@uipath/apollo-react 7.20.0 → 7.21.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/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/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 +3 -3
|
@@ -21,10 +21,6 @@ const firstValuesOf = (rule)=>{
|
|
|
21
21
|
});
|
|
22
22
|
return first;
|
|
23
23
|
};
|
|
24
|
-
const cellName = ({ cell }, column, values, position)=>cell?.(column, values, position) ?? [
|
|
25
|
-
column,
|
|
26
|
-
values
|
|
27
|
-
].filter(Boolean).join(' ');
|
|
28
24
|
const verdictOf = (rule, columnId, cells, labels)=>{
|
|
29
25
|
const matched = isOutcome(rule, columnId) ? void 0 : cells?.[columnId]?.matched;
|
|
30
26
|
return void 0 === matched ? '' : labels.conditionVerdict(matched);
|
|
@@ -67,7 +63,7 @@ const ruleCardModel = ({ rule, position, numbered, mark, selectable, decisionLin
|
|
|
67
63
|
token,
|
|
68
64
|
labelId: `${id}-cell-${index}`,
|
|
69
65
|
label: [
|
|
70
|
-
|
|
66
|
+
labels.cell(columnNameOf(rule, columnId), shownValuesOf(parts, columnId, labels), position),
|
|
71
67
|
verdictOf(rule, columnId, cells, labels)
|
|
72
68
|
].filter(Boolean).join(' '),
|
|
73
69
|
editable: void 0 !== editLabels
|
|
@@ -112,9 +108,9 @@ const ruleCardModel = ({ rule, position, numbered, mark, selectable, decisionLin
|
|
|
112
108
|
].flatMap((badge)=>badge ? markIds(badge.id, badge.marks) : []).join(' ') || void 0,
|
|
113
109
|
stops,
|
|
114
110
|
stopOf: (token)=>stopByToken.get(token),
|
|
115
|
-
linkOf: (token)=>decisionLinks && 'input' === token.kind && void 0 !== token.
|
|
116
|
-
decisionId: token.
|
|
117
|
-
label: labels.openDecision
|
|
111
|
+
linkOf: (token)=>decisionLinks && 'input' === token.kind && void 0 !== token.producedBy ? {
|
|
112
|
+
decisionId: token.producedBy,
|
|
113
|
+
label: labels.openDecision(token.text),
|
|
118
114
|
tabbable: !selectable
|
|
119
115
|
} : void 0,
|
|
120
116
|
badges,
|
|
@@ -128,4 +124,4 @@ const ruleCardModel = ({ rule, position, numbered, mark, selectable, decisionLin
|
|
|
128
124
|
}
|
|
129
125
|
};
|
|
130
126
|
};
|
|
131
|
-
export {
|
|
127
|
+
export { firstValuesOf, ruleCardModel };
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
conditionEntriesOf: ()=>conditionEntriesOf,
|
|
28
|
+
ruleEntriesOf: ()=>ruleEntriesOf
|
|
29
|
+
});
|
|
30
|
+
const external_sentenceParts_cjs_namespaceObject = require("./sentenceParts.cjs");
|
|
31
|
+
const DIVIDER = {
|
|
32
|
+
divider: true
|
|
33
|
+
};
|
|
34
|
+
const joined = (groups)=>groups.filter((group)=>group.length > 0).flatMap((group, index)=>0 === index ? group : [
|
|
35
|
+
DIVIDER,
|
|
36
|
+
...group
|
|
37
|
+
]);
|
|
38
|
+
const ruleEntriesOf = (actions, labels, rules, rowId)=>{
|
|
39
|
+
const index = rules.findIndex((rule)=>rule.rowId === rowId);
|
|
40
|
+
if (index < 0) return [];
|
|
41
|
+
const { onInsertRule, onDuplicateRule, onClearRule, onMoveRule, onDeleteRule } = actions;
|
|
42
|
+
return joined([
|
|
43
|
+
[
|
|
44
|
+
...onInsertRule ? [
|
|
45
|
+
{
|
|
46
|
+
label: labels.insertRuleAbove,
|
|
47
|
+
onClick: ()=>onInsertRule(index)
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: labels.insertRuleBelow,
|
|
51
|
+
onClick: ()=>onInsertRule(index + 1)
|
|
52
|
+
}
|
|
53
|
+
] : [],
|
|
54
|
+
...onDuplicateRule ? [
|
|
55
|
+
{
|
|
56
|
+
label: labels.duplicateRule,
|
|
57
|
+
onClick: ()=>onDuplicateRule(rowId)
|
|
58
|
+
}
|
|
59
|
+
] : [],
|
|
60
|
+
...onClearRule ? [
|
|
61
|
+
{
|
|
62
|
+
label: labels.clearRule,
|
|
63
|
+
onClick: ()=>onClearRule(rowId)
|
|
64
|
+
}
|
|
65
|
+
] : []
|
|
66
|
+
],
|
|
67
|
+
onMoveRule ? [
|
|
68
|
+
{
|
|
69
|
+
label: labels.moveRuleUp,
|
|
70
|
+
disabled: 0 === index,
|
|
71
|
+
onClick: ()=>onMoveRule(index, index - 1)
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: labels.moveRuleDown,
|
|
75
|
+
disabled: index === rules.length - 1,
|
|
76
|
+
onClick: ()=>onMoveRule(index, index + 1)
|
|
77
|
+
}
|
|
78
|
+
] : [],
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
label: labels.deleteRule(index + 1),
|
|
82
|
+
destructive: true,
|
|
83
|
+
onClick: ()=>onDeleteRule(rowId)
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
]);
|
|
87
|
+
};
|
|
88
|
+
const conditionEntriesOf = (actions, labels, rule, bands, startEdit)=>{
|
|
89
|
+
if (!rule) return [];
|
|
90
|
+
const { rowId } = rule;
|
|
91
|
+
const columns = bands.flatMap((band)=>band.columns);
|
|
92
|
+
const unused = [
|
|
93
|
+
...new Set(actions.inputIds)
|
|
94
|
+
].flatMap((columnId)=>{
|
|
95
|
+
const column = columns.find((candidate)=>candidate.id === columnId);
|
|
96
|
+
if (!column || (0, external_sentenceParts_cjs_namespaceObject.hasStop)(rule, columnId)) return [];
|
|
97
|
+
return [
|
|
98
|
+
{
|
|
99
|
+
label: column.name,
|
|
100
|
+
icon: column.icon,
|
|
101
|
+
focusesOwnSurface: true,
|
|
102
|
+
onClick: ()=>startEdit({
|
|
103
|
+
rowId,
|
|
104
|
+
columnId,
|
|
105
|
+
index: 0
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
});
|
|
110
|
+
const { onAddInput } = actions;
|
|
111
|
+
const addInput = ()=>{
|
|
112
|
+
const columnId = onAddInput?.(rowId);
|
|
113
|
+
if ('string' == typeof columnId) startEdit({
|
|
114
|
+
rowId,
|
|
115
|
+
columnId,
|
|
116
|
+
index: 0
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return joined([
|
|
120
|
+
unused,
|
|
121
|
+
onAddInput ? [
|
|
122
|
+
{
|
|
123
|
+
label: labels.addInput,
|
|
124
|
+
focusesOwnSurface: true,
|
|
125
|
+
onClick: addInput
|
|
126
|
+
}
|
|
127
|
+
] : []
|
|
128
|
+
]);
|
|
129
|
+
};
|
|
130
|
+
exports.conditionEntriesOf = __webpack_exports__.conditionEntriesOf;
|
|
131
|
+
exports.ruleEntriesOf = __webpack_exports__.ruleEntriesOf;
|
|
132
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
133
|
+
"conditionEntriesOf",
|
|
134
|
+
"ruleEntriesOf"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DecisionTableProps } from './DecisionTable';
|
|
2
|
+
import type { GridMenuEntry } from './GridMenu';
|
|
3
|
+
import type { RuleActionsLabels } from './RuleActions';
|
|
4
|
+
import type { SentenceBand, SentenceRule, SentenceValueId } from './sentenceTypes';
|
|
5
|
+
export interface RuleMenuLabels extends Pick<RuleActionsLabels, 'deleteRule'> {
|
|
6
|
+
insertRuleAbove: string;
|
|
7
|
+
insertRuleBelow: string;
|
|
8
|
+
duplicateRule: string;
|
|
9
|
+
clearRule: string;
|
|
10
|
+
moveRuleUp: string;
|
|
11
|
+
moveRuleDown: string;
|
|
12
|
+
addInput: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RuleMenuActions {
|
|
15
|
+
inputIds?: readonly string[];
|
|
16
|
+
onAddInput?: (rowId: string) => string | void;
|
|
17
|
+
onInsertRule?: (index: number) => void;
|
|
18
|
+
onDuplicateRule?: (rowId: string) => void;
|
|
19
|
+
onClearRule?: (rowId: string) => void;
|
|
20
|
+
onMoveRule?: DecisionTableProps['onRowMove'];
|
|
21
|
+
onDeleteRule: (rowId: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const ruleEntriesOf: (actions: RuleMenuActions, labels: RuleMenuLabels, rules: readonly SentenceRule[], rowId: string) => GridMenuEntry[];
|
|
24
|
+
export declare const conditionEntriesOf: (actions: RuleMenuActions, labels: RuleMenuLabels, rule: SentenceRule | undefined, bands: readonly SentenceBand[], startEdit: (value: SentenceValueId) => void) => GridMenuEntry[];
|
|
25
|
+
//# sourceMappingURL=ruleMenuEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleMenuEntries.d.ts","sourceRoot":"","sources":["../../src/decision-table/ruleMenuEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGnF,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC;IAC3E,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IAErB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,eAAe;IAE9B,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE7B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAE9C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,UAAU,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAE7C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAUD,eAAO,MAAM,aAAa,GACxB,SAAS,eAAe,EACxB,QAAQ,cAAc,EACtB,OAAO,SAAS,YAAY,EAAE,EAC9B,OAAO,MAAM,KACZ,aAAa,EAuCf,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,eAAe,EACxB,QAAQ,cAAc,EACtB,MAAM,YAAY,GAAG,SAAS,EAC9B,OAAO,SAAS,YAAY,EAAE,EAC9B,WAAW,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,KAC1C,aAAa,EAyBf,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { hasStop } from "./sentenceParts.js";
|
|
2
|
+
const DIVIDER = {
|
|
3
|
+
divider: true
|
|
4
|
+
};
|
|
5
|
+
const joined = (groups)=>groups.filter((group)=>group.length > 0).flatMap((group, index)=>0 === index ? group : [
|
|
6
|
+
DIVIDER,
|
|
7
|
+
...group
|
|
8
|
+
]);
|
|
9
|
+
const ruleEntriesOf = (actions, labels, rules, rowId)=>{
|
|
10
|
+
const index = rules.findIndex((rule)=>rule.rowId === rowId);
|
|
11
|
+
if (index < 0) return [];
|
|
12
|
+
const { onInsertRule, onDuplicateRule, onClearRule, onMoveRule, onDeleteRule } = actions;
|
|
13
|
+
return joined([
|
|
14
|
+
[
|
|
15
|
+
...onInsertRule ? [
|
|
16
|
+
{
|
|
17
|
+
label: labels.insertRuleAbove,
|
|
18
|
+
onClick: ()=>onInsertRule(index)
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: labels.insertRuleBelow,
|
|
22
|
+
onClick: ()=>onInsertRule(index + 1)
|
|
23
|
+
}
|
|
24
|
+
] : [],
|
|
25
|
+
...onDuplicateRule ? [
|
|
26
|
+
{
|
|
27
|
+
label: labels.duplicateRule,
|
|
28
|
+
onClick: ()=>onDuplicateRule(rowId)
|
|
29
|
+
}
|
|
30
|
+
] : [],
|
|
31
|
+
...onClearRule ? [
|
|
32
|
+
{
|
|
33
|
+
label: labels.clearRule,
|
|
34
|
+
onClick: ()=>onClearRule(rowId)
|
|
35
|
+
}
|
|
36
|
+
] : []
|
|
37
|
+
],
|
|
38
|
+
onMoveRule ? [
|
|
39
|
+
{
|
|
40
|
+
label: labels.moveRuleUp,
|
|
41
|
+
disabled: 0 === index,
|
|
42
|
+
onClick: ()=>onMoveRule(index, index - 1)
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: labels.moveRuleDown,
|
|
46
|
+
disabled: index === rules.length - 1,
|
|
47
|
+
onClick: ()=>onMoveRule(index, index + 1)
|
|
48
|
+
}
|
|
49
|
+
] : [],
|
|
50
|
+
[
|
|
51
|
+
{
|
|
52
|
+
label: labels.deleteRule(index + 1),
|
|
53
|
+
destructive: true,
|
|
54
|
+
onClick: ()=>onDeleteRule(rowId)
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
59
|
+
const conditionEntriesOf = (actions, labels, rule, bands, startEdit)=>{
|
|
60
|
+
if (!rule) return [];
|
|
61
|
+
const { rowId } = rule;
|
|
62
|
+
const columns = bands.flatMap((band)=>band.columns);
|
|
63
|
+
const unused = [
|
|
64
|
+
...new Set(actions.inputIds)
|
|
65
|
+
].flatMap((columnId)=>{
|
|
66
|
+
const column = columns.find((candidate)=>candidate.id === columnId);
|
|
67
|
+
if (!column || hasStop(rule, columnId)) return [];
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
label: column.name,
|
|
71
|
+
icon: column.icon,
|
|
72
|
+
focusesOwnSurface: true,
|
|
73
|
+
onClick: ()=>startEdit({
|
|
74
|
+
rowId,
|
|
75
|
+
columnId,
|
|
76
|
+
index: 0
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
});
|
|
81
|
+
const { onAddInput } = actions;
|
|
82
|
+
const addInput = ()=>{
|
|
83
|
+
const columnId = onAddInput?.(rowId);
|
|
84
|
+
if ('string' == typeof columnId) startEdit({
|
|
85
|
+
rowId,
|
|
86
|
+
columnId,
|
|
87
|
+
index: 0
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return joined([
|
|
91
|
+
unused,
|
|
92
|
+
onAddInput ? [
|
|
93
|
+
{
|
|
94
|
+
label: labels.addInput,
|
|
95
|
+
focusesOwnSurface: true,
|
|
96
|
+
onClick: addInput
|
|
97
|
+
}
|
|
98
|
+
] : []
|
|
99
|
+
]);
|
|
100
|
+
};
|
|
101
|
+
export { conditionEntriesOf, ruleEntriesOf };
|
|
@@ -24,18 +24,19 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
27
|
+
isOutcome: ()=>isOutcome,
|
|
28
28
|
partsText: ()=>partsText,
|
|
29
|
-
|
|
29
|
+
bandColumnOf: ()=>bandColumnOf,
|
|
30
30
|
boundedParts: ()=>boundedParts,
|
|
31
|
-
|
|
31
|
+
hasStop: ()=>hasStop,
|
|
32
32
|
isValue: ()=>isValue,
|
|
33
33
|
cellTextOf: ()=>cellTextOf,
|
|
34
|
+
stopTokensOf: ()=>stopTokensOf,
|
|
34
35
|
tokenText: ()=>tokenText,
|
|
35
36
|
valueTokenOf: ()=>valueTokenOf,
|
|
36
37
|
columnNameOf: ()=>columnNameOf,
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
SENTENCE_LINE_VALUE_LIMIT: ()=>SENTENCE_LINE_VALUE_LIMIT,
|
|
39
|
+
bandColumnNameOf: ()=>bandColumnNameOf
|
|
39
40
|
});
|
|
40
41
|
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
41
42
|
const SENTENCE_LINE_VALUE_LIMIT = 20;
|
|
@@ -65,7 +66,8 @@ const hasStop = (rule, columnId)=>void 0 !== rule && stopTokensOf(rule).some((to
|
|
|
65
66
|
const cellTextOf = (rule, columnId)=>ruleTokens(rule).filter((token)=>token.columnId === columnId).map((token)=>`${token.kind}:${token.text}`).join('\n');
|
|
66
67
|
const isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
67
68
|
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
68
|
-
const
|
|
69
|
+
const bandColumnOf = (bands, columnId)=>bands.flatMap((band)=>band.columns).find((column)=>column.id === columnId);
|
|
70
|
+
const bandColumnNameOf = (bands, columnId)=>bandColumnOf(bands, columnId)?.name ?? '';
|
|
69
71
|
const valueTokenOf = (rule, value)=>ruleTokens(rule).find((token)=>'value' === token.kind && token.columnId === value.columnId && token.index === value.index);
|
|
70
72
|
const partsText = (parts, empty = external_constants_cjs_namespaceObject.EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
71
73
|
const boundedParts = (parts, limit)=>{
|
|
@@ -104,6 +106,7 @@ const boundedParts = (parts, limit)=>{
|
|
|
104
106
|
};
|
|
105
107
|
exports.SENTENCE_LINE_VALUE_LIMIT = __webpack_exports__.SENTENCE_LINE_VALUE_LIMIT;
|
|
106
108
|
exports.bandColumnNameOf = __webpack_exports__.bandColumnNameOf;
|
|
109
|
+
exports.bandColumnOf = __webpack_exports__.bandColumnOf;
|
|
107
110
|
exports.boundedParts = __webpack_exports__.boundedParts;
|
|
108
111
|
exports.cellTextOf = __webpack_exports__.cellTextOf;
|
|
109
112
|
exports.columnNameOf = __webpack_exports__.columnNameOf;
|
|
@@ -117,6 +120,7 @@ exports.valueTokenOf = __webpack_exports__.valueTokenOf;
|
|
|
117
120
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
118
121
|
"SENTENCE_LINE_VALUE_LIMIT",
|
|
119
122
|
"bandColumnNameOf",
|
|
123
|
+
"bandColumnOf",
|
|
120
124
|
"boundedParts",
|
|
121
125
|
"cellTextOf",
|
|
122
126
|
"columnNameOf",
|
|
@@ -7,6 +7,7 @@ export declare const hasStop: (rule: SentenceRule | undefined, columnId: string)
|
|
|
7
7
|
export declare const cellTextOf: (rule: SentenceRule, columnId: string) => string;
|
|
8
8
|
export declare const isOutcome: (rule: SentenceRule, columnId: string) => boolean;
|
|
9
9
|
export declare const columnNameOf: (rule: SentenceRule, columnId: string) => string;
|
|
10
|
+
export declare const bandColumnOf: (bands: readonly SentenceBand[], columnId: string) => SentenceBand["columns"][number] | undefined;
|
|
10
11
|
export declare const bandColumnNameOf: (bands: readonly SentenceBand[], columnId: string) => string;
|
|
11
12
|
export declare const valueTokenOf: (rule: SentenceRule, value: SentenceValueId) => SentenceValueToken | undefined;
|
|
12
13
|
export declare const partsText: (parts: readonly SentencePart[], empty?: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentenceParts.d.ts","sourceRoot":"","sources":["../../src/decision-table/sentenceParts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,eAAO,MAAM,OAAO,GAAI,MAAM,YAAY,KAAG,I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AAM,YAAY,EAAE,UAAU,MAAM,KAAG,OACoB,CAAC;AAGtF,eAAO,MAAM,YAAY,GAAI,MAAM,YAAY,EAAE,UAAU,MAAM,KAAG,MAEhE,CAAC;AAGL,eAAO,MAAM,YAAY,GACvB,OAAO,SAAS,YAAY,EAAE,EAC9B,UAAU,MAAM,KACf,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,SAC2C,CAAC;AAGjF,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,UAAU,MAAM,KAAG,MACzC,CAAC;AAG5C,eAAO,MAAM,YAAY,GACvB,MAAM,YAAY,EAClB,OAAO,eAAe,KACrB,kBAAkB,GAAG,SAIrB,CAAC;AAGJ,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,cAAwB,KAAG,MACK,CAAC;AAG3F,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB;AAGD,UAAU,YAAY;IACpB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CAChC;AASD,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,OAAO,MAAM,KAAG,YA4B5E,CAAC"}
|
|
@@ -26,7 +26,8 @@ const hasStop = (rule, columnId)=>void 0 !== rule && stopTokensOf(rule).some((to
|
|
|
26
26
|
const cellTextOf = (rule, columnId)=>ruleTokens(rule).filter((token)=>token.columnId === columnId).map((token)=>`${token.kind}:${token.text}`).join('\n');
|
|
27
27
|
const isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
28
28
|
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
29
|
-
const
|
|
29
|
+
const bandColumnOf = (bands, columnId)=>bands.flatMap((band)=>band.columns).find((column)=>column.id === columnId);
|
|
30
|
+
const bandColumnNameOf = (bands, columnId)=>bandColumnOf(bands, columnId)?.name ?? '';
|
|
30
31
|
const valueTokenOf = (rule, value)=>ruleTokens(rule).find((token)=>'value' === token.kind && token.columnId === value.columnId && token.index === value.index);
|
|
31
32
|
const partsText = (parts, empty = EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
32
33
|
const boundedParts = (parts, limit)=>{
|
|
@@ -63,4 +64,4 @@ const boundedParts = (parts, limit)=>{
|
|
|
63
64
|
}))
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
|
-
export { SENTENCE_LINE_VALUE_LIMIT, bandColumnNameOf, boundedParts, cellTextOf, columnNameOf, hasStop, isOutcome, isValue, partsText, stopTokensOf, tokenText, valueTokenOf };
|
|
67
|
+
export { SENTENCE_LINE_VALUE_LIMIT, bandColumnNameOf, bandColumnOf, boundedParts, cellTextOf, columnNameOf, hasStop, isOutcome, isValue, partsText, stopTokensOf, tokenText, valueTokenOf };
|
|
@@ -3,7 +3,7 @@ export interface SentenceNameToken {
|
|
|
3
3
|
kind: 'input' | 'output';
|
|
4
4
|
columnId: string;
|
|
5
5
|
text: string;
|
|
6
|
-
|
|
6
|
+
producedBy?: string;
|
|
7
7
|
}
|
|
8
8
|
export interface SentenceValueToken {
|
|
9
9
|
kind: 'value';
|
|
@@ -23,9 +23,11 @@ export interface SentenceRule {
|
|
|
23
23
|
lead: readonly SentencePart[];
|
|
24
24
|
lines: readonly SentenceLine[];
|
|
25
25
|
}
|
|
26
|
+
export type SentenceValueType = 'text' | 'number' | 'boolean' | 'date' | 'time' | 'dateTime' | 'dayTimeDuration' | 'yearMonthDuration' | 'list' | 'any';
|
|
26
27
|
export interface SentenceBandColumn {
|
|
27
28
|
id: string;
|
|
28
29
|
name: string;
|
|
30
|
+
type?: SentenceValueType;
|
|
29
31
|
icon?: React.ReactNode;
|
|
30
32
|
}
|
|
31
33
|
export interface SentenceBand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentenceTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/sentenceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAGnE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,aAAa,CAAC;AAGlD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC;AAGD,MAAM,WAAW,YAAY;IAE3B,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAEjC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAE9B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC;AAGD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAGD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACxC;AAGD,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MAAM,iBAAiB,GACzB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,UAAU,GACV,iBAAiB,GACjB,mBAAmB,GACnB,MAAM,GACN,KAAK,CAAC;AAGV,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAGD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACxC;AAGD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -32,10 +32,20 @@ const pillOf = (section, columnId)=>[
|
|
|
32
32
|
].find((item)=>item.dataset.columnId === columnId)?.querySelector('button') ?? void 0;
|
|
33
33
|
const useColumnEditing = ({ column, bands, container })=>{
|
|
34
34
|
const [openId, setOpenId] = (0, external_react_namespaceObject.useState)(null);
|
|
35
|
+
const refocusRef = (0, external_react_namespaceObject.useRef)(null);
|
|
35
36
|
const open = column && null !== openId ? bands.flatMap((band)=>band.columns).find((candidate)=>candidate.id === openId) : void 0;
|
|
36
37
|
if (null !== openId && !open) setOpenId(null);
|
|
38
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
39
|
+
const columnId = refocusRef.current;
|
|
40
|
+
if (null !== openId || null === columnId) return;
|
|
41
|
+
refocusRef.current = null;
|
|
42
|
+
pillOf(container(), columnId)?.focus();
|
|
43
|
+
}, [
|
|
44
|
+
openId,
|
|
45
|
+
container
|
|
46
|
+
]);
|
|
37
47
|
const close = (columnId, refocus)=>{
|
|
38
|
-
|
|
48
|
+
refocusRef.current = refocus ? columnId : null;
|
|
39
49
|
setOpenId(null);
|
|
40
50
|
};
|
|
41
51
|
const editorOf = (edit, shown)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnEditing.d.ts","sourceRoot":"","sources":["../../src/decision-table/useColumnEditing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACpC;AAGD,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,kBAAkB,CAAC;IACxF,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,WAAW,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,aAAa;IAE5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE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@ -1,13 +1,23 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
const pillOf = (section, columnId)=>[
|
|
3
3
|
...section?.querySelectorAll('[data-band-id] li[data-column-id]') ?? []
|
|
4
4
|
].find((item)=>item.dataset.columnId === columnId)?.querySelector('button') ?? void 0;
|
|
5
5
|
const useColumnEditing = ({ column, bands, container })=>{
|
|
6
6
|
const [openId, setOpenId] = useState(null);
|
|
7
|
+
const refocusRef = useRef(null);
|
|
7
8
|
const open = column && null !== openId ? bands.flatMap((band)=>band.columns).find((candidate)=>candidate.id === openId) : void 0;
|
|
8
9
|
if (null !== openId && !open) setOpenId(null);
|
|
10
|
+
useLayoutEffect(()=>{
|
|
11
|
+
const columnId = refocusRef.current;
|
|
12
|
+
if (null !== openId || null === columnId) return;
|
|
13
|
+
refocusRef.current = null;
|
|
14
|
+
pillOf(container(), columnId)?.focus();
|
|
15
|
+
}, [
|
|
16
|
+
openId,
|
|
17
|
+
container
|
|
18
|
+
]);
|
|
9
19
|
const close = (columnId, refocus)=>{
|
|
10
|
-
|
|
20
|
+
refocusRef.current = refocus ? columnId : null;
|
|
11
21
|
setOpenId(null);
|
|
12
22
|
};
|
|
13
23
|
const editorOf = (edit, shown)=>{
|