@uipath/apollo-react 4.5.4-pr525.f7c19ae → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/BaseNode/BaseNode.cjs +74 -55
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +69 -50
- 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/NodeLabel.cjs +18 -63
- 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 -57
- 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/FloatingCanvasPanel/FloatingCanvasPanel.cjs +3 -2
- package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.d.ts +2 -1
- package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.d.ts.map +1 -1
- package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.js +3 -2
- package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.cjs +4 -2
- package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.d.ts +2 -1
- package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.d.ts.map +1 -1
- package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.js +4 -2
- 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 -67
- 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 -33
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +0 -87
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +0 -23
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +0 -50
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +0 -65
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +0 -14
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +0 -31
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +0 -67
- 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 -33
- package/dist/canvas/styles/reactflow-reset.css +0 -12
|
@@ -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);
|
|
@@ -344,69 +324,103 @@ const BaseNodeComponent = (props)=>{
|
|
|
344
324
|
const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
|
|
345
325
|
if (!manifest) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
346
326
|
ref: containerRef,
|
|
347
|
-
|
|
327
|
+
style: {
|
|
328
|
+
position: 'relative'
|
|
329
|
+
},
|
|
348
330
|
onMouseEnter: handleMouseEnter,
|
|
349
331
|
onMouseLeave: handleMouseLeave,
|
|
350
332
|
onFocus: handleFocus,
|
|
351
333
|
onBlur: handleBlur,
|
|
352
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
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
|
+
]
|
|
357
368
|
})
|
|
358
369
|
});
|
|
359
|
-
const hasFooter = !!displayFooter;
|
|
360
|
-
const containerWidth = getContainerWidth(displayShape, width);
|
|
361
|
-
const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
|
|
362
370
|
const nodeContent = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
363
371
|
ref: containerRef,
|
|
364
|
-
|
|
372
|
+
style: {
|
|
373
|
+
position: 'relative'
|
|
374
|
+
},
|
|
365
375
|
onMouseEnter: handleMouseEnter,
|
|
366
376
|
onMouseLeave: handleMouseLeave,
|
|
367
377
|
onFocus: handleFocus,
|
|
368
378
|
onBlur: handleBlur,
|
|
369
379
|
children: [
|
|
370
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
380
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseContainer, {
|
|
381
|
+
selected: selected,
|
|
371
382
|
shape: displayShape,
|
|
372
|
-
|
|
373
|
-
isHovered: isHovered,
|
|
383
|
+
className: (0, index_cjs_namespaceObject.cx)(executionStatus, interactionState),
|
|
374
384
|
interactionState: interactionState,
|
|
375
385
|
executionStatus: executionStatus,
|
|
376
386
|
validationStatus: validationState?.validationStatus,
|
|
377
387
|
suggestionType: suggestionType,
|
|
378
|
-
width:
|
|
379
|
-
height:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
388
|
+
width: width,
|
|
389
|
+
height: height,
|
|
390
|
+
backgroundColor: displayBackground,
|
|
391
|
+
hasFooter: !!displayFooter,
|
|
392
|
+
footerVariant: displayFooterVariant,
|
|
393
|
+
"aria-busy": data.loading || void 0,
|
|
383
394
|
children: [
|
|
384
|
-
/*#__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, {
|
|
385
401
|
shape: displayShape,
|
|
386
402
|
color: displayColor,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
containerHeight: 'number' == typeof containerHeight ? containerHeight : void 0,
|
|
392
|
-
children: data.loading ? null : Icon
|
|
403
|
+
backgroundColor: displayIconBackground,
|
|
404
|
+
height: displayFooter ? void 0 : height,
|
|
405
|
+
width: displayFooter ? void 0 : width ?? height,
|
|
406
|
+
children: Icon
|
|
393
407
|
}),
|
|
394
|
-
adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
408
|
+
adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
395
409
|
position: "top-left",
|
|
396
410
|
shape: displayShape,
|
|
397
411
|
children: adornments.topLeft
|
|
398
412
|
}),
|
|
399
|
-
adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
413
|
+
adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
400
414
|
position: "top-right",
|
|
401
415
|
shape: displayShape,
|
|
402
416
|
children: adornments.topRight
|
|
403
417
|
}),
|
|
404
|
-
adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
418
|
+
adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
405
419
|
position: "bottom-right",
|
|
406
420
|
shape: displayShape,
|
|
407
421
|
children: adornments.bottomRight
|
|
408
422
|
}),
|
|
409
|
-
adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
423
|
+
adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
|
|
410
424
|
position: "bottom-left",
|
|
411
425
|
shape: displayShape,
|
|
412
426
|
children: adornments.bottomLeft
|
|
@@ -424,7 +438,12 @@ const BaseNodeComponent = (props)=>{
|
|
|
424
438
|
onChange: handleLabelChange
|
|
425
439
|
}),
|
|
426
440
|
displayFooter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
427
|
-
|
|
441
|
+
style: {
|
|
442
|
+
flexBasis: '100%',
|
|
443
|
+
paddingTop: '2px',
|
|
444
|
+
minWidth: 0,
|
|
445
|
+
overflow: 'hidden'
|
|
446
|
+
},
|
|
428
447
|
children: displayFooter
|
|
429
448
|
})
|
|
430
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);
|
|
@@ -316,52 +296,86 @@ const BaseNodeComponent = (props)=>{
|
|
|
316
296
|
const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
|
|
317
297
|
if (!manifest) return /*#__PURE__*/ jsx("div", {
|
|
318
298
|
ref: containerRef,
|
|
319
|
-
|
|
299
|
+
style: {
|
|
300
|
+
position: 'relative'
|
|
301
|
+
},
|
|
320
302
|
onMouseEnter: handleMouseEnter,
|
|
321
303
|
onMouseLeave: handleMouseLeave,
|
|
322
304
|
onFocus: handleFocus,
|
|
323
305
|
onBlur: handleBlur,
|
|
324
|
-
children: /*#__PURE__*/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
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
|
+
]
|
|
329
340
|
})
|
|
330
341
|
});
|
|
331
|
-
const hasFooter = !!displayFooter;
|
|
332
|
-
const containerWidth = getContainerWidth(displayShape, width);
|
|
333
|
-
const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
|
|
334
342
|
const nodeContent = /*#__PURE__*/ jsxs("div", {
|
|
335
343
|
ref: containerRef,
|
|
336
|
-
|
|
344
|
+
style: {
|
|
345
|
+
position: 'relative'
|
|
346
|
+
},
|
|
337
347
|
onMouseEnter: handleMouseEnter,
|
|
338
348
|
onMouseLeave: handleMouseLeave,
|
|
339
349
|
onFocus: handleFocus,
|
|
340
350
|
onBlur: handleBlur,
|
|
341
351
|
children: [
|
|
342
352
|
/*#__PURE__*/ jsxs(BaseContainer, {
|
|
353
|
+
selected: selected,
|
|
343
354
|
shape: displayShape,
|
|
344
|
-
|
|
345
|
-
isHovered: isHovered,
|
|
355
|
+
className: cx(executionStatus, interactionState),
|
|
346
356
|
interactionState: interactionState,
|
|
347
357
|
executionStatus: executionStatus,
|
|
348
358
|
validationStatus: validationState?.validationStatus,
|
|
349
359
|
suggestionType: suggestionType,
|
|
350
|
-
width:
|
|
351
|
-
height:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
360
|
+
width: width,
|
|
361
|
+
height: height,
|
|
362
|
+
backgroundColor: displayBackground,
|
|
363
|
+
hasFooter: !!displayFooter,
|
|
364
|
+
footerVariant: displayFooterVariant,
|
|
365
|
+
"aria-busy": data.loading || void 0,
|
|
355
366
|
children: [
|
|
356
|
-
/*#__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, {
|
|
357
373
|
shape: displayShape,
|
|
358
374
|
color: displayColor,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
containerHeight: 'number' == typeof containerHeight ? containerHeight : void 0,
|
|
364
|
-
children: data.loading ? null : Icon
|
|
375
|
+
backgroundColor: displayIconBackground,
|
|
376
|
+
height: displayFooter ? void 0 : height,
|
|
377
|
+
width: displayFooter ? void 0 : width ?? height,
|
|
378
|
+
children: Icon
|
|
365
379
|
}),
|
|
366
380
|
adornments?.topLeft && /*#__PURE__*/ jsx(BaseBadgeSlot, {
|
|
367
381
|
position: "top-left",
|
|
@@ -396,7 +410,12 @@ const BaseNodeComponent = (props)=>{
|
|
|
396
410
|
onChange: handleLabelChange
|
|
397
411
|
}),
|
|
398
412
|
displayFooter && /*#__PURE__*/ jsx("div", {
|
|
399
|
-
|
|
413
|
+
style: {
|
|
414
|
+
flexBasis: '100%',
|
|
415
|
+
paddingTop: '2px',
|
|
416
|
+
minWidth: 0,
|
|
417
|
+
overflow: 'hidden'
|
|
418
|
+
},
|
|
400
419
|
children: displayFooter
|
|
401
420
|
})
|
|
402
421
|
]
|