seat-editor 3.5.66 → 3.6.0

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 (46) hide show
  1. package/dist/app/new-board/page.js +18 -1
  2. package/dist/app/new-board/page.jsx +18 -1
  3. package/dist/components/button-radio/index.d.ts +11 -0
  4. package/dist/components/button-radio/index.js +19 -0
  5. package/dist/components/button-radio/index.jsx +22 -0
  6. package/dist/components/form-tools/label.js +20 -2
  7. package/dist/components/form-tools/label.jsx +30 -2
  8. package/dist/components/layer-v3/index.d.ts +9 -1
  9. package/dist/components/layer-v3/index.js +65 -95
  10. package/dist/components/layer-v3/index.jsx +79 -115
  11. package/dist/components/layer-v4/constant.d.ts +16 -2
  12. package/dist/components/layer-v4/constant.js +57 -12
  13. package/dist/components/layer-v4/index.js +111 -188
  14. package/dist/components/layer-v4/index.jsx +124 -215
  15. package/dist/components/modal-preview/index.d.ts +3 -1
  16. package/dist/components/modal-preview/index.js +12 -2
  17. package/dist/components/modal-preview/index.jsx +13 -3
  18. package/dist/dto/table.d.ts +5 -0
  19. package/dist/features/board-v3/board-slice.d.ts +2 -1
  20. package/dist/features/board-v3/board-slice.js +4 -1
  21. package/dist/features/board-v3/constant.d.ts +5 -1
  22. package/dist/features/board-v3/constant.js +23 -1
  23. package/dist/features/board-v3/index.d.ts +6 -1
  24. package/dist/features/board-v3/index.js +59 -49
  25. package/dist/features/board-v3/index.jsx +105 -68
  26. package/dist/features/board-v3/utils.js +48 -28
  27. package/dist/features/package/index.d.ts +5 -0
  28. package/dist/features/package/index.js +1 -1
  29. package/dist/features/package/index.jsx +2 -2
  30. package/dist/features/panel/index.js +2 -2
  31. package/dist/features/panel/index.jsx +2 -2
  32. package/dist/features/panel/selected-group.js +2 -2
  33. package/dist/features/panel/selected-group.jsx +4 -2
  34. package/dist/features/side-tool/icons.d.ts +1 -0
  35. package/dist/features/side-tool/icons.js +2 -0
  36. package/dist/features/side-tool/icons.jsx +6 -0
  37. package/dist/features/side-tool/index.d.ts +6 -1
  38. package/dist/features/side-tool/index.js +31 -3
  39. package/dist/features/side-tool/index.jsx +32 -16
  40. package/dist/features/side-tool/side-tool-slice.d.ts +2 -0
  41. package/dist/features/side-tool/side-tool-slice.js +8 -1
  42. package/dist/features/view-only-3/index.js +0 -21
  43. package/dist/features/view-only-3/index.jsx +0 -21
  44. package/dist/provider/antd-provider.js +5 -2
  45. package/dist/provider/antd-provider.jsx +5 -2
  46. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { arcByDirection, distributeWithSpacing, getBoundingBoxFromPoints, } from
4
4
  import { PRIVILEGED_TAGS, tagsDummy } from "./constant";
5
5
  import { useAppSelector } from "../../hooks/use-redux";
6
6
  import { RsvpIcons } from "../../features/board-v3/icons";
7
+ import { LabelItem } from "../layer-v3";
7
8
  const toKebabCase = (str) => str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
8
9
  const iconNames = [
9
10
  "upcoming",
@@ -33,131 +34,117 @@ const getIconFromId = (data) => {
33
34
  };
34
35
  const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, privilegedTags = [], }) => {
35
36
  const { isShowTagType } = useAppSelector((state) => state.board);
36
- const showLabels = !["type-1", "type-2"].includes(isShowTagType) && !iconTags;
37
+ const showLabels = !["type-1", "type-2", "type-3"].includes(isShowTagType) && !iconTags;
37
38
  const renderShape = (item) => {
38
39
  var _a, _b, _c, _d, _e, _f, _g;
39
- 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;
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, horizontalAlign, verticalAlign, fontSizeType1, fontSizeType2, fontSizeType3, } = item;
40
41
  const fontSizeFromLabel = (_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.fontSize;
42
+ const fontTypeSize = {
43
+ "type-1": fontSizeType1,
44
+ "type-2": fontSizeType2,
45
+ "type-3": fontSizeType3,
46
+ };
41
47
  const renderTags = (data) => {
42
48
  var _a;
43
49
  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));
50
+ const scaleFontSize = Number(fontTypeSize[isShowTagType] || 1);
44
51
  const privileged = !isEmpty(privilegedTags)
45
52
  ? privilegedTags
46
53
  : isShowTagType === "type-1"
47
54
  ? PRIVILEGED_TAGS["CURRENT_TIME"]
48
55
  : isShowTagType === "type-2"
49
56
  ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"]
50
- : undefined;
51
- if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
52
- const scaleDefault = Number(fontSize || fontSizeFromLabel || 12) / 12;
53
- const gapBetweenTags = Number(gapTags || 20) * scaleDefault;
54
- const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
55
- // Hitung total tinggi semua grup tag (buat center vertikal)
56
- 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) => {
57
- var _a;
58
- const items = tag.items || [];
59
- const isColumn = (_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column");
60
- const tagHeight = isColumn
61
- ? items.length * defaultFontSize + 2 * (Number(tag.gap) || 2)
62
- : defaultFontSize; // horizontal = 1 line
63
- return sum + tagHeight + gapBetweenTags;
64
- }, 0)) - gapBetweenTags;
65
- const startY = Number(height) / 4 - totalTagHeight / 3; // titik awal supaya semua di tengah
66
- let currentY = startY;
67
- return tags
68
- .filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key))
69
- .map((tag, tagIndex) => {
70
- var _a;
71
- const itemsPriv = privileged[tagIndex].items;
72
- const direction = ((_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column"))
73
- ? "column"
74
- : "flex";
75
- const gap = Number(tag.gap || 2) * scaleDefault;
76
- const items = tag.items || [];
77
- const fontSize = Number(defaultFontSize);
78
- const isColumn = direction === "column";
79
- const groupHeight = isColumn
80
- ? items.length * fontSize + 2 * gap
81
- : fontSize;
82
- const centerX = width / 2;
83
- const centerY = currentY + groupHeight;
84
- // naikkan posisi Y untuk grup berikutnya
85
- currentY += groupHeight + gapBetweenTags;
86
- const elements = items
87
- .filter((item) => itemsPriv.includes(item.type))
88
- .map((item, i) => {
89
- var _a, _b;
90
- const offsetY = isColumn
91
- ? i * (fontSize + gap) - groupHeight / 2 + fontSize / 2
92
- : 0;
93
- const offsetX = !isColumn
94
- ? i * (fontSize + gap) - (1 * (fontSize + gap)) / 2
95
- : 0;
96
- const posX = centerX + offsetX + Number((_a = tag.offsetX) !== null && _a !== void 0 ? _a : 0);
97
- const posY = centerY + offsetY + Number((_b = tag.offsetY) !== null && _b !== void 0 ? _b : 0);
98
- const renderSymbol = (symbol) => {
99
- if (!symbol)
100
- return null;
101
- const { position = "right", size = (item === null || item === void 0 ? void 0 : item.fontSize) || Number(fontSize), gap: symbolGap = 0, } = symbol;
102
- const sizeFont = (item === null || item === void 0 ? void 0 : item.fontSize) || Number(fontSize) / 3;
103
- let offsetSymbolX = 0;
104
- let offsetSymbolY = 0;
105
- switch (position) {
106
- case "right":
107
- offsetSymbolX = size + symbolGap;
108
- break;
109
- case "left":
110
- offsetSymbolX = -(size + symbolGap);
111
- break;
112
- case "top":
113
- offsetSymbolY = -(size + symbolGap);
114
- break;
115
- case "bottom":
116
- offsetSymbolY = size + symbolGap;
117
- break;
118
- case "right-top":
119
- offsetSymbolX = size + symbolGap;
120
- offsetSymbolY = -(size / 4);
121
- break;
122
- case "right-bottom":
123
- offsetSymbolX = size + symbolGap;
124
- offsetSymbolY = size / 4;
125
- break;
126
- case "left-top":
127
- offsetSymbolX = -size - symbolGap;
128
- offsetSymbolY = -(size / 4);
129
- break;
130
- case "left-bottom":
131
- offsetSymbolX = -size - symbolGap;
132
- offsetSymbolY = size / 4;
133
- break;
134
- }
135
- return (<tspan {...symbol} key={`symbol-${tagIndex}-${i}`} x={posX + offsetSymbolX} y={posY + offsetSymbolY} textAnchor="middle" dominantBaseline="middle" fontSize={`${sizeFont}px`}>
136
- {symbol.value}
137
- </tspan>);
57
+ : isShowTagType === "type-3"
58
+ ? PRIVILEGED_TAGS["POS_VIEW"]
59
+ : undefined;
60
+ if (!(tags === null || tags === void 0 ? void 0 : tags.length))
61
+ return null;
62
+ const scaleDefault = Number(scaleFontSize || fontSize || fontSizeFromLabel || 12);
63
+ const postViewTagDummy = isShowTagType === "type-3";
64
+ const gapBetweenTags = Number((postViewTagDummy ? 1 : gapTags) || 20) * scaleDefault;
65
+ const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12) * scaleDefault;
66
+ const filteredTags = tags.filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key));
67
+ // hitung tinggi tiap group
68
+ const groupHeights = filteredTags.map((tag) => {
69
+ var _a;
70
+ const isColumn = (_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column");
71
+ const gap = Number(tag.gap || 2) * scaleDefault;
72
+ const items = tag.items || [];
73
+ return isColumn
74
+ ? (items.length - 1) * (defaultFontSize + gap) + defaultFontSize
75
+ : defaultFontSize;
76
+ });
77
+ // total tinggi semua group + gap antar group
78
+ const totalTagHeight = groupHeights.reduce((sum, h) => sum + h, 0) +
79
+ (filteredTags.length - 1) * gapBetweenTags;
80
+ // startY supaya center vertikal
81
+ let currentY = height / 2 - totalTagHeight / 2;
82
+ return filteredTags.map((tag, tagIndex) => {
83
+ var _a;
84
+ const itemsPriv = privileged[tagIndex].items;
85
+ const isColumn = (_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column");
86
+ const gap = Number(tag.gap || 2) * scaleDefault;
87
+ const items = tag.items || [];
88
+ const groupHeight = groupHeights[tagIndex];
89
+ const centerX = width / 2;
90
+ const centerY = currentY + groupHeight / 2;
91
+ currentY += groupHeight + gapBetweenTags;
92
+ const elements = items
93
+ .filter((item) => itemsPriv.includes(item.type))
94
+ .map((item, i) => {
95
+ var _a, _b, _c;
96
+ const offsetY = isColumn
97
+ ? i * (defaultFontSize + gap) - groupHeight / 2 + defaultFontSize / 2
98
+ : 0;
99
+ const offsetX = !isColumn
100
+ ? i * (defaultFontSize + gap) - ((items.length - 1) * (defaultFontSize + gap)) / 2
101
+ : 0;
102
+ const posX = centerX + offsetX + Number((_a = tag.offsetX) !== null && _a !== void 0 ? _a : 0);
103
+ const posY = centerY + offsetY + Number((_b = tag.offsetY) !== null && _b !== void 0 ? _b : 0);
104
+ const renderSymbol = (symbol, width) => {
105
+ var _a;
106
+ if (!symbol)
107
+ return null;
108
+ const { position = "right", size = Number(item === null || item === void 0 ? void 0 : item.fontSize) || defaultFontSize / 3, gap: symbolGap = 0, } = symbol;
109
+ const sizeFont = defaultFontSize / 3;
110
+ const offsets = {
111
+ right: { x: size + (symbolGap * scaleFontSize) + width / 2.3, y: 0 },
112
+ left: { x: -(size + (symbolGap * scaleFontSize) + width / 2.3), y: 0 },
113
+ top: { x: 0, y: -(size + (symbolGap * scaleFontSize) + width / 2.3) },
114
+ bottom: { x: 0, y: size + (symbolGap * scaleFontSize) + width / 2.3 },
115
+ "right-top": { x: size + (symbolGap * scaleFontSize) + width / 2.3, y: -(defaultFontSize / 4) },
116
+ "right-bottom": { x: size + (symbolGap * scaleFontSize) + width / 2.3, y: defaultFontSize / 4 },
117
+ "left-top": { x: -(size + (symbolGap * scaleFontSize) + width / 2.3), y: -(defaultFontSize / 4) },
118
+ "left-bottom": { x: -(size + (symbolGap * scaleFontSize) + width / 2.3), y: defaultFontSize / 4 },
138
119
  };
139
- if (item.type === "icon") {
140
- const icons = iconTags !== null && iconTags !== void 0 ? iconTags : dummyIconTags;
141
- const iconTag = icons === null || icons === void 0 ? void 0 : icons.find((icon) => icon.key === item.value);
142
- if (!iconTag)
143
- return null;
144
- const scale = defaultFontSize / 12;
145
- return (<g {...item} key={`icon-${tagIndex}-${i}`} transform={`translate(${posX - defaultFontSize}, ${posY - defaultFontSize / 2}) scale(${scale})`}>
146
- {iconTag.icon}
147
- </g>);
148
- }
149
- if (item.type === "text") {
150
- return (<text {...item} key={`text-${tagIndex}-${i}`} x={posX} y={posY} textAnchor="middle" dominantBaseline="middle" fontSize={defaultFontSize}>
151
- {item.value} {renderSymbol(item === null || item === void 0 ? void 0 : item.symbol)}
152
- </text>);
153
- }
154
- return null;
155
- });
156
- return (<g key={`group-${tagIndex}`} pointerEvents="none">
157
- {elements}
158
- </g>);
120
+ const { x: sx, y: sy } = (_a = offsets[position]) !== null && _a !== void 0 ? _a : offsets.right;
121
+ return (<tspan key={`symbol-${tagIndex}-${i}`} x={posX + sx} y={posY + sy} textAnchor="middle" dominantBaseline="middle" fontSize={`${sizeFont}px`}>
122
+ {symbol.value}
123
+ </tspan>);
124
+ };
125
+ if (item.type === "icon") {
126
+ const icons = iconTags !== null && iconTags !== void 0 ? iconTags : dummyIconTags;
127
+ const iconTag = icons === null || icons === void 0 ? void 0 : icons.find((icon) => icon.key === item.value);
128
+ if (!iconTag)
129
+ return null;
130
+ const scale = defaultFontSize / 12;
131
+ return (<g {...item} key={`icon-${tagIndex}-${i}`} transform={`translate(${posX - defaultFontSize / 1.3}, ${posY - defaultFontSize / 1.3}) scale(${scale})`}>
132
+ {iconTag.icon}
133
+ </g>);
134
+ }
135
+ if (item.type === "text") {
136
+ const widthText = ((_c = item === null || item === void 0 ? void 0 : item.value) === null || _c === void 0 ? void 0 : _c.length) * defaultFontSize * 0.6;
137
+ return (<text {...item} key={`text-${tagIndex}-${i}`} x={posX} y={posY} textAnchor="middle" dominantBaseline="middle" fontSize={defaultFontSize}>
138
+ {item.value}
139
+ {renderSymbol(item === null || item === void 0 ? void 0 : item.symbol, widthText)}
140
+ </text>);
141
+ }
142
+ return null;
159
143
  });
160
- }
144
+ return (<g key={`group-${tagIndex}`} pointerEvents="none" transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
145
+ {elements}
146
+ </g>);
147
+ });
161
148
  };
162
149
  let commonProps = {
163
150
  fill,
@@ -165,6 +152,16 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
165
152
  stroke,
166
153
  strokeWidth,
167
154
  };
155
+ const labelProps = {
156
+ labels,
157
+ id,
158
+ width,
159
+ height,
160
+ commonProps,
161
+ horizontalAlign,
162
+ verticalAlign,
163
+ rotation,
164
+ };
168
165
  const hasSelected = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.id) === id;
169
166
  if (hasSelected) {
170
167
  const eventSelectedStyles = eventMatchTable === null || eventMatchTable === void 0 ? void 0 : eventMatchTable.find((style) => style.event === "selected");
@@ -298,18 +295,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
298
295
  ])} {...commonProps}/>
299
296
  {renderTags(tags)}
300
297
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`} pointerEvents="none">
301
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
302
- var _a, _b, _c, _d, _e, _f, _g;
303
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
304
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
305
- return (<text pointerEvents="none" {...omit(commonProps, [
306
- "opacity",
307
- "stroke",
308
- "strokeWidth",
309
- ])} 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">
310
- {_ === null || _ === void 0 ? void 0 : _.label}
311
- </text>);
312
- })}
298
+ <LabelItem {...labelProps}/>
313
299
  </g>)}
314
300
  </g>
315
301
  </g>);
@@ -324,18 +310,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
324
310
  <g transform={`rotate(${rotation}, 0, 0)`}>
325
311
  <polygon {...commonProps} key={id} points={finalPoint} x="0" y="0"/>
326
312
  <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})`}>
327
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
328
- var _a, _b, _c, _d, _e, _f, _g;
329
- 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);
330
- 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);
331
- return (<text {...omit(commonProps, [
332
- "opacity",
333
- "stroke",
334
- "strokeWidth",
335
- ])} 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">
336
- {_ === null || _ === void 0 ? void 0 : _.label}
337
- </text>);
338
- })}
313
+ <LabelItem {...labelProps}/>
339
314
  </g>
340
315
  </g>
341
316
  </g>);
@@ -390,18 +365,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
390
365
  ])}/>
391
366
  {renderTags(tags)}
392
367
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
393
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
394
- var _a, _b, _c, _d, _e, _f, _g;
395
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
396
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
397
- return (<text {...omit(commonProps, [
398
- "opacity",
399
- "stroke",
400
- "strokeWidth",
401
- ])} 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">
402
- {_ === null || _ === void 0 ? void 0 : _.label}
403
- </text>);
404
- })}
368
+ <LabelItem {...labelProps}/>
405
369
  </g>)}
406
370
  </g>
407
371
  </g>);
@@ -478,12 +442,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
478
442
 
479
443
  {renderTags(tags)}
480
444
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
481
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
482
- var _a, _b, _c, _d;
483
- 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}>
484
- {_ === null || _ === void 0 ? void 0 : _.label}
485
- </text>);
486
- })}
445
+ <LabelItem {...labelProps}/>
487
446
  </g>)}
488
447
  </g>
489
448
  </g>);
@@ -624,18 +583,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
624
583
  </g>
625
584
  {renderTags(tags)}
626
585
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
627
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
628
- var _a, _b, _c, _d, _e, _f, _g;
629
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
630
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
631
- return (<text {...omit(commonProps, [
632
- "opacity",
633
- "stroke",
634
- "strokeWidth",
635
- ])} 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">
636
- {_ === null || _ === void 0 ? void 0 : _.label}
637
- </text>);
638
- })}
586
+ <LabelItem {...labelProps}/>
639
587
  </g>)}
640
588
  </g>
641
589
  </g>);
@@ -749,18 +697,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
749
697
  {[...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}/>))}
750
698
  </g>
751
699
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
752
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
753
- var _a, _b, _c, _d, _e, _f, _g;
754
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
755
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
756
- return (<text {...omit(commonProps, [
757
- "opacity",
758
- "stroke",
759
- "strokeWidth",
760
- ])} 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">
761
- {_ === null || _ === void 0 ? void 0 : _.label}
762
- </text>);
763
- })}
700
+ <LabelItem {...labelProps}/>
764
701
  </g>)}
765
702
  </g>
766
703
  </g>);
@@ -876,18 +813,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
876
813
  </g>
877
814
  {renderTags(tags)}
878
815
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
879
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
880
- var _a, _b, _c, _d, _e, _f, _g;
881
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
882
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
883
- return (<text {...omit(commonProps, [
884
- "opacity",
885
- "stroke",
886
- "strokeWidth",
887
- ])} 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">
888
- {_ === null || _ === void 0 ? void 0 : _.label}
889
- </text>);
890
- })}
816
+ <LabelItem {...labelProps}/>
891
817
  </g>)}
892
818
  </g>
893
819
  </g>);
@@ -1027,18 +953,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
1027
953
  </g>
1028
954
  {renderTags(tags)}
1029
955
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1030
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
1031
- var _a, _b, _c, _d, _e, _f, _g;
1032
- const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
1033
- const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
1034
- return (<text {...omit(commonProps, [
1035
- "opacity",
1036
- "stroke",
1037
- "strokeWidth",
1038
- ])} 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">
1039
- {_ === null || _ === void 0 ? void 0 : _.label}
1040
- </text>);
1041
- })}
956
+ <LabelItem {...labelProps}/>
1042
957
  </g>)}
1043
958
  </g>
1044
959
  </g>);
@@ -1088,24 +1003,18 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
1088
1003
  <image href={src} width={width} height={height} transform={transformRotate} {...commonProps}/>
1089
1004
  {renderTags(tags)}
1090
1005
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1091
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
1092
- var _a, _b, _c, _d;
1093
- 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}>
1094
- {_ === null || _ === void 0 ? void 0 : _.label}
1095
- </text>);
1096
- })}
1006
+ <LabelItem {...labelProps}/>
1097
1007
  </g>)}
1098
1008
  </g>
1099
1009
  </g>);
1100
1010
  case "background":
1101
- return (<g key={id} onContextMenu={(e) => e.preventDefault()}>
1102
- <image href={src} x={x} y={y} width={width} height={height} transform={transformRotate} {...commonProps}/>
1103
- {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
1104
- var _a, _b, _c, _d;
1105
- 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}>
1106
- {_ === null || _ === void 0 ? void 0 : _.label}
1107
- </text>);
1108
- })}
1011
+ return (<g key={id} onContextMenu={(e) => e.preventDefault()} transform={`translate(${x}, ${y})`}>
1012
+ <g transform={`rotate(${rotation}, 0, 0)`}>
1013
+ <image href={src} width={width} height={height}/>
1014
+ <g data-text={`${id}-text`} transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
1015
+ <LabelItem {...labelProps}/>
1016
+ </g>
1017
+ </g>
1109
1018
  </g>);
1110
1019
  default:
1111
1020
  return <g key={id}/>;
@@ -1,4 +1,6 @@
1
- declare const ModalPreview: ({ children }: {
1
+ import { ModalProps } from "antd";
2
+ declare const ModalPreview: ({ children, modalProps }: {
2
3
  children: React.ReactNode;
4
+ modalProps?: ModalProps;
3
5
  }) => import("react/jsx-runtime").JSX.Element;
4
6
  export default ModalPreview;
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Modal } from "antd";
4
4
  import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
5
5
  import { useEffect } from "react";
6
- const ModalPreview = ({ children }) => {
6
+ const ModalPreview = ({ children, modalProps }) => {
7
7
  const { isPreview } = useAppSelector((state) => state.tool);
8
8
  const dispatch = useAppDispatch();
9
9
  useEffect(() => {
@@ -14,6 +14,16 @@ const ModalPreview = ({ children }) => {
14
14
  });
15
15
  }
16
16
  }, [isPreview]);
17
- return (_jsx(Modal, { open: isPreview, onCancel: () => dispatch({ type: "tool/setTooglePreview", payload: false }), width: 1000, height: 600, title: "Preview Board", centered: true, footer: null, children: _jsx("div", { className: "flex flex-col p-4 h-[500px]", children: children }) }));
17
+ return (_jsx(Modal, Object.assign({ open: isPreview, onCancel: () => dispatch({ type: "tool/setTooglePreview", payload: false }), width: 900, styles: {
18
+ content: {
19
+ padding: 0,
20
+ },
21
+ header: {
22
+ marginBottom: 0,
23
+ },
24
+ footer: {
25
+ marginTop: 0,
26
+ }
27
+ }, centered: true }, modalProps, { children: _jsx("div", { className: "h-[400px]", children: children }) })));
18
28
  };
19
29
  export default ModalPreview;
@@ -2,7 +2,7 @@
2
2
  import { Modal } from "antd";
3
3
  import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
4
4
  import { useEffect } from "react";
5
- const ModalPreview = ({ children }) => {
5
+ const ModalPreview = ({ children, modalProps }) => {
6
6
  const { isPreview } = useAppSelector((state) => state.tool);
7
7
  const dispatch = useAppDispatch();
8
8
  useEffect(() => {
@@ -13,8 +13,18 @@ const ModalPreview = ({ children }) => {
13
13
  });
14
14
  }
15
15
  }, [isPreview]);
16
- return (<Modal open={isPreview} onCancel={() => dispatch({ type: "tool/setTooglePreview", payload: false })} width={1000} height={600} title="Preview Board" centered footer={null}>
17
- <div className="flex flex-col p-4 h-[500px]">{children}</div>
16
+ return (<Modal open={isPreview} onCancel={() => dispatch({ type: "tool/setTooglePreview", payload: false })} width={900} styles={{
17
+ content: {
18
+ padding: 0,
19
+ },
20
+ header: {
21
+ marginBottom: 0,
22
+ },
23
+ footer: {
24
+ marginTop: 0,
25
+ }
26
+ }} centered {...modalProps}>
27
+ <div className="h-[400px]">{children}</div>
18
28
  </Modal>);
19
29
  };
20
30
  export default ModalPreview;
@@ -9,6 +9,8 @@ export interface Label extends SVGAttributes<SVGElement> {
9
9
  y?: number;
10
10
  fontColor?: string;
11
11
  rotation?: number;
12
+ horizontalAlign?: "start" | "middle" | "end";
13
+ verticalAlign?: "hanging" | "middle" | "auto";
12
14
  }
13
15
  export interface Symbol extends SVGAttributes<SVGElement> {
14
16
  value?: string;
@@ -57,6 +59,9 @@ export interface TableProps {
57
59
  strokeWidth?: number;
58
60
  stroke?: string;
59
61
  opacity?: number;
62
+ fontSizeType1?: number;
63
+ fontSizeType2?: number;
64
+ fontSizeType3?: number;
60
65
  seatPositions?: {
61
66
  top: number;
62
67
  right: number;
@@ -1,3 +1,4 @@
1
+ export type ShowTagType = "default" | "type-1" | "type-2" | "type-3";
1
2
  export interface Component {
2
3
  id: string;
3
4
  [key: string]: any;
@@ -18,7 +19,7 @@ export interface InitialState {
18
19
  historyChanges: HistoryEntry[];
19
20
  pointer: number;
20
21
  updateBy: "global" | "local";
21
- isShowTagType: "default" | "type-1" | "type-2";
22
+ isShowTagType: ShowTagType;
22
23
  }
23
24
  export declare const addComponent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "board/addComponent">, removeComponent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "board/removeComponent">, updateComponent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "board/updateComponent">, setBackgroundColor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "board/setBackgroundColor">, removeExtraComponent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "board/removeExtraComponent">;
24
25
  declare const _default: import("redux").Reducer<InitialState>;
@@ -162,13 +162,16 @@ const boardSlice = createSlice({
162
162
  },
163
163
  setScalingFontSize: (state, action) => {
164
164
  state.components = state.components.map((component) => {
165
- var _a, _b, _c, _d, _e, _f;
165
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
166
166
  if (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.type) === "type-1") {
167
167
  return Object.assign(Object.assign({}, component), { fontSizeType1: (_c = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1 });
168
168
  }
169
169
  if (((_d = action.payload) === null || _d === void 0 ? void 0 : _d.type) === "type-2") {
170
170
  return Object.assign(Object.assign({}, component), { fontSizeType2: (_f = (_e = action.payload) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 1 });
171
171
  }
172
+ if (((_g = action.payload) === null || _g === void 0 ? void 0 : _g.type) === "type-3") {
173
+ return Object.assign(Object.assign({}, component), { fontSizeType3: (_j = (_h = action.payload) === null || _h === void 0 ? void 0 : _h.value) !== null && _j !== void 0 ? _j : 1 });
174
+ }
172
175
  return component;
173
176
  });
174
177
  },
@@ -5,4 +5,8 @@ declare const MIN_Y = 10;
5
5
  declare const ZOOM_STEP = 0.2;
6
6
  declare const ZOOM_MAX = 2;
7
7
  declare const ZOOM_MIN = 0.2;
8
- export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN };
8
+ declare const FONT_SCALES: {
9
+ value: number;
10
+ label: string;
11
+ }[];
12
+ export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, FONT_SCALES };
@@ -5,4 +5,26 @@ const MIN_Y = 10;
5
5
  const ZOOM_STEP = 0.2;
6
6
  const ZOOM_MAX = 2;
7
7
  const ZOOM_MIN = 0.2;
8
- export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN };
8
+ const FONT_SCALES = [
9
+ {
10
+ value: 0.5,
11
+ label: "Smallest (0,5×)",
12
+ },
13
+ {
14
+ value: 0.75,
15
+ label: "Smaller (0,75×)",
16
+ },
17
+ {
18
+ value: 1,
19
+ label: "Normal",
20
+ },
21
+ {
22
+ value: 2,
23
+ label: "Larger (2×)",
24
+ },
25
+ {
26
+ value: 3,
27
+ label: "Largest (3×)",
28
+ }
29
+ ];
30
+ export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, FONT_SCALES };