@uipath/apollo-react 7.36.0 → 7.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/CitationButton.cjs +72 -0
- package/dist/decision-table/CitationButton.d.ts +33 -0
- package/dist/decision-table/CitationButton.d.ts.map +1 -0
- package/dist/decision-table/CitationButton.js +35 -0
- package/dist/decision-table/DecisionGraphCard.cjs +16 -2
- package/dist/decision-table/DecisionGraphCard.d.ts +5 -0
- package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphCard.js +17 -3
- package/dist/decision-table/DecisionGraphText.cjs +23 -4
- package/dist/decision-table/DecisionGraphText.d.ts +13 -5
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +23 -4
- package/dist/decision-table/DecisionText.cjs +34 -2
- package/dist/decision-table/DecisionText.d.ts +4 -3
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +34 -2
- package/dist/decision-table/DecisionTextHeader.cjs +17 -1
- package/dist/decision-table/DecisionTextHeader.d.ts +7 -1
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
- package/dist/decision-table/DecisionTextHeader.js +18 -2
- package/dist/decision-table/RuleCard.cjs +60 -26
- package/dist/decision-table/RuleCard.d.ts +2 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -1
- package/dist/decision-table/RuleCard.js +61 -27
- package/dist/decision-table/RuleList.cjs +2 -1
- package/dist/decision-table/RuleList.d.ts +1 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -1
- package/dist/decision-table/RuleList.js +2 -1
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts +4 -2
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/textMode.d.ts +3 -0
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphTypes.d.ts +8 -0
- package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
- package/dist/decision-table/decisionTextTypes.d.ts +1 -0
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +16 -8
- package/dist/decision-table/index.d.ts +4 -3
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -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.d.ts +2 -1
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.cjs +15 -1
- package/dist/decision-table/sentenceSelection.d.ts +3 -1
- package/dist/decision-table/sentenceSelection.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.js +9 -1
- package/dist/decision-table/sentenceStyles.cjs +33 -6
- package/dist/decision-table/sentenceStyles.d.ts +8 -1
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -1
- package/dist/decision-table/sentenceStyles.js +9 -3
- package/dist/decision-table/sentenceTypes.d.ts +28 -0
- 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/useContainerHandlers.cjs +88 -3
- package/dist/decision-table/useContainerHandlers.d.ts +10 -1
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
- package/dist/decision-table/useContainerHandlers.js +88 -3
- package/dist/decision-table/useDecisionGraphStrings.cjs +6 -2
- package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
- package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionGraphStrings.js +6 -2
- package/dist/decision-table/useDecisionTextStrings.cjs +43 -0
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionTextStrings.js +43 -0
- package/dist/decision-table/useSentenceNavigation.cjs +5 -6
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -1
- package/dist/decision-table/useSentenceNavigation.js +1 -2
- package/package.json +2 -2
|
@@ -30,8 +30,72 @@ const external_react_namespaceObject = require("react");
|
|
|
30
30
|
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
31
31
|
const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
|
|
32
32
|
const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenceNavigation.cjs");
|
|
33
|
+
const clickedCitationOf = (target, view)=>{
|
|
34
|
+
const button = target instanceof Element ? target.closest('[data-rule-action="citation"]') : null;
|
|
35
|
+
if (!button) return;
|
|
36
|
+
return (card)=>{
|
|
37
|
+
const active = button.ownerDocument.activeElement;
|
|
38
|
+
const movedOut = null !== active && active !== button.ownerDocument.body && !view.contains(active);
|
|
39
|
+
if (movedOut) return null;
|
|
40
|
+
return card.contains(button) ? button : card;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const citationButtonsOf = (view, rowId)=>[
|
|
44
|
+
...view.querySelectorAll('li[data-row-id]')
|
|
45
|
+
].filter((card)=>card.dataset.rowId === rowId).flatMap((card)=>[
|
|
46
|
+
...card.querySelectorAll('[data-rule-action="citation"]')
|
|
47
|
+
]);
|
|
48
|
+
const firstStop = (row)=>row && {
|
|
49
|
+
kind: 'citation',
|
|
50
|
+
row,
|
|
51
|
+
button: 0
|
|
52
|
+
};
|
|
53
|
+
const lastStop = (row)=>row && {
|
|
54
|
+
kind: 'citation',
|
|
55
|
+
row,
|
|
56
|
+
button: row.count - 1
|
|
57
|
+
};
|
|
58
|
+
const citationStopOf = (event, citedRows)=>{
|
|
59
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
60
|
+
const view = event.currentTarget;
|
|
61
|
+
if (event.target === view) return 'Enter' === event.key ? firstStop(citedRows[0]) : void 0;
|
|
62
|
+
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
63
|
+
const rowId = target?.closest('li[data-row-id]')?.dataset.rowId;
|
|
64
|
+
const at = citedRows.findIndex((row)=>row.rowId === rowId);
|
|
65
|
+
const row = citedRows[at];
|
|
66
|
+
const button = target && void 0 !== rowId ? citationButtonsOf(view, rowId).indexOf(target) : -1;
|
|
67
|
+
if (!row || button < 0) return;
|
|
68
|
+
if ('ArrowDown' === event.key) return button + 1 < row.count ? {
|
|
69
|
+
kind: 'citation',
|
|
70
|
+
row,
|
|
71
|
+
button: button + 1
|
|
72
|
+
} : firstStop(citedRows[at + 1]);
|
|
73
|
+
if ('ArrowUp' === event.key) return button > 0 ? {
|
|
74
|
+
kind: 'citation',
|
|
75
|
+
row,
|
|
76
|
+
button: button - 1
|
|
77
|
+
} : lastStop(citedRows[at - 1]);
|
|
78
|
+
if ('Home' === event.key) return firstStop(citedRows[0]);
|
|
79
|
+
if ('End' === event.key) return lastStop(citedRows[citedRows.length - 1]);
|
|
80
|
+
return 'Escape' === event.key ? {
|
|
81
|
+
kind: 'view'
|
|
82
|
+
} : void 0;
|
|
83
|
+
};
|
|
33
84
|
const isTabOnView = (event)=>'Tab' === event.key && !event.shiftKey && event.target === event.currentTarget;
|
|
34
|
-
const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history })=>{
|
|
85
|
+
const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop })=>{
|
|
86
|
+
const pendingCitationRef = (0, external_react_namespaceObject.useRef)(null);
|
|
87
|
+
const focusPendingCitation = ()=>{
|
|
88
|
+
const pending = pendingCitationRef.current;
|
|
89
|
+
const view = container();
|
|
90
|
+
const button = pending && view ? citationButtonsOf(view, pending.row.rowId)[pending.button] : void 0;
|
|
91
|
+
if (!pending || !button) return false;
|
|
92
|
+
pendingCitationRef.current = null;
|
|
93
|
+
button.focus({
|
|
94
|
+
preventScroll: true
|
|
95
|
+
});
|
|
96
|
+
revealStop(pending.row.index, button);
|
|
97
|
+
return true;
|
|
98
|
+
};
|
|
35
99
|
const focusWithinRef = (0, external_react_namespaceObject.useRef)(false);
|
|
36
100
|
const pressedRef = (0, external_react_namespaceObject.useRef)(false);
|
|
37
101
|
const stopPressRef = (0, external_react_namespaceObject.useRef)(null);
|
|
@@ -41,6 +105,9 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
41
105
|
if (focusWithinRef.current && view && (0, external_gridEvents_cjs_namespaceObject.hasLostFocus)(view)) view.focus();
|
|
42
106
|
});
|
|
43
107
|
(0, external_react_namespaceObject.useEffect)(()=>()=>stopPressRef.current?.(), []);
|
|
108
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
109
|
+
focusPendingCitation();
|
|
110
|
+
});
|
|
44
111
|
const endPress = ()=>{
|
|
45
112
|
stopPressRef.current?.();
|
|
46
113
|
stopPressRef.current = null;
|
|
@@ -84,11 +151,28 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
84
151
|
step();
|
|
85
152
|
return true;
|
|
86
153
|
};
|
|
154
|
+
const moveAmongCitations = (event)=>{
|
|
155
|
+
const stop = citationKeys && !event.defaultPrevented ? citationStopOf(event, citedRows) : void 0;
|
|
156
|
+
if (!stop) return false;
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
const view = event.currentTarget;
|
|
159
|
+
if ('view' === stop.kind) {
|
|
160
|
+
view.focus();
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
pendingCitationRef.current = {
|
|
164
|
+
row: stop.row,
|
|
165
|
+
button: stop.button
|
|
166
|
+
};
|
|
167
|
+
focusRow(stop.row.rowId);
|
|
168
|
+
if (!focusPendingCitation()) revealRow(stop.row.index);
|
|
169
|
+
return true;
|
|
170
|
+
};
|
|
87
171
|
const onKeyDown = (event)=>{
|
|
88
172
|
if (stopTabbable && isTabOnView(event)) {
|
|
89
173
|
event.preventDefault();
|
|
90
174
|
navigation.refocus();
|
|
91
|
-
} else if (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event)) return;
|
|
175
|
+
} else if (!moveAmongCitations(event) && (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event))) return;
|
|
92
176
|
consumerKeyDown?.(event);
|
|
93
177
|
};
|
|
94
178
|
const onFocus = (event)=>{
|
|
@@ -102,6 +186,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
102
186
|
const onBlur = (event)=>{
|
|
103
187
|
if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) {
|
|
104
188
|
focusWithinRef.current = false;
|
|
189
|
+
pendingCitationRef.current = null;
|
|
105
190
|
endPress();
|
|
106
191
|
setFocusInside(false);
|
|
107
192
|
focusRow(void 0);
|
|
@@ -111,7 +196,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
111
196
|
const onClick = (event)=>{
|
|
112
197
|
const claimed = openDecision(event, (0, external_sentenceTargets_cjs_namespaceObject.clickedDecision)(event.target), 0 === event.detail) || ruleMenus.onClick(event) || valueEditing.onClick(event);
|
|
113
198
|
const selection = claimed ? null : (0, external_sentenceTargets_cjs_namespaceObject.clickedSelection)(event.target);
|
|
114
|
-
if (selection) navigation.select(selection,
|
|
199
|
+
if (selection) navigation.select(selection, clickedCitationOf(event.target, event.currentTarget), false);
|
|
115
200
|
consumerClick?.(event);
|
|
116
201
|
};
|
|
117
202
|
return {
|
|
@@ -20,8 +20,17 @@ export interface ContainerHandlersParams {
|
|
|
20
20
|
stopTabbable: boolean;
|
|
21
21
|
focusRow: (rowId: string | undefined) => void;
|
|
22
22
|
history: TextHistory | null;
|
|
23
|
+
citationKeys: boolean;
|
|
24
|
+
citedRows: readonly CitedRow[];
|
|
25
|
+
revealRow: RuleWindow['scrollRowIntoView'];
|
|
26
|
+
revealStop: RuleWindow['scrollStopIntoView'];
|
|
23
27
|
}
|
|
24
|
-
export
|
|
28
|
+
export interface CitedRow {
|
|
29
|
+
rowId: string;
|
|
30
|
+
index: number;
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const useContainerHandlers: ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop, }: ContainerHandlersParams) => {
|
|
25
34
|
tabIndex: number;
|
|
26
35
|
onPointerOver: (event: React.PointerEvent<HTMLElement>) => void;
|
|
27
36
|
onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContainerHandlers.d.ts","sourceRoot":"","sources":["../../src/decision-table/useContainerHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useContainerHandlers.d.ts","sourceRoot":"","sources":["../../src/decision-table/useContainerHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAoBtD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,YAAY,GAAG,UAAU,CAC1B,GACC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAG/C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACvD,OAAO,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACzC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IAErB,cAAc,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3E,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAEnC,YAAY,EAAE,OAAO,CAAC;IAEtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAE9C,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAE5B,YAAY,EAAE,OAAO,CAAC;IAEtB,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IAE/B,SAAS,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAE3C,UAAU,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;CAC9C;AAGD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAiDD,eAAO,MAAM,oBAAoB,GAAI,+KAelC,uBAAuB;;2BA4CM,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC;2BAI/B,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC;6BAM7B,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC;0BAIlC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC;uBAkDlC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;qBAelC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;oBAQ9B,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;qBAa5B,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBtD,CAAC"}
|
|
@@ -2,8 +2,72 @@ import { useEffect, useRef, useState } from "react";
|
|
|
2
2
|
import { hasLostFocus, isComposing, isFromTextField, isRedoKey, isUndoKey, onNextGesture } from "./gridEvents.js";
|
|
3
3
|
import { clickedDecision, clickedSelection, rowIdOf, stopDecisionOf, valueTokenAt } from "./sentenceTargets.js";
|
|
4
4
|
import { isIgnoredKey } from "./useSentenceNavigation.js";
|
|
5
|
+
const clickedCitationOf = (target, view)=>{
|
|
6
|
+
const button = target instanceof Element ? target.closest('[data-rule-action="citation"]') : null;
|
|
7
|
+
if (!button) return;
|
|
8
|
+
return (card)=>{
|
|
9
|
+
const active = button.ownerDocument.activeElement;
|
|
10
|
+
const movedOut = null !== active && active !== button.ownerDocument.body && !view.contains(active);
|
|
11
|
+
if (movedOut) return null;
|
|
12
|
+
return card.contains(button) ? button : card;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const citationButtonsOf = (view, rowId)=>[
|
|
16
|
+
...view.querySelectorAll('li[data-row-id]')
|
|
17
|
+
].filter((card)=>card.dataset.rowId === rowId).flatMap((card)=>[
|
|
18
|
+
...card.querySelectorAll('[data-rule-action="citation"]')
|
|
19
|
+
]);
|
|
20
|
+
const firstStop = (row)=>row && {
|
|
21
|
+
kind: 'citation',
|
|
22
|
+
row,
|
|
23
|
+
button: 0
|
|
24
|
+
};
|
|
25
|
+
const lastStop = (row)=>row && {
|
|
26
|
+
kind: 'citation',
|
|
27
|
+
row,
|
|
28
|
+
button: row.count - 1
|
|
29
|
+
};
|
|
30
|
+
const citationStopOf = (event, citedRows)=>{
|
|
31
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
32
|
+
const view = event.currentTarget;
|
|
33
|
+
if (event.target === view) return 'Enter' === event.key ? firstStop(citedRows[0]) : void 0;
|
|
34
|
+
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
35
|
+
const rowId = target?.closest('li[data-row-id]')?.dataset.rowId;
|
|
36
|
+
const at = citedRows.findIndex((row)=>row.rowId === rowId);
|
|
37
|
+
const row = citedRows[at];
|
|
38
|
+
const button = target && void 0 !== rowId ? citationButtonsOf(view, rowId).indexOf(target) : -1;
|
|
39
|
+
if (!row || button < 0) return;
|
|
40
|
+
if ('ArrowDown' === event.key) return button + 1 < row.count ? {
|
|
41
|
+
kind: 'citation',
|
|
42
|
+
row,
|
|
43
|
+
button: button + 1
|
|
44
|
+
} : firstStop(citedRows[at + 1]);
|
|
45
|
+
if ('ArrowUp' === event.key) return button > 0 ? {
|
|
46
|
+
kind: 'citation',
|
|
47
|
+
row,
|
|
48
|
+
button: button - 1
|
|
49
|
+
} : lastStop(citedRows[at - 1]);
|
|
50
|
+
if ('Home' === event.key) return firstStop(citedRows[0]);
|
|
51
|
+
if ('End' === event.key) return lastStop(citedRows[citedRows.length - 1]);
|
|
52
|
+
return 'Escape' === event.key ? {
|
|
53
|
+
kind: 'view'
|
|
54
|
+
} : void 0;
|
|
55
|
+
};
|
|
5
56
|
const isTabOnView = (event)=>'Tab' === event.key && !event.shiftKey && event.target === event.currentTarget;
|
|
6
|
-
const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history })=>{
|
|
57
|
+
const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop })=>{
|
|
58
|
+
const pendingCitationRef = useRef(null);
|
|
59
|
+
const focusPendingCitation = ()=>{
|
|
60
|
+
const pending = pendingCitationRef.current;
|
|
61
|
+
const view = container();
|
|
62
|
+
const button = pending && view ? citationButtonsOf(view, pending.row.rowId)[pending.button] : void 0;
|
|
63
|
+
if (!pending || !button) return false;
|
|
64
|
+
pendingCitationRef.current = null;
|
|
65
|
+
button.focus({
|
|
66
|
+
preventScroll: true
|
|
67
|
+
});
|
|
68
|
+
revealStop(pending.row.index, button);
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
7
71
|
const focusWithinRef = useRef(false);
|
|
8
72
|
const pressedRef = useRef(false);
|
|
9
73
|
const stopPressRef = useRef(null);
|
|
@@ -13,6 +77,9 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
13
77
|
if (focusWithinRef.current && view && hasLostFocus(view)) view.focus();
|
|
14
78
|
});
|
|
15
79
|
useEffect(()=>()=>stopPressRef.current?.(), []);
|
|
80
|
+
useEffect(()=>{
|
|
81
|
+
focusPendingCitation();
|
|
82
|
+
});
|
|
16
83
|
const endPress = ()=>{
|
|
17
84
|
stopPressRef.current?.();
|
|
18
85
|
stopPressRef.current = null;
|
|
@@ -56,11 +123,28 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
56
123
|
step();
|
|
57
124
|
return true;
|
|
58
125
|
};
|
|
126
|
+
const moveAmongCitations = (event)=>{
|
|
127
|
+
const stop = citationKeys && !event.defaultPrevented ? citationStopOf(event, citedRows) : void 0;
|
|
128
|
+
if (!stop) return false;
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
const view = event.currentTarget;
|
|
131
|
+
if ('view' === stop.kind) {
|
|
132
|
+
view.focus();
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
pendingCitationRef.current = {
|
|
136
|
+
row: stop.row,
|
|
137
|
+
button: stop.button
|
|
138
|
+
};
|
|
139
|
+
focusRow(stop.row.rowId);
|
|
140
|
+
if (!focusPendingCitation()) revealRow(stop.row.index);
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
59
143
|
const onKeyDown = (event)=>{
|
|
60
144
|
if (stopTabbable && isTabOnView(event)) {
|
|
61
145
|
event.preventDefault();
|
|
62
146
|
navigation.refocus();
|
|
63
|
-
} else if (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event)) return;
|
|
147
|
+
} else if (!moveAmongCitations(event) && (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event))) return;
|
|
64
148
|
consumerKeyDown?.(event);
|
|
65
149
|
};
|
|
66
150
|
const onFocus = (event)=>{
|
|
@@ -74,6 +158,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
74
158
|
const onBlur = (event)=>{
|
|
75
159
|
if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) {
|
|
76
160
|
focusWithinRef.current = false;
|
|
161
|
+
pendingCitationRef.current = null;
|
|
77
162
|
endPress();
|
|
78
163
|
setFocusInside(false);
|
|
79
164
|
focusRow(void 0);
|
|
@@ -83,7 +168,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
|
|
|
83
168
|
const onClick = (event)=>{
|
|
84
169
|
const claimed = openDecision(event, clickedDecision(event.target), 0 === event.detail) || ruleMenus.onClick(event) || valueEditing.onClick(event);
|
|
85
170
|
const selection = claimed ? null : clickedSelection(event.target);
|
|
86
|
-
if (selection) navigation.select(selection,
|
|
171
|
+
if (selection) navigation.select(selection, clickedCitationOf(event.target, event.currentTarget), false);
|
|
87
172
|
consumerClick?.(event);
|
|
88
173
|
};
|
|
89
174
|
return {
|
|
@@ -31,7 +31,7 @@ const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
|
|
|
31
31
|
const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
|
|
32
32
|
const useDecisionGraphLabels = ()=>{
|
|
33
33
|
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
34
|
-
const { markStatus } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
|
|
34
|
+
const { markStatus, openCitation, citationPage } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
|
|
35
35
|
return (0, external_react_namespaceObject.useMemo)(()=>({
|
|
36
36
|
graph: _({
|
|
37
37
|
id: 'decision-graph.graph',
|
|
@@ -70,6 +70,8 @@ const useDecisionGraphLabels = ()=>{
|
|
|
70
70
|
}
|
|
71
71
|
}),
|
|
72
72
|
markStatus,
|
|
73
|
+
openCitation,
|
|
74
|
+
citationPage,
|
|
73
75
|
minimap: _({
|
|
74
76
|
id: 'decision-graph.minimap',
|
|
75
77
|
message: 'Browse rules'
|
|
@@ -251,7 +253,9 @@ const useDecisionGraphLabels = ()=>{
|
|
|
251
253
|
})
|
|
252
254
|
}), [
|
|
253
255
|
_,
|
|
254
|
-
markStatus
|
|
256
|
+
markStatus,
|
|
257
|
+
openCitation,
|
|
258
|
+
citationPage
|
|
255
259
|
]);
|
|
256
260
|
};
|
|
257
261
|
exports.useDecisionGraphLabels = __webpack_exports__.useDecisionGraphLabels;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { CitationLabels } from './CitationButton';
|
|
1
2
|
import type { DecisionGraphActionLabels } from './decisionGraphActionTypes';
|
|
2
3
|
import type { DecisionGraphMinimapLabels } from './DecisionGraphMinimap';
|
|
3
4
|
import type { MarkBadgeLabels } from './MarkBadge';
|
|
4
|
-
export interface DecisionGraphLabels extends DecisionGraphMinimapLabels, MarkBadgeLabels, DecisionGraphActionLabels {
|
|
5
|
+
export interface DecisionGraphLabels extends DecisionGraphMinimapLabels, MarkBadgeLabels, CitationLabels, DecisionGraphActionLabels {
|
|
5
6
|
graph: string;
|
|
6
7
|
empty: string;
|
|
7
8
|
ruleCount: (count: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDecisionGraphStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionGraphStrings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,MAAM,WAAW,mBACf,SAAQ,0BAA0B,EAChC,eAAe,EACf,yBAAyB;IAE3B,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,
|
|
1
|
+
{"version":3,"file":"useDecisionGraphStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionGraphStrings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,MAAM,WAAW,mBACf,SAAQ,0BAA0B,EAChC,eAAe,EACf,cAAc,EACd,yBAAyB;IAE3B,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,mBA+HzC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { useSafeLingui } from "../i18n/useSafeLingui.js";
|
|
|
3
3
|
import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
4
4
|
const useDecisionGraphLabels = ()=>{
|
|
5
5
|
const { _ } = useSafeLingui();
|
|
6
|
-
const { markStatus } = useDecisionTextLabels();
|
|
6
|
+
const { markStatus, openCitation, citationPage } = useDecisionTextLabels();
|
|
7
7
|
return useMemo(()=>({
|
|
8
8
|
graph: _({
|
|
9
9
|
id: 'decision-graph.graph',
|
|
@@ -42,6 +42,8 @@ const useDecisionGraphLabels = ()=>{
|
|
|
42
42
|
}
|
|
43
43
|
}),
|
|
44
44
|
markStatus,
|
|
45
|
+
openCitation,
|
|
46
|
+
citationPage,
|
|
45
47
|
minimap: _({
|
|
46
48
|
id: 'decision-graph.minimap',
|
|
47
49
|
message: 'Browse rules'
|
|
@@ -223,7 +225,9 @@ const useDecisionGraphLabels = ()=>{
|
|
|
223
225
|
})
|
|
224
226
|
}), [
|
|
225
227
|
_,
|
|
226
|
-
markStatus
|
|
228
|
+
markStatus,
|
|
229
|
+
openCitation,
|
|
230
|
+
citationPage
|
|
227
231
|
]);
|
|
228
232
|
};
|
|
229
233
|
export { useDecisionGraphLabels };
|
|
@@ -127,6 +127,10 @@ const useDecisionTextLabels = ()=>{
|
|
|
127
127
|
id: 'decision-text.empty_value',
|
|
128
128
|
message: 'empty'
|
|
129
129
|
}),
|
|
130
|
+
pressEnterForSources: _({
|
|
131
|
+
id: 'decision-text.press_enter_for_sources',
|
|
132
|
+
message: "Press Enter to reach the rules' sources"
|
|
133
|
+
}),
|
|
130
134
|
openDecision: (input)=>_({
|
|
131
135
|
id: 'decision-text.open_decision',
|
|
132
136
|
message: "Open {input}'s decision",
|
|
@@ -134,6 +138,45 @@ const useDecisionTextLabels = ()=>{
|
|
|
134
138
|
input
|
|
135
139
|
}
|
|
136
140
|
}),
|
|
141
|
+
openCitation: (owner, page, index)=>{
|
|
142
|
+
const numbered = null === index ? 'no' : 'yes';
|
|
143
|
+
if ('rule' === owner.kind) return _({
|
|
144
|
+
id: 'decision-text.open_rule_citation',
|
|
145
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of rule {position}, page {page}',
|
|
146
|
+
values: {
|
|
147
|
+
numbered,
|
|
148
|
+
index: index ?? 0,
|
|
149
|
+
position: owner.position,
|
|
150
|
+
page
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if ('decision' === owner.kind) return _({
|
|
154
|
+
id: 'decision-text.open_decision_citation',
|
|
155
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of {decision}, page {page}',
|
|
156
|
+
values: {
|
|
157
|
+
numbered,
|
|
158
|
+
index: index ?? 0,
|
|
159
|
+
decision: owner.name,
|
|
160
|
+
page
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return _({
|
|
164
|
+
id: 'decision-text.open_table_citation',
|
|
165
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of this decision, page {page}',
|
|
166
|
+
values: {
|
|
167
|
+
numbered,
|
|
168
|
+
index: index ?? 0,
|
|
169
|
+
page
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
citationPage: (page)=>_({
|
|
174
|
+
id: 'decision-text.citation_page',
|
|
175
|
+
message: 'Page {page}',
|
|
176
|
+
values: {
|
|
177
|
+
page
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
137
180
|
changeStatus: (change)=>changes[change],
|
|
138
181
|
movedFrom: (number)=>_({
|
|
139
182
|
id: 'decision-text.moved_from',
|
|
@@ -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,qBAAqB,QAAO,
|
|
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,kBAiHxC,CAAC;AAGF,eAAO,MAAM,yBAAyB,QAAO,sBA8F5C,CAAC"}
|
|
@@ -98,6 +98,10 @@ const useDecisionTextLabels = ()=>{
|
|
|
98
98
|
id: 'decision-text.empty_value',
|
|
99
99
|
message: 'empty'
|
|
100
100
|
}),
|
|
101
|
+
pressEnterForSources: _({
|
|
102
|
+
id: 'decision-text.press_enter_for_sources',
|
|
103
|
+
message: "Press Enter to reach the rules' sources"
|
|
104
|
+
}),
|
|
101
105
|
openDecision: (input)=>_({
|
|
102
106
|
id: 'decision-text.open_decision',
|
|
103
107
|
message: "Open {input}'s decision",
|
|
@@ -105,6 +109,45 @@ const useDecisionTextLabels = ()=>{
|
|
|
105
109
|
input
|
|
106
110
|
}
|
|
107
111
|
}),
|
|
112
|
+
openCitation: (owner, page, index)=>{
|
|
113
|
+
const numbered = null === index ? 'no' : 'yes';
|
|
114
|
+
if ('rule' === owner.kind) return _({
|
|
115
|
+
id: 'decision-text.open_rule_citation',
|
|
116
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of rule {position}, page {page}',
|
|
117
|
+
values: {
|
|
118
|
+
numbered,
|
|
119
|
+
index: index ?? 0,
|
|
120
|
+
position: owner.position,
|
|
121
|
+
page
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
if ('decision' === owner.kind) return _({
|
|
125
|
+
id: 'decision-text.open_decision_citation',
|
|
126
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of {decision}, page {page}',
|
|
127
|
+
values: {
|
|
128
|
+
numbered,
|
|
129
|
+
index: index ?? 0,
|
|
130
|
+
decision: owner.name,
|
|
131
|
+
page
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return _({
|
|
135
|
+
id: 'decision-text.open_table_citation',
|
|
136
|
+
message: 'Open source{numbered, select, yes { {index}} other {}} of this decision, page {page}',
|
|
137
|
+
values: {
|
|
138
|
+
numbered,
|
|
139
|
+
index: index ?? 0,
|
|
140
|
+
page
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
citationPage: (page)=>_({
|
|
145
|
+
id: 'decision-text.citation_page',
|
|
146
|
+
message: 'Page {page}',
|
|
147
|
+
values: {
|
|
148
|
+
page
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
108
151
|
changeStatus: (change)=>changes[change],
|
|
109
152
|
movedFrom: (number)=>_({
|
|
110
153
|
id: 'decision-text.moved_from',
|
|
@@ -43,7 +43,6 @@ const selectionAt = (rules, { row, stop })=>{
|
|
|
43
43
|
const columnId = stopsOf(target)[stop];
|
|
44
44
|
return (0, external_sentenceSelection_cjs_namespaceObject.selectionOf)(target.rowId, columnId);
|
|
45
45
|
};
|
|
46
|
-
const sameSelection = (left, right)=>left?.rowId === right?.rowId && (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(left) === (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(right);
|
|
47
46
|
const verticalMove = (delta, meta, from, rowCount, stopsAt, columnId)=>{
|
|
48
47
|
const last = rowCount - 1;
|
|
49
48
|
const row = meta ? delta < 0 ? 0 : last : (0, external_useGridNavigation_cjs_namespaceObject.clamp)(from.row + delta, last);
|
|
@@ -99,7 +98,7 @@ const movedStopOf = (element, current)=>{
|
|
|
99
98
|
const focusedAddRule = addRule?.contains((0, external_gridEvents_cjs_namespaceObject.activeElementOf)(addRule)) ? addRule : void 0;
|
|
100
99
|
return focusedAddRule ?? cell;
|
|
101
100
|
};
|
|
102
|
-
const keptColumnOf = (wanted, current)=>wanted && sameSelection(wanted.at, current) ? wanted.columnId : (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(current);
|
|
101
|
+
const keptColumnOf = (wanted, current)=>wanted && (0, external_sentenceSelection_cjs_namespaceObject.sameSelection)(wanted.at, current) ? wanted.columnId : (0, external_sentenceSelection_cjs_namespaceObject.selectedColumnOf)(current);
|
|
103
102
|
const isVerticalKey = (key)=>(external_useGridNavigation_cjs_namespaceObject.ARROW_DELTAS[key]?.row ?? 0) !== 0;
|
|
104
103
|
const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, container, firstVisibleRow, scrollStopIntoView, scrollRowIntoView })=>{
|
|
105
104
|
const stops = (0, external_react_namespaceObject.useMemo)(()=>stopsOf(null === selectedRow ? void 0 : rules[selectedRow]), [
|
|
@@ -133,14 +132,14 @@ const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, contain
|
|
|
133
132
|
const shownRowIdRef = (0, external_react_namespaceObject.useRef)(selectedRule?.rowId);
|
|
134
133
|
const shownSelectionRef = (0, external_react_namespaceObject.useRef)(current);
|
|
135
134
|
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
136
|
-
const changed = !sameSelection(shownSelectionRef.current, current);
|
|
135
|
+
const changed = !(0, external_sentenceSelection_cjs_namespaceObject.sameSelection)(shownSelectionRef.current, current);
|
|
137
136
|
shownSelectionRef.current = current;
|
|
138
|
-
if (changed && !sameSelection(wantedRef.current?.at ?? null, current)) wantedRef.current = void 0;
|
|
137
|
+
if (changed && !(0, external_sentenceSelection_cjs_namespaceObject.sameSelection)(wantedRef.current?.at ?? null, current)) wantedRef.current = void 0;
|
|
139
138
|
const pending = pendingFocusRef.current;
|
|
140
139
|
const moved = selectedRule?.rowId !== shownRowIdRef.current;
|
|
141
140
|
shownRowIdRef.current = selectedRule?.rowId;
|
|
142
141
|
const stayed = (0, external_gridEvents_cjs_namespaceObject.focusStays)(container(), pending?.from);
|
|
143
|
-
const applied = void 0 !== pending && sameSelection(pending.selection, current);
|
|
142
|
+
const applied = void 0 !== pending && (0, external_sentenceSelection_cjs_namespaceObject.sameSelection)(pending.selection, current);
|
|
144
143
|
if (!stayed || applied) pendingFocusRef.current = void 0;
|
|
145
144
|
if (void 0 !== pending && applied && stayed) focusCurrent(pending.focus, pending.scroll);
|
|
146
145
|
else if (moved && null !== selectedRow) {
|
|
@@ -151,7 +150,7 @@ const useSentenceNavigation = ({ rules, selected, selectedRow, onSelect, contain
|
|
|
151
150
|
});
|
|
152
151
|
const request = (selection, focus, scroll = true)=>{
|
|
153
152
|
if (!onSelect) return;
|
|
154
|
-
if (sameSelection(selection, selected ?? null)) return void focusCurrent(focus, scroll);
|
|
153
|
+
if ((0, external_sentenceSelection_cjs_namespaceObject.sameSelection)(selection, selected ?? null)) return void focusCurrent(focus, scroll);
|
|
155
154
|
const view = container();
|
|
156
155
|
pendingFocusRef.current = {
|
|
157
156
|
selection,
|
|
@@ -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;AAIlD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,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;AA4GlD,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,7 +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
|
+
import { sameSelection, selectedColumnOf, selectionOf } from "./sentenceSelection.js";
|
|
5
5
|
import { cardOf, cellOf } from "./sentenceTargets.js";
|
|
6
6
|
import { ARROW_DELTAS, GRID_ENTRY_KEYS, clamp } from "./useGridNavigation.js";
|
|
7
7
|
const stopsOf = (rule)=>[
|
|
@@ -14,7 +14,6 @@ const selectionAt = (rules, { row, stop })=>{
|
|
|
14
14
|
const columnId = stopsOf(target)[stop];
|
|
15
15
|
return selectionOf(target.rowId, columnId);
|
|
16
16
|
};
|
|
17
|
-
const sameSelection = (left, right)=>left?.rowId === right?.rowId && selectedColumnOf(left) === selectedColumnOf(right);
|
|
18
17
|
const verticalMove = (delta, meta, from, rowCount, stopsAt, columnId)=>{
|
|
19
18
|
const last = rowCount - 1;
|
|
20
19
|
const row = meta ? delta < 0 ? 0 : last : clamp(from.row + delta, last);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/apollo-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.37.1",
|
|
4
4
|
"description": "Apollo Design System - React component library with Material UI theming",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -251,9 +251,9 @@
|
|
|
251
251
|
"use-sync-external-store": "^1.2.0",
|
|
252
252
|
"zod": "^4.6.6",
|
|
253
253
|
"zustand": "^5.0.9",
|
|
254
|
-
"@uipath/apollo-core": "5.15.3",
|
|
255
254
|
"@uipath/apollo-ui-icons": "1.2.1",
|
|
256
255
|
"@uipath/apollo-ui-icons-react": "1.1.0",
|
|
256
|
+
"@uipath/apollo-core": "5.15.3",
|
|
257
257
|
"@uipath/apollo-wind": "2.95.1"
|
|
258
258
|
},
|
|
259
259
|
"devDependencies": {
|