apexgantt 3.7.0 → 3.9.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/.github/workflows/publish.yml +1 -3
- package/README.md +117 -44
- package/apexgantt.d.ts +1051 -0
- package/apexgantt.es.min.js +1 -1
- package/apexgantt.min.js +1 -1
- package/demo/accessibility-demo.html +217 -0
- package/demo/baseline.html +150 -0
- package/demo/critical-path.html +225 -0
- package/demo/css-theming.html +445 -0
- package/demo/dependency-types.html +284 -0
- package/demo/events-demo.html +5 -11
- package/demo/mixed-contexts.html +263 -0
- package/demo/responsive-height-test.html +171 -0
- package/demo/row-virtualizer-demo.html +148 -0
- package/demo/selection-demo.html +492 -0
- package/demo/task-list-columns-demo.html +642 -0
- package/demo/toolbar-demo.html +633 -0
- package/package.json +5 -6
- package/demo/basic-gantt-large-range.html +0 -46
- package/index.d.ts +0 -15
- package/lib/gantt.d.ts +0 -93
- package/lib/models/Annotation.d.ts +0 -56
- package/lib/models/ArrowLink.d.ts +0 -28
- package/lib/models/Bar.d.ts +0 -30
- package/lib/models/BarDragManager.d.ts +0 -27
- package/lib/models/BarResizeManager.d.ts +0 -21
- package/lib/models/DataManager.d.ts +0 -44
- package/lib/models/DataParser.d.ts +0 -57
- package/lib/models/Dialog.d.ts +0 -37
- package/lib/models/Options.d.ts +0 -118
- package/lib/models/SplitView.d.ts +0 -29
- package/lib/models/StateManager.d.ts +0 -20
- package/lib/models/TaskForm.d.ts +0 -28
- package/lib/models/Tasks.d.ts +0 -51
- package/lib/models/Theme.d.ts +0 -36
- package/lib/models/TimeLine.d.ts +0 -21
- package/lib/styles/Dialog.style.d.ts +0 -1
- package/lib/styles/Dropdown.style.d.ts +0 -1
- package/lib/styles/Gantt.style.d.ts +0 -1
- package/lib/styles/Scrollbar.style.d.ts +0 -1
- package/lib/styles/TaskForm.style.d.ts +0 -1
- package/lib/styles/Tasks.style.d.ts +0 -1
- package/lib/styles/Timeline.style.d.ts +0 -1
- package/lib/styles/Toolbar.style.d.ts +0 -1
- package/lib/styles/Tooltip.style.d.ts +0 -1
- package/lib/types/events.d.ts +0 -95
- package/lib/util/arrow.util.d.ts +0 -3
- package/lib/util/bar.util.d.ts +0 -4
- package/lib/util/date.util.d.ts +0 -24
- package/lib/util/dom-context.util.d.ts +0 -48
- package/lib/util/gantt-export.d.ts +0 -1
- package/lib/util/gantt.util.d.ts +0 -9
- package/lib/util/ganttExport.d.ts +0 -1
- package/lib/util/icon.util.d.ts +0 -7
- package/lib/util/style-injection.util.d.ts +0 -24
- package/lib/util/task.util.d.ts +0 -44
package/apexgantt.d.ts
ADDED
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing an annotation in the graph.
|
|
3
|
+
*/
|
|
4
|
+
export declare interface Annotation {
|
|
5
|
+
readonly bgColor?: string;
|
|
6
|
+
readonly borderColor?: string;
|
|
7
|
+
readonly borderDashArray?: number;
|
|
8
|
+
readonly borderWidth?: number;
|
|
9
|
+
readonly label?: AnnotationLabel;
|
|
10
|
+
readonly x1: string;
|
|
11
|
+
readonly x2?: null | string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Interface representing the label of an annotation.
|
|
16
|
+
*/
|
|
17
|
+
declare interface AnnotationLabel {
|
|
18
|
+
readonly fontColor?: string;
|
|
19
|
+
readonly fontFamily?: string;
|
|
20
|
+
readonly fontSize?: string;
|
|
21
|
+
readonly fontWeight?: string;
|
|
22
|
+
readonly orientation?: Orientation;
|
|
23
|
+
readonly text?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class ApexGantt extends BaseChart {
|
|
27
|
+
private options;
|
|
28
|
+
private viewMode;
|
|
29
|
+
private arrowLink;
|
|
30
|
+
private dataManager;
|
|
31
|
+
private stateManager;
|
|
32
|
+
private containerResizeObserver;
|
|
33
|
+
private lastKnownWidth;
|
|
34
|
+
private lastKnownHeight;
|
|
35
|
+
private resizeDebounceTimer;
|
|
36
|
+
private dependencyArrowHandler;
|
|
37
|
+
private rowHoverHandler;
|
|
38
|
+
private rowHoverLeaveHandler;
|
|
39
|
+
private criticalPathResult;
|
|
40
|
+
/** Cached references to frequently queried DOM elements. Populated by cacheDomElements() after each render. */
|
|
41
|
+
private domCache;
|
|
42
|
+
private scrollManager;
|
|
43
|
+
private zoomManager;
|
|
44
|
+
private layoutManager;
|
|
45
|
+
private styleManager;
|
|
46
|
+
private keyboardNavigationManager;
|
|
47
|
+
private selectionManager;
|
|
48
|
+
private virtualScrollCoordinator;
|
|
49
|
+
/** MediaQueryList for prefers-reduced-motion. Updated dynamically. */
|
|
50
|
+
private reducedMotionMQL;
|
|
51
|
+
private reducedMotionHandler;
|
|
52
|
+
constructor(element: HTMLElement, options?: GanttUserOptions);
|
|
53
|
+
/**
|
|
54
|
+
* Set the global ApexCharts license key.
|
|
55
|
+
*
|
|
56
|
+
* Call this once before creating any chart instance, typically at app startup.
|
|
57
|
+
* Without a valid license the chart renders with a watermark.
|
|
58
|
+
*
|
|
59
|
+
* @param key - The license key string provided by ApexCharts.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { ApexGantt } from 'apexgantt';
|
|
64
|
+
* ApexGantt.setLicense('YOUR_LICENSE_KEY');
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
static setLicense(key: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Detect prefers-reduced-motion at init time and listen for runtime changes.
|
|
70
|
+
* When active, a CSS class is toggled on the root element so that the
|
|
71
|
+
* `@media (prefers-reduced-motion: reduce)` rules in Gantt.style.ts disable
|
|
72
|
+
* all transitions/animations automatically.
|
|
73
|
+
*/
|
|
74
|
+
private setupReducedMotion;
|
|
75
|
+
private initializeTooltip;
|
|
76
|
+
/**
|
|
77
|
+
* Render the Gantt chart into the element supplied in the constructor.
|
|
78
|
+
*
|
|
79
|
+
* Call once after construction to create the initial DOM. Subsequent renders
|
|
80
|
+
* (triggered by `update()` or internal interactions) are handled automatically.
|
|
81
|
+
*
|
|
82
|
+
* @param _data - Reserved for future use. Pass `undefined` or omit.
|
|
83
|
+
* @returns The container `HTMLElement` that hosts the chart.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const gantt = new ApexGantt(document.getElementById('chart')!, options);
|
|
88
|
+
* gantt.render();
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
render(_data?: TaskInput[]): HTMLElement;
|
|
92
|
+
private cacheDomElements;
|
|
93
|
+
private clearDomCache;
|
|
94
|
+
private performAfterActions;
|
|
95
|
+
/**
|
|
96
|
+
* Create (or re-create) the VirtualScrollCoordinator.
|
|
97
|
+
* Called once per full render, before the coordinator is used.
|
|
98
|
+
*/
|
|
99
|
+
private initVirtualScrollCoordinator;
|
|
100
|
+
private setupRowHoverSync;
|
|
101
|
+
private setupRowBackgroundColors;
|
|
102
|
+
private fadeArrowsAfterAnimation;
|
|
103
|
+
private renderDependencyArrows;
|
|
104
|
+
private setupDependencyArrowEvents;
|
|
105
|
+
private computeCriticalPath;
|
|
106
|
+
private applyCriticalPathHighlighting;
|
|
107
|
+
private rerenderTimeline;
|
|
108
|
+
private cleanupEventListeners;
|
|
109
|
+
private cleanupTooltips;
|
|
110
|
+
private cleanupDependencyArrows;
|
|
111
|
+
private createActionButton;
|
|
112
|
+
private createSeparator;
|
|
113
|
+
private createViewModeDisplay;
|
|
114
|
+
/**
|
|
115
|
+
* Render the built-in toolbar (zoom controls, view-mode display, export button,
|
|
116
|
+
* and any custom `toolbarItems`) into the provided container element.
|
|
117
|
+
*
|
|
118
|
+
* Normally called automatically by `render()`. Use this method directly only
|
|
119
|
+
* when you need to mount the toolbar in a custom DOM slot outside the chart.
|
|
120
|
+
*
|
|
121
|
+
* @param container - The `HTMLElement` to render the toolbar into.
|
|
122
|
+
* Its `innerHTML` is replaced on each call.
|
|
123
|
+
*/
|
|
124
|
+
renderToolbar(container: HTMLElement): void;
|
|
125
|
+
/**
|
|
126
|
+
* Build a single DOM element for a custom toolbar item.
|
|
127
|
+
* Returns null for unknown types (future-proofing).
|
|
128
|
+
*/
|
|
129
|
+
private createToolbarItem;
|
|
130
|
+
private createToolbarButton;
|
|
131
|
+
private createToolbarSelect;
|
|
132
|
+
/**
|
|
133
|
+
* Update chart options and re-render.
|
|
134
|
+
*
|
|
135
|
+
* Merges the supplied options with the current configuration. Only the keys
|
|
136
|
+
* you pass are changed; unspecified keys keep their current values. Passing
|
|
137
|
+
* `undefined` for a key resets it to its default value.
|
|
138
|
+
*
|
|
139
|
+
* Scroll position, collapsed/expanded state, and current view mode are
|
|
140
|
+
* preserved across updates unless explicitly overridden.
|
|
141
|
+
*
|
|
142
|
+
* @param options - Partial or full `GanttUserOptions` to apply.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* // Switch to month view and update tasks
|
|
147
|
+
* gantt.update({ viewMode: ViewMode.Month, series: newTasks });
|
|
148
|
+
*
|
|
149
|
+
* // Toggle dark theme at runtime
|
|
150
|
+
* gantt.update({ theme: 'dark' });
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
update(options: GanttUserOptions): void;
|
|
154
|
+
private detectCurrentTheme;
|
|
155
|
+
/**
|
|
156
|
+
* Imperatively update a single task's data and reflect the change in the UI
|
|
157
|
+
* without triggering a full re-render.
|
|
158
|
+
*
|
|
159
|
+
* Useful for applying real-time changes (e.g. progress updates from a server)
|
|
160
|
+
* with minimal DOM work. Only the affected task bar and row are updated.
|
|
161
|
+
*
|
|
162
|
+
* @param taskId - The `id` of the task to update.
|
|
163
|
+
* @param updatedTask - A partial `Task` object containing only the fields to change.
|
|
164
|
+
* Supply `startTime`, `endTime`, `progress`, `name`, etc. — any subset is valid.
|
|
165
|
+
*
|
|
166
|
+
* @throws {Error} If no task with the given `taskId` exists in the current dataset.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* // Update progress for task 't3'
|
|
171
|
+
* gantt.updateTask('t3', { progress: 75 });
|
|
172
|
+
*
|
|
173
|
+
* // Shift a task's dates
|
|
174
|
+
* gantt.updateTask('t3', { startTime: '2026-06-01', endTime: '2026-06-15' });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
updateTask(taskId: string, updatedTask: Partial<Task>): void;
|
|
178
|
+
/** Returns an array of currently selected task objects. Requires `enableSelection: true`. */
|
|
179
|
+
getSelectedTasks(): Task[];
|
|
180
|
+
/** Programmatically set the selection to the given task IDs. Requires `enableSelection: true`. */
|
|
181
|
+
setSelectedTasks(ids: string[]): void;
|
|
182
|
+
/** Clear all selected tasks. Requires `enableSelection: true`. */
|
|
183
|
+
clearSelection(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Zoom in by one step (increase timeline resolution).
|
|
186
|
+
*
|
|
187
|
+
* Scale order from finest to coarsest: `Day → Week → Month → Quarter → Year`.
|
|
188
|
+
* Calling `zoomIn()` when already at `Day` view has no effect.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* gantt.zoomIn(); // e.g. Month → Week
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
zoomIn(): void;
|
|
196
|
+
/**
|
|
197
|
+
* Zoom out by one step (decrease timeline resolution).
|
|
198
|
+
*
|
|
199
|
+
* Scale order from finest to coarsest: `Day → Week → Month → Quarter → Year`.
|
|
200
|
+
* Calling `zoomOut()` when already at `Year` view has no effect.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* gantt.zoomOut(); // e.g. Month → Quarter
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
zoomOut(): void;
|
|
208
|
+
/**
|
|
209
|
+
* update the horizontal scrollbar's content width to match timeline width
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* Normalize dimension value to CSS string
|
|
213
|
+
*/
|
|
214
|
+
private normalizeDimension;
|
|
215
|
+
/**
|
|
216
|
+
* resize observer for container to handle responsive width and height changes
|
|
217
|
+
*/
|
|
218
|
+
private setupContainerResizeObserver;
|
|
219
|
+
private handleContainerResize;
|
|
220
|
+
private performResize;
|
|
221
|
+
/**
|
|
222
|
+
* Destroy the chart instance and free all associated resources.
|
|
223
|
+
*
|
|
224
|
+
* Removes all event listeners, disconnects `ResizeObserver`s, clears the
|
|
225
|
+
* tooltip, clears the DOM, and nulls internal references. After calling
|
|
226
|
+
* `destroy()`, the instance cannot be reused — create a new `ApexGantt`
|
|
227
|
+
* instead.
|
|
228
|
+
*
|
|
229
|
+
* Always call `destroy()` before removing the host element from the DOM or
|
|
230
|
+
* when cleaning up in frameworks (component `ngOnDestroy`, React `useEffect`
|
|
231
|
+
* cleanup, Vue `onBeforeUnmount`, etc.).
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* // React cleanup example
|
|
236
|
+
* useEffect(() => {
|
|
237
|
+
* const gantt = new ApexGantt(ref.current!, options);
|
|
238
|
+
* gantt.render();
|
|
239
|
+
* return () => gantt.destroy();
|
|
240
|
+
* }, []);
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
destroy(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Returns `true` if the chart has been destroyed or the host element is empty.
|
|
246
|
+
*
|
|
247
|
+
* Use this guard before calling any other method if you are unsure whether
|
|
248
|
+
* `destroy()` has already been called.
|
|
249
|
+
*
|
|
250
|
+
* @returns `true` after `destroy()` has been called, `false` while the chart is live.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* if (!gantt.isDestroyed()) {
|
|
255
|
+
* gantt.update({ series: newTasks });
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
isDestroyed(): boolean;
|
|
260
|
+
}
|
|
261
|
+
export { ApexGantt }
|
|
262
|
+
export default ApexGantt;
|
|
263
|
+
|
|
264
|
+
declare abstract class BaseChart {
|
|
265
|
+
/* Excluded from this release type: element */
|
|
266
|
+
/** Destroys the chart instance and cleans up DOM resources. */
|
|
267
|
+
destroy(): void;
|
|
268
|
+
/** Returns the unique identifier for this chart instance. */
|
|
269
|
+
getInstanceId(): string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Planned (baseline) dates for a task, used to visualise schedule variance.
|
|
274
|
+
*
|
|
275
|
+
* Attach to `TaskInput.baseline`. A thin secondary bar is rendered below the
|
|
276
|
+
* actual task bar when `GanttUserOptions.baseline.enabled` is `true`.
|
|
277
|
+
*/
|
|
278
|
+
export declare interface BaselineInput {
|
|
279
|
+
/** Planned (baseline) start date for the task */
|
|
280
|
+
readonly start: string;
|
|
281
|
+
/** Planned (baseline) end date for the task */
|
|
282
|
+
readonly end: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Visual options for baseline (planned vs. actual) bars.
|
|
287
|
+
*
|
|
288
|
+
* Enable with `GanttUserOptions.baseline.enabled = true`. Tasks that include
|
|
289
|
+
* a `baseline` field on their `TaskInput` will render a secondary thin bar
|
|
290
|
+
* below the actual task bar to show schedule variance.
|
|
291
|
+
*/
|
|
292
|
+
export declare interface BaselineOptions {
|
|
293
|
+
/** Whether to render baseline bars below actual bars. Defaults to false. */
|
|
294
|
+
readonly enabled: boolean;
|
|
295
|
+
/** Color of the baseline bar. Defaults to '#b0b8c1' (light grey). */
|
|
296
|
+
readonly color: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Identifies the built-in columns available in the task-list panel.
|
|
301
|
+
*
|
|
302
|
+
* Pass `ColumnKey` values inside `ColumnListItem.key` when configuring
|
|
303
|
+
* `GanttUserOptions.columnConfig` to control which columns are visible
|
|
304
|
+
* and in what order.
|
|
305
|
+
*/
|
|
306
|
+
export declare enum ColumnKey {
|
|
307
|
+
Duration = "duration",
|
|
308
|
+
EndTime = "endTime",
|
|
309
|
+
Name = "name",
|
|
310
|
+
Progress = "progress",
|
|
311
|
+
StartTime = "startTime"
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export declare const ColumnList: ColumnListItem[];
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Defines a single column in the task-list panel.
|
|
318
|
+
*
|
|
319
|
+
* Pass an array of these to `GanttUserOptions.columnConfig` to override the
|
|
320
|
+
* default column set. Use `ColumnList` as the starting point and filter or
|
|
321
|
+
* reorder as needed.
|
|
322
|
+
*/
|
|
323
|
+
export declare interface ColumnListItem {
|
|
324
|
+
readonly key: ColumnKey;
|
|
325
|
+
readonly title: string;
|
|
326
|
+
readonly minWidth?: string;
|
|
327
|
+
readonly flexGrow?: number;
|
|
328
|
+
readonly visible?: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export declare const DarkTheme: GanttTheme;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* DataParser - for parsing raw data objects into TaskInput format
|
|
335
|
+
*/
|
|
336
|
+
export declare class DataParser {
|
|
337
|
+
/**
|
|
338
|
+
* Extract value from nested object using dot notation path
|
|
339
|
+
* @param obj - source object
|
|
340
|
+
* @param path - dot notation path (e.g., 'project.task.title')
|
|
341
|
+
* @returns Extracted value
|
|
342
|
+
*/
|
|
343
|
+
private static getNestedValue;
|
|
344
|
+
/**
|
|
345
|
+
* single parsing value configuration
|
|
346
|
+
* @param obj - Source object
|
|
347
|
+
* @param parsingValue - Either a string path or object with key and transform
|
|
348
|
+
* @returns Processed value
|
|
349
|
+
*/
|
|
350
|
+
private static processParsingValue;
|
|
351
|
+
/**
|
|
352
|
+
* Build a TaskInput from a raw item using the provided config.
|
|
353
|
+
* Returns null if required fields are missing or cannot be extracted.
|
|
354
|
+
*/
|
|
355
|
+
private static buildTaskInput;
|
|
356
|
+
/**
|
|
357
|
+
* Parse an array of raw data objects into TaskInput array
|
|
358
|
+
* @param data - Array of raw data objects
|
|
359
|
+
* @param config - Parsing configuration mapping
|
|
360
|
+
* @returns Array of TaskInput objects
|
|
361
|
+
*/
|
|
362
|
+
static parse(data: unknown[], config: ParsingConfig): TaskInput[];
|
|
363
|
+
/**
|
|
364
|
+
* validate parsing configuration
|
|
365
|
+
* @param config - parsing configuration to validate
|
|
366
|
+
* @returns true if valid, false otherwise
|
|
367
|
+
*/
|
|
368
|
+
static validateConfig(config: ParsingConfig): boolean;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Detail payload for the `dependency-arrow-update` event.
|
|
373
|
+
*
|
|
374
|
+
* Fires when the user creates, updates, or removes a dependency arrow
|
|
375
|
+
* between two tasks in the interactive dependency editor.
|
|
376
|
+
*/
|
|
377
|
+
export declare interface DependencyArrowUpdateDetail {
|
|
378
|
+
fromId: string;
|
|
379
|
+
toId: string;
|
|
380
|
+
type: 'FF' | 'FS' | 'SF' | 'SS';
|
|
381
|
+
lag?: number;
|
|
382
|
+
chartInstanceId: string;
|
|
383
|
+
arrowLinkInstanceId?: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Finish-to-Finish (`FF`), Finish-to-Start (`FS`), Start-to-Finish (`SF`),
|
|
388
|
+
* or Start-to-Start (`SS`) dependency relationship between two tasks.
|
|
389
|
+
* Defaults to `'FS'` when not specified.
|
|
390
|
+
*/
|
|
391
|
+
export declare type DependencyType = 'FF' | 'FS' | 'SF' | 'SS';
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* chart event names
|
|
395
|
+
* use these constants to attach event listeners like below
|
|
396
|
+
*
|
|
397
|
+
* element.addEventListener(GanttEvents.TASK_UPDATE, (e) => {
|
|
398
|
+
* console.log(e.detail);
|
|
399
|
+
* });
|
|
400
|
+
*/
|
|
401
|
+
/**
|
|
402
|
+
* Typed event map for the `ApexGantt` container element.
|
|
403
|
+
*
|
|
404
|
+
* Use this interface to get fully-typed `CustomEvent.detail` when adding
|
|
405
|
+
* event listeners on the gantt element. Wrapper libraries (React, Vue,
|
|
406
|
+
* Angular) should bridge these events to their respective event systems
|
|
407
|
+
* using this map rather than casting `Event` manually.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* import type { GanttEventMap } from 'apexgantt';
|
|
412
|
+
*
|
|
413
|
+
* element.addEventListener('taskDragged', (e: GanttEventMap['taskDragged']) => {
|
|
414
|
+
* console.log(e.detail.taskId, e.detail.daysMoved);
|
|
415
|
+
* });
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
export declare interface GanttEventMap {
|
|
419
|
+
/** Fires when a task is being updated (before completion). */
|
|
420
|
+
taskUpdate: CustomEvent<TaskUpdateEventDetail>;
|
|
421
|
+
/** Fires when task form validation fails. */
|
|
422
|
+
taskValidationError: CustomEvent<TaskValidationErrorEventDetail>;
|
|
423
|
+
/** Fires after a task update completes successfully. */
|
|
424
|
+
taskUpdateSuccess: CustomEvent<TaskUpdateSuccessEventDetail>;
|
|
425
|
+
/** Fires when a task update fails with an error. */
|
|
426
|
+
taskUpdateError: CustomEvent<TaskUpdateErrorEventDetail>;
|
|
427
|
+
/** Fires when a task bar is dragged to a new position. */
|
|
428
|
+
taskDragged: CustomEvent<TaskDraggedEventDetail>;
|
|
429
|
+
/** Fires when a task bar is resized via its handles. */
|
|
430
|
+
taskResized: CustomEvent<TaskResizedEventDetail>;
|
|
431
|
+
/** Fires when the set of selected tasks changes. */
|
|
432
|
+
selectionChange: CustomEvent<SelectionChangeEventDetail>;
|
|
433
|
+
/** Fires when a dependency arrow is updated. */
|
|
434
|
+
'dependency-arrow-update': CustomEvent<DependencyArrowUpdateDetail>;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export declare const GanttEvents: {
|
|
438
|
+
/**
|
|
439
|
+
* emits when a task is being updated (before completion)
|
|
440
|
+
*/
|
|
441
|
+
readonly TASK_UPDATE: "taskUpdate";
|
|
442
|
+
/**
|
|
443
|
+
* emits when form validation fails
|
|
444
|
+
*/
|
|
445
|
+
readonly TASK_VALIDATION_ERROR: "taskValidationError";
|
|
446
|
+
/**
|
|
447
|
+
* emits after a task update completes successfully
|
|
448
|
+
*/
|
|
449
|
+
readonly TASK_UPDATE_SUCCESS: "taskUpdateSuccess";
|
|
450
|
+
/**
|
|
451
|
+
* emits when a task update fails
|
|
452
|
+
*/
|
|
453
|
+
readonly TASK_UPDATE_ERROR: "taskUpdateError";
|
|
454
|
+
/**
|
|
455
|
+
* emits when a task bar is dragged to a new position
|
|
456
|
+
*/
|
|
457
|
+
readonly TASK_DRAGGED: "taskDragged";
|
|
458
|
+
/**
|
|
459
|
+
* emits when a task bar is resized via handles
|
|
460
|
+
*/
|
|
461
|
+
readonly TASK_RESIZED: "taskResized";
|
|
462
|
+
/**
|
|
463
|
+
* emits when the set of selected tasks changes
|
|
464
|
+
*/
|
|
465
|
+
readonly SELECTION_CHANGE: "selectionChange";
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Complete color palette for the chart UI.
|
|
470
|
+
*
|
|
471
|
+
* Use `LightTheme` or `DarkTheme` as a starting point and spread-override
|
|
472
|
+
* individual fields, or pass a fully custom object. Pass the result as
|
|
473
|
+
* `GanttUserOptions.theme` when using a `ThemeMode` string is insufficient.
|
|
474
|
+
*
|
|
475
|
+
* @see {@link LightTheme} {@link DarkTheme} {@link getTheme}
|
|
476
|
+
*/
|
|
477
|
+
export declare interface GanttTheme {
|
|
478
|
+
readonly tooltipBGColor: string;
|
|
479
|
+
readonly tooltipBorderColor: string;
|
|
480
|
+
readonly tooltipTextColor: string;
|
|
481
|
+
readonly cellBorderColor: string;
|
|
482
|
+
readonly rowBackgroundColors: readonly string[];
|
|
483
|
+
readonly headerBackground: string;
|
|
484
|
+
readonly headerTextColor: string;
|
|
485
|
+
readonly barBackgroundColor: string;
|
|
486
|
+
readonly barTextColor: string;
|
|
487
|
+
readonly arrowColor: string;
|
|
488
|
+
readonly backgroundColor: string;
|
|
489
|
+
readonly textColor: string;
|
|
490
|
+
readonly borderColor: string;
|
|
491
|
+
readonly annotationBgColor: string;
|
|
492
|
+
readonly annotationBorderColor: string;
|
|
493
|
+
readonly dialogBgColor: string;
|
|
494
|
+
readonly dialogBorderColor: string;
|
|
495
|
+
readonly buttonBgColor: string;
|
|
496
|
+
readonly buttonTextColor: string;
|
|
497
|
+
readonly buttonHoverBgColor: string;
|
|
498
|
+
readonly toolbarBgColor: string;
|
|
499
|
+
readonly toolbarBorderColor: string;
|
|
500
|
+
readonly toolbarHoverBgColor: string;
|
|
501
|
+
readonly scrollbarTrackColor: string;
|
|
502
|
+
readonly scrollbarThumbColor: string;
|
|
503
|
+
readonly scrollbarThumbHoverColor: string;
|
|
504
|
+
readonly splitBarColor: string;
|
|
505
|
+
readonly splitBarHoverColor: string;
|
|
506
|
+
readonly splitBarBorderColor: string;
|
|
507
|
+
readonly splitBarHandleColor: string;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Top-level configuration object for `ApexGantt`.
|
|
512
|
+
*
|
|
513
|
+
* Pass this to `new ApexGantt(element, options)` or to `gantt.update(options)`.
|
|
514
|
+
* Every field is optional except `series`. Use a `GanttTheme` object or a
|
|
515
|
+
* `ThemeMode` string for the `theme` field; for per-task styling use the
|
|
516
|
+
* corresponding fields on `TaskInput`.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```ts
|
|
520
|
+
* const gantt = new ApexGantt('#chart', {
|
|
521
|
+
* series: myTasks,
|
|
522
|
+
* viewMode: ViewMode.Week,
|
|
523
|
+
* height: 400,
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
export declare interface GanttUserOptions {
|
|
528
|
+
/** Color theme preset. `'light'` (default) or `'dark'`. */
|
|
529
|
+
readonly theme?: ThemeMode;
|
|
530
|
+
/** Background color of annotation markers. @default '#F9D1FC' */
|
|
531
|
+
readonly annotationBgColor?: string;
|
|
532
|
+
/** Border color of annotation markers. @default '#E273EA' */
|
|
533
|
+
readonly annotationBorderColor?: string;
|
|
534
|
+
/** SVG stroke-dasharray for annotation borders, e.g. `[6, 3]`. @default [] */
|
|
535
|
+
readonly annotationBorderDashArray?: number[];
|
|
536
|
+
/** Border width of annotation markers in pixels. @default 2 */
|
|
537
|
+
readonly annotationBorderWidth?: number;
|
|
538
|
+
/** Whether annotation lines are drawn horizontally or vertically. @default Orientation.Horizontal */
|
|
539
|
+
readonly annotationOrientation?: Orientation;
|
|
540
|
+
/** Array of annotation objects to overlay on the timeline. @default [] */
|
|
541
|
+
readonly annotations?: Annotation[];
|
|
542
|
+
/** Color of dependency arrows between tasks. @default '#0D6EFD' */
|
|
543
|
+
readonly arrowColor?: string;
|
|
544
|
+
/** Background color of the whole chart container. @default '#FFFFFF' */
|
|
545
|
+
readonly backgroundColor?: string;
|
|
546
|
+
/** Default background fill color for task bars. @default '#537CFA' */
|
|
547
|
+
readonly barBackgroundColor?: string;
|
|
548
|
+
/** CSS border-radius applied to task bars. @default '5px' */
|
|
549
|
+
readonly barBorderRadius?: string;
|
|
550
|
+
/** Top and bottom margin inside each row for the task bar in pixels. @default 4 */
|
|
551
|
+
readonly barMargin?: number;
|
|
552
|
+
/** Text color rendered inside task bars. @default '#FFFFFF' */
|
|
553
|
+
readonly barTextColor?: string;
|
|
554
|
+
/** Baseline options. When `enabled` is true, tasks with a `baseline` field render a thin bar below the actual bar. */
|
|
555
|
+
readonly baseline?: Partial<BaselineOptions>;
|
|
556
|
+
/** Color of the cell and row divider lines. @default '#eff0f0' */
|
|
557
|
+
readonly borderColor?: string;
|
|
558
|
+
/** Arbitrary CSS injected onto the root container element. */
|
|
559
|
+
readonly canvasStyle?: string;
|
|
560
|
+
/** Fill color for task bars on the critical path (requires `enableCriticalPath: true`). @default '#e53935' */
|
|
561
|
+
readonly criticalBarColor?: string;
|
|
562
|
+
/** Stroke color for dependency arrows on the critical path. @default '#e53935' */
|
|
563
|
+
readonly criticalArrowColor?: string;
|
|
564
|
+
/** When true, calculates and highlights the critical path through dependent tasks. @default false */
|
|
565
|
+
readonly enableCriticalPath?: boolean;
|
|
566
|
+
/** Border color for all cells in the task table and timeline grid. @default '#eff0f0' */
|
|
567
|
+
readonly cellBorderColor?: string;
|
|
568
|
+
/** CSS border-width for all cell lines, e.g. `'1px'`. @default '1px' */
|
|
569
|
+
readonly cellBorderWidth?: string;
|
|
570
|
+
/** Custom column definitions for the task-list panel. When omitted, all default columns are shown. */
|
|
571
|
+
readonly columnConfig?: ColumnListItem[];
|
|
572
|
+
/** Enable row selection (click, Ctrl+Click, Shift+Click, keyboard). @default false */
|
|
573
|
+
readonly enableSelection?: boolean;
|
|
574
|
+
/** Show the SVG export button in the toolbar. @default true */
|
|
575
|
+
readonly enableExport?: boolean;
|
|
576
|
+
/** Allow the task-list panel to be resized by dragging the divider. @default true */
|
|
577
|
+
readonly enableResize?: boolean;
|
|
578
|
+
/** Allow tasks to be reordered by dragging rows in the task list. @default true */
|
|
579
|
+
readonly enableTaskDrag?: boolean;
|
|
580
|
+
/** Show the inline task-edit form when a task row is clicked. @default false */
|
|
581
|
+
readonly enableTaskEdit?: boolean;
|
|
582
|
+
/** Allow task bars to be resized by dragging their handles. @default true */
|
|
583
|
+
readonly enableTaskResize?: boolean;
|
|
584
|
+
/** Show a tooltip on task-bar hover. @default true */
|
|
585
|
+
readonly enableTooltip?: boolean;
|
|
586
|
+
/** Color for all text in the chart. @default '#000000' */
|
|
587
|
+
readonly fontColor?: string;
|
|
588
|
+
/** CSS font-family for the chart. Falls back to the page default when empty. */
|
|
589
|
+
readonly fontFamily?: string;
|
|
590
|
+
/** CSS font-size for the chart, e.g. `'14px'`. @default '14px' */
|
|
591
|
+
readonly fontSize?: string;
|
|
592
|
+
/** CSS font-weight for the chart. @default '400' */
|
|
593
|
+
readonly fontWeight?: string;
|
|
594
|
+
/** Background color of the timeline and task-list header row. @default '#f3f3f3' */
|
|
595
|
+
readonly headerBackground?: string;
|
|
596
|
+
/** Height of the chart. Accepts a pixel number or a CSS string. @default 500 */
|
|
597
|
+
readonly height?: number | string;
|
|
598
|
+
/** dayjs-compatible format string used to parse `startTime` / `endTime` values. @default 'MM-DD-YYYY' */
|
|
599
|
+
readonly inputDateFormat?: string;
|
|
600
|
+
/** Alternating row background colors. The pattern cycles automatically. @default ['#FFFFFF'] */
|
|
601
|
+
readonly rowBackgroundColors?: readonly string[];
|
|
602
|
+
/** Height of each task row in pixels. @default 28 */
|
|
603
|
+
readonly rowHeight?: number;
|
|
604
|
+
/** Task data array. Required. Each item must satisfy `TaskInput`, or use `parsing` to map custom field names. */
|
|
605
|
+
readonly series: TaskInput[] | Record<string, unknown>[];
|
|
606
|
+
/** Initial pixel width of the task-list panel. @default 425 */
|
|
607
|
+
readonly tasksContainerWidth?: number;
|
|
608
|
+
/** Background color of the hover tooltip. @default '#FFFFFF' */
|
|
609
|
+
readonly tooltipBGColor?: string;
|
|
610
|
+
/** Border color of the hover tooltip. @default '#BCBCBC' */
|
|
611
|
+
readonly tooltipBorderColor?: string;
|
|
612
|
+
/** HTML `id` for the tooltip container element. @default 'apexgantt-tooltip-container' */
|
|
613
|
+
readonly tooltipId?: string;
|
|
614
|
+
/** Custom function returning an HTML string for the task tooltip. */
|
|
615
|
+
readonly tooltipTemplate?: (task: Task, dateFormat: string) => string;
|
|
616
|
+
/** Timeline granularity. @default ViewMode.Month */
|
|
617
|
+
readonly viewMode?: ViewMode;
|
|
618
|
+
/** Width of the chart. Accepts a pixel number or a CSS string. @default '100%' */
|
|
619
|
+
readonly width?: number | string;
|
|
620
|
+
/** Field-mapping config to parse non-standard task shapes without manual data transformation. */
|
|
621
|
+
readonly parsing?: ParsingConfig;
|
|
622
|
+
/** Show a checkbox column for multi-select. Only applies when `enableSelection` is true. @default true */
|
|
623
|
+
readonly showCheckboxColumn?: boolean;
|
|
624
|
+
/**
|
|
625
|
+
* Custom controls rendered in the toolbar alongside the built-in zoom and export buttons.
|
|
626
|
+
* Each item can be a `ToolbarButton`, `ToolbarSelect`, or `ToolbarSeparator`.
|
|
627
|
+
* Use `position: 'left'` to insert before the built-in controls (default is `'right'`).
|
|
628
|
+
* @default []
|
|
629
|
+
*/
|
|
630
|
+
readonly toolbarItems?: ToolbarItem[];
|
|
631
|
+
/** `aria-label` for the task-list table, used by screen readers. @default 'Task list' */
|
|
632
|
+
readonly taskListAriaLabel?: string;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export declare function getTheme(mode: ThemeMode): GanttTheme;
|
|
636
|
+
|
|
637
|
+
export declare const LightTheme: GanttTheme;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Controls whether an annotation line or region is drawn horizontally
|
|
641
|
+
* (spanning the full chart width) or vertically (spanning the full chart height).
|
|
642
|
+
*/
|
|
643
|
+
export declare enum Orientation {
|
|
644
|
+
Horizontal = "horizontal",
|
|
645
|
+
Vertical = "vertical"
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Field-mapping configuration for `DataParser`.
|
|
650
|
+
*
|
|
651
|
+
* Maps the required and optional `TaskInput` fields to paths in a raw
|
|
652
|
+
* data object. Use this when your API returns data with different key names
|
|
653
|
+
* than the `TaskInput` interface expects. Pass the result as
|
|
654
|
+
* `GanttUserOptions.parsing`.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```ts
|
|
658
|
+
* const parsing: ParsingConfig = {
|
|
659
|
+
* id: 'task_id',
|
|
660
|
+
* name: 'title',
|
|
661
|
+
* startTime: 'start_date',
|
|
662
|
+
* endTime: 'end_date',
|
|
663
|
+
* progress: { key: 'pct_complete', transform: Number },
|
|
664
|
+
* };
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
export declare interface ParsingConfig {
|
|
668
|
+
id: ParsingValue;
|
|
669
|
+
name: ParsingValue;
|
|
670
|
+
startTime: ParsingValue;
|
|
671
|
+
endTime?: ParsingValue;
|
|
672
|
+
progress?: ParsingValue;
|
|
673
|
+
type?: ParsingValue;
|
|
674
|
+
parentId?: ParsingValue;
|
|
675
|
+
dependency?: ParsingValue;
|
|
676
|
+
barBackgroundColor?: ParsingValue;
|
|
677
|
+
rowBackgroundColor?: ParsingValue;
|
|
678
|
+
collapsed?: ParsingValue;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* A field mapping value: either a dot-notation path string to a key in the
|
|
683
|
+
* raw data object, or an object with a `key` path and an optional `transform`
|
|
684
|
+
* function for type coercion or renaming.
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```ts
|
|
688
|
+
* // Simple path string
|
|
689
|
+
* const mapping: ParsingValue = 'meta.taskId';
|
|
690
|
+
*
|
|
691
|
+
* // Path + transform
|
|
692
|
+
* const mapping: ParsingValue = { key: 'start_date', transform: (v) => String(v) };
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
export declare type ParsingValue = string | {
|
|
696
|
+
key: string;
|
|
697
|
+
transform?: (value: unknown) => unknown;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Detail payload for the `selectionChange` event.
|
|
702
|
+
*
|
|
703
|
+
* Fires whenever the set of selected task rows changes (click, Ctrl+Click,
|
|
704
|
+
* Shift+Click, or keyboard selection).
|
|
705
|
+
*/
|
|
706
|
+
export declare interface SelectionChangeEventDetail {
|
|
707
|
+
selectedTasks: Task[];
|
|
708
|
+
selectedIds: string[];
|
|
709
|
+
timestamp: number;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Resolved task object used internally and returned from selection/event APIs.
|
|
714
|
+
*
|
|
715
|
+
* Extends `TaskInput` with fields that are guaranteed to be present after the
|
|
716
|
+
* data normalisation step (missing optional fields are filled with defaults).
|
|
717
|
+
* Use `Task` in wrapper libraries when typing event detail payloads and the
|
|
718
|
+
* return value of `getSelectedTasks()`.
|
|
719
|
+
*/
|
|
720
|
+
export declare interface Task extends TaskInput {
|
|
721
|
+
/** End date is always present after normalisation (defaults to `startTime` for milestones). */
|
|
722
|
+
readonly endTime: string;
|
|
723
|
+
/** Nesting depth in the task hierarchy. `0` = top-level task. */
|
|
724
|
+
readonly level?: number;
|
|
725
|
+
/** Resolved progress value (0–100). Always present; defaults to `0`. */
|
|
726
|
+
readonly progress: number;
|
|
727
|
+
/** Resolved task type. Always present; defaults to `TaskType.Task`. */
|
|
728
|
+
readonly type: TaskType;
|
|
729
|
+
/** Computed left offset in pixels within the timeline body. Set after layout. */
|
|
730
|
+
readonly left?: number;
|
|
731
|
+
/** Computed width in pixels within the timeline body. Set after layout. */
|
|
732
|
+
readonly width?: number;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Declares a predecessor/successor relationship between two tasks.
|
|
737
|
+
*
|
|
738
|
+
* Attach one or more of these to `TaskInput.dependency` to draw arrows between
|
|
739
|
+
* task bars and have them respected during drag/resize operations.
|
|
740
|
+
*/
|
|
741
|
+
export declare interface TaskDependency {
|
|
742
|
+
/** ID of the task this task depends on */
|
|
743
|
+
readonly taskId: string;
|
|
744
|
+
/** Dependency type. Defaults to 'FS' (Finish-to-Start) */
|
|
745
|
+
readonly type?: DependencyType;
|
|
746
|
+
/** Lag/lead in days. Positive = lag (delay), negative = lead (overlap). Defaults to 0. */
|
|
747
|
+
readonly lag?: number;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Detail payload for the `taskDragged` event.
|
|
752
|
+
*
|
|
753
|
+
* Fires when a task bar is dropped at a new horizontal position. All dates are
|
|
754
|
+
* formatted using `GanttUserOptions.inputDateFormat`. `affectedChildTasks`
|
|
755
|
+
* lists any sub-tasks whose dates were shifted as a side-effect.
|
|
756
|
+
*/
|
|
757
|
+
export declare interface TaskDraggedEventDetail {
|
|
758
|
+
taskId: string;
|
|
759
|
+
oldStartTime: string;
|
|
760
|
+
oldEndTime: string;
|
|
761
|
+
newStartTime: string;
|
|
762
|
+
newEndTime: string;
|
|
763
|
+
daysMoved: number;
|
|
764
|
+
affectedChildTasks: Array<{
|
|
765
|
+
taskId: string;
|
|
766
|
+
newStartTime: string;
|
|
767
|
+
newEndTime: string;
|
|
768
|
+
}>;
|
|
769
|
+
timestamp: number;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Raw task data shape passed to `new ApexGantt()` via `GanttUserOptions.series`
|
|
774
|
+
* or to `DataParser.parse()`.
|
|
775
|
+
*
|
|
776
|
+
* Dates are supplied as strings and parsed using `GanttUserOptions.inputDateFormat`
|
|
777
|
+
* (default: `'YYYY-MM-DD'`). Any format understood by dayjs is valid when the
|
|
778
|
+
* corresponding `inputDateFormat` is specified.
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```ts
|
|
782
|
+
* const task: TaskInput = {
|
|
783
|
+
* id: 'task-1',
|
|
784
|
+
* name: 'Design Phase',
|
|
785
|
+
* startTime: '2026-01-01',
|
|
786
|
+
* endTime: '2026-01-15',
|
|
787
|
+
* progress: 60,
|
|
788
|
+
* type: TaskType.Task,
|
|
789
|
+
* };
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
export declare interface TaskInput {
|
|
793
|
+
/** Unique identifier for the task. Must be stable across renders. */
|
|
794
|
+
readonly id: string;
|
|
795
|
+
/** Display name shown in the task list column and task bar. */
|
|
796
|
+
readonly name: string;
|
|
797
|
+
/**
|
|
798
|
+
* Task start date string. Parsed using `GanttUserOptions.inputDateFormat`.
|
|
799
|
+
* @example `'2026-01-01'` (default format `'YYYY-MM-DD'`)
|
|
800
|
+
*/
|
|
801
|
+
readonly startTime: string;
|
|
802
|
+
/**
|
|
803
|
+
* Task end date string. Parsed using `GanttUserOptions.inputDateFormat`.
|
|
804
|
+
* When omitted, the task renders as a milestone on `startTime`.
|
|
805
|
+
* @example `'2026-01-15'`
|
|
806
|
+
*/
|
|
807
|
+
readonly endTime?: string;
|
|
808
|
+
/**
|
|
809
|
+
* Completion percentage (0–100). Renders a filled progress portion inside
|
|
810
|
+
* the task bar. @default 0
|
|
811
|
+
*/
|
|
812
|
+
readonly progress?: number;
|
|
813
|
+
/**
|
|
814
|
+
* Visual type of the task. `'task'` renders a bar; `'milestone'` renders a
|
|
815
|
+
* diamond marker. @default TaskType.Task
|
|
816
|
+
*/
|
|
817
|
+
readonly type?: TaskType;
|
|
818
|
+
/**
|
|
819
|
+
* ID of the parent task. Nested tasks are rendered as children in the
|
|
820
|
+
* task list and inherit the parent's row background color.
|
|
821
|
+
*/
|
|
822
|
+
readonly parentId?: string;
|
|
823
|
+
/**
|
|
824
|
+
* Dependency on another task. Accepts either a plain task ID string
|
|
825
|
+
* (backwards-compatible, treated as Finish-to-Start with 0 lag) or a full
|
|
826
|
+
* `TaskDependency` object for typed dependency with lag/lead support.
|
|
827
|
+
* @example `'task-2'`
|
|
828
|
+
* @example `{ taskId: 'task-2', type: 'FS', lag: 2 }`
|
|
829
|
+
*/
|
|
830
|
+
readonly dependency?: string | TaskDependency;
|
|
831
|
+
/** Override the task bar fill color for this specific task. */
|
|
832
|
+
readonly barBackgroundColor?: string;
|
|
833
|
+
/** Override the row background color for this specific task row. */
|
|
834
|
+
readonly rowBackgroundColor?: string;
|
|
835
|
+
/**
|
|
836
|
+
* Baseline (planned) dates for comparison against actual dates.
|
|
837
|
+
* Rendered as a thin bar below the actual task bar when
|
|
838
|
+
* `GanttUserOptions.baseline.enabled` is `true`.
|
|
839
|
+
*/
|
|
840
|
+
readonly baseline?: BaselineInput;
|
|
841
|
+
/**
|
|
842
|
+
* Whether this task's child tasks are collapsed (hidden) in the task list.
|
|
843
|
+
* Mutable so it can be toggled by the expand/collapse UI without a full
|
|
844
|
+
* options update. @default false
|
|
845
|
+
*/
|
|
846
|
+
collapsed?: boolean;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Detail payload for the `taskResized` event.
|
|
851
|
+
*
|
|
852
|
+
* Fires when a task bar is resized by dragging its left or right handle.
|
|
853
|
+
* `durationChange` is the signed delta in days (positive = longer, negative = shorter).
|
|
854
|
+
* All date strings are formatted using `GanttUserOptions.inputDateFormat`.
|
|
855
|
+
*/
|
|
856
|
+
export declare interface TaskResizedEventDetail {
|
|
857
|
+
taskId: string;
|
|
858
|
+
resizeHandle: 'left' | 'right';
|
|
859
|
+
oldStartTime: string;
|
|
860
|
+
oldEndTime: string;
|
|
861
|
+
newStartTime: string;
|
|
862
|
+
newEndTime: string;
|
|
863
|
+
durationChange: number;
|
|
864
|
+
timestamp: number;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Discriminates how a task is rendered in the timeline.
|
|
869
|
+
*
|
|
870
|
+
* - `Task` — rendered as a horizontal bar spanning `startTime` to `endTime`.
|
|
871
|
+
* - `Milestone` — rendered as a diamond marker at `startTime` with no duration.
|
|
872
|
+
*/
|
|
873
|
+
export declare enum TaskType {
|
|
874
|
+
Milestone = "milestone",
|
|
875
|
+
Task = "task"
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Detail payload for the `taskUpdateError` event.
|
|
880
|
+
*
|
|
881
|
+
* Fires when a task update fails after submission. `error` contains the
|
|
882
|
+
* underlying `Error` instance for logging or user feedback.
|
|
883
|
+
*/
|
|
884
|
+
export declare interface TaskUpdateErrorEventDetail {
|
|
885
|
+
taskId: string;
|
|
886
|
+
error: Error;
|
|
887
|
+
timestamp: number;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Detail payload for the `taskUpdate` event.
|
|
892
|
+
*
|
|
893
|
+
* Fires immediately when a task update is submitted (before server-side
|
|
894
|
+
* validation). Use `taskUpdateSuccess` or `taskUpdateError` to react to the
|
|
895
|
+
* final outcome.
|
|
896
|
+
*/
|
|
897
|
+
export declare interface TaskUpdateEventDetail {
|
|
898
|
+
taskId: string;
|
|
899
|
+
updates: Partial<Task>;
|
|
900
|
+
updatedTask: Task;
|
|
901
|
+
timestamp: number;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Detail payload for the `taskUpdateSuccess` event.
|
|
906
|
+
*
|
|
907
|
+
* Fires after a task update completes without error. `updatedTask` contains
|
|
908
|
+
* the fully resolved `Task` object with all applied changes.
|
|
909
|
+
*/
|
|
910
|
+
export declare interface TaskUpdateSuccessEventDetail {
|
|
911
|
+
taskId: string;
|
|
912
|
+
updatedTask: Task;
|
|
913
|
+
timestamp: number;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Detail payload for the `taskValidationError` event.
|
|
918
|
+
*
|
|
919
|
+
* Fires when the inline task-edit form fails client-side validation.
|
|
920
|
+
* `errors` contains one entry per failing field with a human-readable message.
|
|
921
|
+
*/
|
|
922
|
+
export declare interface TaskValidationErrorEventDetail {
|
|
923
|
+
taskId: string;
|
|
924
|
+
errors: Array<{
|
|
925
|
+
field: string;
|
|
926
|
+
message: string;
|
|
927
|
+
}>;
|
|
928
|
+
timestamp: number;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/** Color-mode selector. Switches between the built-in `LightTheme` and `DarkTheme` presets. */
|
|
932
|
+
export declare type ThemeMode = 'dark' | 'light';
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* A plain button in the custom toolbar area.
|
|
936
|
+
*
|
|
937
|
+
* @example
|
|
938
|
+
* {
|
|
939
|
+
* type: 'button',
|
|
940
|
+
* label: 'Send to Buffer',
|
|
941
|
+
* tooltip: 'Publish selected tasks to Buffer',
|
|
942
|
+
* requiresSelection: true,
|
|
943
|
+
* onClick: ({ selectedTasks }) => publish(selectedTasks),
|
|
944
|
+
* }
|
|
945
|
+
*/
|
|
946
|
+
export declare interface ToolbarButton {
|
|
947
|
+
type: 'button';
|
|
948
|
+
/** Text label shown inside the button. */
|
|
949
|
+
label?: string;
|
|
950
|
+
/** SVG string rendered as the button icon. */
|
|
951
|
+
icon?: string;
|
|
952
|
+
/** Tooltip shown on hover (`title` attribute). */
|
|
953
|
+
tooltip?: string;
|
|
954
|
+
/**
|
|
955
|
+
* Where to insert the button relative to the built-in zoom/view controls.
|
|
956
|
+
* @default 'right'
|
|
957
|
+
*/
|
|
958
|
+
position?: 'left' | 'right';
|
|
959
|
+
/**
|
|
960
|
+
* Static disabled flag, or a function evaluated on every selection change.
|
|
961
|
+
* Use a function to disable the button when nothing is selected.
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* disabled: ({ selectedTasks }) => selectedTasks.length === 0
|
|
965
|
+
*/
|
|
966
|
+
disabled?: boolean | ((context: ToolbarContext) => boolean);
|
|
967
|
+
/**
|
|
968
|
+
* When true the button is automatically disabled whenever the selection is
|
|
969
|
+
* empty. Equivalent to `disabled: ({ selectedTasks }) => selectedTasks.length === 0`
|
|
970
|
+
* but more ergonomic for the common case.
|
|
971
|
+
* @default false
|
|
972
|
+
*/
|
|
973
|
+
requiresSelection?: boolean;
|
|
974
|
+
/**
|
|
975
|
+
* When true, the button label is augmented with the selection count badge,
|
|
976
|
+
* e.g. "Send (3)". Only meaningful when a `label` is also set.
|
|
977
|
+
* @default false
|
|
978
|
+
*/
|
|
979
|
+
showCount?: boolean;
|
|
980
|
+
/** Called when the button is clicked. */
|
|
981
|
+
onClick: (context: ToolbarContext) => void;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Context object passed to toolbar item callbacks so they can read
|
|
986
|
+
* the current selection without needing a reference to the chart instance.
|
|
987
|
+
*/
|
|
988
|
+
export declare interface ToolbarContext {
|
|
989
|
+
/** Currently selected task objects. Empty array when nothing is selected. */
|
|
990
|
+
selectedTasks: Task[];
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/** Union of all supported toolbar item types. */
|
|
994
|
+
export declare type ToolbarItem = ToolbarButton | ToolbarSelect | ToolbarSeparator;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* A `<select>` dropdown in the custom toolbar area.
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* {
|
|
1001
|
+
* type: 'select',
|
|
1002
|
+
* label: 'Content Type',
|
|
1003
|
+
* placeholder: 'Filter by type…',
|
|
1004
|
+
* options: [
|
|
1005
|
+
* { value: 'blog', text: 'Blog Post' },
|
|
1006
|
+
* { value: 'video', text: 'Video' },
|
|
1007
|
+
* ],
|
|
1008
|
+
* onChange: (value, { selectedTasks }) => filter(value, selectedTasks),
|
|
1009
|
+
* }
|
|
1010
|
+
*/
|
|
1011
|
+
export declare interface ToolbarSelect {
|
|
1012
|
+
type: 'select';
|
|
1013
|
+
/** Optional label rendered before the `<select>` element. */
|
|
1014
|
+
label?: string;
|
|
1015
|
+
/** Placeholder option rendered when no value is chosen. */
|
|
1016
|
+
placeholder?: string;
|
|
1017
|
+
/** Where to insert relative to built-in controls. @default 'right' */
|
|
1018
|
+
position?: 'left' | 'right';
|
|
1019
|
+
/** List of options shown in the dropdown. */
|
|
1020
|
+
options: ReadonlyArray<{
|
|
1021
|
+
value: string;
|
|
1022
|
+
text: string;
|
|
1023
|
+
}>;
|
|
1024
|
+
/** Called when the selected value changes. */
|
|
1025
|
+
onChange: (value: string, context: ToolbarContext) => void;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* A thin vertical divider line between toolbar items.
|
|
1030
|
+
*/
|
|
1031
|
+
export declare interface ToolbarSeparator {
|
|
1032
|
+
type: 'separator';
|
|
1033
|
+
/** Where to insert relative to built-in controls. @default 'right' */
|
|
1034
|
+
position?: 'left' | 'right';
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Timeline granularity — controls the column width and header labels.
|
|
1039
|
+
*
|
|
1040
|
+
* Pass as `GanttUserOptions.viewMode`. Use the toolbar's zoom controls
|
|
1041
|
+
* or call `gantt.zoomIn()` / `gantt.zoomOut()` to switch dynamically.
|
|
1042
|
+
*/
|
|
1043
|
+
export declare enum ViewMode {
|
|
1044
|
+
Day = "day",
|
|
1045
|
+
Month = "month",
|
|
1046
|
+
Quarter = "quarter",
|
|
1047
|
+
Week = "week",
|
|
1048
|
+
Year = "year"
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export { }
|