seat-editor 1.4.19 → 1.4.21

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 (56) hide show
  1. package/dist/app/layout.d.ts +1 -1
  2. package/dist/app/layout.js +22 -0
  3. package/dist/app/new-board/page.d.ts +1 -1
  4. package/dist/app/new-board/page.js +30 -0
  5. package/dist/app/old-board/page.d.ts +1 -2
  6. package/dist/app/old-board/page.js +377 -0
  7. package/dist/app/only-view/page.d.ts +1 -1
  8. package/dist/app/only-view/page.js +41 -0
  9. package/dist/app/page.d.ts +1 -1
  10. package/dist/app/page.js +8 -0
  11. package/dist/components/button-tools/index.d.ts +1 -1
  12. package/dist/components/button-tools/index.js +11 -0
  13. package/dist/components/form-tools/label.d.ts +1 -1
  14. package/dist/components/form-tools/label.js +7 -0
  15. package/dist/components/form-tools/shape.d.ts +1 -1
  16. package/dist/components/form-tools/shape.js +25 -0
  17. package/dist/components/input/number-indicator.d.ts +1 -1
  18. package/dist/components/input/number-indicator.js +27 -0
  19. package/dist/components/joystick/index.d.ts +1 -2
  20. package/dist/components/joystick/index.js +48 -0
  21. package/dist/components/layer/index.d.ts +1 -1
  22. package/dist/components/layer/index.js +276 -0
  23. package/dist/components/lib/index.d.ts +1 -1
  24. package/dist/components/lib/index.js +28 -0
  25. package/dist/components/modal-preview/index.d.ts +1 -1
  26. package/dist/components/modal-preview/index.js +10 -0
  27. package/dist/features/board/index.d.ts +1 -1
  28. package/dist/features/board/index.js +626 -0
  29. package/dist/features/navbar/index.d.ts +1 -1
  30. package/dist/features/navbar/index.js +6 -0
  31. package/dist/features/package/index.d.ts +1 -1
  32. package/dist/features/package/index.js +102 -0
  33. package/dist/features/package/index.jsx +6 -9
  34. package/dist/features/panel/index.d.ts +1 -1
  35. package/dist/features/panel/index.js +97 -0
  36. package/dist/features/panel/select-tool.d.ts +1 -1
  37. package/dist/features/panel/select-tool.js +44 -0
  38. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  39. package/dist/features/panel/square-circle-tool.js +8 -0
  40. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  41. package/dist/features/panel/table-seat-circle.js +9 -0
  42. package/dist/features/panel/text-tool.d.ts +1 -1
  43. package/dist/features/panel/text-tool.js +7 -0
  44. package/dist/features/panel/upload-tool.d.ts +1 -1
  45. package/dist/features/panel/upload-tool.js +155 -0
  46. package/dist/features/side-tool/index.d.ts +1 -1
  47. package/dist/features/side-tool/index.js +244 -0
  48. package/dist/features/view/index.d.ts +1 -1
  49. package/dist/features/view/index.js +213 -0
  50. package/dist/features/view/index.jsx +4 -6
  51. package/dist/provider/antd-provider.js +43 -0
  52. package/dist/provider/redux-provider.d.ts +1 -1
  53. package/dist/provider/redux-provider.js +7 -0
  54. package/dist/provider/store-provider.d.ts +1 -1
  55. package/dist/provider/store-provider.js +9 -0
  56. package/package.json +1 -1
@@ -0,0 +1,244 @@
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 } from "lucide-react";
4
+ import ButtonTools from "../../components/button-tools";
5
+ import { Divider, ColorPicker, Button, } from "antd";
6
+ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
+ import { useState } from "react";
8
+ const SideTool = ({ dragOnly }) => {
9
+ const [color, setColor] = useState("#000000");
10
+ const dispatch = useAppDispatch();
11
+ const { active } = 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
+ const actionsTools = [
28
+ // {
29
+ // id: "table-split",
30
+ // name: "Table Split",
31
+ // icon: <TableCellsSplit />,
32
+ // },
33
+ {
34
+ id: "square",
35
+ name: "Square",
36
+ icon: _jsx(SquareMousePointer, {}),
37
+ },
38
+ {
39
+ id: "circle",
40
+ name: "Circle",
41
+ icon: _jsx(Circle, {}),
42
+ },
43
+ {
44
+ id: "table-seat-circle",
45
+ name: "Table Seat Circle",
46
+ icon: _jsx(Ratio, {}),
47
+ },
48
+ {
49
+ id: "image-table",
50
+ name: "Image Table",
51
+ icon: _jsx(Upload, {}),
52
+ },
53
+ // {
54
+ // id: "table-seat-square",
55
+ // name: "Table Seat Square",
56
+ // icon: <Dock />,
57
+ // },
58
+ // {
59
+ // id: "diamond",
60
+ // name: "Diamond",
61
+ // icon: <Diamond />,
62
+ // },
63
+ ];
64
+ const controlTools = [
65
+ {
66
+ id: "background",
67
+ name: "Background",
68
+ icon: _jsx(Image, {}),
69
+ },
70
+ {
71
+ id: "text",
72
+ name: "Text",
73
+ icon: _jsx(Type, {}),
74
+ },
75
+ // {
76
+ // id: "background-color",
77
+ // name: "Background Color",
78
+ // icon: <PaintBucket/>
79
+ // }
80
+ ];
81
+ const hanldeSelectTool = (id) => {
82
+ if (id === "background" || id === "text" || id === "image-table") {
83
+ dispatch({
84
+ type: "panel/setShow",
85
+ payload: true,
86
+ });
87
+ }
88
+ dispatch({
89
+ type: "tool/setActiveTool",
90
+ payload: id,
91
+ });
92
+ };
93
+ const handleChangeColorBackground = (color) => {
94
+ setColor(color.toHexString());
95
+ dispatch({
96
+ type: "board/setBackgroundColor",
97
+ payload: color.toHexString(),
98
+ });
99
+ };
100
+ const handleOpenModalPreview = () => {
101
+ dispatch({
102
+ type: "tool/setTooglePreview",
103
+ payload: true,
104
+ });
105
+ };
106
+ const handleRemoveComponent = () => {
107
+ dispatch({
108
+ type: "board/removeComponent",
109
+ payload: selectedComponent,
110
+ });
111
+ dispatch({
112
+ type: "board/removeExtraComponent",
113
+ payload: selectedComponent,
114
+ });
115
+ dispatch({ type: "board/setFlagChange", payload: true });
116
+ };
117
+ const handleDuplicateComponent = () => {
118
+ const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
119
+ dispatch({
120
+ type: "board/addComponent",
121
+ payload: newComponent,
122
+ });
123
+ dispatch({
124
+ type: "panel/setSelectedComponent",
125
+ payload: newComponent,
126
+ });
127
+ dispatch({ type: "board/setFlagChange", payload: true });
128
+ };
129
+ function swapOneStepById(arr, id, direction) {
130
+ const index = arr.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
131
+ if (index === -1)
132
+ return arr; // id tidak ditemukan
133
+ const newArr = [...arr];
134
+ if (direction === "left" && index > 0) {
135
+ [newArr[index - 1], newArr[index]] = [newArr[index], newArr[index - 1]];
136
+ }
137
+ if (direction === "right" && index < arr.length - 1) {
138
+ [newArr[index + 1], newArr[index]] = [newArr[index], newArr[index + 1]];
139
+ }
140
+ return newArr;
141
+ }
142
+ const handleOverride = () => {
143
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
144
+ const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
145
+ dispatch({
146
+ type: "board/setNewExtraComponents",
147
+ payload: setNewExtraComponents,
148
+ });
149
+ dispatch({ type: "board/setFlagChange", payload: true });
150
+ return;
151
+ }
152
+ const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
153
+ dispatch({
154
+ type: "board/setNewComponents",
155
+ payload: newArr,
156
+ });
157
+ dispatch({ type: "board/setFlagChange", payload: true });
158
+ };
159
+ const handleOverrideLeft = () => {
160
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
161
+ const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
162
+ dispatch({
163
+ type: "board/setNewExtraComponents",
164
+ payload: setNewExtraComponents,
165
+ });
166
+ dispatch({ type: "board/setFlagChange", payload: true });
167
+ return;
168
+ }
169
+ const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
170
+ dispatch({
171
+ type: "board/setNewComponents",
172
+ payload: newArr,
173
+ });
174
+ dispatch({ type: "board/setFlagChange", payload: true });
175
+ };
176
+ 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: {
177
+ icon: tool.icon,
178
+ type: "text",
179
+ name: tool.name,
180
+ onClick: () => hanldeSelectTool(tool.id),
181
+ style: active === tool.id ? { color: "red" } : {},
182
+ }, popoverProps: {
183
+ content: _jsx("div", { children: tool.name }),
184
+ trigger: "hover",
185
+ placement: "right",
186
+ }, items: [] }, tool.id))), !dragOnly && (_jsxs(_Fragment, { children: [_jsx(ButtonTools, { buttonProps: {
187
+ icon: _jsx(CopyPlus, {}),
188
+ type: "text",
189
+ name: "duplicate",
190
+ onClick: () => handleDuplicateComponent(),
191
+ }, items: [], popoverProps: {
192
+ content: _jsx("div", { children: "Duplicate" }),
193
+ trigger: "hover",
194
+ placement: "right",
195
+ } }), _jsx(ButtonTools, { buttonProps: {
196
+ onClick: () => handleRemoveComponent(),
197
+ icon: _jsx(Trash, {}),
198
+ type: "text",
199
+ name: "trash",
200
+ }, items: [], popoverProps: {
201
+ content: _jsx("div", { children: "Trash" }),
202
+ trigger: "hover",
203
+ placement: "right",
204
+ } }), _jsx(ButtonTools, { buttonProps: {
205
+ onClick: () => handleOverride(),
206
+ icon: _jsx(Layers2, {}),
207
+ type: "text",
208
+ name: "override",
209
+ }, items: [], popoverProps: {
210
+ content: _jsx("div", { children: "Override Right" }),
211
+ trigger: "hover",
212
+ placement: "right",
213
+ } }), _jsx(ButtonTools, { buttonProps: {
214
+ onClick: () => handleOverrideLeft(),
215
+ icon: _jsx(Layers, {}),
216
+ type: "text",
217
+ name: "override",
218
+ }, items: [], popoverProps: {
219
+ content: _jsx("div", { children: "Override Left" }),
220
+ trigger: "hover",
221
+ placement: "right",
222
+ } }), _jsx(Divider, {}), actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
223
+ icon: tool.icon,
224
+ type: "text",
225
+ name: tool.name,
226
+ onClick: () => hanldeSelectTool(tool.id),
227
+ style: active === tool.id ? { color: "red" } : {},
228
+ }, popoverProps: {
229
+ content: _jsx("div", { children: tool.name }),
230
+ trigger: "hover",
231
+ placement: "right",
232
+ }, items: [] }, tool.id))), _jsx(Divider, {})] })), controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
233
+ icon: tool.icon,
234
+ type: "text",
235
+ name: tool.name,
236
+ onClick: () => hanldeSelectTool(tool.id),
237
+ style: active === tool.id ? { color: "red" } : {},
238
+ }, popoverProps: {
239
+ content: _jsx("div", { children: tool.name }),
240
+ trigger: "hover",
241
+ placement: "right",
242
+ }, 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: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} })] }));
243
+ };
244
+ 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;
@@ -0,0 +1,213 @@
1
+ "use client";
2
+ "use client";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { useEffect, useMemo, useRef, useState } from "react";
5
+ import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
6
+ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
+ import Layers from "../../components/layer";
8
+ import { isEqual } from "lodash";
9
+ const LayerView = (props) => {
10
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, selectedTableColor, colorMatchKey, statusKey, defaultBackground, } = props;
11
+ const transformRef = useRef(null);
12
+ const containerRef = useRef(null);
13
+ const svgRef = useRef(null);
14
+ const [scale, setScale] = useState(1);
15
+ const [selectedTable, setSelectedTable] = useState(null);
16
+ const { components: componentsEditor, extraComponents: extraComponentsEditor, } = useAppSelector((state) => state.board);
17
+ const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
18
+ const dispatch = useAppDispatch();
19
+ const convertComponentProps = () => {
20
+ let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
21
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
22
+ return Object.assign({}, item[mappingKey]);
23
+ }
24
+ return item;
25
+ });
26
+ return mappingData;
27
+ };
28
+ useEffect(() => {
29
+ if (!isEqual(componentsEditor, convertComponentProps())) {
30
+ let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
31
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[props.mappingKey])) {
32
+ return Object.assign({}, item[props.mappingKey]);
33
+ }
34
+ return item;
35
+ });
36
+ dispatch({
37
+ type: "board/setNewComponents",
38
+ payload: mappingData,
39
+ });
40
+ }
41
+ if (!isEqual(extraComponentsEditor, extraComponentProps)) {
42
+ dispatch({
43
+ type: "board/setNewExtraComponents",
44
+ payload: extraComponentProps,
45
+ });
46
+ }
47
+ if (defaultBackground) {
48
+ dispatch({
49
+ type: "board/setBackgroundColor",
50
+ payload: defaultBackground,
51
+ });
52
+ }
53
+ }, [componentProps, extraComponentProps, defaultBackground]);
54
+ useEffect(() => {
55
+ onCurrentStateChange &&
56
+ onCurrentStateChange({
57
+ components: componentsEditor,
58
+ extraComponents: extraComponentsEditor,
59
+ });
60
+ }, [componentsEditor, extraComponentsEditor]);
61
+ const handleSelectComponent = (items) => {
62
+ const find = componentsEditor.find((item) => {
63
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
64
+ return item[mappingKey].id === (items === null || items === void 0 ? void 0 : items.id);
65
+ }
66
+ return (item === null || item === void 0 ? void 0 : item.id) === (items === null || items === void 0 ? void 0 : items.id);
67
+ });
68
+ onSelectComponent && onSelectComponent(find);
69
+ setSelectedTable(find);
70
+ };
71
+ const boundingBox = useMemo(() => {
72
+ var _a, _b, _c, _d, _e, _f;
73
+ if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
74
+ return { minX: 0, minY: 0, width: 500, height: 500 };
75
+ }
76
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
77
+ componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.forEach((_) => {
78
+ var _a, _b, _c, _d;
79
+ let values = mappingKey ? _[mappingKey] : _;
80
+ if (!values)
81
+ return;
82
+ if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("square")) {
83
+ minX = Math.min(minX, values.x);
84
+ minY = Math.min(minY, values.y);
85
+ maxX = Math.max(maxX, values.x + values.width);
86
+ maxY = Math.max(maxY, values.y + values.height);
87
+ }
88
+ if ((_b = values === null || values === void 0 ? void 0 : values.shape) === null || _b === void 0 ? void 0 : _b.includes("circle")) {
89
+ minX = Math.min(minX, values.x);
90
+ minY = Math.min(minY, values.y);
91
+ maxX = Math.max(maxX, values.x + values.width);
92
+ maxY = Math.max(maxY, values.y + values.height);
93
+ }
94
+ if ((_c = values === null || values === void 0 ? void 0 : values.shape) === null || _c === void 0 ? void 0 : _c.includes("table-seat-circle")) {
95
+ minX = Math.min(minX, values.x);
96
+ minY = Math.min(minY, values.y);
97
+ maxX = Math.max(maxX, values.x + values.width);
98
+ maxY = Math.max(maxY, values.y + values.height);
99
+ }
100
+ if ((_d = values === null || values === void 0 ? void 0 : values.shape) === null || _d === void 0 ? void 0 : _d.includes("image-table")) {
101
+ minX = Math.min(minX, values.x);
102
+ minY = Math.min(minY, values.y);
103
+ maxX = Math.max(maxX, values.x + values.width);
104
+ maxY = Math.max(maxY, values.y + values.height);
105
+ }
106
+ });
107
+ extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.forEach((values) => {
108
+ var _a, _b;
109
+ if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("background")) {
110
+ minX = Math.min(minX, values.x);
111
+ minY = Math.min(minY, values.y);
112
+ maxX = Math.max(maxX, values.x + values.width);
113
+ maxY = Math.max(maxY, values.y + values.height);
114
+ }
115
+ if ((_b = values === null || values === void 0 ? void 0 : values.shape) === null || _b === void 0 ? void 0 : _b.includes("text")) {
116
+ minX = Math.min(minX, values.x);
117
+ minY = Math.min(minY, values.y);
118
+ maxX = Math.max(maxX, values.x + values.width);
119
+ maxY = Math.max(maxY, values.y + values.height);
120
+ }
121
+ });
122
+ if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 1 && ((_b = (_a = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _a === void 0 ? void 0 : _a.shape) === null || _b === void 0 ? void 0 : _b.includes("background"))) {
123
+ minX = (_c = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _c === void 0 ? void 0 : _c.x;
124
+ minY = (_d = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _d === void 0 ? void 0 : _d.y;
125
+ maxX = (_e = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _e === void 0 ? void 0 : _e.width;
126
+ maxY = (_f = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _f === void 0 ? void 0 : _f.height;
127
+ }
128
+ if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) < 1) {
129
+ minX = minX - minX * 0.5;
130
+ minY = minY - minY * 0.5;
131
+ }
132
+ return {
133
+ minX,
134
+ minY,
135
+ width: maxX,
136
+ height: maxY,
137
+ };
138
+ }, [componentsEditor, extraComponentsEditor]);
139
+ const renderElements = (elementEditor, mappingKey, colorMatchKey) => {
140
+ return elementEditor.map((editorItem, i) => {
141
+ var _a, _b, _c, _d;
142
+ const isUsingMapping = mappingKey &&
143
+ typeof editorItem[mappingKey] === "object" &&
144
+ editorItem[mappingKey] !== null;
145
+ const finalProps = isUsingMapping ? editorItem[mappingKey] : editorItem;
146
+ if (colorMatchKey) {
147
+ if (isUsingMapping) {
148
+ return Object.assign(Object.assign({}, finalProps), { fill: (_b = (_a = colorMatchKey.find((item) => item.key == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[statusKey]))) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : finalProps.fill });
149
+ }
150
+ else {
151
+ return Object.assign(Object.assign({}, finalProps), { fill: (_d = (_c = colorMatchKey.find((item) => item.key == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[statusKey]))) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : finalProps.fill });
152
+ }
153
+ }
154
+ return finalProps;
155
+ });
156
+ };
157
+ const [fingerCount, setFingerCount] = useState(0);
158
+ useEffect(() => {
159
+ const container = document.getElementById("workspace");
160
+ const handleTouchStart = (e) => {
161
+ const count = e.touches.length;
162
+ setFingerCount(count);
163
+ };
164
+ const handleTouchEnd = () => {
165
+ setFingerCount(0);
166
+ };
167
+ if (container) {
168
+ container.addEventListener("touchstart", handleTouchStart);
169
+ container.addEventListener("touchend", handleTouchEnd);
170
+ }
171
+ return () => {
172
+ if (container) {
173
+ container.removeEventListener("touchstart", handleTouchStart);
174
+ container.removeEventListener("touchend", handleTouchEnd);
175
+ }
176
+ };
177
+ }, []);
178
+ return (_jsx("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
179
+ height: "100vh",
180
+ overflow: "auto",
181
+ WebkitOverflowScrolling: "touch",
182
+ touchAction: "pan-y",
183
+ } }, props.containerProps, { children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, { disabled: fingerCount === 1 && scale === 1, disablePadding: true,
184
+ // panning={{
185
+ // disabled: false,
186
+ // velocityDisabled: true,
187
+ // }}
188
+ // limitToBounds={false}
189
+ // doubleClick={{ disabled: true }}
190
+ // pinch={{ disabled: false }}
191
+ // wheel={{ disabled: true }}
192
+ // disabled={true}
193
+ // disablePadding={true}
194
+ centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1,
195
+ // pinch={{ step: 1 }}
196
+ smooth: true, children: _jsx(TransformComponent, { wrapperStyle: {
197
+ width: "100%",
198
+ height: "100%",
199
+ overflow: "visible",
200
+ }, contentStyle: {
201
+ width: "100%",
202
+ height: "100%",
203
+ }, children: _jsx("svg", Object.assign({}, props.svgProps, { id: "workspace", ref: svgRef, width: "100%", height: "100%", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
204
+ background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
205
+ display: "block",
206
+ pointerEvents: "auto",
207
+ // touchAction: "pan-y",
208
+ }, children: _jsx(Layers, { mode: "view", components: [
209
+ ...extraComponentsEditor,
210
+ ...renderElements(componentsEditor, mappingKey, colorMatchKey),
211
+ ], onClick: handleSelectComponent, selectedTable: selectedTable, selectedTableColor: selectedTableColor }) })) }) })) })));
212
+ };
213
+ export default LayerView;
@@ -16,24 +16,22 @@ const LayerView = (props) => {
16
16
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
17
17
  const dispatch = useAppDispatch();
18
18
  const convertComponentProps = () => {
19
- let mappingData = componentProps.map((item) => {
20
- if (mappingKey && item[mappingKey]) {
19
+ let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
20
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
21
21
  return Object.assign({}, item[mappingKey]);
22
22
  }
23
23
  return item;
24
24
  });
25
- console.log("mappingData view", mappingData);
26
25
  return mappingData;
27
26
  };
28
27
  useEffect(() => {
29
28
  if (!isEqual(componentsEditor, convertComponentProps())) {
30
- let mappingData = componentProps.map((item) => {
31
- if (mappingKey && item[props.mappingKey]) {
29
+ let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
30
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[props.mappingKey])) {
32
31
  return Object.assign({}, item[props.mappingKey]);
33
32
  }
34
33
  return item;
35
34
  });
36
- console.log("mappingData useEffect view", mappingData);
37
35
  dispatch({
38
36
  type: "board/setNewComponents",
39
37
  payload: mappingData,
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { ConfigProvider } from "antd";
5
+ import { AntdRegistry } from "@ant-design/nextjs-registry";
6
+ import { useAppSelector, useAppDispatch } from "../hooks/use-redux";
7
+ export const AntdProvider = ({ children, themeColor }) => {
8
+ const dispatch = useAppDispatch();
9
+ const theme = useAppSelector((state) => state.theme);
10
+ useEffect(() => {
11
+ if (themeColor !== theme.primaryColor) {
12
+ dispatch({
13
+ type: "theme/setPrimaryColor",
14
+ payload: themeColor
15
+ });
16
+ }
17
+ }, [themeColor]);
18
+ return (_jsx(AntdRegistry, { children: _jsx(ConfigProvider, { theme: {
19
+ token: {
20
+ colorPrimary: themeColor,
21
+ },
22
+ // token: {
23
+ // colorPrimary: theme.theme["--primary-color"],
24
+ // colorPrimaryBorderHover: theme.theme["--primary-color"],
25
+ // fontFamily: "var(--font-inter), sans-serif",
26
+ // colorError: theme.theme["--danger"],
27
+ // controlOutlineWidth: 4,
28
+ // controlOutline: theme.theme["--surface-color"],
29
+ // colorBgContainerDisabled: "var(--netral-03)",
30
+ // colorTextPlaceholder: "var(--netral-06)",
31
+ // },
32
+ components: {
33
+ Form: {
34
+ labelFontSize: 14,
35
+ fontWeightStrong: 500,
36
+ itemMarginBottom: 12,
37
+ },
38
+ Button: {
39
+ colorPrimary: themeColor
40
+ }
41
+ },
42
+ }, children: children }) }));
43
+ };
@@ -1,3 +1,3 @@
1
1
  export declare const ReduxProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react").JSX.Element;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { store } from "../libs/store";
4
+ import { Provider } from "react-redux";
5
+ export const ReduxProvider = ({ children }) => {
6
+ return _jsx(Provider, { store: store, children: children });
7
+ };
@@ -1,4 +1,4 @@
1
1
  export declare const StoreProvider: ({ children, themeColor, }: {
2
2
  children: React.ReactNode;
3
3
  themeColor?: string;
4
- }) => import("react").JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ReduxProvider } from "./redux-provider";
4
+ import { AntdProvider } from "./antd-provider";
5
+ import { injectSeatEditorCSS } from "../utils/injectCss";
6
+ export const StoreProvider = ({ children, themeColor = "red", }) => {
7
+ injectSeatEditorCSS();
8
+ return (_jsx(ReduxProvider, { children: _jsx(AntdProvider, { themeColor: themeColor, children: children }) }));
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",