@uipath/apollo-react 7.17.4 → 7.19.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/canvas/components/BaseNode/BaseNode.cjs +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -2
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +3 -4
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +4 -5
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.cjs +3 -7
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.d.ts.map +1 -1
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.js +4 -8
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.cjs +59 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.d.ts +2 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.d.ts.map +1 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.js +25 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/AddRuleButton.cjs +49 -0
- package/dist/decision-table/AddRuleButton.d.ts +7 -0
- package/dist/decision-table/AddRuleButton.d.ts.map +1 -0
- package/dist/decision-table/AddRuleButton.js +15 -0
- package/dist/decision-table/AddRuleFooter.cjs +46 -0
- package/dist/decision-table/AddRuleFooter.d.ts +9 -0
- package/dist/decision-table/AddRuleFooter.d.ts.map +1 -0
- package/dist/decision-table/AddRuleFooter.js +12 -0
- package/dist/decision-table/BandColumn.cjs +66 -0
- package/dist/decision-table/BandColumn.d.ts +12 -0
- package/dist/decision-table/BandColumn.d.ts.map +1 -0
- package/dist/decision-table/BandColumn.js +32 -0
- package/dist/decision-table/BandList.cjs +54 -0
- package/dist/decision-table/BandList.d.ts +12 -0
- package/dist/decision-table/BandList.d.ts.map +1 -0
- package/dist/decision-table/BandList.js +20 -0
- package/dist/decision-table/CellTextEditor.cjs +78 -0
- package/dist/decision-table/CellTextEditor.d.ts +8 -0
- package/dist/decision-table/CellTextEditor.d.ts.map +1 -0
- package/dist/decision-table/CellTextEditor.js +44 -0
- package/dist/decision-table/ConditionLine.cjs +66 -0
- package/dist/decision-table/ConditionLine.d.ts +12 -0
- package/dist/decision-table/ConditionLine.d.ts.map +1 -0
- package/dist/decision-table/ConditionLine.js +32 -0
- package/dist/decision-table/DecisionText.cjs +168 -0
- package/dist/decision-table/DecisionText.d.ts +44 -0
- package/dist/decision-table/DecisionText.d.ts.map +1 -0
- package/dist/decision-table/DecisionText.js +134 -0
- package/dist/decision-table/DecisionTextHeader.cjs +73 -0
- package/dist/decision-table/DecisionTextHeader.d.ts +13 -0
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -0
- package/dist/decision-table/DecisionTextHeader.js +39 -0
- package/dist/decision-table/EmptyRules.cjs +51 -0
- package/dist/decision-table/EmptyRules.d.ts +9 -0
- package/dist/decision-table/EmptyRules.d.ts.map +1 -0
- package/dist/decision-table/EmptyRules.js +17 -0
- package/dist/decision-table/GridCell.cjs +11 -31
- package/dist/decision-table/GridCell.d.ts +1 -9
- package/dist/decision-table/GridCell.d.ts.map +1 -1
- package/dist/decision-table/GridCell.js +12 -32
- package/dist/decision-table/LineLead.cjs +58 -0
- package/dist/decision-table/LineLead.d.ts +10 -0
- package/dist/decision-table/LineLead.d.ts.map +1 -0
- package/dist/decision-table/LineLead.js +24 -0
- package/dist/decision-table/LineText.cjs +109 -0
- package/dist/decision-table/LineText.d.ts +20 -0
- package/dist/decision-table/LineText.d.ts.map +1 -0
- package/dist/decision-table/LineText.js +75 -0
- package/dist/decision-table/MarkBadge.cjs +66 -0
- package/dist/decision-table/MarkBadge.d.ts +13 -0
- package/dist/decision-table/MarkBadge.d.ts.map +1 -0
- package/dist/decision-table/MarkBadge.js +29 -0
- package/dist/decision-table/PolicyOptionItem.cjs +121 -0
- package/dist/decision-table/PolicyOptionItem.d.ts +16 -0
- package/dist/decision-table/PolicyOptionItem.d.ts.map +1 -0
- package/dist/decision-table/PolicyOptionItem.js +84 -0
- package/dist/decision-table/PolicyPicker.cjs +110 -0
- package/dist/decision-table/PolicyPicker.d.ts +17 -0
- package/dist/decision-table/PolicyPicker.d.ts.map +1 -0
- package/dist/decision-table/PolicyPicker.js +76 -0
- package/dist/decision-table/RemoveConditionButton.cjs +52 -0
- package/dist/decision-table/RemoveConditionButton.d.ts +7 -0
- package/dist/decision-table/RemoveConditionButton.d.ts.map +1 -0
- package/dist/decision-table/RemoveConditionButton.js +18 -0
- package/dist/decision-table/RuleActions.cjs +76 -0
- package/dist/decision-table/RuleActions.d.ts +15 -0
- package/dist/decision-table/RuleActions.d.ts.map +1 -0
- package/dist/decision-table/RuleActions.js +42 -0
- package/dist/decision-table/RuleCard.cjs +123 -0
- package/dist/decision-table/RuleCard.d.ts +14 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -0
- package/dist/decision-table/RuleCard.js +89 -0
- package/dist/decision-table/RuleLine.cjs +56 -0
- package/dist/decision-table/RuleLine.d.ts +12 -0
- package/dist/decision-table/RuleLine.d.ts.map +1 -0
- package/dist/decision-table/RuleLine.js +22 -0
- package/dist/decision-table/RuleList.cjs +73 -0
- package/dist/decision-table/RuleList.d.ts +28 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -0
- package/dist/decision-table/RuleList.js +39 -0
- package/dist/decision-table/SentenceBands.cjs +60 -0
- package/dist/decision-table/SentenceBands.d.ts +12 -0
- package/dist/decision-table/SentenceBands.d.ts.map +1 -0
- package/dist/decision-table/SentenceBands.js +26 -0
- package/dist/decision-table/StopLabels.cjs +43 -0
- package/dist/decision-table/StopLabels.d.ts +7 -0
- package/dist/decision-table/StopLabels.d.ts.map +1 -0
- package/dist/decision-table/StopLabels.js +9 -0
- package/dist/decision-table/TokenChip.cjs +87 -0
- package/dist/decision-table/TokenChip.d.ts +24 -0
- package/dist/decision-table/TokenChip.d.ts.map +1 -0
- package/dist/decision-table/TokenChip.js +53 -0
- package/dist/decision-table/ValueEditorOverlay.cjs +71 -0
- package/dist/decision-table/ValueEditorOverlay.d.ts +11 -0
- package/dist/decision-table/ValueEditorOverlay.d.ts.map +1 -0
- package/dist/decision-table/ValueEditorOverlay.js +37 -0
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +37 -0
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +30 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -0
- package/dist/decision-table/decisionTextTypes.cjs +18 -0
- package/dist/decision-table/decisionTextTypes.d.ts +21 -0
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -0
- package/dist/decision-table/decisionTextTypes.js +0 -0
- package/dist/decision-table/gridEvents.cjs +46 -2
- package/dist/decision-table/gridEvents.d.ts +4 -0
- package/dist/decision-table/gridEvents.d.ts.map +1 -1
- package/dist/decision-table/gridEvents.js +33 -1
- package/dist/decision-table/gridTypes.d.ts +8 -0
- package/dist/decision-table/gridTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +63 -55
- package/dist/decision-table/index.d.ts +11 -1
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -1
- package/dist/decision-table/ruleCardModel.cjs +171 -0
- package/dist/decision-table/ruleCardModel.d.ts +52 -0
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -0
- package/dist/decision-table/ruleCardModel.js +131 -0
- package/dist/decision-table/sentenceMarks.cjs +89 -0
- package/dist/decision-table/sentenceMarks.d.ts +27 -0
- package/dist/decision-table/sentenceMarks.d.ts.map +1 -0
- package/dist/decision-table/sentenceMarks.js +43 -0
- package/dist/decision-table/sentenceParts.cjs +133 -0
- package/dist/decision-table/sentenceParts.d.ts +24 -0
- package/dist/decision-table/sentenceParts.d.ts.map +1 -0
- package/dist/decision-table/sentenceParts.js +66 -0
- package/dist/decision-table/sentenceRuleHeights.cjs +70 -0
- package/dist/decision-table/sentenceRuleHeights.d.ts +7 -0
- package/dist/decision-table/sentenceRuleHeights.d.ts.map +1 -0
- package/dist/decision-table/sentenceRuleHeights.js +30 -0
- package/dist/decision-table/sentenceStyles.cjs +239 -0
- package/dist/decision-table/sentenceStyles.d.ts +56 -0
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -0
- package/dist/decision-table/sentenceStyles.js +64 -0
- package/dist/decision-table/sentenceTargets.cjs +158 -0
- package/dist/decision-table/sentenceTargets.d.ts +33 -0
- package/dist/decision-table/sentenceTargets.d.ts.map +1 -0
- package/dist/decision-table/sentenceTargets.js +94 -0
- package/dist/decision-table/sentenceTypes.cjs +18 -0
- package/dist/decision-table/sentenceTypes.d.ts +49 -0
- package/dist/decision-table/sentenceTypes.d.ts.map +1 -0
- package/dist/decision-table/sentenceTypes.js +0 -0
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useAddRule.cjs +63 -0
- package/dist/decision-table/useAddRule.d.ts +8 -0
- package/dist/decision-table/useAddRule.d.ts.map +1 -0
- package/dist/decision-table/useAddRule.js +29 -0
- package/dist/decision-table/useCellHover.cjs +55 -0
- package/dist/decision-table/useCellHover.d.ts +4 -0
- package/dist/decision-table/useCellHover.d.ts.map +1 -0
- package/dist/decision-table/useCellHover.js +21 -0
- package/dist/decision-table/useContainerHandlers.cjs +140 -0
- package/dist/decision-table/useContainerHandlers.d.ts +299 -0
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -0
- package/dist/decision-table/useContainerHandlers.js +106 -0
- package/dist/decision-table/useEditorPlacement.cjs +104 -0
- package/dist/decision-table/useEditorPlacement.d.ts +17 -0
- package/dist/decision-table/useEditorPlacement.d.ts.map +1 -0
- package/dist/decision-table/useEditorPlacement.js +70 -0
- package/dist/decision-table/useGridLayout.d.ts +1 -8
- package/dist/decision-table/useGridLayout.d.ts.map +1 -1
- package/dist/decision-table/useGridNavigation.cjs +11 -2
- package/dist/decision-table/useGridNavigation.d.ts +3 -0
- package/dist/decision-table/useGridNavigation.d.ts.map +1 -1
- package/dist/decision-table/useGridNavigation.js +1 -1
- package/dist/decision-table/useHorizontalOverflow.cjs +65 -0
- package/dist/decision-table/useHorizontalOverflow.d.ts +5 -0
- package/dist/decision-table/useHorizontalOverflow.d.ts.map +1 -0
- package/dist/decision-table/useHorizontalOverflow.js +31 -0
- package/dist/decision-table/useRuleMenus.cjs +149 -0
- package/dist/decision-table/useRuleMenus.d.ts +24 -0
- package/dist/decision-table/useRuleMenus.d.ts.map +1 -0
- package/dist/decision-table/useRuleMenus.js +115 -0
- package/dist/decision-table/useRuleWindow.cjs +136 -0
- package/dist/decision-table/useRuleWindow.d.ts +17 -0
- package/dist/decision-table/useRuleWindow.d.ts.map +1 -0
- package/dist/decision-table/useRuleWindow.js +99 -0
- package/dist/decision-table/useSentenceNavigation.cjs +224 -0
- package/dist/decision-table/useSentenceNavigation.d.ts +21 -0
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -0
- package/dist/decision-table/useSentenceNavigation.js +187 -0
- package/dist/decision-table/useValueEditing.cjs +306 -0
- package/dist/decision-table/useValueEditing.d.ts +34 -0
- package/dist/decision-table/useValueEditing.d.ts.map +1 -0
- package/dist/decision-table/useValueEditing.js +272 -0
- package/dist/decision-table/useVirtualizedAxis.cjs +34 -11
- package/dist/decision-table/useVirtualizedAxis.d.ts +1 -1
- package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -1
- package/dist/decision-table/useVirtualizedAxis.js +34 -11
- package/dist/decision-table/valueTypes.cjs +18 -0
- package/dist/decision-table/valueTypes.d.ts +6 -0
- package/dist/decision-table/valueTypes.d.ts.map +1 -0
- package/dist/decision-table/valueTypes.js +0 -0
- package/package.json +4 -4
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { hasLostFocus, onNextGesture } from "./gridEvents.js";
|
|
3
|
+
import { clickedDecision, clickedSelection, stopDecisionOf, valueTokenAt } from "./sentenceTargets.js";
|
|
4
|
+
import { isIgnoredKey } from "./useSentenceNavigation.js";
|
|
5
|
+
const isTabOnView = (event)=>'Tab' === event.key && !event.shiftKey && event.target === event.currentTarget;
|
|
6
|
+
const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable })=>{
|
|
7
|
+
const focusWithinRef = useRef(false);
|
|
8
|
+
const pressedRef = useRef(false);
|
|
9
|
+
const stopPressRef = useRef(null);
|
|
10
|
+
const [focusInside, setFocusInside] = useState(false);
|
|
11
|
+
useEffect(()=>{
|
|
12
|
+
const view = container();
|
|
13
|
+
if (focusWithinRef.current && view && hasLostFocus(view)) view.focus();
|
|
14
|
+
});
|
|
15
|
+
useEffect(()=>()=>stopPressRef.current?.(), []);
|
|
16
|
+
const endPress = ()=>{
|
|
17
|
+
stopPressRef.current?.();
|
|
18
|
+
stopPressRef.current = null;
|
|
19
|
+
pressedRef.current = false;
|
|
20
|
+
};
|
|
21
|
+
const { onPointerOver: consumerPointerOver, onPointerOut: consumerPointerOut, onKeyDown: consumerKeyDown, onFocus: consumerFocus, onBlur: consumerBlur, onClick: consumerClick, onPointerDown: consumerPointerDown, onPointerUp: consumerPointerUp, onMouseUp: consumerMouseUp, onPointerCancel: consumerPointerCancel, onContextMenu: consumerContextMenu, ...restContainerProps } = containerProps ?? {};
|
|
22
|
+
const onPointerOver = (event)=>{
|
|
23
|
+
hoverTo(valueTokenAt(event.target));
|
|
24
|
+
consumerPointerOver?.(event);
|
|
25
|
+
};
|
|
26
|
+
const onPointerDown = (event)=>{
|
|
27
|
+
pressedRef.current = true;
|
|
28
|
+
stopPressRef.current = onNextGesture(event.currentTarget, endPress);
|
|
29
|
+
valueEditing.onPointerDown(event);
|
|
30
|
+
consumerPointerDown?.(event);
|
|
31
|
+
};
|
|
32
|
+
const onPointerUp = (event)=>{
|
|
33
|
+
valueEditing.onRelease();
|
|
34
|
+
consumerPointerUp?.(event);
|
|
35
|
+
};
|
|
36
|
+
const onMouseUp = (event)=>{
|
|
37
|
+
valueEditing.onRelease();
|
|
38
|
+
consumerMouseUp?.(event);
|
|
39
|
+
};
|
|
40
|
+
const onPointerCancel = (event)=>{
|
|
41
|
+
endPress();
|
|
42
|
+
consumerPointerCancel?.(event);
|
|
43
|
+
};
|
|
44
|
+
const onContextMenu = (event)=>{
|
|
45
|
+
valueEditing.forgetPress();
|
|
46
|
+
consumerContextMenu?.(event);
|
|
47
|
+
};
|
|
48
|
+
const onPointerOut = (event)=>{
|
|
49
|
+
const to = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
50
|
+
if (!event.currentTarget.contains(to)) hoverTo(null);
|
|
51
|
+
consumerPointerOut?.(event);
|
|
52
|
+
};
|
|
53
|
+
const openDecision = (event, decisionId)=>{
|
|
54
|
+
if (!onOpenDecision || void 0 === decisionId) return false;
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
onOpenDecision(decisionId);
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
const openStopDecision = (event)=>'Enter' === event.key && event.altKey && !isIgnoredKey(event) && openDecision(event, stopDecisionOf(event.target));
|
|
60
|
+
const onKeyDown = (event)=>{
|
|
61
|
+
if (!event.repeat) valueEditing.forgetPress();
|
|
62
|
+
if (stopTabbable && isTabOnView(event)) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
navigation.refocus();
|
|
65
|
+
} else if (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event)) return;
|
|
66
|
+
consumerKeyDown?.(event);
|
|
67
|
+
};
|
|
68
|
+
const onFocus = (event)=>{
|
|
69
|
+
const entered = !focusWithinRef.current && event.target === event.currentTarget;
|
|
70
|
+
focusWithinRef.current = true;
|
|
71
|
+
setFocusInside(true);
|
|
72
|
+
if (entered && stopTabbable && !pressedRef.current) navigation.refocus();
|
|
73
|
+
consumerFocus?.(event);
|
|
74
|
+
};
|
|
75
|
+
const onBlur = (event)=>{
|
|
76
|
+
if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) {
|
|
77
|
+
focusWithinRef.current = false;
|
|
78
|
+
endPress();
|
|
79
|
+
if (event.relatedTarget instanceof Node) valueEditing.forgetPress();
|
|
80
|
+
setFocusInside(false);
|
|
81
|
+
}
|
|
82
|
+
consumerBlur?.(event);
|
|
83
|
+
};
|
|
84
|
+
const onClick = (event)=>{
|
|
85
|
+
const claimed = valueEditing.takeRecoveredClick(event) || openDecision(event, clickedDecision(event.target)) || ruleMenus.onClick(event) || valueEditing.onClick(event);
|
|
86
|
+
const selection = claimed ? null : clickedSelection(event.target);
|
|
87
|
+
if (selection) navigation.select(selection, void 0, false);
|
|
88
|
+
consumerClick?.(event);
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
...restContainerProps,
|
|
92
|
+
tabIndex: stopTabbable && focusInside ? -1 : 0,
|
|
93
|
+
onPointerOver,
|
|
94
|
+
onPointerDown,
|
|
95
|
+
onPointerUp,
|
|
96
|
+
onMouseUp,
|
|
97
|
+
onPointerCancel,
|
|
98
|
+
onContextMenu,
|
|
99
|
+
onPointerOut,
|
|
100
|
+
onKeyDown,
|
|
101
|
+
onFocus,
|
|
102
|
+
onBlur,
|
|
103
|
+
onClick
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export { useContainerHandlers };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useEditorPlacement: ()=>useEditorPlacement
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
31
|
+
const anchorOf = (section, target)=>{
|
|
32
|
+
const card = (0, external_sentenceTargets_cjs_namespaceObject.cardOf)(section, target.rowId);
|
|
33
|
+
return card && ((0, external_sentenceTargets_cjs_namespaceObject.valueChipOf)(card, target) ?? (0, external_sentenceTargets_cjs_namespaceObject.cellOf)(card, target.columnId) ?? (0, external_sentenceTargets_cjs_namespaceObject.addConditionOf)(card) ?? card);
|
|
34
|
+
};
|
|
35
|
+
const placementOf = (section, target, overlay)=>{
|
|
36
|
+
const anchor = section && anchorOf(section, target);
|
|
37
|
+
if (!section || !anchor) return {
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0
|
|
40
|
+
};
|
|
41
|
+
const frame = section.getBoundingClientRect();
|
|
42
|
+
const box = anchor.getBoundingClientRect();
|
|
43
|
+
const margin = Number.parseFloat(getComputedStyle(overlay).marginTop) || 0;
|
|
44
|
+
const height = overlay.offsetHeight + margin;
|
|
45
|
+
const fitsBelow = box.bottom + height <= frame.top + section.clientHeight;
|
|
46
|
+
const fitsAbove = box.top - height >= frame.top;
|
|
47
|
+
const top = fitsBelow || !fitsAbove ? box.bottom : box.top - height - margin;
|
|
48
|
+
const left = Math.min(box.left - frame.left, section.clientWidth - overlay.offsetWidth);
|
|
49
|
+
return {
|
|
50
|
+
top: top - frame.top + section.scrollTop,
|
|
51
|
+
left: Math.max(0, left) + section.scrollLeft
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const samePlacement = (left, right)=>left?.top === right.top && left?.left === right.left;
|
|
55
|
+
const useEditorPlacement = ({ container, target })=>{
|
|
56
|
+
const overlayRef = (0, external_react_namespaceObject.useRef)(null);
|
|
57
|
+
const [placement, setPlacement] = (0, external_react_namespaceObject.useState)(null);
|
|
58
|
+
const targetRef = (0, external_react_namespaceObject.useRef)(target);
|
|
59
|
+
targetRef.current = target;
|
|
60
|
+
const place = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
61
|
+
const overlay = overlayRef.current;
|
|
62
|
+
if (!overlay) return;
|
|
63
|
+
const next = placementOf(container(), targetRef.current, overlay);
|
|
64
|
+
setPlacement((current)=>samePlacement(current, next) ? current : next);
|
|
65
|
+
}, [
|
|
66
|
+
container
|
|
67
|
+
]);
|
|
68
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>place());
|
|
69
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
70
|
+
const section = container();
|
|
71
|
+
const overlay = overlayRef.current;
|
|
72
|
+
const resizes = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(place);
|
|
73
|
+
if (section) resizes?.observe(section);
|
|
74
|
+
if (overlay) resizes?.observe(overlay);
|
|
75
|
+
let frame = 0;
|
|
76
|
+
const placeNextFrame = ()=>{
|
|
77
|
+
cancelAnimationFrame(frame);
|
|
78
|
+
frame = requestAnimationFrame(place);
|
|
79
|
+
};
|
|
80
|
+
section?.addEventListener('scroll', placeNextFrame, true);
|
|
81
|
+
const fonts = document.fonts;
|
|
82
|
+
fonts?.addEventListener('loadingdone', placeNextFrame);
|
|
83
|
+
return ()=>{
|
|
84
|
+
resizes?.disconnect();
|
|
85
|
+
section?.removeEventListener('scroll', placeNextFrame, true);
|
|
86
|
+
fonts?.removeEventListener('loadingdone', placeNextFrame);
|
|
87
|
+
cancelAnimationFrame(frame);
|
|
88
|
+
};
|
|
89
|
+
}, [
|
|
90
|
+
container,
|
|
91
|
+
place
|
|
92
|
+
]);
|
|
93
|
+
return {
|
|
94
|
+
overlayRef,
|
|
95
|
+
placement
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
exports.useEditorPlacement = __webpack_exports__.useEditorPlacement;
|
|
99
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
100
|
+
"useEditorPlacement"
|
|
101
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
102
|
+
Object.defineProperty(exports, '__esModule', {
|
|
103
|
+
value: true
|
|
104
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SentenceValueId } from './sentenceTypes';
|
|
3
|
+
import type { RuleWindow } from './useRuleWindow';
|
|
4
|
+
export interface EditorPlacementParams {
|
|
5
|
+
container: RuleWindow['container'];
|
|
6
|
+
target: SentenceValueId;
|
|
7
|
+
}
|
|
8
|
+
export interface EditorPlacement {
|
|
9
|
+
top: number;
|
|
10
|
+
left: number;
|
|
11
|
+
}
|
|
12
|
+
export interface EditorPlacementResult {
|
|
13
|
+
overlayRef: React.RefObject<HTMLFieldSetElement | null>;
|
|
14
|
+
placement: EditorPlacement | null;
|
|
15
|
+
}
|
|
16
|
+
export declare const useEditorPlacement: ({ container, target, }: EditorPlacementParams) => EditorPlacementResult;
|
|
17
|
+
//# sourceMappingURL=useEditorPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorPlacement.d.ts","sourceRoot":"","sources":["../../src/decision-table/useEditorPlacement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,eAAe,CAAC;CACzB;AAGD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAExD,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;CACnC;AAqCD,eAAO,MAAM,kBAAkB,GAAI,wBAGhC,qBAAqB,KAAG,qBAqC1B,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { addConditionOf, cardOf, cellOf, valueChipOf } from "./sentenceTargets.js";
|
|
3
|
+
const anchorOf = (section, target)=>{
|
|
4
|
+
const card = cardOf(section, target.rowId);
|
|
5
|
+
return card && (valueChipOf(card, target) ?? cellOf(card, target.columnId) ?? addConditionOf(card) ?? card);
|
|
6
|
+
};
|
|
7
|
+
const placementOf = (section, target, overlay)=>{
|
|
8
|
+
const anchor = section && anchorOf(section, target);
|
|
9
|
+
if (!section || !anchor) return {
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0
|
|
12
|
+
};
|
|
13
|
+
const frame = section.getBoundingClientRect();
|
|
14
|
+
const box = anchor.getBoundingClientRect();
|
|
15
|
+
const margin = Number.parseFloat(getComputedStyle(overlay).marginTop) || 0;
|
|
16
|
+
const height = overlay.offsetHeight + margin;
|
|
17
|
+
const fitsBelow = box.bottom + height <= frame.top + section.clientHeight;
|
|
18
|
+
const fitsAbove = box.top - height >= frame.top;
|
|
19
|
+
const top = fitsBelow || !fitsAbove ? box.bottom : box.top - height - margin;
|
|
20
|
+
const left = Math.min(box.left - frame.left, section.clientWidth - overlay.offsetWidth);
|
|
21
|
+
return {
|
|
22
|
+
top: top - frame.top + section.scrollTop,
|
|
23
|
+
left: Math.max(0, left) + section.scrollLeft
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const samePlacement = (left, right)=>left?.top === right.top && left?.left === right.left;
|
|
27
|
+
const useEditorPlacement = ({ container, target })=>{
|
|
28
|
+
const overlayRef = useRef(null);
|
|
29
|
+
const [placement, setPlacement] = useState(null);
|
|
30
|
+
const targetRef = useRef(target);
|
|
31
|
+
targetRef.current = target;
|
|
32
|
+
const place = useCallback(()=>{
|
|
33
|
+
const overlay = overlayRef.current;
|
|
34
|
+
if (!overlay) return;
|
|
35
|
+
const next = placementOf(container(), targetRef.current, overlay);
|
|
36
|
+
setPlacement((current)=>samePlacement(current, next) ? current : next);
|
|
37
|
+
}, [
|
|
38
|
+
container
|
|
39
|
+
]);
|
|
40
|
+
useLayoutEffect(()=>place());
|
|
41
|
+
useLayoutEffect(()=>{
|
|
42
|
+
const section = container();
|
|
43
|
+
const overlay = overlayRef.current;
|
|
44
|
+
const resizes = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(place);
|
|
45
|
+
if (section) resizes?.observe(section);
|
|
46
|
+
if (overlay) resizes?.observe(overlay);
|
|
47
|
+
let frame = 0;
|
|
48
|
+
const placeNextFrame = ()=>{
|
|
49
|
+
cancelAnimationFrame(frame);
|
|
50
|
+
frame = requestAnimationFrame(place);
|
|
51
|
+
};
|
|
52
|
+
section?.addEventListener('scroll', placeNextFrame, true);
|
|
53
|
+
const fonts = document.fonts;
|
|
54
|
+
fonts?.addEventListener('loadingdone', placeNextFrame);
|
|
55
|
+
return ()=>{
|
|
56
|
+
resizes?.disconnect();
|
|
57
|
+
section?.removeEventListener('scroll', placeNextFrame, true);
|
|
58
|
+
fonts?.removeEventListener('loadingdone', placeNextFrame);
|
|
59
|
+
cancelAnimationFrame(frame);
|
|
60
|
+
};
|
|
61
|
+
}, [
|
|
62
|
+
container,
|
|
63
|
+
place
|
|
64
|
+
]);
|
|
65
|
+
return {
|
|
66
|
+
overlayRef,
|
|
67
|
+
placement
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export { useEditorPlacement };
|
|
@@ -26,14 +26,7 @@ export declare const useGridLayout: ({ columns, rowCount, rowHeightPx, leadingCo
|
|
|
26
26
|
trailingColumnWidth: number;
|
|
27
27
|
containerRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
28
28
|
visibleColumns: VisibleGridColumn[];
|
|
29
|
-
rowSegments: (
|
|
30
|
-
type: "items";
|
|
31
|
-
from: number;
|
|
32
|
-
to: number;
|
|
33
|
-
} | {
|
|
34
|
-
type: "spacer";
|
|
35
|
-
sizePx: number;
|
|
36
|
-
})[];
|
|
29
|
+
rowSegments: import("./useVirtualizedAxis").AxisSegment[];
|
|
37
30
|
theadRef: (element: HTMLTableSectionElement | null) => void;
|
|
38
31
|
attachContainer: (element: HTMLDivElement | null) => void;
|
|
39
32
|
setTableElement: (table: HTMLTableElement | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGridLayout.d.ts","sourceRoot":"","sources":["../../src/decision-table/useGridLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAY,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAI3E,UAAU,iBAAiB;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,EAAE,MAAM,CAAC;IAEpB,kBAAkB,EAAE,MAAM,CAAC;IAE3B,mBAAmB,EAAE,MAAM,CAAC;IAE5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,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AAC,KAAK,IAAI,CAAC;IAEhE,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAE5D,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAWD,eAAO,MAAM,oBAAoB,GAAI,SAAS,UAAU,EAAE,EAAE,oBAAe,KAAG,GAAG,CAAC,MAAM,CASvF,CAAC;AA6BF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAa1D,eAAO,MAAM,aAAa,GAAI,iMAY3B,iBAAiB;;;;;;;;;;;;wBAwCqB,uBAAuB,GAAG,IAAI;+BAoJzD,cAAc,GAAG,IAAI;;;;kCAbpB,MAAM;wCAIH,MAAM;;;;CAwCvB,CAAC"}
|
|
@@ -24,8 +24,11 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
useGridNavigation: ()=>useGridNavigation,
|
|
28
|
+
clamp: ()=>clamp,
|
|
29
|
+
GRID_ENTRY_KEYS: ()=>GRID_ENTRY_KEYS,
|
|
30
|
+
ARROW_DELTAS: ()=>ARROW_DELTAS,
|
|
31
|
+
normalizedRect: ()=>normalizedRect
|
|
29
32
|
});
|
|
30
33
|
const external_react_namespaceObject = require("react");
|
|
31
34
|
const external_react_dom_namespaceObject = require("react-dom");
|
|
@@ -430,9 +433,15 @@ const useGridNavigation = ({ table, rowIds, colIds }, options = {})=>{
|
|
|
430
433
|
onKeyDown
|
|
431
434
|
};
|
|
432
435
|
};
|
|
436
|
+
exports.ARROW_DELTAS = __webpack_exports__.ARROW_DELTAS;
|
|
437
|
+
exports.GRID_ENTRY_KEYS = __webpack_exports__.GRID_ENTRY_KEYS;
|
|
438
|
+
exports.clamp = __webpack_exports__.clamp;
|
|
433
439
|
exports.normalizedRect = __webpack_exports__.normalizedRect;
|
|
434
440
|
exports.useGridNavigation = __webpack_exports__.useGridNavigation;
|
|
435
441
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
442
|
+
"ARROW_DELTAS",
|
|
443
|
+
"GRID_ENTRY_KEYS",
|
|
444
|
+
"clamp",
|
|
436
445
|
"normalizedRect",
|
|
437
446
|
"useGridNavigation"
|
|
438
447
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -47,6 +47,9 @@ export interface GridNavigation {
|
|
|
47
47
|
cancelEdit: () => void;
|
|
48
48
|
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
49
49
|
}
|
|
50
|
+
export declare const clamp: (value: number, max: number) => number;
|
|
51
|
+
export declare const GRID_ENTRY_KEYS: readonly string[];
|
|
52
|
+
export declare const ARROW_DELTAS: Readonly<Record<string, GridPosition | undefined>>;
|
|
50
53
|
export interface GridNavigationOptions {
|
|
51
54
|
onSelectionReplaced?: (gesture: SelectionGesture) => void;
|
|
52
55
|
canEditAt?: (position: GridPosition, gesture: EditGesture) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGridNavigation.d.ts","sourceRoot":"","sources":["../../src/decision-table/useGridNavigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3E,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AAOxC,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACnC;AACD,MAAM,MAAM,kBAAkB,GAAG,KAAK,C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_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useHorizontalOverflow: ()=>useHorizontalOverflow
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const useHorizontalOverflow = ()=>{
|
|
31
|
+
const ref = (0, external_react_namespaceObject.useRef)(null);
|
|
32
|
+
const [overflows, setOverflows] = (0, external_react_namespaceObject.useState)(false);
|
|
33
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
34
|
+
const element = ref.current;
|
|
35
|
+
if (!element) return;
|
|
36
|
+
const measure = ()=>setOverflows(element.scrollWidth > element.clientWidth);
|
|
37
|
+
const resizes = new ResizeObserver(measure);
|
|
38
|
+
const observe = ()=>{
|
|
39
|
+
resizes.disconnect();
|
|
40
|
+
resizes.observe(element);
|
|
41
|
+
for (const child of element.children)resizes.observe(child);
|
|
42
|
+
measure();
|
|
43
|
+
};
|
|
44
|
+
const mutations = new MutationObserver(observe);
|
|
45
|
+
observe();
|
|
46
|
+
mutations.observe(element, {
|
|
47
|
+
childList: true
|
|
48
|
+
});
|
|
49
|
+
return ()=>{
|
|
50
|
+
mutations.disconnect();
|
|
51
|
+
resizes.disconnect();
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
return {
|
|
55
|
+
ref,
|
|
56
|
+
overflows
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.useHorizontalOverflow = __webpack_exports__.useHorizontalOverflow;
|
|
60
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
+
"useHorizontalOverflow"
|
|
62
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
|
+
Object.defineProperty(exports, '__esModule', {
|
|
64
|
+
value: true
|
|
65
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHorizontalOverflow.d.ts","sourceRoot":"","sources":["../../src/decision-table/useHorizontalOverflow.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,WAAW;;;CAuB1D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
const useHorizontalOverflow = ()=>{
|
|
3
|
+
const ref = useRef(null);
|
|
4
|
+
const [overflows, setOverflows] = useState(false);
|
|
5
|
+
useLayoutEffect(()=>{
|
|
6
|
+
const element = ref.current;
|
|
7
|
+
if (!element) return;
|
|
8
|
+
const measure = ()=>setOverflows(element.scrollWidth > element.clientWidth);
|
|
9
|
+
const resizes = new ResizeObserver(measure);
|
|
10
|
+
const observe = ()=>{
|
|
11
|
+
resizes.disconnect();
|
|
12
|
+
resizes.observe(element);
|
|
13
|
+
for (const child of element.children)resizes.observe(child);
|
|
14
|
+
measure();
|
|
15
|
+
};
|
|
16
|
+
const mutations = new MutationObserver(observe);
|
|
17
|
+
observe();
|
|
18
|
+
mutations.observe(element, {
|
|
19
|
+
childList: true
|
|
20
|
+
});
|
|
21
|
+
return ()=>{
|
|
22
|
+
mutations.disconnect();
|
|
23
|
+
resizes.disconnect();
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
return {
|
|
27
|
+
ref,
|
|
28
|
+
overflows
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export { useHorizontalOverflow };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useRuleMenus: ()=>useRuleMenus
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
31
|
+
const menuLabel = (edit, state, position)=>{
|
|
32
|
+
if (!edit || !state) return '';
|
|
33
|
+
return 'rule' === state.menu ? edit.labels.ruleActions(position) : edit.labels.addCondition(position);
|
|
34
|
+
};
|
|
35
|
+
const anchorOf = (trigger)=>{
|
|
36
|
+
const { left, bottom } = trigger.getBoundingClientRect();
|
|
37
|
+
return {
|
|
38
|
+
x: left,
|
|
39
|
+
y: bottom
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const movedAnchor = ({ trigger, anchor })=>{
|
|
43
|
+
const moved = anchorOf(trigger);
|
|
44
|
+
return moved.x === anchor.x && moved.y === anchor.y ? null : moved;
|
|
45
|
+
};
|
|
46
|
+
const renderedParentOf = (node)=>{
|
|
47
|
+
if (node instanceof ShadowRoot) return node.host;
|
|
48
|
+
return (node instanceof Element ? node.assignedSlot : null) ?? node.parentNode;
|
|
49
|
+
};
|
|
50
|
+
const holds = (ancestor, node)=>{
|
|
51
|
+
for(let at = node; at; at = renderedParentOf(at))if (at === ancestor) return true;
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
const scrollRootsOf = (node)=>{
|
|
55
|
+
const roots = new Set();
|
|
56
|
+
for(let at = node; at; at = renderedParentOf(at))roots.add(at.getRootNode());
|
|
57
|
+
return [
|
|
58
|
+
...roots
|
|
59
|
+
];
|
|
60
|
+
};
|
|
61
|
+
const useRuleMenus = ({ edit, rules, selectedRowId, refocus })=>{
|
|
62
|
+
const [state, setState] = (0, external_react_namespaceObject.useState)(null);
|
|
63
|
+
const restoreFocusRef = (0, external_react_namespaceObject.useRef)(null);
|
|
64
|
+
const position = state ? rules.findIndex((rule)=>rule.rowId === state.rowId) + 1 : 0;
|
|
65
|
+
const open = edit && position > 0 ? state : null;
|
|
66
|
+
const close = (scroll)=>{
|
|
67
|
+
restoreFocusRef.current = state && {
|
|
68
|
+
...state,
|
|
69
|
+
scroll
|
|
70
|
+
};
|
|
71
|
+
setState(null);
|
|
72
|
+
};
|
|
73
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
74
|
+
if (state && (!open || !state.trigger.isConnected)) return void close(false);
|
|
75
|
+
const anchor = state && movedAnchor(state);
|
|
76
|
+
if (state && anchor) return void setState({
|
|
77
|
+
...state,
|
|
78
|
+
anchor
|
|
79
|
+
});
|
|
80
|
+
const restore = restoreFocusRef.current;
|
|
81
|
+
if (!restore || state) return;
|
|
82
|
+
restoreFocusRef.current = null;
|
|
83
|
+
if (restore.trigger.isConnected && restore.openedOnRowId === selectedRowId) restore.trigger.focus({
|
|
84
|
+
preventScroll: true
|
|
85
|
+
});
|
|
86
|
+
else refocus(restore.scroll);
|
|
87
|
+
});
|
|
88
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
89
|
+
if (!state) return;
|
|
90
|
+
const close = ()=>{
|
|
91
|
+
restoreFocusRef.current = {
|
|
92
|
+
...state,
|
|
93
|
+
scroll: false
|
|
94
|
+
};
|
|
95
|
+
setState(null);
|
|
96
|
+
};
|
|
97
|
+
const closeOnScroll = (event)=>{
|
|
98
|
+
if (event.target instanceof Node && holds(event.target, state.trigger)) close();
|
|
99
|
+
};
|
|
100
|
+
const roots = scrollRootsOf(state.trigger);
|
|
101
|
+
for (const root of roots)root.addEventListener('scroll', closeOnScroll, {
|
|
102
|
+
capture: true,
|
|
103
|
+
passive: true
|
|
104
|
+
});
|
|
105
|
+
window.addEventListener('resize', close);
|
|
106
|
+
return ()=>{
|
|
107
|
+
for (const root of roots)root.removeEventListener('scroll', closeOnScroll, {
|
|
108
|
+
capture: true
|
|
109
|
+
});
|
|
110
|
+
window.removeEventListener('resize', close);
|
|
111
|
+
};
|
|
112
|
+
}, [
|
|
113
|
+
state
|
|
114
|
+
]);
|
|
115
|
+
const entries = ()=>{
|
|
116
|
+
if (!edit || !open) return [];
|
|
117
|
+
return 'rule' === open.menu ? edit.ruleEntries(open.rowId) : edit.conditionEntries(open.rowId);
|
|
118
|
+
};
|
|
119
|
+
const onClose = ()=>close(true);
|
|
120
|
+
const openFor = (action)=>{
|
|
121
|
+
if (!edit || action?.action !== 'conditions' && action?.action !== 'rule') return false;
|
|
122
|
+
const entriesOf = 'rule' === action.action ? edit.ruleEntries : edit.conditionEntries;
|
|
123
|
+
if (0 === entriesOf(action.rowId).length) return false;
|
|
124
|
+
setState({
|
|
125
|
+
menu: action.action,
|
|
126
|
+
rowId: action.rowId,
|
|
127
|
+
trigger: action.trigger,
|
|
128
|
+
openedOnRowId: selectedRowId,
|
|
129
|
+
anchor: anchorOf(action.trigger)
|
|
130
|
+
});
|
|
131
|
+
return true;
|
|
132
|
+
};
|
|
133
|
+
const onClick = (event)=>openFor((0, external_sentenceTargets_cjs_namespaceObject.clickedAction)(event.target));
|
|
134
|
+
return {
|
|
135
|
+
state: open,
|
|
136
|
+
label: menuLabel(edit, open, position),
|
|
137
|
+
entries,
|
|
138
|
+
onClose,
|
|
139
|
+
onClick,
|
|
140
|
+
openFor
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
exports.useRuleMenus = __webpack_exports__.useRuleMenus;
|
|
144
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
145
|
+
"useRuleMenus"
|
|
146
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
147
|
+
Object.defineProperty(exports, '__esModule', {
|
|
148
|
+
value: true
|
|
149
|
+
});
|