@rytass/wms-map-react-components 0.1.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +181 -0
- package/README.md +30 -0
- package/components/breadcrumb/breadcrumb-edit-modal.cjs +92 -0
- package/components/breadcrumb/breadcrumb-edit-modal.d.cts +9 -0
- package/components/breadcrumb/breadcrumb-edit-modal.module.scss.cjs +5 -0
- package/components/breadcrumb/breadcrumb.cjs +171 -0
- package/components/breadcrumb/breadcrumb.d.cts +11 -0
- package/components/breadcrumb/breadcrumb.d.ts +1 -1
- package/components/breadcrumb/breadcrumb.module.scss.cjs +5 -0
- package/components/canvas/react-flow-canvas.cjs +327 -0
- package/components/canvas/react-flow-canvas.d.cts +40 -0
- package/components/canvas/react-flow-canvas.d.ts +3 -1
- package/components/canvas/react-flow-canvas.js +7 -1
- package/components/canvas/react-flow-canvas.module.scss.cjs +5 -0
- package/components/modal/wms-map-content.cjs +835 -0
- package/components/modal/wms-map-content.d.cts +4 -0
- package/components/modal/wms-map-content.d.ts +1 -1
- package/components/modal/wms-map-content.js +30 -3
- package/components/modal/wms-map-modal-container.cjs +132 -0
- package/components/modal/wms-map-modal-container.d.cts +5 -0
- package/components/modal/wms-map-modal-container.d.ts +2 -2
- package/components/modal/wms-map-modal-container.js +6 -4
- package/components/modal/wms-map-modal-container.module.scss.cjs +5 -0
- package/components/nodes/base-node.d.cts +12 -0
- package/components/nodes/base-node.d.ts +1 -1
- package/components/nodes/image-node.cjs +234 -0
- package/components/nodes/image-node.d.cts +17 -0
- package/components/nodes/image-node.d.ts +1 -1
- package/components/nodes/image-node.js +0 -2
- package/components/nodes/image-node.module.scss.cjs +5 -0
- package/components/nodes/path-node.cjs +554 -0
- package/components/nodes/path-node.d.cts +19 -0
- package/components/nodes/path-node.d.ts +1 -1
- package/components/nodes/path-node.js +6 -5
- package/components/nodes/path-node.module.scss.cjs +5 -0
- package/components/nodes/rectangle-node.cjs +240 -0
- package/components/nodes/rectangle-node.d.cts +11 -0
- package/components/nodes/rectangle-node.d.ts +1 -1
- package/components/nodes/rectangle-node.js +6 -5
- package/components/nodes/rectangle-node.module.scss.cjs +5 -0
- package/components/preview/wms-map-preview.cjs +201 -0
- package/components/preview/wms-map-preview.d.cts +11 -0
- package/components/preview/wms-map-preview.d.ts +11 -0
- package/components/preview/wms-map-preview.js +199 -0
- package/components/ui/context-menu.cjs +171 -0
- package/components/ui/context-menu.d.cts +25 -0
- package/components/ui/context-menu.module.scss.cjs +5 -0
- package/components/ui/toolbar.cjs +286 -0
- package/components/ui/toolbar.d.cts +23 -0
- package/components/ui/toolbar.d.ts +1 -1
- package/components/ui/toolbar.module.scss.cjs +5 -0
- package/components/ui/view-mode-toolbar.cjs +44 -0
- package/components/ui/view-mode-toolbar.d.cts +9 -0
- package/components/ui/view-mode-toolbar.d.ts +1 -1
- package/components/ui/view-mode-toolbar.module.scss.cjs +5 -0
- package/constants/index.cjs +54 -0
- package/constants/index.d.cts +45 -0
- package/constants/index.d.ts +2 -2
- package/constants/text-mappings.cjs +46 -0
- package/constants/text-mappings.d.cts +181 -0
- package/hooks/use-context-menu.cjs +231 -0
- package/hooks/use-context-menu.d.cts +37 -0
- package/hooks/use-context-menu.d.ts +1 -1
- package/hooks/use-direct-state-history.cjs +217 -0
- package/hooks/use-direct-state-history.d.cts +58 -0
- package/hooks/use-direct-state-history.d.ts +2 -2
- package/hooks/use-fit-view-when-ready.cjs +74 -0
- package/hooks/use-fit-view-when-ready.d.cts +18 -0
- package/hooks/use-fit-view-when-ready.d.ts +18 -0
- package/hooks/use-fit-view-when-ready.js +72 -0
- package/hooks/use-pen-drawing.cjs +366 -0
- package/hooks/use-pen-drawing.d.cts +30 -0
- package/hooks/use-pen-drawing.d.ts +1 -1
- package/hooks/use-rectangle-drawing.cjs +139 -0
- package/hooks/use-rectangle-drawing.d.cts +19 -0
- package/hooks/use-rectangle-drawing.d.ts +1 -1
- package/hooks/use-text-editing.cjs +156 -0
- package/hooks/use-text-editing.d.cts +19 -0
- package/icons/index.cjs +233 -0
- package/icons/index.d.cts +16 -0
- package/index.cjs +28 -0
- package/index.d.cts +6 -0
- package/index.d.ts +6 -5
- package/index.js +1 -0
- package/package.json +68 -3
- package/types/callback.types.d.cts +7 -0
- package/types/callback.types.d.ts +1 -1
- package/types/canvas.types.d.cts +35 -0
- package/types/canvas.types.d.ts +1 -1
- package/types/component-props.types.d.cts +76 -0
- package/types/component-props.types.d.ts +33 -2
- package/types/history.types.d.cts +24 -0
- package/types/history.types.d.ts +2 -2
- package/types/index.d.cts +5 -0
- package/types/index.d.ts +5 -5
- package/types/react-flow.types.d.cts +30 -0
- package/typings.cjs +44 -0
- package/typings.d.cts +136 -0
- package/utils/api-data-transform.cjs +221 -0
- package/utils/api-data-transform.d.cts +33 -0
- package/utils/api-data-transform.d.ts +1 -1
- package/utils/color-utils.cjs +58 -0
- package/utils/color-utils.d.cts +17 -0
- package/utils/debug-logger.cjs +45 -0
- package/utils/debug-logger.d.cts +33 -0
- package/utils/fit-trigger.cjs +41 -0
- package/utils/fit-trigger.d.cts +37 -0
- package/utils/fit-trigger.d.ts +37 -0
- package/utils/fit-trigger.js +36 -0
- package/utils/map-data-transform.cjs +360 -0
- package/utils/map-data-transform.d.cts +18 -0
- package/utils/map-data-transform.d.ts +1 -1
- package/utils/node-operations.cjs +88 -0
- package/utils/node-operations.d.cts +26 -0
- package/utils/node-utils.cjs +40 -0
- package/utils/node-utils.d.cts +10 -0
- package/utils/preview-highlight.cjs +38 -0
- package/utils/preview-highlight.d.cts +12 -0
- package/utils/preview-highlight.d.ts +12 -0
- package/utils/preview-highlight.js +34 -0
- package/index.cjs.css +0 -1
- package/index.cjs.js +0 -5128
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/wms-map-react-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Rytass Warehouse Management System Map React Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rytass",
|
|
@@ -32,7 +32,72 @@
|
|
|
32
32
|
"@storybook/react-vite": "^10.3.5",
|
|
33
33
|
"storybook": "^10.3.5"
|
|
34
34
|
},
|
|
35
|
-
"
|
|
35
|
+
"type": "module",
|
|
36
|
+
"main": "./index.cjs",
|
|
36
37
|
"module": "./index.js",
|
|
37
|
-
"
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"typings": "./index.d.ts",
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20.19.0"
|
|
42
|
+
},
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./index.d.ts",
|
|
47
|
+
"default": "./index.js"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./index.d.cts",
|
|
51
|
+
"default": "./index.cjs"
|
|
52
|
+
},
|
|
53
|
+
"default": "./index.js"
|
|
54
|
+
},
|
|
55
|
+
"./constants": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./constants/index.d.ts",
|
|
58
|
+
"default": "./constants/index.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./constants/index.d.cts",
|
|
62
|
+
"default": "./constants/index.cjs"
|
|
63
|
+
},
|
|
64
|
+
"default": "./constants/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./icons": {
|
|
67
|
+
"import": {
|
|
68
|
+
"types": "./icons/index.d.ts",
|
|
69
|
+
"default": "./icons/index.js"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./icons/index.d.cts",
|
|
73
|
+
"default": "./icons/index.cjs"
|
|
74
|
+
},
|
|
75
|
+
"default": "./icons/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./package.json": "./package.json",
|
|
78
|
+
"./*.css": "./*.css",
|
|
79
|
+
"./*.json": "./*.json",
|
|
80
|
+
"./*.js": {
|
|
81
|
+
"import": {
|
|
82
|
+
"types": "./*.d.ts",
|
|
83
|
+
"default": "./*.js"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./*.d.cts",
|
|
87
|
+
"default": "./*.cjs"
|
|
88
|
+
},
|
|
89
|
+
"default": "./*.js"
|
|
90
|
+
},
|
|
91
|
+
"./*": {
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./*.d.ts",
|
|
94
|
+
"default": "./*.js"
|
|
95
|
+
},
|
|
96
|
+
"require": {
|
|
97
|
+
"types": "./*.d.cts",
|
|
98
|
+
"default": "./*.cjs"
|
|
99
|
+
},
|
|
100
|
+
"default": "./*.js"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
38
103
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FlowNode, FlowEdge } from './react-flow.types.cjs';
|
|
2
|
+
export interface NodesStateSetterCallback {
|
|
3
|
+
(updater: (currentNodes: FlowNode[]) => FlowNode[]): void;
|
|
4
|
+
}
|
|
5
|
+
export interface EdgesStateSetterCallback {
|
|
6
|
+
(updater: (currentEdges: FlowEdge[]) => FlowEdge[]): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FlowNode } from './react-flow.types.cjs';
|
|
2
|
+
export interface ImageNodeData {
|
|
3
|
+
imageUrl: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
originalWidth: number;
|
|
7
|
+
originalHeight: number;
|
|
8
|
+
fileName: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RectangleNodeData {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
color: string;
|
|
14
|
+
label: string;
|
|
15
|
+
isResizing?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface PathNodeData {
|
|
18
|
+
points: Array<{
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}>;
|
|
22
|
+
color: string;
|
|
23
|
+
strokeWidth: number;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NodeCreationData {
|
|
27
|
+
currentNode: FlowNode;
|
|
28
|
+
nodeType: string;
|
|
29
|
+
data: ImageNodeData | RectangleNodeData | PathNodeData;
|
|
30
|
+
}
|
|
31
|
+
export interface CanvasViewport {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
zoom: number;
|
|
35
|
+
}
|
package/types/canvas.types.d.ts
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { ViewMode, WMSNodeClickInfo, Map, EditMode, DrawingMode } from '../typings.cjs';
|
|
3
|
+
import { FlowNode, FlowEdge } from './react-flow.types.cjs';
|
|
4
|
+
export interface WMSMapModalProps {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
open: boolean;
|
|
7
|
+
viewMode?: ViewMode;
|
|
8
|
+
colorPalette?: string[];
|
|
9
|
+
showBreadcrumbEditButton?: (warehouseIds: string[]) => boolean;
|
|
10
|
+
onNodeClick?: (nodeInfo: WMSNodeClickInfo) => void;
|
|
11
|
+
onNodeDoubleClick?: (nodeInfo: WMSNodeClickInfo) => void;
|
|
12
|
+
onSave?: (mapData: Map) => void;
|
|
13
|
+
onBreadcrumbClick?: (warehouseId: string, index: number) => void;
|
|
14
|
+
onNameChange?: (name: string) => Promise<void>;
|
|
15
|
+
initialNodes?: FlowNode[];
|
|
16
|
+
initialEdges?: FlowEdge[];
|
|
17
|
+
debugMode?: boolean;
|
|
18
|
+
title?: string;
|
|
19
|
+
onUpload: (files: File[]) => Promise<string[]>;
|
|
20
|
+
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
21
|
+
maxFileSizeKB?: number;
|
|
22
|
+
warehouseIds?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* 開圖時自動縮放到框住所有節點,預設 true。
|
|
25
|
+
* 只在換到另一張地圖(warehouseIds 改變)或同一張圖第一次拿到非空節點時 fit;
|
|
26
|
+
* 同一張圖的節點增減(編輯後儲存、重新抓資料)不會重新 fit。
|
|
27
|
+
* 換圖時請讓 warehouseIds 不晚於 initialNodes 更新。
|
|
28
|
+
*/
|
|
29
|
+
fitViewOnLoad?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface WMSMapContentProps {
|
|
32
|
+
editMode: EditMode;
|
|
33
|
+
drawingMode: DrawingMode;
|
|
34
|
+
selectedColor: string;
|
|
35
|
+
viewMode: ViewMode;
|
|
36
|
+
colorPalette?: string[];
|
|
37
|
+
showBreadcrumbEditButton?: (warehouseIds: string[]) => boolean;
|
|
38
|
+
onEditModeChange: (mode: EditMode) => void;
|
|
39
|
+
onToggleRectangleTool: () => void;
|
|
40
|
+
onTogglePenTool: () => void;
|
|
41
|
+
onColorChange: (color: string) => void;
|
|
42
|
+
onNodeClick?: (nodeInfo: WMSNodeClickInfo) => void;
|
|
43
|
+
onNodeDoubleClick?: (nodeInfo: WMSNodeClickInfo) => void;
|
|
44
|
+
onSave?: (mapData: Map) => void;
|
|
45
|
+
onBreadcrumbClick?: (warehouseId: string, index: number) => void;
|
|
46
|
+
onNameChange?: (name: string) => Promise<void>;
|
|
47
|
+
initialNodes?: FlowNode[];
|
|
48
|
+
initialEdges?: FlowEdge[];
|
|
49
|
+
onUpload: (files: File[]) => Promise<string[]>;
|
|
50
|
+
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
51
|
+
maxFileSizeKB?: number;
|
|
52
|
+
warehouseIds?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* 開圖時自動縮放到框住所有節點,預設 true。
|
|
55
|
+
* 只在換到另一張地圖(warehouseIds 改變)或同一張圖第一次拿到非空節點時 fit;
|
|
56
|
+
* 同一張圖的節點增減(編輯後儲存、重新抓資料)不會重新 fit。
|
|
57
|
+
* 換圖時請讓 warehouseIds 不晚於 initialNodes 更新。
|
|
58
|
+
*/
|
|
59
|
+
fitViewOnLoad?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface WMSMapPreviewProps {
|
|
62
|
+
/** 要顯示的節點(與 WMSMapModal 的 initialNodes 同格式)。 */
|
|
63
|
+
initialNodes: FlowNode[];
|
|
64
|
+
/** 要高亮的範圍節點 id;有值時 fit 只框住這些節點。 */
|
|
65
|
+
highlightIds?: string[];
|
|
66
|
+
/** 有 highlightIds 時是否淡化其餘範圍,預設 true。 */
|
|
67
|
+
dimOthers?: boolean;
|
|
68
|
+
/** fit 時的比例 padding,預設 0.15。 */
|
|
69
|
+
fitPadding?: number;
|
|
70
|
+
/** 是否允許平移與縮放,預設 false(完全靜態)。任何情況下都不可選取或編輯。 */
|
|
71
|
+
interactive?: boolean;
|
|
72
|
+
/** 提供時,背景圖改用 `getFilenameFQDN(data.fileName)` 的結果作為圖片網址。 */
|
|
73
|
+
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
74
|
+
className?: string;
|
|
75
|
+
style?: CSSProperties;
|
|
76
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { ViewMode, WMSNodeClickInfo, Map, EditMode, DrawingMode } from '../typings.js';
|
|
3
|
+
import { FlowNode, FlowEdge } from './react-flow.types.js';
|
|
3
4
|
export interface WMSMapModalProps {
|
|
4
5
|
onClose: () => void;
|
|
5
6
|
open: boolean;
|
|
@@ -19,6 +20,13 @@ export interface WMSMapModalProps {
|
|
|
19
20
|
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
20
21
|
maxFileSizeKB?: number;
|
|
21
22
|
warehouseIds?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* 開圖時自動縮放到框住所有節點,預設 true。
|
|
25
|
+
* 只在換到另一張地圖(warehouseIds 改變)或同一張圖第一次拿到非空節點時 fit;
|
|
26
|
+
* 同一張圖的節點增減(編輯後儲存、重新抓資料)不會重新 fit。
|
|
27
|
+
* 換圖時請讓 warehouseIds 不晚於 initialNodes 更新。
|
|
28
|
+
*/
|
|
29
|
+
fitViewOnLoad?: boolean;
|
|
22
30
|
}
|
|
23
31
|
export interface WMSMapContentProps {
|
|
24
32
|
editMode: EditMode;
|
|
@@ -42,4 +50,27 @@ export interface WMSMapContentProps {
|
|
|
42
50
|
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
43
51
|
maxFileSizeKB?: number;
|
|
44
52
|
warehouseIds?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* 開圖時自動縮放到框住所有節點,預設 true。
|
|
55
|
+
* 只在換到另一張地圖(warehouseIds 改變)或同一張圖第一次拿到非空節點時 fit;
|
|
56
|
+
* 同一張圖的節點增減(編輯後儲存、重新抓資料)不會重新 fit。
|
|
57
|
+
* 換圖時請讓 warehouseIds 不晚於 initialNodes 更新。
|
|
58
|
+
*/
|
|
59
|
+
fitViewOnLoad?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface WMSMapPreviewProps {
|
|
62
|
+
/** 要顯示的節點(與 WMSMapModal 的 initialNodes 同格式)。 */
|
|
63
|
+
initialNodes: FlowNode[];
|
|
64
|
+
/** 要高亮的範圍節點 id;有值時 fit 只框住這些節點。 */
|
|
65
|
+
highlightIds?: string[];
|
|
66
|
+
/** 有 highlightIds 時是否淡化其餘範圍,預設 true。 */
|
|
67
|
+
dimOthers?: boolean;
|
|
68
|
+
/** fit 時的比例 padding,預設 0.15。 */
|
|
69
|
+
fitPadding?: number;
|
|
70
|
+
/** 是否允許平移與縮放,預設 false(完全靜態)。任何情況下都不可選取或編輯。 */
|
|
71
|
+
interactive?: boolean;
|
|
72
|
+
/** 提供時,背景圖改用 `getFilenameFQDN(data.fileName)` 的結果作為圖片網址。 */
|
|
73
|
+
getFilenameFQDN?: (filename: string) => Promise<string> | string;
|
|
74
|
+
className?: string;
|
|
75
|
+
style?: CSSProperties;
|
|
45
76
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EditMode } from '../typings.cjs';
|
|
2
|
+
import { FlowNode, FlowEdge } from './react-flow.types.cjs';
|
|
3
|
+
export interface HistoryState {
|
|
4
|
+
nodes: FlowNode[];
|
|
5
|
+
edges: FlowEdge[];
|
|
6
|
+
editMode: EditMode;
|
|
7
|
+
operation: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HistoryOperation {
|
|
11
|
+
index: number;
|
|
12
|
+
operation: string;
|
|
13
|
+
nodes: number;
|
|
14
|
+
edges: number;
|
|
15
|
+
isCurrent: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface HistorySummary {
|
|
18
|
+
canUndo: boolean;
|
|
19
|
+
canRedo: boolean;
|
|
20
|
+
historyLength: number;
|
|
21
|
+
currentIndex: number;
|
|
22
|
+
currentOperation?: string;
|
|
23
|
+
operations?: HistoryOperation[];
|
|
24
|
+
}
|
package/types/history.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditMode } from '../typings';
|
|
2
|
-
import { FlowNode, FlowEdge } from './react-flow.types';
|
|
1
|
+
import { EditMode } from '../typings.js';
|
|
2
|
+
import { FlowNode, FlowEdge } from './react-flow.types.js';
|
|
3
3
|
export interface HistoryState {
|
|
4
4
|
nodes: FlowNode[];
|
|
5
5
|
edges: FlowEdge[];
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './react-flow.types';
|
|
2
|
-
export * from './canvas.types';
|
|
3
|
-
export * from './history.types';
|
|
4
|
-
export * from './component-props.types';
|
|
5
|
-
export * from './callback.types';
|
|
1
|
+
export * from './react-flow.types.js';
|
|
2
|
+
export * from './canvas.types.js';
|
|
3
|
+
export * from './history.types.js';
|
|
4
|
+
export * from './component-props.types.js';
|
|
5
|
+
export * from './callback.types.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Node, Edge, NodeChange, EdgeChange } from '@xyflow/react';
|
|
2
|
+
export interface NodeDataBase {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface FlowNode extends Node {
|
|
6
|
+
id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
position: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
selectable?: boolean;
|
|
14
|
+
draggable?: boolean;
|
|
15
|
+
deletable?: boolean;
|
|
16
|
+
data: NodeDataBase;
|
|
17
|
+
}
|
|
18
|
+
export interface FlowEdge extends Edge {
|
|
19
|
+
id: string;
|
|
20
|
+
source: string;
|
|
21
|
+
target: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FlowNodesChangeHandler {
|
|
24
|
+
(changes: NodeChange<FlowNode>[]): void;
|
|
25
|
+
}
|
|
26
|
+
export interface FlowEdgesChangeHandler {
|
|
27
|
+
(changes: EdgeChange[]): void;
|
|
28
|
+
}
|
|
29
|
+
export type FlowNodeChange = NodeChange<FlowNode>;
|
|
30
|
+
export type FlowEdgeChange = EdgeChange;
|
package/typings.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var MapRangeColor = /*#__PURE__*/ function(MapRangeColor) {
|
|
4
|
+
MapRangeColor["RED"] = "RED";
|
|
5
|
+
MapRangeColor["YELLOW"] = "YELLOW";
|
|
6
|
+
MapRangeColor["GREEN"] = "GREEN";
|
|
7
|
+
MapRangeColor["BLUE"] = "BLUE";
|
|
8
|
+
MapRangeColor["BLACK"] = "BLACK";
|
|
9
|
+
return MapRangeColor;
|
|
10
|
+
}({});
|
|
11
|
+
var MapRangeType = /*#__PURE__*/ function(MapRangeType) {
|
|
12
|
+
MapRangeType["RECTANGLE"] = "RECTANGLE";
|
|
13
|
+
MapRangeType["POLYGON"] = "POLYGON";
|
|
14
|
+
return MapRangeType;
|
|
15
|
+
}({});
|
|
16
|
+
var EditMode = /*#__PURE__*/ function(EditMode) {
|
|
17
|
+
EditMode["BACKGROUND"] = "BACKGROUND";
|
|
18
|
+
EditMode["LAYER"] = "LAYER";
|
|
19
|
+
return EditMode;
|
|
20
|
+
}({});
|
|
21
|
+
var DrawingMode = /*#__PURE__*/ function(DrawingMode) {
|
|
22
|
+
DrawingMode["NONE"] = "NONE";
|
|
23
|
+
DrawingMode["RECTANGLE"] = "RECTANGLE";
|
|
24
|
+
DrawingMode["PEN"] = "PEN";
|
|
25
|
+
return DrawingMode;
|
|
26
|
+
}({});
|
|
27
|
+
var LayerDrawingTool = /*#__PURE__*/ function(LayerDrawingTool) {
|
|
28
|
+
LayerDrawingTool["SELECT"] = "SELECT";
|
|
29
|
+
LayerDrawingTool["RECTANGLE"] = "RECTANGLE";
|
|
30
|
+
LayerDrawingTool["PEN"] = "PEN";
|
|
31
|
+
return LayerDrawingTool;
|
|
32
|
+
}({});
|
|
33
|
+
var ViewMode = /*#__PURE__*/ function(ViewMode) {
|
|
34
|
+
ViewMode["EDIT"] = "EDIT";
|
|
35
|
+
ViewMode["VIEW"] = "VIEW";
|
|
36
|
+
return ViewMode;
|
|
37
|
+
}({});
|
|
38
|
+
|
|
39
|
+
exports.DrawingMode = DrawingMode;
|
|
40
|
+
exports.EditMode = EditMode;
|
|
41
|
+
exports.LayerDrawingTool = LayerDrawingTool;
|
|
42
|
+
exports.MapRangeColor = MapRangeColor;
|
|
43
|
+
exports.MapRangeType = MapRangeType;
|
|
44
|
+
exports.ViewMode = ViewMode;
|
package/typings.d.cts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export type ID = string;
|
|
2
|
+
export declare enum MapRangeColor {
|
|
3
|
+
RED = "RED",
|
|
4
|
+
YELLOW = "YELLOW",
|
|
5
|
+
GREEN = "GREEN",
|
|
6
|
+
BLUE = "BLUE",
|
|
7
|
+
BLACK = "BLACK"
|
|
8
|
+
}
|
|
9
|
+
export declare enum MapRangeType {
|
|
10
|
+
RECTANGLE = "RECTANGLE",
|
|
11
|
+
POLYGON = "POLYGON"
|
|
12
|
+
}
|
|
13
|
+
interface MapRange {
|
|
14
|
+
id: ID;
|
|
15
|
+
type: MapRangeType;
|
|
16
|
+
color: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MapBackground {
|
|
19
|
+
id: ID;
|
|
20
|
+
filename: string;
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
export interface Map {
|
|
27
|
+
id: ID;
|
|
28
|
+
backgrounds: MapBackground[];
|
|
29
|
+
ranges: MapRange[];
|
|
30
|
+
}
|
|
31
|
+
export interface MapRectangleRange extends MapRange {
|
|
32
|
+
type: MapRangeType.RECTANGLE;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
}
|
|
38
|
+
export interface MapPolygonRangePoint {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}
|
|
42
|
+
export interface MapPolygonRange extends MapRange {
|
|
43
|
+
type: MapRangeType.POLYGON;
|
|
44
|
+
points: MapPolygonRangePoint[];
|
|
45
|
+
}
|
|
46
|
+
export declare enum EditMode {
|
|
47
|
+
BACKGROUND = "BACKGROUND",
|
|
48
|
+
LAYER = "LAYER"
|
|
49
|
+
}
|
|
50
|
+
export declare enum DrawingMode {
|
|
51
|
+
NONE = "NONE",
|
|
52
|
+
RECTANGLE = "RECTANGLE",
|
|
53
|
+
PEN = "PEN"
|
|
54
|
+
}
|
|
55
|
+
export declare enum LayerDrawingTool {
|
|
56
|
+
SELECT = "SELECT",
|
|
57
|
+
RECTANGLE = "RECTANGLE",
|
|
58
|
+
PEN = "PEN"
|
|
59
|
+
}
|
|
60
|
+
export declare enum ViewMode {
|
|
61
|
+
EDIT = "EDIT",
|
|
62
|
+
VIEW = "VIEW"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 圖形點擊資訊基礎介面
|
|
66
|
+
*/
|
|
67
|
+
export interface NodeClickInfo {
|
|
68
|
+
id: ID;
|
|
69
|
+
type: string;
|
|
70
|
+
position: {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
};
|
|
74
|
+
zIndex?: number;
|
|
75
|
+
selected?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 背景圖片點擊資訊
|
|
79
|
+
*/
|
|
80
|
+
export interface ImageNodeClickInfo extends NodeClickInfo {
|
|
81
|
+
type: 'imageNode';
|
|
82
|
+
imageData: {
|
|
83
|
+
filename: string;
|
|
84
|
+
size: {
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
};
|
|
88
|
+
originalSize: {
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
};
|
|
92
|
+
imageUrl: string;
|
|
93
|
+
};
|
|
94
|
+
mapBackground: MapBackground;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 矩形圖形點擊資訊
|
|
98
|
+
*/
|
|
99
|
+
export interface RectangleNodeClickInfo extends NodeClickInfo {
|
|
100
|
+
type: 'rectangleNode';
|
|
101
|
+
rectangleData: {
|
|
102
|
+
color: string;
|
|
103
|
+
size: {
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
mapRectangleRange: MapRectangleRange;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 路徑圖形點擊資訊
|
|
112
|
+
*/
|
|
113
|
+
export interface PathNodeClickInfo extends NodeClickInfo {
|
|
114
|
+
type: 'pathNode';
|
|
115
|
+
pathData: {
|
|
116
|
+
color: string;
|
|
117
|
+
strokeWidth: number;
|
|
118
|
+
pointCount: number;
|
|
119
|
+
points: {
|
|
120
|
+
x: number;
|
|
121
|
+
y: number;
|
|
122
|
+
}[];
|
|
123
|
+
bounds: {
|
|
124
|
+
minX: number;
|
|
125
|
+
minY: number;
|
|
126
|
+
maxX: number;
|
|
127
|
+
maxY: number;
|
|
128
|
+
} | null;
|
|
129
|
+
};
|
|
130
|
+
mapPolygonRange: MapPolygonRange;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 所有圖形點擊資訊的聯合類型
|
|
134
|
+
*/
|
|
135
|
+
export type WMSNodeClickInfo = ImageNodeClickInfo | RectangleNodeClickInfo | PathNodeClickInfo;
|
|
136
|
+
export {};
|