seat-editor 3.4.7 → 3.5.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 (108) hide show
  1. package/dist/app/constant.d.ts +1 -1
  2. package/dist/app/graph-view/page.d.ts +1 -0
  3. package/dist/app/graph-view/page.js +343 -0
  4. package/dist/app/graph-view/page.jsx +445 -0
  5. package/dist/app/graph-view-new/constant.d.ts +581 -0
  6. package/dist/app/graph-view-new/constant.js +6973 -0
  7. package/dist/app/graph-view-new/page.d.ts +1 -0
  8. package/dist/app/graph-view-new/page.js +71 -0
  9. package/dist/app/graph-view-new/page.jsx +98 -0
  10. package/dist/app/new-board/page.js +43 -7
  11. package/dist/app/new-board/page.jsx +45 -12
  12. package/dist/components/button-tools/index.js +7 -5
  13. package/dist/components/button-tools/index.jsx +21 -9
  14. package/dist/components/form-tools/label.js +9 -20
  15. package/dist/components/form-tools/label.jsx +38 -28
  16. package/dist/components/form-tools/shape.js +5 -5
  17. package/dist/components/form-tools/shape.jsx +8 -8
  18. package/dist/components/layer-v3/index.js +44 -3
  19. package/dist/components/layer-v3/index.jsx +120 -3
  20. package/dist/components/layer-v4/index.js +3 -2
  21. package/dist/components/layer-v4/index.jsx +3 -2
  22. package/dist/components/layer-v5/constant.d.ts +60 -0
  23. package/dist/components/layer-v5/constant.js +93 -0
  24. package/dist/components/layer-v5/index.d.ts +24 -0
  25. package/dist/components/layer-v5/index.js +927 -0
  26. package/dist/components/layer-v5/index.jsx +1049 -0
  27. package/dist/features/board-v3/index.js +350 -72
  28. package/dist/features/board-v3/index.jsx +369 -75
  29. package/dist/features/board-v3/resize-element.js +5 -0
  30. package/dist/features/board-v3/utils.d.ts +8 -0
  31. package/dist/features/board-v3/utils.js +23 -7
  32. package/dist/features/package/index.d.ts +2 -0
  33. package/dist/features/package/index.js +1 -1
  34. package/dist/features/package/index.jsx +6 -1
  35. package/dist/features/panel/index.d.ts +8 -0
  36. package/dist/features/panel/index.js +160 -38
  37. package/dist/features/panel/index.jsx +173 -46
  38. package/dist/features/panel/polygon.d.ts +2 -0
  39. package/dist/features/panel/polygon.js +44 -0
  40. package/dist/features/panel/polygon.jsx +70 -0
  41. package/dist/features/panel/select-tool.js +3 -0
  42. package/dist/features/panel/select-tool.jsx +3 -0
  43. package/dist/features/panel/selected-group.js +24 -26
  44. package/dist/features/panel/selected-group.jsx +56 -51
  45. package/dist/features/panel/text-tool.js +17 -2
  46. package/dist/features/panel/text-tool.jsx +19 -2
  47. package/dist/features/panel/upload-tool.js +17 -3
  48. package/dist/features/panel/upload-tool.jsx +23 -4
  49. package/dist/features/side-tool/index.js +43 -6
  50. package/dist/features/side-tool/index.jsx +47 -10
  51. package/dist/features/view-only-4/connect-handle.d.ts +13 -0
  52. package/dist/features/view-only-4/connect-handle.js +23 -0
  53. package/dist/features/view-only-4/connect-handle.jsx +30 -0
  54. package/dist/features/view-only-4/connection-layer.d.ts +21 -0
  55. package/dist/features/view-only-4/connection-layer.js +219 -0
  56. package/dist/features/view-only-4/connection-layer.jsx +291 -0
  57. package/dist/features/view-only-4/index.d.ts +99 -0
  58. package/dist/features/view-only-4/index.js +684 -0
  59. package/dist/features/view-only-4/index.jsx +722 -0
  60. package/dist/features/view-only-4/integration-guide.d.ts +0 -0
  61. package/dist/features/view-only-4/integration-guide.js +0 -0
  62. package/dist/features/view-only-4/use-connection-graph.d.ts +41 -0
  63. package/dist/features/view-only-4/use-connection-graph.js +182 -0
  64. package/dist/features/view-only-4/utils.d.ts +74 -0
  65. package/dist/features/view-only-4/utils.js +106 -0
  66. package/dist/features/view-only-5/connect-handle.d.ts +30 -0
  67. package/dist/features/view-only-5/connect-handle.js +88 -0
  68. package/dist/features/view-only-5/connect-handle.jsx +96 -0
  69. package/dist/features/view-only-5/connection-layer.d.ts +34 -0
  70. package/dist/features/view-only-5/connection-layer.js +182 -0
  71. package/dist/features/view-only-5/connection-layer.jsx +265 -0
  72. package/dist/features/view-only-5/index.d.ts +102 -0
  73. package/dist/features/view-only-5/index.js +585 -0
  74. package/dist/features/view-only-5/index.jsx +614 -0
  75. package/dist/features/view-only-5/use-connection-graph.d.ts +57 -0
  76. package/dist/features/view-only-5/use-connection-graph.js +196 -0
  77. package/dist/features/view-only-5/utils.d.ts +52 -0
  78. package/dist/features/view-only-5/utils.js +80 -0
  79. package/dist/features/view-only-6/connect-handle.d.ts +13 -0
  80. package/dist/features/view-only-6/connect-handle.js +20 -0
  81. package/dist/features/view-only-6/connect-handle.jsx +21 -0
  82. package/dist/features/view-only-6/connection-layer.d.ts +22 -0
  83. package/dist/features/view-only-6/connection-layer.js +191 -0
  84. package/dist/features/view-only-6/connection-layer.jsx +244 -0
  85. package/dist/features/view-only-6/index.d.ts +99 -0
  86. package/dist/features/view-only-6/index.js +687 -0
  87. package/dist/features/view-only-6/index.jsx +724 -0
  88. package/dist/features/view-only-6/use-connection-graph.d.ts +26 -0
  89. package/dist/features/view-only-6/use-connection-graph.js +103 -0
  90. package/dist/features/view-only-6/utils.d.ts +66 -0
  91. package/dist/features/view-only-6/utils.js +96 -0
  92. package/dist/features/view-only-7/connect-handle.d.ts +13 -0
  93. package/dist/features/view-only-7/connect-handle.js +23 -0
  94. package/dist/features/view-only-7/connect-handle.jsx +30 -0
  95. package/dist/features/view-only-7/connection-layer.d.ts +22 -0
  96. package/dist/features/view-only-7/connection-layer.js +165 -0
  97. package/dist/features/view-only-7/connection-layer.jsx +217 -0
  98. package/dist/features/view-only-7/index.d.ts +99 -0
  99. package/dist/features/view-only-7/index.js +687 -0
  100. package/dist/features/view-only-7/index.jsx +724 -0
  101. package/dist/features/view-only-7/use-connection-graph.d.ts +26 -0
  102. package/dist/features/view-only-7/use-connection-graph.js +104 -0
  103. package/dist/features/view-only-7/utils.d.ts +69 -0
  104. package/dist/features/view-only-7/utils.js +144 -0
  105. package/dist/index.d.ts +2 -1
  106. package/dist/index.js +2 -1
  107. package/dist/seat-editor.css +1 -1
  108. package/package.json +1 -1
@@ -4,10 +4,18 @@ import { createElement as _createElement } from "react";
4
4
  import { isEmpty, omit } from "lodash";
5
5
  import { arcByDirection, distributeWithSpacing, rectToPolygonNodes, rectToPolygonPoints, } from "./utils";
6
6
  import { useAppSelector } from "../../hooks/use-redux";
7
+ import { useMemo } from "react";
7
8
  const Layers = ({ components, selectedComponent, activeTool, selectionLines, }) => {
8
9
  var _a;
9
10
  const hasPoints = selectionLines && !isEmpty(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.points);
10
11
  const lockBackground = useAppSelector((state) => state.tool.lockBackground);
12
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
13
+ const allSelectionId = useMemo(() => {
14
+ const ids = (selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item === null || item === void 0 ? void 0 : item.id)) || [];
15
+ if (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id)
16
+ ids.push(selectedComponent.id);
17
+ return ids;
18
+ }, [selectedGroup, selectedComponent]);
11
19
  const renderShape = (item) => {
12
20
  var _a, _b, _c, _d, _e, _f;
13
21
  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;
@@ -17,6 +25,19 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
17
25
  stroke,
18
26
  strokeWidth,
19
27
  };
28
+ const selectionBox = {
29
+ stroke: "#3b82f6",
30
+ strokeWidth: 4,
31
+ width: width + strokeWidth + 2,
32
+ height: height + strokeWidth + 2,
33
+ x: x - strokeWidth / 2,
34
+ y: y - strokeWidth / 2,
35
+ opacity: 0,
36
+ };
37
+ if (allSelectionId === null || allSelectionId === void 0 ? void 0 : allSelectionId.includes(id)) {
38
+ commonProps.stroke = "#ffa39e";
39
+ commonProps.strokeWidth = 4;
40
+ }
20
41
  switch (shape) {
21
42
  case "square":
22
43
  return (_jsx("g", { "data-id": id, id: `${id}`, transform: `translate(${x}, ${y})`, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_createElement("rect", Object.assign({}, commonProps, { key: id, width: width, height: height, rx: radius })), _jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -42,7 +63,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
42
63
  const showPoints = (selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.id) == id;
43
64
  return (_jsx("g", { "data-id": id, transform: `translate(${x}, ${y})`, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_createElement("polygon", Object.assign({}, commonProps, { key: id, points: finalPoint, x: "0", y: "0" })), (showPoints || !isClosed) &&
44
65
  points.map((_, index) => {
45
- return (_jsxs(_Fragment, { children: [_jsx("rect", { "data-point": JSON.stringify(_), id: `${index}`, x: (_ === null || _ === void 0 ? void 0 : _.x) - 5, y: (_ === null || _ === void 0 ? void 0 : _.y) - 5, width: 10, height: 10, fill: "#4a90e2", cursor: "pointer" }, `${id}-point-${index}`), _jsx("circle", { "data-point": JSON.stringify(_), id: `${index}`, cx: _ === null || _ === void 0 ? void 0 : _.x, cy: _ === null || _ === void 0 ? void 0 : _.y, r: 15, fill: "transparent", cursor: "pointer" }, `${id}-point-${index}`)] }));
66
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { "data-point": JSON.stringify(_), id: `${index}`, x: (_ === null || _ === void 0 ? void 0 : _.x) - 5, y: (_ === null || _ === void 0 ? void 0 : _.y) - 5, width: 10, height: 10, fill: "#4a90e2", cursor: "pointer" }, `${id}-point-${index}`), _jsx("circle", { "data-point": JSON.stringify(_), id: `${index}`, cx: _ === null || _ === void 0 ? void 0 : _.x, cy: _ === null || _ === void 0 ? void 0 : _.y, r: 15, fill: "transparent", cursor: "pointer" }, `${id}-point-${index - 100}`)] }));
46
67
  })] }) }, id));
47
68
  case "selection-box":
48
69
  const pointsFormat = rectToPolygonPoints(x, y, width, height);
@@ -85,7 +106,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
85
106
  const cy = centerY + (tableRadius + seatRadius) * Math.sin(angle);
86
107
  return { cx, cy };
87
108
  });
88
- return (_jsx("g", { "data-id": id, transform: `translate(${x}, ${y})`, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: tableRadius, fill: fill }, commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill }, `${id}-seat-${i}`))) }), _jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
109
+ return (_jsx("g", { "data-id": id, transform: `translate(${x}, ${y})`, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: tableRadius, fill: fill }, commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", Object.assign({ cx: cx, cy: cy, r: seatRadius, fill: seatFill }, commonProps), `${id}-seat-${i}`))) }), _jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
89
110
  var _a, _b, _c, _d, _e, _f, _g;
90
111
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
91
112
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -434,7 +455,23 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
434
455
  ]), { 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" }), _ === null || _ === void 0 ? void 0 : _.label));
435
456
  }) })] }) }, id));
436
457
  case "bounding-box": {
437
- return (_jsx("g", { transform: `translate(${x}, ${y})`, "data-bounding-box": id, children: _jsx("rect", { width: width, height: height, fill: "none", stroke: "#3b82f6", strokeWidth: 1, strokeDasharray: "6 4", pointerEvents: "none" }) }, id));
458
+ const topLine = `${0},${0} ${width},${0}`;
459
+ const rightLine = `${width},${0} ${width},${height}`;
460
+ const bottomLine = `${width},${height} ${0},${height}`;
461
+ const leftLine = `${0},${height} ${0},${0}`;
462
+ return (_jsxs("g", { id: "bounding-box", transform: `translate(${x}, ${y})`, "data-bounding-box": id, children: [_jsx("rect", { width: width, height: height, fill: "none", stroke: "#3b82f6", strokeWidth: 1, strokeDasharray: "6 4", pointerEvents: "none" }), _jsx("polyline", { points: topLine, fill: "none", stroke: "transparent", strokeWidth: 3, "data-position": "top-boundaries", style: {
463
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
464
+ cursor: "row-resize",
465
+ } }), _jsx("polyline", { points: rightLine, fill: "none", stroke: "transparent", strokeWidth: 3, "data-position": "right-boundaries", style: {
466
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
467
+ cursor: "col-resize",
468
+ } }), _jsx("polyline", { points: bottomLine, fill: "none", stroke: "transparent", strokeWidth: 3, "data-position": "bottom-boundaries", style: {
469
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
470
+ cursor: "row-resize",
471
+ } }), _jsx("polyline", { points: leftLine, fill: "none", stroke: "transparent", strokeWidth: 3, "data-position": "left-boundaries", style: {
472
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
473
+ cursor: "col-resize",
474
+ } })] }, id));
438
475
  }
439
476
  default:
440
477
  return _jsx("g", {}, id);
@@ -442,6 +479,10 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
442
479
  };
443
480
  let date = new Date();
444
481
  const nodesRaw = rectToPolygonNodes(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.width, selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.height);
482
+ // const nodesRawNew = rectToPolygonNodes(
483
+ // selectionLinesPoints?.width,
484
+ // selectionLinesPoints?.height
485
+ // );
445
486
  return (_jsxs("g", { id: "selection-layer", children: [components === null || components === void 0 ? void 0 : components.map(renderShape), !isEmpty(selectionLines) && activeTool === "select" && (_jsxs(_Fragment, { children: [nodesRaw.map((p1, index) => {
446
487
  const p2 = nodesRaw[(index + 2) % nodesRaw.length];
447
488
  const side = index === 0
@@ -2,10 +2,18 @@
2
2
  import { isEmpty, omit } from "lodash";
3
3
  import { arcByDirection, distributeWithSpacing, rectToPolygonNodes, rectToPolygonPoints, } from "./utils";
4
4
  import { useAppSelector } from "../../hooks/use-redux";
5
+ import { useMemo } from "react";
5
6
  const Layers = ({ components, selectedComponent, activeTool, selectionLines, }) => {
6
7
  var _a;
7
8
  const hasPoints = selectionLines && !isEmpty(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.points);
8
9
  const lockBackground = useAppSelector((state) => state.tool.lockBackground);
10
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
11
+ const allSelectionId = useMemo(() => {
12
+ const ids = (selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item === null || item === void 0 ? void 0 : item.id)) || [];
13
+ if (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id)
14
+ ids.push(selectedComponent.id);
15
+ return ids;
16
+ }, [selectedGroup, selectedComponent]);
9
17
  const renderShape = (item) => {
10
18
  var _a, _b, _c, _d, _e, _f;
11
19
  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;
@@ -15,6 +23,19 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
15
23
  stroke,
16
24
  strokeWidth,
17
25
  };
26
+ const selectionBox = {
27
+ stroke: "#3b82f6",
28
+ strokeWidth: 4,
29
+ width: width + strokeWidth + 2,
30
+ height: height + strokeWidth + 2,
31
+ x: x - strokeWidth / 2,
32
+ y: y - strokeWidth / 2,
33
+ opacity: 0,
34
+ };
35
+ if (allSelectionId === null || allSelectionId === void 0 ? void 0 : allSelectionId.includes(id)) {
36
+ commonProps.stroke = "#ffa39e";
37
+ commonProps.strokeWidth = 4;
38
+ }
18
39
  switch (shape) {
19
40
  case "square":
20
41
  return (<g key={id} data-id={id} id={`${id}`} transform={`translate(${x}, ${y})`}>
@@ -54,7 +75,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
54
75
  points.map((_, index) => {
55
76
  return (<>
56
77
  <rect data-point={JSON.stringify(_)} id={`${index}`} key={`${id}-point-${index}`} x={(_ === null || _ === void 0 ? void 0 : _.x) - 5} y={(_ === null || _ === void 0 ? void 0 : _.y) - 5} width={10} height={10} fill="#4a90e2" cursor={"pointer"}/>
57
- <circle data-point={JSON.stringify(_)} id={`${index}`} key={`${id}-point-${index}`} cx={_ === null || _ === void 0 ? void 0 : _.x} cy={_ === null || _ === void 0 ? void 0 : _.y} r={15} fill="transparent" cursor={"pointer"}/>
78
+ <circle data-point={JSON.stringify(_)} id={`${index}`} key={`${id}-point-${index - 100}`} cx={_ === null || _ === void 0 ? void 0 : _.x} cy={_ === null || _ === void 0 ? void 0 : _.y} r={15} fill="transparent" cursor={"pointer"}/>
58
79
  </>);
59
80
  })}
60
81
  </g>
@@ -129,7 +150,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
129
150
  <circle cx={centerX} cy={centerY} r={tableRadius} fill={fill} {...commonProps}/>
130
151
  {/* Seat */}
131
152
  <g data-seat={`${id}-seats`}>
132
- {seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill}/>))}
153
+ {seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill} {...commonProps}/>))}
133
154
  </g>
134
155
 
135
156
  <g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
@@ -556,8 +577,32 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
556
577
  </g>
557
578
  </g>);
558
579
  case "bounding-box": {
559
- return (<g key={id} transform={`translate(${x}, ${y})`} data-bounding-box={id}>
580
+ const topLine = `${0},${0} ${width},${0}`;
581
+ const rightLine = `${width},${0} ${width},${height}`;
582
+ const bottomLine = `${width},${height} ${0},${height}`;
583
+ const leftLine = `${0},${height} ${0},${0}`;
584
+ return (<g key={id} id="bounding-box" transform={`translate(${x}, ${y})`} data-bounding-box={id}>
560
585
  <rect width={width} height={height} fill="none" stroke="#3b82f6" strokeWidth={1} strokeDasharray="6 4" pointerEvents="none"/>
586
+ {/* top polyline */}
587
+ <polyline points={topLine} fill="none" stroke="transparent" strokeWidth={3} data-position="top-boundaries" style={{
588
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
589
+ cursor: "row-resize",
590
+ }}/>
591
+ {/* right polyline */}
592
+ <polyline points={rightLine} fill="none" stroke="transparent" strokeWidth={3} data-position="right-boundaries" style={{
593
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
594
+ cursor: "col-resize",
595
+ }}/>
596
+ {/* bottom polyline */}
597
+ <polyline points={bottomLine} fill="none" stroke="transparent" strokeWidth={3} data-position="bottom-boundaries" style={{
598
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
599
+ cursor: "row-resize",
600
+ }}/>
601
+ {/* left polyline */}
602
+ <polyline points={leftLine} fill="none" stroke="transparent" strokeWidth={3} data-position="left-boundaries" style={{
603
+ pointerEvents: activeTool === "bounding-box" ? "none" : "stroke",
604
+ cursor: "col-resize",
605
+ }}/>
561
606
  </g>);
562
607
  }
563
608
  default:
@@ -566,6 +611,10 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
566
611
  };
567
612
  let date = new Date();
568
613
  const nodesRaw = rectToPolygonNodes(selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.width, selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.height);
614
+ // const nodesRawNew = rectToPolygonNodes(
615
+ // selectionLinesPoints?.width,
616
+ // selectionLinesPoints?.height
617
+ // );
569
618
  return (<g key={`${date}`} id="selection-layer">
570
619
  {components === null || components === void 0 ? void 0 : components.map(renderShape)}
571
620
  {!isEmpty(selectionLines) && activeTool === "select" && (<>
@@ -625,6 +674,74 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
625
674
  }))}
626
675
  </g>
627
676
  </g>
677
+ {/* {!isEmpty(selectionLinesPoints) && (
678
+ <g
679
+ key={`selection-${date}`}
680
+ id="selection-lines"
681
+ data-selection={`selection-${
682
+ selectedComponent?.id ?? selectionLines?.id
683
+ }`}
684
+ transform={`translate(${selectionLinesPoints?.x},${selectionLinesPoints?.y})`}
685
+ >
686
+ <g transform={`rotate(${0}, 0,0)`}>
687
+ <rect
688
+ width={selectionLinesPoints?.width}
689
+ height={selectionLinesPoints?.height}
690
+ fill="none"
691
+ stroke="red"
692
+ strokeWidth={1}
693
+ id="rect-box-selection"
694
+ />
695
+
696
+ {nodesRawNew?.map((node: Point, index: number) => {
697
+ const corner = (index: number) => {
698
+ switch (index) {
699
+ case 0:
700
+ return "top-left";
701
+ case 1:
702
+ return "top";
703
+ case 2:
704
+ return "top-right";
705
+ case 3:
706
+ return "right";
707
+ case 4:
708
+ return "bottom-right";
709
+ case 5:
710
+ return "bottom";
711
+ case 6:
712
+ return "bottom-left";
713
+ case 7:
714
+ return "left";
715
+ }
716
+ };
717
+
718
+ return (
719
+ <>
720
+ <circle
721
+ data-position={corner(index)}
722
+ key={index}
723
+ r={5}
724
+ cx={node.x}
725
+ cy={node.y}
726
+ fill="transparent"
727
+ style={{ cursor: "pointer" }}
728
+ />
729
+ <circle
730
+ data-position={corner(index)}
731
+ key={index}
732
+ r={5}
733
+ cx={node.x}
734
+ cy={node.y}
735
+ fill="red"
736
+ id={`circle-corner-${selectedComponent?.id}`}
737
+ style={{ cursor: "pointer" }}
738
+ />
739
+ </>
740
+ );
741
+ })}
742
+ </g>
743
+ </g>
744
+ )} */}
628
745
  </>)}
629
746
  </g>);
630
747
  };
@@ -51,7 +51,8 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
51
51
  ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"]
52
52
  : undefined;
53
53
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
54
- const gapBetweenTags = Number(gapTags || 20);
54
+ const scaleDefault = Number(fontSize || fontSizeFromLabel || 12) / 12;
55
+ const gapBetweenTags = Number(gapTags || 20) * scaleDefault;
55
56
  const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
56
57
  // Hitung total tinggi semua grup tag (buat center vertikal)
57
58
  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) => {
@@ -73,7 +74,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
73
74
  const direction = ((_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column"))
74
75
  ? "column"
75
76
  : "flex";
76
- const gap = Number(tag.gap || 2);
77
+ const gap = Number(tag.gap || 2) * scaleDefault;
77
78
  const items = tag.items || [];
78
79
  const fontSize = Number(defaultFontSize);
79
80
  const isColumn = direction === "column";
@@ -49,7 +49,8 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
49
49
  ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"]
50
50
  : undefined;
51
51
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
52
- const gapBetweenTags = Number(gapTags || 20);
52
+ const scaleDefault = Number(fontSize || fontSizeFromLabel || 12) / 12;
53
+ const gapBetweenTags = Number(gapTags || 20) * scaleDefault;
53
54
  const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
54
55
  // Hitung total tinggi semua grup tag (buat center vertikal)
55
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) => {
@@ -71,7 +72,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
71
72
  const direction = ((_a = tag.direction) === null || _a === void 0 ? void 0 : _a.includes("column"))
72
73
  ? "column"
73
74
  : "flex";
74
- const gap = Number(tag.gap || 2);
75
+ const gap = Number(tag.gap || 2) * scaleDefault;
75
76
  const items = tag.items || [];
76
77
  const fontSize = Number(defaultFontSize);
77
78
  const isColumn = direction === "column";
@@ -0,0 +1,60 @@
1
+ export declare const tagsDummy: (name: string, icon: string) => ({
2
+ gap: string;
3
+ key: string;
4
+ items: {
5
+ type: string;
6
+ value: string;
7
+ }[];
8
+ direction: string;
9
+ offsetX?: undefined;
10
+ offsetY?: undefined;
11
+ } | {
12
+ gap: string;
13
+ key: string;
14
+ items: {
15
+ type: string;
16
+ value: string;
17
+ }[];
18
+ offsetX: string;
19
+ offsetY: string;
20
+ direction: string;
21
+ } | {
22
+ gap: string;
23
+ key: string;
24
+ items: ({
25
+ type: string;
26
+ value: string;
27
+ fontWeight: string;
28
+ textDecoration: string;
29
+ symbol?: undefined;
30
+ } | {
31
+ type: string;
32
+ value: string;
33
+ fontWeight?: undefined;
34
+ textDecoration?: undefined;
35
+ symbol?: undefined;
36
+ } | {
37
+ type: string;
38
+ value: string;
39
+ symbol: {
40
+ value: string;
41
+ gap: number;
42
+ position: string;
43
+ };
44
+ fontWeight?: undefined;
45
+ textDecoration?: undefined;
46
+ })[];
47
+ direction: string;
48
+ offsetY: number;
49
+ offsetX?: undefined;
50
+ })[];
51
+ export declare const PRIVILEGED_TAGS: {
52
+ CURRENT_TIME: {
53
+ key: string;
54
+ items: string[];
55
+ }[];
56
+ NEXT_3_RESERVATION: {
57
+ key: string;
58
+ items: string[];
59
+ }[];
60
+ };
@@ -0,0 +1,93 @@
1
+ export const tagsDummy = (name, icon) => [
2
+ {
3
+ gap: "8",
4
+ key: "table",
5
+ items: [
6
+ {
7
+ type: "text",
8
+ value: name,
9
+ },
10
+ {
11
+ type: "icon",
12
+ value: icon,
13
+ },
14
+ ],
15
+ direction: "column",
16
+ },
17
+ {
18
+ gap: "8",
19
+ key: "pax",
20
+ items: [
21
+ {
22
+ type: "icon",
23
+ value: "people",
24
+ },
25
+ {
26
+ type: "text",
27
+ value: "0/8",
28
+ },
29
+ ],
30
+ offsetX: "3",
31
+ offsetY: "1",
32
+ direction: "flex",
33
+ },
34
+ {
35
+ gap: "2",
36
+ key: "rsvp_time",
37
+ items: [
38
+ {
39
+ type: "text",
40
+ value: "18:00",
41
+ fontWeight: "bold",
42
+ textDecoration: "underline",
43
+ },
44
+ {
45
+ type: "text",
46
+ value: "19:00",
47
+ },
48
+ {
49
+ type: "text",
50
+ value: "22:00",
51
+ symbol: {
52
+ value: "+1",
53
+ gap: 1,
54
+ position: "right-top"
55
+ },
56
+ },
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
+ ],
68
+ direction: "column",
69
+ offsetY: -35,
70
+ },
71
+ ];
72
+ export const PRIVILEGED_TAGS = {
73
+ CURRENT_TIME: [
74
+ {
75
+ key: "table",
76
+ items: ["text", "icon"],
77
+ },
78
+ {
79
+ key: "pax",
80
+ items: ["text", "icon"],
81
+ },
82
+ ],
83
+ NEXT_3_RESERVATION: [
84
+ {
85
+ key: "table",
86
+ items: ["text"],
87
+ },
88
+ {
89
+ key: "rsvp_time",
90
+ items: ["text"],
91
+ },
92
+ ],
93
+ };
@@ -0,0 +1,24 @@
1
+ import { EventHandleType } from "../../dto/event-handler";
2
+ import { PropertiesProps } from "../../dto/table";
3
+ import { TableMatchEvent } from "../../features/view-only-3";
4
+ interface LayersProps {
5
+ components?: PropertiesProps[];
6
+ selectedComponent?: PropertiesProps;
7
+ activeTool?: string;
8
+ onBlur?: () => void;
9
+ selectedTable?: PropertiesProps;
10
+ iconTags?: {
11
+ icon: React.JSX.Element;
12
+ key: string;
13
+ }[];
14
+ eventMatchTable?: TableMatchEvent[];
15
+ onHighlightGroup?: (group: SVGGElement, eventType: EventHandleType) => void;
16
+ onForceRestoreGroup?: (group: SVGGElement, eventType: EventHandleType) => void;
17
+ selectedTableColor?: string;
18
+ privilegedTags?: {
19
+ key: string;
20
+ items: string[];
21
+ }[];
22
+ }
23
+ declare const Layers: ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, privilegedTags, }: LayersProps) => import("react/jsx-runtime").JSX.Element;
24
+ export default Layers;