gantt-renderer 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +137 -88
- package/dist/index.mjs +205 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# [0.6.0](https://github.com/doberkofler/gantt-renderer/compare/v0.5.0...v0.6.0) (2026-05-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **gantt:** simplify default grid columns and add showAddTaskButton option ([800c3cd](https://github.com/doberkofler/gantt-renderer/commit/800c3cdb02d42dfc266823e1d56c0c6cd0eaf009))
|
|
7
|
+
* **locale:** add built-in locale constants for 9 languages ([712254a](https://github.com/doberkofler/gantt-renderer/commit/712254acecc4110ad53de9de14833b2feb1ef16f))
|
|
8
|
+
* **types:** add generic type params to Task, Link, GanttInput, GanttChart ([561ebcf](https://github.com/doberkofler/gantt-renderer/commit/561ebcf01dd1610f0f80739bd29509a05e7848c5))
|
|
9
|
+
|
|
1
10
|
# [0.5.0](https://github.com/doberkofler/gantt-renderer/compare/v0.4.0...v0.5.0) (2026-05-09)
|
|
2
11
|
|
|
3
12
|
|
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ declare const SpecialDaySchema: z.ZodObject<{
|
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
declare const TaskSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
29
|
kind: z.ZodLiteral<"task">;
|
|
30
|
-
|
|
30
|
+
endDate: z.ZodString;
|
|
31
31
|
percentComplete: z.ZodDefault<z.ZodNumber>;
|
|
32
32
|
id: z.ZodNumber;
|
|
33
33
|
text: z.ZodString;
|
|
@@ -38,7 +38,7 @@ declare const TaskSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
38
38
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
39
39
|
}, z.core.$strip>, z.ZodObject<{
|
|
40
40
|
kind: z.ZodLiteral<"project">;
|
|
41
|
-
|
|
41
|
+
endDate: z.ZodString;
|
|
42
42
|
percentComplete: z.ZodDefault<z.ZodNumber>;
|
|
43
43
|
open: z.ZodDefault<z.ZodBoolean>;
|
|
44
44
|
id: z.ZodNumber;
|
|
@@ -74,7 +74,7 @@ declare const LinkSchema: z.ZodObject<{
|
|
|
74
74
|
declare const GanttInputSchema: z.ZodObject<{
|
|
75
75
|
tasks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
76
|
kind: z.ZodLiteral<"task">;
|
|
77
|
-
|
|
77
|
+
endDate: z.ZodString;
|
|
78
78
|
percentComplete: z.ZodDefault<z.ZodNumber>;
|
|
79
79
|
id: z.ZodNumber;
|
|
80
80
|
text: z.ZodString;
|
|
@@ -85,7 +85,7 @@ declare const GanttInputSchema: z.ZodObject<{
|
|
|
85
85
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
86
86
|
}, z.core.$strip>, z.ZodObject<{
|
|
87
87
|
kind: z.ZodLiteral<"project">;
|
|
88
|
-
|
|
88
|
+
endDate: z.ZodString;
|
|
89
89
|
percentComplete: z.ZodDefault<z.ZodNumber>;
|
|
90
90
|
open: z.ZodDefault<z.ZodBoolean>;
|
|
91
91
|
id: z.ZodNumber;
|
|
@@ -119,43 +119,78 @@ declare const GanttInputSchema: z.ZodObject<{
|
|
|
119
119
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
120
120
|
}, z.core.$strip>>>;
|
|
121
121
|
}, z.core.$strip>;
|
|
122
|
-
/**
|
|
123
|
-
type
|
|
124
|
-
/**
|
|
125
|
-
type
|
|
126
|
-
/** Allowed task kind values: `'task'`, `'project'`, or `'milestone'`. */
|
|
127
|
-
type TaskKind = z.infer<typeof TaskKindSchema>;
|
|
128
|
-
type SpecialDayKind = z.infer<typeof SpecialDayKindSchema>;
|
|
129
|
-
type SpecialDay = z.infer<typeof SpecialDaySchema>;
|
|
122
|
+
/** @internal */
|
|
123
|
+
type ZodTaskInferred = z.infer<typeof TaskSchema>;
|
|
124
|
+
/** @internal */
|
|
125
|
+
type ZodLinkInferred = z.infer<typeof LinkSchema>;
|
|
130
126
|
/**
|
|
131
|
-
*
|
|
127
|
+
* Conditional data property helper.
|
|
128
|
+
* When `T` is `never`, adds nothing. Otherwise adds `{data?: T | undefined}`.
|
|
129
|
+
*/
|
|
130
|
+
type WithData<T> = [T] extends [never] ? Record<never, never> : {
|
|
131
|
+
data?: T | undefined;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Distributes `Omit` over union members so variant-specific properties
|
|
135
|
+
* (e.g. `endDate`, `percentComplete`, `open`) are preserved in discriminated unions.
|
|
136
|
+
*/
|
|
137
|
+
type WithoutData<T> = T extends unknown ? Omit<T, 'data'> : never;
|
|
138
|
+
/**
|
|
139
|
+
* A task in the Gantt chart — discriminated by `kind` into leaf tasks,
|
|
132
140
|
* summary projects, and milestones.
|
|
133
141
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* -
|
|
142
|
+
* @param TData - The type of the optional `data` property. Defaults to `never`,
|
|
143
|
+
* which omits the `data` property from the type. Specify a concrete type to enable
|
|
144
|
+
* compile-time-checked task data in both input and callback payloads.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* // Default: no `data` property
|
|
149
|
+
* const task: Task = { id: 1, text: 'Build', startDate: '2026-01-01', endDate: '2026-01-03', kind: 'task' };
|
|
150
|
+
*
|
|
151
|
+
* // With typed data
|
|
152
|
+
* interface TaskMeta { priority: number; label: string }
|
|
153
|
+
* const typedTask: Task<TaskMeta> = {
|
|
154
|
+
* id: 1, text: 'Build', startDate: '2026-01-01', endDate: '2026-01-03',
|
|
155
|
+
* kind: 'task', data: { priority: 1, label: 'critical' }
|
|
156
|
+
* };
|
|
157
|
+
* ```
|
|
137
158
|
*/
|
|
138
|
-
type Task =
|
|
159
|
+
type Task<TData = never> = WithoutData<ZodTaskInferred> & WithData<TData>;
|
|
139
160
|
/**
|
|
140
|
-
* A dependency link between two tasks.
|
|
141
|
-
*
|
|
161
|
+
* A dependency link between two tasks.
|
|
162
|
+
*
|
|
163
|
+
* @param TData - The type of the optional `data` property. Defaults to `never`.
|
|
142
164
|
*/
|
|
143
|
-
type Link =
|
|
165
|
+
type Link<TData = never> = WithoutData<ZodLinkInferred> & WithData<TData>;
|
|
144
166
|
/**
|
|
145
167
|
* The complete input data for the chart.
|
|
146
168
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
169
|
+
* @param TTaskData - The type of the `data` property on tasks. Defaults to `never`.
|
|
170
|
+
* @param TLinkData - The type of the `data` property on links. Defaults to `never`.
|
|
149
171
|
*/
|
|
150
|
-
type GanttInput =
|
|
172
|
+
type GanttInput<TTaskData = never, TLinkData = never> = {
|
|
173
|
+
tasks: Task<TTaskData>[];
|
|
174
|
+
links: Link<TLinkData>[];
|
|
175
|
+
};
|
|
176
|
+
/** @internal */
|
|
177
|
+
type _GanttInputZod = z.infer<typeof GanttInputSchema>;
|
|
178
|
+
/** The raw, unvalidated input shape that consumers pass to {@link parseGanttInput}. */
|
|
179
|
+
type GanttInputRaw = z.input<typeof GanttInputSchema>;
|
|
180
|
+
/** Allowed dependency link type values: `'FS'`, `'SS'`, `'FF'`, or `'SF'`. */
|
|
181
|
+
type LinkType = z.infer<typeof LinkTypeSchema>;
|
|
182
|
+
/** Allowed task kind values: `'task'`, `'project'`, or `'milestone'`. */
|
|
183
|
+
type TaskKind = z.infer<typeof TaskKindSchema>;
|
|
184
|
+
type SpecialDayKind = z.infer<typeof SpecialDayKindSchema>;
|
|
185
|
+
type SpecialDay = z.infer<typeof SpecialDaySchema>;
|
|
151
186
|
/**
|
|
152
187
|
* Parses raw external data.
|
|
153
188
|
*
|
|
154
189
|
* @param raw - The unvalidated input from the consumer.
|
|
155
|
-
* @returns The parsed and validated
|
|
190
|
+
* @returns The parsed and validated input with `data` typed as `Record<string, unknown>`.
|
|
156
191
|
* @throws {import('zod').ZodError} On schema validation failure.
|
|
157
192
|
*/
|
|
158
|
-
declare function parseGanttInput(raw: GanttInputRaw): GanttInput
|
|
193
|
+
declare function parseGanttInput(raw: GanttInputRaw): GanttInput<Record<string, unknown>, Record<string, unknown>>;
|
|
159
194
|
//#endregion
|
|
160
195
|
//#region src/lib/timeline/scale.d.ts
|
|
161
196
|
type TimeScale = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
@@ -174,7 +209,7 @@ declare const SCALE_CONFIGS: Record<TimeScale, ScaleConfig>;
|
|
|
174
209
|
* Produced by {@link buildTaskTree}; consumed by virtualized row rendering
|
|
175
210
|
* and the timeline layout engine.
|
|
176
211
|
*/
|
|
177
|
-
type TaskNode =
|
|
212
|
+
type TaskNode = ZodTaskInferred & {
|
|
178
213
|
/** Array of child task nodes in the tree hierarchy. */children: TaskNode[]; /** 0 = root */
|
|
179
214
|
depth: number;
|
|
180
215
|
};
|
|
@@ -188,7 +223,7 @@ type TaskNode = Task & {
|
|
|
188
223
|
* when a parent cycle is detected, or when a `parent` points to a
|
|
189
224
|
* milestone or leaf task.
|
|
190
225
|
*/
|
|
191
|
-
declare function buildTaskTree(tasks:
|
|
226
|
+
declare function buildTaskTree(tasks: ZodTaskInferred[]): TaskNode[];
|
|
192
227
|
/**
|
|
193
228
|
* Flattens a tree into a visible row list.
|
|
194
229
|
* A node's children are included only when its id is in `expandedIds`.
|
|
@@ -209,9 +244,9 @@ declare function isParent(node: TaskNode): boolean;
|
|
|
209
244
|
//#region src/lib/timeline/pixelMapper.d.ts
|
|
210
245
|
type PixelMapper = {
|
|
211
246
|
/** Date → x pixel offset from viewport start */toX: (date: Date) => number; /** x pixel offset → Date */
|
|
212
|
-
toDate: (x: number) => Date; /**
|
|
213
|
-
|
|
214
|
-
|
|
247
|
+
toDate: (x: number) => Date; /** Days → pixel width */
|
|
248
|
+
durationDaysToWidth: (days: number) => number; /** Pixel width → days (float) */
|
|
249
|
+
widthToDurationDays: (px: number) => number; /** The origin timestamp used for this mapper */
|
|
215
250
|
originMs: number; /** Pixel width of one column unit */
|
|
216
251
|
columnWidth: number;
|
|
217
252
|
};
|
|
@@ -268,7 +303,7 @@ declare function computeLayout(rows: TaskNode[], mapper: PixelMapper): Map<numbe
|
|
|
268
303
|
declare function deriveViewport(tasks: TaskNode[], paddingHours?: number): [Date, Date];
|
|
269
304
|
//#endregion
|
|
270
305
|
//#region src/lib/locale.d.ts
|
|
271
|
-
type LocaleLabelKey = 'ariaTask' | 'ariaMilestone' | 'addSubtaskTitle' | 'columnTaskName' | 'columnStartDate' | 'columnDuration' | 'columnQuarter';
|
|
306
|
+
type LocaleLabelKey = 'ariaTask' | 'ariaMilestone' | 'addSubtaskTitle' | 'columnTaskName' | 'columnStartDate' | 'columnEndDate' | 'columnDuration' | 'columnQuarter';
|
|
272
307
|
type ChartLocale = {
|
|
273
308
|
code: string;
|
|
274
309
|
labels?: Partial<Record<LocaleLabelKey, string>>;
|
|
@@ -278,6 +313,14 @@ type ChartLocale = {
|
|
|
278
313
|
};
|
|
279
314
|
declare const EN_US_LABELS: Record<LocaleLabelKey, string>;
|
|
280
315
|
declare const CHART_LOCALE_EN_US: ChartLocale;
|
|
316
|
+
declare const CHART_LOCALE_EN_GB: ChartLocale;
|
|
317
|
+
declare const CHART_LOCALE_DE_DE: ChartLocale;
|
|
318
|
+
declare const CHART_LOCALE_FR_FR: ChartLocale;
|
|
319
|
+
declare const CHART_LOCALE_ES_ES: ChartLocale;
|
|
320
|
+
declare const CHART_LOCALE_IT_IT: ChartLocale;
|
|
321
|
+
declare const CHART_LOCALE_PT_PT: ChartLocale;
|
|
322
|
+
declare const CHART_LOCALE_ZH_CN: ChartLocale;
|
|
323
|
+
declare const CHART_LOCALE_JA_JP: ChartLocale;
|
|
281
324
|
/**
|
|
282
325
|
* Derives the first day of week (0=Sun, 1=Mon, 6=Sat) from a BCP 47 code.
|
|
283
326
|
* Uses `Intl.Locale.getWeekInfo()` where available (Chromium, Safari 15.4+),
|
|
@@ -340,7 +383,7 @@ declare function formatLabel(template: string, arg: string): string;
|
|
|
340
383
|
* @param links - The dependency links defining the directed edges.
|
|
341
384
|
* @throws {GanttError} When a cycle is detected, with a human-readable cycle path.
|
|
342
385
|
*/
|
|
343
|
-
declare function detectCycles(tasks:
|
|
386
|
+
declare function detectCycles(tasks: ZodTaskInferred[], links: ZodLinkInferred[]): void;
|
|
344
387
|
/**
|
|
345
388
|
* Validates that every link references existing task IDs and that no
|
|
346
389
|
* duplicate (source, target) pairs exist.
|
|
@@ -351,7 +394,7 @@ declare function detectCycles(tasks: Task[], links: Link[]): void;
|
|
|
351
394
|
* when a non-FS link connects to/from a milestone, or when duplicate
|
|
352
395
|
* (source, target) pairs exist.
|
|
353
396
|
*/
|
|
354
|
-
declare function validateLinkRefs(tasks:
|
|
397
|
+
declare function validateLinkRefs(tasks: ZodTaskInferred[], links: ZodLinkInferred[]): void;
|
|
355
398
|
//#endregion
|
|
356
399
|
//#region src/lib/domain/dateMath.d.ts
|
|
357
400
|
/**
|
|
@@ -416,7 +459,7 @@ type RoutedLink = {
|
|
|
416
459
|
* @param layouts - A map from task ID to its computed {@link BarLayout}.
|
|
417
460
|
* @returns An array of {@link RoutedLink} objects with computed vertex paths.
|
|
418
461
|
*/
|
|
419
|
-
declare function routeLinks(links:
|
|
462
|
+
declare function routeLinks(links: ZodLinkInferred[], layouts: Map<number, BarLayout>): RoutedLink[];
|
|
420
463
|
//#endregion
|
|
421
464
|
//#region src/lib/vanilla/dom/gridColumns.d.ts
|
|
422
465
|
/**
|
|
@@ -424,7 +467,7 @@ declare function routeLinks(links: Link[], layouts: Map<number, BarLayout>): Rou
|
|
|
424
467
|
* Use when referencing task fields in grid column schemas that apply
|
|
425
468
|
* across a heterogeneous set of task kinds.
|
|
426
469
|
*/
|
|
427
|
-
type TaskDataField = keyof
|
|
470
|
+
type TaskDataField = keyof ZodTaskInferred | 'endDate' | 'percentComplete' | 'open';
|
|
428
471
|
type GridColumn = {
|
|
429
472
|
id: string;
|
|
430
473
|
header: string;
|
|
@@ -432,7 +475,7 @@ type GridColumn = {
|
|
|
432
475
|
align?: 'left' | 'center' | 'right';
|
|
433
476
|
visible?: boolean;
|
|
434
477
|
field?: TaskDataField;
|
|
435
|
-
format?: (value: unknown, task:
|
|
478
|
+
format?: (value: unknown, task: ZodTaskInferred, row: TaskNode, locale: ChartLocale) => string;
|
|
436
479
|
};
|
|
437
480
|
declare const DEFAULT_GRID_COLUMNS: GridColumn[];
|
|
438
481
|
/**
|
|
@@ -468,72 +511,74 @@ declare const GRID_COLUMN_FR_MIN_WIDTH = 120;
|
|
|
468
511
|
declare function gridNaturalWidth(columns: GridColumn[]): number;
|
|
469
512
|
//#endregion
|
|
470
513
|
//#region src/lib/vanilla/gantt-chart.d.ts
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
514
|
+
/** Internal convenience aliases for the zod-inferred runtime types (include `data?: Record<string, unknown>`). */
|
|
515
|
+
type GanttInput$1 = _GanttInputZod;
|
|
516
|
+
type OnTaskClick<TTaskData = never, TLinkData = never> = (payload: {
|
|
517
|
+
task: Task<TTaskData>;
|
|
518
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
474
519
|
}) => void | Promise<void>;
|
|
475
|
-
type OnTaskDoubleClick = (payload: {
|
|
476
|
-
task: Task
|
|
477
|
-
instance: GanttInstance
|
|
520
|
+
type OnTaskDoubleClick<TTaskData = never, TLinkData = never> = (payload: {
|
|
521
|
+
task: Task<TTaskData>;
|
|
522
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
478
523
|
}) => void | Promise<void>;
|
|
479
|
-
type OnTaskMove = (payload: {
|
|
480
|
-
task: Task
|
|
524
|
+
type OnTaskMove<TTaskData = never, TLinkData = never> = (payload: {
|
|
525
|
+
task: Task<TTaskData>;
|
|
481
526
|
newStartDate: Date;
|
|
482
527
|
newEndDate: Date;
|
|
483
|
-
instance: GanttInstance
|
|
528
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
484
529
|
}) => boolean | Promise<boolean>;
|
|
485
|
-
type OnTaskResize = (payload: {
|
|
486
|
-
task: Task
|
|
530
|
+
type OnTaskResize<TTaskData = never, TLinkData = never> = (payload: {
|
|
531
|
+
task: Task<TTaskData>;
|
|
487
532
|
newDurationHours: number;
|
|
488
533
|
newStartDate: Date;
|
|
489
534
|
newEndDate: Date;
|
|
490
|
-
instance: GanttInstance
|
|
535
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
491
536
|
}) => boolean | Promise<boolean>;
|
|
492
|
-
type OnTaskAdd = (payload: {
|
|
493
|
-
parentTask: Task
|
|
494
|
-
instance: GanttInstance
|
|
537
|
+
type OnTaskAdd<TTaskData = never, TLinkData = never> = (payload: {
|
|
538
|
+
parentTask: Task<TTaskData>;
|
|
539
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
495
540
|
}) => boolean | Promise<boolean>;
|
|
496
|
-
type OnLinkCreate = (payload: {
|
|
541
|
+
type OnLinkCreate<TTaskData = never, TLinkData = never> = (payload: {
|
|
497
542
|
type: 'FS';
|
|
498
|
-
sourceTask: Task
|
|
499
|
-
targetTask: Task
|
|
500
|
-
instance: GanttInstance
|
|
543
|
+
sourceTask: Task<TTaskData>;
|
|
544
|
+
targetTask: Task<TTaskData>;
|
|
545
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
501
546
|
}) => boolean | Promise<boolean>;
|
|
502
|
-
type OnLinkClick = (payload: {
|
|
503
|
-
link: Link
|
|
504
|
-
instance: GanttInstance
|
|
547
|
+
type OnLinkClick<TTaskData = never, TLinkData = never> = (payload: {
|
|
548
|
+
link: Link<TLinkData>;
|
|
549
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
505
550
|
}) => void | Promise<void>;
|
|
506
|
-
type OnLinkDblClick = (payload: {
|
|
507
|
-
link: Link
|
|
508
|
-
instance: GanttInstance
|
|
551
|
+
type OnLinkDblClick<TTaskData = never, TLinkData = never> = (payload: {
|
|
552
|
+
link: Link<TLinkData>;
|
|
553
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
509
554
|
}) => void | Promise<void>;
|
|
510
|
-
type OnProgressChange = (payload: {
|
|
511
|
-
task: Task
|
|
555
|
+
type OnProgressChange<TTaskData = never, TLinkData = never> = (payload: {
|
|
556
|
+
task: Task<TTaskData>;
|
|
512
557
|
newPercentComplete: number;
|
|
513
|
-
instance: GanttInstance
|
|
558
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
514
559
|
}) => boolean | Promise<boolean>;
|
|
515
|
-
type OnTooltipText = (payload: {
|
|
516
|
-
task: Task
|
|
517
|
-
instance: GanttInstance
|
|
560
|
+
type OnTooltipText<TTaskData = never, TLinkData = never> = (payload: {
|
|
561
|
+
task: Task<TTaskData>;
|
|
562
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
518
563
|
}) => string | null;
|
|
519
|
-
type GanttCallbacks = {
|
|
520
|
-
onTaskClick?: OnTaskClick
|
|
521
|
-
onTaskDoubleClick?: OnTaskDoubleClick
|
|
522
|
-
onTaskMove?: OnTaskMove
|
|
523
|
-
onTaskResize?: OnTaskResize
|
|
524
|
-
onTaskAdd?: OnTaskAdd
|
|
525
|
-
onLinkCreate?: OnLinkCreate
|
|
526
|
-
onLinkClick?: OnLinkClick
|
|
527
|
-
onLinkDblClick?: OnLinkDblClick
|
|
528
|
-
onProgressChange?: OnProgressChange
|
|
529
|
-
onTooltipText?: OnTooltipText
|
|
564
|
+
type GanttCallbacks<TTaskData = never, TLinkData = never> = {
|
|
565
|
+
onTaskClick?: OnTaskClick<TTaskData, TLinkData>;
|
|
566
|
+
onTaskDoubleClick?: OnTaskDoubleClick<TTaskData, TLinkData>;
|
|
567
|
+
onTaskMove?: OnTaskMove<TTaskData, TLinkData>;
|
|
568
|
+
onTaskResize?: OnTaskResize<TTaskData, TLinkData>;
|
|
569
|
+
onTaskAdd?: OnTaskAdd<TTaskData, TLinkData>;
|
|
570
|
+
onLinkCreate?: OnLinkCreate<TTaskData, TLinkData>;
|
|
571
|
+
onLinkClick?: OnLinkClick<TTaskData, TLinkData>;
|
|
572
|
+
onLinkDblClick?: OnLinkDblClick<TTaskData, TLinkData>;
|
|
573
|
+
onProgressChange?: OnProgressChange<TTaskData, TLinkData>;
|
|
574
|
+
onTooltipText?: OnTooltipText<TTaskData, TLinkData>;
|
|
530
575
|
onLeftPaneWidthChange?: (payload: {
|
|
531
576
|
width: number;
|
|
532
|
-
instance: GanttInstance
|
|
577
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
533
578
|
}) => void | Promise<void>;
|
|
534
579
|
onGridColumnsChange?: (payload: {
|
|
535
580
|
columns: GridColumn[];
|
|
536
|
-
instance: GanttInstance
|
|
581
|
+
instance: GanttInstance<TTaskData, TLinkData>;
|
|
537
582
|
}) => void | Promise<void>;
|
|
538
583
|
};
|
|
539
584
|
type ThemeMode = 'light' | 'dark' | 'system';
|
|
@@ -557,11 +602,12 @@ type GanttOptions = {
|
|
|
557
602
|
specialDays?: SpecialDay[];
|
|
558
603
|
gridColumns?: GridColumn[];
|
|
559
604
|
theme?: ThemeMode;
|
|
605
|
+
showAddTaskButton?: boolean;
|
|
560
606
|
};
|
|
561
|
-
type GanttInstance = {
|
|
562
|
-
update: (input: GanttInput) => void;
|
|
607
|
+
type GanttInstance<TTaskData = never, TLinkData = never> = {
|
|
608
|
+
update: (input: GanttInput$1) => void;
|
|
563
609
|
setOptions: (opts: Partial<GanttOptions>) => void;
|
|
564
|
-
setCallbacks: (cbs: GanttCallbacks) => void;
|
|
610
|
+
setCallbacks: (cbs: GanttCallbacks<TTaskData, TLinkData>) => void;
|
|
565
611
|
select: (id: number | null, fireCallback?: boolean) => void;
|
|
566
612
|
collapseAll: () => void;
|
|
567
613
|
expandAll: () => void;
|
|
@@ -572,15 +618,18 @@ type GanttInstance = {
|
|
|
572
618
|
* Validates input, builds a DOM tree, and renders a full interactive chart
|
|
573
619
|
* inside the given container element.
|
|
574
620
|
*
|
|
621
|
+
* @param TTaskData - The type of the optional `data` property on tasks. Defaults to `never`.
|
|
622
|
+
* @param TLinkData - The type of the optional `data` property on links. Defaults to `never`.
|
|
623
|
+
*
|
|
575
624
|
* @example
|
|
576
625
|
* ```ts
|
|
577
|
-
* const chart = new GanttChart(document.getElementById('chart')!,
|
|
626
|
+
* const chart = new GanttChart(document.getElementById('chart')!, {
|
|
578
627
|
* locale: 'de-DE',
|
|
579
628
|
* theme: 'dark',
|
|
580
629
|
* });
|
|
581
630
|
* ```
|
|
582
631
|
*/
|
|
583
|
-
declare class GanttChart implements GanttInstance {
|
|
632
|
+
declare class GanttChart<TTaskData = never, TLinkData = never> implements GanttInstance<TTaskData, TLinkData> {
|
|
584
633
|
#private;
|
|
585
634
|
/**
|
|
586
635
|
* Constructs a new chart, builds the DOM, and wires internal event handling.
|
|
@@ -598,14 +647,14 @@ declare class GanttChart implements GanttInstance {
|
|
|
598
647
|
* @param cbs - The {@link GanttCallbacks} to register.
|
|
599
648
|
* @throws {GanttError} When the instance has been destroyed.
|
|
600
649
|
*/
|
|
601
|
-
setCallbacks(cbs: GanttCallbacks): void;
|
|
650
|
+
setCallbacks(cbs: GanttCallbacks<TTaskData, TLinkData>): void;
|
|
602
651
|
/**
|
|
603
652
|
* Replaces the full dataset and re-renders.
|
|
604
653
|
*
|
|
605
654
|
* @param newInput - The new {@link GanttInput} to apply.
|
|
606
655
|
* @throws {GanttError} When the instance has been destroyed.
|
|
607
656
|
*/
|
|
608
|
-
update(newInput: GanttInput): void;
|
|
657
|
+
update(newInput: GanttInput$1): void;
|
|
609
658
|
/**
|
|
610
659
|
* Merges the supplied options into the current configuration and re-renders
|
|
611
660
|
* only the panes affected by the changed options.
|
|
@@ -657,5 +706,5 @@ declare class GanttError extends Error {
|
|
|
657
706
|
constructor(code: GanttErrorCode, message: string);
|
|
658
707
|
}
|
|
659
708
|
//#endregion
|
|
660
|
-
export { BAR_HEIGHT, BAR_Y_OFFSET, type BarLayout, CHART_LOCALE_EN_US, type ChartLocale, DEFAULT_GRID_COLUMNS, DENSITY, EN_US_LABELS, GRID_COLUMN_FR_MIN_WIDTH, type GanttCallbacks, GanttChart, GanttError, type GanttErrorCode, type GanttInput, type GanttInputRaw, GanttInputSchema, type GanttInstance, type GanttOptions, type GridColumn, type Link, LinkSchema, type LinkType, LinkTypeSchema, type LocaleLabelKey, MILESTONE_HALF, MILESTONE_SIZE, type OnLinkClick, type OnLinkCreate, type OnLinkDblClick, type OnProgressChange, type OnTaskAdd, type OnTaskClick, type OnTaskDoubleClick, type OnTaskMove, type OnTaskResize, type OnTooltipText, type PixelMapper, type Point, ROW_HEIGHT, type RoutedLink, SCALE_CONFIGS, type ScaleConfig, type SpecialDay, type SpecialDayKind, SpecialDayKindSchema, SpecialDaySchema, type Task, type TaskDataField, type TaskKind, TaskKindSchema, type TaskNode, TaskSchema, type ThemeMode, type TimeScale, addDays, addHours, buildTaskTree, computeLayout, createPixelMapper, deriveViewport, deriveWeekNumbering, deriveWeekStartsOn, deriveWeekendDays, detectCycles, diffDays, diffHours, flattenTree, formatLabel, formatWeekNumber, gridColumnDefaults, gridNaturalWidth, gridTemplateColumns, isParent, parseDate, parseGanttInput, resolveChartLocale, routeLinks, validateLinkRefs, visibleColumns };
|
|
709
|
+
export { BAR_HEIGHT, BAR_Y_OFFSET, type BarLayout, CHART_LOCALE_DE_DE, CHART_LOCALE_EN_GB, CHART_LOCALE_EN_US, CHART_LOCALE_ES_ES, CHART_LOCALE_FR_FR, CHART_LOCALE_IT_IT, CHART_LOCALE_JA_JP, CHART_LOCALE_PT_PT, CHART_LOCALE_ZH_CN, type ChartLocale, DEFAULT_GRID_COLUMNS, DENSITY, EN_US_LABELS, GRID_COLUMN_FR_MIN_WIDTH, type GanttCallbacks, GanttChart, GanttError, type GanttErrorCode, type GanttInput, type GanttInputRaw, GanttInputSchema, type GanttInstance, type GanttOptions, type GridColumn, type Link, LinkSchema, type LinkType, LinkTypeSchema, type LocaleLabelKey, MILESTONE_HALF, MILESTONE_SIZE, type OnLinkClick, type OnLinkCreate, type OnLinkDblClick, type OnProgressChange, type OnTaskAdd, type OnTaskClick, type OnTaskDoubleClick, type OnTaskMove, type OnTaskResize, type OnTooltipText, type PixelMapper, type Point, ROW_HEIGHT, type RoutedLink, SCALE_CONFIGS, type ScaleConfig, type SpecialDay, type SpecialDayKind, SpecialDayKindSchema, SpecialDaySchema, type Task, type TaskDataField, type TaskKind, TaskKindSchema, type TaskNode, TaskSchema, type ThemeMode, type TimeScale, addDays, addHours, buildTaskTree, computeLayout, createPixelMapper, deriveViewport, deriveWeekNumbering, deriveWeekStartsOn, deriveWeekendDays, detectCycles, diffDays, diffHours, flattenTree, formatLabel, formatWeekNumber, gridColumnDefaults, gridNaturalWidth, gridTemplateColumns, isParent, parseDate, parseGanttInput, resolveChartLocale, routeLinks, validateLinkRefs, visibleColumns };
|
|
661
710
|
//# sourceMappingURL=index.d.mts.map
|