seat-editor 1.6.21 → 1.6.22
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/constant.d.ts +43 -0
- package/dist/app/constant.js +2747 -0
- 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 +2 -2
- 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/page.d.ts +1 -1
- package/dist/app/only-view/{page.js → page.jsx} +1 -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/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} +98 -39
- 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} +16 -8
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/{select-tool.js → select-tool.jsx} +20 -8
- 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/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} +90 -71
- package/dist/features/view/index.d.ts +1 -1
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only/{index.js → index.jsx} +44 -35
- 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 -34
- 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/table-seat-circle.js +0 -9
- package/dist/features/panel/text-tool.js +0 -7
- package/dist/features/view/index.js +0 -221
- package/dist/provider/antd-provider.js +0 -43
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { omit } from "lodash";
|
|
4
|
+
const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode = "edit", style,
|
|
5
|
+
// onTouchEnd,
|
|
6
|
+
// onTouchMove,
|
|
7
|
+
onTouchStart }) => {
|
|
8
|
+
const refItemTemp = useRef(null);
|
|
9
|
+
const handleOnHover = (item) => {
|
|
10
|
+
if (mode === "edit") {
|
|
11
|
+
refItemTemp.current = item;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const renderShadowShape = (item) => {
|
|
15
|
+
const { id, x, y, width, height, fill, opacity, rotation, shape, fontColor, text, seatFill, labels, } = item;
|
|
16
|
+
const commonProps = { fill, opacity };
|
|
17
|
+
switch (shape) {
|
|
18
|
+
case "square":
|
|
19
|
+
return (<rect key={id} x={x} y={y} width={width} height={height} {...commonProps}/>);
|
|
20
|
+
case "circle":
|
|
21
|
+
return (<circle key={id} cx={x + width / 2} cy={y + height / 2} r={width / 2} {...commonProps}/>);
|
|
22
|
+
case "diamond":
|
|
23
|
+
return (<rect key={id} x={x} y={y} width={width} height={height} transform={`rotate(${rotation}, ${x}, ${y})`} {...commonProps}/>);
|
|
24
|
+
case "table-seat-circle": {
|
|
25
|
+
const seatCount = item.seatCount;
|
|
26
|
+
const openSpace = item.openSpace; // nilai antara 0 (tidak ada ruang) sampai maksimal ~0.9
|
|
27
|
+
const centerX = x + width / 2;
|
|
28
|
+
const centerY = y + height / 2;
|
|
29
|
+
const radius = width;
|
|
30
|
+
const seatRadius = width / 4;
|
|
31
|
+
const fullAngle = 2 * Math.PI;
|
|
32
|
+
const availableAngle = fullAngle * (1 - openSpace); // sudut yang dipakai untuk kursi
|
|
33
|
+
const angleStart = (fullAngle - availableAngle) / 2; // agar tetap seimbang
|
|
34
|
+
const angleStep = availableAngle / seatCount;
|
|
35
|
+
const seatCircles = Array.from({ length: seatCount }, (_, i) => {
|
|
36
|
+
const angle = angleStart + i * angleStep;
|
|
37
|
+
const cx = centerX + radius * Math.cos(angle);
|
|
38
|
+
const cy = centerY + radius * Math.sin(angle);
|
|
39
|
+
return { cx, cy };
|
|
40
|
+
});
|
|
41
|
+
return (<g key={id} transform={`rotate(${rotation} ${x + width / 2} ${y + height / 2})`}>
|
|
42
|
+
<circle cx={centerX} cy={centerY} r={width - 15} {...commonProps} opacity={id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity}/>
|
|
43
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
return (<text 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})`}>
|
|
46
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
47
|
+
</text>);
|
|
48
|
+
})}
|
|
49
|
+
<g fill="#e6b9c0" opacity={id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity} stroke="#c49ba3" strokeWidth="1" key={`${id}-seats`}>
|
|
50
|
+
{seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill}/>))}
|
|
51
|
+
</g>
|
|
52
|
+
</g>);
|
|
53
|
+
}
|
|
54
|
+
case "table-seat-square": {
|
|
55
|
+
const seatCount = item.seatCount || 6;
|
|
56
|
+
const openSpace = item.openSpace || 0; // from 0 to 0.9
|
|
57
|
+
const seatRadius = width / 6;
|
|
58
|
+
// split seats evenly on top and bottom
|
|
59
|
+
const seatCountPerSide = Math.ceil(seatCount / 2);
|
|
60
|
+
const availableWidth = width * (1 - openSpace);
|
|
61
|
+
const startX = x + (width * openSpace) / 2;
|
|
62
|
+
const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
|
|
63
|
+
const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
|
|
64
|
+
cx: startX + i * spacing,
|
|
65
|
+
cy: y - seatRadius * 1.5,
|
|
66
|
+
}));
|
|
67
|
+
const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
|
|
68
|
+
(_, i) => ({
|
|
69
|
+
cx: startX + i * spacing,
|
|
70
|
+
cy: y + height + seatRadius * 1.5,
|
|
71
|
+
}));
|
|
72
|
+
return (<g key={id}>
|
|
73
|
+
{/* Square Table */}
|
|
74
|
+
<rect x={x} y={y} width={width} height={height} {...commonProps}/>
|
|
75
|
+
|
|
76
|
+
{/* Seats */}
|
|
77
|
+
<g fill="#e6b9c0" fillOpacity="0.5" stroke="#c49ba3" strokeWidth="1" key={`${id}-seats`}>
|
|
78
|
+
{[...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius}/>))}
|
|
79
|
+
</g>
|
|
80
|
+
</g>);
|
|
81
|
+
}
|
|
82
|
+
case "text":
|
|
83
|
+
return (<g key={id} onClick={() => {
|
|
84
|
+
onClick && onClick(item);
|
|
85
|
+
}}>
|
|
86
|
+
<rect x={x} y={y} width={width} height={height} fill="transparent" opacity={opacity}/>
|
|
87
|
+
<text x={x + width / 2} y={y + height / 2} textAnchor="middle" dominantBaseline="middle" fill={fontColor} fontSize={height * 0.6} opacity={opacity}>
|
|
88
|
+
{text}
|
|
89
|
+
</text>
|
|
90
|
+
</g>);
|
|
91
|
+
case "ruler":
|
|
92
|
+
return (<g key={id}>
|
|
93
|
+
<rect x={x - (window.innerWidth * 3) / 2} y={y} width={window.innerWidth * 3} height={1} fill="black"/>
|
|
94
|
+
<rect x={x} y={y - (window.innerHeight * 3) / 2} width={1} height={window.innerHeight * 3} fill="black"/>
|
|
95
|
+
|
|
96
|
+
</g>);
|
|
97
|
+
default:
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const renderShape = (item) => {
|
|
102
|
+
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, } = item;
|
|
103
|
+
const commonProps = {
|
|
104
|
+
fill,
|
|
105
|
+
opacity,
|
|
106
|
+
stroke,
|
|
107
|
+
strokeWidth,
|
|
108
|
+
onMouseDown: (e) => {
|
|
109
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e, item || refItemTemp.current);
|
|
110
|
+
},
|
|
111
|
+
onMouseEnter: (e) => {
|
|
112
|
+
// e.stopPropagation();
|
|
113
|
+
handleOnHover === null || handleOnHover === void 0 ? void 0 : handleOnHover(item);
|
|
114
|
+
},
|
|
115
|
+
onClick: (e) => {
|
|
116
|
+
// e.stopPropagation();
|
|
117
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
118
|
+
},
|
|
119
|
+
onMouseUp: (e) => {
|
|
120
|
+
// e.stopPropagation();
|
|
121
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(e);
|
|
122
|
+
},
|
|
123
|
+
onBlur: (e) => {
|
|
124
|
+
// e.stopPropagation();
|
|
125
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
126
|
+
},
|
|
127
|
+
// onTouchMove: (
|
|
128
|
+
// e: React.TouchEvent<
|
|
129
|
+
// SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
|
|
130
|
+
// >
|
|
131
|
+
// ) => {
|
|
132
|
+
// // e.stopPropagation();
|
|
133
|
+
// onTouchMove?.(e);
|
|
134
|
+
// },
|
|
135
|
+
onTouchStart: (e) => {
|
|
136
|
+
// e.stopPropagation();
|
|
137
|
+
onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e, item);
|
|
138
|
+
},
|
|
139
|
+
// onTouchEnd: (
|
|
140
|
+
// e: React.TouchEvent<
|
|
141
|
+
// SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement
|
|
142
|
+
// >
|
|
143
|
+
// ) => {
|
|
144
|
+
// // e.stopPropagation();
|
|
145
|
+
// onTouchEnd?.(e);
|
|
146
|
+
// },
|
|
147
|
+
onDoubleClick: (e) => {
|
|
148
|
+
// e.stopPropagation();
|
|
149
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(item);
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
switch (shape) {
|
|
153
|
+
case "square":
|
|
154
|
+
return (<g key={id}>
|
|
155
|
+
<rect key={id} 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})`}/>
|
|
156
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
157
|
+
var _a, _b, _c, _d;
|
|
158
|
+
return (<text {...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) => {
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
onClick && onClick(item);
|
|
161
|
+
}}>
|
|
162
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
163
|
+
</text>);
|
|
164
|
+
})}
|
|
165
|
+
</g>);
|
|
166
|
+
case "circle":
|
|
167
|
+
return (<g key={id}>
|
|
168
|
+
<circle key={id} 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")}/>
|
|
169
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
170
|
+
var _a, _b, _c, _d;
|
|
171
|
+
return (<text 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) => {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
onClick && onClick(item);
|
|
174
|
+
}}>
|
|
175
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
176
|
+
</text>);
|
|
177
|
+
})}
|
|
178
|
+
</g>);
|
|
179
|
+
case "diamond":
|
|
180
|
+
return (<g key={id}>
|
|
181
|
+
<rect key={id} 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}/>
|
|
182
|
+
<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">
|
|
183
|
+
{label}
|
|
184
|
+
</text>
|
|
185
|
+
</g>);
|
|
186
|
+
case "table-seat-circle": {
|
|
187
|
+
const seatCount = item.seatCount;
|
|
188
|
+
const openSpace = item.openSpace; // nilai antara 0 (tidak ada ruang) sampai maksimal ~0.9
|
|
189
|
+
const centerX = x + width / 2;
|
|
190
|
+
const centerY = y + height / 2;
|
|
191
|
+
const radius = width;
|
|
192
|
+
const seatRadius = width / 4;
|
|
193
|
+
const fullAngle = 2 * Math.PI;
|
|
194
|
+
const availableAngle = fullAngle * (1 - openSpace); // sudut yang dipakai untuk kursi
|
|
195
|
+
const angleStart = (fullAngle - availableAngle) / 2; // agar tetap seimbang
|
|
196
|
+
const angleStep = availableAngle / seatCount;
|
|
197
|
+
const seatCircles = Array.from({ length: seatCount }, (_, i) => {
|
|
198
|
+
const angle = angleStart + i * angleStep;
|
|
199
|
+
const cx = centerX + radius * Math.cos(angle);
|
|
200
|
+
const cy = centerY + radius * Math.sin(angle);
|
|
201
|
+
return { cx, cy };
|
|
202
|
+
});
|
|
203
|
+
return (<g key={id} transform={`rotate(${rotation} ${x + width / 2} ${y + height / 2})`}>
|
|
204
|
+
<circle 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}/>
|
|
205
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
206
|
+
var _a, _b, _c, _d;
|
|
207
|
+
return (<text 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) => {
|
|
208
|
+
e.stopPropagation();
|
|
209
|
+
onClick && onClick(item);
|
|
210
|
+
}}>
|
|
211
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
212
|
+
</text>);
|
|
213
|
+
})}
|
|
214
|
+
<g fill="#e6b9c0" opacity={id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity} stroke="#c49ba3" key={`${id}-seats`} strokeWidth="1">
|
|
215
|
+
{seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill}/>))}
|
|
216
|
+
</g>
|
|
217
|
+
</g>);
|
|
218
|
+
}
|
|
219
|
+
case "table-seat-square": {
|
|
220
|
+
const seatCount = item.seatCount || 6;
|
|
221
|
+
const openSpace = item.openSpace || 0; // from 0 to 0.9
|
|
222
|
+
const seatRadius = width / 6;
|
|
223
|
+
// split seats evenly on top and bottom
|
|
224
|
+
const seatCountPerSide = Math.ceil(seatCount / 2);
|
|
225
|
+
const availableWidth = width * (1 - openSpace);
|
|
226
|
+
const startX = x + (width * openSpace) / 2;
|
|
227
|
+
const spacing = seatCountPerSide > 1 ? availableWidth / (seatCountPerSide - 1) : 0;
|
|
228
|
+
const topSeats = Array.from({ length: seatCountPerSide }, (_, i) => ({
|
|
229
|
+
cx: startX + i * spacing,
|
|
230
|
+
cy: y - seatRadius * 1.5,
|
|
231
|
+
}));
|
|
232
|
+
const bottomSeats = Array.from({ length: seatCount - seatCountPerSide }, // in case it's odd
|
|
233
|
+
(_, i) => ({
|
|
234
|
+
cx: startX + i * spacing,
|
|
235
|
+
cy: y + height + seatRadius * 1.5,
|
|
236
|
+
}));
|
|
237
|
+
return (<g key={id} transform={`rotate(${rotation}, ${x}, ${y})`}>
|
|
238
|
+
{/* Square Table */}
|
|
239
|
+
<rect 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}/>
|
|
240
|
+
<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">
|
|
241
|
+
{label}
|
|
242
|
+
</text>
|
|
243
|
+
{/* Seats */}
|
|
244
|
+
<g fill="#e6b9c0" fillOpacity="0.5" stroke="#c49ba3" strokeWidth="1" key={`${id}-seats`}>
|
|
245
|
+
{[...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius}/>))}
|
|
246
|
+
</g>
|
|
247
|
+
</g>);
|
|
248
|
+
}
|
|
249
|
+
case "text":
|
|
250
|
+
return (<g key={id}>
|
|
251
|
+
<rect x={x} y={y} width={width} height={height} fill="transparent" opacity={opacity} onClick={(e) => {
|
|
252
|
+
e.stopPropagation();
|
|
253
|
+
onClick && onClick(item);
|
|
254
|
+
}}/>
|
|
255
|
+
<text 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"])}>
|
|
256
|
+
{text}
|
|
257
|
+
</text>
|
|
258
|
+
</g>);
|
|
259
|
+
case "image-table":
|
|
260
|
+
case "background":
|
|
261
|
+
return (<g key={id} onClick={() => {
|
|
262
|
+
onClick && onClick(item);
|
|
263
|
+
}}>
|
|
264
|
+
<image href={src} x={x} y={y} width={width} height={height} transform={`rotate(${rotation} ${x + width / 2} ${y + height / 2})`} {...commonProps}/>
|
|
265
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
266
|
+
var _a, _b, _c, _d;
|
|
267
|
+
return (<text key={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})`}>
|
|
268
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
269
|
+
</text>);
|
|
270
|
+
})}
|
|
271
|
+
</g>);
|
|
272
|
+
default:
|
|
273
|
+
return <g key={id}/>;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
let date = new Date();
|
|
277
|
+
return (<g key={`${date}`}>
|
|
278
|
+
{components === null || components === void 0 ? void 0 : components.map(renderShape)}
|
|
279
|
+
{shadowShape === null || shadowShape === void 0 ? void 0 : shadowShape.map(renderShadowShape)}
|
|
280
|
+
|
|
281
|
+
{selectedComponent && activeTool === "select" && (<>
|
|
282
|
+
{[
|
|
283
|
+
"square",
|
|
284
|
+
"circle",
|
|
285
|
+
"diamond",
|
|
286
|
+
"text",
|
|
287
|
+
"background",
|
|
288
|
+
"image-table",
|
|
289
|
+
].includes(selectedComponent.shape) && (<g key={`${selectedComponent.id}-selection`}>
|
|
290
|
+
<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"
|
|
291
|
+
// transform={`scale(${selectedComponent.scale})`}
|
|
292
|
+
onMouseDown={(e) => {
|
|
293
|
+
e.stopPropagation();
|
|
294
|
+
onMouseDown(e, selectedComponent, "top-left");
|
|
295
|
+
}} onTouchStart={(e) => {
|
|
296
|
+
e.stopPropagation();
|
|
297
|
+
onTouchStart(e, selectedComponent, "top-left");
|
|
298
|
+
}}/>
|
|
299
|
+
<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) => {
|
|
300
|
+
e.stopPropagation();
|
|
301
|
+
onMouseDown(e, selectedComponent, "top-center");
|
|
302
|
+
}} onTouchStart={(e) => {
|
|
303
|
+
e.stopPropagation();
|
|
304
|
+
onTouchStart(e, selectedComponent, "top-center");
|
|
305
|
+
}}/>
|
|
306
|
+
<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) => {
|
|
307
|
+
e.stopPropagation();
|
|
308
|
+
onMouseDown(e, selectedComponent, "left-center");
|
|
309
|
+
}} onTouchStart={(e) => {
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
onTouchStart(e, selectedComponent, "left-center");
|
|
312
|
+
}}/>
|
|
313
|
+
<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) => {
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
onMouseDown(e, selectedComponent, "top-right");
|
|
316
|
+
}} onTouchStart={(e) => {
|
|
317
|
+
e.stopPropagation();
|
|
318
|
+
onTouchStart(e, selectedComponent, "top-right");
|
|
319
|
+
}}/>
|
|
320
|
+
<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) => {
|
|
321
|
+
e.stopPropagation();
|
|
322
|
+
onMouseDown(e, selectedComponent, "bottom-right");
|
|
323
|
+
}} onTouchStart={(e) => {
|
|
324
|
+
e.stopPropagation();
|
|
325
|
+
onTouchStart(e, selectedComponent, "bottom-right");
|
|
326
|
+
}}/>
|
|
327
|
+
<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) => {
|
|
328
|
+
e.stopPropagation();
|
|
329
|
+
onMouseDown(e, selectedComponent, "bottom-center");
|
|
330
|
+
}} onTouchStart={(e) => {
|
|
331
|
+
e.stopPropagation();
|
|
332
|
+
onTouchStart(e, selectedComponent, "bottom-center");
|
|
333
|
+
}}/>
|
|
334
|
+
<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) => {
|
|
335
|
+
e.stopPropagation();
|
|
336
|
+
onMouseDown(e, selectedComponent, "right-center");
|
|
337
|
+
}} onTouchStart={(e) => {
|
|
338
|
+
e.stopPropagation();
|
|
339
|
+
onTouchStart(e, selectedComponent, "right-center");
|
|
340
|
+
}}/>
|
|
341
|
+
<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) => {
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
onMouseDown(e, selectedComponent, "bottom-left");
|
|
344
|
+
}} onTouchStart={(e) => {
|
|
345
|
+
e.stopPropagation();
|
|
346
|
+
onTouchStart(e, selectedComponent, "bottom-left");
|
|
347
|
+
}}/>
|
|
348
|
+
</g>)}
|
|
349
|
+
{["table-seat-circle", "table-seat-square"].includes(selectedComponent.shape) && (<g key={selectedComponent.id}>
|
|
350
|
+
<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) => {
|
|
351
|
+
e.stopPropagation();
|
|
352
|
+
onMouseDown(e, selectedComponent, "top-left");
|
|
353
|
+
}}/>
|
|
354
|
+
<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) => {
|
|
355
|
+
e.stopPropagation();
|
|
356
|
+
onMouseDown(e, selectedComponent, "top-right");
|
|
357
|
+
}}/>
|
|
358
|
+
<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) => {
|
|
359
|
+
e.stopPropagation();
|
|
360
|
+
onMouseDown(e, selectedComponent, "bottom-right");
|
|
361
|
+
}}/>
|
|
362
|
+
<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) => {
|
|
363
|
+
e.stopPropagation();
|
|
364
|
+
onMouseDown(e, selectedComponent, "b-left");
|
|
365
|
+
}}/>
|
|
366
|
+
</g>)}
|
|
367
|
+
</>)}
|
|
368
|
+
</g>);
|
|
369
|
+
};
|
|
370
|
+
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
|
|
6
|
+
declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react").JSX.Element;
|
|
7
7
|
export default TableEditor;
|
|
8
8
|
export { LayerView };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
2
|
import { useEffect } from "react";
|
|
4
3
|
import Board from "../../features/board";
|
|
5
4
|
import SideTool from "../../features/side-tool";
|
|
@@ -22,7 +21,13 @@ const TableEditor = ({ componentProps = [], extraComponentProps = [], }) => {
|
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
}, [componentProps, extraComponentProps]);
|
|
25
|
-
return (
|
|
24
|
+
return (<>
|
|
25
|
+
<div className="w-full h-screen flex relative">
|
|
26
|
+
<SideTool />
|
|
27
|
+
<Board />
|
|
28
|
+
<ControlPanels />
|
|
29
|
+
</div>
|
|
30
|
+
</>);
|
|
26
31
|
};
|
|
27
32
|
export default TableEditor;
|
|
28
33
|
export { LayerView };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Modal } from "antd";
|
|
3
|
+
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
4
|
+
const ModalPreview = ({ children }) => {
|
|
5
|
+
const { isPreview } = useAppSelector((state) => state.tool);
|
|
6
|
+
const dispatch = useAppDispatch();
|
|
7
|
+
return (<Modal open={isPreview} onCancel={() => dispatch({ type: "tool/setTooglePreview", payload: false })} width={700} title="Preview Board" centered footer={null}>
|
|
8
|
+
<div className="flex flex-col p-4 h-[500px]">{children}</div>
|
|
9
|
+
</Modal>);
|
|
10
|
+
};
|
|
11
|
+
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
|
|
5
|
+
declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react").JSX.Element;
|
|
6
6
|
export default BoardTemplate;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
3
|
import { TransformWrapper, TransformComponent, MiniMap, } from "react-zoom-pan-pinch";
|
|
5
4
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
@@ -607,15 +606,21 @@ const BoardTemplate = ({ onSelectComponent }) => {
|
|
|
607
606
|
}
|
|
608
607
|
};
|
|
609
608
|
const renderMiniMap = () => {
|
|
610
|
-
return (
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
609
|
+
return (<MiniMap width={250} height={250}>
|
|
610
|
+
<div className="w-full h-full">
|
|
611
|
+
<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={{
|
|
612
|
+
background: "#f5f5f5",
|
|
613
|
+
display: "block",
|
|
614
|
+
}}>
|
|
615
|
+
<Layers shadowShape={shadowShape} components={[...extraComponentsState, ...componentsState]} activeTool={activeTool}
|
|
616
|
+
// onClick={handleSelectComponent}
|
|
617
|
+
// onMouseDown={handleMouseDown}
|
|
618
|
+
// onMouseUp={handleMouseUp}
|
|
619
|
+
// onBlur={handleUnSelectComponent}
|
|
620
|
+
selectedComponent={selectedComponent}/>
|
|
621
|
+
</svg>
|
|
622
|
+
</div>
|
|
623
|
+
</MiniMap>);
|
|
619
624
|
};
|
|
620
625
|
const handelZoomIn = () => {
|
|
621
626
|
var _a;
|
|
@@ -641,26 +646,80 @@ const BoardTemplate = ({ onSelectComponent }) => {
|
|
|
641
646
|
// moveComponent &&
|
|
642
647
|
// isTouching.current &&
|
|
643
648
|
// !resizeDirection
|
|
644
|
-
return (
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
649
|
+
return (<>
|
|
650
|
+
<ModalPreview>
|
|
651
|
+
<LayerView statusKey="status"/>
|
|
652
|
+
</ModalPreview>
|
|
653
|
+
<div className="relative w-full h-screen flex-1 overflow-hidden" ref={containerRef}>
|
|
654
|
+
<div className="absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10">
|
|
655
|
+
<div className="flex gap-2">
|
|
656
|
+
<Button icon={<ZoomIn />} onClick={handelZoomIn}/>
|
|
657
|
+
<Button icon={<ZoomOut />} onClick={handleZoomOut}/>
|
|
658
|
+
</div>
|
|
659
|
+
</div>
|
|
660
|
+
<TransformWrapper ref={transformRef} panning={{ disabled: activeTool === "select" }} centerZoomedOut={true} onTransformed={({ state: { scale } }) => setScale(scale)} minScale={1} // sangat kecil = bisa zoom out jauh
|
|
661
|
+
maxScale={1000} initialScale={1} pinch={{ step: 1 }} smooth={true} doubleClick={{ step: 1, disabled: activeTool === "select" }} disablePadding>
|
|
662
|
+
{scale > 1 && (<div className="absolute bottom-[60px] left-1/2 transform -translate-x-1/2 z-10">
|
|
663
|
+
{renderMiniMap()}
|
|
664
|
+
</div>)}
|
|
665
|
+
<TransformComponent wrapperStyle={{
|
|
666
|
+
width: "100%",
|
|
667
|
+
height: "100%",
|
|
668
|
+
overflow: "hidden",
|
|
669
|
+
}} contentStyle={{
|
|
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
|
+
</>);
|
|
665
724
|
};
|
|
666
725
|
export default BoardTemplate;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface BoardTemplateProps {
|
|
2
3
|
onSelectComponent?: (items: any) => void;
|
|
3
4
|
mappingKey?: string;
|
|
4
5
|
viewOnly?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) =>
|
|
7
|
+
declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => React.JSX.Element;
|
|
7
8
|
export default BoardTemplate;
|