@uipath/apollo-react 7.25.0 → 7.27.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/decision-table/BandColumn.d.ts +2 -2
- package/dist/decision-table/BandColumn.d.ts.map +1 -1
- package/dist/decision-table/ColumnEditorOverlay.cjs +3 -3
- package/dist/decision-table/ColumnEditorOverlay.d.ts +6 -5
- package/dist/decision-table/ColumnEditorOverlay.d.ts.map +1 -1
- package/dist/decision-table/ColumnEditorOverlay.js +3 -3
- package/dist/decision-table/ColumnPopover.cjs +52 -31
- package/dist/decision-table/ColumnPopover.d.ts +36 -23
- package/dist/decision-table/ColumnPopover.d.ts.map +1 -1
- package/dist/decision-table/ColumnPopover.js +52 -31
- package/dist/decision-table/DecisionGraphText.cjs +2 -2
- package/dist/decision-table/DecisionGraphText.d.ts +0 -2
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +2 -2
- package/dist/decision-table/DecisionText.cjs +35 -10
- package/dist/decision-table/DecisionText.d.ts +29 -33
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +35 -10
- package/dist/decision-table/DecisionTextHeader.cjs +10 -8
- package/dist/decision-table/DecisionTextHeader.d.ts +13 -5
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
- package/dist/decision-table/DecisionTextHeader.js +10 -8
- package/dist/decision-table/__fixtures__/diffSentences.fixtures.d.ts +9 -8
- package/dist/decision-table/__fixtures__/diffSentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +5 -2
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +12 -7
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts +15 -17
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/textMode.d.ts +16 -0
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -0
- package/dist/decision-table/bandColumns.cjs +22 -35
- package/dist/decision-table/bandColumns.d.ts +2 -4
- package/dist/decision-table/bandColumns.d.ts.map +1 -1
- package/dist/decision-table/bandColumns.js +21 -31
- package/dist/decision-table/decisionTextDiff.d.ts +13 -12
- package/dist/decision-table/decisionTextDiff.d.ts.map +1 -1
- package/dist/decision-table/decisionTextTypes.d.ts +5 -4
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +23 -11
- package/dist/decision-table/index.d.ts +9 -9
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +3 -2
- 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/sentenceGridSelection.cjs +57 -0
- package/dist/decision-table/sentenceGridSelection.d.ts +6 -0
- package/dist/decision-table/sentenceGridSelection.d.ts.map +1 -0
- package/dist/decision-table/sentenceGridSelection.js +20 -0
- package/dist/decision-table/sentenceSelection.cjs +59 -0
- package/dist/decision-table/sentenceSelection.d.ts +6 -0
- package/dist/decision-table/sentenceSelection.d.ts.map +1 -0
- package/dist/decision-table/sentenceSelection.js +16 -0
- package/dist/decision-table/sentenceTargets.cjs +9 -13
- package/dist/decision-table/sentenceTargets.d.ts.map +1 -1
- package/dist/decision-table/sentenceTargets.js +2 -6
- package/dist/decision-table/sentenceTypes.d.ts +24 -14
- 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 +7 -5
- package/dist/decision-table/useColumnEditing.d.ts +6 -6
- package/dist/decision-table/useColumnEditing.d.ts.map +1 -1
- package/dist/decision-table/useColumnEditing.js +7 -5
- package/dist/decision-table/useDecisionGraphStrings.cjs +3 -7
- package/dist/decision-table/useDecisionGraphStrings.d.ts +1 -1
- package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionGraphStrings.js +4 -8
- package/dist/decision-table/useDecisionTextStrings.cjs +11 -22
- package/dist/decision-table/useDecisionTextStrings.d.ts +2 -3
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionTextStrings.js +10 -18
- package/dist/decision-table/useEditState.d.ts +2 -2
- package/dist/decision-table/useEditState.d.ts.map +1 -1
- package/dist/decision-table/useSentenceNavigation.cjs +8 -12
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -1
- package/dist/decision-table/useSentenceNavigation.js +8 -12
- package/dist/decision-table/useValueEditing.cjs +16 -29
- package/dist/decision-table/useValueEditing.d.ts.map +1 -1
- package/dist/decision-table/useValueEditing.js +16 -29
- package/dist/decision-table/valueTypes.d.ts +2 -2
- package/dist/decision-table/valueTypes.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -34,7 +34,8 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
34
34
|
const [openId, setOpenId] = (0, external_react_namespaceObject.useState)(null);
|
|
35
35
|
const refocusRef = (0, external_react_namespaceObject.useRef)(null);
|
|
36
36
|
const open = column && null !== openId ? bands.flatMap((band)=>band.columns).find((candidate)=>candidate.id === openId) : void 0;
|
|
37
|
-
|
|
37
|
+
const field = column && open ? column.field(open.id) : void 0;
|
|
38
|
+
if (null !== openId && !field) setOpenId(null);
|
|
38
39
|
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
39
40
|
const columnId = refocusRef.current;
|
|
40
41
|
if (null !== openId || null === columnId) return;
|
|
@@ -48,13 +49,14 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
48
49
|
refocusRef.current = refocus ? columnId : null;
|
|
49
50
|
setOpenId(null);
|
|
50
51
|
};
|
|
51
|
-
const editorOf = (edit, shown)=>{
|
|
52
|
+
const editorOf = (edit, shown, shownField)=>{
|
|
52
53
|
const { onMoreProperties } = edit;
|
|
53
54
|
return {
|
|
54
55
|
column: shown,
|
|
56
|
+
field: shownField,
|
|
55
57
|
anchor: (section)=>pillOf(section, shown.id),
|
|
56
58
|
onApply: (change)=>{
|
|
57
|
-
if (Object.keys(change).
|
|
59
|
+
if (Object.keys(change).some((key)=>'kind' !== key)) edit.onCommit(shown.id, change);
|
|
58
60
|
close(shown.id, true);
|
|
59
61
|
},
|
|
60
62
|
onCancel: ()=>close(shown.id, true),
|
|
@@ -72,9 +74,9 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
72
74
|
kind: 'edit',
|
|
73
75
|
pills: {
|
|
74
76
|
onToggle: (columnId)=>setOpenId((current)=>current === columnId ? null : columnId),
|
|
75
|
-
openColumnId: open ? open.id : null
|
|
77
|
+
openColumnId: open && field ? open.id : null
|
|
76
78
|
},
|
|
77
|
-
editor: open ? editorOf(column, open) : void 0
|
|
79
|
+
editor: open && field ? editorOf(column, open, field) : void 0
|
|
78
80
|
};
|
|
79
81
|
};
|
|
80
82
|
exports.useColumnEditing = __webpack_exports__.useColumnEditing;
|
|
@@ -4,23 +4,23 @@ import type { EditorOverlayProps } from './EditorOverlay';
|
|
|
4
4
|
import type { SentenceBand } from './sentenceTypes';
|
|
5
5
|
import type { EditorAnchor } from './useEditorPlacement';
|
|
6
6
|
import type { RuleWindow } from './useRuleWindow';
|
|
7
|
-
export interface ColumnEditingParams {
|
|
8
|
-
column: ColumnEdit | undefined;
|
|
7
|
+
export interface ColumnEditingParams<Type> {
|
|
8
|
+
column: ColumnEdit<Type> | undefined;
|
|
9
9
|
bands: readonly SentenceBand[];
|
|
10
10
|
container: RuleWindow['container'];
|
|
11
11
|
}
|
|
12
|
-
export interface OpenColumnEditor extends Pick<ColumnPopoverProps
|
|
12
|
+
export interface OpenColumnEditor<Type> extends Pick<ColumnPopoverProps<Type>, 'column' | 'field' | 'onApply' | 'onCancel' | 'onMoreProperties'> {
|
|
13
13
|
anchor: EditorAnchor;
|
|
14
14
|
onDismiss: NonNullable<EditorOverlayProps['onPressOutside']>;
|
|
15
15
|
}
|
|
16
|
-
export type ColumnEditing = {
|
|
16
|
+
export type ColumnEditing<Type> = {
|
|
17
17
|
kind: 'plain';
|
|
18
18
|
} | {
|
|
19
19
|
kind: 'edit';
|
|
20
20
|
pills: Pick<Extract<BandMode, {
|
|
21
21
|
kind: 'edit';
|
|
22
22
|
}>, 'onToggle' | 'openColumnId'>;
|
|
23
|
-
editor: OpenColumnEditor | undefined;
|
|
23
|
+
editor: OpenColumnEditor<Type> | undefined;
|
|
24
24
|
};
|
|
25
|
-
export declare const useColumnEditing: ({ column, bands, container, }: ColumnEditingParams) => ColumnEditing
|
|
25
|
+
export declare const useColumnEditing: <Type>({ column, bands, container, }: ColumnEditingParams<Type>) => ColumnEditing<Type>;
|
|
26
26
|
//# sourceMappingURL=useColumnEditing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnEditing.d.ts","sourceRoot":"","sources":["../../src/decision-table/useColumnEditing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,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;
|
|
1
|
+
{"version":3,"file":"useColumnEditing.d.ts","sourceRoot":"","sources":["../../src/decision-table/useColumnEditing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,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,CAAC,IAAI;IACvC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACpC;AAGD,MAAM,WAAW,gBAAgB,CAAC,IAAI,CACpC,SAAQ,IAAI,CACV,kBAAkB,CAAC,IAAI,CAAC,EACxB,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,kBAAkB,CACjE;IACD,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,WAAW,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAC9D;AAGD,MAAM,MAAM,aAAa,CAAC,IAAI,IAC1B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC;IAC9E,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;CAC5C,CAAC;AAQN,eAAO,MAAM,gBAAgB,GAAI,IAAI,EAAE,+BAIpC,mBAAmB,CAAC,IAAI,CAAC,KAAG,aAAa,CAAC,IAAI,CAuDhD,CAAC"}
|
|
@@ -6,7 +6,8 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
6
6
|
const [openId, setOpenId] = useState(null);
|
|
7
7
|
const refocusRef = useRef(null);
|
|
8
8
|
const open = column && null !== openId ? bands.flatMap((band)=>band.columns).find((candidate)=>candidate.id === openId) : void 0;
|
|
9
|
-
|
|
9
|
+
const field = column && open ? column.field(open.id) : void 0;
|
|
10
|
+
if (null !== openId && !field) setOpenId(null);
|
|
10
11
|
useLayoutEffect(()=>{
|
|
11
12
|
const columnId = refocusRef.current;
|
|
12
13
|
if (null !== openId || null === columnId) return;
|
|
@@ -20,13 +21,14 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
20
21
|
refocusRef.current = refocus ? columnId : null;
|
|
21
22
|
setOpenId(null);
|
|
22
23
|
};
|
|
23
|
-
const editorOf = (edit, shown)=>{
|
|
24
|
+
const editorOf = (edit, shown, shownField)=>{
|
|
24
25
|
const { onMoreProperties } = edit;
|
|
25
26
|
return {
|
|
26
27
|
column: shown,
|
|
28
|
+
field: shownField,
|
|
27
29
|
anchor: (section)=>pillOf(section, shown.id),
|
|
28
30
|
onApply: (change)=>{
|
|
29
|
-
if (Object.keys(change).
|
|
31
|
+
if (Object.keys(change).some((key)=>'kind' !== key)) edit.onCommit(shown.id, change);
|
|
30
32
|
close(shown.id, true);
|
|
31
33
|
},
|
|
32
34
|
onCancel: ()=>close(shown.id, true),
|
|
@@ -44,9 +46,9 @@ const useColumnEditing = ({ column, bands, container })=>{
|
|
|
44
46
|
kind: 'edit',
|
|
45
47
|
pills: {
|
|
46
48
|
onToggle: (columnId)=>setOpenId((current)=>current === columnId ? null : columnId),
|
|
47
|
-
openColumnId: open ? open.id : null
|
|
49
|
+
openColumnId: open && field ? open.id : null
|
|
48
50
|
},
|
|
49
|
-
editor: open ? editorOf(column, open) : void 0
|
|
51
|
+
editor: open && field ? editorOf(column, open, field) : void 0
|
|
50
52
|
};
|
|
51
53
|
};
|
|
52
54
|
export { useColumnEditing };
|
|
@@ -29,10 +29,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_react_namespaceObject = require("react");
|
|
30
30
|
const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
|
|
31
31
|
const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
|
|
32
|
-
const useDecisionGraphLabels = (
|
|
32
|
+
const useDecisionGraphLabels = ()=>{
|
|
33
33
|
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
34
|
-
const { markStatus } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)(
|
|
35
|
-
|
|
34
|
+
const { markStatus } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
|
|
35
|
+
return (0, external_react_namespaceObject.useMemo)(()=>({
|
|
36
36
|
graph: _({
|
|
37
37
|
id: 'decision-graph.graph',
|
|
38
38
|
message: 'Decisions'
|
|
@@ -115,10 +115,6 @@ const useDecisionGraphLabels = (overrides)=>{
|
|
|
115
115
|
_,
|
|
116
116
|
markStatus
|
|
117
117
|
]);
|
|
118
|
-
return (0, external_react_namespaceObject.useMemo)(()=>(0, external_useDecisionTextStrings_cjs_namespaceObject.withLabelOverrides)(defaults, overrides), [
|
|
119
|
-
defaults,
|
|
120
|
-
overrides
|
|
121
|
-
]);
|
|
122
118
|
};
|
|
123
119
|
exports.useDecisionGraphLabels = __webpack_exports__.useDecisionGraphLabels;
|
|
124
120
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -10,5 +10,5 @@ export interface DecisionGraphLabels extends DecisionGraphMinimapLabels, MarkBad
|
|
|
10
10
|
minimapDecision: (name: string, count: number) => string;
|
|
11
11
|
minimapReference: (name: string) => string;
|
|
12
12
|
}
|
|
13
|
-
export declare const useDecisionGraphLabels: (
|
|
13
|
+
export declare const useDecisionGraphLabels: () => DecisionGraphLabels;
|
|
14
14
|
//# sourceMappingURL=useDecisionGraphStrings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDecisionGraphStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionGraphStrings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B,EAAE,eAAe;IAEtF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAErC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAElC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAGD,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useDecisionGraphStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionGraphStrings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B,EAAE,eAAe;IAEtF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAErC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAElC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAGD,eAAO,MAAM,sBAAsB,QAAO,mBAyDzC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useSafeLingui } from "../i18n/useSafeLingui.js";
|
|
3
|
-
import { useDecisionTextLabels
|
|
4
|
-
const useDecisionGraphLabels = (
|
|
3
|
+
import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
4
|
+
const useDecisionGraphLabels = ()=>{
|
|
5
5
|
const { _ } = useSafeLingui();
|
|
6
|
-
const { markStatus } = useDecisionTextLabels(
|
|
7
|
-
|
|
6
|
+
const { markStatus } = useDecisionTextLabels();
|
|
7
|
+
return useMemo(()=>({
|
|
8
8
|
graph: _({
|
|
9
9
|
id: 'decision-graph.graph',
|
|
10
10
|
message: 'Decisions'
|
|
@@ -87,9 +87,5 @@ const useDecisionGraphLabels = (overrides)=>{
|
|
|
87
87
|
_,
|
|
88
88
|
markStatus
|
|
89
89
|
]);
|
|
90
|
-
return useMemo(()=>withLabelOverrides(defaults, overrides), [
|
|
91
|
-
defaults,
|
|
92
|
-
overrides
|
|
93
|
-
]);
|
|
94
90
|
};
|
|
95
91
|
export { useDecisionGraphLabels };
|
|
@@ -25,18 +25,13 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
useDecisionTextEditLabels: ()=>useDecisionTextEditLabels,
|
|
28
|
-
useDecisionTextLabels: ()=>useDecisionTextLabels
|
|
29
|
-
withLabelOverrides: ()=>withLabelOverrides
|
|
28
|
+
useDecisionTextLabels: ()=>useDecisionTextLabels
|
|
30
29
|
});
|
|
31
30
|
const external_react_namespaceObject = require("react");
|
|
32
31
|
const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
|
|
33
|
-
const
|
|
34
|
-
...defaults,
|
|
35
|
-
...Object.fromEntries(Object.entries(overrides).filter(([, value])=>void 0 !== value))
|
|
36
|
-
} : defaults;
|
|
37
|
-
const useDecisionTextLabels = (overrides)=>{
|
|
32
|
+
const useDecisionTextLabels = ()=>{
|
|
38
33
|
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
39
|
-
|
|
34
|
+
return (0, external_react_namespaceObject.useMemo)(()=>{
|
|
40
35
|
const tones = {
|
|
41
36
|
error: _({
|
|
42
37
|
id: 'decision-text.mark_error',
|
|
@@ -74,6 +69,10 @@ const useDecisionTextLabels = (overrides)=>{
|
|
|
74
69
|
id: 'decision-text.empty_rules',
|
|
75
70
|
message: 'No rules yet'
|
|
76
71
|
}),
|
|
72
|
+
addRule: _({
|
|
73
|
+
id: 'decision-text.add_rule',
|
|
74
|
+
message: 'Add rule'
|
|
75
|
+
}),
|
|
77
76
|
inputs: _({
|
|
78
77
|
id: 'decision-text.band_inputs',
|
|
79
78
|
message: 'Inputs'
|
|
@@ -155,14 +154,10 @@ const useDecisionTextLabels = (overrides)=>{
|
|
|
155
154
|
}, [
|
|
156
155
|
_
|
|
157
156
|
]);
|
|
158
|
-
return (0, external_react_namespaceObject.useMemo)(()=>withLabelOverrides(defaults, overrides), [
|
|
159
|
-
defaults,
|
|
160
|
-
overrides
|
|
161
|
-
]);
|
|
162
157
|
};
|
|
163
|
-
const useDecisionTextEditLabels = (
|
|
158
|
+
const useDecisionTextEditLabels = ()=>{
|
|
164
159
|
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
165
|
-
|
|
160
|
+
return (0, external_react_namespaceObject.useMemo)(()=>({
|
|
166
161
|
addCondition: (position)=>_({
|
|
167
162
|
id: 'decision-text.add_condition',
|
|
168
163
|
message: 'Add condition to rule {position}',
|
|
@@ -344,7 +339,7 @@ const useDecisionTextEditLabels = (overrides)=>{
|
|
|
344
339
|
}),
|
|
345
340
|
allowedValuesHint: _({
|
|
346
341
|
id: 'decision-text.allowed_values_hint',
|
|
347
|
-
message: 'Separate values with commas.'
|
|
342
|
+
message: 'Separate values with commas, and write each one as the example shows.'
|
|
348
343
|
}),
|
|
349
344
|
moreProperties: _({
|
|
350
345
|
id: 'decision-text.more_properties',
|
|
@@ -353,18 +348,12 @@ const useDecisionTextEditLabels = (overrides)=>{
|
|
|
353
348
|
}), [
|
|
354
349
|
_
|
|
355
350
|
]);
|
|
356
|
-
return (0, external_react_namespaceObject.useMemo)(()=>withLabelOverrides(defaults, overrides), [
|
|
357
|
-
defaults,
|
|
358
|
-
overrides
|
|
359
|
-
]);
|
|
360
351
|
};
|
|
361
352
|
exports.useDecisionTextEditLabels = __webpack_exports__.useDecisionTextEditLabels;
|
|
362
353
|
exports.useDecisionTextLabels = __webpack_exports__.useDecisionTextLabels;
|
|
363
|
-
exports.withLabelOverrides = __webpack_exports__.withLabelOverrides;
|
|
364
354
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
365
355
|
"useDecisionTextEditLabels",
|
|
366
|
-
"useDecisionTextLabels"
|
|
367
|
-
"withLabelOverrides"
|
|
356
|
+
"useDecisionTextLabels"
|
|
368
357
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
369
358
|
Object.defineProperty(exports, '__esModule', {
|
|
370
359
|
value: true
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DecisionTextEditLabels, DecisionTextLabels } from './decisionTextTypes';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const useDecisionTextEditLabels: (overrides: Partial<DecisionTextEditLabels> | undefined) => DecisionTextEditLabels;
|
|
2
|
+
export declare const useDecisionTextLabels: () => DecisionTextLabels;
|
|
3
|
+
export declare const useDecisionTextEditLabels: () => DecisionTextEditLabels;
|
|
5
4
|
//# sourceMappingURL=useDecisionTextStrings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDecisionTextStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionTextStrings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAItF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"useDecisionTextStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionTextStrings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAItF,eAAO,MAAM,qBAAqB,QAAO,kBAsExC,CAAC;AAGF,eAAO,MAAM,yBAAyB,QAAO,sBA4F5C,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useSafeLingui } from "../i18n/useSafeLingui.js";
|
|
3
|
-
const
|
|
4
|
-
...defaults,
|
|
5
|
-
...Object.fromEntries(Object.entries(overrides).filter(([, value])=>void 0 !== value))
|
|
6
|
-
} : defaults;
|
|
7
|
-
const useDecisionTextLabels = (overrides)=>{
|
|
3
|
+
const useDecisionTextLabels = ()=>{
|
|
8
4
|
const { _ } = useSafeLingui();
|
|
9
|
-
|
|
5
|
+
return useMemo(()=>{
|
|
10
6
|
const tones = {
|
|
11
7
|
error: _({
|
|
12
8
|
id: 'decision-text.mark_error',
|
|
@@ -44,6 +40,10 @@ const useDecisionTextLabels = (overrides)=>{
|
|
|
44
40
|
id: 'decision-text.empty_rules',
|
|
45
41
|
message: 'No rules yet'
|
|
46
42
|
}),
|
|
43
|
+
addRule: _({
|
|
44
|
+
id: 'decision-text.add_rule',
|
|
45
|
+
message: 'Add rule'
|
|
46
|
+
}),
|
|
47
47
|
inputs: _({
|
|
48
48
|
id: 'decision-text.band_inputs',
|
|
49
49
|
message: 'Inputs'
|
|
@@ -125,14 +125,10 @@ const useDecisionTextLabels = (overrides)=>{
|
|
|
125
125
|
}, [
|
|
126
126
|
_
|
|
127
127
|
]);
|
|
128
|
-
return useMemo(()=>withLabelOverrides(defaults, overrides), [
|
|
129
|
-
defaults,
|
|
130
|
-
overrides
|
|
131
|
-
]);
|
|
132
128
|
};
|
|
133
|
-
const useDecisionTextEditLabels = (
|
|
129
|
+
const useDecisionTextEditLabels = ()=>{
|
|
134
130
|
const { _ } = useSafeLingui();
|
|
135
|
-
|
|
131
|
+
return useMemo(()=>({
|
|
136
132
|
addCondition: (position)=>_({
|
|
137
133
|
id: 'decision-text.add_condition',
|
|
138
134
|
message: 'Add condition to rule {position}',
|
|
@@ -314,7 +310,7 @@ const useDecisionTextEditLabels = (overrides)=>{
|
|
|
314
310
|
}),
|
|
315
311
|
allowedValuesHint: _({
|
|
316
312
|
id: 'decision-text.allowed_values_hint',
|
|
317
|
-
message: 'Separate values with commas.'
|
|
313
|
+
message: 'Separate values with commas, and write each one as the example shows.'
|
|
318
314
|
}),
|
|
319
315
|
moreProperties: _({
|
|
320
316
|
id: 'decision-text.more_properties',
|
|
@@ -323,9 +319,5 @@ const useDecisionTextEditLabels = (overrides)=>{
|
|
|
323
319
|
}), [
|
|
324
320
|
_
|
|
325
321
|
]);
|
|
326
|
-
return useMemo(()=>withLabelOverrides(defaults, overrides), [
|
|
327
|
-
defaults,
|
|
328
|
-
overrides
|
|
329
|
-
]);
|
|
330
322
|
};
|
|
331
|
-
export { useDecisionTextEditLabels, useDecisionTextLabels
|
|
323
|
+
export { useDecisionTextEditLabels, useDecisionTextLabels };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DecisionTextEditLabels, CellEdit, ViewEdit } from './decisionTextTypes';
|
|
2
2
|
import type { CommitRefusal } from './valueTypes';
|
|
3
3
|
export interface EditState {
|
|
4
4
|
edit: ViewEdit | undefined;
|
|
5
5
|
refusal: CommitRefusal | null;
|
|
6
6
|
}
|
|
7
|
-
export declare const useEditState: (edit:
|
|
7
|
+
export declare const useEditState: (edit: CellEdit | undefined, labels: DecisionTextEditLabels) => EditState;
|
|
8
8
|
//# sourceMappingURL=useEditState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditState.d.ts","sourceRoot":"","sources":["../../src/decision-table/useEditState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useEditState.d.ts","sourceRoot":"","sources":["../../src/decision-table/useEditState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGtF,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,QAAQ,GAAG,SAAS,EAC1B,QAAQ,sBAAsB,KAC7B,SA4CF,CAAC"}
|
|
@@ -30,6 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
32
32
|
const external_ruleCardModel_cjs_namespaceObject = require("./ruleCardModel.cjs");
|
|
33
|
+
const external_sentenceSelection_cjs_namespaceObject = require("./sentenceSelection.cjs");
|
|
33
34
|
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
34
35
|
const external_useGridNavigation_cjs_namespaceObject = require("./useGridNavigation.cjs");
|
|
35
36
|
const stopsOf = (rule)=>[
|
|
@@ -40,14 +41,9 @@ const selectionAt = (rules, { row, stop })=>{
|
|
|
40
41
|
const target = rules[row];
|
|
41
42
|
if (!target) return;
|
|
42
43
|
const columnId = stopsOf(target)[stop];
|
|
43
|
-
return
|
|
44
|
-
rowId: target.rowId
|
|
45
|
-
} : {
|
|
46
|
-
rowId: target.rowId,
|
|
47
|
-
columnId
|
|
48
|
-
};
|
|
44
|
+
return (0, external_sentenceSelection_cjs_namespaceObject.selectionOf)(target.rowId, columnId);
|
|
49
45
|
};
|
|
50
|
-
const sameSelection = (left, right)=>left?.rowId === right?.rowId && left
|
|
46
|
+
const sameSelection = (left, right)=>left?.rowId === right?.rowId && (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(left) === (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(right);
|
|
51
47
|
const verticalMove = (delta, meta, from, rowCount, stopsAt, columnId)=>{
|
|
52
48
|
const last = rowCount - 1;
|
|
53
49
|
const row = meta ? delta < 0 ? 0 : last : (0, external_useGridNavigation_cjs_namespaceObject.clamp)(from.row + delta, last);
|
|
@@ -95,15 +91,15 @@ const isOnStop = (event)=>event.target === event.currentTarget || event.target i
|
|
|
95
91
|
const isIgnoredKey = (event)=>event.defaultPrevented || event.nativeEvent.isComposing || !isOnStop(event) || (0, external_gridEvents_cjs_namespaceObject.isFromTextField)(event.target);
|
|
96
92
|
const stopOf = (container, selection)=>{
|
|
97
93
|
const card = (0, external_sentenceTargets_cjs_namespaceObject.cardOf)(container, selection.rowId);
|
|
98
|
-
return card &&
|
|
94
|
+
return card && 'cell' === selection.kind ? (0, external_sentenceTargets_cjs_namespaceObject.cellOf)(card, selection.columnId) : card;
|
|
99
95
|
};
|
|
100
96
|
const movedStopOf = (element, current)=>{
|
|
101
|
-
const cell = element && current?.
|
|
97
|
+
const cell = element && current?.kind === 'cell' ? stopOf(element, current) : void 0;
|
|
102
98
|
const addRule = element?.querySelector('[data-add-rule]');
|
|
103
99
|
const focusedAddRule = addRule?.contains((0, external_gridEvents_cjs_namespaceObject.activeElementOf)(addRule)) ? addRule : void 0;
|
|
104
100
|
return focusedAddRule ?? cell;
|
|
105
101
|
};
|
|
106
|
-
const keptColumnOf = (wanted, current)=>wanted && sameSelection(wanted.at, current) ? wanted.columnId : current
|
|
102
|
+
const keptColumnOf = (wanted, current)=>wanted && sameSelection(wanted.at, current) ? wanted.columnId : (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(current);
|
|
107
103
|
const isVerticalKey = (key)=>(external_useGridNavigation_cjs_namespaceObject.ARROW_DELTAS[key]?.row ?? 0) !== 0;
|
|
108
104
|
const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, container, firstVisibleRow, scrollStopIntoView, scrollRowIntoView })=>{
|
|
109
105
|
const stops = (0, external_react_namespaceObject.useMemo)(()=>stopsOf(null === selectedRow ? void 0 : rules[selectedRow]), [
|
|
@@ -112,11 +108,11 @@ const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, contain
|
|
|
112
108
|
]);
|
|
113
109
|
const position = null === selectedRow ? null : {
|
|
114
110
|
row: selectedRow,
|
|
115
|
-
stop: Math.max(0, stops.indexOf(selected
|
|
111
|
+
stop: Math.max(0, stops.indexOf((0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(selected)))
|
|
116
112
|
};
|
|
117
113
|
const current = position && (selectionAt(rules, position) ?? null);
|
|
118
114
|
const selectedRule = null === selectedRow ? void 0 : rules[selectedRow];
|
|
119
|
-
const selectedColumnId = current
|
|
115
|
+
const selectedColumnId = (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(current) ?? null;
|
|
120
116
|
const focusCurrent = (focus, scroll = true)=>{
|
|
121
117
|
const element = container();
|
|
122
118
|
if (!element) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSentenceNavigation.d.ts","sourceRoot":"","sources":["../../src/decision-table/useSentenceNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"useSentenceNavigation.d.ts","sourceRoot":"","sources":["../../src/decision-table/useSentenceNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA+GlD,eAAO,MAAM,YAAY,GAAI,OAAO,KAAK,CAAC,aAAa,KAAG,OAI3B,CAAC;AAiBhC,MAAM,WAAW,wBACf,SAAQ,IAAI,CACV,UAAU,EACV,aAAa,GAAG,WAAW,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,mBAAmB,CAC7F;IACD,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvE;AAGD,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,CAAC;AAyB3D,MAAM,WAAW,kBAAkB;IAEjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,MAAM,EAAE,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE3F,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC;IAEhE,WAAW,EAAE,CACX,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,SAAS,YAAY,EAAE,KAC5B,IAAI,CAAC;IAEV,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAGD,eAAO,MAAM,qBAAqB,GAAI,gHASnC,wBAAwB,KAAG,kBAuH7B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useLayoutEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { activeElementOf, focusStays, isFromTextField } from "./gridEvents.js";
|
|
3
3
|
import { firstValuesOf } from "./ruleCardModel.js";
|
|
4
|
+
import { selectedColumnOf, selectionOf } from "./sentenceSelection.js";
|
|
4
5
|
import { cardOf, cellOf } from "./sentenceTargets.js";
|
|
5
6
|
import { ARROW_DELTAS, GRID_ENTRY_KEYS, clamp } from "./useGridNavigation.js";
|
|
6
7
|
const stopsOf = (rule)=>[
|
|
@@ -11,14 +12,9 @@ const selectionAt = (rules, { row, stop })=>{
|
|
|
11
12
|
const target = rules[row];
|
|
12
13
|
if (!target) return;
|
|
13
14
|
const columnId = stopsOf(target)[stop];
|
|
14
|
-
return
|
|
15
|
-
rowId: target.rowId
|
|
16
|
-
} : {
|
|
17
|
-
rowId: target.rowId,
|
|
18
|
-
columnId
|
|
19
|
-
};
|
|
15
|
+
return selectionOf(target.rowId, columnId);
|
|
20
16
|
};
|
|
21
|
-
const sameSelection = (left, right)=>left?.rowId === right?.rowId && left
|
|
17
|
+
const sameSelection = (left, right)=>left?.rowId === right?.rowId && selectedColumnOf(left) === selectedColumnOf(right);
|
|
22
18
|
const verticalMove = (delta, meta, from, rowCount, stopsAt, columnId)=>{
|
|
23
19
|
const last = rowCount - 1;
|
|
24
20
|
const row = meta ? delta < 0 ? 0 : last : clamp(from.row + delta, last);
|
|
@@ -66,15 +62,15 @@ const isOnStop = (event)=>event.target === event.currentTarget || event.target i
|
|
|
66
62
|
const isIgnoredKey = (event)=>event.defaultPrevented || event.nativeEvent.isComposing || !isOnStop(event) || isFromTextField(event.target);
|
|
67
63
|
const stopOf = (container, selection)=>{
|
|
68
64
|
const card = cardOf(container, selection.rowId);
|
|
69
|
-
return card &&
|
|
65
|
+
return card && 'cell' === selection.kind ? cellOf(card, selection.columnId) : card;
|
|
70
66
|
};
|
|
71
67
|
const movedStopOf = (element, current)=>{
|
|
72
|
-
const cell = element && current?.
|
|
68
|
+
const cell = element && current?.kind === 'cell' ? stopOf(element, current) : void 0;
|
|
73
69
|
const addRule = element?.querySelector('[data-add-rule]');
|
|
74
70
|
const focusedAddRule = addRule?.contains(activeElementOf(addRule)) ? addRule : void 0;
|
|
75
71
|
return focusedAddRule ?? cell;
|
|
76
72
|
};
|
|
77
|
-
const keptColumnOf = (wanted, current)=>wanted && sameSelection(wanted.at, current) ? wanted.columnId : current
|
|
73
|
+
const keptColumnOf = (wanted, current)=>wanted && sameSelection(wanted.at, current) ? wanted.columnId : selectedColumnOf(current);
|
|
78
74
|
const isVerticalKey = (key)=>(ARROW_DELTAS[key]?.row ?? 0) !== 0;
|
|
79
75
|
const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, container, firstVisibleRow, scrollStopIntoView, scrollRowIntoView })=>{
|
|
80
76
|
const stops = useMemo(()=>stopsOf(null === selectedRow ? void 0 : rules[selectedRow]), [
|
|
@@ -83,11 +79,11 @@ const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, contain
|
|
|
83
79
|
]);
|
|
84
80
|
const position = null === selectedRow ? null : {
|
|
85
81
|
row: selectedRow,
|
|
86
|
-
stop: Math.max(0, stops.indexOf(selected
|
|
82
|
+
stop: Math.max(0, stops.indexOf(selectedColumnOf(selected)))
|
|
87
83
|
};
|
|
88
84
|
const current = position && (selectionAt(rules, position) ?? null);
|
|
89
85
|
const selectedRule = null === selectedRow ? void 0 : rules[selectedRow];
|
|
90
|
-
const selectedColumnId = current
|
|
86
|
+
const selectedColumnId = selectedColumnOf(current) ?? null;
|
|
91
87
|
const focusCurrent = (focus, scroll = true)=>{
|
|
92
88
|
const element = container();
|
|
93
89
|
if (!element) return;
|
|
@@ -30,6 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
32
32
|
const external_sentenceParts_cjs_namespaceObject = require("./sentenceParts.cjs");
|
|
33
|
+
const external_sentenceSelection_cjs_namespaceObject = require("./sentenceSelection.cjs");
|
|
33
34
|
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
34
35
|
const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenceNavigation.cjs");
|
|
35
36
|
const isStartKey = (event)=>'Enter' === event.key || 'F2' === event.key || ' ' === event.key && void 0 === (0, external_sentenceTargets_cjs_namespaceObject.clickedDecision)(event.target);
|
|
@@ -41,7 +42,7 @@ const valueKey = ({ rowId, columnId, index })=>JSON.stringify([
|
|
|
41
42
|
]);
|
|
42
43
|
const textIn = (rules, cell)=>{
|
|
43
44
|
const rule = rules.find((candidate)=>candidate.rowId === cell.rowId);
|
|
44
|
-
return rule && (
|
|
45
|
+
return rule && ('rule' === cell.kind ? '' : (0, external_sentenceParts_cjs_namespaceObject.cellTextOf)(rule, cell.columnId));
|
|
45
46
|
};
|
|
46
47
|
const rowIdOf = (element)=>element instanceof HTMLElement ? element.closest('li[data-row-id]')?.dataset.rowId : void 0;
|
|
47
48
|
const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, labels, container })=>{
|
|
@@ -67,10 +68,7 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
67
68
|
const start = (value)=>{
|
|
68
69
|
if (!edit) return;
|
|
69
70
|
awaitHost(null);
|
|
70
|
-
if (selected?.rowId !== value.rowId || selected
|
|
71
|
-
rowId: value.rowId,
|
|
72
|
-
columnId: value.columnId
|
|
73
|
-
}, ()=>null, false);
|
|
71
|
+
if (selected?.rowId !== value.rowId || (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(selected) !== value.columnId) navigation.select((0, external_sentenceSelection_cjs_namespaceObject.cellSelection)(value), ()=>null, false);
|
|
74
72
|
edit.onStartEdit(value);
|
|
75
73
|
};
|
|
76
74
|
const editorOf = ()=>{
|
|
@@ -122,10 +120,8 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
122
120
|
};
|
|
123
121
|
const rowRule = rules.find((candidate)=>candidate.rowId === from.rowId);
|
|
124
122
|
if ('cancel' === move || 'none' === move && refocus) {
|
|
125
|
-
if ((0, external_sentenceParts_cjs_namespaceObject.hasStop)(rowRule, cell.columnId)) navigation.select(cell);
|
|
126
|
-
else navigation.select(
|
|
127
|
-
rowId: from.rowId
|
|
128
|
-
}, external_sentenceTargets_cjs_namespaceObject.addConditionOf);
|
|
123
|
+
if ((0, external_sentenceParts_cjs_namespaceObject.hasStop)(rowRule, cell.columnId)) navigation.select((0, external_sentenceSelection_cjs_namespaceObject.cellSelection)(cell));
|
|
124
|
+
else navigation.select((0, external_sentenceSelection_cjs_namespaceObject.ruleSelection)(from.rowId), external_sentenceTargets_cjs_namespaceObject.addConditionOf);
|
|
129
125
|
return;
|
|
130
126
|
}
|
|
131
127
|
const sibling = {
|
|
@@ -139,10 +135,7 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
139
135
|
const opened = target ? valueKey(target) : void 0;
|
|
140
136
|
if (opened === openedRef.current) return;
|
|
141
137
|
openedRef.current = opened;
|
|
142
|
-
if (target && (selected?.rowId !== target.rowId || selected
|
|
143
|
-
rowId: target.rowId,
|
|
144
|
-
columnId: target.columnId
|
|
145
|
-
});
|
|
138
|
+
if (target && (selected?.rowId !== target.rowId || (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(selected) !== target.columnId)) onSelect?.((0, external_sentenceSelection_cjs_namespaceObject.cellSelection)(target));
|
|
146
139
|
});
|
|
147
140
|
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
148
141
|
const gone = target && !rule ? valueKey(target) : null;
|
|
@@ -169,18 +162,19 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
169
162
|
if (!target && (0, external_gridEvents_cjs_namespaceObject.focusStays)(container(), pending.focused)) resolve(pending);
|
|
170
163
|
});
|
|
171
164
|
const cancelEditOf = (cell)=>{
|
|
172
|
-
if (target?.rowId !== cell.rowId || cell.
|
|
165
|
+
if (target?.rowId !== cell.rowId || 'cell' === cell.kind && target.columnId !== cell.columnId) return;
|
|
173
166
|
awaitHost(null);
|
|
174
167
|
edit?.onCancel();
|
|
175
168
|
};
|
|
176
169
|
const clear = (cell, refocusNow, scroll)=>{
|
|
170
|
+
const selection = (0, external_sentenceSelection_cjs_namespaceObject.cellSelection)(cell);
|
|
177
171
|
refocusRef.current = {
|
|
178
|
-
cell,
|
|
179
|
-
text: textIn(rules,
|
|
172
|
+
cell: selection,
|
|
173
|
+
text: textIn(rules, selection),
|
|
180
174
|
scroll
|
|
181
175
|
};
|
|
182
176
|
edit?.onClearCell(cell);
|
|
183
|
-
cancelEditOf(
|
|
177
|
+
cancelEditOf(selection);
|
|
184
178
|
if (refocusNow && staysOn(cell.rowId)) navigation.refocus(scroll);
|
|
185
179
|
};
|
|
186
180
|
const onKeyDown = (event)=>{
|
|
@@ -204,25 +198,18 @@ const useValueEditing = ({ edit, rules, bands, selected, onSelect, navigation, l
|
|
|
204
198
|
const onAction = (action)=>{
|
|
205
199
|
if ('clear' === action.action) {
|
|
206
200
|
clear(action.cell, selected?.rowId === action.cell.rowId, false);
|
|
207
|
-
if (selected?.rowId !== action.cell.rowId) navigation.select(
|
|
208
|
-
rowId: action.cell.rowId
|
|
209
|
-
}, void 0, false);
|
|
201
|
+
if (selected?.rowId !== action.cell.rowId) navigation.select((0, external_sentenceSelection_cjs_namespaceObject.ruleSelection)(action.cell.rowId), void 0, false);
|
|
210
202
|
return true;
|
|
211
203
|
}
|
|
212
204
|
if ('delete' !== action.action) return false;
|
|
205
|
+
const deleted = (0, external_sentenceSelection_cjs_namespaceObject.ruleSelection)(action.rowId);
|
|
213
206
|
refocusRef.current = {
|
|
214
|
-
cell:
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
text: textIn(rules, {
|
|
218
|
-
rowId: action.rowId
|
|
219
|
-
}),
|
|
207
|
+
cell: deleted,
|
|
208
|
+
text: textIn(rules, deleted),
|
|
220
209
|
scroll: true
|
|
221
210
|
};
|
|
222
211
|
edit?.onDeleteRule(action.rowId);
|
|
223
|
-
cancelEditOf(
|
|
224
|
-
rowId: action.rowId
|
|
225
|
-
});
|
|
212
|
+
cancelEditOf(deleted);
|
|
226
213
|
if (selected?.rowId === action.rowId && staysOn(action.rowId)) navigation.refocus();
|
|
227
214
|
return true;
|
|
228
215
|
};
|
|
@@ -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,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
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;AAmBtD,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,YA0LvB,CAAC"}
|