@workiom/frappe-gantt 1.0.6 → 1.0.7

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/src/index.js CHANGED
@@ -1436,19 +1436,29 @@ export default class Gantt {
1436
1436
 
1437
1437
  $.on(this.$svg, 'mouseup', (e) => {
1438
1438
  this.bar_being_dragged = null;
1439
+ const tasks_changed = [];
1440
+
1439
1441
  bars.forEach((bar) => {
1440
1442
  const $bar = bar.$bar;
1441
1443
  if (!$bar.finaldx) return;
1442
1444
  bar.date_changed();
1443
1445
  bar.compute_progress();
1444
1446
  bar.set_action_completed();
1447
+ // Track tasks that changed
1448
+ tasks_changed.push({
1449
+ task: bar.task,
1450
+ start: bar.task._start,
1451
+ end: date_utils.add(bar.task._end, -1, 'second')
1452
+ });
1445
1453
  });
1446
1454
 
1447
1455
  // Update dependent tasks based on dependencies_type
1448
1456
  // Only update for the parent bar that was actually moved
1449
1457
  const parent_bar = this.get_bar(parent_bar_id);
1450
1458
  if (parent_bar && parent_bar.$bar.finaldx) {
1451
- this.update_dependent_tasks_by_type(parent_bar);
1459
+ const dependent_changes = this.update_dependent_tasks_by_type(parent_bar);
1460
+ // Add dependent task changes to the list
1461
+ tasks_changed.push(...dependent_changes);
1452
1462
  }
1453
1463
 
1454
1464
  // Recalculate critical path if enabled and any bar was moved
@@ -1456,6 +1466,13 @@ export default class Gantt {
1456
1466
  this.calculate_critical_path();
1457
1467
  this.update_arrow_critical_path();
1458
1468
  }
1469
+
1470
+ // Trigger on_after_date_change for all tasks that changed
1471
+ if (tasks_changed.length > 0) {
1472
+ tasks_changed.forEach(({task, start, end}) => {
1473
+ this.trigger_event('after_date_change', [task, start, end]);
1474
+ });
1475
+ }
1459
1476
  });
1460
1477
 
1461
1478
  this.bind_bar_progress();
@@ -1563,9 +1580,10 @@ export default class Gantt {
1563
1580
 
1564
1581
  update_dependent_tasks_by_type(parent_bar) {
1565
1582
  const dependencies_type = parent_bar.task.dependencies_type || this.options.dependencies_type;
1583
+ const changed_tasks = [];
1566
1584
 
1567
1585
  // Skip if using fixed dependency type (current behavior)
1568
- if (dependencies_type === 'fixed') return;
1586
+ if (dependencies_type === 'fixed') return changed_tasks;
1569
1587
 
1570
1588
  // Get all tasks that depend on this task
1571
1589
  const dependent_task_ids = this.dependency_map[parent_bar.task.id] || [];
@@ -1649,9 +1667,19 @@ export default class Gantt {
1649
1667
  date_utils.add(new_end, -1, 'second'),
1650
1668
  ]);
1651
1669
 
1652
- // Recursively update dependents of this task
1653
- this.update_dependent_tasks_by_type(dependent_bar);
1670
+ // Track this changed task
1671
+ changed_tasks.push({
1672
+ task: dependent_task,
1673
+ start: new_start,
1674
+ end: date_utils.add(new_end, -1, 'second')
1675
+ });
1676
+
1677
+ // Recursively update dependents of this task and collect their changes
1678
+ const recursive_changes = this.update_dependent_tasks_by_type(dependent_bar);
1679
+ changed_tasks.push(...recursive_changes);
1654
1680
  });
1681
+
1682
+ return changed_tasks;
1655
1683
  }
1656
1684
 
1657
1685
  get_snap_position(dx, ox) {
@@ -344,4 +344,35 @@
344
344
  }
345
345
  }
346
346
  }
347
+
348
+ & .add-task-icon {
349
+ cursor: pointer;
350
+ transition: opacity 0.2s ease;
351
+
352
+ & .add-task-icon-bg {
353
+ fill: var(--g-bar-color);
354
+ stroke: var(--g-bar-border);
355
+ stroke-width: 1;
356
+ transition: all 0.2s ease;
357
+ }
358
+
359
+ & .add-task-icon-plus {
360
+ stroke: var(--g-text-dark);
361
+ stroke-width: 2;
362
+ stroke-linecap: round;
363
+ transition: stroke 0.2s ease;
364
+ }
365
+
366
+ &.active,
367
+ &:hover {
368
+ & .add-task-icon-bg {
369
+ fill: var(--g-progress-color);
370
+ stroke: var(--g-progress-color);
371
+ }
372
+
373
+ & .add-task-icon-plus {
374
+ stroke: var(--g-text-light);
375
+ }
376
+ }
377
+ }
347
378
  }