seat-editor 3.0.3 → 3.0.4
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/layout.d.ts +1 -1
- package/dist/app/{layout.js → layout.jsx} +7 -2
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/new-board/page.jsx +55 -0
- package/dist/app/old-board/page.d.ts +2 -1
- package/dist/app/old-board/{page.js → page.jsx} +215 -82
- package/dist/app/only-view/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +10 -2
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/page.jsx +101 -0
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +10 -2
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.jsx +13 -0
- package/dist/app/test/page.d.ts +2 -1
- package/dist/app/test/{page.js → page.jsx} +5 -3
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/app/v2/page.jsx +13 -0
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/button-tools/index.jsx +17 -0
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/label.jsx +44 -0
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/form-tools/shape.jsx +66 -0
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/input/{number-indicator.js → number-indicator.jsx} +11 -2
- package/dist/components/joystick/index.d.ts +2 -1
- package/dist/components/joystick/{index.js → index.jsx} +14 -13
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer/index.jsx +383 -0
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v2/index.jsx +370 -0
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v3/{index.js → index.jsx} +242 -102
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/layer-v4/{index.js → index.jsx} +157 -80
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/lib/{index.js → index.jsx} +7 -2
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/components/modal-preview/index.jsx +11 -0
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board/{index.js → index.jsx} +90 -31
- package/dist/features/board-v2/index.d.ts +2 -1
- package/dist/features/board-v2/{index.js → index.jsx} +101 -39
- package/dist/features/board-v3/index copy.d.ts +2 -1
- package/dist/features/board-v3/{index copy.js → index copy.jsx } +128 -50
- package/dist/features/board-v3/index.d.ts +2 -1
- package/dist/features/board-v3/{index.js → index.jsx} +110 -32
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/navbar/index.jsx +5 -0
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/package/{index.js → index.jsx} +16 -6
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/{index.js → index.jsx} +25 -7
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/{select-tool.js → select-tool.jsx} +23 -10
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/selected-group.jsx +47 -0
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/{square-circle-tool.js → square-circle-tool.jsx} +4 -2
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.jsx +31 -0
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/table-seat-square.jsx +46 -0
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/text-tool.jsx +26 -0
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/{upload-tool.js → upload-tool.jsx} +24 -2
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/side-tool/{index.js → index.jsx} +120 -98
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only/{index.js → index.jsx} +38 -31
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-2/{index.js → index.jsx} +16 -13
- package/dist/features/view-only-3/index.d.ts +1 -1
- package/dist/features/view-only-3/{index.js → index.jsx} +45 -30
- package/dist/provider/antd-provider.jsx +46 -0
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/{redux-provider.js → redux-provider.jsx} +1 -2
- package/dist/provider/store-provider.d.ts +1 -1
- package/dist/provider/{store-provider.js → store-provider.jsx} +3 -2
- package/package.json +1 -1
- package/dist/app/new-board/page.js +0 -33
- package/dist/app/only-view/page.js +0 -78
- package/dist/app/page.js +0 -8
- package/dist/app/v2/page.js +0 -8
- package/dist/components/button-tools/index.js +0 -11
- package/dist/components/form-tools/label.js +0 -7
- package/dist/components/form-tools/shape.js +0 -25
- package/dist/components/layer/index.js +0 -295
- package/dist/components/layer-v2/index.js +0 -282
- package/dist/components/modal-preview/index.js +0 -10
- package/dist/features/navbar/index.js +0 -6
- package/dist/features/panel/selected-group.js +0 -7
- package/dist/features/panel/table-seat-circle.js +0 -9
- package/dist/features/panel/table-seat-square.js +0 -9
- package/dist/features/panel/text-tool.js +0 -7
- package/dist/provider/antd-provider.js +0 -43
package/dist/app/layout.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import localFont from "next/font/local";
|
|
3
2
|
import "./globals.css";
|
|
4
3
|
import { Layout } from "antd";
|
|
@@ -18,5 +17,11 @@ export const metadata = {
|
|
|
18
17
|
description: "Generated by create next app",
|
|
19
18
|
};
|
|
20
19
|
export default function RootLayout({ children, }) {
|
|
21
|
-
return (
|
|
20
|
+
return (<html lang="en">
|
|
21
|
+
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
|
22
|
+
<StoreProvider>
|
|
23
|
+
<Layout>{children}</Layout>
|
|
24
|
+
</StoreProvider>
|
|
25
|
+
</body>
|
|
26
|
+
</html>);
|
|
22
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function NewBoard(): import("react
|
|
1
|
+
export default function NewBoard(): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import SeatEditor from "../../features/package";
|
|
4
|
+
import { extraComponent } from "../constant";
|
|
5
|
+
import { data4 } from "../constant";
|
|
6
|
+
export default function NewBoard() {
|
|
7
|
+
const [initialValue, setInitialValue] = useState([]);
|
|
8
|
+
const [extraComponents, setExtraComponents] = useState([]);
|
|
9
|
+
const [backgroundColor, setBackgroundColor] = useState("#000000");
|
|
10
|
+
const [viewOnly, setViewOnly] = useState(true);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setInitialValue(data4);
|
|
13
|
+
setExtraComponents(extraComponent);
|
|
14
|
+
}, []);
|
|
15
|
+
return (<>
|
|
16
|
+
<div className="w-full h-screen flex flex-col relative justify-center">
|
|
17
|
+
<div className="w-full h-[1000px] bg-white border-r border-gray-200">
|
|
18
|
+
{/* <LayerView
|
|
19
|
+
componentProps={initialValue}
|
|
20
|
+
mappingKey="properties"
|
|
21
|
+
extraComponentProps={[]}
|
|
22
|
+
defaultBackground="#ffffff"
|
|
23
|
+
// dragOnly={true}
|
|
24
|
+
statusKey="status"
|
|
25
|
+
|
|
26
|
+
/> */}
|
|
27
|
+
</div>
|
|
28
|
+
{/* <button className="bg-blue-500 text-white px-4 py-2 rounded"
|
|
29
|
+
onClick={() => setViewOnly(!viewOnly)}
|
|
30
|
+
>
|
|
31
|
+
{viewOnly ? "Edit Mode" : "View Mode"}
|
|
32
|
+
</button> */}
|
|
33
|
+
<div className="flex-1 h-full">
|
|
34
|
+
<SeatEditor componentProps={initialValue} viewOnly={false} dragOnly={true} deleteAutorized={{
|
|
35
|
+
component: true,
|
|
36
|
+
extraComponent: true,
|
|
37
|
+
}} mappingKey="properties" onCurrentStateChange={(setState) => {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
40
|
+
setInitialValue((_b = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _b !== void 0 ? _b : []);
|
|
41
|
+
}
|
|
42
|
+
if (setState === null || setState === void 0 ? void 0 : setState.backgroundColor) {
|
|
43
|
+
setBackgroundColor(setState === null || setState === void 0 ? void 0 : setState.backgroundColor);
|
|
44
|
+
}
|
|
45
|
+
if (((_c = setState === null || setState === void 0 ? void 0 : setState.extraComponents) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
46
|
+
setExtraComponents((_d = setState === null || setState === void 0 ? void 0 : setState.extraComponents) !== null && _d !== void 0 ? _d : []);
|
|
47
|
+
}
|
|
48
|
+
}} extraComponentProps={extraComponents} defaultBackground={backgroundColor}
|
|
49
|
+
// dragOnly={true}
|
|
50
|
+
statusKey="status"/>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
</>);
|
|
55
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { useState } from "react";
|
|
2
|
+
import React, { useState } from "react";
|
|
4
3
|
import { Button, Input, Modal } from "antd"; //tes commit
|
|
5
4
|
// aduhuhhusd
|
|
6
5
|
import { Square, MousePointer2, Move3D, Trash, CopyPlusIcon, ZoomInIcon, ZoomOutIcon, DownloadIcon, UploadIcon, Circle, PenIcon, Pencil, } from "lucide-react";
|
|
@@ -293,85 +292,219 @@ const SeatEditor = () => {
|
|
|
293
292
|
// link.click();
|
|
294
293
|
// document.body.removeChild(link);
|
|
295
294
|
};
|
|
296
|
-
return (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
295
|
+
return (<div className="flex h-screen w-full">
|
|
296
|
+
{/* Toolbar */}
|
|
297
|
+
<div className="w-16 bg-gray-800 text-white flex flex-col items-center py-4 space-y-4">
|
|
298
|
+
{/* Select Tool */}
|
|
299
|
+
<Button type={activeTool === "select" ? "primary" : "default"} shape="circle" icon={<MousePointer2 />} onClick={() => handleToolClick("select")}/>
|
|
300
|
+
<Button type={activeTool === "circle" ? "primary" : "default"} shape="circle" icon={<Circle />} onClick={() => handleToolClick("circle")}/>
|
|
301
|
+
<Button type={activeTool === "vip-seat" ? "primary" : "default"} shape="circle" icon={<PenIcon />} // Use any icon you prefer
|
|
302
|
+
onClick={() => handleToolClick("vip-seat")}/>
|
|
303
|
+
{/* Rectangle Tool */}
|
|
304
|
+
<Button type={activeTool === "rectangle" ? "primary" : "default"} shape="circle" icon={<Square />} onClick={() => handleToolClick("rectangle")}/>
|
|
305
|
+
{/* Node Tool */}
|
|
306
|
+
<Button type={activeTool === "node" ? "primary" : "default"} shape="circle" icon={<Move3D />} onClick={() => handleToolClick("node")}/>
|
|
307
|
+
<Button type={activeTool === "pen" ? "primary" : "default"} shape="circle" icon={<Pencil />} onClick={() => handleToolClick("pen")}/>
|
|
308
|
+
|
|
309
|
+
{/* delete */}
|
|
310
|
+
<Button type="default" shape="circle" icon={<Trash />} onClick={deleteSelectedRectangle}/>
|
|
311
|
+
{/* duplicate */}
|
|
312
|
+
<Button type="default" shape="circle" icon={<CopyPlusIcon />} // You can use a copy icon
|
|
313
|
+
onClick={duplicateRectangle}/>
|
|
314
|
+
{/* zoomIn/out */}
|
|
315
|
+
<Button type="default" shape="circle" onClick={zoomIn} icon={<ZoomInIcon />}/>
|
|
316
|
+
<Button type="default" shape="circle" onClick={zoomOut} icon={<ZoomOutIcon />}/>
|
|
317
|
+
{/* {activeTool === "image" && ( */}
|
|
318
|
+
<UploadIcon />
|
|
319
|
+
<span>Image Seat</span>
|
|
320
|
+
<input type="file" accept="image/*" onChange={handleImageUpload}/>
|
|
321
|
+
<span>Background Image</span>
|
|
322
|
+
<input type="file" accept="image/*" onChange={handleImageUploadBackground}/>
|
|
323
|
+
{/* )} */}
|
|
324
|
+
<Button shape="circle" icon={<DownloadIcon />} onClick={exportJSON}/>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
{/* Workspace */}
|
|
328
|
+
<div className="w-full flex items-center justify-center" id={"workspace"}>
|
|
329
|
+
<div className={`bg-gray-900 relative ${getCursorStyle()} w-full h-screen `} onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp} style={{
|
|
330
|
+
transform: `scale(${zoom})`,
|
|
331
|
+
transformOrigin: "0 0",
|
|
332
|
+
}}>
|
|
333
|
+
|
|
334
|
+
{shadowRect && (<div className="absolute border-dashed border-2 border-blue-400" style={{
|
|
335
|
+
left: shadowRect.x,
|
|
336
|
+
top: shadowRect.y,
|
|
337
|
+
width: shadowRect.width,
|
|
338
|
+
height: shadowRect.height,
|
|
339
|
+
backgroundColor: shadowRect.color,
|
|
340
|
+
}}/>)}
|
|
341
|
+
{/* Render rectangles */}
|
|
342
|
+
{rectangles.map((rect) => (<div key={rect.id} 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
|
|
343
|
+
? "border-black"
|
|
344
|
+
: "border-gray-300"}`} style={{
|
|
345
|
+
left: rect.x,
|
|
346
|
+
top: rect.y,
|
|
347
|
+
width: rect.width,
|
|
348
|
+
height: rect.height,
|
|
349
|
+
backgroundColor: rect.color,
|
|
350
|
+
transform: `rotate(${rect.rotation}deg)`,
|
|
351
|
+
transformOrigin: "center",
|
|
352
|
+
borderRadius: rect.shape === "circle" ? "100%" : "0%",
|
|
353
|
+
}}>
|
|
354
|
+
{rect.shape === "image-table" && (<div className="w-full h-full relative">
|
|
355
|
+
<img src={rect.src} alt="custom" className="w-full h-full object-cover" draggable={false}/>
|
|
356
|
+
<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
357
|
+
top: "10%",
|
|
358
|
+
height: "20%",
|
|
359
|
+
backgroundColor: rect.highlightColor || "transparent",
|
|
360
|
+
}}>
|
|
361
|
+
<span className="text-white font-bold text-xs absolute" style={{
|
|
362
|
+
top: "10%",
|
|
363
|
+
left: "50%",
|
|
364
|
+
}}>
|
|
365
|
+
{rect.table}
|
|
366
|
+
</span>
|
|
367
|
+
</div>
|
|
368
|
+
<span className="text-xs text-white flex items-center justify-center absolute w-full" style={{
|
|
369
|
+
top: "85%",
|
|
370
|
+
left: "50%",
|
|
371
|
+
transform: "translate(-50%, -50%)",
|
|
372
|
+
backgroundColor: rect.highlightColor || "transparent"
|
|
373
|
+
}}>
|
|
374
|
+
{rect.pax}
|
|
375
|
+
</span>
|
|
376
|
+
<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
377
|
+
top: "40%",
|
|
378
|
+
height: "20%",
|
|
379
|
+
backgroundColor: rect.highlightColor || "transparent",
|
|
380
|
+
}}>
|
|
381
|
+
<span className="text-white font-bold text-xs">
|
|
382
|
+
{rect.status}
|
|
383
|
+
</span>
|
|
384
|
+
</div>
|
|
385
|
+
</div>)}
|
|
386
|
+
{rect.shape === "image" && (<img src={rect.src} alt="custom" className="w-full h-full object-cover" draggable={false}/>)}
|
|
387
|
+
{rect.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
388
|
+
top: "10%",
|
|
389
|
+
height: "20%",
|
|
390
|
+
}}>
|
|
391
|
+
<span className="text-white font-bold text-xs">
|
|
392
|
+
{rect.table}
|
|
393
|
+
</span>
|
|
394
|
+
</div>)}
|
|
395
|
+
{rect.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
396
|
+
top: "40%",
|
|
397
|
+
height: "20%",
|
|
398
|
+
backgroundColor: rect.highlightColor || "transparent",
|
|
399
|
+
}}>
|
|
400
|
+
<span className="text-white font-bold text-xs">
|
|
401
|
+
{rect.status}
|
|
402
|
+
</span>
|
|
403
|
+
</div>)}
|
|
404
|
+
|
|
405
|
+
{/* Bottom Text */}
|
|
406
|
+
<div className="absolute bottom-2 left-0 right-0 text-center text-white text-sm">
|
|
407
|
+
{rect.shape === "vip-seat" ? "8 Pax" : ""}
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
{/* Resize Nodes */}
|
|
411
|
+
{/* Resize Nodes (Only Show When in Node Mode and Item is Selected) */}
|
|
412
|
+
{activeTool === "node" && (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id && (<>
|
|
413
|
+
{/* Top Left */}
|
|
414
|
+
<div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
|
|
415
|
+
top: -6,
|
|
416
|
+
left: -6,
|
|
417
|
+
cursor: "nwse-resize",
|
|
418
|
+
borderRadius: rect.shape === "circle" ? "50%" : "0%",
|
|
419
|
+
}} onMouseDown={() => startResizing("top-left")}/>
|
|
420
|
+
{/* Top Right */}
|
|
421
|
+
<div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
|
|
422
|
+
top: -6,
|
|
423
|
+
right: -6,
|
|
424
|
+
cursor: "nesw-resize",
|
|
425
|
+
borderRadius: rect.shape === "circle" ? "50%" : "0%",
|
|
426
|
+
}} onMouseDown={() => startResizing("top-right")}/>
|
|
427
|
+
{/* Bottom Left */}
|
|
428
|
+
<div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
|
|
429
|
+
bottom: -6,
|
|
430
|
+
left: -6,
|
|
431
|
+
cursor: "nesw-resize",
|
|
432
|
+
borderRadius: rect.shape === "circle" ? "50%" : "0%",
|
|
433
|
+
}} onMouseDown={() => startResizing("bottom-left")}/>
|
|
434
|
+
{/* Bottom Right */}
|
|
435
|
+
<div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
|
|
436
|
+
bottom: -6,
|
|
437
|
+
right: -6,
|
|
438
|
+
cursor: "nwse-resize",
|
|
439
|
+
borderRadius: rect.shape === "circle" ? "50%" : "0%",
|
|
440
|
+
}} onMouseDown={() => startResizing("bottom-right")}/>
|
|
441
|
+
</>)}
|
|
442
|
+
</div>))}
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
{/* Rectangle Customization Modal */}
|
|
447
|
+
<Modal open={showModal} onCancel={() => setShowModal(false)} onOk={() => setShowModal(false)} title="Edit Rectangle">
|
|
448
|
+
{selectedRectangle && (<>
|
|
449
|
+
<div className="flex gap-4 items-center">
|
|
450
|
+
<div className="flex flex-col">
|
|
451
|
+
<p className="mb-2 font-semibold">Change Color:</p>
|
|
452
|
+
<SketchPicker color={selectedRectangle.color} onChangeComplete={(color) => updateRectangle({ color: color.hex })}/>
|
|
453
|
+
</div>
|
|
454
|
+
<div className="flex flex-col">
|
|
455
|
+
<p className="mt-4 mb-2 font-semibold">Live Preview:</p>
|
|
456
|
+
<div className="relative borderflex items-center justify-center" style={{
|
|
457
|
+
width: selectedRectangle.width,
|
|
458
|
+
height: selectedRectangle.height,
|
|
459
|
+
margin: "0 auto",
|
|
460
|
+
transform: `rotate(${selectedRectangle.rotation}deg)`,
|
|
461
|
+
backgroundColor: selectedRectangle.color,
|
|
462
|
+
transition: "all 0.3s ease",
|
|
463
|
+
scale: "0.5",
|
|
464
|
+
borderRadius: selectedRectangle.shape === "circle" ? "100%" : "0%",
|
|
465
|
+
}}>
|
|
466
|
+
{selectedRectangle.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
467
|
+
top: "10%",
|
|
468
|
+
height: "20%",
|
|
469
|
+
}}>
|
|
470
|
+
<span className="text-white font-bold text-xs">
|
|
471
|
+
{selectedRectangle.status}sfsdf
|
|
472
|
+
</span>
|
|
473
|
+
</div>)}
|
|
474
|
+
{selectedRectangle.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
|
|
475
|
+
top: "40%",
|
|
476
|
+
height: "20%",
|
|
477
|
+
backgroundColor: selectedRectangle.highlightColor || "transparent",
|
|
478
|
+
}}>
|
|
479
|
+
<span className="text-white font-bold text-xs">
|
|
480
|
+
{selectedRectangle.status} dsdsd
|
|
481
|
+
</span>
|
|
482
|
+
</div>)}
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
{/* Preview Section */}
|
|
488
|
+
|
|
489
|
+
<p className="mt-4 mb-2 font-semibold">Edit Text:</p>
|
|
490
|
+
<Input value={selectedRectangle.pax} onChange={(e) => updateRectangle({ pax: e.target.value })}/>
|
|
491
|
+
<p className="mt-4 mb-2 font-semibold">Edit Label:</p>
|
|
492
|
+
<Input value={selectedRectangle.table} onChange={(e) => updateRectangle({ table: e.target.value })}/>
|
|
493
|
+
<p className="mt-4 mb-2 font-semibold">Edit Highlight:</p>
|
|
494
|
+
<Input value={selectedRectangle.status} onChange={(e) => updateRectangle({ status: e.target.value })}/>
|
|
495
|
+
{/* Rotation Controls */}
|
|
496
|
+
<p className="mt-4 mb-2 font-semibold">Rotate:</p>
|
|
497
|
+
<div className="flex gap-4 items-center">
|
|
498
|
+
<Button onClick={() => rotateRectangle("left")}>
|
|
499
|
+
⟲ Rotate Left
|
|
500
|
+
</Button>
|
|
501
|
+
<span>{selectedRectangle.rotation}°</span>
|
|
502
|
+
<Button onClick={() => rotateRectangle("right")}>
|
|
503
|
+
⟳ Rotate Right
|
|
504
|
+
</Button>
|
|
505
|
+
</div>
|
|
506
|
+
</>)}
|
|
507
|
+
</Modal>
|
|
508
|
+
</div>);
|
|
376
509
|
};
|
|
377
510
|
export default SeatEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function ChairIcon(): import("react
|
|
1
|
+
export function ChairIcon(): import("react").JSX.Element;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
export const ChairIcon = () => {
|
|
3
|
-
return (
|
|
2
|
+
return (<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<g clip-path="url(#clip0_3019_14165)">
|
|
4
|
+
<path d="M15.9717 7.5339V4.70339C15.9717 3.07627 14.7076 2.5 13.5189 2.5H6.46226C5.27359 2.5 4.00943 3.07627 4.00943 4.70339V7.5339C3.14151 7.73729 2.5 8.4322 2.5 9.27966V13.822C2.5 15.161 3.5 15.6864 4.48113 15.7373V16.8898C4.48113 17.2288 4.78302 17.5 5.16038 17.5H5.85849C6.23585 17.5 6.53774 17.2288 6.53774 16.8898V15.7373H13.4623V16.8898C13.4623 17.2288 13.7642 17.5 14.1415 17.5H14.8396C15.217 17.5 15.5189 17.2288 15.5189 16.8898V15.7373C16.9717 15.6695 17.5 14.7203 17.5 13.822V9.26271C17.4623 8.4322 16.8208 7.72034 15.9717 7.5339ZM4.68868 4.70339C4.68868 3.31356 5.80189 3.09322 6.46226 3.09322H13.5189C14.1792 3.09322 15.2925 3.29661 15.2925 4.68644V7.4661C14.2736 7.55085 13.4623 8.31356 13.4623 9.26271V9.68644H6.51887V9.26271C6.51887 8.31356 5.70755 7.55085 4.68868 7.4661V4.70339ZM13.4434 10.2966V12.3983H6.51887V10.2966H13.4434ZM5.85849 16.8898H5.16038V15.7373H5.85849V16.8898ZM14.8208 16.8898H14.1226V15.7373H14.8208V16.8898ZM16.8208 13.822H16.8019C16.8019 14.4153 16.5566 15.1441 15.3302 15.1441H14.8208H14.1226H5.85849H5.16038H4.65094C3.99057 15.1441 3.17925 14.9237 3.17925 13.822V9.26271C3.17925 8.6017 3.78302 8.05932 4.51887 8.05932C5.25472 8.05932 5.85849 8.6017 5.85849 9.26271V12.7034C5.85849 12.8729 6.00943 13.0085 6.19811 13.0085H13.8019C13.9906 13.0085 14.1415 12.8729 14.1415 12.7034V9.26271C14.1415 8.6017 14.7453 8.05932 15.4811 8.05932C16.217 8.05932 16.8208 8.6017 16.8208 9.26271V13.822Z" fill="#347ADB" stroke="#347ADB" stroke-width="0.8"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_3019_14165">
|
|
8
|
+
<rect width="16.6667" height="16.6667" fill="white" transform="translate(1.66675 1.6665)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>);
|
|
4
12
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const TouchScrollDetect: () => import("react
|
|
1
|
+
declare const TouchScrollDetect: () => import("react").JSX.Element;
|
|
2
2
|
export default TouchScrollDetect;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import LayerView from "@/features/view-only-3";
|
|
3
|
+
import { useState, useRef } from "react";
|
|
4
|
+
import { data4 } from "../constant";
|
|
5
|
+
import { ChairIcon } from "./chair";
|
|
6
|
+
import { UserIcon } from "./user";
|
|
7
|
+
import { Modal } from "antd";
|
|
8
|
+
import JsonView from '@uiw/react-json-view';
|
|
9
|
+
const Card = (item) => {
|
|
10
|
+
const handleDragStart = (e) => {
|
|
11
|
+
// Jangan preventDefault di drag start
|
|
12
|
+
e.dataTransfer.setData("application/json", JSON.stringify(item));
|
|
13
|
+
e.dataTransfer.effectAllowed = "move";
|
|
14
|
+
};
|
|
15
|
+
return (<div className="h-40 bg-gray-400 shadow-lg rounded-lg p-4 m-4" data-table={JSON.stringify(item)} draggable onContextMenu={(e) => e.preventDefault()} onDragStart={handleDragStart} // ✅ ini yang benar
|
|
16
|
+
onClick={(e) => e.stopPropagation()} onPointerDown={(e) => e.stopPropagation()}>
|
|
17
|
+
<h2 className="text-lg font-semibold mb-2">Card Title</h2>
|
|
18
|
+
<p className="text-gray-600">{item === null || item === void 0 ? void 0 : item.name}</p>
|
|
19
|
+
</div>);
|
|
20
|
+
};
|
|
21
|
+
const TouchScrollDetect = () => {
|
|
22
|
+
const refLayer = useRef(null);
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const [table, setTable] = useState(null);
|
|
25
|
+
const handleZoomIn = () => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
(_b = (_a = refLayer === null || refLayer === void 0 ? void 0 : refLayer.current) === null || _a === void 0 ? void 0 : _a.transformRef) === null || _b === void 0 ? void 0 : _b.zoomIn(0.1);
|
|
28
|
+
};
|
|
29
|
+
const handleZoomOut = () => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_b = (_a = refLayer === null || refLayer === void 0 ? void 0 : refLayer.current) === null || _a === void 0 ? void 0 : _a.transformRef) === null || _b === void 0 ? void 0 : _b.zoomOut();
|
|
32
|
+
};
|
|
33
|
+
const handleSwitch = (e, data) => {
|
|
34
|
+
setOpen(!open);
|
|
35
|
+
setTable(data);
|
|
36
|
+
};
|
|
37
|
+
const handleDrop = (e, data) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
setOpen(!open);
|
|
40
|
+
setTable(data);
|
|
41
|
+
};
|
|
42
|
+
const handleSelectTable = (item) => {
|
|
43
|
+
setOpen(!open);
|
|
44
|
+
setTable(item);
|
|
45
|
+
};
|
|
46
|
+
const renderModal = () => {
|
|
47
|
+
return (<Modal open={open} onCancel={() => setOpen(false)} width={700} title="Preview Board" centered footer={null}>
|
|
48
|
+
<div className="flex flex-col p-4 h-[500px] overflow-auto">
|
|
49
|
+
<JsonView value={table}/>
|
|
50
|
+
</div>
|
|
51
|
+
</Modal>);
|
|
52
|
+
};
|
|
53
|
+
return (<div className="w-full h-screen border-2 border-black overflow-auto" id="scroll-container">
|
|
54
|
+
{renderModal()}
|
|
55
|
+
<div className="flex">
|
|
56
|
+
<div className="h-screen bg-gray-500 w-1/3">
|
|
57
|
+
<div className="p-4">
|
|
58
|
+
{data4.map((item, index) => (<Card key={index} {...item}/>))}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div className="h-screen w-2/3 relative">
|
|
62
|
+
<div className="absolute top-1 right-1 flex gap-4 z-[10]">
|
|
63
|
+
<button className="p-4 bg-gray-400" onClick={() => handleZoomIn()}>+</button>
|
|
64
|
+
<button className="p-4 bg-gray-400" onClick={() => handleZoomOut()}>-</button>
|
|
65
|
+
</div>
|
|
66
|
+
<LayerView refs={refLayer} statusKey="status" defaultBackground="#000000" mappingKey="properties" componentProps={data4} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
|
|
67
|
+
handleSelectTable(component);
|
|
68
|
+
}} dragTableBlockKey={[
|
|
69
|
+
{
|
|
70
|
+
key: "is_lock",
|
|
71
|
+
value: 1,
|
|
72
|
+
},
|
|
73
|
+
]} tableMatchKey={[
|
|
74
|
+
{
|
|
75
|
+
key: 0,
|
|
76
|
+
properties: { fill: "white" },
|
|
77
|
+
},
|
|
78
|
+
]} eventMatchTable={[
|
|
79
|
+
{
|
|
80
|
+
event: "mouseenter",
|
|
81
|
+
properties: { fill: "red" },
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
event: "selected",
|
|
85
|
+
properties: { fill: "white" },
|
|
86
|
+
},
|
|
87
|
+
]} iconTags={[
|
|
88
|
+
{
|
|
89
|
+
icon: <ChairIcon />,
|
|
90
|
+
key: "chair",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
icon: <UserIcon />,
|
|
94
|
+
key: "user",
|
|
95
|
+
},
|
|
96
|
+
]}/>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>);
|
|
100
|
+
};
|
|
101
|
+
export default TouchScrollDetect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function UserIcon(): import("react
|
|
1
|
+
export function UserIcon(): import("react").JSX.Element;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
export const UserIcon = () => {
|
|
3
|
-
return (
|
|
2
|
+
return (<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M7.61992 10.1625C9.00754 10.1625 10.1324 9.03757 10.1324 7.64995C10.1324 6.26234 9.00754 5.13745 7.61992 5.13745C6.23231 5.13745 5.10742 6.26234 5.10742 7.64995C5.10742 9.03757 6.23231 10.1625 7.61992 10.1625Z" fill="#5E6278"/>
|
|
4
|
+
<path d="M7.62 14.9999C9.34313 14.9999 10.74 14.1168 10.74 13.0274C10.74 11.9381 9.34313 11.0549 7.62 11.0549C5.89687 11.0549 4.5 11.9381 4.5 13.0274C4.5 14.1168 5.89687 14.9999 7.62 14.9999Z" fill="#5E6278"/>
|
|
5
|
+
<path opacity="0.3" d="M11.595 4.23C12.7631 4.23 13.71 3.28308 13.71 2.115C13.71 0.946918 12.7631 0 11.595 0C10.4269 0 9.47998 0.946918 9.47998 2.115C9.47998 3.28308 10.4269 4.23 11.595 4.23Z" fill="#5E6278"/>
|
|
6
|
+
<path opacity="0.3" d="M3.62257 4.23C4.79065 4.23 5.73757 3.28308 5.73757 2.115C5.73757 0.946918 4.79065 0 3.62257 0C2.45449 0 1.50757 0.946918 1.50757 2.115C1.50757 3.28308 2.45449 4.23 3.62257 4.23Z" fill="#5E6278"/>
|
|
7
|
+
<g opacity="0.3">
|
|
8
|
+
<path d="M11.4749 5.87256C11.2349 5.87256 11.0024 5.87256 10.7699 5.91006C11.1229 6.52313 11.2825 7.22856 11.2276 7.93388C11.1727 8.63919 10.906 9.31147 10.4624 9.86256C10.7984 9.92909 11.1399 9.96424 11.4824 9.96756C13.3874 9.96756 14.9249 9.04506 14.9249 7.92006C14.9249 6.79506 13.3799 5.87256 11.4749 5.87256Z" fill="#5E6278"/>
|
|
9
|
+
<path d="M3.4499 6C3.6899 6 3.9224 6 4.1549 6.0375C3.80187 6.65057 3.64233 7.356 3.6972 8.06132C3.75208 8.76664 4.0188 9.43891 4.4624 9.99C4.12639 10.0565 3.78492 10.0917 3.4424 10.095C1.5374 10.095 -9.77516e-05 9.1725 -9.77516e-05 8.0475C-9.77516e-05 6.9225 1.5449 6 3.4499 6Z" fill="#5E6278"/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>);
|
|
4
12
|
};
|
package/dist/app/page.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const TableEditor: () => import("react
|
|
1
|
+
declare const TableEditor: () => import("react").JSX.Element;
|
|
2
2
|
export default TableEditor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Board from "../features/board-v3";
|
|
2
|
+
import SideTool from "../features/side-tool";
|
|
3
|
+
import ControlPanels from "../features/panel";
|
|
4
|
+
const TableEditor = () => {
|
|
5
|
+
return (<>
|
|
6
|
+
<div className="w-full h-screen flex relative">
|
|
7
|
+
<SideTool />
|
|
8
|
+
<Board />
|
|
9
|
+
<ControlPanels />
|
|
10
|
+
</div>
|
|
11
|
+
</>);
|
|
12
|
+
};
|
|
13
|
+
export default TableEditor;
|
package/dist/app/test/page.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function DraggableRect(): React.JSX.Element;
|