@object-ui/plugin-gantt 6.2.2 → 7.0.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 +150 -0
- package/README.md +109 -4
- package/dist/GanttView.d.ts +217 -0
- package/dist/GanttView.d.ts.map +1 -0
- package/dist/ObjectGantt.d.ts +38 -0
- package/dist/ObjectGantt.d.ts.map +1 -0
- package/dist/QuickFilterBar.d.ts +39 -0
- package/dist/QuickFilterBar.d.ts.map +1 -0
- package/dist/ResourceWorkload.d.ts +37 -0
- package/dist/ResourceWorkload.d.ts.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3449 -534
- package/dist/index.umd.cjs +93 -1
- package/dist/scheduling.d.ts +83 -0
- package/dist/scheduling.d.ts.map +1 -0
- package/dist/{packages/plugin-gantt/src/useGanttTranslation.d.ts → useGanttTranslation.d.ts} +3 -6
- package/dist/useGanttTranslation.d.ts.map +1 -0
- package/dist/workload.d.ts +73 -0
- package/dist/workload.d.ts.map +1 -0
- package/package.json +13 -12
- package/dist/packages/plugin-gantt/src/GanttView.d.ts +0 -43
- package/dist/packages/plugin-gantt/src/GanttView.d.ts.map +0 -1
- package/dist/packages/plugin-gantt/src/ObjectGantt.d.ts +0 -13
- package/dist/packages/plugin-gantt/src/ObjectGantt.d.ts.map +0 -1
- package/dist/packages/plugin-gantt/src/index.d.ts +0 -10
- package/dist/packages/plugin-gantt/src/index.d.ts.map +0 -1
- package/dist/packages/plugin-gantt/src/useGanttTranslation.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,155 @@
|
|
|
1
1
|
# @object-ui/plugin-gantt
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 995c85d: Gantt feature parity, Phases 1–5: dependency links, real time scales, hierarchy, interaction polish, and virtualization.
|
|
8
|
+
|
|
9
|
+
- **Dependency links** — `task.dependencies` renders as orthogonal arrows in an SVG overlay, with all four MS-Project link types (`fs`/`ss`/`ff`/`sf`) via the object form `{ id, type }`. Arrows follow bars live during drag/resize; hovering a bar highlights its links. `normalizeDependencies` (exported) accepts CSV strings, id arrays, and object arrays with id/type aliases. New dependencies can be created by dragging from a bar's link dot onto another bar (`onDependencyCreate`).
|
|
10
|
+
- **Real time scales** — day/week/month/quarter modes with a two-row header (group row + unit row), weekend tinting, zoom in/out, and a jump-to-today button.
|
|
11
|
+
- **Hierarchy** — `parent` builds a tree: collapsible summary rows with bracket-style summary bars aggregated from descendants, milestone diamonds, indent guides, and `aria-expanded`/`role="treeitem"` semantics. Dragging a summary bar moves its whole subtree by the same offset (live preview + one `onTaskUpdate` per task); the summary's displayed range rolls up from children, so moving a child past the parent's edge stretches the parent automatically.
|
|
12
|
+
- **Interaction polish** — progress drag handle, hover tooltip, context menu (including delete), keyboard navigation/editing, inline title editing, and row drag-reorder (`onTaskReorder`).
|
|
13
|
+
- **Scale** — virtualized rows _and_ columns (spacer-based windowing; only the visible window is in the DOM, verified: 5,000 tasks render in ~27 ms with 26 rows in the DOM), a fullscreen toggle, and custom timeline `markers` (`{ date, label?, color? }`).
|
|
14
|
+
|
|
15
|
+
Colors that the prebuilt components stylesheet doesn't emit utilities for use theme CSS variables inline, so everything renders correctly in consuming apps.
|
|
16
|
+
|
|
17
|
+
- 053c948: feat(gantt): year scale, navigation, saved layout, and PDF export (follow-up to #1672)
|
|
18
|
+
|
|
19
|
+
- **Year scale** — new `year` granularity (one column per year, with a "20XXs"
|
|
20
|
+
decade group band above); ResourceWorkload follows the same column width/label.
|
|
21
|
+
- **Navigation** — toolbar gains _This week_ / _This month_ jump buttons (beside
|
|
22
|
+
the existing _Today_), scrolling the timeline to the current week/month start.
|
|
23
|
+
- **Saved layout** — `persistLayoutKey` / `onLayoutChange` plus a "Save layout"
|
|
24
|
+
button snapshot the current granularity + zoom + collapsed task columns to
|
|
25
|
+
`localStorage` (`gantt-layout:<object>:<view>`) and restore on next load (an
|
|
26
|
+
explicit `viewMode` prop still wins). `ObjectGantt` derives the key from the
|
|
27
|
+
data object by default; `persistLayout: false` opts out.
|
|
28
|
+
- **PDF export** — rasterizes the whole chart SVG to JPEG embedded in a
|
|
29
|
+
zero-dependency single-page PDF (DCTDecode), alongside PNG export
|
|
30
|
+
(`buildExportSvg` shared by both).
|
|
31
|
+
|
|
32
|
+
- 053c948: feat(gantt): configurable hover tooltip + live parent-stretch (follow-up to #1672)
|
|
33
|
+
|
|
34
|
+
- **Configurable tooltip** — a view declares `tooltipFields` on its gantt config
|
|
35
|
+
(field names, or `{ field, label }` to override the label); `ObjectGantt`
|
|
36
|
+
resolves each against the record (select options → label, lookups → embedded
|
|
37
|
+
record name, dates/numbers/currency/percent through the shared `@object-ui/
|
|
38
|
+
fields` formatters) and feeds `GanttView` a `task.fields` array that replaces
|
|
39
|
+
the default hover detail.
|
|
40
|
+
- **Live parent-stretch** — a summary bar's displayed range rolls up from its
|
|
41
|
+
children live, so dragging a child past the parent's edge stretches the parent.
|
|
42
|
+
- Also replaces six prebuilt-CSS utilities the components stylesheet never emits
|
|
43
|
+
(connector dot `-right-2` was occluding the progress label, resize-handle
|
|
44
|
+
width, progress-fill radius, grid z-index, `sm:` variants) with inline styles
|
|
45
|
+
/ a scoped media query so the chart renders correctly in consuming apps.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 0ad72a6: fix: pass full gantt config to renderer, render multi-value lookups in gantt tooltips, persist `bodyExtra` on dataSource actions, and complete zh/en gantt labels
|
|
50
|
+
|
|
51
|
+
Four platform gaps that the EHR app previously worked around with `node_modules` patches:
|
|
52
|
+
|
|
53
|
+
- **app-shell / ObjectView** — the `config.gantt → renderer props` adapter was a hardcoded 6-field whitelist, so `parentField`/`typeField` (and `baseline*`, `groupByField`, `resourceView`, `tooltipFields`, `quickFilters`, …) never reached the renderer and the chart degraded to a flat list. It now spreads the full `viewDef.gantt` first, then applies the three required defaults last (mirroring the gallery branch).
|
|
54
|
+
- **plugin-gantt / ObjectGantt** — the tooltip value formatter only handled single-object lookups, so a multi-value lookup (a populated `[{name},{name}]` array) fell through to `'—'`. It now maps each array element to its display value and joins them.
|
|
55
|
+
- **app-shell / useConsoleActionRuntime** — `bodyExtra` was merged only on the absolute-HTTP path; the generic `dataSource.update` path ignored it, so a pure-confirmation action (no params array) left an empty payload and persisted nothing. `bodyExtra` is now merged last on that path too, matching the documented semantics.
|
|
56
|
+
- **i18n** — added the gantt labels the 9.x renderer references but the bundles lacked: `toolbar.thisWeek/thisMonth/exportPdf/saveLayout`, `viewMode.year`, `menu.add*/removeDependency/noCandidates`, the `linkType.*` and `conflict.*` blocks, and `readOnly*` — in both `en` (canonical key source) and `zh`.
|
|
57
|
+
|
|
58
|
+
- bd8b054: fix(currency): resolve the tenant default currency across the long-tail renderers
|
|
59
|
+
|
|
60
|
+
Phase 2b of the currency-resolution work (ADR-0053). The cell/field renderers
|
|
61
|
+
already funnelled through `resolveFieldCurrency` + `useLocalization` (#1856),
|
|
62
|
+
but the rest of the renderers still hard-coded `USD` or read only one of
|
|
63
|
+
`currency`/`defaultCurrency`. They now share the same resolution chain — explicit
|
|
64
|
+
field currency -> `currencyConfig.defaultCurrency` -> legacy `defaultCurrency` ->
|
|
65
|
+
tenant `localization.currency` -> plain number:
|
|
66
|
+
|
|
67
|
+
- `plugin-dashboard` `ObjectMetricWidget` (inferred currency), `ObjectDataTable`
|
|
68
|
+
(symbol-format fallback).
|
|
69
|
+
- `plugin-grid` `useColumnSummary` (footer agrees with the cells) and
|
|
70
|
+
`ObjectGrid` (compact amount + name-inferred currency cells).
|
|
71
|
+
- `plugin-detail` `DetailView` summary metrics.
|
|
72
|
+
- `plugin-gantt` `ObjectGantt` currency tooltips.
|
|
73
|
+
- `components` `element:number` (`format: 'currency'`) — tenant default instead
|
|
74
|
+
of a baked-in `USD`, and renders with the tenant locale.
|
|
75
|
+
|
|
76
|
+
`resolveFieldCurrency` now lives in `@object-ui/i18n` (co-located with
|
|
77
|
+
`useLocalization`, which supplies the tenant default); `@object-ui/fields`
|
|
78
|
+
re-exports it, so the existing import path is unchanged. No behavior change when
|
|
79
|
+
no tenant currency is configured — a field that declares its own currency, or a
|
|
80
|
+
deployment with no `localization.currency`, renders exactly as before.
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [5976ba3]
|
|
83
|
+
- Updated dependencies [a00e16d]
|
|
84
|
+
- Updated dependencies [eaccefd]
|
|
85
|
+
- Updated dependencies [f7f325d]
|
|
86
|
+
- Updated dependencies [c12986e]
|
|
87
|
+
- Updated dependencies [71d7ce0]
|
|
88
|
+
- Updated dependencies [053c948]
|
|
89
|
+
- Updated dependencies [89e113c]
|
|
90
|
+
- Updated dependencies [ddbe4a2]
|
|
91
|
+
- Updated dependencies [2d47e94]
|
|
92
|
+
- Updated dependencies [9049bbe]
|
|
93
|
+
- Updated dependencies [77cc6bb]
|
|
94
|
+
- Updated dependencies [6c0c92c]
|
|
95
|
+
- Updated dependencies [97c6831]
|
|
96
|
+
- Updated dependencies [cb2fdb1]
|
|
97
|
+
- Updated dependencies [c3749eb]
|
|
98
|
+
- Updated dependencies [c09f44e]
|
|
99
|
+
- Updated dependencies [6cfa330]
|
|
100
|
+
- Updated dependencies [ad8ade6]
|
|
101
|
+
- Updated dependencies [d54346c]
|
|
102
|
+
- Updated dependencies [5332639]
|
|
103
|
+
- Updated dependencies [3870c20]
|
|
104
|
+
- Updated dependencies [2eb3096]
|
|
105
|
+
- Updated dependencies [b88c560]
|
|
106
|
+
- Updated dependencies [0ad72a6]
|
|
107
|
+
- Updated dependencies [bd398df]
|
|
108
|
+
- Updated dependencies [3fa23a7]
|
|
109
|
+
- Updated dependencies [18d0339]
|
|
110
|
+
- Updated dependencies [66ed3ad]
|
|
111
|
+
- Updated dependencies [c6445b6]
|
|
112
|
+
- Updated dependencies [80c133c]
|
|
113
|
+
- Updated dependencies [5e1b838]
|
|
114
|
+
- Updated dependencies [59b6bbb]
|
|
115
|
+
- Updated dependencies [d16566f]
|
|
116
|
+
- Updated dependencies [90acb7f]
|
|
117
|
+
- Updated dependencies [7913390]
|
|
118
|
+
- Updated dependencies [514f426]
|
|
119
|
+
- Updated dependencies [1394e34]
|
|
120
|
+
- Updated dependencies [e95cc25]
|
|
121
|
+
- Updated dependencies [abe8ebc]
|
|
122
|
+
- Updated dependencies [300d755]
|
|
123
|
+
- Updated dependencies [3cc38fe]
|
|
124
|
+
- Updated dependencies [bd8b054]
|
|
125
|
+
- Updated dependencies [4eb9cb6]
|
|
126
|
+
- Updated dependencies [7c239fd]
|
|
127
|
+
- Updated dependencies [858ad94]
|
|
128
|
+
- Updated dependencies [2270239]
|
|
129
|
+
- Updated dependencies [db8cd00]
|
|
130
|
+
- Updated dependencies [650bd1f]
|
|
131
|
+
- Updated dependencies [2f31406]
|
|
132
|
+
- Updated dependencies [18728c1]
|
|
133
|
+
- Updated dependencies [8d1195d]
|
|
134
|
+
- @object-ui/core@7.0.0
|
|
135
|
+
- @object-ui/components@7.0.0
|
|
136
|
+
- @object-ui/plugin-detail@7.0.0
|
|
137
|
+
- @object-ui/react@7.0.0
|
|
138
|
+
- @object-ui/i18n@7.0.0
|
|
139
|
+
- @object-ui/types@7.0.0
|
|
140
|
+
- @object-ui/fields@7.0.0
|
|
141
|
+
|
|
142
|
+
## 6.2.3
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- @object-ui/types@6.2.3
|
|
147
|
+
- @object-ui/core@6.2.3
|
|
148
|
+
- @object-ui/react@6.2.3
|
|
149
|
+
- @object-ui/components@6.2.3
|
|
150
|
+
- @object-ui/fields@6.2.3
|
|
151
|
+
- @object-ui/plugin-detail@6.2.3
|
|
152
|
+
|
|
3
153
|
## 6.2.2
|
|
4
154
|
|
|
5
155
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -127,6 +127,7 @@ Display project timeline with tasks:
|
|
|
127
127
|
viewMode?: 'day' | 'week' | 'month',
|
|
128
128
|
onTaskClick?: (task) => void,
|
|
129
129
|
onTaskUpdate?: (task) => void,
|
|
130
|
+
readOnly?: boolean, // disable all editing (drag/resize/inline/delete/link/undo)
|
|
130
131
|
className?: string
|
|
131
132
|
}
|
|
132
133
|
```
|
|
@@ -227,11 +228,20 @@ const schema = {
|
|
|
227
228
|
|
|
228
229
|
## View Modes
|
|
229
230
|
|
|
230
|
-
The Gantt chart
|
|
231
|
+
The Gantt chart renders one timeline column per unit of the active scale:
|
|
231
232
|
|
|
232
|
-
- **day** -
|
|
233
|
-
- **week** -
|
|
234
|
-
- **month** -
|
|
233
|
+
- **day** - one column per day (weekday + weekend shading)
|
|
234
|
+
- **week** - one column per week (starting Monday)
|
|
235
|
+
- **month** - one column per calendar month
|
|
236
|
+
- **quarter** - one column per quarter (Q1–Q4)
|
|
237
|
+
|
|
238
|
+
A two-row header shows the grouping above the units (months above days/weeks,
|
|
239
|
+
years above months/quarters). The toolbar's segmented control switches scales
|
|
240
|
+
interactively (`onViewChange` notifies you), and the zoom buttons step the
|
|
241
|
+
column width — falling through to the next coarser/finer scale at the bounds.
|
|
242
|
+
Drag snapping follows the active scale: bars snap to days in day view, weeks
|
|
243
|
+
in week view, and whole calendar months/quarters (duration preserved) in the
|
|
244
|
+
coarse views.
|
|
235
245
|
|
|
236
246
|
```typescript
|
|
237
247
|
const schema = {
|
|
@@ -241,6 +251,79 @@ const schema = {
|
|
|
241
251
|
};
|
|
242
252
|
```
|
|
243
253
|
|
|
254
|
+
## Task Hierarchy, Summaries & Milestones
|
|
255
|
+
|
|
256
|
+
Give a task a `parent` (or configure `parentField` on the data-source schema)
|
|
257
|
+
to build a tree: child rows indent under their parent with expand/collapse
|
|
258
|
+
chevrons in the task list. Any task with children renders as a **summary**
|
|
259
|
+
bracket spanning its children's combined date range, with progress rolled up
|
|
260
|
+
as the duration-weighted average of its descendants — summaries are read-only,
|
|
261
|
+
their children drive them.
|
|
262
|
+
|
|
263
|
+
Zero-duration tasks (`end <= start`) — or tasks whose `type` is
|
|
264
|
+
`'milestone'` (via `typeField`: values like `milestone`, `summary`,
|
|
265
|
+
`project`, `group` are recognized) — render as diamond markers. Milestones
|
|
266
|
+
can be dragged to move but not resized; dependency arrows anchor at the
|
|
267
|
+
diamond center.
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
const tasks = [
|
|
271
|
+
{ id: 'phase1', title: 'Phase 1', start: '…', end: '…', progress: 0 }, // summary (has children)
|
|
272
|
+
{ id: 't1', title: 'Design', parent: 'phase1', start: '…', end: '…', progress: 80 },
|
|
273
|
+
{ id: 't2', title: 'Build', parent: 'phase1', start: '…', end: '…', progress: 20 },
|
|
274
|
+
{ id: 'launch', title: 'Launch', type: 'milestone', start: '2024-07-01', end: '2024-07-01', progress: 0 },
|
|
275
|
+
];
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Interactions
|
|
279
|
+
|
|
280
|
+
Beyond drag-to-reschedule, the timeline supports:
|
|
281
|
+
|
|
282
|
+
- **Progress drag** — hover a bar and drag the round grip at the progress
|
|
283
|
+
boundary; the fill follows live and `onTaskUpdate(task, { progress })`
|
|
284
|
+
commits on release (snapped to whole percent, clamped 0–100).
|
|
285
|
+
- **Hover tooltip** — bars, milestones and summaries show a tooltip with
|
|
286
|
+
title, date range, duration and progress.
|
|
287
|
+
- **Context menu** — right-click a bar or list row for View details / Edit
|
|
288
|
+
inline / Delete (items appear only when the matching callback is wired).
|
|
289
|
+
- **Keyboard navigation** — the chart body is focusable: ↑/↓ move the row
|
|
290
|
+
selection, Enter opens the task, Delete deletes it, ←/→ collapse/expand
|
|
291
|
+
summary rows. Rows carry `treeitem` roles with `aria-level`/`aria-selected`.
|
|
292
|
+
- **Drag-to-create dependency** — drag the connector dot on a bar's right
|
|
293
|
+
edge onto another bar; a dashed rubber band previews the link and
|
|
294
|
+
`onDependencyCreate(source, target, 'fs')` fires on drop. Through
|
|
295
|
+
`ObjectGantt` the new predecessor is appended to the record's
|
|
296
|
+
`dependenciesField`, preserving the field's original shape (CSV or array).
|
|
297
|
+
- **Row drag-to-reorder** — pass `onTaskReorder(task, before)` to enable
|
|
298
|
+
HTML5 drag reordering in the task list (sibling-scoped; persistence is up
|
|
299
|
+
to the host, e.g. via a sort field).
|
|
300
|
+
|
|
301
|
+
## Scale & Performance
|
|
302
|
+
|
|
303
|
+
Rows and timeline columns are **virtualized**: only what is in (or near) the
|
|
304
|
+
viewport renders, so the chart stays responsive with thousands of tasks and
|
|
305
|
+
multi-year day-scale ranges. No configuration needed — windowing follows the
|
|
306
|
+
scroll position automatically, and dependency arrows keep their absolute
|
|
307
|
+
positions while scrolling.
|
|
308
|
+
|
|
309
|
+
Two more chrome features ship with it:
|
|
310
|
+
|
|
311
|
+
- **Fullscreen** — the expand button in the toolbar puts the whole chart into
|
|
312
|
+
native fullscreen (and back).
|
|
313
|
+
- **Custom markers** — vertical reference lines beyond the Today marker:
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
<GanttView
|
|
317
|
+
tasks={tasks}
|
|
318
|
+
markers={[
|
|
319
|
+
{ date: '2026-07-01', label: 'Code freeze', color: '#ef4444' },
|
|
320
|
+
{ date: '2026-07-15', label: 'Release' }, // defaults to the primary theme color
|
|
321
|
+
]}
|
|
322
|
+
/>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Through the schema, pass the same array as `markers` on the gantt node.
|
|
326
|
+
|
|
244
327
|
## Task Dependencies
|
|
245
328
|
|
|
246
329
|
Link tasks to show dependencies:
|
|
@@ -273,6 +356,28 @@ const tasks = [
|
|
|
273
356
|
];
|
|
274
357
|
```
|
|
275
358
|
|
|
359
|
+
Dependencies render as arrows from the predecessor bar to the dependent bar.
|
|
360
|
+
Arrows follow bars live while dragging, and hovering a bar highlights its links.
|
|
361
|
+
|
|
362
|
+
### Link Types
|
|
363
|
+
|
|
364
|
+
Each dependency entry is either a predecessor id (`'task-1'`) or an object with
|
|
365
|
+
an explicit link type:
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
dependencies: [
|
|
369
|
+
{ id: 'task-1', type: 'fs' }, // finish-to-start (default)
|
|
370
|
+
{ id: 'task-2', type: 'ss' }, // start-to-start
|
|
371
|
+
{ id: 'task-3', type: 'ff' }, // finish-to-finish
|
|
372
|
+
{ id: 'task-4', type: 'sf' }, // start-to-finish
|
|
373
|
+
]
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
When records come from a data source (`dependenciesField`), the field value may
|
|
377
|
+
be a CSV string (`"task1, task2"`), an array of ids, or an array of objects —
|
|
378
|
+
`task`/`target`/`_id` are accepted as id aliases, and long-form type names like
|
|
379
|
+
`"finish_to_start"` / `"end-to-end"` map onto `fs`/`ss`/`ff`/`sf`.
|
|
380
|
+
|
|
276
381
|
## Integration with Data Sources
|
|
277
382
|
|
|
278
383
|
```typescript
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { WorkingCalendar } from './scheduling';
|
|
2
|
+
/**
|
|
3
|
+
* ObjectUI
|
|
4
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
/**
|
|
11
|
+
* Dependency link types, MS-Project style:
|
|
12
|
+
* - `fs` finish-to-start (default): predecessor must finish before this task starts
|
|
13
|
+
* - `ss` start-to-start, `ff` finish-to-finish, `sf` start-to-finish
|
|
14
|
+
*/
|
|
15
|
+
export type GanttLinkType = 'fs' | 'ss' | 'ff' | 'sf';
|
|
16
|
+
export interface GanttDependencyObject {
|
|
17
|
+
id: string | number;
|
|
18
|
+
type?: GanttLinkType;
|
|
19
|
+
}
|
|
20
|
+
/** A dependency is the PREDECESSOR's task id, optionally with a link type. */
|
|
21
|
+
export type GanttDependency = string | number | GanttDependencyObject;
|
|
22
|
+
/**
|
|
23
|
+
* Task rendering variant. `summary` is implied for any task that has
|
|
24
|
+
* children; `milestone` is implied when end <= start (zero duration).
|
|
25
|
+
*/
|
|
26
|
+
export type GanttTaskType = 'task' | 'summary' | 'milestone' | 'group';
|
|
27
|
+
export interface GanttTask {
|
|
28
|
+
id: string | number;
|
|
29
|
+
title: string;
|
|
30
|
+
start: Date;
|
|
31
|
+
end: Date;
|
|
32
|
+
progress: number;
|
|
33
|
+
color?: string;
|
|
34
|
+
data?: any;
|
|
35
|
+
dependencies?: GanttDependency[];
|
|
36
|
+
/** Parent task id — builds the hierarchy. Unknown ids render as roots. */
|
|
37
|
+
parent?: string | number | null;
|
|
38
|
+
/**
|
|
39
|
+
* Node kind. Defaults to a leaf `task` (or `summary` automatically when it has
|
|
40
|
+
* children). Set `'group'` to render a pure tree header — expandable/collapsible
|
|
41
|
+
* like a summary but with NO timeline bar (用于 项目/产品 这类纯分组层级,左侧成树、右侧无条).
|
|
42
|
+
* Its children still render their own bars normally.
|
|
43
|
+
*/
|
|
44
|
+
type?: GanttTaskType;
|
|
45
|
+
/**
|
|
46
|
+
* Per-node lock (仅查看/跳转). When true this row is view-only: its bar can't be
|
|
47
|
+
* dragged/resized, progress can't be dragged, no dependency can be drawn from
|
|
48
|
+
* it, and inline-edit / context-menu edit+delete are hidden. Clicking the bar
|
|
49
|
+
* (onTaskClick — open drawer / jump) still works. Independent of the global
|
|
50
|
+
* `readOnly`; use to lock individual levels (e.g. 派工单) while others stay
|
|
51
|
+
* editable. Maps from the view's `lockField` in ObjectGantt.
|
|
52
|
+
*/
|
|
53
|
+
locked?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Baseline (planned) start/end. When both are present a thin reference bar is
|
|
56
|
+
* drawn beneath the live bar so planned-vs-actual drift is visible at a glance.
|
|
57
|
+
*/
|
|
58
|
+
baselineStart?: Date;
|
|
59
|
+
baselineEnd?: Date;
|
|
60
|
+
/**
|
|
61
|
+
* Extra label/value rows for the hover tooltip (悬浮详情), in display order.
|
|
62
|
+
* Populated from the view's `tooltipFields` config (resolved + formatted by
|
|
63
|
+
* ObjectGantt). When present they replace the default date·duration·progress
|
|
64
|
+
* line in the tooltip.
|
|
65
|
+
*/
|
|
66
|
+
fields?: Array<{
|
|
67
|
+
label: string;
|
|
68
|
+
value: string;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
/** Timeline granularity — one column per day, week, month, or quarter. */
|
|
72
|
+
export type GanttViewMode = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
73
|
+
/**
|
|
74
|
+
* Nominal days represented by one column at each granularity. Sets the zoom
|
|
75
|
+
* scale: pxPerDay = columnWidth / NOMINAL_DAYS[mode]. Actual column widths
|
|
76
|
+
* follow the calendar (a 31-day month is slightly wider than a 30-day one)
|
|
77
|
+
* so grid lines, bars and the Today marker share one linear ms→px mapping.
|
|
78
|
+
*/
|
|
79
|
+
export declare const NOMINAL_DAYS: Record<GanttViewMode, number>;
|
|
80
|
+
export declare const MS_PER_DAY: number;
|
|
81
|
+
/** Floor a date to the start of its column unit (Monday for weeks). */
|
|
82
|
+
export declare function startOfUnit(date: Date, mode: GanttViewMode): Date;
|
|
83
|
+
/** Add whole column units; month/quarter clamp the day (Jan 31 + 1mo = Feb 28). */
|
|
84
|
+
export declare function addUnits(date: Date, units: number, mode: GanttViewMode): Date;
|
|
85
|
+
/** Custom vertical timeline marker (deadline, sprint boundary, release…). */
|
|
86
|
+
export interface GanttMarker {
|
|
87
|
+
date: Date | string;
|
|
88
|
+
label?: string;
|
|
89
|
+
color?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface GanttViewProps {
|
|
92
|
+
tasks: GanttTask[];
|
|
93
|
+
/** Initial timeline granularity (also switchable from the toolbar). */
|
|
94
|
+
viewMode?: GanttViewMode;
|
|
95
|
+
startDate?: Date;
|
|
96
|
+
endDate?: Date;
|
|
97
|
+
/** Extra vertical marker lines rendered like the Today marker. */
|
|
98
|
+
markers?: GanttMarker[];
|
|
99
|
+
onTaskClick?: (task: GanttTask) => void;
|
|
100
|
+
onTaskUpdate?: (task: GanttTask, changes: Partial<Pick<GanttTask, 'title' | 'start' | 'end' | 'progress'>>) => void;
|
|
101
|
+
onTaskDelete?: (task: GanttTask) => void;
|
|
102
|
+
/** Notified when the user switches granularity from the toolbar. */
|
|
103
|
+
onViewChange?: (view: GanttViewMode) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Enables drag-to-link: a connector dot on each bar can be dragged onto
|
|
106
|
+
* another bar to create a dependency (target depends on source).
|
|
107
|
+
*/
|
|
108
|
+
onDependencyCreate?: (source: GanttTask, target: GanttTask, type: GanttLinkType) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Enables dependency removal: right-clicking a dependency link opens a menu
|
|
111
|
+
* with "移除依赖" and a type switch. Called with the source/target tasks of the
|
|
112
|
+
* removed link (target no longer depends on source).
|
|
113
|
+
*/
|
|
114
|
+
onDependencyDelete?: (source: GanttTask, target: GanttTask) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Enables row drag-to-reorder in the task list. Called with the dragged
|
|
117
|
+
* task and the sibling it was dropped on (insert before it). Only fires
|
|
118
|
+
* for rows sharing the same parent.
|
|
119
|
+
*/
|
|
120
|
+
onTaskReorder?: (task: GanttTask, before: GanttTask) => void;
|
|
121
|
+
className?: string;
|
|
122
|
+
/** Enable inline editing of task fields */
|
|
123
|
+
inlineEdit?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Show the "auto-schedule" toolbar button. Clicking it runs a one-shot
|
|
126
|
+
* dependency-driven reschedule of the whole project (顺延): every successor is
|
|
127
|
+
* pushed later until its link constraints hold, preserving durations, and the
|
|
128
|
+
* resulting date changes are emitted via `onTaskUpdate`. Requires onTaskUpdate.
|
|
129
|
+
*/
|
|
130
|
+
autoSchedule?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* After a bar drag/resize, validate the move against dependency constraints
|
|
133
|
+
* (拖拽冲突校验). If the new position would violate a link — the task moved
|
|
134
|
+
* earlier than a predecessor allows, or its move pushes successors past their
|
|
135
|
+
* constraints — a confirmation prompts to 自动顺延 (cascade-reschedule the
|
|
136
|
+
* affected tasks, preserving durations) or keep the overlap. Requires
|
|
137
|
+
* onTaskUpdate and only fires when links exist. Ignored in readOnly.
|
|
138
|
+
*/
|
|
139
|
+
rescheduleOnConflict?: boolean;
|
|
140
|
+
/** Start with the critical-path highlight enabled (toggle stays in the toolbar). */
|
|
141
|
+
criticalPathDefault?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Working calendar for duration math. When set, auto-schedule and critical
|
|
144
|
+
* path count working days only — weekends (`skipWeekends`) and any `holidays`
|
|
145
|
+
* (ISO `yyyy-mm-dd` UTC keys) are skipped rather than consumed.
|
|
146
|
+
*/
|
|
147
|
+
workingCalendar?: WorkingCalendar;
|
|
148
|
+
/** Render planned-vs-actual baseline bars when tasks carry baseline dates. */
|
|
149
|
+
showBaselines?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Read-only mode. When true, every write interaction is disabled regardless
|
|
152
|
+
* of which callbacks are passed: no bar drag / resize / progress handle, no
|
|
153
|
+
* inline editing, no delete, no dependency-link drag, no row reorder, no
|
|
154
|
+
* auto-schedule, and the Undo/Redo toolbar buttons are hidden. Clicking a
|
|
155
|
+
* task (`onTaskClick`) and switching granularity still work — those don't
|
|
156
|
+
* mutate data. Equivalent to omitting all write callbacks, but explicit and
|
|
157
|
+
* metadata-drivable.
|
|
158
|
+
*/
|
|
159
|
+
readOnly?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Mobile read-only (移动端只读缩略). When true, the chart auto-enters read-only
|
|
162
|
+
* mode on narrow viewports (< 640px) so touch users get a clean, scrollable
|
|
163
|
+
* thumbnail of the schedule instead of error-prone drag editing — equivalent
|
|
164
|
+
* to `readOnly` but scoped to small screens. Wider viewports are unaffected.
|
|
165
|
+
* Independent of (and OR-combined with) `readOnly`.
|
|
166
|
+
*/
|
|
167
|
+
mobileReadOnly?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Dynamic grouping accessor (动态 Group by). When provided, leaf tasks are
|
|
170
|
+
* bucketed by the returned `key` and rendered beneath one synthesized summary
|
|
171
|
+
* row per group — the original `parent` hierarchy is replaced by the grouping.
|
|
172
|
+
* Return `null` to drop a task into the "ungrouped" bucket. Grouping is purely
|
|
173
|
+
* presentational: the timeline range, critical path and auto-schedule still run
|
|
174
|
+
* on the real task list, and the synthetic group rows are never draggable.
|
|
175
|
+
*/
|
|
176
|
+
groupBy?: (task: GanttTask) => {
|
|
177
|
+
key: string | number;
|
|
178
|
+
label: string;
|
|
179
|
+
} | null;
|
|
180
|
+
/** Label for the bucket collecting tasks whose `groupBy` returns null. */
|
|
181
|
+
ungroupedLabel?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Auto-collapse tree nodes at or below this depth on first render (默认折叠).
|
|
184
|
+
* Depth is 0-indexed: roots are 0, their children 1, etc. Every node whose
|
|
185
|
+
* depth is `>= defaultCollapsedDepth` AND which has children is seeded into the
|
|
186
|
+
* collapsed set once, so its subtree starts hidden. The user can still expand
|
|
187
|
+
* any of them — this only sets the initial state. Example: a 项目→产品→排产计划→派工单
|
|
188
|
+
* tree where 排产计划 sits at depth 2 uses `defaultCollapsedDepth={2}` to start
|
|
189
|
+
* with every 排产计划 (and its 派工单 children) folded. Omit (or pass a depth past
|
|
190
|
+
* the deepest node) to start fully expanded.
|
|
191
|
+
*/
|
|
192
|
+
defaultCollapsedDepth?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Persist the user's layout tweaks (granularity + column/task-list widths)
|
|
195
|
+
* to `localStorage` under this key. On mount the saved layout is restored;
|
|
196
|
+
* the "保存布局" toolbar button writes the current layout. Omit to disable
|
|
197
|
+
* persistence. The button still appears when `onLayoutChange` is set.
|
|
198
|
+
*/
|
|
199
|
+
persistLayoutKey?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Notified when the user saves the current layout (保存布局). Receives the
|
|
202
|
+
* snapshot `{ viewMode, columnWidth, taskListCollapsed }`. Use this to persist
|
|
203
|
+
* layout in your own store instead of (or alongside) `persistLayoutKey`.
|
|
204
|
+
*/
|
|
205
|
+
onLayoutChange?: (layout: GanttLayout) => void;
|
|
206
|
+
}
|
|
207
|
+
/** Persisted layout snapshot written by the "保存布局" toolbar button. */
|
|
208
|
+
export interface GanttLayout {
|
|
209
|
+
viewMode: GanttViewMode;
|
|
210
|
+
/** Effective day-column width in px, or null when auto-fit. */
|
|
211
|
+
columnWidth: number | null;
|
|
212
|
+
taskListCollapsed: boolean;
|
|
213
|
+
/** User-dragged task-list (name column) width in px, or null when auto-sized. */
|
|
214
|
+
taskListWidth?: number | null;
|
|
215
|
+
}
|
|
216
|
+
export declare function GanttView({ tasks, viewMode: viewModeProp, startDate, endDate, markers, onTaskClick, onTaskUpdate: onTaskUpdateProp, onTaskDelete: onTaskDeleteProp, onViewChange, onDependencyCreate: onDependencyCreateProp, onDependencyDelete: onDependencyDeleteProp, onTaskReorder: onTaskReorderProp, className, inlineEdit: inlineEditProp, autoSchedule: autoScheduleProp, rescheduleOnConflict: rescheduleOnConflictProp, criticalPathDefault, workingCalendar, showBaselines, readOnly, mobileReadOnly, groupBy, ungroupedLabel, defaultCollapsedDepth, persistLayoutKey, onLayoutChange, }: GanttViewProps): React.JSX.Element;
|
|
217
|
+
//# sourceMappingURL=GanttView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GanttView.d.ts","sourceRoot":"","sources":["../src/GanttView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA4B9B,OAAO,EAAiD,KAAK,eAAe,EAAyB,MAAM,cAAc,CAAA;AAoCzH;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,CAAC,EAA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,OAAO,EACP,WAAW,EACX,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EACZ,kBAAkB,EAAE,sBAAsB,EAC1C,kBAAkB,EAAE,sBAAsB,EAC1C,aAAa,EAAE,iBAAiB,EAChC,SAAS,EACT,UAAU,EAAE,cAAsB,EAClC,YAAY,EAAE,gBAAwB,EACtC,oBAAoB,EAAE,wBAAgC,EACtD,mBAA2B,EAC3B,eAAe,EACf,aAAoB,EACpB,QAAgB,EAChB,cAAsB,EACtB,OAAO,EACP,cAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,GACf,EAAE,cAAc,qBAu2GhB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ObjectGridSchema, DataSource } from '@object-ui/types';
|
|
3
|
+
import { GanttDependency, GanttTaskType } from './GanttView';
|
|
4
|
+
/**
|
|
5
|
+
* One quick-filter dimension (快速筛选维度). Generic by design: the page configures
|
|
6
|
+
* which record fields become filter dropdowns; the plugin resolves each one's
|
|
7
|
+
* options from the object schema (select options / lookup reference records) so
|
|
8
|
+
* no business field names are baked into the (MIT) plugin.
|
|
9
|
+
*/
|
|
10
|
+
export interface QuickFilterDef {
|
|
11
|
+
/** Record field / dot-path the dimension filters on. */
|
|
12
|
+
field: string;
|
|
13
|
+
/** Trigger label (falls back to the schema field label / humanized name). */
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Explicit option override. Highest priority — use for fixed enums that are
|
|
17
|
+
* not modeled as select options (e.g. 派工类别). Plain strings become
|
|
18
|
+
* value === label; objects allow a distinct display label.
|
|
19
|
+
*/
|
|
20
|
+
options?: Array<string | {
|
|
21
|
+
value: string | number;
|
|
22
|
+
label?: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
/** Map a record's type value onto a GanttTaskType (undefined = infer). */
|
|
26
|
+
export declare function normalizeTaskType(raw: unknown): GanttTaskType | undefined;
|
|
27
|
+
export declare function normalizeDependencies(raw: unknown): GanttDependency[];
|
|
28
|
+
export interface ObjectGanttProps {
|
|
29
|
+
schema: ObjectGridSchema;
|
|
30
|
+
dataSource?: DataSource;
|
|
31
|
+
className?: string;
|
|
32
|
+
onTaskClick?: (record: any) => void;
|
|
33
|
+
onRowClick?: (record: any) => void;
|
|
34
|
+
onEdit?: (record: any) => void;
|
|
35
|
+
onDelete?: (record: any) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare const ObjectGantt: React.FC<ObjectGanttProps>;
|
|
38
|
+
//# sourceMappingURL=ObjectGantt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectGantt.d.ts","sourceRoot":"","sources":["../src/ObjectGantt.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AA0B5F,OAAO,EAA6B,KAAK,eAAe,EAAsB,KAAK,aAAa,EAAsB,MAAM,aAAa,CAAC;AAK1I;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE;AAqED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAUzE;AAiBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,EAAE,CAqBrE;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAuGD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAu2BlD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface QuickFilterOption {
|
|
3
|
+
/** Stable key compared against a task's resolved field value. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Human-facing label shown in the checkbox list and trigger summary. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface QuickFilterField {
|
|
9
|
+
/** Record field/path this dimension filters on (e.g. "project", "owner.id"). */
|
|
10
|
+
field: string;
|
|
11
|
+
/** Display label for the dropdown trigger. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Full option list (already resolved by the owner). */
|
|
14
|
+
options: QuickFilterOption[];
|
|
15
|
+
}
|
|
16
|
+
export interface QuickFilterLabels {
|
|
17
|
+
/** "全部" / "All" — the select-all toggle and empty-selection trigger text. */
|
|
18
|
+
all?: string;
|
|
19
|
+
/** "清除筛选" / "Clear" — clears every dimension. */
|
|
20
|
+
clear?: string;
|
|
21
|
+
/** Builds the "showing N / M" summary; omit to hide the summary. */
|
|
22
|
+
resultSummary?: (shown: number, total: number) => string;
|
|
23
|
+
/** Placeholder shown when a dimension resolved zero options. */
|
|
24
|
+
empty?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface QuickFilterBarProps {
|
|
27
|
+
filters: QuickFilterField[];
|
|
28
|
+
/** field → selected option values (absent/empty = no constraint). */
|
|
29
|
+
value: Record<string, string[]>;
|
|
30
|
+
onChange: (field: string, values: string[]) => void;
|
|
31
|
+
onClear: () => void;
|
|
32
|
+
/** Visible/total task counts for the summary caption (optional). */
|
|
33
|
+
resultCount?: number;
|
|
34
|
+
totalCount?: number;
|
|
35
|
+
labels?: QuickFilterLabels;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const QuickFilterBar: React.FC<QuickFilterBarProps>;
|
|
39
|
+
//# sourceMappingURL=QuickFilterBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilterBar.d.ts","sourceRoot":"","sources":["../src/QuickFilterBar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4MD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+CxD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GanttTask, GanttViewMode } from './GanttView';
|
|
2
|
+
/**
|
|
3
|
+
* ObjectUI
|
|
4
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Resource / Workload view (资源/工作负载视图).
|
|
11
|
+
*
|
|
12
|
+
* A per-resource load histogram aligned to the same time columns the Gantt grid
|
|
13
|
+
* uses. Each resource gets a row; each column draws a bar whose height ∝ the
|
|
14
|
+
* summed effort of that resource's tasks active in that span, painted red once
|
|
15
|
+
* it exceeds capacity (over-allocation). The aggregation lives in `workload.ts`
|
|
16
|
+
* (pure + unit-tested); this component is the renderer + timeline geometry.
|
|
17
|
+
*/
|
|
18
|
+
import * as React from 'react';
|
|
19
|
+
export interface ResourceWorkloadProps {
|
|
20
|
+
tasks: GanttTask[];
|
|
21
|
+
/** Resource accessor — null routes a task into the "unassigned" row. */
|
|
22
|
+
assignee: (task: GanttTask) => {
|
|
23
|
+
key: string | number;
|
|
24
|
+
label: string;
|
|
25
|
+
} | null;
|
|
26
|
+
/** Capacity units a task consumes while active (default 1). */
|
|
27
|
+
effort?: (task: GanttTask) => number;
|
|
28
|
+
/** Per-resource capacity ceiling; number or per-key function (default 1). */
|
|
29
|
+
capacity?: number | ((key: string) => number);
|
|
30
|
+
/** Time granularity — must match the chart it accompanies. */
|
|
31
|
+
viewMode?: GanttViewMode;
|
|
32
|
+
/** Label for the unassigned bucket. */
|
|
33
|
+
unassignedLabel?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function ResourceWorkload({ tasks, assignee, effort, capacity, viewMode, unassignedLabel, className, }: ResourceWorkloadProps): React.JSX.Element;
|
|
37
|
+
//# sourceMappingURL=ResourceWorkload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceWorkload.d.ts","sourceRoot":"","sources":["../src/ResourceWorkload.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAmD,MAAM,aAAa,CAAC;AAIlH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,wEAAwE;IACxE,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK;QAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9E,+DAA+D;IAC/D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,MAAM,CAAC;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9C,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAY,EACZ,QAAgB,EAChB,eAA8B,EAC9B,SAAS,GACV,EAAE,qBAAqB,qBAuIvB"}
|