@salmonui/gantt 0.0.0-stage → 0.3.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.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -2
  3. package/dist/gantt/Gantt.d.ts +5 -0
  4. package/dist/gantt/Gantt.d.ts.map +1 -0
  5. package/dist/gantt/Gantt.js +516 -0
  6. package/dist/gantt/Gantt.js.map +1 -0
  7. package/dist/gantt/adaptive.d.ts +8 -0
  8. package/dist/gantt/adaptive.d.ts.map +1 -0
  9. package/dist/gantt/adaptive.js +38 -0
  10. package/dist/gantt/adaptive.js.map +1 -0
  11. package/dist/gantt/api.d.ts +9 -0
  12. package/dist/gantt/api.d.ts.map +1 -0
  13. package/dist/gantt/api.js +181 -0
  14. package/dist/gantt/api.js.map +1 -0
  15. package/dist/gantt/chart.d.ts +70 -0
  16. package/dist/gantt/chart.d.ts.map +1 -0
  17. package/dist/gantt/chart.js +580 -0
  18. package/dist/gantt/chart.js.map +1 -0
  19. package/dist/gantt/columns.d.ts +9 -0
  20. package/dist/gantt/columns.d.ts.map +1 -0
  21. package/dist/gantt/columns.js +139 -0
  22. package/dist/gantt/columns.js.map +1 -0
  23. package/dist/gantt/export.d.ts +53 -0
  24. package/dist/gantt/export.d.ts.map +1 -0
  25. package/dist/gantt/export.js +241 -0
  26. package/dist/gantt/export.js.map +1 -0
  27. package/dist/gantt/fields.d.ts +42 -0
  28. package/dist/gantt/fields.d.ts.map +1 -0
  29. package/dist/gantt/fields.js +235 -0
  30. package/dist/gantt/fields.js.map +1 -0
  31. package/dist/gantt/instance.d.ts +214 -0
  32. package/dist/gantt/instance.d.ts.map +1 -0
  33. package/dist/gantt/instance.js +1029 -0
  34. package/dist/gantt/instance.js.map +1 -0
  35. package/dist/gantt/interact.d.ts +7 -0
  36. package/dist/gantt/interact.d.ts.map +1 -0
  37. package/dist/gantt/interact.js +315 -0
  38. package/dist/gantt/interact.js.map +1 -0
  39. package/dist/gantt/loading.d.ts +21 -0
  40. package/dist/gantt/loading.d.ts.map +1 -0
  41. package/dist/gantt/loading.js +81 -0
  42. package/dist/gantt/loading.js.map +1 -0
  43. package/dist/gantt/locale.d.ts +161 -0
  44. package/dist/gantt/locale.d.ts.map +1 -0
  45. package/dist/gantt/locale.js +145 -0
  46. package/dist/gantt/locale.js.map +1 -0
  47. package/dist/gantt/menu-items.d.ts +8 -0
  48. package/dist/gantt/menu-items.d.ts.map +1 -0
  49. package/dist/gantt/menu-items.js +16 -0
  50. package/dist/gantt/menu-items.js.map +1 -0
  51. package/dist/gantt/menu-run.d.ts +5 -0
  52. package/dist/gantt/menu-run.d.ts.map +1 -0
  53. package/dist/gantt/menu-run.js +69 -0
  54. package/dist/gantt/menu-run.js.map +1 -0
  55. package/dist/gantt/modules.d.ts +19 -0
  56. package/dist/gantt/modules.d.ts.map +1 -0
  57. package/dist/gantt/modules.js +8 -0
  58. package/dist/gantt/modules.js.map +1 -0
  59. package/dist/gantt/popups.d.ts +23 -0
  60. package/dist/gantt/popups.d.ts.map +1 -0
  61. package/dist/gantt/popups.js +158 -0
  62. package/dist/gantt/popups.js.map +1 -0
  63. package/dist/gantt/registry-lazy.d.ts +4 -0
  64. package/dist/gantt/registry-lazy.d.ts.map +1 -0
  65. package/dist/gantt/registry-lazy.js +54 -0
  66. package/dist/gantt/registry-lazy.js.map +1 -0
  67. package/dist/gantt/registry-static.d.ts +4 -0
  68. package/dist/gantt/registry-static.d.ts.map +1 -0
  69. package/dist/gantt/registry-static.js +13 -0
  70. package/dist/gantt/registry-static.js.map +1 -0
  71. package/dist/gantt/remote.d.ts +16 -0
  72. package/dist/gantt/remote.d.ts.map +1 -0
  73. package/dist/gantt/remote.js +178 -0
  74. package/dist/gantt/remote.js.map +1 -0
  75. package/dist/gantt/resource-view.d.ts +57 -0
  76. package/dist/gantt/resource-view.d.ts.map +1 -0
  77. package/dist/gantt/resource-view.js +123 -0
  78. package/dist/gantt/resource-view.js.map +1 -0
  79. package/dist/gantt/toolbar.d.ts +11 -0
  80. package/dist/gantt/toolbar.d.ts.map +1 -0
  81. package/dist/gantt/toolbar.js +166 -0
  82. package/dist/gantt/toolbar.js.map +1 -0
  83. package/dist/gantt/tooltip.d.ts +7 -0
  84. package/dist/gantt/tooltip.d.ts.map +1 -0
  85. package/dist/gantt/tooltip.js +180 -0
  86. package/dist/gantt/tooltip.js.map +1 -0
  87. package/dist/gantt/types.d.ts +625 -0
  88. package/dist/gantt/types.d.ts.map +1 -0
  89. package/dist/gantt/types.js +7 -0
  90. package/dist/gantt/types.js.map +1 -0
  91. package/dist/gantt.css +5593 -0
  92. package/dist/gantt.d.ts +6 -0
  93. package/dist/gantt.d.ts.map +1 -0
  94. package/dist/gantt.js +13 -0
  95. package/dist/gantt.js.map +1 -0
  96. package/dist/internal/timeline/project/calendar.d.ts +50 -0
  97. package/dist/internal/timeline/project/calendar.d.ts.map +1 -0
  98. package/dist/internal/timeline/project/calendar.js +312 -0
  99. package/dist/internal/timeline/project/calendar.js.map +1 -0
  100. package/dist/internal/timeline/project/critical.d.ts +34 -0
  101. package/dist/internal/timeline/project/critical.d.ts.map +1 -0
  102. package/dist/internal/timeline/project/critical.js +135 -0
  103. package/dist/internal/timeline/project/critical.js.map +1 -0
  104. package/dist/internal/timeline/project/dependencies.d.ts +16 -0
  105. package/dist/internal/timeline/project/dependencies.d.ts.map +1 -0
  106. package/dist/internal/timeline/project/dependencies.js +87 -0
  107. package/dist/internal/timeline/project/dependencies.js.map +1 -0
  108. package/dist/internal/timeline/project/engine.d.ts +118 -0
  109. package/dist/internal/timeline/project/engine.d.ts.map +1 -0
  110. package/dist/internal/timeline/project/engine.js +1907 -0
  111. package/dist/internal/timeline/project/engine.js.map +1 -0
  112. package/dist/internal/timeline/project/format.d.ts +22 -0
  113. package/dist/internal/timeline/project/format.d.ts.map +1 -0
  114. package/dist/internal/timeline/project/format.js +41 -0
  115. package/dist/internal/timeline/project/format.js.map +1 -0
  116. package/dist/internal/timeline/project/history.d.ts +27 -0
  117. package/dist/internal/timeline/project/history.d.ts.map +1 -0
  118. package/dist/internal/timeline/project/history.js +74 -0
  119. package/dist/internal/timeline/project/history.js.map +1 -0
  120. package/dist/internal/timeline/project/resources.d.ts +26 -0
  121. package/dist/internal/timeline/project/resources.d.ts.map +1 -0
  122. package/dist/internal/timeline/project/resources.js +109 -0
  123. package/dist/internal/timeline/project/resources.js.map +1 -0
  124. package/dist/internal/timeline/project/types.d.ts +99 -0
  125. package/dist/internal/timeline/project/types.d.ts.map +1 -0
  126. package/dist/internal/timeline/project/types.js +6 -0
  127. package/dist/internal/timeline/project/types.js.map +1 -0
  128. package/dist/internal/timeline/scale.d.ts +60 -0
  129. package/dist/internal/timeline/scale.d.ts.map +1 -0
  130. package/dist/internal/timeline/scale.js +156 -0
  131. package/dist/internal/timeline/scale.js.map +1 -0
  132. package/package.json +55 -4
@@ -0,0 +1,625 @@
1
+ import type { CSSProperties, ReactNode, Ref } from 'react';
2
+ import type { RowId } from '@salmonui/core/data';
3
+ import type { DataGridApi, DataGridColumn, DataGridProps } from '@salmonui/data-grid';
4
+ import type { DataGridContextMenuItemId, DataGridMenuItem } from '@salmonui/data-grid';
5
+ import type { DataGridExportOptions } from '@salmonui/data-grid';
6
+ import type { DataGridEvent } from '@salmonui/data-grid';
7
+ import type { DataSource } from '@salmonui/data-grid/engine';
8
+ import type { ConstraintType, Dependency, DependencyType, DurationUnit, ScheduleConflict, TaskMode, TaskType, WorkUnit } from '../internal/timeline/project/types.js';
9
+ import type { ScaleUnit } from '../internal/timeline/scale.js';
10
+ import type { GanttLocaleText } from './locale.js';
11
+ export type { ConstraintType, Dependency as GanttDependency, DependencyType as GanttDependencyType, DurationUnit as GanttDurationUnit, TaskMode as GanttTaskMode, TaskType as GanttTaskType, WorkUnit as GanttWorkUnit, ScaleUnit as GanttTimeUnit };
12
+ /** A date value accepted by the task roles: `Date`, ISO string, epoch ms or a plain date-time (`{ year, month, day, hour?, minute? }`). */
13
+ export type GanttDateInput = Date | string | number | {
14
+ readonly year: number;
15
+ readonly month: number;
16
+ readonly day: number;
17
+ readonly hour?: number;
18
+ readonly minute?: number;
19
+ };
20
+ /** `taskFields`: the row property that holds each task role. Defaults are the role names. */
21
+ export interface GanttTaskFields {
22
+ readonly id?: string;
23
+ readonly title?: string;
24
+ readonly start?: string;
25
+ readonly end?: string;
26
+ readonly duration?: string;
27
+ readonly durationUnit?: string;
28
+ readonly progress?: string;
29
+ /** Flat data: the parent task id. */
30
+ readonly parentId?: string;
31
+ /** Nested data: the child task array. Default `'children'` when `parentId` is not mapped. */
32
+ readonly children?: string;
33
+ readonly predecessors?: string;
34
+ readonly milestone?: string;
35
+ readonly notes?: string;
36
+ readonly baselineStart?: string;
37
+ readonly baselineEnd?: string;
38
+ readonly baselineDuration?: string;
39
+ readonly resources?: string;
40
+ readonly work?: string;
41
+ readonly taskType?: string;
42
+ readonly manual?: string;
43
+ readonly segments?: string;
44
+ readonly indicators?: string;
45
+ readonly expanded?: string;
46
+ readonly constraintType?: string;
47
+ readonly constraintDate?: string;
48
+ readonly calendar?: string;
49
+ readonly className?: string;
50
+ }
51
+ export type GanttTaskRole = Exclude<keyof GanttTaskFields, 'children'>;
52
+ /** `workingTime`: hours as decimals (`8`, `17.5`); `week` overrides `dayRanges` per weekday (0 = Sunday). */
53
+ export interface GanttWorkingTime {
54
+ readonly dayRanges?: readonly {
55
+ readonly from: number;
56
+ readonly to: number;
57
+ }[];
58
+ readonly week?: Partial<Readonly<Record<0 | 1 | 2 | 3 | 4 | 5 | 6, readonly {
59
+ readonly from: number;
60
+ readonly to: number;
61
+ }[]>>>;
62
+ readonly workDays?: readonly number[];
63
+ readonly includeWeekend?: boolean;
64
+ readonly hoursPerDay?: number;
65
+ readonly daysPerWeek?: number;
66
+ readonly daysPerMonth?: number;
67
+ }
68
+ /** A holiday: shaded and non-working for the engine. */
69
+ export interface GanttHoliday {
70
+ readonly start: GanttDateInput;
71
+ /** Inclusive day (default `start`). */
72
+ readonly end?: GanttDateInput;
73
+ readonly label?: string;
74
+ readonly className?: string;
75
+ }
76
+ /** A named working calendar. `exceptions` without `ranges` are non-working. */
77
+ export interface GanttCalendar {
78
+ readonly id: string;
79
+ readonly workingTime?: GanttWorkingTime;
80
+ readonly exceptions?: readonly {
81
+ readonly start: GanttDateInput;
82
+ readonly end?: GanttDateInput;
83
+ readonly ranges?: readonly {
84
+ readonly from: number;
85
+ readonly to: number;
86
+ }[];
87
+ }[];
88
+ }
89
+ /** An event marker. */
90
+ export interface GanttMarker {
91
+ readonly date: GanttDateInput;
92
+ readonly label?: string;
93
+ readonly className?: string;
94
+ }
95
+ /** One timeline tier. */
96
+ export interface GanttTier {
97
+ readonly unit: ScaleUnit;
98
+ readonly count?: number;
99
+ /** `Intl.DateTimeFormat` options for the cell text. */
100
+ readonly format?: Intl.DateTimeFormatOptions;
101
+ readonly render?: (ctx: GanttTimelineCellContext) => ReactNode;
102
+ }
103
+ /** `timeline.renderCell` / tier `render` context. */
104
+ export interface GanttTimelineCellContext {
105
+ readonly tier: 'top' | 'bottom';
106
+ /** Cell start as a `Date` whose UTC fields are the wall time in `timeZone`. */
107
+ readonly date: Date;
108
+ readonly unit: ScaleUnit;
109
+ readonly width: number;
110
+ readonly text: string;
111
+ }
112
+ /** A zoom level: two tiers and the bottom-tier cell width. */
113
+ export interface GanttZoomLevel {
114
+ readonly top?: GanttTier | null;
115
+ readonly bottom: GanttTier;
116
+ readonly unitWidth?: number;
117
+ }
118
+ /** `timeline`. */
119
+ export interface GanttTimeline {
120
+ /** Tier preset. Default `'week'`. */
121
+ readonly mode?: 'hour' | 'day' | 'week' | 'month' | 'year';
122
+ readonly topTier?: GanttTier | null;
123
+ readonly bottomTier?: GanttTier;
124
+ /** Width of one bottom-tier cell in px (`timelineUnitSize`). Default 33. */
125
+ readonly unitWidth?: number;
126
+ /** First day of week (0 = Sunday). Default from `locale`. */
127
+ readonly weekStart?: number;
128
+ readonly renderCell?: (ctx: GanttTimelineCellContext) => ReactNode;
129
+ /** Extends the range when scrolled to an edge (`enableInfiniteTimelineScroll`). */
130
+ readonly infinite?: boolean;
131
+ /** Tier cell tooltips (the full date). Default true. */
132
+ readonly tooltips?: boolean;
133
+ }
134
+ /** `splitter`. */
135
+ export interface GanttSplitter {
136
+ /** Grid pane width (px or `'40%'`). */
137
+ readonly position?: number | string;
138
+ /** Grid pane ends after this column (wins over `position`). */
139
+ readonly columnIndex?: number;
140
+ readonly minSize?: number;
141
+ }
142
+ /** A taskbar render context. */
143
+ export interface GanttTaskbarContext<Row> {
144
+ readonly task: Row;
145
+ readonly info: GanttTaskInfo;
146
+ readonly start: Date | null;
147
+ readonly end: Date | null;
148
+ readonly progress: number;
149
+ readonly width: number;
150
+ readonly critical: boolean;
151
+ readonly selected: boolean;
152
+ }
153
+ /** `getTaskbarProps` result: applied to the taskbar part. */
154
+ export interface GanttTaskbarProps {
155
+ readonly className?: string;
156
+ readonly style?: CSSProperties;
157
+ readonly [data: `data-${string}`]: string | number | boolean | undefined;
158
+ }
159
+ /** Label value: a field name or a render function. */
160
+ export type GanttLabel<Row> = string | ((ctx: GanttTaskbarContext<Row>) => ReactNode);
161
+ /** `tooltip`. */
162
+ export interface GanttTooltipOptions<Row> {
163
+ readonly renderTaskbar?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
164
+ readonly renderBaseline?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
165
+ readonly renderConnector?: (ctx: {
166
+ readonly from: Row;
167
+ readonly to: Row;
168
+ readonly dependency: Dependency;
169
+ }) => ReactNode;
170
+ readonly renderEditing?: (ctx: GanttTaskbarContext<Row> & {
171
+ readonly action: GanttTaskbarAction;
172
+ }) => ReactNode;
173
+ readonly renderTimeline?: (ctx: GanttTimelineCellContext) => ReactNode;
174
+ }
175
+ /** A task indicator. */
176
+ export interface GanttIndicator {
177
+ readonly date: GanttDateInput;
178
+ readonly label?: string;
179
+ readonly icon?: ReactNode;
180
+ readonly tooltip?: string;
181
+ readonly className?: string;
182
+ }
183
+ export type GanttTaskbarAction = 'move' | 'resizeStart' | 'resizeEnd' | 'progress' | 'connect' | 'segmentMove' | 'segmentResize';
184
+ /** Computed task information (`getTaskInfo`). */
185
+ export interface GanttTaskInfo {
186
+ readonly id: RowId;
187
+ readonly parentId: RowId | null;
188
+ readonly level: number;
189
+ readonly start: Date | null;
190
+ readonly end: Date | null;
191
+ readonly duration: number;
192
+ readonly durationUnit: DurationUnit;
193
+ readonly progress: number;
194
+ readonly milestone: boolean;
195
+ readonly parent: boolean;
196
+ readonly manual: boolean;
197
+ readonly unscheduled: boolean;
198
+ readonly work: number;
199
+ readonly wbs: string;
200
+ readonly critical: boolean;
201
+ /** Total float in hours of working time (valid with `criticalPath`). */
202
+ readonly totalFloat: number;
203
+ readonly predecessors: readonly Dependency[];
204
+ readonly segments: readonly {
205
+ readonly start: Date;
206
+ readonly end: Date;
207
+ }[] | null;
208
+ }
209
+ export type GanttEventSource = 'pointer' | 'keyboard' | 'touch' | 'api';
210
+ /** Base of Gantt events: the Data Grid event shape. */
211
+ export type GanttEvent = DataGridEvent;
212
+ export interface GanttTaskbarEditEvent<Row> extends GanttEvent {
213
+ readonly action: GanttTaskbarAction;
214
+ readonly taskId: RowId;
215
+ readonly task: Row;
216
+ /** Proposed dates and progress (start of the edit in `onTaskbarEditStart`). */
217
+ readonly start: Date | null;
218
+ readonly end: Date | null;
219
+ readonly progress: number;
220
+ /** For `'connect'`: the link being drawn. */
221
+ readonly dependency?: Dependency & {
222
+ readonly to: RowId;
223
+ };
224
+ readonly segmentIndex?: number;
225
+ }
226
+ export interface GanttDependencyChangeEvent<Row> extends GanttEvent {
227
+ readonly action: 'add' | 'remove' | 'update';
228
+ readonly taskId: RowId;
229
+ readonly task: Row | null;
230
+ readonly dependencies: readonly Dependency[];
231
+ readonly previous: readonly Dependency[];
232
+ }
233
+ export interface GanttScheduleConflictEvent<Row> extends GanttEvent {
234
+ readonly conflicts: readonly (ScheduleConflict & {
235
+ readonly task: Row | null;
236
+ })[];
237
+ /** Settles the conflict: keep the link and move the task, remove the link, or cancel the change. Default: the built-in dialog asks. */
238
+ resolve(choice: 'move' | 'removeLink' | 'cancel'): void;
239
+ }
240
+ export interface GanttTaskChangeEvent<Row> extends GanttEvent {
241
+ readonly action: 'add' | 'update' | 'delete' | 'indent' | 'outdent' | 'move' | 'split' | 'merge' | 'undo' | 'redo';
242
+ readonly taskIds: readonly RowId[];
243
+ /** The changed rows after the change (empty for deletes). */
244
+ readonly rows: readonly Row[];
245
+ }
246
+ export interface GanttZoomChangeEvent extends GanttEvent {
247
+ readonly level: number;
248
+ readonly previous: number;
249
+ }
250
+ export interface GanttSplitterEvent extends GanttEvent {
251
+ /** Grid pane width in px. */
252
+ readonly position: number;
253
+ }
254
+ export interface GanttTaskbarClickEvent<Row> extends GanttEvent {
255
+ readonly taskId: RowId;
256
+ readonly task: Row;
257
+ readonly target: 'taskbar' | 'milestone' | 'parent' | 'baseline' | 'connector' | 'label';
258
+ }
259
+ export interface GanttChartPointerEvent<Row> extends GanttEvent {
260
+ readonly date: Date;
261
+ readonly taskId: RowId | null;
262
+ readonly task: Row | null;
263
+ }
264
+ export interface GanttTooltipOpenEvent<Row> extends GanttEvent {
265
+ readonly kind: 'taskbar' | 'baseline' | 'connector' | 'timeline' | 'editing';
266
+ readonly task: Row | null;
267
+ }
268
+ export interface GanttToolbarItemClickEvent extends GanttEvent {
269
+ readonly item: string;
270
+ }
271
+ export interface GanttContextMenuOpenEvent<Row> extends GanttEvent {
272
+ readonly pane: 'grid' | 'chart';
273
+ readonly taskId: RowId | null;
274
+ readonly task: Row | null;
275
+ }
276
+ export interface GanttContextMenuItemClickEvent<Row> extends GanttEvent {
277
+ readonly item: string;
278
+ readonly taskId: RowId | null;
279
+ readonly task: Row | null;
280
+ }
281
+ export interface GanttDialogOpenEvent<Row> extends GanttEvent {
282
+ readonly mode: 'add' | 'edit';
283
+ readonly taskId: RowId | null;
284
+ readonly task: Row | null;
285
+ }
286
+ export interface GanttExportEvent extends GanttEvent {
287
+ readonly format: 'excel' | 'csv' | 'pdf';
288
+ readonly fileName: string;
289
+ }
290
+ export interface GanttErrorEvent {
291
+ readonly error: unknown;
292
+ readonly action: string;
293
+ readonly taskIds: readonly RowId[];
294
+ }
295
+ /** `adaptive` options. */
296
+ export interface GanttAdaptive {
297
+ /** Container width (px) below which the adaptive layout applies; measured after hydration (default 640). */
298
+ readonly breakpoint?: number;
299
+ }
300
+ /** Built-in toolbar items. */
301
+ export type GanttToolbarItemId = 'add' | 'edit' | 'update' | 'delete' | 'cancel' | 'expandAll' | 'collapseAll' | 'search' | 'previousTimeSpan' | 'nextTimeSpan' | 'zoomIn' | 'zoomOut' | 'zoomToFit' | 'indent' | 'outdent' | 'criticalPath' | 'excelExport' | 'csvExport' | 'pdfExport' | 'undo' | 'redo';
302
+ export type GanttToolbarItem = GanttToolbarItemId | {
303
+ readonly id: string;
304
+ readonly text?: string;
305
+ readonly icon?: ReactNode;
306
+ readonly disabled?: boolean;
307
+ readonly align?: 'start' | 'end';
308
+ readonly render?: () => ReactNode;
309
+ };
310
+ /** Built-in context menu items. */
311
+ export type GanttContextMenuItemId = 'taskInformation' | 'deleteTask' | 'addAbove' | 'addBelow' | 'addChild' | 'addMilestone' | 'convertToTask' | 'convertToMilestone' | 'deleteDependency' | 'indent' | 'outdent' | 'splitTask' | 'mergeTask' | 'cancel';
312
+ export type GanttContextMenuItem = GanttContextMenuItemId | DataGridContextMenuItemId | DataGridMenuItem;
313
+ /** A dialog tab. */
314
+ export type GanttDialogTab<Row> = {
315
+ readonly type: 'general' | 'dependency' | 'resources' | 'notes' | 'segments';
316
+ readonly label?: string;
317
+ readonly fields?: readonly string[];
318
+ } | {
319
+ readonly type: 'custom';
320
+ readonly label: string;
321
+ readonly render: (ctx: {
322
+ readonly task: Row | null;
323
+ readonly values: Record<string, unknown>;
324
+ readonly setValue: (field: string, value: unknown) => void;
325
+ }) => ReactNode;
326
+ };
327
+ /** `editing`. */
328
+ export interface GanttEditing<Row> {
329
+ /** Grid pane edit mode; `'auto'` is cell editing in the grid and the dialog from the chart. Default `'auto'`. */
330
+ readonly mode?: 'cell' | 'row' | 'dialog' | 'auto';
331
+ readonly edit?: boolean;
332
+ readonly add?: boolean;
333
+ readonly delete?: boolean;
334
+ /** Taskbar drag, resize, progress and connect (default true when editable). */
335
+ readonly taskbar?: boolean;
336
+ /** Dropping a taskbar on another row reparents (or reassigns in the resource view). */
337
+ readonly taskbarDragBetweenRows?: boolean;
338
+ readonly newRowPosition?: 'top' | 'bottom' | 'above' | 'below' | 'child';
339
+ readonly confirmDelete?: boolean;
340
+ readonly dialogTabs?: readonly GanttDialogTab<Row>[];
341
+ }
342
+ /** `undo`. */
343
+ export interface GanttUndo {
344
+ readonly actions?: readonly string[];
345
+ readonly limit?: number;
346
+ }
347
+ /** A resource. */
348
+ export type GanttResource = Readonly<Record<string, unknown>>;
349
+ /** `resourceFields`. Defaults `id`, `name`, `unit`, `group`. */
350
+ export interface GanttResourceFields {
351
+ readonly id?: string;
352
+ readonly name?: string;
353
+ readonly unit?: string;
354
+ readonly group?: string;
355
+ }
356
+ /** Export writers: loaders of `@salmonui/export` subpaths. */
357
+ export interface GanttExportWriters {
358
+ readonly excel?: () => Promise<{
359
+ readonly exportXlsx: unknown;
360
+ }>;
361
+ readonly pdf?: () => Promise<{
362
+ readonly exportGanttPdf: unknown;
363
+ }>;
364
+ }
365
+ /** A PDF export. */
366
+ export interface GanttPdfExportOptions<Row> {
367
+ readonly fileName?: string;
368
+ readonly pageSize?: 'A4' | 'A3' | 'Letter' | 'Legal' | {
369
+ readonly width: number;
370
+ readonly height: number;
371
+ };
372
+ readonly orientation?: 'portrait' | 'landscape';
373
+ /** Scales the chart so the whole timeline fits the page width. Default false (pages across). */
374
+ readonly fitToWidth?: boolean;
375
+ readonly header?: string;
376
+ readonly footer?: string;
377
+ /** A TrueType font for non-Latin text (the PDF writer's `font`). */
378
+ readonly font?: unknown;
379
+ readonly cell?: (ctx: {
380
+ readonly task: Row;
381
+ readonly field: string;
382
+ readonly value: unknown;
383
+ text: string;
384
+ }) => void;
385
+ readonly headerCell?: (ctx: {
386
+ readonly field: string;
387
+ text: string;
388
+ }) => void;
389
+ readonly taskbar?: (ctx: {
390
+ readonly task: Row;
391
+ readonly info: GanttTaskInfo;
392
+ color: string;
393
+ progressColor: string;
394
+ }) => void;
395
+ readonly timelineCell?: (ctx: {
396
+ readonly date: Date;
397
+ readonly tier: 'top' | 'bottom';
398
+ text: string;
399
+ }) => void;
400
+ }
401
+ /** Excel / CSV export options: the Data Grid export options and hooks. */
402
+ export type GanttGridExportOptions<Row> = Pick<DataGridExportOptions<Row>, 'fileName' | 'cell' | 'headerCell' | 'tree' | 'includeHiddenColumns' | 'columns'>;
403
+ export interface GanttExportFile<T> {
404
+ readonly fileName: string;
405
+ readonly mimeType: string;
406
+ readonly data: T;
407
+ }
408
+ /** Grid-pane props passed to the `DataGrid` unchanged (GGRID rows keep the Data Grid names). */
409
+ export type GanttGridProps<Row> = Pick<DataGridProps<Row>, 'sorting' | 'onBeforeSortChange' | 'onSortChange' | 'filtering' | 'onBeforeFilterChange' | 'onFilterChange' | 'search' | 'onBeforeSearchChange' | 'onSearchChange' | 'selection' | 'onBeforeSelectionChange' | 'onSelectionChange' | 'columnMenu' | 'renderContextMenu' | 'reorderable' | 'onBeforeColumnReorder' | 'onColumnReorder' | 'resizable' | 'resizeMode' | 'onColumnResizeStart' | 'onColumnResize' | 'onColumnResizeEnd' | 'columnChooser' | 'onBeforeColumnVisibilityChange' | 'onColumnVisibilityChange' | 'gridLines' | 'highlightOnHover' | 'striped' | 'textWrap' | 'overflow' | 'getRowProps' | 'getCellProps' | 'rowClassName' | 'renderEmpty' | 'loadingIndicator' | 'onViewChange' | 'onRowDoubleClick' | 'onRowClick' | 'onCellClick' | 'rowDrag' | 'onBeforeRowDrop' | 'onRowDrop' | 'onRowDragStart' | 'onRowDrag' | 'onBeforeTreeToggle' | 'onTreeToggle' | 'onBeforeEditStart' | 'onBeforeCellValueChange' | 'onBeforeSave' | 'onSave' | 'keyBindings' | 'onKeyDown' | 'virtualization' | 'initialRows' | 'currency' | 'icons' | 'features'>;
410
+ export interface GanttProps<Row = Record<string, unknown>> extends Partial<GanttGridProps<Row>> {
411
+ /** Tasks (nested `children` or flat `parentId`), or a `@salmonui/data` / Data Grid source. Reactive. */
412
+ readonly data: readonly Row[] | DataSource<Row>;
413
+ readonly taskFields?: GanttTaskFields;
414
+ /** Grid pane columns: Data Grid columns or task column presets. Default title, start, end, duration, progress. */
415
+ readonly columns?: readonly (GanttColumnPreset | DataGridColumn<Row>)[];
416
+ /** Field of the tree column. Default the title column. */
417
+ readonly treeColumn?: string;
418
+ /** Rows a filter or search keeps around the matches (Data Grid `tree.filterMode`). Default `'ancestors'`. */
419
+ readonly treeFilterMode?: 'ancestors' | 'descendants' | 'both' | 'none';
420
+ /** `'all'` (default) or `'none'`; the `expanded` role wins per task. */
421
+ readonly defaultExpanded?: 'all' | 'none' | boolean;
422
+ /** Load children on demand: rows with this field true have children loaded on expand. */
423
+ readonly hasChildrenField?: string;
424
+ readonly loadChildren?: (ctx: {
425
+ readonly rowId: RowId;
426
+ readonly row: Row;
427
+ readonly signal: AbortSignal;
428
+ }) => readonly Row[] | Promise<readonly Row[]>;
429
+ readonly taskMode?: TaskMode;
430
+ readonly autoSchedule?: boolean;
431
+ readonly projectStart?: GanttDateInput | null;
432
+ readonly projectEnd?: GanttDateInput | null;
433
+ readonly workingTime?: GanttWorkingTime;
434
+ readonly holidays?: readonly GanttHoliday[];
435
+ readonly calendars?: readonly GanttCalendar[];
436
+ readonly projectCalendar?: string;
437
+ readonly durationUnit?: DurationUnit;
438
+ readonly workUnit?: WorkUnit;
439
+ readonly taskType?: TaskType;
440
+ readonly dependencyTypes?: readonly DependencyType[];
441
+ readonly validateDependencies?: boolean;
442
+ readonly validateManualTasks?: boolean;
443
+ readonly parentDependencies?: boolean;
444
+ readonly dependencyLag?: {
445
+ readonly normalizeOnLoad?: boolean;
446
+ readonly updateOnTaskbarEdit?: boolean;
447
+ };
448
+ readonly unscheduledTasks?: boolean;
449
+ readonly criticalPath?: boolean;
450
+ /** IANA zone the task dates are wall times in. Set it for SSR. */
451
+ readonly timeZone?: string;
452
+ readonly locale?: string;
453
+ readonly localeText?: GanttLocaleText;
454
+ /**
455
+ * Column, label and tooltip date format: `Intl.DateTimeFormat` options, or a Data Grid format string
456
+ * (a skeleton such as `'yMMMd'` or a style such as `'short'`; a pattern such as `'dd.MM.yyyy'` formats the grid columns).
457
+ */
458
+ readonly dateFormat?: Intl.DateTimeFormatOptions | string;
459
+ readonly wbs?: boolean | {
460
+ readonly autoUpdate?: boolean;
461
+ };
462
+ readonly resources?: readonly GanttResource[];
463
+ readonly resourceFields?: GanttResourceFields;
464
+ readonly resourceView?: boolean;
465
+ readonly overAllocation?: boolean;
466
+ readonly multiTaskbar?: boolean;
467
+ readonly taskbarOverlap?: boolean;
468
+ readonly timeline?: GanttTimeline;
469
+ /** Zoom level index into `zoomLevels` (reactive) / `onZoomChange`. */
470
+ readonly zoom?: number;
471
+ readonly defaultZoom?: number;
472
+ readonly zoomLevels?: readonly GanttZoomLevel[];
473
+ readonly onZoomChange?: (event: GanttZoomChangeEvent) => void;
474
+ readonly highlightWeekends?: boolean;
475
+ readonly markers?: readonly GanttMarker[];
476
+ readonly rowHeight?: number;
477
+ /** Per-row height (taller rows for baselines or lanes), shared with the grid through the row-height extension point. */
478
+ readonly getRowHeight?: (row: Row) => number;
479
+ readonly taskbarHeight?: number;
480
+ readonly baselines?: boolean;
481
+ readonly labels?: {
482
+ readonly start?: GanttLabel<Row>;
483
+ readonly end?: GanttLabel<Row>;
484
+ readonly inside?: GanttLabel<Row>;
485
+ };
486
+ readonly tooltip?: boolean | GanttTooltipOptions<Row>;
487
+ readonly onBeforeTooltipOpen?: (event: GanttTooltipOpenEvent<Row>) => void;
488
+ readonly renderTaskbar?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
489
+ readonly renderParentTaskbar?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
490
+ readonly renderMilestone?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
491
+ readonly renderBaseline?: (ctx: GanttTaskbarContext<Row>) => ReactNode;
492
+ readonly getTaskbarProps?: (ctx: GanttTaskbarContext<Row>) => GanttTaskbarProps | undefined;
493
+ readonly connectorWidth?: number;
494
+ readonly inlineNotes?: boolean;
495
+ readonly focusTaskOnSelect?: boolean;
496
+ readonly splitter?: GanttSplitter;
497
+ readonly panes?: 'both' | 'grid' | 'chart';
498
+ /** Adaptive UI: one pane at a time with a pane switch and full-screen dialogs; `true` always (server markup included), `{ breakpoint }` below the container width (measured after hydration). */
499
+ readonly adaptive?: boolean | GanttAdaptive;
500
+ readonly readOnly?: boolean;
501
+ readonly editing?: boolean | GanttEditing<Row>;
502
+ readonly undo?: boolean | GanttUndo;
503
+ readonly toolbar?: readonly GanttToolbarItem[];
504
+ readonly onToolbarItemClick?: (event: GanttToolbarItemClickEvent) => void;
505
+ /** Context menu of both panes: Gantt items, Data Grid items and custom items; `true` for the default set. */
506
+ readonly contextMenu?: boolean | readonly GanttContextMenuItem[];
507
+ readonly onBeforeContextMenuOpen?: (event: GanttContextMenuOpenEvent<Row>) => void;
508
+ readonly onContextMenuItemClick?: (event: GanttContextMenuItemClickEvent<Row>) => void;
509
+ readonly onTaskbarEditStart?: (event: GanttTaskbarEditEvent<Row>) => void;
510
+ /** At most once per animation frame. */
511
+ readonly onTaskbarEdit?: (event: GanttTaskbarEditEvent<Row>) => void;
512
+ readonly onBeforeTaskbarEditEnd?: (event: GanttTaskbarEditEvent<Row>) => void;
513
+ readonly onTaskbarEditEnd?: (event: GanttTaskbarEditEvent<Row>) => void;
514
+ readonly onBeforeDependencyChange?: (event: GanttDependencyChangeEvent<Row>) => void;
515
+ readonly onDependencyChange?: (event: GanttDependencyChangeEvent<Row>) => void;
516
+ readonly onScheduleConflict?: (event: GanttScheduleConflictEvent<Row>) => void;
517
+ readonly onBeforeTaskChange?: (event: GanttTaskChangeEvent<Row>) => void;
518
+ readonly onTaskChange?: (event: GanttTaskChangeEvent<Row>) => void;
519
+ readonly onTaskbarClick?: (event: GanttTaskbarClickEvent<Row>) => void;
520
+ /** At most once per animation frame. */
521
+ readonly onChartPointerMove?: (event: GanttChartPointerEvent<Row>) => void;
522
+ readonly onSplitterResizeStart?: (event: GanttSplitterEvent) => void;
523
+ readonly onSplitterResize?: (event: GanttSplitterEvent) => void;
524
+ readonly onSplitterResizeEnd?: (event: GanttSplitterEvent) => void;
525
+ readonly onBeforeDialogOpen?: (event: GanttDialogOpenEvent<Row>) => void;
526
+ readonly onBeforeExport?: (event: GanttExportEvent) => void;
527
+ readonly onExport?: (event: GanttExportEvent) => void;
528
+ readonly onError?: (event: GanttErrorEvent) => void;
529
+ readonly onReady?: (api: GanttApi<Row>) => void;
530
+ /** Writes the changed rows back (local `data`): called once per committed change with the full new array. */
531
+ readonly onDataChange?: (rows: readonly Row[], event: GanttTaskChangeEvent<Row>) => void;
532
+ readonly exportWriters?: GanttExportWriters;
533
+ readonly height?: number | string;
534
+ readonly width?: number | string;
535
+ readonly dir?: 'ltr' | 'rtl' | 'auto';
536
+ readonly className?: string;
537
+ readonly style?: CSSProperties;
538
+ readonly id?: string;
539
+ readonly 'aria-label'?: string;
540
+ readonly ref?: Ref<GanttApi<Row>>;
541
+ }
542
+ /** Task column presets. */
543
+ export type GanttColumnPreset = 'title' | 'start' | 'end' | 'duration' | 'progress' | 'predecessors' | 'resources' | 'work' | 'taskType' | 'notes' | 'baselineStart' | 'baselineEnd' | 'wbs' | 'wbsPredecessors' | 'serialNumber' | 'id';
544
+ /** Results of Gantt actions. */
545
+ export interface GanttActionResult {
546
+ readonly status: 'applied' | 'rejected' | 'conflict';
547
+ readonly reason?: string;
548
+ }
549
+ export interface GanttState {
550
+ readonly grid: unknown;
551
+ readonly splitter: number | null;
552
+ readonly zoom: number;
553
+ readonly scrollDate: string | null;
554
+ }
555
+ /** `ref`; extends the grid pane's `DataGridApi`. */
556
+ export interface GanttApi<Row = Record<string, unknown>> extends Omit<DataGridApi<Row>, 'cancelEdit' | 'getState' | 'restoreState' | 'exportToExcel' | 'exportToCsv' | 'exportToPdf' | 'print' | 'undo' | 'redo' | 'setLoading'> {
557
+ readonly grid: DataGridApi<Row>;
558
+ getTask(id: RowId): Row | undefined;
559
+ getTaskInfo(id: RowId): GanttTaskInfo | undefined;
560
+ getViewRows(): readonly Row[];
561
+ getCriticalTasks(): readonly Row[];
562
+ formatDuration(id: RowId): string;
563
+ formatWork(id: RowId): string;
564
+ addTask(task?: Partial<Row>, options?: {
565
+ readonly position?: 'top' | 'bottom' | 'above' | 'below' | 'child';
566
+ readonly targetId?: RowId;
567
+ }): GanttActionResult;
568
+ updateTask(id: RowId, changes: Partial<Row>): GanttActionResult;
569
+ deleteTasks(ids: RowId | readonly RowId[]): GanttActionResult;
570
+ changeTaskId(id: RowId, newId: RowId): GanttActionResult;
571
+ cancelEdit(): void;
572
+ indent(ids: RowId | readonly RowId[]): GanttActionResult;
573
+ outdent(ids: RowId | readonly RowId[]): GanttActionResult;
574
+ moveTasks(ids: RowId | readonly RowId[], targetId: RowId, position: 'above' | 'below' | 'child'): GanttActionResult;
575
+ addDependency(taskId: RowId, dependency: Dependency | string): GanttActionResult;
576
+ removeDependency(taskId: RowId, predecessorId: RowId): GanttActionResult;
577
+ updateDependencies(taskId: RowId, dependencies: readonly Dependency[] | string): GanttActionResult;
578
+ splitTask(id: RowId, date: GanttDateInput): GanttActionResult;
579
+ mergeSegments(id: RowId, segmentIndexes: readonly number[]): GanttActionResult;
580
+ convertToMilestone(id: RowId): GanttActionResult;
581
+ convertToTask(id: RowId): GanttActionResult;
582
+ setTaskMode(id: RowId, mode: 'auto' | 'manual'): GanttActionResult;
583
+ setProjectDates(start: GanttDateInput, end: GanttDateInput): void;
584
+ expandAll(): void;
585
+ collapseAll(): void;
586
+ expandRows(ids: RowId | readonly RowId[]): void;
587
+ collapseRows(ids: RowId | readonly RowId[]): void;
588
+ zoomIn(): void;
589
+ zoomOut(): void;
590
+ zoomToFit(): void;
591
+ getZoom(): number;
592
+ extendTimeline(side: 'start' | 'end'): void;
593
+ scrollToDate(date: GanttDateInput): void;
594
+ scrollToTask(id: RowId): void;
595
+ scrollTo(options: {
596
+ readonly top?: number;
597
+ readonly left?: number;
598
+ }): void;
599
+ setSplitterPosition(position: number | string): void;
600
+ openAddDialog(): void;
601
+ openEditDialog(id: RowId): void;
602
+ closeDialog(): void;
603
+ undo(): void;
604
+ redo(): void;
605
+ getUndoActions(): readonly string[];
606
+ getRedoActions(): readonly string[];
607
+ clearUndo(): void;
608
+ clearRedo(): void;
609
+ setLoading(loading: boolean): void;
610
+ getState(): GanttState;
611
+ restoreState(state: GanttState): void;
612
+ /** The grid pane's Excel export with the Data Grid `cell` / `headerCell` hooks; tree rows as outline levels. */
613
+ exportToExcel(options?: GanttGridExportOptions<Row> & {
614
+ readonly sheetName?: string;
615
+ }): Promise<GanttExportFile<Uint8Array> | null>;
616
+ exportToCsv(options?: GanttGridExportOptions<Row> & {
617
+ readonly separator?: string; /** Default true; `false` writes raw text. */
618
+ readonly escapeFormulas?: boolean;
619
+ }): Promise<GanttExportFile<string> | null>;
620
+ exportToPdf(options?: GanttPdfExportOptions<Row>): Promise<GanttExportFile<Uint8Array> | null>;
621
+ print(): void;
622
+ getTaskbarElement(id: RowId): HTMLElement | null;
623
+ getChartElement(): HTMLElement | null;
624
+ }
625
+ //# sourceMappingURL=types.d.ts.map