@uipath/apollo-react 7.34.0 → 7.36.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/components/BaseNode/BaseNodeContainer.cjs +4 -4
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -4
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionGraphText.cjs +398 -6
- package/dist/decision-table/DecisionGraphText.d.ts +15 -5
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +399 -7
- package/dist/decision-table/DecisionText.cjs +16 -2
- package/dist/decision-table/DecisionText.d.ts +3 -3
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +16 -2
- package/dist/decision-table/__fixtures__/textMode.d.ts +3 -3
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/useStoryHistory.d.ts +7 -0
- package/dist/decision-table/__fixtures__/useStoryHistory.d.ts.map +1 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts +8 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphTypes.d.ts +3 -0
- package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +54 -62
- package/dist/decision-table/index.d.ts +1 -2
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +1 -2
- package/dist/decision-table/revealIn.cjs +59 -0
- package/dist/decision-table/revealIn.d.ts +7 -0
- package/dist/decision-table/revealIn.d.ts.map +1 -0
- package/dist/decision-table/revealIn.js +25 -0
- package/dist/decision-table/sentenceTargets.cjs +5 -1
- package/dist/decision-table/sentenceTargets.d.ts +1 -0
- package/dist/decision-table/sentenceTargets.d.ts.map +1 -1
- package/dist/decision-table/sentenceTargets.js +2 -1
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useContainerHandlers.cjs +19 -6
- package/dist/decision-table/useContainerHandlers.d.ts +8 -2
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
- package/dist/decision-table/useContainerHandlers.js +21 -8
- package/dist/decision-table/useGridLayout.cjs +12 -2
- package/dist/decision-table/useGridLayout.d.ts.map +1 -1
- package/dist/decision-table/useGridLayout.js +12 -2
- package/dist/decision-table/useRuleWindow.cjs +9 -4
- package/dist/decision-table/useRuleWindow.d.ts +1 -1
- package/dist/decision-table/useRuleWindow.d.ts.map +1 -1
- package/dist/decision-table/useRuleWindow.js +9 -4
- package/dist/decision-table/useValueEditing.cjs +1 -2
- package/dist/decision-table/useValueEditing.d.ts.map +1 -1
- package/dist/decision-table/useValueEditing.js +1 -2
- package/dist/decision-table/useVirtualizedAxis.cjs +17 -14
- package/dist/decision-table/useVirtualizedAxis.d.ts +2 -2
- package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -1
- package/dist/decision-table/useVirtualizedAxis.js +17 -14
- package/package.json +2 -2
- package/dist/decision-table/DecisionGraphView.cjs +0 -409
- package/dist/decision-table/DecisionGraphView.d.ts +0 -20
- package/dist/decision-table/DecisionGraphView.d.ts.map +0 -1
- package/dist/decision-table/DecisionGraphView.js +0 -375
- package/dist/decision-table/EditableDecisionGraphText.cjs +0 -40
- package/dist/decision-table/EditableDecisionGraphText.d.ts +0 -5
- package/dist/decision-table/EditableDecisionGraphText.d.ts.map +0 -1
- package/dist/decision-table/EditableDecisionGraphText.js +0 -6
|
@@ -1,10 +1,402 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { Plus } from "lucide-react";
|
|
4
|
+
import { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { DecisionGraphCard, DecisionGraphReference } from "./DecisionGraphCard.js";
|
|
6
|
+
import { DecisionGraphMinimapSlot } from "./DecisionGraphMinimapSlot.js";
|
|
7
|
+
import { childPositionsOf, decisionsOf, topPositionsOf, usersOf } from "./decisionGraphPositions.js";
|
|
8
|
+
import { GRAPH_ADD_DECISION_CLASS, GRAPH_BRANCH_CLASS, GRAPH_COLUMN_CLASS, GRAPH_EMPTY_CLASS, GRAPH_FRAME_CLASS, GRAPH_MINIMAP_GAP_PX, GRAPH_NEST_CLASS, GRAPH_OUTPUT_HUE_CLASS, GRAPH_SCROLLER_CLASS, graphColumnInsetOf } from "./decisionGraphStyles.js";
|
|
9
|
+
import { revealIn } from "./revealIn.js";
|
|
10
|
+
import { SENTENCE_MIN_RULE_HEIGHT_PX } from "./sentenceRuleHeights.js";
|
|
11
|
+
import { useDecisionGraphActions } from "./useDecisionGraphActions.js";
|
|
12
|
+
import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
|
|
13
|
+
import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
14
|
+
import { useTextAnnouncements } from "./useTextAnnouncements.js";
|
|
15
|
+
const NO_EXPANDED = new Set();
|
|
16
|
+
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
17
|
+
kind: 'rule',
|
|
18
|
+
decisionId: id,
|
|
19
|
+
rowId: mark.rowId
|
|
20
|
+
} : {
|
|
21
|
+
kind: 'decision',
|
|
22
|
+
decisionId: id
|
|
23
|
+
};
|
|
24
|
+
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
25
|
+
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
26
|
+
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
27
|
+
const flash = (element)=>{
|
|
28
|
+
if (prefersReducedMotion()) return;
|
|
29
|
+
element.animate?.([
|
|
30
|
+
{
|
|
31
|
+
boxShadow: '0 0 0 4px color-mix(in srgb, var(--color-primary) 40%, transparent)'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
boxShadow: '0 0 0 0 transparent'
|
|
35
|
+
}
|
|
36
|
+
], {
|
|
37
|
+
duration: 1400,
|
|
38
|
+
easing: 'ease-out'
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const NEAR_MARGIN = '100% 0px';
|
|
42
|
+
const nearAfter = (current, entries)=>{
|
|
43
|
+
let next;
|
|
44
|
+
for (const { target, isIntersecting } of entries){
|
|
45
|
+
const decisionId = target instanceof HTMLElement ? target.dataset.decisionId : void 0;
|
|
46
|
+
if (void 0 !== decisionId && (next ?? current).has(decisionId) !== isIntersecting) {
|
|
47
|
+
next ??= new Set(current);
|
|
48
|
+
if (isIntersecting) next.add(decisionId);
|
|
49
|
+
else next.delete(decisionId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return next ?? current;
|
|
53
|
+
};
|
|
54
|
+
const bodyHeightOf = (card)=>{
|
|
55
|
+
const body = card.querySelector(':scope > [data-graph-body]');
|
|
56
|
+
if (!body || body.querySelector(':scope > [data-graph-placeholder]')) return null;
|
|
57
|
+
return body.offsetHeight || null;
|
|
58
|
+
};
|
|
59
|
+
const ruleCountsOf = (nodes)=>{
|
|
60
|
+
const counts = new Map();
|
|
61
|
+
const visit = (node)=>{
|
|
62
|
+
if ('decision' !== node.kind) return;
|
|
63
|
+
if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
|
|
64
|
+
for (const child of node.children)visit(child);
|
|
65
|
+
};
|
|
66
|
+
for (const node of nodes)visit(node);
|
|
67
|
+
return counts;
|
|
5
68
|
};
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
69
|
+
const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
70
|
+
let height = 0;
|
|
71
|
+
let rules = 0;
|
|
72
|
+
for (const [decisionId, measured] of heights){
|
|
73
|
+
const count = ruleCounts.get(decisionId) ?? 0;
|
|
74
|
+
if (0 !== count) {
|
|
75
|
+
height += measured;
|
|
76
|
+
rules += count;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
80
|
+
};
|
|
81
|
+
const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
82
|
+
const labels = useDecisionGraphLabels();
|
|
83
|
+
const { selected } = mode;
|
|
84
|
+
const { announce, region } = useTextAnnouncements(useDecisionTextLabels(), dataTestId);
|
|
85
|
+
const idPrefix = useId();
|
|
86
|
+
const [ownExpanded, setOwnExpanded] = useState(NO_EXPANDED);
|
|
87
|
+
const expanded = expansion?.expanded ?? ownExpanded;
|
|
88
|
+
const users = useMemo(()=>usersOf(nodes), [
|
|
89
|
+
nodes
|
|
90
|
+
]);
|
|
91
|
+
const drawn = useMemo(()=>new Set(decisionsOf(nodes).map(({ id })=>id)), [
|
|
92
|
+
nodes
|
|
93
|
+
]);
|
|
94
|
+
const [scroller, setScroller] = useState(null);
|
|
95
|
+
const [launcherEnd, setLauncherEnd] = useState(0);
|
|
96
|
+
const cardsRef = useRef(new Map());
|
|
97
|
+
const [pending, setPending] = useState(null);
|
|
98
|
+
const [near, setNear] = useState(()=>"u" < typeof IntersectionObserver ? null : NO_EXPANDED);
|
|
99
|
+
const [revealed, setRevealed] = useState(null);
|
|
100
|
+
const [focused, setFocused] = useState(null);
|
|
101
|
+
const heightsRef = useRef(new Map());
|
|
102
|
+
const observersRef = useRef(null);
|
|
103
|
+
const ruleCounts = useMemo(()=>ruleCountsOf(nodes), [
|
|
104
|
+
nodes
|
|
105
|
+
]);
|
|
106
|
+
const setExpanded = (next)=>{
|
|
107
|
+
if (expansion) expansion.onChange(next);
|
|
108
|
+
else setOwnExpanded(next);
|
|
109
|
+
};
|
|
110
|
+
const toggle = (decisionId)=>{
|
|
111
|
+
const next = new Set(expanded);
|
|
112
|
+
const folds = next.delete(decisionId);
|
|
113
|
+
if (!folds) next.add(decisionId);
|
|
114
|
+
setExpanded(next);
|
|
115
|
+
if (folds) onFold?.(decisionId);
|
|
116
|
+
};
|
|
117
|
+
const reveal = (target)=>{
|
|
118
|
+
if (!expanded.has(target.decisionId)) setExpanded(new Set([
|
|
119
|
+
...expanded,
|
|
120
|
+
target.decisionId
|
|
121
|
+
]));
|
|
122
|
+
setPending(target);
|
|
123
|
+
setRevealed(target.decisionId);
|
|
124
|
+
if ('navigate' === target.mode.kind && 'read' !== mode.kind) mode.onReveal('rule' === target.kind ? {
|
|
125
|
+
kind: 'rule',
|
|
126
|
+
decisionId: target.decisionId,
|
|
127
|
+
rowId: target.rowId
|
|
128
|
+
} : {
|
|
129
|
+
kind: 'decision',
|
|
130
|
+
decisionId: target.decisionId
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const bodyContext = {
|
|
134
|
+
revealDecision: (decisionId, byKey)=>{
|
|
135
|
+
if (!drawn.has(decisionId)) return void onOpenDecision?.(decisionId);
|
|
136
|
+
reveal({
|
|
137
|
+
kind: 'decision',
|
|
138
|
+
decisionId,
|
|
139
|
+
mode: {
|
|
140
|
+
kind: 'navigate',
|
|
141
|
+
focus: byKey,
|
|
142
|
+
flash: true
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
|
|
148
|
+
const actions = useDecisionGraphActions({
|
|
149
|
+
mode,
|
|
150
|
+
nodes,
|
|
151
|
+
labels,
|
|
152
|
+
openOf,
|
|
153
|
+
cardOf: (decisionId)=>cardsRef.current.get(decisionId),
|
|
154
|
+
scroller,
|
|
155
|
+
announce,
|
|
156
|
+
dataTestId
|
|
157
|
+
});
|
|
158
|
+
const cardRefsRef = useRef(new Map());
|
|
159
|
+
const cardRef = useCallback((decisionId)=>{
|
|
160
|
+
const cached = cardRefsRef.current.get(decisionId);
|
|
161
|
+
if (cached) return cached;
|
|
162
|
+
const attach = (element)=>{
|
|
163
|
+
const observers = observersRef.current;
|
|
164
|
+
const previous = cardsRef.current.get(decisionId);
|
|
165
|
+
if (previous && previous !== element) {
|
|
166
|
+
observers?.near.unobserve(previous);
|
|
167
|
+
observers?.size?.unobserve(previous);
|
|
168
|
+
}
|
|
169
|
+
if (!element) return void cardsRef.current.delete(decisionId);
|
|
170
|
+
cardsRef.current.set(decisionId, element);
|
|
171
|
+
observers?.near.observe(element);
|
|
172
|
+
observers?.size?.observe(element);
|
|
173
|
+
};
|
|
174
|
+
cardRefsRef.current.set(decisionId, attach);
|
|
175
|
+
return attach;
|
|
176
|
+
}, []);
|
|
177
|
+
useLayoutEffect(()=>{
|
|
178
|
+
if (!scroller || "u" < typeof IntersectionObserver) return;
|
|
179
|
+
const remember = (card)=>{
|
|
180
|
+
if (!(card instanceof HTMLElement)) return;
|
|
181
|
+
const decisionId = card.dataset.decisionId;
|
|
182
|
+
const height = bodyHeightOf(card);
|
|
183
|
+
if (void 0 !== decisionId && null !== height) heightsRef.current.set(decisionId, height);
|
|
184
|
+
};
|
|
185
|
+
const nearObserver = new IntersectionObserver((entries)=>{
|
|
186
|
+
for (const { target } of entries)remember(target);
|
|
187
|
+
setNear((current)=>nearAfter(current ?? NO_EXPANDED, entries));
|
|
188
|
+
}, {
|
|
189
|
+
root: scroller,
|
|
190
|
+
rootMargin: NEAR_MARGIN
|
|
191
|
+
});
|
|
192
|
+
const sizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver((entries)=>{
|
|
193
|
+
for (const { target } of entries)remember(target);
|
|
194
|
+
});
|
|
195
|
+
observersRef.current = {
|
|
196
|
+
near: nearObserver,
|
|
197
|
+
size: sizeObserver
|
|
198
|
+
};
|
|
199
|
+
for (const card of cardsRef.current.values()){
|
|
200
|
+
nearObserver.observe(card);
|
|
201
|
+
sizeObserver?.observe(card);
|
|
202
|
+
}
|
|
203
|
+
return ()=>{
|
|
204
|
+
nearObserver.disconnect();
|
|
205
|
+
sizeObserver?.disconnect();
|
|
206
|
+
observersRef.current = null;
|
|
207
|
+
};
|
|
208
|
+
}, [
|
|
209
|
+
scroller
|
|
210
|
+
]);
|
|
211
|
+
const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
|
|
212
|
+
const bodyOf = (decisionId, scrollContainer)=>{
|
|
213
|
+
const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
|
|
214
|
+
if (mounted) return renderBody(decisionId, {
|
|
215
|
+
container: scrollContainer
|
|
216
|
+
}, bodyContext);
|
|
217
|
+
const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
|
|
218
|
+
return /*#__PURE__*/ jsx("div", {
|
|
219
|
+
"aria-hidden": true,
|
|
220
|
+
"data-graph-placeholder": true,
|
|
221
|
+
style: {
|
|
222
|
+
height
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
const onFocus = (event)=>{
|
|
227
|
+
const card = event.target instanceof Element ? event.target.closest('[data-graph-card]') : null;
|
|
228
|
+
const decisionId = card instanceof HTMLElement ? card.dataset.decisionId : void 0;
|
|
229
|
+
if (void 0 !== decisionId) setFocused(decisionId);
|
|
230
|
+
};
|
|
231
|
+
useLayoutEffect(()=>{
|
|
232
|
+
if (!pending) return;
|
|
233
|
+
const apply = ()=>{
|
|
234
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
235
|
+
if (!scroller || !card) return false;
|
|
236
|
+
if ('decision' === pending.kind) {
|
|
237
|
+
const heading = card.querySelector('[data-graph-toggle]');
|
|
238
|
+
if ('navigate' === pending.mode.kind) revealIn(scroller, {
|
|
239
|
+
vertical: card,
|
|
240
|
+
horizontal: heading ?? card,
|
|
241
|
+
block: 'start'
|
|
242
|
+
});
|
|
243
|
+
if (focuses(pending.mode)) heading?.focus({
|
|
244
|
+
preventScroll: true
|
|
245
|
+
});
|
|
246
|
+
if (flashes(pending.mode)) flash(card);
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
const rule = card.querySelector(`li[data-row-id="${CSS.escape(pending.rowId)}"]`);
|
|
250
|
+
if (!rule) return false;
|
|
251
|
+
if ('navigate' === pending.mode.kind) revealIn(scroller, {
|
|
252
|
+
vertical: rule,
|
|
253
|
+
horizontal: rule,
|
|
254
|
+
block: 'center'
|
|
255
|
+
});
|
|
256
|
+
if (focuses(pending.mode)) {
|
|
257
|
+
if (!rule.hasAttribute('tabindex')) rule.tabIndex = -1;
|
|
258
|
+
rule.focus({
|
|
259
|
+
preventScroll: true
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (flashes(pending.mode)) flash(rule);
|
|
263
|
+
return true;
|
|
264
|
+
};
|
|
265
|
+
if (apply()) return void setPending(null);
|
|
266
|
+
const frame = requestAnimationFrame(()=>{
|
|
267
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
268
|
+
if (!apply() && flashes(pending.mode) && card) flash(card);
|
|
269
|
+
setPending(null);
|
|
270
|
+
});
|
|
271
|
+
return ()=>cancelAnimationFrame(frame);
|
|
9
272
|
});
|
|
273
|
+
const branch = (node, depth, position)=>{
|
|
274
|
+
if ('reference' === node.kind) return /*#__PURE__*/ jsx(DecisionGraphReference, {
|
|
275
|
+
node: node,
|
|
276
|
+
labels: labels,
|
|
277
|
+
actions: actions.referenceOf(node, position),
|
|
278
|
+
onReveal: ()=>reveal({
|
|
279
|
+
kind: 'decision',
|
|
280
|
+
decisionId: node.targetId,
|
|
281
|
+
mode: {
|
|
282
|
+
kind: 'navigate',
|
|
283
|
+
focus: false,
|
|
284
|
+
flash: false
|
|
285
|
+
}
|
|
286
|
+
}),
|
|
287
|
+
onOpen: openOf(node.targetId),
|
|
288
|
+
dataTestId: dataTestId
|
|
289
|
+
});
|
|
290
|
+
const open = expanded.has(node.id);
|
|
291
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
292
|
+
children: [
|
|
293
|
+
/*#__PURE__*/ jsx(DecisionGraphCard, {
|
|
294
|
+
node: node,
|
|
295
|
+
depth: depth,
|
|
296
|
+
open: open,
|
|
297
|
+
active: selected === node.id,
|
|
298
|
+
usedBy: (users.get(node.id) ?? []).map((user)=>user.label),
|
|
299
|
+
bodyId: `${idPrefix}-${encodeURIComponent(node.id)}`,
|
|
300
|
+
body: open && scroller ? bodyOf(node.id, scroller) : null,
|
|
301
|
+
labels: labels,
|
|
302
|
+
onToggle: ()=>toggle(node.id),
|
|
303
|
+
onShowProblem: (byKey)=>reveal({
|
|
304
|
+
...markTargetOf(node),
|
|
305
|
+
mode: byKey ? {
|
|
306
|
+
kind: 'navigate',
|
|
307
|
+
focus: true,
|
|
308
|
+
flash: true
|
|
309
|
+
} : {
|
|
310
|
+
kind: 'inPlace'
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
onOpen: openOf(node.id),
|
|
314
|
+
actions: actions.cardOf(node, position),
|
|
315
|
+
cardRef: cardRef(node.id),
|
|
316
|
+
dataTestId: dataTestId
|
|
317
|
+
}),
|
|
318
|
+
node.children.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
319
|
+
className: GRAPH_NEST_CLASS,
|
|
320
|
+
"data-graph-nest-of": node.id,
|
|
321
|
+
children: childPositionsOf(node, position).map((childPosition)=>{
|
|
322
|
+
const child = node.children[childPosition.index];
|
|
323
|
+
return child && /*#__PURE__*/ jsx("div", {
|
|
324
|
+
className: GRAPH_BRANCH_CLASS,
|
|
325
|
+
children: branch(child, depth + 1, childPosition)
|
|
326
|
+
}, child.id);
|
|
327
|
+
})
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
333
|
+
className: cn(GRAPH_FRAME_CLASS, GRAPH_OUTPUT_HUE_CLASS),
|
|
334
|
+
"data-testid": dataTestId,
|
|
335
|
+
...actions.focusWithin,
|
|
336
|
+
children: [
|
|
337
|
+
nodes.length > 0 && /*#__PURE__*/ jsx(DecisionGraphMinimapSlot, {
|
|
338
|
+
nodes: nodes,
|
|
339
|
+
rules: rules,
|
|
340
|
+
selected: selected,
|
|
341
|
+
onPick: (target)=>reveal({
|
|
342
|
+
...target,
|
|
343
|
+
mode: {
|
|
344
|
+
kind: 'navigate',
|
|
345
|
+
focus: true,
|
|
346
|
+
flash: true
|
|
347
|
+
}
|
|
348
|
+
}),
|
|
349
|
+
onLauncherEnd: setLauncherEnd,
|
|
350
|
+
labels: labels,
|
|
351
|
+
dataTestId: `${dataTestId}-minimap`
|
|
352
|
+
}),
|
|
353
|
+
/*#__PURE__*/ jsxs("section", {
|
|
354
|
+
ref: setScroller,
|
|
355
|
+
"aria-label": labels.graph,
|
|
356
|
+
className: GRAPH_SCROLLER_CLASS,
|
|
357
|
+
style: {
|
|
358
|
+
scrollPaddingInlineStart: launcherEnd + GRAPH_MINIMAP_GAP_PX
|
|
359
|
+
},
|
|
360
|
+
"data-testid": `${dataTestId}-scroller`,
|
|
361
|
+
children: [
|
|
362
|
+
0 === nodes.length && /*#__PURE__*/ jsx("p", {
|
|
363
|
+
className: GRAPH_EMPTY_CLASS,
|
|
364
|
+
"data-testid": `${dataTestId}-empty`,
|
|
365
|
+
children: labels.empty
|
|
366
|
+
}),
|
|
367
|
+
(nodes.length > 0 || actions.addTop) && /*#__PURE__*/ jsxs("div", {
|
|
368
|
+
className: GRAPH_COLUMN_CLASS,
|
|
369
|
+
style: {
|
|
370
|
+
paddingLeft: graphColumnInsetOf(launcherEnd)
|
|
371
|
+
},
|
|
372
|
+
onFocus: onFocus,
|
|
373
|
+
children: [
|
|
374
|
+
topPositionsOf(nodes).map((position)=>{
|
|
375
|
+
const node = nodes[position.index];
|
|
376
|
+
return node && /*#__PURE__*/ jsx("div", {
|
|
377
|
+
children: branch(node, 0, position)
|
|
378
|
+
}, node.id);
|
|
379
|
+
}),
|
|
380
|
+
actions.addTop && /*#__PURE__*/ jsxs("button", {
|
|
381
|
+
type: "button",
|
|
382
|
+
className: GRAPH_ADD_DECISION_CLASS,
|
|
383
|
+
onClick: actions.addTop,
|
|
384
|
+
"data-graph-add": true,
|
|
385
|
+
"data-testid": `${dataTestId}-add-decision`,
|
|
386
|
+
children: [
|
|
387
|
+
/*#__PURE__*/ jsx(Plus, {
|
|
388
|
+
"aria-hidden": true
|
|
389
|
+
}),
|
|
390
|
+
labels.addDecision
|
|
391
|
+
]
|
|
392
|
+
})
|
|
393
|
+
]
|
|
394
|
+
})
|
|
395
|
+
]
|
|
396
|
+
}),
|
|
397
|
+
actions.dialogs,
|
|
398
|
+
region
|
|
399
|
+
]
|
|
400
|
+
});
|
|
401
|
+
};
|
|
10
402
|
export { DecisionGraphText };
|
|
@@ -133,7 +133,16 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
133
133
|
bands
|
|
134
134
|
});
|
|
135
135
|
const listed = diffRows?.rules ?? shown.rules;
|
|
136
|
-
const
|
|
136
|
+
const [focusedRowId, setFocusedRowId] = (0, external_react_namespaceObject.useState)(void 0);
|
|
137
|
+
const retainedRowId = edit?.editing?.rowId ?? selected?.rowId;
|
|
138
|
+
const retainedRowIds = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
139
|
+
retainedRowId,
|
|
140
|
+
focusedRowId
|
|
141
|
+
], [
|
|
142
|
+
retainedRowId,
|
|
143
|
+
focusedRowId
|
|
144
|
+
]);
|
|
145
|
+
const ruleWindow = (0, external_useRuleWindow_cjs_namespaceObject.useRuleWindow)(listed, selected?.rowId, retainedRowIds, scroll);
|
|
137
146
|
const selectable = void 0 !== onSelect;
|
|
138
147
|
const addRuleAction = (0, external_useAddRule_cjs_namespaceObject.useAddRule)({
|
|
139
148
|
...ruleWindow,
|
|
@@ -171,7 +180,12 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
171
180
|
ruleMenus,
|
|
172
181
|
onOpenDecision,
|
|
173
182
|
container: ruleWindow.container,
|
|
174
|
-
stopTabbable: selectable && null !== ruleWindow.selectedRow
|
|
183
|
+
stopTabbable: selectable && null !== ruleWindow.selectedRow,
|
|
184
|
+
focusRow: setFocusedRowId,
|
|
185
|
+
history: 'edit' === mode.kind ? {
|
|
186
|
+
onUndo: mode.onUndo,
|
|
187
|
+
onRedo: mode.onRedo
|
|
188
|
+
} : null
|
|
175
189
|
});
|
|
176
190
|
const columnEditing = (0, external_useColumnEditing_cjs_namespaceObject.useColumnEditing)({
|
|
177
191
|
column: 'edit' === mode.kind ? mode.edit.column : void 0,
|
|
@@ -7,7 +7,7 @@ import { type HitPolicyCatalog, type HitPolicyPick } from './hitPolicyMenu';
|
|
|
7
7
|
import { type TableMarks } from './marks';
|
|
8
8
|
import type { DecisionTextTable, SentenceSelection } from './sentenceTypes';
|
|
9
9
|
import { useCellHover } from './useCellHover';
|
|
10
|
-
import { type ContainerHandlersParams, type DecisionTextContainerProps } from './useContainerHandlers';
|
|
10
|
+
import { type ContainerHandlersParams, type TextHistory, type DecisionTextContainerProps } from './useContainerHandlers';
|
|
11
11
|
import { type DecisionTextScroll } from './useRuleWindow';
|
|
12
12
|
import { type SentenceNavigationSource } from './useSentenceNavigation';
|
|
13
13
|
type SelectHandler = NonNullable<SentenceNavigationSource['onSelect']>;
|
|
@@ -18,14 +18,14 @@ export type DecisionTextMode<Op, Policy, Total, Type, Refusal> = {
|
|
|
18
18
|
kind: 'select';
|
|
19
19
|
selected: SentenceSelection | null;
|
|
20
20
|
onSelect: SelectHandler;
|
|
21
|
-
} | {
|
|
21
|
+
} | (TextHistory & {
|
|
22
22
|
kind: 'edit';
|
|
23
23
|
selected: SentenceSelection | null;
|
|
24
24
|
onSelect: SelectHandler;
|
|
25
25
|
edit: DecisionTextEdit<Op, Type, Refusal>;
|
|
26
26
|
onPolicyChange: (picked: HitPolicyPick<Policy, Total>) => void;
|
|
27
27
|
onAddRule: () => void;
|
|
28
|
-
} | {
|
|
28
|
+
}) | {
|
|
29
29
|
kind: 'diff';
|
|
30
30
|
diff: DecisionTextDiff<Policy, Total, Type>;
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAMvD,OAAO,KAAK,EACV,iBAAiB,EAGjB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAEhC,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,yBAAyB,CAAC;AAM/F,KAAK,aAAa,GAAG,WAAW,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC;AAGvE,MAAM,MAAM,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,IACzD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE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IAE5B,SAAS,EAAE,MAAM,CAAC;IAElB,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAE5C,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAmBD,eAAO,MAAM,YAAY,GAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,+JAe5D,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,KAAG,KAAK,CAAC,GAAG,CAAC,OAuNlE,CAAC"}
|
|
@@ -105,7 +105,16 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
105
105
|
bands
|
|
106
106
|
});
|
|
107
107
|
const listed = diffRows?.rules ?? shown.rules;
|
|
108
|
-
const
|
|
108
|
+
const [focusedRowId, setFocusedRowId] = useState(void 0);
|
|
109
|
+
const retainedRowId = edit?.editing?.rowId ?? selected?.rowId;
|
|
110
|
+
const retainedRowIds = useMemo(()=>[
|
|
111
|
+
retainedRowId,
|
|
112
|
+
focusedRowId
|
|
113
|
+
], [
|
|
114
|
+
retainedRowId,
|
|
115
|
+
focusedRowId
|
|
116
|
+
]);
|
|
117
|
+
const ruleWindow = useRuleWindow(listed, selected?.rowId, retainedRowIds, scroll);
|
|
109
118
|
const selectable = void 0 !== onSelect;
|
|
110
119
|
const addRuleAction = useAddRule({
|
|
111
120
|
...ruleWindow,
|
|
@@ -143,7 +152,12 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
143
152
|
ruleMenus,
|
|
144
153
|
onOpenDecision,
|
|
145
154
|
container: ruleWindow.container,
|
|
146
|
-
stopTabbable: selectable && null !== ruleWindow.selectedRow
|
|
155
|
+
stopTabbable: selectable && null !== ruleWindow.selectedRow,
|
|
156
|
+
focusRow: setFocusedRowId,
|
|
157
|
+
history: 'edit' === mode.kind ? {
|
|
158
|
+
onUndo: mode.onUndo,
|
|
159
|
+
onRedo: mode.onRedo
|
|
160
|
+
} : null
|
|
147
161
|
});
|
|
148
162
|
const columnEditing = useColumnEditing({
|
|
149
163
|
column: 'edit' === mode.kind ? mode.edit.column : void 0,
|
|
@@ -10,11 +10,11 @@ type EditMode = Extract<FixtureMode, {
|
|
|
10
10
|
kind: 'edit';
|
|
11
11
|
}>;
|
|
12
12
|
export declare const outcomeField: () => ReturnType<FixtureEdit["valueField"]>;
|
|
13
|
-
export type ModeProps = Partial<Pick<EditMode, 'selected' | 'onSelect' | 'edit' | 'onAddRule' | 'onPolicyChange'> & Pick<Extract<FixtureMode, {
|
|
13
|
+
export type ModeProps = Partial<Pick<EditMode, 'selected' | 'onSelect' | 'edit' | 'onAddRule' | 'onPolicyChange' | 'onUndo' | 'onRedo'> & Pick<Extract<FixtureMode, {
|
|
14
14
|
kind: 'diff';
|
|
15
15
|
}>, 'diff'>>;
|
|
16
16
|
export type FlatTextProps = Omit<FixtureTextProps, 'mode' | 'table' | 'hitPolicies' | 'columnTypes'> & ModeProps & DecisionTextTable<FixturePolicy, FixtureTotal, FixtureType> & Partial<Pick<FixtureTextProps, 'hitPolicies' | 'columnTypes'>>;
|
|
17
|
-
export declare const modeOf: ({ selected, onSelect, edit, onAddRule, onPolicyChange, diff, }: ModeProps) => FixtureMode;
|
|
18
|
-
export declare const textPropsOf: ({ selected, onSelect, edit, onAddRule, onPolicyChange, diff, hitPolicy, inputs, outputs, rules, hitPolicies, columnTypes, ...props }: FlatTextProps) => FixtureTextProps;
|
|
17
|
+
export declare const modeOf: ({ selected, onSelect, edit, onAddRule, onPolicyChange, onUndo, onRedo, diff, }: ModeProps) => FixtureMode;
|
|
18
|
+
export declare const textPropsOf: ({ selected, onSelect, edit, onAddRule, onPolicyChange, onUndo, onRedo, diff, hitPolicy, inputs, outputs, rules, hitPolicies, columnTypes, ...props }: FlatTextProps) => FixtureTextProps;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=textMode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textMode.d.ts","sourceRoot":"","sources":["../../../src/decision-table/__fixtures__/textMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAGjB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAC9C,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,CACf,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,gBAAgB,CACxC,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,CACf,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,KAAK,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAGvD,eAAO,MAAM,YAAY,QAAO,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAGlE,CAAC;AAGH,MAAM,MAAM,SAAS,GAAG,OAAO,CAC7B,IAAI,
|
|
1
|
+
{"version":3,"file":"textMode.d.ts","sourceRoot":"","sources":["../../../src/decision-table/__fixtures__/textMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,E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G,gBAMjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoryHistory.d.ts","sourceRoot":"","sources":["../../../src/decision-table/__fixtures__/useStoryHistory.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,SAAS,MAAM,CAAC;;gBAM9B,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC;;;CAuBrC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DecisionGraphTarget } from './decisionGraphTypes';
|
|
1
2
|
export type DecisionGraphPlace = {
|
|
2
3
|
kind: 'top';
|
|
3
4
|
index: number;
|
|
@@ -52,8 +53,15 @@ export interface DecisionGraphEdit<Refusal, Logic> {
|
|
|
52
53
|
}
|
|
53
54
|
export type DecisionGraphMode<Refusal, Logic> = {
|
|
54
55
|
kind: 'read';
|
|
56
|
+
selected: string | null;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'select';
|
|
59
|
+
selected: string | null;
|
|
60
|
+
onReveal: (target: DecisionGraphTarget) => void;
|
|
55
61
|
} | {
|
|
56
62
|
kind: 'edit';
|
|
63
|
+
selected: string | null;
|
|
64
|
+
onReveal: (target: DecisionGraphTarget) => void;
|
|
57
65
|
edit: DecisionGraphEdit<Refusal, Logic>;
|
|
58
66
|
};
|
|
59
67
|
export interface DecisionGraphActionLabels {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisionGraphActionTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/decisionGraphActionTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decisionGraphActionTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/decisionGraphActionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAA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B,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC"}
|
|
@@ -41,4 +41,7 @@ export interface DecisionGraphExpansion {
|
|
|
41
41
|
expanded: ReadonlySet<string>;
|
|
42
42
|
onChange: (expanded: ReadonlySet<string>) => void;
|
|
43
43
|
}
|
|
44
|
+
export interface DecisionGraphBodyContext {
|
|
45
|
+
revealDecision: (decisionId: string, byKey: boolean) => void;
|
|
46
|
+
}
|
|
44
47
|
//# sourceMappingURL=decisionGraphTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisionGraphTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/decisionGraphTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAGtB,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAGhD,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,UAAU,CAAC;IAEjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,EAAE,kBAAkB,CAAC;IAE1B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACxC;AAGD,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,CAAC;IAElB,EAAE,EAAE,MAAM,CAAC;IACX,KAA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