seat-editor 1.2.15 → 1.2.16

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 (57) hide show
  1. package/dist/app/layout.d.ts +1 -1
  2. package/dist/app/new-board/page.d.ts +1 -1
  3. package/dist/app/old-board/page.d.ts +1 -2
  4. package/dist/app/old-board/page.js +5 -0
  5. package/dist/app/only-view/page.d.ts +1 -1
  6. package/dist/app/page.d.ts +1 -1
  7. package/dist/components/button-tools/index.d.ts +1 -1
  8. package/dist/components/form-tools/label.d.ts +1 -1
  9. package/dist/components/form-tools/shape.d.ts +1 -1
  10. package/dist/components/input/number-indicator.d.ts +1 -1
  11. package/dist/components/layer/index.d.ts +1 -1
  12. package/dist/components/layer/index.js +22 -10
  13. package/dist/components/lib/index.d.ts +1 -1
  14. package/dist/components/modal-preview/index.d.ts +1 -1
  15. package/dist/features/board/index.d.ts +1 -1
  16. package/dist/features/navbar/index.d.ts +1 -1
  17. package/dist/features/package/index.d.ts +1 -1
  18. package/dist/features/panel/index.d.ts +1 -1
  19. package/dist/features/panel/index.js +0 -5
  20. package/dist/features/panel/select-tool.d.ts +1 -1
  21. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  22. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  23. package/dist/features/panel/text-tool.d.ts +1 -1
  24. package/dist/features/panel/upload-tool.d.ts +1 -1
  25. package/dist/features/panel/upload-tool.js +0 -3
  26. package/dist/features/side-tool/index.d.ts +1 -1
  27. package/dist/features/view/index.d.ts +1 -1
  28. package/dist/features/view/index.js +10 -8
  29. package/dist/provider/redux-provider.d.ts +1 -1
  30. package/dist/provider/store-provider.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/dist/app/layout.jsx +0 -27
  33. package/dist/app/new-board/page.jsx +0 -12
  34. package/dist/app/old-board/page.jsx +0 -510
  35. package/dist/app/only-view/page.jsx +0 -19
  36. package/dist/app/page.jsx +0 -13
  37. package/dist/components/button-tools/index.jsx +0 -17
  38. package/dist/components/form-tools/label.jsx +0 -44
  39. package/dist/components/form-tools/shape.jsx +0 -43
  40. package/dist/components/input/number-indicator.jsx +0 -36
  41. package/dist/components/layer/index.jsx +0 -254
  42. package/dist/components/lib/index.jsx +0 -33
  43. package/dist/components/modal-preview/index.jsx +0 -11
  44. package/dist/features/board/index.jsx +0 -290
  45. package/dist/features/navbar/index.jsx +0 -5
  46. package/dist/features/package/index.jsx +0 -39
  47. package/dist/features/panel/index.jsx +0 -86
  48. package/dist/features/panel/select-tool.jsx +0 -45
  49. package/dist/features/panel/square-circle-tool.jsx +0 -10
  50. package/dist/features/panel/table-seat-circle.jsx +0 -31
  51. package/dist/features/panel/text-tool.jsx +0 -22
  52. package/dist/features/panel/upload-tool.jsx +0 -77
  53. package/dist/features/side-tool/index.jsx +0 -211
  54. package/dist/features/view/index.jsx +0 -147
  55. package/dist/provider/antd-provider.jsx +0 -30
  56. package/dist/provider/redux-provider.jsx +0 -6
  57. package/dist/provider/store-provider.jsx +0 -8
@@ -3,4 +3,4 @@ import "./globals.css";
3
3
  export declare const metadata: Metadata;
4
4
  export default function RootLayout({ children, }: Readonly<{
5
5
  children: React.ReactNode;
6
- }>): import("react").JSX.Element;
6
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export default function NewBoard(): import("react").JSX.Element;
1
+ export default function NewBoard(): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,2 @@
1
- import React from "react";
2
- declare const SeatEditor: () => React.JSX.Element;
1
+ declare const SeatEditor: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default SeatEditor;
@@ -15,6 +15,7 @@ const SeatEditor = () => {
15
15
  const [shadowRect, setShadowRect] = useState(null);
16
16
  const [showModal, setShowModal] = useState(false);
17
17
  const [dragOffset, setDragOffset] = useState(null);
18
+ console.log({ rectangles });
18
19
  const [zoom, setZoom] = useState(1);
19
20
  const [resizeDirection, setResizeDirection] = useState(null);
20
21
  const [images, setImages] = useState([]);
@@ -29,12 +30,15 @@ const SeatEditor = () => {
29
30
  const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
30
31
  if (!file)
31
32
  return;
33
+ console.log({ file });
32
34
  const reader = new FileReader();
33
35
  reader.onload = () => {
34
36
  const img = document.createElement("img");
35
37
  img.src = reader.result;
38
+ console.log({ img });
36
39
  let width = img.width > widthWorkspace ? img.width / 2 : img.width;
37
40
  let height = img.height > heightWorkspace ? img.height / 2 : img.height;
41
+ console.log({ width, height }, img.width, img.height);
38
42
  img.onload = () => {
39
43
  setRectangles((prev) => [
40
44
  ...prev,
@@ -284,6 +288,7 @@ const SeatEditor = () => {
284
288
  }
285
289
  };
286
290
  const exportJSON = () => {
291
+ console.log({ rectangles, images });
287
292
  // const json = JSON.stringify(rectangles, null, 2);
288
293
  // const blob = new Blob([json], { type: "application/json" });
289
294
  // const link = document.createElement("a");
@@ -1,2 +1,2 @@
1
- declare const OnlyView: () => import("react").JSX.Element;
1
+ declare const OnlyView: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default OnlyView;
@@ -1,2 +1,2 @@
1
- declare const TableEditor: () => import("react").JSX.Element;
1
+ declare const TableEditor: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default TableEditor;
@@ -7,5 +7,5 @@ interface ButtonToolsProps {
7
7
  }>;
8
8
  popoverProps?: PopoverProps;
9
9
  }
10
- declare const ButtonTools: (props: ButtonToolsProps) => import("react").JSX.Element;
10
+ declare const ButtonTools: (props: ButtonToolsProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export default ButtonTools;
@@ -1,2 +1,2 @@
1
- declare const SectionLabel: () => import("react").JSX.Element;
1
+ declare const SectionLabel: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SectionLabel;
@@ -1,2 +1,2 @@
1
- declare const SectionShape: () => import("react").JSX.Element;
1
+ declare const SectionShape: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SectionShape;
@@ -3,5 +3,5 @@ interface NumberIndicatorProps {
3
3
  defaultValue?: number;
4
4
  onChange: (value: number) => void;
5
5
  }
6
- declare const NumberIndicator: ({ name, defaultValue, onChange }: NumberIndicatorProps) => import("react").JSX.Element;
6
+ declare const NumberIndicator: ({ name, defaultValue, onChange }: NumberIndicatorProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default NumberIndicator;
@@ -12,5 +12,5 @@ interface LayersProps {
12
12
  style?: any;
13
13
  mode?: "view" | "edit";
14
14
  }
15
- declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style }: LayersProps) => import("react").JSX.Element;
15
+ declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style }: LayersProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export default Layers;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { omit } from "lodash";
4
- const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, }) => {
4
+ const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode = "edit", style }) => {
5
5
  const renderShadowShape = (item) => {
6
6
  const { id, x, y, width, height, fill, opacity, rotation, shape, fontColor, text, seatFill, labels, } = item;
7
7
  const commonProps = { fill, opacity };
@@ -86,17 +86,23 @@ const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedT
86
86
  };
87
87
  switch (shape) {
88
88
  case "square":
89
- return (_jsxs(_Fragment, { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity"), { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})` }), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
89
+ return (_jsxs(_Fragment, { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity"), { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})` }), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
90
90
  var _a, _b, _c, _d;
91
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
91
+ return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
92
+ e.stopPropagation();
93
+ onClick(item);
94
+ }, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
92
95
  })] }));
93
96
  case "circle":
94
- return (_jsxs(_Fragment, { children: [_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity")), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
97
+ return (_jsxs(_Fragment, { children: [_jsx("circle", Object.assign({ cx: x + width / 2, cy: y + height / 2, r: width / 2, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill, opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity }, omit(commonProps, "opacity")), id), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
95
98
  var _a, _b, _c, _d;
96
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
99
+ return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
100
+ e.stopPropagation();
101
+ onClick(item);
102
+ }, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
97
103
  })] }));
98
104
  case "diamond":
99
- return (_jsxs(_Fragment, { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, transform: `rotate(${rotation}, ${x}, ${y})` }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }), id), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label })] }));
105
+ return (_jsxs(_Fragment, { children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), transform: `rotate(${rotation}, ${x}, ${y})` }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }), id), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label })] }));
100
106
  case "table-seat-circle": {
101
107
  const seatCount = item.seatCount;
102
108
  const openSpace = item.openSpace; // nilai antara 0 (tidak ada ruang) sampai maksimal ~0.9
@@ -114,9 +120,12 @@ const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedT
114
120
  const cy = centerY + radius * Math.sin(angle);
115
121
  return { cx, cy };
116
122
  });
117
- return (_jsxs("g", { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: width - 15, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, commonProps, { opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity })), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
123
+ return (_jsxs("g", { transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: [_jsx("circle", Object.assign({ cx: centerX, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), cy: centerY, r: width - 15, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, commonProps, { opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity })), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
118
124
  var _a, _b, _c, _d;
119
- return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
125
+ return (_jsx("text", { x: x + width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: y + height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})`, onClick: (e) => {
126
+ e.stopPropagation();
127
+ onClick(item);
128
+ }, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
120
129
  }), _jsx("g", { fill: "#e6b9c0", opacity: id === (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) ? 0.5 : opacity, stroke: "#c49ba3", strokeWidth: "1", children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill }, `${id}-seat-${i}`))) })] }, id));
121
130
  }
122
131
  case "table-seat-square": {
@@ -137,10 +146,13 @@ const Layers = ({ shadowShape, components, onClick, selectedComponent, selectedT
137
146
  cx: startX + i * spacing,
138
147
  cy: y + height + seatRadius * 1.5,
139
148
  }));
140
- return (_jsxs("g", { transform: `rotate(${rotation}, ${x}, ${y})`, children: [_jsx("rect", Object.assign({ x: x, y: y, width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill })), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label }), _jsx("g", { fill: "#e6b9c0", fillOpacity: "0.5", stroke: "#c49ba3", strokeWidth: "1", children: [...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius }, `${id}-seat-${i}`))) })] }, id));
149
+ return (_jsxs("g", { transform: `rotate(${rotation}, ${x}, ${y})`, children: [_jsx("rect", Object.assign({ x: x, y: y, style: Object.assign({ cursor: mode === "view" ? "pointer" : "default" }, style), width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill })), _jsx("text", { x: x + width / 2, y: y + height / 2, fill: fontColor !== null && fontColor !== void 0 ? fontColor : "black", fontSize: `${fontSize !== null && fontSize !== void 0 ? fontSize : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", children: label }), _jsx("g", { fill: "#e6b9c0", fillOpacity: "0.5", stroke: "#c49ba3", strokeWidth: "1", children: [...topSeats, ...bottomSeats].map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius }, `${id}-seat-${i}`))) })] }, id));
141
150
  }
142
151
  case "text":
143
- return (_jsxs("g", { children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity }), _jsx("text", Object.assign({ x: x + width / 2, y: y + height / 2, textAnchor: "middle", dominantBaseline: "middle", fill: fontColor, fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : height * 0.6, opacity: opacity }, omit(commonProps, ["fill", "opacity"]), { children: text }))] }, id));
152
+ return (_jsxs("g", { children: [_jsx("rect", { x: x, y: y, width: width, height: height, fill: "transparent", opacity: opacity, onClick: (e) => {
153
+ e.stopPropagation();
154
+ onClick(item);
155
+ } }), _jsx("text", Object.assign({ x: x + width / 2, y: y + height / 2, textAnchor: "middle", dominantBaseline: "middle", fill: fontColor, fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : height * 0.6, opacity: opacity }, omit(commonProps, ["fill", "opacity"]), { children: text }))] }, id));
144
156
  case "image-table":
145
157
  case "background":
146
158
  return (_jsxs("g", { onClick: () => onClick(item), children: [_jsx("image", Object.assign({ href: src, x: x, y: y, width: width, height: height, transform: `rotate(${rotation} ${x + width / 2} ${y + height / 2})` }, commonProps)), labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -3,6 +3,6 @@ export interface LayerViewProps {
3
3
  componentProps: any[];
4
4
  extraComponentProps: any[];
5
5
  }
6
- declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react").JSX.Element;
6
+ declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TableEditor;
8
8
  export { LayerView };
@@ -1,4 +1,4 @@
1
1
  declare const ModalPreview: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react").JSX.Element;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
4
  export default ModalPreview;
@@ -1,5 +1,5 @@
1
1
  interface BoardTemplateProps {
2
2
  onSelectComponent?: (items: any) => void;
3
3
  }
4
- declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react").JSX.Element;
4
+ declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
5
5
  export default BoardTemplate;
@@ -1,2 +1,2 @@
1
- declare const Navbar: () => import("react").JSX.Element;
1
+ declare const Navbar: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Navbar;
@@ -13,5 +13,5 @@ export interface TableEditorProps {
13
13
  ];
14
14
  statusKey: string;
15
15
  }
16
- declare const TableEditor: (props: TableEditorProps) => import("react").JSX.Element;
16
+ declare const TableEditor: (props: TableEditorProps) => import("react/jsx-runtime").JSX.Element;
17
17
  export default TableEditor;
@@ -1,2 +1,2 @@
1
- declare const ControlPanels: () => import("react").JSX.Element;
1
+ declare const ControlPanels: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default ControlPanels;
@@ -16,7 +16,6 @@ const ControlPanels = () => {
16
16
  const [form] = Form.useForm();
17
17
  let values = Form.useWatch([], form);
18
18
  useEffect(() => {
19
- console.log("masuuuuk");
20
19
  if (selectedComponent) {
21
20
  const isDifferentId = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) !== (values === null || values === void 0 ? void 0 : values.id) || !(values === null || values === void 0 ? void 0 : values.id);
22
21
  const isSameIdAndSameDimensions = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) === (values === null || values === void 0 ? void 0 : values.id) &&
@@ -24,15 +23,12 @@ const ControlPanels = () => {
24
23
  (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.width) === (values === null || values === void 0 ? void 0 : values.width) &&
25
24
  (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x) === (values === null || values === void 0 ? void 0 : values.x) &&
26
25
  (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y) === (values === null || values === void 0 ? void 0 : values.y);
27
- console.log({ isDifferentId, isSameIdAndSameDimensions, show });
28
26
  if (show && (isDifferentId || isSameIdAndSameDimensions)) {
29
27
  setOpen(true);
30
28
  }
31
- console.log("turee");
32
29
  form.setFieldsValue(selectedComponent);
33
30
  }
34
31
  else {
35
- console.log("false");
36
32
  setOpen(false);
37
33
  }
38
34
  }, [selectedComponent]);
@@ -77,7 +73,6 @@ const ControlPanels = () => {
77
73
  };
78
74
  // if(!show) return null
79
75
  return (_jsx(Drawer, { open: show, onClose: handleClose, title: "Panel", children: _jsx("div", { className: "bg-white h-full max-h-screen overflow-y-auto w-[300px]", children: _jsxs(Form, { layout: "vertical", form: form, name: "table", onFinish: (values) => {
80
- console.log(values);
81
76
  }, onValuesChange: handleChangeComponent, initialValues: { labels: [{}] }, children: [_jsx(Form.Item, { name: "id", hidden: true, children: _jsx(Input, {}) }), renderFormPanel()] }) }) }));
82
77
  };
83
78
  export default ControlPanels;
@@ -1,4 +1,4 @@
1
1
  declare const SelectToolForm: ({ title }: {
2
2
  title?: string;
3
- }) => import("react").JSX.Element;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
4
  export default SelectToolForm;
@@ -1,2 +1,2 @@
1
- declare const SquareToolForm: () => import("react").JSX.Element;
1
+ declare const SquareToolForm: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SquareToolForm;
@@ -1,2 +1,2 @@
1
- declare const SeatCircle: () => import("react").JSX.Element;
1
+ declare const SeatCircle: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SeatCircle;
@@ -1,2 +1,2 @@
1
- declare const TextTool: () => import("react").JSX.Element;
1
+ declare const TextTool: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default TextTool;
@@ -2,5 +2,5 @@ interface UploadToolProps {
2
2
  name: string;
3
3
  type?: "component" | "background";
4
4
  }
5
- declare const UploadTool: ({ name, type }: UploadToolProps) => import("react").JSX.Element;
5
+ declare const UploadTool: ({ name, type }: UploadToolProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default UploadTool;
@@ -57,9 +57,6 @@ const UploadTool = ({ name, type }) => {
57
57
  message.error(`${info.file.name} file upload failed.`);
58
58
  }
59
59
  },
60
- onDrop(e) {
61
- console.log("Dropped files", e.dataTransfer.files);
62
- },
63
60
  };
64
61
  return (_jsxs(_Fragment, { children: [_jsxs(Dragger, Object.assign({}, props, { children: [_jsx("p", { className: "ant-upload-drag-icon", children: _jsx(InboxOutlined, {}) }), _jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), _jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] })), _jsx(SectionShape, {}), _jsx(SectionLabel, {})] }));
65
62
  };
@@ -1,2 +1,2 @@
1
- declare const SideTool: () => import("react").JSX.Element;
1
+ declare const SideTool: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SideTool;
@@ -12,5 +12,5 @@ export interface LayerViewProps {
12
12
  statusKey: string;
13
13
  transformProps?: any;
14
14
  }
15
- declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
15
+ declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export default LayerView;
@@ -52,28 +52,29 @@ const LayerView = (props) => {
52
52
  }
53
53
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
54
54
  componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.forEach((_) => {
55
+ var _a, _b, _c, _d;
55
56
  let values = mappingKey ? _[mappingKey] : _.shape;
56
57
  if (!values)
57
58
  return;
58
- if (values.shape.includes("square")) {
59
+ if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("square")) {
59
60
  minX = Math.min(minX, values.x);
60
61
  minY = Math.min(minY, values.y);
61
62
  maxX = Math.max(maxX, values.x + values.width);
62
63
  maxY = Math.max(maxY, values.y + values.height);
63
64
  }
64
- if (values.shape.includes("circle")) {
65
+ if ((_b = values === null || values === void 0 ? void 0 : values.shape) === null || _b === void 0 ? void 0 : _b.includes("circle")) {
65
66
  minX = Math.min(minX, values.x);
66
67
  minY = Math.min(minY, values.y);
67
68
  maxX = Math.max(maxX, values.x + values.width);
68
69
  maxY = Math.max(maxY, values.y + values.height);
69
70
  }
70
- if (values.shape.includes("table-seat-circle")) {
71
+ if ((_c = values === null || values === void 0 ? void 0 : values.shape) === null || _c === void 0 ? void 0 : _c.includes("table-seat-circle")) {
71
72
  minX = Math.min(minX, values.x);
72
73
  minY = Math.min(minY, values.y);
73
74
  maxX = Math.max(maxX, values.x + values.width);
74
75
  maxY = Math.max(maxY, values.y + values.height);
75
76
  }
76
- if (values.shape.includes("image-table")) {
77
+ if ((_d = values === null || values === void 0 ? void 0 : values.shape) === null || _d === void 0 ? void 0 : _d.includes("image-table")) {
77
78
  minX = Math.min(minX, values.x);
78
79
  minY = Math.min(minY, values.y);
79
80
  maxX = Math.max(maxX, values.x + values.width);
@@ -101,7 +102,6 @@ const LayerView = (props) => {
101
102
  };
102
103
  }, [componentsEditor, extraComponentsEditor]);
103
104
  let elementEditor = [, ...componentsEditor];
104
- console.log({ elementEditor });
105
105
  const renderElements = (elementEditor, mappingKey, colorMatchKey) => {
106
106
  return elementEditor.map((editorItem, i) => {
107
107
  var _a, _b, _c, _d;
@@ -120,7 +120,9 @@ const LayerView = (props) => {
120
120
  return finalProps;
121
121
  });
122
122
  };
123
- return (_jsx("div", { className: "relative w-full h-full flex-1", ref: containerRef, children: _jsx(TransformWrapper, { ref: transformRef, panning: { disabled: false }, centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, pinch: { step: 1 }, smooth: true, disablePadding: true, children: _jsx(TransformComponent, { wrapperStyle: {
123
+ return (_jsx("div", { className: "relative w-full h-full flex-1", ref: containerRef, children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, { panning: {
124
+ disabled: false,
125
+ }, centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, pinch: { step: 1 }, smooth: true, children: _jsx(TransformComponent, { wrapperStyle: {
124
126
  width: "100%",
125
127
  height: "100%",
126
128
  overflow: "hidden",
@@ -130,9 +132,9 @@ const LayerView = (props) => {
130
132
  }, children: _jsx("svg", { id: "workspace", ref: svgRef, width: "100%", height: "100%", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
131
133
  background: backgroundColor,
132
134
  display: "block",
133
- }, children: _jsx(Layers, { components: [
135
+ }, children: _jsx(Layers, { mode: "view", components: [
134
136
  ...extraComponentsEditor,
135
137
  ...renderElements(componentsEditor, mappingKey, colorMatchKey),
136
- ], onClick: handleSelectComponent, selectedTable: selectedTable, selectedTableColor: selectedTableColor }) }) }) }) }));
138
+ ], onClick: handleSelectComponent, selectedTable: selectedTable, selectedTableColor: selectedTableColor }) }) }) })) }));
137
139
  };
138
140
  export default LayerView;
@@ -1,3 +1,3 @@
1
1
  export declare const ReduxProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react").JSX.Element;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  export declare const StoreProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react").JSX.Element;
3
+ }) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,27 +0,0 @@
1
- import localFont from "next/font/local";
2
- import "./globals.css";
3
- import { Layout } from "antd";
4
- import { StoreProvider } from "../provider/store-provider";
5
- const geistSans = localFont({
6
- src: "./fonts/GeistVF.woff",
7
- variable: "--font-geist-sans",
8
- weight: "100 900",
9
- });
10
- const geistMono = localFont({
11
- src: "./fonts/GeistMonoVF.woff",
12
- variable: "--font-geist-mono",
13
- weight: "100 900",
14
- });
15
- export const metadata = {
16
- title: "Create Next App",
17
- description: "Generated by create next app",
18
- };
19
- export default function RootLayout({ children, }) {
20
- return (<html lang="en">
21
- <body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
22
- <StoreProvider>
23
- <Layout>{children}</Layout>
24
- </StoreProvider>
25
- </body>
26
- </html>);
27
- }
@@ -1,12 +0,0 @@
1
- import Board from "../../features/board";
2
- import SideTool from "../../features/side-tool";
3
- import ControlPanels from "../../features/panel";
4
- export default function NewBoard() {
5
- return (<>
6
- <div className="w-full h-screen flex relative">
7
- <SideTool />
8
- <Board />
9
- <ControlPanels />
10
- </div>
11
- </>);
12
- }