seat-editor 1.6.14 → 1.6.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 (69) 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/new-board/page.js +4 -1
  4. package/dist/app/new-board/page.jsx +4 -1
  5. package/dist/app/old-board/page.d.ts +2 -1
  6. package/dist/app/only-view/page.d.ts +1 -1
  7. package/dist/app/page.d.ts +1 -1
  8. package/dist/app/test/page.d.ts +2 -1
  9. package/dist/app/v2/page.d.ts +1 -1
  10. package/dist/components/button-tools/index.d.ts +1 -1
  11. package/dist/components/form-tools/label.d.ts +1 -1
  12. package/dist/components/form-tools/shape.d.ts +1 -1
  13. package/dist/components/input/number-indicator.d.ts +1 -1
  14. package/dist/components/joystick/index.d.ts +2 -1
  15. package/dist/components/layer/index.d.ts +1 -1
  16. package/dist/components/layer-v2/index.d.ts +1 -1
  17. package/dist/components/lib/index.d.ts +1 -1
  18. package/dist/components/modal-preview/index.d.ts +1 -1
  19. package/dist/features/board/index.d.ts +1 -1
  20. package/dist/features/board-v2/index.d.ts +2 -1
  21. package/dist/features/board-v2/index.js +0 -1
  22. package/dist/features/board-v2/index.jsx +0 -1
  23. package/dist/features/navbar/index.d.ts +1 -1
  24. package/dist/features/package/index.d.ts +5 -1
  25. package/dist/features/package/index.js +2 -2
  26. package/dist/features/package/index.jsx +2 -2
  27. package/dist/features/panel/index.d.ts +1 -1
  28. package/dist/features/panel/index.js +12 -11
  29. package/dist/features/panel/index.jsx +12 -11
  30. package/dist/features/panel/select-tool.d.ts +1 -1
  31. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  32. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  33. package/dist/features/panel/text-tool.d.ts +1 -1
  34. package/dist/features/panel/upload-tool.d.ts +1 -1
  35. package/dist/features/side-tool/index.d.ts +6 -2
  36. package/dist/features/side-tool/index.js +34 -22
  37. package/dist/features/side-tool/index.jsx +36 -23
  38. package/dist/features/view/index.d.ts +1 -1
  39. package/dist/features/view-only/index.d.ts +1 -1
  40. package/dist/provider/redux-provider.d.ts +1 -1
  41. package/dist/provider/store-provider.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/dist/app/layout.js +0 -22
  44. package/dist/app/old-board/page.js +0 -377
  45. package/dist/app/only-view/page.js +0 -41
  46. package/dist/app/page.js +0 -8
  47. package/dist/app/test/page.js +0 -43
  48. package/dist/app/v2/page.js +0 -8
  49. package/dist/components/button-tools/index.js +0 -11
  50. package/dist/components/form-tools/label.js +0 -7
  51. package/dist/components/form-tools/shape.js +0 -25
  52. package/dist/components/input/number-indicator.js +0 -27
  53. package/dist/components/joystick/index.js +0 -48
  54. package/dist/components/layer/index.js +0 -295
  55. package/dist/components/layer-v2/index.js +0 -282
  56. package/dist/components/lib/index.js +0 -28
  57. package/dist/components/modal-preview/index.js +0 -10
  58. package/dist/features/board/index.js +0 -666
  59. package/dist/features/navbar/index.js +0 -6
  60. package/dist/features/panel/select-tool.js +0 -48
  61. package/dist/features/panel/square-circle-tool.js +0 -8
  62. package/dist/features/panel/table-seat-circle.js +0 -9
  63. package/dist/features/panel/text-tool.js +0 -7
  64. package/dist/features/panel/upload-tool.js +0 -130
  65. package/dist/features/view/index.js +0 -219
  66. package/dist/features/view-only/index.js +0 -197
  67. package/dist/provider/antd-provider.js +0 -43
  68. package/dist/provider/redux-provider.js +0 -7
  69. package/dist/provider/store-provider.js +0 -9
@@ -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-runtime").JSX.Element;
6
+ }>): import("react").JSX.Element;
@@ -1 +1 @@
1
- export default function NewBoard(): import("react/jsx-runtime").JSX.Element;
1
+ export default function NewBoard(): import("react").JSX.Element;
@@ -19,7 +19,10 @@ export default function NewBoard() {
19
19
  height: 100,
20
20
  }]);
21
21
  }, []);
22
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("button", { className: "bg-blue-500 text-white px-4 py-2 rounded", onClick: () => setViewOnly(!viewOnly), children: viewOnly ? "Edit Mode" : "View Mode" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, dragOnly: true, mappingKey: "properties", onCurrentStateChange: (setState) => {
22
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("button", { className: "bg-blue-500 text-white px-4 py-2 rounded", onClick: () => setViewOnly(!viewOnly), children: viewOnly ? "Edit Mode" : "View Mode" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, dragOnly: true, deleteAutorized: {
23
+ component: true,
24
+ extraComponent: true,
25
+ }, mappingKey: "properties", onCurrentStateChange: (setState) => {
23
26
  var _a, _b, _c, _d;
24
27
  if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
25
28
  setInitialValue((_b = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _b !== void 0 ? _b : []);
@@ -35,7 +35,10 @@ export default function NewBoard() {
35
35
  {viewOnly ? "Edit Mode" : "View Mode"}
36
36
  </button>
37
37
  <div className="flex-1 h-full">
38
- <SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly mappingKey="properties" onCurrentStateChange={(setState) => {
38
+ <SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly deleteAutorized={{
39
+ component: true,
40
+ extraComponent: true,
41
+ }} mappingKey="properties" onCurrentStateChange={(setState) => {
39
42
  var _a, _b, _c, _d;
40
43
  if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
41
44
  setInitialValue((_b = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _b !== void 0 ? _b : []);
@@ -1,2 +1,3 @@
1
- declare const SeatEditor: () => import("react/jsx-runtime").JSX.Element;
1
+ import React from "react";
2
+ declare const SeatEditor: () => React.JSX.Element;
2
3
  export default SeatEditor;
@@ -1,2 +1,2 @@
1
- declare const TouchScrollDetect: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TouchScrollDetect: () => import("react").JSX.Element;
2
2
  export default TouchScrollDetect;
@@ -1,2 +1,2 @@
1
- declare const TableEditor: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TableEditor: () => import("react").JSX.Element;
2
2
  export default TableEditor;
@@ -1 +1,2 @@
1
- export default function DraggableRect(): import("react/jsx-runtime").JSX.Element;
1
+ import React from "react";
2
+ export default function DraggableRect(): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- declare const TableEditor: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TableEditor: () => import("react").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-runtime").JSX.Element;
10
+ declare const ButtonTools: (props: ButtonToolsProps) => import("react").JSX.Element;
11
11
  export default ButtonTools;
@@ -1,2 +1,2 @@
1
- declare const SectionLabel: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const SectionLabel: () => import("react").JSX.Element;
2
2
  export default SectionLabel;
@@ -1,2 +1,2 @@
1
- declare const SectionShape: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const SectionShape: () => import("react").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-runtime").JSX.Element;
6
+ declare const NumberIndicator: ({ name, defaultValue, onChange }: NumberIndicatorProps) => import("react").JSX.Element;
7
7
  export default NumberIndicator;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  type JoystickPosition = {
2
3
  x: number;
3
4
  y: number;
@@ -7,5 +8,5 @@ type JoystickProps = {
7
8
  onMove?: (pos: JoystickPosition) => void;
8
9
  onEnd?: () => void;
9
10
  };
10
- export declare const Joystick: ({ size, onMove, onEnd, }: JoystickProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Joystick: ({ size, onMove, onEnd, }: JoystickProps) => React.JSX.Element;
11
12
  export {};
@@ -15,5 +15,5 @@ interface LayersProps {
15
15
  onTouchMove?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
16
16
  onTouchEnd?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
17
17
  }
18
- declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style, onTouchEnd, onTouchMove, onTouchStart }: LayersProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style, onTouchEnd, onTouchMove, onTouchStart }: LayersProps) => import("react").JSX.Element;
19
19
  export default Layers;
@@ -15,5 +15,5 @@ interface LayersProps {
15
15
  onTouchMove?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
16
16
  onTouchEnd?: (e: React.TouchEvent<SVGRectElement | SVGCircleElement | SVGTextElement | SVGImageElement>) => void;
17
17
  }
18
- declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style, onTouchStart }: LayersProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const Layers: ({ shadowShape, components, onClick, selectedComponent, selectedTable, activeTool, onMouseDown, onMouseUp, onBlur, selectedTableColor, mode, style, onTouchStart }: LayersProps) => import("react").JSX.Element;
19
19
  export default Layers;
@@ -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-runtime").JSX.Element;
6
+ declare const TableEditor: ({ componentProps, extraComponentProps, }: LayerViewProps) => import("react").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-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
4
  export default ModalPreview;
@@ -2,5 +2,5 @@ interface BoardTemplateProps {
2
2
  onSelectComponent?: (items: any) => void;
3
3
  mappingKey?: string;
4
4
  }
5
- declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react").JSX.Element;
6
6
  export default BoardTemplate;
@@ -1,6 +1,7 @@
1
+ import React from "react";
1
2
  interface BoardTemplateProps {
2
3
  onSelectComponent?: (items: any) => void;
3
4
  mappingKey?: string;
4
5
  }
5
- declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => React.JSX.Element;
6
7
  export default BoardTemplate;
@@ -456,7 +456,6 @@ const BoardTemplate = ({ onSelectComponent }) => {
456
456
  const handleUnSelectComponent = () => {
457
457
  dispatch({ type: "panel/setSelectedComponent", payload: null });
458
458
  setSelectedComponent(null);
459
- dispatch({ type: "panel/setShow", payload: true });
460
459
  };
461
460
  // const handleTouchStart = (
462
461
  // e: React.TouchEvent<
@@ -455,7 +455,6 @@ const BoardTemplate = ({ onSelectComponent }) => {
455
455
  const handleUnSelectComponent = () => {
456
456
  dispatch({ type: "panel/setSelectedComponent", payload: null });
457
457
  setSelectedComponent(null);
458
- dispatch({ type: "panel/setShow", payload: true });
459
458
  };
460
459
  // const handleTouchStart = (
461
460
  // e: React.TouchEvent<
@@ -1,2 +1,2 @@
1
- declare const Navbar: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const Navbar: () => import("react").JSX.Element;
2
2
  export default Navbar;
@@ -22,6 +22,10 @@ export interface TableEditorProps {
22
22
  };
23
23
  dragOnly?: boolean;
24
24
  viewOnly?: boolean;
25
+ deleteAutorized?: {
26
+ component: boolean;
27
+ extraComponent: boolean;
28
+ };
25
29
  }
26
- declare const TableEditor: (props: TableEditorProps) => import("react/jsx-runtime").JSX.Element;
30
+ declare const TableEditor: (props: TableEditorProps) => import("react").JSX.Element;
27
31
  export default TableEditor;
@@ -9,7 +9,7 @@ import { isEqual } from "lodash";
9
9
  import LayerView from "../view";
10
10
  const TableEditor = (props) => {
11
11
  const [initialValue, setInitialValue] = useState(null);
12
- const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, } = props;
12
+ const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized } = props;
13
13
  const { components, extraComponents, backgroundColor } = useAppSelector((state) => state.board);
14
14
  const dispatch = useAppDispatch();
15
15
  useEffect(() => {
@@ -99,6 +99,6 @@ const TableEditor = (props) => {
99
99
  display: !viewOnly ? "none" : "flex",
100
100
  }, children: _jsx(LayerView, { statusKey: "status" }) }), _jsxs("div", { className: "w-full h-full flex relative", style: {
101
101
  display: viewOnly ? "none" : "flex",
102
- }, children: [_jsx(SideTool, { dragOnly: dragOnly }), _jsx(Board, { onSelectComponent: props.onSelectComponent }), _jsx(ControlPanels, { action: props.action, responseMapping: props.responseMapping })] })] }) }));
102
+ }, children: [_jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { onSelectComponent: props.onSelectComponent }), _jsx(ControlPanels, { action: props.action, responseMapping: props.responseMapping })] })] }) }));
103
103
  };
104
104
  export default TableEditor;
@@ -8,7 +8,7 @@ import { isEqual } from "lodash";
8
8
  import LayerView from "../view";
9
9
  const TableEditor = (props) => {
10
10
  const [initialValue, setInitialValue] = useState(null);
11
- const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, } = props;
11
+ const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized } = props;
12
12
  const { components, extraComponents, backgroundColor } = useAppSelector((state) => state.board);
13
13
  const dispatch = useAppDispatch();
14
14
  useEffect(() => {
@@ -104,7 +104,7 @@ const TableEditor = (props) => {
104
104
  <div className="w-full h-full flex relative" style={{
105
105
  display: viewOnly ? "none" : "flex",
106
106
  }}>
107
- <SideTool dragOnly={dragOnly}/>
107
+ <SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
108
108
  <Board onSelectComponent={props.onSelectComponent}/>
109
109
  <ControlPanels action={props.action} responseMapping={props.responseMapping}/>
110
110
  </div>
@@ -7,5 +7,5 @@ interface ControlPanelsProps {
7
7
  src: string;
8
8
  };
9
9
  }
10
- declare const ControlPanels: (props: ControlPanelsProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const ControlPanels: (props: ControlPanelsProps) => import("react").JSX.Element;
11
11
  export default ControlPanels;
@@ -53,7 +53,9 @@ const ControlPanels = (props) => {
53
53
  }, [tool]);
54
54
  const createShape = (shape, ...props) => {
55
55
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
56
- return (Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props[0]), { shape, fill: (_b = (_a = props === null || props === void 0 ? void 0 : props[0]) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : theme === null || theme === void 0 ? void 0 : theme.primaryColor, seatCount: shape === "table-seat-circle" ? (_d = (_c = props === null || props === void 0 ? void 0 : props[0]) === null || _c === void 0 ? void 0 : _c.seatCount) !== null && _d !== void 0 ? _d : 6 : 0, openSpace: shape === "table-seat-circle" ? (_f = (_e = props === null || props === void 0 ? void 0 : props[0]) === null || _e === void 0 ? void 0 : _e.openSpace) !== null && _f !== void 0 ? _f : 0 : undefined, seatFill: shape === "table-seat-circle" ? (_h = (_g = props === null || props === void 0 ? void 0 : props[0]) === null || _g === void 0 ? void 0 : _g.seatFill) !== null && _h !== void 0 ? _h : "#DADADA" : undefined, text: shape === "text" ? (_k = (_j = props === null || props === void 0 ? void 0 : props[0]) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : "Text" : undefined, fontColor: shape === "text" ? (_m = (_l = props === null || props === void 0 ? void 0 : props[0]) === null || _l === void 0 ? void 0 : _l.fontColor) !== null && _m !== void 0 ? _m : "#DADADA" : undefined }));
56
+ return (Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props[0]), { shape, fill: (_b = (_a = props === null || props === void 0 ? void 0 : props[0]) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : theme === null || theme === void 0 ? void 0 : theme.primaryColor, seatCount: shape === "table-seat-circle" ? (_d = (_c = props === null || props === void 0 ? void 0 : props[0]) === null || _c === void 0 ? void 0 : _c.seatCount) !== null && _d !== void 0 ? _d : 6 : 0, openSpace: shape === "table-seat-circle" ? (_f = (_e = props === null || props === void 0 ? void 0 : props[0]) === null || _e === void 0 ? void 0 : _e.openSpace) !== null && _f !== void 0 ? _f : 0 : undefined, seatFill: shape === "table-seat-circle"
57
+ ? (_h = (_g = props === null || props === void 0 ? void 0 : props[0]) === null || _g === void 0 ? void 0 : _g.seatFill) !== null && _h !== void 0 ? _h : "#DADADA"
58
+ : undefined, text: shape === "text" ? (_k = (_j = props === null || props === void 0 ? void 0 : props[0]) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : "Text" : undefined, fontColor: shape === "text" ? (_m = (_l = props === null || props === void 0 ? void 0 : props[0]) === null || _l === void 0 ? void 0 : _l.fontColor) !== null && _m !== void 0 ? _m : "#DADADA" : undefined }));
57
59
  };
58
60
  const handleChangeComponent = (values, allValues) => {
59
61
  const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
@@ -62,19 +64,18 @@ const ControlPanels = (props) => {
62
64
  type: "board/updateComponent",
63
65
  payload: Object.assign(Object.assign({}, (selectedComponent || {})), newValues),
64
66
  });
65
- // dispatch({
66
- // type: "panel/updateSelectedComponent",
67
- // payload: {
68
- // ...(selectedComponent || {}),
69
- // ...newValues,
70
- // },
71
- // });
67
+ if (shape !== (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
68
+ dispatch({
69
+ type: "panel/updateSelectedComponent",
70
+ payload: Object.assign(Object.assign({}, (selectedComponent || {})), newValues),
71
+ });
72
+ }
72
73
  dispatch({ type: "board/setFlagChange", payload: true });
73
74
  };
74
75
  const renderFormPanel = () => {
75
76
  switch (tool.active) {
76
77
  case "select":
77
- return _jsx(SelectToolForm, { action: action, responseMapping: responseMapping });
78
+ return (_jsx(SelectToolForm, { action: action, responseMapping: responseMapping }));
78
79
  case "square":
79
80
  case "circle":
80
81
  return _jsx(SquareToolForm, {});
@@ -98,8 +99,8 @@ const ControlPanels = (props) => {
98
99
  // if(!show) return null
99
100
  return (_jsx(Drawer, { open: show, onClose: handleClose, title: "Panel", styles: {
100
101
  body: {
101
- paddingBottom: 0
102
- }
102
+ paddingBottom: 0,
103
+ },
103
104
  }, children: _jsx("div", { className: "bg-white h-full max-h-screen w-full p-2", children: _jsxs(Form, { layout: "vertical", form: form, name: "table", onValuesChange: handleChangeComponent, initialValues: { labels: [{}] }, children: [_jsx(Form.Item, { name: "id", hidden: true, children: _jsx(Input, {}) }), renderFormPanel()] }) }) }));
104
105
  };
105
106
  export default ControlPanels;
@@ -52,7 +52,9 @@ const ControlPanels = (props) => {
52
52
  }, [tool]);
53
53
  const createShape = (shape, ...props) => {
54
54
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
55
- return (Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props[0]), { shape, fill: (_b = (_a = props === null || props === void 0 ? void 0 : props[0]) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : theme === null || theme === void 0 ? void 0 : theme.primaryColor, seatCount: shape === "table-seat-circle" ? (_d = (_c = props === null || props === void 0 ? void 0 : props[0]) === null || _c === void 0 ? void 0 : _c.seatCount) !== null && _d !== void 0 ? _d : 6 : 0, openSpace: shape === "table-seat-circle" ? (_f = (_e = props === null || props === void 0 ? void 0 : props[0]) === null || _e === void 0 ? void 0 : _e.openSpace) !== null && _f !== void 0 ? _f : 0 : undefined, seatFill: shape === "table-seat-circle" ? (_h = (_g = props === null || props === void 0 ? void 0 : props[0]) === null || _g === void 0 ? void 0 : _g.seatFill) !== null && _h !== void 0 ? _h : "#DADADA" : undefined, text: shape === "text" ? (_k = (_j = props === null || props === void 0 ? void 0 : props[0]) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : "Text" : undefined, fontColor: shape === "text" ? (_m = (_l = props === null || props === void 0 ? void 0 : props[0]) === null || _l === void 0 ? void 0 : _l.fontColor) !== null && _m !== void 0 ? _m : "#DADADA" : undefined }));
55
+ return (Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props[0]), { shape, fill: (_b = (_a = props === null || props === void 0 ? void 0 : props[0]) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : theme === null || theme === void 0 ? void 0 : theme.primaryColor, seatCount: shape === "table-seat-circle" ? (_d = (_c = props === null || props === void 0 ? void 0 : props[0]) === null || _c === void 0 ? void 0 : _c.seatCount) !== null && _d !== void 0 ? _d : 6 : 0, openSpace: shape === "table-seat-circle" ? (_f = (_e = props === null || props === void 0 ? void 0 : props[0]) === null || _e === void 0 ? void 0 : _e.openSpace) !== null && _f !== void 0 ? _f : 0 : undefined, seatFill: shape === "table-seat-circle"
56
+ ? (_h = (_g = props === null || props === void 0 ? void 0 : props[0]) === null || _g === void 0 ? void 0 : _g.seatFill) !== null && _h !== void 0 ? _h : "#DADADA"
57
+ : undefined, text: shape === "text" ? (_k = (_j = props === null || props === void 0 ? void 0 : props[0]) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : "Text" : undefined, fontColor: shape === "text" ? (_m = (_l = props === null || props === void 0 ? void 0 : props[0]) === null || _l === void 0 ? void 0 : _l.fontColor) !== null && _m !== void 0 ? _m : "#DADADA" : undefined }));
56
58
  };
57
59
  const handleChangeComponent = (values, allValues) => {
58
60
  const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
@@ -61,19 +63,18 @@ const ControlPanels = (props) => {
61
63
  type: "board/updateComponent",
62
64
  payload: Object.assign(Object.assign({}, (selectedComponent || {})), newValues),
63
65
  });
64
- // dispatch({
65
- // type: "panel/updateSelectedComponent",
66
- // payload: {
67
- // ...(selectedComponent || {}),
68
- // ...newValues,
69
- // },
70
- // });
66
+ if (shape !== (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
67
+ dispatch({
68
+ type: "panel/updateSelectedComponent",
69
+ payload: Object.assign(Object.assign({}, (selectedComponent || {})), newValues),
70
+ });
71
+ }
71
72
  dispatch({ type: "board/setFlagChange", payload: true });
72
73
  };
73
74
  const renderFormPanel = () => {
74
75
  switch (tool.active) {
75
76
  case "select":
76
- return <SelectToolForm action={action} responseMapping={responseMapping}/>;
77
+ return (<SelectToolForm action={action} responseMapping={responseMapping}/>);
77
78
  case "square":
78
79
  case "circle":
79
80
  return <SquareToolForm />;
@@ -97,8 +98,8 @@ const ControlPanels = (props) => {
97
98
  // if(!show) return null
98
99
  return (<Drawer open={show} onClose={handleClose} title="Panel" styles={{
99
100
  body: {
100
- paddingBottom: 0
101
- }
101
+ paddingBottom: 0,
102
+ },
102
103
  }}>
103
104
  <div className="bg-white h-full max-h-screen w-full p-2">
104
105
  <Form layout="vertical" form={form} name="table" onValuesChange={handleChangeComponent} initialValues={{ labels: [{}] }}>
@@ -2,5 +2,5 @@ declare const SelectToolForm: ({ title, action, responseMapping }: {
2
2
  title?: string;
3
3
  action: any;
4
4
  responseMapping: any;
5
- }) => import("react/jsx-runtime").JSX.Element;
5
+ }) => import("react").JSX.Element;
6
6
  export default SelectToolForm;
@@ -1,2 +1,2 @@
1
- declare const SquareToolForm: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const SquareToolForm: () => import("react").JSX.Element;
2
2
  export default SquareToolForm;
@@ -1,2 +1,2 @@
1
- declare const SeatCircle: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const SeatCircle: () => import("react").JSX.Element;
2
2
  export default SeatCircle;
@@ -1,2 +1,2 @@
1
- declare const TextTool: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TextTool: () => import("react").JSX.Element;
2
2
  export default TextTool;
@@ -10,5 +10,5 @@ interface UploadToolProps {
10
10
  };
11
11
  defaultValue?: any;
12
12
  }
13
- declare const UploadTool: ({ name, type, action, responseMapping, defaultValue, }: UploadToolProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const UploadTool: ({ name, type, action, responseMapping, defaultValue, }: UploadToolProps) => import("react").JSX.Element;
14
14
  export default UploadTool;
@@ -1,4 +1,8 @@
1
- declare const SideTool: ({ dragOnly }: {
1
+ declare const SideTool: ({ dragOnly, deleteAutorized, }: {
2
2
  dragOnly?: boolean;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ deleteAutorized?: {
4
+ component: boolean;
5
+ extraComponent: boolean;
6
+ };
7
+ }) => import("react").JSX.Element;
4
8
  export default SideTool;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2 } from "lucide-react";
3
+ import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2, } from "lucide-react";
4
4
  import ButtonTools from "../../components/button-tools";
5
- import { Divider, ColorPicker, Button, } from "antd";
5
+ import { Divider, ColorPicker, Button, message, } from "antd";
6
6
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
7
  import { useState } from "react";
8
- const SideTool = ({ dragOnly }) => {
8
+ const SideTool = ({ dragOnly, deleteAutorized, }) => {
9
9
  const [color, setColor] = useState("#000000");
10
10
  const dispatch = useAppDispatch();
11
11
  const { active, grid } = useAppSelector((state) => state.tool);
@@ -32,7 +32,7 @@ const SideTool = ({ dragOnly }) => {
32
32
  id: "node",
33
33
  name: "Node Tool",
34
34
  icon: _jsx(MousePointer2, {}),
35
- }
35
+ },
36
36
  ];
37
37
  const actionsTools = [
38
38
  // {
@@ -147,14 +147,26 @@ const SideTool = ({ dragOnly }) => {
147
147
  dispatch({ type: "board/setFlagChange", payload: true });
148
148
  };
149
149
  const handleRemoveComponent = () => {
150
- dispatch({
151
- type: "board/removeComponent",
152
- payload: selectedComponent,
153
- });
154
- dispatch({
155
- type: "board/removeExtraComponent",
156
- payload: selectedComponent,
157
- });
150
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) !== "background" && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component)) {
151
+ message.error("You are not authorized to delete this table.");
152
+ return;
153
+ }
154
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background" && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent)) {
155
+ message.error("You are not authorized to delete this background.");
156
+ return;
157
+ }
158
+ if (deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component) {
159
+ dispatch({
160
+ type: "board/removeComponent",
161
+ payload: selectedComponent,
162
+ });
163
+ }
164
+ if (deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent) {
165
+ dispatch({
166
+ type: "board/removeExtraComponent",
167
+ payload: selectedComponent,
168
+ });
169
+ }
158
170
  dispatch({ type: "board/setFlagChange", payload: true });
159
171
  dispatch({
160
172
  type: "panel/setSelectedComponent",
@@ -240,15 +252,6 @@ const SideTool = ({ dragOnly }) => {
240
252
  content: _jsx("div", { children: "Duplicate" }),
241
253
  trigger: "hover",
242
254
  placement: "right",
243
- } }), _jsx(ButtonTools, { buttonProps: {
244
- onClick: () => handleRemoveComponent(),
245
- icon: _jsx(Trash, {}),
246
- type: "text",
247
- name: "trash",
248
- }, items: [], popoverProps: {
249
- content: _jsx("div", { children: "Trash" }),
250
- trigger: "hover",
251
- placement: "right",
252
255
  } }), _jsx(ButtonTools, { buttonProps: {
253
256
  onClick: () => handleOverride(),
254
257
  icon: _jsx(Layers2, {}),
@@ -287,6 +290,15 @@ const SideTool = ({ dragOnly }) => {
287
290
  content: _jsx("div", { children: tool.name }),
288
291
  trigger: "hover",
289
292
  placement: "right",
290
- }, items: [] }, tool.id))), _jsx(ColorPicker, { value: color, onChange: handleChangeColorBackground, children: _jsx(Button, { icon: _jsx(PaintBucket, {}), type: "text", name: "Background Color", onClick: () => hanldeSelectTool("background-color"), style: active === "background-color" ? { color: "red" } : {} }) }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} }), _jsx(Button, { icon: _jsx(Grid, {}), type: "text", name: "Grid", onClick: () => toggleGrid() })] }));
293
+ }, items: [] }, tool.id))), _jsx(ColorPicker, { value: color, onChange: handleChangeColorBackground, children: _jsx(Button, { icon: _jsx(PaintBucket, {}), type: "text", name: "Background Color", onClick: () => hanldeSelectTool("background-color"), style: active === "background-color" ? { color: "red" } : {} }) }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} }), _jsx(Button, { icon: _jsx(Grid, {}), type: "text", name: "Grid", onClick: () => toggleGrid() }), _jsx(ButtonTools, { buttonProps: {
294
+ onClick: () => handleRemoveComponent(),
295
+ icon: _jsx(Trash, {}),
296
+ type: "text",
297
+ name: "trash",
298
+ }, items: [], popoverProps: {
299
+ content: _jsx("div", { children: "Trash" }),
300
+ trigger: "hover",
301
+ placement: "right",
302
+ } })] }));
291
303
  };
292
304
  export default SideTool;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2 } from "lucide-react";
2
+ import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2, } from "lucide-react";
3
3
  import ButtonTools from "../../components/button-tools";
4
- import { Divider, ColorPicker, Button, } from "antd";
4
+ import { Divider, ColorPicker, Button, message, } from "antd";
5
5
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
6
6
  import { useState } from "react";
7
- const SideTool = ({ dragOnly }) => {
7
+ const SideTool = ({ dragOnly, deleteAutorized, }) => {
8
8
  const [color, setColor] = useState("#000000");
9
9
  const dispatch = useAppDispatch();
10
10
  const { active, grid } = useAppSelector((state) => state.tool);
@@ -31,7 +31,7 @@ const SideTool = ({ dragOnly }) => {
31
31
  id: "node",
32
32
  name: "Node Tool",
33
33
  icon: <MousePointer2 />,
34
- }
34
+ },
35
35
  ];
36
36
  const actionsTools = [
37
37
  // {
@@ -146,14 +146,26 @@ const SideTool = ({ dragOnly }) => {
146
146
  dispatch({ type: "board/setFlagChange", payload: true });
147
147
  };
148
148
  const handleRemoveComponent = () => {
149
- dispatch({
150
- type: "board/removeComponent",
151
- payload: selectedComponent,
152
- });
153
- dispatch({
154
- type: "board/removeExtraComponent",
155
- payload: selectedComponent,
156
- });
149
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) !== "background" && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component)) {
150
+ message.error("You are not authorized to delete this table.");
151
+ return;
152
+ }
153
+ if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background" && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent)) {
154
+ message.error("You are not authorized to delete this background.");
155
+ return;
156
+ }
157
+ if (deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component) {
158
+ dispatch({
159
+ type: "board/removeComponent",
160
+ payload: selectedComponent,
161
+ });
162
+ }
163
+ if (deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent) {
164
+ dispatch({
165
+ type: "board/removeExtraComponent",
166
+ payload: selectedComponent,
167
+ });
168
+ }
157
169
  dispatch({ type: "board/setFlagChange", payload: true });
158
170
  dispatch({
159
171
  type: "panel/setSelectedComponent",
@@ -243,16 +255,7 @@ const SideTool = ({ dragOnly }) => {
243
255
  trigger: "hover",
244
256
  placement: "right",
245
257
  }}/>
246
- <ButtonTools buttonProps={{
247
- onClick: () => handleRemoveComponent(),
248
- icon: <Trash />,
249
- type: "text",
250
- name: "trash",
251
- }} items={[]} popoverProps={{
252
- content: <div>Trash</div>,
253
- trigger: "hover",
254
- placement: "right",
255
- }}/>
258
+
256
259
  <ButtonTools buttonProps={{
257
260
  onClick: () => handleOverride(),
258
261
  icon: <Layers2 />,
@@ -286,7 +289,7 @@ const SideTool = ({ dragOnly }) => {
286
289
  trigger: "hover",
287
290
  placement: "right",
288
291
  }} items={[]}/>))}
289
-
292
+
290
293
  <Divider />
291
294
  </>)}
292
295
  {controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
@@ -305,6 +308,16 @@ const SideTool = ({ dragOnly }) => {
305
308
  </ColorPicker>
306
309
  <Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
307
310
  <Button icon={<Grid />} type="text" name="Grid" onClick={() => toggleGrid()}/>
311
+ <ButtonTools buttonProps={{
312
+ onClick: () => handleRemoveComponent(),
313
+ icon: <Trash />,
314
+ type: "text",
315
+ name: "trash",
316
+ }} items={[]} popoverProps={{
317
+ content: <div>Trash</div>,
318
+ trigger: "hover",
319
+ placement: "right",
320
+ }}/>
308
321
  </div>);
309
322
  };
310
323
  export default SideTool;
@@ -15,5 +15,5 @@ export interface LayerViewProps {
15
15
  containerProps?: any;
16
16
  svgProps?: any;
17
17
  }
18
- declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
19
19
  export default LayerView;
@@ -15,5 +15,5 @@ export interface LayerViewProps {
15
15
  containerProps?: any;
16
16
  svgProps?: any;
17
17
  }
18
- declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
19
19
  export default LayerView;
@@ -1,3 +1,3 @@
1
1
  export declare const ReduxProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  export declare const StoreProvider: ({ children, themeColor, }: {
2
2
  children: React.ReactNode;
3
3
  themeColor?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => import("react").JSX.Element;