seat-editor 2.1.0 → 2.1.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.
- package/dist/app/layout.d.ts +1 -1
- package/dist/app/{layout.jsx → layout.js} +2 -7
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/new-board/page.js +34 -0
- package/dist/app/old-board/page.d.ts +1 -2
- package/dist/app/old-board/{page.jsx → page.js} +82 -215
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/{page.jsx → page.js} +2 -1
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.js +8 -0
- package/dist/app/test/page.d.ts +1 -2
- package/dist/app/test/{page.jsx → page.js} +3 -5
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/app/v2/page.js +8 -0
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/button-tools/index.js +11 -0
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/label.js +7 -0
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/form-tools/shape.js +25 -0
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/input/{number-indicator.jsx → number-indicator.js} +2 -11
- package/dist/components/joystick/index.d.ts +1 -2
- package/dist/components/joystick/{index.jsx → index.js} +13 -14
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer/index.js +295 -0
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v2/index.js +282 -0
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v3/index.js +337 -0
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/lib/{index.jsx → index.js} +2 -7
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/components/modal-preview/index.js +10 -0
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board/{index.jsx → index.js} +31 -90
- package/dist/features/board-v2/index.d.ts +1 -2
- package/dist/features/board-v2/{index.jsx → index.js} +39 -101
- package/dist/features/board-v3/index.d.ts +1 -2
- package/dist/features/board-v3/{index.jsx → index.js} +42 -120
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/navbar/index.js +6 -0
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/package/{index.jsx → index.js} +6 -16
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/{index.jsx → index.js} +8 -16
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/{select-tool.jsx → select-tool.js} +8 -20
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/{square-circle-tool.jsx → square-circle-tool.js} +2 -4
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.js +9 -0
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/text-tool.js +7 -0
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/{upload-tool.jsx → upload-tool.js} +2 -24
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/side-tool/{index.jsx → index.js} +98 -120
- package/dist/features/view/index.d.ts +1 -1
- package/dist/features/view/{index.jsx → index.js} +31 -38
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only/{index.jsx → index.js} +31 -38
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-2/{index.jsx → index.js} +13 -16
- package/dist/provider/antd-provider.js +43 -0
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/{redux-provider.jsx → redux-provider.js} +2 -1
- package/dist/provider/store-provider.d.ts +1 -1
- package/dist/provider/{store-provider.jsx → store-provider.js} +2 -3
- package/dist/seat-editor.css +1 -1
- package/package.json +1 -1
- package/dist/app/new-board/page.jsx +0 -56
- package/dist/app/page.jsx +0 -13
- package/dist/app/v2/page.jsx +0 -13
- package/dist/components/button-tools/index.jsx +0 -17
- package/dist/components/form-tools/label.jsx +0 -44
- package/dist/components/form-tools/shape.jsx +0 -66
- package/dist/components/layer/index.jsx +0 -383
- package/dist/components/layer-v2/index.jsx +0 -370
- package/dist/components/layer-v3/index.jsx +0 -418
- package/dist/components/modal-preview/index.jsx +0 -11
- package/dist/features/navbar/index.jsx +0 -5
- package/dist/features/panel/table-seat-circle.jsx +0 -31
- package/dist/features/panel/text-tool.jsx +0 -26
- package/dist/provider/antd-provider.jsx +0 -46
|
@@ -0,0 +1,337 @@
|
|
|
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 { isArray, isEmpty, omit } from "lodash";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode = "edit", style,
|
|
8
|
+
// onTouchEnd,
|
|
9
|
+
// onTouchMove,
|
|
10
|
+
onTouchStart, }) => {
|
|
11
|
+
const refItemTemp = useRef(null);
|
|
12
|
+
const handleOnHover = (item) => {
|
|
13
|
+
if (mode === "edit") {
|
|
14
|
+
refItemTemp.current = item;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function rectToPolygonPoints(x, y, width, height) {
|
|
18
|
+
const topLeft = [x, y];
|
|
19
|
+
const topRight = [x + width, y];
|
|
20
|
+
const bottomRight = [x + width, y + height];
|
|
21
|
+
const bottomLeft = [x, y + height];
|
|
22
|
+
const points = [topLeft, topRight, bottomRight, bottomLeft]
|
|
23
|
+
.map((point) => point.join(","))
|
|
24
|
+
.join(" ");
|
|
25
|
+
return points;
|
|
26
|
+
}
|
|
27
|
+
function rectToPolygonNodes(x, y, width, height) {
|
|
28
|
+
const points = [
|
|
29
|
+
{ x: x, y: y },
|
|
30
|
+
{ x: x + width, y: y },
|
|
31
|
+
{ x: x + width, y: y + height },
|
|
32
|
+
{ x: x, y: y + height },
|
|
33
|
+
];
|
|
34
|
+
return points;
|
|
35
|
+
}
|
|
36
|
+
const renderShadowShape = (item) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const { id, x, y, width, height, fill, opacity, rotation, shape, fontColor, text, seatFill, labels, points, } = item;
|
|
39
|
+
const commonProps = { fill, opacity };
|
|
40
|
+
switch (shape) {
|
|
41
|
+
case "square":
|
|
42
|
+
case "polygon":
|
|
43
|
+
const pointsFormat = !isEmpty(points)
|
|
44
|
+
? points
|
|
45
|
+
: rectToPolygonPoints(x, y, width, height);
|
|
46
|
+
return _jsx("polygon", Object.assign({ points: pointsFormat }, commonProps), id);
|
|
47
|
+
case "circle":
|
|
48
|
+
return (_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2 }, commonProps), id));
|
|
49
|
+
case "diamond":
|
|
50
|
+
return (_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, transform: `rotate(${rotation}, ${x}, ${y})` }, commonProps), id));
|
|
51
|
+
case "table-seat-circle": {
|
|
52
|
+
const seatCount = item.seatCount;
|
|
53
|
+
const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
|
|
54
|
+
const centerX = x + width / 2;
|
|
55
|
+
const centerY = y + height / 2;
|
|
56
|
+
const baseSize = Math.min(width, height);
|
|
57
|
+
const radius = baseSize / 2; // jarak kursi dari pusat
|
|
58
|
+
const seatRadius = baseSize / 6; // ukuran kursi
|
|
59
|
+
const fullAngle = 2 * Math.PI;
|
|
60
|
+
const availableAngle = fullAngle * (1 - openSpace);
|
|
61
|
+
const angleStart = (fullAngle - availableAngle) / 2;
|
|
62
|
+
const angleStep = availableAngle / seatCount;
|
|
63
|
+
const seatInsetFactor = 0.3;
|
|
64
|
+
const seatCircles = Array.from({ length: seatCount }, (_, i) => {
|
|
65
|
+
const angle = angleStart + i * angleStep;
|
|
66
|
+
const inset = seatRadius * seatInsetFactor; // default 0.3
|
|
67
|
+
const cx = centerX + (radius - inset) * Math.cos(angle);
|
|
68
|
+
const cy = centerY + (radius - inset) * Math.sin(angle);
|
|
69
|
+
return { cx, cy };
|
|
70
|
+
});
|
|
71
|
+
return (_jsxs("g", { transform: `rotate(${rotation} ${centerX} ${centerY})`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: radius - 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) => {
|
|
72
|
+
var _a, _b, _c, _d;
|
|
73
|
+
return (_jsx("text", { x: centerX + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: centerY + ((_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} ${centerX} ${centerY})`, onClick: (e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
onClick && onClick(item);
|
|
76
|
+
}, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
|
|
77
|
+
}), _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));
|
|
78
|
+
}
|
|
79
|
+
case "table-seat-square": {
|
|
80
|
+
const seatCount = item.seatCount || 6;
|
|
81
|
+
const openSpace = item.openSpace || 0; // from 0 to 0.9
|
|
82
|
+
const seatRadius = width / 6;
|
|
83
|
+
// split seats evenly on top and bottom
|
|
84
|
+
const seatCountPerSide = Math.ceil(seatCount / 2);
|
|
85
|
+
const availableWidth = width * (1 - openSpace);
|
|
86
|
+
const startX = x + (width * openSpace) / 2;
|
|
87
|
+
const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
|
|
88
|
+
const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
|
|
89
|
+
cx: startX + i * spacing,
|
|
90
|
+
cy: y - seatRadius * 1.5,
|
|
91
|
+
}));
|
|
92
|
+
const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
|
|
93
|
+
(_, i) => ({
|
|
94
|
+
cx: startX + i * spacing,
|
|
95
|
+
cy: y + height + seatRadius * 1.5,
|
|
96
|
+
}));
|
|
97
|
+
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));
|
|
98
|
+
}
|
|
99
|
+
case "text":
|
|
100
|
+
return (_jsxs("g", { onClick: () => {
|
|
101
|
+
onClick && onClick(item);
|
|
102
|
+
}, 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));
|
|
103
|
+
case "ruler":
|
|
104
|
+
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));
|
|
105
|
+
default:
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const renderShape = (item) => {
|
|
110
|
+
var _a;
|
|
111
|
+
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, points, } = item;
|
|
112
|
+
const commonProps = {
|
|
113
|
+
fill,
|
|
114
|
+
opacity,
|
|
115
|
+
stroke,
|
|
116
|
+
strokeWidth,
|
|
117
|
+
onMouseDown: (e) => {
|
|
118
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e, item || refItemTemp.current);
|
|
119
|
+
},
|
|
120
|
+
onMouseEnter: (e) => {
|
|
121
|
+
// e.stopPropagation();
|
|
122
|
+
handleOnHover === null || handleOnHover === void 0 ? void 0 : handleOnHover(item);
|
|
123
|
+
},
|
|
124
|
+
onClick: (e) => {
|
|
125
|
+
// e.stopPropagation();
|
|
126
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
127
|
+
},
|
|
128
|
+
onMouseUp: (e) => {
|
|
129
|
+
// e.stopPropagation();
|
|
130
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(e);
|
|
131
|
+
},
|
|
132
|
+
onBlur: (e) => {
|
|
133
|
+
// e.stopPropagation();
|
|
134
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
135
|
+
},
|
|
136
|
+
// onTouchMove: (
|
|
137
|
+
// e: React.TouchEvent<
|
|
138
|
+
// SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
|
|
139
|
+
// >
|
|
140
|
+
// ) => {
|
|
141
|
+
// // e.stopPropagation();
|
|
142
|
+
// onTouchMove?.(e);
|
|
143
|
+
// },
|
|
144
|
+
onTouchStart: (e) => {
|
|
145
|
+
// e.stopPropagation();
|
|
146
|
+
onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e, item);
|
|
147
|
+
},
|
|
148
|
+
// onTouchEnd: (
|
|
149
|
+
// e: React.TouchEvent<
|
|
150
|
+
// SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
|
|
151
|
+
// >
|
|
152
|
+
// ) => {
|
|
153
|
+
// // e.stopPropagation();
|
|
154
|
+
// onTouchEnd?.(e);
|
|
155
|
+
// },
|
|
156
|
+
onDoubleClick: (e) => {
|
|
157
|
+
// e.stopPropagation();
|
|
158
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
switch (shape) {
|
|
162
|
+
case "square":
|
|
163
|
+
case "polygon":
|
|
164
|
+
const pointsFormat = !isEmpty(points)
|
|
165
|
+
? points
|
|
166
|
+
: rectToPolygonPoints(x, y, width, height);
|
|
167
|
+
return (_jsx("g", { children: _createElement("polygon", Object.assign({}, commonProps, { key: id, points: pointsFormat })) }, id));
|
|
168
|
+
// return (
|
|
169
|
+
// <g key={id}>
|
|
170
|
+
// <rect
|
|
171
|
+
// key={id}
|
|
172
|
+
// x={x}
|
|
173
|
+
// y={y}
|
|
174
|
+
// width={width}
|
|
175
|
+
// height={height}
|
|
176
|
+
// fill={selectedTableColor ?? fill}
|
|
177
|
+
// style={{
|
|
178
|
+
// cursor: mode === "view" ? "pointer" : "default",
|
|
179
|
+
// ...style,
|
|
180
|
+
// }}
|
|
181
|
+
// opacity={id === selectedComponent?.id ? 0.5 : opacity}
|
|
182
|
+
// {...omit(commonProps, "opacity")}
|
|
183
|
+
// transform={`rotate(${rotation} ${x + width / 2} ${
|
|
184
|
+
// y + height / 2
|
|
185
|
+
// })`}
|
|
186
|
+
// />
|
|
187
|
+
// {labels?.map((_: any, index: number) => {
|
|
188
|
+
// return (
|
|
189
|
+
// <text
|
|
190
|
+
// {...omit(commonProps, ["opacity", "stroke", "strokeWidth"])}
|
|
191
|
+
// key={`${id}-label-${index}`}
|
|
192
|
+
// x={x + width / 2 + (_?.x ?? 0)}
|
|
193
|
+
// y={y + height / 2 + (_?.y ?? 0)}
|
|
194
|
+
// fill={_?.fontColor ?? "black"}
|
|
195
|
+
// fontSize={`${_?.fontSize ?? 10}px`}
|
|
196
|
+
// fontWeight="bold"
|
|
197
|
+
// textAnchor="middle"
|
|
198
|
+
// dominantBaseline="middle"
|
|
199
|
+
// transform={`rotate(${rotation} ${x + width / 2} ${
|
|
200
|
+
// y + height / 2
|
|
201
|
+
// })`}
|
|
202
|
+
// onClick={(e) => {
|
|
203
|
+
// e.stopPropagation();
|
|
204
|
+
// onClick&& onClick(item);
|
|
205
|
+
// }}
|
|
206
|
+
// >
|
|
207
|
+
// {_?.label}
|
|
208
|
+
// </text>
|
|
209
|
+
// );
|
|
210
|
+
// })}
|
|
211
|
+
// </g>
|
|
212
|
+
// );
|
|
213
|
+
case "circle":
|
|
214
|
+
return (_jsxs("g", { children: [_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: Math.min(width, height) / 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) => {
|
|
215
|
+
var _a, _b, _c, _d;
|
|
216
|
+
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) => {
|
|
217
|
+
e.stopPropagation();
|
|
218
|
+
onClick && onClick(item);
|
|
219
|
+
}, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
|
|
220
|
+
})] }, id));
|
|
221
|
+
case "diamond":
|
|
222
|
+
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));
|
|
223
|
+
case "table-seat-circle": {
|
|
224
|
+
const seatCount = item.seatCount;
|
|
225
|
+
const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
|
|
226
|
+
const centerX = x + width / 2;
|
|
227
|
+
const centerY = y + height / 2;
|
|
228
|
+
const baseSize = Math.min(width, height);
|
|
229
|
+
const radius = baseSize / 2; // jarak kursi dari pusat
|
|
230
|
+
const seatRadius = baseSize / 6; // ukuran kursi
|
|
231
|
+
const fullAngle = 2 * Math.PI;
|
|
232
|
+
const availableAngle = fullAngle * (1 - openSpace);
|
|
233
|
+
const angleStart = (fullAngle - availableAngle) / 2;
|
|
234
|
+
const angleStep = availableAngle / seatCount;
|
|
235
|
+
const seatInsetFactor = 0.3;
|
|
236
|
+
const seatCircles = Array.from({ length: seatCount }, (_, i) => {
|
|
237
|
+
const angle = angleStart + i * angleStep;
|
|
238
|
+
const inset = seatRadius * seatInsetFactor; // default 0.3
|
|
239
|
+
const cx = centerX + (radius - inset) * Math.cos(angle);
|
|
240
|
+
const cy = centerY + (radius - inset) * Math.sin(angle);
|
|
241
|
+
return { cx, cy };
|
|
242
|
+
});
|
|
243
|
+
return (_jsxs("g", { transform: `rotate(${rotation} ${centerX} ${centerY})`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: radius - 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) => {
|
|
244
|
+
var _a, _b, _c, _d;
|
|
245
|
+
return (_jsx("text", { x: centerX + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: centerY + ((_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} ${centerX} ${centerY})`, onClick: (e) => {
|
|
246
|
+
e.stopPropagation();
|
|
247
|
+
onClick && onClick(item);
|
|
248
|
+
}, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
|
|
249
|
+
}), _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));
|
|
250
|
+
}
|
|
251
|
+
case "table-seat-square": {
|
|
252
|
+
const seatCount = item.seatCount || 6;
|
|
253
|
+
const openSpace = item.openSpace || 0; // from 0 to 0.9
|
|
254
|
+
const seatRadius = width / 6;
|
|
255
|
+
// split seats evenly on top and bottom
|
|
256
|
+
const seatCountPerSide = Math.ceil(seatCount / 2);
|
|
257
|
+
const availableWidth = width * (1 - openSpace);
|
|
258
|
+
const startX = x + (width * openSpace) / 2;
|
|
259
|
+
const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
|
|
260
|
+
const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
|
|
261
|
+
cx: startX + i * spacing,
|
|
262
|
+
cy: y - seatRadius * 1.5,
|
|
263
|
+
}));
|
|
264
|
+
const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
|
|
265
|
+
(_, i) => ({
|
|
266
|
+
cx: startX + i * spacing,
|
|
267
|
+
cy: y + height + seatRadius * 1.5,
|
|
268
|
+
}));
|
|
269
|
+
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));
|
|
270
|
+
}
|
|
271
|
+
case "text":
|
|
272
|
+
return (_jsxs("g", { children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity, onClick: (e) => {
|
|
273
|
+
e.stopPropagation();
|
|
274
|
+
onClick && onClick(item);
|
|
275
|
+
} }), _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));
|
|
276
|
+
case "image-table":
|
|
277
|
+
case "background":
|
|
278
|
+
return (_jsxs("g", { onClick: () => {
|
|
279
|
+
onClick && onClick(item);
|
|
280
|
+
}, 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) => {
|
|
281
|
+
var _a, _b, _c, _d;
|
|
282
|
+
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));
|
|
283
|
+
})] }, id));
|
|
284
|
+
default:
|
|
285
|
+
return _jsx("g", {}, id);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
let date = new Date();
|
|
289
|
+
const nodesRaw = !isEmpty(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.nodes) && isArray(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.nodes)
|
|
290
|
+
? selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.nodes
|
|
291
|
+
: rectToPolygonNodes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.width, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.height);
|
|
292
|
+
const polylinePoints = [...nodesRaw, nodesRaw[0]]
|
|
293
|
+
.map((n) => `${n.x},${n.y}`)
|
|
294
|
+
.join(" ");
|
|
295
|
+
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: [nodesRaw.map((p1, index) => {
|
|
296
|
+
const p2 = nodesRaw[(index + 1) % nodesRaw.length]; // sisi berikutnya (wrap ke awal)
|
|
297
|
+
const side = index === 0
|
|
298
|
+
? "top"
|
|
299
|
+
: index === 1
|
|
300
|
+
? "right"
|
|
301
|
+
: index === 2
|
|
302
|
+
? "bottom"
|
|
303
|
+
: "left";
|
|
304
|
+
return (_jsx("polyline", { points: `${p1.x},${p1.y} ${p2.x},${p2.y}`, fill: "none", stroke: "transparent", strokeWidth: 5, className: clsx([
|
|
305
|
+
{
|
|
306
|
+
"cursor-ns-resize": side === "top" || side === "bottom",
|
|
307
|
+
"cursor-ew-resize": side === "left" || side === "right",
|
|
308
|
+
},
|
|
309
|
+
]), onMouseDown: (e) => {
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
if (side === "top" || side === "bottom") {
|
|
312
|
+
onMouseDown(e, selectedComponent, side); // misal "top" / "bottom"
|
|
313
|
+
}
|
|
314
|
+
else if (side === "left" || side === "right") {
|
|
315
|
+
onMouseDown(e, selectedComponent, side);
|
|
316
|
+
}
|
|
317
|
+
} }, index));
|
|
318
|
+
}), nodesRaw === null || nodesRaw === void 0 ? void 0 : nodesRaw.map((node, index) => {
|
|
319
|
+
const corner = index === 0
|
|
320
|
+
? "top-left"
|
|
321
|
+
: index === 1
|
|
322
|
+
? "top-right"
|
|
323
|
+
: index === 2
|
|
324
|
+
? "bottom-right"
|
|
325
|
+
: "bottom-left";
|
|
326
|
+
return (_jsx("rect", { x: node.x - 10, y: node.y - 10, width: 20, height: 20, fill: "transparent", className: clsx([
|
|
327
|
+
{
|
|
328
|
+
"cursor-nwse-resize": corner === "top-left" || corner === "bottom-right",
|
|
329
|
+
"cursor-nesw-resize": corner === "top-right" || corner === "bottom-left",
|
|
330
|
+
},
|
|
331
|
+
]), onMouseDown: (e) => {
|
|
332
|
+
e.stopPropagation();
|
|
333
|
+
onMouseDown(e, selectedComponent, corner);
|
|
334
|
+
} }, index));
|
|
335
|
+
}), _jsx("polyline", { points: polylinePoints, fill: "none", stroke: "blue", strokeWidth: 1 })] }))] }, `${date}`));
|
|
336
|
+
};
|
|
337
|
+
export default Layers;
|
|
@@ -3,6 +3,6 @@ export interface LayerViewProps {
|
|
|
3
3
|
componentProps: any[];
|
|
4
4
|
extraComponentProps: any[];
|
|
5
5
|
}
|
|
6
|
-
declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react").JSX.Element;
|
|
6
|
+
declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default TableEditor;
|
|
8
8
|
export { LayerView };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { useEffect } from "react";
|
|
3
4
|
import Board from "../../features/board";
|
|
4
5
|
import SideTool from "../../features/side-tool";
|
|
@@ -21,13 +22,7 @@ const TableEditor = ({ componentProps = [], extraComponentProps = [], }) => {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
}, [componentProps, extraComponentProps]);
|
|
24
|
-
return (
|
|
25
|
-
<div className="w-full h-screen flex relative">
|
|
26
|
-
<SideTool />
|
|
27
|
-
<Board />
|
|
28
|
-
<ControlPanels />
|
|
29
|
-
</div>
|
|
30
|
-
</>);
|
|
25
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex relative", children: [_jsx(SideTool, {}), _jsx(Board, {}), _jsx(ControlPanels, {})] }) }));
|
|
31
26
|
};
|
|
32
27
|
export default TableEditor;
|
|
33
28
|
export { LayerView };
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -2,5 +2,5 @@ interface BoardTemplateProps {
|
|
|
2
2
|
onSelectComponent?: (items: any) => void;
|
|
3
3
|
mappingKey?: string;
|
|
4
4
|
}
|
|
5
|
-
declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react").JSX.Element;
|
|
5
|
+
declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default BoardTemplate;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
4
|
import { TransformWrapper, TransformComponent, MiniMap, } from "react-zoom-pan-pinch";
|
|
4
5
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
@@ -606,21 +607,15 @@ const BoardTemplate = ({ onSelectComponent }) => {
|
|
|
606
607
|
}
|
|
607
608
|
};
|
|
608
609
|
const renderMiniMap = () => {
|
|
609
|
-
return (
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
// onMouseUp={handleMouseUp}
|
|
619
|
-
// onBlur={handleUnSelectComponent}
|
|
620
|
-
selectedComponent={selectedComponent}/>
|
|
621
|
-
</svg>
|
|
622
|
-
</div>
|
|
623
|
-
</MiniMap>);
|
|
610
|
+
return (_jsx(MiniMap, { width: 250, height: 250, children: _jsx("div", { className: "w-full h-full", children: _jsx("svg", { id: "workspace", width: "100%", height: "100%", viewBox: `0 0 ${widthBoard} ${heightBoard}`, className: "h-screen w-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
|
|
611
|
+
background: "#f5f5f5",
|
|
612
|
+
display: "block",
|
|
613
|
+
}, children: _jsx(Layers, { shadowShape: shadowShape, components: [...extraComponentsState, ...componentsState], activeTool: activeTool,
|
|
614
|
+
// onClick={handleSelectComponent}
|
|
615
|
+
// onMouseDown={handleMouseDown}
|
|
616
|
+
// onMouseUp={handleMouseUp}
|
|
617
|
+
// onBlur={handleUnSelectComponent}
|
|
618
|
+
selectedComponent: selectedComponent }) }) }) }));
|
|
624
619
|
};
|
|
625
620
|
const handelZoomIn = () => {
|
|
626
621
|
var _a;
|
|
@@ -646,80 +641,26 @@ const BoardTemplate = ({ onSelectComponent }) => {
|
|
|
646
641
|
// moveComponent &&
|
|
647
642
|
// isTouching.current &&
|
|
648
643
|
// !resizeDirection
|
|
649
|
-
return (
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
width: "100%",
|
|
671
|
-
height: "100%",
|
|
672
|
-
}}>
|
|
673
|
-
<svg id="workspace" ref={svgRef} width="100%" height="100%" viewBox={`0 0 ${widthBoard} ${heightBoard}`} className="h-screen" onMouseUp={handleMouseUp} onMouseMove={handleMouseMove} onMouseEnter={handleMouseEnter} onClick={(e) => {
|
|
674
|
-
e.stopPropagation();
|
|
675
|
-
handleMouseClick(e);
|
|
676
|
-
}} onMouseLeave={handleMouseLeave} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
677
|
-
background: backgroundColor,
|
|
678
|
-
display: "block",
|
|
679
|
-
cursor: activeTool === "ruler" ? "crosshair" : "auto",
|
|
680
|
-
}}>
|
|
681
|
-
<Layers shadowShape={shadowShape} components={[...extraComponentsState, ...componentsState]} style={{
|
|
682
|
-
cursor: getCursorStyle(),
|
|
683
|
-
}}
|
|
684
|
-
// onClick={handleSelectComponent}
|
|
685
|
-
onMouseDown={handleMouseDown}
|
|
686
|
-
// onMouseUp={handleMouseUp}
|
|
687
|
-
onBlur={handleUnSelectComponent} selectedComponent={selectedComponent} activeTool={activeTool} onTouchStart={(e, item, direction) => handleTouchStart(e, item, direction)} onTouchMove={(e) => handleTouchMove(e)} onTouchEnd={handleTouchEnd}/>
|
|
688
|
-
{activeTool === "ruler" && (<>
|
|
689
|
-
<g id="horizontal-ruler">
|
|
690
|
-
<rect x="0" y="0" width={window.innerWidth} height="30" fill="#e0e0e0"/>
|
|
691
|
-
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
692
|
-
{Array.from({ length: window.innerWidth / 50 }, (_, i) => (<g key={i}>
|
|
693
|
-
<line x1={i * 50} y1="0" x2={i * 50} y2="10"/>
|
|
694
|
-
<text x={i * 50} y="15">
|
|
695
|
-
{i * 50}
|
|
696
|
-
</text>
|
|
697
|
-
</g>))}
|
|
698
|
-
</g>
|
|
699
|
-
</g>
|
|
700
|
-
<g id="vertical-ruler">
|
|
701
|
-
<rect x="0" y="0" width="30" height={window.innerHeight} fill="#e0e0e0"/>
|
|
702
|
-
<g stroke="#888" font-size="10" text-anchor="middle">
|
|
703
|
-
{Array.from({ length: window.innerHeight / 10 }, (_, i) => (<g key={i}>
|
|
704
|
-
<line x1="0" y1={i * 50} x2="10" y2={i * 50}/>
|
|
705
|
-
<text x="15" y={i * 50}>
|
|
706
|
-
{i * 50}
|
|
707
|
-
</text>
|
|
708
|
-
</g>))}
|
|
709
|
-
</g>
|
|
710
|
-
</g>
|
|
711
|
-
</>)}
|
|
712
|
-
{grid && (<g stroke="#ddd" strokeWidth={0.5}>
|
|
713
|
-
{/* Vertical lines */}
|
|
714
|
-
{Array.from({ length: widthBoard / 10 }, (_, i) => (<line key={`v-${i}`} x1={i * 10} y1={0} x2={i * 10} y2={heightBoard}/>))}
|
|
715
|
-
|
|
716
|
-
{/* Horizontal lines */}
|
|
717
|
-
{Array.from({ length: heightBoard / 10 }, (_, i) => (<line key={`h-${i}`} x1={0} y1={i * 10} x2={widthBoard} y2={i * 10}/>))}
|
|
718
|
-
</g>)}
|
|
719
|
-
</svg>
|
|
720
|
-
</TransformComponent>
|
|
721
|
-
</TransformWrapper>
|
|
722
|
-
</div>
|
|
723
|
-
</>);
|
|
644
|
+
return (_jsxs(_Fragment, { children: [_jsx(ModalPreview, { children: _jsx(LayerView, { statusKey: "status" }) }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden", ref: containerRef, children: [_jsx("div", { className: "absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10", children: _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { icon: _jsx(ZoomIn, {}), onClick: handelZoomIn }), _jsx(Button, { icon: _jsx(ZoomOut, {}), onClick: handleZoomOut })] }) }), _jsxs(TransformWrapper, { ref: transformRef, panning: { disabled: activeTool === "select" }, centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, pinch: { step: 1 }, smooth: true, doubleClick: { step: 1, disabled: activeTool === "select" }, disablePadding: true, children: [scale > 1 && (_jsx("div", { className: "absolute bottom-[60px] left-1/2 transform -translate-x-1/2 z-10", children: renderMiniMap() })), _jsx(TransformComponent, { wrapperStyle: {
|
|
645
|
+
width: "100%",
|
|
646
|
+
height: "100%",
|
|
647
|
+
overflow: "hidden",
|
|
648
|
+
}, contentStyle: {
|
|
649
|
+
width: "100%",
|
|
650
|
+
height: "100%",
|
|
651
|
+
}, children: _jsxs("svg", { id: "workspace", ref: svgRef, width: "100%", height: "100%", viewBox: `0 0 ${widthBoard} ${heightBoard}`, className: "h-screen", onMouseUp: handleMouseUp, onMouseMove: handleMouseMove, onMouseEnter: handleMouseEnter, onClick: (e) => {
|
|
652
|
+
e.stopPropagation();
|
|
653
|
+
handleMouseClick(e);
|
|
654
|
+
}, onMouseLeave: handleMouseLeave, xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
|
|
655
|
+
background: backgroundColor,
|
|
656
|
+
display: "block",
|
|
657
|
+
cursor: activeTool === "ruler" ? "crosshair" : "auto",
|
|
658
|
+
}, children: [_jsx(Layers, { shadowShape: shadowShape, components: [...extraComponentsState, ...componentsState], style: {
|
|
659
|
+
cursor: getCursorStyle(),
|
|
660
|
+
},
|
|
661
|
+
// onClick={handleSelectComponent}
|
|
662
|
+
onMouseDown: handleMouseDown,
|
|
663
|
+
// onMouseUp={handleMouseUp}
|
|
664
|
+
onBlur: handleUnSelectComponent, selectedComponent: selectedComponent, activeTool: activeTool, onTouchStart: (e, item, direction) => handleTouchStart(e, item, direction), onTouchMove: (e) => handleTouchMove(e), onTouchEnd: handleTouchEnd }), activeTool === "ruler" && (_jsxs(_Fragment, { children: [_jsxs("g", { id: "horizontal-ruler", children: [_jsx("rect", { x: "0", y: "0", width: window.innerWidth, height: "30", fill: "#e0e0e0" }), _jsx("g", { stroke: "#888", "font-size": "10", "text-anchor": "middle", children: Array.from({ length: window.innerWidth / 50 }, (_, i) => (_jsxs("g", { children: [_jsx("line", { x1: i * 50, y1: "0", x2: i * 50, y2: "10" }), _jsx("text", { x: i * 50, y: "15", children: i * 50 })] }, i))) })] }), _jsxs("g", { id: "vertical-ruler", children: [_jsx("rect", { x: "0", y: "0", width: "30", height: window.innerHeight, fill: "#e0e0e0" }), _jsx("g", { stroke: "#888", "font-size": "10", "text-anchor": "middle", children: Array.from({ length: window.innerHeight / 10 }, (_, i) => (_jsxs("g", { children: [_jsx("line", { x1: "0", y1: i * 50, x2: "10", y2: i * 50 }), _jsx("text", { x: "15", y: i * 50, children: i * 50 })] }, i))) })] })] })), grid && (_jsxs("g", { stroke: "#ddd", strokeWidth: 0.5, children: [Array.from({ length: widthBoard / 10 }, (_, i) => (_jsx("line", { x1: i * 10, y1: 0, x2: i * 10, y2: heightBoard }, `v-${i}`))), Array.from({ length: heightBoard / 10 }, (_, i) => (_jsx("line", { x1: 0, y1: i * 10, x2: widthBoard, y2: i * 10 }, `h-${i}`)))] }))] }) })] })] })] }));
|
|
724
665
|
};
|
|
725
666
|
export default BoardTemplate;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface BoardTemplateProps {
|
|
3
2
|
onSelectComponent?: (items: any) => void;
|
|
4
3
|
mappingKey?: string;
|
|
5
4
|
viewOnly?: boolean;
|
|
6
5
|
}
|
|
7
|
-
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) =>
|
|
6
|
+
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default BoardTemplate;
|