@object-ui/plugin-gantt 17.6.0 → 17.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3041 -0
- package/README.md +421 -155
- package/dist/GanttView.d.ts +26 -21
- package/dist/GanttView.d.ts.map +1 -1
- package/dist/ObjectGantt.d.ts +191 -4
- package/dist/ObjectGantt.d.ts.map +1 -1
- package/dist/ResourceWorkload.d.ts +1 -1
- package/dist/ResourceWorkload.d.ts.map +1 -1
- package/dist/index.d.ts +55 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1975 -1680
- package/dist/index.umd.cjs +3 -4
- package/dist/scheduling.d.ts +10 -2
- package/dist/scheduling.d.ts.map +1 -1
- package/dist/tzShift.d.ts +55 -0
- package/dist/tzShift.d.ts.map +1 -0
- package/dist/useGanttTranslation.d.ts.map +1 -1
- package/package.json +16 -13
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Gantt chart plugin for Object UI - Visualize project timelines and task dependen
|
|
|
19
19
|
### Create / Edit / Delete / View
|
|
20
20
|
|
|
21
21
|
When used through `ObjectGantt` (the wiring the framework uses for the
|
|
22
|
-
`gantt` view type) the full CRUD lifecycle is wired automatically:
|
|
22
|
+
`gantt` stored view type) the full CRUD lifecycle is wired automatically:
|
|
23
23
|
|
|
24
24
|
- **Create** — click the toolbar "+ New Task" button. A small dialog opens
|
|
25
25
|
pre-filled with start/end (today → +7 days). On submit the component calls
|
|
@@ -44,26 +44,70 @@ When used through `ObjectGantt` (the wiring the framework uses for the
|
|
|
44
44
|
fetched by `DetailView` itself when `dataSource.getObjectSchema` is
|
|
45
45
|
available).
|
|
46
46
|
|
|
47
|
-
Override
|
|
48
|
-
`{ mode
|
|
49
|
-
|
|
47
|
+
Override it with `navigation` in the `properties` bag — the spec's
|
|
48
|
+
`NavigationConfig`, `{ mode, size, openNewTab, preventNavigation }`. What a
|
|
49
|
+
task click does with each member, measured through the real `SchemaRenderer`
|
|
50
|
+
(objectui#11168 slice 4):
|
|
51
|
+
|
|
52
|
+
- **absent** — the drawer above, this renderer's own default;
|
|
53
|
+
- `drawer`, `modal`, `popover` — the task's record in that overlay; `split` —
|
|
54
|
+
the record beside the chart, which stays drawn;
|
|
55
|
+
- `page`, and a block written without `mode` (the spec's `page` default) —
|
|
56
|
+
the record page in the same tab; `new_window` — the same page in a new tab;
|
|
57
|
+
- `none` — nothing; `preventNavigation: true` — nothing, whatever the mode;
|
|
58
|
+
`openNewTab: true` — the record page in a new tab, outranking every mode
|
|
59
|
+
except `none`; `size` — the overlay width.
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{ "type": "object-gantt", "properties": { "objectName": "project_task", "gantt": { "startDateField": "start_date", "endDateField": "end_date", "titleField": "name" }, "navigation": { "mode": "page" } } }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The record-page address is the gantt's own. It derives it from the page it
|
|
66
|
+
is on and does not use a record navigator the host publishes
|
|
67
|
+
(objectui#11293), so mounting one changes nothing. On the object's own list
|
|
68
|
+
or view route (`…/project_task/view/all`) the address is the record page
|
|
69
|
+
`…/project_task/record/ID`; on any other page, such as a custom page, the
|
|
70
|
+
gantt appends `/project_task/record/ID` to the current address. The object is
|
|
71
|
+
`data.object` when `data` is the object provider, else `objectName`; on
|
|
72
|
+
inline rows that name neither, no mode opens anything, the default drawer
|
|
73
|
+
included.
|
|
74
|
+
|
|
75
|
+
*Which* detail layout opens is not authorable here: assign a `record` page
|
|
76
|
+
to the object and let `isDefault` pick the one that opens. Page assignment
|
|
77
|
+
is what resolves a detail layout; this block only decides **how** that
|
|
78
|
+
detail is surfaced. `navigation`'s schema refuses any key it does not
|
|
79
|
+
declare: an undeclared key rejects the whole config, so the `mode` beside it
|
|
80
|
+
never takes effect either. `@objectstack/spec`'s `NavigationConfigSchema`
|
|
81
|
+
owns the member list.
|
|
50
82
|
|
|
51
83
|
|
|
52
84
|
### Drag-and-drop rescheduling
|
|
53
85
|
|
|
54
86
|
When the renderer is used through `ObjectGantt` (the standard wiring used by
|
|
55
|
-
the framework's `gantt` view type) drag is enabled automatically: each bar
|
|
87
|
+
the framework's `gantt` stored view type) drag is enabled automatically: each bar
|
|
56
88
|
shows a grab cursor; the body drags the entire task, and the two thin edge
|
|
57
89
|
zones (≈6px) resize start or end. Pointer motion snaps to whole days using
|
|
58
|
-
the current column width.
|
|
59
|
-
|
|
90
|
+
the current column width. A move shifts the start and the end by the same
|
|
91
|
+
number of calendar days and keeps each one's time of day, so across a
|
|
92
|
+
daylight-saving change a day task keeps its length in days and a 10:00 start
|
|
93
|
+
stays at 10:00; dragging a summary moves every task beneath it the same way.
|
|
94
|
+
With shift bands configured (`timeSegments`), a day-view drag moves by bands
|
|
95
|
+
instead and keeps the bar's elapsed length. On release `ObjectGantt` issues an
|
|
96
|
+
optimistic local patch and a `dataSource.update(objectName, recordId, { [startDateField]: …,
|
|
60
97
|
[endDateField]: … })`. If the request fails the local state is reverted.
|
|
61
98
|
|
|
62
99
|
When you embed the lower-level `<GanttView>` directly, pass `onTaskUpdate`
|
|
63
100
|
to opt in:
|
|
64
101
|
|
|
65
102
|
```tsx
|
|
66
|
-
|
|
103
|
+
import { GanttView } from '@object-ui/plugin-gantt';
|
|
104
|
+
import type { GanttTask } from '@object-ui/plugin-gantt';
|
|
105
|
+
|
|
106
|
+
// `tasks` is whatever you loaded; `save` stands in for your own write path.
|
|
107
|
+
declare const tasks: GanttTask[];
|
|
108
|
+
declare const save: (id: GanttTask['id'], changes: { start: Date; end: Date }) => void;
|
|
109
|
+
|
|
110
|
+
const editableChart = <GanttView
|
|
67
111
|
tasks={tasks}
|
|
68
112
|
onTaskUpdate={(task, { start, end }) => {
|
|
69
113
|
// `changes` is a Partial<Pick<GanttTask, 'title' | 'start' | 'end' | 'progress'>>:
|
|
@@ -73,7 +117,7 @@ to opt in:
|
|
|
73
117
|
if (!start || !end) return;
|
|
74
118
|
save(task.id, { start, end });
|
|
75
119
|
}}
|
|
76
|
-
|
|
120
|
+
/>;
|
|
77
121
|
```
|
|
78
122
|
|
|
79
123
|
## Installation
|
|
@@ -92,14 +136,19 @@ import '@object-ui/plugin-gantt';
|
|
|
92
136
|
|
|
93
137
|
// Now you can use gantt types in your schemas.
|
|
94
138
|
// The gantt is RECORD-DRIVEN: it names a data source and the fields to read.
|
|
95
|
-
// It does not take a task array — see "Schema API" below.
|
|
139
|
+
// It does not take a task array — see "Schema API" below. Its props go in the
|
|
140
|
+
// node's `properties` bag, and its field mapping in the bag's `gantt` block.
|
|
96
141
|
const schema = {
|
|
97
|
-
type: 'gantt',
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
142
|
+
type: 'object-gantt',
|
|
143
|
+
properties: {
|
|
144
|
+
objectName: 'project_tasks',
|
|
145
|
+
gantt: {
|
|
146
|
+
titleField: 'name',
|
|
147
|
+
startDateField: 'start_date',
|
|
148
|
+
endDateField: 'end_date',
|
|
149
|
+
progressField: 'completion_percentage'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
103
152
|
};
|
|
104
153
|
```
|
|
105
154
|
|
|
@@ -114,11 +163,27 @@ claim these schema types:
|
|
|
114
163
|
| Schema `type` | Namespaced key | Renderer |
|
|
115
164
|
| --- | --- | --- |
|
|
116
165
|
| `object-gantt` | `plugin-gantt:object-gantt` | `ObjectGanttRenderer` |
|
|
117
|
-
| `gantt` | `view:gantt` | `ObjectGanttRenderer` |
|
|
118
166
|
|
|
119
|
-
Both spellings resolve — `register` stores the namespaced key
|
|
120
|
-
|
|
121
|
-
`
|
|
167
|
+
Both spellings of the surviving key resolve — `register` stores the namespaced key
|
|
168
|
+
*and* a bare-`type` fallback. It declares four inputs: `objectName`, the `gantt`
|
|
169
|
+
configuration object, and the two other record sources, `data` and `staticData`.
|
|
170
|
+
`objectName` is not a required input: the record source is one of `data`,
|
|
171
|
+
`staticData` and `objectName` (read in that order), and the `object-gantt` schema
|
|
172
|
+
refuses a block that declares none of them, unless the node's `dataSource.object`
|
|
173
|
+
names the object, which the registration then lands on `objectName`. `data` is a
|
|
174
|
+
`{ provider, … }` data-source configuration, never a bare array; inline rows go
|
|
175
|
+
under `staticData`.
|
|
176
|
+
|
|
177
|
+
> **The bare `gantt` key is retired** (objectui#8008, ruled 2026-09-09). This
|
|
178
|
+
> table used to carry a second row, `gantt` / `view:gantt`, on the same renderer.
|
|
179
|
+
> The registry accepted both spellings while the published declaration admitted
|
|
180
|
+
> only one — `ObjectGanttSchema.type` is the literal `'object-gantt'` — so an
|
|
181
|
+
> author who annotated their node could not write the key the registry took.
|
|
182
|
+
> `object-gantt` is now the one spelling.
|
|
183
|
+
>
|
|
184
|
+
> ⚠️ The **stored view type** `"gantt"` — what a saved `listViews[].type` holds —
|
|
185
|
+
> is a **different layer and is unchanged**. `ObjectView` maps a stored `gantt`
|
|
186
|
+
> view onto the `object-gantt` node type, so no saved view moves.
|
|
122
187
|
|
|
123
188
|
`ObjectGanttRenderer` is a thin wrapper: it pulls `dataSource` off the renderer
|
|
124
189
|
context and hands the schema to `ObjectGantt`.
|
|
@@ -130,7 +195,7 @@ The package exports components, helpers and their types — not a registry map:
|
|
|
130
195
|
```typescript
|
|
131
196
|
import {
|
|
132
197
|
ObjectGantt, // ObjectQL-integrated gantt: loads records, writes back edits
|
|
133
|
-
ObjectGanttRenderer, // the registered renderer for `object-gantt`
|
|
198
|
+
ObjectGanttRenderer, // the registered renderer for `object-gantt`
|
|
134
199
|
GanttView, // the standalone timeline component
|
|
135
200
|
QuickFilterBar, // the toolbar's quick-filter dropdowns
|
|
136
201
|
ResourceWorkload, // resource × period workload grid
|
|
@@ -191,6 +256,16 @@ The gantt node is **record-driven**: it names *where records come from* and
|
|
|
191
256
|
objects further down this page are the component's runtime shape, produced by
|
|
192
257
|
`ObjectGantt` from each record.
|
|
193
258
|
|
|
259
|
+
An authored node takes its props in its `properties` bag, whose members are
|
|
260
|
+
`@objectstack/spec`'s `ComponentPropsMap['object-gantt']` row, and its field
|
|
261
|
+
mapping in the bag's `gantt` block. `objectui validate` judges the bag against
|
|
262
|
+
that row and refuses a prop written flat on the node by name, naming where it
|
|
263
|
+
goes (`Did you mean objectName → properties.objectName?`, or
|
|
264
|
+
`startDateField → properties.gantt.startDateField`), as the spec's own page
|
|
265
|
+
component does (objectui#10859). `SchemaRenderer` hoists the bag onto the node
|
|
266
|
+
before `ObjectGantt` runs, so the reads below are the same for both: the
|
|
267
|
+
renderer sees the hoisted node.
|
|
268
|
+
|
|
194
269
|
`ObjectGantt` decides what to render from exactly two reads
|
|
195
270
|
(`src/ObjectGantt.tsx`):
|
|
196
271
|
|
|
@@ -199,58 +274,90 @@ that is present wins; if none is present there is no data config at all and the
|
|
|
199
274
|
chart renders empty:
|
|
200
275
|
|
|
201
276
|
```typescript
|
|
202
|
-
{
|
|
203
|
-
type: 'gantt',
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
277
|
+
const recordSource = {
|
|
278
|
+
type: 'object-gantt',
|
|
279
|
+
properties: {
|
|
280
|
+
// Pick ONE of the three:
|
|
281
|
+
objectName: 'project_tasks', // load through the host DataSource
|
|
282
|
+
// data: { provider: 'value', items: [ /* records */ ] }, // inline records
|
|
283
|
+
// staticData: [ /* records */ ], // shorthand for the above
|
|
284
|
+
},
|
|
285
|
+
// …or name the object in the node's `dataSource` binding instead of `objectName`:
|
|
286
|
+
// dataSource: { object: 'project_tasks' },
|
|
287
|
+
};
|
|
210
288
|
```
|
|
211
289
|
|
|
212
|
-
`data` is the spec's `ViewData` union
|
|
213
|
-
`{ provider: '
|
|
214
|
-
`{ provider: 'schema', schemaId }
|
|
290
|
+
`data` is the spec's `ViewData` union. This chart reads three of its arms:
|
|
291
|
+
`{ provider: 'object', object }`, `{ provider: 'value', items }` and
|
|
292
|
+
`{ provider: 'api', read, write }`. The fourth, `{ provider: 'schema', schemaId }`,
|
|
293
|
+
is accepted by the spec and is not a source this chart reads: measured, a gantt
|
|
294
|
+
carrying it queries `objectName` instead.
|
|
295
|
+
|
|
296
|
+
**The provider does not change which query keys apply.** An authored `filter`
|
|
297
|
+
and `sort` narrow and order the rows on **every** provider, inline ones
|
|
298
|
+
included, and the platform row ceiling (2,000 drawn rows, with a footnote
|
|
299
|
+
naming both numbers) applies to all of them — inline rows cost the browser what
|
|
300
|
+
fetched rows cost. Inline rows go through the same in-memory adapter the other
|
|
301
|
+
providers go through, so `filter` is evaluated with the same matcher and the
|
|
302
|
+
ceiling is applied to the **filtered** set, never to the raw one. Before
|
|
303
|
+
objectui#8769 the inline provider skipped that query and drew every authored
|
|
304
|
+
row with an authored `filter` silently dropped.
|
|
305
|
+
|
|
306
|
+
The same holds for the full-text pair: `search` is sent as `$search`, and
|
|
307
|
+
`searchableFields` as `$searchFields` alongside it (never without a term). A
|
|
308
|
+
list view's toolbar Search box writes both onto the gantt node it composes — the
|
|
309
|
+
chart runs its own query, so the node is the only way the term reaches it. They
|
|
310
|
+
are not authored keys: the spec's row does not declare them, so `objectui
|
|
311
|
+
validate` refuses them in the bag.
|
|
215
312
|
|
|
216
313
|
**2. How the fields map — `getGanttConfig`.** Two spellings, checked in order.
|
|
217
|
-
|
|
218
|
-
|
|
314
|
+
The **`gantt` block wins whenever it is present**, and it is taken WHOLE — the
|
|
315
|
+
flat top-level keys are not merged into it. The flat spelling is read only when
|
|
316
|
+
there is no `gantt` block, and then only when `startDateField` and
|
|
317
|
+
`endDateField` are both present. A node carrying both spellings renders the
|
|
318
|
+
block's values and gets a dev-mode warning naming the ignored top-level keys.
|
|
319
|
+
**Author the `gantt` block**: the flat spelling is the runtime handoff
|
|
320
|
+
`ObjectView` and `ListView` write onto the node they compose, and an authored
|
|
321
|
+
node cannot carry it — `objectui validate` refuses each flat key and names
|
|
322
|
+
`properties.gantt.KEY`, and the spec's row refuses it inside the bag too.
|
|
323
|
+
|
|
324
|
+
Precedence follows the maintainer ruling on objectui#5018 (2026-08-17), which
|
|
325
|
+
settled the identical two-faces shape for `plugin-map`; objectui#6469 inherited
|
|
326
|
+
it here. Before that flip the flat branch returned first, so an authored `gantt`
|
|
327
|
+
block was discarded silently.
|
|
219
328
|
|
|
220
329
|
```typescript
|
|
221
|
-
{
|
|
222
|
-
type: 'gantt',
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
330
|
+
const fieldMapping = {
|
|
331
|
+
type: 'object-gantt',
|
|
332
|
+
properties: {
|
|
333
|
+
objectName: 'project_tasks',
|
|
334
|
+
gantt: {
|
|
335
|
+
startDateField: 'start_date',
|
|
336
|
+
endDateField: 'end_date',
|
|
337
|
+
titleField: 'name',
|
|
338
|
+
progressField: 'completion_percentage',
|
|
339
|
+
dependenciesField: 'dependent_task_ids',
|
|
340
|
+
colorField: 'bar_color',
|
|
341
|
+
parentField: 'parent_task',
|
|
342
|
+
typeField: 'task_kind',
|
|
343
|
+
viewMode: 'week', // 'day'|'week'|'month'|'quarter'|'year'
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
};
|
|
239
347
|
```
|
|
240
348
|
|
|
241
|
-
`viewMode` is real authoring surface (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
layout then seeds the granularity before the renderer's `'day'` fallback.
|
|
349
|
+
`viewMode` is real authoring surface (a member of the spec's `GanttConfigSchema`,
|
|
350
|
+
so of the `gantt` block) and is honoured by **both** renderer branches — the
|
|
351
|
+
timeline and the resource-workload grid. It reaches the renderer through
|
|
352
|
+
`getGanttConfig`, so it only takes effect alongside a taken gantt config.
|
|
353
|
+
Omitting it is meaningful — a persisted layout then seeds the granularity before
|
|
354
|
+
the renderer's `'day'` fallback.
|
|
248
355
|
|
|
249
356
|
#### Keys this page used to teach that the renderer never reads
|
|
250
357
|
|
|
251
358
|
Earlier revisions of this README showed a task-array schema. Those keys have no
|
|
252
359
|
read site anywhere in `src/` — a schema built from them renders an **empty
|
|
253
|
-
chart with no diagnostic**, because `type: 'gantt'` *is* a registered type, so
|
|
360
|
+
chart with no diagnostic**, because `type: 'object-gantt'` *is* a registered type, so
|
|
254
361
|
the node mounts and simply finds nothing to draw:
|
|
255
362
|
|
|
256
363
|
| Key shown before | Status | Use instead |
|
|
@@ -260,15 +367,111 @@ the node mounts and simply finds nothing to draw:
|
|
|
260
367
|
| `nameField` | never read | `titleField` |
|
|
261
368
|
| `startField` | never read | `startDateField` |
|
|
262
369
|
| `endField` | never read | `endDateField` |
|
|
263
|
-
| `fields: { name, start, end, … }` | never read | the
|
|
370
|
+
| `fields: { name, start, end, … }` | never read | the `gantt` block |
|
|
264
371
|
| `onTaskClick`, `onTaskUpdate` | never read *off the schema* | React props on `<ObjectGantt>` / `<GanttView>` — functions do not belong in serializable metadata |
|
|
265
372
|
| `className` | never read off the schema | a React prop on `<ObjectGantt>` |
|
|
266
373
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
374
|
+
The keys the renderer reads beside `gantt` — `readOnly`, `mobileReadOnly`,
|
|
375
|
+
`markers`, `navigation`, `skipWeekends`, `holidays`, `criticalPath`,
|
|
376
|
+
`showBaselines`, `persistLayout` / `viewName` and `label` — are all optional,
|
|
377
|
+
all declared by the spec's `object-gantt` row, and all published by the
|
|
378
|
+
registration since objectui#11168 slice 4. Each is described in the table
|
|
379
|
+
below.
|
|
380
|
+
|
|
381
|
+
#### Full field-mapping reference (`GanttConfig` members)
|
|
382
|
+
|
|
383
|
+
`titleField` / `startDateField` / `endDateField` are required; everything below
|
|
384
|
+
is optional. Set them INSIDE the `gantt` block — beside a `gantt` block a
|
|
385
|
+
top-level copy is ignored (with a dev-mode warning naming the losing keys), and
|
|
386
|
+
on an authored node `objectui validate` refuses it.
|
|
387
|
+
|
|
388
|
+
| Key (under `gantt`) | Effect |
|
|
389
|
+
| --- | --- |
|
|
390
|
+
| `parentField` | Builds the summary tree: parents roll up their children's span and weighted progress. |
|
|
391
|
+
| `typeField` | Distinguishes `task` / `summary` (aliases `project`, `phase`) / `milestone` / `group` (alias `folder`). A `group` row renders as a **pure tree header with no timeline bar** — expandable like a summary but never scheduled, for grouping-only levels that have no dates of their own. `summary` still renders a bar-carrying rollup bracket. |
|
|
392
|
+
| `lockField` | Marks a row **view-only** when the field is truthy: no bar drag/resize, no progress drag, no dependency connector dot, and inline-edit plus context-menu edit/delete are hidden. Clicking still works (open drawer / jump). Independent of `readOnly`, so one level of a tree can be frozen while its siblings stay editable. |
|
|
393
|
+
| `defaultCollapsedDepth` | Auto-collapse every tree node at or below this 0-indexed depth that has children, on first render. Roots are depth 0; the user can still expand any of them, this only seeds the initial state. In a 4-level tree, `2` starts with every level-2 node (and its children) folded. Omit to start fully expanded. |
|
|
394
|
+
| `dependenciesField` | Draws the dependency arrows. Accepts CSV, an id array, or `[{ id, type: 'fs'\|'ss'\|'ff'\|'sf' }]`. Setting it also makes links **editable** unless `readOnly`: drag a bar's connector dot to create an FS link, right-click a link to switch its type or remove it, right-click a bar to add a predecessor or successor. Every change is written back to the field, which is auto-promoted to the `[{ id, type }]` form the moment a non-FS link is stored. |
|
|
395
|
+
| `tooltipFields` | The hover detail. Each entry is a field name or `{ field, label }`, formatted by field type. |
|
|
396
|
+
| `baselineStartField` / `baselineEndField` | Draw a thin planned-vs-actual baseline strip under each bar. |
|
|
397
|
+
| `groupByField` | Swimlane the rows by any field — a select/lookup label or a raw value; empty values fall into an "ungrouped" bucket. |
|
|
398
|
+
| `colorField` | Field whose value picks the bar colour. |
|
|
399
|
+
| `resourceView: true` | Render the **resource / workload view** instead of the task grid: one row per resource with a per-column load histogram. Requires `assigneeField` to bucket tasks. |
|
|
400
|
+
| `assigneeField` / `effortField` / `capacity` | Resource bucketing (required for `resourceView`), per-task workload weight (default `1`), and the per-resource capacity ceiling (default `1`). Any column whose summed load exceeds `capacity` is painted as over-allocated. |
|
|
401
|
+
| `quickFilters: [{ field, label?, options? }]` | Render a quick-filter bar above the grid — one multi-select dropdown per entry, narrowing the visible bars by that field (AND across dimensions). Option lists resolve in priority order: explicit `options` → the object schema's `select`/`enum` options (the full domain) → a `lookup` / `master_detail`'s referenced records (pulled in full through the data source, so values with **no** tasks still appear) → distinct values from the loaded data. Lookup values match on the embedded record id. Selecting every option of a dimension collapses to "no constraint". |
|
|
402
|
+
| `autoZoomToFilter` | When a quick filter narrows the set, re-derive the timeline range from the **remaining** tasks so the axis zooms to the filtered span (default `true`). Set `false` to pin the axis to the full task span, so bars keep their absolute position while filtering. |
|
|
403
|
+
| `viewMode` | Initial granularity, `'day'` (default) / `'week'` / `'month'` / `'quarter'` / `'year'`; the toolbar switches it live. `year` widens the axis to one column per year with a decade band above. |
|
|
404
|
+
|
|
405
|
+
With links present, dragging a bar into a position that violates a dependency
|
|
406
|
+
raises a reschedule confirmation: accepting runs a topological forward pass
|
|
407
|
+
(link-type aware; summaries stay fixed rollups) over the affected tasks,
|
|
408
|
+
declining keeps the manual placement. This is on by default whenever
|
|
409
|
+
`dependenciesField` is set, and suppressed under `readOnly`.
|
|
410
|
+
|
|
411
|
+
#### Node-level display and behaviour options
|
|
412
|
+
|
|
413
|
+
True siblings of `gantt` in the `properties` bag, not `GanttConfig` members.
|
|
414
|
+
|
|
415
|
+
| Key (in `properties`, beside `gantt`) | Effect |
|
|
416
|
+
| --- | --- |
|
|
417
|
+
| `criticalPath: true` | Start with the critical-path (zero-slack chain) highlight on; the toolbar toggle stays available. |
|
|
418
|
+
| `showBaselines: false` | Hide the baseline strips even when baseline fields are mapped (default `true`). |
|
|
419
|
+
| `skipWeekends: true` | Working-calendar math: auto-schedule and critical path count working days only, and reschedules snap off Sat/Sun. In **day mode** this also folds weekend columns out of the timeline — Friday sits against Monday and a one-column drag advances one working day. Coarser scales stay linear. |
|
|
420
|
+
| `holidays: ["yyyy-mm-dd", …]` | Extra non-working days for the working calendar, combined with or instead of `skipWeekends`. In day mode these columns fold out of the axis too. |
|
|
421
|
+
| `markers: [{ date, label?, color? }]` | Extra vertical marker lines, like the Today line. `label` is drawn against the line and `color` paints it (the theme's primary colour when omitted); a date outside the chart's range draws no line. |
|
|
422
|
+
| `persistLayout: false` | Disable layout persistence. By default the toolbar's save-layout button snapshots the current granularity, zoom and task-list collapse state, plus the quick-filter chips, to `localStorage` (key `gantt-layout:OBJECT:VIEW`) and restores it on the next load. `OBJECT` is `objectName`, else `data.object`, and `gantt` on inline rows that name neither. With `false` there is no save-layout button and nothing is stored. |
|
|
423
|
+
| `viewName: "board"` | The `VIEW` half of that key (default `default`). Two gantts on the same object with different names keep separate layouts, and each restores only its own. |
|
|
424
|
+
| `readOnly: true` | **Disable every edit path** — no bar drag/resize/progress, no inline edit, no delete, no dependency-link drag, no reorder, no auto-schedule, and the Undo/Redo buttons are hidden. A read-only badge shows in the toolbar and the right-click menu drops to view-only (or is suppressed when nothing is actionable). Task click and granularity switching still work. Use it for dashboards and shared read-only views. |
|
|
425
|
+
| `mobileReadOnly: false` | When the chart is narrow (under 640 px of its own measured width, or of the viewport until that is measured) it auto-enters read-only, giving touch users a clean scrollable thumbnail — the chart's write paths are gated as under `readOnly`, applied only while narrow. The record drawer is not: it locks under `readOnly` alone, so a task's record still opens writable on a narrow chart. Enabled by default; `false` keeps a narrow chart editable, and `readOnly: true` locks the chart and the drawer at any width. |
|
|
426
|
+
| `label` | Names the exported PNG/PDF file: the link after `gantt.exportFileName` and before the object's own label, then `objectName`. A string, or an inline locale map (`{ "en": …, "zh-CN": … }`) resolved to the display locale. The chart draws it nowhere else. |
|
|
427
|
+
| `navigation` | What a task click opens — see **Create / Edit / Delete / View** above. |
|
|
428
|
+
|
|
429
|
+
The toolbar also carries **navigation** (jump-to-today / this-week / this-month
|
|
430
|
+
buttons that scroll the timeline to the start of that period) and **export**
|
|
431
|
+
(PNG, plus a dependency-free single-page PDF of the whole chart), always
|
|
432
|
+
available regardless of `readOnly`. Each task-list row carries a **locate** icon
|
|
433
|
+
by its End cell that smooth-scrolls the timeline to centre that row's bar and
|
|
434
|
+
pulses it — useful in deep or long trees.
|
|
435
|
+
|
|
436
|
+
#### A maximal node, for reference
|
|
437
|
+
|
|
438
|
+
```json
|
|
439
|
+
{
|
|
440
|
+
"type": "object-gantt",
|
|
441
|
+
"properties": {
|
|
442
|
+
"objectName": "project_task",
|
|
443
|
+
"gantt": {
|
|
444
|
+
"titleField": "name",
|
|
445
|
+
"startDateField": "start_date",
|
|
446
|
+
"endDateField": "end_date",
|
|
447
|
+
"progressField": "progress",
|
|
448
|
+
"parentField": "parent_id",
|
|
449
|
+
"dependenciesField": "depends_on",
|
|
450
|
+
"typeField": "item_type",
|
|
451
|
+
"lockField": "is_locked",
|
|
452
|
+
"defaultCollapsedDepth": 2,
|
|
453
|
+
"colorField": "status",
|
|
454
|
+
"baselineStartField": "planned_start",
|
|
455
|
+
"baselineEndField": "planned_end",
|
|
456
|
+
"tooltipFields": [{ "field": "owner", "label": "Owner" }, "status", "effort"],
|
|
457
|
+
"groupByField": "owner",
|
|
458
|
+
"assigneeField": "owner",
|
|
459
|
+
"effortField": "effort",
|
|
460
|
+
"quickFilters": [
|
|
461
|
+
{ "field": "status", "label": "Status" },
|
|
462
|
+
{ "field": "project", "label": "Project" },
|
|
463
|
+
{ "field": "priority", "label": "Priority", "options": ["high", "medium", "low"] }
|
|
464
|
+
],
|
|
465
|
+
"autoZoomToFilter": true
|
|
466
|
+
},
|
|
467
|
+
"criticalPath": true,
|
|
468
|
+
"skipWeekends": true,
|
|
469
|
+
"holidays": ["2026-01-01", "2026-12-25"],
|
|
470
|
+
"readOnly": false
|
|
471
|
+
},
|
|
472
|
+
"bind": "project_task"
|
|
473
|
+
}
|
|
474
|
+
```
|
|
272
475
|
|
|
273
476
|
### Task Structure
|
|
274
477
|
|
|
@@ -276,7 +479,10 @@ path — drag/resize/inline/delete/link/undo), `mobileReadOnly`, `markers`,
|
|
|
276
479
|
what `ObjectGantt` produces from each record. Dates are real `Date` objects and
|
|
277
480
|
the label field is `title` (`src/GanttView.tsx`):
|
|
278
481
|
|
|
482
|
+
<!-- readme-exports: partial GanttTask — deliberate excerpt: `fields` and `hasOwnDates` are populated by ObjectGantt itself, as the paragraph below the block says -->
|
|
279
483
|
```typescript
|
|
484
|
+
import type { GanttDependency, GanttTaskType } from '@object-ui/plugin-gantt';
|
|
485
|
+
|
|
280
486
|
interface GanttTask {
|
|
281
487
|
id: string | number;
|
|
282
488
|
title: string;
|
|
@@ -304,60 +510,64 @@ the full declaration.
|
|
|
304
510
|
### Basic Gantt Chart
|
|
305
511
|
|
|
306
512
|
Inline records, no backend — `data.items` carries the records and the `*Field`
|
|
307
|
-
keys say which of their fields the chart reads. Note that
|
|
308
|
-
names are yours; only the `*Field` keys are fixed vocabulary.
|
|
513
|
+
keys of the `gantt` block say which of their fields the chart reads. Note that
|
|
514
|
+
the record field names are yours; only the `*Field` keys are fixed vocabulary.
|
|
309
515
|
|
|
310
516
|
```typescript
|
|
311
517
|
const schema = {
|
|
312
|
-
type: 'gantt',
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
518
|
+
type: 'object-gantt',
|
|
519
|
+
properties: {
|
|
520
|
+
gantt: {
|
|
521
|
+
viewMode: 'week',
|
|
522
|
+
startDateField: 'start',
|
|
523
|
+
endDateField: 'end',
|
|
524
|
+
titleField: 'name',
|
|
525
|
+
progressField: 'progress',
|
|
526
|
+
dependenciesField: 'dependencies',
|
|
527
|
+
colorField: 'color',
|
|
528
|
+
},
|
|
529
|
+
data: {
|
|
530
|
+
provider: 'value',
|
|
531
|
+
items: [
|
|
532
|
+
{
|
|
533
|
+
id: '1',
|
|
534
|
+
name: 'Project Planning',
|
|
535
|
+
start: '2024-01-01',
|
|
536
|
+
end: '2024-01-07',
|
|
537
|
+
progress: 100,
|
|
538
|
+
// bar fill goes straight into an inline `backgroundColor` —
|
|
539
|
+
// it must be a CSS color, NOT a Tailwind class
|
|
540
|
+
color: '#3b82f6'
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: '2',
|
|
544
|
+
name: 'Design Phase',
|
|
545
|
+
start: '2024-01-08',
|
|
546
|
+
end: '2024-01-21',
|
|
547
|
+
progress: 75,
|
|
548
|
+
dependencies: ['1'],
|
|
549
|
+
color: '#a855f7'
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
id: '3',
|
|
553
|
+
name: 'Development',
|
|
554
|
+
start: '2024-01-22',
|
|
555
|
+
end: '2024-02-15',
|
|
556
|
+
progress: 30,
|
|
557
|
+
dependencies: ['2'],
|
|
558
|
+
color: '#22c55e'
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
id: '4',
|
|
562
|
+
name: 'Testing',
|
|
563
|
+
start: '2024-02-16',
|
|
564
|
+
end: '2024-02-28',
|
|
565
|
+
progress: 0,
|
|
566
|
+
dependencies: ['3'],
|
|
567
|
+
color: '#f97316'
|
|
568
|
+
}
|
|
569
|
+
]
|
|
570
|
+
}
|
|
361
571
|
}
|
|
362
572
|
};
|
|
363
573
|
```
|
|
@@ -368,14 +578,22 @@ Callbacks are **not** schema keys — the schema is serializable metadata, and a
|
|
|
368
578
|
function cannot survive it. Through the registered `gantt` / `object-gantt`
|
|
369
579
|
types the whole CRUD lifecycle is already wired to the host `DataSource`
|
|
370
580
|
(create/edit/drag/delete/detail drawer), so there is usually nothing to pass.
|
|
371
|
-
When you render the component yourself, hand the callbacks in as React props
|
|
581
|
+
When you render the component yourself, hand the callbacks in as React props.
|
|
582
|
+
A component mounted without `SchemaRenderer` receives the node as it reads it,
|
|
583
|
+
so its `schema` prop keeps its props on the node: nothing hoists a `properties`
|
|
584
|
+
bag there.
|
|
372
585
|
|
|
373
586
|
```tsx
|
|
374
587
|
import { ObjectGantt } from '@object-ui/plugin-gantt';
|
|
588
|
+
import type { DataSource } from '@object-ui/types';
|
|
589
|
+
|
|
590
|
+
// The adapter your host already talks to — see "Integration with Data
|
|
591
|
+
// Sources" below for where it comes from.
|
|
592
|
+
declare const dataSource: DataSource;
|
|
375
593
|
|
|
376
|
-
<ObjectGantt
|
|
594
|
+
const interactiveChart = <ObjectGantt
|
|
377
595
|
schema={{
|
|
378
|
-
type: 'gantt',
|
|
596
|
+
type: 'object-gantt',
|
|
379
597
|
objectName: 'project_tasks',
|
|
380
598
|
startDateField: 'start_date',
|
|
381
599
|
endDateField: 'end_date',
|
|
@@ -383,23 +601,28 @@ import { ObjectGantt } from '@object-ui/plugin-gantt';
|
|
|
383
601
|
}}
|
|
384
602
|
dataSource={dataSource}
|
|
385
603
|
onTaskClick={(record) => console.log('Task clicked:', record)}
|
|
386
|
-
|
|
604
|
+
/>;
|
|
387
605
|
```
|
|
388
606
|
|
|
389
|
-
To turn editing off from the metadata instead, set `readOnly: true`
|
|
390
|
-
schema — that one *is*
|
|
607
|
+
To turn editing off from the metadata instead, set `readOnly: true` — in the
|
|
608
|
+
`properties` bag of an authored node, or on the schema you mount — that one *is*
|
|
609
|
+
read.
|
|
391
610
|
|
|
392
611
|
### With ObjectQL Integration
|
|
393
612
|
|
|
394
613
|
```typescript
|
|
395
614
|
const schema = {
|
|
396
615
|
type: 'object-gantt',
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
616
|
+
properties: {
|
|
617
|
+
objectName: 'project_tasks',
|
|
618
|
+
gantt: {
|
|
619
|
+
titleField: 'name',
|
|
620
|
+
startDateField: 'start_date',
|
|
621
|
+
endDateField: 'end_date',
|
|
622
|
+
progressField: 'completion_percentage',
|
|
623
|
+
dependenciesField: 'dependent_task_ids'
|
|
624
|
+
}
|
|
625
|
+
}
|
|
403
626
|
};
|
|
404
627
|
```
|
|
405
628
|
|
|
@@ -421,17 +644,36 @@ Drag snapping follows the active scale: bars snap to days in day view, weeks
|
|
|
421
644
|
in week view, and whole calendar months/quarters (duration preserved) in the
|
|
422
645
|
coarse views.
|
|
423
646
|
|
|
424
|
-
|
|
425
|
-
|
|
647
|
+
### The toolbar period label and its steppers
|
|
648
|
+
|
|
649
|
+
The label between the `‹` / `›` buttons names the period **currently on screen**,
|
|
650
|
+
not the extent of the data: it reads the date at the left edge of the viewport
|
|
651
|
+
and snaps it to the same tier the band header groups by — a month under day and
|
|
652
|
+
week view, a year under month and quarter view, a decade under year view, and
|
|
653
|
+
the shift-day under shift-segmented day view. So the label and the band header
|
|
654
|
+
directly beneath it always name the same period, and the label moves as the
|
|
655
|
+
chart is scrolled.
|
|
656
|
+
|
|
657
|
+
`‹` / `›` step the visible window by one of those periods (one month in day and
|
|
658
|
+
week view, one year in month and quarter view, a decade in year view), clamped
|
|
659
|
+
to the ends of the timeline. They step the *label's* tier rather than a single
|
|
660
|
+
column, so one click always changes what the label says.
|
|
661
|
+
|
|
662
|
+
Set the initial scale with `viewMode`, a member of the `gantt` block, beside
|
|
663
|
+
the field mapping:
|
|
426
664
|
|
|
427
665
|
```typescript
|
|
428
666
|
const schema = {
|
|
429
|
-
type: 'gantt',
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
667
|
+
type: 'object-gantt',
|
|
668
|
+
properties: {
|
|
669
|
+
objectName: 'project_tasks',
|
|
670
|
+
gantt: {
|
|
671
|
+
viewMode: 'month',
|
|
672
|
+
startDateField: 'start_date',
|
|
673
|
+
endDateField: 'end_date',
|
|
674
|
+
titleField: 'name'
|
|
675
|
+
}
|
|
676
|
+
}
|
|
435
677
|
};
|
|
436
678
|
```
|
|
437
679
|
|
|
@@ -504,16 +746,22 @@ Two more chrome features ship with it:
|
|
|
504
746
|
- **Custom markers** — vertical reference lines beyond the Today marker:
|
|
505
747
|
|
|
506
748
|
```tsx
|
|
507
|
-
|
|
749
|
+
import { GanttView } from '@object-ui/plugin-gantt';
|
|
750
|
+
import type { GanttTask } from '@object-ui/plugin-gantt';
|
|
751
|
+
|
|
752
|
+
declare const tasks: GanttTask[];
|
|
753
|
+
|
|
754
|
+
const chartWithMarkers = <GanttView
|
|
508
755
|
tasks={tasks}
|
|
509
756
|
markers={[
|
|
510
757
|
{ date: '2026-07-01', label: 'Code freeze', color: '#ef4444' },
|
|
511
758
|
{ date: '2026-07-15', label: 'Release' }, // defaults to the primary theme color
|
|
512
759
|
]}
|
|
513
|
-
|
|
760
|
+
/>;
|
|
514
761
|
```
|
|
515
762
|
|
|
516
|
-
Through the schema, pass the same array as `markers`
|
|
763
|
+
Through the schema, pass the same array as `markers` in the gantt node's
|
|
764
|
+
`properties` bag.
|
|
517
765
|
|
|
518
766
|
## Task Dependencies
|
|
519
767
|
|
|
@@ -578,18 +826,22 @@ be a CSV string (`"task1, task2"`), an array of ids, or an array of objects —
|
|
|
578
826
|
|
|
579
827
|
The adapter is **not** a schema key — it reaches the renderer through the
|
|
580
828
|
renderer context (or as an explicit `dataSource` prop), while the schema names
|
|
581
|
-
the object and the fields
|
|
829
|
+
the object and the fields. Mounted directly as below, `ObjectGantt` takes the
|
|
830
|
+
node as it reads it, typed `ObjectGanttSchema`, with its props on the node;
|
|
831
|
+
through `SchemaRenderer` the same props go in the authored node's `properties`
|
|
832
|
+
bag:
|
|
582
833
|
|
|
583
834
|
```tsx
|
|
584
835
|
import { createObjectStackAdapter } from '@object-ui/data-objectstack';
|
|
585
836
|
import { ObjectGantt } from '@object-ui/plugin-gantt';
|
|
837
|
+
import type { ObjectGanttSchema } from '@object-ui/types';
|
|
586
838
|
|
|
587
839
|
const dataSource = createObjectStackAdapter({
|
|
588
840
|
baseUrl: 'https://api.example.com',
|
|
589
841
|
token: 'your-auth-token'
|
|
590
842
|
});
|
|
591
843
|
|
|
592
|
-
const schema = {
|
|
844
|
+
const schema: ObjectGanttSchema = {
|
|
593
845
|
type: 'object-gantt',
|
|
594
846
|
objectName: 'tasks',
|
|
595
847
|
titleField: 'task_name',
|
|
@@ -598,7 +850,7 @@ const schema = {
|
|
|
598
850
|
progressField: 'progress_percent'
|
|
599
851
|
};
|
|
600
852
|
|
|
601
|
-
<ObjectGantt schema={schema} dataSource={dataSource}
|
|
853
|
+
const ganttWithAdapter = <ObjectGantt schema={schema} dataSource={dataSource} />;
|
|
602
854
|
```
|
|
603
855
|
|
|
604
856
|
⚠️ A `dataSource` key **on the schema node** is a different thing with the same
|
|
@@ -632,25 +884,39 @@ const props: GanttViewProps = {
|
|
|
632
884
|
};
|
|
633
885
|
```
|
|
634
886
|
|
|
635
|
-
**The authored (JSON metadata)
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
object and the fields to read, it does not carry
|
|
887
|
+
**The authored (JSON metadata) node** is `{ type: 'object-gantt', properties }`,
|
|
888
|
+
and the members of `properties` are `@objectstack/spec`'s
|
|
889
|
+
`ComponentPropsMap['object-gantt']` row (its `ObjectGanttProps`). It is
|
|
890
|
+
**record-driven**: it names an object and the fields to read, it does not carry
|
|
891
|
+
a task array. There is no `GanttSchema`. `ObjectGanttSchema` in `@object-ui/types`
|
|
892
|
+
— which this package imports and does not re-export — types the node as
|
|
893
|
+
`ObjectGantt` reads it: after `SchemaRenderer` hoists the bag, or as you mount it
|
|
894
|
+
yourself.
|
|
639
895
|
|
|
640
896
|
```typescript
|
|
641
|
-
import type {
|
|
897
|
+
import type { ObjectGanttBlockNode } from '@object-ui/types';
|
|
642
898
|
|
|
643
|
-
const gantt:
|
|
899
|
+
const gantt: ObjectGanttBlockNode = {
|
|
644
900
|
type: 'object-gantt',
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
901
|
+
properties: {
|
|
902
|
+
objectName: 'project_tasks',
|
|
903
|
+
gantt: {
|
|
904
|
+
titleField: 'name',
|
|
905
|
+
startDateField: 'start_date',
|
|
906
|
+
endDateField: 'end_date',
|
|
907
|
+
progressField: 'completion_percentage',
|
|
908
|
+
dependenciesField: 'dependent_task_ids',
|
|
909
|
+
},
|
|
910
|
+
},
|
|
651
911
|
};
|
|
652
912
|
```
|
|
653
913
|
|
|
914
|
+
`dependenciesField` (plural) is the spec's spelling and the one to author. The
|
|
915
|
+
singular `dependencyField` is a `@deprecated` legacy alias: `ObjectGantt` still
|
|
916
|
+
reads it (`dependenciesField || dependencyField`) on a node built in code, but an
|
|
917
|
+
authored node cannot carry it — `objectui validate` refuses it and names
|
|
918
|
+
`properties.gantt.dependenciesField`.
|
|
919
|
+
|
|
654
920
|
For a list view served under the `gantt` view type, the same configuration is a
|
|
655
921
|
`gantt` block on `ListViewSchema` (typed by `GanttConfig`, also from
|
|
656
922
|
`@object-ui/types`) rather than top-level keys — `ObjectGantt` reads either
|