gantt-renderer 0.6.0 → 0.7.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 +2 -1
- package/dist/index.d.mts +28 -10
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [0.
|
|
1
|
+
# [0.7.0](https://github.com/doberkofler/gantt-renderer/compare/v0.6.0...v0.7.0) (2026-05-11)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* **gantt:** simplify default grid columns and add showAddTaskButton option ([800c3cd](https://github.com/doberkofler/gantt-renderer/commit/800c3cdb02d42dfc266823e1d56c0c6cd0eaf009))
|
|
7
7
|
* **locale:** add built-in locale constants for 9 languages ([712254a](https://github.com/doberkofler/gantt-renderer/commit/712254acecc4110ad53de9de14833b2feb1ef16f))
|
|
8
8
|
* **types:** add generic type params to Task, Link, GanttInput, GanttChart ([561ebcf](https://github.com/doberkofler/gantt-renderer/commit/561ebcf01dd1610f0f80739bd29509a05e7848c5))
|
|
9
|
+
* **types:** make GanttInputRaw and parseGanttInput generic ([e665221](https://github.com/doberkofler/gantt-renderer/commit/e665221cd13ed58138770365079884cfcc5067fe))
|
|
9
10
|
|
|
10
11
|
# [0.5.0](https://github.com/doberkofler/gantt-renderer/compare/v0.4.0...v0.5.0) (2026-05-09)
|
|
11
12
|
|
package/dist/index.d.mts
CHANGED
|
@@ -123,6 +123,14 @@ declare const GanttInputSchema: z.ZodObject<{
|
|
|
123
123
|
type ZodTaskInferred = z.infer<typeof TaskSchema>;
|
|
124
124
|
/** @internal */
|
|
125
125
|
type ZodLinkInferred = z.infer<typeof LinkSchema>;
|
|
126
|
+
/** @internal */
|
|
127
|
+
type ZodTaskInput = z.input<typeof TaskSchema>;
|
|
128
|
+
/** @internal */
|
|
129
|
+
type ZodLinkInput = z.input<typeof LinkSchema>;
|
|
130
|
+
/** Raw input version of a task — uses zod's input shape where fields with defaults are optional. */
|
|
131
|
+
type TaskRaw<TData = never> = WithoutData<ZodTaskInput> & WithData<TData>;
|
|
132
|
+
/** Raw input version of a link — uses zod's input shape where fields with defaults are optional. */
|
|
133
|
+
type LinkRaw<TData = never> = WithoutData<ZodLinkInput> & WithData<TData>;
|
|
126
134
|
/**
|
|
127
135
|
* Conditional data property helper.
|
|
128
136
|
* When `T` is `never`, adds nothing. Otherwise adds `{data?: T | undefined}`.
|
|
@@ -173,10 +181,18 @@ type GanttInput<TTaskData = never, TLinkData = never> = {
|
|
|
173
181
|
tasks: Task<TTaskData>[];
|
|
174
182
|
links: Link<TLinkData>[];
|
|
175
183
|
};
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type
|
|
184
|
+
/**
|
|
185
|
+
* The raw, unvalidated input shape that consumers pass to {@link parseGanttInput}.
|
|
186
|
+
*
|
|
187
|
+
* Fields with defaults in the schema (e.g. `percentComplete`, `type`) remain optional here.
|
|
188
|
+
*
|
|
189
|
+
* @param TTaskData - The type of the `data` property on tasks. Defaults to `never`.
|
|
190
|
+
* @param TLinkData - The type of the `data` property on links. Defaults to `never`.
|
|
191
|
+
*/
|
|
192
|
+
type GanttInputRaw<TTaskData = never, TLinkData = never> = {
|
|
193
|
+
tasks: TaskRaw<TTaskData>[];
|
|
194
|
+
links?: LinkRaw<TLinkData>[];
|
|
195
|
+
};
|
|
180
196
|
/** Allowed dependency link type values: `'FS'`, `'SS'`, `'FF'`, or `'SF'`. */
|
|
181
197
|
type LinkType = z.infer<typeof LinkTypeSchema>;
|
|
182
198
|
/** Allowed task kind values: `'task'`, `'project'`, or `'milestone'`. */
|
|
@@ -186,11 +202,15 @@ type SpecialDay = z.infer<typeof SpecialDaySchema>;
|
|
|
186
202
|
/**
|
|
187
203
|
* Parses raw external data.
|
|
188
204
|
*
|
|
205
|
+
* Compile-time generics enforce the `data` shape on tasks and links.
|
|
206
|
+
* Runtime validation is done by the zod schemas; the `data` field is
|
|
207
|
+
* validated as a generic object at runtime regardless of the type parameter.
|
|
208
|
+
*
|
|
189
209
|
* @param raw - The unvalidated input from the consumer.
|
|
190
|
-
* @returns The parsed and validated input with `data` typed
|
|
210
|
+
* @returns The parsed and validated input with `data` typed per the type parameters.
|
|
191
211
|
* @throws {import('zod').ZodError} On schema validation failure.
|
|
192
212
|
*/
|
|
193
|
-
declare function parseGanttInput(raw: GanttInputRaw): GanttInput<
|
|
213
|
+
declare function parseGanttInput<TTaskData = never, TLinkData = never>(raw: GanttInputRaw<TTaskData, TLinkData>): GanttInput<TTaskData, TLinkData>;
|
|
194
214
|
//#endregion
|
|
195
215
|
//#region src/lib/timeline/scale.d.ts
|
|
196
216
|
type TimeScale = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
@@ -511,8 +531,6 @@ declare const GRID_COLUMN_FR_MIN_WIDTH = 120;
|
|
|
511
531
|
declare function gridNaturalWidth(columns: GridColumn[]): number;
|
|
512
532
|
//#endregion
|
|
513
533
|
//#region src/lib/vanilla/gantt-chart.d.ts
|
|
514
|
-
/** Internal convenience aliases for the zod-inferred runtime types (include `data?: Record<string, unknown>`). */
|
|
515
|
-
type GanttInput$1 = _GanttInputZod;
|
|
516
534
|
type OnTaskClick<TTaskData = never, TLinkData = never> = (payload: {
|
|
517
535
|
task: Task<TTaskData>;
|
|
518
536
|
instance: GanttInstance<TTaskData, TLinkData>;
|
|
@@ -605,7 +623,7 @@ type GanttOptions = {
|
|
|
605
623
|
showAddTaskButton?: boolean;
|
|
606
624
|
};
|
|
607
625
|
type GanttInstance<TTaskData = never, TLinkData = never> = {
|
|
608
|
-
update: (input: GanttInput
|
|
626
|
+
update: (input: GanttInput<TTaskData, TLinkData>) => void;
|
|
609
627
|
setOptions: (opts: Partial<GanttOptions>) => void;
|
|
610
628
|
setCallbacks: (cbs: GanttCallbacks<TTaskData, TLinkData>) => void;
|
|
611
629
|
select: (id: number | null, fireCallback?: boolean) => void;
|
|
@@ -654,7 +672,7 @@ declare class GanttChart<TTaskData = never, TLinkData = never> implements GanttI
|
|
|
654
672
|
* @param newInput - The new {@link GanttInput} to apply.
|
|
655
673
|
* @throws {GanttError} When the instance has been destroyed.
|
|
656
674
|
*/
|
|
657
|
-
update(newInput: GanttInput
|
|
675
|
+
update(newInput: GanttInput<TTaskData, TLinkData>): void;
|
|
658
676
|
/**
|
|
659
677
|
* Merges the supplied options into the current configuration and re-renders
|
|
660
678
|
* only the panes affected by the changed options.
|
package/dist/index.mjs
CHANGED
|
@@ -157,8 +157,12 @@ const GanttInputSchema = z.object({
|
|
|
157
157
|
/**
|
|
158
158
|
* Parses raw external data.
|
|
159
159
|
*
|
|
160
|
+
* Compile-time generics enforce the `data` shape on tasks and links.
|
|
161
|
+
* Runtime validation is done by the zod schemas; the `data` field is
|
|
162
|
+
* validated as a generic object at runtime regardless of the type parameter.
|
|
163
|
+
*
|
|
160
164
|
* @param raw - The unvalidated input from the consumer.
|
|
161
|
-
* @returns The parsed and validated input with `data` typed
|
|
165
|
+
* @returns The parsed and validated input with `data` typed per the type parameters.
|
|
162
166
|
* @throws {import('zod').ZodError} On schema validation failure.
|
|
163
167
|
*/
|
|
164
168
|
function parseGanttInput(raw) {
|
|
@@ -3324,9 +3328,10 @@ var GanttChart = class {
|
|
|
3324
3328
|
*/
|
|
3325
3329
|
update(newInput) {
|
|
3326
3330
|
this.#assertAlive();
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3331
|
+
const input = newInput;
|
|
3332
|
+
validateLinkRefs(input.tasks, input.links);
|
|
3333
|
+
detectCycles(input.tasks, input.links);
|
|
3334
|
+
this.#input = structuredClone(input);
|
|
3330
3335
|
this.#taskIndex = buildTaskIndex(this.#input.tasks);
|
|
3331
3336
|
this.#expandedIds = getInitialExpandedIds(this.#input.tasks);
|
|
3332
3337
|
if (this.#rafPending && this.#rafId !== null) {
|