@uipath/apollo-react 7.30.1 → 7.31.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/components/AgentCanvas/nodes/AgentNode.cjs +11 -9
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.js +11 -9
- package/dist/canvas/icons/AutonomousAgentIcon.cjs +7 -1
- package/dist/canvas/icons/AutonomousAgentIcon.d.ts +2 -1
- package/dist/canvas/icons/AutonomousAgentIcon.d.ts.map +1 -1
- package/dist/canvas/icons/AutonomousAgentIcon.js +7 -1
- package/dist/canvas/icons/ConversationalAgentIcon.cjs +7 -1
- package/dist/canvas/icons/ConversationalAgentIcon.d.ts +2 -1
- package/dist/canvas/icons/ConversationalAgentIcon.d.ts.map +1 -1
- package/dist/canvas/icons/ConversationalAgentIcon.js +7 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionGraphCard.cjs +112 -9
- package/dist/decision-table/DecisionGraphCard.d.ts +21 -0
- package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphCard.js +115 -12
- package/dist/decision-table/DecisionGraphDialogs.cjs +223 -0
- package/dist/decision-table/DecisionGraphDialogs.d.ts +30 -0
- package/dist/decision-table/DecisionGraphDialogs.d.ts.map +1 -0
- package/dist/decision-table/DecisionGraphDialogs.js +183 -0
- package/dist/decision-table/DecisionGraphText.cjs +6 -338
- package/dist/decision-table/DecisionGraphText.d.ts +4 -15
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +7 -339
- package/dist/decision-table/DecisionGraphView.cjs +409 -0
- package/dist/decision-table/DecisionGraphView.d.ts +20 -0
- package/dist/decision-table/DecisionGraphView.d.ts.map +1 -0
- package/dist/decision-table/DecisionGraphView.js +375 -0
- package/dist/decision-table/DecisionTable.cjs +3 -1
- package/dist/decision-table/DecisionTable.d.ts.map +1 -1
- package/dist/decision-table/DecisionTable.js +3 -1
- package/dist/decision-table/EditableDecisionGraphText.cjs +40 -0
- package/dist/decision-table/EditableDecisionGraphText.d.ts +5 -0
- package/dist/decision-table/EditableDecisionGraphText.d.ts.map +1 -0
- package/dist/decision-table/EditableDecisionGraphText.js +6 -0
- package/dist/decision-table/GridMenu.cjs +36 -2
- package/dist/decision-table/GridMenu.d.ts +8 -0
- package/dist/decision-table/GridMenu.d.ts.map +1 -1
- package/dist/decision-table/GridMenu.js +33 -2
- package/dist/decision-table/__fixtures__/graphActionsHost.d.ts +21 -0
- package/dist/decision-table/__fixtures__/graphActionsHost.d.ts.map +1 -0
- package/dist/decision-table/constants.cjs +7 -0
- package/dist/decision-table/constants.d.ts +1 -0
- package/dist/decision-table/constants.d.ts.map +1 -1
- package/dist/decision-table/constants.js +5 -1
- package/dist/decision-table/decisionGraphActionTypes.cjs +18 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts +88 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -0
- package/dist/decision-table/decisionGraphActionTypes.js +0 -0
- package/dist/decision-table/decisionGraphMenuEntries.cjs +247 -0
- package/dist/decision-table/decisionGraphMenuEntries.d.ts +46 -0
- package/dist/decision-table/decisionGraphMenuEntries.d.ts.map +1 -0
- package/dist/decision-table/decisionGraphMenuEntries.js +186 -0
- package/dist/decision-table/decisionGraphPositions.cjs +136 -0
- package/dist/decision-table/decisionGraphPositions.d.ts +26 -0
- package/dist/decision-table/decisionGraphPositions.d.ts.map +1 -0
- package/dist/decision-table/decisionGraphPositions.js +69 -0
- package/dist/decision-table/decisionGraphStyles.cjs +24 -16
- package/dist/decision-table/decisionGraphStyles.d.ts +3 -1
- package/dist/decision-table/decisionGraphStyles.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphStyles.js +4 -2
- package/dist/decision-table/index.cjs +62 -54
- package/dist/decision-table/index.d.ts +2 -0
- 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/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useDecisionGraphActions.cjs +385 -0
- package/dist/decision-table/useDecisionGraphActions.d.ts +24 -0
- package/dist/decision-table/useDecisionGraphActions.d.ts.map +1 -0
- package/dist/decision-table/useDecisionGraphActions.js +351 -0
- package/dist/decision-table/useDecisionGraphStrings.cjs +138 -0
- 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 +138 -0
- package/dist/decision-table/useDragReorder.cjs +3 -2
- package/dist/decision-table/useDragReorder.d.ts.map +1 -1
- package/dist/decision-table/useDragReorder.js +3 -2
- package/dist/decision-table/useRuleWindow.cjs +3 -7
- package/dist/decision-table/useRuleWindow.d.ts.map +1 -1
- package/dist/decision-table/useRuleWindow.js +1 -5
- package/package.json +3 -3
|
@@ -0,0 +1,375 @@
|
|
|
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, topPositionsOf, usersOf } from "./decisionGraphPositions.js";
|
|
8
|
+
import { GRAPH_ADD_DECISION_CLASS, GRAPH_BRANCH_CLASS, GRAPH_COLUMN_CLASS, GRAPH_EMPTY_CLASS, GRAPH_FRAME_CLASS, GRAPH_NEST_CLASS, GRAPH_OUTPUT_HUE_CLASS, GRAPH_SCROLLER_CLASS, graphColumnInsetOf } from "./decisionGraphStyles.js";
|
|
9
|
+
import { SENTENCE_MIN_RULE_HEIGHT_PX } from "./sentenceRuleHeights.js";
|
|
10
|
+
import { useDecisionGraphActions } from "./useDecisionGraphActions.js";
|
|
11
|
+
import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
|
|
12
|
+
import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
13
|
+
import { contentTopIn } from "./useRuleWindow.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 scrollTo = (scroller, top)=>scroller.scrollTo?.({
|
|
42
|
+
top
|
|
43
|
+
});
|
|
44
|
+
const NEAR_MARGIN = '100% 0px';
|
|
45
|
+
const nearAfter = (current, entries)=>{
|
|
46
|
+
let next;
|
|
47
|
+
for (const { target, isIntersecting } of entries){
|
|
48
|
+
const decisionId = target instanceof HTMLElement ? target.dataset.decisionId : void 0;
|
|
49
|
+
if (void 0 !== decisionId && (next ?? current).has(decisionId) !== isIntersecting) {
|
|
50
|
+
next ??= new Set(current);
|
|
51
|
+
if (isIntersecting) next.add(decisionId);
|
|
52
|
+
else next.delete(decisionId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return next ?? current;
|
|
56
|
+
};
|
|
57
|
+
const bodyHeightOf = (card)=>{
|
|
58
|
+
const body = card.querySelector(':scope > [data-graph-body]');
|
|
59
|
+
if (!body || body.querySelector(':scope > [data-graph-placeholder]')) return null;
|
|
60
|
+
return body.offsetHeight || null;
|
|
61
|
+
};
|
|
62
|
+
const ruleCountsOf = (nodes)=>{
|
|
63
|
+
const counts = new Map();
|
|
64
|
+
const visit = (node)=>{
|
|
65
|
+
if ('decision' !== node.kind) return;
|
|
66
|
+
if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
|
|
67
|
+
for (const child of node.children)visit(child);
|
|
68
|
+
};
|
|
69
|
+
for (const node of nodes)visit(node);
|
|
70
|
+
return counts;
|
|
71
|
+
};
|
|
72
|
+
const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
73
|
+
let height = 0;
|
|
74
|
+
let rules = 0;
|
|
75
|
+
for (const [decisionId, measured] of heights){
|
|
76
|
+
const count = ruleCounts.get(decisionId) ?? 0;
|
|
77
|
+
if (0 !== count) {
|
|
78
|
+
height += measured;
|
|
79
|
+
rules += count;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
83
|
+
};
|
|
84
|
+
const DecisionGraphView = ({ nodes, mode, renderBody, expansion, onFold, selected = null, onReveal, onOpenDecision, rules, dataTestId })=>{
|
|
85
|
+
const labels = useDecisionGraphLabels();
|
|
86
|
+
const { announce, region } = useTextAnnouncements(useDecisionTextLabels(), dataTestId);
|
|
87
|
+
const idPrefix = useId();
|
|
88
|
+
const [ownExpanded, setOwnExpanded] = useState(NO_EXPANDED);
|
|
89
|
+
const expanded = expansion?.expanded ?? ownExpanded;
|
|
90
|
+
const users = useMemo(()=>usersOf(nodes), [
|
|
91
|
+
nodes
|
|
92
|
+
]);
|
|
93
|
+
const [scroller, setScroller] = useState(null);
|
|
94
|
+
const [launcherEnd, setLauncherEnd] = useState(0);
|
|
95
|
+
const cardsRef = useRef(new Map());
|
|
96
|
+
const [pending, setPending] = useState(null);
|
|
97
|
+
const [near, setNear] = useState(()=>"u" < typeof IntersectionObserver ? null : NO_EXPANDED);
|
|
98
|
+
const [revealed, setRevealed] = useState(null);
|
|
99
|
+
const [focused, setFocused] = useState(null);
|
|
100
|
+
const heightsRef = useRef(new Map());
|
|
101
|
+
const observersRef = useRef(null);
|
|
102
|
+
const ruleCounts = useMemo(()=>ruleCountsOf(nodes), [
|
|
103
|
+
nodes
|
|
104
|
+
]);
|
|
105
|
+
const setExpanded = (next)=>{
|
|
106
|
+
if (expansion) expansion.onChange(next);
|
|
107
|
+
else setOwnExpanded(next);
|
|
108
|
+
};
|
|
109
|
+
const toggle = (decisionId)=>{
|
|
110
|
+
const next = new Set(expanded);
|
|
111
|
+
const folds = next.delete(decisionId);
|
|
112
|
+
if (!folds) next.add(decisionId);
|
|
113
|
+
setExpanded(next);
|
|
114
|
+
if (folds) onFold?.(decisionId);
|
|
115
|
+
};
|
|
116
|
+
const reveal = (target)=>{
|
|
117
|
+
if (!expanded.has(target.decisionId)) setExpanded(new Set([
|
|
118
|
+
...expanded,
|
|
119
|
+
target.decisionId
|
|
120
|
+
]));
|
|
121
|
+
setPending(target);
|
|
122
|
+
setRevealed(target.decisionId);
|
|
123
|
+
if ('navigate' === target.mode.kind) onReveal?.('rule' === target.kind ? {
|
|
124
|
+
kind: 'rule',
|
|
125
|
+
decisionId: target.decisionId,
|
|
126
|
+
rowId: target.rowId
|
|
127
|
+
} : {
|
|
128
|
+
kind: 'decision',
|
|
129
|
+
decisionId: target.decisionId
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
|
|
133
|
+
const actions = useDecisionGraphActions({
|
|
134
|
+
mode,
|
|
135
|
+
nodes,
|
|
136
|
+
labels,
|
|
137
|
+
openOf,
|
|
138
|
+
cardOf: (decisionId)=>cardsRef.current.get(decisionId),
|
|
139
|
+
scroller,
|
|
140
|
+
announce,
|
|
141
|
+
dataTestId
|
|
142
|
+
});
|
|
143
|
+
const cardRefsRef = useRef(new Map());
|
|
144
|
+
const cardRef = useCallback((decisionId)=>{
|
|
145
|
+
const cached = cardRefsRef.current.get(decisionId);
|
|
146
|
+
if (cached) return cached;
|
|
147
|
+
const attach = (element)=>{
|
|
148
|
+
const observers = observersRef.current;
|
|
149
|
+
const previous = cardsRef.current.get(decisionId);
|
|
150
|
+
if (previous && previous !== element) {
|
|
151
|
+
observers?.near.unobserve(previous);
|
|
152
|
+
observers?.size?.unobserve(previous);
|
|
153
|
+
}
|
|
154
|
+
if (!element) return void cardsRef.current.delete(decisionId);
|
|
155
|
+
cardsRef.current.set(decisionId, element);
|
|
156
|
+
observers?.near.observe(element);
|
|
157
|
+
observers?.size?.observe(element);
|
|
158
|
+
};
|
|
159
|
+
cardRefsRef.current.set(decisionId, attach);
|
|
160
|
+
return attach;
|
|
161
|
+
}, []);
|
|
162
|
+
useLayoutEffect(()=>{
|
|
163
|
+
if (!scroller || "u" < typeof IntersectionObserver) return;
|
|
164
|
+
const remember = (card)=>{
|
|
165
|
+
if (!(card instanceof HTMLElement)) return;
|
|
166
|
+
const decisionId = card.dataset.decisionId;
|
|
167
|
+
const height = bodyHeightOf(card);
|
|
168
|
+
if (void 0 !== decisionId && null !== height) heightsRef.current.set(decisionId, height);
|
|
169
|
+
};
|
|
170
|
+
const nearObserver = new IntersectionObserver((entries)=>{
|
|
171
|
+
for (const { target } of entries)remember(target);
|
|
172
|
+
setNear((current)=>nearAfter(current ?? NO_EXPANDED, entries));
|
|
173
|
+
}, {
|
|
174
|
+
root: scroller,
|
|
175
|
+
rootMargin: NEAR_MARGIN
|
|
176
|
+
});
|
|
177
|
+
const sizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver((entries)=>{
|
|
178
|
+
for (const { target } of entries)remember(target);
|
|
179
|
+
});
|
|
180
|
+
observersRef.current = {
|
|
181
|
+
near: nearObserver,
|
|
182
|
+
size: sizeObserver
|
|
183
|
+
};
|
|
184
|
+
for (const card of cardsRef.current.values()){
|
|
185
|
+
nearObserver.observe(card);
|
|
186
|
+
sizeObserver?.observe(card);
|
|
187
|
+
}
|
|
188
|
+
return ()=>{
|
|
189
|
+
nearObserver.disconnect();
|
|
190
|
+
sizeObserver?.disconnect();
|
|
191
|
+
observersRef.current = null;
|
|
192
|
+
};
|
|
193
|
+
}, [
|
|
194
|
+
scroller
|
|
195
|
+
]);
|
|
196
|
+
const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
|
|
197
|
+
const bodyOf = (decisionId, scrollContainer)=>{
|
|
198
|
+
const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
|
|
199
|
+
if (mounted) return renderBody(decisionId, {
|
|
200
|
+
container: scrollContainer
|
|
201
|
+
});
|
|
202
|
+
const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
|
|
203
|
+
return /*#__PURE__*/ jsx("div", {
|
|
204
|
+
"aria-hidden": true,
|
|
205
|
+
"data-graph-placeholder": true,
|
|
206
|
+
style: {
|
|
207
|
+
height
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
const onFocus = (event)=>{
|
|
212
|
+
const card = event.target instanceof Element ? event.target.closest('[data-decision-id]') : null;
|
|
213
|
+
const decisionId = card instanceof HTMLElement ? card.dataset.decisionId : void 0;
|
|
214
|
+
if (void 0 !== decisionId) setFocused(decisionId);
|
|
215
|
+
};
|
|
216
|
+
useLayoutEffect(()=>{
|
|
217
|
+
if (!pending) return;
|
|
218
|
+
const apply = ()=>{
|
|
219
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
220
|
+
if (!scroller || !card) return false;
|
|
221
|
+
if ('decision' === pending.kind) {
|
|
222
|
+
if ('navigate' === pending.mode.kind) scrollTo(scroller, contentTopIn(card, scroller));
|
|
223
|
+
if (focuses(pending.mode)) card.querySelector('[data-graph-toggle]')?.focus({
|
|
224
|
+
preventScroll: true
|
|
225
|
+
});
|
|
226
|
+
if (flashes(pending.mode)) flash(card);
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
const rule = card.querySelector(`li[data-row-id="${CSS.escape(pending.rowId)}"]`);
|
|
230
|
+
if (!rule) return false;
|
|
231
|
+
if ('navigate' === pending.mode.kind) scrollTo(scroller, contentTopIn(rule, scroller) - (scroller.clientHeight - rule.offsetHeight) / 2);
|
|
232
|
+
if (focuses(pending.mode)) {
|
|
233
|
+
if (!rule.hasAttribute('tabindex')) rule.tabIndex = -1;
|
|
234
|
+
rule.focus({
|
|
235
|
+
preventScroll: true
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (flashes(pending.mode)) flash(rule);
|
|
239
|
+
return true;
|
|
240
|
+
};
|
|
241
|
+
if (apply()) return void setPending(null);
|
|
242
|
+
const frame = requestAnimationFrame(()=>{
|
|
243
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
244
|
+
if (!apply() && flashes(pending.mode) && card) flash(card);
|
|
245
|
+
setPending(null);
|
|
246
|
+
});
|
|
247
|
+
return ()=>cancelAnimationFrame(frame);
|
|
248
|
+
});
|
|
249
|
+
const branch = (node, depth, position)=>{
|
|
250
|
+
if ('reference' === node.kind) return /*#__PURE__*/ jsx(DecisionGraphReference, {
|
|
251
|
+
node: node,
|
|
252
|
+
labels: labels,
|
|
253
|
+
actions: actions.referenceOf(node, position),
|
|
254
|
+
onReveal: ()=>reveal({
|
|
255
|
+
kind: 'decision',
|
|
256
|
+
decisionId: node.targetId,
|
|
257
|
+
mode: {
|
|
258
|
+
kind: 'navigate',
|
|
259
|
+
focus: false,
|
|
260
|
+
flash: false
|
|
261
|
+
}
|
|
262
|
+
}),
|
|
263
|
+
onOpen: openOf(node.targetId),
|
|
264
|
+
dataTestId: dataTestId
|
|
265
|
+
});
|
|
266
|
+
const open = expanded.has(node.id);
|
|
267
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
268
|
+
children: [
|
|
269
|
+
/*#__PURE__*/ jsx(DecisionGraphCard, {
|
|
270
|
+
node: node,
|
|
271
|
+
depth: depth,
|
|
272
|
+
open: open,
|
|
273
|
+
active: selected === node.id,
|
|
274
|
+
usedBy: (users.get(node.id) ?? []).map((user)=>user.label),
|
|
275
|
+
bodyId: `${idPrefix}-${encodeURIComponent(node.id)}`,
|
|
276
|
+
body: open && scroller ? bodyOf(node.id, scroller) : null,
|
|
277
|
+
labels: labels,
|
|
278
|
+
onToggle: ()=>toggle(node.id),
|
|
279
|
+
onShowProblem: (byKey)=>reveal({
|
|
280
|
+
...markTargetOf(node),
|
|
281
|
+
mode: byKey ? {
|
|
282
|
+
kind: 'navigate',
|
|
283
|
+
focus: true,
|
|
284
|
+
flash: true
|
|
285
|
+
} : {
|
|
286
|
+
kind: 'inPlace'
|
|
287
|
+
}
|
|
288
|
+
}),
|
|
289
|
+
onOpen: openOf(node.id),
|
|
290
|
+
actions: actions.cardOf(node, position),
|
|
291
|
+
cardRef: cardRef(node.id),
|
|
292
|
+
dataTestId: dataTestId
|
|
293
|
+
}),
|
|
294
|
+
node.children.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
295
|
+
className: GRAPH_NEST_CLASS,
|
|
296
|
+
"data-graph-nest-of": node.id,
|
|
297
|
+
children: childPositionsOf(node, position).map((childPosition)=>{
|
|
298
|
+
const child = node.children[childPosition.index];
|
|
299
|
+
return child && /*#__PURE__*/ jsx("div", {
|
|
300
|
+
className: GRAPH_BRANCH_CLASS,
|
|
301
|
+
children: branch(child, depth + 1, childPosition)
|
|
302
|
+
}, child.id);
|
|
303
|
+
})
|
|
304
|
+
})
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
309
|
+
className: cn(GRAPH_FRAME_CLASS, GRAPH_OUTPUT_HUE_CLASS),
|
|
310
|
+
"data-testid": dataTestId,
|
|
311
|
+
...actions.focusWithin,
|
|
312
|
+
children: [
|
|
313
|
+
nodes.length > 0 && /*#__PURE__*/ jsx(DecisionGraphMinimapSlot, {
|
|
314
|
+
nodes: nodes,
|
|
315
|
+
rules: rules,
|
|
316
|
+
selected: selected,
|
|
317
|
+
onPick: (target)=>reveal({
|
|
318
|
+
...target,
|
|
319
|
+
mode: {
|
|
320
|
+
kind: 'navigate',
|
|
321
|
+
focus: true,
|
|
322
|
+
flash: true
|
|
323
|
+
}
|
|
324
|
+
}),
|
|
325
|
+
onLauncherEnd: setLauncherEnd,
|
|
326
|
+
labels: labels,
|
|
327
|
+
dataTestId: `${dataTestId}-minimap`
|
|
328
|
+
}),
|
|
329
|
+
/*#__PURE__*/ jsxs("section", {
|
|
330
|
+
ref: setScroller,
|
|
331
|
+
"aria-label": labels.graph,
|
|
332
|
+
className: GRAPH_SCROLLER_CLASS,
|
|
333
|
+
"data-testid": `${dataTestId}-scroller`,
|
|
334
|
+
children: [
|
|
335
|
+
0 === nodes.length && /*#__PURE__*/ jsx("p", {
|
|
336
|
+
className: GRAPH_EMPTY_CLASS,
|
|
337
|
+
"data-testid": `${dataTestId}-empty`,
|
|
338
|
+
children: labels.empty
|
|
339
|
+
}),
|
|
340
|
+
(nodes.length > 0 || actions.addTop) && /*#__PURE__*/ jsxs("div", {
|
|
341
|
+
className: GRAPH_COLUMN_CLASS,
|
|
342
|
+
style: {
|
|
343
|
+
paddingLeft: graphColumnInsetOf(launcherEnd)
|
|
344
|
+
},
|
|
345
|
+
onFocus: onFocus,
|
|
346
|
+
children: [
|
|
347
|
+
topPositionsOf(nodes).map((position)=>{
|
|
348
|
+
const node = nodes[position.index];
|
|
349
|
+
return node && /*#__PURE__*/ jsx("div", {
|
|
350
|
+
children: branch(node, 0, position)
|
|
351
|
+
}, node.id);
|
|
352
|
+
}),
|
|
353
|
+
actions.addTop && /*#__PURE__*/ jsxs("button", {
|
|
354
|
+
type: "button",
|
|
355
|
+
className: GRAPH_ADD_DECISION_CLASS,
|
|
356
|
+
onClick: actions.addTop,
|
|
357
|
+
"data-graph-add": true,
|
|
358
|
+
"data-testid": `${dataTestId}-add-decision`,
|
|
359
|
+
children: [
|
|
360
|
+
/*#__PURE__*/ jsx(Plus, {
|
|
361
|
+
"aria-hidden": true
|
|
362
|
+
}),
|
|
363
|
+
labels.addDecision
|
|
364
|
+
]
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
}),
|
|
370
|
+
actions.dialogs,
|
|
371
|
+
region
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
export { DecisionGraphView };
|
|
@@ -43,6 +43,7 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
43
43
|
const external_react_namespaceObject = require("react");
|
|
44
44
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
45
45
|
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
46
|
+
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
46
47
|
const external_gridStyles_cjs_namespaceObject = require("./gridStyles.cjs");
|
|
47
48
|
const external_MarkGlyph_cjs_namespaceObject = require("./MarkGlyph.cjs");
|
|
48
49
|
const external_useDragReorder_cjs_namespaceObject = require("./useDragReorder.cjs");
|
|
@@ -396,7 +397,8 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
396
397
|
]);
|
|
397
398
|
const focusWithinRef = (0, external_react_namespaceObject.useRef)(false);
|
|
398
399
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
399
|
-
|
|
400
|
+
const container = containerRef.current;
|
|
401
|
+
if (focusWithinRef.current && null !== container && (0, external_gridEvents_cjs_namespaceObject.hasLostFocus)(container)) container.focus();
|
|
400
402
|
});
|
|
401
403
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
402
404
|
const container = containerRef.current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionTable.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DecisionTable.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAuBf,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,UAAU,EACV,iBAAiB,EAClB,MAAM,aAAa,CAAC;AA0BrB,MAAM,WAAW,iBAAiB;IAEhC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IAKjC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM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rowRight } from "lucide-react";
|
|
4
4
|
import react, { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
5
5
|
import { BODY_ROW_HEIGHT_PX, MIN_COLUMN_WIDTH } from "./constants.js";
|
|
6
|
+
import { hasLostFocus } from "./gridEvents.js";
|
|
6
7
|
import { DRAG_PREVIEW_CLASS, DRAG_SOURCE_CLASS, DROP_INDICATOR_Z_CLASS, FROZEN_RIGHT_GROUP_CELL_CLASS, GRID_FRAME_CLASS, GRID_PANE_CLASS, GROUP_CELL_CLASS, GROUP_GUTTER_CLASS, HEADER_CELL_CLASS, PINNED_HEADER_Z_CLASS, RESIZE_HANDLE_BELOW_INSERT_CLASS, RESIZE_HANDLE_CLASS, ROW_HOVER_OVERLAY_CLASS, SEPARATOR_GROUP_CELL_CLASS, SEPARATOR_HEADER_CELL_CLASS, TABLE_EDGE_CLASS, TABLE_HUG_EDGE_CLASS, TOP_LEFT_CORNER_CELL_CLASS } from "./gridStyles.js";
|
|
7
8
|
import { MarkGlyph } from "./MarkGlyph.js";
|
|
8
9
|
import { bandGeometry, buildColumnPreview, buildRowPreview, dragShiftPx, dropIndex, gapStartPx, useDragReorder } from "./useDragReorder.js";
|
|
@@ -356,7 +357,8 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
356
357
|
]);
|
|
357
358
|
const focusWithinRef = useRef(false);
|
|
358
359
|
useEffect(()=>{
|
|
359
|
-
|
|
360
|
+
const container = containerRef.current;
|
|
361
|
+
if (focusWithinRef.current && null !== container && hasLostFocus(container)) container.focus();
|
|
360
362
|
});
|
|
361
363
|
useEffect(()=>{
|
|
362
364
|
const container = containerRef.current;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EditableDecisionGraphText: ()=>EditableDecisionGraphText
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_DecisionGraphView_cjs_namespaceObject = require("./DecisionGraphView.cjs");
|
|
31
|
+
const EditableDecisionGraphText = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionGraphView_cjs_namespaceObject.DecisionGraphView, {
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
exports.EditableDecisionGraphText = __webpack_exports__.EditableDecisionGraphText;
|
|
35
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
36
|
+
"EditableDecisionGraphText"
|
|
37
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
|
+
Object.defineProperty(exports, '__esModule', {
|
|
39
|
+
value: true
|
|
40
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type DecisionGraphViewProps } from './DecisionGraphView';
|
|
3
|
+
export type EditableDecisionGraphTextProps<Refusal, Logic> = DecisionGraphViewProps<Refusal, Logic>;
|
|
4
|
+
export declare const EditableDecisionGraphText: <Refusal, Logic>(props: EditableDecisionGraphTextProps<Refusal, Logic>) => React.ReactElement;
|
|
5
|
+
//# sourceMappingURL=EditableDecisionGraphText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableDecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/EditableDecisionGraphText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAErF,MAAM,MAAM,8BAA8B,CAAC,OAAO,EAAE,KAAK,IAAI,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAGpG,eAAO,MAAM,yBAAyB,GAAI,OAAO,EAAE,KAAK,EACtD,OAAO,8BAA8B,CAAC,OAAO,EAAE,KAAK,CAAC,KACpD,KAAK,CAAC,YAAgD,CAAC"}
|
|
@@ -24,7 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
GridContextMenu: ()=>GridContextMenu
|
|
27
|
+
GridContextMenu: ()=>GridContextMenu,
|
|
28
|
+
GridMenuButton: ()=>GridMenuButton
|
|
28
29
|
});
|
|
29
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
31
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
@@ -126,9 +127,42 @@ const GridContextMenu = ({ label, dataTestId, state, entries, onClose, className
|
|
|
126
127
|
]
|
|
127
128
|
});
|
|
128
129
|
};
|
|
130
|
+
const GridMenuButton = ({ label, dataTestId, entries, className, children })=>{
|
|
131
|
+
const [open, setOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
132
|
+
const { items, onCloseAutoFocus } = useGridMenuItems(open ? entries() : [], open, dataTestId);
|
|
133
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DropdownMenu, {
|
|
134
|
+
open: open,
|
|
135
|
+
modal: false,
|
|
136
|
+
onOpenChange: setOpen,
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DropdownMenuTrigger, {
|
|
139
|
+
asChild: true,
|
|
140
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-label": label,
|
|
143
|
+
className: className,
|
|
144
|
+
"data-testid": dataTestId,
|
|
145
|
+
children: children
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DropdownMenuContent, {
|
|
149
|
+
align: "end",
|
|
150
|
+
side: "bottom",
|
|
151
|
+
"aria-label": label,
|
|
152
|
+
className: "min-w-52",
|
|
153
|
+
"data-testid": `${dataTestId}-menu`,
|
|
154
|
+
onCloseAutoFocus: onCloseAutoFocus,
|
|
155
|
+
onDoubleClick: (event)=>event.stopPropagation(),
|
|
156
|
+
children: items
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
};
|
|
129
161
|
exports.GridContextMenu = __webpack_exports__.GridContextMenu;
|
|
162
|
+
exports.GridMenuButton = __webpack_exports__.GridMenuButton;
|
|
130
163
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
131
|
-
"GridContextMenu"
|
|
164
|
+
"GridContextMenu",
|
|
165
|
+
"GridMenuButton"
|
|
132
166
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
133
167
|
Object.defineProperty(exports, '__esModule', {
|
|
134
168
|
value: true
|
|
@@ -28,4 +28,12 @@ export interface GridContextMenuProps {
|
|
|
28
28
|
className?: string;
|
|
29
29
|
}
|
|
30
30
|
export declare const GridContextMenu: React.FC<GridContextMenuProps>;
|
|
31
|
+
export interface GridMenuButtonProps {
|
|
32
|
+
label: string;
|
|
33
|
+
dataTestId: string;
|
|
34
|
+
entries: () => GridMenuEntry[];
|
|
35
|
+
className: string;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare const GridMenuButton: React.FC<GridMenuButtonProps>;
|
|
31
39
|
//# sourceMappingURL=GridMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridMenu.d.ts","sourceRoot":"","sources":["../../src/decision-table/GridMenu.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAMvB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAsF7D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,K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AE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4C1D,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,aAAa,EAAE,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAGD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA6BxD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, cn } from "@uipath/apollo-wind";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
const isDivider = (entry)=>true === entry.divider;
|
|
5
5
|
const DESTRUCTIVE_ITEM_CLASS = 'text-destructive focus:bg-destructive/10 focus:text-destructive';
|
|
6
6
|
const useGridMenuItems = (entries, open, dataTestId)=>{
|
|
@@ -98,4 +98,35 @@ const GridContextMenu = ({ label, dataTestId, state, entries, onClose, className
|
|
|
98
98
|
]
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
const GridMenuButton = ({ label, dataTestId, entries, className, children })=>{
|
|
102
|
+
const [open, setOpen] = useState(false);
|
|
103
|
+
const { items, onCloseAutoFocus } = useGridMenuItems(open ? entries() : [], open, dataTestId);
|
|
104
|
+
return /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
105
|
+
open: open,
|
|
106
|
+
modal: false,
|
|
107
|
+
onOpenChange: setOpen,
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
110
|
+
asChild: true,
|
|
111
|
+
children: /*#__PURE__*/ jsx("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
"aria-label": label,
|
|
114
|
+
className: className,
|
|
115
|
+
"data-testid": dataTestId,
|
|
116
|
+
children: children
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ jsx(DropdownMenuContent, {
|
|
120
|
+
align: "end",
|
|
121
|
+
side: "bottom",
|
|
122
|
+
"aria-label": label,
|
|
123
|
+
className: "min-w-52",
|
|
124
|
+
"data-testid": `${dataTestId}-menu`,
|
|
125
|
+
onCloseAutoFocus: onCloseAutoFocus,
|
|
126
|
+
onDoubleClick: (event)=>event.stopPropagation(),
|
|
127
|
+
children: items
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
export { GridContextMenu, GridMenuButton };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DecisionGraphAction, DecisionGraphMove } from '../decisionGraphActionTypes';
|
|
2
|
+
import type { DecisionGraphDecisionNode, DecisionGraphNode } from '../decisionGraphTypes';
|
|
3
|
+
export type FixtureLogic = 'table' | 'literal';
|
|
4
|
+
export type FixtureRefusal = 'duplicateName' | 'loop';
|
|
5
|
+
interface FixtureDecision {
|
|
6
|
+
node: Pick<DecisionGraphDecisionNode, 'label' | 'logic' | 'mark'>;
|
|
7
|
+
inputs: readonly string[];
|
|
8
|
+
notes: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface FixtureGraph {
|
|
11
|
+
decisions: ReadonlyMap<string, FixtureDecision>;
|
|
12
|
+
top: readonly string[];
|
|
13
|
+
added: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const graphOf: (nodes: readonly DecisionGraphNode[]) => FixtureGraph;
|
|
16
|
+
export declare const nodesOf: (graph: FixtureGraph) => DecisionGraphNode[];
|
|
17
|
+
export declare const moved: (graph: FixtureGraph, move: DecisionGraphMove) => FixtureGraph | FixtureRefusal;
|
|
18
|
+
export declare const fixtureActions: (graph: FixtureGraph, update: (next: FixtureGraph) => void) => DecisionGraphAction<FixtureRefusal, FixtureLogic>[];
|
|
19
|
+
export declare const wordFixtureRefusal: (refusal: FixtureRefusal) => string;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=graphActionsHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphActionsHost.d.ts","sourceRoot":"","sources":["../../../src/decision-table/__fixtures__/graphActionsHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;AAEtD,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,CAAC,yBAAyB,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IAClE,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAGD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAChD,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,iBAAiB,EAAE,KAAG,YAc7D,CAAC;AAGF,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,KAAG,iBAAiB,EAmB9D,CAAC;AAwDF,eAAO,MAAM,KAAK,GAChB,OAAO,YAAY,EACnB,MAAM,iBAAiB,KACtB,YAAY,GAAG,cAOjB,CAAC;AAGF,eAAO,MAAM,cAAc,GACzB,OAAO,YAAY,EACnB,QAAQ,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,KACnC,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,EA8HnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,cAAc,KAAG,MAGhB,CAAC"}
|