seat-editor 3.3.13 → 3.3.15
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/app/constant.d.ts +1 -0
- package/dist/app/constant.js +1 -0
- package/dist/app/layout.d.ts +6 -0
- package/dist/app/layout.jsx +27 -0
- package/dist/app/new-board/page.jsx +55 -0
- package/dist/app/old-board/page.d.ts +3 -0
- package/dist/app/old-board/page.jsx +510 -0
- package/dist/app/only-view/chair.d.ts +1 -0
- package/dist/app/only-view/chair.js +12 -0
- package/dist/app/only-view/constant.d.ts +60 -0
- package/dist/app/only-view/constant.js +1336 -0
- package/dist/app/only-view/page.jsx +248 -0
- package/dist/app/only-view/user.d.ts +1 -0
- package/dist/app/only-view/user.js +12 -0
- package/dist/app/page.d.ts +2 -0
- package/dist/app/page.jsx +13 -0
- package/dist/app/test/page.d.ts +2 -0
- package/dist/app/test/page.jsx +45 -0
- package/dist/app/v2/page.d.ts +2 -0
- package/dist/app/v2/page.jsx +13 -0
- package/dist/components/button-tools/index.d.ts +11 -0
- package/dist/components/button-tools/index.jsx +17 -0
- package/dist/components/form-tools/label.d.ts +2 -0
- package/dist/components/form-tools/label.jsx +63 -0
- package/dist/components/form-tools/shape.d.ts +8 -0
- package/dist/components/form-tools/shape.jsx +113 -0
- package/dist/components/input/number-indicator.d.ts +7 -0
- package/dist/components/input/number-indicator.jsx +36 -0
- package/dist/components/joystick/index.d.ts +12 -0
- package/dist/components/joystick/index.jsx +49 -0
- package/dist/components/layer/index.d.ts +19 -0
- package/dist/components/layer/index.jsx +383 -0
- package/dist/components/layer-v2/index.d.ts +19 -0
- package/dist/components/layer-v2/index.jsx +370 -0
- package/dist/components/layer-v3/index.d.ts +13 -0
- package/dist/components/layer-v3/index.jsx +631 -0
- package/dist/components/layer-v3/utils.d.ts +19 -0
- package/dist/components/layer-v3/utils.js +72 -0
- package/dist/components/layer-v4/constant.d.ts +60 -0
- package/dist/components/layer-v4/constant.js +93 -0
- package/dist/components/layer-v4/index.d.ts +24 -0
- package/dist/components/layer-v4/index.jsx +1046 -0
- package/dist/components/lib/index.d.ts +8 -0
- package/dist/components/lib/index.jsx +33 -0
- package/dist/components/modal-preview/index.d.ts +4 -0
- package/dist/components/modal-preview/index.jsx +11 -0
- package/dist/dto/event-handler.d.ts +1 -0
- package/dist/dto/event-handler.js +1 -0
- package/dist/dto/table.d.ts +80 -0
- package/dist/dto/table.js +1 -0
- package/dist/features/board/board-slice.d.ts +14 -0
- package/dist/features/board/board-slice.js +52 -0
- package/dist/features/board/index.d.ts +6 -0
- package/dist/features/board/index.jsx +725 -0
- package/dist/features/board-v2/board-slice.d.ts +14 -0
- package/dist/features/board-v2/board-slice.js +52 -0
- package/dist/features/board-v2/index.d.ts +8 -0
- package/dist/features/board-v2/index.jsx +869 -0
- package/dist/features/board-v3/board-slice.d.ts +19 -0
- package/dist/features/board-v3/board-slice.js +274 -0
- package/dist/features/board-v3/constant.d.ts +5 -0
- package/dist/features/board-v3/constant.js +5 -0
- package/dist/features/board-v3/history-slice.d.ts +27 -0
- package/dist/features/board-v3/history-slice.js +27 -0
- package/dist/features/board-v3/icons.d.ts +4 -0
- package/dist/features/board-v3/icons.jsx +100 -0
- package/dist/features/board-v3/index.d.ts +16 -0
- package/dist/features/board-v3/index.jsx +1678 -0
- package/dist/features/board-v3/polygon.d.ts +28 -0
- package/dist/features/board-v3/polygon.js +109 -0
- package/dist/features/board-v3/rect.d.ts +9 -0
- package/dist/features/board-v3/rect.js +152 -0
- package/dist/features/board-v3/resize-element.d.ts +12 -0
- package/dist/features/board-v3/resize-element.js +43 -0
- package/dist/features/board-v3/utils.d.ts +180 -0
- package/dist/features/board-v3/utils.js +1235 -0
- package/dist/features/navbar/index.d.ts +2 -0
- package/dist/features/navbar/index.jsx +5 -0
- package/dist/features/panel/index.d.ts +6 -0
- package/dist/features/panel/index.jsx +251 -0
- package/dist/features/panel/panel-slice.d.ts +23 -0
- package/dist/features/panel/panel-slice.js +46 -0
- package/dist/features/panel/select-tool.d.ts +6 -0
- package/dist/features/panel/select-tool.jsx +70 -0
- package/dist/features/panel/selected-group.d.ts +2 -0
- package/dist/features/panel/selected-group.jsx +93 -0
- package/dist/features/panel/square-circle-tool.d.ts +2 -0
- package/dist/features/panel/square-circle-tool.jsx +10 -0
- package/dist/features/panel/table-seat-circle.d.ts +2 -0
- package/dist/features/panel/table-seat-circle.jsx +36 -0
- package/dist/features/panel/table-seat-square.d.ts +2 -0
- package/dist/features/panel/table-seat-square.jsx +51 -0
- package/dist/features/panel/text-tool.d.ts +2 -0
- package/dist/features/panel/text-tool.jsx +57 -0
- package/dist/features/panel/upload-tool.d.ts +10 -0
- package/dist/features/panel/upload-tool.jsx +176 -0
- package/dist/features/panel/utils.d.ts +5 -0
- package/dist/features/panel/utils.js +47 -0
- package/dist/features/side-tool/index.d.ts +8 -0
- package/dist/features/side-tool/index.jsx +390 -0
- package/dist/features/side-tool/side-tool-slice.d.ts +16 -0
- package/dist/features/side-tool/side-tool-slice.js +28 -0
- package/dist/features/theme/theme-slice.d.ts +12 -0
- package/dist/features/theme/theme-slice.js +15 -0
- package/dist/features/view-only/index.d.ts +19 -0
- package/dist/features/view-only/index.jsx +205 -0
- package/dist/features/view-only-2/index.d.ts +19 -0
- package/dist/features/view-only-2/index.jsx +190 -0
- package/dist/features/view-only-3/index.d.ts +89 -0
- package/dist/features/view-only-3/index.jsx +590 -0
- package/dist/features/view-only-3/utils.d.ts +1 -0
- package/dist/features/view-only-3/utils.js +3 -0
- package/dist/hooks/use-redux.d.ts +4 -0
- package/dist/hooks/use-redux.js +3 -0
- package/dist/index.js +10 -0
- package/dist/libs/middleware.d.ts +2 -0
- package/dist/libs/middleware.js +5 -0
- package/dist/libs/rootReducer.d.ts +12 -0
- package/dist/libs/rootReducer.js +14 -0
- package/dist/libs/store.d.ts +18 -0
- package/dist/libs/store.js +19 -0
- package/dist/provider/antd-provider.d.ts +4 -0
- package/dist/provider/antd-provider.jsx +46 -0
- package/dist/provider/redux-provider.d.ts +3 -0
- package/dist/provider/redux-provider.jsx +6 -0
- package/dist/provider/store-provider.d.ts +4 -0
- package/dist/provider/store-provider.jsx +10 -0
- package/dist/utils/constant.d.ts +3 -0
- package/dist/utils/constant.js +13 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.js +29 -0
- package/dist/utils/injectCss.d.ts +1 -0
- package/dist/utils/injectCss.js +13 -0
- package/dist/utils/regex.d.ts +3 -0
- package/dist/utils/regex.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Grid, Lock, LockOpen, Undo2, Redo2, PenTool, Scan, } from "lucide-react";
|
|
3
|
+
import ButtonTools from "../../components/button-tools";
|
|
4
|
+
import { Divider, ColorPicker, Button, message, } from "antd";
|
|
5
|
+
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
8
|
+
const [color, setColor] = useState("#000000");
|
|
9
|
+
const dispatch = useAppDispatch();
|
|
10
|
+
const { active, grid, lockBackground } = useAppSelector((state) => state.tool);
|
|
11
|
+
const { selectedComponent } = useAppSelector((state) => state.panel);
|
|
12
|
+
const { components, extraComponents } = useAppSelector((state) => state.board);
|
|
13
|
+
const [preview, setPreview] = useState(false);
|
|
14
|
+
const tools = [
|
|
15
|
+
{
|
|
16
|
+
id: "select",
|
|
17
|
+
name: "Select Tool",
|
|
18
|
+
icon: <MousePointer />,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "grab",
|
|
22
|
+
name: "Grab Tool",
|
|
23
|
+
icon: <Hand />,
|
|
24
|
+
},
|
|
25
|
+
// {
|
|
26
|
+
// id: "ruler",
|
|
27
|
+
// name: "Ruler",
|
|
28
|
+
// icon: <Ruler />,
|
|
29
|
+
// },
|
|
30
|
+
// {
|
|
31
|
+
// id: "bounding-box",
|
|
32
|
+
// name: "Bounding Box Tool",
|
|
33
|
+
// icon: <Scan />,
|
|
34
|
+
// }
|
|
35
|
+
// {
|
|
36
|
+
// id: "node",
|
|
37
|
+
// name: "Node Tool",
|
|
38
|
+
// icon: <MousePointer2 />,
|
|
39
|
+
// },
|
|
40
|
+
];
|
|
41
|
+
const actionsTools = [
|
|
42
|
+
// {
|
|
43
|
+
// id: "table-split",
|
|
44
|
+
// name: "Table Split",
|
|
45
|
+
// icon: <TableCellsSplit />,
|
|
46
|
+
// },
|
|
47
|
+
{
|
|
48
|
+
id: "square",
|
|
49
|
+
name: "Square",
|
|
50
|
+
icon: <SquareMousePointer />,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "circle",
|
|
54
|
+
name: "Circle",
|
|
55
|
+
icon: <Circle />,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "table-seat-circle",
|
|
59
|
+
name: "Table Seat Circle",
|
|
60
|
+
icon: <Ratio />,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "image-table",
|
|
64
|
+
name: "Image Table",
|
|
65
|
+
icon: <Upload />,
|
|
66
|
+
},
|
|
67
|
+
// {
|
|
68
|
+
// id: "table-seat-square",
|
|
69
|
+
// name: "Table Seat Square",
|
|
70
|
+
// icon: <Dock />,
|
|
71
|
+
// },
|
|
72
|
+
// {
|
|
73
|
+
// id: "diamond",
|
|
74
|
+
// name: "Diamond",
|
|
75
|
+
// icon: <Diamond />,
|
|
76
|
+
// },
|
|
77
|
+
];
|
|
78
|
+
const controlTools = [
|
|
79
|
+
{
|
|
80
|
+
id: "background",
|
|
81
|
+
name: "Background",
|
|
82
|
+
icon: <Image />,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "text",
|
|
86
|
+
name: "Text",
|
|
87
|
+
icon: <Type />,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "polygon",
|
|
91
|
+
name: "Polygon Tool",
|
|
92
|
+
icon: <PenTool />,
|
|
93
|
+
},
|
|
94
|
+
// {
|
|
95
|
+
// id: "background-color",
|
|
96
|
+
// name: "Background Color",
|
|
97
|
+
// icon: <PaintBucket/>
|
|
98
|
+
// }
|
|
99
|
+
];
|
|
100
|
+
const hanldeSelectTool = (id) => {
|
|
101
|
+
if (active === id) {
|
|
102
|
+
dispatch({
|
|
103
|
+
type: "tool/setActiveTool",
|
|
104
|
+
payload: "",
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (id === "background" || id === "image-table") {
|
|
109
|
+
dispatch({
|
|
110
|
+
type: "panel/setShow",
|
|
111
|
+
payload: true,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
dispatch({
|
|
115
|
+
type: "tool/setActiveTool",
|
|
116
|
+
payload: id,
|
|
117
|
+
});
|
|
118
|
+
dispatch({
|
|
119
|
+
type: "panel/setSelectedComponent",
|
|
120
|
+
payload: null,
|
|
121
|
+
});
|
|
122
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
123
|
+
};
|
|
124
|
+
const toggleGrid = () => {
|
|
125
|
+
dispatch({
|
|
126
|
+
type: "tool/setToogleGrid",
|
|
127
|
+
payload: !grid,
|
|
128
|
+
});
|
|
129
|
+
dispatch({
|
|
130
|
+
type: "panel/setSelectedComponent",
|
|
131
|
+
payload: null,
|
|
132
|
+
});
|
|
133
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
134
|
+
};
|
|
135
|
+
const toogleSetLockBackground = () => {
|
|
136
|
+
dispatch({
|
|
137
|
+
type: "tool/setToogleBackground",
|
|
138
|
+
payload: !lockBackground,
|
|
139
|
+
});
|
|
140
|
+
// dispatch({ type: "board/setFlagChange", payload: true });
|
|
141
|
+
};
|
|
142
|
+
const handleChangeColorBackground = (color) => {
|
|
143
|
+
setColor(color.toHexString());
|
|
144
|
+
dispatch({
|
|
145
|
+
type: "board/setBackgroundColor",
|
|
146
|
+
payload: color.toHexString(),
|
|
147
|
+
});
|
|
148
|
+
dispatch({
|
|
149
|
+
type: "panel/setSelectedComponent",
|
|
150
|
+
payload: null,
|
|
151
|
+
});
|
|
152
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
153
|
+
};
|
|
154
|
+
const handleOpenModalPreview = () => {
|
|
155
|
+
dispatch({
|
|
156
|
+
type: "tool/setTooglePreview",
|
|
157
|
+
payload: true,
|
|
158
|
+
});
|
|
159
|
+
dispatch({
|
|
160
|
+
type: "panel/setSelectedComponent",
|
|
161
|
+
payload: null,
|
|
162
|
+
});
|
|
163
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
164
|
+
};
|
|
165
|
+
const handleRemoveComponent = () => {
|
|
166
|
+
const exludedShapes = ["background", "text"];
|
|
167
|
+
if (!selectedComponent)
|
|
168
|
+
return;
|
|
169
|
+
if (!exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) &&
|
|
170
|
+
!(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component)) {
|
|
171
|
+
message.error("You are not authorized to delete this table.");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) &&
|
|
175
|
+
!(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent)) {
|
|
176
|
+
message.error("You are not authorized to delete this background.");
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component) &&
|
|
180
|
+
!exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
|
|
181
|
+
dispatch({
|
|
182
|
+
type: "board/removeComponent",
|
|
183
|
+
payload: selectedComponent,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent) &&
|
|
187
|
+
exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
|
|
188
|
+
dispatch({
|
|
189
|
+
type: "board/removeExtraComponent",
|
|
190
|
+
payload: selectedComponent,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
194
|
+
dispatch({
|
|
195
|
+
type: "panel/setSelectedComponent",
|
|
196
|
+
payload: null,
|
|
197
|
+
});
|
|
198
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
199
|
+
};
|
|
200
|
+
const handleDuplicateComponent = () => {
|
|
201
|
+
const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
|
|
202
|
+
dispatch({
|
|
203
|
+
type: "board/addComponent",
|
|
204
|
+
payload: newComponent,
|
|
205
|
+
});
|
|
206
|
+
dispatch({
|
|
207
|
+
type: "panel/setSelectedComponent",
|
|
208
|
+
payload: newComponent,
|
|
209
|
+
});
|
|
210
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
211
|
+
};
|
|
212
|
+
function swapOneStepById(arr, id, direction) {
|
|
213
|
+
const index = arr.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
|
214
|
+
if (index === -1)
|
|
215
|
+
return arr; // id tidak ditemukan
|
|
216
|
+
const newArr = [...arr];
|
|
217
|
+
if (direction === "left" && index > 0) {
|
|
218
|
+
[newArr[index - 1], newArr[index]] = [newArr[index], newArr[index - 1]];
|
|
219
|
+
}
|
|
220
|
+
if (direction === "right" && index < arr.length - 1) {
|
|
221
|
+
[newArr[index + 1], newArr[index]] = [newArr[index], newArr[index + 1]];
|
|
222
|
+
}
|
|
223
|
+
return newArr;
|
|
224
|
+
}
|
|
225
|
+
const handleOverride = () => {
|
|
226
|
+
if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
|
|
227
|
+
const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
|
|
228
|
+
dispatch({
|
|
229
|
+
type: "board/setNewExtraComponents",
|
|
230
|
+
payload: setNewExtraComponents,
|
|
231
|
+
});
|
|
232
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
|
|
236
|
+
dispatch({
|
|
237
|
+
type: "board/setNewComponents",
|
|
238
|
+
payload: newArr,
|
|
239
|
+
});
|
|
240
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
241
|
+
};
|
|
242
|
+
const handleOverrideLeft = () => {
|
|
243
|
+
if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
|
|
244
|
+
const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
|
|
245
|
+
dispatch({
|
|
246
|
+
type: "board/setNewExtraComponents",
|
|
247
|
+
payload: setNewExtraComponents,
|
|
248
|
+
});
|
|
249
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
|
|
253
|
+
dispatch({
|
|
254
|
+
type: "board/setNewComponents",
|
|
255
|
+
payload: newArr,
|
|
256
|
+
});
|
|
257
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
258
|
+
};
|
|
259
|
+
const handleUndo = () => {
|
|
260
|
+
dispatch({ type: "board/undoHistory" });
|
|
261
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
262
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
263
|
+
};
|
|
264
|
+
const handleRedo = () => {
|
|
265
|
+
dispatch({ type: "board/redoHistory" });
|
|
266
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
267
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
268
|
+
};
|
|
269
|
+
return (<div className="h-full left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4">
|
|
270
|
+
{tools === null || tools === void 0 ? void 0 : tools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
271
|
+
icon: tool.icon,
|
|
272
|
+
type: "text",
|
|
273
|
+
name: tool.name,
|
|
274
|
+
onClick: () => hanldeSelectTool(tool.id),
|
|
275
|
+
style: active === tool.id ? { color: "red" } : {},
|
|
276
|
+
}} popoverProps={{
|
|
277
|
+
content: <div>{tool.name}</div>,
|
|
278
|
+
trigger: "hover",
|
|
279
|
+
placement: "right",
|
|
280
|
+
}} items={[]}/>))}
|
|
281
|
+
{!dragOnly && (<>
|
|
282
|
+
<ButtonTools buttonProps={{
|
|
283
|
+
icon: <CopyPlus />,
|
|
284
|
+
type: "text",
|
|
285
|
+
name: "duplicate",
|
|
286
|
+
onClick: () => handleDuplicateComponent(),
|
|
287
|
+
}} items={[]} popoverProps={{
|
|
288
|
+
content: <div>Duplicate</div>,
|
|
289
|
+
trigger: "hover",
|
|
290
|
+
placement: "right",
|
|
291
|
+
}}/>
|
|
292
|
+
|
|
293
|
+
<ButtonTools buttonProps={{
|
|
294
|
+
onClick: () => handleOverride(),
|
|
295
|
+
icon: <Layers2 />,
|
|
296
|
+
type: "text",
|
|
297
|
+
name: "override",
|
|
298
|
+
}} items={[]} popoverProps={{
|
|
299
|
+
content: <div>Override Right</div>,
|
|
300
|
+
trigger: "hover",
|
|
301
|
+
placement: "right",
|
|
302
|
+
}}/>
|
|
303
|
+
<ButtonTools buttonProps={{
|
|
304
|
+
onClick: () => handleOverrideLeft(),
|
|
305
|
+
icon: <Layers />,
|
|
306
|
+
type: "text",
|
|
307
|
+
name: "override",
|
|
308
|
+
}} items={[]} popoverProps={{
|
|
309
|
+
content: <div>Override Left</div>,
|
|
310
|
+
trigger: "hover",
|
|
311
|
+
placement: "right",
|
|
312
|
+
}}/>
|
|
313
|
+
|
|
314
|
+
<Divider />
|
|
315
|
+
{actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
316
|
+
icon: tool.icon,
|
|
317
|
+
type: "text",
|
|
318
|
+
name: tool.name,
|
|
319
|
+
onClick: () => hanldeSelectTool(tool.id),
|
|
320
|
+
style: active === tool.id ? { color: "red" } : {},
|
|
321
|
+
}} popoverProps={{
|
|
322
|
+
content: <div>{tool.name}</div>,
|
|
323
|
+
trigger: "hover",
|
|
324
|
+
placement: "right",
|
|
325
|
+
}} items={[]}/>))}
|
|
326
|
+
|
|
327
|
+
<Divider />
|
|
328
|
+
</>)}
|
|
329
|
+
{controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
330
|
+
icon: tool.icon,
|
|
331
|
+
type: "text",
|
|
332
|
+
name: tool.name,
|
|
333
|
+
onClick: () => hanldeSelectTool(tool.id),
|
|
334
|
+
style: active === tool.id ? { color: "red" } : {},
|
|
335
|
+
}} popoverProps={{
|
|
336
|
+
content: <div>{tool.name}</div>,
|
|
337
|
+
trigger: "hover",
|
|
338
|
+
placement: "right",
|
|
339
|
+
}} items={[]}/>))}
|
|
340
|
+
<ColorPicker value={color} onChange={handleChangeColorBackground}>
|
|
341
|
+
<Button icon={<PaintBucket />} type="text" name="Background Color" onClick={() => hanldeSelectTool("background-color")} style={active === "background-color" ? { color: "red" } : {}}/>
|
|
342
|
+
</ColorPicker>
|
|
343
|
+
<Button icon={<Scan />} type="text" name="Preview" onClick={() => hanldeSelectTool("bounding-box")} style={active === "preview" ? { color: "red" } : {}}/>
|
|
344
|
+
<Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
|
|
345
|
+
<Button icon={<Grid />} type="text" name="Grid" onClick={() => toggleGrid()}/>
|
|
346
|
+
<ButtonTools buttonProps={{
|
|
347
|
+
onClick: () => handleRemoveComponent(),
|
|
348
|
+
icon: <Trash />,
|
|
349
|
+
type: "text",
|
|
350
|
+
name: "trash",
|
|
351
|
+
}} items={[]} popoverProps={{
|
|
352
|
+
content: <div>Trash</div>,
|
|
353
|
+
trigger: "hover",
|
|
354
|
+
placement: "right",
|
|
355
|
+
}}/>
|
|
356
|
+
<ButtonTools buttonProps={{
|
|
357
|
+
onClick: () => toogleSetLockBackground(),
|
|
358
|
+
icon: lockBackground ? <Lock /> : <LockOpen />,
|
|
359
|
+
type: "text",
|
|
360
|
+
name: "trash",
|
|
361
|
+
}} items={[]} popoverProps={{
|
|
362
|
+
content: (<div>
|
|
363
|
+
{lockBackground ? "Unlock Background" : "Lock Background"}
|
|
364
|
+
</div>),
|
|
365
|
+
trigger: "hover",
|
|
366
|
+
placement: "right",
|
|
367
|
+
}}/>
|
|
368
|
+
<ButtonTools buttonProps={{
|
|
369
|
+
onClick: () => handleUndo(),
|
|
370
|
+
icon: <Undo2 />,
|
|
371
|
+
type: "text",
|
|
372
|
+
name: "undo",
|
|
373
|
+
}} items={[]} popoverProps={{
|
|
374
|
+
content: <div>Undo</div>,
|
|
375
|
+
trigger: "hover",
|
|
376
|
+
placement: "right",
|
|
377
|
+
}}/>
|
|
378
|
+
<ButtonTools buttonProps={{
|
|
379
|
+
onClick: () => handleRedo(),
|
|
380
|
+
icon: <Redo2 />,
|
|
381
|
+
type: "text",
|
|
382
|
+
name: "redo",
|
|
383
|
+
}} items={[]} popoverProps={{
|
|
384
|
+
content: <div>Redo</div>,
|
|
385
|
+
trigger: "hover",
|
|
386
|
+
placement: "right",
|
|
387
|
+
}}/>
|
|
388
|
+
</div>);
|
|
389
|
+
};
|
|
390
|
+
export default SideTool;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
export interface ToolState {
|
|
3
|
+
active: "circle" | "square" | "diamond" | string;
|
|
4
|
+
isPreview: boolean;
|
|
5
|
+
grid: boolean;
|
|
6
|
+
lockBackground: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const sideToolSlice: import("@reduxjs/toolkit").Slice<ToolState, {
|
|
9
|
+
setActiveTool: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<string>) => void;
|
|
10
|
+
setTooglePreview: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
11
|
+
setToogleGrid: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
12
|
+
setToogleBackground: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
13
|
+
}, "tool", "tool", import("@reduxjs/toolkit").SliceSelectors<ToolState>>;
|
|
14
|
+
export declare const setActiveTool: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string, "tool/setActiveTool">, setTooglePreview: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setTooglePreview">, setToogleGrid: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setToogleGrid">, setToogleBackground: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setToogleBackground">;
|
|
15
|
+
declare const _default: import("redux").Reducer<ToolState>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
3
|
+
const initialState = {
|
|
4
|
+
active: "",
|
|
5
|
+
isPreview: false,
|
|
6
|
+
grid: false,
|
|
7
|
+
lockBackground: false
|
|
8
|
+
};
|
|
9
|
+
export const sideToolSlice = createSlice({
|
|
10
|
+
name: "tool",
|
|
11
|
+
initialState,
|
|
12
|
+
reducers: {
|
|
13
|
+
setActiveTool: (state, action) => {
|
|
14
|
+
state.active = action.payload;
|
|
15
|
+
},
|
|
16
|
+
setTooglePreview: (state, action) => {
|
|
17
|
+
state.isPreview = action.payload;
|
|
18
|
+
},
|
|
19
|
+
setToogleGrid: (state, action) => {
|
|
20
|
+
state.grid = action.payload;
|
|
21
|
+
},
|
|
22
|
+
setToogleBackground: (state, action) => {
|
|
23
|
+
state.lockBackground = action.payload;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const { setActiveTool, setTooglePreview, setToogleGrid, setToogleBackground } = sideToolSlice.actions;
|
|
28
|
+
export default sideToolSlice.reducer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ThemeProps {
|
|
2
|
+
primaryColor: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const themeSlice: import("@reduxjs/toolkit").Slice<ThemeProps, {
|
|
5
|
+
setPrimaryColor: (state: import("immer").WritableDraft<ThemeProps>, action: {
|
|
6
|
+
payload: any;
|
|
7
|
+
type: string;
|
|
8
|
+
}) => void;
|
|
9
|
+
}, "theme", "theme", import("@reduxjs/toolkit").SliceSelectors<ThemeProps>>;
|
|
10
|
+
export declare const setPrimaryColor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "theme/setPrimaryColor">;
|
|
11
|
+
declare const _default: import("redux").Reducer<ThemeProps>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
const initialState = {
|
|
3
|
+
primaryColor: "#4A90E2",
|
|
4
|
+
};
|
|
5
|
+
export const themeSlice = createSlice({
|
|
6
|
+
name: "theme",
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
setPrimaryColor: (state, action) => {
|
|
10
|
+
state.primaryColor = action.payload;
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export const { setPrimaryColor } = themeSlice.actions;
|
|
15
|
+
export default themeSlice.reducer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LayerViewProps {
|
|
2
|
+
componentProps?: any[];
|
|
3
|
+
extraComponentProps?: any[];
|
|
4
|
+
onCurrentStateChange?: (state: any) => void;
|
|
5
|
+
onSelectComponent?: (component: any) => void;
|
|
6
|
+
mappingKey?: string;
|
|
7
|
+
selectedTableColor?: string;
|
|
8
|
+
colorMatchKey?: {
|
|
9
|
+
color: string;
|
|
10
|
+
key: string;
|
|
11
|
+
}[];
|
|
12
|
+
statusKey: string;
|
|
13
|
+
defaultBackground?: string;
|
|
14
|
+
transformProps?: any;
|
|
15
|
+
containerProps?: any;
|
|
16
|
+
svgProps?: any;
|
|
17
|
+
}
|
|
18
|
+
declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
|
|
19
|
+
export default LayerView;
|