@uipath/apollo-react 4.19.0 → 4.20.0-pr644.f72be25
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 +95 -75
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.d.ts +2 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.js +95 -75
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.cjs +2 -2
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.d.ts +2 -2
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.js +2 -2
- package/dist/canvas/components/Toolbox/ListView.cjs +13 -1
- package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.js +14 -2
- package/dist/canvas/components/Toolbox/ListView.styles.cjs +18 -0
- package/dist/canvas/components/Toolbox/ListView.styles.d.ts +4 -0
- package/dist/canvas/components/Toolbox/ListView.styles.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.styles.js +16 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/material/components/ap-chat/locales/de.cjs +1 -1
- package/dist/material/components/ap-chat/locales/de.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/de.js +1 -1
- package/dist/material/components/ap-chat/locales/es-MX.cjs +1 -1
- package/dist/material/components/ap-chat/locales/es-MX.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/es-MX.js +1 -1
- package/dist/material/components/ap-chat/locales/es.cjs +1 -1
- package/dist/material/components/ap-chat/locales/es.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/es.js +1 -1
- package/dist/material/components/ap-chat/locales/fr.cjs +1 -1
- package/dist/material/components/ap-chat/locales/fr.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/fr.js +1 -1
- package/dist/material/components/ap-chat/locales/ja.cjs +1 -1
- package/dist/material/components/ap-chat/locales/ja.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/ja.js +1 -1
- package/dist/material/components/ap-chat/locales/ko.cjs +1 -1
- package/dist/material/components/ap-chat/locales/ko.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/ko.js +1 -1
- package/dist/material/components/ap-chat/locales/pt-BR.cjs +1 -1
- package/dist/material/components/ap-chat/locales/pt-BR.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/pt-BR.js +1 -1
- package/dist/material/components/ap-chat/locales/pt.cjs +1 -1
- package/dist/material/components/ap-chat/locales/pt.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/pt.js +1 -1
- package/dist/material/components/ap-chat/locales/tr.cjs +1 -1
- package/dist/material/components/ap-chat/locales/tr.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/tr.js +1 -1
- package/dist/material/components/ap-chat/locales/zh-CN.cjs +1 -1
- package/dist/material/components/ap-chat/locales/zh-CN.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/zh-CN.js +1 -1
- package/dist/material/components/ap-chat/locales/zh-TW.cjs +1 -1
- package/dist/material/components/ap-chat/locales/zh-TW.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/zh-TW.js +1 -1
- package/package.json +2 -2
|
@@ -59,9 +59,9 @@ const external_useMarkdownShortcuts_cjs_namespaceObject = require("./useMarkdown
|
|
|
59
59
|
const external_useScrollCapture_cjs_namespaceObject = require("./useScrollCapture.cjs");
|
|
60
60
|
const minWidth = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
61
61
|
const minHeight = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
62
|
-
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, onContentChange, onColorChange, onResize })=>{
|
|
62
|
+
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, readOnly = false, onContentChange, onColorChange, onResize })=>{
|
|
63
63
|
const { updateNodeData, deleteElements } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
64
|
-
const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(data.autoFocus ?? false);
|
|
64
|
+
const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(!readOnly && (data.autoFocus ?? false));
|
|
65
65
|
const [isResizing, setIsResizing] = (0, external_react_namespaceObject.useState)(false);
|
|
66
66
|
const [isColorPickerOpen, setIsColorPickerOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
67
67
|
const [localContent, setLocalContent] = (0, external_react_namespaceObject.useState)(data.content || '');
|
|
@@ -88,14 +88,15 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
88
88
|
textAreaRef.current.focus();
|
|
89
89
|
textAreaRef.current.select();
|
|
90
90
|
}
|
|
91
|
-
if (data.autoFocus) updateNodeData(id, {
|
|
91
|
+
if (!readOnly && data.autoFocus) updateNodeData(id, {
|
|
92
92
|
autoFocus: false
|
|
93
93
|
});
|
|
94
94
|
}, [
|
|
95
95
|
isEditing,
|
|
96
96
|
data.autoFocus,
|
|
97
97
|
id,
|
|
98
|
-
updateNodeData
|
|
98
|
+
updateNodeData,
|
|
99
|
+
readOnly
|
|
99
100
|
]);
|
|
100
101
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
101
102
|
if (!selected || isResizing) setIsColorPickerOpen(false);
|
|
@@ -103,8 +104,17 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
103
104
|
selected,
|
|
104
105
|
isResizing
|
|
105
106
|
]);
|
|
107
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
108
|
+
if (readOnly) {
|
|
109
|
+
setIsEditing(false);
|
|
110
|
+
setLocalContent(data.content || '');
|
|
111
|
+
}
|
|
112
|
+
}, [
|
|
113
|
+
readOnly,
|
|
114
|
+
data.content
|
|
115
|
+
]);
|
|
106
116
|
const handleDoubleClick = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
107
|
-
if (isEditing) return;
|
|
117
|
+
if (readOnly || isEditing) return;
|
|
108
118
|
setIsEditing(true);
|
|
109
119
|
setTimeout(()=>{
|
|
110
120
|
if (textAreaRef.current) {
|
|
@@ -113,10 +123,12 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
113
123
|
}
|
|
114
124
|
}, 0);
|
|
115
125
|
}, [
|
|
116
|
-
isEditing
|
|
126
|
+
isEditing,
|
|
127
|
+
readOnly
|
|
117
128
|
]);
|
|
118
129
|
const handleBlur = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
119
130
|
setIsEditing(false);
|
|
131
|
+
if (readOnly) return;
|
|
120
132
|
if (localContent !== data.content) {
|
|
121
133
|
onContentChange?.(localContent);
|
|
122
134
|
updateNodeData(id, {
|
|
@@ -128,7 +140,8 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
128
140
|
localContent,
|
|
129
141
|
data.content,
|
|
130
142
|
updateNodeData,
|
|
131
|
-
onContentChange
|
|
143
|
+
onContentChange,
|
|
144
|
+
readOnly
|
|
132
145
|
]);
|
|
133
146
|
const handleChange = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
134
147
|
setLocalContent(e.target.value);
|
|
@@ -205,6 +218,7 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
205
218
|
setIsColorPickerOpen((prev)=>!prev);
|
|
206
219
|
}, []);
|
|
207
220
|
const handleEditClick = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
221
|
+
if (readOnly) return;
|
|
208
222
|
setIsEditing(true);
|
|
209
223
|
setTimeout(()=>{
|
|
210
224
|
if (textAreaRef.current) {
|
|
@@ -212,7 +226,9 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
212
226
|
textAreaRef.current.select();
|
|
213
227
|
}
|
|
214
228
|
}, 0);
|
|
215
|
-
}, [
|
|
229
|
+
}, [
|
|
230
|
+
readOnly
|
|
231
|
+
]);
|
|
216
232
|
const handleDelete = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
217
233
|
deleteElements({
|
|
218
234
|
nodes: [
|
|
@@ -299,69 +315,73 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
299
315
|
}),
|
|
300
316
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_StickyNoteNode_styles_cjs_namespaceObject.StickyNoteWrapper, {
|
|
301
317
|
children: [
|
|
302
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
318
|
+
!readOnly && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
319
|
+
children: [
|
|
320
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
321
|
+
style: {
|
|
322
|
+
background: 'transparent',
|
|
323
|
+
border: 'none',
|
|
324
|
+
zIndex: external_StickyNoteNode_styles_cjs_namespaceObject.RESIZE_CONTROL_Z_INDEX
|
|
325
|
+
},
|
|
326
|
+
position: "top-left",
|
|
327
|
+
minWidth: minWidth,
|
|
328
|
+
minHeight: minHeight,
|
|
329
|
+
onResizeStart: handleResizeStart,
|
|
330
|
+
onResizeEnd: handleResizeEnd,
|
|
331
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.ResizeHandle, {
|
|
332
|
+
selected: selected,
|
|
333
|
+
cursor: "nwse-resize"
|
|
334
|
+
})
|
|
335
|
+
}),
|
|
336
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
337
|
+
style: {
|
|
338
|
+
background: 'transparent',
|
|
339
|
+
border: 'none',
|
|
340
|
+
zIndex: external_StickyNoteNode_styles_cjs_namespaceObject.RESIZE_CONTROL_Z_INDEX
|
|
341
|
+
},
|
|
342
|
+
position: "top-right",
|
|
343
|
+
minWidth: minWidth,
|
|
344
|
+
minHeight: minHeight,
|
|
345
|
+
onResizeStart: handleResizeStart,
|
|
346
|
+
onResizeEnd: handleResizeEnd,
|
|
347
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.ResizeHandle, {
|
|
348
|
+
selected: selected,
|
|
349
|
+
cursor: "nesw-resize"
|
|
350
|
+
})
|
|
351
|
+
}),
|
|
352
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
353
|
+
style: {
|
|
354
|
+
background: 'transparent',
|
|
355
|
+
border: 'none',
|
|
356
|
+
zIndex: external_StickyNoteNode_styles_cjs_namespaceObject.RESIZE_CONTROL_Z_INDEX
|
|
357
|
+
},
|
|
358
|
+
position: "bottom-left",
|
|
359
|
+
minWidth: minWidth,
|
|
360
|
+
minHeight: minHeight,
|
|
361
|
+
onResizeStart: handleResizeStart,
|
|
362
|
+
onResizeEnd: handleResizeEnd,
|
|
363
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.ResizeHandle, {
|
|
364
|
+
selected: selected,
|
|
365
|
+
cursor: "nesw-resize"
|
|
366
|
+
})
|
|
367
|
+
}),
|
|
368
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
369
|
+
style: {
|
|
370
|
+
background: 'transparent',
|
|
371
|
+
border: 'none',
|
|
372
|
+
zIndex: external_StickyNoteNode_styles_cjs_namespaceObject.RESIZE_CONTROL_Z_INDEX
|
|
373
|
+
},
|
|
374
|
+
position: "bottom-right",
|
|
375
|
+
minWidth: minWidth,
|
|
376
|
+
minHeight: minHeight,
|
|
377
|
+
onResizeStart: handleResizeStart,
|
|
378
|
+
onResizeEnd: handleResizeEnd,
|
|
379
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.ResizeHandle, {
|
|
380
|
+
selected: selected,
|
|
381
|
+
cursor: "nwse-resize"
|
|
382
|
+
})
|
|
383
|
+
})
|
|
384
|
+
]
|
|
365
385
|
}),
|
|
366
386
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_StickyNoteNode_styles_cjs_namespaceObject.StickyNoteContainer, {
|
|
367
387
|
backgroundColor: colorWithAlpha,
|
|
@@ -371,10 +391,10 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
371
391
|
onDoubleClick: handleDoubleClick,
|
|
372
392
|
children: [
|
|
373
393
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.TopCornerIndicators, {
|
|
374
|
-
|
|
394
|
+
visible: selected && !readOnly
|
|
375
395
|
}),
|
|
376
396
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_styles_cjs_namespaceObject.BottomCornerIndicators, {
|
|
377
|
-
|
|
397
|
+
visible: selected && !readOnly
|
|
378
398
|
}),
|
|
379
399
|
isEditing ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.ApI18nProvider, {
|
|
380
400
|
component: "canvas",
|
|
@@ -419,13 +439,13 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
419
439
|
})
|
|
420
440
|
]
|
|
421
441
|
}),
|
|
422
|
-
selected && !dragging && !isResizing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
442
|
+
!readOnly && selected && !dragging && !isResizing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
423
443
|
nodeId: id,
|
|
424
444
|
config: toolbarConfig,
|
|
425
445
|
expanded: true
|
|
426
446
|
}),
|
|
427
447
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_motion_react_namespaceObject.AnimatePresence, {
|
|
428
|
-
children: selected && !dragging && !isResizing && isColorPickerOpen && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
448
|
+
children: !readOnly && selected && !dragging && !isResizing && isColorPickerOpen && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
429
449
|
style: {
|
|
430
450
|
position: 'absolute',
|
|
431
451
|
top: -40,
|
|
@@ -4,9 +4,10 @@ export interface StickyNoteNodeProps extends NodeProps {
|
|
|
4
4
|
data: StickyNoteData;
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
renderPlaceholderOnSelect?: boolean;
|
|
7
|
+
readOnly?: boolean;
|
|
7
8
|
onContentChange?: (content: string) => void;
|
|
8
9
|
onColorChange?: (color: StickyNoteColor) => void;
|
|
9
10
|
onResize?: (width: number, height: number) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const StickyNoteNode: import("react").MemoExoticComponent<({ id, data, selected, dragging, placeholder, renderPlaceholderOnSelect, onContentChange, onColorChange, onResize, }: StickyNoteNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export declare const StickyNoteNode: import("react").MemoExoticComponent<({ id, data, selected, dragging, placeholder, renderPlaceholderOnSelect, readOnly, onContentChange, onColorChange, onResize, }: StickyNoteNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
13
|
//# sourceMappingURL=StickyNoteNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAgC1E,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,wBAAwB,CAAC;AAM7F,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;
|
|
1
|
+
{"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAgC1E,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,wBAAwB,CAAC;AAM7F,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAoZD,eAAO,MAAM,cAAc,sKApYxB,mBAAmB,6CAoYqC,CAAC"}
|
|
@@ -19,9 +19,9 @@ import { useMarkdownShortcuts } from "./useMarkdownShortcuts.js";
|
|
|
19
19
|
import { useScrollCapture } from "./useScrollCapture.js";
|
|
20
20
|
const minWidth = 8 * GRID_SPACING;
|
|
21
21
|
const minHeight = 8 * GRID_SPACING;
|
|
22
|
-
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, onContentChange, onColorChange, onResize })=>{
|
|
22
|
+
const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, readOnly = false, onContentChange, onColorChange, onResize })=>{
|
|
23
23
|
const { updateNodeData, deleteElements } = useReactFlow();
|
|
24
|
-
const [isEditing, setIsEditing] = useState(data.autoFocus ?? false);
|
|
24
|
+
const [isEditing, setIsEditing] = useState(!readOnly && (data.autoFocus ?? false));
|
|
25
25
|
const [isResizing, setIsResizing] = useState(false);
|
|
26
26
|
const [isColorPickerOpen, setIsColorPickerOpen] = useState(false);
|
|
27
27
|
const [localContent, setLocalContent] = useState(data.content || '');
|
|
@@ -48,14 +48,15 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
48
48
|
textAreaRef.current.focus();
|
|
49
49
|
textAreaRef.current.select();
|
|
50
50
|
}
|
|
51
|
-
if (data.autoFocus) updateNodeData(id, {
|
|
51
|
+
if (!readOnly && data.autoFocus) updateNodeData(id, {
|
|
52
52
|
autoFocus: false
|
|
53
53
|
});
|
|
54
54
|
}, [
|
|
55
55
|
isEditing,
|
|
56
56
|
data.autoFocus,
|
|
57
57
|
id,
|
|
58
|
-
updateNodeData
|
|
58
|
+
updateNodeData,
|
|
59
|
+
readOnly
|
|
59
60
|
]);
|
|
60
61
|
useEffect(()=>{
|
|
61
62
|
if (!selected || isResizing) setIsColorPickerOpen(false);
|
|
@@ -63,8 +64,17 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
63
64
|
selected,
|
|
64
65
|
isResizing
|
|
65
66
|
]);
|
|
67
|
+
useEffect(()=>{
|
|
68
|
+
if (readOnly) {
|
|
69
|
+
setIsEditing(false);
|
|
70
|
+
setLocalContent(data.content || '');
|
|
71
|
+
}
|
|
72
|
+
}, [
|
|
73
|
+
readOnly,
|
|
74
|
+
data.content
|
|
75
|
+
]);
|
|
66
76
|
const handleDoubleClick = useCallback(()=>{
|
|
67
|
-
if (isEditing) return;
|
|
77
|
+
if (readOnly || isEditing) return;
|
|
68
78
|
setIsEditing(true);
|
|
69
79
|
setTimeout(()=>{
|
|
70
80
|
if (textAreaRef.current) {
|
|
@@ -73,10 +83,12 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
73
83
|
}
|
|
74
84
|
}, 0);
|
|
75
85
|
}, [
|
|
76
|
-
isEditing
|
|
86
|
+
isEditing,
|
|
87
|
+
readOnly
|
|
77
88
|
]);
|
|
78
89
|
const handleBlur = useCallback(()=>{
|
|
79
90
|
setIsEditing(false);
|
|
91
|
+
if (readOnly) return;
|
|
80
92
|
if (localContent !== data.content) {
|
|
81
93
|
onContentChange?.(localContent);
|
|
82
94
|
updateNodeData(id, {
|
|
@@ -88,7 +100,8 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
88
100
|
localContent,
|
|
89
101
|
data.content,
|
|
90
102
|
updateNodeData,
|
|
91
|
-
onContentChange
|
|
103
|
+
onContentChange,
|
|
104
|
+
readOnly
|
|
92
105
|
]);
|
|
93
106
|
const handleChange = useCallback((e)=>{
|
|
94
107
|
setLocalContent(e.target.value);
|
|
@@ -165,6 +178,7 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
165
178
|
setIsColorPickerOpen((prev)=>!prev);
|
|
166
179
|
}, []);
|
|
167
180
|
const handleEditClick = useCallback(()=>{
|
|
181
|
+
if (readOnly) return;
|
|
168
182
|
setIsEditing(true);
|
|
169
183
|
setTimeout(()=>{
|
|
170
184
|
if (textAreaRef.current) {
|
|
@@ -172,7 +186,9 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
172
186
|
textAreaRef.current.select();
|
|
173
187
|
}
|
|
174
188
|
}, 0);
|
|
175
|
-
}, [
|
|
189
|
+
}, [
|
|
190
|
+
readOnly
|
|
191
|
+
]);
|
|
176
192
|
const handleDelete = useCallback(()=>{
|
|
177
193
|
deleteElements({
|
|
178
194
|
nodes: [
|
|
@@ -259,69 +275,73 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
259
275
|
}),
|
|
260
276
|
/*#__PURE__*/ jsxs(StickyNoteWrapper, {
|
|
261
277
|
children: [
|
|
262
|
-
/*#__PURE__*/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
278
|
+
!readOnly && /*#__PURE__*/ jsxs(Fragment, {
|
|
279
|
+
children: [
|
|
280
|
+
/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
281
|
+
style: {
|
|
282
|
+
background: 'transparent',
|
|
283
|
+
border: 'none',
|
|
284
|
+
zIndex: RESIZE_CONTROL_Z_INDEX
|
|
285
|
+
},
|
|
286
|
+
position: "top-left",
|
|
287
|
+
minWidth: minWidth,
|
|
288
|
+
minHeight: minHeight,
|
|
289
|
+
onResizeStart: handleResizeStart,
|
|
290
|
+
onResizeEnd: handleResizeEnd,
|
|
291
|
+
children: /*#__PURE__*/ jsx(ResizeHandle, {
|
|
292
|
+
selected: selected,
|
|
293
|
+
cursor: "nwse-resize"
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
297
|
+
style: {
|
|
298
|
+
background: 'transparent',
|
|
299
|
+
border: 'none',
|
|
300
|
+
zIndex: RESIZE_CONTROL_Z_INDEX
|
|
301
|
+
},
|
|
302
|
+
position: "top-right",
|
|
303
|
+
minWidth: minWidth,
|
|
304
|
+
minHeight: minHeight,
|
|
305
|
+
onResizeStart: handleResizeStart,
|
|
306
|
+
onResizeEnd: handleResizeEnd,
|
|
307
|
+
children: /*#__PURE__*/ jsx(ResizeHandle, {
|
|
308
|
+
selected: selected,
|
|
309
|
+
cursor: "nesw-resize"
|
|
310
|
+
})
|
|
311
|
+
}),
|
|
312
|
+
/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
313
|
+
style: {
|
|
314
|
+
background: 'transparent',
|
|
315
|
+
border: 'none',
|
|
316
|
+
zIndex: RESIZE_CONTROL_Z_INDEX
|
|
317
|
+
},
|
|
318
|
+
position: "bottom-left",
|
|
319
|
+
minWidth: minWidth,
|
|
320
|
+
minHeight: minHeight,
|
|
321
|
+
onResizeStart: handleResizeStart,
|
|
322
|
+
onResizeEnd: handleResizeEnd,
|
|
323
|
+
children: /*#__PURE__*/ jsx(ResizeHandle, {
|
|
324
|
+
selected: selected,
|
|
325
|
+
cursor: "nesw-resize"
|
|
326
|
+
})
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
329
|
+
style: {
|
|
330
|
+
background: 'transparent',
|
|
331
|
+
border: 'none',
|
|
332
|
+
zIndex: RESIZE_CONTROL_Z_INDEX
|
|
333
|
+
},
|
|
334
|
+
position: "bottom-right",
|
|
335
|
+
minWidth: minWidth,
|
|
336
|
+
minHeight: minHeight,
|
|
337
|
+
onResizeStart: handleResizeStart,
|
|
338
|
+
onResizeEnd: handleResizeEnd,
|
|
339
|
+
children: /*#__PURE__*/ jsx(ResizeHandle, {
|
|
340
|
+
selected: selected,
|
|
341
|
+
cursor: "nwse-resize"
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
]
|
|
325
345
|
}),
|
|
326
346
|
/*#__PURE__*/ jsxs(StickyNoteContainer, {
|
|
327
347
|
backgroundColor: colorWithAlpha,
|
|
@@ -331,10 +351,10 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
331
351
|
onDoubleClick: handleDoubleClick,
|
|
332
352
|
children: [
|
|
333
353
|
/*#__PURE__*/ jsx(TopCornerIndicators, {
|
|
334
|
-
|
|
354
|
+
visible: selected && !readOnly
|
|
335
355
|
}),
|
|
336
356
|
/*#__PURE__*/ jsx(BottomCornerIndicators, {
|
|
337
|
-
|
|
357
|
+
visible: selected && !readOnly
|
|
338
358
|
}),
|
|
339
359
|
isEditing ? /*#__PURE__*/ jsxs(ApI18nProvider, {
|
|
340
360
|
component: "canvas",
|
|
@@ -379,13 +399,13 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
|
|
|
379
399
|
})
|
|
380
400
|
]
|
|
381
401
|
}),
|
|
382
|
-
selected && !dragging && !isResizing && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
402
|
+
!readOnly && selected && !dragging && !isResizing && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
383
403
|
nodeId: id,
|
|
384
404
|
config: toolbarConfig,
|
|
385
405
|
expanded: true
|
|
386
406
|
}),
|
|
387
407
|
/*#__PURE__*/ jsx(AnimatePresence, {
|
|
388
|
-
children: selected && !dragging && !isResizing && isColorPickerOpen && /*#__PURE__*/ jsx("div", {
|
|
408
|
+
children: !readOnly && selected && !dragging && !isResizing && isColorPickerOpen && /*#__PURE__*/ jsx("div", {
|
|
389
409
|
style: {
|
|
390
410
|
position: 'absolute',
|
|
391
411
|
top: -40,
|
|
@@ -281,7 +281,7 @@ const TopCornerIndicators = styled_default().div`
|
|
|
281
281
|
position: absolute;
|
|
282
282
|
inset: 0;
|
|
283
283
|
pointer-events: none;
|
|
284
|
-
opacity: ${(props)=>props.
|
|
284
|
+
opacity: ${(props)=>props.visible ? 1 : 0};
|
|
285
285
|
|
|
286
286
|
/* Top-left corner */
|
|
287
287
|
&::before {
|
|
@@ -313,7 +313,7 @@ const BottomCornerIndicators = styled_default().div`
|
|
|
313
313
|
position: absolute;
|
|
314
314
|
inset: 0;
|
|
315
315
|
pointer-events: none;
|
|
316
|
-
opacity: ${(props)=>props.
|
|
316
|
+
opacity: ${(props)=>props.visible ? 1 : 0};
|
|
317
317
|
|
|
318
318
|
/* Bottom-left corner */
|
|
319
319
|
&::before {
|
|
@@ -35,13 +35,13 @@ export declare const TopCornerIndicators: import("@emotion/styled").StyledCompon
|
|
|
35
35
|
theme?: import("@emotion/react").Theme;
|
|
36
36
|
as?: React.ElementType;
|
|
37
37
|
} & {
|
|
38
|
-
|
|
38
|
+
visible?: boolean;
|
|
39
39
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
40
40
|
export declare const BottomCornerIndicators: import("@emotion/styled").StyledComponent<{
|
|
41
41
|
theme?: import("@emotion/react").Theme;
|
|
42
42
|
as?: React.ElementType;
|
|
43
43
|
} & {
|
|
44
|
-
|
|
44
|
+
visible?: boolean;
|
|
45
45
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
46
46
|
export declare const ColorPickerPanel: import("@emotion/styled").StyledComponent<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
47
47
|
theme?: import("@emotion/react").Theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyNoteNode.styles.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,8BAA8B,MAAM,CAAC;AA4BlD,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,sBAAsB,2CAUlC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;yGAI7B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;iBACjB,MAAM;qBACF,MAAM;eACZ,OAAO;eACP,OAAO;yGAuBnB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;eAAgC,OAAO;2HAsBrE,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;yGA8H9B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;eAA2B,OAAO;aAAW,MAAM;yGAW3E,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;
|
|
1
|
+
{"version":3,"file":"StickyNoteNode.styles.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,8BAA8B,MAAM,CAAC;AA4BlD,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,sBAAsB,2CAUlC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;yGAI7B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;iBACjB,MAAM;qBACF,MAAM;eACZ,OAAO;eACP,OAAO;yGAuBnB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;eAAgC,OAAO;2HAsBrE,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;yGA8H9B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;eAA2B,OAAO;aAAW,MAAM;yGAW3E,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;cAA0B,OAAO;yGA+BhE,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;cAA0B,OAAO;yGA+BnE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;UAa5B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;WAA0B,MAAM;gBAAc,OAAO;qHAkB5E,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;iBAA6B,MAAM;yGAQzE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;cAA6B,OAAO;qHAoBhE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;yGAK5B,CAAC"}
|
|
@@ -229,7 +229,7 @@ const TopCornerIndicators = styled.div`
|
|
|
229
229
|
position: absolute;
|
|
230
230
|
inset: 0;
|
|
231
231
|
pointer-events: none;
|
|
232
|
-
opacity: ${(props)=>props.
|
|
232
|
+
opacity: ${(props)=>props.visible ? 1 : 0};
|
|
233
233
|
|
|
234
234
|
/* Top-left corner */
|
|
235
235
|
&::before {
|
|
@@ -261,7 +261,7 @@ const BottomCornerIndicators = styled.div`
|
|
|
261
261
|
position: absolute;
|
|
262
262
|
inset: 0;
|
|
263
263
|
pointer-events: none;
|
|
264
|
-
opacity: ${(props)=>props.
|
|
264
|
+
opacity: ${(props)=>props.visible ? 1 : 0};
|
|
265
265
|
|
|
266
266
|
/* Bottom-left corner */
|
|
267
267
|
&::before {
|
|
@@ -36,6 +36,13 @@ const CanvasThemeContext_cjs_namespaceObject = require("../BaseCanvas/CanvasThem
|
|
|
36
36
|
const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
|
|
37
37
|
const external_ListView_styles_cjs_namespaceObject = require("./ListView.styles.cjs");
|
|
38
38
|
const DEFAULT_SKELETON_COUNT = 3;
|
|
39
|
+
function getInitial(name) {
|
|
40
|
+
const trimmed = name.trim();
|
|
41
|
+
if (!trimmed) return '?';
|
|
42
|
+
return [
|
|
43
|
+
...trimmed
|
|
44
|
+
][0] ?? '?';
|
|
45
|
+
}
|
|
39
46
|
function buildRenderedItems(items, enableSections, loadingSkeleton) {
|
|
40
47
|
const result = [];
|
|
41
48
|
const skeletonConfig = 'object' == typeof loadingSkeleton ? loadingSkeleton : loadingSkeleton ? {} : void 0;
|
|
@@ -162,7 +169,12 @@ const ListViewRow = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ in
|
|
|
162
169
|
icon: item.icon.name,
|
|
163
170
|
size: 24
|
|
164
171
|
}),
|
|
165
|
-
item.icon?.Component && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(item.icon.Component, {})
|
|
172
|
+
item.icon?.Component && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(item.icon.Component, {}),
|
|
173
|
+
!item.icon?.url && !item.icon?.name && !item.icon?.Component && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ListView_styles_cjs_namespaceObject.InitialsBadge, {
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
"data-testid": "list-item-initials-badge",
|
|
176
|
+
children: getInitial(item.name)
|
|
177
|
+
})
|
|
166
178
|
]
|
|
167
179
|
}),
|
|
168
180
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Column, {
|