@rytass/wms-map-react-components 0.1.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/LICENSE +21 -0
- package/README.md +77 -0
- package/components/breadcrumb/breadcrumb-edit-modal.d.ts +9 -0
- package/components/breadcrumb/breadcrumb-edit-modal.js +92 -0
- package/components/breadcrumb/breadcrumb-edit-modal.module.scss.js +3 -0
- package/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/components/breadcrumb/breadcrumb.js +167 -0
- package/components/breadcrumb/breadcrumb.module.scss.js +3 -0
- package/components/canvas/react-flow-canvas.d.ts +37 -0
- package/components/canvas/react-flow-canvas.js +317 -0
- package/components/canvas/react-flow-canvas.module.scss.js +3 -0
- package/components/modal/wms-map-content.d.ts +4 -0
- package/components/modal/wms-map-content.js +753 -0
- package/components/modal/wms-map-header.d.ts +6 -0
- package/components/modal/wms-map-header.js +19 -0
- package/components/modal/wms-map-header.module.scss.js +3 -0
- package/components/modal/wms-map-modal-container.d.ts +4 -0
- package/components/modal/wms-map-modal-container.js +95 -0
- package/components/modal/wms-map-modal-container.module.scss.js +3 -0
- package/components/nodes/base-node.d.ts +12 -0
- package/components/nodes/image-node.d.ts +17 -0
- package/components/nodes/image-node.js +233 -0
- package/components/nodes/image-node.module.scss.js +3 -0
- package/components/nodes/path-node.d.ts +19 -0
- package/components/nodes/path-node.js +550 -0
- package/components/nodes/path-node.module.scss.js +3 -0
- package/components/nodes/rectangle-node.d.ts +11 -0
- package/components/nodes/rectangle-node.js +236 -0
- package/components/nodes/rectangle-node.module.scss.js +3 -0
- package/components/ui/context-menu.d.ts +25 -0
- package/components/ui/context-menu.js +168 -0
- package/components/ui/context-menu.module.scss.js +3 -0
- package/components/ui/toolbar.d.ts +23 -0
- package/components/ui/toolbar.js +278 -0
- package/components/ui/toolbar.module.scss.js +3 -0
- package/components/ui/view-mode-toolbar.d.ts +9 -0
- package/components/ui/view-mode-toolbar.js +41 -0
- package/components/ui/view-mode-toolbar.module.scss.js +3 -0
- package/constants/index.d.ts +45 -0
- package/constants/index.js +37 -0
- package/constants/text-mappings.d.ts +181 -0
- package/constants/text-mappings.js +44 -0
- package/hooks/use-context-menu.d.ts +37 -0
- package/hooks/use-context-menu.js +228 -0
- package/hooks/use-direct-state-history.d.ts +58 -0
- package/hooks/use-direct-state-history.js +214 -0
- package/hooks/use-pen-drawing.d.ts +30 -0
- package/hooks/use-pen-drawing.js +363 -0
- package/hooks/use-rectangle-drawing.d.ts +19 -0
- package/hooks/use-rectangle-drawing.js +136 -0
- package/hooks/use-text-editing.d.ts +19 -0
- package/hooks/use-text-editing.js +153 -0
- package/icons/index.d.ts +15 -0
- package/icons/index.js +209 -0
- package/index.cjs.css +1 -0
- package/index.cjs.js +5033 -0
- package/index.css +1 -0
- package/index.d.ts +5 -0
- package/index.js +4 -0
- package/package.json +40 -0
- package/types/callback.types.d.ts +7 -0
- package/types/canvas.types.d.ts +35 -0
- package/types/component-props.types.d.ts +41 -0
- package/types/history.types.d.ts +24 -0
- package/types/index.d.ts +5 -0
- package/types/react-flow.types.d.ts +30 -0
- package/typings.d.ts +140 -0
- package/typings.js +37 -0
- package/utils/api-data-transform.d.ts +33 -0
- package/utils/api-data-transform.js +218 -0
- package/utils/color-utils.d.ts +17 -0
- package/utils/color-utils.js +55 -0
- package/utils/debug-logger.d.ts +33 -0
- package/utils/debug-logger.js +41 -0
- package/utils/map-data-transform.d.ts +18 -0
- package/utils/map-data-transform.js +342 -0
- package/utils/node-operations.d.ts +26 -0
- package/utils/node-operations.js +83 -0
- package/utils/node-utils.d.ts +10 -0
- package/utils/node-utils.js +37 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { ModalHeader } from '@mezzanine-ui/react';
|
|
4
|
+
import styles from './wms-map-header.module.scss.js';
|
|
5
|
+
|
|
6
|
+
const WMSMapHeader = ({ title = '編輯倉儲空間' })=>{
|
|
7
|
+
return /*#__PURE__*/ jsx(ModalHeader, {
|
|
8
|
+
className: styles.modalHeader,
|
|
9
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
10
|
+
className: styles.headerLeft,
|
|
11
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
12
|
+
className: styles.title,
|
|
13
|
+
children: title
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { WMSMapHeader as default };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { Modal } from '@mezzanine-ui/react';
|
|
4
|
+
import { ReactFlowProvider } from '@xyflow/react';
|
|
5
|
+
import { EditMode, DrawingMode, ViewMode } from '../../typings.js';
|
|
6
|
+
import { DEFAULT_RECTANGLE_COLOR } from '../../constants/index.js';
|
|
7
|
+
import WMSMapHeader from './wms-map-header.js';
|
|
8
|
+
import WMSMapContent from './wms-map-content.js';
|
|
9
|
+
import { setDebugMode } from '../../utils/debug-logger.js';
|
|
10
|
+
import styles from './wms-map-modal-container.module.scss.js';
|
|
11
|
+
|
|
12
|
+
const WMSMapModalContainer = ({ open, onClose, viewMode = ViewMode.EDIT, colorPalette, onNodeClick, onSave, onBreadcrumbClick, onNameChange, initialNodes, initialEdges, debugMode = false, title, onUpload, getFilenameFQDN, maxFileSizeKB, warehouseIds })=>{
|
|
13
|
+
const [editMode, setEditMode] = useState(EditMode.BACKGROUND);
|
|
14
|
+
const [drawingMode, setDrawingMode] = useState(DrawingMode.NONE);
|
|
15
|
+
const [selectedColor, setSelectedColor] = useState(()=>{
|
|
16
|
+
if (colorPalette && colorPalette.length > 0) {
|
|
17
|
+
return colorPalette[0];
|
|
18
|
+
}
|
|
19
|
+
return DEFAULT_RECTANGLE_COLOR;
|
|
20
|
+
});
|
|
21
|
+
// 設定 debug 模式
|
|
22
|
+
useEffect(()=>{
|
|
23
|
+
setDebugMode(debugMode);
|
|
24
|
+
}, [
|
|
25
|
+
debugMode
|
|
26
|
+
]);
|
|
27
|
+
// 當 colorPalette 變化時,確保選中的顏色仍然有效
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
if (colorPalette && colorPalette.length > 0) {
|
|
30
|
+
if (!colorPalette.includes(selectedColor)) {
|
|
31
|
+
setSelectedColor(colorPalette[0]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [
|
|
35
|
+
colorPalette,
|
|
36
|
+
selectedColor
|
|
37
|
+
]);
|
|
38
|
+
const handleEditModeChange = useCallback((mode)=>{
|
|
39
|
+
setEditMode(mode);
|
|
40
|
+
setDrawingMode(DrawingMode.NONE); // 切換編輯模式時重設繪圖模式
|
|
41
|
+
}, []);
|
|
42
|
+
const handleToggleRectangleTool = useCallback(()=>{
|
|
43
|
+
if (editMode !== EditMode.LAYER) return;
|
|
44
|
+
setDrawingMode((prev)=>prev === DrawingMode.RECTANGLE ? DrawingMode.NONE : DrawingMode.RECTANGLE);
|
|
45
|
+
}, [
|
|
46
|
+
editMode
|
|
47
|
+
]);
|
|
48
|
+
const handleTogglePenTool = useCallback(()=>{
|
|
49
|
+
if (editMode !== EditMode.LAYER) return;
|
|
50
|
+
setDrawingMode((prev)=>prev === DrawingMode.PEN ? DrawingMode.NONE : DrawingMode.PEN);
|
|
51
|
+
}, [
|
|
52
|
+
editMode
|
|
53
|
+
]);
|
|
54
|
+
const handleColorChange = useCallback((color)=>{
|
|
55
|
+
setSelectedColor(color);
|
|
56
|
+
}, []);
|
|
57
|
+
return /*#__PURE__*/ jsxs(Modal, {
|
|
58
|
+
open: open,
|
|
59
|
+
onClose: onClose,
|
|
60
|
+
className: styles.modal,
|
|
61
|
+
children: [
|
|
62
|
+
/*#__PURE__*/ jsx(WMSMapHeader, {
|
|
63
|
+
title: title
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ jsx("div", {
|
|
66
|
+
className: styles.content,
|
|
67
|
+
children: /*#__PURE__*/ jsx(ReactFlowProvider, {
|
|
68
|
+
children: /*#__PURE__*/ jsx(WMSMapContent, {
|
|
69
|
+
editMode: editMode,
|
|
70
|
+
drawingMode: drawingMode,
|
|
71
|
+
selectedColor: selectedColor,
|
|
72
|
+
viewMode: viewMode,
|
|
73
|
+
colorPalette: colorPalette,
|
|
74
|
+
onEditModeChange: handleEditModeChange,
|
|
75
|
+
onToggleRectangleTool: handleToggleRectangleTool,
|
|
76
|
+
onTogglePenTool: handleTogglePenTool,
|
|
77
|
+
onColorChange: handleColorChange,
|
|
78
|
+
onNodeClick: onNodeClick,
|
|
79
|
+
onSave: onSave,
|
|
80
|
+
onBreadcrumbClick: onBreadcrumbClick,
|
|
81
|
+
onNameChange: onNameChange,
|
|
82
|
+
initialNodes: initialNodes,
|
|
83
|
+
initialEdges: initialEdges,
|
|
84
|
+
onUpload: onUpload,
|
|
85
|
+
getFilenameFQDN: getFilenameFQDN,
|
|
86
|
+
maxFileSizeKB: maxFileSizeKB,
|
|
87
|
+
warehouseIds: warehouseIds
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { WMSMapModalContainer as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { NodeProps } from '@xyflow/react';
|
|
3
|
+
import { EditMode } from '../../typings';
|
|
4
|
+
interface BaseNodeProps extends NodeProps {
|
|
5
|
+
editMode: EditMode;
|
|
6
|
+
label: string;
|
|
7
|
+
onCopyPaste: () => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const BaseNode: FC<BaseNodeProps>;
|
|
12
|
+
export default BaseNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NodeProps } from '@xyflow/react';
|
|
3
|
+
import { EditMode, ViewMode } from '../../typings';
|
|
4
|
+
interface ImageNodeProps extends NodeProps {
|
|
5
|
+
editMode: EditMode;
|
|
6
|
+
viewMode: ViewMode;
|
|
7
|
+
onResizeComplete?: (id: string, oldSize: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}, newSize: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
showBackground?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.NamedExoticComponent<ImageNodeProps>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { useReactFlow, useUpdateNodeInternals, NodeResizer } from '@xyflow/react';
|
|
4
|
+
import { ViewMode, EditMode } from '../../typings.js';
|
|
5
|
+
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, ACTIVE_OPACITY, INACTIVE_OPACITY } from '../../constants/index.js';
|
|
6
|
+
import { useContextMenu } from '../../hooks/use-context-menu.js';
|
|
7
|
+
import { createImageCopy } from '../../utils/node-operations.js';
|
|
8
|
+
import ContextMenu from '../ui/context-menu.js';
|
|
9
|
+
import styles from './image-node.module.scss.js';
|
|
10
|
+
|
|
11
|
+
const ImageNode = ({ data, selected, id, editMode, viewMode, showBackground = true })=>{
|
|
12
|
+
const { setNodes } = useReactFlow();
|
|
13
|
+
const updateNodeInternals = useUpdateNodeInternals();
|
|
14
|
+
const { imageUrl, width = DEFAULT_IMAGE_WIDTH, height = DEFAULT_IMAGE_HEIGHT, fileName, originalWidth = width, originalHeight = height } = data;
|
|
15
|
+
const [currentSize, setCurrentSize] = useState({
|
|
16
|
+
width,
|
|
17
|
+
height
|
|
18
|
+
});
|
|
19
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
20
|
+
// Sync currentSize with node data when it changes
|
|
21
|
+
useEffect(()=>{
|
|
22
|
+
setCurrentSize({
|
|
23
|
+
width,
|
|
24
|
+
height
|
|
25
|
+
});
|
|
26
|
+
}, [
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
|
+
]);
|
|
30
|
+
// Calculate aspect ratio
|
|
31
|
+
const aspectRatio = originalWidth / originalHeight;
|
|
32
|
+
// Check if this node should be editable based on edit mode and view mode
|
|
33
|
+
const isEditable = viewMode === ViewMode.EDIT && editMode === EditMode.BACKGROUND;
|
|
34
|
+
// Check if this node should be selectable (only in BACKGROUND mode or VIEW mode)
|
|
35
|
+
const isSelectable = editMode === EditMode.BACKGROUND || viewMode === ViewMode.VIEW;
|
|
36
|
+
const opacity = editMode === EditMode.BACKGROUND ? ACTIVE_OPACITY : INACTIVE_OPACITY;
|
|
37
|
+
// Context menu functionality
|
|
38
|
+
const { contextMenu, handleContextMenu, handleCloseContextMenu, handleDelete, arrangeActions, arrangeStates, getNodes, setNodes: setNodesFromHook } = useContextMenu({
|
|
39
|
+
id,
|
|
40
|
+
editMode,
|
|
41
|
+
isEditable,
|
|
42
|
+
nodeType: 'imageNode'
|
|
43
|
+
});
|
|
44
|
+
useCallback((updates)=>{
|
|
45
|
+
setNodes((nodes)=>nodes.map((node)=>node.id === id ? {
|
|
46
|
+
...node,
|
|
47
|
+
data: {
|
|
48
|
+
...node.data,
|
|
49
|
+
...updates
|
|
50
|
+
}
|
|
51
|
+
} : node));
|
|
52
|
+
updateNodeInternals(id);
|
|
53
|
+
}, [
|
|
54
|
+
id,
|
|
55
|
+
setNodes,
|
|
56
|
+
updateNodeInternals
|
|
57
|
+
]);
|
|
58
|
+
const handleResize = useCallback(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
(_event, params)=>{
|
|
60
|
+
const newWidth = params.width;
|
|
61
|
+
const newHeight = newWidth / aspectRatio;
|
|
62
|
+
// 在 resize 過程中更新本地狀態和節點資料以提供正確的視覺回饋
|
|
63
|
+
const newSize = {
|
|
64
|
+
width: newWidth,
|
|
65
|
+
height: newHeight
|
|
66
|
+
};
|
|
67
|
+
setCurrentSize(newSize);
|
|
68
|
+
// 標記正在調整大小,避免在 WmsMapModal 中記錄歷史
|
|
69
|
+
if (!isResizing) {
|
|
70
|
+
setIsResizing(true);
|
|
71
|
+
}
|
|
72
|
+
// 即時更新節點以提供視覺回饋
|
|
73
|
+
setNodes((nodes)=>nodes.map((node)=>node.id === id ? {
|
|
74
|
+
...node,
|
|
75
|
+
data: {
|
|
76
|
+
...node.data,
|
|
77
|
+
width: newWidth,
|
|
78
|
+
height: newHeight,
|
|
79
|
+
isResizing: true
|
|
80
|
+
},
|
|
81
|
+
position: {
|
|
82
|
+
x: params.x ?? 0,
|
|
83
|
+
y: params.y ?? 0
|
|
84
|
+
}
|
|
85
|
+
} : node));
|
|
86
|
+
}, [
|
|
87
|
+
aspectRatio,
|
|
88
|
+
id,
|
|
89
|
+
setNodes,
|
|
90
|
+
isResizing
|
|
91
|
+
]);
|
|
92
|
+
const handleResizeStart = useCallback(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
(_event, _params)=>{
|
|
94
|
+
// 開始調整大小時可以執行額外的邏輯,例如禁用拖拽
|
|
95
|
+
// 這裡保持空白,但提供了擴展點
|
|
96
|
+
}, []);
|
|
97
|
+
const handleResizeEnd = useCallback(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
(_event, params)=>{
|
|
99
|
+
const newWidth = params.width;
|
|
100
|
+
const newHeight = newWidth / aspectRatio;
|
|
101
|
+
// 清除調整大小標記
|
|
102
|
+
setIsResizing(false);
|
|
103
|
+
// 最終更新節點資料,移除 isResizing 標記
|
|
104
|
+
// 這次更新會觸發歷史記錄(因為沒有 isResizing 標記)
|
|
105
|
+
setNodes((nodes)=>nodes.map((node)=>node.id === id ? {
|
|
106
|
+
...node,
|
|
107
|
+
data: {
|
|
108
|
+
...node.data,
|
|
109
|
+
width: newWidth,
|
|
110
|
+
height: newHeight,
|
|
111
|
+
isResizing: undefined
|
|
112
|
+
},
|
|
113
|
+
position: {
|
|
114
|
+
x: params.x ?? 0,
|
|
115
|
+
y: params.y ?? 0
|
|
116
|
+
}
|
|
117
|
+
} : node));
|
|
118
|
+
// 確保內部狀態同步
|
|
119
|
+
updateNodeInternals(id);
|
|
120
|
+
}, [
|
|
121
|
+
aspectRatio,
|
|
122
|
+
id,
|
|
123
|
+
setNodes,
|
|
124
|
+
updateNodeInternals
|
|
125
|
+
]);
|
|
126
|
+
// Handle copy and paste
|
|
127
|
+
const handleCopyPaste = useCallback(()=>{
|
|
128
|
+
const currentNode = getNodes().find((node)=>node.id === id);
|
|
129
|
+
if (!currentNode) {
|
|
130
|
+
console.error('Current node not found');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setNodesFromHook((nds)=>{
|
|
134
|
+
// Calculate next zIndex
|
|
135
|
+
const maxZIndex = Math.max(...nds.map((n)=>n.zIndex || 0), 0);
|
|
136
|
+
const copiedNode = createImageCopy({
|
|
137
|
+
currentNode,
|
|
138
|
+
data: {
|
|
139
|
+
imageUrl,
|
|
140
|
+
width: currentSize.width,
|
|
141
|
+
height: currentSize.height,
|
|
142
|
+
fileName,
|
|
143
|
+
originalWidth,
|
|
144
|
+
originalHeight
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const nodeWithZIndex = {
|
|
148
|
+
...copiedNode,
|
|
149
|
+
zIndex: maxZIndex + 1
|
|
150
|
+
};
|
|
151
|
+
return [
|
|
152
|
+
...nds,
|
|
153
|
+
nodeWithZIndex
|
|
154
|
+
];
|
|
155
|
+
});
|
|
156
|
+
handleCloseContextMenu();
|
|
157
|
+
}, [
|
|
158
|
+
id,
|
|
159
|
+
imageUrl,
|
|
160
|
+
currentSize,
|
|
161
|
+
fileName,
|
|
162
|
+
originalWidth,
|
|
163
|
+
originalHeight,
|
|
164
|
+
getNodes,
|
|
165
|
+
setNodesFromHook,
|
|
166
|
+
handleCloseContextMenu
|
|
167
|
+
]);
|
|
168
|
+
// 計算節點的顯示狀態 - 在檢視模式下受 showBackground 控制
|
|
169
|
+
const isVisible = viewMode === ViewMode.EDIT || showBackground;
|
|
170
|
+
// console.log('🖼️ ImageNode 顯示計算:', {
|
|
171
|
+
// id: id.slice(-4),
|
|
172
|
+
// viewMode,
|
|
173
|
+
// showBackground,
|
|
174
|
+
// isVisible
|
|
175
|
+
// });
|
|
176
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
177
|
+
className: `${styles.imageNode} ${selected ? styles.selected : ''} ${!isSelectable ? styles.nonSelectable : ''}`,
|
|
178
|
+
style: {
|
|
179
|
+
opacity: isVisible ? opacity : 0,
|
|
180
|
+
pointerEvents: isVisible ? 'auto' : 'none',
|
|
181
|
+
transition: 'opacity 0.3s ease'
|
|
182
|
+
},
|
|
183
|
+
children: [
|
|
184
|
+
selected && isEditable && /*#__PURE__*/ jsx(NodeResizer, {
|
|
185
|
+
minWidth: 50,
|
|
186
|
+
minHeight: 50 / aspectRatio,
|
|
187
|
+
keepAspectRatio: true,
|
|
188
|
+
onResizeStart: handleResizeStart,
|
|
189
|
+
onResize: handleResize,
|
|
190
|
+
onResizeEnd: handleResizeEnd,
|
|
191
|
+
isVisible: selected && isEditable,
|
|
192
|
+
color: "#5570d3",
|
|
193
|
+
handleClassName: styles.customResizeHandle
|
|
194
|
+
}),
|
|
195
|
+
/*#__PURE__*/ jsxs("div", {
|
|
196
|
+
className: styles.imageContainer,
|
|
197
|
+
onContextMenu: viewMode === ViewMode.EDIT ? handleContextMenu : undefined,
|
|
198
|
+
children: [
|
|
199
|
+
/*#__PURE__*/ jsx("img", {
|
|
200
|
+
src: imageUrl,
|
|
201
|
+
alt: fileName || 'Uploaded image',
|
|
202
|
+
className: styles.image,
|
|
203
|
+
style: {
|
|
204
|
+
width: `${currentSize.width}px`,
|
|
205
|
+
height: `${currentSize.height}px`,
|
|
206
|
+
maxWidth: '100%',
|
|
207
|
+
maxHeight: '100%',
|
|
208
|
+
opacity: opacity
|
|
209
|
+
},
|
|
210
|
+
draggable: false
|
|
211
|
+
}),
|
|
212
|
+
fileName && /*#__PURE__*/ jsx("div", {
|
|
213
|
+
className: styles.imageLabel,
|
|
214
|
+
children: fileName
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
}),
|
|
218
|
+
viewMode === ViewMode.EDIT && /*#__PURE__*/ jsx(ContextMenu, {
|
|
219
|
+
visible: contextMenu.visible,
|
|
220
|
+
x: contextMenu.x,
|
|
221
|
+
y: contextMenu.y,
|
|
222
|
+
onClose: handleCloseContextMenu,
|
|
223
|
+
onCopyPaste: handleCopyPaste,
|
|
224
|
+
onDelete: handleDelete,
|
|
225
|
+
arrangeActions: arrangeActions,
|
|
226
|
+
arrangeStates: arrangeStates
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
var ImageNode$1 = /*#__PURE__*/ React.memo(ImageNode);
|
|
232
|
+
|
|
233
|
+
export { ImageNode$1 as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"imageNode":"image-node-module_imageNode__RA0Qo","selected":"image-node-module_selected__XB4vQ","image":"image-node-module_image__GnlBw","nonSelectable":"image-node-module_nonSelectable__GF-N6","imageContainer":"image-node-module_imageContainer__Bs4MJ","imageLabel":"image-node-module_imageLabel__BwBbB","customResizeHandle":"image-node-module_customResizeHandle__wBp7h"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { NodeProps } from '@xyflow/react';
|
|
3
|
+
import { EditMode, ViewMode } from '../../typings';
|
|
4
|
+
interface PathNodeProps extends NodeProps {
|
|
5
|
+
editMode: EditMode;
|
|
6
|
+
viewMode: ViewMode;
|
|
7
|
+
onTextEditComplete?: (id: string, oldText: string, newText: string) => void;
|
|
8
|
+
onPathPointsChange?: (id: string, oldPoints: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}[], newPoints: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}[]) => void;
|
|
15
|
+
onPathPointDragStateChange?: (id: string, isDragging: boolean) => void;
|
|
16
|
+
isHovered?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const PathNode: FC<PathNodeProps>;
|
|
19
|
+
export default PathNode;
|