gantt-lib 0.20.0 → 0.22.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 +76 -2
- package/dist/index.d.ts +76 -2
- package/dist/index.js +144 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -58
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +21 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -487,7 +487,7 @@ function getSuccessorChain(draggedTaskId, allTasks, linkTypes = ["FS"]) {
|
|
|
487
487
|
}
|
|
488
488
|
return chain;
|
|
489
489
|
}
|
|
490
|
-
function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks) {
|
|
490
|
+
function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks, skipChildCascade = false) {
|
|
491
491
|
const taskById = new Map(allTasks.map((t) => [t.id, t]));
|
|
492
492
|
const updatedDates = /* @__PURE__ */ new Map();
|
|
493
493
|
updatedDates.set(movedTaskId, { start: newStart, end: newEnd });
|
|
@@ -497,27 +497,29 @@ function cascadeByLinks(movedTaskId, newStart, newEnd, allTasks) {
|
|
|
497
497
|
while (queue.length > 0) {
|
|
498
498
|
const currentId = queue.shift();
|
|
499
499
|
const { start: predStart, end: predEnd } = updatedDates.get(currentId);
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
500
|
+
if (!skipChildCascade) {
|
|
501
|
+
const children = getChildren(currentId, allTasks);
|
|
502
|
+
for (const child of children) {
|
|
503
|
+
if (visited.has(child.id) || child.locked) continue;
|
|
504
|
+
const origStart = new Date(child.startDate);
|
|
505
|
+
const origEnd = new Date(child.endDate);
|
|
506
|
+
const durationMs = origEnd.getTime() - origStart.getTime();
|
|
507
|
+
const parentOrig = taskById.get(currentId);
|
|
508
|
+
const parentOrigStart = new Date(parentOrig.startDate);
|
|
509
|
+
const parentOrigEnd = new Date(parentOrig.endDate);
|
|
510
|
+
const parentStartDelta = predStart.getTime() - parentOrigStart.getTime();
|
|
511
|
+
const parentEndDelta = predEnd.getTime() - parentOrigEnd.getTime();
|
|
512
|
+
const newChildStart = new Date(origStart.getTime() + parentStartDelta);
|
|
513
|
+
const newChildEnd = new Date(origEnd.getTime() + parentEndDelta);
|
|
514
|
+
visited.add(child.id);
|
|
515
|
+
updatedDates.set(child.id, { start: newChildStart, end: newChildEnd });
|
|
516
|
+
result.push({
|
|
517
|
+
...child,
|
|
518
|
+
startDate: newChildStart.toISOString().split("T")[0],
|
|
519
|
+
endDate: newChildEnd.toISOString().split("T")[0]
|
|
520
|
+
});
|
|
521
|
+
queue.push(child.id);
|
|
522
|
+
}
|
|
521
523
|
}
|
|
522
524
|
for (const task of allTasks) {
|
|
523
525
|
if (visited.has(task.id) || !task.dependencies || task.locked) continue;
|
|
@@ -1248,6 +1250,27 @@ var calculateOrthogonalPath = (from, to) => {
|
|
|
1248
1250
|
return `M ${fx} ${fy} H ${tx} V ${ty}`;
|
|
1249
1251
|
};
|
|
1250
1252
|
|
|
1253
|
+
// src/utils/expired.ts
|
|
1254
|
+
init_dateUtils();
|
|
1255
|
+
var isTaskExpired = (task, referenceDate = /* @__PURE__ */ new Date()) => {
|
|
1256
|
+
if (!task) return false;
|
|
1257
|
+
const actualProgress = task.progress ?? 0;
|
|
1258
|
+
if (actualProgress >= 100) return false;
|
|
1259
|
+
const today = new Date(Date.UTC(
|
|
1260
|
+
referenceDate.getFullYear(),
|
|
1261
|
+
referenceDate.getMonth(),
|
|
1262
|
+
referenceDate.getDate()
|
|
1263
|
+
));
|
|
1264
|
+
const taskStart = parseUTCDate(task.startDate);
|
|
1265
|
+
const taskEnd = parseUTCDate(task.endDate);
|
|
1266
|
+
const msPerDay = 1e3 * 60 * 60 * 24;
|
|
1267
|
+
const duration = taskEnd.getTime() - taskStart.getTime() + msPerDay;
|
|
1268
|
+
const elapsedFromToday = today.getTime() - taskStart.getTime();
|
|
1269
|
+
const elapsed = Math.min(Math.max(0, elapsedFromToday), duration);
|
|
1270
|
+
const expectedProgress = elapsed / duration * 100;
|
|
1271
|
+
return actualProgress < expectedProgress;
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1251
1274
|
// src/hooks/useTaskDrag.ts
|
|
1252
1275
|
import { useEffect, useRef, useState, useCallback } from "react";
|
|
1253
1276
|
var globalActiveDrag = null;
|
|
@@ -1670,10 +1693,10 @@ var useTaskDrag = (options) => {
|
|
|
1670
1693
|
// src/components/TaskRow/TaskRow.tsx
|
|
1671
1694
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1672
1695
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
1673
|
-
return prevProps.task.id === nextProps.task.id && prevProps.task.name === nextProps.task.name && prevProps.task.startDate === nextProps.task.startDate && prevProps.task.endDate === nextProps.task.endDate && prevProps.task.color === nextProps.task.color && prevProps.task.progress === nextProps.task.progress && prevProps.task.accepted === nextProps.task.accepted && prevProps.monthStart.getTime() === nextProps.monthStart.getTime() && prevProps.dayWidth === nextProps.dayWidth && prevProps.rowHeight === nextProps.rowHeight && prevProps.overridePosition?.left === nextProps.overridePosition?.left && prevProps.overridePosition?.width === nextProps.overridePosition?.width && prevProps.allTasks === nextProps.allTasks && prevProps.disableConstraints === nextProps.disableConstraints && prevProps.task.locked === nextProps.task.locked && prevProps.task.divider === nextProps.task.divider && prevProps.highlightExpiredTasks === nextProps.highlightExpiredTasks;
|
|
1696
|
+
return prevProps.task.id === nextProps.task.id && prevProps.task.name === nextProps.task.name && prevProps.task.startDate === nextProps.task.startDate && prevProps.task.endDate === nextProps.task.endDate && prevProps.task.color === nextProps.task.color && prevProps.task.progress === nextProps.task.progress && prevProps.task.accepted === nextProps.task.accepted && prevProps.monthStart.getTime() === nextProps.monthStart.getTime() && prevProps.dayWidth === nextProps.dayWidth && prevProps.rowHeight === nextProps.rowHeight && prevProps.overridePosition?.left === nextProps.overridePosition?.left && prevProps.overridePosition?.width === nextProps.overridePosition?.width && prevProps.allTasks === nextProps.allTasks && prevProps.disableConstraints === nextProps.disableConstraints && prevProps.task.locked === nextProps.task.locked && prevProps.task.divider === nextProps.task.divider && prevProps.highlightExpiredTasks === nextProps.highlightExpiredTasks && prevProps.isFilterMatch === nextProps.isFilterMatch;
|
|
1674
1697
|
};
|
|
1675
1698
|
var TaskRow = React2.memo(
|
|
1676
|
-
({ task, monthStart, dayWidth, rowHeight, onTasksChange, onDragStateChange, rowIndex, allTasks, enableAutoSchedule, disableConstraints, overridePosition, onCascadeProgress, onCascade, divider, highlightExpiredTasks }) => {
|
|
1699
|
+
({ task, monthStart, dayWidth, rowHeight, onTasksChange, onDragStateChange, rowIndex, allTasks, enableAutoSchedule, disableConstraints, overridePosition, onCascadeProgress, onCascade, divider, highlightExpiredTasks, isFilterMatch = false }) => {
|
|
1677
1700
|
const { divider: taskDivider } = task;
|
|
1678
1701
|
const taskStartDate = useMemo2(() => parseUTCDate(task.startDate), [task.startDate]);
|
|
1679
1702
|
const taskEndDate = useMemo2(() => parseUTCDate(task.endDate), [task.endDate]);
|
|
@@ -1685,20 +1708,7 @@ var TaskRow = React2.memo(
|
|
|
1685
1708
|
}, [allTasks, task.id]);
|
|
1686
1709
|
const isExpired = useMemo2(() => {
|
|
1687
1710
|
if (!highlightExpiredTasks) return false;
|
|
1688
|
-
|
|
1689
|
-
const today = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
|
|
1690
|
-
const taskStart = parseUTCDate(task.startDate);
|
|
1691
|
-
const taskEnd = parseUTCDate(task.endDate);
|
|
1692
|
-
const actualProgress = task.progress ?? 0;
|
|
1693
|
-
if (actualProgress >= 100) {
|
|
1694
|
-
return false;
|
|
1695
|
-
}
|
|
1696
|
-
const msPerDay = 1e3 * 60 * 60 * 24;
|
|
1697
|
-
const duration = taskEnd.getTime() - taskStart.getTime() + msPerDay;
|
|
1698
|
-
const elapsedFromToday = today.getTime() - taskStart.getTime();
|
|
1699
|
-
const elapsed = Math.min(Math.max(0, elapsedFromToday), duration);
|
|
1700
|
-
const expected = elapsed / duration * 100;
|
|
1701
|
-
return actualProgress < expected;
|
|
1711
|
+
return isTaskExpired(task);
|
|
1702
1712
|
}, [task.startDate, task.endDate, task.progress, highlightExpiredTasks]);
|
|
1703
1713
|
const { left, width } = useMemo2(
|
|
1704
1714
|
() => calculateTaskBar(taskStartDate, taskEndDate, monthStart, dayWidth),
|
|
@@ -1783,12 +1793,15 @@ var TaskRow = React2.memo(
|
|
|
1783
1793
|
if (lastDigit >= 2 && lastDigit <= 4) return `${count} \u0437\u0430\u0434\u0430\u0447\u0438`;
|
|
1784
1794
|
return `${count} \u0437\u0430\u0434\u0430\u0447`;
|
|
1785
1795
|
};
|
|
1786
|
-
const estimatedTextWidth = durationDays >= 10 ? 76 : 62;
|
|
1796
|
+
const estimatedTextWidth = isParent ? 120 : durationDays >= 10 ? 76 : 62;
|
|
1787
1797
|
const showProgressInside = progressWidth > 0 && displayWidth > estimatedTextWidth;
|
|
1798
|
+
const MIN_DURATION_WIDTH = isParent ? 80 : 50;
|
|
1799
|
+
const showDurationInside = durationDays >= 2 && displayWidth > MIN_DURATION_WIDTH;
|
|
1788
1800
|
return /* @__PURE__ */ jsxs2(
|
|
1789
1801
|
"div",
|
|
1790
1802
|
{
|
|
1791
|
-
|
|
1803
|
+
"data-filter-match": isFilterMatch ? "true" : "false",
|
|
1804
|
+
className: `gantt-tr-row ${isFilterMatch ? "gantt-tr-row-filter-match" : ""}`,
|
|
1792
1805
|
style: { height: `${rowHeight}px` },
|
|
1793
1806
|
children: [
|
|
1794
1807
|
taskDivider === "top" && /* @__PURE__ */ jsx2("div", { className: "gantt-tr-divider gantt-tr-divider-top" }),
|
|
@@ -1822,7 +1835,7 @@ var TaskRow = React2.memo(
|
|
|
1822
1835
|
}
|
|
1823
1836
|
),
|
|
1824
1837
|
!isParent && /* @__PURE__ */ jsx2("div", { className: "gantt-tr-resizeHandle gantt-tr-resizeHandleLeft" }),
|
|
1825
|
-
/* @__PURE__ */ jsx2("span", { className: "gantt-tr-taskDuration", children: isParent ? getChildCountLabel(childCount) : `${durationDays} \u0434` }),
|
|
1838
|
+
showDurationInside && /* @__PURE__ */ jsx2("span", { className: "gantt-tr-taskDuration", children: isParent ? getChildCountLabel(childCount) : `${durationDays} \u0434` }),
|
|
1826
1839
|
progressWidth > 0 && showProgressInside && /* @__PURE__ */ jsxs2("span", { className: "gantt-tr-progressText", children: [
|
|
1827
1840
|
progressWidth,
|
|
1828
1841
|
"%"
|
|
@@ -1871,9 +1884,10 @@ var TaskRow = React2.memo(
|
|
|
1871
1884
|
{
|
|
1872
1885
|
className: "gantt-tr-rightLabels",
|
|
1873
1886
|
style: {
|
|
1874
|
-
left: `${displayLeft + displayWidth}px`
|
|
1887
|
+
left: `${displayLeft + Math.max(displayWidth, 20) - Math.min(6, Math.max(displayWidth, 20) / 2) + 8}px`
|
|
1875
1888
|
},
|
|
1876
1889
|
children: [
|
|
1890
|
+
!showDurationInside && /* @__PURE__ */ jsx2("span", { className: "gantt-tr-externalDuration", children: isParent ? getChildCountLabel(childCount) : `${durationDays} \u0434` }),
|
|
1877
1891
|
progressWidth > 0 && !showProgressInside && /* @__PURE__ */ jsxs2("span", { className: "gantt-tr-externalProgress", children: [
|
|
1878
1892
|
progressWidth,
|
|
1879
1893
|
"%"
|
|
@@ -3295,7 +3309,8 @@ var TaskListRow = React9.memo(
|
|
|
3295
3309
|
nestingDepth = 0,
|
|
3296
3310
|
ancestorContinues = [],
|
|
3297
3311
|
customDays,
|
|
3298
|
-
isWeekend: isWeekend3
|
|
3312
|
+
isWeekend: isWeekend3,
|
|
3313
|
+
isFilterMatch = false
|
|
3299
3314
|
}) => {
|
|
3300
3315
|
const [editingName, setEditingName] = useState4(false);
|
|
3301
3316
|
const [nameValue, setNameValue] = useState4("");
|
|
@@ -3694,8 +3709,10 @@ var TaskListRow = React9.memo(
|
|
|
3694
3709
|
return /* @__PURE__ */ jsxs9(
|
|
3695
3710
|
"div",
|
|
3696
3711
|
{
|
|
3712
|
+
"data-filter-match": isFilterMatch ? "true" : "false",
|
|
3697
3713
|
className: [
|
|
3698
3714
|
"gantt-tl-row",
|
|
3715
|
+
isFilterMatch ? "gantt-tl-row-filter-match" : "",
|
|
3699
3716
|
isSelected ? "gantt-tl-row-selected" : "",
|
|
3700
3717
|
isPicking && !isSourceRow ? "gantt-tl-row-picking" : "",
|
|
3701
3718
|
isSourceRow ? "gantt-tl-row-picking-self" : "",
|
|
@@ -4033,11 +4050,14 @@ var TaskListRow = React9.memo(
|
|
|
4033
4050
|
]
|
|
4034
4051
|
}
|
|
4035
4052
|
),
|
|
4036
|
-
/* @__PURE__ */
|
|
4053
|
+
/* @__PURE__ */ jsxs9(
|
|
4037
4054
|
"span",
|
|
4038
4055
|
{
|
|
4039
4056
|
style: editingDuration ? { visibility: "hidden", pointerEvents: "none" } : void 0,
|
|
4040
|
-
children:
|
|
4057
|
+
children: [
|
|
4058
|
+
getInclusiveDurationDays(task.startDate, task.endDate),
|
|
4059
|
+
"\u0434"
|
|
4060
|
+
]
|
|
4041
4061
|
}
|
|
4042
4062
|
)
|
|
4043
4063
|
]
|
|
@@ -4134,7 +4154,7 @@ var TaskListRow = React9.memo(
|
|
|
4134
4154
|
padding: "2px 4px",
|
|
4135
4155
|
color: "#ffffff"
|
|
4136
4156
|
} : void 0,
|
|
4137
|
-
children: task.progress ? Math.round(task.progress) === 100 ? "100" : `${Math.round(task.progress)}%` : "
|
|
4157
|
+
children: task.progress ? Math.round(task.progress) === 100 ? "100" : `${Math.round(task.progress)}%` : "-"
|
|
4138
4158
|
}
|
|
4139
4159
|
)
|
|
4140
4160
|
]
|
|
@@ -4373,7 +4393,8 @@ var TaskList = ({
|
|
|
4373
4393
|
onPromoteTask,
|
|
4374
4394
|
onDemoteTask,
|
|
4375
4395
|
customDays,
|
|
4376
|
-
isWeekend: isWeekend3
|
|
4396
|
+
isWeekend: isWeekend3,
|
|
4397
|
+
highlightedTaskIds = /* @__PURE__ */ new Set()
|
|
4377
4398
|
}) => {
|
|
4378
4399
|
const [internalCollapsedParentIds, setInternalCollapsedParentIds] = useState6(/* @__PURE__ */ new Set());
|
|
4379
4400
|
const collapsedParentIds = externalCollapsedParentIds ?? internalCollapsedParentIds;
|
|
@@ -4841,7 +4862,8 @@ var TaskList = ({
|
|
|
4841
4862
|
nestingDepth: nestingDepthMap.get(task.id) ?? 0,
|
|
4842
4863
|
ancestorContinues: ancestorContinuesMap.get(task.id) ?? [],
|
|
4843
4864
|
customDays,
|
|
4844
|
-
isWeekend: isWeekend3
|
|
4865
|
+
isWeekend: isWeekend3,
|
|
4866
|
+
isFilterMatch: highlightedTaskIds.has(task.id)
|
|
4845
4867
|
},
|
|
4846
4868
|
task.id
|
|
4847
4869
|
)) }),
|
|
@@ -4911,7 +4933,8 @@ var GanttChart = forwardRef(({
|
|
|
4911
4933
|
enableAddTask = true,
|
|
4912
4934
|
viewMode = "day",
|
|
4913
4935
|
customDays,
|
|
4914
|
-
isWeekend: isWeekend3
|
|
4936
|
+
isWeekend: isWeekend3,
|
|
4937
|
+
taskFilter
|
|
4915
4938
|
}, ref) => {
|
|
4916
4939
|
const scrollContainerRef = useRef7(null);
|
|
4917
4940
|
const [selectedTaskId, setSelectedTaskId] = useState7(null);
|
|
@@ -4931,7 +4954,7 @@ var GanttChart = forwardRef(({
|
|
|
4931
4954
|
() => Math.round(dateRange.length * dayWidth),
|
|
4932
4955
|
[dateRange.length, dayWidth]
|
|
4933
4956
|
);
|
|
4934
|
-
const
|
|
4957
|
+
const visibleTasks = useMemo9(() => {
|
|
4935
4958
|
const parentMap = new Map(normalizedTasks.map((t) => [t.id, t.parentId]));
|
|
4936
4959
|
function isAnyAncestorCollapsed(parentId) {
|
|
4937
4960
|
let current = parentId;
|
|
@@ -4943,9 +4966,13 @@ var GanttChart = forwardRef(({
|
|
|
4943
4966
|
}
|
|
4944
4967
|
return normalizedTasks.filter((task) => !isAnyAncestorCollapsed(task.parentId));
|
|
4945
4968
|
}, [normalizedTasks, collapsedParentIds]);
|
|
4969
|
+
const matchedTaskIds = useMemo9(() => {
|
|
4970
|
+
if (!taskFilter) return /* @__PURE__ */ new Set();
|
|
4971
|
+
return new Set(visibleTasks.filter(taskFilter).map((task) => task.id));
|
|
4972
|
+
}, [visibleTasks, taskFilter]);
|
|
4946
4973
|
const totalGridHeight = useMemo9(
|
|
4947
|
-
() =>
|
|
4948
|
-
[
|
|
4974
|
+
() => visibleTasks.length * rowHeight,
|
|
4975
|
+
[visibleTasks.length, rowHeight]
|
|
4949
4976
|
);
|
|
4950
4977
|
const monthStart = useMemo9(() => {
|
|
4951
4978
|
if (dateRange.length === 0) {
|
|
@@ -5061,8 +5088,20 @@ var GanttChart = forwardRef(({
|
|
|
5061
5088
|
}
|
|
5062
5089
|
return;
|
|
5063
5090
|
}
|
|
5064
|
-
const
|
|
5065
|
-
|
|
5091
|
+
const isParent = isTaskParent(updatedTask.id, tasks);
|
|
5092
|
+
if (isParent) {
|
|
5093
|
+
const { startDate: parentStart, endDate: parentEnd } = computeParentDates(updatedTask.id, tasks);
|
|
5094
|
+
const parentWithRecalcDates = {
|
|
5095
|
+
...updatedTask,
|
|
5096
|
+
startDate: parentStart.toISOString().split("T")[0],
|
|
5097
|
+
endDate: parentEnd.toISOString().split("T")[0]
|
|
5098
|
+
};
|
|
5099
|
+
const cascadedTasks = disableConstraints ? [parentWithRecalcDates] : [parentWithRecalcDates, ...cascadeByLinks(updatedTask.id, parentStart, parentEnd, tasks, true)];
|
|
5100
|
+
onTasksChange?.(cascadedTasks);
|
|
5101
|
+
} else {
|
|
5102
|
+
const cascadedTasks = disableConstraints ? [updatedTask] : [updatedTask, ...cascadeByLinks(updatedTask.id, newStart, newEnd, tasks)];
|
|
5103
|
+
onTasksChange?.(cascadedTasks);
|
|
5104
|
+
}
|
|
5066
5105
|
}, [tasks, onTasksChange, disableConstraints, editingTaskId]);
|
|
5067
5106
|
const handleDelete = useCallback6((taskId) => {
|
|
5068
5107
|
const toDelete = /* @__PURE__ */ new Set([taskId]);
|
|
@@ -5316,6 +5355,7 @@ var GanttChart = forwardRef(({
|
|
|
5316
5355
|
onToggleCollapse: handleToggleCollapse,
|
|
5317
5356
|
onPromoteTask: onPromoteTask ?? handlePromoteTask,
|
|
5318
5357
|
onDemoteTask: onDemoteTask ?? handleDemoteTask,
|
|
5358
|
+
highlightedTaskIds: matchedTaskIds,
|
|
5319
5359
|
customDays,
|
|
5320
5360
|
isWeekend: isWeekend3
|
|
5321
5361
|
}
|
|
@@ -5354,7 +5394,7 @@ var GanttChart = forwardRef(({
|
|
|
5354
5394
|
/* @__PURE__ */ jsx15(
|
|
5355
5395
|
DependencyLines_default,
|
|
5356
5396
|
{
|
|
5357
|
-
tasks:
|
|
5397
|
+
tasks: visibleTasks,
|
|
5358
5398
|
allTasks: normalizedTasks,
|
|
5359
5399
|
collapsedParentIds,
|
|
5360
5400
|
monthStart,
|
|
@@ -5375,7 +5415,7 @@ var GanttChart = forwardRef(({
|
|
|
5375
5415
|
totalHeight: totalGridHeight
|
|
5376
5416
|
}
|
|
5377
5417
|
),
|
|
5378
|
-
|
|
5418
|
+
visibleTasks.map((task, index) => /* @__PURE__ */ jsx15(
|
|
5379
5419
|
TaskRow_default,
|
|
5380
5420
|
{
|
|
5381
5421
|
task,
|
|
@@ -5399,7 +5439,8 @@ var GanttChart = forwardRef(({
|
|
|
5399
5439
|
overridePosition: cascadeOverrides.get(task.id),
|
|
5400
5440
|
onCascadeProgress: handleCascadeProgress,
|
|
5401
5441
|
onCascade: handleCascade,
|
|
5402
|
-
highlightExpiredTasks
|
|
5442
|
+
highlightExpiredTasks,
|
|
5443
|
+
isFilterMatch: matchedTaskIds.has(task.id)
|
|
5403
5444
|
},
|
|
5404
5445
|
task.id
|
|
5405
5446
|
))
|
|
@@ -5431,6 +5472,32 @@ Button.displayName = "Button";
|
|
|
5431
5472
|
|
|
5432
5473
|
// src/utils/index.ts
|
|
5433
5474
|
init_dateUtils();
|
|
5475
|
+
|
|
5476
|
+
// src/filters/index.ts
|
|
5477
|
+
init_dateUtils();
|
|
5478
|
+
var and = (...predicates) => (task) => predicates.every((p) => p(task));
|
|
5479
|
+
var or = (...predicates) => (task) => predicates.some((p) => p(task));
|
|
5480
|
+
var not = (predicate) => (task) => !predicate(task);
|
|
5481
|
+
var withoutDeps = () => (task) => !!task && (!task.dependencies || task.dependencies.length === 0);
|
|
5482
|
+
var expired = (referenceDate = /* @__PURE__ */ new Date()) => (task) => isTaskExpired(task, referenceDate);
|
|
5483
|
+
var inDateRange = (rangeStart, rangeEnd) => (task) => {
|
|
5484
|
+
if (!task) return false;
|
|
5485
|
+
const taskStart = parseUTCDate(task.startDate);
|
|
5486
|
+
const taskEnd = parseUTCDate(task.endDate);
|
|
5487
|
+
return taskStart.getTime() <= rangeEnd.getTime() && taskEnd.getTime() >= rangeStart.getTime();
|
|
5488
|
+
};
|
|
5489
|
+
var progressInRange = (min, max) => (task) => {
|
|
5490
|
+
if (!task) return false;
|
|
5491
|
+
const progress = task.progress ?? 0;
|
|
5492
|
+
return progress >= min && progress <= max;
|
|
5493
|
+
};
|
|
5494
|
+
var nameContains = (substring, caseSensitive = false) => (task) => {
|
|
5495
|
+
if (!task) return false;
|
|
5496
|
+
const name = task.name;
|
|
5497
|
+
const search = caseSensitive ? substring : substring.toLowerCase();
|
|
5498
|
+
const target = caseSensitive ? name : name.toLowerCase();
|
|
5499
|
+
return target.includes(search);
|
|
5500
|
+
};
|
|
5434
5501
|
export {
|
|
5435
5502
|
Button,
|
|
5436
5503
|
Calendar,
|
|
@@ -5446,6 +5513,7 @@ export {
|
|
|
5446
5513
|
TaskRow_default as TaskRow,
|
|
5447
5514
|
TimeScaleHeader_default as TimeScaleHeader,
|
|
5448
5515
|
TodayIndicator_default as TodayIndicator,
|
|
5516
|
+
and,
|
|
5449
5517
|
buildAdjacencyList,
|
|
5450
5518
|
calculateBezierPath,
|
|
5451
5519
|
calculateDependencyPath,
|
|
@@ -5465,6 +5533,7 @@ export {
|
|
|
5465
5533
|
createDateKey,
|
|
5466
5534
|
detectCycles,
|
|
5467
5535
|
detectEdgeZone,
|
|
5536
|
+
expired,
|
|
5468
5537
|
findParentId,
|
|
5469
5538
|
flattenHierarchy,
|
|
5470
5539
|
formatDateLabel,
|
|
@@ -5482,17 +5551,24 @@ export {
|
|
|
5482
5551
|
getWeekBlocks,
|
|
5483
5552
|
getWeekSpans,
|
|
5484
5553
|
getYearSpans,
|
|
5554
|
+
inDateRange,
|
|
5555
|
+
isTaskExpired,
|
|
5485
5556
|
isTaskParent,
|
|
5486
5557
|
isToday,
|
|
5487
5558
|
isWeekend,
|
|
5559
|
+
nameContains,
|
|
5488
5560
|
normalizeHierarchyTasks,
|
|
5489
5561
|
normalizeTaskDates,
|
|
5562
|
+
not,
|
|
5563
|
+
or,
|
|
5490
5564
|
parseUTCDate,
|
|
5491
5565
|
pixelsToDate,
|
|
5566
|
+
progressInRange,
|
|
5492
5567
|
recalculateIncomingLags,
|
|
5493
5568
|
removeDependenciesBetweenTasks,
|
|
5494
5569
|
universalCascade,
|
|
5495
5570
|
useTaskDrag,
|
|
5496
|
-
validateDependencies
|
|
5571
|
+
validateDependencies,
|
|
5572
|
+
withoutDeps
|
|
5497
5573
|
};
|
|
5498
5574
|
//# sourceMappingURL=index.mjs.map
|