gantt-task-react-v 1.2.2 → 1.2.4
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/components/gantt/task-gantt.d.ts +0 -1
- package/dist/components/gantt-today/index.d.ts +2 -1
- package/dist/components/task-list/index.d.ts +0 -1
- package/dist/gantt-task-react.es.js +403 -353
- package/dist/gantt-task-react.umd.js +403 -353
- package/dist/helpers/data-date-helper.d.ts +14 -0
- package/dist/style.css +23 -53
- package/dist/types/public-types.d.ts +0 -5
- package/package.json +1 -1
|
@@ -7473,11 +7473,11 @@
|
|
|
7473
7473
|
function useScrollIntent(_ref2) {
|
|
7474
7474
|
let {
|
|
7475
7475
|
delta,
|
|
7476
|
-
disabled
|
|
7476
|
+
disabled
|
|
7477
7477
|
} = _ref2;
|
|
7478
7478
|
const previousDelta = usePrevious(delta);
|
|
7479
7479
|
return useLazyMemo((previousIntent) => {
|
|
7480
|
-
if (
|
|
7480
|
+
if (disabled || !previousDelta || !previousIntent) {
|
|
7481
7481
|
return defaultScrollIntent;
|
|
7482
7482
|
}
|
|
7483
7483
|
const direction = {
|
|
@@ -7494,7 +7494,7 @@
|
|
|
7494
7494
|
[Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
|
|
7495
7495
|
}
|
|
7496
7496
|
};
|
|
7497
|
-
}, [
|
|
7497
|
+
}, [disabled, delta, previousDelta]);
|
|
7498
7498
|
}
|
|
7499
7499
|
function useCachedNode(draggableNodes, id) {
|
|
7500
7500
|
const draggableNode = id !== null ? draggableNodes.get(id) : void 0;
|
|
@@ -7543,8 +7543,8 @@
|
|
|
7543
7543
|
strategy
|
|
7544
7544
|
} = config;
|
|
7545
7545
|
const containersRef = React.useRef(containers);
|
|
7546
|
-
const
|
|
7547
|
-
const disabledRef = useLatestValue(
|
|
7546
|
+
const disabled = isDisabled();
|
|
7547
|
+
const disabledRef = useLatestValue(disabled);
|
|
7548
7548
|
const measureDroppableContainers = React.useCallback(function(ids2) {
|
|
7549
7549
|
if (ids2 === void 0) {
|
|
7550
7550
|
ids2 = [];
|
|
@@ -7561,7 +7561,7 @@
|
|
|
7561
7561
|
}, [disabledRef]);
|
|
7562
7562
|
const timeoutId = React.useRef(null);
|
|
7563
7563
|
const droppableRects = useLazyMemo((previousValue) => {
|
|
7564
|
-
if (
|
|
7564
|
+
if (disabled && !dragging2) {
|
|
7565
7565
|
return defaultValue;
|
|
7566
7566
|
}
|
|
7567
7567
|
if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
|
|
@@ -7584,19 +7584,19 @@
|
|
|
7584
7584
|
return map;
|
|
7585
7585
|
}
|
|
7586
7586
|
return previousValue;
|
|
7587
|
-
}, [containers, queue, dragging2,
|
|
7587
|
+
}, [containers, queue, dragging2, disabled, measure]);
|
|
7588
7588
|
React.useEffect(() => {
|
|
7589
7589
|
containersRef.current = containers;
|
|
7590
7590
|
}, [containers]);
|
|
7591
7591
|
React.useEffect(
|
|
7592
7592
|
() => {
|
|
7593
|
-
if (
|
|
7593
|
+
if (disabled) {
|
|
7594
7594
|
return;
|
|
7595
7595
|
}
|
|
7596
7596
|
measureDroppableContainers();
|
|
7597
7597
|
},
|
|
7598
7598
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7599
|
-
[dragging2,
|
|
7599
|
+
[dragging2, disabled]
|
|
7600
7600
|
);
|
|
7601
7601
|
React.useEffect(
|
|
7602
7602
|
() => {
|
|
@@ -7609,7 +7609,7 @@
|
|
|
7609
7609
|
);
|
|
7610
7610
|
React.useEffect(
|
|
7611
7611
|
() => {
|
|
7612
|
-
if (
|
|
7612
|
+
if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
|
|
7613
7613
|
return;
|
|
7614
7614
|
}
|
|
7615
7615
|
timeoutId.current = setTimeout(() => {
|
|
@@ -7618,7 +7618,7 @@
|
|
|
7618
7618
|
}, frequency);
|
|
7619
7619
|
},
|
|
7620
7620
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7621
|
-
[frequency,
|
|
7621
|
+
[frequency, disabled, measureDroppableContainers, ...dependencies]
|
|
7622
7622
|
);
|
|
7623
7623
|
return {
|
|
7624
7624
|
droppableRects,
|
|
@@ -7653,18 +7653,18 @@
|
|
|
7653
7653
|
function useMutationObserver(_ref) {
|
|
7654
7654
|
let {
|
|
7655
7655
|
callback,
|
|
7656
|
-
disabled
|
|
7656
|
+
disabled
|
|
7657
7657
|
} = _ref;
|
|
7658
7658
|
const handleMutations = useEvent(callback);
|
|
7659
7659
|
const mutationObserver = React.useMemo(() => {
|
|
7660
|
-
if (
|
|
7660
|
+
if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
|
|
7661
7661
|
return void 0;
|
|
7662
7662
|
}
|
|
7663
7663
|
const {
|
|
7664
7664
|
MutationObserver
|
|
7665
7665
|
} = window;
|
|
7666
7666
|
return new MutationObserver(handleMutations);
|
|
7667
|
-
}, [handleMutations,
|
|
7667
|
+
}, [handleMutations, disabled]);
|
|
7668
7668
|
React.useEffect(() => {
|
|
7669
7669
|
return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
7670
7670
|
}, [mutationObserver]);
|
|
@@ -7673,12 +7673,12 @@
|
|
|
7673
7673
|
function useResizeObserver(_ref) {
|
|
7674
7674
|
let {
|
|
7675
7675
|
callback,
|
|
7676
|
-
disabled
|
|
7676
|
+
disabled
|
|
7677
7677
|
} = _ref;
|
|
7678
7678
|
const handleResize = useEvent(callback);
|
|
7679
7679
|
const resizeObserver = React.useMemo(
|
|
7680
7680
|
() => {
|
|
7681
|
-
if (
|
|
7681
|
+
if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
|
|
7682
7682
|
return void 0;
|
|
7683
7683
|
}
|
|
7684
7684
|
const {
|
|
@@ -7687,7 +7687,7 @@
|
|
|
7687
7687
|
return new ResizeObserver2(handleResize);
|
|
7688
7688
|
},
|
|
7689
7689
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7690
|
-
[
|
|
7690
|
+
[disabled]
|
|
7691
7691
|
);
|
|
7692
7692
|
React.useEffect(() => {
|
|
7693
7693
|
return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
@@ -8005,9 +8005,9 @@
|
|
|
8005
8005
|
getEnabled() {
|
|
8006
8006
|
return this.toArray().filter((_ref) => {
|
|
8007
8007
|
let {
|
|
8008
|
-
disabled
|
|
8008
|
+
disabled
|
|
8009
8009
|
} = _ref;
|
|
8010
|
-
return !
|
|
8010
|
+
return !disabled;
|
|
8011
8011
|
});
|
|
8012
8012
|
}
|
|
8013
8013
|
getNodeFor(id) {
|
|
@@ -8137,7 +8137,7 @@
|
|
|
8137
8137
|
const {
|
|
8138
8138
|
id,
|
|
8139
8139
|
key: key2,
|
|
8140
|
-
disabled
|
|
8140
|
+
disabled
|
|
8141
8141
|
} = action;
|
|
8142
8142
|
const element = state.droppable.containers.get(id);
|
|
8143
8143
|
if (!element || key2 !== element.key) {
|
|
@@ -8146,7 +8146,7 @@
|
|
|
8146
8146
|
const containers = new DroppableContainersMap(state.droppable.containers);
|
|
8147
8147
|
containers.set(id, {
|
|
8148
8148
|
...element,
|
|
8149
|
-
disabled
|
|
8149
|
+
disabled
|
|
8150
8150
|
});
|
|
8151
8151
|
return {
|
|
8152
8152
|
...state,
|
|
@@ -8182,7 +8182,7 @@
|
|
|
8182
8182
|
}
|
|
8183
8183
|
function RestoreFocus(_ref) {
|
|
8184
8184
|
let {
|
|
8185
|
-
disabled
|
|
8185
|
+
disabled
|
|
8186
8186
|
} = _ref;
|
|
8187
8187
|
const {
|
|
8188
8188
|
active,
|
|
@@ -8192,7 +8192,7 @@
|
|
|
8192
8192
|
const previousActivatorEvent = usePrevious(activatorEvent);
|
|
8193
8193
|
const previousActiveId = usePrevious(active == null ? void 0 : active.id);
|
|
8194
8194
|
React.useEffect(() => {
|
|
8195
|
-
if (
|
|
8195
|
+
if (disabled) {
|
|
8196
8196
|
return;
|
|
8197
8197
|
}
|
|
8198
8198
|
if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
|
|
@@ -8226,7 +8226,7 @@
|
|
|
8226
8226
|
}
|
|
8227
8227
|
});
|
|
8228
8228
|
}
|
|
8229
|
-
}, [activatorEvent,
|
|
8229
|
+
}, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
|
|
8230
8230
|
return null;
|
|
8231
8231
|
}
|
|
8232
8232
|
function applyModifiers(modifiers, _ref) {
|
|
@@ -8277,8 +8277,8 @@
|
|
|
8277
8277
|
y: config
|
|
8278
8278
|
} : config;
|
|
8279
8279
|
useIsomorphicLayoutEffect(() => {
|
|
8280
|
-
const
|
|
8281
|
-
if (
|
|
8280
|
+
const disabled = !x && !y;
|
|
8281
|
+
if (disabled || !activeNode) {
|
|
8282
8282
|
initialized.current = false;
|
|
8283
8283
|
return;
|
|
8284
8284
|
}
|
|
@@ -8785,7 +8785,7 @@
|
|
|
8785
8785
|
let {
|
|
8786
8786
|
id,
|
|
8787
8787
|
data,
|
|
8788
|
-
disabled
|
|
8788
|
+
disabled = false,
|
|
8789
8789
|
attributes
|
|
8790
8790
|
} = _ref;
|
|
8791
8791
|
const key2 = useUniqueId(ID_PREFIX$1);
|
|
@@ -8831,18 +8831,18 @@
|
|
|
8831
8831
|
const memoizedAttributes = React.useMemo(() => ({
|
|
8832
8832
|
role,
|
|
8833
8833
|
tabIndex,
|
|
8834
|
-
"aria-disabled":
|
|
8834
|
+
"aria-disabled": disabled,
|
|
8835
8835
|
"aria-pressed": isDragging && role === defaultRole ? true : void 0,
|
|
8836
8836
|
"aria-roledescription": roleDescription,
|
|
8837
8837
|
"aria-describedby": ariaDescribedById.draggable
|
|
8838
|
-
}), [
|
|
8838
|
+
}), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);
|
|
8839
8839
|
return {
|
|
8840
8840
|
active,
|
|
8841
8841
|
activatorEvent,
|
|
8842
8842
|
activeNodeRect,
|
|
8843
8843
|
attributes: memoizedAttributes,
|
|
8844
8844
|
isDragging,
|
|
8845
|
-
listeners:
|
|
8845
|
+
listeners: disabled ? void 0 : listeners,
|
|
8846
8846
|
node,
|
|
8847
8847
|
over,
|
|
8848
8848
|
setNodeRef,
|
|
@@ -8860,7 +8860,7 @@
|
|
|
8860
8860
|
function useDroppable(_ref) {
|
|
8861
8861
|
let {
|
|
8862
8862
|
data,
|
|
8863
|
-
disabled
|
|
8863
|
+
disabled = false,
|
|
8864
8864
|
id,
|
|
8865
8865
|
resizeObserverConfig
|
|
8866
8866
|
} = _ref;
|
|
@@ -8872,7 +8872,7 @@
|
|
|
8872
8872
|
measureDroppableContainers
|
|
8873
8873
|
} = React.useContext(InternalContext);
|
|
8874
8874
|
const previous = React.useRef({
|
|
8875
|
-
disabled
|
|
8875
|
+
disabled
|
|
8876
8876
|
});
|
|
8877
8877
|
const resizeObserverConnected = React.useRef(false);
|
|
8878
8878
|
const rect = React.useRef(null);
|
|
@@ -8936,7 +8936,7 @@
|
|
|
8936
8936
|
element: {
|
|
8937
8937
|
id,
|
|
8938
8938
|
key: key2,
|
|
8939
|
-
disabled
|
|
8939
|
+
disabled,
|
|
8940
8940
|
node: nodeRef,
|
|
8941
8941
|
rect,
|
|
8942
8942
|
data: dataRef
|
|
@@ -8952,16 +8952,16 @@
|
|
|
8952
8952
|
[id]
|
|
8953
8953
|
);
|
|
8954
8954
|
React.useEffect(() => {
|
|
8955
|
-
if (
|
|
8955
|
+
if (disabled !== previous.current.disabled) {
|
|
8956
8956
|
dispatch({
|
|
8957
8957
|
type: Action.SetDroppableDisabled,
|
|
8958
8958
|
id,
|
|
8959
8959
|
key: key2,
|
|
8960
|
-
disabled
|
|
8960
|
+
disabled
|
|
8961
8961
|
});
|
|
8962
|
-
previous.current.disabled =
|
|
8962
|
+
previous.current.disabled = disabled;
|
|
8963
8963
|
}
|
|
8964
|
-
}, [id, key2,
|
|
8964
|
+
}, [id, key2, disabled, dispatch]);
|
|
8965
8965
|
return {
|
|
8966
8966
|
active,
|
|
8967
8967
|
rect,
|
|
@@ -9352,14 +9352,14 @@
|
|
|
9352
9352
|
}
|
|
9353
9353
|
return true;
|
|
9354
9354
|
}
|
|
9355
|
-
function normalizeDisabled(
|
|
9356
|
-
if (typeof
|
|
9355
|
+
function normalizeDisabled(disabled) {
|
|
9356
|
+
if (typeof disabled === "boolean") {
|
|
9357
9357
|
return {
|
|
9358
|
-
draggable:
|
|
9359
|
-
droppable:
|
|
9358
|
+
draggable: disabled,
|
|
9359
|
+
droppable: disabled
|
|
9360
9360
|
};
|
|
9361
9361
|
}
|
|
9362
|
-
return
|
|
9362
|
+
return disabled;
|
|
9363
9363
|
}
|
|
9364
9364
|
const rectSortingStrategy = (_ref) => {
|
|
9365
9365
|
let {
|
|
@@ -9481,7 +9481,7 @@
|
|
|
9481
9481
|
const previousItemsRef = React.useRef(items);
|
|
9482
9482
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
9483
9483
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
9484
|
-
const
|
|
9484
|
+
const disabled = normalizeDisabled(disabledProp);
|
|
9485
9485
|
useIsomorphicLayoutEffect(() => {
|
|
9486
9486
|
if (itemsHaveChanged && isDragging) {
|
|
9487
9487
|
measureDroppableContainers(items);
|
|
@@ -9494,7 +9494,7 @@
|
|
|
9494
9494
|
() => ({
|
|
9495
9495
|
activeIndex,
|
|
9496
9496
|
containerId,
|
|
9497
|
-
disabled
|
|
9497
|
+
disabled,
|
|
9498
9498
|
disableTransforms,
|
|
9499
9499
|
items,
|
|
9500
9500
|
overIndex,
|
|
@@ -9503,7 +9503,7 @@
|
|
|
9503
9503
|
strategy
|
|
9504
9504
|
}),
|
|
9505
9505
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9506
|
-
[activeIndex, containerId,
|
|
9506
|
+
[activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]
|
|
9507
9507
|
);
|
|
9508
9508
|
return React.createElement(Context.Provider, {
|
|
9509
9509
|
value: contextValue
|
|
@@ -9556,7 +9556,7 @@
|
|
|
9556
9556
|
};
|
|
9557
9557
|
function useDerivedTransform(_ref) {
|
|
9558
9558
|
let {
|
|
9559
|
-
disabled
|
|
9559
|
+
disabled,
|
|
9560
9560
|
index: index2,
|
|
9561
9561
|
node,
|
|
9562
9562
|
rect
|
|
@@ -9564,7 +9564,7 @@
|
|
|
9564
9564
|
const [derivedTransform, setDerivedtransform] = React.useState(null);
|
|
9565
9565
|
const previousIndex = React.useRef(index2);
|
|
9566
9566
|
useIsomorphicLayoutEffect(() => {
|
|
9567
|
-
if (!
|
|
9567
|
+
if (!disabled && index2 !== previousIndex.current && node.current) {
|
|
9568
9568
|
const initial = rect.current;
|
|
9569
9569
|
if (initial) {
|
|
9570
9570
|
const current = getClientRect(node.current, {
|
|
@@ -9584,7 +9584,7 @@
|
|
|
9584
9584
|
if (index2 !== previousIndex.current) {
|
|
9585
9585
|
previousIndex.current = index2;
|
|
9586
9586
|
}
|
|
9587
|
-
}, [
|
|
9587
|
+
}, [disabled, index2, node, rect]);
|
|
9588
9588
|
React.useEffect(() => {
|
|
9589
9589
|
if (derivedTransform) {
|
|
9590
9590
|
setDerivedtransform(null);
|
|
@@ -9615,7 +9615,7 @@
|
|
|
9615
9615
|
useDragOverlay,
|
|
9616
9616
|
strategy: globalStrategy
|
|
9617
9617
|
} = React.useContext(Context);
|
|
9618
|
-
const
|
|
9618
|
+
const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
|
|
9619
9619
|
const index2 = items.indexOf(id);
|
|
9620
9620
|
const data = React.useMemo(() => ({
|
|
9621
9621
|
sortable: {
|
|
@@ -9634,7 +9634,7 @@
|
|
|
9634
9634
|
} = useDroppable({
|
|
9635
9635
|
id,
|
|
9636
9636
|
data,
|
|
9637
|
-
disabled:
|
|
9637
|
+
disabled: disabled.droppable,
|
|
9638
9638
|
resizeObserverConfig: {
|
|
9639
9639
|
updateMeasurementsFor: itemsAfterCurrentSortable,
|
|
9640
9640
|
...resizeObserverConfig
|
|
@@ -9658,7 +9658,7 @@
|
|
|
9658
9658
|
...defaultAttributes,
|
|
9659
9659
|
...userDefinedAttributes
|
|
9660
9660
|
},
|
|
9661
|
-
disabled:
|
|
9661
|
+
disabled: disabled.draggable
|
|
9662
9662
|
});
|
|
9663
9663
|
const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
|
|
9664
9664
|
const isSorting = Boolean(active);
|
|
@@ -10654,16 +10654,14 @@
|
|
|
10654
10654
|
);
|
|
10655
10655
|
};
|
|
10656
10656
|
const TaskListTable = React.memo(TaskListTableDefaultInner);
|
|
10657
|
-
const taskListRoot = "
|
|
10658
|
-
const taskListHorizontalScroll = "
|
|
10659
|
-
const taskListResizer = "
|
|
10660
|
-
const horizontalContainer$1 = "
|
|
10661
|
-
const tableWrapper = "
|
|
10662
|
-
const scrollToTop = "
|
|
10663
|
-
const scrollToBottom = "
|
|
10664
|
-
const hidden = "
|
|
10665
|
-
const disabled$1 = "_disabled_cyzwo_213";
|
|
10666
|
-
const disabledOverlay$1 = "_disabledOverlay_cyzwo_221";
|
|
10657
|
+
const taskListRoot = "_taskListRoot_yoz76_1";
|
|
10658
|
+
const taskListHorizontalScroll = "_taskListHorizontalScroll_yoz76_19";
|
|
10659
|
+
const taskListResizer = "_taskListResizer_yoz76_81";
|
|
10660
|
+
const horizontalContainer$1 = "_horizontalContainer_yoz76_145";
|
|
10661
|
+
const tableWrapper = "_tableWrapper_yoz76_159";
|
|
10662
|
+
const scrollToTop = "_scrollToTop_yoz76_173";
|
|
10663
|
+
const scrollToBottom = "_scrollToBottom_yoz76_189";
|
|
10664
|
+
const hidden = "_hidden_yoz76_205";
|
|
10667
10665
|
const styles$d = {
|
|
10668
10666
|
taskListRoot,
|
|
10669
10667
|
taskListHorizontalScroll,
|
|
@@ -10672,9 +10670,7 @@
|
|
|
10672
10670
|
tableWrapper,
|
|
10673
10671
|
scrollToTop,
|
|
10674
10672
|
scrollToBottom,
|
|
10675
|
-
hidden
|
|
10676
|
-
disabled: disabled$1,
|
|
10677
|
-
disabledOverlay: disabledOverlay$1
|
|
10673
|
+
hidden
|
|
10678
10674
|
};
|
|
10679
10675
|
const checkHasChildren = (task, childTasksMap) => {
|
|
10680
10676
|
const { id, comparisonLevel = 1 } = task;
|
|
@@ -10723,8 +10719,7 @@
|
|
|
10723
10719
|
tasks,
|
|
10724
10720
|
onResizeColumn,
|
|
10725
10721
|
canReorderTasks,
|
|
10726
|
-
tableBottom
|
|
10727
|
-
isLoading = false
|
|
10722
|
+
tableBottom
|
|
10728
10723
|
}) => {
|
|
10729
10724
|
const [
|
|
10730
10725
|
columns,
|
|
@@ -10901,8 +10896,7 @@
|
|
|
10901
10896
|
{
|
|
10902
10897
|
className: `${styles$d.scrollToBottom} ${!renderedIndexes || renderedIndexes[3] ? styles$d.hidden : ""}`
|
|
10903
10898
|
}
|
|
10904
|
-
)
|
|
10905
|
-
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$d.disabledOverlay })
|
|
10899
|
+
)
|
|
10906
10900
|
] }),
|
|
10907
10901
|
(tableBottom == null ? void 0 : tableBottom.renderContent) && (tableBottom == null ? void 0 : tableBottom.height) && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: tableBottom.height, width: "100%" }, children: tableBottom.renderContent() })
|
|
10908
10902
|
]
|
|
@@ -10932,6 +10926,285 @@
|
|
|
10932
10926
|
ganttToday,
|
|
10933
10927
|
ganttTodayCircle
|
|
10934
10928
|
};
|
|
10929
|
+
const getDateByOffset = (startDate, offset2, viewMode) => {
|
|
10930
|
+
switch (viewMode) {
|
|
10931
|
+
case ViewMode.Day:
|
|
10932
|
+
return addDays(startDate, offset2);
|
|
10933
|
+
case ViewMode.HalfDay:
|
|
10934
|
+
return addHours(startDate, offset2 * 12);
|
|
10935
|
+
case ViewMode.QuarterDay:
|
|
10936
|
+
return addHours(startDate, offset2 * 6);
|
|
10937
|
+
case ViewMode.Hour:
|
|
10938
|
+
return addHours(startDate, offset2);
|
|
10939
|
+
case ViewMode.Month:
|
|
10940
|
+
return addMonths(startDate, offset2);
|
|
10941
|
+
case ViewMode.Week:
|
|
10942
|
+
return addWeeks(startDate, offset2);
|
|
10943
|
+
case ViewMode.Year:
|
|
10944
|
+
return addYears(startDate, offset2);
|
|
10945
|
+
default:
|
|
10946
|
+
throw new Error("Unknown view mode");
|
|
10947
|
+
}
|
|
10948
|
+
};
|
|
10949
|
+
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10950
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10951
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10952
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10953
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10954
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10955
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10956
|
+
};
|
|
10957
|
+
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10958
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10959
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10960
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10961
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10962
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10963
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10964
|
+
};
|
|
10965
|
+
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
10966
|
+
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
10967
|
+
let progressX;
|
|
10968
|
+
if (rtl) {
|
|
10969
|
+
progressX = taskX2 - progressWidth;
|
|
10970
|
+
} else {
|
|
10971
|
+
progressX = taskX1;
|
|
10972
|
+
}
|
|
10973
|
+
return [progressWidth, progressX];
|
|
10974
|
+
};
|
|
10975
|
+
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
10976
|
+
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
10977
|
+
newDate = new Date(
|
|
10978
|
+
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
10979
|
+
);
|
|
10980
|
+
return newDate;
|
|
10981
|
+
};
|
|
10982
|
+
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
10983
|
+
let result;
|
|
10984
|
+
switch (selectedTask.type) {
|
|
10985
|
+
case "milestone":
|
|
10986
|
+
result = handleTaskBySVGMouseEventForMilestone(
|
|
10987
|
+
action,
|
|
10988
|
+
selectedTask,
|
|
10989
|
+
initialCoordinates,
|
|
10990
|
+
coordinates,
|
|
10991
|
+
xStep,
|
|
10992
|
+
timeStep
|
|
10993
|
+
);
|
|
10994
|
+
break;
|
|
10995
|
+
default:
|
|
10996
|
+
result = handleTaskBySVGMouseEventForBar(
|
|
10997
|
+
action,
|
|
10998
|
+
selectedTask,
|
|
10999
|
+
initialCoordinates,
|
|
11000
|
+
coordinates,
|
|
11001
|
+
xStep,
|
|
11002
|
+
timeStep,
|
|
11003
|
+
rtl
|
|
11004
|
+
);
|
|
11005
|
+
break;
|
|
11006
|
+
}
|
|
11007
|
+
return result;
|
|
11008
|
+
};
|
|
11009
|
+
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11010
|
+
const changedTask = { ...selectedTask };
|
|
11011
|
+
let isChanged = false;
|
|
11012
|
+
switch (action) {
|
|
11013
|
+
case "progress":
|
|
11014
|
+
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11015
|
+
if (isChanged) {
|
|
11016
|
+
changedTask.progress = Math.round(
|
|
11017
|
+
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11018
|
+
);
|
|
11019
|
+
}
|
|
11020
|
+
break;
|
|
11021
|
+
case "start": {
|
|
11022
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11023
|
+
if (isChanged) {
|
|
11024
|
+
if (rtl) {
|
|
11025
|
+
changedTask.end = dateByX(
|
|
11026
|
+
coordinates.x1,
|
|
11027
|
+
initialCoordinates.x1,
|
|
11028
|
+
selectedTask.end,
|
|
11029
|
+
xStep,
|
|
11030
|
+
timeStep
|
|
11031
|
+
);
|
|
11032
|
+
} else {
|
|
11033
|
+
changedTask.start = dateByX(
|
|
11034
|
+
coordinates.x1,
|
|
11035
|
+
initialCoordinates.x1,
|
|
11036
|
+
selectedTask.start,
|
|
11037
|
+
xStep,
|
|
11038
|
+
timeStep
|
|
11039
|
+
);
|
|
11040
|
+
}
|
|
11041
|
+
}
|
|
11042
|
+
break;
|
|
11043
|
+
}
|
|
11044
|
+
case "end": {
|
|
11045
|
+
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11046
|
+
if (isChanged) {
|
|
11047
|
+
if (rtl) {
|
|
11048
|
+
changedTask.start = dateByX(
|
|
11049
|
+
coordinates.x2,
|
|
11050
|
+
initialCoordinates.x2,
|
|
11051
|
+
selectedTask.start,
|
|
11052
|
+
xStep,
|
|
11053
|
+
timeStep
|
|
11054
|
+
);
|
|
11055
|
+
} else {
|
|
11056
|
+
changedTask.end = dateByX(
|
|
11057
|
+
coordinates.x2,
|
|
11058
|
+
initialCoordinates.x2,
|
|
11059
|
+
selectedTask.end,
|
|
11060
|
+
xStep,
|
|
11061
|
+
timeStep
|
|
11062
|
+
);
|
|
11063
|
+
}
|
|
11064
|
+
}
|
|
11065
|
+
break;
|
|
11066
|
+
}
|
|
11067
|
+
case "move": {
|
|
11068
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11069
|
+
if (isChanged) {
|
|
11070
|
+
if (rtl) {
|
|
11071
|
+
changedTask.end = dateByX(
|
|
11072
|
+
coordinates.x1,
|
|
11073
|
+
initialCoordinates.x1,
|
|
11074
|
+
selectedTask.end,
|
|
11075
|
+
xStep,
|
|
11076
|
+
timeStep
|
|
11077
|
+
);
|
|
11078
|
+
changedTask.start = dateByX(
|
|
11079
|
+
coordinates.x2,
|
|
11080
|
+
initialCoordinates.x2,
|
|
11081
|
+
selectedTask.start,
|
|
11082
|
+
xStep,
|
|
11083
|
+
timeStep
|
|
11084
|
+
);
|
|
11085
|
+
} else {
|
|
11086
|
+
changedTask.start = dateByX(
|
|
11087
|
+
coordinates.x1,
|
|
11088
|
+
initialCoordinates.x1,
|
|
11089
|
+
selectedTask.start,
|
|
11090
|
+
xStep,
|
|
11091
|
+
timeStep
|
|
11092
|
+
);
|
|
11093
|
+
changedTask.end = dateByX(
|
|
11094
|
+
coordinates.x2,
|
|
11095
|
+
initialCoordinates.x2,
|
|
11096
|
+
selectedTask.end,
|
|
11097
|
+
xStep,
|
|
11098
|
+
timeStep
|
|
11099
|
+
);
|
|
11100
|
+
}
|
|
11101
|
+
}
|
|
11102
|
+
break;
|
|
11103
|
+
}
|
|
11104
|
+
}
|
|
11105
|
+
return { isChanged, changedTask };
|
|
11106
|
+
};
|
|
11107
|
+
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11108
|
+
const changedTask = { ...selectedTask };
|
|
11109
|
+
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11110
|
+
if (isChanged) {
|
|
11111
|
+
switch (action) {
|
|
11112
|
+
case "move": {
|
|
11113
|
+
changedTask.start = dateByX(
|
|
11114
|
+
coordinates.x1,
|
|
11115
|
+
initialCoordinates.x1,
|
|
11116
|
+
selectedTask.start,
|
|
11117
|
+
xStep,
|
|
11118
|
+
timeStep
|
|
11119
|
+
);
|
|
11120
|
+
changedTask.end = changedTask.start;
|
|
11121
|
+
break;
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11124
|
+
}
|
|
11125
|
+
return { isChanged, changedTask };
|
|
11126
|
+
};
|
|
11127
|
+
const calculateDataDatePosition = ({
|
|
11128
|
+
dataDate,
|
|
11129
|
+
startDate,
|
|
11130
|
+
viewMode,
|
|
11131
|
+
columnWidth,
|
|
11132
|
+
tasks = [],
|
|
11133
|
+
rtl = false
|
|
11134
|
+
}) => {
|
|
11135
|
+
const tasksStartingOnDataDate = tasks.filter((task) => {
|
|
11136
|
+
if (!task || !task.start)
|
|
11137
|
+
return false;
|
|
11138
|
+
const taskStartDate = new Date(task.start);
|
|
11139
|
+
const dataDateNormalized = new Date(dataDate);
|
|
11140
|
+
switch (viewMode) {
|
|
11141
|
+
case ViewMode.Hour:
|
|
11142
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear() && taskStartDate.getMonth() === dataDateNormalized.getMonth() && taskStartDate.getDate() === dataDateNormalized.getDate() && taskStartDate.getHours() === dataDateNormalized.getHours();
|
|
11143
|
+
case ViewMode.QuarterDay:
|
|
11144
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear() && taskStartDate.getMonth() === dataDateNormalized.getMonth() && taskStartDate.getDate() === dataDateNormalized.getDate() && Math.floor(taskStartDate.getHours() / 6) === Math.floor(dataDateNormalized.getHours() / 6);
|
|
11145
|
+
case ViewMode.HalfDay:
|
|
11146
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear() && taskStartDate.getMonth() === dataDateNormalized.getMonth() && taskStartDate.getDate() === dataDateNormalized.getDate() && Math.floor(taskStartDate.getHours() / 12) === Math.floor(dataDateNormalized.getHours() / 12);
|
|
11147
|
+
case ViewMode.Day:
|
|
11148
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear() && taskStartDate.getMonth() === dataDateNormalized.getMonth() && taskStartDate.getDate() === dataDateNormalized.getDate();
|
|
11149
|
+
case ViewMode.Week: {
|
|
11150
|
+
const taskWeekStart = new Date(taskStartDate);
|
|
11151
|
+
taskWeekStart.setDate(taskStartDate.getDate() - taskStartDate.getDay());
|
|
11152
|
+
const dataWeekStart = new Date(dataDateNormalized);
|
|
11153
|
+
dataWeekStart.setDate(
|
|
11154
|
+
dataDateNormalized.getDate() - dataDateNormalized.getDay()
|
|
11155
|
+
);
|
|
11156
|
+
return taskWeekStart.getTime() === dataWeekStart.getTime();
|
|
11157
|
+
}
|
|
11158
|
+
case ViewMode.Month:
|
|
11159
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear() && taskStartDate.getMonth() === dataDateNormalized.getMonth();
|
|
11160
|
+
case ViewMode.Year:
|
|
11161
|
+
return taskStartDate.getFullYear() === dataDateNormalized.getFullYear();
|
|
11162
|
+
default:
|
|
11163
|
+
return false;
|
|
11164
|
+
}
|
|
11165
|
+
});
|
|
11166
|
+
if (tasksStartingOnDataDate.length > 0) {
|
|
11167
|
+
let maxEndPosition = -Infinity;
|
|
11168
|
+
for (const task of tasksStartingOnDataDate) {
|
|
11169
|
+
const taskEndX = taskXCoordinate(
|
|
11170
|
+
task.end,
|
|
11171
|
+
startDate,
|
|
11172
|
+
viewMode,
|
|
11173
|
+
columnWidth
|
|
11174
|
+
);
|
|
11175
|
+
maxEndPosition = Math.max(maxEndPosition, taskEndX);
|
|
11176
|
+
}
|
|
11177
|
+
if (maxEndPosition > -Infinity) {
|
|
11178
|
+
return maxEndPosition;
|
|
11179
|
+
}
|
|
11180
|
+
}
|
|
11181
|
+
const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
11182
|
+
const extraMultiplier = () => {
|
|
11183
|
+
switch (viewMode) {
|
|
11184
|
+
case ViewMode.Week: {
|
|
11185
|
+
const percent = dataDate.getDay() / 7;
|
|
11186
|
+
return 1 + percent * 0.2;
|
|
11187
|
+
}
|
|
11188
|
+
case ViewMode.Month: {
|
|
11189
|
+
const dayInMonth = dataDate.getDate();
|
|
11190
|
+
const maxDaysInMonth = getDaysInMonth(
|
|
11191
|
+
dataDate.getMonth(),
|
|
11192
|
+
dataDate.getFullYear()
|
|
11193
|
+
);
|
|
11194
|
+
const percent = dayInMonth / maxDaysInMonth;
|
|
11195
|
+
return 1 + percent * 0.5;
|
|
11196
|
+
}
|
|
11197
|
+
case ViewMode.Year: {
|
|
11198
|
+
const percent = dataDate.getMonth() / 12;
|
|
11199
|
+
return 1 + percent * 0.5;
|
|
11200
|
+
}
|
|
11201
|
+
default:
|
|
11202
|
+
return 1;
|
|
11203
|
+
}
|
|
11204
|
+
};
|
|
11205
|
+
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11206
|
+
return rtl ? tickX + columnWidth : tickX;
|
|
11207
|
+
};
|
|
10935
11208
|
const GanttTodayInner = ({
|
|
10936
11209
|
additionalLeftSpace,
|
|
10937
11210
|
distances: { columnWidth },
|
|
@@ -10946,7 +11219,8 @@
|
|
|
10946
11219
|
todayColor = null,
|
|
10947
11220
|
dataDateColor = null,
|
|
10948
11221
|
todayLabel = "Today",
|
|
10949
|
-
dataDateLabel = "Data Date"
|
|
11222
|
+
dataDateLabel = "Data Date",
|
|
11223
|
+
tasks = []
|
|
10950
11224
|
}) => {
|
|
10951
11225
|
const todayElement = React.useMemo(() => {
|
|
10952
11226
|
if (isUnknownDates || !showTodayLine) {
|
|
@@ -11029,32 +11303,15 @@
|
|
|
11029
11303
|
if (!showDataDateLine || !dataDate) {
|
|
11030
11304
|
return null;
|
|
11031
11305
|
}
|
|
11032
|
-
const
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
const maxDaysInMonth = getDaysInMonth(
|
|
11042
|
-
dataDate.getMonth(),
|
|
11043
|
-
dataDate.getFullYear()
|
|
11044
|
-
);
|
|
11045
|
-
const percent = dayInMonth / maxDaysInMonth;
|
|
11046
|
-
return 1 + percent * 0.5;
|
|
11047
|
-
}
|
|
11048
|
-
case ViewMode.Year: {
|
|
11049
|
-
const percent = dataDate.getMonth() / 12;
|
|
11050
|
-
return 1 + percent * 0.5;
|
|
11051
|
-
}
|
|
11052
|
-
default:
|
|
11053
|
-
return 1;
|
|
11054
|
-
}
|
|
11055
|
-
};
|
|
11056
|
-
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11057
|
-
const x = rtl ? tickX + columnWidth : tickX;
|
|
11306
|
+
const tickX = calculateDataDatePosition({
|
|
11307
|
+
dataDate,
|
|
11308
|
+
startDate,
|
|
11309
|
+
viewMode,
|
|
11310
|
+
columnWidth,
|
|
11311
|
+
tasks,
|
|
11312
|
+
rtl
|
|
11313
|
+
});
|
|
11314
|
+
const x = rtl ? tickX : tickX;
|
|
11058
11315
|
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11059
11316
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11060
11317
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11100,7 +11357,8 @@
|
|
|
11100
11357
|
showDataDateLine,
|
|
11101
11358
|
dataDate,
|
|
11102
11359
|
dataDateColor,
|
|
11103
|
-
dataDateLabel
|
|
11360
|
+
dataDateLabel,
|
|
11361
|
+
tasks
|
|
11104
11362
|
]);
|
|
11105
11363
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "today", children: [
|
|
11106
11364
|
dataDateElement,
|
|
@@ -11795,204 +12053,6 @@
|
|
|
11795
12053
|
}
|
|
11796
12054
|
);
|
|
11797
12055
|
};
|
|
11798
|
-
const getDateByOffset = (startDate, offset2, viewMode) => {
|
|
11799
|
-
switch (viewMode) {
|
|
11800
|
-
case ViewMode.Day:
|
|
11801
|
-
return addDays(startDate, offset2);
|
|
11802
|
-
case ViewMode.HalfDay:
|
|
11803
|
-
return addHours(startDate, offset2 * 12);
|
|
11804
|
-
case ViewMode.QuarterDay:
|
|
11805
|
-
return addHours(startDate, offset2 * 6);
|
|
11806
|
-
case ViewMode.Hour:
|
|
11807
|
-
return addHours(startDate, offset2);
|
|
11808
|
-
case ViewMode.Month:
|
|
11809
|
-
return addMonths(startDate, offset2);
|
|
11810
|
-
case ViewMode.Week:
|
|
11811
|
-
return addWeeks(startDate, offset2);
|
|
11812
|
-
case ViewMode.Year:
|
|
11813
|
-
return addYears(startDate, offset2);
|
|
11814
|
-
default:
|
|
11815
|
-
throw new Error("Unknown view mode");
|
|
11816
|
-
}
|
|
11817
|
-
};
|
|
11818
|
-
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11819
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11820
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11821
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11822
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11823
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11824
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11825
|
-
};
|
|
11826
|
-
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11827
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11828
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11829
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11830
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11831
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11832
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11833
|
-
};
|
|
11834
|
-
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11835
|
-
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
11836
|
-
let progressX;
|
|
11837
|
-
if (rtl) {
|
|
11838
|
-
progressX = taskX2 - progressWidth;
|
|
11839
|
-
} else {
|
|
11840
|
-
progressX = taskX1;
|
|
11841
|
-
}
|
|
11842
|
-
return [progressWidth, progressX];
|
|
11843
|
-
};
|
|
11844
|
-
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11845
|
-
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
11846
|
-
newDate = new Date(
|
|
11847
|
-
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11848
|
-
);
|
|
11849
|
-
return newDate;
|
|
11850
|
-
};
|
|
11851
|
-
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11852
|
-
let result;
|
|
11853
|
-
switch (selectedTask.type) {
|
|
11854
|
-
case "milestone":
|
|
11855
|
-
result = handleTaskBySVGMouseEventForMilestone(
|
|
11856
|
-
action,
|
|
11857
|
-
selectedTask,
|
|
11858
|
-
initialCoordinates,
|
|
11859
|
-
coordinates,
|
|
11860
|
-
xStep,
|
|
11861
|
-
timeStep
|
|
11862
|
-
);
|
|
11863
|
-
break;
|
|
11864
|
-
default:
|
|
11865
|
-
result = handleTaskBySVGMouseEventForBar(
|
|
11866
|
-
action,
|
|
11867
|
-
selectedTask,
|
|
11868
|
-
initialCoordinates,
|
|
11869
|
-
coordinates,
|
|
11870
|
-
xStep,
|
|
11871
|
-
timeStep,
|
|
11872
|
-
rtl
|
|
11873
|
-
);
|
|
11874
|
-
break;
|
|
11875
|
-
}
|
|
11876
|
-
return result;
|
|
11877
|
-
};
|
|
11878
|
-
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11879
|
-
const changedTask = { ...selectedTask };
|
|
11880
|
-
let isChanged = false;
|
|
11881
|
-
switch (action) {
|
|
11882
|
-
case "progress":
|
|
11883
|
-
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11884
|
-
if (isChanged) {
|
|
11885
|
-
changedTask.progress = Math.round(
|
|
11886
|
-
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11887
|
-
);
|
|
11888
|
-
}
|
|
11889
|
-
break;
|
|
11890
|
-
case "start": {
|
|
11891
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11892
|
-
if (isChanged) {
|
|
11893
|
-
if (rtl) {
|
|
11894
|
-
changedTask.end = dateByX(
|
|
11895
|
-
coordinates.x1,
|
|
11896
|
-
initialCoordinates.x1,
|
|
11897
|
-
selectedTask.end,
|
|
11898
|
-
xStep,
|
|
11899
|
-
timeStep
|
|
11900
|
-
);
|
|
11901
|
-
} else {
|
|
11902
|
-
changedTask.start = dateByX(
|
|
11903
|
-
coordinates.x1,
|
|
11904
|
-
initialCoordinates.x1,
|
|
11905
|
-
selectedTask.start,
|
|
11906
|
-
xStep,
|
|
11907
|
-
timeStep
|
|
11908
|
-
);
|
|
11909
|
-
}
|
|
11910
|
-
}
|
|
11911
|
-
break;
|
|
11912
|
-
}
|
|
11913
|
-
case "end": {
|
|
11914
|
-
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11915
|
-
if (isChanged) {
|
|
11916
|
-
if (rtl) {
|
|
11917
|
-
changedTask.start = dateByX(
|
|
11918
|
-
coordinates.x2,
|
|
11919
|
-
initialCoordinates.x2,
|
|
11920
|
-
selectedTask.start,
|
|
11921
|
-
xStep,
|
|
11922
|
-
timeStep
|
|
11923
|
-
);
|
|
11924
|
-
} else {
|
|
11925
|
-
changedTask.end = dateByX(
|
|
11926
|
-
coordinates.x2,
|
|
11927
|
-
initialCoordinates.x2,
|
|
11928
|
-
selectedTask.end,
|
|
11929
|
-
xStep,
|
|
11930
|
-
timeStep
|
|
11931
|
-
);
|
|
11932
|
-
}
|
|
11933
|
-
}
|
|
11934
|
-
break;
|
|
11935
|
-
}
|
|
11936
|
-
case "move": {
|
|
11937
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11938
|
-
if (isChanged) {
|
|
11939
|
-
if (rtl) {
|
|
11940
|
-
changedTask.end = dateByX(
|
|
11941
|
-
coordinates.x1,
|
|
11942
|
-
initialCoordinates.x1,
|
|
11943
|
-
selectedTask.end,
|
|
11944
|
-
xStep,
|
|
11945
|
-
timeStep
|
|
11946
|
-
);
|
|
11947
|
-
changedTask.start = dateByX(
|
|
11948
|
-
coordinates.x2,
|
|
11949
|
-
initialCoordinates.x2,
|
|
11950
|
-
selectedTask.start,
|
|
11951
|
-
xStep,
|
|
11952
|
-
timeStep
|
|
11953
|
-
);
|
|
11954
|
-
} else {
|
|
11955
|
-
changedTask.start = dateByX(
|
|
11956
|
-
coordinates.x1,
|
|
11957
|
-
initialCoordinates.x1,
|
|
11958
|
-
selectedTask.start,
|
|
11959
|
-
xStep,
|
|
11960
|
-
timeStep
|
|
11961
|
-
);
|
|
11962
|
-
changedTask.end = dateByX(
|
|
11963
|
-
coordinates.x2,
|
|
11964
|
-
initialCoordinates.x2,
|
|
11965
|
-
selectedTask.end,
|
|
11966
|
-
xStep,
|
|
11967
|
-
timeStep
|
|
11968
|
-
);
|
|
11969
|
-
}
|
|
11970
|
-
}
|
|
11971
|
-
break;
|
|
11972
|
-
}
|
|
11973
|
-
}
|
|
11974
|
-
return { isChanged, changedTask };
|
|
11975
|
-
};
|
|
11976
|
-
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11977
|
-
const changedTask = { ...selectedTask };
|
|
11978
|
-
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11979
|
-
if (isChanged) {
|
|
11980
|
-
switch (action) {
|
|
11981
|
-
case "move": {
|
|
11982
|
-
changedTask.start = dateByX(
|
|
11983
|
-
coordinates.x1,
|
|
11984
|
-
initialCoordinates.x1,
|
|
11985
|
-
selectedTask.start,
|
|
11986
|
-
xStep,
|
|
11987
|
-
timeStep
|
|
11988
|
-
);
|
|
11989
|
-
changedTask.end = changedTask.start;
|
|
11990
|
-
break;
|
|
11991
|
-
}
|
|
11992
|
-
}
|
|
11993
|
-
}
|
|
11994
|
-
return { isChanged, changedTask };
|
|
11995
|
-
};
|
|
11996
12056
|
const barWrapper = "_barWrapper_5jhkr_1";
|
|
11997
12057
|
const barHandle = "_barHandle_5jhkr_11";
|
|
11998
12058
|
const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
|
|
@@ -13386,19 +13446,15 @@
|
|
|
13386
13446
|
] });
|
|
13387
13447
|
};
|
|
13388
13448
|
const TaskGanttContent = React.memo(TaskGanttContentInner);
|
|
13389
|
-
const ganttVerticalContainer = "
|
|
13390
|
-
const horizontalContainer = "
|
|
13391
|
-
const wrapper = "
|
|
13392
|
-
const calendarDragging = "
|
|
13393
|
-
const disabled = "_disabled_15ld3_117";
|
|
13394
|
-
const disabledOverlay = "_disabledOverlay_15ld3_125";
|
|
13449
|
+
const ganttVerticalContainer = "_ganttVerticalContainer_1wr55_1";
|
|
13450
|
+
const horizontalContainer = "_horizontalContainer_1wr55_73";
|
|
13451
|
+
const wrapper = "_wrapper_1wr55_85";
|
|
13452
|
+
const calendarDragging = "_calendarDragging_1wr55_109";
|
|
13395
13453
|
const styles$2 = {
|
|
13396
13454
|
ganttVerticalContainer,
|
|
13397
13455
|
horizontalContainer,
|
|
13398
13456
|
wrapper,
|
|
13399
|
-
calendarDragging
|
|
13400
|
-
disabled,
|
|
13401
|
-
disabledOverlay
|
|
13457
|
+
calendarDragging
|
|
13402
13458
|
};
|
|
13403
13459
|
const TaskGanttInner = (props) => {
|
|
13404
13460
|
const {
|
|
@@ -13418,8 +13474,7 @@
|
|
|
13418
13474
|
onVerticalScrollbarScrollX,
|
|
13419
13475
|
verticalGanttContainerRef,
|
|
13420
13476
|
verticalScrollbarRef,
|
|
13421
|
-
onOpenGanttContextMenu
|
|
13422
|
-
isLoading = false
|
|
13477
|
+
onOpenGanttContextMenu
|
|
13423
13478
|
} = props;
|
|
13424
13479
|
const contentRef = React.useRef(null);
|
|
13425
13480
|
const moveStateVertRef = React.useRef(null);
|
|
@@ -13543,44 +13598,41 @@
|
|
|
13543
13598
|
children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { scrollRef: verticalGanttContainerRef, ...calendarProps })
|
|
13544
13599
|
}
|
|
13545
13600
|
),
|
|
13546
|
-
/* @__PURE__ */ jsxRuntime.
|
|
13601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13547
13602
|
"div",
|
|
13548
13603
|
{
|
|
13549
13604
|
ref: horizontalContainerRef,
|
|
13550
13605
|
className: styles$2.horizontalContainer,
|
|
13551
13606
|
style: containerStyle,
|
|
13552
|
-
children:
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13607
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13608
|
+
"svg",
|
|
13609
|
+
{
|
|
13610
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13611
|
+
width: fullSvgWidth,
|
|
13612
|
+
height: ganttFullHeight,
|
|
13613
|
+
fontFamily: "var(--gantt-font-family)",
|
|
13614
|
+
ref: ganttSVGRef,
|
|
13615
|
+
onContextMenu: (event) => {
|
|
13616
|
+
event.preventDefault();
|
|
13617
|
+
if (onOpenGanttContextMenu) {
|
|
13618
|
+
onOpenGanttContextMenu(event.clientX, event.clientY);
|
|
13619
|
+
}
|
|
13620
|
+
},
|
|
13621
|
+
children: [
|
|
13622
|
+
/* @__PURE__ */ jsxRuntime.jsx(GanttToday, { ...ganttTodayProps }),
|
|
13623
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13624
|
+
"rect",
|
|
13625
|
+
{
|
|
13626
|
+
ref: contentRef,
|
|
13627
|
+
width: "100%",
|
|
13628
|
+
height: "100%",
|
|
13629
|
+
fill: "transparent"
|
|
13565
13630
|
}
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
{
|
|
13572
|
-
ref: contentRef,
|
|
13573
|
-
width: "100%",
|
|
13574
|
-
height: "100%",
|
|
13575
|
-
fill: "transparent"
|
|
13576
|
-
}
|
|
13577
|
-
),
|
|
13578
|
-
/* @__PURE__ */ jsxRuntime.jsx(TaskGanttContent, { ...barProps })
|
|
13579
|
-
]
|
|
13580
|
-
}
|
|
13581
|
-
) }),
|
|
13582
|
-
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2.disabledOverlay })
|
|
13583
|
-
]
|
|
13631
|
+
),
|
|
13632
|
+
/* @__PURE__ */ jsxRuntime.jsx(TaskGanttContent, { ...barProps })
|
|
13633
|
+
]
|
|
13634
|
+
}
|
|
13635
|
+
) })
|
|
13584
13636
|
}
|
|
13585
13637
|
)
|
|
13586
13638
|
]
|
|
@@ -18050,7 +18102,7 @@
|
|
|
18050
18102
|
},
|
|
18051
18103
|
handleAction,
|
|
18052
18104
|
option,
|
|
18053
|
-
option: { icon: icon2, label: label2, disabled
|
|
18105
|
+
option: { icon: icon2, label: label2, disabled, children }
|
|
18054
18106
|
} = props;
|
|
18055
18107
|
const [hovered, setHovered] = React.useState(false);
|
|
18056
18108
|
const [coords, setCoords] = React.useState(null);
|
|
@@ -18060,7 +18112,7 @@
|
|
|
18060
18112
|
const onClick = React.useCallback(
|
|
18061
18113
|
(e) => {
|
|
18062
18114
|
e.preventDefault();
|
|
18063
|
-
if (
|
|
18115
|
+
if (disabled) {
|
|
18064
18116
|
return;
|
|
18065
18117
|
}
|
|
18066
18118
|
if (children && children.length > 0) {
|
|
@@ -18070,7 +18122,7 @@
|
|
|
18070
18122
|
handleAction(option);
|
|
18071
18123
|
onClose == null ? void 0 : onClose();
|
|
18072
18124
|
},
|
|
18073
|
-
[onClose, handleAction, option,
|
|
18125
|
+
[onClose, handleAction, option, disabled, children]
|
|
18074
18126
|
);
|
|
18075
18127
|
React.useEffect(() => {
|
|
18076
18128
|
if (!hovered || !nestedRef.current)
|
|
@@ -18130,8 +18182,8 @@
|
|
|
18130
18182
|
"button",
|
|
18131
18183
|
{
|
|
18132
18184
|
className: styles$1.menuOption,
|
|
18133
|
-
"aria-disabled":
|
|
18134
|
-
disabled
|
|
18185
|
+
"aria-disabled": disabled,
|
|
18186
|
+
disabled,
|
|
18135
18187
|
style: {
|
|
18136
18188
|
height: contextMenuOptionHeight,
|
|
18137
18189
|
paddingLeft: contextMenuSidePadding,
|
|
@@ -18148,7 +18200,7 @@
|
|
|
18148
18200
|
style: {
|
|
18149
18201
|
width: contextMenuIconWidth,
|
|
18150
18202
|
color: "var(--gantt-context-menu-text-color)",
|
|
18151
|
-
opacity:
|
|
18203
|
+
opacity: disabled ? 0.3 : 0.5
|
|
18152
18204
|
},
|
|
18153
18205
|
children: icon2
|
|
18154
18206
|
}
|
|
@@ -19015,8 +19067,7 @@
|
|
|
19015
19067
|
todayLabel = "Today",
|
|
19016
19068
|
dataDateLabel = "Data Date",
|
|
19017
19069
|
showProgress = true,
|
|
19018
|
-
progressColor
|
|
19019
|
-
isLoading = false
|
|
19070
|
+
progressColor
|
|
19020
19071
|
} = props;
|
|
19021
19072
|
const ganttSVGRef = React.useRef(null);
|
|
19022
19073
|
const wrapperRef = React.useRef(null);
|
|
@@ -20218,7 +20269,8 @@
|
|
|
20218
20269
|
todayColor,
|
|
20219
20270
|
dataDateColor,
|
|
20220
20271
|
todayLabel,
|
|
20221
|
-
dataDateLabel
|
|
20272
|
+
dataDateLabel,
|
|
20273
|
+
tasks: sortedTasks.filter((task) => task.type !== "empty")
|
|
20222
20274
|
}),
|
|
20223
20275
|
[
|
|
20224
20276
|
additionalLeftSpace,
|
|
@@ -20234,7 +20286,8 @@
|
|
|
20234
20286
|
todayColor,
|
|
20235
20287
|
dataDateColor,
|
|
20236
20288
|
todayLabel,
|
|
20237
|
-
dataDateLabel
|
|
20289
|
+
dataDateLabel,
|
|
20290
|
+
sortedTasks
|
|
20238
20291
|
]
|
|
20239
20292
|
);
|
|
20240
20293
|
const calendarProps = React.useMemo(
|
|
@@ -20379,8 +20432,7 @@
|
|
|
20379
20432
|
taskListContainerRef,
|
|
20380
20433
|
taskListRef,
|
|
20381
20434
|
tasks: visibleTasks,
|
|
20382
|
-
ganttRef: wrapperRef
|
|
20383
|
-
isLoading
|
|
20435
|
+
ganttRef: wrapperRef
|
|
20384
20436
|
}),
|
|
20385
20437
|
[
|
|
20386
20438
|
childTasksMap,
|
|
@@ -20409,8 +20461,7 @@
|
|
|
20409
20461
|
selectedIdsMirror,
|
|
20410
20462
|
taskList,
|
|
20411
20463
|
taskListContainerRef,
|
|
20412
|
-
visibleTasks
|
|
20413
|
-
isLoading
|
|
20464
|
+
visibleTasks
|
|
20414
20465
|
]
|
|
20415
20466
|
);
|
|
20416
20467
|
return /* @__PURE__ */ jsxRuntime.jsx(GanttThemeProvider, { theme, children: (cssVars) => /* @__PURE__ */ jsxRuntime.jsx(GanttLocaleProvider, { locale, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -20448,8 +20499,7 @@
|
|
|
20448
20499
|
verticalGanttContainerRef,
|
|
20449
20500
|
onOpenGanttContextMenu: (clientX, clientY) => {
|
|
20450
20501
|
handleOpenGanttContextMenu(null, clientX, clientY);
|
|
20451
|
-
}
|
|
20452
|
-
isLoading
|
|
20502
|
+
}
|
|
20453
20503
|
}
|
|
20454
20504
|
),
|
|
20455
20505
|
tooltipTaskFromMap && /* @__PURE__ */ jsxRuntime.jsx(
|