@ganttloom/gantt-vue 0.2.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.
@@ -0,0 +1,456 @@
1
+ import * as vue from 'vue';
2
+ import { ExtractPropTypes, PropType, ShallowRef, Ref } from 'vue';
3
+ import { GanttTask, GanttDependency, ViewMode, GanttColumn, GanttTheme, WorkingCalendar, GanttMarker, ResourceHistogramOptions, ResourceLoadBucket, ResourceLevelingOptions, ResourceLevelingResult, GanttRenderModel, GanttChart as GanttChart$1, GanttOptions } from '@ganttloom/gantt-core';
4
+ export { ConstraintType, DEFAULT_PALETTE, DENSITY_PRESETS, Density, DependencyType, FilterTasksOptions, FilterTasksResult, GanttAssignee, GanttColumn, GanttDependency, GanttEventMap, GanttMarker, GanttOptions, GanttRenderBar, GanttRenderLink, GanttRenderMarker, GanttRenderModel, GanttRenderRow, GanttRenderTick, GanttTask, GanttTheme, ResourceHistogramOptions, ResourceLevelingOptions, ResourceLevelingResult, ResourceLoadBucket, ViewMode, WorkingCalendar, applyColorByField, applyConstraint, colorByField, computeResourceHistogram, computeWBSCodes, filterTasks, isHoliday, isWithinWorkingHours, isWorkingDay, isWorkingTime, levelResources, nextWorkingDay, previousWorkingDay, renderResourceHistogramSVG, shiftToWorkingDay, shiftToWorkingTime } from '@ganttloom/gantt-core';
5
+
6
+ /** Imperative escape hatches, available via a template ref (see the package README). */
7
+ interface GanttChartHandle {
8
+ undo(): void;
9
+ redo(): void;
10
+ canUndo(): boolean;
11
+ canRedo(): boolean;
12
+ expandAll(): void;
13
+ collapseAll(): void;
14
+ toggleGroup(taskId: string): void;
15
+ removeDependency(fromId: string, toId: string): void;
16
+ updateDependency(fromId: string, toId: string, partial: Partial<GanttDependency>): void;
17
+ updateTask(id: string, partial: Partial<GanttTask>): void;
18
+ setViewMode(mode: ViewMode): void;
19
+ fitToViewport(containerWidthPx: number): void;
20
+ scrollToToday(): void;
21
+ scrollToRangeStart(): void;
22
+ scrollToRangeEnd(): void;
23
+ getPageCount(): number;
24
+ setPage(page: number): void;
25
+ zoomIn(factor?: number): void;
26
+ zoomOut(factor?: number): void;
27
+ getZoomLevel(): number;
28
+ getResourceHistogram(options?: ResourceHistogramOptions): ResourceLoadBucket[];
29
+ getLeveledTasks(options?: ResourceLevelingOptions): ResourceLevelingResult;
30
+ selectTask(id: string, options?: {
31
+ additive?: boolean;
32
+ }): void;
33
+ selectAllVisible(): void;
34
+ clearSelection(): void;
35
+ getSelectedTaskIds(): string[];
36
+ bulkShiftDates(deltaMs: number): void;
37
+ bulkDelete(): void;
38
+ toSVGString(): string;
39
+ toPNGDataURL(): Promise<string>;
40
+ toPNGDataURLs(options?: {
41
+ pageWidthPx?: number;
42
+ pageHeightPx?: number;
43
+ }): Promise<string[]>;
44
+ getRenderModel(): GanttRenderModel | null;
45
+ /** Direct access to the underlying framework-agnostic core instance (null before mount). */
46
+ getInstance(): GanttChart$1 | null;
47
+ }
48
+ declare const ganttChartProps: {
49
+ readonly tasks: {
50
+ readonly type: PropType<GanttTask[]>;
51
+ readonly required: true;
52
+ };
53
+ readonly dependencies: {
54
+ readonly type: PropType<GanttDependency[]>;
55
+ readonly default: () => never[];
56
+ };
57
+ readonly viewMode: {
58
+ readonly type: PropType<ViewMode>;
59
+ readonly default: undefined;
60
+ };
61
+ readonly columns: {
62
+ readonly type: PropType<GanttColumn[]>;
63
+ readonly default: undefined;
64
+ };
65
+ readonly theme: {
66
+ readonly type: PropType<Partial<GanttTheme>>;
67
+ readonly default: undefined;
68
+ };
69
+ readonly colorScheme: {
70
+ readonly type: PropType<"light" | "dark" | "auto">;
71
+ readonly default: undefined;
72
+ };
73
+ readonly columnWidth: {
74
+ readonly type: NumberConstructor;
75
+ readonly default: undefined;
76
+ };
77
+ readonly readonly: {
78
+ readonly type: BooleanConstructor;
79
+ readonly default: undefined;
80
+ };
81
+ readonly showProgress: {
82
+ readonly type: BooleanConstructor;
83
+ readonly default: undefined;
84
+ };
85
+ readonly showDependencies: {
86
+ readonly type: BooleanConstructor;
87
+ readonly default: undefined;
88
+ };
89
+ readonly gridPanelWidth: {
90
+ readonly type: NumberConstructor;
91
+ readonly default: undefined;
92
+ };
93
+ readonly showCriticalPath: {
94
+ readonly type: BooleanConstructor;
95
+ readonly default: undefined;
96
+ };
97
+ readonly showBaseline: {
98
+ readonly type: BooleanConstructor;
99
+ readonly default: undefined;
100
+ };
101
+ readonly showDeadlines: {
102
+ readonly type: BooleanConstructor;
103
+ readonly default: undefined;
104
+ };
105
+ readonly showAssigneeAvatars: {
106
+ readonly type: BooleanConstructor;
107
+ readonly default: undefined;
108
+ };
109
+ readonly enableHistory: {
110
+ readonly type: BooleanConstructor;
111
+ readonly default: undefined;
112
+ };
113
+ readonly keyboardAccessible: {
114
+ readonly type: BooleanConstructor;
115
+ readonly default: undefined;
116
+ };
117
+ readonly virtualScroll: {
118
+ readonly type: BooleanConstructor;
119
+ readonly default: undefined;
120
+ };
121
+ readonly autoSchedule: {
122
+ readonly type: BooleanConstructor;
123
+ readonly default: undefined;
124
+ };
125
+ readonly pagination: {
126
+ readonly type: PropType<{
127
+ pageSize: number;
128
+ page: number;
129
+ }>;
130
+ readonly default: undefined;
131
+ };
132
+ readonly snapToUnit: {
133
+ readonly type: PropType<"hour" | "day" | "week" | false>;
134
+ readonly default: undefined;
135
+ };
136
+ /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */
137
+ readonly calendar: {
138
+ readonly type: PropType<WorkingCalendar>;
139
+ readonly default: undefined;
140
+ };
141
+ /** arbitrary labeled vertical lines on the timeline, independent of any task */
142
+ readonly markers: {
143
+ readonly type: PropType<GanttMarker[]>;
144
+ readonly default: undefined;
145
+ };
146
+ /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */
147
+ readonly autoRollupProgress: {
148
+ readonly type: BooleanConstructor;
149
+ readonly default: undefined;
150
+ };
151
+ /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */
152
+ readonly selectable: {
153
+ readonly type: BooleanConstructor;
154
+ readonly default: undefined;
155
+ };
156
+ };
157
+ type GanttChartProps = ExtractPropTypes<typeof ganttChartProps>;
158
+ declare const GanttChart: vue.DefineComponent<ExtractPropTypes<{
159
+ readonly tasks: {
160
+ readonly type: PropType<GanttTask[]>;
161
+ readonly required: true;
162
+ };
163
+ readonly dependencies: {
164
+ readonly type: PropType<GanttDependency[]>;
165
+ readonly default: () => never[];
166
+ };
167
+ readonly viewMode: {
168
+ readonly type: PropType<ViewMode>;
169
+ readonly default: undefined;
170
+ };
171
+ readonly columns: {
172
+ readonly type: PropType<GanttColumn[]>;
173
+ readonly default: undefined;
174
+ };
175
+ readonly theme: {
176
+ readonly type: PropType<Partial<GanttTheme>>;
177
+ readonly default: undefined;
178
+ };
179
+ readonly colorScheme: {
180
+ readonly type: PropType<"light" | "dark" | "auto">;
181
+ readonly default: undefined;
182
+ };
183
+ readonly columnWidth: {
184
+ readonly type: NumberConstructor;
185
+ readonly default: undefined;
186
+ };
187
+ readonly readonly: {
188
+ readonly type: BooleanConstructor;
189
+ readonly default: undefined;
190
+ };
191
+ readonly showProgress: {
192
+ readonly type: BooleanConstructor;
193
+ readonly default: undefined;
194
+ };
195
+ readonly showDependencies: {
196
+ readonly type: BooleanConstructor;
197
+ readonly default: undefined;
198
+ };
199
+ readonly gridPanelWidth: {
200
+ readonly type: NumberConstructor;
201
+ readonly default: undefined;
202
+ };
203
+ readonly showCriticalPath: {
204
+ readonly type: BooleanConstructor;
205
+ readonly default: undefined;
206
+ };
207
+ readonly showBaseline: {
208
+ readonly type: BooleanConstructor;
209
+ readonly default: undefined;
210
+ };
211
+ readonly showDeadlines: {
212
+ readonly type: BooleanConstructor;
213
+ readonly default: undefined;
214
+ };
215
+ readonly showAssigneeAvatars: {
216
+ readonly type: BooleanConstructor;
217
+ readonly default: undefined;
218
+ };
219
+ readonly enableHistory: {
220
+ readonly type: BooleanConstructor;
221
+ readonly default: undefined;
222
+ };
223
+ readonly keyboardAccessible: {
224
+ readonly type: BooleanConstructor;
225
+ readonly default: undefined;
226
+ };
227
+ readonly virtualScroll: {
228
+ readonly type: BooleanConstructor;
229
+ readonly default: undefined;
230
+ };
231
+ readonly autoSchedule: {
232
+ readonly type: BooleanConstructor;
233
+ readonly default: undefined;
234
+ };
235
+ readonly pagination: {
236
+ readonly type: PropType<{
237
+ pageSize: number;
238
+ page: number;
239
+ }>;
240
+ readonly default: undefined;
241
+ };
242
+ readonly snapToUnit: {
243
+ readonly type: PropType<"hour" | "day" | "week" | false>;
244
+ readonly default: undefined;
245
+ };
246
+ /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */
247
+ readonly calendar: {
248
+ readonly type: PropType<WorkingCalendar>;
249
+ readonly default: undefined;
250
+ };
251
+ /** arbitrary labeled vertical lines on the timeline, independent of any task */
252
+ readonly markers: {
253
+ readonly type: PropType<GanttMarker[]>;
254
+ readonly default: undefined;
255
+ };
256
+ /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */
257
+ readonly autoRollupProgress: {
258
+ readonly type: BooleanConstructor;
259
+ readonly default: undefined;
260
+ };
261
+ /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */
262
+ readonly selectable: {
263
+ readonly type: BooleanConstructor;
264
+ readonly default: undefined;
265
+ };
266
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
267
+ [key: string]: any;
268
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
269
+ "date-change": (_task: GanttTask, _start: Date, _end: Date) => boolean;
270
+ "progress-change": (_task: GanttTask, _progress: number) => boolean;
271
+ "dependency-create": (_dep: GanttDependency) => boolean;
272
+ "dependency-remove": (_dep: GanttDependency) => boolean;
273
+ "dependency-dblclick": (_dep: GanttDependency) => boolean;
274
+ "task-click": (_task: GanttTask) => boolean;
275
+ "group-toggle": (_task: GanttTask, _collapsed: boolean) => boolean;
276
+ "context-menu": (_task: GanttTask, _evt: PointerEvent) => boolean;
277
+ "task-create": (_task: GanttTask) => boolean;
278
+ "column-resize": (_columnId: string, _width: number) => boolean;
279
+ "column-reorder": (_order: string[]) => boolean;
280
+ "task-reorder": (_draggedTaskId: string, _targetTaskId: string, _position: "before" | "after" | "inside") => boolean;
281
+ "selection-change": (_taskIds: string[]) => boolean;
282
+ }, string, vue.PublicProps, Readonly<ExtractPropTypes<{
283
+ readonly tasks: {
284
+ readonly type: PropType<GanttTask[]>;
285
+ readonly required: true;
286
+ };
287
+ readonly dependencies: {
288
+ readonly type: PropType<GanttDependency[]>;
289
+ readonly default: () => never[];
290
+ };
291
+ readonly viewMode: {
292
+ readonly type: PropType<ViewMode>;
293
+ readonly default: undefined;
294
+ };
295
+ readonly columns: {
296
+ readonly type: PropType<GanttColumn[]>;
297
+ readonly default: undefined;
298
+ };
299
+ readonly theme: {
300
+ readonly type: PropType<Partial<GanttTheme>>;
301
+ readonly default: undefined;
302
+ };
303
+ readonly colorScheme: {
304
+ readonly type: PropType<"light" | "dark" | "auto">;
305
+ readonly default: undefined;
306
+ };
307
+ readonly columnWidth: {
308
+ readonly type: NumberConstructor;
309
+ readonly default: undefined;
310
+ };
311
+ readonly readonly: {
312
+ readonly type: BooleanConstructor;
313
+ readonly default: undefined;
314
+ };
315
+ readonly showProgress: {
316
+ readonly type: BooleanConstructor;
317
+ readonly default: undefined;
318
+ };
319
+ readonly showDependencies: {
320
+ readonly type: BooleanConstructor;
321
+ readonly default: undefined;
322
+ };
323
+ readonly gridPanelWidth: {
324
+ readonly type: NumberConstructor;
325
+ readonly default: undefined;
326
+ };
327
+ readonly showCriticalPath: {
328
+ readonly type: BooleanConstructor;
329
+ readonly default: undefined;
330
+ };
331
+ readonly showBaseline: {
332
+ readonly type: BooleanConstructor;
333
+ readonly default: undefined;
334
+ };
335
+ readonly showDeadlines: {
336
+ readonly type: BooleanConstructor;
337
+ readonly default: undefined;
338
+ };
339
+ readonly showAssigneeAvatars: {
340
+ readonly type: BooleanConstructor;
341
+ readonly default: undefined;
342
+ };
343
+ readonly enableHistory: {
344
+ readonly type: BooleanConstructor;
345
+ readonly default: undefined;
346
+ };
347
+ readonly keyboardAccessible: {
348
+ readonly type: BooleanConstructor;
349
+ readonly default: undefined;
350
+ };
351
+ readonly virtualScroll: {
352
+ readonly type: BooleanConstructor;
353
+ readonly default: undefined;
354
+ };
355
+ readonly autoSchedule: {
356
+ readonly type: BooleanConstructor;
357
+ readonly default: undefined;
358
+ };
359
+ readonly pagination: {
360
+ readonly type: PropType<{
361
+ pageSize: number;
362
+ page: number;
363
+ }>;
364
+ readonly default: undefined;
365
+ };
366
+ readonly snapToUnit: {
367
+ readonly type: PropType<"hour" | "day" | "week" | false>;
368
+ readonly default: undefined;
369
+ };
370
+ /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */
371
+ readonly calendar: {
372
+ readonly type: PropType<WorkingCalendar>;
373
+ readonly default: undefined;
374
+ };
375
+ /** arbitrary labeled vertical lines on the timeline, independent of any task */
376
+ readonly markers: {
377
+ readonly type: PropType<GanttMarker[]>;
378
+ readonly default: undefined;
379
+ };
380
+ /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */
381
+ readonly autoRollupProgress: {
382
+ readonly type: BooleanConstructor;
383
+ readonly default: undefined;
384
+ };
385
+ /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */
386
+ readonly selectable: {
387
+ readonly type: BooleanConstructor;
388
+ readonly default: undefined;
389
+ };
390
+ }>> & Readonly<{
391
+ "onDate-change"?: ((_task: GanttTask, _start: Date, _end: Date) => any) | undefined;
392
+ "onProgress-change"?: ((_task: GanttTask, _progress: number) => any) | undefined;
393
+ "onDependency-create"?: ((_dep: GanttDependency) => any) | undefined;
394
+ "onDependency-remove"?: ((_dep: GanttDependency) => any) | undefined;
395
+ "onTask-click"?: ((_task: GanttTask) => any) | undefined;
396
+ "onTask-create"?: ((_task: GanttTask) => any) | undefined;
397
+ "onGroup-toggle"?: ((_task: GanttTask, _collapsed: boolean) => any) | undefined;
398
+ "onContext-menu"?: ((_task: GanttTask, _evt: PointerEvent) => any) | undefined;
399
+ "onColumn-resize"?: ((_columnId: string, _width: number) => any) | undefined;
400
+ "onColumn-reorder"?: ((_order: string[]) => any) | undefined;
401
+ "onDependency-dblclick"?: ((_dep: GanttDependency) => any) | undefined;
402
+ "onTask-reorder"?: ((_draggedTaskId: string, _targetTaskId: string, _position: "before" | "after" | "inside") => any) | undefined;
403
+ "onSelection-change"?: ((_taskIds: string[]) => any) | undefined;
404
+ }>, {
405
+ readonly viewMode: ViewMode;
406
+ readonly columns: GanttColumn[];
407
+ readonly theme: Partial<GanttTheme>;
408
+ readonly colorScheme: "light" | "dark" | "auto";
409
+ readonly columnWidth: number;
410
+ readonly readonly: boolean;
411
+ readonly showProgress: boolean;
412
+ readonly showDependencies: boolean;
413
+ readonly gridPanelWidth: number;
414
+ readonly showCriticalPath: boolean;
415
+ readonly showBaseline: boolean;
416
+ readonly showDeadlines: boolean;
417
+ readonly showAssigneeAvatars: boolean;
418
+ readonly calendar: WorkingCalendar;
419
+ readonly markers: GanttMarker[];
420
+ readonly autoRollupProgress: boolean;
421
+ readonly selectable: boolean;
422
+ readonly enableHistory: boolean;
423
+ readonly keyboardAccessible: boolean;
424
+ readonly virtualScroll: boolean;
425
+ readonly pagination: {
426
+ pageSize: number;
427
+ page: number;
428
+ };
429
+ readonly snapToUnit: false | "hour" | "day" | "week";
430
+ readonly autoSchedule: boolean;
431
+ readonly dependencies: GanttDependency[];
432
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
433
+
434
+ interface UseGanttChartResult {
435
+ /** The underlying framework-agnostic GanttChart instance, or null before the mount effect runs. */
436
+ chart: ShallowRef<GanttChart$1 | null>;
437
+ /** Reactive, subscribed to the core's "history-change" event. Only meaningful when `enableHistory` is set in options. */
438
+ canUndo: Ref<boolean>;
439
+ /** Reactive, subscribed to the core's "history-change" event. Only meaningful when `enableHistory` is set in options. */
440
+ canRedo: Ref<boolean>;
441
+ }
442
+ /**
443
+ * Lower-level escape hatch for consumers who want to own their own container element
444
+ * and DOM tree instead of using the <GanttChart /> component. Constructs a
445
+ * @ganttloom/gantt-core GanttChart instance against `containerRef.value` on mount,
446
+ * keeps it in sync with the tasks/dependencies/options getters via setTasks / setDependencies /
447
+ * setOptions (reference-equality checks only — return a new array/object to trigger a sync),
448
+ * and destroys it on unmount.
449
+ *
450
+ * `getTasks`/`getDependencies`/`getOptions` are plain functions (not refs) so this composable
451
+ * can track whatever reactive source each one reads — a prop, a ref, a computed — without
452
+ * imposing a shape on the caller.
453
+ */
454
+ declare function useGanttChart(containerRef: Ref<HTMLElement | null>, getTasks: () => GanttTask[], getDependencies: () => GanttDependency[], getOptions: () => GanttOptions): UseGanttChartResult;
455
+
456
+ export { GanttChart, type GanttChartHandle, type GanttChartProps, type UseGanttChartResult, GanttChart as default, useGanttChart };