@masterteam/task-schedule 0.0.20 → 0.0.22

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.
@@ -3672,6 +3672,16 @@ class TaskSchedule {
3672
3672
  if (item.id === 'convert_to') {
3673
3673
  item.iconCss = 'fas fa-random';
3674
3674
  item.items = this.editTaskTypes().filter((taskType) => taskType.id !== currentType);
3675
+ return;
3676
+ }
3677
+ // Hide the built-in "Add > Milestone" entry from the right-click menu;
3678
+ // milestones are still added via the toolbar and the convert-to submenu.
3679
+ // Scope this strictly to the Add submenu — touching other items' lazily
3680
+ // populated submenus (e.g. DeleteDependency) re-renders the menu and makes
3681
+ // Syncfusion's own Save/Cancel hide pass flicker.
3682
+ if (String(item.id ?? '').endsWith('_contextMenu_Add') &&
3683
+ Array.isArray(item.items)) {
3684
+ item.items = item.items.filter((subItem) => !String(subItem?.id ?? '').endsWith('_contextMenu_Milestone'));
3675
3685
  }
3676
3686
  });
3677
3687
  }
@@ -3711,6 +3721,16 @@ class TaskSchedule {
3711
3721
  this.openScheduleDialog(args?.requestType === 'beforeOpenEditDialog' ? 'edit' : 'create', args);
3712
3722
  return;
3713
3723
  }
3724
+ // Context-menu "Add > Above/Below/Child" calls Gantt's addRecord directly,
3725
+ // so it never raises beforeOpenAddDialog — the row is inserted locally and
3726
+ // never persisted (it vanishes on refresh). Cancel that local-only add and
3727
+ // route it through the create dialog, which saves it with the correct
3728
+ // parent (parentGuid is resolved from the right-clicked anchor row).
3729
+ if (args?.requestType === 'beforeAdd' && this.isContextAddAction()) {
3730
+ args.cancel = true;
3731
+ this.openScheduleDialog('create', args);
3732
+ return;
3733
+ }
3714
3734
  if (args?.requestType === 'beforeDelete') {
3715
3735
  args.cancel = true;
3716
3736
  const taskId = this.actionService.readDeleteTaskId(args);
@@ -4003,12 +4023,18 @@ class TaskSchedule {
4003
4023
  }
4004
4024
  resolveParentGuidForContextAddTask(task) {
4005
4025
  const actionId = this.contextAddTask();
4026
+ // The anchor is Syncfusion's row object, which keeps the original record
4027
+ // (and its custom guid/parentGuid) under `taskData` rather than at the top
4028
+ // level. Fall back to it so the subtask is actually created with a parent.
4029
+ const taskData = task?.['taskData'];
4030
+ const guid = task?.guid ?? taskData?.guid;
4031
+ const parentGuid = task?.parentGuid ?? taskData?.parentGuid;
4006
4032
  if (actionId.endsWith('_contextMenu_Child')) {
4007
- return String(task?.guid ?? '');
4033
+ return String(guid ?? '');
4008
4034
  }
4009
4035
  if (actionId.endsWith('_contextMenu_Below') ||
4010
4036
  actionId.endsWith('_contextMenu_Above')) {
4011
- return String(task?.parentGuid ?? '');
4037
+ return String(parentGuid ?? '');
4012
4038
  }
4013
4039
  return null;
4014
4040
  }