seat-editor 3.5.66 → 3.6.1
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/new-board/page.js +18 -1
- package/dist/app/new-board/page.jsx +18 -1
- package/dist/components/button-radio/index.d.ts +11 -0
- package/dist/components/button-radio/index.js +22 -0
- package/dist/components/button-radio/index.jsx +25 -0
- package/dist/components/form-tools/label.js +20 -2
- package/dist/components/form-tools/label.jsx +30 -2
- package/dist/components/layer-v3/index.d.ts +9 -1
- package/dist/components/layer-v3/index.js +65 -95
- package/dist/components/layer-v3/index.jsx +79 -115
- package/dist/components/layer-v4/constant.d.ts +16 -2
- package/dist/components/layer-v4/constant.js +57 -12
- package/dist/components/layer-v4/index.js +111 -188
- package/dist/components/layer-v4/index.jsx +124 -215
- package/dist/components/modal-preview/index.d.ts +3 -1
- package/dist/components/modal-preview/index.js +12 -2
- package/dist/components/modal-preview/index.jsx +13 -3
- package/dist/dto/table.d.ts +5 -0
- package/dist/features/board-v3/board-slice.d.ts +2 -1
- package/dist/features/board-v3/board-slice.js +4 -1
- package/dist/features/board-v3/constant.d.ts +5 -1
- package/dist/features/board-v3/constant.js +23 -1
- package/dist/features/board-v3/icons.d.ts +1 -0
- package/dist/features/board-v3/icons.js +3 -0
- package/dist/features/board-v3/icons.jsx +7 -0
- package/dist/features/board-v3/index.d.ts +6 -1
- package/dist/features/board-v3/index.js +63 -49
- package/dist/features/board-v3/index.jsx +116 -68
- package/dist/features/board-v3/utils.js +48 -28
- package/dist/features/package/index.d.ts +5 -0
- package/dist/features/package/index.js +1 -1
- package/dist/features/package/index.jsx +2 -2
- package/dist/features/panel/index.js +2 -2
- package/dist/features/panel/index.jsx +2 -2
- package/dist/features/panel/selected-group.js +2 -2
- package/dist/features/panel/selected-group.jsx +4 -2
- package/dist/features/side-tool/icons.d.ts +1 -0
- package/dist/features/side-tool/icons.js +2 -0
- package/dist/features/side-tool/icons.jsx +6 -0
- package/dist/features/side-tool/index.d.ts +6 -1
- package/dist/features/side-tool/index.js +31 -3
- package/dist/features/side-tool/index.jsx +32 -16
- package/dist/features/side-tool/side-tool-slice.d.ts +2 -0
- package/dist/features/side-tool/side-tool-slice.js +8 -1
- package/dist/features/view-only-3/index.js +0 -21
- package/dist/features/view-only-3/index.jsx +0 -21
- package/dist/provider/antd-provider.js +5 -2
- package/dist/provider/antd-provider.jsx +5 -2
- package/package.json +1 -1
|
@@ -17,13 +17,23 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
17
17
|
}, [selectedGroup, selectedComponent]);
|
|
18
18
|
const renderShape = (item) => {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
|
-
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, points, seatPositions, radius = 0, } = item;
|
|
20
|
+
const { id, x, y, width, height, fill, opacity, rotation = 0, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, label, seatFill, src, points, seatPositions, radius = 0, horizontalAlign, verticalAlign, } = item;
|
|
21
21
|
const commonProps = {
|
|
22
22
|
fill,
|
|
23
23
|
opacity,
|
|
24
24
|
stroke,
|
|
25
25
|
strokeWidth,
|
|
26
26
|
};
|
|
27
|
+
const labelProps = {
|
|
28
|
+
labels,
|
|
29
|
+
id,
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
commonProps,
|
|
33
|
+
horizontalAlign,
|
|
34
|
+
verticalAlign,
|
|
35
|
+
rotation,
|
|
36
|
+
};
|
|
27
37
|
if (allSelectionId === null || allSelectionId === void 0 ? void 0 : allSelectionId.includes(id)) {
|
|
28
38
|
commonProps.stroke = "#ffa39e";
|
|
29
39
|
commonProps.strokeWidth = 4;
|
|
@@ -38,18 +48,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
38
48
|
<g transform={`rotate(${rotation}, 0, 0)`}>
|
|
39
49
|
<rect {...commonProps} key={id} width={width} height={height} rx={radius}/>
|
|
40
50
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
41
|
-
|
|
42
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
44
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
45
|
-
return (<text {...omit(commonProps, [
|
|
46
|
-
"opacity",
|
|
47
|
-
"stroke",
|
|
48
|
-
"strokeWidth",
|
|
49
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
50
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
51
|
-
</text>);
|
|
52
|
-
})}
|
|
51
|
+
<LabelItem {...labelProps}/>
|
|
53
52
|
</g>
|
|
54
53
|
</g>
|
|
55
54
|
</g>);
|
|
@@ -80,18 +79,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
80
79
|
</>);
|
|
81
80
|
})}
|
|
82
81
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${centerX}, ${centerY}) translate(${box === null || box === void 0 ? void 0 : box.x}, ${box === null || box === void 0 ? void 0 : box.y})`}>
|
|
83
|
-
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
85
|
-
const cx = (box === null || box === void 0 ? void 0 : box.width) / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
86
|
-
const cy = (box === null || box === void 0 ? void 0 : box.height) / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
87
|
-
return (<text {...omit(commonProps, [
|
|
88
|
-
"opacity",
|
|
89
|
-
"stroke",
|
|
90
|
-
"strokeWidth",
|
|
91
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={(box === null || box === void 0 ? void 0 : box.width) / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={(box === null || box === void 0 ? void 0 : box.height) / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
92
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
93
|
-
</text>);
|
|
94
|
-
})}
|
|
82
|
+
<LabelItem {...labelProps}/>
|
|
95
83
|
</g>
|
|
96
84
|
</g>
|
|
97
85
|
</g>);
|
|
@@ -117,18 +105,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
117
105
|
<g transform={`rotate(${rotation}, 0, 0)`}>
|
|
118
106
|
<circle key={id} cx={width / 2} cy={height / 2} r={Math.min(height, width) / 2} fill={fill} {...commonProps}/>
|
|
119
107
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
120
|
-
|
|
121
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
122
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
123
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
124
|
-
return (<text {...omit(commonProps, [
|
|
125
|
-
"opacity",
|
|
126
|
-
"stroke",
|
|
127
|
-
"strokeWidth",
|
|
128
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
129
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
130
|
-
</text>);
|
|
131
|
-
})}
|
|
108
|
+
<LabelItem {...labelProps}/>
|
|
132
109
|
</g>
|
|
133
110
|
</g>
|
|
134
111
|
</g>);
|
|
@@ -169,18 +146,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
169
146
|
</g>
|
|
170
147
|
|
|
171
148
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
172
|
-
|
|
173
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
174
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
175
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
176
|
-
return (<text {...omit(commonProps, [
|
|
177
|
-
"opacity",
|
|
178
|
-
"stroke",
|
|
179
|
-
"strokeWidth",
|
|
180
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
181
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
182
|
-
</text>);
|
|
183
|
-
})}
|
|
149
|
+
<LabelItem {...labelProps}/>
|
|
184
150
|
</g>
|
|
185
151
|
</g>
|
|
186
152
|
</g>);
|
|
@@ -276,18 +242,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
276
242
|
{seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (<rect x={x} y={y} key={`${id}-seat-${i}`} id={`seat-${id}`} height={height} width={width} rx={radius / 4} fill={seatFill}/>))}
|
|
277
243
|
</g>
|
|
278
244
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
279
|
-
|
|
280
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
281
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
282
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
283
|
-
return (<text {...omit(commonProps, [
|
|
284
|
-
"opacity",
|
|
285
|
-
"stroke",
|
|
286
|
-
"strokeWidth",
|
|
287
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
288
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
289
|
-
</text>);
|
|
290
|
-
})}
|
|
245
|
+
<LabelItem {...labelProps}/>
|
|
291
246
|
</g>
|
|
292
247
|
</g>
|
|
293
248
|
</g>);
|
|
@@ -355,18 +310,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
355
310
|
{[...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}/>))}
|
|
356
311
|
</g>
|
|
357
312
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
358
|
-
|
|
359
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
360
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
361
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
362
|
-
return (<text {...omit(commonProps, [
|
|
363
|
-
"opacity",
|
|
364
|
-
"stroke",
|
|
365
|
-
"strokeWidth",
|
|
366
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
367
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
368
|
-
</text>);
|
|
369
|
-
})}
|
|
313
|
+
<LabelItem {...labelProps}/>
|
|
370
314
|
</g>
|
|
371
315
|
</g>
|
|
372
316
|
</g>);
|
|
@@ -433,22 +377,11 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
433
377
|
<g transform={`rotate(${rotation}, 0, 0)`}>
|
|
434
378
|
{/* Seats */}
|
|
435
379
|
<rect width={width} height={height} rx={radius} {...commonProps} fill={fill}/>
|
|
436
|
-
<g key={`${id}-seats`} data-seat={`${id}-seats`}>
|
|
380
|
+
<g key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${0}, ${0})`}>
|
|
437
381
|
{seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill={seatFill}/>))}
|
|
438
382
|
</g>
|
|
439
383
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
440
|
-
|
|
441
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
442
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
443
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
444
|
-
return (<text {...omit(commonProps, [
|
|
445
|
-
"opacity",
|
|
446
|
-
"stroke",
|
|
447
|
-
"strokeWidth",
|
|
448
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
449
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
450
|
-
</text>);
|
|
451
|
-
})}
|
|
384
|
+
<LabelItem {...labelProps}/>
|
|
452
385
|
</g>
|
|
453
386
|
</g>
|
|
454
387
|
</g>);
|
|
@@ -543,18 +476,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
543
476
|
{seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (<rect x={x} y={y} key={`${id}-seat-${i}`} id={`seat-${id}`} height={height} width={width} rx={radius / 4} fill={seatFill}/>))}
|
|
544
477
|
</g>
|
|
545
478
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
546
|
-
|
|
547
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
548
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
549
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
550
|
-
return (<text {...omit(commonProps, [
|
|
551
|
-
"opacity",
|
|
552
|
-
"stroke",
|
|
553
|
-
"strokeWidth",
|
|
554
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
555
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
556
|
-
</text>);
|
|
557
|
-
})}
|
|
479
|
+
<LabelItem {...labelProps}/>
|
|
558
480
|
</g>
|
|
559
481
|
</g>
|
|
560
482
|
</g>);
|
|
@@ -574,6 +496,15 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
574
496
|
</g>
|
|
575
497
|
</g>);
|
|
576
498
|
case "image-table":
|
|
499
|
+
return (<g key={id} id={`${id}`} data-id={id} transform={`translate(${x}, ${y})`}>
|
|
500
|
+
<g transform={`rotate(${rotation}, 0, 0)`}>
|
|
501
|
+
<image href={src} width={width} height={height}/>
|
|
502
|
+
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
503
|
+
<LabelItem {...labelProps}/>
|
|
504
|
+
</g>
|
|
505
|
+
<rect width={width} height={height} fill="transparent" opacity={opacity} {...omit(commonProps, ["fill", "opacity"])}/>
|
|
506
|
+
</g>
|
|
507
|
+
</g>);
|
|
577
508
|
case "background":
|
|
578
509
|
return (<g key={id} id={`${id}`} data-id={id} transform={`translate(${x}, ${y})`} style={{
|
|
579
510
|
pointerEvents: lockBackground ? "none" : "auto",
|
|
@@ -581,18 +512,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
581
512
|
<g transform={`rotate(${rotation}, 0, 0)`}>
|
|
582
513
|
<image href={src} width={width} height={height}/>
|
|
583
514
|
<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
|
|
584
|
-
|
|
585
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
586
|
-
const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
|
|
587
|
-
const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
|
|
588
|
-
return (<text {...omit(commonProps, [
|
|
589
|
-
"opacity",
|
|
590
|
-
"stroke",
|
|
591
|
-
"strokeWidth",
|
|
592
|
-
])} transform={`rotate(${(_c = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _c !== void 0 ? _c : 0}, ${cx},${cy})`} key={`${id}-label-${index}`} x={width / 2 + ((_d = _ === null || _ === void 0 ? void 0 : _.x) !== null && _d !== void 0 ? _d : 0)} y={height / 2 + ((_e = _ === null || _ === void 0 ? void 0 : _.y) !== null && _e !== void 0 ? _e : 0)} fill={(_f = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _f !== void 0 ? _f : "black"} fontSize={`${(_g = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _g !== void 0 ? _g : 10}px`} fontWeight="bold" textAnchor="middle" dominantBaseline="middle">
|
|
593
|
-
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
594
|
-
</text>);
|
|
595
|
-
})}
|
|
515
|
+
<LabelItem {...labelProps}/>
|
|
596
516
|
</g>
|
|
597
517
|
<rect width={width} height={height} fill="transparent" opacity={opacity} {...omit(commonProps, ["fill", "opacity"])}/>
|
|
598
518
|
</g>
|
|
@@ -632,10 +552,6 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
632
552
|
};
|
|
633
553
|
// let date = new Date();
|
|
634
554
|
const nodesRaw = rectToPolygonNodes(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.width, selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.height);
|
|
635
|
-
// const nodesRawNew = rectToPolygonNodes(
|
|
636
|
-
// selectionLinesPoints?.width,
|
|
637
|
-
// selectionLinesPoints?.height
|
|
638
|
-
// );
|
|
639
555
|
return (<g key={`${selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id}`} id="selection-layer">
|
|
640
556
|
{components === null || components === void 0 ? void 0 : components.map(renderShape)}
|
|
641
557
|
{!isEmpty(selectionLines) && activeTool === "select" && (<>
|
|
@@ -691,11 +607,59 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
|
|
|
691
607
|
return (<React.Fragment key={`corner-${index}`}>
|
|
692
608
|
<circle data-position={corner(index)} key={`circle-${index}`} r={5} cx={node.x} cy={node.y} fill="transparent" style={{ cursor: "pointer" }}/>
|
|
693
609
|
<circle data-position={corner(index)} key={`circle-${index}`} r={5} cx={node.x} cy={node.y} fill="#4a90e2" id={`circle-corner-${selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id}`} style={{ cursor: "pointer" }}/>
|
|
694
|
-
|
|
610
|
+
</React.Fragment>);
|
|
695
611
|
}))}
|
|
696
612
|
</g>
|
|
697
613
|
</g>
|
|
698
614
|
</>)}
|
|
699
615
|
</g>);
|
|
700
616
|
};
|
|
617
|
+
export const LabelItem = ({ id, width, height, labels, commonProps, rotation = 0, }) => {
|
|
618
|
+
// const getEffectiveDimensions = (width: number, height: number, rotation: number) => {
|
|
619
|
+
// const rad = (rotation * Math.PI) / 180;
|
|
620
|
+
// const cos = Math.abs(Math.cos(rad));
|
|
621
|
+
// const sin = Math.abs(Math.sin(rad));
|
|
622
|
+
// return {
|
|
623
|
+
// effectiveWidth: width * cos + height * sin,
|
|
624
|
+
// effectiveHeight: width * sin + height * cos,
|
|
625
|
+
// };
|
|
626
|
+
// };
|
|
627
|
+
const PADDING = 0;
|
|
628
|
+
const getX = (labelX = 0, horizontalAlign = "middle") => {
|
|
629
|
+
// const { effectiveWidth } = getEffectiveDimensions(width, height, rotation);
|
|
630
|
+
if (horizontalAlign === "start")
|
|
631
|
+
return PADDING + labelX;
|
|
632
|
+
if (horizontalAlign === "end")
|
|
633
|
+
return width - PADDING + labelX;
|
|
634
|
+
return width / 2 + labelX;
|
|
635
|
+
};
|
|
636
|
+
const getY = (labelY = 0, verticalAlign = "middle") => {
|
|
637
|
+
// const { effectiveHeight } = getEffectiveDimensions(width, height, rotation);
|
|
638
|
+
if (verticalAlign === "hanging")
|
|
639
|
+
return PADDING + labelY;
|
|
640
|
+
if (verticalAlign === "auto")
|
|
641
|
+
return height - PADDING + labelY;
|
|
642
|
+
return height / 2 + labelY;
|
|
643
|
+
};
|
|
644
|
+
const textAnchorMap = {
|
|
645
|
+
start: "start",
|
|
646
|
+
middle: "middle",
|
|
647
|
+
end: "end",
|
|
648
|
+
};
|
|
649
|
+
const dominantBaselineMap = {
|
|
650
|
+
hanging: "hanging",
|
|
651
|
+
middle: "middle",
|
|
652
|
+
bottom: "auto",
|
|
653
|
+
};
|
|
654
|
+
return (<>
|
|
655
|
+
{labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
|
|
656
|
+
var _a, _b, _c, _d, _e;
|
|
657
|
+
const x = getX(_ === null || _ === void 0 ? void 0 : _.x, _ === null || _ === void 0 ? void 0 : _.horizontalAlign);
|
|
658
|
+
const y = getY(_ === null || _ === void 0 ? void 0 : _.y, _ === null || _ === void 0 ? void 0 : _.verticalAlign);
|
|
659
|
+
return (<text {...omit(commonProps, ["opacity", "stroke", "strokeWidth"])} transform={`rotate(${(_a = _ === null || _ === void 0 ? void 0 : _.rotation) !== null && _a !== void 0 ? _a : 0}, ${x}, ${y})`} key={`${id}-label-${index}`} x={x} y={y} fill={(_b = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _b !== void 0 ? _b : "black"} fontSize={`${(_c = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _c !== void 0 ? _c : 10}px`} fontWeight="bold" textAnchor={textAnchorMap[(_d = _ === null || _ === void 0 ? void 0 : _.horizontalAlign) !== null && _d !== void 0 ? _d : "middle"]} dominantBaseline={dominantBaselineMap[(_e = _ === null || _ === void 0 ? void 0 : _.verticalAlign) !== null && _e !== void 0 ? _e : "middle"]}>
|
|
660
|
+
{_ === null || _ === void 0 ? void 0 : _.label}
|
|
661
|
+
</text>);
|
|
662
|
+
})}
|
|
663
|
+
</>);
|
|
664
|
+
};
|
|
701
665
|
export default Layers;
|
|
@@ -6,8 +6,8 @@ export declare const tagsDummy: (name: string, icon: string) => ({
|
|
|
6
6
|
value: string;
|
|
7
7
|
}[];
|
|
8
8
|
direction: string;
|
|
9
|
+
offsetY: string;
|
|
9
10
|
offsetX?: undefined;
|
|
10
|
-
offsetY?: undefined;
|
|
11
11
|
} | {
|
|
12
12
|
gap: string;
|
|
13
13
|
key: string;
|
|
@@ -38,7 +38,6 @@ export declare const tagsDummy: (name: string, icon: string) => ({
|
|
|
38
38
|
value: string;
|
|
39
39
|
symbol: {
|
|
40
40
|
value: string;
|
|
41
|
-
gap: number;
|
|
42
41
|
position: string;
|
|
43
42
|
};
|
|
44
43
|
fontWeight?: undefined;
|
|
@@ -47,6 +46,17 @@ export declare const tagsDummy: (name: string, icon: string) => ({
|
|
|
47
46
|
direction: string;
|
|
48
47
|
offsetY: number;
|
|
49
48
|
offsetX?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
gap: string;
|
|
51
|
+
key: string;
|
|
52
|
+
items: {
|
|
53
|
+
type: string;
|
|
54
|
+
value: string;
|
|
55
|
+
fontWeight: string;
|
|
56
|
+
}[];
|
|
57
|
+
offsetY: string;
|
|
58
|
+
direction: string;
|
|
59
|
+
offsetX?: undefined;
|
|
50
60
|
})[];
|
|
51
61
|
export declare const PRIVILEGED_TAGS: {
|
|
52
62
|
CURRENT_TIME: {
|
|
@@ -57,4 +67,8 @@ export declare const PRIVILEGED_TAGS: {
|
|
|
57
67
|
key: string;
|
|
58
68
|
items: string[];
|
|
59
69
|
}[];
|
|
70
|
+
POS_VIEW: {
|
|
71
|
+
key: string;
|
|
72
|
+
items: string[];
|
|
73
|
+
}[];
|
|
60
74
|
};
|
|
@@ -13,6 +13,7 @@ export const tagsDummy = (name, icon) => [
|
|
|
13
13
|
},
|
|
14
14
|
],
|
|
15
15
|
direction: "column",
|
|
16
|
+
offsetY: "5",
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
gap: "8",
|
|
@@ -50,23 +51,53 @@ export const tagsDummy = (name, icon) => [
|
|
|
50
51
|
value: "22:00",
|
|
51
52
|
symbol: {
|
|
52
53
|
value: "+1",
|
|
53
|
-
gap: 1,
|
|
54
|
+
// gap: 1,
|
|
54
55
|
position: "right-top"
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
|
-
// as Position, // right | right-top | right-bottom | left | left-top | left-bottom | top | bottom
|
|
58
|
-
// {
|
|
59
|
-
// type: "text",
|
|
60
|
-
// value: "23:00",
|
|
61
|
-
// symbol: {
|
|
62
|
-
// value: "+1",
|
|
63
|
-
// gap: 1,
|
|
64
|
-
// position: "right-top" as Position, // right | right-top | right-bottom | left | left-top | left-bottom | top | bottom
|
|
65
|
-
// },
|
|
66
|
-
// },
|
|
67
58
|
],
|
|
68
59
|
direction: "column",
|
|
69
|
-
offsetY: -
|
|
60
|
+
offsetY: -10,
|
|
61
|
+
},
|
|
62
|
+
//POST TYPE
|
|
63
|
+
{
|
|
64
|
+
gap: "0",
|
|
65
|
+
key: "table_name",
|
|
66
|
+
items: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
value: name,
|
|
70
|
+
fontWeight: "bold"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
offsetY: "0",
|
|
74
|
+
direction: "column",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
gap: "0",
|
|
78
|
+
key: "pax_pos",
|
|
79
|
+
items: [
|
|
80
|
+
{
|
|
81
|
+
type: "text",
|
|
82
|
+
value: "8",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
offsetX: "0",
|
|
86
|
+
offsetY: "0",
|
|
87
|
+
direction: "column",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
gap: "0",
|
|
91
|
+
key: "price",
|
|
92
|
+
items: [
|
|
93
|
+
{
|
|
94
|
+
type: "text",
|
|
95
|
+
value: "11.000K",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
offsetX: "0",
|
|
99
|
+
offsetY: "0",
|
|
100
|
+
direction: "column",
|
|
70
101
|
},
|
|
71
102
|
];
|
|
72
103
|
export const PRIVILEGED_TAGS = {
|
|
@@ -90,4 +121,18 @@ export const PRIVILEGED_TAGS = {
|
|
|
90
121
|
items: ["text"],
|
|
91
122
|
},
|
|
92
123
|
],
|
|
124
|
+
POS_VIEW: [
|
|
125
|
+
{
|
|
126
|
+
key: "table_name",
|
|
127
|
+
items: ["text"],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "pax_pos",
|
|
131
|
+
items: ["text"],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: "price",
|
|
135
|
+
items: ["text"],
|
|
136
|
+
},
|
|
137
|
+
]
|
|
93
138
|
};
|