@uipath/apollo-react 4.32.0 → 4.32.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/LoopNode/IterationNavigator.cjs +29 -13
- package/dist/canvas/components/LoopNode/IterationNavigator.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/IterationNavigator.js +27 -11
- package/dist/canvas/components/LoopNode/LoopNode.cjs +39 -18
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.js +37 -16
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/i18n/useSafeLingui.cjs +12 -1
- package/dist/i18n/useSafeLingui.d.ts.map +1 -1
- package/dist/i18n/useSafeLingui.js +12 -1
- package/package.json +1 -1
|
@@ -29,7 +29,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
31
|
const external_react_namespaceObject = require("react");
|
|
32
|
-
const index_cjs_namespaceObject = require("
|
|
32
|
+
const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
|
|
33
|
+
const external_utils_index_cjs_namespaceObject = require("../../utils/index.cjs");
|
|
33
34
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
34
35
|
function resolveState(iterationState) {
|
|
35
36
|
if (!Number.isFinite(iterationState.total)) return;
|
|
@@ -39,7 +40,7 @@ function resolveState(iterationState) {
|
|
|
39
40
|
return {
|
|
40
41
|
...iterationState,
|
|
41
42
|
total,
|
|
42
|
-
activeIndex: (0,
|
|
43
|
+
activeIndex: (0, external_utils_index_cjs_namespaceObject.clamp)(rawActiveIndex, 0, total - 1)
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
function stopCanvasControlEvent(event) {
|
|
@@ -53,12 +54,33 @@ function IterationNavigator({ iterationState }) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
function NavigatorContent({ iterationState }) {
|
|
57
|
+
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
56
58
|
const { activeIndex, total, onActiveIndexChange, disabled, ariaLabel } = iterationState;
|
|
57
59
|
const canInteract = !disabled && 'function' == typeof onActiveIndexChange;
|
|
58
60
|
const canGoPrevious = canInteract && activeIndex > 0;
|
|
59
61
|
const canGoNext = canInteract && activeIndex < total - 1;
|
|
60
|
-
const label = ariaLabel ??
|
|
62
|
+
const label = ariaLabel ?? _({
|
|
63
|
+
id: 'loop-node.iteration.label',
|
|
64
|
+
message: 'Loop iteration'
|
|
65
|
+
});
|
|
61
66
|
const visibleIndex = activeIndex + 1;
|
|
67
|
+
const statusLabel = _({
|
|
68
|
+
id: 'loop-node.iteration.status',
|
|
69
|
+
message: '{label}: {visibleIndex} of {total}',
|
|
70
|
+
values: {
|
|
71
|
+
label,
|
|
72
|
+
visibleIndex,
|
|
73
|
+
total
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const previousLabel = _({
|
|
77
|
+
id: 'loop-node.iteration.previous',
|
|
78
|
+
message: 'Previous loop iteration'
|
|
79
|
+
});
|
|
80
|
+
const nextLabel = _({
|
|
81
|
+
id: 'loop-node.iteration.next',
|
|
82
|
+
message: 'Next loop iteration'
|
|
83
|
+
});
|
|
62
84
|
const handlePrevious = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
63
85
|
event.stopPropagation();
|
|
64
86
|
if (!canGoPrevious) return;
|
|
@@ -84,21 +106,15 @@ function NavigatorContent({ iterationState }) {
|
|
|
84
106
|
onMouseDown: stopCanvasControlEvent,
|
|
85
107
|
onDoubleClick: stopCanvasControlEvent,
|
|
86
108
|
children: [
|
|
87
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
109
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("legend", {
|
|
88
110
|
className: "sr-only",
|
|
89
|
-
children:
|
|
90
|
-
label,
|
|
91
|
-
": ",
|
|
92
|
-
visibleIndex,
|
|
93
|
-
" of ",
|
|
94
|
-
total
|
|
95
|
-
]
|
|
111
|
+
children: statusLabel
|
|
96
112
|
}),
|
|
97
113
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
98
114
|
type: "button",
|
|
99
115
|
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan inline-flex h-4 w-4 items-center justify-center rounded-full', 'text-foreground transition-opacity', canGoPrevious ? 'cursor-pointer opacity-100' : 'cursor-not-allowed opacity-40'),
|
|
100
116
|
disabled: !canGoPrevious,
|
|
101
|
-
"aria-label":
|
|
117
|
+
"aria-label": previousLabel,
|
|
102
118
|
onClick: handlePrevious,
|
|
103
119
|
onPointerDown: stopCanvasControlEvent,
|
|
104
120
|
onMouseDown: stopCanvasControlEvent,
|
|
@@ -121,7 +137,7 @@ function NavigatorContent({ iterationState }) {
|
|
|
121
137
|
type: "button",
|
|
122
138
|
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan inline-flex h-4 w-4 items-center justify-center rounded-full', 'text-foreground transition-opacity', canGoNext ? 'cursor-pointer opacity-100' : 'cursor-not-allowed opacity-40'),
|
|
123
139
|
disabled: !canGoNext,
|
|
124
|
-
"aria-label":
|
|
140
|
+
"aria-label": nextLabel,
|
|
125
141
|
onClick: handleNext,
|
|
126
142
|
onPointerDown: stopCanvasControlEvent,
|
|
127
143
|
onMouseDown: stopCanvasControlEvent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IterationNavigator.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/IterationNavigator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IterationNavigator.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/IterationNavigator.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,UAAU,uBAAuB;IAC/B,cAAc,EAAE,kBAAkB,CAAC;CACpC;AA4BD,wBAAgB,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE,uBAAuB,kDAQ7E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@uipath/apollo-wind";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
+
import { useSafeLingui } from "../../../i18n/index.js";
|
|
4
5
|
import { clamp } from "../../utils/index.js";
|
|
5
6
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
6
7
|
function resolveState(iterationState) {
|
|
@@ -25,12 +26,33 @@ function IterationNavigator({ iterationState }) {
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
function NavigatorContent({ iterationState }) {
|
|
29
|
+
const { _ } = useSafeLingui();
|
|
28
30
|
const { activeIndex, total, onActiveIndexChange, disabled, ariaLabel } = iterationState;
|
|
29
31
|
const canInteract = !disabled && 'function' == typeof onActiveIndexChange;
|
|
30
32
|
const canGoPrevious = canInteract && activeIndex > 0;
|
|
31
33
|
const canGoNext = canInteract && activeIndex < total - 1;
|
|
32
|
-
const label = ariaLabel ??
|
|
34
|
+
const label = ariaLabel ?? _({
|
|
35
|
+
id: 'loop-node.iteration.label',
|
|
36
|
+
message: 'Loop iteration'
|
|
37
|
+
});
|
|
33
38
|
const visibleIndex = activeIndex + 1;
|
|
39
|
+
const statusLabel = _({
|
|
40
|
+
id: 'loop-node.iteration.status',
|
|
41
|
+
message: '{label}: {visibleIndex} of {total}',
|
|
42
|
+
values: {
|
|
43
|
+
label,
|
|
44
|
+
visibleIndex,
|
|
45
|
+
total
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const previousLabel = _({
|
|
49
|
+
id: 'loop-node.iteration.previous',
|
|
50
|
+
message: 'Previous loop iteration'
|
|
51
|
+
});
|
|
52
|
+
const nextLabel = _({
|
|
53
|
+
id: 'loop-node.iteration.next',
|
|
54
|
+
message: 'Next loop iteration'
|
|
55
|
+
});
|
|
34
56
|
const handlePrevious = useCallback((event)=>{
|
|
35
57
|
event.stopPropagation();
|
|
36
58
|
if (!canGoPrevious) return;
|
|
@@ -56,21 +78,15 @@ function NavigatorContent({ iterationState }) {
|
|
|
56
78
|
onMouseDown: stopCanvasControlEvent,
|
|
57
79
|
onDoubleClick: stopCanvasControlEvent,
|
|
58
80
|
children: [
|
|
59
|
-
/*#__PURE__*/
|
|
81
|
+
/*#__PURE__*/ jsx("legend", {
|
|
60
82
|
className: "sr-only",
|
|
61
|
-
children:
|
|
62
|
-
label,
|
|
63
|
-
": ",
|
|
64
|
-
visibleIndex,
|
|
65
|
-
" of ",
|
|
66
|
-
total
|
|
67
|
-
]
|
|
83
|
+
children: statusLabel
|
|
68
84
|
}),
|
|
69
85
|
/*#__PURE__*/ jsx("button", {
|
|
70
86
|
type: "button",
|
|
71
87
|
className: cn('nodrag nopan inline-flex h-4 w-4 items-center justify-center rounded-full', 'text-foreground transition-opacity', canGoPrevious ? 'cursor-pointer opacity-100' : 'cursor-not-allowed opacity-40'),
|
|
72
88
|
disabled: !canGoPrevious,
|
|
73
|
-
"aria-label":
|
|
89
|
+
"aria-label": previousLabel,
|
|
74
90
|
onClick: handlePrevious,
|
|
75
91
|
onPointerDown: stopCanvasControlEvent,
|
|
76
92
|
onMouseDown: stopCanvasControlEvent,
|
|
@@ -93,7 +109,7 @@ function NavigatorContent({ iterationState }) {
|
|
|
93
109
|
type: "button",
|
|
94
110
|
className: cn('nodrag nopan inline-flex h-4 w-4 items-center justify-center rounded-full', 'text-foreground transition-opacity', canGoNext ? 'cursor-pointer opacity-100' : 'cursor-not-allowed opacity-40'),
|
|
95
111
|
disabled: !canGoNext,
|
|
96
|
-
"aria-label":
|
|
112
|
+
"aria-label": nextLabel,
|
|
97
113
|
onClick: handleNext,
|
|
98
114
|
onPointerDown: stopCanvasControlEvent,
|
|
99
115
|
onMouseDown: stopCanvasControlEvent,
|
|
@@ -31,8 +31,9 @@ const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
|
31
31
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
33
|
const shallow_namespaceObject = require("zustand/shallow");
|
|
34
|
+
const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
|
|
34
35
|
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
35
|
-
const
|
|
36
|
+
const external_core_index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
36
37
|
const external_hooks_index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
37
38
|
const adornment_resolver_cjs_namespaceObject = require("../../utils/adornment-resolver.cjs");
|
|
38
39
|
const container_cjs_namespaceObject = require("../../utils/container.cjs");
|
|
@@ -47,11 +48,11 @@ const BaseNodeBadgeSlot_cjs_namespaceObject = require("../BaseNode/BaseNodeBadge
|
|
|
47
48
|
const BaseNodeContainer_cjs_namespaceObject = require("../BaseNode/BaseNodeContainer.cjs");
|
|
48
49
|
const BaseNodeMissingManifest_cjs_namespaceObject = require("../BaseNode/BaseNodeMissingManifest.cjs");
|
|
49
50
|
const external_ButtonHandle_index_cjs_namespaceObject = require("../ButtonHandle/index.cjs");
|
|
51
|
+
const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
|
|
50
52
|
const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs");
|
|
51
53
|
const external_IterationNavigator_cjs_namespaceObject = require("./IterationNavigator.cjs");
|
|
52
54
|
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
|
|
53
55
|
const DEFAULT_LOOP_ICON = 'repeat';
|
|
54
|
-
const DEFAULT_LOOP_TITLE = 'Loop';
|
|
55
56
|
const EMPTY_DATA = {};
|
|
56
57
|
const LOOP_HEADER_ADORNMENT_GAP = 8;
|
|
57
58
|
const LOOP_HEADER_ADORNMENT_PADDING = external_constants_cjs_namespaceObject.NODE_BADGE_INSET_SQUARE + external_constants_cjs_namespaceObject.NODE_BADGE_SIZE + LOOP_HEADER_ADORNMENT_GAP;
|
|
@@ -158,7 +159,8 @@ function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
|
158
159
|
}
|
|
159
160
|
function LoopNodeComponent(props) {
|
|
160
161
|
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp, iterationState: iterationStateProp } = props;
|
|
161
|
-
const nodeTypeRegistry = (0,
|
|
162
|
+
const nodeTypeRegistry = (0, external_core_index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
163
|
+
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
162
164
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
163
165
|
const [isResizing, setIsResizing] = (0, external_react_namespaceObject.useState)(false);
|
|
164
166
|
const resolvedData = data ?? EMPTY_DATA;
|
|
@@ -203,9 +205,23 @@ function LoopNodeComponent(props) {
|
|
|
203
205
|
id,
|
|
204
206
|
resolvedData
|
|
205
207
|
]);
|
|
206
|
-
const displayTitle = display.label ??
|
|
208
|
+
const displayTitle = display.label ?? _({
|
|
209
|
+
id: 'loop-node.title',
|
|
210
|
+
message: 'Loop'
|
|
211
|
+
});
|
|
207
212
|
const displayIcon = display.icon ?? DEFAULT_LOOP_ICON;
|
|
208
213
|
const isParallel = true === resolvedData.parallel;
|
|
214
|
+
const label = isParallel ? _({
|
|
215
|
+
id: 'loop-node.mode.parallel',
|
|
216
|
+
message: 'Parallel'
|
|
217
|
+
}) : _({
|
|
218
|
+
id: 'loop-node.mode.sequential',
|
|
219
|
+
message: 'Sequential'
|
|
220
|
+
});
|
|
221
|
+
const addNodeToLoopLabel = _({
|
|
222
|
+
id: 'loop-node.add-node',
|
|
223
|
+
message: 'Add node to loop'
|
|
224
|
+
});
|
|
209
225
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
210
226
|
const containerWidth = width || container_cjs_namespaceObject.DEFAULT_CONTAINER_WIDTH;
|
|
211
227
|
const containerHeight = height || container_cjs_namespaceObject.DEFAULT_CONTAINER_HEIGHT;
|
|
@@ -330,6 +346,7 @@ function LoopNodeComponent(props) {
|
|
|
330
346
|
icon: displayIcon,
|
|
331
347
|
loading: isLoading,
|
|
332
348
|
isParallel: isParallel,
|
|
349
|
+
label: label,
|
|
333
350
|
iterationState: iterationStateProp,
|
|
334
351
|
hasTopLeftAdornment: hasTopLeftAdornment,
|
|
335
352
|
hasTopRightAdornment: hasTopRightAdornment
|
|
@@ -341,6 +358,7 @@ function LoopNodeComponent(props) {
|
|
|
341
358
|
showEmptyStateButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
342
359
|
className: (0, apollo_wind_namespaceObject.cn)('pointer-events-none absolute left-1/2 top-1/2', '-translate-x-1/2 -translate-y-1/2'),
|
|
343
360
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyState, {
|
|
361
|
+
label: addNodeToLoopLabel,
|
|
344
362
|
onAddFirstChild: handleEmptyClick
|
|
345
363
|
})
|
|
346
364
|
}) : null,
|
|
@@ -368,7 +386,7 @@ function LoopNodeComponent(props) {
|
|
|
368
386
|
});
|
|
369
387
|
}
|
|
370
388
|
const LoopNode = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(LoopNodeComponent);
|
|
371
|
-
function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
389
|
+
function Header({ title, icon, loading, isParallel, label, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
372
390
|
const titleContent = loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
373
391
|
className: "h-5 w-28 animate-pulse rounded bg-(--canvas-background-overlay)"
|
|
374
392
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -389,7 +407,6 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
389
407
|
paddingLeft: hasTopLeftAdornment ? LOOP_HEADER_ADORNMENT_PADDING : void 0,
|
|
390
408
|
paddingRight: hasTopRightAdornment ? LOOP_HEADER_ADORNMENT_PADDING : void 0
|
|
391
409
|
} : void 0;
|
|
392
|
-
const executionModeIcon = isParallel ? 'columns-3' : 'rows-3';
|
|
393
410
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
394
411
|
className: (0, apollo_wind_namespaceObject.cn)('flex shrink-0 cursor-grab items-center justify-between gap-2.5 rounded-t-[18px]', '-mb-2.5 bg-surface-overlay px-3.5 pb-2.5 pt-2.5 text-foreground', 'active:cursor-grabbing'),
|
|
395
412
|
style: headerStyle,
|
|
@@ -412,14 +429,14 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
412
429
|
className: "flex h-6 shrink-0 items-center gap-1 rounded-full border border-border bg-surface px-2.5 text-[11px] font-semibold leading-4 text-foreground shadow-sm",
|
|
413
430
|
children: [
|
|
414
431
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
415
|
-
className:
|
|
432
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex shrink-0', isParallel && 'rotate-90'),
|
|
416
433
|
"aria-hidden": true,
|
|
417
434
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
418
|
-
icon:
|
|
435
|
+
icon: "text-align-justify",
|
|
419
436
|
size: 12
|
|
420
437
|
})
|
|
421
438
|
}),
|
|
422
|
-
|
|
439
|
+
label
|
|
423
440
|
]
|
|
424
441
|
})
|
|
425
442
|
]
|
|
@@ -427,15 +444,19 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
427
444
|
]
|
|
428
445
|
});
|
|
429
446
|
}
|
|
430
|
-
function EmptyState({ onAddFirstChild }) {
|
|
431
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
447
|
+
function EmptyState({ label, onAddFirstChild }) {
|
|
448
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
449
|
+
content: label,
|
|
450
|
+
placement: "top",
|
|
451
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
452
|
+
type: "button",
|
|
453
|
+
onClick: onAddFirstChild,
|
|
454
|
+
"aria-label": label,
|
|
455
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan', 'pointer-events-auto flex h-8 w-8 items-center justify-center rounded-xl', 'border border-border bg-surface-overlay text-foreground', 'shadow-(--canvas-node-shadow-lifted)', 'transition-colors', 'hover:bg-surface-hover hover:border-brand'),
|
|
456
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
457
|
+
icon: "plus",
|
|
458
|
+
size: 14
|
|
459
|
+
})
|
|
439
460
|
})
|
|
440
461
|
});
|
|
441
462
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAqI1E,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,2CA6Q9C;AAED,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { NodeResizeControl, useStore, useUpdateNodeInternals } from "../../xyflo
|
|
|
3
3
|
import { cn } from "@uipath/apollo-wind";
|
|
4
4
|
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { shallow } from "zustand/shallow";
|
|
6
|
+
import { useSafeLingui } from "../../../i18n/index.js";
|
|
6
7
|
import { NODE_BADGE_INSET_SQUARE, NODE_BADGE_SIZE } from "../../constants.js";
|
|
7
8
|
import { useOptionalNodeTypeRegistry } from "../../core/index.js";
|
|
8
9
|
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
@@ -19,11 +20,11 @@ import { BaseBadgeSlot } from "../BaseNode/BaseNodeBadgeSlot.js";
|
|
|
19
20
|
import { getStatusBorder } from "../BaseNode/BaseNodeContainer.js";
|
|
20
21
|
import { MissingManifestNode } from "../BaseNode/BaseNodeMissingManifest.js";
|
|
21
22
|
import { ButtonHandles } from "../ButtonHandle/index.js";
|
|
23
|
+
import { CanvasTooltip } from "../CanvasTooltip.js";
|
|
22
24
|
import { NodeToolbar } from "../Toolbar/index.js";
|
|
23
25
|
import { IterationNavigator } from "./IterationNavigator.js";
|
|
24
26
|
import { resolveContainerHandleGroups } from "./LoopNode.helpers.js";
|
|
25
27
|
const DEFAULT_LOOP_ICON = 'repeat';
|
|
26
|
-
const DEFAULT_LOOP_TITLE = 'Loop';
|
|
27
28
|
const EMPTY_DATA = {};
|
|
28
29
|
const LOOP_HEADER_ADORNMENT_GAP = 8;
|
|
29
30
|
const LOOP_HEADER_ADORNMENT_PADDING = NODE_BADGE_INSET_SQUARE + NODE_BADGE_SIZE + LOOP_HEADER_ADORNMENT_GAP;
|
|
@@ -131,6 +132,7 @@ function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
|
131
132
|
function LoopNodeComponent(props) {
|
|
132
133
|
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp, iterationState: iterationStateProp } = props;
|
|
133
134
|
const nodeTypeRegistry = useOptionalNodeTypeRegistry();
|
|
135
|
+
const { _ } = useSafeLingui();
|
|
134
136
|
const [isHovered, setIsHovered] = useState(false);
|
|
135
137
|
const [isResizing, setIsResizing] = useState(false);
|
|
136
138
|
const resolvedData = data ?? EMPTY_DATA;
|
|
@@ -175,9 +177,23 @@ function LoopNodeComponent(props) {
|
|
|
175
177
|
id,
|
|
176
178
|
resolvedData
|
|
177
179
|
]);
|
|
178
|
-
const displayTitle = display.label ??
|
|
180
|
+
const displayTitle = display.label ?? _({
|
|
181
|
+
id: 'loop-node.title',
|
|
182
|
+
message: 'Loop'
|
|
183
|
+
});
|
|
179
184
|
const displayIcon = display.icon ?? DEFAULT_LOOP_ICON;
|
|
180
185
|
const isParallel = true === resolvedData.parallel;
|
|
186
|
+
const label = isParallel ? _({
|
|
187
|
+
id: 'loop-node.mode.parallel',
|
|
188
|
+
message: 'Parallel'
|
|
189
|
+
}) : _({
|
|
190
|
+
id: 'loop-node.mode.sequential',
|
|
191
|
+
message: 'Sequential'
|
|
192
|
+
});
|
|
193
|
+
const addNodeToLoopLabel = _({
|
|
194
|
+
id: 'loop-node.add-node',
|
|
195
|
+
message: 'Add node to loop'
|
|
196
|
+
});
|
|
181
197
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
182
198
|
const containerWidth = width || DEFAULT_CONTAINER_WIDTH;
|
|
183
199
|
const containerHeight = height || DEFAULT_CONTAINER_HEIGHT;
|
|
@@ -302,6 +318,7 @@ function LoopNodeComponent(props) {
|
|
|
302
318
|
icon: displayIcon,
|
|
303
319
|
loading: isLoading,
|
|
304
320
|
isParallel: isParallel,
|
|
321
|
+
label: label,
|
|
305
322
|
iterationState: iterationStateProp,
|
|
306
323
|
hasTopLeftAdornment: hasTopLeftAdornment,
|
|
307
324
|
hasTopRightAdornment: hasTopRightAdornment
|
|
@@ -313,6 +330,7 @@ function LoopNodeComponent(props) {
|
|
|
313
330
|
showEmptyStateButton ? /*#__PURE__*/ jsx("div", {
|
|
314
331
|
className: cn('pointer-events-none absolute left-1/2 top-1/2', '-translate-x-1/2 -translate-y-1/2'),
|
|
315
332
|
children: /*#__PURE__*/ jsx(EmptyState, {
|
|
333
|
+
label: addNodeToLoopLabel,
|
|
316
334
|
onAddFirstChild: handleEmptyClick
|
|
317
335
|
})
|
|
318
336
|
}) : null,
|
|
@@ -340,7 +358,7 @@ function LoopNodeComponent(props) {
|
|
|
340
358
|
});
|
|
341
359
|
}
|
|
342
360
|
const LoopNode = /*#__PURE__*/ memo(LoopNodeComponent);
|
|
343
|
-
function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
361
|
+
function Header({ title, icon, loading, isParallel, label, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
344
362
|
const titleContent = loading ? /*#__PURE__*/ jsx("div", {
|
|
345
363
|
className: "h-5 w-28 animate-pulse rounded bg-(--canvas-background-overlay)"
|
|
346
364
|
}) : /*#__PURE__*/ jsx("span", {
|
|
@@ -361,7 +379,6 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
361
379
|
paddingLeft: hasTopLeftAdornment ? LOOP_HEADER_ADORNMENT_PADDING : void 0,
|
|
362
380
|
paddingRight: hasTopRightAdornment ? LOOP_HEADER_ADORNMENT_PADDING : void 0
|
|
363
381
|
} : void 0;
|
|
364
|
-
const executionModeIcon = isParallel ? 'columns-3' : 'rows-3';
|
|
365
382
|
return /*#__PURE__*/ jsxs("div", {
|
|
366
383
|
className: cn('flex shrink-0 cursor-grab items-center justify-between gap-2.5 rounded-t-[18px]', '-mb-2.5 bg-surface-overlay px-3.5 pb-2.5 pt-2.5 text-foreground', 'active:cursor-grabbing'),
|
|
367
384
|
style: headerStyle,
|
|
@@ -384,14 +401,14 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
384
401
|
className: "flex h-6 shrink-0 items-center gap-1 rounded-full border border-border bg-surface px-2.5 text-[11px] font-semibold leading-4 text-foreground shadow-sm",
|
|
385
402
|
children: [
|
|
386
403
|
/*#__PURE__*/ jsx("span", {
|
|
387
|
-
className:
|
|
404
|
+
className: cn('flex shrink-0', isParallel && 'rotate-90'),
|
|
388
405
|
"aria-hidden": true,
|
|
389
406
|
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
390
|
-
icon:
|
|
407
|
+
icon: "text-align-justify",
|
|
391
408
|
size: 12
|
|
392
409
|
})
|
|
393
410
|
}),
|
|
394
|
-
|
|
411
|
+
label
|
|
395
412
|
]
|
|
396
413
|
})
|
|
397
414
|
]
|
|
@@ -399,15 +416,19 @@ function Header({ title, icon, loading, isParallel, iterationState, hasTopLeftAd
|
|
|
399
416
|
]
|
|
400
417
|
});
|
|
401
418
|
}
|
|
402
|
-
function EmptyState({ onAddFirstChild }) {
|
|
403
|
-
return /*#__PURE__*/ jsx(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
419
|
+
function EmptyState({ label, onAddFirstChild }) {
|
|
420
|
+
return /*#__PURE__*/ jsx(CanvasTooltip, {
|
|
421
|
+
content: label,
|
|
422
|
+
placement: "top",
|
|
423
|
+
children: /*#__PURE__*/ jsx("button", {
|
|
424
|
+
type: "button",
|
|
425
|
+
onClick: onAddFirstChild,
|
|
426
|
+
"aria-label": label,
|
|
427
|
+
className: cn('nodrag nopan', 'pointer-events-auto flex h-8 w-8 items-center justify-center rounded-xl', 'border border-border bg-surface-overlay text-foreground', 'shadow-(--canvas-node-shadow-lifted)', 'transition-colors', 'hover:bg-surface-hover hover:border-brand'),
|
|
428
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
429
|
+
icon: "plus",
|
|
430
|
+
size: 14
|
|
431
|
+
})
|
|
411
432
|
})
|
|
412
433
|
});
|
|
413
434
|
}
|
|
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
messages: ()=>messages
|
|
28
28
|
});
|
|
29
|
-
const messages = JSON.parse("{\"stage-node.add-first-task\":[\"Add first task\"],\"stage-node.add-task\":[\"Add task\"],\"stage-node.add-task-to-parallel-group-above\":[\"Add task to parallel group above\"],\"stage-node.add-task-to-parallel-group-below\":[\"Add task to parallel group below\"],\"stage-node.adhoc-tasks\":[\"Ad hoc tasks\"],\"stage-node.create-parallel-group-with-task-above\":[\"Create parallel group with task above\"],\"stage-node.create-parallel-group-with-task-below\":[\"Create parallel group with task below\"],\"stage-node.delete-task\":[\"Delete task\"],\"stage-node.event-driven-tasks\":[\"Event-driven tasks\"],\"stage-node.move-down\":[\"Move down\"],\"stage-node.move-up\":[\"Move up\"],\"stage-node.no-tasks\":[\"No tasks\"],\"stage-node.parallel\":[\"Parallel\"],\"stage-node.remove-from-parallel-group\":[\"Remove from parallel group\"],\"stage-node.remove-group-from-stage\":[\"Remove group from stage\"],\"stage-node.replace-task\":[\"Replace task\"],\"stage-node.status.cancelled\":[\"Cancelled\"],\"stage-node.status.completed\":[\"Completed\"],\"stage-node.status.failed\":[\"Failed\"],\"stage-node.status.in-progress\":[\"In progress\"],\"stage-node.status.not-executed\":[\"Not started\"],\"stage-node.status.paused\":[\"Paused\"],\"stage-node.status.terminated\":[\"Terminated\"],\"stage-node.status.warning\":[\"Warning\"],\"stage-node.ungroup-parallel-tasks\":[\"Ungroup parallel tasks\"],\"stage-node.untitled-stage\":[\"Untitled stage\"],\"sticky-note.formatting.bold\":[\"Bold (\",[\"boldShortcut\"],\")\"],\"sticky-note.formatting.bullet-list\":[\"Bullet list\"],\"sticky-note.formatting.italic\":[\"Italic (\",[\"italicShortcut\"],\")\"],\"sticky-note.formatting.numbered-list\":[\"Numbered list\"],\"sticky-note.formatting.strikethrough\":[\"Strikethrough (\",[\"strikethroughShortcut\"],\")\"],\"sticky-note.formatting.toolbar\":[\"Text formatting\"],\"sticky-note.toolbar.color\":[\"Color\"],\"sticky-note.toolbar.delete\":[\"Delete\"],\"sticky-note.toolbar.edit\":[\"Edit\"],\"toolbox.search\":[\"Search\"]}");
|
|
29
|
+
const messages = JSON.parse("{\"loop-node.add-node\":[\"Add node to loop\"],\"loop-node.iteration.label\":[\"Loop iteration\"],\"loop-node.iteration.next\":[\"Next loop iteration\"],\"loop-node.iteration.previous\":[\"Previous loop iteration\"],\"loop-node.iteration.status\":[[\"label\"],\": \",[\"visibleIndex\"],\" of \",[\"total\"]],\"loop-node.mode.parallel\":[\"Parallel\"],\"loop-node.mode.sequential\":[\"Sequential\"],\"loop-node.title\":[\"Loop\"],\"stage-node.add-first-task\":[\"Add first task\"],\"stage-node.add-task\":[\"Add task\"],\"stage-node.add-task-to-parallel-group-above\":[\"Add task to parallel group above\"],\"stage-node.add-task-to-parallel-group-below\":[\"Add task to parallel group below\"],\"stage-node.adhoc-tasks\":[\"Ad hoc tasks\"],\"stage-node.create-parallel-group-with-task-above\":[\"Create parallel group with task above\"],\"stage-node.create-parallel-group-with-task-below\":[\"Create parallel group with task below\"],\"stage-node.delete-task\":[\"Delete task\"],\"stage-node.event-driven-tasks\":[\"Event-driven tasks\"],\"stage-node.move-down\":[\"Move down\"],\"stage-node.move-up\":[\"Move up\"],\"stage-node.no-tasks\":[\"No tasks\"],\"stage-node.parallel\":[\"Parallel\"],\"stage-node.remove-from-parallel-group\":[\"Remove from parallel group\"],\"stage-node.remove-group-from-stage\":[\"Remove group from stage\"],\"stage-node.replace-task\":[\"Replace task\"],\"stage-node.status.cancelled\":[\"Cancelled\"],\"stage-node.status.completed\":[\"Completed\"],\"stage-node.status.failed\":[\"Failed\"],\"stage-node.status.in-progress\":[\"In progress\"],\"stage-node.status.not-executed\":[\"Not started\"],\"stage-node.status.paused\":[\"Paused\"],\"stage-node.status.terminated\":[\"Terminated\"],\"stage-node.status.warning\":[\"Warning\"],\"stage-node.ungroup-parallel-tasks\":[\"Ungroup parallel tasks\"],\"stage-node.untitled-stage\":[\"Untitled stage\"],\"sticky-note.formatting.bold\":[\"Bold (\",[\"boldShortcut\"],\")\"],\"sticky-note.formatting.bullet-list\":[\"Bullet list\"],\"sticky-note.formatting.italic\":[\"Italic (\",[\"italicShortcut\"],\")\"],\"sticky-note.formatting.numbered-list\":[\"Numbered list\"],\"sticky-note.formatting.strikethrough\":[\"Strikethrough (\",[\"strikethroughShortcut\"],\")\"],\"sticky-note.formatting.toolbar\":[\"Text formatting\"],\"sticky-note.toolbar.color\":[\"Color\"],\"sticky-note.toolbar.delete\":[\"Delete\"],\"sticky-note.toolbar.edit\":[\"Edit\"],\"toolbox.search\":[\"Search\"]}");
|
|
30
30
|
exports.messages = __webpack_exports__.messages;
|
|
31
31
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
32
32
|
"messages"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/canvas/locales/en.ts"],"names":[],"mappings":"AAAkB,OAAO,KAAI,EAAC,QAAQ,EAAC,MAAI,cAAc,CAAC;AAAA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/canvas/locales/en.ts"],"names":[],"mappings":"AAAkB,OAAO,KAAI,EAAC,QAAQ,EAAC,MAAI,cAAc,CAAC;AAAA,eAAO,MAAM,QAAQ,EAA26E,QAAQ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const messages = JSON.parse("{\"stage-node.add-first-task\":[\"Add first task\"],\"stage-node.add-task\":[\"Add task\"],\"stage-node.add-task-to-parallel-group-above\":[\"Add task to parallel group above\"],\"stage-node.add-task-to-parallel-group-below\":[\"Add task to parallel group below\"],\"stage-node.adhoc-tasks\":[\"Ad hoc tasks\"],\"stage-node.create-parallel-group-with-task-above\":[\"Create parallel group with task above\"],\"stage-node.create-parallel-group-with-task-below\":[\"Create parallel group with task below\"],\"stage-node.delete-task\":[\"Delete task\"],\"stage-node.event-driven-tasks\":[\"Event-driven tasks\"],\"stage-node.move-down\":[\"Move down\"],\"stage-node.move-up\":[\"Move up\"],\"stage-node.no-tasks\":[\"No tasks\"],\"stage-node.parallel\":[\"Parallel\"],\"stage-node.remove-from-parallel-group\":[\"Remove from parallel group\"],\"stage-node.remove-group-from-stage\":[\"Remove group from stage\"],\"stage-node.replace-task\":[\"Replace task\"],\"stage-node.status.cancelled\":[\"Cancelled\"],\"stage-node.status.completed\":[\"Completed\"],\"stage-node.status.failed\":[\"Failed\"],\"stage-node.status.in-progress\":[\"In progress\"],\"stage-node.status.not-executed\":[\"Not started\"],\"stage-node.status.paused\":[\"Paused\"],\"stage-node.status.terminated\":[\"Terminated\"],\"stage-node.status.warning\":[\"Warning\"],\"stage-node.ungroup-parallel-tasks\":[\"Ungroup parallel tasks\"],\"stage-node.untitled-stage\":[\"Untitled stage\"],\"sticky-note.formatting.bold\":[\"Bold (\",[\"boldShortcut\"],\")\"],\"sticky-note.formatting.bullet-list\":[\"Bullet list\"],\"sticky-note.formatting.italic\":[\"Italic (\",[\"italicShortcut\"],\")\"],\"sticky-note.formatting.numbered-list\":[\"Numbered list\"],\"sticky-note.formatting.strikethrough\":[\"Strikethrough (\",[\"strikethroughShortcut\"],\")\"],\"sticky-note.formatting.toolbar\":[\"Text formatting\"],\"sticky-note.toolbar.color\":[\"Color\"],\"sticky-note.toolbar.delete\":[\"Delete\"],\"sticky-note.toolbar.edit\":[\"Edit\"],\"toolbox.search\":[\"Search\"]}");
|
|
1
|
+
const messages = JSON.parse("{\"loop-node.add-node\":[\"Add node to loop\"],\"loop-node.iteration.label\":[\"Loop iteration\"],\"loop-node.iteration.next\":[\"Next loop iteration\"],\"loop-node.iteration.previous\":[\"Previous loop iteration\"],\"loop-node.iteration.status\":[[\"label\"],\": \",[\"visibleIndex\"],\" of \",[\"total\"]],\"loop-node.mode.parallel\":[\"Parallel\"],\"loop-node.mode.sequential\":[\"Sequential\"],\"loop-node.title\":[\"Loop\"],\"stage-node.add-first-task\":[\"Add first task\"],\"stage-node.add-task\":[\"Add task\"],\"stage-node.add-task-to-parallel-group-above\":[\"Add task to parallel group above\"],\"stage-node.add-task-to-parallel-group-below\":[\"Add task to parallel group below\"],\"stage-node.adhoc-tasks\":[\"Ad hoc tasks\"],\"stage-node.create-parallel-group-with-task-above\":[\"Create parallel group with task above\"],\"stage-node.create-parallel-group-with-task-below\":[\"Create parallel group with task below\"],\"stage-node.delete-task\":[\"Delete task\"],\"stage-node.event-driven-tasks\":[\"Event-driven tasks\"],\"stage-node.move-down\":[\"Move down\"],\"stage-node.move-up\":[\"Move up\"],\"stage-node.no-tasks\":[\"No tasks\"],\"stage-node.parallel\":[\"Parallel\"],\"stage-node.remove-from-parallel-group\":[\"Remove from parallel group\"],\"stage-node.remove-group-from-stage\":[\"Remove group from stage\"],\"stage-node.replace-task\":[\"Replace task\"],\"stage-node.status.cancelled\":[\"Cancelled\"],\"stage-node.status.completed\":[\"Completed\"],\"stage-node.status.failed\":[\"Failed\"],\"stage-node.status.in-progress\":[\"In progress\"],\"stage-node.status.not-executed\":[\"Not started\"],\"stage-node.status.paused\":[\"Paused\"],\"stage-node.status.terminated\":[\"Terminated\"],\"stage-node.status.warning\":[\"Warning\"],\"stage-node.ungroup-parallel-tasks\":[\"Ungroup parallel tasks\"],\"stage-node.untitled-stage\":[\"Untitled stage\"],\"sticky-note.formatting.bold\":[\"Bold (\",[\"boldShortcut\"],\")\"],\"sticky-note.formatting.bullet-list\":[\"Bullet list\"],\"sticky-note.formatting.italic\":[\"Italic (\",[\"italicShortcut\"],\")\"],\"sticky-note.formatting.numbered-list\":[\"Numbered list\"],\"sticky-note.formatting.strikethrough\":[\"Strikethrough (\",[\"strikethroughShortcut\"],\")\"],\"sticky-note.formatting.toolbar\":[\"Text formatting\"],\"sticky-note.toolbar.color\":[\"Color\"],\"sticky-note.toolbar.delete\":[\"Delete\"],\"sticky-note.toolbar.edit\":[\"Edit\"],\"toolbox.search\":[\"Search\"]}");
|
|
2
2
|
export { messages };
|