@uipath/apollo-react 4.34.0 → 4.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/BaseCanvas/index.cjs +25 -15
- package/dist/canvas/components/BaseCanvas/index.d.ts +1 -0
- package/dist/canvas/components/BaseCanvas/index.d.ts.map +1 -1
- package/dist/canvas/components/BaseCanvas/index.js +1 -0
- package/dist/canvas/components/BaseNode/BaseNode.cjs +3 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -1
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts +3 -1
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +30 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +11 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +30 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.cjs +3 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts +3 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.js +3 -1
- package/dist/canvas/components/ButtonHandle/useButtonHandles.cjs +6 -2
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts +4 -2
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/useButtonHandles.js +6 -2
- package/dist/canvas/components/CaseFlow/case-flow.manifest.cjs +12 -0
- package/dist/canvas/components/CaseFlow/case-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/CaseFlow/case-flow.manifest.js +12 -0
- package/dist/canvas/components/CaseFlow/index.cjs +42 -0
- package/dist/canvas/components/CaseFlow/index.d.ts +2 -0
- package/dist/canvas/components/CaseFlow/index.d.ts.map +1 -0
- package/dist/canvas/components/CaseFlow/index.js +2 -0
- package/dist/canvas/components/LoopNode/LoopNode.cjs +9 -3
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.js +9 -3
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +10 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNodeExecutionCount.cjs +370 -0
- package/dist/canvas/components/LoopNode/LoopNodeExecutionCount.d.ts +8 -0
- package/dist/canvas/components/LoopNode/LoopNodeExecutionCount.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNodeExecutionCount.js +333 -0
- package/dist/canvas/components/LoopNode/index.cjs +15 -8
- package/dist/canvas/components/LoopNode/index.d.ts +1 -0
- package/dist/canvas/components/LoopNode/index.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/index.js +1 -0
- package/dist/canvas/components/index.cjs +43 -36
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- 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/canvas/utils/CanvasEventBus.d.ts +13 -2
- package/dist/canvas/utils/CanvasEventBus.d.ts.map +1 -1
- package/dist/canvas/utils/manifest-resolver.d.ts +3 -1
- package/dist/canvas/utils/manifest-resolver.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -51,6 +51,7 @@ const external_ButtonHandle_index_cjs_namespaceObject = require("../ButtonHandle
|
|
|
51
51
|
const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
|
|
52
52
|
const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs");
|
|
53
53
|
const external_IterationNavigator_cjs_namespaceObject = require("./IterationNavigator.cjs");
|
|
54
|
+
const external_LoopNodeExecutionCount_cjs_namespaceObject = require("./LoopNodeExecutionCount.cjs");
|
|
54
55
|
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
|
|
55
56
|
const DEFAULT_LOOP_ICON = 'repeat';
|
|
56
57
|
const EMPTY_DATA = {};
|
|
@@ -158,7 +159,7 @@ function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
|
158
159
|
return manifestHandleConfigurations ?? [];
|
|
159
160
|
}
|
|
160
161
|
function LoopNodeComponent(props) {
|
|
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;
|
|
162
|
+
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp, iterationState: iterationStateProp, iterationPillState: iterationPillStateProp } = props;
|
|
162
163
|
const nodeTypeRegistry = (0, external_core_index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
163
164
|
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
164
165
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -348,6 +349,8 @@ function LoopNodeComponent(props) {
|
|
|
348
349
|
isParallel: isParallel,
|
|
349
350
|
label: label,
|
|
350
351
|
iterationState: iterationStateProp,
|
|
352
|
+
iterationPillState: iterationPillStateProp,
|
|
353
|
+
nodeWidth: containerWidth,
|
|
351
354
|
hasTopLeftAdornment: hasTopLeftAdornment,
|
|
352
355
|
hasTopRightAdornment: hasTopRightAdornment
|
|
353
356
|
}),
|
|
@@ -386,7 +389,7 @@ function LoopNodeComponent(props) {
|
|
|
386
389
|
});
|
|
387
390
|
}
|
|
388
391
|
const LoopNode = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(LoopNodeComponent);
|
|
389
|
-
function Header({ title, icon, loading, isParallel, label, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
392
|
+
function Header({ title, icon, loading, isParallel, label, iterationState, iterationPillState, nodeWidth, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
390
393
|
const titleContent = loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
391
394
|
className: "h-5 w-28 animate-pulse rounded bg-(--canvas-background-overlay)"
|
|
392
395
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -422,7 +425,10 @@ function Header({ title, icon, loading, isParallel, label, iterationState, hasTo
|
|
|
422
425
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
423
426
|
className: "flex shrink-0 items-center gap-2",
|
|
424
427
|
children: [
|
|
425
|
-
|
|
428
|
+
iterationPillState ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_LoopNodeExecutionCount_cjs_namespaceObject.LoopNodeExecutionCount, {
|
|
429
|
+
state: iterationPillState,
|
|
430
|
+
size: nodeWidth >= 400 ? 'full' : nodeWidth >= 260 ? 'compact' : 'minimal'
|
|
431
|
+
}) : iterationState ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_IterationNavigator_cjs_namespaceObject.IterationNavigator, {
|
|
426
432
|
iterationState: iterationState
|
|
427
433
|
}) : null,
|
|
428
434
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
@@ -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":"AA2CA,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,kBAAkB,CAAC;AAqI1B,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,2CAgR9C;AAED,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
@@ -23,6 +23,7 @@ import { ButtonHandles } from "../ButtonHandle/index.js";
|
|
|
23
23
|
import { CanvasTooltip } from "../CanvasTooltip.js";
|
|
24
24
|
import { NodeToolbar } from "../Toolbar/index.js";
|
|
25
25
|
import { IterationNavigator } from "./IterationNavigator.js";
|
|
26
|
+
import { LoopNodeExecutionCount } from "./LoopNodeExecutionCount.js";
|
|
26
27
|
import { resolveContainerHandleGroups } from "./LoopNode.helpers.js";
|
|
27
28
|
const DEFAULT_LOOP_ICON = 'repeat';
|
|
28
29
|
const EMPTY_DATA = {};
|
|
@@ -130,7 +131,7 @@ function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
|
130
131
|
return manifestHandleConfigurations ?? [];
|
|
131
132
|
}
|
|
132
133
|
function LoopNodeComponent(props) {
|
|
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;
|
|
134
|
+
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp, iterationState: iterationStateProp, iterationPillState: iterationPillStateProp } = props;
|
|
134
135
|
const nodeTypeRegistry = useOptionalNodeTypeRegistry();
|
|
135
136
|
const { _ } = useSafeLingui();
|
|
136
137
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -320,6 +321,8 @@ function LoopNodeComponent(props) {
|
|
|
320
321
|
isParallel: isParallel,
|
|
321
322
|
label: label,
|
|
322
323
|
iterationState: iterationStateProp,
|
|
324
|
+
iterationPillState: iterationPillStateProp,
|
|
325
|
+
nodeWidth: containerWidth,
|
|
323
326
|
hasTopLeftAdornment: hasTopLeftAdornment,
|
|
324
327
|
hasTopRightAdornment: hasTopRightAdornment
|
|
325
328
|
}),
|
|
@@ -358,7 +361,7 @@ function LoopNodeComponent(props) {
|
|
|
358
361
|
});
|
|
359
362
|
}
|
|
360
363
|
const LoopNode = /*#__PURE__*/ memo(LoopNodeComponent);
|
|
361
|
-
function Header({ title, icon, loading, isParallel, label, iterationState, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
364
|
+
function Header({ title, icon, loading, isParallel, label, iterationState, iterationPillState, nodeWidth, hasTopLeftAdornment, hasTopRightAdornment }) {
|
|
362
365
|
const titleContent = loading ? /*#__PURE__*/ jsx("div", {
|
|
363
366
|
className: "h-5 w-28 animate-pulse rounded bg-(--canvas-background-overlay)"
|
|
364
367
|
}) : /*#__PURE__*/ jsx("span", {
|
|
@@ -394,7 +397,10 @@ function Header({ title, icon, loading, isParallel, label, iterationState, hasTo
|
|
|
394
397
|
/*#__PURE__*/ jsxs("div", {
|
|
395
398
|
className: "flex shrink-0 items-center gap-2",
|
|
396
399
|
children: [
|
|
397
|
-
|
|
400
|
+
iterationPillState ? /*#__PURE__*/ jsx(LoopNodeExecutionCount, {
|
|
401
|
+
state: iterationPillState,
|
|
402
|
+
size: nodeWidth >= 400 ? 'full' : nodeWidth >= 260 ? 'compact' : 'minimal'
|
|
403
|
+
}) : iterationState ? /*#__PURE__*/ jsx(IterationNavigator, {
|
|
398
404
|
iterationState: iterationState
|
|
399
405
|
}) : null,
|
|
400
406
|
/*#__PURE__*/ jsxs("span", {
|
|
@@ -16,12 +16,22 @@ export interface LoopIterationState {
|
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
ariaLabel?: string;
|
|
18
18
|
}
|
|
19
|
+
export interface LoopNodeExecutionCountState {
|
|
20
|
+
activeIndex: number;
|
|
21
|
+
total: number;
|
|
22
|
+
onActiveIndexChange?: (nextIndex: number) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
isAll: boolean;
|
|
25
|
+
onAllChange: (isAll: boolean) => void;
|
|
26
|
+
iterationStatuses?: Map<number, ElementStatusValues>;
|
|
27
|
+
}
|
|
19
28
|
export interface LoopNodeConfig {
|
|
20
29
|
toolbarConfig?: NodeToolbarConfig | null;
|
|
21
30
|
adornments?: NodeAdornments;
|
|
22
31
|
executionStatusOverride?: ElementStatusValues;
|
|
23
32
|
suggestionType?: SuggestionType;
|
|
24
33
|
iterationState?: LoopIterationState;
|
|
34
|
+
iterationPillState?: LoopNodeExecutionCountState;
|
|
25
35
|
}
|
|
26
36
|
export interface LoopNodeProps extends NodeProps<Node<LoopNodeData>>, LoopNodeConfig {
|
|
27
37
|
onAddFirstChild?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,uBAAuB,CAAC,EAAE,mBAAmB,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"LoopNode.types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,uBAAuB,CAAC,EAAE,mBAAmB,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,kBAAkB,CAAC,EAAE,2BAA2B,CAAC;CAClD;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc;IAClF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC/C"}
|
|
@@ -0,0 +1,370 @@
|
|
|
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
|
+
LoopNodeExecutionCount: ()=>LoopNodeExecutionCount,
|
|
28
|
+
getIterationStatusColor: ()=>getIterationStatusColor
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
|
|
34
|
+
const execution_cjs_namespaceObject = require("../../types/execution.cjs");
|
|
35
|
+
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
36
|
+
const NodeUtils_cjs_namespaceObject = require("../../utils/NodeUtils.cjs");
|
|
37
|
+
function stopEvent(e) {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
}
|
|
40
|
+
function getIterationStatusColor(status) {
|
|
41
|
+
switch(status){
|
|
42
|
+
case execution_cjs_namespaceObject.ElementStatusValues.Completed:
|
|
43
|
+
return '#22c55e';
|
|
44
|
+
case execution_cjs_namespaceObject.ElementStatusValues.Failed:
|
|
45
|
+
return '#ef4444';
|
|
46
|
+
case execution_cjs_namespaceObject.ElementStatusValues.InProgress:
|
|
47
|
+
return '#f59e0b';
|
|
48
|
+
case execution_cjs_namespaceObject.ElementStatusValues.Paused:
|
|
49
|
+
return '#a855f7';
|
|
50
|
+
case execution_cjs_namespaceObject.ElementStatusValues.Cancelled:
|
|
51
|
+
return '#94a3b8';
|
|
52
|
+
default:
|
|
53
|
+
return 'currentColor';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function LoopNodeExecutionCount({ state, size = 'full' }) {
|
|
57
|
+
const { activeIndex, total, onActiveIndexChange, disabled, isAll, onAllChange, iterationStatuses } = state;
|
|
58
|
+
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
59
|
+
const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(false);
|
|
60
|
+
const [inputValue, setInputValue] = (0, external_react_namespaceObject.useState)('');
|
|
61
|
+
const inputRef = (0, external_react_namespaceObject.useRef)(null);
|
|
62
|
+
const safeTotal = Number.isFinite(total) && total > 0 ? total : 1;
|
|
63
|
+
const safeActiveIndex = (0, NodeUtils_cjs_namespaceObject.clamp)(Number.isFinite(activeIndex) && activeIndex >= 0 ? activeIndex : 0, 0, safeTotal - 1);
|
|
64
|
+
const canInteract = !disabled && 'function' == typeof onActiveIndexChange;
|
|
65
|
+
const visibleIndex = safeActiveIndex + 1;
|
|
66
|
+
const currentStatus = iterationStatuses?.get(safeActiveIndex);
|
|
67
|
+
const firstFailedIndex = iterationStatuses ? [
|
|
68
|
+
...iterationStatuses.entries()
|
|
69
|
+
].find(([, s])=>s === execution_cjs_namespaceObject.ElementStatusValues.Failed)?.[0] : void 0;
|
|
70
|
+
const completedCount = iterationStatuses ? [
|
|
71
|
+
...iterationStatuses.values()
|
|
72
|
+
].filter((s)=>s === execution_cjs_namespaceObject.ElementStatusValues.Completed).length : void 0;
|
|
73
|
+
const failedCount = iterationStatuses ? [
|
|
74
|
+
...iterationStatuses.values()
|
|
75
|
+
].filter((s)=>s === execution_cjs_namespaceObject.ElementStatusValues.Failed).length : 0;
|
|
76
|
+
const handlePrev = (e)=>{
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
if (canInteract && !isAll && safeActiveIndex > 0) onActiveIndexChange?.(safeActiveIndex - 1);
|
|
79
|
+
};
|
|
80
|
+
const handleNext = (e)=>{
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
if (canInteract && !isAll && safeActiveIndex < safeTotal - 1) onActiveIndexChange?.(safeActiveIndex + 1);
|
|
83
|
+
};
|
|
84
|
+
const toggleAll = (e)=>{
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
if (disabled) return;
|
|
87
|
+
onAllChange(!isAll);
|
|
88
|
+
};
|
|
89
|
+
const handleJumpToFailed = (e)=>{
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
if (void 0 !== firstFailedIndex) onActiveIndexChange?.(firstFailedIndex);
|
|
92
|
+
};
|
|
93
|
+
const startEdit = (e)=>{
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
if (!canInteract || isAll || isEditing) return;
|
|
96
|
+
setInputValue(String(visibleIndex));
|
|
97
|
+
setIsEditing(true);
|
|
98
|
+
requestAnimationFrame(()=>inputRef.current?.select());
|
|
99
|
+
};
|
|
100
|
+
const commitEdit = ()=>{
|
|
101
|
+
const parsed = parseInt(inputValue, 10);
|
|
102
|
+
if (!Number.isNaN(parsed)) onActiveIndexChange?.((0, NodeUtils_cjs_namespaceObject.clamp)(parsed, 1, safeTotal) - 1);
|
|
103
|
+
setIsEditing(false);
|
|
104
|
+
};
|
|
105
|
+
const handleInputKeyDown = (e)=>{
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
if ('Enter' === e.key) commitEdit();
|
|
108
|
+
if ('Escape' === e.key) setIsEditing(false);
|
|
109
|
+
};
|
|
110
|
+
const canGoPrev = canInteract && !isAll && safeActiveIndex > 0;
|
|
111
|
+
const canGoNext = canInteract && !isAll && safeActiveIndex < safeTotal - 1;
|
|
112
|
+
if ('minimal' === size) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
113
|
+
className: "nodrag nopan pointer-events-auto flex items-center",
|
|
114
|
+
onPointerDown: stopEvent,
|
|
115
|
+
onMouseDown: stopEvent,
|
|
116
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
117
|
+
className: "flex h-6 items-center gap-0.5 rounded-full border border-border bg-surface px-2 text-[11px] font-semibold leading-none shadow-sm",
|
|
118
|
+
children: isAll ? void 0 !== completedCount ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
121
|
+
style: {
|
|
122
|
+
color: getIterationStatusColor(execution_cjs_namespaceObject.ElementStatusValues.Completed)
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
"✓",
|
|
126
|
+
completedCount
|
|
127
|
+
]
|
|
128
|
+
}),
|
|
129
|
+
failedCount > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
130
|
+
style: {
|
|
131
|
+
color: getIterationStatusColor(execution_cjs_namespaceObject.ElementStatusValues.Failed)
|
|
132
|
+
},
|
|
133
|
+
children: [
|
|
134
|
+
' ',
|
|
135
|
+
"✗",
|
|
136
|
+
failedCount
|
|
137
|
+
]
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
143
|
+
className: "opacity-60",
|
|
144
|
+
children: "Σ"
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
147
|
+
className: "ml-0.5",
|
|
148
|
+
children: safeTotal
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
152
|
+
children: [
|
|
153
|
+
currentStatus && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
154
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full",
|
|
155
|
+
style: {
|
|
156
|
+
backgroundColor: getIterationStatusColor(currentStatus)
|
|
157
|
+
}
|
|
158
|
+
}),
|
|
159
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
160
|
+
children: visibleIndex
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
163
|
+
className: "px-0.5 opacity-60",
|
|
164
|
+
children: "/"
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
167
|
+
children: safeTotal
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
174
|
+
className: "nodrag nopan pointer-events-auto flex items-center gap-1.5",
|
|
175
|
+
onPointerDown: stopEvent,
|
|
176
|
+
onMouseDown: stopEvent,
|
|
177
|
+
onDoubleClick: stopEvent,
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
180
|
+
className: "nodrag nopan flex h-6 items-stretch overflow-hidden rounded-full border border-border bg-surface shadow-sm",
|
|
181
|
+
children: [
|
|
182
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
onClick: toggleAll,
|
|
185
|
+
onPointerDown: stopEvent,
|
|
186
|
+
onMouseDown: stopEvent,
|
|
187
|
+
disabled: disabled,
|
|
188
|
+
"aria-pressed": isAll,
|
|
189
|
+
"aria-label": _({
|
|
190
|
+
id: 'loop-node.execution-count.show-aggregate',
|
|
191
|
+
message: 'Show aggregate across all iterations'
|
|
192
|
+
}),
|
|
193
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan select-none px-2.5 text-[11px] font-semibold leading-none transition-colors', isAll ? 'bg-surface-overlay text-foreground' : 'text-foreground hover:bg-surface-hover', disabled && 'cursor-not-allowed opacity-50'),
|
|
194
|
+
children: "All"
|
|
195
|
+
}),
|
|
196
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
197
|
+
className: "w-px shrink-0 bg-border"
|
|
198
|
+
}),
|
|
199
|
+
isAll ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
200
|
+
type: "button",
|
|
201
|
+
onClick: toggleAll,
|
|
202
|
+
onPointerDown: stopEvent,
|
|
203
|
+
onMouseDown: stopEvent,
|
|
204
|
+
disabled: disabled,
|
|
205
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan flex items-center gap-1.5 px-2.5 text-[11px] font-semibold leading-none transition-colors hover:bg-surface-overlay', disabled && 'cursor-not-allowed opacity-50'),
|
|
206
|
+
"aria-label": _({
|
|
207
|
+
id: 'loop-node.execution-count.return-to-individual',
|
|
208
|
+
message: 'Return to individual iteration view'
|
|
209
|
+
}),
|
|
210
|
+
title: _({
|
|
211
|
+
id: 'loop-node.execution-count.click-to-return',
|
|
212
|
+
message: 'Click to return to individual iteration view'
|
|
213
|
+
}),
|
|
214
|
+
children: void 0 !== completedCount ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
217
|
+
style: {
|
|
218
|
+
color: getIterationStatusColor(execution_cjs_namespaceObject.ElementStatusValues.Completed)
|
|
219
|
+
},
|
|
220
|
+
children: [
|
|
221
|
+
"✓ ",
|
|
222
|
+
completedCount
|
|
223
|
+
]
|
|
224
|
+
}),
|
|
225
|
+
failedCount > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
226
|
+
style: {
|
|
227
|
+
color: getIterationStatusColor(execution_cjs_namespaceObject.ElementStatusValues.Failed)
|
|
228
|
+
},
|
|
229
|
+
children: [
|
|
230
|
+
"✗ ",
|
|
231
|
+
failedCount
|
|
232
|
+
]
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
236
|
+
children: [
|
|
237
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
238
|
+
"aria-hidden": true,
|
|
239
|
+
className: "opacity-60",
|
|
240
|
+
children: "Σ"
|
|
241
|
+
}),
|
|
242
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
243
|
+
children: safeTotal
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
248
|
+
className: "flex items-stretch",
|
|
249
|
+
children: [
|
|
250
|
+
'full' === size && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
251
|
+
type: "button",
|
|
252
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan flex w-5 items-center justify-center text-foreground transition-opacity', canGoPrev ? 'cursor-pointer hover:bg-surface-overlay' : 'cursor-not-allowed opacity-40'),
|
|
253
|
+
disabled: !canGoPrev,
|
|
254
|
+
"aria-label": _({
|
|
255
|
+
id: 'loop-node.execution-count.previous-iteration',
|
|
256
|
+
message: 'Previous iteration'
|
|
257
|
+
}),
|
|
258
|
+
onClick: handlePrev,
|
|
259
|
+
onPointerDown: stopEvent,
|
|
260
|
+
onMouseDown: stopEvent,
|
|
261
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
262
|
+
icon: "chevron-left",
|
|
263
|
+
size: 12
|
|
264
|
+
})
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
267
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex min-w-10 select-none items-center justify-center gap-0.5 text-[11px] font-semibold leading-none', 'full' === size ? 'px-1' : 'px-2.5', canInteract && !isEditing && 'cursor-pointer hover:text-foreground-accent'),
|
|
268
|
+
onClick: startEdit,
|
|
269
|
+
title: canInteract ? _({
|
|
270
|
+
id: 'loop-node.execution-count.click-to-jump',
|
|
271
|
+
message: 'Click to jump to a specific iteration'
|
|
272
|
+
}) : void 0,
|
|
273
|
+
children: isEditing ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
274
|
+
children: [
|
|
275
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
|
|
276
|
+
ref: inputRef,
|
|
277
|
+
type: "number",
|
|
278
|
+
min: 1,
|
|
279
|
+
max: safeTotal,
|
|
280
|
+
value: inputValue,
|
|
281
|
+
onChange: (e)=>setInputValue(e.target.value),
|
|
282
|
+
onBlur: commitEdit,
|
|
283
|
+
onKeyDown: handleInputKeyDown,
|
|
284
|
+
onPointerDown: stopEvent,
|
|
285
|
+
className: "w-7 appearance-none bg-transparent text-center text-[11px] font-semibold leading-none outline-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none border-b border-foreground-accent"
|
|
286
|
+
}),
|
|
287
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
288
|
+
className: "px-0.5 opacity-60",
|
|
289
|
+
children: "/"
|
|
290
|
+
}),
|
|
291
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
292
|
+
children: safeTotal
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
296
|
+
children: [
|
|
297
|
+
currentStatus && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
298
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full",
|
|
299
|
+
style: {
|
|
300
|
+
backgroundColor: getIterationStatusColor(currentStatus)
|
|
301
|
+
}
|
|
302
|
+
}),
|
|
303
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
304
|
+
children: visibleIndex
|
|
305
|
+
}),
|
|
306
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
307
|
+
className: "px-0.5 opacity-60",
|
|
308
|
+
children: "/"
|
|
309
|
+
}),
|
|
310
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
311
|
+
children: safeTotal
|
|
312
|
+
})
|
|
313
|
+
]
|
|
314
|
+
})
|
|
315
|
+
}),
|
|
316
|
+
'full' === size && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
317
|
+
type: "button",
|
|
318
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nopan flex w-5 items-center justify-center text-foreground transition-opacity', canGoNext ? 'cursor-pointer hover:bg-surface-overlay' : 'cursor-not-allowed opacity-40'),
|
|
319
|
+
disabled: !canGoNext,
|
|
320
|
+
"aria-label": _({
|
|
321
|
+
id: 'loop-node.execution-count.next-iteration',
|
|
322
|
+
message: 'Next iteration'
|
|
323
|
+
}),
|
|
324
|
+
onClick: handleNext,
|
|
325
|
+
onPointerDown: stopEvent,
|
|
326
|
+
onMouseDown: stopEvent,
|
|
327
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
328
|
+
icon: "chevron-right",
|
|
329
|
+
size: 12
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
})
|
|
334
|
+
]
|
|
335
|
+
}),
|
|
336
|
+
void 0 !== firstFailedIndex && !isAll && canInteract && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
337
|
+
type: "button",
|
|
338
|
+
className: "nodrag nopan inline-flex h-6 w-6 items-center justify-center rounded-full border border-border bg-surface shadow-sm transition-colors hover:border-red-400",
|
|
339
|
+
onClick: handleJumpToFailed,
|
|
340
|
+
onPointerDown: stopEvent,
|
|
341
|
+
onMouseDown: stopEvent,
|
|
342
|
+
"aria-label": _({
|
|
343
|
+
id: 'loop-node.execution-count.jump-to-failed',
|
|
344
|
+
message: 'Jump to first failed iteration'
|
|
345
|
+
}),
|
|
346
|
+
title: _({
|
|
347
|
+
id: 'loop-node.execution-count.jump-to-iteration',
|
|
348
|
+
message: 'Jump to iteration {iterationNumber} (failed)',
|
|
349
|
+
values: {
|
|
350
|
+
iterationNumber: firstFailedIndex + 1
|
|
351
|
+
}
|
|
352
|
+
}),
|
|
353
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
354
|
+
icon: "crosshair",
|
|
355
|
+
size: 12,
|
|
356
|
+
color: getIterationStatusColor(execution_cjs_namespaceObject.ElementStatusValues.Failed)
|
|
357
|
+
})
|
|
358
|
+
})
|
|
359
|
+
]
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
exports.LoopNodeExecutionCount = __webpack_exports__.LoopNodeExecutionCount;
|
|
363
|
+
exports.getIterationStatusColor = __webpack_exports__.getIterationStatusColor;
|
|
364
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
365
|
+
"LoopNodeExecutionCount",
|
|
366
|
+
"getIterationStatusColor"
|
|
367
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
368
|
+
Object.defineProperty(exports, '__esModule', {
|
|
369
|
+
value: true
|
|
370
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementStatusValues } from '../../types/execution';
|
|
2
|
+
import type { LoopNodeExecutionCountState } from './LoopNode.types';
|
|
3
|
+
export declare function getIterationStatusColor(status: ElementStatusValues | undefined): string;
|
|
4
|
+
export declare function LoopNodeExecutionCount({ state, size, }: {
|
|
5
|
+
state: LoopNodeExecutionCountState;
|
|
6
|
+
size?: 'full' | 'compact' | 'minimal';
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=LoopNodeExecutionCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopNodeExecutionCount.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNodeExecutionCount.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAMpE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAevF;AAED,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,IAAa,GACd,EAAE;IACD,KAAK,EAAE,2BAA2B,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACvC,2CA0UA"}
|