gantt-renderer 0.10.0 → 0.11.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 +12 -0
- package/dist/index.d.mts +23 -5
- package/dist/index.mjs +29 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [0.11.0](https://github.com/doberkofler/gantt-renderer/compare/v0.10.0...v0.11.0) (2026-05-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **gantt:** default fireCallback to false on select, collapseAll, and expandAll ([2572d4c](https://github.com/doberkofler/gantt-renderer/commit/2572d4c0c75b672b5f2d98d9a1dfde5fb30a421d))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **gantt:** add getOpenStates instance method ([8c8b09c](https://github.com/doberkofler/gantt-renderer/commit/8c8b09cf323b45cc237e969ea190fb7cd7cb5428))
|
|
12
|
+
|
|
1
13
|
# [0.10.0](https://github.com/doberkofler/gantt-renderer/compare/v0.9.0...v0.10.0) (2026-05-13)
|
|
2
14
|
|
|
3
15
|
|
package/dist/index.d.mts
CHANGED
|
@@ -552,8 +552,12 @@ type GanttInstance<TTaskData = never, TLinkData = never> = {
|
|
|
552
552
|
setOptions: (opts: Partial<GanttOptions>) => void;
|
|
553
553
|
setCallbacks: (cbs: GanttCallbacks<TTaskData, TLinkData>) => void;
|
|
554
554
|
select: (id: number | null, fireCallback?: boolean) => void;
|
|
555
|
-
collapseAll: () => void;
|
|
556
|
-
expandAll: () => void;
|
|
555
|
+
collapseAll: (fireCallback?: boolean) => void;
|
|
556
|
+
expandAll: (fireCallback?: boolean) => void;
|
|
557
|
+
getOpenStates: () => {
|
|
558
|
+
id: number;
|
|
559
|
+
open: boolean;
|
|
560
|
+
}[];
|
|
557
561
|
destroy: () => void;
|
|
558
562
|
};
|
|
559
563
|
/**
|
|
@@ -612,22 +616,36 @@ declare class GanttChart<TTaskData = never, TLinkData = never> implements GanttI
|
|
|
612
616
|
* Programmatically selects or deselects a task.
|
|
613
617
|
*
|
|
614
618
|
* @param id - The task ID to select, or `null` to clear the selection.
|
|
615
|
-
* @param fireCallback - Whether to fire the `onTaskClick` callback. Default `
|
|
619
|
+
* @param fireCallback - Whether to fire the `onTaskClick` callback. Default `false`.
|
|
616
620
|
* @throws {GanttError} When the instance has been destroyed.
|
|
617
621
|
*/
|
|
618
622
|
select(id: number | null, fireCallback?: boolean): void;
|
|
619
623
|
/**
|
|
620
624
|
* Collapses all expandable groups in the task tree.
|
|
621
625
|
*
|
|
626
|
+
* @param fireCallback - Whether to fire the `onExpandCollapseAll` callback. Default `false`.
|
|
622
627
|
* @throws {GanttError} When the instance has been destroyed.
|
|
623
628
|
*/
|
|
624
|
-
collapseAll(): void;
|
|
629
|
+
collapseAll(fireCallback?: boolean): void;
|
|
625
630
|
/**
|
|
626
631
|
* Expands all expandable groups in the task tree.
|
|
627
632
|
*
|
|
633
|
+
* @param fireCallback - Whether to fire the `onExpandCollapseAll` callback. Default `false`.
|
|
634
|
+
* @throws {GanttError} When the instance has been destroyed.
|
|
635
|
+
*/
|
|
636
|
+
expandAll(fireCallback?: boolean): void;
|
|
637
|
+
/**
|
|
638
|
+
* Returns the current expand/collapse state of every expandable node
|
|
639
|
+
* (project tasks that have children). The result is ordered by the
|
|
640
|
+
* input task list order.
|
|
641
|
+
*
|
|
642
|
+
* @returns An array of `{id, open}` objects for expandable nodes only.
|
|
628
643
|
* @throws {GanttError} When the instance has been destroyed.
|
|
629
644
|
*/
|
|
630
|
-
|
|
645
|
+
getOpenStates(): {
|
|
646
|
+
id: number;
|
|
647
|
+
open: boolean;
|
|
648
|
+
}[];
|
|
631
649
|
/**
|
|
632
650
|
* Removes the chart DOM and internal listeners, rendering the instance
|
|
633
651
|
* unusable. Subsequent calls to any public method will throw.
|
package/dist/index.mjs
CHANGED
|
@@ -3316,10 +3316,10 @@ var GanttChart = class {
|
|
|
3316
3316
|
* Programmatically selects or deselects a task.
|
|
3317
3317
|
*
|
|
3318
3318
|
* @param id - The task ID to select, or `null` to clear the selection.
|
|
3319
|
-
* @param fireCallback - Whether to fire the `onTaskClick` callback. Default `
|
|
3319
|
+
* @param fireCallback - Whether to fire the `onTaskClick` callback. Default `false`.
|
|
3320
3320
|
* @throws {GanttError} When the instance has been destroyed.
|
|
3321
3321
|
*/
|
|
3322
|
-
select(id, fireCallback =
|
|
3322
|
+
select(id, fireCallback = false) {
|
|
3323
3323
|
this.#assertAlive();
|
|
3324
3324
|
if (id === null) this.#selectedId = null;
|
|
3325
3325
|
else {
|
|
@@ -3340,11 +3340,12 @@ var GanttChart = class {
|
|
|
3340
3340
|
/**
|
|
3341
3341
|
* Collapses all expandable groups in the task tree.
|
|
3342
3342
|
*
|
|
3343
|
+
* @param fireCallback - Whether to fire the `onExpandCollapseAll` callback. Default `false`.
|
|
3343
3344
|
* @throws {GanttError} When the instance has been destroyed.
|
|
3344
3345
|
*/
|
|
3345
|
-
collapseAll() {
|
|
3346
|
+
collapseAll(fireCallback = false) {
|
|
3346
3347
|
this.#assertAlive();
|
|
3347
|
-
const changed = this.#buildExpandCollapseAllPayload(false);
|
|
3348
|
+
const changed = fireCallback ? this.#buildExpandCollapseAllPayload(false) : [];
|
|
3348
3349
|
this.#expandedIds.clear();
|
|
3349
3350
|
if (this.#rafPending && this.#rafId !== null) {
|
|
3350
3351
|
cancelAnimationFrame(this.#rafId);
|
|
@@ -3360,11 +3361,12 @@ var GanttChart = class {
|
|
|
3360
3361
|
/**
|
|
3361
3362
|
* Expands all expandable groups in the task tree.
|
|
3362
3363
|
*
|
|
3364
|
+
* @param fireCallback - Whether to fire the `onExpandCollapseAll` callback. Default `false`.
|
|
3363
3365
|
* @throws {GanttError} When the instance has been destroyed.
|
|
3364
3366
|
*/
|
|
3365
|
-
expandAll() {
|
|
3367
|
+
expandAll(fireCallback = false) {
|
|
3366
3368
|
this.#assertAlive();
|
|
3367
|
-
const changed = this.#buildExpandCollapseAllPayload(true);
|
|
3369
|
+
const changed = fireCallback ? this.#buildExpandCollapseAllPayload(true) : [];
|
|
3368
3370
|
this.#expandedIds.clear();
|
|
3369
3371
|
if (this.#input !== null) for (const id of getExpandableTaskIds(this.#input.tasks)) this.#expandedIds.add(id);
|
|
3370
3372
|
if (this.#rafPending && this.#rafId !== null) {
|
|
@@ -3392,6 +3394,25 @@ var GanttChart = class {
|
|
|
3392
3394
|
return changed;
|
|
3393
3395
|
}
|
|
3394
3396
|
/**
|
|
3397
|
+
* Returns the current expand/collapse state of every expandable node
|
|
3398
|
+
* (project tasks that have children). The result is ordered by the
|
|
3399
|
+
* input task list order.
|
|
3400
|
+
*
|
|
3401
|
+
* @returns An array of `{id, open}` objects for expandable nodes only.
|
|
3402
|
+
* @throws {GanttError} When the instance has been destroyed.
|
|
3403
|
+
*/
|
|
3404
|
+
getOpenStates() {
|
|
3405
|
+
this.#assertAlive();
|
|
3406
|
+
if (this.#input === null) return [];
|
|
3407
|
+
const expandableIds = getExpandableTaskIds(this.#input.tasks);
|
|
3408
|
+
const result = [];
|
|
3409
|
+
for (const task of this.#input.tasks) if (expandableIds.has(task.id)) result.push({
|
|
3410
|
+
id: task.id,
|
|
3411
|
+
open: this.#expandedIds.has(task.id)
|
|
3412
|
+
});
|
|
3413
|
+
return result;
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3395
3416
|
* Removes the chart DOM and internal listeners, rendering the instance
|
|
3396
3417
|
* unusable. Subsequent calls to any public method will throw.
|
|
3397
3418
|
*/
|
|
@@ -3573,11 +3594,11 @@ var GanttChart = class {
|
|
|
3573
3594
|
const collapseBtn = headerEl.querySelector(".gantt-header-collapse-btn");
|
|
3574
3595
|
if (expandBtn !== null) expandBtn.addEventListener("click", (e) => {
|
|
3575
3596
|
e.stopPropagation();
|
|
3576
|
-
this.expandAll();
|
|
3597
|
+
this.expandAll(true);
|
|
3577
3598
|
});
|
|
3578
3599
|
if (collapseBtn !== null) collapseBtn.addEventListener("click", (e) => {
|
|
3579
3600
|
e.stopPropagation();
|
|
3580
|
-
this.collapseAll();
|
|
3601
|
+
this.collapseAll(true);
|
|
3581
3602
|
});
|
|
3582
3603
|
}
|
|
3583
3604
|
#scheduleRender() {
|