@hitachivantara/uikit-react-lab 5.46.13 → 6.0.0-next.2
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/{esm/Flow → Flow}/Background/Background.js +1 -1
- package/dist/{esm/Flow → Flow}/Empty/Empty.styles.js +1 -1
- package/dist/{esm/Flow → Flow}/Node/Node.js +0 -3
- package/dist/{esm/Flow → Flow}/Sidebar/Sidebar.js +1 -1
- package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/DefaultNavigation.js +1 -3
- package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/SimpleNavigation.js +1 -3
- package/dist/{esm/StepNavigation → StepNavigation}/StepNavigation.js +2 -7
- package/dist/{esm/Wizard → Wizard}/WizardTitle/WizardTitle.js +31 -47
- package/dist/{esm/Wizard → Wizard}/WizardTitle/WizardTitle.styles.js +0 -10
- package/dist/{types/index.d.ts → index.d.ts} +12 -28
- package/package.json +14 -14
- package/dist/cjs/Blade/Blade.cjs +0 -174
- package/dist/cjs/Blade/Blade.styles.cjs +0 -71
- package/dist/cjs/Blades/Blades.cjs +0 -104
- package/dist/cjs/Blades/Blades.styles.cjs +0 -11
- package/dist/cjs/Dashboard/Dashboard.cjs +0 -63
- package/dist/cjs/Dashboard/Dashboard.styles.cjs +0 -196
- package/dist/cjs/Flow/Background/Background.cjs +0 -19
- package/dist/cjs/Flow/Controls/Controls.cjs +0 -96
- package/dist/cjs/Flow/DroppableFlow.cjs +0 -204
- package/dist/cjs/Flow/Empty/Empty.cjs +0 -12
- package/dist/cjs/Flow/Empty/Empty.styles.cjs +0 -16
- package/dist/cjs/Flow/Flow.cjs +0 -33
- package/dist/cjs/Flow/Flow.styles.cjs +0 -19
- package/dist/cjs/Flow/FlowContext/FlowContext.cjs +0 -25
- package/dist/cjs/Flow/FlowContext/NodeMetaContext.cjs +0 -43
- package/dist/cjs/Flow/Minimap/Minimap.cjs +0 -30
- package/dist/cjs/Flow/Minimap/Minimap.styles.cjs +0 -10
- package/dist/cjs/Flow/Node/BaseNode.cjs +0 -192
- package/dist/cjs/Flow/Node/BaseNode.styles.cjs +0 -135
- package/dist/cjs/Flow/Node/Node.cjs +0 -115
- package/dist/cjs/Flow/Node/Node.styles.cjs +0 -42
- package/dist/cjs/Flow/Node/Parameters/ParamRenderer.cjs +0 -19
- package/dist/cjs/Flow/Node/Parameters/Select.cjs +0 -41
- package/dist/cjs/Flow/Node/Parameters/Slider.cjs +0 -33
- package/dist/cjs/Flow/Node/Parameters/Text.cjs +0 -19
- package/dist/cjs/Flow/Node/utils.cjs +0 -54
- package/dist/cjs/Flow/Sidebar/Sidebar.cjs +0 -141
- package/dist/cjs/Flow/Sidebar/Sidebar.styles.cjs +0 -24
- package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroup.cjs +0 -62
- package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroup.styles.cjs +0 -34
- package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.cjs +0 -51
- package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.cjs +0 -35
- package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.cjs +0 -23
- package/dist/cjs/Flow/base.cjs +0 -411
- package/dist/cjs/Flow/hooks/useFlowContext.cjs +0 -6
- package/dist/cjs/Flow/hooks/useFlowInstance.cjs +0 -7
- package/dist/cjs/Flow/hooks/useFlowNode.cjs +0 -134
- package/dist/cjs/Flow/hooks/useFlowNodeMeta.cjs +0 -10
- package/dist/cjs/Flow/hooks/useNode.cjs +0 -159
- package/dist/cjs/Flow/hooks/useNodeId.cjs +0 -8
- package/dist/cjs/Flow/nodes/DashboardNode.cjs +0 -88
- package/dist/cjs/Flow/nodes/DashboardNode.styles.cjs +0 -16
- package/dist/cjs/Flow/nodes/StickyNode.cjs +0 -441
- package/dist/cjs/StepNavigation/DefaultNavigation/DefaultNavigation.cjs +0 -56
- package/dist/cjs/StepNavigation/DefaultNavigation/Step/Step.cjs +0 -78
- package/dist/cjs/StepNavigation/DefaultNavigation/Step/Step.styles.cjs +0 -35
- package/dist/cjs/StepNavigation/DefaultNavigation/utils.cjs +0 -34
- package/dist/cjs/StepNavigation/SimpleNavigation/Dot/Dot.cjs +0 -43
- package/dist/cjs/StepNavigation/SimpleNavigation/Dot/Dot.styles.cjs +0 -18
- package/dist/cjs/StepNavigation/SimpleNavigation/SimpleNavigation.cjs +0 -52
- package/dist/cjs/StepNavigation/SimpleNavigation/utils.cjs +0 -13
- package/dist/cjs/StepNavigation/StepNavigation.cjs +0 -188
- package/dist/cjs/StepNavigation/StepNavigation.styles.cjs +0 -34
- package/dist/cjs/StepNavigation/utils.cjs +0 -8
- package/dist/cjs/Wizard/Wizard.cjs +0 -108
- package/dist/cjs/Wizard/Wizard.styles.cjs +0 -8
- package/dist/cjs/Wizard/WizardActions/WizardActions.cjs +0 -132
- package/dist/cjs/Wizard/WizardActions/WizardActions.styles.cjs +0 -22
- package/dist/cjs/Wizard/WizardContainer/WizardContainer.cjs +0 -31
- package/dist/cjs/Wizard/WizardContainer/WizardContainer.styles.cjs +0 -15
- package/dist/cjs/Wizard/WizardContent/WizardContent.cjs +0 -121
- package/dist/cjs/Wizard/WizardContent/WizardContent.styles.cjs +0 -38
- package/dist/cjs/Wizard/WizardContext/WizardContext.cjs +0 -15
- package/dist/cjs/Wizard/WizardTitle/WizardTitle.cjs +0 -97
- package/dist/cjs/Wizard/WizardTitle/WizardTitle.styles.cjs +0 -27
- package/dist/cjs/index.cjs +0 -93
- /package/dist/{esm/Blade → Blade}/Blade.js +0 -0
- /package/dist/{esm/Blade → Blade}/Blade.styles.js +0 -0
- /package/dist/{esm/Blades → Blades}/Blades.js +0 -0
- /package/dist/{esm/Blades → Blades}/Blades.styles.js +0 -0
- /package/dist/{esm/Dashboard → Dashboard}/Dashboard.js +0 -0
- /package/dist/{esm/Dashboard → Dashboard}/Dashboard.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Controls/Controls.js +0 -0
- /package/dist/{esm/Flow → Flow}/DroppableFlow.js +0 -0
- /package/dist/{esm/Flow → Flow}/Empty/Empty.js +0 -0
- /package/dist/{esm/Flow → Flow}/Flow.js +0 -0
- /package/dist/{esm/Flow → Flow}/Flow.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/FlowContext/FlowContext.js +0 -0
- /package/dist/{esm/Flow → Flow}/FlowContext/NodeMetaContext.js +0 -0
- /package/dist/{esm/Flow → Flow}/Minimap/Minimap.js +0 -0
- /package/dist/{esm/Flow → Flow}/Minimap/Minimap.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/BaseNode.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/BaseNode.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/Node.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/Parameters/ParamRenderer.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/Parameters/Select.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/Parameters/Slider.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/Parameters/Text.js +0 -0
- /package/dist/{esm/Flow → Flow}/Node/utils.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/Sidebar.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroup.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroup.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.js +0 -0
- /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/base.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useFlowContext.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useFlowInstance.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useFlowNode.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useFlowNodeMeta.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useNode.js +0 -0
- /package/dist/{esm/Flow → Flow}/hooks/useNodeId.js +0 -0
- /package/dist/{esm/Flow → Flow}/nodes/DashboardNode.js +0 -0
- /package/dist/{esm/Flow → Flow}/nodes/DashboardNode.styles.js +0 -0
- /package/dist/{esm/Flow → Flow}/nodes/StickyNode.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/Step/Step.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/Step/Step.styles.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/utils.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/Dot/Dot.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/Dot/Dot.styles.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/utils.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/StepNavigation.styles.js +0 -0
- /package/dist/{esm/StepNavigation → StepNavigation}/utils.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/Wizard.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/Wizard.styles.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardActions/WizardActions.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardActions/WizardActions.styles.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardContainer/WizardContainer.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardContainer/WizardContainer.styles.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardContent/WizardContent.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardContent/WizardContent.styles.js +0 -0
- /package/dist/{esm/Wizard → Wizard}/WizardContext/WizardContext.js +0 -0
- /package/dist/{esm/index.js → index.js} +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const reactflow = require("reactflow");
|
|
5
|
-
const shallow = require("zustand/shallow");
|
|
6
|
-
const useFlowInstance = require("./useFlowInstance.cjs");
|
|
7
|
-
const useNodeId = require("./useNodeId.cjs");
|
|
8
|
-
function relativePosition(positionA, positionB) {
|
|
9
|
-
if (positionA && positionB)
|
|
10
|
-
return {
|
|
11
|
-
x: positionB.x - positionA.x,
|
|
12
|
-
y: positionB.y - positionA.y
|
|
13
|
-
};
|
|
14
|
-
return { x: 0, y: 0 };
|
|
15
|
-
}
|
|
16
|
-
function useFlowNode(id) {
|
|
17
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
18
|
-
const nodeSelector = react.useCallback(
|
|
19
|
-
(state) => state.getNodes().find((n) => n.id === nodeId),
|
|
20
|
-
[nodeId]
|
|
21
|
-
);
|
|
22
|
-
return reactflow.useStore(nodeSelector, shallow.shallow);
|
|
23
|
-
}
|
|
24
|
-
function useFlowNodeInputEdges(id) {
|
|
25
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
26
|
-
const inputEdgesSelector = react.useCallback(
|
|
27
|
-
(state) => state.edges.filter((e) => e.target === nodeId),
|
|
28
|
-
[nodeId]
|
|
29
|
-
);
|
|
30
|
-
return reactflow.useStore(inputEdgesSelector, shallow.shallow);
|
|
31
|
-
}
|
|
32
|
-
function useFlowNodeOutputEdges(id) {
|
|
33
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
34
|
-
const outputEdgesSelector = react.useCallback(
|
|
35
|
-
(state) => state.edges.filter((e) => e.source === nodeId),
|
|
36
|
-
[nodeId]
|
|
37
|
-
);
|
|
38
|
-
return reactflow.useStore(outputEdgesSelector, shallow.shallow);
|
|
39
|
-
}
|
|
40
|
-
function useFlowNodeEdges(id) {
|
|
41
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
42
|
-
const edgesSelector = react.useCallback(
|
|
43
|
-
(state) => state.edges.filter(
|
|
44
|
-
(e) => e.source === nodeId || e.target === nodeId
|
|
45
|
-
),
|
|
46
|
-
[nodeId]
|
|
47
|
-
);
|
|
48
|
-
return reactflow.useStore(edgesSelector, shallow.shallow);
|
|
49
|
-
}
|
|
50
|
-
function useFlowNodeParents(id) {
|
|
51
|
-
const inputEdges = useFlowNodeInputEdges(id);
|
|
52
|
-
const parentNodesSelector = react.useCallback(
|
|
53
|
-
(state) => {
|
|
54
|
-
return inputEdges.map((e) => state.getNodes().find((n) => n.id === e.source)).filter((n) => n !== null);
|
|
55
|
-
},
|
|
56
|
-
[inputEdges]
|
|
57
|
-
);
|
|
58
|
-
return reactflow.useStore(parentNodesSelector, shallow.shallow);
|
|
59
|
-
}
|
|
60
|
-
function useFlowInputNodes(id) {
|
|
61
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
62
|
-
const nodes = reactflow.useNodes();
|
|
63
|
-
const edges = reactflow.useEdges();
|
|
64
|
-
return react.useMemo(() => {
|
|
65
|
-
return edges.filter((e) => e.target === nodeId).map((e) => nodes.find((n) => n.id === e.source)).filter((n) => n !== null);
|
|
66
|
-
}, [edges, nodeId, nodes]);
|
|
67
|
-
}
|
|
68
|
-
function useFlowOutputNodes(id) {
|
|
69
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
70
|
-
const nodes = reactflow.useNodes();
|
|
71
|
-
const edges = reactflow.useEdges();
|
|
72
|
-
return react.useMemo(() => {
|
|
73
|
-
return edges.filter((e) => e.source === nodeId).map((e) => nodes.find((n) => n.id === e.target)).filter((n) => n !== null);
|
|
74
|
-
}, [edges, nodeId, nodes]);
|
|
75
|
-
}
|
|
76
|
-
function useFlowNodeUtils(id) {
|
|
77
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
78
|
-
const reactFlowInstance = useFlowInstance.useFlowInstance();
|
|
79
|
-
const setNodeData = react.useCallback(
|
|
80
|
-
(setNewData) => {
|
|
81
|
-
if (!nodeId) return;
|
|
82
|
-
reactFlowInstance.setNodes((nodes) => {
|
|
83
|
-
return nodes.map((n) => {
|
|
84
|
-
if (n.id === nodeId) {
|
|
85
|
-
return { ...n, data: setNewData(n.data) };
|
|
86
|
-
}
|
|
87
|
-
return n;
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
[nodeId, reactFlowInstance]
|
|
92
|
-
);
|
|
93
|
-
const setNodeParent = react.useCallback(
|
|
94
|
-
(node, extent) => {
|
|
95
|
-
if (!nodeId) return;
|
|
96
|
-
reactFlowInstance.setNodes((nodes) => {
|
|
97
|
-
return nodes.map((n) => {
|
|
98
|
-
if (n.id === nodeId) {
|
|
99
|
-
return {
|
|
100
|
-
...n,
|
|
101
|
-
parentId: node ? node.id : void 0,
|
|
102
|
-
extent,
|
|
103
|
-
position: node ? relativePosition(node.position, n.position) : n.positionAbsolute ?? n.position
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return n;
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
[nodeId, reactFlowInstance]
|
|
111
|
-
);
|
|
112
|
-
return react.useMemo(
|
|
113
|
-
() => ({
|
|
114
|
-
setNodeData,
|
|
115
|
-
setNodeParent
|
|
116
|
-
}),
|
|
117
|
-
[setNodeData, setNodeParent]
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
function useFlowNodeIntersections(id) {
|
|
121
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
122
|
-
const node = useFlowNode(nodeId ?? "");
|
|
123
|
-
const reactFlowInstance = useFlowInstance.useFlowInstance();
|
|
124
|
-
return node ? reactFlowInstance.getIntersectingNodes(node, false) : [];
|
|
125
|
-
}
|
|
126
|
-
exports.useFlowInputNodes = useFlowInputNodes;
|
|
127
|
-
exports.useFlowNode = useFlowNode;
|
|
128
|
-
exports.useFlowNodeEdges = useFlowNodeEdges;
|
|
129
|
-
exports.useFlowNodeInputEdges = useFlowNodeInputEdges;
|
|
130
|
-
exports.useFlowNodeIntersections = useFlowNodeIntersections;
|
|
131
|
-
exports.useFlowNodeOutputEdges = useFlowNodeOutputEdges;
|
|
132
|
-
exports.useFlowNodeParents = useFlowNodeParents;
|
|
133
|
-
exports.useFlowNodeUtils = useFlowNodeUtils;
|
|
134
|
-
exports.useFlowOutputNodes = useFlowOutputNodes;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const NodeMetaContext = require("../FlowContext/NodeMetaContext.cjs");
|
|
4
|
-
const useNodeId = require("./useNodeId.cjs");
|
|
5
|
-
function useFlowNodeMeta(id) {
|
|
6
|
-
const nodeId = useNodeId.useNodeId(id);
|
|
7
|
-
const { registry } = NodeMetaContext.useNodeMetaRegistry();
|
|
8
|
-
return registry[nodeId];
|
|
9
|
-
}
|
|
10
|
-
exports.useFlowNodeMeta = useFlowNodeMeta;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
|
-
const uid = require("uid");
|
|
6
|
-
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
7
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
8
|
-
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
9
|
-
const NodeMetaContext = require("../FlowContext/NodeMetaContext.cjs");
|
|
10
|
-
const utils = require("../Node/utils.cjs");
|
|
11
|
-
const useFlowContext = require("./useFlowContext.cjs");
|
|
12
|
-
const useFlowInstance = require("./useFlowInstance.cjs");
|
|
13
|
-
const useFlowNode = require("./useFlowNode.cjs");
|
|
14
|
-
const DEFAULT_LABELS = {
|
|
15
|
-
deleteActionLabel: "Delete",
|
|
16
|
-
duplicateActionLabel: "Duplicate"
|
|
17
|
-
};
|
|
18
|
-
function useHvNode(props) {
|
|
19
|
-
const {
|
|
20
|
-
id,
|
|
21
|
-
title: titleProp,
|
|
22
|
-
icon: iconProp,
|
|
23
|
-
color: colorProp,
|
|
24
|
-
subtitle: subtitleProp,
|
|
25
|
-
nodeActions: nodeActionsProp,
|
|
26
|
-
inputs: inputsProp,
|
|
27
|
-
outputs: outputsProp,
|
|
28
|
-
groupId,
|
|
29
|
-
labels: labelsProps,
|
|
30
|
-
nodeToolbarProps
|
|
31
|
-
} = props;
|
|
32
|
-
const { registerNode, unregisterNode } = NodeMetaContext.useNodeMetaRegistry();
|
|
33
|
-
const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProps);
|
|
34
|
-
const inputs = react.useMemo(() => utils.identifyHandles(inputsProp), [inputsProp]);
|
|
35
|
-
const inputEdges = useFlowNode.useFlowNodeInputEdges();
|
|
36
|
-
const outputs = react.useMemo(() => utils.identifyHandles(outputsProp), [outputsProp]);
|
|
37
|
-
const outputEdges = useFlowNode.useFlowNodeOutputEdges();
|
|
38
|
-
const { nodeGroups } = useFlowContext.useFlowContext();
|
|
39
|
-
const intersections = useFlowNode.useFlowNodeIntersections();
|
|
40
|
-
const { setNodeParent, setNodeData } = useFlowNode.useFlowNodeUtils();
|
|
41
|
-
const node = useFlowNode.useFlowNode();
|
|
42
|
-
const reactFlowInstance = useFlowInstance.useFlowInstance();
|
|
43
|
-
const nodeGroup = groupId && nodeGroups && nodeGroups[groupId] || void 0;
|
|
44
|
-
const title = titleProp || nodeGroup?.label;
|
|
45
|
-
const icon = iconProp || nodeGroup?.icon;
|
|
46
|
-
const color = uikitStyles.getColor(colorProp || nodeGroup?.color);
|
|
47
|
-
const iconColor = uikitStyles.getColor(
|
|
48
|
-
react.isValidElement(icon) && icon.props.color || "textDark"
|
|
49
|
-
);
|
|
50
|
-
const subtitle = subtitleProp || node?.data.nodeLabel;
|
|
51
|
-
const [showActions, setShowActions] = react.useState(false);
|
|
52
|
-
const toggleShowActions = react.useCallback(() => {
|
|
53
|
-
setShowActions(!showActions);
|
|
54
|
-
}, [showActions]);
|
|
55
|
-
const getNodeToolbarProps = react.useCallback(
|
|
56
|
-
() => ({
|
|
57
|
-
offset: 0,
|
|
58
|
-
isVisible: showActions,
|
|
59
|
-
...nodeToolbarProps
|
|
60
|
-
}),
|
|
61
|
-
[nodeToolbarProps, showActions]
|
|
62
|
-
);
|
|
63
|
-
const nodeActions = react.useMemo(
|
|
64
|
-
() => nodeActionsProp || [
|
|
65
|
-
{ id: "delete", label: labels?.deleteActionLabel, icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Delete, {}) },
|
|
66
|
-
{
|
|
67
|
-
id: "duplicate",
|
|
68
|
-
label: labels?.duplicateActionLabel,
|
|
69
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Duplicate, {})
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
[labels?.deleteActionLabel, labels?.duplicateActionLabel, nodeActionsProp]
|
|
73
|
-
);
|
|
74
|
-
react.useEffect(() => {
|
|
75
|
-
registerNode(id, {
|
|
76
|
-
label: title || "",
|
|
77
|
-
inputs,
|
|
78
|
-
outputs
|
|
79
|
-
});
|
|
80
|
-
return () => unregisterNode(id);
|
|
81
|
-
}, [id, title, inputs, outputs, registerNode, unregisterNode]);
|
|
82
|
-
const handleDefaultAction = react.useCallback(
|
|
83
|
-
(action) => {
|
|
84
|
-
if (!node) return;
|
|
85
|
-
if (action.callback) {
|
|
86
|
-
action.callback(node);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
switch (action.id) {
|
|
90
|
-
case "delete":
|
|
91
|
-
reactFlowInstance.deleteElements({ nodes: [node] });
|
|
92
|
-
break;
|
|
93
|
-
case "duplicate":
|
|
94
|
-
reactFlowInstance.addNodes([
|
|
95
|
-
{
|
|
96
|
-
...node,
|
|
97
|
-
id: uid.uid(),
|
|
98
|
-
position: {
|
|
99
|
-
x: node.position.x,
|
|
100
|
-
y: node.position.y + (node.height || 0) + 20
|
|
101
|
-
},
|
|
102
|
-
selected: false,
|
|
103
|
-
zIndex: Number(uikitStyles.theme.zIndices.overlay)
|
|
104
|
-
}
|
|
105
|
-
]);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
[node, reactFlowInstance]
|
|
110
|
-
);
|
|
111
|
-
return react.useMemo(
|
|
112
|
-
() => ({
|
|
113
|
-
// state
|
|
114
|
-
id,
|
|
115
|
-
title,
|
|
116
|
-
icon,
|
|
117
|
-
color,
|
|
118
|
-
iconColor,
|
|
119
|
-
subtitle,
|
|
120
|
-
inputs,
|
|
121
|
-
inputEdges,
|
|
122
|
-
outputs,
|
|
123
|
-
outputEdges,
|
|
124
|
-
node,
|
|
125
|
-
nodeActions,
|
|
126
|
-
showActions,
|
|
127
|
-
intersections,
|
|
128
|
-
// prop getters
|
|
129
|
-
getNodeToolbarProps,
|
|
130
|
-
// actions
|
|
131
|
-
toggleShowActions,
|
|
132
|
-
handleDefaultAction,
|
|
133
|
-
setNodeData,
|
|
134
|
-
setNodeParent
|
|
135
|
-
}),
|
|
136
|
-
[
|
|
137
|
-
id,
|
|
138
|
-
title,
|
|
139
|
-
icon,
|
|
140
|
-
color,
|
|
141
|
-
iconColor,
|
|
142
|
-
subtitle,
|
|
143
|
-
inputs,
|
|
144
|
-
inputEdges,
|
|
145
|
-
outputs,
|
|
146
|
-
outputEdges,
|
|
147
|
-
node,
|
|
148
|
-
nodeActions,
|
|
149
|
-
showActions,
|
|
150
|
-
intersections,
|
|
151
|
-
getNodeToolbarProps,
|
|
152
|
-
toggleShowActions,
|
|
153
|
-
handleDefaultAction,
|
|
154
|
-
setNodeData,
|
|
155
|
-
setNodeParent
|
|
156
|
-
]
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
exports.useHvNode = useHvNode;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const reactflow = require("reactflow");
|
|
4
|
-
function useNodeId(id) {
|
|
5
|
-
const currentNodeId = reactflow.useNodeId();
|
|
6
|
-
return id ?? currentNodeId;
|
|
7
|
-
}
|
|
8
|
-
exports.useNodeId = useNodeId;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
5
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
6
|
-
const DashboardNode_styles = require("./DashboardNode.styles.cjs");
|
|
7
|
-
const Node = require("../Node/Node.cjs");
|
|
8
|
-
const Dashboard = require("../../Dashboard/Dashboard.cjs");
|
|
9
|
-
const DEFAULT_LABELS = {
|
|
10
|
-
emptyMessage: "No visualizations connected to the dashboard.",
|
|
11
|
-
dialogTitle: "Configure dashboard",
|
|
12
|
-
dialogSubtitle: "Please configure the layout of your dashboard as needed.",
|
|
13
|
-
dialogApply: "Apply",
|
|
14
|
-
dialogCancel: "Cancel"
|
|
15
|
-
};
|
|
16
|
-
const HvDashboardNode = (props) => {
|
|
17
|
-
const {
|
|
18
|
-
id,
|
|
19
|
-
open,
|
|
20
|
-
layout,
|
|
21
|
-
labels: labelsProp,
|
|
22
|
-
classes: classesProp,
|
|
23
|
-
previewItems,
|
|
24
|
-
children,
|
|
25
|
-
dialogProps,
|
|
26
|
-
dashboardProps,
|
|
27
|
-
onApply,
|
|
28
|
-
onCancel,
|
|
29
|
-
onClose,
|
|
30
|
-
...others
|
|
31
|
-
} = props;
|
|
32
|
-
const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProp);
|
|
33
|
-
const { classes } = DashboardNode_styles.useClasses(classesProp);
|
|
34
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
|
-
Node.HvFlowNode,
|
|
36
|
-
{
|
|
37
|
-
id,
|
|
38
|
-
classes,
|
|
39
|
-
labels,
|
|
40
|
-
...others,
|
|
41
|
-
children: [
|
|
42
|
-
children,
|
|
43
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
-
uikitReactCore.HvDialog,
|
|
45
|
-
{
|
|
46
|
-
open,
|
|
47
|
-
maxWidth: "lg",
|
|
48
|
-
fullWidth: true,
|
|
49
|
-
onClose,
|
|
50
|
-
...dialogProps,
|
|
51
|
-
children: [
|
|
52
|
-
/* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvDialogTitle, { variant: "info", children: labels?.dialogTitle }),
|
|
53
|
-
/* @__PURE__ */ jsxRuntime.jsxs(uikitReactCore.HvDialogContent, { indentContent: true, children: [
|
|
54
|
-
labels?.dialogSubtitle,
|
|
55
|
-
layout && layout?.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
-
Dashboard.HvDashboard,
|
|
57
|
-
{
|
|
58
|
-
cols: 12,
|
|
59
|
-
layout,
|
|
60
|
-
compactType: "vertical",
|
|
61
|
-
rowHeight: 80,
|
|
62
|
-
margin: [16, 16],
|
|
63
|
-
containerPadding: [0, 16],
|
|
64
|
-
...dashboardProps,
|
|
65
|
-
children: previewItems
|
|
66
|
-
}
|
|
67
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
68
|
-
uikitReactCore.HvEmptyState,
|
|
69
|
-
{
|
|
70
|
-
className: classes.empty,
|
|
71
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Info, {}),
|
|
72
|
-
message: labels?.emptyMessage
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
] }),
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsxs(uikitReactCore.HvDialogActions, { children: [
|
|
77
|
-
/* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvButton, { variant: "primary", onClick: onApply, children: labels?.dialogApply }),
|
|
78
|
-
/* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvButton, { variant: "secondarySubtle", onClick: onCancel, children: labels?.dialogCancel })
|
|
79
|
-
] })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
exports.hvDashboardNodeClasses = DashboardNode_styles.staticClasses;
|
|
88
|
-
exports.HvDashboardNode = HvDashboardNode;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
-
const Node_styles = require("../Node/Node.styles.cjs");
|
|
5
|
-
const baseClasses = Object.fromEntries(
|
|
6
|
-
Object.keys(Node_styles.staticClasses).map((key) => [key, {}])
|
|
7
|
-
);
|
|
8
|
-
const { staticClasses, useClasses } = uikitReactCore.createClasses("HvDashboardNode", {
|
|
9
|
-
empty: {
|
|
10
|
-
padding: uikitReactCore.theme.spacing("sm", 0, 0, 0)
|
|
11
|
-
},
|
|
12
|
-
// Spread here to know if we are overriding classes from parents
|
|
13
|
-
...baseClasses
|
|
14
|
-
});
|
|
15
|
-
exports.staticClasses = staticClasses;
|
|
16
|
-
exports.useClasses = useClasses;
|