@uipath/apollo-react 3.28.0 → 3.29.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/StickyNoteNode/StickyNoteNode.cjs +22 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.js +22 -1
- package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.cjs +31 -11
- package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.d.ts.map +1 -1
- package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.js +31 -11
- package/package.json +2 -2
|
@@ -52,7 +52,7 @@ const external_StickyNoteNode_types_cjs_namespaceObject = require("./StickyNoteN
|
|
|
52
52
|
const minWidth = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
53
53
|
const minHeight = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
54
54
|
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false })=>{
|
|
55
|
-
const { updateNodeData } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
55
|
+
const { updateNodeData, deleteElements } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
56
56
|
const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(data.autoFocus ?? false);
|
|
57
57
|
const [isResizing, setIsResizing] = (0, external_react_namespaceObject.useState)(false);
|
|
58
58
|
const [isColorPickerOpen, setIsColorPickerOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -146,6 +146,18 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
146
146
|
}
|
|
147
147
|
}, 0);
|
|
148
148
|
}, []);
|
|
149
|
+
const handleDelete = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
150
|
+
deleteElements({
|
|
151
|
+
nodes: [
|
|
152
|
+
{
|
|
153
|
+
id
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
}, [
|
|
158
|
+
id,
|
|
159
|
+
deleteElements
|
|
160
|
+
]);
|
|
149
161
|
const markdownComponents = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
150
162
|
a: ({ href, children, ...props })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
|
|
151
163
|
...props,
|
|
@@ -163,6 +175,15 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
163
175
|
}), []);
|
|
164
176
|
const toolbarConfig = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
165
177
|
const actions = [
|
|
178
|
+
{
|
|
179
|
+
id: 'delete',
|
|
180
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApIcon, {
|
|
181
|
+
variant: "outlined",
|
|
182
|
+
name: "delete"
|
|
183
|
+
}),
|
|
184
|
+
label: 'Delete',
|
|
185
|
+
onAction: handleDelete
|
|
186
|
+
},
|
|
166
187
|
{
|
|
167
188
|
id: 'edit',
|
|
168
189
|
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApIcon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAuB1E,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG9E,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAuB1E,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG9E,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AA8TD,eAAO,MAAM,cAAc,kHAlTxB,mBAAmB,6CAkTqC,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { STICKY_NOTE_COLORS, withAlpha } from "./StickyNoteNode.types.js";
|
|
|
13
13
|
const minWidth = 8 * GRID_SPACING;
|
|
14
14
|
const minHeight = 8 * GRID_SPACING;
|
|
15
15
|
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false })=>{
|
|
16
|
-
const { updateNodeData } = useReactFlow();
|
|
16
|
+
const { updateNodeData, deleteElements } = useReactFlow();
|
|
17
17
|
const [isEditing, setIsEditing] = useState(data.autoFocus ?? false);
|
|
18
18
|
const [isResizing, setIsResizing] = useState(false);
|
|
19
19
|
const [isColorPickerOpen, setIsColorPickerOpen] = useState(false);
|
|
@@ -107,6 +107,18 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
107
107
|
}
|
|
108
108
|
}, 0);
|
|
109
109
|
}, []);
|
|
110
|
+
const handleDelete = useCallback(()=>{
|
|
111
|
+
deleteElements({
|
|
112
|
+
nodes: [
|
|
113
|
+
{
|
|
114
|
+
id
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
}, [
|
|
119
|
+
id,
|
|
120
|
+
deleteElements
|
|
121
|
+
]);
|
|
110
122
|
const markdownComponents = useMemo(()=>({
|
|
111
123
|
a: ({ href, children, ...props })=>/*#__PURE__*/ jsx("a", {
|
|
112
124
|
...props,
|
|
@@ -124,6 +136,15 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
124
136
|
}), []);
|
|
125
137
|
const toolbarConfig = useMemo(()=>{
|
|
126
138
|
const actions = [
|
|
139
|
+
{
|
|
140
|
+
id: 'delete',
|
|
141
|
+
icon: /*#__PURE__*/ jsx(ApIcon, {
|
|
142
|
+
variant: "outlined",
|
|
143
|
+
name: "delete"
|
|
144
|
+
}),
|
|
145
|
+
label: 'Delete',
|
|
146
|
+
onAction: handleDelete
|
|
147
|
+
},
|
|
127
148
|
{
|
|
128
149
|
id: 'edit',
|
|
129
150
|
icon: /*#__PURE__*/ jsx(ApIcon, {
|
|
@@ -74,15 +74,17 @@ const StyledSankeyLink = (0, styles_namespaceObject.styled)('path')({
|
|
|
74
74
|
const StyledSankeyNodeLabel = (0, styles_namespaceObject.styled)('text')({
|
|
75
75
|
fontSize: apollo_core_default().FontVariantToken.fontSizeS,
|
|
76
76
|
fill: 'var(--color-foreground-emp)',
|
|
77
|
-
pointerEvents: '
|
|
78
|
-
userSelect: 'none'
|
|
77
|
+
pointerEvents: 'auto',
|
|
78
|
+
userSelect: 'none',
|
|
79
|
+
cursor: 'default'
|
|
79
80
|
});
|
|
80
81
|
const StyledSankeyNodeValue = (0, styles_namespaceObject.styled)('text')({
|
|
81
82
|
fontSize: apollo_core_default().FontVariantToken.fontSizeS,
|
|
82
83
|
fontWeight: apollo_core_default().FontFamily.FontWeightMedium,
|
|
83
84
|
fill: 'var(--color-foreground-emp)',
|
|
84
|
-
pointerEvents: '
|
|
85
|
-
userSelect: 'none'
|
|
85
|
+
pointerEvents: 'auto',
|
|
86
|
+
userSelect: 'none',
|
|
87
|
+
cursor: 'default'
|
|
86
88
|
});
|
|
87
89
|
const LinkTooltipContent = (0, styles_namespaceObject.styled)(material_namespaceObject.Paper)({
|
|
88
90
|
backgroundColor: 'var(--color-background)',
|
|
@@ -114,8 +116,12 @@ const TooltipValue = (0, styles_namespaceObject.styled)('span')({
|
|
|
114
116
|
color: 'var(--color-foreground-emp)',
|
|
115
117
|
fontWeight: apollo_core_default().FontFamily.FontWeightSemibold
|
|
116
118
|
});
|
|
117
|
-
const DIAGRAM_MARGIN_HORIZONTAL =
|
|
119
|
+
const DIAGRAM_MARGIN_HORIZONTAL = 80;
|
|
118
120
|
const DIAGRAM_MARGIN_VERTICAL = 5;
|
|
121
|
+
const truncateText = (text, maxChars)=>{
|
|
122
|
+
if (text.length <= maxChars) return text;
|
|
123
|
+
return `${text.substring(0, maxChars - 1)}…`;
|
|
124
|
+
};
|
|
119
125
|
const ApSankeyDiagram = /*#__PURE__*/ external_react_default().forwardRef((props, ref)=>{
|
|
120
126
|
const { data, nodeAlignment = 'justify', nodePadding = 16, nodeWidth = 24, style, className, colorScheme = external_d3_scale_chromatic_namespaceObject.schemeTableau10, ariaLabel = 'Sankey diagram', onLinkClick, onNodeClick } = props;
|
|
121
127
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
@@ -227,13 +233,20 @@ const ApSankeyDiagram = /*#__PURE__*/ external_react_default().forwardRef((props
|
|
|
227
233
|
]);
|
|
228
234
|
const nodeData = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
229
235
|
if (!sankeyGraph) return [];
|
|
236
|
+
const midpoint = actualWidth / 2;
|
|
230
237
|
return sankeyGraph.nodes.map((node, index)=>{
|
|
231
238
|
const extNode = node;
|
|
232
239
|
const x0 = extNode.x0 || 0;
|
|
233
240
|
const x1 = extNode.x1 || 0;
|
|
234
241
|
const y0 = extNode.y0 || 0;
|
|
235
242
|
const y1 = extNode.y1 || 0;
|
|
236
|
-
const
|
|
243
|
+
const nodeCenter = (x0 + x1) / 2;
|
|
244
|
+
const labelOnRight = nodeCenter < midpoint;
|
|
245
|
+
const fullSpace = labelOnRight ? actualWidth - DIAGRAM_MARGIN_HORIZONTAL - x1 - parseInt(apollo_core_default().Spacing.SpacingXs) : x0 - DIAGRAM_MARGIN_HORIZONTAL - parseInt(apollo_core_default().Spacing.SpacingXs);
|
|
246
|
+
const spaceToMidpoint = labelOnRight ? midpoint - x1 - parseInt(apollo_core_default().Spacing.SpacingXs) : x0 - midpoint - parseInt(apollo_core_default().Spacing.SpacingXs);
|
|
247
|
+
const availableSpace = spaceToMidpoint > 0 ? Math.min(fullSpace, spaceToMidpoint) : fullSpace;
|
|
248
|
+
const maxChars = Math.floor(Math.max(0, availableSpace) / parseInt(apollo_core_default().Spacing.SpacingXs));
|
|
249
|
+
const displayLabel = truncateText(extNode.label, maxChars);
|
|
237
250
|
return {
|
|
238
251
|
node: extNode,
|
|
239
252
|
x: x0,
|
|
@@ -241,10 +254,12 @@ const ApSankeyDiagram = /*#__PURE__*/ external_react_default().forwardRef((props
|
|
|
241
254
|
width: x1 - x0,
|
|
242
255
|
height: y1 - y0,
|
|
243
256
|
color: nodeColorMap.get(extNode.id) || colorScheme[index % colorScheme.length],
|
|
244
|
-
labelX:
|
|
257
|
+
labelX: labelOnRight ? x1 + parseInt(apollo_core_default().Spacing.SpacingXs) : x0 - parseInt(apollo_core_default().Spacing.SpacingXs),
|
|
245
258
|
labelY: (y0 + y1) / 2,
|
|
246
|
-
labelAnchor:
|
|
247
|
-
value: extNode.value || 0
|
|
259
|
+
labelAnchor: labelOnRight ? 'start' : 'end',
|
|
260
|
+
value: extNode.value || 0,
|
|
261
|
+
displayLabel,
|
|
262
|
+
fullLabel: extNode.label
|
|
248
263
|
};
|
|
249
264
|
});
|
|
250
265
|
}, [
|
|
@@ -364,12 +379,17 @@ const ApSankeyDiagram = /*#__PURE__*/ external_react_default().forwardRef((props
|
|
|
364
379
|
onMouseLeave: handleNodeMouseLeave,
|
|
365
380
|
onClick: (e)=>onNodeClick?.(nodeItem.node, e)
|
|
366
381
|
}),
|
|
367
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
382
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(StyledSankeyNodeLabel, {
|
|
368
383
|
x: nodeItem.labelX,
|
|
369
384
|
y: nodeItem.labelY,
|
|
370
385
|
dy: "0.35em",
|
|
371
386
|
textAnchor: nodeItem.labelAnchor,
|
|
372
|
-
children:
|
|
387
|
+
children: [
|
|
388
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("title", {
|
|
389
|
+
children: nodeItem.fullLabel
|
|
390
|
+
}),
|
|
391
|
+
nodeItem.displayLabel
|
|
392
|
+
]
|
|
373
393
|
}),
|
|
374
394
|
nodeItem.value > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StyledSankeyNodeValue, {
|
|
375
395
|
x: nodeItem.labelX,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApSankeyDiagram.d.ts","sourceRoot":"","sources":["../../../../src/material/components/ap-sankey-diagram/ApSankeyDiagram.tsx"],"names":[],"mappings":"AAeA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ApSankeyDiagram.d.ts","sourceRoot":"","sources":["../../../../src/material/components/ap-sankey-diagram/ApSankeyDiagram.tsx"],"names":[],"mappings":"AAeA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,yBAAyB,CAAC;AAqI5F,eAAO,MAAM,eAAe,6FAob3B,CAAC"}
|
|
@@ -35,15 +35,17 @@ const StyledSankeyLink = styled('path')({
|
|
|
35
35
|
const StyledSankeyNodeLabel = styled('text')({
|
|
36
36
|
fontSize: apollo_core.FontVariantToken.fontSizeS,
|
|
37
37
|
fill: 'var(--color-foreground-emp)',
|
|
38
|
-
pointerEvents: '
|
|
39
|
-
userSelect: 'none'
|
|
38
|
+
pointerEvents: 'auto',
|
|
39
|
+
userSelect: 'none',
|
|
40
|
+
cursor: 'default'
|
|
40
41
|
});
|
|
41
42
|
const StyledSankeyNodeValue = styled('text')({
|
|
42
43
|
fontSize: apollo_core.FontVariantToken.fontSizeS,
|
|
43
44
|
fontWeight: apollo_core.FontFamily.FontWeightMedium,
|
|
44
45
|
fill: 'var(--color-foreground-emp)',
|
|
45
|
-
pointerEvents: '
|
|
46
|
-
userSelect: 'none'
|
|
46
|
+
pointerEvents: 'auto',
|
|
47
|
+
userSelect: 'none',
|
|
48
|
+
cursor: 'default'
|
|
47
49
|
});
|
|
48
50
|
const LinkTooltipContent = styled(Paper)({
|
|
49
51
|
backgroundColor: 'var(--color-background)',
|
|
@@ -75,8 +77,12 @@ const TooltipValue = styled('span')({
|
|
|
75
77
|
color: 'var(--color-foreground-emp)',
|
|
76
78
|
fontWeight: apollo_core.FontFamily.FontWeightSemibold
|
|
77
79
|
});
|
|
78
|
-
const DIAGRAM_MARGIN_HORIZONTAL =
|
|
80
|
+
const DIAGRAM_MARGIN_HORIZONTAL = 80;
|
|
79
81
|
const DIAGRAM_MARGIN_VERTICAL = 5;
|
|
82
|
+
const truncateText = (text, maxChars)=>{
|
|
83
|
+
if (text.length <= maxChars) return text;
|
|
84
|
+
return `${text.substring(0, maxChars - 1)}…`;
|
|
85
|
+
};
|
|
80
86
|
const ApSankeyDiagram = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
81
87
|
const { data, nodeAlignment = 'justify', nodePadding = 16, nodeWidth = 24, style, className, colorScheme = schemeTableau10, ariaLabel = 'Sankey diagram', onLinkClick, onNodeClick } = props;
|
|
82
88
|
const containerRef = useRef(null);
|
|
@@ -188,13 +194,20 @@ const ApSankeyDiagram = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
|
188
194
|
]);
|
|
189
195
|
const nodeData = useMemo(()=>{
|
|
190
196
|
if (!sankeyGraph) return [];
|
|
197
|
+
const midpoint = actualWidth / 2;
|
|
191
198
|
return sankeyGraph.nodes.map((node, index)=>{
|
|
192
199
|
const extNode = node;
|
|
193
200
|
const x0 = extNode.x0 || 0;
|
|
194
201
|
const x1 = extNode.x1 || 0;
|
|
195
202
|
const y0 = extNode.y0 || 0;
|
|
196
203
|
const y1 = extNode.y1 || 0;
|
|
197
|
-
const
|
|
204
|
+
const nodeCenter = (x0 + x1) / 2;
|
|
205
|
+
const labelOnRight = nodeCenter < midpoint;
|
|
206
|
+
const fullSpace = labelOnRight ? actualWidth - DIAGRAM_MARGIN_HORIZONTAL - x1 - parseInt(apollo_core.Spacing.SpacingXs) : x0 - DIAGRAM_MARGIN_HORIZONTAL - parseInt(apollo_core.Spacing.SpacingXs);
|
|
207
|
+
const spaceToMidpoint = labelOnRight ? midpoint - x1 - parseInt(apollo_core.Spacing.SpacingXs) : x0 - midpoint - parseInt(apollo_core.Spacing.SpacingXs);
|
|
208
|
+
const availableSpace = spaceToMidpoint > 0 ? Math.min(fullSpace, spaceToMidpoint) : fullSpace;
|
|
209
|
+
const maxChars = Math.floor(Math.max(0, availableSpace) / parseInt(apollo_core.Spacing.SpacingXs));
|
|
210
|
+
const displayLabel = truncateText(extNode.label, maxChars);
|
|
198
211
|
return {
|
|
199
212
|
node: extNode,
|
|
200
213
|
x: x0,
|
|
@@ -202,10 +215,12 @@ const ApSankeyDiagram = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
|
202
215
|
width: x1 - x0,
|
|
203
216
|
height: y1 - y0,
|
|
204
217
|
color: nodeColorMap.get(extNode.id) || colorScheme[index % colorScheme.length],
|
|
205
|
-
labelX:
|
|
218
|
+
labelX: labelOnRight ? x1 + parseInt(apollo_core.Spacing.SpacingXs) : x0 - parseInt(apollo_core.Spacing.SpacingXs),
|
|
206
219
|
labelY: (y0 + y1) / 2,
|
|
207
|
-
labelAnchor:
|
|
208
|
-
value: extNode.value || 0
|
|
220
|
+
labelAnchor: labelOnRight ? 'start' : 'end',
|
|
221
|
+
value: extNode.value || 0,
|
|
222
|
+
displayLabel,
|
|
223
|
+
fullLabel: extNode.label
|
|
209
224
|
};
|
|
210
225
|
});
|
|
211
226
|
}, [
|
|
@@ -325,12 +340,17 @@ const ApSankeyDiagram = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
|
325
340
|
onMouseLeave: handleNodeMouseLeave,
|
|
326
341
|
onClick: (e)=>onNodeClick?.(nodeItem.node, e)
|
|
327
342
|
}),
|
|
328
|
-
/*#__PURE__*/
|
|
343
|
+
/*#__PURE__*/ jsxs(StyledSankeyNodeLabel, {
|
|
329
344
|
x: nodeItem.labelX,
|
|
330
345
|
y: nodeItem.labelY,
|
|
331
346
|
dy: "0.35em",
|
|
332
347
|
textAnchor: nodeItem.labelAnchor,
|
|
333
|
-
children:
|
|
348
|
+
children: [
|
|
349
|
+
/*#__PURE__*/ jsx("title", {
|
|
350
|
+
children: nodeItem.fullLabel
|
|
351
|
+
}),
|
|
352
|
+
nodeItem.displayLabel
|
|
353
|
+
]
|
|
334
354
|
}),
|
|
335
355
|
nodeItem.value > 0 && /*#__PURE__*/ jsx(StyledSankeyNodeValue, {
|
|
336
356
|
x: nodeItem.labelX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/apollo-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.1",
|
|
4
4
|
"description": "Apollo Design System - React component library with Material UI theming",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"zod": "^4.3.5",
|
|
200
200
|
"zustand": "^5.0.9",
|
|
201
201
|
"@uipath/apollo-core": "5.7.0",
|
|
202
|
-
"@uipath/apollo-wind": "0.8.
|
|
202
|
+
"@uipath/apollo-wind": "0.8.1"
|
|
203
203
|
},
|
|
204
204
|
"devDependencies": {
|
|
205
205
|
"@lingui/cli": "^5.6.1",
|