@uipath/apollo-react 7.20.0 → 7.21.1
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/CanvasTooltip.cjs +9 -4
- package/dist/canvas/components/CanvasTooltip.d.ts +3 -1
- package/dist/canvas/components/CanvasTooltip.d.ts.map +1 -1
- package/dist/canvas/components/CanvasTooltip.js +5 -3
- package/dist/canvas/components/StageNode/StageHeaderChips.cjs +33 -7
- package/dist/canvas/components/StageNode/StageHeaderChips.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageHeaderChips.js +36 -10
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/ColumnPopover.cjs +7 -2
- package/dist/decision-table/ColumnPopover.d.ts +2 -1
- package/dist/decision-table/ColumnPopover.d.ts.map +1 -1
- package/dist/decision-table/ColumnPopover.js +7 -2
- package/dist/decision-table/DecisionText.cjs +13 -1
- package/dist/decision-table/DecisionText.d.ts +5 -8
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +14 -2
- package/dist/decision-table/EditorOverlay.cjs +5 -1
- package/dist/decision-table/EditorOverlay.d.ts.map +1 -1
- package/dist/decision-table/EditorOverlay.js +5 -1
- package/dist/decision-table/ExpressionEditorFrame.cjs +2 -2
- package/dist/decision-table/ExpressionEditorFrame.js +2 -2
- package/dist/decision-table/MarkTooltip.cjs +58 -14
- package/dist/decision-table/MarkTooltip.d.ts.map +1 -1
- package/dist/decision-table/MarkTooltip.js +58 -14
- package/dist/decision-table/PopoverSelect.cjs +2 -1
- package/dist/decision-table/PopoverSelect.d.ts.map +1 -1
- package/dist/decision-table/PopoverSelect.js +2 -1
- package/dist/decision-table/TokenChip.d.ts +1 -1
- package/dist/decision-table/TokenChip.d.ts.map +1 -1
- package/dist/decision-table/ValueEditorOverlay.cjs +2 -1
- package/dist/decision-table/ValueEditorOverlay.d.ts +2 -2
- package/dist/decision-table/ValueEditorOverlay.d.ts.map +1 -1
- package/dist/decision-table/ValueEditorOverlay.js +2 -1
- package/dist/decision-table/ValuePopover.cjs +14 -3
- package/dist/decision-table/ValuePopover.d.ts +2 -1
- package/dist/decision-table/ValuePopover.d.ts.map +1 -1
- package/dist/decision-table/ValuePopover.js +14 -3
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +5 -5
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/modalDialog.d.ts +1 -0
- package/dist/decision-table/__fixtures__/modalDialog.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +7 -15
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/bandColumns.cjs +68 -0
- package/dist/decision-table/bandColumns.d.ts +9 -0
- package/dist/decision-table/bandColumns.d.ts.map +1 -0
- package/dist/decision-table/bandColumns.js +31 -0
- package/dist/decision-table/decisionTextTypes.d.ts +16 -11
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
- package/dist/decision-table/index.d.ts +3 -3
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/locales/de.cjs +1 -1
- package/dist/decision-table/locales/de.d.ts.map +1 -1
- package/dist/decision-table/locales/de.js +1 -1
- package/dist/decision-table/locales/en.cjs +1 -1
- package/dist/decision-table/locales/en.d.ts.map +1 -1
- package/dist/decision-table/locales/en.js +1 -1
- package/dist/decision-table/locales/es-MX.cjs +1 -1
- package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
- package/dist/decision-table/locales/es-MX.js +1 -1
- package/dist/decision-table/locales/es.cjs +1 -1
- package/dist/decision-table/locales/es.d.ts.map +1 -1
- package/dist/decision-table/locales/es.js +1 -1
- package/dist/decision-table/locales/fr.cjs +1 -1
- package/dist/decision-table/locales/fr.d.ts.map +1 -1
- package/dist/decision-table/locales/fr.js +1 -1
- package/dist/decision-table/locales/ja.cjs +1 -1
- package/dist/decision-table/locales/ja.d.ts.map +1 -1
- package/dist/decision-table/locales/ja.js +1 -1
- package/dist/decision-table/locales/ko.cjs +1 -1
- package/dist/decision-table/locales/ko.d.ts.map +1 -1
- package/dist/decision-table/locales/ko.js +1 -1
- package/dist/decision-table/locales/pt-BR.cjs +1 -1
- package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
- package/dist/decision-table/locales/pt-BR.js +1 -1
- package/dist/decision-table/locales/pt.cjs +1 -1
- package/dist/decision-table/locales/pt.d.ts.map +1 -1
- package/dist/decision-table/locales/pt.js +1 -1
- package/dist/decision-table/locales/ro.cjs +1 -1
- package/dist/decision-table/locales/ro.d.ts.map +1 -1
- package/dist/decision-table/locales/ro.js +1 -1
- package/dist/decision-table/locales/ru.cjs +1 -1
- package/dist/decision-table/locales/ru.d.ts.map +1 -1
- package/dist/decision-table/locales/ru.js +1 -1
- package/dist/decision-table/locales/tr.cjs +1 -1
- package/dist/decision-table/locales/tr.d.ts.map +1 -1
- package/dist/decision-table/locales/tr.js +1 -1
- package/dist/decision-table/locales/zh-CN.cjs +1 -1
- package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-CN.js +1 -1
- package/dist/decision-table/locales/zh-TW.cjs +1 -1
- package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-TW.js +1 -1
- package/dist/decision-table/ruleCardModel.cjs +4 -11
- package/dist/decision-table/ruleCardModel.d.ts +3 -4
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
- package/dist/decision-table/ruleCardModel.js +5 -9
- package/dist/decision-table/ruleMenuEntries.cjs +138 -0
- package/dist/decision-table/ruleMenuEntries.d.ts +25 -0
- package/dist/decision-table/ruleMenuEntries.d.ts.map +1 -0
- package/dist/decision-table/ruleMenuEntries.js +101 -0
- package/dist/decision-table/sentenceParts.cjs +10 -6
- package/dist/decision-table/sentenceParts.d.ts +1 -0
- package/dist/decision-table/sentenceParts.d.ts.map +1 -1
- package/dist/decision-table/sentenceParts.js +3 -2
- package/dist/decision-table/sentenceTypes.d.ts +3 -1
- package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useColumnEditing.cjs +11 -1
- package/dist/decision-table/useColumnEditing.d.ts.map +1 -1
- package/dist/decision-table/useColumnEditing.js +12 -2
- package/dist/decision-table/useDecisionTextStrings.cjs +326 -0
- package/dist/decision-table/useDecisionTextStrings.d.ts +5 -0
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -0
- package/dist/decision-table/useDecisionTextStrings.js +286 -0
- package/dist/decision-table/useEditState.cjs +87 -0
- package/dist/decision-table/useEditState.d.ts +8 -0
- package/dist/decision-table/useEditState.d.ts.map +1 -0
- package/dist/decision-table/useEditState.js +53 -0
- package/dist/decision-table/useEditorPlacement.cjs +15 -3
- package/dist/decision-table/useEditorPlacement.d.ts.map +1 -1
- package/dist/decision-table/useEditorPlacement.js +15 -3
- package/dist/decision-table/usePendingCondition.d.ts +2 -2
- package/dist/decision-table/usePendingCondition.d.ts.map +1 -1
- package/dist/decision-table/useRuleMenus.cjs +9 -6
- package/dist/decision-table/useRuleMenus.d.ts +5 -4
- package/dist/decision-table/useRuleMenus.d.ts.map +1 -1
- package/dist/decision-table/useRuleMenus.js +9 -6
- package/dist/decision-table/useShapeDraft.cjs +3 -4
- package/dist/decision-table/useShapeDraft.d.ts.map +1 -1
- package/dist/decision-table/useShapeDraft.js +3 -4
- package/dist/decision-table/useValueEditing.cjs +8 -4
- package/dist/decision-table/useValueEditing.d.ts +3 -3
- package/dist/decision-table/useValueEditing.d.ts.map +1 -1
- package/dist/decision-table/useValueEditing.js +9 -5
- package/dist/decision-table/valueTypes.d.ts +6 -1
- package/dist/decision-table/valueTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
useEditState: ()=>useEditState
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const external_useValueEditing_cjs_namespaceObject = require("./useValueEditing.cjs");
|
|
31
|
+
const keyOf = (value)=>value ? (0, external_useValueEditing_cjs_namespaceObject.valueKey)(value) : void 0;
|
|
32
|
+
const useEditState = (edit, labels)=>{
|
|
33
|
+
const [held, setHeld] = (0, external_react_namespaceObject.useState)(edit?.editing ?? null);
|
|
34
|
+
const [refusal, setRefusal] = (0, external_react_namespaceObject.useState)(null);
|
|
35
|
+
const controlled = edit?.editing !== void 0;
|
|
36
|
+
const editing = (controlled ? edit?.editing : edit && held) ?? null;
|
|
37
|
+
const key = keyOf(editing);
|
|
38
|
+
if (keyOf(held) !== key) setHeld(editing);
|
|
39
|
+
if (refusal && refusal.key !== key) setRefusal(null);
|
|
40
|
+
if (!edit) return {
|
|
41
|
+
edit: void 0,
|
|
42
|
+
refusal: null
|
|
43
|
+
};
|
|
44
|
+
const hold = (next)=>{
|
|
45
|
+
if (!controlled) setHeld(next);
|
|
46
|
+
};
|
|
47
|
+
const shown = refusal && refusal.key === key && '' !== refusal.message.trim() ? refusal : null;
|
|
48
|
+
return {
|
|
49
|
+
edit: {
|
|
50
|
+
...edit,
|
|
51
|
+
labels,
|
|
52
|
+
editing,
|
|
53
|
+
onStartEdit: (value)=>{
|
|
54
|
+
edit.onStartEdit?.(value);
|
|
55
|
+
hold(value);
|
|
56
|
+
},
|
|
57
|
+
onCommit: (value, commit, move)=>{
|
|
58
|
+
const answer = edit.onCommit(value, commit, move);
|
|
59
|
+
if ('string' == typeof answer) {
|
|
60
|
+
setRefusal((last)=>({
|
|
61
|
+
key: (0, external_useValueEditing_cjs_namespaceObject.valueKey)(value),
|
|
62
|
+
message: answer,
|
|
63
|
+
attempt: (last?.attempt ?? 0) + 1
|
|
64
|
+
}));
|
|
65
|
+
return answer;
|
|
66
|
+
}
|
|
67
|
+
setRefusal(null);
|
|
68
|
+
hold(null);
|
|
69
|
+
},
|
|
70
|
+
onCancel: ()=>{
|
|
71
|
+
edit.onCancel?.();
|
|
72
|
+
hold(null);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
refusal: shown && {
|
|
76
|
+
message: shown.message,
|
|
77
|
+
attempt: shown.attempt
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.useEditState = __webpack_exports__.useEditState;
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"useEditState"
|
|
84
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
85
|
+
Object.defineProperty(exports, '__esModule', {
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DecisionTextEdit, DecisionTextEditLabels, ViewEdit } from './decisionTextTypes';
|
|
2
|
+
import type { CommitRefusal } from './valueTypes';
|
|
3
|
+
export interface EditState {
|
|
4
|
+
edit: ViewEdit | undefined;
|
|
5
|
+
refusal: CommitRefusal | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const useEditState: (edit: DecisionTextEdit | undefined, labels: DecisionTextEditLabels) => EditState;
|
|
8
|
+
//# sourceMappingURL=useEditState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditState.d.ts","sourceRoot":"","sources":["../../src/decision-table/useEditState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAOlD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE3B,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;CAC/B;AAMD,eAAO,MAAM,YAAY,GACvB,MAAM,gBAAgB,GAAG,SAAS,EAClC,QAAQ,sBAAsB,KAC7B,SA4CF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { valueKey } from "./useValueEditing.js";
|
|
3
|
+
const keyOf = (value)=>value ? valueKey(value) : void 0;
|
|
4
|
+
const useEditState = (edit, labels)=>{
|
|
5
|
+
const [held, setHeld] = useState(edit?.editing ?? null);
|
|
6
|
+
const [refusal, setRefusal] = useState(null);
|
|
7
|
+
const controlled = edit?.editing !== void 0;
|
|
8
|
+
const editing = (controlled ? edit?.editing : edit && held) ?? null;
|
|
9
|
+
const key = keyOf(editing);
|
|
10
|
+
if (keyOf(held) !== key) setHeld(editing);
|
|
11
|
+
if (refusal && refusal.key !== key) setRefusal(null);
|
|
12
|
+
if (!edit) return {
|
|
13
|
+
edit: void 0,
|
|
14
|
+
refusal: null
|
|
15
|
+
};
|
|
16
|
+
const hold = (next)=>{
|
|
17
|
+
if (!controlled) setHeld(next);
|
|
18
|
+
};
|
|
19
|
+
const shown = refusal && refusal.key === key && '' !== refusal.message.trim() ? refusal : null;
|
|
20
|
+
return {
|
|
21
|
+
edit: {
|
|
22
|
+
...edit,
|
|
23
|
+
labels,
|
|
24
|
+
editing,
|
|
25
|
+
onStartEdit: (value)=>{
|
|
26
|
+
edit.onStartEdit?.(value);
|
|
27
|
+
hold(value);
|
|
28
|
+
},
|
|
29
|
+
onCommit: (value, commit, move)=>{
|
|
30
|
+
const answer = edit.onCommit(value, commit, move);
|
|
31
|
+
if ('string' == typeof answer) {
|
|
32
|
+
setRefusal((last)=>({
|
|
33
|
+
key: valueKey(value),
|
|
34
|
+
message: answer,
|
|
35
|
+
attempt: (last?.attempt ?? 0) + 1
|
|
36
|
+
}));
|
|
37
|
+
return answer;
|
|
38
|
+
}
|
|
39
|
+
setRefusal(null);
|
|
40
|
+
hold(null);
|
|
41
|
+
},
|
|
42
|
+
onCancel: ()=>{
|
|
43
|
+
edit.onCancel?.();
|
|
44
|
+
hold(null);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
refusal: shown && {
|
|
48
|
+
message: shown.message,
|
|
49
|
+
attempt: shown.attempt
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export { useEditState };
|
|
@@ -34,6 +34,19 @@ const valueAnchor = (target)=>(section)=>{
|
|
|
34
34
|
const card = (0, external_sentenceTargets_cjs_namespaceObject.cardOf)(section, target.rowId);
|
|
35
35
|
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);
|
|
36
36
|
};
|
|
37
|
+
const unplacedSizeOf = (overlay)=>{
|
|
38
|
+
const { top, left } = overlay.style;
|
|
39
|
+
overlay.style.top = '0px';
|
|
40
|
+
overlay.style.left = '0px';
|
|
41
|
+
const size = {
|
|
42
|
+
width: overlay.offsetWidth,
|
|
43
|
+
height: overlay.offsetHeight,
|
|
44
|
+
margin: Number.parseFloat(getComputedStyle(overlay).marginTop) || 0
|
|
45
|
+
};
|
|
46
|
+
overlay.style.top = top;
|
|
47
|
+
overlay.style.left = left;
|
|
48
|
+
return size;
|
|
49
|
+
};
|
|
37
50
|
const placementOf = (section, element, overlay)=>{
|
|
38
51
|
if (!section || !element) return {
|
|
39
52
|
top: 0,
|
|
@@ -42,9 +55,8 @@ const placementOf = (section, element, overlay)=>{
|
|
|
42
55
|
const frame = section.getBoundingClientRect();
|
|
43
56
|
const box = element.getBoundingClientRect();
|
|
44
57
|
const { innerWidth, innerHeight } = window;
|
|
45
|
-
const margin =
|
|
46
|
-
const height =
|
|
47
|
-
const width = overlay.offsetWidth;
|
|
58
|
+
const { width, height: overlayHeight, margin } = unplacedSizeOf(overlay);
|
|
59
|
+
const height = overlayHeight + margin;
|
|
48
60
|
const top = box.bottom + height <= innerHeight ? box.bottom : box.top - height >= 0 ? box.top - height - margin : Math.max(0, innerHeight - height);
|
|
49
61
|
const left = Math.min(box.left, frame.left + section.clientWidth - width, innerWidth - width);
|
|
50
62
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorPlacement.d.ts","sourceRoot":"","sources":["../../src/decision-table/useEditorPlacement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,UAAU,CAAC,WAAW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CAAC"}
|
|
@@ -5,6 +5,19 @@ const valueAnchor = (target)=>(section)=>{
|
|
|
5
5
|
const card = cardOf(section, target.rowId);
|
|
6
6
|
return card && (valueChipOf(card, target) ?? cellOf(card, target.columnId) ?? addConditionOf(card) ?? card);
|
|
7
7
|
};
|
|
8
|
+
const unplacedSizeOf = (overlay)=>{
|
|
9
|
+
const { top, left } = overlay.style;
|
|
10
|
+
overlay.style.top = '0px';
|
|
11
|
+
overlay.style.left = '0px';
|
|
12
|
+
const size = {
|
|
13
|
+
width: overlay.offsetWidth,
|
|
14
|
+
height: overlay.offsetHeight,
|
|
15
|
+
margin: Number.parseFloat(getComputedStyle(overlay).marginTop) || 0
|
|
16
|
+
};
|
|
17
|
+
overlay.style.top = top;
|
|
18
|
+
overlay.style.left = left;
|
|
19
|
+
return size;
|
|
20
|
+
};
|
|
8
21
|
const placementOf = (section, element, overlay)=>{
|
|
9
22
|
if (!section || !element) return {
|
|
10
23
|
top: 0,
|
|
@@ -13,9 +26,8 @@ const placementOf = (section, element, overlay)=>{
|
|
|
13
26
|
const frame = section.getBoundingClientRect();
|
|
14
27
|
const box = element.getBoundingClientRect();
|
|
15
28
|
const { innerWidth, innerHeight } = window;
|
|
16
|
-
const margin =
|
|
17
|
-
const height =
|
|
18
|
-
const width = overlay.offsetWidth;
|
|
29
|
+
const { width, height: overlayHeight, margin } = unplacedSizeOf(overlay);
|
|
30
|
+
const height = overlayHeight + margin;
|
|
19
31
|
const top = box.bottom + height <= innerHeight ? box.bottom : box.top - height >= 0 ? box.top - height - margin : Math.max(0, innerHeight - height);
|
|
20
32
|
const left = Math.min(box.left, frame.left + section.clientWidth - width, innerWidth - width);
|
|
21
33
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewEdit } from './decisionTextTypes';
|
|
2
2
|
import type { SentenceBand, SentenceRule, SentenceValueId } from './sentenceTypes';
|
|
3
3
|
import type { ValuePopoverProps } from './ValuePopover';
|
|
4
4
|
export interface PendingConditionParams {
|
|
5
|
-
edit:
|
|
5
|
+
edit: ViewEdit | undefined;
|
|
6
6
|
rules: readonly SentenceRule[];
|
|
7
7
|
bands: readonly SentenceBand[];
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePendingCondition.d.ts","sourceRoot":"","sources":["../../src/decision-table/usePendingCondition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"usePendingCondition.d.ts","sourceRoot":"","sources":["../../src/decision-table/usePendingCondition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAE/B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAE/B,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAEhC,gBAAgB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;CACzD;AASD,eAAO,MAAM,mBAAmB,GAAI,yBAIjC,sBAAsB,KAAG,gBA0C3B,CAAC"}
|
|
@@ -28,6 +28,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const external_react_namespaceObject = require("react");
|
|
30
30
|
const external_renderedTree_cjs_namespaceObject = require("./renderedTree.cjs");
|
|
31
|
+
const external_ruleMenuEntries_cjs_namespaceObject = require("./ruleMenuEntries.cjs");
|
|
31
32
|
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
32
33
|
const menuLabel = (edit, state, position)=>{
|
|
33
34
|
if (!edit || !state) return '';
|
|
@@ -48,7 +49,7 @@ const holds = (ancestor, node)=>{
|
|
|
48
49
|
for(let at = node; at; at = (0, external_renderedTree_cjs_namespaceObject.renderedParentOf)(at))if (at === ancestor) return true;
|
|
49
50
|
return false;
|
|
50
51
|
};
|
|
51
|
-
const useRuleMenus = ({ edit, rules, selectedRowId, refocus })=>{
|
|
52
|
+
const useRuleMenus = ({ edit, rules, bands, selectedRowId, refocus })=>{
|
|
52
53
|
const [state, setState] = (0, external_react_namespaceObject.useState)(null);
|
|
53
54
|
const restoreFocusRef = (0, external_react_namespaceObject.useRef)(null);
|
|
54
55
|
const position = state ? rules.findIndex((rule)=>rule.rowId === state.rowId) + 1 : 0;
|
|
@@ -102,15 +103,17 @@ const useRuleMenus = ({ edit, rules, selectedRowId, refocus })=>{
|
|
|
102
103
|
}, [
|
|
103
104
|
state
|
|
104
105
|
]);
|
|
105
|
-
const
|
|
106
|
-
if (!edit
|
|
107
|
-
|
|
106
|
+
const entriesOf = (menu, rowId)=>{
|
|
107
|
+
if (!edit) return [];
|
|
108
|
+
if ('rule' === menu) return (0, external_ruleMenuEntries_cjs_namespaceObject.ruleEntriesOf)(edit, edit.labels, rules, rowId);
|
|
109
|
+
const rule = rules.find((candidate)=>candidate.rowId === rowId);
|
|
110
|
+
return (0, external_ruleMenuEntries_cjs_namespaceObject.conditionEntriesOf)(edit, edit.labels, rule, bands, edit.onStartEdit);
|
|
108
111
|
};
|
|
112
|
+
const entries = ()=>open ? entriesOf(open.menu, open.rowId) : [];
|
|
109
113
|
const onClose = ()=>close(true);
|
|
110
114
|
const openFor = (action)=>{
|
|
111
115
|
if (!edit || action?.action !== 'conditions' && action?.action !== 'rule') return false;
|
|
112
|
-
|
|
113
|
-
if (0 === entriesOf(action.rowId).length) return false;
|
|
116
|
+
if (0 === entriesOf(action.action, action.rowId).length) return false;
|
|
114
117
|
setState({
|
|
115
118
|
menu: action.action,
|
|
116
119
|
rowId: action.rowId,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ViewEdit } from './decisionTextTypes';
|
|
3
3
|
import type { GridContextMenuProps, GridContextMenuState } from './GridMenu';
|
|
4
4
|
import type { OpenRuleMenu } from './RuleList';
|
|
5
|
-
import type { SentenceRule } from './sentenceTypes';
|
|
5
|
+
import type { SentenceBand, SentenceRule } from './sentenceTypes';
|
|
6
6
|
export interface RuleMenusParams {
|
|
7
|
-
edit:
|
|
7
|
+
edit: ViewEdit | undefined;
|
|
8
8
|
rules: readonly SentenceRule[];
|
|
9
|
+
bands: readonly SentenceBand[];
|
|
9
10
|
selectedRowId: string | undefined;
|
|
10
11
|
refocus: (scroll: boolean) => void;
|
|
11
12
|
}
|
|
@@ -17,6 +18,6 @@ export interface RuleMenus extends Pick<GridContextMenuProps, 'label' | 'entries
|
|
|
17
18
|
state: RuleMenuState | null;
|
|
18
19
|
onClick: (event: React.MouseEvent<HTMLElement>) => boolean;
|
|
19
20
|
}
|
|
20
|
-
export declare const useRuleMenus: ({ edit, rules, selectedRowId, refocus, }: RuleMenusParams) => RuleMenus;
|
|
21
|
+
export declare const useRuleMenus: ({ edit, rules, bands, selectedRowId, refocus, }: RuleMenusParams) => RuleMenus;
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=useRuleMenus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRuleMenus.d.ts","sourceRoot":"","sources":["../../src/decision-table/useRuleMenus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useRuleMenus.d.ts","sourceRoot":"","sources":["../../src/decision-table/useRuleMenus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAiB,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAE/B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAGD,UAAU,aAAc,SAAQ,oBAAoB,EAAE,YAAY;IAChE,OAAO,EAAE,WAAW,CAAC;IAErB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAKD,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5F,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAE5B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC;CAC5D;AAkCD,eAAO,MAAM,YAAY,GAAI,iDAM1B,eAAe,KAAG,SAqFpB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { renderedParentOf, scrollRootsOf } from "./renderedTree.js";
|
|
3
|
+
import { conditionEntriesOf, ruleEntriesOf } from "./ruleMenuEntries.js";
|
|
3
4
|
import { clickedAction } from "./sentenceTargets.js";
|
|
4
5
|
const menuLabel = (edit, state, position)=>{
|
|
5
6
|
if (!edit || !state) return '';
|
|
@@ -20,7 +21,7 @@ const holds = (ancestor, node)=>{
|
|
|
20
21
|
for(let at = node; at; at = renderedParentOf(at))if (at === ancestor) return true;
|
|
21
22
|
return false;
|
|
22
23
|
};
|
|
23
|
-
const useRuleMenus = ({ edit, rules, selectedRowId, refocus })=>{
|
|
24
|
+
const useRuleMenus = ({ edit, rules, bands, selectedRowId, refocus })=>{
|
|
24
25
|
const [state, setState] = useState(null);
|
|
25
26
|
const restoreFocusRef = useRef(null);
|
|
26
27
|
const position = state ? rules.findIndex((rule)=>rule.rowId === state.rowId) + 1 : 0;
|
|
@@ -74,15 +75,17 @@ const useRuleMenus = ({ edit, rules, selectedRowId, refocus })=>{
|
|
|
74
75
|
}, [
|
|
75
76
|
state
|
|
76
77
|
]);
|
|
77
|
-
const
|
|
78
|
-
if (!edit
|
|
79
|
-
|
|
78
|
+
const entriesOf = (menu, rowId)=>{
|
|
79
|
+
if (!edit) return [];
|
|
80
|
+
if ('rule' === menu) return ruleEntriesOf(edit, edit.labels, rules, rowId);
|
|
81
|
+
const rule = rules.find((candidate)=>candidate.rowId === rowId);
|
|
82
|
+
return conditionEntriesOf(edit, edit.labels, rule, bands, edit.onStartEdit);
|
|
80
83
|
};
|
|
84
|
+
const entries = ()=>open ? entriesOf(open.menu, open.rowId) : [];
|
|
81
85
|
const onClose = ()=>close(true);
|
|
82
86
|
const openFor = (action)=>{
|
|
83
87
|
if (!edit || action?.action !== 'conditions' && action?.action !== 'rule') return false;
|
|
84
|
-
|
|
85
|
-
if (0 === entriesOf(action.rowId).length) return false;
|
|
88
|
+
if (0 === entriesOf(action.action, action.rowId).length) return false;
|
|
86
89
|
setState({
|
|
87
90
|
menu: action.action,
|
|
88
91
|
rowId: action.rowId,
|
|
@@ -50,14 +50,13 @@ const operatorsOf = ({ operators = NO_OPERATORS, operator, values, ends })=>{
|
|
|
50
50
|
];
|
|
51
51
|
};
|
|
52
52
|
const operatorOf = (field)=>field.operator || operatorsOf(field)[0]?.id;
|
|
53
|
-
const problemOf = (shape, { values }, field, adds,
|
|
53
|
+
const problemOf = (shape, { values }, field, adds, hidesHeld)=>{
|
|
54
54
|
const [low = '', high = ''] = values;
|
|
55
55
|
if ('range' === shape) {
|
|
56
56
|
if ('' === low.trim() || '' === high.trim()) return 'missingEnd';
|
|
57
57
|
return field.inOrder?.(low, high) ?? true ? null : 'endsOutOfOrder';
|
|
58
58
|
}
|
|
59
59
|
if ('list' === shape) return values.length > 0 ? null : 'noValueChecked';
|
|
60
|
-
const hidesHeld = held && (field.allowedValues?.length ?? 0) > 0;
|
|
61
60
|
return (adds || hidesHeld) && '' === low.trim() ? 'missingValue' : null;
|
|
62
61
|
};
|
|
63
62
|
const useShapeDraft = (field, value, adds)=>{
|
|
@@ -72,7 +71,7 @@ const useShapeDraft = (field, value, adds)=>{
|
|
|
72
71
|
const [adding, setAdding] = (0, external_react_namespaceObject.useState)('');
|
|
73
72
|
const [operator, setOperator] = (0, external_react_namespaceObject.useState)(()=>operatorOf(field));
|
|
74
73
|
const operators = operatorsOf(field);
|
|
75
|
-
const allowedValues = field.allowedValues ?? NO_VALUES;
|
|
74
|
+
const allowedValues = filled(field.allowedValues ?? NO_VALUES);
|
|
76
75
|
const picked = 0 === operators.length ? void 0 : operator;
|
|
77
76
|
const shapeOf = (id)=>operators.find((option)=>option.id === id)?.shape ?? 'single';
|
|
78
77
|
const shape = shapeOf(picked);
|
|
@@ -133,7 +132,7 @@ const useShapeDraft = (field, value, adds)=>{
|
|
|
133
132
|
checked,
|
|
134
133
|
adding,
|
|
135
134
|
current,
|
|
136
|
-
problem: problemOf(shape, current, field, adds, held.length > 0),
|
|
135
|
+
problem: problemOf(shape, current, field, adds, held.length > 0 && allowedValues.length > 0),
|
|
137
136
|
setText: (next)=>setValues([
|
|
138
137
|
next,
|
|
139
138
|
...values.slice(1)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShapeDraft.d.ts","sourceRoot":"","sources":["../../src/decision-table/useShapeDraft.ts"],"names":[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D,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,EAAE,OAAO,MAAM,EAAE,MAAM,OAAO,KAAG,UAkE/E,CAAC"}
|
|
@@ -20,14 +20,13 @@ const operatorsOf = ({ operators = NO_OPERATORS, operator, values, ends })=>{
|
|
|
20
20
|
];
|
|
21
21
|
};
|
|
22
22
|
const operatorOf = (field)=>field.operator || operatorsOf(field)[0]?.id;
|
|
23
|
-
const problemOf = (shape, { values }, field, adds,
|
|
23
|
+
const problemOf = (shape, { values }, field, adds, hidesHeld)=>{
|
|
24
24
|
const [low = '', high = ''] = values;
|
|
25
25
|
if ('range' === shape) {
|
|
26
26
|
if ('' === low.trim() || '' === high.trim()) return 'missingEnd';
|
|
27
27
|
return field.inOrder?.(low, high) ?? true ? null : 'endsOutOfOrder';
|
|
28
28
|
}
|
|
29
29
|
if ('list' === shape) return values.length > 0 ? null : 'noValueChecked';
|
|
30
|
-
const hidesHeld = held && (field.allowedValues?.length ?? 0) > 0;
|
|
31
30
|
return (adds || hidesHeld) && '' === low.trim() ? 'missingValue' : null;
|
|
32
31
|
};
|
|
33
32
|
const useShapeDraft = (field, value, adds)=>{
|
|
@@ -42,7 +41,7 @@ const useShapeDraft = (field, value, adds)=>{
|
|
|
42
41
|
const [adding, setAdding] = useState('');
|
|
43
42
|
const [operator, setOperator] = useState(()=>operatorOf(field));
|
|
44
43
|
const operators = operatorsOf(field);
|
|
45
|
-
const allowedValues = field.allowedValues ?? NO_VALUES;
|
|
44
|
+
const allowedValues = filled(field.allowedValues ?? NO_VALUES);
|
|
46
45
|
const picked = 0 === operators.length ? void 0 : operator;
|
|
47
46
|
const shapeOf = (id)=>operators.find((option)=>option.id === id)?.shape ?? 'single';
|
|
48
47
|
const shape = shapeOf(picked);
|
|
@@ -103,7 +102,7 @@ const useShapeDraft = (field, value, adds)=>{
|
|
|
103
102
|
checked,
|
|
104
103
|
adding,
|
|
105
104
|
current,
|
|
106
|
-
problem: problemOf(shape, current, field, adds, held.length > 0),
|
|
105
|
+
problem: problemOf(shape, current, field, adds, held.length > 0 && allowedValues.length > 0),
|
|
107
106
|
setText: (next)=>setValues([
|
|
108
107
|
next,
|
|
109
108
|
...values.slice(1)
|
|
@@ -29,7 +29,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
});
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
32
|
-
const external_ruleCardModel_cjs_namespaceObject = require("./ruleCardModel.cjs");
|
|
33
32
|
const external_sentenceParts_cjs_namespaceObject = require("./sentenceParts.cjs");
|
|
34
33
|
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
35
34
|
const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenceNavigation.cjs");
|
|
@@ -53,7 +52,8 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
53
52
|
const target = edit?.editing ?? null;
|
|
54
53
|
const openedRef = (0, external_react_namespaceObject.useRef)(target ? valueKey(target) : void 0);
|
|
55
54
|
const row = target ? rules.findIndex((rule)=>rule.rowId === target.rowId) : -1;
|
|
56
|
-
const
|
|
55
|
+
const listed = null !== target && ((0, external_sentenceParts_cjs_namespaceObject.hasStop)(rules[row], target.columnId) || bands.some((band)=>band.columns.some((column)=>column.id === target.columnId)));
|
|
56
|
+
const rule = listed ? rules[row] : void 0;
|
|
57
57
|
const awaitHost = (pending)=>{
|
|
58
58
|
stopAwaitingRef.current?.();
|
|
59
59
|
const view = container();
|
|
@@ -77,7 +77,11 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
77
77
|
if (!edit || !target || !rule) return null;
|
|
78
78
|
const token = (0, external_sentenceParts_cjs_namespaceObject.valueTokenOf)(rule, target);
|
|
79
79
|
const column = (0, external_sentenceParts_cjs_namespaceObject.columnNameOf)(rule, target.columnId) || (0, external_sentenceParts_cjs_namespaceObject.bandColumnNameOf)(bands, target.columnId);
|
|
80
|
-
const
|
|
80
|
+
const hostField = edit.valueField?.(target);
|
|
81
|
+
const field = {
|
|
82
|
+
...hostField,
|
|
83
|
+
icon: hostField?.icon ?? (0, external_sentenceParts_cjs_namespaceObject.bandColumnOf)(bands, target.columnId)?.icon
|
|
84
|
+
};
|
|
81
85
|
const held = (0, external_sentenceParts_cjs_namespaceObject.hasStop)(rule, target.columnId);
|
|
82
86
|
const cancel = ()=>{
|
|
83
87
|
awaitHost({
|
|
@@ -91,7 +95,7 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
91
95
|
return {
|
|
92
96
|
target,
|
|
93
97
|
value: token?.text ?? '',
|
|
94
|
-
ariaLabel: held ?
|
|
98
|
+
ariaLabel: held ? labels.cell(column, token ? (0, external_sentenceParts_cjs_namespaceObject.tokenText)(token, labels.emptyValue) : '', row + 1) : edit.labels.newCondition(column, row + 1),
|
|
95
99
|
column,
|
|
96
100
|
field,
|
|
97
101
|
adds: !held,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { ViewEdit } from './decisionTextTypes';
|
|
3
|
+
import type { RuleCardLabels } from './ruleCardModel';
|
|
4
4
|
import type { SentenceBand, SentenceRule, SentenceSelection, SentenceValueId } from './sentenceTypes';
|
|
5
5
|
import type { RuleWindow } from './useRuleWindow';
|
|
6
6
|
import { type SentenceNavigation, type SentenceNavigationSource } from './useSentenceNavigation';
|
|
7
7
|
import type { OpenValueEditor } from './ValueEditorOverlay';
|
|
8
8
|
export interface ValueEditingParams {
|
|
9
|
-
edit:
|
|
9
|
+
edit: ViewEdit | undefined;
|
|
10
10
|
rules: readonly SentenceRule[];
|
|
11
11
|
bands: readonly SentenceBand[];
|
|
12
12
|
selected: SentenceSelection | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useValueEditing.d.ts","sourceRoot":"","sources":["../../src/decision-table/useValueEditing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useValueEditing.d.ts","sourceRoot":"","sources":["../../src/decision-table/useValueEditing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAkBtD,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAC/C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC;IACpD,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACpC;AAqBD,MAAM,WAAW,YAAY;IAE3B,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAE/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC;IAEhE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC;IAE3D,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAUD,eAAO,MAAM,QAAQ,GAAI,4BAA4B,eAAe,KAAG,MAC7B,CAAC;AAc3C,eAAO,MAAM,eAAe,GAAI,4EAS7B,kBAAkB,KAAG,YAyLvB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
2
2
|
import { activeElementOf, focusStays, hasLostFocus, onNextGesture } from "./gridEvents.js";
|
|
3
|
-
import {
|
|
4
|
-
import { bandColumnNameOf, cellTextOf, columnNameOf, hasStop, isOutcome, tokenText, valueTokenOf } from "./sentenceParts.js";
|
|
3
|
+
import { bandColumnNameOf, bandColumnOf, cellTextOf, columnNameOf, hasStop, isOutcome, tokenText, valueTokenOf } from "./sentenceParts.js";
|
|
5
4
|
import { addConditionOf, clickedAction, clickedDecision, clickedValue } from "./sentenceTargets.js";
|
|
6
5
|
import { isIgnoredKey } from "./useSentenceNavigation.js";
|
|
7
6
|
const isStartKey = (event)=>'Enter' === event.key || 'F2' === event.key || ' ' === event.key && void 0 === clickedDecision(event.target);
|
|
@@ -24,7 +23,8 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
24
23
|
const target = edit?.editing ?? null;
|
|
25
24
|
const openedRef = useRef(target ? valueKey(target) : void 0);
|
|
26
25
|
const row = target ? rules.findIndex((rule)=>rule.rowId === target.rowId) : -1;
|
|
27
|
-
const
|
|
26
|
+
const listed = null !== target && (hasStop(rules[row], target.columnId) || bands.some((band)=>band.columns.some((column)=>column.id === target.columnId)));
|
|
27
|
+
const rule = listed ? rules[row] : void 0;
|
|
28
28
|
const awaitHost = (pending)=>{
|
|
29
29
|
stopAwaitingRef.current?.();
|
|
30
30
|
const view = container();
|
|
@@ -48,7 +48,11 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
48
48
|
if (!edit || !target || !rule) return null;
|
|
49
49
|
const token = valueTokenOf(rule, target);
|
|
50
50
|
const column = columnNameOf(rule, target.columnId) || bandColumnNameOf(bands, target.columnId);
|
|
51
|
-
const
|
|
51
|
+
const hostField = edit.valueField?.(target);
|
|
52
|
+
const field = {
|
|
53
|
+
...hostField,
|
|
54
|
+
icon: hostField?.icon ?? bandColumnOf(bands, target.columnId)?.icon
|
|
55
|
+
};
|
|
52
56
|
const held = hasStop(rule, target.columnId);
|
|
53
57
|
const cancel = ()=>{
|
|
54
58
|
awaitHost({
|
|
@@ -62,7 +66,7 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
62
66
|
return {
|
|
63
67
|
target,
|
|
64
68
|
value: token?.text ?? '',
|
|
65
|
-
ariaLabel: held ?
|
|
69
|
+
ariaLabel: held ? labels.cell(column, token ? tokenText(token, labels.emptyValue) : '', row + 1) : edit.labels.newCondition(column, row + 1),
|
|
66
70
|
column,
|
|
67
71
|
field,
|
|
68
72
|
adds: !held,
|
|
@@ -18,7 +18,8 @@ export interface RangeEnds {
|
|
|
18
18
|
lowInclusive: boolean;
|
|
19
19
|
highInclusive: boolean;
|
|
20
20
|
}
|
|
21
|
-
export interface ValueField
|
|
21
|
+
export interface ValueField {
|
|
22
|
+
icon?: SentenceBandColumn['icon'];
|
|
22
23
|
operators?: readonly ValueOperatorOption[];
|
|
23
24
|
operator?: string;
|
|
24
25
|
allowedValues?: readonly string[];
|
|
@@ -36,4 +37,8 @@ export type ValueCommit = {
|
|
|
36
37
|
kind: 'expression';
|
|
37
38
|
text: string;
|
|
38
39
|
};
|
|
40
|
+
export interface CommitRefusal {
|
|
41
|
+
message: string;
|
|
42
|
+
attempt: number;
|
|
43
|
+
}
|
|
39
44
|
//# sourceMappingURL=valueTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/valueTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG3E,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;CAC1B;AAGD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,WAAW,CAAC;IAC/F,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjC,OAAO,EAAE,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D;AAGD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAGrD,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAGD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"valueTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/valueTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG3E,MAAM,WAAW,sBAAsB;IACrC,KAAK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