@uipath/apollo-react 7.27.0 → 7.29.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/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/core/tokens/css/theme-variables.css +1 -1
- package/dist/core/tokens/css/variables.css +1 -1
- package/dist/core/tokens/less/_variables.less +1 -1
- package/dist/core/tokens/scss/_css-variables.scss +1 -1
- package/dist/core/tokens/scss/_variables.scss +1 -1
- package/dist/decision-table/DecisionGraphCard.cjs +7 -5
- package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphCard.js +7 -5
- package/dist/decision-table/DecisionGraphMinimapSlot.cjs +7 -5
- package/dist/decision-table/DecisionGraphMinimapSlot.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphMinimapSlot.js +7 -5
- package/dist/decision-table/DecisionGraphText.cjs +21 -9
- package/dist/decision-table/DecisionGraphText.d.ts +2 -3
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +21 -9
- package/dist/decision-table/DecisionText.cjs +8 -3
- package/dist/decision-table/DecisionText.d.ts +5 -5
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +8 -3
- package/dist/decision-table/ValueFields.cjs +9 -5
- package/dist/decision-table/ValueFields.d.ts +0 -2
- package/dist/decision-table/ValueFields.d.ts.map +1 -1
- package/dist/decision-table/ValueFields.js +9 -5
- package/dist/decision-table/ValuePopover.cjs +18 -28
- package/dist/decision-table/ValuePopover.d.ts +5 -4
- package/dist/decision-table/ValuePopover.d.ts.map +1 -1
- package/dist/decision-table/ValuePopover.js +18 -28
- package/dist/decision-table/__fixtures__/decisionGraph.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +4 -3
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +13 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts +7 -4
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/textMode.d.ts +7 -3
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphTypes.d.ts +27 -6
- package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
- package/dist/decision-table/decisionTextTypes.d.ts +8 -6
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
- package/dist/decision-table/hostValues.cjs +90 -0
- package/dist/decision-table/hostValues.d.ts +13 -0
- package/dist/decision-table/hostValues.d.ts.map +1 -0
- package/dist/decision-table/hostValues.js +50 -0
- package/dist/decision-table/index.d.ts +3 -2
- 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/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useDecisionTextStrings.cjs +0 -4
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionTextStrings.js +0 -4
- package/dist/decision-table/useEditState.cjs +17 -1
- package/dist/decision-table/useEditState.d.ts +3 -1
- package/dist/decision-table/useEditState.d.ts.map +1 -1
- package/dist/decision-table/useEditState.js +17 -1
- package/dist/decision-table/useHostValueEdit.cjs +91 -0
- package/dist/decision-table/useHostValueEdit.d.ts +5 -0
- package/dist/decision-table/useHostValueEdit.d.ts.map +1 -0
- package/dist/decision-table/useHostValueEdit.js +57 -0
- package/dist/decision-table/usePendingCondition.cjs +6 -5
- package/dist/decision-table/usePendingCondition.d.ts.map +1 -1
- package/dist/decision-table/usePendingCondition.js +7 -6
- package/dist/decision-table/useShapeDraft.cjs +93 -65
- package/dist/decision-table/useShapeDraft.d.ts +17 -14
- package/dist/decision-table/useShapeDraft.d.ts.map +1 -1
- package/dist/decision-table/useShapeDraft.js +93 -62
- package/dist/decision-table/useValueEditing.cjs +3 -7
- package/dist/decision-table/useValueEditing.d.ts.map +1 -1
- package/dist/decision-table/useValueEditing.js +3 -7
- package/dist/decision-table/valueTypes.d.ts +57 -19
- package/dist/decision-table/valueTypes.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -73,7 +73,7 @@ body.light, .apollo-design.light, :where(.light:not(.react-flow)) {
|
|
|
73
73
|
--color-success-text: #038108;
|
|
74
74
|
--color-success-background: #eeffe5;
|
|
75
75
|
--color-success-foreground-inverse: #74c94b;
|
|
76
|
-
--color-warning-icon: #
|
|
76
|
+
--color-warning-icon: #9e6100;
|
|
77
77
|
--color-warning-icon-inverse: #ffbb27;
|
|
78
78
|
--color-warning-text: #9e6100;
|
|
79
79
|
--color-warning-background: #fff3db;
|
|
@@ -685,7 +685,7 @@
|
|
|
685
685
|
--color-success-foreground-inverse-dark-hc: #6eb84a;
|
|
686
686
|
--color-success-foreground-inverse-future-dark: #007a55;
|
|
687
687
|
--color-success-foreground-inverse-future-light: #00d492;
|
|
688
|
-
--color-warning-icon-light: #
|
|
688
|
+
--color-warning-icon-light: #9e6100;
|
|
689
689
|
--color-warning-icon-light-hc: #805a07;
|
|
690
690
|
--color-warning-icon-dark: #ffbb27;
|
|
691
691
|
--color-warning-icon-dark-hc: #ffbb27;
|
|
@@ -684,7 +684,7 @@
|
|
|
684
684
|
@color-success-foreground-inverse-dark-hc: #6eb84a;
|
|
685
685
|
@color-success-foreground-inverse-future-dark: #007a55;
|
|
686
686
|
@color-success-foreground-inverse-future-light: #00d492;
|
|
687
|
-
@color-warning-icon-light: #
|
|
687
|
+
@color-warning-icon-light: #9e6100;
|
|
688
688
|
@color-warning-icon-light-hc: #805a07;
|
|
689
689
|
@color-warning-icon-dark: #ffbb27;
|
|
690
690
|
@color-warning-icon-dark-hc: #ffbb27;
|
|
@@ -685,7 +685,7 @@
|
|
|
685
685
|
--color-success-foreground-inverse-dark-hc: #6eb84a;
|
|
686
686
|
--color-success-foreground-inverse-future-dark: #007a55;
|
|
687
687
|
--color-success-foreground-inverse-future-light: #00d492;
|
|
688
|
-
--color-warning-icon-light: #
|
|
688
|
+
--color-warning-icon-light: #9e6100;
|
|
689
689
|
--color-warning-icon-light-hc: #805a07;
|
|
690
690
|
--color-warning-icon-dark: #ffbb27;
|
|
691
691
|
--color-warning-icon-dark-hc: #ffbb27;
|
|
@@ -686,7 +686,7 @@ $color-success-foreground-inverse-dark: #6eb84a !default;
|
|
|
686
686
|
$color-success-foreground-inverse-dark-hc: #6eb84a !default;
|
|
687
687
|
$color-success-foreground-inverse-future-dark: #007a55 !default;
|
|
688
688
|
$color-success-foreground-inverse-future-light: #00d492 !default;
|
|
689
|
-
$color-warning-icon-light: #
|
|
689
|
+
$color-warning-icon-light: #9e6100 !default;
|
|
690
690
|
$color-warning-icon-light-hc: #805a07 !default;
|
|
691
691
|
$color-warning-icon-dark: #ffbb27 !default;
|
|
692
692
|
$color-warning-icon-dark-hc: #ffbb27 !default;
|
|
@@ -47,7 +47,9 @@ const openOnKey = (event, open)=>{
|
|
|
47
47
|
};
|
|
48
48
|
const isOtherAction = (target)=>target instanceof Element && null !== target.closest('button:not([data-graph-toggle])');
|
|
49
49
|
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, cardRef, dataTestId })=>{
|
|
50
|
-
const
|
|
50
|
+
const { logic } = node;
|
|
51
|
+
const headingMark = node.mark?.mark;
|
|
52
|
+
const mark = (0, external_sentenceMarks_cjs_namespaceObject.isLineMark)(headingMark) ? headingMark : void 0;
|
|
51
53
|
const Heading = HEADINGS[Math.min(depth, HEADINGS.length - 1)] ?? 'h6';
|
|
52
54
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("section", {
|
|
53
55
|
ref: cardRef,
|
|
@@ -90,15 +92,15 @@ const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, la
|
|
|
90
92
|
className: "sr-only",
|
|
91
93
|
children: labels.usedBy(usedBy.join(', '))
|
|
92
94
|
}),
|
|
93
|
-
|
|
95
|
+
'table' === logic.kind && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
94
96
|
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_HIT_POLICY_CLASS,
|
|
95
97
|
"data-testid": `${dataTestId}-hit-policy-${node.id}`,
|
|
96
|
-
children:
|
|
98
|
+
children: logic.hitPolicy
|
|
97
99
|
}),
|
|
98
100
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
99
|
-
className: (0, apollo_wind_namespaceObject.cn)(external_decisionGraphStyles_cjs_namespaceObject.GRAPH_RULE_COUNT_CLASS,
|
|
101
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_decisionGraphStyles_cjs_namespaceObject.GRAPH_RULE_COUNT_CLASS, 'table' !== logic.kind && 'invisible'),
|
|
100
102
|
"data-testid": `${dataTestId}-rule-count-${node.id}`,
|
|
101
|
-
children:
|
|
103
|
+
children: 'table' === logic.kind && labels.ruleCount(logic.ruleCount)
|
|
102
104
|
}),
|
|
103
105
|
mark && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
104
106
|
type: "button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphCard.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAiBlG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAA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AAC;IAErB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAkBD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAiG9D,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAgCxE,CAAC"}
|
|
@@ -18,7 +18,9 @@ const openOnKey = (event, open)=>{
|
|
|
18
18
|
};
|
|
19
19
|
const isOtherAction = (target)=>target instanceof Element && null !== target.closest('button:not([data-graph-toggle])');
|
|
20
20
|
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, cardRef, dataTestId })=>{
|
|
21
|
-
const
|
|
21
|
+
const { logic } = node;
|
|
22
|
+
const headingMark = node.mark?.mark;
|
|
23
|
+
const mark = isLineMark(headingMark) ? headingMark : void 0;
|
|
22
24
|
const Heading = HEADINGS[Math.min(depth, HEADINGS.length - 1)] ?? 'h6';
|
|
23
25
|
return /*#__PURE__*/ jsxs("section", {
|
|
24
26
|
ref: cardRef,
|
|
@@ -61,15 +63,15 @@ const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, la
|
|
|
61
63
|
className: "sr-only",
|
|
62
64
|
children: labels.usedBy(usedBy.join(', '))
|
|
63
65
|
}),
|
|
64
|
-
|
|
66
|
+
'table' === logic.kind && /*#__PURE__*/ jsx("span", {
|
|
65
67
|
className: GRAPH_HIT_POLICY_CLASS,
|
|
66
68
|
"data-testid": `${dataTestId}-hit-policy-${node.id}`,
|
|
67
|
-
children:
|
|
69
|
+
children: logic.hitPolicy
|
|
68
70
|
}),
|
|
69
71
|
/*#__PURE__*/ jsx("span", {
|
|
70
|
-
className: cn(GRAPH_RULE_COUNT_CLASS,
|
|
72
|
+
className: cn(GRAPH_RULE_COUNT_CLASS, 'table' !== logic.kind && 'invisible'),
|
|
71
73
|
"data-testid": `${dataTestId}-rule-count-${node.id}`,
|
|
72
|
-
children:
|
|
74
|
+
children: 'table' === logic.kind && labels.ruleCount(logic.ruleCount)
|
|
73
75
|
}),
|
|
74
76
|
mark && /*#__PURE__*/ jsx("button", {
|
|
75
77
|
type: "button",
|
|
@@ -55,10 +55,10 @@ const minimapOf = (nodes, rules, labels)=>{
|
|
|
55
55
|
kind: 'decision',
|
|
56
56
|
decisionId: node.id,
|
|
57
57
|
label: node.label,
|
|
58
|
-
count:
|
|
59
|
-
meta: String(node.ruleCount),
|
|
60
|
-
ariaLabel: labels.minimapDecision(node.label, node.ruleCount)
|
|
61
|
-
},
|
|
58
|
+
count: 'table' === node.logic.kind ? {
|
|
59
|
+
meta: String(node.logic.ruleCount),
|
|
60
|
+
ariaLabel: labels.minimapDecision(node.label, node.logic.ruleCount)
|
|
61
|
+
} : null,
|
|
62
62
|
children: [
|
|
63
63
|
...ruleItems,
|
|
64
64
|
...node.children.map(toItem)
|
|
@@ -68,12 +68,14 @@ const minimapOf = (nodes, rules, labels)=>{
|
|
|
68
68
|
return nodes.map(toItem);
|
|
69
69
|
};
|
|
70
70
|
const targetOf = (item)=>'rule' === item.kind ? {
|
|
71
|
+
kind: 'rule',
|
|
71
72
|
decisionId: item.decisionId,
|
|
72
73
|
rowId: item.rowId
|
|
73
74
|
} : {
|
|
75
|
+
kind: 'decision',
|
|
74
76
|
decisionId: 'decision' === item.kind ? item.decisionId : item.targetId
|
|
75
77
|
};
|
|
76
|
-
const ruleTotalOf = (nodes)=>nodes.reduce((total, node)=>'decision' === node.kind ? total + (node.ruleCount
|
|
78
|
+
const ruleTotalOf = (nodes)=>nodes.reduce((total, node)=>'decision' === node.kind ? total + ('table' === node.logic.kind ? node.logic.ruleCount : 0) + ruleTotalOf(node.children) : total, 0);
|
|
77
79
|
const DecisionGraphMinimapSlot = ({ nodes, rules, selected, onPick, onLauncherEnd, labels, dataTestId })=>{
|
|
78
80
|
const slotRef = (0, external_react_namespaceObject.useRef)(null);
|
|
79
81
|
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphMinimapSlot.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphMinimapSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAEpC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,SAAS,YAAY,EAAE,CAAC;IAExD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAE9C,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"DecisionGraphMinimapSlot.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphMinimapSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAEpC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,SAAS,YAAY,EAAE,CAAC;IAExD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAE9C,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAkED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAkC5E,CAAC"}
|
|
@@ -27,10 +27,10 @@ const minimapOf = (nodes, rules, labels)=>{
|
|
|
27
27
|
kind: 'decision',
|
|
28
28
|
decisionId: node.id,
|
|
29
29
|
label: node.label,
|
|
30
|
-
count:
|
|
31
|
-
meta: String(node.ruleCount),
|
|
32
|
-
ariaLabel: labels.minimapDecision(node.label, node.ruleCount)
|
|
33
|
-
},
|
|
30
|
+
count: 'table' === node.logic.kind ? {
|
|
31
|
+
meta: String(node.logic.ruleCount),
|
|
32
|
+
ariaLabel: labels.minimapDecision(node.label, node.logic.ruleCount)
|
|
33
|
+
} : null,
|
|
34
34
|
children: [
|
|
35
35
|
...ruleItems,
|
|
36
36
|
...node.children.map(toItem)
|
|
@@ -40,12 +40,14 @@ const minimapOf = (nodes, rules, labels)=>{
|
|
|
40
40
|
return nodes.map(toItem);
|
|
41
41
|
};
|
|
42
42
|
const targetOf = (item)=>'rule' === item.kind ? {
|
|
43
|
+
kind: 'rule',
|
|
43
44
|
decisionId: item.decisionId,
|
|
44
45
|
rowId: item.rowId
|
|
45
46
|
} : {
|
|
47
|
+
kind: 'decision',
|
|
46
48
|
decisionId: 'decision' === item.kind ? item.decisionId : item.targetId
|
|
47
49
|
};
|
|
48
|
-
const ruleTotalOf = (nodes)=>nodes.reduce((total, node)=>'decision' === node.kind ? total + (node.ruleCount
|
|
50
|
+
const ruleTotalOf = (nodes)=>nodes.reduce((total, node)=>'decision' === node.kind ? total + ('table' === node.logic.kind ? node.logic.ruleCount : 0) + ruleTotalOf(node.children) : total, 0);
|
|
49
51
|
const DecisionGraphMinimapSlot = ({ nodes, rules, selected, onPick, onLauncherEnd, labels, dataTestId })=>{
|
|
50
52
|
const slotRef = useRef(null);
|
|
51
53
|
useLayoutEffect(()=>{
|
|
@@ -36,6 +36,14 @@ const external_sentenceRuleHeights_cjs_namespaceObject = require("./sentenceRule
|
|
|
36
36
|
const external_useDecisionGraphStrings_cjs_namespaceObject = require("./useDecisionGraphStrings.cjs");
|
|
37
37
|
const external_useRuleWindow_cjs_namespaceObject = require("./useRuleWindow.cjs");
|
|
38
38
|
const NO_EXPANDED = new Set();
|
|
39
|
+
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
40
|
+
kind: 'rule',
|
|
41
|
+
decisionId: id,
|
|
42
|
+
rowId: mark.rowId
|
|
43
|
+
} : {
|
|
44
|
+
kind: 'decision',
|
|
45
|
+
decisionId: id
|
|
46
|
+
};
|
|
39
47
|
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
40
48
|
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
41
49
|
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -91,7 +99,7 @@ const ruleCountsOf = (nodes)=>{
|
|
|
91
99
|
const counts = new Map();
|
|
92
100
|
const visit = (node)=>{
|
|
93
101
|
if ('decision' !== node.kind) return;
|
|
94
|
-
if (
|
|
102
|
+
if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
|
|
95
103
|
for (const child of node.children)visit(child);
|
|
96
104
|
};
|
|
97
105
|
for (const node of nodes)visit(node);
|
|
@@ -109,11 +117,11 @@ const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
|
109
117
|
}
|
|
110
118
|
return 0 === rules ? external_sentenceRuleHeights_cjs_namespaceObject.SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
111
119
|
};
|
|
112
|
-
const DecisionGraphText = ({ nodes, renderBody,
|
|
120
|
+
const DecisionGraphText = ({ nodes, renderBody, expansion, onFold, selected = null, onReveal, onOpenDecision, rules, dataTestId })=>{
|
|
113
121
|
const labels = (0, external_useDecisionGraphStrings_cjs_namespaceObject.useDecisionGraphLabels)();
|
|
114
122
|
const idPrefix = (0, external_react_namespaceObject.useId)();
|
|
115
123
|
const [ownExpanded, setOwnExpanded] = (0, external_react_namespaceObject.useState)(NO_EXPANDED);
|
|
116
|
-
const expanded =
|
|
124
|
+
const expanded = expansion?.expanded ?? ownExpanded;
|
|
117
125
|
const users = (0, external_react_namespaceObject.useMemo)(()=>usersOf(nodes), [
|
|
118
126
|
nodes
|
|
119
127
|
]);
|
|
@@ -130,8 +138,8 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
130
138
|
nodes
|
|
131
139
|
]);
|
|
132
140
|
const setExpanded = (next)=>{
|
|
133
|
-
if (
|
|
134
|
-
|
|
141
|
+
if (expansion) expansion.onChange(next);
|
|
142
|
+
else setOwnExpanded(next);
|
|
135
143
|
};
|
|
136
144
|
const toggle = (decisionId)=>{
|
|
137
145
|
const next = new Set(expanded);
|
|
@@ -147,9 +155,13 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
147
155
|
]));
|
|
148
156
|
setPending(target);
|
|
149
157
|
setRevealed(target.decisionId);
|
|
150
|
-
if ('navigate' === target.mode.kind) onReveal?.({
|
|
158
|
+
if ('navigate' === target.mode.kind) onReveal?.('rule' === target.kind ? {
|
|
159
|
+
kind: 'rule',
|
|
151
160
|
decisionId: target.decisionId,
|
|
152
161
|
rowId: target.rowId
|
|
162
|
+
} : {
|
|
163
|
+
kind: 'decision',
|
|
164
|
+
decisionId: target.decisionId
|
|
153
165
|
});
|
|
154
166
|
};
|
|
155
167
|
const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
|
|
@@ -231,7 +243,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
231
243
|
const apply = ()=>{
|
|
232
244
|
const card = cardsRef.current.get(pending.decisionId);
|
|
233
245
|
if (!scroller || !card) return false;
|
|
234
|
-
if (
|
|
246
|
+
if ('decision' === pending.kind) {
|
|
235
247
|
if ('navigate' === pending.mode.kind) scrollTo(scroller, (0, external_useRuleWindow_cjs_namespaceObject.contentTopIn)(card, scroller));
|
|
236
248
|
if (focuses(pending.mode)) card.querySelector('[data-graph-toggle]')?.focus({
|
|
237
249
|
preventScroll: true
|
|
@@ -264,6 +276,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
264
276
|
node: node,
|
|
265
277
|
labels: labels,
|
|
266
278
|
onReveal: ()=>reveal({
|
|
279
|
+
kind: 'decision',
|
|
267
280
|
decisionId: node.targetId,
|
|
268
281
|
mode: {
|
|
269
282
|
kind: 'navigate',
|
|
@@ -288,8 +301,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
288
301
|
labels: labels,
|
|
289
302
|
onToggle: ()=>toggle(node.id),
|
|
290
303
|
onShowProblem: (byKey)=>reveal({
|
|
291
|
-
|
|
292
|
-
rowId: node.markRowId,
|
|
304
|
+
...markTargetOf(node),
|
|
293
305
|
mode: byKey ? {
|
|
294
306
|
kind: 'navigate',
|
|
295
307
|
focus: true,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type DecisionGraphMinimapSlotProps } from './DecisionGraphMinimapSlot';
|
|
3
|
-
import type { DecisionGraphNode, DecisionGraphTarget } from './decisionGraphTypes';
|
|
3
|
+
import type { DecisionGraphExpansion, DecisionGraphNode, DecisionGraphTarget } from './decisionGraphTypes';
|
|
4
4
|
import type { ContainerHandlersParams } from './useContainerHandlers';
|
|
5
5
|
import { type DecisionTextScroll } from './useRuleWindow';
|
|
6
6
|
export interface DecisionGraphTextProps {
|
|
7
7
|
nodes: readonly DecisionGraphNode[];
|
|
8
8
|
renderBody: (decisionId: string, scroll: Exclude<DecisionTextScroll, 'self'>) => React.ReactNode;
|
|
9
9
|
onFold?: (decisionId: string) => void;
|
|
10
|
-
|
|
11
|
-
onExpandedChange?: (expanded: ReadonlySet<string>) => void;
|
|
10
|
+
expansion?: DecisionGraphExpansion;
|
|
12
11
|
selected?: string | null;
|
|
13
12
|
onReveal?: (target: DecisionGraphTarget) => void;
|
|
14
13
|
onOpenDecision?: ContainerHandlersParams['onOpenDecision'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,4BAA4B,CAAC;AAWpC,OAAO,KAAK,EAEV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,WAAW,sBAAsB;IAErC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;I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KAAK,CAAC,EAAE,CAAC,sBAAsB,CA6Q9D,CAAC"}
|
|
@@ -8,6 +8,14 @@ import { SENTENCE_MIN_RULE_HEIGHT_PX } from "./sentenceRuleHeights.js";
|
|
|
8
8
|
import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
|
|
9
9
|
import { contentTopIn } from "./useRuleWindow.js";
|
|
10
10
|
const NO_EXPANDED = new Set();
|
|
11
|
+
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
12
|
+
kind: 'rule',
|
|
13
|
+
decisionId: id,
|
|
14
|
+
rowId: mark.rowId
|
|
15
|
+
} : {
|
|
16
|
+
kind: 'decision',
|
|
17
|
+
decisionId: id
|
|
18
|
+
};
|
|
11
19
|
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
12
20
|
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
13
21
|
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -63,7 +71,7 @@ const ruleCountsOf = (nodes)=>{
|
|
|
63
71
|
const counts = new Map();
|
|
64
72
|
const visit = (node)=>{
|
|
65
73
|
if ('decision' !== node.kind) return;
|
|
66
|
-
if (
|
|
74
|
+
if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
|
|
67
75
|
for (const child of node.children)visit(child);
|
|
68
76
|
};
|
|
69
77
|
for (const node of nodes)visit(node);
|
|
@@ -81,11 +89,11 @@ const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
|
81
89
|
}
|
|
82
90
|
return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
83
91
|
};
|
|
84
|
-
const DecisionGraphText = ({ nodes, renderBody,
|
|
92
|
+
const DecisionGraphText = ({ nodes, renderBody, expansion, onFold, selected = null, onReveal, onOpenDecision, rules, dataTestId })=>{
|
|
85
93
|
const labels = useDecisionGraphLabels();
|
|
86
94
|
const idPrefix = useId();
|
|
87
95
|
const [ownExpanded, setOwnExpanded] = useState(NO_EXPANDED);
|
|
88
|
-
const expanded =
|
|
96
|
+
const expanded = expansion?.expanded ?? ownExpanded;
|
|
89
97
|
const users = useMemo(()=>usersOf(nodes), [
|
|
90
98
|
nodes
|
|
91
99
|
]);
|
|
@@ -102,8 +110,8 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
102
110
|
nodes
|
|
103
111
|
]);
|
|
104
112
|
const setExpanded = (next)=>{
|
|
105
|
-
if (
|
|
106
|
-
|
|
113
|
+
if (expansion) expansion.onChange(next);
|
|
114
|
+
else setOwnExpanded(next);
|
|
107
115
|
};
|
|
108
116
|
const toggle = (decisionId)=>{
|
|
109
117
|
const next = new Set(expanded);
|
|
@@ -119,9 +127,13 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
119
127
|
]));
|
|
120
128
|
setPending(target);
|
|
121
129
|
setRevealed(target.decisionId);
|
|
122
|
-
if ('navigate' === target.mode.kind) onReveal?.({
|
|
130
|
+
if ('navigate' === target.mode.kind) onReveal?.('rule' === target.kind ? {
|
|
131
|
+
kind: 'rule',
|
|
123
132
|
decisionId: target.decisionId,
|
|
124
133
|
rowId: target.rowId
|
|
134
|
+
} : {
|
|
135
|
+
kind: 'decision',
|
|
136
|
+
decisionId: target.decisionId
|
|
125
137
|
});
|
|
126
138
|
};
|
|
127
139
|
const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
|
|
@@ -203,7 +215,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
203
215
|
const apply = ()=>{
|
|
204
216
|
const card = cardsRef.current.get(pending.decisionId);
|
|
205
217
|
if (!scroller || !card) return false;
|
|
206
|
-
if (
|
|
218
|
+
if ('decision' === pending.kind) {
|
|
207
219
|
if ('navigate' === pending.mode.kind) scrollTo(scroller, contentTopIn(card, scroller));
|
|
208
220
|
if (focuses(pending.mode)) card.querySelector('[data-graph-toggle]')?.focus({
|
|
209
221
|
preventScroll: true
|
|
@@ -236,6 +248,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
236
248
|
node: node,
|
|
237
249
|
labels: labels,
|
|
238
250
|
onReveal: ()=>reveal({
|
|
251
|
+
kind: 'decision',
|
|
239
252
|
decisionId: node.targetId,
|
|
240
253
|
mode: {
|
|
241
254
|
kind: 'navigate',
|
|
@@ -260,8 +273,7 @@ const DecisionGraphText = ({ nodes, renderBody, expanded: hostExpanded, onExpand
|
|
|
260
273
|
labels: labels,
|
|
261
274
|
onToggle: ()=>toggle(node.id),
|
|
262
275
|
onShowProblem: (byKey)=>reveal({
|
|
263
|
-
|
|
264
|
-
rowId: node.markRowId,
|
|
276
|
+
...markTargetOf(node),
|
|
265
277
|
mode: byKey ? {
|
|
266
278
|
kind: 'navigate',
|
|
267
279
|
focus: true,
|
|
@@ -51,11 +51,12 @@ const external_useCellHover_cjs_namespaceObject = require("./useCellHover.cjs");
|
|
|
51
51
|
const external_useColumnEditing_cjs_namespaceObject = require("./useColumnEditing.cjs");
|
|
52
52
|
const external_useContainerHandlers_cjs_namespaceObject = require("./useContainerHandlers.cjs");
|
|
53
53
|
const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
|
|
54
|
-
const
|
|
54
|
+
const external_useHostValueEdit_cjs_namespaceObject = require("./useHostValueEdit.cjs");
|
|
55
55
|
const external_usePendingCondition_cjs_namespaceObject = require("./usePendingCondition.cjs");
|
|
56
56
|
const external_useRuleMenus_cjs_namespaceObject = require("./useRuleMenus.cjs");
|
|
57
57
|
const external_useRuleWindow_cjs_namespaceObject = require("./useRuleWindow.cjs");
|
|
58
58
|
const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenceNavigation.cjs");
|
|
59
|
+
const external_useTextAnnouncements_cjs_namespaceObject = require("./useTextAnnouncements.cjs");
|
|
59
60
|
const external_useValueEditing_cjs_namespaceObject = require("./useValueEditing.cjs");
|
|
60
61
|
const external_ValueEditorOverlay_cjs_namespaceObject = require("./ValueEditorOverlay.cjs");
|
|
61
62
|
const NO_FOLDS = new Set();
|
|
@@ -82,8 +83,11 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
82
83
|
const idPrefix = (0, external_react_namespaceObject.useId)();
|
|
83
84
|
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
84
85
|
const labels = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
|
|
85
|
-
const
|
|
86
|
-
const { edit, refusal } = (0,
|
|
86
|
+
const announcements = (0, external_useTextAnnouncements_cjs_namespaceObject.useTextAnnouncements)(_, dataTestId);
|
|
87
|
+
const { edit, refusal } = (0, external_useHostValueEdit_cjs_namespaceObject.useHostValueEdit)('edit' === mode.kind ? mode.edit : void 0, [
|
|
88
|
+
...inputs,
|
|
89
|
+
...outputs
|
|
90
|
+
], (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextEditLabels)(), announcements);
|
|
87
91
|
const addRule = 'edit' === mode.kind ? {
|
|
88
92
|
label: labels.addRule,
|
|
89
93
|
onAdd: mode.onAddRule
|
|
@@ -281,6 +285,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
281
285
|
entries: ruleMenus.entries,
|
|
282
286
|
onClose: ruleMenus.onClose
|
|
283
287
|
}),
|
|
288
|
+
announcements.region,
|
|
284
289
|
children
|
|
285
290
|
]
|
|
286
291
|
});
|
|
@@ -11,7 +11,7 @@ import { type ContainerHandlersParams, type DecisionTextContainerProps } from '.
|
|
|
11
11
|
import { type DecisionTextScroll } from './useRuleWindow';
|
|
12
12
|
import { type SentenceNavigationSource } from './useSentenceNavigation';
|
|
13
13
|
type SelectHandler = NonNullable<SentenceNavigationSource['onSelect']>;
|
|
14
|
-
export type DecisionTextMode<Policy, Total, Type> = {
|
|
14
|
+
export type DecisionTextMode<Op, Policy, Total, Type, Refusal> = {
|
|
15
15
|
kind: 'read';
|
|
16
16
|
selected: SentenceSelection | null;
|
|
17
17
|
} | {
|
|
@@ -22,16 +22,16 @@ export type DecisionTextMode<Policy, Total, Type> = {
|
|
|
22
22
|
kind: 'edit';
|
|
23
23
|
selected: SentenceSelection | null;
|
|
24
24
|
onSelect: SelectHandler;
|
|
25
|
-
edit: DecisionTextEdit<Type>;
|
|
25
|
+
edit: DecisionTextEdit<Op, Type, Refusal>;
|
|
26
26
|
onPolicyChange: (picked: HitPolicyPick<Policy, Total>) => void;
|
|
27
27
|
onAddRule: () => void;
|
|
28
28
|
} | {
|
|
29
29
|
kind: 'diff';
|
|
30
30
|
diff: DecisionTextDiff<Policy, Total, Type>;
|
|
31
31
|
};
|
|
32
|
-
export interface DecisionTextProps<Policy, Total, Type> {
|
|
32
|
+
export interface DecisionTextProps<Op, Policy, Total, Type, Refusal> {
|
|
33
33
|
table: DecisionTextTable<Policy, Total, Type>;
|
|
34
|
-
mode: DecisionTextMode<Policy, Total, Type>;
|
|
34
|
+
mode: DecisionTextMode<Op, Policy, Total, Type, Refusal>;
|
|
35
35
|
hitPolicies: HitPolicyCatalog<Policy, Total>;
|
|
36
36
|
columnTypes: readonly ColumnTypeOption<Type>[];
|
|
37
37
|
numbered?: boolean;
|
|
@@ -45,6 +45,6 @@ export interface DecisionTextProps<Policy, Total, Type> {
|
|
|
45
45
|
dataTestId: string;
|
|
46
46
|
children?: React.ReactNode;
|
|
47
47
|
}
|
|
48
|
-
export declare const DecisionText: <Policy, Total, Type>({ table, mode, hitPolicies, columnTypes, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Policy, Total, Type>) => React.JSX.Element;
|
|
48
|
+
export declare const DecisionText: <Op, Policy, Total, Type, Refusal>({ table, mode, hitPolicies, columnTypes, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Op, Policy, Total, Type, Refusal>) => React.JSX.Element;
|
|
49
49
|
export {};
|
|
50
50
|
//# sourceMappingURL=DecisionText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAMvD,OAAO,KAAK,EACV,iBAAiB,EAGjB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAEhC,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,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12 @@ import { useCellHover } from "./useCellHover.js";
|
|
|
23
23
|
import { useColumnEditing } from "./useColumnEditing.js";
|
|
24
24
|
import { useContainerHandlers } from "./useContainerHandlers.js";
|
|
25
25
|
import { useDecisionTextEditLabels, useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
26
|
-
import {
|
|
26
|
+
import { useHostValueEdit } from "./useHostValueEdit.js";
|
|
27
27
|
import { usePendingCondition } from "./usePendingCondition.js";
|
|
28
28
|
import { useRuleMenus } from "./useRuleMenus.js";
|
|
29
29
|
import { useRuleWindow } from "./useRuleWindow.js";
|
|
30
30
|
import { useSentenceNavigation } from "./useSentenceNavigation.js";
|
|
31
|
+
import { useTextAnnouncements } from "./useTextAnnouncements.js";
|
|
31
32
|
import { useValueEditing } from "./useValueEditing.js";
|
|
32
33
|
import { ValueEditorOverlay } from "./ValueEditorOverlay.js";
|
|
33
34
|
const NO_FOLDS = new Set();
|
|
@@ -54,8 +55,11 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
54
55
|
const idPrefix = useId();
|
|
55
56
|
const { _ } = useSafeLingui();
|
|
56
57
|
const labels = useDecisionTextLabels();
|
|
57
|
-
const
|
|
58
|
-
const { edit, refusal } =
|
|
58
|
+
const announcements = useTextAnnouncements(_, dataTestId);
|
|
59
|
+
const { edit, refusal } = useHostValueEdit('edit' === mode.kind ? mode.edit : void 0, [
|
|
60
|
+
...inputs,
|
|
61
|
+
...outputs
|
|
62
|
+
], useDecisionTextEditLabels(), announcements);
|
|
59
63
|
const addRule = 'edit' === mode.kind ? {
|
|
60
64
|
label: labels.addRule,
|
|
61
65
|
onAdd: mode.onAddRule
|
|
@@ -253,6 +257,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
253
257
|
entries: ruleMenus.entries,
|
|
254
258
|
onClose: ruleMenus.onClose
|
|
255
259
|
}),
|
|
260
|
+
announcements.region,
|
|
256
261
|
children
|
|
257
262
|
]
|
|
258
263
|
});
|
|
@@ -36,16 +36,18 @@ const invalidEnds = ({ problem, text, high })=>{
|
|
|
36
36
|
const missing = 'missingEnd' === problem;
|
|
37
37
|
return {
|
|
38
38
|
low: missing && '' === text.trim(),
|
|
39
|
-
high: missing && '' === high.trim()
|
|
39
|
+
high: missing && '' === high.trim()
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
const ValueFields = ({ draft,
|
|
42
|
+
const ValueFields = ({ draft, index, column, ariaLabel, onPick, onFieldsKeyDown, onValueKeyDown, focusRef, keyShortcuts, labels, describedBy, dataTestId })=>{
|
|
43
43
|
const { shape, text, allowedValues, listed, checked } = draft;
|
|
44
|
+
const held = draft.heldValueAt(index);
|
|
44
45
|
const choices = allowedValues.length > 0;
|
|
45
46
|
const allowed = new Set(allowedValues);
|
|
46
47
|
const outsideAllowed = (options)=>choices ? [
|
|
47
48
|
...new Set(options)
|
|
48
49
|
].filter((option)=>'' !== option.trim() && !allowed.has(option)) : [];
|
|
50
|
+
if ('valueless' === shape) return null;
|
|
49
51
|
if ('range' === shape) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
50
52
|
onKeyDown: onFieldsKeyDown,
|
|
51
53
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_RangeFields_cjs_namespaceObject.RangeFields, {
|
|
@@ -74,7 +76,7 @@ const ValueFields = ({ draft, value, index, values, column, ariaLabel, onPick, o
|
|
|
74
76
|
adding: draft.adding,
|
|
75
77
|
onAddingChange: draft.setAdding,
|
|
76
78
|
addLabel: labels.addValue,
|
|
77
|
-
focused:
|
|
79
|
+
focused: draft.heldList[index] ?? checked[0] ?? listed[0],
|
|
78
80
|
focusRef: focusRef,
|
|
79
81
|
label: column,
|
|
80
82
|
describedBy: describedBy,
|
|
@@ -87,8 +89,10 @@ const ValueFields = ({ draft, value, index, values, column, ariaLabel, onPick, o
|
|
|
87
89
|
onKeyDown: onValueKeyDown,
|
|
88
90
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_AllowedValueList_cjs_namespaceObject.AllowedValueList, {
|
|
89
91
|
values: allowedValues,
|
|
90
|
-
notAllowed: outsideAllowed([
|
|
91
|
-
|
|
92
|
+
notAllowed: outsideAllowed(void 0 === held ? [
|
|
93
|
+
text
|
|
94
|
+
] : [
|
|
95
|
+
held,
|
|
92
96
|
text
|
|
93
97
|
]),
|
|
94
98
|
notAllowedLabel: labels.notAllowed,
|
|
@@ -8,9 +8,7 @@ export interface ValueFieldsLabels extends RangeFieldsLabels {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ValueFieldsProps {
|
|
10
10
|
draft: ShapeDraft;
|
|
11
|
-
value: string;
|
|
12
11
|
index: number;
|
|
13
|
-
values: readonly string[] | undefined;
|
|
14
12
|
column: string;
|
|
15
13
|
ariaLabel: string;
|
|
16
14
|
onPick: AllowedValueListProps['onPick'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueFields.d.ts","sourceRoot":"","sources":["../../src/decision-table/ValueFields.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAE1D,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"ValueFields.d.ts","sourceRoot":"","sources":["../../src/decision-table/ValueFields.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAE1D,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACxC,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACzD,cAAc,EAAE,KAAK,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAE1B,UAAU,EAAE,MAAM,CAAC;CACpB;AASD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmGlD,CAAC"}
|
|
@@ -8,16 +8,18 @@ const invalidEnds = ({ problem, text, high })=>{
|
|
|
8
8
|
const missing = 'missingEnd' === problem;
|
|
9
9
|
return {
|
|
10
10
|
low: missing && '' === text.trim(),
|
|
11
|
-
high: missing && '' === high.trim()
|
|
11
|
+
high: missing && '' === high.trim()
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
const ValueFields = ({ draft,
|
|
14
|
+
const ValueFields = ({ draft, index, column, ariaLabel, onPick, onFieldsKeyDown, onValueKeyDown, focusRef, keyShortcuts, labels, describedBy, dataTestId })=>{
|
|
15
15
|
const { shape, text, allowedValues, listed, checked } = draft;
|
|
16
|
+
const held = draft.heldValueAt(index);
|
|
16
17
|
const choices = allowedValues.length > 0;
|
|
17
18
|
const allowed = new Set(allowedValues);
|
|
18
19
|
const outsideAllowed = (options)=>choices ? [
|
|
19
20
|
...new Set(options)
|
|
20
21
|
].filter((option)=>'' !== option.trim() && !allowed.has(option)) : [];
|
|
22
|
+
if ('valueless' === shape) return null;
|
|
21
23
|
if ('range' === shape) return /*#__PURE__*/ jsx("div", {
|
|
22
24
|
onKeyDown: onFieldsKeyDown,
|
|
23
25
|
children: /*#__PURE__*/ jsx(RangeFields, {
|
|
@@ -46,7 +48,7 @@ const ValueFields = ({ draft, value, index, values, column, ariaLabel, onPick, o
|
|
|
46
48
|
adding: draft.adding,
|
|
47
49
|
onAddingChange: draft.setAdding,
|
|
48
50
|
addLabel: labels.addValue,
|
|
49
|
-
focused:
|
|
51
|
+
focused: draft.heldList[index] ?? checked[0] ?? listed[0],
|
|
50
52
|
focusRef: focusRef,
|
|
51
53
|
label: column,
|
|
52
54
|
describedBy: describedBy,
|
|
@@ -59,8 +61,10 @@ const ValueFields = ({ draft, value, index, values, column, ariaLabel, onPick, o
|
|
|
59
61
|
onKeyDown: onValueKeyDown,
|
|
60
62
|
children: /*#__PURE__*/ jsx(AllowedValueList, {
|
|
61
63
|
values: allowedValues,
|
|
62
|
-
notAllowed: outsideAllowed([
|
|
63
|
-
|
|
64
|
+
notAllowed: outsideAllowed(void 0 === held ? [
|
|
65
|
+
text
|
|
66
|
+
] : [
|
|
67
|
+
held,
|
|
64
68
|
text
|
|
65
69
|
]),
|
|
66
70
|
notAllowedLabel: labels.notAllowed,
|