gantt-lib 0.144.0 → 0.145.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/dist/index.mjs CHANGED
@@ -3461,7 +3461,7 @@ function normalizeHierarchyTasks(tasks) {
3461
3461
  ...orderedTasks[index],
3462
3462
  startDate: new Date(minStart).toISOString().split("T")[0],
3463
3463
  endDate: new Date(maxEnd).toISOString().split("T")[0],
3464
- progress: totalWeight === 0 ? 0 : Math.round(weightedProgress / totalWeight * 10) / 10
3464
+ progress: orderedTasks[index].progressAggregation === "manual" ? orderedTasks[index].progress : totalWeight === 0 ? 0 : Math.round(weightedProgress / totalWeight * 10) / 10
3465
3465
  };
3466
3466
  }
3467
3467
  return orderedTasks;
@@ -7451,40 +7451,6 @@ var getEndDateFromDuration = (startDate, durationDays) => {
7451
7451
  const start = parseUTCDate(startDate);
7452
7452
  return new Date(start.getTime() + (durationDays - 1) * DAY_MS4).toISOString().split("T")[0];
7453
7453
  };
7454
- var TrashIcon = () => /* @__PURE__ */ jsxs10(
7455
- "svg",
7456
- {
7457
- xmlns: "http://www.w3.org/2000/svg",
7458
- width: "12",
7459
- height: "12",
7460
- viewBox: "0 0 24 24",
7461
- fill: "none",
7462
- stroke: "currentColor",
7463
- strokeWidth: "2",
7464
- strokeLinecap: "round",
7465
- strokeLinejoin: "round",
7466
- children: [
7467
- /* @__PURE__ */ jsx15("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
7468
- /* @__PURE__ */ jsx15("path", { d: "M3 6h18" }),
7469
- /* @__PURE__ */ jsx15("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
7470
- ]
7471
- }
7472
- );
7473
- var PlusIcon = () => /* @__PURE__ */ jsx15(
7474
- "svg",
7475
- {
7476
- xmlns: "http://www.w3.org/2000/svg",
7477
- width: "14",
7478
- height: "14",
7479
- viewBox: "0 0 24 24",
7480
- fill: "none",
7481
- stroke: "currentColor",
7482
- strokeWidth: "2",
7483
- strokeLinecap: "round",
7484
- strokeLinejoin: "round",
7485
- children: /* @__PURE__ */ jsx15("path", { d: "M12 5v14M5 12h14" })
7486
- }
7487
- );
7488
7454
  var DepEditIcon = () => /* @__PURE__ */ jsxs10(
7489
7455
  "svg",
7490
7456
  {
@@ -7527,67 +7493,6 @@ var VerticalDotsIcon = () => /* @__PURE__ */ jsxs10(
7527
7493
  ]
7528
7494
  }
7529
7495
  );
7530
- var CopyIcon = () => /* @__PURE__ */ jsxs10(
7531
- "svg",
7532
- {
7533
- xmlns: "http://www.w3.org/2000/svg",
7534
- width: "16",
7535
- height: "16",
7536
- viewBox: "0 0 24 24",
7537
- fill: "none",
7538
- stroke: "currentColor",
7539
- strokeWidth: "2",
7540
- strokeLinecap: "round",
7541
- strokeLinejoin: "round",
7542
- children: [
7543
- /* @__PURE__ */ jsx15("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
7544
- /* @__PURE__ */ jsx15("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
7545
- ]
7546
- }
7547
- );
7548
- var UngroupIcon = () => /* @__PURE__ */ jsxs10(
7549
- "svg",
7550
- {
7551
- xmlns: "http://www.w3.org/2000/svg",
7552
- width: "16",
7553
- height: "16",
7554
- viewBox: "0 0 24 24",
7555
- fill: "none",
7556
- stroke: "currentColor",
7557
- strokeWidth: "2",
7558
- strokeLinecap: "round",
7559
- strokeLinejoin: "round",
7560
- children: [
7561
- /* @__PURE__ */ jsx15("path", { d: "M3 12h10" }),
7562
- /* @__PURE__ */ jsx15("path", { d: "m6 9-3 3 3 3" }),
7563
- /* @__PURE__ */ jsx15("path", { d: "M13 6h8" }),
7564
- /* @__PURE__ */ jsx15("path", { d: "M13 18h8" })
7565
- ]
7566
- }
7567
- );
7568
- var TASK_COLOR_PALETTE = [
7569
- // { label: "Палисандр", value: "#A61E4D" },
7570
- // { label: "Киноварь", value: "#E8590C" },
7571
- // { label: "Жёлт", value: "#eec45c" },
7572
- { label: "\u041A\u0438\u043D\u043E\u0432\u0430\u0440\u044C2", value: "#fe724e" },
7573
- // { label: "Оранжевый", value: "#F08C00" },
7574
- { label: "\u041E\u0440\u0430\u043D\u0436\u0435\u0432\u044B\u04392", value: "#ff991f" },
7575
- { label: "\u0417\u043E\u043B\u043E\u0442\u043E\u0439", value: "#e5c800" },
7576
- { label: "\u0411\u0438\u0440\u044E\u0437\u0430", value: "#58d8a3" },
7577
- { label: "\u041F\u0430\u043B\u0438\u0441\u0430\u043D\u0434\u0440", value: "#d64a7b" },
7578
- { label: "\u041F\u0435\u0441\u043E\u0447\u043D\u044B\u0439", value: "#997B10" },
7579
- { label: "\u0428\u0430\u0440\u0442\u0440\u0435\u0437", value: "#A3BE00" },
7580
- { label: "\u0413\u043E\u043B\u0443\u0431\u043E\u0439", value: "#03c7e6" },
7581
- { label: "\u0412\u0438\u043D\u043E\u0433\u0440\u0430\u04342", value: "#8678d9" },
7582
- { label: "\u0421\u0435\u0440\u044B\u04392", value: "#6b778c" },
7583
- { label: "\u041B\u0435\u0441\u043D\u043E\u0439", value: "#2B8A3E" }
7584
- // { label: "Лесной3", value: "#60b838" },
7585
- // { label: "Бирюза", value: "#0B7285" },
7586
- // { label: "Серый", value: "#495057" },
7587
- // { label: "Океан", value: "#5244ff" },
7588
- // { label: "Океан2", value: "#0626ba" },
7589
- // { label: "Виноград", value: "#AE3EC9" },
7590
- ];
7591
7496
  var ChevronRightIcon = () => /* @__PURE__ */ jsx15(
7592
7497
  "svg",
7593
7498
  {
@@ -7617,81 +7522,6 @@ function formatDependencyPrintLabel(dep, predecessorTaskNumber, lag) {
7617
7522
  const lagSuffix = effectiveLag === 0 ? "" : effectiveLag > 0 ? `+${effectiveLag}` : String(effectiveLag);
7618
7523
  return `[${predecessorTaskNumber ?? dep.taskId}]${LINK_TYPE_LABELS_RU2[dep.type]}${lagSuffix}`;
7619
7524
  }
7620
- var ArrowLeft = () => /* @__PURE__ */ jsxs10(
7621
- "svg",
7622
- {
7623
- xmlns: "http://www.w3.org/2000/svg",
7624
- width: "16",
7625
- height: "16",
7626
- viewBox: "0 0 24 24",
7627
- fill: "none",
7628
- stroke: "currentColor",
7629
- strokeWidth: "2",
7630
- strokeLinecap: "round",
7631
- strokeLinejoin: "round",
7632
- children: [
7633
- /* @__PURE__ */ jsx15("path", { d: "m12 19-7-7 7-7" }),
7634
- /* @__PURE__ */ jsx15("path", { d: "M19 12H5" })
7635
- ]
7636
- }
7637
- );
7638
- var ArrowRight = () => /* @__PURE__ */ jsxs10(
7639
- "svg",
7640
- {
7641
- xmlns: "http://www.w3.org/2000/svg",
7642
- width: "16",
7643
- height: "16",
7644
- viewBox: "0 0 24 24",
7645
- fill: "none",
7646
- stroke: "currentColor",
7647
- strokeWidth: "2",
7648
- strokeLinecap: "round",
7649
- strokeLinejoin: "round",
7650
- children: [
7651
- /* @__PURE__ */ jsx15("path", { d: "M5 12h14" }),
7652
- /* @__PURE__ */ jsx15("path", { d: "m12 5 7 7-7 7" })
7653
- ]
7654
- }
7655
- );
7656
- var HierarchyButton = ({
7657
- isChild,
7658
- rowIndex: _rowIndex,
7659
- canDemote,
7660
- onPromote,
7661
- onDemote
7662
- }) => {
7663
- const canPromote = isChild && onPromote;
7664
- const showDemote = canDemote && !!onDemote;
7665
- if (!canPromote && !showDemote) return null;
7666
- return /* @__PURE__ */ jsxs10(Fragment4, { children: [
7667
- canPromote && /* @__PURE__ */ jsx15(
7668
- "button",
7669
- {
7670
- type: "button",
7671
- className: "gantt-tl-name-action-btn gantt-tl-action-hierarchy",
7672
- onClick: (e) => {
7673
- e.stopPropagation();
7674
- onPromote(e);
7675
- },
7676
- title: "\u041F\u043E\u0432\u044B\u0441\u0438\u0442\u044C \u0443\u0440\u043E\u0432\u0435\u043D\u044C",
7677
- children: /* @__PURE__ */ jsx15(ArrowLeft, {})
7678
- }
7679
- ),
7680
- showDemote && /* @__PURE__ */ jsx15(
7681
- "button",
7682
- {
7683
- type: "button",
7684
- className: "gantt-tl-name-action-btn gantt-tl-action-hierarchy",
7685
- onClick: (e) => {
7686
- e.stopPropagation();
7687
- onDemote(e);
7688
- },
7689
- title: "\u041F\u043E\u043D\u0438\u0437\u0438\u0442\u044C \u0443\u0440\u043E\u0432\u0435\u043D\u044C",
7690
- children: /* @__PURE__ */ jsx15(ArrowRight, {})
7691
- }
7692
- )
7693
- ] });
7694
- };
7695
7525
  var DepChip = ({
7696
7526
  lag,
7697
7527
  dep,
@@ -8028,7 +7858,7 @@ var areTaskListRowPropsEqual = (prevProps, nextProps) => {
8028
7858
  const nextPickingTask = nextProps.selectingPredecessorFor === nextTask.id;
8029
7859
  const prevAnyPicking = prevProps.selectingPredecessorFor != null;
8030
7860
  const nextAnyPicking = nextProps.selectingPredecessorFor != null;
8031
- return prevTaskUnchanged && prevProps.rowIndex === nextProps.rowIndex && prevProps.taskNumber === nextProps.taskNumber && prevProps.taskNumberMap === nextProps.taskNumberMap && prevProps.rowHeight === nextProps.rowHeight && prevIsSelected === nextIsSelected && prevProps.disableTaskNameEditing === nextProps.disableTaskNameEditing && prevProps.disableDependencyEditing === nextProps.disableDependencyEditing && prevProps.allTasks === nextProps.allTasks && prevProps.activeLinkType === nextProps.activeLinkType && prevProps.dependencyPickMode === nextProps.dependencyPickMode && prevPickingTask === nextPickingTask && prevAnyPicking === nextAnyPicking && resolveSelectedChipRole(prevProps) === resolveSelectedChipRole(nextProps) && prevIsEditingTask === nextIsEditingTask && prevProps.isDragging === nextProps.isDragging && prevProps.isDragOver === nextProps.isDragOver && prevProps.dragOverPlacement === nextProps.dragOverPlacement && prevProps.isNestedDropTarget === nextProps.isNestedDropTarget && prevProps.isDirectChildDropTarget === nextProps.isDirectChildDropTarget && prevCollapsed === nextCollapsed && prevProps.canDemoteTask === nextProps.canDemoteTask && prevProps.isLastChild === nextProps.isLastChild && prevProps.nestingDepth === nextProps.nestingDepth && prevProps.hasVisibleChildren === nextProps.hasVisibleChildren && prevProps.ancestorLineModes === nextProps.ancestorLineModes && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend && prevProps.fillParentRow === nextProps.fillParentRow && prevProps.businessDays === nextProps.businessDays && prevProps.defaultTaskDurationDays === nextProps.defaultTaskDurationDays && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.isFilterHideMode === nextProps.isFilterHideMode && prevProps.resolvedColumns === nextProps.resolvedColumns && prevProps.isTaskSelected === nextProps.isTaskSelected && resolveActiveCustomCellForRow(prevProps) === resolveActiveCustomCellForRow(nextProps) && prevProps.taskListMenuCommands === nextProps.taskListMenuCommands && prevProps.hideTaskListRowActions === nextProps.hideTaskListRowActions && prevProps.rowClassName === nextProps.rowClassName && prevProps.getTaskListNamePrefixIcon === nextProps.getTaskListNamePrefixIcon && prevProps.taskDateChangeMode === nextProps.taskDateChangeMode && prevProps.printDependencyLabels === nextProps.printDependencyLabels;
7861
+ return prevTaskUnchanged && prevProps.rowIndex === nextProps.rowIndex && prevProps.taskNumber === nextProps.taskNumber && prevProps.taskNumberMap === nextProps.taskNumberMap && prevProps.rowHeight === nextProps.rowHeight && prevIsSelected === nextIsSelected && prevProps.disableTaskNameEditing === nextProps.disableTaskNameEditing && prevProps.disableDependencyEditing === nextProps.disableDependencyEditing && prevProps.allTasks === nextProps.allTasks && prevProps.activeLinkType === nextProps.activeLinkType && prevProps.dependencyPickMode === nextProps.dependencyPickMode && prevPickingTask === nextPickingTask && prevAnyPicking === nextAnyPicking && resolveSelectedChipRole(prevProps) === resolveSelectedChipRole(nextProps) && prevIsEditingTask === nextIsEditingTask && prevProps.isDragging === nextProps.isDragging && prevProps.isDragOver === nextProps.isDragOver && prevProps.dragOverPlacement === nextProps.dragOverPlacement && prevProps.isNestedDropTarget === nextProps.isNestedDropTarget && prevProps.isDirectChildDropTarget === nextProps.isDirectChildDropTarget && prevCollapsed === nextCollapsed && prevProps.canDemoteTask === nextProps.canDemoteTask && prevProps.isLastChild === nextProps.isLastChild && prevProps.nestingDepth === nextProps.nestingDepth && prevProps.hasVisibleChildren === nextProps.hasVisibleChildren && prevProps.ancestorLineModes === nextProps.ancestorLineModes && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend && prevProps.fillParentRow === nextProps.fillParentRow && prevProps.businessDays === nextProps.businessDays && prevProps.defaultTaskDurationDays === nextProps.defaultTaskDurationDays && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.isFilterHideMode === nextProps.isFilterHideMode && prevProps.resolvedColumns === nextProps.resolvedColumns && prevProps.isTaskSelected === nextProps.isTaskSelected && resolveActiveCustomCellForRow(prevProps) === resolveActiveCustomCellForRow(nextProps) && prevProps.taskListMenuCommands === nextProps.taskListMenuCommands && prevProps.onInsertAfter === nextProps.onInsertAfter && prevProps.onPromoteTask === nextProps.onPromoteTask && prevProps.onDemoteTask === nextProps.onDemoteTask && prevProps.onDuplicateTask === nextProps.onDuplicateTask && prevProps.onDelete === nextProps.onDelete && prevProps.onUngroupTask === nextProps.onUngroupTask && prevProps.renderTaskListActions === nextProps.renderTaskListActions && prevProps.renderTaskListMenu === nextProps.renderTaskListMenu && prevProps.hideTaskListRowActions === nextProps.hideTaskListRowActions && prevProps.rowClassName === nextProps.rowClassName && prevProps.getTaskListNamePrefixIcon === nextProps.getTaskListNamePrefixIcon && prevProps.taskDateChangeMode === nextProps.taskDateChangeMode && prevProps.printDependencyLabels === nextProps.printDependencyLabels;
8032
7862
  };
8033
7863
  var TaskListRow = React11.memo(
8034
7864
  ({
@@ -8092,6 +7922,8 @@ var TaskListRow = React11.memo(
8092
7922
  activeCustomCell,
8093
7923
  onActiveCustomCellChange,
8094
7924
  taskListMenuCommands = [],
7925
+ renderTaskListActions,
7926
+ renderTaskListMenu,
8095
7927
  hideTaskListRowActions = false,
8096
7928
  rowClassName,
8097
7929
  compositeParentColor,
@@ -8144,7 +7976,6 @@ var TaskListRow = React11.memo(
8144
7976
  const progressInputRef = useRef6(null);
8145
7977
  const [overflowOpen, setOverflowOpen] = useState6(false);
8146
7978
  const [contextMenuOpen, setContextMenuOpen] = useState6(false);
8147
- const [colorMenuOpen, setColorMenuOpen] = useState6(false);
8148
7979
  const nameConfirmedRef = useRef6(false);
8149
7980
  const durationConfirmedRef = useRef6(false);
8150
7981
  const progressConfirmedRef = useRef6(false);
@@ -8661,47 +8492,6 @@ var TaskListRow = React11.memo(
8661
8492
  },
8662
8493
  [task.id, onToggleCollapse]
8663
8494
  );
8664
- const handlePromote = useCallback6(
8665
- (e) => {
8666
- e.stopPropagation();
8667
- onPromoteTask?.(task.id);
8668
- },
8669
- [task.id, onPromoteTask]
8670
- );
8671
- const handleDemote = useCallback6(
8672
- (e) => {
8673
- e.stopPropagation();
8674
- onDemoteTask?.(task.id, "");
8675
- },
8676
- [task.id, onDemoteTask]
8677
- );
8678
- const closeColorMenu = useCallback6(() => {
8679
- setColorMenuOpen(false);
8680
- }, []);
8681
- const handleApplyColor = useCallback6(
8682
- (color) => {
8683
- if (!onTasksChange) return;
8684
- const descendantIds = new Set(
8685
- isParent ? getAllDescendants(task.id, allTasks).map((descendant) => descendant.id) : []
8686
- );
8687
- const updatedTasks = [
8688
- { ...task, color },
8689
- ...allTasks.filter((candidate) => descendantIds.has(candidate.id)).map((candidate) => ({ ...candidate, color }))
8690
- ];
8691
- onTasksChange(updatedTasks);
8692
- closeColorMenu();
8693
- setContextMenuOpen(false);
8694
- },
8695
- [allTasks, closeColorMenu, isParent, onTasksChange, task]
8696
- );
8697
- const handleUngroup = useCallback6(
8698
- (e) => {
8699
- e.stopPropagation();
8700
- setContextMenuOpen(false);
8701
- onUngroupTask?.(task.id);
8702
- },
8703
- [onUngroupTask, task.id]
8704
- );
8705
8495
  const visibleCustomMenuCommands = useMemo9(
8706
8496
  () => taskListMenuCommands.filter(
8707
8497
  (command) => {
@@ -8714,18 +8504,50 @@ var TaskListRow = React11.memo(
8714
8504
  ),
8715
8505
  [taskListMenuCommands, task, isParent, isMilestoneRow]
8716
8506
  );
8717
- const hasContextMenu = !hideTaskListRowActions && (visibleCustomMenuCommands.length > 0 || !!onDuplicateTask || !!onDelete || !!onTasksChange || isParent && !!onUngroupTask);
8718
- const handleCustomMenuCommandClick = useCallback6(
8719
- (command) => (e) => {
8720
- e.stopPropagation();
8721
- if (command.closeOnSelect !== false) {
8722
- setContextMenuOpen(false);
8723
- closeColorMenu();
8507
+ const actionContext = {
8508
+ task,
8509
+ isParent,
8510
+ canPromote: isChild && !!onPromoteTask,
8511
+ canDemote: canDemoteTask && !!onDemoteTask,
8512
+ insertAfter: onInsertAfter ? () => {
8513
+ const range = buildDefaultTaskDateRange(getTodayISODate(), {
8514
+ businessDays,
8515
+ defaultTaskDurationDays,
8516
+ weekendPredicate
8517
+ });
8518
+ onInsertAfter(task.id, { id: crypto.randomUUID(), name: "\u041D\u043E\u0432\u0430\u044F \u0440\u0430\u0431\u043E\u0442\u0430", ...range, parentId: task.parentId });
8519
+ } : void 0,
8520
+ promote: isChild && onPromoteTask ? () => onPromoteTask(task.id) : void 0,
8521
+ demote: canDemoteTask && onDemoteTask ? () => onDemoteTask(task.id, "") : void 0,
8522
+ duplicate: onDuplicateTask ? () => onDuplicateTask(task.id) : void 0,
8523
+ delete: onDelete ? () => onDelete(task.id) : void 0,
8524
+ ungroup: isParent && onUngroupTask ? () => onUngroupTask(task.id) : void 0,
8525
+ closeMenu: () => setContextMenuOpen(false)
8526
+ };
8527
+ const commandContent = visibleCustomMenuCommands.length ? visibleCustomMenuCommands.map((command) => /* @__PURE__ */ jsxs10(React11.Fragment, { children: [
8528
+ command.divider === "top" && /* @__PURE__ */ jsx15("hr", { className: "gantt-tl-context-menu-divider" }),
8529
+ /* @__PURE__ */ jsxs10(
8530
+ "button",
8531
+ {
8532
+ type: "button",
8533
+ className: `gantt-tl-context-menu-item${command.danger ? " gantt-tl-context-menu-item-danger" : ""}`,
8534
+ disabled: command.isDisabled?.(task) ?? false,
8535
+ onClick: (event) => {
8536
+ event.stopPropagation();
8537
+ if (command.closeOnSelect !== false) actionContext.closeMenu();
8538
+ command.onSelect(task);
8539
+ },
8540
+ children: [
8541
+ command.icon,
8542
+ command.label
8543
+ ]
8724
8544
  }
8725
- command.onSelect(task);
8726
- },
8727
- [closeColorMenu, task]
8728
- );
8545
+ ),
8546
+ command.divider === "bottom" && /* @__PURE__ */ jsx15("hr", { className: "gantt-tl-context-menu-divider" })
8547
+ ] }, command.id)) : null;
8548
+ const menuContent = hideTaskListRowActions ? null : renderTaskListMenu ? renderTaskListMenu(actionContext, commandContent) : commandContent;
8549
+ const actionContent = hideTaskListRowActions ? null : renderTaskListActions?.(actionContext);
8550
+ const hasContextMenu = menuContent !== null && menuContent !== void 0 && menuContent !== false;
8729
8551
  const handleAddClick = useCallback6(
8730
8552
  (e) => {
8731
8553
  e.stopPropagation();
@@ -9200,197 +9022,25 @@ var TaskListRow = React11.memo(
9200
9022
  "aria-hidden": "true"
9201
9023
  }
9202
9024
  ),
9203
- !editingName && !hideTaskListRowActions && (onInsertAfter || onDelete || onPromoteTask || onDemoteTask || onUngroupTask || onDuplicateTask || onTasksChange || hasContextMenu) && /* @__PURE__ */ jsxs10("div", { className: `gantt-tl-name-actions${contextMenuOpen ? " gantt-tl-name-actions-open" : ""}`, children: [
9204
- onInsertAfter && /* @__PURE__ */ jsx15(
9205
- "button",
9206
- {
9207
- type: "button",
9208
- className: "gantt-tl-name-action-btn gantt-tl-action-insert",
9209
- onClick: (e) => {
9210
- e.stopPropagation();
9211
- const range = buildDefaultTaskDateRange(getTodayISODate(), {
9212
- businessDays,
9213
- defaultTaskDurationDays,
9214
- weekendPredicate
9215
- });
9216
- const newTask = {
9217
- id: crypto.randomUUID(),
9218
- name: "\u041D\u043E\u0432\u0430\u044F \u0440\u0430\u0431\u043E\u0442\u0430",
9219
- startDate: range.startDate,
9220
- endDate: range.endDate,
9221
- parentId: task.parentId
9222
- };
9223
- onInsertAfter(task.id, newTask);
9224
- },
9225
- "aria-label": "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0443 \u043F\u043E\u0441\u043B\u0435 \u044D\u0442\u043E\u0439",
9226
- children: /* @__PURE__ */ jsx15(PlusIcon, {})
9227
- }
9228
- ),
9229
- /* @__PURE__ */ jsx15(
9230
- HierarchyButton,
9231
- {
9232
- isChild,
9233
- rowIndex,
9234
- canDemote: canDemoteTask,
9235
- onPromote: onPromoteTask ? handlePromote : void 0,
9236
- onDemote: onDemoteTask ? handleDemote : void 0
9237
- }
9238
- ),
9239
- hasContextMenu && /* @__PURE__ */ jsxs10(Popover, { open: contextMenuOpen, onOpenChange: (open) => {
9240
- setContextMenuOpen(open);
9241
- if (!open) closeColorMenu();
9242
- }, children: [
9025
+ !editingName && !hideTaskListRowActions && (actionContent || hasContextMenu) ? /* @__PURE__ */ jsxs10("div", { className: `gantt-tl-name-actions${contextMenuOpen ? " gantt-tl-name-actions-open" : ""}`, onClick: (event) => event.stopPropagation(), children: [
9026
+ actionContent,
9027
+ hasContextMenu ? /* @__PURE__ */ jsxs10(Popover, { open: contextMenuOpen, onOpenChange: setContextMenuOpen, children: [
9243
9028
  /* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
9244
9029
  "button",
9245
9030
  {
9246
9031
  type: "button",
9247
9032
  className: "gantt-tl-name-action-btn gantt-tl-action-context",
9248
- onClick: (e) => {
9249
- e.stopPropagation();
9250
- setContextMenuOpen((v) => !v);
9033
+ onClick: (event) => {
9034
+ event.stopPropagation();
9035
+ setContextMenuOpen((value) => !value);
9251
9036
  },
9252
9037
  "aria-label": "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E",
9253
9038
  children: /* @__PURE__ */ jsx15(VerticalDotsIcon, {})
9254
9039
  }
9255
9040
  ) }),
9256
- /* @__PURE__ */ jsxs10(PopoverContent, { className: "gantt-tl-context-menu", portal: true, align: "end", children: [
9257
- onTasksChange && /* @__PURE__ */ jsxs10(
9258
- "div",
9259
- {
9260
- className: "gantt-tl-context-menu-section gantt-tl-context-submenu-wrap",
9261
- onMouseLeave: (e) => {
9262
- if (!e.currentTarget.contains(e.relatedTarget)) {
9263
- closeColorMenu();
9264
- }
9265
- },
9266
- onBlur: (e) => {
9267
- if (!e.currentTarget.contains(e.relatedTarget)) {
9268
- closeColorMenu();
9269
- }
9270
- },
9271
- children: [
9272
- /* @__PURE__ */ jsxs10(
9273
- "button",
9274
- {
9275
- type: "button",
9276
- className: "gantt-tl-context-menu-item gantt-tl-context-menu-item-toggle",
9277
- onMouseEnter: () => setColorMenuOpen(true),
9278
- "aria-expanded": colorMenuOpen,
9279
- "aria-haspopup": "menu",
9280
- children: [
9281
- /* @__PURE__ */ jsxs10("span", { className: "gantt-tl-context-menu-item-main", children: [
9282
- task.color && /* @__PURE__ */ jsx15(
9283
- "span",
9284
- {
9285
- className: "gantt-tl-color-swatch gantt-tl-color-swatch-inline",
9286
- style: { backgroundColor: task.color },
9287
- "aria-hidden": "true"
9288
- }
9289
- ),
9290
- "\u0426\u0432\u0435\u0442"
9291
- ] }),
9292
- /* @__PURE__ */ jsx15(ChevronRightIcon, {})
9293
- ]
9294
- }
9295
- ),
9296
- colorMenuOpen && /* @__PURE__ */ jsx15("div", { className: "gantt-tl-context-submenu", role: "menu", "aria-label": "\u0412\u044B\u0431\u043E\u0440 \u0446\u0432\u0435\u0442\u0430", children: /* @__PURE__ */ jsxs10("div", { className: "gantt-tl-color-grid", children: [
9297
- /* @__PURE__ */ jsx15(
9298
- "button",
9299
- {
9300
- type: "button",
9301
- className: `gantt-tl-color-swatch gantt-tl-color-swatch-clear${!task.color ? " is-selected" : ""}`,
9302
- onClick: (e) => {
9303
- e.stopPropagation();
9304
- handleApplyColor(void 0);
9305
- },
9306
- "aria-label": "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0446\u0432\u0435\u0442",
9307
- title: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0446\u0432\u0435\u0442",
9308
- children: /* @__PURE__ */ jsx15("span", { className: "gantt-tl-color-swatch-clear-line" })
9309
- }
9310
- ),
9311
- TASK_COLOR_PALETTE.map((paletteColor) => /* @__PURE__ */ jsx15(
9312
- "button",
9313
- {
9314
- type: "button",
9315
- className: `gantt-tl-color-swatch${task.color === paletteColor.value ? " is-selected" : ""}`,
9316
- style: { backgroundColor: paletteColor.value },
9317
- onClick: (e) => {
9318
- e.stopPropagation();
9319
- handleApplyColor(paletteColor.value);
9320
- },
9321
- "aria-label": `\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0446\u0432\u0435\u0442 ${paletteColor.label}`,
9322
- title: paletteColor.label
9323
- },
9324
- paletteColor.value
9325
- ))
9326
- ] }) })
9327
- ]
9328
- }
9329
- ),
9330
- onDuplicateTask && /* @__PURE__ */ jsxs10(
9331
- "button",
9332
- {
9333
- type: "button",
9334
- className: "gantt-tl-context-menu-item",
9335
- onClick: (e) => {
9336
- e.stopPropagation();
9337
- setContextMenuOpen(false);
9338
- onDuplicateTask(task.id);
9339
- },
9340
- children: [
9341
- /* @__PURE__ */ jsx15(CopyIcon, {}),
9342
- "\u0414\u0443\u0431\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C"
9343
- ]
9344
- }
9345
- ),
9346
- visibleCustomMenuCommands.map((command) => /* @__PURE__ */ jsxs10(React11.Fragment, { children: [
9347
- command.divider === "top" && /* @__PURE__ */ jsx15("hr", { className: "gantt-tl-context-menu-divider" }),
9348
- /* @__PURE__ */ jsxs10(
9349
- "button",
9350
- {
9351
- type: "button",
9352
- className: `gantt-tl-context-menu-item${command.danger ? " gantt-tl-context-menu-item-danger" : ""}`,
9353
- onClick: handleCustomMenuCommandClick(command),
9354
- disabled: command.isDisabled?.(task) ?? false,
9355
- children: [
9356
- command.icon,
9357
- command.label
9358
- ]
9359
- }
9360
- ),
9361
- command.divider === "bottom" && /* @__PURE__ */ jsx15("hr", { className: "gantt-tl-context-menu-divider" })
9362
- ] }, command.id)),
9363
- isParent && onUngroupTask && /* @__PURE__ */ jsxs10(
9364
- "button",
9365
- {
9366
- type: "button",
9367
- className: "gantt-tl-context-menu-item",
9368
- onClick: handleUngroup,
9369
- children: [
9370
- /* @__PURE__ */ jsx15(UngroupIcon, {}),
9371
- "\u0420\u0430\u0437\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C"
9372
- ]
9373
- }
9374
- ),
9375
- onDelete && /* @__PURE__ */ jsxs10(
9376
- "button",
9377
- {
9378
- type: "button",
9379
- className: "gantt-tl-context-menu-item gantt-tl-context-menu-item-danger",
9380
- onClick: (e) => {
9381
- e.stopPropagation();
9382
- setContextMenuOpen(false);
9383
- onDelete(task.id);
9384
- },
9385
- children: [
9386
- /* @__PURE__ */ jsx15(TrashIcon, {}),
9387
- "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0443"
9388
- ]
9389
- }
9390
- )
9391
- ] })
9392
- ] })
9393
- ] })
9041
+ /* @__PURE__ */ jsx15(PopoverContent, { className: "gantt-tl-context-menu", portal: true, align: "end", children: menuContent })
9042
+ ] }) : null
9043
+ ] }) : null
9394
9044
  ] });
9395
9045
  const startDateCell = /* @__PURE__ */ jsx15(
9396
9046
  "div",
@@ -10240,7 +9890,7 @@ var BUILT_IN_CSS_CLASSES = {
10240
9890
  duration: "gantt-tl-cell-duration",
10241
9891
  progress: "gantt-tl-cell-progress"
10242
9892
  };
10243
- function getAllDescendants2(parentId, tasks) {
9893
+ function getAllDescendants3(parentId, tasks) {
10244
9894
  const descendants = [];
10245
9895
  const visited = /* @__PURE__ */ new Set();
10246
9896
  function collectChildren(taskId) {
@@ -10258,7 +9908,7 @@ function getAllDescendants2(parentId, tasks) {
10258
9908
  function duplicateTaskSubtree(anchorTaskId, orderedTasks) {
10259
9909
  const anchorTask = orderedTasks.find((task) => task.id === anchorTaskId);
10260
9910
  if (!anchorTask) return orderedTasks;
10261
- const descendants = getAllDescendants2(anchorTaskId, orderedTasks);
9911
+ const descendants = getAllDescendants3(anchorTaskId, orderedTasks);
10262
9912
  const sourceIds = /* @__PURE__ */ new Set([anchorTaskId, ...descendants.map((task) => task.id)]);
10263
9913
  const sourceSubtree = orderedTasks.filter((task) => sourceIds.has(task.id));
10264
9914
  const cloneIdMap = new Map(sourceSubtree.map((task) => [task.id, crypto.randomUUID()]));
@@ -10367,7 +10017,7 @@ var TaskList = ({
10367
10017
  disableTaskDrag = false,
10368
10018
  disableTaskListReorder = false,
10369
10019
  editingTaskId: propEditingTaskId,
10370
- enableAddTask = true,
10020
+ enableAddTask = false,
10371
10021
  addTaskLabel = "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0443",
10372
10022
  defaultTaskDurationDays = DEFAULT_TASK_DURATION_DAYS,
10373
10023
  collapsedParentIds: externalCollapsedParentIds,
@@ -10393,6 +10043,8 @@ var TaskList = ({
10393
10043
  taskListColumnWidths,
10394
10044
  onTaskListColumnWidthsChange,
10395
10045
  taskListMenuCommands,
10046
+ renderTaskListActions,
10047
+ renderTaskListMenu,
10396
10048
  hideTaskListRowActions = false,
10397
10049
  getTaskListRowClassName,
10398
10050
  getTaskListNamePrefixIcon,
@@ -10823,7 +10475,7 @@ var TaskList = ({
10823
10475
  }
10824
10476
  const draggedTask = orderedTasks.find((t) => t.id === draggedTaskId);
10825
10477
  if (!draggedTask) return true;
10826
- const descendants = getAllDescendants2(draggedTaskId, orderedTasks);
10478
+ const descendants = getAllDescendants3(draggedTaskId, orderedTasks);
10827
10479
  const descendantIds = new Set(descendants.map((d) => d.id));
10828
10480
  if (descendantIds.has(dropTarget.id)) {
10829
10481
  return false;
@@ -10840,7 +10492,7 @@ var TaskList = ({
10840
10492
  if (target.placement !== "before" || target.index <= 0 || target.index >= visibleTasks.length) {
10841
10493
  return target;
10842
10494
  }
10843
- const descendantIds = new Set(getAllDescendants2(movedTaskId, orderedTasks).map((task) => task.id));
10495
+ const descendantIds = new Set(getAllDescendants3(movedTaskId, orderedTasks).map((task) => task.id));
10844
10496
  const movedIds = /* @__PURE__ */ new Set([movedTaskId, ...descendantIds]);
10845
10497
  const targetTask = visibleTasks[target.index];
10846
10498
  if (targetTask?.id === movedTaskId) {
@@ -10963,7 +10615,7 @@ var TaskList = ({
10963
10615
  let subtree;
10964
10616
  let subtreeCount;
10965
10617
  if (hasChildren) {
10966
- const descendants = getAllDescendants2(moved.id, orderedTasks);
10618
+ const descendants = getAllDescendants3(moved.id, orderedTasks);
10967
10619
  subtree = [moved, ...descendants];
10968
10620
  subtreeCount = subtree.length;
10969
10621
  } else {
@@ -10981,7 +10633,7 @@ var TaskList = ({
10981
10633
  const handleBeforeFirstDragOver = useCallback7((e) => {
10982
10634
  const draggedTaskId = dragTaskIdRef.current;
10983
10635
  const firstTask = visibleTasks[0];
10984
- const descendantIds = draggedTaskId ? new Set(getAllDescendants2(draggedTaskId, orderedTasks).map((task) => task.id)) : /* @__PURE__ */ new Set();
10636
+ const descendantIds = draggedTaskId ? new Set(getAllDescendants3(draggedTaskId, orderedTasks).map((task) => task.id)) : /* @__PURE__ */ new Set();
10985
10637
  const isValidBeforeFirstDrop = !!draggedTaskId && !!firstTask && firstTask.id !== draggedTaskId && !descendantIds.has(firstTask.id) && isValidParentDrop(draggedTaskId, 0);
10986
10638
  setIsBeforeFirstDropZoneActive(isValidBeforeFirstDrop);
10987
10639
  handleDragOver(0, e, "before");
@@ -11519,7 +11171,7 @@ var TaskList = ({
11519
11171
  onScrollToTask,
11520
11172
  onDelete,
11521
11173
  onAdd,
11522
- onInsertAfter: handleStartInsertAfter,
11174
+ onInsertAfter: onInsertAfter ? handleStartInsertAfter : void 0,
11523
11175
  editingTaskId: propEditingTaskId,
11524
11176
  isDragging: !reorderDisabled && draggingIndex === index,
11525
11177
  isDragOver: !reorderDisabled && dragOverTarget?.index === index,
@@ -11554,6 +11206,8 @@ var TaskList = ({
11554
11206
  activeCustomCell,
11555
11207
  onActiveCustomCellChange: setActiveCustomCell,
11556
11208
  taskListMenuCommands,
11209
+ renderTaskListActions,
11210
+ renderTaskListMenu,
11557
11211
  hideTaskListRowActions,
11558
11212
  rowClassName: [
11559
11213
  task.parentId && compositeParentIds.has(task.parentId) ? "gantt-tl-row-composite-detail" : "",
@@ -15483,7 +15137,7 @@ function TaskGanttChartInner(props, ref) {
15483
15137
  onPromoteTask,
15484
15138
  onDemoteTask,
15485
15139
  onUngroupTask,
15486
- enableAddTask = true,
15140
+ enableAddTask = false,
15487
15141
  addTaskLabel = "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0443",
15488
15142
  defaultTaskDurationDays,
15489
15143
  taskFilter,
@@ -15516,6 +15170,8 @@ function TaskGanttChartInner(props, ref) {
15516
15170
  taskListColumnWidths,
15517
15171
  onTaskListColumnWidthsChange,
15518
15172
  taskListMenuCommands,
15173
+ renderTaskListActions,
15174
+ renderTaskListMenu,
15519
15175
  hideTaskListRowActions = false,
15520
15176
  getTaskListRowClassName,
15521
15177
  getTaskListNamePrefixIcon,
@@ -16842,9 +16498,9 @@ function TaskGanttChartInner(props, ref) {
16842
16498
  ),
16843
16499
  selectedChip,
16844
16500
  onAdd,
16845
- onDelete: handleDelete,
16846
- onInsertAfter: handleInsertAfter,
16847
- onReorder: handleReorder,
16501
+ onDelete: onDelete ? handleDelete : void 0,
16502
+ onInsertAfter: onInsertAfter ? handleInsertAfter : void 0,
16503
+ onReorder: onReorder || onTasksChange ? handleReorder : void 0,
16848
16504
  disableTaskDrag: disableTaskDrag || disableTaskListReorder,
16849
16505
  editingTaskId,
16850
16506
  enableAddTask,
@@ -16852,9 +16508,9 @@ function TaskGanttChartInner(props, ref) {
16852
16508
  defaultTaskDurationDays,
16853
16509
  collapsedParentIds,
16854
16510
  onToggleCollapse: handleToggleCollapse,
16855
- onPromoteTask: onPromoteTask ?? handlePromoteTask,
16856
- onDemoteTask: onDemoteTask ?? handleDemoteTask,
16857
- onUngroupTask: onUngroupTask ?? handleUngroupTask,
16511
+ onPromoteTask: onPromoteTask ?? (onTasksChange ? handlePromoteTask : void 0),
16512
+ onDemoteTask: onDemoteTask ?? (onTasksChange ? handleDemoteTask : void 0),
16513
+ onUngroupTask: onUngroupTask ?? (onTasksChange ? handleUngroupTask : void 0),
16858
16514
  highlightedTaskIds: taskListHighlightedTaskIds,
16859
16515
  fillParentRows: shouldFillParentRowsInTaskList,
16860
16516
  enableTaskMultiSelect,
@@ -16873,6 +16529,8 @@ function TaskGanttChartInner(props, ref) {
16873
16529
  taskListColumnWidths,
16874
16530
  onTaskListColumnWidthsChange,
16875
16531
  taskListMenuCommands,
16532
+ renderTaskListActions,
16533
+ renderTaskListMenu,
16876
16534
  hideTaskListRowActions,
16877
16535
  getTaskListRowClassName,
16878
16536
  getTaskListNamePrefixIcon,