@masterteam/task-schedule 0.0.21 → 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.
@@ -3721,6 +3721,16 @@ class TaskSchedule {
3721
3721
  this.openScheduleDialog(args?.requestType === 'beforeOpenEditDialog' ? 'edit' : 'create', args);
3722
3722
  return;
3723
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
+ }
3724
3734
  if (args?.requestType === 'beforeDelete') {
3725
3735
  args.cancel = true;
3726
3736
  const taskId = this.actionService.readDeleteTaskId(args);
@@ -4013,12 +4023,18 @@ class TaskSchedule {
4013
4023
  }
4014
4024
  resolveParentGuidForContextAddTask(task) {
4015
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;
4016
4032
  if (actionId.endsWith('_contextMenu_Child')) {
4017
- return String(task?.guid ?? '');
4033
+ return String(guid ?? '');
4018
4034
  }
4019
4035
  if (actionId.endsWith('_contextMenu_Below') ||
4020
4036
  actionId.endsWith('_contextMenu_Above')) {
4021
- return String(task?.parentGuid ?? '');
4037
+ return String(parentGuid ?? '');
4022
4038
  }
4023
4039
  return null;
4024
4040
  }