seat-editor 3.3.35 → 3.3.37

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.
Files changed (83) hide show
  1. package/dist/app/constant.d.ts +3 -0
  2. package/dist/app/constant.js +2 -0
  3. package/dist/app/layout.d.ts +1 -1
  4. package/dist/app/layout.js +22 -0
  5. package/dist/app/new-board/page.d.ts +1 -1
  6. package/dist/app/new-board/page.js +58 -0
  7. package/dist/app/old-board/page.d.ts +1 -2
  8. package/dist/app/old-board/page.js +377 -0
  9. package/dist/app/only-view/chair.d.ts +1 -1
  10. package/dist/app/only-view/chair.js +2 -10
  11. package/dist/app/only-view/page.d.ts +1 -1
  12. package/dist/app/only-view/page.js +226 -0
  13. package/dist/app/only-view/user.d.ts +1 -1
  14. package/dist/app/only-view/user.js +2 -10
  15. package/dist/app/page.d.ts +1 -1
  16. package/dist/app/page.js +8 -0
  17. package/dist/app/test/page.d.ts +1 -2
  18. package/dist/app/test/page.js +43 -0
  19. package/dist/app/v2/page.d.ts +1 -1
  20. package/dist/app/v2/page.js +8 -0
  21. package/dist/components/button-tools/index.d.ts +1 -1
  22. package/dist/components/button-tools/index.js +11 -0
  23. package/dist/components/form-tools/label.d.ts +1 -1
  24. package/dist/components/form-tools/label.js +21 -0
  25. package/dist/components/form-tools/shape.d.ts +1 -1
  26. package/dist/components/form-tools/shape.js +69 -0
  27. package/dist/components/input/number-indicator.d.ts +1 -1
  28. package/dist/components/input/number-indicator.js +27 -0
  29. package/dist/components/joystick/index.d.ts +1 -2
  30. package/dist/components/joystick/index.js +48 -0
  31. package/dist/components/layer/index.d.ts +1 -1
  32. package/dist/components/layer/index.js +295 -0
  33. package/dist/components/layer-v2/index.d.ts +1 -1
  34. package/dist/components/layer-v2/index.js +282 -0
  35. package/dist/components/layer-v3/index.d.ts +1 -1
  36. package/dist/components/layer-v3/index.js +483 -0
  37. package/dist/components/layer-v4/index.d.ts +1 -1
  38. package/dist/components/layer-v4/index.js +924 -0
  39. package/dist/components/lib/index.d.ts +1 -1
  40. package/dist/components/lib/index.js +28 -0
  41. package/dist/components/modal-preview/index.d.ts +1 -1
  42. package/dist/components/modal-preview/index.js +10 -0
  43. package/dist/features/board/index.d.ts +1 -1
  44. package/dist/features/board/index.js +666 -0
  45. package/dist/features/board-v2/index.d.ts +1 -2
  46. package/dist/features/board-v2/index.js +807 -0
  47. package/dist/features/board-v3/icons.js +16 -0
  48. package/dist/features/board-v3/index.d.ts +1 -1
  49. package/dist/features/board-v3/index.js +1587 -0
  50. package/dist/features/navbar/index.d.ts +1 -1
  51. package/dist/features/navbar/index.js +6 -0
  52. package/dist/features/package/index.d.ts +1 -1
  53. package/dist/features/package/index.js +166 -0
  54. package/dist/features/panel/index.d.ts +1 -1
  55. package/dist/features/panel/index.js +243 -0
  56. package/dist/features/panel/select-tool.d.ts +1 -1
  57. package/dist/features/panel/select-tool.js +57 -0
  58. package/dist/features/panel/selected-group.d.ts +1 -1
  59. package/dist/features/panel/selected-group.js +35 -0
  60. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  61. package/dist/features/panel/square-circle-tool.js +8 -0
  62. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  63. package/dist/features/panel/table-seat-circle.js +9 -0
  64. package/dist/features/panel/table-seat-square.d.ts +1 -1
  65. package/dist/features/panel/table-seat-square.js +9 -0
  66. package/dist/features/panel/text-tool.d.ts +1 -1
  67. package/dist/features/panel/text-tool.js +22 -0
  68. package/dist/features/panel/upload-tool.d.ts +1 -1
  69. package/dist/features/panel/upload-tool.js +150 -0
  70. package/dist/features/side-tool/index.d.ts +1 -1
  71. package/dist/features/side-tool/index.js +365 -0
  72. package/dist/features/view-only/index.d.ts +1 -1
  73. package/dist/features/view-only/index.js +198 -0
  74. package/dist/features/view-only-2/index.d.ts +84 -14
  75. package/dist/features/view-only-2/index.js +558 -0
  76. package/dist/features/view-only-3/index.d.ts +1 -1
  77. package/dist/features/view-only-3/index.js +577 -0
  78. package/dist/provider/antd-provider.js +43 -0
  79. package/dist/provider/redux-provider.d.ts +1 -1
  80. package/dist/provider/redux-provider.js +7 -0
  81. package/dist/provider/store-provider.d.ts +1 -1
  82. package/dist/provider/store-provider.js +9 -0
  83. package/package.json +1 -1
@@ -6,5 +6,5 @@ interface UploadToolProps {
6
6
  defaultValue?: PropertiesProps;
7
7
  transform?: any;
8
8
  }
9
- declare const UploadTool: ({ name, type, action, defaultValue, transform }: UploadToolProps) => import("react").JSX.Element;
9
+ declare const UploadTool: ({ name, type, action, defaultValue, transform }: UploadToolProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export default UploadTool;
@@ -0,0 +1,150 @@
1
+ "use client";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { useState, useEffect } from "react";
13
+ import { Upload, Image, Button, Form } from "antd";
14
+ import { InboxOutlined, LoadingOutlined } from "@ant-design/icons";
15
+ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
16
+ import SectionLabel from "../../components/form-tools/label";
17
+ import SectionShape from "../../components/form-tools/shape";
18
+ const { Dragger } = Upload;
19
+ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
20
+ // const src = Form.useWatch("src");
21
+ // const height = Form.useWatch("height");
22
+ // const width = Form.useWatch("width");
23
+ // const x = Form.useWatch("x");
24
+ // const y = Form.useWatch("y");
25
+ // const shape = Form.useWatch("shape");
26
+ var _a, _b, _c;
27
+ const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
28
+ const transformState = (_a = transform === null || transform === void 0 ? void 0 : transform.instance) === null || _a === void 0 ? void 0 : _a.transformState;
29
+ const [defaultSrc, setDefaultSrc] = useState(null);
30
+ const [isEdit, setIsEdit] = useState(false);
31
+ const [loading, setLoading] = useState(false);
32
+ useEffect(() => {
33
+ if (defaultValue) {
34
+ setDefaultSrc(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.src);
35
+ setIsEdit(true);
36
+ setLoading(false);
37
+ }
38
+ }, [defaultValue]);
39
+ useEffect(() => {
40
+ if (selectedComponent && selectedComponent.shape === name) {
41
+ setDefaultSrc(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.src);
42
+ setIsEdit(true);
43
+ setLoading(false);
44
+ }
45
+ }, [selectedComponent]);
46
+ const dispatch = useAppDispatch();
47
+ const widthWorkspace = ((_b = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
48
+ const heightWorkspace = ((_c = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0;
49
+ const defaultFormatValue = (width, height, src, id, x, y) => ({
50
+ id: String(id) || `${Date.now()}`,
51
+ x: x || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionX),
52
+ y: y || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionY),
53
+ width: width < 1 ? 200 : width,
54
+ height: height < 1 ? 200 : height,
55
+ rotation: 0,
56
+ shape: name,
57
+ src,
58
+ });
59
+ const propsUpload = {
60
+ name: "file",
61
+ multiple: true,
62
+ maxCount: 1,
63
+ showUploadList: false,
64
+ onChange: (info) => __awaiter(void 0, void 0, void 0, function* () {
65
+ setLoading(true);
66
+ if (info.file) {
67
+ const file = info.file;
68
+ const img = new window.Image();
69
+ let srcFromResponse = "";
70
+ try {
71
+ // ⬇️ IF ada custom action (upload ke server)
72
+ if (action) {
73
+ const src = yield action(file);
74
+ if (isEdit) {
75
+ dispatch({
76
+ type: "board/updateComponent",
77
+ payload: Object.assign({}, defaultFormatValue(selectedComponent.width, selectedComponent.height, src, String(selectedComponent.id), selectedComponent.x, selectedComponent.y)),
78
+ });
79
+ dispatch({
80
+ type: "panel/setSelectedComponent",
81
+ payload: Object.assign({}, defaultFormatValue(selectedComponent.width, selectedComponent.height, src, String(selectedComponent.id), selectedComponent.x, selectedComponent.y)),
82
+ });
83
+ setDefaultSrc(src);
84
+ dispatch({ type: "board/setFlagChange", payload: true });
85
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
86
+ }
87
+ else {
88
+ const defaultValue = Object.assign({}, defaultFormatValue(0, 0, src));
89
+ dispatch({
90
+ type: type === "component"
91
+ ? "board/addComponent"
92
+ : "board/setExtraComponent",
93
+ payload: defaultValue,
94
+ });
95
+ dispatch({
96
+ type: "panel/setSelectedComponent",
97
+ payload: defaultValue,
98
+ });
99
+ }
100
+ }
101
+ // ⬇️ IF local upload
102
+ else {
103
+ img.onload = () => {
104
+ const scaleX = widthWorkspace / img.width;
105
+ const scaleY = heightWorkspace / img.height;
106
+ const scale = Math.min(1, scaleX, scaleY);
107
+ const width = img.width * scale;
108
+ const height = img.height * scale;
109
+ if (isEdit) {
110
+ dispatch({
111
+ type: "board/updateComponent",
112
+ payload: Object.assign({}, defaultFormatValue(selectedComponent.width, selectedComponent.height, img.src, selectedComponent.id, selectedComponent.x, selectedComponent.y)),
113
+ });
114
+ dispatch({
115
+ type: "panel/setSelectedComponent",
116
+ payload: Object.assign({}, defaultFormatValue(selectedComponent.width, selectedComponent.height, img.src, selectedComponent.id, selectedComponent.x, selectedComponent.y)),
117
+ });
118
+ setDefaultSrc(img.src);
119
+ dispatch({ type: "board/setFlagChange", payload: true });
120
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
121
+ }
122
+ else {
123
+ dispatch({
124
+ type: type === "component"
125
+ ? "board/addComponent"
126
+ : "board/setExtraComponent",
127
+ payload: Object.assign({}, defaultFormatValue(width, height, img.src)),
128
+ });
129
+ }
130
+ setDefaultSrc(img.src);
131
+ dispatch({ type: "board/setFlagChange", payload: true });
132
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
133
+ // message.success(`${info.file.name} uploaded successfully.`);
134
+ };
135
+ // Set img src AFTER onload
136
+ img.src = URL.createObjectURL(file);
137
+ }
138
+ }
139
+ catch (e) {
140
+ // message.error("Upload failed, please try again.");
141
+ }
142
+ }
143
+ }),
144
+ };
145
+ const handleDelete = () => {
146
+ setDefaultSrc(null);
147
+ };
148
+ return (_jsxs(Form.Item, { label: "", name: "src", className: "w-full", children: [defaultSrc ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto", children: _jsx(Image, { src: defaultSrc }) }), _jsx(Button, { type: "primary", onClick: handleDelete, children: "Edit" })] })) : (_jsx(Dragger, Object.assign({ beforeUpload: () => false }, propsUpload, { children: loading ? (_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px]", children: _jsx(LoadingOutlined, {}) })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "ant-upload-drag-icon", children: _jsx(InboxOutlined, {}) }), _jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), _jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] })) }))), _jsx(SectionShape, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }));
149
+ };
150
+ export default UploadTool;
@@ -4,5 +4,5 @@ declare const SideTool: ({ dragOnly, deleteAutorized, }: {
4
4
  component: boolean;
5
5
  extraComponent: boolean;
6
6
  };
7
- }) => import("react").JSX.Element;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
8
  export default SideTool;
@@ -0,0 +1,365 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ 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";
4
+ import ButtonTools from "../../components/button-tools";
5
+ import { Divider, ColorPicker, Button, message, } from "antd";
6
+ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
+ import { useState } from "react";
8
+ const SideTool = ({ dragOnly, deleteAutorized, }) => {
9
+ const [color, setColor] = useState("#000000");
10
+ const dispatch = useAppDispatch();
11
+ const { active, grid, lockBackground } = useAppSelector((state) => state.tool);
12
+ const { selectedComponent } = useAppSelector((state) => state.panel);
13
+ const { components, extraComponents } = useAppSelector((state) => state.board);
14
+ const [preview, setPreview] = useState(false);
15
+ const tools = [
16
+ {
17
+ id: "select",
18
+ name: "Select Tool",
19
+ icon: _jsx(MousePointer, {}),
20
+ },
21
+ {
22
+ id: "grab",
23
+ name: "Grab Tool",
24
+ icon: _jsx(Hand, {}),
25
+ },
26
+ // {
27
+ // id: "ruler",
28
+ // name: "Ruler",
29
+ // icon: <Ruler />,
30
+ // },
31
+ // {
32
+ // id: "bounding-box",
33
+ // name: "Bounding Box Tool",
34
+ // icon: <Scan />,
35
+ // }
36
+ // {
37
+ // id: "node",
38
+ // name: "Node Tool",
39
+ // icon: <MousePointer2 />,
40
+ // },
41
+ ];
42
+ const actionsTools = [
43
+ // {
44
+ // id: "table-split",
45
+ // name: "Table Split",
46
+ // icon: <TableCellsSplit />,
47
+ // },
48
+ {
49
+ id: "square",
50
+ name: "Square",
51
+ icon: _jsx(SquareMousePointer, {}),
52
+ },
53
+ {
54
+ id: "circle",
55
+ name: "Circle",
56
+ icon: _jsx(Circle, {}),
57
+ },
58
+ {
59
+ id: "table-seat-circle",
60
+ name: "Table Seat Circle",
61
+ icon: _jsx(Ratio, {}),
62
+ },
63
+ {
64
+ id: "image-table",
65
+ name: "Image Table",
66
+ icon: _jsx(Upload, {}),
67
+ },
68
+ // {
69
+ // id: "table-seat-square",
70
+ // name: "Table Seat Square",
71
+ // icon: <Dock />,
72
+ // },
73
+ // {
74
+ // id: "diamond",
75
+ // name: "Diamond",
76
+ // icon: <Diamond />,
77
+ // },
78
+ ];
79
+ const controlTools = [
80
+ {
81
+ id: "background",
82
+ name: "Background",
83
+ icon: _jsx(Image, {}),
84
+ },
85
+ {
86
+ id: "text",
87
+ name: "Text",
88
+ icon: _jsx(Type, {}),
89
+ },
90
+ {
91
+ id: "polygon",
92
+ name: "Polygon Tool",
93
+ icon: _jsx(PenTool, {}),
94
+ },
95
+ // {
96
+ // id: "background-color",
97
+ // name: "Background Color",
98
+ // icon: <PaintBucket/>
99
+ // }
100
+ ];
101
+ const hanldeSelectTool = (id) => {
102
+ if (active === id) {
103
+ dispatch({
104
+ type: "tool/setActiveTool",
105
+ payload: "",
106
+ });
107
+ return;
108
+ }
109
+ if (id === "background" || id === "image-table") {
110
+ dispatch({
111
+ type: "panel/setShow",
112
+ payload: true,
113
+ });
114
+ }
115
+ dispatch({
116
+ type: "tool/setActiveTool",
117
+ payload: id,
118
+ });
119
+ dispatch({
120
+ type: "panel/setSelectedComponent",
121
+ payload: null,
122
+ });
123
+ dispatch({ type: "board/setFlagChange", payload: true });
124
+ };
125
+ const toggleGrid = () => {
126
+ dispatch({
127
+ type: "tool/setToogleGrid",
128
+ payload: !grid,
129
+ });
130
+ dispatch({
131
+ type: "panel/setSelectedComponent",
132
+ payload: null,
133
+ });
134
+ dispatch({ type: "board/setFlagChange", payload: true });
135
+ };
136
+ const toogleSetLockBackground = () => {
137
+ dispatch({
138
+ type: "tool/setToogleBackground",
139
+ payload: !lockBackground,
140
+ });
141
+ // dispatch({ type: "board/setFlagChange", payload: true });
142
+ };
143
+ const handleChangeColorBackground = (color) => {
144
+ setColor(color.toHexString());
145
+ dispatch({
146
+ type: "board/setBackgroundColor",
147
+ payload: color.toHexString(),
148
+ });
149
+ dispatch({
150
+ type: "panel/setSelectedComponent",
151
+ payload: null,
152
+ });
153
+ dispatch({ type: "board/setFlagChange", payload: true });
154
+ };
155
+ const handleOpenModalPreview = () => {
156
+ dispatch({
157
+ type: "tool/setTooglePreview",
158
+ payload: true,
159
+ });
160
+ dispatch({
161
+ type: "panel/setSelectedComponent",
162
+ payload: null,
163
+ });
164
+ dispatch({ type: "board/setFlagChange", payload: true });
165
+ };
166
+ const handleRemoveComponent = () => {
167
+ const exludedShapes = ["background", "text"];
168
+ if (!selectedComponent)
169
+ return;
170
+ if (!exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) &&
171
+ !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component)) {
172
+ message.error("You are not authorized to delete this table.");
173
+ return;
174
+ }
175
+ if (exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) &&
176
+ !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent)) {
177
+ message.error("You are not authorized to delete this background.");
178
+ return;
179
+ }
180
+ if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component) &&
181
+ !exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
182
+ dispatch({
183
+ type: "board/removeComponent",
184
+ payload: selectedComponent,
185
+ });
186
+ }
187
+ if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent) &&
188
+ exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
189
+ dispatch({
190
+ type: "board/removeExtraComponent",
191
+ payload: selectedComponent,
192
+ });
193
+ }
194
+ dispatch({ type: "board/setFlagChange", payload: true });
195
+ dispatch({
196
+ type: "panel/setSelectedComponent",
197
+ payload: null,
198
+ });
199
+ dispatch({ type: "board/setFlagChange", payload: true });
200
+ };
201
+ const handleDuplicateComponent = () => {
202
+ const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
203
+ dispatch({
204
+ type: "board/addComponent",
205
+ payload: newComponent,
206
+ });
207
+ dispatch({
208
+ type: "panel/setSelectedComponent",
209
+ payload: newComponent,
210
+ });
211
+ dispatch({ type: "board/setFlagChange", payload: true });
212
+ };
213
+ function swapOneStepById(arr, id, direction) {
214
+ const index = arr.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
215
+ if (index === -1)
216
+ return arr; // id tidak ditemukan
217
+ const newArr = [...arr];
218
+ if (direction === "left" && index > 0) {
219
+ [newArr[index - 1], newArr[index]] = [newArr[index], newArr[index - 1]];
220
+ }
221
+ if (direction === "right" && index < arr.length - 1) {
222
+ [newArr[index + 1], newArr[index]] = [newArr[index], newArr[index + 1]];
223
+ }
224
+ return newArr;
225
+ }
226
+ const handleOverride = () => {
227
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
228
+ const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
229
+ dispatch({
230
+ type: "board/setNewExtraComponents",
231
+ payload: setNewExtraComponents,
232
+ });
233
+ dispatch({ type: "board/setFlagChange", payload: true });
234
+ return;
235
+ }
236
+ const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
237
+ dispatch({
238
+ type: "board/setNewComponents",
239
+ payload: newArr,
240
+ });
241
+ dispatch({ type: "board/setFlagChange", payload: true });
242
+ };
243
+ const handleOverrideLeft = () => {
244
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
245
+ const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
246
+ dispatch({
247
+ type: "board/setNewExtraComponents",
248
+ payload: setNewExtraComponents,
249
+ });
250
+ dispatch({ type: "board/setFlagChange", payload: true });
251
+ return;
252
+ }
253
+ const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
254
+ dispatch({
255
+ type: "board/setNewComponents",
256
+ payload: newArr,
257
+ });
258
+ dispatch({ type: "board/setFlagChange", payload: true });
259
+ };
260
+ const handleUndo = () => {
261
+ dispatch({ type: "board/undoHistory" });
262
+ dispatch({ type: "board/setFlagChange", payload: true });
263
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
264
+ };
265
+ const handleRedo = () => {
266
+ dispatch({ type: "board/redoHistory" });
267
+ dispatch({ type: "board/setFlagChange", payload: true });
268
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
269
+ };
270
+ return (_jsxs("div", { className: "h-full left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4", children: [tools === null || tools === void 0 ? void 0 : tools.map((tool) => (_jsx(ButtonTools, { 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: _jsx("div", { children: tool.name }),
278
+ trigger: "hover",
279
+ placement: "right",
280
+ }, items: [] }, tool.id))), !dragOnly && (_jsxs(_Fragment, { children: [_jsx(ButtonTools, { buttonProps: {
281
+ icon: _jsx(CopyPlus, {}),
282
+ type: "text",
283
+ name: "duplicate",
284
+ onClick: () => handleDuplicateComponent(),
285
+ }, items: [], popoverProps: {
286
+ content: _jsx("div", { children: "Duplicate" }),
287
+ trigger: "hover",
288
+ placement: "right",
289
+ } }), _jsx(ButtonTools, { buttonProps: {
290
+ onClick: () => handleOverride(),
291
+ icon: _jsx(Layers2, {}),
292
+ type: "text",
293
+ name: "override",
294
+ }, items: [], popoverProps: {
295
+ content: _jsx("div", { children: "Override Right" }),
296
+ trigger: "hover",
297
+ placement: "right",
298
+ } }), _jsx(ButtonTools, { buttonProps: {
299
+ onClick: () => handleOverrideLeft(),
300
+ icon: _jsx(Layers, {}),
301
+ type: "text",
302
+ name: "override",
303
+ }, items: [], popoverProps: {
304
+ content: _jsx("div", { children: "Override Left" }),
305
+ trigger: "hover",
306
+ placement: "right",
307
+ } }), _jsx(Divider, {}), actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
308
+ icon: tool.icon,
309
+ type: "text",
310
+ name: tool.name,
311
+ onClick: () => hanldeSelectTool(tool.id),
312
+ style: active === tool.id ? { color: "red" } : {},
313
+ }, popoverProps: {
314
+ content: _jsx("div", { children: tool.name }),
315
+ trigger: "hover",
316
+ placement: "right",
317
+ }, items: [] }, tool.id))), _jsx(Divider, {})] })), controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
318
+ icon: tool.icon,
319
+ type: "text",
320
+ name: tool.name,
321
+ onClick: () => hanldeSelectTool(tool.id),
322
+ style: active === tool.id ? { color: "red" } : {},
323
+ }, popoverProps: {
324
+ content: _jsx("div", { children: tool.name }),
325
+ trigger: "hover",
326
+ placement: "right",
327
+ }, items: [] }, tool.id))), _jsx(ColorPicker, { value: color, onChange: handleChangeColorBackground, children: _jsx(Button, { icon: _jsx(PaintBucket, {}), type: "text", name: "Background Color", onClick: () => hanldeSelectTool("background-color"), style: active === "background-color" ? { color: "red" } : {} }) }), _jsx(Button, { icon: _jsx(Scan, {}), type: "text", name: "Bounding Box", onClick: () => hanldeSelectTool("bounding-box"), style: active === "bounding-box" ? { color: "red" } : {} }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} }), _jsx(Button, { icon: _jsx(Grid, {}), type: "text", name: "Grid", onClick: () => toggleGrid() }), _jsx(ButtonTools, { buttonProps: {
328
+ onClick: () => handleRemoveComponent(),
329
+ icon: _jsx(Trash, {}),
330
+ type: "text",
331
+ name: "trash",
332
+ }, items: [], popoverProps: {
333
+ content: _jsx("div", { children: "Trash" }),
334
+ trigger: "hover",
335
+ placement: "right",
336
+ } }), _jsx(ButtonTools, { buttonProps: {
337
+ onClick: () => toogleSetLockBackground(),
338
+ icon: lockBackground ? _jsx(Lock, {}) : _jsx(LockOpen, {}),
339
+ type: "text",
340
+ name: "trash",
341
+ }, items: [], popoverProps: {
342
+ content: (_jsx("div", { children: lockBackground ? "Unlock Background" : "Lock Background" })),
343
+ trigger: "hover",
344
+ placement: "right",
345
+ } }), _jsx(ButtonTools, { buttonProps: {
346
+ onClick: () => handleUndo(),
347
+ icon: _jsx(Undo2, {}),
348
+ type: "text",
349
+ name: "undo",
350
+ }, items: [], popoverProps: {
351
+ content: _jsx("div", { children: "Undo" }),
352
+ trigger: "hover",
353
+ placement: "right",
354
+ } }), _jsx(ButtonTools, { buttonProps: {
355
+ onClick: () => handleRedo(),
356
+ icon: _jsx(Redo2, {}),
357
+ type: "text",
358
+ name: "redo",
359
+ }, items: [], popoverProps: {
360
+ content: _jsx("div", { children: "Redo" }),
361
+ trigger: "hover",
362
+ placement: "right",
363
+ } })] }));
364
+ };
365
+ export default SideTool;
@@ -15,5 +15,5 @@ export interface LayerViewProps {
15
15
  containerProps?: any;
16
16
  svgProps?: any;
17
17
  }
18
- declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export default LayerView;