gantt-renderer 0.4.0 → 0.5.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.5.0](https://github.com/doberkofler/gantt-renderer/compare/v0.4.0...v0.5.0) (2026-05-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * add newEndDate to onTaskMove and newStartDate/newEndDate to onTaskResize callbacks ([e5fc91e](https://github.com/doberkofler/gantt-renderer/commit/e5fc91e6200c76b27db8c09aa1821765105317fa))
7
+
1
8
  # [0.4.0](https://github.com/doberkofler/gantt-renderer/compare/v0.2.0...v0.4.0) (2026-05-09)
2
9
 
3
10
 
package/dist/index.d.mts CHANGED
@@ -472,24 +472,27 @@ type OnTaskClick = (payload: {
472
472
  task: Task;
473
473
  instance: GanttInstance;
474
474
  }) => void | Promise<void>;
475
+ type OnTaskDoubleClick = (payload: {
476
+ task: Task;
477
+ instance: GanttInstance;
478
+ }) => void | Promise<void>;
475
479
  type OnTaskMove = (payload: {
476
480
  task: Task;
477
481
  newStartDate: Date;
482
+ newEndDate: Date;
478
483
  instance: GanttInstance;
479
484
  }) => boolean | Promise<boolean>;
480
485
  type OnTaskResize = (payload: {
481
486
  task: Task;
482
487
  newDurationHours: number;
488
+ newStartDate: Date;
489
+ newEndDate: Date;
483
490
  instance: GanttInstance;
484
491
  }) => boolean | Promise<boolean>;
485
492
  type OnTaskAdd = (payload: {
486
493
  parentTask: Task;
487
494
  instance: GanttInstance;
488
495
  }) => boolean | Promise<boolean>;
489
- type OnTaskDoubleClick = (payload: {
490
- task: Task;
491
- instance: GanttInstance;
492
- }) => void | Promise<void>;
493
496
  type OnLinkCreate = (payload: {
494
497
  type: 'FS';
495
498
  sourceTask: Task;
@@ -515,10 +518,10 @@ type OnTooltipText = (payload: {
515
518
  }) => string | null;
516
519
  type GanttCallbacks = {
517
520
  onTaskClick?: OnTaskClick;
521
+ onTaskDoubleClick?: OnTaskDoubleClick;
518
522
  onTaskMove?: OnTaskMove;
519
523
  onTaskResize?: OnTaskResize;
520
524
  onTaskAdd?: OnTaskAdd;
521
- onTaskDoubleClick?: OnTaskDoubleClick;
522
525
  onLinkCreate?: OnLinkCreate;
523
526
  onLinkClick?: OnLinkClick;
524
527
  onLinkDblClick?: OnLinkDblClick;
package/dist/index.mjs CHANGED
@@ -3030,9 +3030,12 @@ var GanttChart = class {
3030
3030
  _onTaskMoveFinal: async (payload) => {
3031
3031
  const task = this.#findTask(payload.id);
3032
3032
  if (task !== void 0) {
3033
+ const durationHours = task.kind !== "milestone" ? task.durationHours : 0;
3034
+ const newEndDate = addHours(payload.startDate, durationHours);
3033
3035
  const result = this.#callbacks.onTaskMove?.({
3034
3036
  task,
3035
3037
  newStartDate: payload.startDate,
3038
+ newEndDate,
3036
3039
  instance: this
3037
3040
  });
3038
3041
  if (result instanceof Promise) {
@@ -3060,9 +3063,13 @@ var GanttChart = class {
3060
3063
  _onTaskResizeFinal: async (payload) => {
3061
3064
  const task = this.#findTask(payload.id);
3062
3065
  if (task !== void 0) {
3066
+ const newStartDate = parseDate(task.startDate);
3067
+ const newEndDate = addHours(newStartDate, task.kind !== "milestone" ? task.durationHours : 0);
3063
3068
  const result = this.#callbacks.onTaskResize?.({
3064
3069
  task,
3065
3070
  newDurationHours: payload.durationHours,
3071
+ newStartDate,
3072
+ newEndDate,
3066
3073
  instance: this
3067
3074
  });
3068
3075
  if (result instanceof Promise) {