seat-editor 1.4.31 → 1.4.33

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 (58) 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 +31 -0
  5. package/dist/app/new-board/page.jsx +25 -17
  6. package/dist/app/old-board/page.d.ts +1 -2
  7. package/dist/app/old-board/page.js +377 -0
  8. package/dist/app/only-view/page.d.ts +1 -1
  9. package/dist/app/only-view/page.js +41 -0
  10. package/dist/app/page.d.ts +1 -1
  11. package/dist/app/page.js +8 -0
  12. package/dist/components/button-tools/index.d.ts +1 -1
  13. package/dist/components/button-tools/index.js +11 -0
  14. package/dist/components/form-tools/label.d.ts +1 -1
  15. package/dist/components/form-tools/label.js +7 -0
  16. package/dist/components/form-tools/shape.d.ts +1 -1
  17. package/dist/components/form-tools/shape.js +25 -0
  18. package/dist/components/input/number-indicator.d.ts +1 -1
  19. package/dist/components/input/number-indicator.js +27 -0
  20. package/dist/components/joystick/index.d.ts +1 -2
  21. package/dist/components/joystick/index.js +48 -0
  22. package/dist/components/layer/index.d.ts +1 -1
  23. package/dist/components/layer/index.js +276 -0
  24. package/dist/components/lib/index.d.ts +1 -1
  25. package/dist/components/lib/index.js +28 -0
  26. package/dist/components/modal-preview/index.d.ts +1 -1
  27. package/dist/components/modal-preview/index.js +10 -0
  28. package/dist/features/board/index.d.ts +1 -1
  29. package/dist/features/board/index.js +626 -0
  30. package/dist/features/board/index.jsx +3 -3
  31. package/dist/features/navbar/index.d.ts +1 -1
  32. package/dist/features/navbar/index.js +6 -0
  33. package/dist/features/package/index.d.ts +2 -1
  34. package/dist/features/package/index.js +92 -0
  35. package/dist/features/package/index.jsx +12 -6
  36. package/dist/features/panel/index.d.ts +1 -1
  37. package/dist/features/panel/index.js +97 -0
  38. package/dist/features/panel/select-tool.d.ts +1 -1
  39. package/dist/features/panel/select-tool.js +44 -0
  40. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  41. package/dist/features/panel/square-circle-tool.js +8 -0
  42. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  43. package/dist/features/panel/table-seat-circle.js +9 -0
  44. package/dist/features/panel/text-tool.d.ts +1 -1
  45. package/dist/features/panel/text-tool.js +7 -0
  46. package/dist/features/panel/upload-tool.d.ts +1 -1
  47. package/dist/features/panel/upload-tool.js +155 -0
  48. package/dist/features/side-tool/index.d.ts +1 -1
  49. package/dist/features/side-tool/index.js +244 -0
  50. package/dist/features/view/index.d.ts +1 -1
  51. package/dist/features/view/index.js +219 -0
  52. package/dist/provider/antd-provider.js +43 -0
  53. package/dist/provider/redux-provider.d.ts +1 -1
  54. package/dist/provider/redux-provider.js +7 -0
  55. package/dist/provider/store-provider.d.ts +1 -1
  56. package/dist/provider/store-provider.js +9 -0
  57. package/dist/seat-editor.css +1 -1
  58. package/package.json +1 -1
@@ -3,4 +3,4 @@ import "./globals.css";
3
3
  export declare const metadata: Metadata;
4
4
  export default function RootLayout({ children, }: Readonly<{
5
5
  children: React.ReactNode;
6
- }>): import("react").JSX.Element;
6
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import localFont from "next/font/local";
3
+ import "./globals.css";
4
+ import { Layout } from "antd";
5
+ import { StoreProvider } from "../provider/store-provider";
6
+ const geistSans = localFont({
7
+ src: "./fonts/GeistVF.woff",
8
+ variable: "--font-geist-sans",
9
+ weight: "100 900",
10
+ });
11
+ const geistMono = localFont({
12
+ src: "./fonts/GeistMonoVF.woff",
13
+ variable: "--font-geist-mono",
14
+ weight: "100 900",
15
+ });
16
+ export const metadata = {
17
+ title: "Create Next App",
18
+ description: "Generated by create next app",
19
+ };
20
+ export default function RootLayout({ children, }) {
21
+ return (_jsx("html", { lang: "en", children: _jsx("body", { className: `${geistSans.variable} ${geistMono.variable} antialiased`, children: _jsx(StoreProvider, { children: _jsx(Layout, { children: children }) }) }) }));
22
+ }
@@ -1 +1 @@
1
- export default function NewBoard(): import("react").JSX.Element;
1
+ export default function NewBoard(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
+ import { useEffect, useState } from "react";
13
+ import SeatEditor from "../../features/package";
14
+ import { constantData } from "../constant";
15
+ export default function NewBoard() {
16
+ const [initialValue, setInitialValue] = useState([]);
17
+ const [viewOnly, setViewOnly] = useState(true);
18
+ console.log("constantData", constantData);
19
+ useEffect(() => {
20
+ setInitialValue(constantData);
21
+ }, []);
22
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("button", { className: "bg-blue-500 text-white px-4 py-2 rounded", onClick: () => setViewOnly(!viewOnly), children: viewOnly ? "Edit Mode" : "View Mode" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, mappingKey: "properties", onCurrentStateChange: (setState) => {
23
+ var _a;
24
+ console.log("setState", setState);
25
+ setInitialValue((_a = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _a !== void 0 ? _a : []);
26
+ }, extraComponentProps: [], defaultBackground: "#ffffff",
27
+ // dragOnly={true}
28
+ statusKey: "status", action: (action) => __awaiter(this, void 0, void 0, function* () {
29
+ console.log("action", action);
30
+ }) }) })] }) }));
31
+ }
@@ -1,8 +1,19 @@
1
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
+ };
2
11
  import { useEffect, useState } from "react";
12
+ import SeatEditor from "../../features/package";
3
13
  import { constantData } from "../constant";
4
14
  export default function NewBoard() {
5
15
  const [initialValue, setInitialValue] = useState([]);
16
+ const [viewOnly, setViewOnly] = useState(true);
6
17
  console.log("constantData", constantData);
7
18
  useEffect(() => {
8
19
  setInitialValue(constantData);
@@ -26,23 +37,20 @@ export default function NewBoard() {
26
37
  }}
27
38
  /> */}
28
39
  {/* </div> */}
29
- {/* <div className="flex-1 h-full">
30
- <SeatEditor
31
- componentProps={initialValue}
32
- mappingKey="properties"
33
- onCurrentStateChange={(setState: any) => {
34
- console.log("setState", setState);
35
- setInitialValue(setState?.components??[]);
36
- }}
37
- extraComponentProps={[]}
38
- defaultBackground="#ffffff"
39
- // dragOnly={true}
40
- statusKey="status"
41
- action={async (action: any) => {
42
- console.log("action", action);
43
- }}
44
- />
45
- </div> */}
40
+ <button className="bg-blue-500 text-white px-4 py-2 rounded" onClick={() => setViewOnly(!viewOnly)}>
41
+ {viewOnly ? "Edit Mode" : "View Mode"}
42
+ </button>
43
+ <div className="flex-1 h-full">
44
+ <SeatEditor componentProps={initialValue} viewOnly={viewOnly} mappingKey="properties" onCurrentStateChange={(setState) => {
45
+ var _a;
46
+ console.log("setState", setState);
47
+ setInitialValue((_a = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _a !== void 0 ? _a : []);
48
+ }} extraComponentProps={[]} defaultBackground="#ffffff"
49
+ // dragOnly={true}
50
+ statusKey="status" action={(action) => __awaiter(this, void 0, void 0, function* () {
51
+ console.log("action", action);
52
+ })}/>
53
+ </div>
46
54
 
47
55
  </div>
48
56
  </>);
@@ -1,3 +1,2 @@
1
- import React from "react";
2
- declare const SeatEditor: () => React.JSX.Element;
1
+ declare const SeatEditor: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default SeatEditor;
@@ -0,0 +1,377 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Button, Input, Modal } from "antd"; //tes commit
5
+ // aduhuhhusd
6
+ import { Square, MousePointer2, Move3D, Trash, CopyPlusIcon, ZoomInIcon, ZoomOutIcon, DownloadIcon, UploadIcon, Circle, PenIcon, Pencil, } from "lucide-react";
7
+ import { SketchPicker } from "react-color";
8
+ const SeatEditor = () => {
9
+ var _a, _b;
10
+ const [activeTool, setActiveTool] = useState(null);
11
+ const [rectangles, setRectangles] = useState([]);
12
+ const [selectedRectangle, setSelectedRectangle] = useState(null);
13
+ const [isDragging, setIsDragging] = useState(false);
14
+ const [startPoint, setStartPoint] = useState(null);
15
+ const [shadowRect, setShadowRect] = useState(null);
16
+ const [showModal, setShowModal] = useState(false);
17
+ const [dragOffset, setDragOffset] = useState(null);
18
+ const [zoom, setZoom] = useState(1);
19
+ const [resizeDirection, setResizeDirection] = useState(null);
20
+ const [images, setImages] = useState([]);
21
+ const [penPaths, setPenPaths] = useState([]);
22
+ const [currentPath, setCurrentPath] = useState(null);
23
+ const [isDrawing, setIsDrawing] = useState(false);
24
+ // upload image
25
+ const widthWorkspace = ((_a = document.getElementById("workspace")) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
26
+ const heightWorkspace = ((_b = document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
27
+ const handleImageUploadBackground = (e) => {
28
+ var _a;
29
+ const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
30
+ if (!file)
31
+ return;
32
+ const reader = new FileReader();
33
+ reader.onload = () => {
34
+ const img = document.createElement("img");
35
+ img.src = reader.result;
36
+ let width = img.width > widthWorkspace ? img.width / 2 : img.width;
37
+ let height = img.height > heightWorkspace ? img.height / 2 : img.height;
38
+ img.onload = () => {
39
+ setRectangles((prev) => [
40
+ ...prev,
41
+ {
42
+ id: rectangles.length + 1,
43
+ x: 100,
44
+ y: 100,
45
+ width: width < 1 ? 100 : width,
46
+ height: height < 1 ? 100 : height,
47
+ rotation: 0,
48
+ shape: "image",
49
+ src: img.src,
50
+ },
51
+ ]);
52
+ };
53
+ };
54
+ reader.readAsDataURL(file);
55
+ };
56
+ const handleImageUpload = (e) => {
57
+ var _a;
58
+ const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
59
+ if (!file)
60
+ return;
61
+ const reader = new FileReader();
62
+ reader.onload = () => {
63
+ const img = document.createElement("img");
64
+ img.src = reader.result;
65
+ let width = img.width > widthWorkspace ? img.width / 2 : img.width;
66
+ let height = img.height > heightWorkspace ? img.height / 2 : img.height;
67
+ img.onload = () => {
68
+ setRectangles((prev) => [
69
+ ...prev,
70
+ {
71
+ id: rectangles.length + 1,
72
+ x: 100,
73
+ y: 100,
74
+ width: width < 1 ? 100 : width,
75
+ height: height < 1 ? 100 : height,
76
+ rotation: 0,
77
+ shape: "image-table",
78
+ src: img.src,
79
+ pax: "4 Pax",
80
+ highlightColor: "#C1443D",
81
+ status: "SOLD",
82
+ table: `V${rectangles.length + 1}`,
83
+ },
84
+ ]);
85
+ };
86
+ };
87
+ reader.readAsDataURL(file);
88
+ };
89
+ // zoom in out
90
+ const zoomIn = () => setZoom((prev) => prev + 0.1);
91
+ const zoomOut = () => setZoom((prev) => Math.max(0.1, prev - 0.1));
92
+ const handleToolClick = (tool) => {
93
+ setActiveTool(tool);
94
+ setSelectedRectangle(null); // Deselect any rectangle when switching tools
95
+ };
96
+ // === Drawing Rectangle ===
97
+ const handleMouseDown = (e) => {
98
+ if (activeTool === "rectangle" ||
99
+ activeTool === "circle" ||
100
+ activeTool === "vip-seat") {
101
+ const rect = e.target.getBoundingClientRect();
102
+ setStartPoint({ x: e.clientX - rect.left, y: e.clientY - rect.top });
103
+ setIsDragging(true);
104
+ }
105
+ if (activeTool === "pen") {
106
+ const rect = e.target.getBoundingClientRect();
107
+ const newPoint = { x: e.clientX - rect.left, y: e.clientY - rect.top };
108
+ setCurrentPath({
109
+ id: penPaths.length + 1,
110
+ points: [newPoint],
111
+ color: "#fff", // Default white stroke
112
+ strokeWidth: 2, // Default stroke width
113
+ });
114
+ setIsDrawing(true);
115
+ }
116
+ };
117
+ // rotate logic
118
+ const rotateRectangle = (direction) => {
119
+ if (selectedRectangle) {
120
+ const rotationChange = direction === "left" ? -5 : 5; // Rotate 5 degrees
121
+ const newRotation = (selectedRectangle.rotation + rotationChange) % 360;
122
+ setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
123
+ ? Object.assign(Object.assign({}, rect), { rotation: newRotation }) : rect));
124
+ setSelectedRectangle((prev) => prev ? Object.assign(Object.assign({}, prev), { rotation: newRotation }) : null);
125
+ }
126
+ };
127
+ const handleMouseMove = (e) => {
128
+ // Resize logic for node tool
129
+ if (activeTool === "node" &&
130
+ isDragging &&
131
+ resizeDirection &&
132
+ selectedRectangle) {
133
+ const workspaceRect = e.currentTarget.getBoundingClientRect();
134
+ const currentX = e.clientX - workspaceRect.left;
135
+ const currentY = e.clientY - workspaceRect.top;
136
+ let newRect = Object.assign({}, selectedRectangle);
137
+ switch (resizeDirection) {
138
+ case "top-left":
139
+ newRect.width += newRect.x - currentX;
140
+ newRect.height =
141
+ selectedRectangle.shape === "circle"
142
+ ? newRect.width
143
+ : newRect.height + (newRect.y - currentY);
144
+ newRect.x = currentX;
145
+ newRect.y =
146
+ selectedRectangle.shape === "circle" ? newRect.y : currentY;
147
+ break;
148
+ case "top-right":
149
+ newRect.width = currentX - newRect.x;
150
+ newRect.height =
151
+ selectedRectangle.shape === "circle"
152
+ ? newRect.width
153
+ : newRect.height + (newRect.y - currentY);
154
+ newRect.y =
155
+ selectedRectangle.shape === "circle" ? newRect.y : currentY;
156
+ break;
157
+ case "bottom-left":
158
+ newRect.width += newRect.x - currentX;
159
+ newRect.height =
160
+ selectedRectangle.shape === "circle"
161
+ ? newRect.width
162
+ : currentY - newRect.y;
163
+ newRect.x = currentX;
164
+ break;
165
+ case "bottom-right":
166
+ newRect.width = currentX - newRect.x;
167
+ newRect.height =
168
+ selectedRectangle.shape === "circle"
169
+ ? newRect.width
170
+ : currentY - newRect.y;
171
+ break;
172
+ }
173
+ // Ensure width and height are always positive
174
+ newRect.width = Math.max(10, newRect.width);
175
+ newRect.height = Math.max(10, newRect.height);
176
+ setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign({}, newRect) : rect));
177
+ setSelectedRectangle(newRect);
178
+ }
179
+ if ((activeTool === "rectangle" ||
180
+ activeTool === "circle" ||
181
+ activeTool === "vip-seat") &&
182
+ isDragging &&
183
+ startPoint) {
184
+ const rect = e.target.getBoundingClientRect();
185
+ const currentX = e.clientX - rect.left;
186
+ const currentY = e.clientY - rect.top;
187
+ // Update shadow rectangle dimensions dynamically
188
+ const newShadowRect = {
189
+ id: -1, // Temporary ID for preview
190
+ x: Math.min(startPoint.x, currentX),
191
+ y: Math.min(startPoint.y, currentY),
192
+ width: Math.abs(currentX - startPoint.x),
193
+ height: Math.abs(currentY - startPoint.y),
194
+ color: activeTool === "vip-seat" ? "#2D2D36" : "rgba(74, 144, 226, 0.4)", // Light blue with transparency
195
+ pax: "",
196
+ rotation: 0,
197
+ shape: activeTool === "vip-seat" ? "vip-seat" : activeTool, // Define shape type
198
+ highlightColor: activeTool === "vip-seat" ? "#C1443D" : undefined, // Red section in VIP
199
+ status: activeTool === "vip-seat" ? "SOLD" : undefined,
200
+ table: activeTool === "vip-seat" ? `V${rectangles.length + 1}` : undefined, // Table number for VIP
201
+ };
202
+ setShadowRect(newShadowRect);
203
+ }
204
+ // Dragging for select tool
205
+ if (activeTool === "select" &&
206
+ isDragging &&
207
+ selectedRectangle &&
208
+ dragOffset) {
209
+ const workspaceRect = e.currentTarget.getBoundingClientRect();
210
+ const newX = e.clientX - workspaceRect.left - dragOffset.x;
211
+ const newY = e.clientY - workspaceRect.top - dragOffset.y;
212
+ setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
213
+ ? Object.assign(Object.assign({}, rect), { x: newX, y: newY }) : rect));
214
+ }
215
+ };
216
+ const handleMouseUp = () => {
217
+ setIsDragging(false);
218
+ setResizeDirection(null);
219
+ if ((activeTool === "rectangle" ||
220
+ activeTool === "circle" ||
221
+ activeTool === "vip-seat") &&
222
+ isDragging &&
223
+ shadowRect) {
224
+ // Finalize the rectangle on mouse release
225
+ const newRectangle = Object.assign(Object.assign({}, shadowRect), { id: rectangles.length + 1, color: "#4A90E2", pax: activeTool === "vip-seat" ? "4 Pax" : "Seat", highlightColor: activeTool === "vip-seat" ? "#C1443D" : undefined, status: activeTool === "vip-seat" ? "SOLD" : undefined, table: activeTool === "vip-seat" ? "V1" : undefined });
226
+ setRectangles([...rectangles, newRectangle]);
227
+ setImages((prev) => prev.map((img) => img.id === (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id)
228
+ ? Object.assign(Object.assign({}, img), { x: newRectangle.x, y: newRectangle.y }) : img));
229
+ setShadowRect(null); // Clear shadow preview
230
+ setIsDragging(false);
231
+ setStartPoint(null);
232
+ }
233
+ };
234
+ const handleRectangleMouseDown = (e, rect) => {
235
+ if (activeTool === "select" || activeTool === "node") {
236
+ setSelectedRectangle(rect);
237
+ const rectBox = e.target.getBoundingClientRect();
238
+ setDragOffset({
239
+ x: e.clientX - rectBox.left,
240
+ y: e.clientY - rectBox.top,
241
+ });
242
+ setIsDragging(true);
243
+ }
244
+ };
245
+ const handleRectangleDoubleClick = (rect) => {
246
+ if (activeTool === "select" || activeTool === "node") {
247
+ setSelectedRectangle(rect);
248
+ setShowModal(true);
249
+ }
250
+ };
251
+ const updateRectangle = (updates) => {
252
+ if (selectedRectangle) {
253
+ setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign(Object.assign({}, rect), updates) : rect));
254
+ setSelectedRectangle((prev) => (prev ? Object.assign(Object.assign({}, prev), updates) : null));
255
+ }
256
+ };
257
+ const startResizing = (direction) => {
258
+ setResizeDirection(direction);
259
+ setIsDragging(true);
260
+ };
261
+ // Set the cursor style based on the active tool
262
+ const getCursorStyle = () => {
263
+ if (activeTool === "rectangle" ||
264
+ activeTool === "circle" ||
265
+ activeTool === "vip-seat")
266
+ return "cursor-crosshair";
267
+ if (activeTool === "select")
268
+ return "cursor-default";
269
+ if (activeTool === "node")
270
+ return "cursor-pointer";
271
+ return "cursor-default";
272
+ };
273
+ const deleteSelectedRectangle = () => {
274
+ if (selectedRectangle) {
275
+ setRectangles((prev) => prev.filter((rect) => rect.id !== selectedRectangle.id));
276
+ setSelectedRectangle(null);
277
+ }
278
+ };
279
+ // duplicate
280
+ const duplicateRectangle = () => {
281
+ if (selectedRectangle) {
282
+ const newRectangle = Object.assign(Object.assign({}, selectedRectangle), { id: rectangles.length + 1, x: selectedRectangle.x + 20, y: selectedRectangle.y + 20 });
283
+ setRectangles([...rectangles, newRectangle]);
284
+ }
285
+ };
286
+ const exportJSON = () => {
287
+ // const json = JSON.stringify(rectangles, null, 2);
288
+ // const blob = new Blob([json], { type: "application/json" });
289
+ // const link = document.createElement("a");
290
+ // link.href = URL.createObjectURL(blob);
291
+ // link.download = "seat_layout.json";
292
+ // document.body.appendChild(link);
293
+ // link.click();
294
+ // document.body.removeChild(link);
295
+ };
296
+ return (_jsxs("div", { className: "flex h-screen w-full", children: [_jsxs("div", { className: "w-16 bg-gray-800 text-white flex flex-col items-center py-4 space-y-4", children: [_jsx(Button, { type: activeTool === "select" ? "primary" : "default", shape: "circle", icon: _jsx(MousePointer2, {}), onClick: () => handleToolClick("select") }), _jsx(Button, { type: activeTool === "circle" ? "primary" : "default", shape: "circle", icon: _jsx(Circle, {}), onClick: () => handleToolClick("circle") }), _jsx(Button, { type: activeTool === "vip-seat" ? "primary" : "default", shape: "circle", icon: _jsx(PenIcon, {}), onClick: () => handleToolClick("vip-seat") }), _jsx(Button, { type: activeTool === "rectangle" ? "primary" : "default", shape: "circle", icon: _jsx(Square, {}), onClick: () => handleToolClick("rectangle") }), _jsx(Button, { type: activeTool === "node" ? "primary" : "default", shape: "circle", icon: _jsx(Move3D, {}), onClick: () => handleToolClick("node") }), _jsx(Button, { type: activeTool === "pen" ? "primary" : "default", shape: "circle", icon: _jsx(Pencil, {}), onClick: () => handleToolClick("pen") }), _jsx(Button, { type: "default", shape: "circle", icon: _jsx(Trash, {}), onClick: deleteSelectedRectangle }), _jsx(Button, { type: "default", shape: "circle", icon: _jsx(CopyPlusIcon, {}), onClick: duplicateRectangle }), _jsx(Button, { type: "default", shape: "circle", onClick: zoomIn, icon: _jsx(ZoomInIcon, {}) }), _jsx(Button, { type: "default", shape: "circle", onClick: zoomOut, icon: _jsx(ZoomOutIcon, {}) }), _jsx(UploadIcon, {}), _jsx("span", { children: "Image Seat" }), _jsx("input", { type: "file", accept: "image/*", onChange: handleImageUpload }), _jsx("span", { children: "Background Image" }), _jsx("input", { type: "file", accept: "image/*", onChange: handleImageUploadBackground }), _jsx(Button, { shape: "circle", icon: _jsx(DownloadIcon, {}), onClick: exportJSON })] }), _jsx("div", { className: "w-full flex items-center justify-center", id: "workspace", children: _jsxs("div", { className: `bg-gray-900 relative ${getCursorStyle()} w-full h-screen `, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, style: {
297
+ transform: `scale(${zoom})`,
298
+ transformOrigin: "0 0",
299
+ }, children: [shadowRect && (_jsx("div", { className: "absolute border-dashed border-2 border-blue-400", style: {
300
+ left: shadowRect.x,
301
+ top: shadowRect.y,
302
+ width: shadowRect.width,
303
+ height: shadowRect.height,
304
+ backgroundColor: shadowRect.color,
305
+ } })), rectangles.map((rect) => (_jsxs("div", { onMouseDown: (e) => handleRectangleMouseDown(e, rect), onDoubleClick: () => handleRectangleDoubleClick(rect), className: `absolute cursor-move border transition-transform ${(selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id
306
+ ? "border-black"
307
+ : "border-gray-300"}`, style: {
308
+ left: rect.x,
309
+ top: rect.y,
310
+ width: rect.width,
311
+ height: rect.height,
312
+ backgroundColor: rect.color,
313
+ transform: `rotate(${rect.rotation}deg)`,
314
+ transformOrigin: "center",
315
+ borderRadius: rect.shape === "circle" ? "100%" : "0%",
316
+ }, children: [rect.shape === "image-table" && (_jsxs("div", { className: "w-full h-full relative", children: [_jsx("img", { src: rect.src, alt: "custom", className: "w-full h-full object-cover", draggable: false }), _jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
317
+ top: "10%",
318
+ height: "20%",
319
+ backgroundColor: rect.highlightColor || "transparent",
320
+ }, children: _jsx("span", { className: "text-white font-bold text-xs absolute", style: {
321
+ top: "10%",
322
+ left: "50%",
323
+ }, children: rect.table }) }), _jsx("span", { className: "text-xs text-white flex items-center justify-center absolute w-full", style: {
324
+ top: "85%",
325
+ left: "50%",
326
+ transform: "translate(-50%, -50%)",
327
+ backgroundColor: rect.highlightColor || "transparent"
328
+ }, children: rect.pax }), _jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
329
+ top: "40%",
330
+ height: "20%",
331
+ backgroundColor: rect.highlightColor || "transparent",
332
+ }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.status }) })] })), rect.shape === "image" && (_jsx("img", { src: rect.src, alt: "custom", className: "w-full h-full object-cover", draggable: false })), rect.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
333
+ top: "10%",
334
+ height: "20%",
335
+ }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.table }) })), rect.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
336
+ top: "40%",
337
+ height: "20%",
338
+ backgroundColor: rect.highlightColor || "transparent",
339
+ }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.status }) })), _jsx("div", { className: "absolute bottom-2 left-0 right-0 text-center text-white text-sm", children: rect.shape === "vip-seat" ? "8 Pax" : "" }), activeTool === "node" && (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id && (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
340
+ top: -6,
341
+ left: -6,
342
+ cursor: "nwse-resize",
343
+ borderRadius: rect.shape === "circle" ? "50%" : "0%",
344
+ }, onMouseDown: () => startResizing("top-left") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
345
+ top: -6,
346
+ right: -6,
347
+ cursor: "nesw-resize",
348
+ borderRadius: rect.shape === "circle" ? "50%" : "0%",
349
+ }, onMouseDown: () => startResizing("top-right") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
350
+ bottom: -6,
351
+ left: -6,
352
+ cursor: "nesw-resize",
353
+ borderRadius: rect.shape === "circle" ? "50%" : "0%",
354
+ }, onMouseDown: () => startResizing("bottom-left") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
355
+ bottom: -6,
356
+ right: -6,
357
+ cursor: "nwse-resize",
358
+ borderRadius: rect.shape === "circle" ? "50%" : "0%",
359
+ }, onMouseDown: () => startResizing("bottom-right") })] }))] }, rect.id)))] }) }), _jsx(Modal, { open: showModal, onCancel: () => setShowModal(false), onOk: () => setShowModal(false), title: "Edit Rectangle", children: selectedRectangle && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex gap-4 items-center", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-semibold", children: "Change Color:" }), _jsx(SketchPicker, { color: selectedRectangle.color, onChangeComplete: (color) => updateRectangle({ color: color.hex }) })] }), _jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Live Preview:" }), _jsxs("div", { className: "relative borderflex items-center justify-center", style: {
360
+ width: selectedRectangle.width,
361
+ height: selectedRectangle.height,
362
+ margin: "0 auto",
363
+ transform: `rotate(${selectedRectangle.rotation}deg)`,
364
+ backgroundColor: selectedRectangle.color,
365
+ transition: "all 0.3s ease",
366
+ scale: "0.5",
367
+ borderRadius: selectedRectangle.shape === "circle" ? "100%" : "0%",
368
+ }, children: [selectedRectangle.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
369
+ top: "10%",
370
+ height: "20%",
371
+ }, children: _jsxs("span", { className: "text-white font-bold text-xs", children: [selectedRectangle.status, "sfsdf"] }) })), selectedRectangle.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
372
+ top: "40%",
373
+ height: "20%",
374
+ backgroundColor: selectedRectangle.highlightColor || "transparent",
375
+ }, children: _jsxs("span", { className: "text-white font-bold text-xs", children: [selectedRectangle.status, " dsdsd"] }) }))] })] })] }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Text:" }), _jsx(Input, { value: selectedRectangle.pax, onChange: (e) => updateRectangle({ pax: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Label:" }), _jsx(Input, { value: selectedRectangle.table, onChange: (e) => updateRectangle({ table: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Highlight:" }), _jsx(Input, { value: selectedRectangle.status, onChange: (e) => updateRectangle({ status: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Rotate:" }), _jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(Button, { onClick: () => rotateRectangle("left"), children: "\u27F2 Rotate Left" }), _jsxs("span", { children: [selectedRectangle.rotation, "\u00B0"] }), _jsx(Button, { onClick: () => rotateRectangle("right"), children: "\u27F3 Rotate Right" })] })] })) })] }));
376
+ };
377
+ export default SeatEditor;
@@ -1,2 +1,2 @@
1
- declare const TouchScrollDetect: () => import("react").JSX.Element;
1
+ declare const TouchScrollDetect: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default TouchScrollDetect;
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import LayerView from "@/features/view";
4
+ import { useState, useEffect } from "react";
5
+ import { dataDummy } from "./constant";
6
+ const TouchScrollDetect = () => {
7
+ const [fingerCount, setFingerCount] = useState(0);
8
+ const [scrollType, setScrollType] = useState(""); // untuk kondisi tampilan
9
+ useEffect(() => {
10
+ const container = document.getElementById("scroll-container");
11
+ const handleTouchStart = (e) => {
12
+ const count = e.touches.length;
13
+ setFingerCount(count);
14
+ if (count === 1) {
15
+ setScrollType("one");
16
+ }
17
+ else if (count === 2) {
18
+ setScrollType("two");
19
+ }
20
+ else {
21
+ setScrollType("other");
22
+ }
23
+ };
24
+ const handleTouchEnd = () => {
25
+ setFingerCount(0);
26
+ setScrollType(""); // reset saat tidak ada sentuhan
27
+ };
28
+ if (container) {
29
+ container.addEventListener("touchstart", handleTouchStart);
30
+ container.addEventListener("touchend", handleTouchEnd);
31
+ }
32
+ return () => {
33
+ if (container) {
34
+ container.removeEventListener("touchstart", handleTouchStart);
35
+ container.removeEventListener("touchend", handleTouchEnd);
36
+ }
37
+ };
38
+ }, []);
39
+ return (_jsx(LayerView, { statusKey: "status", defaultBackground: "#000000", componentProps: dataDummy, extraComponentProps: [] }));
40
+ };
41
+ export default TouchScrollDetect;
@@ -1,2 +1,2 @@
1
- declare const TableEditor: () => import("react").JSX.Element;
1
+ declare const TableEditor: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default TableEditor;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Board from "../features/board";
3
+ import SideTool from "../features/side-tool";
4
+ import ControlPanels from "../features/panel";
5
+ const TableEditor = () => {
6
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex relative", children: [_jsx(SideTool, {}), _jsx(Board, {}), _jsx(ControlPanels, {})] }) }));
7
+ };
8
+ export default TableEditor;
@@ -7,5 +7,5 @@ interface ButtonToolsProps {
7
7
  }>;
8
8
  popoverProps?: PopoverProps;
9
9
  }
10
- declare const ButtonTools: (props: ButtonToolsProps) => import("react").JSX.Element;
10
+ declare const ButtonTools: (props: ButtonToolsProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export default ButtonTools;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button, Popover } from "antd";
4
+ const ButtonTools = (props) => {
5
+ const { buttonProps, items, popoverProps } = props;
6
+ if (items.length === 0) {
7
+ return (_jsx(Popover, Object.assign({ trigger: "hover" }, popoverProps, { children: _jsx(Button, Object.assign({}, buttonProps)) })));
8
+ }
9
+ return (_jsx(Popover, { content: _jsxs("div", { children: [_jsx(Button, { children: "Button 1" }), _jsx(Button, { children: "Button 2" })] }), trigger: "click", children: _jsx(Button, Object.assign({}, buttonProps)) }));
10
+ };
11
+ export default ButtonTools;
@@ -1,2 +1,2 @@
1
- declare const SectionLabel: () => import("react").JSX.Element;
1
+ declare const SectionLabel: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SectionLabel;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
4
+ const SectionLabel = () => {
5
+ return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Form.Item, { label: "Labels in square", name: "labels", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { children: [_jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "label"], label: "Text", children: _jsx(Input, {}) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "x"], label: "X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) })] })] }, field.key))), _jsxs(Flex, { gap: 2, children: [_jsx(Button, { type: "primary", onClick: () => add(), className: "btn btn-primary", children: "Add" }), _jsx(Button, { type: "primary", onClick: () => remove(fields.length - 1), className: "btn btn-primary", children: "Remove" })] })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
6
+ };
7
+ export default SectionLabel;
@@ -1,2 +1,2 @@
1
- declare const SectionShape: () => import("react").JSX.Element;
1
+ declare const SectionShape: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SectionShape;