seat-editor 3.0.2 → 3.0.3
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 +1 -1
- 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 +33 -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/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +2 -10
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/page.js +78 -0
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +2 -10
- 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.jsx → index.js} +102 -242
- package/dist/components/layer-v4/index.d.ts +3 -3
- package/dist/components/layer-v4/{index.jsx → index.js} +81 -158
- 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 copy.d.ts +1 -2
- package/dist/features/board-v3/{index copy.jsx → index copy.js } +50 -128
- package/dist/features/board-v3/index.d.ts +1 -2
- package/dist/features/board-v3/{index.jsx → index.js} +32 -110
- 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} +7 -25
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/{select-tool.jsx → select-tool.js} +10 -23
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/selected-group.js +7 -0
- 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/table-seat-square.d.ts +1 -1
- package/dist/features/panel/table-seat-square.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-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/features/view-only-3/index.d.ts +3 -3
- package/dist/features/view-only-3/{index.jsx → index.js} +27 -46
- 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/package.json +1 -1
- package/dist/app/new-board/page.jsx +0 -55
- package/dist/app/only-view/page.jsx +0 -101
- 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/modal-preview/index.jsx +0 -11
- package/dist/features/navbar/index.jsx +0 -5
- package/dist/features/panel/selected-group.jsx +0 -47
- package/dist/features/panel/table-seat-circle.jsx +0 -31
- package/dist/features/panel/table-seat-square.jsx +0 -46
- package/dist/features/panel/text-tool.jsx +0 -26
- package/dist/provider/antd-provider.jsx +0 -46
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as _createElement } from "react";
|
|
2
4
|
import { isEmpty, omit } from "lodash";
|
|
3
|
-
import { TABLE_KEYS } from "
|
|
5
|
+
import { TABLE_KEYS } from "../../utils/constant";
|
|
4
6
|
import { distributeWithSpacing } from "../layer-v3";
|
|
5
7
|
const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, }) => {
|
|
6
8
|
const renderShape = (item) => {
|
|
@@ -83,26 +85,23 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
83
85
|
offsetSymbolY = size / 4;
|
|
84
86
|
break;
|
|
85
87
|
}
|
|
86
|
-
return (
|
|
87
|
-
{symbol.value}
|
|
88
|
-
</tspan>);
|
|
88
|
+
return (_createElement("tspan", Object.assign({}, symbol, { key: `symbol-${tagIndex}-${i}`, x: posX + offsetSymbolX, y: posY + offsetSymbolY, textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotate} ${posX} ${posY})` }), symbol.value));
|
|
89
89
|
};
|
|
90
90
|
if (item.type === "icon") {
|
|
91
91
|
const iconTag = iconTags === null || iconTags === void 0 ? void 0 : iconTags.find((icon) => icon.key === item.value);
|
|
92
92
|
if (!iconTag)
|
|
93
93
|
return null;
|
|
94
|
-
return (
|
|
95
|
-
{iconTag.icon}
|
|
96
|
-
</g>);
|
|
94
|
+
return (_createElement("g", Object.assign({}, item, { key: `icon-${tagIndex}-${i}`, transform: `translate(${posX - 10}, ${posY - 10})` }), iconTag.icon));
|
|
97
95
|
}
|
|
98
96
|
if (item.type === "text") {
|
|
99
|
-
return (
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
return (_createElement("text", Object.assign({}, item, { key: `text-${tagIndex}-${i}`, x: posX, y: posY, textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotate} ${posX} ${posY})` }),
|
|
98
|
+
item.value,
|
|
99
|
+
" ",
|
|
100
|
+
renderSymbol(item === null || item === void 0 ? void 0 : item.symbol)));
|
|
102
101
|
}
|
|
103
102
|
return null;
|
|
104
103
|
});
|
|
105
|
-
return
|
|
104
|
+
return _jsx("g", { children: elements }, `group-${tagIndex}`);
|
|
106
105
|
});
|
|
107
106
|
};
|
|
108
107
|
let commonProps = {
|
|
@@ -186,111 +185,93 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
186
185
|
const transformRotate = `rotate(${rotate} ${x + width / 2} ${y + height / 2})`;
|
|
187
186
|
switch (shape) {
|
|
188
187
|
case "square":
|
|
189
|
-
return (
|
|
190
|
-
// data-table={JSON.stringify(item)}
|
|
191
|
-
data-id={id} style={{ pointerEvents: "all" }} onContextMenu={(e) => e.preventDefault()} onDragEnter={(e) => {
|
|
188
|
+
return (_jsxs("g", { "data-id": id, style: { pointerEvents: "all" }, onContextMenu: (e) => e.preventDefault(), onDragEnter: (e) => {
|
|
192
189
|
const group = e.currentTarget;
|
|
193
190
|
highlightGroup(group, "dragenter");
|
|
194
|
-
}
|
|
191
|
+
}, onDragOver: (e) => {
|
|
195
192
|
e.preventDefault(); // agar drop diterima
|
|
196
|
-
}
|
|
193
|
+
}, onDragLeave: (e) => {
|
|
197
194
|
const group = e.currentTarget;
|
|
198
195
|
unhighlightGroup(group);
|
|
199
|
-
}
|
|
196
|
+
}, onDrop: (e) => {
|
|
200
197
|
const group = e.currentTarget;
|
|
201
198
|
// restore langsung dan reset
|
|
202
199
|
forceRestoreGroup(group, "drop");
|
|
203
|
-
}
|
|
200
|
+
}, onPointerOver: (e) => {
|
|
204
201
|
// e.preventDefault(); // penting
|
|
205
202
|
const group = e.currentTarget;
|
|
206
203
|
highlightGroup(group, "pointerover");
|
|
207
|
-
}
|
|
204
|
+
}, onPointerOut: (e) => {
|
|
208
205
|
const group = e.currentTarget;
|
|
209
206
|
unhighlightGroup(group);
|
|
210
|
-
}
|
|
207
|
+
}, onPointerUp: (e) => {
|
|
211
208
|
const group = e.currentTarget;
|
|
212
209
|
// restore langsung dan reset
|
|
213
210
|
forceRestoreGroup(group, "pointerup");
|
|
214
|
-
}
|
|
211
|
+
}, onPointerDown: (e) => {
|
|
215
212
|
const group = e.currentTarget;
|
|
216
213
|
highlightGroup(group, "pointerdown");
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
},
|
|
215
|
+
// onPointerEnter={(e) => {
|
|
216
|
+
// const group = e.currentTarget as SVGGElement;
|
|
217
|
+
// highlightGroup(group, "pointerenter");
|
|
218
|
+
// }}
|
|
219
|
+
onPointerLeave: (e) => {
|
|
223
220
|
const group = e.currentTarget;
|
|
224
221
|
unhighlightGroup(group);
|
|
225
|
-
}
|
|
222
|
+
}, onMouseEnter: (e) => {
|
|
226
223
|
// e.preventDefault(); // penting
|
|
227
224
|
const group = e.currentTarget;
|
|
228
225
|
highlightGroup(group, "mouseenter");
|
|
229
|
-
}
|
|
226
|
+
}, onMouseLeave: (e) => {
|
|
230
227
|
const group = e.currentTarget;
|
|
231
228
|
unhighlightGroup(group);
|
|
232
|
-
}}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
238
|
-
var _a, _b, _c, _d;
|
|
239
|
-
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={transformRotate} {..._}>
|
|
240
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
241
|
-
</text>);
|
|
242
|
-
})}
|
|
243
|
-
</g>);
|
|
229
|
+
}, children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, fill: fill, className: "blink-2", transform: transformRotate }, omit(item, TABLE_KEYS), commonProps), `${id}-rect`), renderTags(tags), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
230
|
+
var _a, _b, _c, _d;
|
|
231
|
+
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: transformRotate }, _), _ === null || _ === void 0 ? void 0 : _.label));
|
|
232
|
+
})] }, id));
|
|
244
233
|
case "circle":
|
|
245
|
-
return (
|
|
246
|
-
// data-table={JSON.stringify(item)}
|
|
247
|
-
data-id={id} onContextMenu={(e) => e.preventDefault()} onDragEnter={(e) => {
|
|
234
|
+
return (_jsxs("g", { style: { pointerEvents: "all" }, "data-id": id, onContextMenu: (e) => e.preventDefault(), onDragEnter: (e) => {
|
|
248
235
|
e.preventDefault(); // penting
|
|
249
236
|
const group = e.currentTarget;
|
|
250
237
|
highlightGroup(group, "dragenter");
|
|
251
|
-
}
|
|
238
|
+
}, onDragOver: (e) => {
|
|
252
239
|
e.preventDefault(); // agar drop diterima
|
|
253
|
-
}
|
|
240
|
+
}, onDragLeave: (e) => {
|
|
254
241
|
const group = e.currentTarget;
|
|
255
242
|
unhighlightGroup(group);
|
|
256
|
-
}
|
|
243
|
+
}, onDrop: (e) => {
|
|
257
244
|
e.preventDefault();
|
|
258
245
|
const group = e.currentTarget;
|
|
259
246
|
// restore langsung dan reset
|
|
260
247
|
forceRestoreGroup(group);
|
|
261
|
-
}
|
|
248
|
+
}, onPointerOver: (e) => {
|
|
262
249
|
e.preventDefault(); // penting
|
|
263
250
|
const group = e.currentTarget;
|
|
264
251
|
highlightGroup(group, "pointerover");
|
|
265
|
-
}
|
|
252
|
+
}, onPointerOut: (e) => {
|
|
266
253
|
const group = e.currentTarget;
|
|
267
254
|
unhighlightGroup(group);
|
|
268
|
-
}
|
|
255
|
+
}, onPointerUp: (e) => {
|
|
269
256
|
e.preventDefault();
|
|
270
257
|
const group = e.currentTarget;
|
|
271
258
|
// restore langsung dan reset
|
|
272
259
|
forceRestoreGroup(group);
|
|
273
|
-
}
|
|
260
|
+
}, onMouseDown: (e) => {
|
|
274
261
|
e.preventDefault();
|
|
275
262
|
const group = e.currentTarget;
|
|
276
263
|
highlightGroup(group, "mousedown");
|
|
277
|
-
}
|
|
264
|
+
}, onMouseEnter: (e) => {
|
|
278
265
|
// e.preventDefault(); // penting
|
|
279
266
|
const group = e.currentTarget;
|
|
280
267
|
highlightGroup(group, "mouseenter");
|
|
281
|
-
}
|
|
268
|
+
}, onMouseLeave: (e) => {
|
|
282
269
|
const group = e.currentTarget;
|
|
283
270
|
unhighlightGroup(group);
|
|
284
|
-
}}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var _a, _b, _c, _d;
|
|
289
|
-
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={transformRotate}>
|
|
290
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
291
|
-
</text>);
|
|
292
|
-
})}
|
|
293
|
-
</g>);
|
|
271
|
+
}, children: [_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2 }, commonProps), id), renderTags(tags), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
272
|
+
var _a, _b, _c, _d;
|
|
273
|
+
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: transformRotate, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
|
|
274
|
+
})] }, id));
|
|
294
275
|
case "table-seat-circle": {
|
|
295
276
|
const seatCount = item.seatCount;
|
|
296
277
|
const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -311,76 +292,50 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
311
292
|
const cy = centerY + (tableRadius + seatRadius) * Math.sin(angle);
|
|
312
293
|
return { cx, cy };
|
|
313
294
|
});
|
|
314
|
-
return (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
295
|
+
return (_jsxs("g", { style: { pointerEvents: "all" }, "data-id": id, transform: `translate(${x}, ${y})`,
|
|
296
|
+
// data-table={JSON.stringify(item)}
|
|
297
|
+
// data-id={id}
|
|
298
|
+
onContextMenu: (e) => e.preventDefault(), onDragEnter: (e) => {
|
|
318
299
|
e.preventDefault(); // penting
|
|
319
300
|
const group = e.currentTarget;
|
|
320
301
|
highlightGroup(group, "dragenter");
|
|
321
|
-
}
|
|
302
|
+
}, onDragOver: (e) => {
|
|
322
303
|
e.preventDefault(); // agar drop diterima
|
|
323
|
-
}
|
|
304
|
+
}, onDragLeave: (e) => {
|
|
324
305
|
const group = e.currentTarget;
|
|
325
306
|
unhighlightGroup(group);
|
|
326
|
-
}
|
|
307
|
+
}, onDrop: (e) => {
|
|
327
308
|
e.preventDefault();
|
|
328
309
|
const group = e.currentTarget;
|
|
329
310
|
// restore langsung dan reset
|
|
330
311
|
forceRestoreGroup(group);
|
|
331
|
-
}
|
|
312
|
+
}, onPointerOver: (e) => {
|
|
332
313
|
e.preventDefault(); // penting
|
|
333
314
|
const group = e.currentTarget;
|
|
334
315
|
highlightGroup(group, "pointerover");
|
|
335
|
-
}
|
|
316
|
+
}, onPointerOut: (e) => {
|
|
336
317
|
const group = e.currentTarget;
|
|
337
318
|
unhighlightGroup(group);
|
|
338
|
-
}
|
|
319
|
+
}, onPointerUp: (e) => {
|
|
339
320
|
e.preventDefault();
|
|
340
321
|
const group = e.currentTarget;
|
|
341
322
|
// restore langsung dan reset
|
|
342
323
|
forceRestoreGroup(group);
|
|
343
|
-
}
|
|
324
|
+
}, onMouseDown: (e) => {
|
|
344
325
|
e.preventDefault();
|
|
345
326
|
const group = e.currentTarget;
|
|
346
327
|
highlightGroup(group, "mousedown");
|
|
347
|
-
}
|
|
328
|
+
}, onMouseEnter: (e) => {
|
|
348
329
|
// e.preventDefault(); // penting
|
|
349
330
|
const group = e.currentTarget;
|
|
350
331
|
highlightGroup(group, "mouseenter");
|
|
351
|
-
}
|
|
332
|
+
}, onMouseLeave: (e) => {
|
|
352
333
|
const group = e.currentTarget;
|
|
353
334
|
unhighlightGroup(group);
|
|
354
|
-
}}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
</g>
|
|
359
|
-
{renderTags(tags)}
|
|
360
|
-
|
|
361
|
-
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
362
|
-
var _a, _b, _c, _d;
|
|
363
|
-
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={transformRotate}>
|
|
364
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
365
|
-
</text>);
|
|
366
|
-
})}
|
|
367
|
-
{/* <g
|
|
368
|
-
fill="#e6b9c0"
|
|
369
|
-
stroke="#c49ba3"
|
|
370
|
-
key={`${id}-seats`}
|
|
371
|
-
strokeWidth="1"
|
|
372
|
-
>
|
|
373
|
-
{seatCircles.map(({ cx, cy }, i) => (
|
|
374
|
-
<circle
|
|
375
|
-
key={`${id}-seat-${i}`}
|
|
376
|
-
cx={cx}
|
|
377
|
-
cy={cy}
|
|
378
|
-
r={seatRadius}
|
|
379
|
-
fill={seatFill}
|
|
380
|
-
/>
|
|
381
|
-
))}
|
|
382
|
-
</g> */}
|
|
383
|
-
</g>);
|
|
335
|
+
}, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: tableRadius, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill || "white" }, `${id}-seat-${i}`))) }), renderTags(tags), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
336
|
+
var _a, _b, _c, _d;
|
|
337
|
+
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: transformRotate, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
|
|
338
|
+
})] }, id));
|
|
384
339
|
}
|
|
385
340
|
case "table-seat-square": {
|
|
386
341
|
const openSpace = item.openSpace || 0; // from 0 to 0.9
|
|
@@ -436,87 +391,55 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
|
|
|
436
391
|
cy,
|
|
437
392
|
id: "right",
|
|
438
393
|
}));
|
|
439
|
-
return (
|
|
440
|
-
<g transform={`rotate(${rotate}, 0, 0)`}>
|
|
441
|
-
{/* Square Table */}
|
|
442
|
-
<rect width={width} height={height} {...commonProps} fill={selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill}/>
|
|
443
|
-
{renderTags(tags)}
|
|
444
|
-
|
|
445
|
-
{/* Seats */}
|
|
446
|
-
<g fill="#e6b9c0" stroke="#c49ba3" strokeWidth="1" key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${-x}, ${-y})`}>
|
|
447
|
-
{[...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (<circle key={`${id}-seat-${i}`} id={`seat-${id}`} cx={cx} cy={cy} r={r} fill={seatFill}/>))}
|
|
448
|
-
</g>
|
|
449
|
-
|
|
450
|
-
<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">
|
|
451
|
-
{label}
|
|
452
|
-
</text>
|
|
453
|
-
</g>
|
|
454
|
-
</g>);
|
|
394
|
+
return (_jsx("g", { "data-id": id, transform: `translate(${x}, ${y})`, children: _jsxs("g", { transform: `rotate(${rotate}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill })), renderTags(tags), _jsx("g", { fill: "#e6b9c0", stroke: "#c49ba3", strokeWidth: "1", "data-seat": `${id}-seats`, transform: `translate(${-x}, ${-y})`, children: [...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (_jsx("circle", { id: `seat-${id}`, cx: cx, cy: cy, r: r, fill: seatFill }, `${id}-seat-${i}`))) }, `${id}-seats`), _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));
|
|
455
395
|
}
|
|
456
396
|
case "text":
|
|
457
|
-
return (
|
|
458
|
-
<rect x={x} y={y} width={width} height={height} fill="transparent" opacity={opacity}/>
|
|
459
|
-
<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"])}>
|
|
460
|
-
{text}
|
|
461
|
-
</text>
|
|
462
|
-
</g>);
|
|
397
|
+
return (_jsxs("g", { onContextMenu: (e) => e.preventDefault(), children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity }), _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));
|
|
463
398
|
case "image-table":
|
|
464
|
-
return (
|
|
399
|
+
return (_jsxs("g", { onContextMenu: (e) => e.preventDefault(), onDragEnter: (e) => {
|
|
465
400
|
e.preventDefault(); // penting
|
|
466
401
|
const group = e.currentTarget;
|
|
467
402
|
highlightGroup(group, "dragenter");
|
|
468
|
-
}
|
|
403
|
+
}, onDragOver: (e) => {
|
|
469
404
|
e.preventDefault(); // agar drop diterima
|
|
470
|
-
}
|
|
405
|
+
}, onDragLeave: (e) => {
|
|
471
406
|
const group = e.currentTarget;
|
|
472
407
|
unhighlightGroup(group);
|
|
473
|
-
}
|
|
408
|
+
}, onDrop: (e) => {
|
|
474
409
|
e.preventDefault();
|
|
475
410
|
const group = e.currentTarget;
|
|
476
411
|
// restore langsung dan reset
|
|
477
412
|
forceRestoreGroup(group);
|
|
478
|
-
}
|
|
413
|
+
}, onPointerOver: (e) => {
|
|
479
414
|
e.preventDefault(); // penting
|
|
480
415
|
const group = e.currentTarget;
|
|
481
416
|
highlightGroup(group, "pointerover");
|
|
482
|
-
}
|
|
417
|
+
}, onPointerOut: (e) => {
|
|
483
418
|
const group = e.currentTarget;
|
|
484
419
|
unhighlightGroup(group);
|
|
485
|
-
}
|
|
420
|
+
}, onPointerUp: (e) => {
|
|
486
421
|
e.preventDefault();
|
|
487
422
|
const group = e.currentTarget;
|
|
488
423
|
// restore langsung dan reset
|
|
489
424
|
forceRestoreGroup(group);
|
|
490
|
-
}
|
|
425
|
+
}, onMouseDown: (e) => {
|
|
491
426
|
e.preventDefault();
|
|
492
427
|
const group = e.currentTarget;
|
|
493
428
|
highlightGroup(group, "mousedown");
|
|
494
|
-
}}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
499
|
-
var _a, _b, _c, _d;
|
|
500
|
-
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={transformRotate}>
|
|
501
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
502
|
-
</text>);
|
|
503
|
-
})}
|
|
504
|
-
</g>);
|
|
429
|
+
}, children: [_jsx("image", Object.assign({ href: src, x: x, y: y, "data-id": id, width: width, height: height, transform: transformRotate }, commonProps)), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
430
|
+
var _a, _b, _c, _d;
|
|
431
|
+
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: transformRotate, children: _ === null || _ === void 0 ? void 0 : _.label }, index));
|
|
432
|
+
})] }, id));
|
|
505
433
|
case "background":
|
|
506
|
-
return (
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
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={transformRotate}>
|
|
511
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
512
|
-
</text>);
|
|
513
|
-
})}
|
|
514
|
-
</g>);
|
|
434
|
+
return (_jsxs("g", { onContextMenu: (e) => e.preventDefault(), children: [_jsx("image", Object.assign({ href: src, x: x, y: y, width: width, height: height, transform: transformRotate }, commonProps)), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
435
|
+
var _a, _b, _c, _d;
|
|
436
|
+
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: transformRotate, children: _ === null || _ === void 0 ? void 0 : _.label }, index));
|
|
437
|
+
})] }, id));
|
|
515
438
|
default:
|
|
516
|
-
return
|
|
439
|
+
return _jsx("g", {}, id);
|
|
517
440
|
}
|
|
518
441
|
};
|
|
519
442
|
let date = new Date();
|
|
520
|
-
return
|
|
443
|
+
return _jsx("g", { children: components === null || components === void 0 ? void 0 : components.map(renderShape) }, `${date}`);
|
|
521
444
|
};
|
|
522
445
|
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;
|