gantt-lib 0.135.7 → 0.135.8
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.js +34 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8871,6 +8871,38 @@ function resolveTaskListColumns(builtIn, custom, hiddenColumnIds = []) {
|
|
|
8871
8871
|
return filterHiddenColumns(result);
|
|
8872
8872
|
}
|
|
8873
8873
|
|
|
8874
|
+
// src/components/TaskList/taskNumbering.ts
|
|
8875
|
+
function buildTaskNumberMap(tasks) {
|
|
8876
|
+
const numberById = /* @__PURE__ */ new Map();
|
|
8877
|
+
const indexById = /* @__PURE__ */ new Map();
|
|
8878
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
8879
|
+
indexById.set(tasks[i].id, i);
|
|
8880
|
+
}
|
|
8881
|
+
let rootNumber = 0;
|
|
8882
|
+
const siblingCountByParent = /* @__PURE__ */ new Map();
|
|
8883
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
8884
|
+
const task = tasks[i];
|
|
8885
|
+
if (!task.parentId) {
|
|
8886
|
+
rootNumber += 1;
|
|
8887
|
+
numberById.set(task.id, String(rootNumber));
|
|
8888
|
+
continue;
|
|
8889
|
+
}
|
|
8890
|
+
if (!indexById.has(task.parentId)) {
|
|
8891
|
+
numberById.set(task.id, String(i + 1));
|
|
8892
|
+
continue;
|
|
8893
|
+
}
|
|
8894
|
+
const parentNumber = numberById.get(task.parentId);
|
|
8895
|
+
if (parentNumber === void 0) {
|
|
8896
|
+
numberById.set(task.id, String(i + 1));
|
|
8897
|
+
continue;
|
|
8898
|
+
}
|
|
8899
|
+
const siblingNumber = (siblingCountByParent.get(task.parentId) ?? 0) + 1;
|
|
8900
|
+
siblingCountByParent.set(task.parentId, siblingNumber);
|
|
8901
|
+
numberById.set(task.id, `${parentNumber}.${siblingNumber}`);
|
|
8902
|
+
}
|
|
8903
|
+
return numberById;
|
|
8904
|
+
}
|
|
8905
|
+
|
|
8874
8906
|
// src/components/TaskList/TaskList.tsx
|
|
8875
8907
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8876
8908
|
var LINK_TYPE_ORDER2 = ["FS", "SS", "FF", "SF"];
|
|
@@ -8956,31 +8988,6 @@ function getNearestVisibleDropAnchorBefore(visibleTasks, movedIds, startIndex) {
|
|
|
8956
8988
|
}
|
|
8957
8989
|
return null;
|
|
8958
8990
|
}
|
|
8959
|
-
function getTaskNumber(tasks, taskIndex) {
|
|
8960
|
-
const task = tasks[taskIndex];
|
|
8961
|
-
if (!task) return "";
|
|
8962
|
-
if (!task.parentId) {
|
|
8963
|
-
let rootIndex = 0;
|
|
8964
|
-
for (let i = 0; i < taskIndex; i++) {
|
|
8965
|
-
if (!tasks[i].parentId) {
|
|
8966
|
-
rootIndex++;
|
|
8967
|
-
}
|
|
8968
|
-
}
|
|
8969
|
-
return String(rootIndex + 1);
|
|
8970
|
-
}
|
|
8971
|
-
const parentIndex = tasks.findIndex((t) => t.id === task.parentId);
|
|
8972
|
-
if (parentIndex === -1) {
|
|
8973
|
-
return String(taskIndex + 1);
|
|
8974
|
-
}
|
|
8975
|
-
const parentNumber = getTaskNumber(tasks, parentIndex);
|
|
8976
|
-
let siblingIndex = 0;
|
|
8977
|
-
for (let i = 0; i < taskIndex; i++) {
|
|
8978
|
-
if (tasks[i].parentId === task.parentId) {
|
|
8979
|
-
siblingIndex++;
|
|
8980
|
-
}
|
|
8981
|
-
}
|
|
8982
|
-
return `${parentNumber}.${siblingIndex + 1}`;
|
|
8983
|
-
}
|
|
8984
8991
|
function normalizeColumnWidthMap(widths) {
|
|
8985
8992
|
if (!widths) {
|
|
8986
8993
|
return {};
|
|
@@ -9157,9 +9164,7 @@ var TaskList = ({
|
|
|
9157
9164
|
[rowHeight, skeletonRowCount, visibleTasks.length]
|
|
9158
9165
|
);
|
|
9159
9166
|
const visibleTaskNumberMap = (0, import_react14.useMemo)(
|
|
9160
|
-
() => Object.fromEntries(
|
|
9161
|
-
visibleTasks.map((task, index) => [task.id, String(getTaskNumber(visibleTasks, index))])
|
|
9162
|
-
),
|
|
9167
|
+
() => Object.fromEntries(buildTaskNumberMap(visibleTasks)),
|
|
9163
9168
|
[visibleTasks]
|
|
9164
9169
|
);
|
|
9165
9170
|
const visibleTaskIds = (0, import_react14.useMemo)(() => visibleTasks.map((task) => task.id), [visibleTasks]);
|
|
@@ -9201,13 +9206,7 @@ var TaskList = ({
|
|
|
9201
9206
|
emitSelectedTaskIdsChange(nextSelectedTaskIds);
|
|
9202
9207
|
}, [effectiveSelectedTaskIds, emitSelectedTaskIdsChange, visibleTaskIds]);
|
|
9203
9208
|
const originalTaskNumberMap = (0, import_react14.useMemo)(
|
|
9204
|
-
() =>
|
|
9205
|
-
const numberMap = /* @__PURE__ */ new Map();
|
|
9206
|
-
for (let i = 0; i < orderedTasks.length; i++) {
|
|
9207
|
-
numberMap.set(orderedTasks[i].id, getTaskNumber(orderedTasks, i));
|
|
9208
|
-
}
|
|
9209
|
-
return Object.fromEntries(numberMap);
|
|
9210
|
-
},
|
|
9209
|
+
() => Object.fromEntries(buildTaskNumberMap(orderedTasks)),
|
|
9211
9210
|
[orderedTasks]
|
|
9212
9211
|
);
|
|
9213
9212
|
const nestingDepthMap = (0, import_react14.useMemo)(() => {
|