seat-editor 3.6.6 → 3.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/app/graph-view/page.d.ts +1 -1
  2. package/dist/app/graph-view-new/page.d.ts +1 -1
  3. package/dist/app/graph-view-new/page.js +100 -12
  4. package/dist/app/graph-view-new/page.jsx +105 -19
  5. package/dist/app/graph-view-new/test.d.ts +0 -0
  6. package/dist/app/graph-view-new/test.js +0 -0
  7. package/dist/app/graph-view-new/test.jsx +0 -0
  8. package/dist/app/layout.d.ts +1 -1
  9. package/dist/app/new-board/page.d.ts +1 -1
  10. package/dist/app/new-board/page.js +1 -1
  11. package/dist/app/new-board/page.jsx +1 -1
  12. package/dist/app/old-board/page.d.ts +1 -2
  13. package/dist/app/only-view/chair.d.ts +1 -1
  14. package/dist/app/only-view/chair.js +2 -10
  15. package/dist/app/only-view/page.d.ts +1 -1
  16. package/dist/app/only-view/user.d.ts +1 -1
  17. package/dist/app/only-view/user.js +2 -10
  18. package/dist/app/page.d.ts +1 -1
  19. package/dist/app/test/page.d.ts +1 -2
  20. package/dist/app/v2/page.d.ts +1 -1
  21. package/dist/components/button-radio/index.d.ts +1 -1
  22. package/dist/components/button-tools/index.d.ts +1 -1
  23. package/dist/components/form-tools/label.d.ts +1 -1
  24. package/dist/components/form-tools/shape.d.ts +2 -2
  25. package/dist/components/icons/camera.d.ts +1 -2
  26. package/dist/components/icons/circle.d.ts +1 -2
  27. package/dist/components/icons/square.d.ts +1 -2
  28. package/dist/components/icons/type-1.d.ts +1 -2
  29. package/dist/components/icons/type-2.d.ts +1 -2
  30. package/dist/components/icons/type-3.d.ts +1 -2
  31. package/dist/components/icons/type-4.d.ts +1 -2
  32. package/dist/components/icons/type-5.d.ts +1 -2
  33. package/dist/components/input/number-indicator.d.ts +1 -1
  34. package/dist/components/joystick/index.d.ts +1 -2
  35. package/dist/components/layer/index.d.ts +1 -1
  36. package/dist/components/layer-v2/index.d.ts +1 -1
  37. package/dist/components/layer-v3/index.d.ts +2 -3
  38. package/dist/components/layer-v4/index.d.ts +1 -1
  39. package/dist/components/layer-v5/icons.d.ts +1 -0
  40. package/dist/components/layer-v5/icons.js +2 -0
  41. package/dist/components/layer-v5/icons.jsx +3 -0
  42. package/dist/components/layer-v5/index.d.ts +4 -1
  43. package/dist/components/layer-v5/index.js +203 -228
  44. package/dist/components/layer-v5/index.jsx +234 -272
  45. package/dist/components/lib/index.d.ts +1 -1
  46. package/dist/components/modal-preview/index.d.ts +1 -1
  47. package/dist/features/board/index.d.ts +1 -1
  48. package/dist/features/board-v2/index.d.ts +1 -2
  49. package/dist/features/board-v3/icons.d.ts +1 -1
  50. package/dist/features/board-v3/index.d.ts +2 -2
  51. package/dist/features/board-v3/index.js +3 -3
  52. package/dist/features/board-v3/index.jsx +3 -3
  53. package/dist/features/navbar/index.d.ts +1 -1
  54. package/dist/features/package/index.d.ts +2 -2
  55. package/dist/features/package/index.js +1 -1
  56. package/dist/features/package/index.jsx +2 -2
  57. package/dist/features/panel/index.d.ts +1 -1
  58. package/dist/features/panel/polygon.d.ts +1 -1
  59. package/dist/features/panel/select-tool.d.ts +1 -1
  60. package/dist/features/panel/selected-group.d.ts +1 -1
  61. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  62. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  63. package/dist/features/panel/table-seat-square.d.ts +1 -1
  64. package/dist/features/panel/text-tool.d.ts +1 -1
  65. package/dist/features/panel/upload-group-tool.d.ts +1 -1
  66. package/dist/features/panel/upload-tool.d.ts +1 -1
  67. package/dist/features/side-tool/icons.d.ts +1 -1
  68. package/dist/features/side-tool/index.d.ts +3 -3
  69. package/dist/features/side-tool/index.js +2 -2
  70. package/dist/features/side-tool/index.jsx +2 -2
  71. package/dist/features/view-only/index.d.ts +1 -1
  72. package/dist/features/view-only-2/index.d.ts +1 -1
  73. package/dist/features/view-only-3/index.d.ts +1 -1
  74. package/dist/features/view-only-4/index.d.ts +1 -1
  75. package/dist/features/view-only-5/connect-handle.d.ts +7 -0
  76. package/dist/features/view-only-5/connect-handle.js +10 -7
  77. package/dist/features/view-only-5/connect-handle.jsx +11 -7
  78. package/dist/features/view-only-5/connection-layer.d.ts +0 -1
  79. package/dist/features/view-only-5/connection-layer.js +7 -5
  80. package/dist/features/view-only-5/connection-layer.jsx +7 -5
  81. package/dist/features/view-only-5/index.d.ts +14 -5
  82. package/dist/features/view-only-5/index.js +168 -123
  83. package/dist/features/view-only-5/index.jsx +169 -124
  84. package/dist/features/view-only-5/use-connection-graph.js +1 -1
  85. package/dist/features/view-only-5/utils.d.ts +7 -1
  86. package/dist/features/view-only-5/utils.js +15 -7
  87. package/dist/features/view-only-6/index.d.ts +1 -1
  88. package/dist/features/view-only-7/index.d.ts +1 -1
  89. package/dist/provider/redux-provider.d.ts +1 -1
  90. package/dist/provider/store-provider.d.ts +1 -1
  91. package/package.json +1 -1
@@ -1,164 +1,193 @@
1
1
  "use client";
2
2
  import { isEmpty, omit } from "lodash";
3
- import { arcByDirection, distributeWithSpacing } from "../layer-v3/utils";
4
- import { PRIVILEGED_TAGS, tagsDummy } from "./constant";
5
- import { useAppSelector } from "../../hooks/use-redux";
6
- import { RsvpIcons } from "../../features/board-v3/icons";
3
+ import { arcByDirection, distributeWithSpacing, rectToPolygonNodes, } from "../layer-v3/utils";
4
+ // import { RsvpIcons } from "../../features/board-v3/icons";
7
5
  import { getBoundingBoxFromPoints } from "../layer-v3/utils";
6
+ import { LabelItem } from "../layer-v3";
7
+ import { TrashIcon } from "lucide-react";
8
+ import React from "react";
8
9
  const toKebabCase = (str) => str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
9
- const iconNames = [
10
- "upcoming",
11
- "late",
12
- "overtime",
13
- "overlapping",
14
- "hold",
15
- "reserved",
16
- "armchair",
17
- "cheque",
18
- "people",
19
- ];
20
- const dummyIconTags = iconNames === null || iconNames === void 0 ? void 0 : iconNames.map((item) => {
21
- const Icon = RsvpIcons === null || RsvpIcons === void 0 ? void 0 : RsvpIcons[item];
22
- return {
23
- key: item,
24
- icon: <Icon />,
25
- };
26
- });
27
- const getIconFromId = (data) => {
28
- const id = String(data);
29
- let hash = 0;
30
- for (let i = 0; i < id.length; i++) {
31
- hash += id.charCodeAt(i);
32
- }
33
- return iconNames[hash % iconNames.length];
34
- };
35
- const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, privilegedTags = [], }) => {
36
- const { isShowTagType } = useAppSelector((state) => state.board);
37
- const showLabels = !["type-1", "type-2"].includes(isShowTagType) && !iconTags;
10
+ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, selectionLines, }) => {
11
+ // const { isShowTagType } = useAppSelector((state) => state.board);
38
12
  const renderShape = (item) => {
39
- var _a, _b, _c, _d, _e, _f, _g;
40
- const { id, x, y, width, height, fill, opacity, rotate = 0, rotation, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, seatFill, src, tags, gapTags, label, points, seatPositions, radius, } = item;
41
- const fontSizeFromLabel = (_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.fontSize;
42
- const renderTags = (data) => {
43
- var _a;
44
- const tags = data !== null && data !== void 0 ? data : tagsDummy(((_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.label) || "Table", getIconFromId(id));
45
- const privileged = !isEmpty(privilegedTags)
46
- ? privilegedTags
47
- : isShowTagType === "type-1"
48
- ? PRIVILEGED_TAGS["CURRENT_TIME"]
49
- : isShowTagType === "type-2"
50
- ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"]
51
- : undefined;
52
- if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
53
- const scaleDefault = Number(fontSize || fontSizeFromLabel || 12) / 12;
54
- const gapBetweenTags = Number(gapTags || 20) * scaleDefault;
55
- const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
56
- // Hitung total tinggi semua grup tag (buat center vertikal)
57
- const totalTagHeight = (tags === null || tags === void 0 ? void 0 : tags.filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key)).reduce((sum, tag) => {
58
- var _a;
59
- const items = tag.items || [];
60
- const isColumn = (_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column");
61
- const tagHeight = isColumn
62
- ? items.length * defaultFontSize + 2 * (Number(tag.gap) || 2)
63
- : defaultFontSize; // horizontal = 1 line
64
- return sum + tagHeight + gapBetweenTags;
65
- }, 0)) - gapBetweenTags;
66
- const startY = Number(height) / 4 - totalTagHeight / 3; // titik awal supaya semua di tengah
67
- let currentY = startY;
68
- return tags
69
- .filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key))
70
- .map((tag, tagIndex) => {
71
- var _a;
72
- const itemsPriv = privileged[tagIndex].items;
73
- const direction = ((_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column"))
74
- ? "column"
75
- : "flex";
76
- const gap = Number(tag.gap || 2) * scaleDefault;
77
- const items = tag.items || [];
78
- const fontSize = Number(defaultFontSize);
79
- const isColumn = direction === "column";
80
- const groupHeight = isColumn
81
- ? items.length * fontSize + 2 * gap
82
- : fontSize;
83
- const centerX = width / 2;
84
- const centerY = currentY + groupHeight;
85
- // naikkan posisi Y untuk grup berikutnya
86
- currentY += groupHeight + gapBetweenTags;
87
- const elements = items
88
- .filter((item) => itemsPriv.includes(item.type))
89
- .map((item, i) => {
90
- var _a, _b;
91
- const offsetY = isColumn
92
- ? i * (fontSize + gap) - groupHeight / 2 + fontSize / 2
93
- : 0;
94
- const offsetX = !isColumn
95
- ? i * (fontSize + gap) - (1 * (fontSize + gap)) / 2
96
- : 0;
97
- const posX = centerX + offsetX + Number((_a = tag.offsetX) !== null && _a !== void 0 ? _a : 0);
98
- const posY = centerY + offsetY + Number((_b = tag.offsetY) !== null && _b !== void 0 ? _b : 0);
99
- const renderSymbol = (symbol) => {
100
- if (!symbol)
101
- return null;
102
- const { position = "right", size = (item === null || item === void 0 ? void 0 : item.fontSize) || Number(fontSize), gap: symbolGap = 0, } = symbol;
103
- const sizeFont = (item === null || item === void 0 ? void 0 : item.fontSize) || Number(fontSize) / 3;
104
- let offsetSymbolX = 0;
105
- let offsetSymbolY = 0;
106
- switch (position) {
107
- case "right":
108
- offsetSymbolX = size + symbolGap;
109
- break;
110
- case "left":
111
- offsetSymbolX = -(size + symbolGap);
112
- break;
113
- case "top":
114
- offsetSymbolY = -(size + symbolGap);
115
- break;
116
- case "bottom":
117
- offsetSymbolY = size + symbolGap;
118
- break;
119
- case "right-top":
120
- offsetSymbolX = size + symbolGap;
121
- offsetSymbolY = -(size / 4);
122
- break;
123
- case "right-bottom":
124
- offsetSymbolX = size + symbolGap;
125
- offsetSymbolY = size / 4;
126
- break;
127
- case "left-top":
128
- offsetSymbolX = -size - symbolGap;
129
- offsetSymbolY = -(size / 4);
130
- break;
131
- case "left-bottom":
132
- offsetSymbolX = -size - symbolGap;
133
- offsetSymbolY = size / 4;
134
- break;
135
- }
136
- return (<tspan {...symbol} key={`symbol-${tagIndex}-${i}`} x={posX + offsetSymbolX} y={posY + offsetSymbolY} textAnchor="middle" dominantBaseline="middle" fontSize={`${sizeFont}px`}>
137
- {symbol.value}
138
- </tspan>);
139
- };
140
- if (item.type === "icon") {
141
- const icons = iconTags !== null && iconTags !== void 0 ? iconTags : dummyIconTags;
142
- const iconTag = icons === null || icons === void 0 ? void 0 : icons.find((icon) => icon.key === item.value);
143
- if (!iconTag)
144
- return null;
145
- const scale = defaultFontSize / 12;
146
- return (<g {...item} key={`icon-${tagIndex}-${i}`} transform={`translate(${posX - defaultFontSize}, ${posY - defaultFontSize / 2}) scale(${scale})`}>
147
- {iconTag.icon}
148
- </g>);
149
- }
150
- if (item.type === "text") {
151
- return (<text {...item} key={`text-${tagIndex}-${i}`} x={posX} y={posY} textAnchor="middle" dominantBaseline="middle" fontSize={defaultFontSize}>
152
- {item.value} {renderSymbol(item === null || item === void 0 ? void 0 : item.symbol)}
153
- </text>);
154
- }
155
- return null;
156
- });
157
- return (<g key={`group-${tagIndex}`} pointerEvents="none">
158
- {elements}
159
- </g>);
160
- });
161
- }
13
+ var _a, _b, _c, _d, _e, _f;
14
+ const { id, x, y, width, height, fill, opacity, rotate = 0, rotation, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, seatFill, src, tags, points, seatPositions, radius, element, } = item;
15
+ const showLabels = !element;
16
+ // const fontSizeFromLabel = labels?.[0]?.fontSize;
17
+ // const renderTags = (data) => {
18
+ // const tags =
19
+ // data ?? tagsDummy(labels?.[0]?.label || "Table", getIconFromId(id));
20
+ // const privileged = !isEmpty(privilegedTags)
21
+ // ? privilegedTags
22
+ // : isShowTagType === "type-1"
23
+ // ? PRIVILEGED_TAGS["CURRENT_TIME"]
24
+ // : isShowTagType === "type-2"
25
+ // ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"]
26
+ // : undefined;
27
+ // if (tags && tags?.length > 0) {
28
+ // const scaleDefault = Number(fontSize || fontSizeFromLabel || 12) / 12;
29
+ // const gapBetweenTags = Number(gapTags || 20) * scaleDefault;
30
+ // const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
31
+ // // Hitung total tinggi semua grup tag (buat center vertikal)
32
+ // const totalTagHeight =
33
+ // tags
34
+ // ?.filter((tag) => privileged?.find((p) => p.key === tag.key))
35
+ // .reduce((sum, tag) => {
36
+ // const items = tag.items || [];
37
+ // const isColumn = tag.direction?.includes("column");
38
+ // const tagHeight = isColumn
39
+ // ? items.length * defaultFontSize + 2 * (Number(tag.gap) || 2)
40
+ // : defaultFontSize; // horizontal = 1 line
41
+ // return sum + tagHeight + gapBetweenTags;
42
+ // }, 0) - gapBetweenTags;
43
+ // const startY = Number(height) / 4 - totalTagHeight / 3; // titik awal supaya semua di tengah
44
+ // let currentY = startY;
45
+ // return tags
46
+ // .filter((tag) => privileged?.find((p) => p.key === tag.key))
47
+ // .map((tag: Tag, tagIndex: number) => {
48
+ // const itemsPriv = privileged[tagIndex].items;
49
+ // const direction = tag.direction?.includes("column")
50
+ // ? "column"
51
+ // : "flex";
52
+ // const gap = Number(tag.gap || 2) * scaleDefault;
53
+ // const items = tag.items || [];
54
+ // const fontSize = Number(defaultFontSize);
55
+ // const isColumn = direction === "column";
56
+ // const groupHeight = isColumn
57
+ // ? items.length * fontSize + 2 * gap
58
+ // : fontSize;
59
+ // const centerX = width / 2;
60
+ // const centerY = currentY + groupHeight;
61
+ // // naikkan posisi Y untuk grup berikutnya
62
+ // currentY += groupHeight + gapBetweenTags;
63
+ // const elements = items
64
+ // .filter((item) => itemsPriv.includes(item.type))
65
+ // .map((item: Item, i: number) => {
66
+ // const offsetY = isColumn
67
+ // ? i * (fontSize + gap) - groupHeight / 2 + fontSize / 2
68
+ // : 0;
69
+ // const offsetX = !isColumn
70
+ // ? i * (fontSize + gap) - (1 * (fontSize + gap)) / 2
71
+ // : 0;
72
+ // const posX = centerX + offsetX + Number(tag.offsetX ?? 0);
73
+ // const posY = centerY + offsetY + Number(tag.offsetY ?? 0);
74
+ // const renderSymbol = (symbol) => {
75
+ // if (!symbol) return null;
76
+ // const {
77
+ // position = "right",
78
+ // size = item?.fontSize || Number(fontSize),
79
+ // gap: symbolGap = 0,
80
+ // } = symbol;
81
+ // const sizeFont = item?.fontSize || Number(fontSize) / 3;
82
+ // let offsetSymbolX = 0;
83
+ // let offsetSymbolY = 0;
84
+ // switch (position) {
85
+ // case "right":
86
+ // offsetSymbolX = size + symbolGap;
87
+ // break;
88
+ // case "left":
89
+ // offsetSymbolX = -(size + symbolGap);
90
+ // break;
91
+ // case "top":
92
+ // offsetSymbolY = -(size + symbolGap);
93
+ // break;
94
+ // case "bottom":
95
+ // offsetSymbolY = size + symbolGap;
96
+ // break;
97
+ // case "right-top":
98
+ // offsetSymbolX = size + symbolGap;
99
+ // offsetSymbolY = -(size / 4);
100
+ // break;
101
+ // case "right-bottom":
102
+ // offsetSymbolX = size + symbolGap;
103
+ // offsetSymbolY = size / 4;
104
+ // break;
105
+ // case "left-top":
106
+ // offsetSymbolX = -size - symbolGap;
107
+ // offsetSymbolY = -(size / 4);
108
+ // break;
109
+ // case "left-bottom":
110
+ // offsetSymbolX = -size - symbolGap;
111
+ // offsetSymbolY = size / 4;
112
+ // break;
113
+ // }
114
+ // return (
115
+ // <tspan
116
+ // {...symbol}
117
+ // key={`symbol-${tagIndex}-${i}`}
118
+ // x={posX + offsetSymbolX}
119
+ // y={posY + offsetSymbolY}
120
+ // textAnchor="middle"
121
+ // dominantBaseline="middle"
122
+ // fontSize={`${sizeFont}px`}
123
+ // >
124
+ // {symbol.value}
125
+ // </tspan>
126
+ // );
127
+ // };
128
+ // if (item.type === "icon") {
129
+ // const icons = iconTags ?? dummyIconTags;
130
+ // const iconTag = icons?.find(
131
+ // (icon) => icon.key === item.value
132
+ // );
133
+ // if (!iconTag) return null;
134
+ // const scale = defaultFontSize / 12;
135
+ // return (
136
+ // <g
137
+ // {...item}
138
+ // key={`icon-${tagIndex}-${i}`}
139
+ // transform={`translate(${posX - defaultFontSize}, ${
140
+ // posY - defaultFontSize / 2
141
+ // }) scale(${scale})`}
142
+ // >
143
+ // {iconTag.icon}
144
+ // </g>
145
+ // );
146
+ // }
147
+ // if (item.type === "text") {
148
+ // return (
149
+ // <text
150
+ // {...item}
151
+ // key={`text-${tagIndex}-${i}`}
152
+ // x={posX}
153
+ // y={posY}
154
+ // textAnchor="middle"
155
+ // dominantBaseline="middle"
156
+ // fontSize={defaultFontSize}
157
+ // >
158
+ // {item.value} {renderSymbol(item?.symbol)}
159
+ // </text>
160
+ // );
161
+ // }
162
+ // return null;
163
+ // });
164
+ // return (
165
+ // <g key={`group-${tagIndex}`} pointerEvents="none">
166
+ // {elements}
167
+ // </g>
168
+ // );
169
+ // });
170
+ // }
171
+ // };
172
+ const renderIcon = () => {
173
+ var _a, _b;
174
+ const icon = element === null || element === void 0 ? void 0 : element.icon;
175
+ const offsetX = Number((_a = element === null || element === void 0 ? void 0 : element.offsetX) !== null && _a !== void 0 ? _a : 0);
176
+ const offsetY = Number((_b = element === null || element === void 0 ? void 0 : element.offsetY) !== null && _b !== void 0 ? _b : 0);
177
+ const defaultFontSize = Number(fontSize || 12);
178
+ const posX = width / 2 + (offsetX !== null && offsetX !== void 0 ? offsetX : defaultFontSize);
179
+ const posY = height / 2 + (offsetY !== null && offsetY !== void 0 ? offsetY : defaultFontSize);
180
+ const centerLabelX = width / 2;
181
+ const centetLabelY = height / 2;
182
+ const newLabelProps = Object.assign(Object.assign({}, labelProps), { height: centetLabelY - defaultFontSize });
183
+ return (<>
184
+ <g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${centerLabelX}, ${centetLabelY})`}>
185
+ <LabelItem {...newLabelProps}/>
186
+ </g>
187
+ <g transform={`rotate(${-rotation}, ${centerLabelX}, ${centetLabelY}) translate(${posX - defaultFontSize}, ${posY}) scale(${defaultFontSize / 12})`}>
188
+ {icon ? icon : <TrashIcon />}
189
+ </g>
190
+ </>);
162
191
  };
163
192
  let commonProps = {
164
193
  fill,
@@ -244,6 +273,14 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
244
273
  delete group.dataset.dragEnterCount;
245
274
  };
246
275
  const transformRotate = `rotate(${rotate} ${x + width / 2} ${y + height / 2})`;
276
+ const labelProps = {
277
+ labels,
278
+ id,
279
+ width,
280
+ height,
281
+ commonProps,
282
+ rotation,
283
+ };
247
284
  switch (shape) {
248
285
  case "square":
249
286
  return (<g key={id} id={`${id}`} data-id={id} transform={`translate(${x}, ${y})`} style={{ pointerEvents: "all" }} onContextMenu={(e) => e.preventDefault()} onDragEnter={(e) => {
@@ -297,21 +334,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
297
334
  "tags",
298
335
  "seatCount",
299
336
  ])} {...commonProps}/>
300
- {renderTags(tags)}
301
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`} pointerEvents="none">
302
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
303
- var _a, _b, _c, _d, _e, _f, _g;
304
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
305
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
306
- return (<text pointerEvents="none" {...omit(commonProps, [
307
- "opacity",
308
- "stroke",
309
- "strokeWidth",
310
- ])} 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">
311
- {_ === null || _ === void 0 ? void 0 : _.label}
312
- </text>);
313
- })}
314
- </g>)}
337
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
338
+ <LabelItem {...labelProps}/>
339
+ </g>) : (renderIcon())}
315
340
  </g>
316
341
  </g>);
317
342
  case "polygon":
@@ -389,26 +414,14 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
389
414
  "tags",
390
415
  "seatCount",
391
416
  ])}/>
392
- {renderTags(tags)}
393
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
394
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
395
- var _a, _b, _c, _d, _e, _f, _g;
396
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
397
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
398
- return (<text {...omit(commonProps, [
399
- "opacity",
400
- "stroke",
401
- "strokeWidth",
402
- ])} 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">
403
- {_ === null || _ === void 0 ? void 0 : _.label}
404
- </text>);
405
- })}
406
- </g>)}
417
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
418
+ <LabelItem {...labelProps}/>
419
+ </g>) : (renderIcon())}
407
420
  </g>
408
421
  </g>);
409
422
  case "table-seat-circle": {
410
423
  const seatCount = item.seatCount;
411
- const openSpace = (_b = item.openSpace) !== null && _b !== void 0 ? _b : 0;
424
+ const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
412
425
  // LOCAL SPACE (tanpa x,y)
413
426
  const centerX = width / 2;
414
427
  const centerY = height / 2;
@@ -477,15 +490,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
477
490
  {seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill} className={item === null || item === void 0 ? void 0 : item.className}/>))}
478
491
  </g>
479
492
 
480
- {renderTags(tags)}
481
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
482
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
483
- var _a, _b, _c, _d;
484
- return (<text key={`${id}-label-${index}`} x={width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0)} 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}>
485
- {_ === null || _ === void 0 ? void 0 : _.label}
486
- </text>);
487
- })}
488
- </g>)}
493
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
494
+ <LabelItem {...labelProps}/>
495
+ </g>) : (renderIcon())}
489
496
  </g>
490
497
  </g>);
491
498
  }
@@ -623,21 +630,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
623
630
  <g key={`${id}-seats`} data-seat={`${id}-seats`}>
624
631
  {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} className={item === null || item === void 0 ? void 0 : item.className}/>))}
625
632
  </g>
626
- {renderTags(tags)}
627
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
628
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
629
- var _a, _b, _c, _d, _e, _f, _g;
630
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
631
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
632
- return (<text {...omit(commonProps, [
633
- "opacity",
634
- "stroke",
635
- "strokeWidth",
636
- ])} 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">
637
- {_ === null || _ === void 0 ? void 0 : _.label}
638
- </text>);
639
- })}
640
- </g>)}
633
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
634
+ <LabelItem {...labelProps}/>
635
+ </g>) : (renderIcon())}
641
636
  </g>
642
637
  </g>);
643
638
  }
@@ -645,10 +640,10 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
645
640
  const openSpace = item.openSpace || 0; // from 0 to 0.9
646
641
  const r = 10;
647
642
  const seatPositions = item.seatPositions;
648
- const topCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _c !== void 0 ? _c : 0;
649
- const bottomCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _d !== void 0 ? _d : 0;
650
- const leftCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _e !== void 0 ? _e : 0;
651
- const rightCount = (_f = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _f !== void 0 ? _f : 0;
643
+ const topCount = (_b = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _b !== void 0 ? _b : 0;
644
+ const bottomCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _c !== void 0 ? _c : 0;
645
+ const leftCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _d !== void 0 ? _d : 0;
646
+ const rightCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _e !== void 0 ? _e : 0;
652
647
  // split seats evenly on top and bottom
653
648
  const seatCountTopBottom = Math.ceil(Math.max(topCount, bottomCount) / 2);
654
649
  const seatCountLeftRight = Math.ceil(Math.max(leftCount, rightCount) / 2);
@@ -743,26 +738,15 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
743
738
  "tags",
744
739
  "seatCount",
745
740
  ])}/>
746
- {renderTags(tags)}
741
+ {/* {renderTags(tags)} */}
747
742
 
748
743
  {/* Seats */}
749
744
  <g key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${-x}, ${-y})`}>
750
745
  {[...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} className={item === null || item === void 0 ? void 0 : item.className}/>))}
751
746
  </g>
752
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
753
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
754
- var _a, _b, _c, _d, _e, _f, _g;
755
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
756
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
757
- return (<text {...omit(commonProps, [
758
- "opacity",
759
- "stroke",
760
- "strokeWidth",
761
- ])} 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">
762
- {_ === null || _ === void 0 ? void 0 : _.label}
763
- </text>);
764
- })}
765
- </g>)}
747
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
748
+ <LabelItem {...labelProps}/>
749
+ </g>) : (renderIcon())}
766
750
  </g>
767
751
  </g>);
768
752
  }
@@ -812,12 +796,12 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
812
796
  radius: seatRadius,
813
797
  spacing: spacingHeight,
814
798
  }).map((cy) => ({ cx: width - seatRadius * 0.1, cy, id: "right" }));
815
- const seats = (_g = [
799
+ const seats = (_f = [
816
800
  ...topSeats,
817
801
  ...bottomSeats,
818
802
  ...leftSeats,
819
803
  ...rightSeats,
820
- ]) === null || _g === void 0 ? void 0 : _g.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
804
+ ]) === null || _f === void 0 ? void 0 : _f.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
821
805
  cx: seat.cx,
822
806
  cy: seat.cy,
823
807
  r: seatRadius,
@@ -875,21 +859,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
875
859
  <g key={`${id}-seats`} data-seat={`${id}-seats`}>
876
860
  {seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill={seatFill} className={item === null || item === void 0 ? void 0 : item.className}/>))}
877
861
  </g>
878
- {renderTags(tags)}
879
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
880
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
881
- var _a, _b, _c, _d, _e, _f, _g;
882
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
883
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
884
- return (<text {...omit(commonProps, [
885
- "opacity",
886
- "stroke",
887
- "strokeWidth",
888
- ])} 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">
889
- {_ === null || _ === void 0 ? void 0 : _.label}
890
- </text>);
891
- })}
892
- </g>)}
862
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
863
+ <LabelItem {...labelProps}/>
864
+ </g>) : (renderIcon())}
893
865
  </g>
894
866
  </g>);
895
867
  }
@@ -1026,21 +998,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
1026
998
  <g key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${-x}, ${-y})`}>
1027
999
  {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}/>))}
1028
1000
  </g>
1029
- {renderTags(tags)}
1030
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1031
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
1032
- var _a, _b, _c, _d, _e, _f, _g;
1033
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
1034
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
1035
- return (<text {...omit(commonProps, [
1036
- "opacity",
1037
- "stroke",
1038
- "strokeWidth",
1039
- ])} 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">
1040
- {_ === null || _ === void 0 ? void 0 : _.label}
1041
- </text>);
1042
- })}
1043
- </g>)}
1001
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1002
+ <LabelItem {...labelProps}/>
1003
+ </g>) : (renderIcon())}
1044
1004
  </g>
1045
1005
  </g>);
1046
1006
  }
@@ -1087,15 +1047,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
1087
1047
  }}>
1088
1048
  <g transform={`rotate(${rotation}, 0, 0)`}>
1089
1049
  <image href={src} width={width} height={height} transform={transformRotate} {...commonProps}/>
1090
- {renderTags(tags)}
1091
- {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1092
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
1093
- var _a, _b, _c, _d;
1094
- 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}>
1095
- {_ === null || _ === void 0 ? void 0 : _.label}
1096
- </text>);
1097
- })}
1098
- </g>)}
1050
+ {showLabels ? (<g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1051
+ <LabelItem {...labelProps}/>
1052
+ </g>) : (renderIcon())}
1099
1053
  </g>
1100
1054
  </g>);
1101
1055
  case "background":
@@ -1113,6 +1067,14 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
1113
1067
  }
1114
1068
  };
1115
1069
  let date = new Date();
1116
- return <g key={`${date}`}>{components === null || components === void 0 ? void 0 : components.map(renderShape)}</g>;
1070
+ const nodesRaw = rectToPolygonNodes(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.width, selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.height);
1071
+ return (<g key={`${date}`}>
1072
+ {components === null || components === void 0 ? void 0 : components.map(renderShape)}
1073
+ {!isEmpty(selectionLines) && (<g key={`selection-${Date.now()}`} id="selection-lines" transform={`translate(${(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.x) - 5},${(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.y) - 5})`}>
1074
+ <g transform={`rotate(${0}, 0,0)`}>
1075
+ <rect width={selectionLines.width + 10} height={selectionLines.height + 10} fill="none" stroke="#4a90e2" strokeWidth={1} strokeDasharray={"4 2"} id="rect-box-selection"/>
1076
+ </g>
1077
+ </g>)}
1078
+ </g>);
1117
1079
  };
1118
1080
  export default Layers;