bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

[FW] We need wrappers for ProjectModel with events, resources, etc. setters/getters #3982

Open jsakalos opened 2 years ago

jsakalos commented 2 years ago

The ProjectModel will have wrappers that will be easily bindable (and thus reactive) in each framework. For example in React:

<BryntumProject
    ref={project}
    tasks={tasks}
    dependencies={dependencies}
    startDate={startDate}
></BryntumProject>
<BryntumGantt project={project} />

We currently do not have native (vanilla) setters/getters on ProjectModel.

We should support two approaches:

  1. simple: bind data directly to view (not applicable to Gantt)
  2. bind data to project and use that in the view (not applicable to Grid)

Original issue comment:

When initial data is passed to the react wrapper it is ignored. The workaround would be to set data at runtime.

    return (
        <BryntumGantt
            {...ganttConfig}
            ref={gantt}
            tasks={tasks}
            assignments={assignments}
            dependencies={dependencies}
            resources={resources}
            timeRanges={timeRanges}
        />
    );

The following showcase has a boolean flag atRuntime. When the flag is false then the Gantt starts empty. Wrapper ignores the initial values of tasks, dependencies, etc. However, at runtime, the setters handle them correctly.

test-template-app.zip

Related ticket to implement getters/setters in vanilla: https://github.com/bryntum/support/issues/4043

ExtAnimal commented 2 years ago

Related to this: https://github.com/bryntum/support/issues/4040

view/mixin/GanttStores.js needs to define timeRangesStore and its associated data literal timeRanges by adding to the static projectStores property.

This will create the underlying Config definitions, so basic JS code will be able to assign and read timeRanges as expected and it will route through to the Project's timeRangesStore.

Exposing these through TS though is another issue.