seat-editor 3.0.0 → 3.0.2

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 (100) hide show
  1. package/dist/app/layout.d.ts +1 -1
  2. package/dist/app/{layout.js → layout.jsx} +7 -2
  3. package/dist/app/new-board/page.d.ts +1 -1
  4. package/dist/app/new-board/page.jsx +55 -0
  5. package/dist/app/old-board/page.d.ts +2 -1
  6. package/dist/app/old-board/{page.js → page.jsx} +215 -82
  7. package/dist/app/only-view/chair.d.ts +1 -1
  8. package/dist/app/only-view/chair.js +10 -2
  9. package/dist/app/only-view/page.d.ts +1 -1
  10. package/dist/app/only-view/page.jsx +101 -0
  11. package/dist/app/only-view/user.d.ts +1 -1
  12. package/dist/app/only-view/user.js +10 -2
  13. package/dist/app/page.d.ts +1 -1
  14. package/dist/app/page.jsx +13 -0
  15. package/dist/app/test/page.d.ts +2 -1
  16. package/dist/app/test/{page.js → page.jsx} +5 -3
  17. package/dist/app/v2/page.d.ts +1 -1
  18. package/dist/app/v2/page.jsx +13 -0
  19. package/dist/components/button-tools/index.d.ts +1 -1
  20. package/dist/components/button-tools/index.jsx +17 -0
  21. package/dist/components/form-tools/label.d.ts +1 -1
  22. package/dist/components/form-tools/label.jsx +44 -0
  23. package/dist/components/form-tools/shape.d.ts +1 -1
  24. package/dist/components/form-tools/shape.jsx +66 -0
  25. package/dist/components/input/number-indicator.d.ts +1 -1
  26. package/dist/components/input/{number-indicator.js → number-indicator.jsx} +11 -2
  27. package/dist/components/joystick/index.d.ts +2 -1
  28. package/dist/components/joystick/{index.js → index.jsx} +14 -13
  29. package/dist/components/layer/index.d.ts +1 -1
  30. package/dist/components/layer/index.jsx +383 -0
  31. package/dist/components/layer-v2/index.d.ts +1 -1
  32. package/dist/components/layer-v2/index.jsx +370 -0
  33. package/dist/components/layer-v3/index.d.ts +1 -1
  34. package/dist/components/layer-v3/{index.js → index.jsx} +242 -102
  35. package/dist/components/layer-v4/index.d.ts +1 -1
  36. package/dist/components/layer-v4/{index.js → index.jsx} +157 -80
  37. package/dist/components/lib/index.d.ts +1 -1
  38. package/dist/components/lib/{index.js → index.jsx} +7 -2
  39. package/dist/components/modal-preview/index.d.ts +1 -1
  40. package/dist/components/modal-preview/index.jsx +11 -0
  41. package/dist/features/board/index.d.ts +1 -1
  42. package/dist/features/board/{index.js → index.jsx} +90 -31
  43. package/dist/features/board-v2/index.d.ts +2 -1
  44. package/dist/features/board-v2/{index.js → index.jsx} +101 -39
  45. package/dist/features/board-v3/index copy.d.ts +2 -1
  46. package/dist/features/board-v3/{index copy.js → index copy.jsx } +128 -50
  47. package/dist/features/board-v3/index.d.ts +2 -1
  48. package/dist/features/board-v3/{index.js → index.jsx} +110 -32
  49. package/dist/features/navbar/index.d.ts +1 -1
  50. package/dist/features/navbar/index.jsx +5 -0
  51. package/dist/features/package/index.d.ts +1 -1
  52. package/dist/features/package/{index.js → index.jsx} +16 -6
  53. package/dist/features/panel/index.d.ts +1 -1
  54. package/dist/features/panel/{index.js → index.jsx} +25 -7
  55. package/dist/features/panel/select-tool.d.ts +1 -1
  56. package/dist/features/panel/{select-tool.js → select-tool.jsx} +23 -10
  57. package/dist/features/panel/selected-group.d.ts +1 -1
  58. package/dist/features/panel/selected-group.jsx +47 -0
  59. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  60. package/dist/features/panel/{square-circle-tool.js → square-circle-tool.jsx} +4 -2
  61. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  62. package/dist/features/panel/table-seat-circle.jsx +31 -0
  63. package/dist/features/panel/table-seat-square.d.ts +1 -1
  64. package/dist/features/panel/table-seat-square.jsx +46 -0
  65. package/dist/features/panel/text-tool.d.ts +1 -1
  66. package/dist/features/panel/text-tool.jsx +26 -0
  67. package/dist/features/panel/upload-tool.d.ts +1 -1
  68. package/dist/features/panel/{upload-tool.js → upload-tool.jsx} +24 -2
  69. package/dist/features/side-tool/index.d.ts +1 -1
  70. package/dist/features/side-tool/{index.js → index.jsx} +120 -98
  71. package/dist/features/view-only/index.d.ts +1 -1
  72. package/dist/features/view-only/{index.js → index.jsx} +38 -31
  73. package/dist/features/view-only-2/index.d.ts +1 -1
  74. package/dist/features/view-only-2/{index.js → index.jsx} +16 -13
  75. package/dist/features/view-only-3/index.d.ts +1 -1
  76. package/dist/features/view-only-3/{index.js → index.jsx} +46 -27
  77. package/dist/index.d.ts +2 -1
  78. package/dist/index.js +2 -1
  79. package/dist/provider/antd-provider.jsx +46 -0
  80. package/dist/provider/redux-provider.d.ts +1 -1
  81. package/dist/provider/{redux-provider.js → redux-provider.jsx} +1 -2
  82. package/dist/provider/store-provider.d.ts +1 -1
  83. package/dist/provider/{store-provider.js → store-provider.jsx} +3 -2
  84. package/package.json +1 -1
  85. package/dist/app/new-board/page.js +0 -33
  86. package/dist/app/only-view/page.js +0 -78
  87. package/dist/app/page.js +0 -8
  88. package/dist/app/v2/page.js +0 -8
  89. package/dist/components/button-tools/index.js +0 -11
  90. package/dist/components/form-tools/label.js +0 -7
  91. package/dist/components/form-tools/shape.js +0 -25
  92. package/dist/components/layer/index.js +0 -295
  93. package/dist/components/layer-v2/index.js +0 -282
  94. package/dist/components/modal-preview/index.js +0 -10
  95. package/dist/features/navbar/index.js +0 -6
  96. package/dist/features/panel/selected-group.js +0 -7
  97. package/dist/features/panel/table-seat-circle.js +0 -9
  98. package/dist/features/panel/table-seat-square.js +0 -9
  99. package/dist/features/panel/text-tool.js +0 -7
  100. package/dist/provider/antd-provider.js +0 -43
@@ -1,282 +0,0 @@
1
- "use client";
2
- import { createElement as _createElement } from "react";
3
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
- import { useRef } from "react";
5
- import { omit } from "lodash";
6
- const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode = "edit", style,
7
- // onTouchEnd,
8
- // onTouchMove,
9
- onTouchStart }) => {
10
- const refItemTemp = useRef(null);
11
- const handleOnHover = (item) => {
12
- if (mode === "edit") {
13
- refItemTemp.current = item;
14
- }
15
- };
16
- const renderShadowShape = (item) => {
17
- const { id, x, y, width, height, fill, opacity, rotation, shape, fontColor, text, seatFill, labels, } = item;
18
- const commonProps = { fill, opacity };
19
- switch (shape) {
20
- case "square":
21
- return (_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height }, commonProps), id));
22
- case "circle":
23
- return (_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2 }, commonProps), id));
24
- case "diamond":
25
- return (_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, transform: `rotate(${rotation}, ${x}, ${y})` }, commonProps), id));
26
- case "table-seat-circle": {
27
- const seatCount = item.seatCount;
28
- const openSpace = item.openSpace; // nilai antara 0 (tidak ada ruang) sampai maksimal ~0.9
29
- const centerX = x + width / 2;
30
- const centerY = y + height / 2;
31
- const radius = width;
32
- const seatRadius = width / 4;
33
- const fullAngle = 2 * Math.PI;
34
- const availableAngle = fullAngle * (1 - openSpace); // sudut yang dipakai untuk kursi
35
- const angleStart = (fullAngle - availableAngle) / 2; // agar tetap seimbang
36
- const angleStep = availableAngle / seatCount;
37
- const seatCircles = Array.from({ length: seatCount }, (_, i) => {
38
- const angle = angleStart + i * angleStep;
39
- const cx = centerX + radius * Math.cos(angle);
40
- const cy = centerY + radius * Math.sin(angle);
41
- return { cx, cy };
42
- });
43
- return (_jsxs("g", { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: width - 15 }, commonProps, { opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity })), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
44
- var _a, _b, _c, _d;
45
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
46
- }), _jsx("g", { fill: "#e6b9c0", opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity, stroke: "#c49ba3", strokeWidth: "1", children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill }, `${id}-seat-${i}`))) }, `${id}-seats`)] }, id));
47
- }
48
- case "table-seat-square": {
49
- const seatCount = item.seatCount || 6;
50
- const openSpace = item.openSpace || 0; // from 0 to 0.9
51
- const seatRadius = width / 6;
52
- // split seats evenly on top and bottom
53
- const seatCountPerSide = Math.ceil(seatCount / 2);
54
- const availableWidth = width * (1 - openSpace);
55
- const startX = x + (width * openSpace) / 2;
56
- const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
57
- const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
58
- cx: startX + i * spacing,
59
- cy: y - seatRadius * 1.5,
60
- }));
61
- const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
62
- (_, i) => ({
63
- cx: startX + i * spacing,
64
- cy: y + height + seatRadius * 1.5,
65
- }));
66
- return (_jsxs("g", { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height }, commonProps)), _jsx("g", { fill: "#e6b9c0", fillOpacity: "0.5", stroke: "#c49ba3", strokeWidth: "1", children: [...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius }, `${id}-seat-${i}`))) }, `${id}-seats`)] }, id));
67
- }
68
- case "text":
69
- return (_jsxs("g", { onClick: () => {
70
- onClick && onClick(item);
71
- }, children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity }), _jsx("text", { x: x + width / 2, y: y + height / 2, textAnchor: "middle", dominantBaseline: "middle", fill: fontColor, fontSize: height * 0.6, opacity: opacity, children: text })] }, id));
72
- case "ruler":
73
- return (_jsxs("g", { children: [_jsx("rect", { x: x - (window.innerWidth * 3) / 2, y: y, width: window.innerWidth * 3, height: 1, fill: "black" }), _jsx("rect", { x: x, y: y - (window.innerHeight * 3) / 2, width: 1, height: window.innerHeight * 3, fill: "black" })] }, id));
74
- default:
75
- return null;
76
- }
77
- };
78
- const renderShape = (item) => {
79
- const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, } = item;
80
- const commonProps = {
81
- fill,
82
- opacity,
83
- stroke,
84
- strokeWidth,
85
- onMouseDown: (e) => {
86
- onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e, item || refItemTemp.current);
87
- },
88
- onMouseEnter: (e) => {
89
- // e.stopPropagation();
90
- handleOnHover === null || handleOnHover === void 0 ? void 0 : handleOnHover(item);
91
- },
92
- onClick: (e) => {
93
- // e.stopPropagation();
94
- onClick === null || onClick === void 0 ? void 0 : onClick(item);
95
- },
96
- onMouseUp: (e) => {
97
- // e.stopPropagation();
98
- onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(e);
99
- },
100
- onBlur: (e) => {
101
- // e.stopPropagation();
102
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
103
- },
104
- // onTouchMove: (
105
- // e: React.TouchEvent<
106
- // SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
107
- // >
108
- // ) => {
109
- // // e.stopPropagation();
110
- // onTouchMove?.(e);
111
- // },
112
- onTouchStart: (e) => {
113
- // e.stopPropagation();
114
- onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e, item);
115
- },
116
- // onTouchEnd: (
117
- // e: React.TouchEvent<
118
- // SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
119
- // >
120
- // ) => {
121
- // // e.stopPropagation();
122
- // onTouchEnd?.(e);
123
- // },
124
- onDoubleClick: (e) => {
125
- // e.stopPropagation();
126
- onClick === null || onClick === void 0 ? void 0 : onClick(item);
127
- },
128
- };
129
- switch (shape) {
130
- case "square":
131
- return (_jsxs("g", { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity"), { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})` }), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
132
- var _a, _b, _c, _d;
133
- return (_createElement("text", Object.assign({}, omit(commonProps, ["opacity", "stroke", "strokeWidth"]), { key: `${id}-label-${index}`, x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
134
- e.stopPropagation();
135
- onClick && onClick(item);
136
- } }), _ === null || _ === void 0 ? void 0 : _.label));
137
- })] }, id));
138
- case "circle":
139
- return (_jsxs("g", { children: [_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity")), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
140
- var _a, _b, _c, _d;
141
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
142
- e.stopPropagation();
143
- onClick && onClick(item);
144
- }, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
145
- })] }, id));
146
- case "diamond":
147
- return (_jsxs("g", { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), transform: `rotate(${rotation}, ${x}, ${y})` }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }), id), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label })] }, id));
148
- case "table-seat-circle": {
149
- const seatCount = item.seatCount;
150
- const openSpace = item.openSpace; // nilai antara 0 (tidak ada ruang) sampai maksimal ~0.9
151
- const centerX = x + width / 2;
152
- const centerY = y + height / 2;
153
- const radius = width;
154
- const seatRadius = width / 4;
155
- const fullAngle = 2 * Math.PI;
156
- const availableAngle = fullAngle * (1 - openSpace); // sudut yang dipakai untuk kursi
157
- const angleStart = (fullAngle - availableAngle) / 2; // agar tetap seimbang
158
- const angleStep = availableAngle / seatCount;
159
- const seatCircles = Array.from({ length: seatCount }, (_, i) => {
160
- const angle = angleStart + i * angleStep;
161
- const cx = centerX + radius * Math.cos(angle);
162
- const cy = centerY + radius * Math.sin(angle);
163
- return { cx, cy };
164
- });
165
- return (_jsxs("g", { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: [_jsx("circle", Object.assign({ cx: centerX, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), cy: centerY, r: width - 15, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, commonProps, { opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity })), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
166
- var _a, _b, _c, _d;
167
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
168
- e.stopPropagation();
169
- onClick && onClick(item);
170
- }, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
171
- }), _jsx("g", { fill: "#e6b9c0", opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity, stroke: "#c49ba3", strokeWidth: "1", children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill }, `${id}-seat-${i}`))) }, `${id}-seats`)] }, id));
172
- }
173
- case "table-seat-square": {
174
- const seatCount = item.seatCount || 6;
175
- const openSpace = item.openSpace || 0; // from 0 to 0.9
176
- const seatRadius = width / 6;
177
- // split seats evenly on top and bottom
178
- const seatCountPerSide = Math.ceil(seatCount / 2);
179
- const availableWidth = width * (1 - openSpace);
180
- const startX = x + (width * openSpace) / 2;
181
- const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
182
- const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
183
- cx: startX + i * spacing,
184
- cy: y - seatRadius * 1.5,
185
- }));
186
- const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
187
- (_, i) => ({
188
- cx: startX + i * spacing,
189
- cy: y + height + seatRadius * 1.5,
190
- }));
191
- return (_jsxs("g", { transform: `rotate(${rotation}, ${x}, ${y})`, children: [_jsx("rect", Object.assign({ x: x, y: y, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill })), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label }), _jsx("g", { fill: "#e6b9c0", fillOpacity: "0.5", stroke: "#c49ba3", strokeWidth: "1", children: [...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius }, `${id}-seat-${i}`))) }, `${id}-seats`)] }, id));
192
- }
193
- case "text":
194
- return (_jsxs("g", { children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity, onClick: (e) => {
195
- e.stopPropagation();
196
- onClick && onClick(item);
197
- } }), _jsx("text", Object.assign({ x: x + width / 2, y: y + height / 2, textAnchor: "middle", dominantBaseline: "middle", fill: fontColor, fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : height * 0.6, opacity: opacity }, omit(commonProps, ["fill", "opacity"]), { children: text }))] }, id));
198
- case "image-table":
199
- case "background":
200
- return (_jsxs("g", { onClick: () => {
201
- onClick && onClick(item);
202
- }, children: [_jsx("image", Object.assign({ href: src, x: x, y: y, width: width, height: height, transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})` }, commonProps)), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
203
- var _a, _b, _c, _d;
204
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: _ === null || _ === void 0 ? void 0 : _.label }, index));
205
- })] }, id));
206
- default:
207
- return _jsx("g", {}, id);
208
- }
209
- };
210
- let date = new Date();
211
- return (_jsxs("g", { children: [components === null || components === void 0 ? void 0 : components.map(renderShape), shadowShape === null || shadowShape === void 0 ? void 0 : shadowShape.map(renderShadowShape), selectedComponent && activeTool === "select" && (_jsxs(_Fragment, { children: [[
212
- "square",
213
- "circle",
214
- "diamond",
215
- "text",
216
- "background",
217
- "image-table",
218
- ].includes(selectedComponent.shape) && (_jsxs("g", { children: [_jsx("rect", { x: selectedComponent.x - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2",
219
- // transform={`scale(${selectedComponent.scale})`}
220
- onMouseDown: (e) => {
221
- e.stopPropagation();
222
- onMouseDown(e, selectedComponent, "top-left");
223
- }, onTouchStart: (e) => {
224
- e.stopPropagation();
225
- onTouchStart(e, selectedComponent, "top-left");
226
- } }), _jsx("rect", { x: selectedComponent.x + (selectedComponent.width - 15) / 2, y: selectedComponent.y - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
227
- e.stopPropagation();
228
- onMouseDown(e, selectedComponent, "top-center");
229
- }, onTouchStart: (e) => {
230
- e.stopPropagation();
231
- onTouchStart(e, selectedComponent, "top-center");
232
- } }), _jsx("rect", { x: selectedComponent.x - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y + (selectedComponent.height - 15) / 2, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
233
- e.stopPropagation();
234
- onMouseDown(e, selectedComponent, "left-center");
235
- }, onTouchStart: (e) => {
236
- e.stopPropagation();
237
- onTouchStart(e, selectedComponent, "left-center");
238
- } }), _jsx("rect", { x: selectedComponent.x + selectedComponent.width + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
239
- e.stopPropagation();
240
- onMouseDown(e, selectedComponent, "top-right");
241
- }, onTouchStart: (e) => {
242
- e.stopPropagation();
243
- onTouchStart(e, selectedComponent, "top-right");
244
- } }), _jsx("rect", { x: selectedComponent.x + selectedComponent.width + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y + selectedComponent.height + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
245
- e.stopPropagation();
246
- onMouseDown(e, selectedComponent, "bottom-right");
247
- }, onTouchStart: (e) => {
248
- e.stopPropagation();
249
- onTouchStart(e, selectedComponent, "bottom-right");
250
- } }), _jsx("rect", { x: selectedComponent.x + (selectedComponent.width - 15) / 2, y: selectedComponent.y + selectedComponent.height + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
251
- e.stopPropagation();
252
- onMouseDown(e, selectedComponent, "bottom-center");
253
- }, onTouchStart: (e) => {
254
- e.stopPropagation();
255
- onTouchStart(e, selectedComponent, "bottom-center");
256
- } }), _jsx("rect", { x: selectedComponent.x + selectedComponent.width + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y + (selectedComponent.height - 15) / 2, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
257
- e.stopPropagation();
258
- onMouseDown(e, selectedComponent, "right-center");
259
- }, onTouchStart: (e) => {
260
- e.stopPropagation();
261
- onTouchStart(e, selectedComponent, "right-center");
262
- } }), _jsx("rect", { x: selectedComponent.x - 25 - ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), y: selectedComponent.y + selectedComponent.height + 5 + ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.strokeWidth) || 0), width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", onMouseDown: (e) => {
263
- e.stopPropagation();
264
- onMouseDown(e, selectedComponent, "bottom-left");
265
- }, onTouchStart: (e) => {
266
- e.stopPropagation();
267
- onTouchStart(e, selectedComponent, "bottom-left");
268
- } })] }, `${selectedComponent.id}-selection`)), ["table-seat-circle", "table-seat-square"].includes(selectedComponent.shape) && (_jsxs("g", { children: [_jsx("rect", { x: selectedComponent.x - selectedComponent.width, y: selectedComponent.y - selectedComponent.height, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", transform: `scale(${selectedComponent.scale})`, onMouseDown: (e) => {
269
- e.stopPropagation();
270
- onMouseDown(e, selectedComponent, "top-left");
271
- } }), _jsx("rect", { x: selectedComponent.x + selectedComponent.width * 2 - 10, y: selectedComponent.y - selectedComponent.height, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", transform: `scale(${selectedComponent.scale})`, onMouseDown: (e) => {
272
- e.stopPropagation();
273
- onMouseDown(e, selectedComponent, "top-right");
274
- } }), _jsx("rect", { x: selectedComponent.x + selectedComponent.width * 2 - 10, y: selectedComponent.y + selectedComponent.height * 2, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", transform: `scale(${selectedComponent.scale})`, onMouseDown: (e) => {
275
- e.stopPropagation();
276
- onMouseDown(e, selectedComponent, "bottom-right");
277
- } }), _jsx("rect", { x: selectedComponent.x - selectedComponent.width, y: selectedComponent.y + selectedComponent.height * 2, width: 20, height: 20, fill: "black", stroke: "white", strokeWidth: "2", transform: `scale(${selectedComponent.scale})`, onMouseDown: (e) => {
278
- e.stopPropagation();
279
- onMouseDown(e, selectedComponent, "b-left");
280
- } })] }, selectedComponent.id))] }))] }, `${date}`));
281
- };
282
- export default Layers;
@@ -1,10 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Modal } from "antd";
4
- import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
5
- const ModalPreview = ({ children }) => {
6
- const { isPreview } = useAppSelector((state) => state.tool);
7
- const dispatch = useAppDispatch();
8
- return (_jsx(Modal, { open: isPreview, onCancel: () => dispatch({ type: "tool/setTooglePreview", payload: false }), width: 700, title: "Preview Board", centered: true, footer: null, children: _jsx("div", { className: "flex flex-col p-4 h-[500px]", children: children }) }));
9
- };
10
- export default ModalPreview;
@@ -1,6 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- const Navbar = () => {
4
- return _jsx("div", { children: "Navbar" });
5
- };
6
- export default Navbar;
@@ -1,7 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { ColorPicker, Flex, Form, InputNumber } from "antd";
4
- const SelectedGroup = () => {
5
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Group Selection" }), _jsxs("div", { className: "py-2", children: [_jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Form.Item, { label: "Width", name: "width", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Position X", name: "x", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Position Y", name: "y", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Rotation", name: "rotation", className: "w-full", children: _jsx(InputNumber, { max: 360, min: 0 }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke", name: "stroke", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { children: [_jsx(Form.Item, { label: "Stroke Width", name: "strokeWidth", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "opacity", name: "opacity", className: "w-full", children: _jsx(InputNumber, { step: 0.1, max: 1, min: 0 }) })] })] })] }) }));
6
- };
7
- export default SelectedGroup;
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { ColorPicker, Flex, Form, InputNumber } from "antd";
4
- import SectionLabel from "../../components/form-tools/label";
5
- import SectionShape from "../../components/form-tools/shape";
6
- const SeatCircle = () => {
7
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Round table" }), _jsxs(Flex, { children: [_jsx(Form.Item, { name: "seatCount", label: "Seat Count", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 1, min: 0, step: 0.1 }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Seat Fill", name: "seatFill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Table Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsx(SectionShape, {}), _jsx(SectionLabel, {})] }) }));
8
- };
9
- export default SeatCircle;
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Col, ColorPicker, Flex, Form, InputNumber, Row, } from "antd";
4
- import SectionLabel from "../../components/form-tools/label";
5
- import SectionShape from "../../components/form-tools/shape";
6
- const SeatSquare = () => {
7
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Square table" }), _jsx(Flex, { className: "w-full", children: _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 1, min: 0, step: 0.1 }) }) }), _jsxs(Row, { gutter: [16, 16], children: [_jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "top"], label: "Top", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) }), _jsx(Form.Item, { name: ["seatPositions", "left"], label: "Left", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) })] }), _jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "right"], label: "Right", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) }), _jsx(Form.Item, { name: ["seatPositions", "bottom"], label: "Bottom", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) })] })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Seat Fill", name: "seatFill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Table Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsx(SectionShape, {}), _jsx(SectionLabel, {})] }) }));
8
- };
9
- export default SeatSquare;
@@ -1,7 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ColorPicker, Form, Input, InputNumber } from "antd";
4
- const TextTool = () => {
5
- return (_jsxs("div", { className: "py-2", children: [_jsx(Form.Item, { label: "Name", name: "shape", className: "w-full hidden", children: _jsx(Input, { defaultValue: "text" }) }), _jsx(Form.Item, { name: "text", label: "Text", children: _jsx(Input, {}) }), _jsx(Form.Item, { name: "fontColor", label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { name: "x", label: "X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: "y", label: "Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: "fontSize", label: "Size", children: _jsx(InputNumber, { suffix: "px" }) })] }));
6
- };
7
- export default TextTool;
@@ -1,43 +0,0 @@
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
- };