@uipath/apollo-react 4.6.0-pr525.f6fa0d2 → 4.6.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/BaseCanvas/BaseCanvas.cjs +1 -0
- package/dist/canvas/components/BaseCanvas/BaseCanvas.d.ts.map +1 -1
- package/dist/canvas/components/BaseCanvas/BaseCanvas.js +1 -0
- package/dist/canvas/components/BaseNode/BaseNode.cjs +75 -74
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +70 -69
- package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +410 -0
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +75 -0
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNode.styles.js +342 -0
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts +1 -2
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +18 -64
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts +1 -8
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +15 -58
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +7 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +7 -4
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.cjs +4 -4
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.js +4 -4
- package/dist/canvas/constants.cjs +0 -60
- package/dist/canvas/constants.d.ts +0 -15
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -16
- package/dist/canvas/index.cjs +35 -39
- package/dist/canvas/index.d.ts +0 -1
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +0 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.cjs +0 -68
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts +0 -9
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.js +0 -34
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +0 -88
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +0 -21
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +0 -51
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +0 -51
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +0 -9
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +0 -17
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +0 -62
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts +0 -9
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.js +0 -28
- package/dist/canvas/styles/reactflow-reset.css +0 -12
|
@@ -76,6 +76,7 @@ const BaseCanvasInnerComponent = (props)=>{
|
|
|
76
76
|
isDarkMode: isDarkMode,
|
|
77
77
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_cjs_namespaceObject.ReactFlow, {
|
|
78
78
|
...reactFlowProps,
|
|
79
|
+
colorMode: '',
|
|
79
80
|
nodes: nodes,
|
|
80
81
|
edges: edges,
|
|
81
82
|
nodeTypes: nodeTypes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseCanvas/BaseCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BaseCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseCanvas/BaseCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EACJ,IAAI,EAEL,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EAKlB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqMzE,eAAO,MAAM,UAAU,EAKjB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC/D,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG;IAC3C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;CACpD,KACE,YAAY,CAAC"}
|
|
@@ -27,10 +27,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
BaseNode: ()=>BaseNode
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const index_cjs_namespaceObject = require("../../utils/index.cjs");
|
|
30
31
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
31
32
|
const external_react_namespaceObject = require("react");
|
|
32
33
|
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
33
|
-
const
|
|
34
|
+
const external_core_index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
34
35
|
const external_hooks_index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
35
36
|
const adornment_resolver_cjs_namespaceObject = require("../../utils/adornment-resolver.cjs");
|
|
36
37
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
@@ -43,31 +44,10 @@ const SelectionStateContext_cjs_namespaceObject = require("../BaseCanvas/Selecti
|
|
|
43
44
|
const SmartHandle_cjs_namespaceObject = require("../ButtonHandle/SmartHandle.cjs");
|
|
44
45
|
const useButtonHandles_cjs_namespaceObject = require("../ButtonHandle/useButtonHandles.cjs");
|
|
45
46
|
const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs");
|
|
46
|
-
const
|
|
47
|
+
const external_BaseNode_styles_cjs_namespaceObject = require("./BaseNode.styles.cjs");
|
|
47
48
|
const external_BaseNodeConfigContext_cjs_namespaceObject = require("./BaseNodeConfigContext.cjs");
|
|
48
|
-
const external_BaseNodeContainer_cjs_namespaceObject = require("./BaseNodeContainer.cjs");
|
|
49
|
-
const external_BaseNodeInnerShape_cjs_namespaceObject = require("./BaseNodeInnerShape.cjs");
|
|
50
|
-
const external_BaseNodeMissingManifest_cjs_namespaceObject = require("./BaseNodeMissingManifest.cjs");
|
|
51
49
|
const external_NodeLabel_cjs_namespaceObject = require("./NodeLabel.cjs");
|
|
52
50
|
const selectIsConnecting = (state)=>!!state.connectionClickStartHandle;
|
|
53
|
-
const getContainerWidth = (shape, width)=>{
|
|
54
|
-
const defaultWidth = 'rectangle' === shape ? external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH : external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
|
|
55
|
-
if (width && width !== external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE && width !== external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH) return width;
|
|
56
|
-
return defaultWidth;
|
|
57
|
-
};
|
|
58
|
-
const getContainerHeight = (height, hasFooter, footerVariant)=>{
|
|
59
|
-
if (hasFooter) switch(footerVariant){
|
|
60
|
-
case 'button':
|
|
61
|
-
return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_BUTTON;
|
|
62
|
-
case 'single':
|
|
63
|
-
return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_SINGLE;
|
|
64
|
-
case 'double':
|
|
65
|
-
return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_DOUBLE;
|
|
66
|
-
default:
|
|
67
|
-
return 'auto';
|
|
68
|
-
}
|
|
69
|
-
return height || external_constants_cjs_namespaceObject.NODE_HEIGHT_DEFAULT;
|
|
70
|
-
};
|
|
71
51
|
const BaseNodeComponent = (props)=>{
|
|
72
52
|
const { type, data, selected, id, dragging, width, height } = props;
|
|
73
53
|
const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = (0, external_BaseNodeConfigContext_cjs_namespaceObject.useBaseNodeOverrideConfig)();
|
|
@@ -79,7 +59,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
79
59
|
const originalHeightRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
80
60
|
const executionState = (0, external_hooks_index_cjs_namespaceObject.useNodeExecutionState)(id);
|
|
81
61
|
const validationState = (0, external_hooks_index_cjs_namespaceObject.useElementValidationStatus)(id);
|
|
82
|
-
const nodeTypeRegistry = (0,
|
|
62
|
+
const nodeTypeRegistry = (0, external_core_index_cjs_namespaceObject.useNodeTypeRegistry)();
|
|
83
63
|
const { mode } = (0, BaseCanvasModeProvider_cjs_namespaceObject.useBaseCanvasMode)();
|
|
84
64
|
const connectedHandleIds = (0, ConnectedHandlesContext_cjs_namespaceObject.useConnectedHandles)(id);
|
|
85
65
|
const isConnecting = (0, react_cjs_namespaceObject.useStore)(selectIsConnecting);
|
|
@@ -175,7 +155,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
175
155
|
statusContext
|
|
176
156
|
]);
|
|
177
157
|
const computedHeight = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
178
|
-
const handleSpacing =
|
|
158
|
+
const handleSpacing = 32;
|
|
179
159
|
const leftHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
|
|
180
160
|
const rightHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
|
|
181
161
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
@@ -229,31 +209,6 @@ const BaseNodeComponent = (props)=>{
|
|
|
229
209
|
display.subLabel
|
|
230
210
|
]);
|
|
231
211
|
const displayFooter = footerComponent;
|
|
232
|
-
const hasFooter = !!displayFooter;
|
|
233
|
-
const containerWidth = getContainerWidth(displayShape, width);
|
|
234
|
-
const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
|
|
235
|
-
const nodeVars = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
236
|
-
const numH = 'number' == typeof containerHeight ? containerHeight : void 0;
|
|
237
|
-
const radiusBasis = 'rectangle' === displayShape ? numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : Math.min(containerWidth, numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE);
|
|
238
|
-
const nodeRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${radiusBasis * external_constants_cjs_namespaceObject.NODE_CONTAINER_RADIUS_RATIO}px`;
|
|
239
|
-
const effectiveH = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
|
|
240
|
-
const effectiveW = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : containerWidth;
|
|
241
|
-
const basis = 'rectangle' === displayShape ? effectiveH : Math.min(effectiveW, effectiveH);
|
|
242
|
-
const innerRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${basis * external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO}px`;
|
|
243
|
-
return {
|
|
244
|
-
'--node-w': `${containerWidth}px`,
|
|
245
|
-
'--node-h': numH ? `${numH}px` : 'auto',
|
|
246
|
-
'--node-radius': nodeRadius,
|
|
247
|
-
'--inner-size': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_SHAPE_RATIO}px`,
|
|
248
|
-
'--inner-radius': innerRadius,
|
|
249
|
-
'--icon-size': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_ICON_RATIO}px`
|
|
250
|
-
};
|
|
251
|
-
}, [
|
|
252
|
-
containerWidth,
|
|
253
|
-
containerHeight,
|
|
254
|
-
displayShape,
|
|
255
|
-
hasFooter
|
|
256
|
-
]);
|
|
257
212
|
const interactionState = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
258
213
|
if (disabled) return 'disabled';
|
|
259
214
|
if (dragging) return 'drag';
|
|
@@ -369,62 +324,103 @@ const BaseNodeComponent = (props)=>{
|
|
|
369
324
|
const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
|
|
370
325
|
if (!manifest) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
371
326
|
ref: containerRef,
|
|
372
|
-
|
|
373
|
-
|
|
327
|
+
style: {
|
|
328
|
+
position: 'relative'
|
|
329
|
+
},
|
|
374
330
|
onMouseEnter: handleMouseEnter,
|
|
375
331
|
onMouseLeave: handleMouseLeave,
|
|
376
332
|
onFocus: handleFocus,
|
|
377
333
|
onBlur: handleBlur,
|
|
378
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
interactionState: interactionState
|
|
334
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseContainer, {
|
|
335
|
+
selected: selected,
|
|
336
|
+
shape: "square",
|
|
337
|
+
className: interactionState,
|
|
338
|
+
interactionState: interactionState,
|
|
339
|
+
children: [
|
|
340
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseIconWrapper, {
|
|
341
|
+
backgroundColor: "var(--canvas-error-background)",
|
|
342
|
+
shape: "square",
|
|
343
|
+
height: height,
|
|
344
|
+
width: width ?? height,
|
|
345
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
346
|
+
icon: "circle-alert",
|
|
347
|
+
size: 32,
|
|
348
|
+
color: "var(--canvas-error-icon)"
|
|
349
|
+
})
|
|
350
|
+
}),
|
|
351
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseTextContainer, {
|
|
352
|
+
shape: "square",
|
|
353
|
+
children: [
|
|
354
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseHeader, {
|
|
355
|
+
shape: "square",
|
|
356
|
+
children: "Manifest not found"
|
|
357
|
+
}),
|
|
358
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseSubHeader, {
|
|
359
|
+
children: [
|
|
360
|
+
'Node type "',
|
|
361
|
+
type,
|
|
362
|
+
'" is not registered'
|
|
363
|
+
]
|
|
364
|
+
})
|
|
365
|
+
]
|
|
366
|
+
})
|
|
367
|
+
]
|
|
383
368
|
})
|
|
384
369
|
});
|
|
385
370
|
const nodeContent = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
386
371
|
ref: containerRef,
|
|
387
|
-
|
|
388
|
-
|
|
372
|
+
style: {
|
|
373
|
+
position: 'relative'
|
|
374
|
+
},
|
|
389
375
|
onMouseEnter: handleMouseEnter,
|
|
390
376
|
onMouseLeave: handleMouseLeave,
|
|
391
377
|
onFocus: handleFocus,
|
|
392
378
|
onBlur: handleBlur,
|
|
393
379
|
children: [
|
|
394
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
380
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseContainer, {
|
|
381
|
+
selected: selected,
|
|
395
382
|
shape: displayShape,
|
|
396
|
-
|
|
397
|
-
isHovered: isHovered,
|
|
383
|
+
className: (0, index_cjs_namespaceObject.cx)(executionStatus, interactionState),
|
|
398
384
|
interactionState: interactionState,
|
|
399
385
|
executionStatus: executionStatus,
|
|
400
386
|
validationStatus: validationState?.validationStatus,
|
|
401
387
|
suggestionType: suggestionType,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
388
|
+
width: width,
|
|
389
|
+
height: height,
|
|
390
|
+
backgroundColor: displayBackground,
|
|
391
|
+
hasFooter: !!displayFooter,
|
|
392
|
+
footerVariant: displayFooterVariant,
|
|
393
|
+
"aria-busy": data.loading || void 0,
|
|
405
394
|
children: [
|
|
406
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
395
|
+
data.loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseSkeletonIcon, {
|
|
396
|
+
"data-testid": "skeleton-icon",
|
|
397
|
+
shape: displayShape,
|
|
398
|
+
nodeHeight: displayFooter ? void 0 : height,
|
|
399
|
+
nodeWidth: displayFooter ? void 0 : width ?? height
|
|
400
|
+
}) : Icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseIconWrapper, {
|
|
401
|
+
shape: displayShape,
|
|
407
402
|
color: displayColor,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
403
|
+
backgroundColor: displayIconBackground,
|
|
404
|
+
height: displayFooter ? void 0 : height,
|
|
405
|
+
width: displayFooter ? void 0 : width ?? height,
|
|
406
|
+
children: Icon
|
|
411
407
|
}),
|
|
412
|
-
adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
408
|
+
adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
413
409
|
position: "top-left",
|
|
414
410
|
shape: displayShape,
|
|
415
411
|
children: adornments.topLeft
|
|
416
412
|
}),
|
|
417
|
-
adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
413
|
+
adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
418
414
|
position: "top-right",
|
|
419
415
|
shape: displayShape,
|
|
420
416
|
children: adornments.topRight
|
|
421
417
|
}),
|
|
422
|
-
adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
418
|
+
adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
423
419
|
position: "bottom-right",
|
|
424
420
|
shape: displayShape,
|
|
425
421
|
children: adornments.bottomRight
|
|
426
422
|
}),
|
|
427
|
-
adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
423
|
+
adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
428
424
|
position: "bottom-left",
|
|
429
425
|
shape: displayShape,
|
|
430
426
|
children: adornments.bottomLeft
|
|
@@ -442,7 +438,12 @@ const BaseNodeComponent = (props)=>{
|
|
|
442
438
|
onChange: handleLabelChange
|
|
443
439
|
}),
|
|
444
440
|
displayFooter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
445
|
-
|
|
441
|
+
style: {
|
|
442
|
+
flexBasis: '100%',
|
|
443
|
+
paddingTop: '2px',
|
|
444
|
+
minWidth: 0,
|
|
445
|
+
overflow: 'hidden'
|
|
446
|
+
},
|
|
446
447
|
children: displayFooter
|
|
447
448
|
})
|
|
448
449
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAkB,MAAM,0CAA0C,CAAC;AAkChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AA+hB1B,eAAO,MAAM,QAAQ,8CAzhBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAyhBhB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../../utils/index.js";
|
|
2
3
|
import { Position, useReactFlow, useStore, useUpdateNodeInternals } from "../../xyflow/react.js";
|
|
3
4
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { DEFAULT_NODE_SIZE
|
|
5
|
+
import { DEFAULT_NODE_SIZE } from "../../constants.js";
|
|
5
6
|
import { useNodeTypeRegistry } from "../../core/index.js";
|
|
6
7
|
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
7
8
|
import { resolveAdornments } from "../../utils/adornment-resolver.js";
|
|
8
|
-
import { getIcon } from "../../utils/icon-registry.js";
|
|
9
|
+
import { CanvasIcon, getIcon } from "../../utils/icon-registry.js";
|
|
9
10
|
import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
|
|
10
11
|
import { resolveToolbar } from "../../utils/toolbar-resolver.js";
|
|
11
12
|
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
@@ -15,31 +16,10 @@ import { useSelectionState } from "../BaseCanvas/SelectionStateContext.js";
|
|
|
15
16
|
import { SmartHandle, SmartHandleProvider } from "../ButtonHandle/SmartHandle.js";
|
|
16
17
|
import { useButtonHandles } from "../ButtonHandle/useButtonHandles.js";
|
|
17
18
|
import { NodeToolbar } from "../Toolbar/index.js";
|
|
18
|
-
import { BaseBadgeSlot } from "./
|
|
19
|
+
import { BaseBadgeSlot, BaseContainer, BaseHeader, BaseIconWrapper, BaseSkeletonIcon, BaseSubHeader, BaseTextContainer } from "./BaseNode.styles.js";
|
|
19
20
|
import { useBaseNodeOverrideConfig } from "./BaseNodeConfigContext.js";
|
|
20
|
-
import { BaseContainer } from "./BaseNodeContainer.js";
|
|
21
|
-
import { BaseInnerShape } from "./BaseNodeInnerShape.js";
|
|
22
|
-
import { MissingManifestNode } from "./BaseNodeMissingManifest.js";
|
|
23
21
|
import { NodeLabel } from "./NodeLabel.js";
|
|
24
22
|
const selectIsConnecting = (state)=>!!state.connectionClickStartHandle;
|
|
25
|
-
const getContainerWidth = (shape, width)=>{
|
|
26
|
-
const defaultWidth = 'rectangle' === shape ? DEFAULT_RECTANGLE_NODE_WIDTH : DEFAULT_NODE_SIZE;
|
|
27
|
-
if (width && width !== DEFAULT_NODE_SIZE && width !== DEFAULT_RECTANGLE_NODE_WIDTH) return width;
|
|
28
|
-
return defaultWidth;
|
|
29
|
-
};
|
|
30
|
-
const getContainerHeight = (height, hasFooter, footerVariant)=>{
|
|
31
|
-
if (hasFooter) switch(footerVariant){
|
|
32
|
-
case 'button':
|
|
33
|
-
return NODE_HEIGHT_FOOTER_BUTTON;
|
|
34
|
-
case 'single':
|
|
35
|
-
return NODE_HEIGHT_FOOTER_SINGLE;
|
|
36
|
-
case 'double':
|
|
37
|
-
return NODE_HEIGHT_FOOTER_DOUBLE;
|
|
38
|
-
default:
|
|
39
|
-
return 'auto';
|
|
40
|
-
}
|
|
41
|
-
return height || NODE_HEIGHT_DEFAULT;
|
|
42
|
-
};
|
|
43
23
|
const BaseNodeComponent = (props)=>{
|
|
44
24
|
const { type, data, selected, id, dragging, width, height } = props;
|
|
45
25
|
const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = useBaseNodeOverrideConfig();
|
|
@@ -147,7 +127,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
147
127
|
statusContext
|
|
148
128
|
]);
|
|
149
129
|
const computedHeight = useMemo(()=>{
|
|
150
|
-
const handleSpacing =
|
|
130
|
+
const handleSpacing = 32;
|
|
151
131
|
const leftHandles = handleConfigurations.filter((config)=>config.position === Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
|
|
152
132
|
const rightHandles = handleConfigurations.filter((config)=>config.position === Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
|
|
153
133
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
@@ -201,31 +181,6 @@ const BaseNodeComponent = (props)=>{
|
|
|
201
181
|
display.subLabel
|
|
202
182
|
]);
|
|
203
183
|
const displayFooter = footerComponent;
|
|
204
|
-
const hasFooter = !!displayFooter;
|
|
205
|
-
const containerWidth = getContainerWidth(displayShape, width);
|
|
206
|
-
const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
|
|
207
|
-
const nodeVars = useMemo(()=>{
|
|
208
|
-
const numH = 'number' == typeof containerHeight ? containerHeight : void 0;
|
|
209
|
-
const radiusBasis = 'rectangle' === displayShape ? numH ?? DEFAULT_NODE_SIZE : Math.min(containerWidth, numH ?? DEFAULT_NODE_SIZE);
|
|
210
|
-
const nodeRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${radiusBasis * NODE_CONTAINER_RADIUS_RATIO}px`;
|
|
211
|
-
const effectiveH = hasFooter ? DEFAULT_NODE_SIZE : numH ?? DEFAULT_NODE_SIZE;
|
|
212
|
-
const effectiveW = hasFooter ? DEFAULT_NODE_SIZE : containerWidth;
|
|
213
|
-
const basis = 'rectangle' === displayShape ? effectiveH : Math.min(effectiveW, effectiveH);
|
|
214
|
-
const innerRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${basis * NODE_INNER_RADIUS_RATIO}px`;
|
|
215
|
-
return {
|
|
216
|
-
'--node-w': `${containerWidth}px`,
|
|
217
|
-
'--node-h': numH ? `${numH}px` : 'auto',
|
|
218
|
-
'--node-radius': nodeRadius,
|
|
219
|
-
'--inner-size': `${basis * NODE_INNER_SHAPE_RATIO}px`,
|
|
220
|
-
'--inner-radius': innerRadius,
|
|
221
|
-
'--icon-size': `${basis * NODE_INNER_ICON_RATIO}px`
|
|
222
|
-
};
|
|
223
|
-
}, [
|
|
224
|
-
containerWidth,
|
|
225
|
-
containerHeight,
|
|
226
|
-
displayShape,
|
|
227
|
-
hasFooter
|
|
228
|
-
]);
|
|
229
184
|
const interactionState = useMemo(()=>{
|
|
230
185
|
if (disabled) return 'disabled';
|
|
231
186
|
if (dragging) return 'drag';
|
|
@@ -341,45 +296,86 @@ const BaseNodeComponent = (props)=>{
|
|
|
341
296
|
const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
|
|
342
297
|
if (!manifest) return /*#__PURE__*/ jsx("div", {
|
|
343
298
|
ref: containerRef,
|
|
344
|
-
|
|
345
|
-
|
|
299
|
+
style: {
|
|
300
|
+
position: 'relative'
|
|
301
|
+
},
|
|
346
302
|
onMouseEnter: handleMouseEnter,
|
|
347
303
|
onMouseLeave: handleMouseLeave,
|
|
348
304
|
onFocus: handleFocus,
|
|
349
305
|
onBlur: handleBlur,
|
|
350
|
-
children: /*#__PURE__*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
interactionState: interactionState
|
|
306
|
+
children: /*#__PURE__*/ jsxs(BaseContainer, {
|
|
307
|
+
selected: selected,
|
|
308
|
+
shape: "square",
|
|
309
|
+
className: interactionState,
|
|
310
|
+
interactionState: interactionState,
|
|
311
|
+
children: [
|
|
312
|
+
/*#__PURE__*/ jsx(BaseIconWrapper, {
|
|
313
|
+
backgroundColor: "var(--canvas-error-background)",
|
|
314
|
+
shape: "square",
|
|
315
|
+
height: height,
|
|
316
|
+
width: width ?? height,
|
|
317
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
318
|
+
icon: "circle-alert",
|
|
319
|
+
size: 32,
|
|
320
|
+
color: "var(--canvas-error-icon)"
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
/*#__PURE__*/ jsxs(BaseTextContainer, {
|
|
324
|
+
shape: "square",
|
|
325
|
+
children: [
|
|
326
|
+
/*#__PURE__*/ jsx(BaseHeader, {
|
|
327
|
+
shape: "square",
|
|
328
|
+
children: "Manifest not found"
|
|
329
|
+
}),
|
|
330
|
+
/*#__PURE__*/ jsxs(BaseSubHeader, {
|
|
331
|
+
children: [
|
|
332
|
+
'Node type "',
|
|
333
|
+
type,
|
|
334
|
+
'" is not registered'
|
|
335
|
+
]
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
})
|
|
339
|
+
]
|
|
355
340
|
})
|
|
356
341
|
});
|
|
357
342
|
const nodeContent = /*#__PURE__*/ jsxs("div", {
|
|
358
343
|
ref: containerRef,
|
|
359
|
-
|
|
360
|
-
|
|
344
|
+
style: {
|
|
345
|
+
position: 'relative'
|
|
346
|
+
},
|
|
361
347
|
onMouseEnter: handleMouseEnter,
|
|
362
348
|
onMouseLeave: handleMouseLeave,
|
|
363
349
|
onFocus: handleFocus,
|
|
364
350
|
onBlur: handleBlur,
|
|
365
351
|
children: [
|
|
366
352
|
/*#__PURE__*/ jsxs(BaseContainer, {
|
|
353
|
+
selected: selected,
|
|
367
354
|
shape: displayShape,
|
|
368
|
-
|
|
369
|
-
isHovered: isHovered,
|
|
355
|
+
className: cx(executionStatus, interactionState),
|
|
370
356
|
interactionState: interactionState,
|
|
371
357
|
executionStatus: executionStatus,
|
|
372
358
|
validationStatus: validationState?.validationStatus,
|
|
373
359
|
suggestionType: suggestionType,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
360
|
+
width: width,
|
|
361
|
+
height: height,
|
|
362
|
+
backgroundColor: displayBackground,
|
|
363
|
+
hasFooter: !!displayFooter,
|
|
364
|
+
footerVariant: displayFooterVariant,
|
|
365
|
+
"aria-busy": data.loading || void 0,
|
|
377
366
|
children: [
|
|
378
|
-
/*#__PURE__*/ jsx(
|
|
367
|
+
data.loading ? /*#__PURE__*/ jsx(BaseSkeletonIcon, {
|
|
368
|
+
"data-testid": "skeleton-icon",
|
|
369
|
+
shape: displayShape,
|
|
370
|
+
nodeHeight: displayFooter ? void 0 : height,
|
|
371
|
+
nodeWidth: displayFooter ? void 0 : width ?? height
|
|
372
|
+
}) : Icon && /*#__PURE__*/ jsx(BaseIconWrapper, {
|
|
373
|
+
shape: displayShape,
|
|
379
374
|
color: displayColor,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
375
|
+
backgroundColor: displayIconBackground,
|
|
376
|
+
height: displayFooter ? void 0 : height,
|
|
377
|
+
width: displayFooter ? void 0 : width ?? height,
|
|
378
|
+
children: Icon
|
|
383
379
|
}),
|
|
384
380
|
adornments?.topLeft && /*#__PURE__*/ jsx(BaseBadgeSlot, {
|
|
385
381
|
position: "top-left",
|
|
@@ -414,7 +410,12 @@ const BaseNodeComponent = (props)=>{
|
|
|
414
410
|
onChange: handleLabelChange
|
|
415
411
|
}),
|
|
416
412
|
displayFooter && /*#__PURE__*/ jsx("div", {
|
|
417
|
-
|
|
413
|
+
style: {
|
|
414
|
+
flexBasis: '100%',
|
|
415
|
+
paddingTop: '2px',
|
|
416
|
+
minWidth: 0,
|
|
417
|
+
overflow: 'hidden'
|
|
418
|
+
},
|
|
418
419
|
children: displayFooter
|
|
419
420
|
})
|
|
420
421
|
]
|