gantt-lib 0.86.0 → 0.87.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.css.map +1 -1
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +317 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +317 -150
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +26 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -303,7 +303,7 @@ declare const progressInRange: (min: number, max: number) => TaskPredicate;
|
|
|
303
303
|
*/
|
|
304
304
|
declare const nameContains: (substring: string, caseSensitive?: boolean) => TaskPredicate;
|
|
305
305
|
|
|
306
|
-
type BuiltInTaskListColumnId = 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
|
|
306
|
+
type BuiltInTaskListColumnId = 'selection' | 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
|
|
307
307
|
type TaskListColumnId = BuiltInTaskListColumnId | (string & {});
|
|
308
308
|
type TaskListColumnAnchor = {
|
|
309
309
|
after: BuiltInTaskListColumnId | string;
|
|
@@ -495,6 +495,12 @@ interface GanttModeProps<TTask extends Task = Task> {
|
|
|
495
495
|
onToggleCollapse?: (parentId: string) => void;
|
|
496
496
|
/** Task IDs to highlight in the task list (for search results) */
|
|
497
497
|
highlightedTaskIds?: Set<string>;
|
|
498
|
+
/** Enable a leading checkbox column for multi-selecting task rows (default: false) */
|
|
499
|
+
enableTaskMultiSelect?: boolean;
|
|
500
|
+
/** Controlled selected task IDs for multi-select mode */
|
|
501
|
+
selectedTaskIds?: Set<string>;
|
|
502
|
+
/** Callback when multi-selected task IDs change */
|
|
503
|
+
onSelectedTaskIdsChange?: (taskIds: Set<string>) => void;
|
|
498
504
|
/** Disable task drag and resize on the calendar grid (default: false) */
|
|
499
505
|
disableTaskDrag?: boolean;
|
|
500
506
|
/** Show calendar chart area (default: true) */
|
|
@@ -766,6 +772,12 @@ interface TaskListProps {
|
|
|
766
772
|
businessDays?: boolean;
|
|
767
773
|
/** Task IDs highlighted by the active filter */
|
|
768
774
|
highlightedTaskIds?: Set<string>;
|
|
775
|
+
/** Enable a leading checkbox column for multi-selecting task rows (default: false) */
|
|
776
|
+
enableTaskMultiSelect?: boolean;
|
|
777
|
+
/** Controlled selected task IDs for multi-select mode */
|
|
778
|
+
selectedTaskIds?: Set<string>;
|
|
779
|
+
/** Callback when multi-selected task IDs change */
|
|
780
|
+
onSelectedTaskIdsChange?: (taskIds: Set<string>) => void;
|
|
769
781
|
/** Filter mode: 'highlight' shows yellow highlight on matches, 'hide' hides non-matching tasks */
|
|
770
782
|
filterMode?: 'highlight' | 'hide';
|
|
771
783
|
/** Task IDs that match the filter (used for hide mode). When undefined, no filtering is applied */
|
package/dist/index.d.ts
CHANGED
|
@@ -303,7 +303,7 @@ declare const progressInRange: (min: number, max: number) => TaskPredicate;
|
|
|
303
303
|
*/
|
|
304
304
|
declare const nameContains: (substring: string, caseSensitive?: boolean) => TaskPredicate;
|
|
305
305
|
|
|
306
|
-
type BuiltInTaskListColumnId = 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
|
|
306
|
+
type BuiltInTaskListColumnId = 'selection' | 'number' | 'name' | 'startDate' | 'endDate' | 'duration' | 'progress' | 'dependencies' | 'actions';
|
|
307
307
|
type TaskListColumnId = BuiltInTaskListColumnId | (string & {});
|
|
308
308
|
type TaskListColumnAnchor = {
|
|
309
309
|
after: BuiltInTaskListColumnId | string;
|
|
@@ -495,6 +495,12 @@ interface GanttModeProps<TTask extends Task = Task> {
|
|
|
495
495
|
onToggleCollapse?: (parentId: string) => void;
|
|
496
496
|
/** Task IDs to highlight in the task list (for search results) */
|
|
497
497
|
highlightedTaskIds?: Set<string>;
|
|
498
|
+
/** Enable a leading checkbox column for multi-selecting task rows (default: false) */
|
|
499
|
+
enableTaskMultiSelect?: boolean;
|
|
500
|
+
/** Controlled selected task IDs for multi-select mode */
|
|
501
|
+
selectedTaskIds?: Set<string>;
|
|
502
|
+
/** Callback when multi-selected task IDs change */
|
|
503
|
+
onSelectedTaskIdsChange?: (taskIds: Set<string>) => void;
|
|
498
504
|
/** Disable task drag and resize on the calendar grid (default: false) */
|
|
499
505
|
disableTaskDrag?: boolean;
|
|
500
506
|
/** Show calendar chart area (default: true) */
|
|
@@ -766,6 +772,12 @@ interface TaskListProps {
|
|
|
766
772
|
businessDays?: boolean;
|
|
767
773
|
/** Task IDs highlighted by the active filter */
|
|
768
774
|
highlightedTaskIds?: Set<string>;
|
|
775
|
+
/** Enable a leading checkbox column for multi-selecting task rows (default: false) */
|
|
776
|
+
enableTaskMultiSelect?: boolean;
|
|
777
|
+
/** Controlled selected task IDs for multi-select mode */
|
|
778
|
+
selectedTaskIds?: Set<string>;
|
|
779
|
+
/** Callback when multi-selected task IDs change */
|
|
780
|
+
onSelectedTaskIdsChange?: (taskIds: Set<string>) => void;
|
|
769
781
|
/** Filter mode: 'highlight' shows yellow highlight on matches, 'hide' hides non-matching tasks */
|
|
770
782
|
filterMode?: 'highlight' | 'hide';
|
|
771
783
|
/** Task IDs that match the filter (used for hide mode). When undefined, no filtering is applied */
|
package/dist/index.js
CHANGED
|
@@ -2976,6 +2976,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
2976
2976
|
"div",
|
|
2977
2977
|
{
|
|
2978
2978
|
"data-filter-match": isFilterMatch ? "true" : "false",
|
|
2979
|
+
"data-gantt-task-row-id": task.id,
|
|
2979
2980
|
className: `gantt-tr-row ${isFilterMatch ? "gantt-tr-row-filter-match" : ""}`,
|
|
2980
2981
|
style: { height: `${rowHeight}px` },
|
|
2981
2982
|
children: [
|
|
@@ -4756,6 +4757,8 @@ var TaskListRow = import_react10.default.memo(
|
|
|
4756
4757
|
isFilterMatch = false,
|
|
4757
4758
|
isFilterHideMode = false,
|
|
4758
4759
|
resolvedColumns,
|
|
4760
|
+
isTaskSelected = false,
|
|
4761
|
+
onTaskSelectionChange,
|
|
4759
4762
|
taskListMenuCommands = []
|
|
4760
4763
|
}) => {
|
|
4761
4764
|
const [editingColumnId, setEditingColumnId] = (0, import_react10.useState)(null);
|
|
@@ -5549,6 +5552,23 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5549
5552
|
const isSelectedDependencyOwner = selectedChip != null && selectedChip.successorId === task.id;
|
|
5550
5553
|
const startDateISO = toISODate2(normalizedTask.startDate);
|
|
5551
5554
|
const endDateISO = editingDuration ? getEndDate(normalizedTask.startDate, durationValue) : toISODate2(normalizedTask.endDate);
|
|
5555
|
+
const selectionCell = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5556
|
+
"div",
|
|
5557
|
+
{
|
|
5558
|
+
className: "gantt-tl-cell gantt-tl-cell-selection",
|
|
5559
|
+
onClick: (e) => e.stopPropagation(),
|
|
5560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5561
|
+
"input",
|
|
5562
|
+
{
|
|
5563
|
+
type: "checkbox",
|
|
5564
|
+
className: "gantt-tl-selection-checkbox",
|
|
5565
|
+
"aria-label": `\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0437\u0430\u0434\u0430\u0447\u0443 ${taskNumber ? `${taskNumber}. ` : ""}${task.name}`,
|
|
5566
|
+
checked: isTaskSelected,
|
|
5567
|
+
onChange: (event) => onTaskSelectionChange?.(task.id, event.target.checked)
|
|
5568
|
+
}
|
|
5569
|
+
)
|
|
5570
|
+
}
|
|
5571
|
+
);
|
|
5552
5572
|
const numberCell = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5553
5573
|
"div",
|
|
5554
5574
|
{
|
|
@@ -6266,6 +6286,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
6266
6286
|
}
|
|
6267
6287
|
);
|
|
6268
6288
|
const builtInCells = {
|
|
6289
|
+
selection: selectionCell,
|
|
6269
6290
|
number: numberCell,
|
|
6270
6291
|
name: nameCell,
|
|
6271
6292
|
startDate: startDateCell,
|
|
@@ -6292,6 +6313,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
6292
6313
|
isParent ? "gantt-tl-row-parent" : ""
|
|
6293
6314
|
].filter(Boolean).join(" "),
|
|
6294
6315
|
style: { minHeight: `${rowHeight}px`, position: "relative" },
|
|
6316
|
+
"data-gantt-task-row-id": task.id,
|
|
6295
6317
|
onClick: handleRowClickInternal,
|
|
6296
6318
|
onKeyDown: handleRowKeyDown,
|
|
6297
6319
|
onDragOver: (e) => onDragOver?.(rowIndex, e),
|
|
@@ -6417,6 +6439,7 @@ var NewTaskRow = ({
|
|
|
6417
6439
|
|
|
6418
6440
|
// src/components/TaskList/columns/createBuiltInColumns.tsx
|
|
6419
6441
|
var BUILT_IN_COLUMN_WIDTHS = {
|
|
6442
|
+
selection: 36,
|
|
6420
6443
|
number: 40,
|
|
6421
6444
|
name: 200,
|
|
6422
6445
|
startDate: 90,
|
|
@@ -6427,7 +6450,7 @@ var BUILT_IN_COLUMN_WIDTHS = {
|
|
|
6427
6450
|
actions: 80
|
|
6428
6451
|
};
|
|
6429
6452
|
function createBuiltInColumns(opts) {
|
|
6430
|
-
|
|
6453
|
+
const columns = [
|
|
6431
6454
|
{ id: "number", header: "\u2116", width: BUILT_IN_COLUMN_WIDTHS.number, renderCell: () => null },
|
|
6432
6455
|
{ id: "name", header: "\u0418\u043C\u044F", width: BUILT_IN_COLUMN_WIDTHS.name, renderCell: () => null },
|
|
6433
6456
|
{ id: "startDate", header: "\u041D\u0430\u0447\u0430\u043B\u043E", width: BUILT_IN_COLUMN_WIDTHS.startDate, renderCell: () => null },
|
|
@@ -6436,6 +6459,15 @@ function createBuiltInColumns(opts) {
|
|
|
6436
6459
|
{ id: "progress", header: "%", width: BUILT_IN_COLUMN_WIDTHS.progress, renderCell: () => null },
|
|
6437
6460
|
{ id: "dependencies", header: null, width: BUILT_IN_COLUMN_WIDTHS.dependencies, renderCell: () => null }
|
|
6438
6461
|
];
|
|
6462
|
+
if (opts?.enableTaskMultiSelect) {
|
|
6463
|
+
columns.unshift({
|
|
6464
|
+
id: "selection",
|
|
6465
|
+
header: null,
|
|
6466
|
+
width: BUILT_IN_COLUMN_WIDTHS.selection,
|
|
6467
|
+
renderCell: () => null
|
|
6468
|
+
});
|
|
6469
|
+
}
|
|
6470
|
+
return columns;
|
|
6439
6471
|
}
|
|
6440
6472
|
|
|
6441
6473
|
// src/components/TaskList/columns/resolveTaskListColumns.ts
|
|
@@ -6496,6 +6528,7 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
|
6496
6528
|
var LINK_TYPE_ORDER2 = ["FS", "SS", "FF", "SF"];
|
|
6497
6529
|
var MIN_TASK_LIST_WIDTH = 530;
|
|
6498
6530
|
var BUILT_IN_CSS_CLASSES = {
|
|
6531
|
+
selection: "gantt-tl-cell-selection",
|
|
6499
6532
|
number: "gantt-tl-cell-number",
|
|
6500
6533
|
name: "gantt-tl-cell-name",
|
|
6501
6534
|
startDate: "gantt-tl-cell-date",
|
|
@@ -6571,6 +6604,30 @@ function getTaskNumber(tasks, taskIndex) {
|
|
|
6571
6604
|
}
|
|
6572
6605
|
return `${parentNumber}.${siblingIndex + 1}`;
|
|
6573
6606
|
}
|
|
6607
|
+
var SelectAllCheckbox = ({
|
|
6608
|
+
checked,
|
|
6609
|
+
indeterminate,
|
|
6610
|
+
onChange
|
|
6611
|
+
}) => {
|
|
6612
|
+
const ref = (0, import_react12.useRef)(null);
|
|
6613
|
+
(0, import_react12.useEffect)(() => {
|
|
6614
|
+
if (ref.current) {
|
|
6615
|
+
ref.current.indeterminate = indeterminate;
|
|
6616
|
+
}
|
|
6617
|
+
}, [indeterminate]);
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6619
|
+
"input",
|
|
6620
|
+
{
|
|
6621
|
+
ref,
|
|
6622
|
+
type: "checkbox",
|
|
6623
|
+
className: "gantt-tl-selection-checkbox",
|
|
6624
|
+
"aria-label": "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435 \u0432\u0438\u0434\u0438\u043C\u044B\u0435 \u0437\u0430\u0434\u0430\u0447\u0438",
|
|
6625
|
+
checked,
|
|
6626
|
+
onChange: (event) => onChange(event.target.checked),
|
|
6627
|
+
onClick: (event) => event.stopPropagation()
|
|
6628
|
+
}
|
|
6629
|
+
);
|
|
6630
|
+
};
|
|
6574
6631
|
var TaskList = ({
|
|
6575
6632
|
tasks,
|
|
6576
6633
|
rowHeight,
|
|
@@ -6601,6 +6658,9 @@ var TaskList = ({
|
|
|
6601
6658
|
isWeekend: isWeekend3,
|
|
6602
6659
|
businessDays,
|
|
6603
6660
|
highlightedTaskIds = /* @__PURE__ */ new Set(),
|
|
6661
|
+
enableTaskMultiSelect = false,
|
|
6662
|
+
selectedTaskIds,
|
|
6663
|
+
onSelectedTaskIdsChange,
|
|
6604
6664
|
filterMode = "highlight",
|
|
6605
6665
|
filteredTaskIds = /* @__PURE__ */ new Set(),
|
|
6606
6666
|
isFilterActive = false,
|
|
@@ -6608,6 +6668,14 @@ var TaskList = ({
|
|
|
6608
6668
|
hiddenTaskListColumns,
|
|
6609
6669
|
taskListMenuCommands
|
|
6610
6670
|
}) => {
|
|
6671
|
+
const [internalSelectedTaskIds, setInternalSelectedTaskIds] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
|
|
6672
|
+
const effectiveSelectedTaskIds = selectedTaskIds ?? internalSelectedTaskIds;
|
|
6673
|
+
const emitSelectedTaskIdsChange = (0, import_react12.useCallback)((nextSelectedTaskIds) => {
|
|
6674
|
+
if (!selectedTaskIds) {
|
|
6675
|
+
setInternalSelectedTaskIds(nextSelectedTaskIds);
|
|
6676
|
+
}
|
|
6677
|
+
onSelectedTaskIdsChange?.(nextSelectedTaskIds);
|
|
6678
|
+
}, [onSelectedTaskIdsChange, selectedTaskIds]);
|
|
6611
6679
|
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
|
|
6612
6680
|
const collapsedParentIds = externalCollapsedParentIds ?? internalCollapsedParentIds;
|
|
6613
6681
|
const handleToggleCollapse = externalOnToggleCollapse ?? (0, import_react12.useCallback)((parentId) => {
|
|
@@ -6654,6 +6722,33 @@ var TaskList = ({
|
|
|
6654
6722
|
),
|
|
6655
6723
|
[visibleTasks]
|
|
6656
6724
|
);
|
|
6725
|
+
const visibleTaskIds = (0, import_react12.useMemo)(() => visibleTasks.map((task) => task.id), [visibleTasks]);
|
|
6726
|
+
const selectedVisibleTaskCount = (0, import_react12.useMemo)(
|
|
6727
|
+
() => visibleTaskIds.filter((taskId) => effectiveSelectedTaskIds.has(taskId)).length,
|
|
6728
|
+
[effectiveSelectedTaskIds, visibleTaskIds]
|
|
6729
|
+
);
|
|
6730
|
+
const areAllVisibleTasksSelected = visibleTaskIds.length > 0 && selectedVisibleTaskCount === visibleTaskIds.length;
|
|
6731
|
+
const areSomeVisibleTasksSelected = selectedVisibleTaskCount > 0 && !areAllVisibleTasksSelected;
|
|
6732
|
+
const handleToggleTaskSelection = (0, import_react12.useCallback)((taskId, checked) => {
|
|
6733
|
+
const nextSelectedTaskIds = new Set(effectiveSelectedTaskIds);
|
|
6734
|
+
if (checked) {
|
|
6735
|
+
nextSelectedTaskIds.add(taskId);
|
|
6736
|
+
} else {
|
|
6737
|
+
nextSelectedTaskIds.delete(taskId);
|
|
6738
|
+
}
|
|
6739
|
+
emitSelectedTaskIdsChange(nextSelectedTaskIds);
|
|
6740
|
+
}, [effectiveSelectedTaskIds, emitSelectedTaskIdsChange]);
|
|
6741
|
+
const handleToggleAllVisibleTaskSelection = (0, import_react12.useCallback)((checked) => {
|
|
6742
|
+
const nextSelectedTaskIds = new Set(effectiveSelectedTaskIds);
|
|
6743
|
+
for (const taskId of visibleTaskIds) {
|
|
6744
|
+
if (checked) {
|
|
6745
|
+
nextSelectedTaskIds.add(taskId);
|
|
6746
|
+
} else {
|
|
6747
|
+
nextSelectedTaskIds.delete(taskId);
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
emitSelectedTaskIdsChange(nextSelectedTaskIds);
|
|
6751
|
+
}, [effectiveSelectedTaskIds, emitSelectedTaskIdsChange, visibleTaskIds]);
|
|
6657
6752
|
const originalTaskNumberMap = (0, import_react12.useMemo)(
|
|
6658
6753
|
() => {
|
|
6659
6754
|
const numberMap = /* @__PURE__ */ new Map();
|
|
@@ -7135,7 +7230,10 @@ var TaskList = ({
|
|
|
7135
7230
|
const duplicatedTasks = duplicateTaskSubtree(taskId, orderedTasks);
|
|
7136
7231
|
onReorder?.(duplicatedTasks);
|
|
7137
7232
|
}, [orderedTasks, onReorder]);
|
|
7138
|
-
const builtInColumns = (0, import_react12.useMemo)(
|
|
7233
|
+
const builtInColumns = (0, import_react12.useMemo)(
|
|
7234
|
+
() => createBuiltInColumns({ businessDays, enableTaskMultiSelect }),
|
|
7235
|
+
[businessDays, enableTaskMultiSelect]
|
|
7236
|
+
);
|
|
7139
7237
|
const resolvedColumns = (0, import_react12.useMemo)(
|
|
7140
7238
|
() => resolveTaskListColumns(
|
|
7141
7239
|
builtInColumns,
|
|
@@ -7159,6 +7257,24 @@ var TaskList = ({
|
|
|
7159
7257
|
style: { "--tasklist-width": `${effectiveTaskListWidth}px` },
|
|
7160
7258
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "gantt-tl-table", children: [
|
|
7161
7259
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "gantt-tl-header", style: { height: `${tableHeaderHeight}px` }, children: resolvedColumns.map((col) => {
|
|
7260
|
+
if (col.id === "selection") {
|
|
7261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7262
|
+
"div",
|
|
7263
|
+
{
|
|
7264
|
+
className: "gantt-tl-headerCell gantt-tl-cell-selection",
|
|
7265
|
+
"data-column-id": "selection",
|
|
7266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7267
|
+
SelectAllCheckbox,
|
|
7268
|
+
{
|
|
7269
|
+
checked: areAllVisibleTasksSelected,
|
|
7270
|
+
indeterminate: areSomeVisibleTasksSelected,
|
|
7271
|
+
onChange: handleToggleAllVisibleTaskSelection
|
|
7272
|
+
}
|
|
7273
|
+
)
|
|
7274
|
+
},
|
|
7275
|
+
col.id
|
|
7276
|
+
);
|
|
7277
|
+
}
|
|
7162
7278
|
if (col.id === "dependencies") {
|
|
7163
7279
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7164
7280
|
"div",
|
|
@@ -7284,6 +7400,8 @@ var TaskList = ({
|
|
|
7284
7400
|
isFilterMatch: filterMode === "highlight" ? highlightedTaskIds.has(task.id) : false,
|
|
7285
7401
|
isFilterHideMode: filterMode === "hide" && isFilterActive,
|
|
7286
7402
|
resolvedColumns,
|
|
7403
|
+
isTaskSelected: effectiveSelectedTaskIds.has(task.id),
|
|
7404
|
+
onTaskSelectionChange: handleToggleTaskSelection,
|
|
7287
7405
|
taskListMenuCommands
|
|
7288
7406
|
}
|
|
7289
7407
|
),
|
|
@@ -9364,6 +9482,9 @@ function TaskGanttChartInner(props, ref) {
|
|
|
9364
9482
|
collapsedParentIds: externalCollapsedParentIds,
|
|
9365
9483
|
onToggleCollapse: externalOnToggleCollapse,
|
|
9366
9484
|
highlightedTaskIds,
|
|
9485
|
+
enableTaskMultiSelect = false,
|
|
9486
|
+
selectedTaskIds,
|
|
9487
|
+
onSelectedTaskIdsChange,
|
|
9367
9488
|
disableTaskDrag = false,
|
|
9368
9489
|
showChart = true,
|
|
9369
9490
|
additionalColumns,
|
|
@@ -9631,6 +9752,40 @@ function TaskGanttChartInner(props, ref) {
|
|
|
9631
9752
|
const handleTaskSelect = (0, import_react15.useCallback)((taskId) => {
|
|
9632
9753
|
setSelectedTaskId(taskId);
|
|
9633
9754
|
}, []);
|
|
9755
|
+
const hoveredRowElementsRef = (0, import_react15.useRef)([]);
|
|
9756
|
+
const clearHoveredRows = (0, import_react15.useCallback)(() => {
|
|
9757
|
+
for (const element of hoveredRowElementsRef.current) {
|
|
9758
|
+
element.classList.remove("gantt-tl-row-hovered", "gantt-tr-row-hovered");
|
|
9759
|
+
}
|
|
9760
|
+
hoveredRowElementsRef.current = [];
|
|
9761
|
+
}, []);
|
|
9762
|
+
const applyHoveredRows = (0, import_react15.useCallback)((taskId) => {
|
|
9763
|
+
const root = scrollContentRef.current;
|
|
9764
|
+
if (!root) return;
|
|
9765
|
+
clearHoveredRows();
|
|
9766
|
+
const nextHoveredRows = Array.from(
|
|
9767
|
+
root.querySelectorAll("[data-gantt-task-row-id]")
|
|
9768
|
+
).filter((element) => element.dataset.ganttTaskRowId === taskId);
|
|
9769
|
+
for (const element of nextHoveredRows) {
|
|
9770
|
+
if (element.classList.contains("gantt-tl-row")) {
|
|
9771
|
+
element.classList.add("gantt-tl-row-hovered");
|
|
9772
|
+
}
|
|
9773
|
+
if (element.classList.contains("gantt-tr-row")) {
|
|
9774
|
+
element.classList.add("gantt-tr-row-hovered");
|
|
9775
|
+
}
|
|
9776
|
+
}
|
|
9777
|
+
hoveredRowElementsRef.current = nextHoveredRows;
|
|
9778
|
+
}, [clearHoveredRows]);
|
|
9779
|
+
const handleSharedRowHover = (0, import_react15.useCallback)((event) => {
|
|
9780
|
+
const target = event.target;
|
|
9781
|
+
const row = target.closest("[data-gantt-task-row-id]");
|
|
9782
|
+
const taskId = row?.dataset.ganttTaskRowId;
|
|
9783
|
+
if (!taskId) return;
|
|
9784
|
+
if (hoveredRowElementsRef.current.some((element) => element.dataset.ganttTaskRowId === taskId)) {
|
|
9785
|
+
return;
|
|
9786
|
+
}
|
|
9787
|
+
applyHoveredRows(taskId);
|
|
9788
|
+
}, [applyHoveredRows]);
|
|
9634
9789
|
const handleToggleCollapse = externalOnToggleCollapse ?? (0, import_react15.useCallback)((parentId) => {
|
|
9635
9790
|
setInternalCollapsedParentIds((prev) => {
|
|
9636
9791
|
const next = new Set(prev);
|
|
@@ -9863,157 +10018,169 @@ function TaskGanttChartInner(props, ref) {
|
|
|
9863
10018
|
className: "gantt-scrollContainer",
|
|
9864
10019
|
style: { height: containerHeight ?? "auto", cursor: "grab" },
|
|
9865
10020
|
onMouseDown: handlePanStart,
|
|
9866
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
10021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
10022
|
+
"div",
|
|
10023
|
+
{
|
|
10024
|
+
ref: scrollContentRef,
|
|
10025
|
+
className: "gantt-scrollContent",
|
|
10026
|
+
onMouseOver: handleSharedRowHover,
|
|
10027
|
+
onMouseLeave: clearHoveredRows,
|
|
10028
|
+
children: [
|
|
10029
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10030
|
+
TaskList,
|
|
10031
|
+
{
|
|
10032
|
+
tasks: normalizedTasks,
|
|
10033
|
+
rowHeight,
|
|
10034
|
+
headerHeight,
|
|
10035
|
+
taskListWidth,
|
|
10036
|
+
onTasksChange: handleTaskChange,
|
|
10037
|
+
selectedTaskId: selectedTaskId ?? void 0,
|
|
10038
|
+
onTaskSelect: handleTaskSelect,
|
|
10039
|
+
show: showTaskList,
|
|
10040
|
+
hasRightShadow: taskListHasRightShadow,
|
|
10041
|
+
disableTaskNameEditing,
|
|
10042
|
+
disableDependencyEditing,
|
|
10043
|
+
onScrollToTask: scrollToTask,
|
|
10044
|
+
onSelectedChipChange: setSelectedChip,
|
|
10045
|
+
onAdd,
|
|
10046
|
+
onDelete: handleDelete,
|
|
10047
|
+
onInsertAfter: handleInsertAfter,
|
|
10048
|
+
onReorder: handleReorder,
|
|
10049
|
+
editingTaskId,
|
|
10050
|
+
enableAddTask,
|
|
10051
|
+
defaultTaskDurationDays,
|
|
10052
|
+
collapsedParentIds,
|
|
10053
|
+
onToggleCollapse: handleToggleCollapse,
|
|
10054
|
+
onPromoteTask: onPromoteTask ?? handlePromoteTask,
|
|
10055
|
+
onDemoteTask: onDemoteTask ?? handleDemoteTask,
|
|
10056
|
+
onUngroupTask: onUngroupTask ?? handleUngroupTask,
|
|
10057
|
+
highlightedTaskIds: taskListHighlightedTaskIds,
|
|
10058
|
+
enableTaskMultiSelect,
|
|
10059
|
+
selectedTaskIds,
|
|
10060
|
+
onSelectedTaskIdsChange,
|
|
10061
|
+
customDays,
|
|
10062
|
+
isWeekend: isWeekend3,
|
|
10063
|
+
businessDays,
|
|
10064
|
+
filterMode,
|
|
10065
|
+
filteredTaskIds: matchedTaskIds,
|
|
10066
|
+
isFilterActive: !!taskFilter,
|
|
10067
|
+
additionalColumns,
|
|
10068
|
+
hiddenTaskListColumns,
|
|
10069
|
+
taskListMenuCommands
|
|
10070
|
+
}
|
|
10071
|
+
),
|
|
10072
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
10073
|
+
"div",
|
|
10074
|
+
{
|
|
10075
|
+
className: showChart ? "gantt-chartSurface" : "gantt-chartSurface gantt-chart-hidden",
|
|
10076
|
+
style: { minWidth: `${gridWidth}px`, flex: 1, display: showChart ? void 0 : "none" },
|
|
10077
|
+
children: [
|
|
10078
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10079
|
+
"div",
|
|
9920
10080
|
{
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
10081
|
+
className: "gantt-stickyHeader",
|
|
10082
|
+
style: { width: `${gridWidth}px`, height: `${timelineHeaderHeight}px` },
|
|
10083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10084
|
+
TimeScaleHeader_default,
|
|
10085
|
+
{
|
|
10086
|
+
days: dateRange,
|
|
10087
|
+
dayWidth,
|
|
10088
|
+
headerHeight,
|
|
10089
|
+
viewMode,
|
|
10090
|
+
isCustomWeekend
|
|
10091
|
+
}
|
|
10092
|
+
)
|
|
9926
10093
|
}
|
|
9927
|
-
)
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
position: "relative",
|
|
9936
|
-
width: `${gridWidth}px`
|
|
9937
|
-
},
|
|
9938
|
-
children: [
|
|
9939
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9940
|
-
GridBackground_default,
|
|
9941
|
-
{
|
|
9942
|
-
dateRange,
|
|
9943
|
-
dayWidth,
|
|
9944
|
-
totalHeight: totalGridHeight,
|
|
9945
|
-
viewMode,
|
|
9946
|
-
isCustomWeekend
|
|
9947
|
-
}
|
|
9948
|
-
),
|
|
9949
|
-
todayInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
|
|
9950
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9951
|
-
DependencyLines_default,
|
|
9952
|
-
{
|
|
9953
|
-
tasks: previewVisibleTasks,
|
|
9954
|
-
allTasks: previewNormalizedTasks,
|
|
9955
|
-
collapsedParentIds,
|
|
9956
|
-
monthStart,
|
|
9957
|
-
dayWidth,
|
|
9958
|
-
rowHeight,
|
|
9959
|
-
gridWidth,
|
|
9960
|
-
dragOverrides: dependencyOverrides,
|
|
9961
|
-
selectedDep: selectedChip,
|
|
9962
|
-
businessDays,
|
|
9963
|
-
weekendPredicate: isCustomWeekend
|
|
9964
|
-
}
|
|
9965
|
-
),
|
|
9966
|
-
dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9967
|
-
DragGuideLines_default,
|
|
9968
|
-
{
|
|
9969
|
-
isDragging: dragGuideLines.isDragging,
|
|
9970
|
-
dragMode: dragGuideLines.dragMode,
|
|
9971
|
-
left: dragGuideLines.left,
|
|
9972
|
-
width: dragGuideLines.width,
|
|
9973
|
-
totalHeight: totalGridHeight
|
|
9974
|
-
}
|
|
9975
|
-
),
|
|
9976
|
-
visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9977
|
-
TaskRow_default,
|
|
9978
|
-
{
|
|
9979
|
-
task,
|
|
9980
|
-
monthStart,
|
|
9981
|
-
dayWidth,
|
|
9982
|
-
rowHeight,
|
|
9983
|
-
onTasksChange: handleTaskChange,
|
|
9984
|
-
onDragStateChange: (state) => {
|
|
9985
|
-
if (state.isDragging) {
|
|
9986
|
-
setDragGuideLines(state);
|
|
9987
|
-
setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
|
|
9988
|
-
} else {
|
|
9989
|
-
setDragGuideLines(null);
|
|
9990
|
-
setDraggedTaskOverride(null);
|
|
9991
|
-
}
|
|
9992
|
-
},
|
|
9993
|
-
rowIndex: index,
|
|
9994
|
-
allTasks: normalizedTasks,
|
|
9995
|
-
enableAutoSchedule: enableAutoSchedule ?? false,
|
|
9996
|
-
disableConstraints: disableConstraints ?? false,
|
|
9997
|
-
overridePosition: cascadeOverrides.get(task.id),
|
|
9998
|
-
onCascadeProgress: handleCascadeProgress,
|
|
9999
|
-
onCascade: handleCascade,
|
|
10000
|
-
highlightExpiredTasks,
|
|
10001
|
-
showBaseline,
|
|
10002
|
-
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
10003
|
-
businessDays,
|
|
10004
|
-
customDays,
|
|
10005
|
-
isWeekend: isWeekend3,
|
|
10006
|
-
disableTaskDrag
|
|
10094
|
+
),
|
|
10095
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
10096
|
+
"div",
|
|
10097
|
+
{
|
|
10098
|
+
className: "gantt-taskArea",
|
|
10099
|
+
style: {
|
|
10100
|
+
position: "relative",
|
|
10101
|
+
width: `${gridWidth}px`
|
|
10007
10102
|
},
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10103
|
+
children: [
|
|
10104
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10105
|
+
GridBackground_default,
|
|
10106
|
+
{
|
|
10107
|
+
dateRange,
|
|
10108
|
+
dayWidth,
|
|
10109
|
+
totalHeight: totalGridHeight,
|
|
10110
|
+
viewMode,
|
|
10111
|
+
isCustomWeekend
|
|
10112
|
+
}
|
|
10113
|
+
),
|
|
10114
|
+
todayInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
|
|
10115
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10116
|
+
DependencyLines_default,
|
|
10117
|
+
{
|
|
10118
|
+
tasks: previewVisibleTasks,
|
|
10119
|
+
allTasks: previewNormalizedTasks,
|
|
10120
|
+
collapsedParentIds,
|
|
10121
|
+
monthStart,
|
|
10122
|
+
dayWidth,
|
|
10123
|
+
rowHeight,
|
|
10124
|
+
gridWidth,
|
|
10125
|
+
dragOverrides: dependencyOverrides,
|
|
10126
|
+
selectedDep: selectedChip,
|
|
10127
|
+
businessDays,
|
|
10128
|
+
weekendPredicate: isCustomWeekend
|
|
10129
|
+
}
|
|
10130
|
+
),
|
|
10131
|
+
dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10132
|
+
DragGuideLines_default,
|
|
10133
|
+
{
|
|
10134
|
+
isDragging: dragGuideLines.isDragging,
|
|
10135
|
+
dragMode: dragGuideLines.dragMode,
|
|
10136
|
+
left: dragGuideLines.left,
|
|
10137
|
+
width: dragGuideLines.width,
|
|
10138
|
+
totalHeight: totalGridHeight
|
|
10139
|
+
}
|
|
10140
|
+
),
|
|
10141
|
+
visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10142
|
+
TaskRow_default,
|
|
10143
|
+
{
|
|
10144
|
+
task,
|
|
10145
|
+
monthStart,
|
|
10146
|
+
dayWidth,
|
|
10147
|
+
rowHeight,
|
|
10148
|
+
onTasksChange: handleTaskChange,
|
|
10149
|
+
onDragStateChange: (state) => {
|
|
10150
|
+
if (state.isDragging) {
|
|
10151
|
+
setDragGuideLines(state);
|
|
10152
|
+
setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
|
|
10153
|
+
} else {
|
|
10154
|
+
setDragGuideLines(null);
|
|
10155
|
+
setDraggedTaskOverride(null);
|
|
10156
|
+
}
|
|
10157
|
+
},
|
|
10158
|
+
rowIndex: index,
|
|
10159
|
+
allTasks: normalizedTasks,
|
|
10160
|
+
enableAutoSchedule: enableAutoSchedule ?? false,
|
|
10161
|
+
disableConstraints: disableConstraints ?? false,
|
|
10162
|
+
overridePosition: cascadeOverrides.get(task.id),
|
|
10163
|
+
onCascadeProgress: handleCascadeProgress,
|
|
10164
|
+
onCascade: handleCascade,
|
|
10165
|
+
highlightExpiredTasks,
|
|
10166
|
+
showBaseline,
|
|
10167
|
+
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
10168
|
+
businessDays,
|
|
10169
|
+
customDays,
|
|
10170
|
+
isWeekend: isWeekend3,
|
|
10171
|
+
disableTaskDrag
|
|
10172
|
+
},
|
|
10173
|
+
task.id
|
|
10174
|
+
))
|
|
10175
|
+
]
|
|
10176
|
+
}
|
|
10177
|
+
)
|
|
10178
|
+
]
|
|
10179
|
+
}
|
|
10180
|
+
)
|
|
10181
|
+
]
|
|
10182
|
+
}
|
|
10183
|
+
)
|
|
10017
10184
|
}
|
|
10018
10185
|
) });
|
|
10019
10186
|
}
|