seat-editor 3.3.43 → 3.3.44

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 (54) hide show
  1. package/dist/app/constant.d.ts +57 -63
  2. package/dist/app/constant.js +76 -71
  3. package/dist/app/layout.d.ts +1 -1
  4. package/dist/app/new-board/page.d.ts +1 -1
  5. package/dist/app/old-board/page.d.ts +1 -2
  6. package/dist/app/only-view/chair.d.ts +1 -1
  7. package/dist/app/only-view/chair.js +2 -10
  8. package/dist/app/only-view/page.d.ts +1 -1
  9. package/dist/app/only-view/page.js +12 -15
  10. package/dist/app/only-view/page.jsx +11 -14
  11. package/dist/app/only-view/user.d.ts +1 -1
  12. package/dist/app/only-view/user.js +2 -10
  13. package/dist/app/page.d.ts +1 -1
  14. package/dist/app/test/page.d.ts +1 -2
  15. package/dist/app/v2/page.d.ts +1 -1
  16. package/dist/components/button-tools/index.d.ts +1 -1
  17. package/dist/components/form-tools/label.d.ts +1 -1
  18. package/dist/components/form-tools/shape.d.ts +1 -1
  19. package/dist/components/input/number-indicator.d.ts +1 -1
  20. package/dist/components/joystick/index.d.ts +1 -2
  21. package/dist/components/layer/index.d.ts +1 -1
  22. package/dist/components/layer-v2/index.d.ts +1 -1
  23. package/dist/components/layer-v3/index.d.ts +1 -1
  24. package/dist/components/layer-v4/index.d.ts +1 -1
  25. package/dist/components/layer-v4/index.js +7 -7
  26. package/dist/components/lib/index.d.ts +1 -1
  27. package/dist/components/modal-preview/index.d.ts +1 -1
  28. package/dist/features/board/index.d.ts +1 -1
  29. package/dist/features/board-v2/index.d.ts +1 -2
  30. package/dist/features/board-v3/index.d.ts +1 -1
  31. package/dist/features/board-v3/index.js +10 -4
  32. package/dist/features/navbar/index.d.ts +1 -1
  33. package/dist/features/package/index.d.ts +1 -1
  34. package/dist/features/package/index.js +7 -1
  35. package/dist/features/panel/index.d.ts +1 -1
  36. package/dist/features/panel/select-tool.d.ts +1 -1
  37. package/dist/features/panel/selected-group.d.ts +1 -1
  38. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  39. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  40. package/dist/features/panel/table-seat-square.d.ts +1 -1
  41. package/dist/features/panel/text-tool.d.ts +1 -1
  42. package/dist/features/panel/upload-tool.d.ts +1 -1
  43. package/dist/features/panel/upload-tool.js +3 -3
  44. package/dist/features/panel/upload-tool.jsx +5 -4
  45. package/dist/features/side-tool/index.d.ts +1 -1
  46. package/dist/features/view-only/index.d.ts +1 -1
  47. package/dist/features/view-only-2/index.d.ts +8 -2
  48. package/dist/features/view-only-2/index.js +33 -18
  49. package/dist/features/view-only-3/index.d.ts +8 -2
  50. package/dist/features/view-only-3/index.js +67 -53
  51. package/dist/features/view-only-3/index.jsx +5 -1
  52. package/dist/provider/redux-provider.d.ts +1 -1
  53. package/dist/provider/store-provider.d.ts +1 -1
  54. package/package.json +1 -1
@@ -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;
@@ -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.Element;
5
+ declare const BoardTemplate: ({ onSelectComponent }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default BoardTemplate;
@@ -1,8 +1,7 @@
1
- import React from "react";
2
1
  interface BoardTemplateProps {
3
2
  onSelectComponent?: (items: any) => void;
4
3
  mappingKey?: string;
5
4
  viewOnly?: boolean;
6
5
  }
7
- declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => React.JSX.Element;
6
+ declare const BoardTemplate: ({ onSelectComponent, viewOnly }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export default BoardTemplate;
@@ -13,5 +13,5 @@ interface BoardTemplateProps {
13
13
  };
14
14
  disabled?: boolean;
15
15
  }
16
- declare const BoardTemplate: ({ refs, loadingRender, disabled }: BoardTemplateProps) => React.JSX.Element;
16
+ declare const BoardTemplate: ({ refs, loadingRender, disabled, }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
17
17
  export default BoardTemplate;
@@ -15,7 +15,7 @@ import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlo
15
15
  const toolElement = ["square", "circle", "table-seat-circle"];
16
16
  const idSelectionBoxGhost = "selection-box-ghost";
17
17
  const nameShapeSelectionBoxGhost = "selection-box";
18
- const BoardTemplate = ({ refs, loadingRender }) => {
18
+ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
19
19
  const dispatch = useAppDispatch();
20
20
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
21
21
  const selectedComponentProps = useAppSelector((state) => state.panel.selectedComponent);
@@ -1312,7 +1312,7 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1312
1312
  let y2 = [];
1313
1313
  allElementSelectionGroup.forEach((element) => {
1314
1314
  const activeId = element.id;
1315
- const { g, inner, element: el } = getAttributeElement(svg, String(activeId));
1315
+ const { g, inner, element: el, } = getAttributeElement(svg, String(activeId));
1316
1316
  const { x, y, width, height } = getGlobalBBox(svg, g);
1317
1317
  xs.push(x);
1318
1318
  ys.push(y);
@@ -1547,7 +1547,13 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1547
1547
  });
1548
1548
  }
1549
1549
  };
1550
- return (_jsxs(_Fragment, { children: [_jsxs(ModalPreview, { children: [_jsx(LayerView, { statusKey: "status", loadingRender: loadingRender }), _jsx("div", { className: "flex gap-2 mt-2", children: _jsxs(Radio.Group, { value: isShowTagType, onChange: handleCheckPreview, children: [_jsx(Radio, { value: "default", children: "Default" }), _jsx(Radio, { value: "type-1", children: "Type 1" }), _jsx(Radio, { value: "type-2", children: "Type 2" })] }) })] }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden", ref: containerRef, children: [_jsx("div", { className: "absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10", children: _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { icon: _jsx(ZoomIn, {}), onClick: handelZoomIn }), _jsx(Button, { icon: _jsx(ZoomOut, {}), onClick: handleZoomOut })] }) }), _jsx(TransformWrapper, { ref: transformRef,
1550
+ return (_jsxs(_Fragment, { children: [_jsxs(ModalPreview, { children: [_jsx(LayerView, { statusKey: "status", loadingRender: loadingRender, actionPrivileged: {
1551
+ select: false,
1552
+ move: false,
1553
+ switch: false,
1554
+ drop: false,
1555
+ rightClick: false,
1556
+ } }), _jsx("div", { className: "flex gap-2 mt-2", children: _jsxs(Radio.Group, { value: isShowTagType, onChange: handleCheckPreview, children: [_jsx(Radio, { value: "default", children: "Default" }), _jsx(Radio, { value: "type-1", children: "Type 1" }), _jsx(Radio, { value: "type-2", children: "Type 2" })] }) })] }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden", ref: containerRef, children: [_jsx("div", { className: "absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10", children: _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { icon: _jsx(ZoomIn, {}), onClick: handelZoomIn }), _jsx(Button, { icon: _jsx(ZoomOut, {}), onClick: handleZoomOut })] }) }), _jsx(TransformWrapper, { ref: transformRef,
1551
1557
  // limitToBounds={true}
1552
1558
  panning: {
1553
1559
  disabled: [
@@ -1558,7 +1564,7 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1558
1564
  "table-seat-circle",
1559
1565
  "table-seat-square",
1560
1566
  "bounding-box",
1561
- ""
1567
+ "",
1562
1568
  ].includes(activeTool),
1563
1569
  },
1564
1570
  // centerZoomedOut={true}
@@ -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;
@@ -44,5 +44,5 @@ export interface TableEditorProps<TMeta = undefined> {
44
44
  };
45
45
  disabledView?: boolean;
46
46
  }
47
- declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react").JSX.Element;
47
+ declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
48
48
  export default TableEditor;
@@ -161,6 +161,12 @@ const TableEditor = (props) => {
161
161
  props === null || props === void 0 ? void 0 : props.defaultBoundingBox,
162
162
  loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
163
163
  ]);
164
- return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative", children: viewOnly ? (_jsx("div", { className: "w-full h-full flex relative", children: _jsx(LayerView, { statusKey: "status", loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`) })) : (_jsxs("div", { className: "w-full h-full flex relative", children: [(loading && !isPreview) && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`), _jsx(ControlPanels, { action: props.action, transform: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.transformRef })] }, `${viewOnly}`)) }) }));
164
+ return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative", children: viewOnly ? (_jsx("div", { className: "w-full h-full flex relative", children: _jsx(LayerView, { statusKey: "status", loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender, actionPrivileged: {
165
+ select: false,
166
+ move: false,
167
+ switch: false,
168
+ drop: false,
169
+ rightClick: false,
170
+ } }, `${viewOnly}`) })) : (_jsxs("div", { className: "w-full h-full flex relative", children: [loading && !isPreview && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender, disabled: props === null || props === void 0 ? void 0 : props.disabledView }, `${viewOnly}`), _jsx(ControlPanels, { action: props.action, transform: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.transformRef })] }, `${viewOnly}`)) }) }));
165
171
  };
166
172
  export default TableEditor;
@@ -2,5 +2,5 @@ interface ControlPanelsProps {
2
2
  action?: (file: File) => Promise<string>;
3
3
  transform?: any;
4
4
  }
5
- declare const ControlPanels: (props: ControlPanelsProps) => import("react").JSX.Element;
5
+ declare const ControlPanels: (props: ControlPanelsProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default ControlPanels;
@@ -2,5 +2,5 @@ declare const SelectToolForm: ({ title, action, tranform }: {
2
2
  title?: string;
3
3
  action: any;
4
4
  tranform: any;
5
- }) => import("react").JSX.Element;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default SelectToolForm;
@@ -1,2 +1,2 @@
1
- declare const SelectedGroup: () => import("react").JSX.Element;
1
+ declare const SelectedGroup: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SelectedGroup;
@@ -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 SeatSquare: () => import("react").JSX.Element;
1
+ declare const SeatSquare: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SeatSquare;
@@ -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;
@@ -6,5 +6,5 @@ interface UploadToolProps {
6
6
  defaultValue?: PropertiesProps;
7
7
  transform?: any;
8
8
  }
9
- declare const UploadTool: ({ name, type, action, defaultValue, transform }: UploadToolProps) => import("react").JSX.Element;
9
+ declare const UploadTool: ({ name, type, action, defaultValue, transform, }: UploadToolProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export default UploadTool;
@@ -16,7 +16,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
16
16
  import SectionLabel from "../../components/form-tools/label";
17
17
  import SectionShape from "../../components/form-tools/shape";
18
18
  const { Dragger } = Upload;
19
- const UploadTool = ({ name, type, action, defaultValue, transform }) => {
19
+ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
20
20
  // const src = Form.useWatch("src");
21
21
  // const height = Form.useWatch("height");
22
22
  // const width = Form.useWatch("width");
@@ -47,7 +47,7 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
47
47
  const widthWorkspace = ((_b = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
48
48
  const heightWorkspace = ((_c = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0;
49
49
  const defaultFormatValue = (width, height, src, id, x, y) => ({
50
- id: String(id) || `${Date.now()}`,
50
+ id: id ? String(id) : `${Date.now()}`,
51
51
  x: x || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionX),
52
52
  y: y || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionY),
53
53
  width: width < 1 ? 200 : width,
@@ -145,6 +145,6 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
145
145
  const handleDelete = () => {
146
146
  setDefaultSrc(null);
147
147
  };
148
- return (_jsxs(Form.Item, { label: "", name: "src", className: "w-full", children: [defaultSrc ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto", children: _jsx(Image, { src: defaultSrc }) }), _jsx(Button, { type: "primary", onClick: handleDelete, children: "Edit" })] })) : (_jsx(Dragger, Object.assign({ beforeUpload: () => false }, propsUpload, { children: loading ? (_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px]", children: _jsx(LoadingOutlined, {}) })) : (_jsxs(_Fragment, { 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, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }));
148
+ return (_jsxs(Form.Item, { label: "", name: "src", className: "w-full", children: [defaultSrc ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto", children: _jsx(Image, { src: defaultSrc }) }), _jsx(Button, { type: "primary", onClick: handleDelete, children: "Edit" })] })) : (_jsx(Dragger, Object.assign({ beforeUpload: () => false }, propsUpload, { children: loading ? (_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px]", children: _jsx(LoadingOutlined, {}) })) : (_jsxs(_Fragment, { 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." })] })) }))), defaultSrc && (_jsxs(_Fragment, { children: [_jsx(SectionShape, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }))] }));
149
149
  };
150
150
  export default UploadTool;
@@ -15,7 +15,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
15
15
  import SectionLabel from "../../components/form-tools/label";
16
16
  import SectionShape from "../../components/form-tools/shape";
17
17
  const { Dragger } = Upload;
18
- const UploadTool = ({ name, type, action, defaultValue, transform }) => {
18
+ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
19
19
  // const src = Form.useWatch("src");
20
20
  // const height = Form.useWatch("height");
21
21
  // const width = Form.useWatch("width");
@@ -168,9 +168,10 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
168
168
  </p>
169
169
  </>)}
170
170
  </Dragger>)}
171
-
172
- <SectionShape allowChangeShape={type === "component"}/>
173
- <SectionLabel />
171
+ {defaultSrc && (<>
172
+ <SectionShape allowChangeShape={type === "component"}/>
173
+ <SectionLabel />
174
+ </>)}
174
175
  </Form.Item>);
175
176
  };
176
177
  export default UploadTool;
@@ -4,5 +4,5 @@ declare const SideTool: ({ dragOnly, deleteAutorized, }: {
4
4
  component: boolean;
5
5
  extraComponent: boolean;
6
6
  };
7
- }) => import("react").JSX.Element;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
8
  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.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export default LayerView;
@@ -77,13 +77,19 @@ export interface LayerViewProps<TMeta = undefined> {
77
77
  paddingRight?: number;
78
78
  paddingBottom?: number;
79
79
  };
80
- disabled?: boolean;
81
80
  loadingRender?: {
82
81
  state: boolean;
83
82
  element: React.JSX.Element;
84
83
  };
85
84
  defaultBoundingBox?: PropertiesProps;
86
85
  viewOnly?: boolean;
86
+ actionPrivileged?: {
87
+ select: boolean;
88
+ move: boolean;
89
+ switch: boolean;
90
+ drop: boolean;
91
+ rightClick: boolean;
92
+ };
87
93
  }
88
- declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
94
+ declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
89
95
  export default LayerView;
@@ -6,7 +6,13 @@ import Layers from "../../components/layer-v4";
6
6
  import { getTranslate } from "../board-v3/utils";
7
7
  import { Spin } from "antd";
8
8
  const LayerView = (props) => {
9
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled, loadingRender, } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
10
+ select: true,
11
+ move: true,
12
+ switch: true,
13
+ drop: true,
14
+ rightClick: true
15
+ } } = props;
10
16
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
11
17
  const tableGhost = useRef(null);
12
18
  const hoverUnderghostId = useRef(null);
@@ -132,13 +138,13 @@ const LayerView = (props) => {
132
138
  });
133
139
  const rightClick = e.button === 2;
134
140
  const click = e.button === 0;
135
- onRightClick && rightClick && onRightClick(e, find);
136
- onSelectComponent && !rightClick && onSelectComponent(find);
141
+ (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
142
+ (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
137
143
  const seletedTable = mappingKey ? find[mappingKey] : find;
138
144
  setSelectedTable(seletedTable);
139
145
  };
140
146
  const boundingBox = useMemo(() => {
141
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
147
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
142
148
  if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
143
149
  return { minX: 0, minY: 0, width: 500, height: 500 };
144
150
  }
@@ -196,10 +202,10 @@ const LayerView = (props) => {
196
202
  if (hasBoundingBox) {
197
203
  hasBoundingBoxRef.current = true;
198
204
  return {
199
- minX: boundingBoxProps.x,
200
- minY: boundingBoxProps.y,
201
- width: boundingBoxProps.width,
202
- height: boundingBoxProps.height,
205
+ minX: boundingBoxProps.x - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
206
+ minY: boundingBoxProps.y - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
207
+ width: boundingBoxProps.width + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
208
+ height: boundingBoxProps.height + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
203
209
  };
204
210
  }
205
211
  // return {
@@ -210,10 +216,10 @@ const LayerView = (props) => {
210
216
  // };
211
217
  // console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
212
218
  return {
213
- minX: minX - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
214
- minY: minY - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
215
- width: maxX + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
216
- height: maxY + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
219
+ minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
220
+ minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
221
+ width: maxX + (((_o = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _o === void 0 ? void 0 : _o.paddingRight) || 0),
222
+ height: maxY + (((_p = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _p === void 0 ? void 0 : _p.paddingBottom) || 0),
217
223
  };
218
224
  }, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
219
225
  const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
@@ -271,7 +277,7 @@ const LayerView = (props) => {
271
277
  };
272
278
  // drop from out layout editor
273
279
  if (type === "drop") {
274
- onDrop && onDrop(event, data);
280
+ (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
275
281
  }
276
282
  // cari elemen bentuk (rect / circle / path)
277
283
  const shape = group.querySelector("rect") ||
@@ -316,10 +322,10 @@ const LayerView = (props) => {
316
322
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
317
323
  const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
318
324
  ? true
319
- : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
325
+ : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
320
326
  const dataRaw = originalData({ id: ghostId, type: "find" });
321
- return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
- })) && !disabled;
327
+ return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
328
+ }))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
323
329
  if (ghostAttributes) {
324
330
  Object.keys(ghostAttributes).forEach((key) => {
325
331
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -539,15 +545,24 @@ const LayerView = (props) => {
539
545
  }
540
546
  };
541
547
  const hasBoundingBox = hasBoundingBoxRef.current;
548
+ const isValidBoundingBox = Number.isFinite(boundingBox.minX) &&
549
+ Number.isFinite(boundingBox.minY) &&
550
+ Number.isFinite(boundingBox.width) &&
551
+ Number.isFinite(boundingBox.height) &&
552
+ boundingBox.width > 0 &&
553
+ boundingBox.height > 0;
554
+ const viewBox = isValidBoundingBox
555
+ ? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
556
+ : "0 0 1000 1000";
542
557
  return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
543
558
  overflow: "auto",
544
559
  WebkitOverflowScrolling: "touch",
545
560
  } }, props.containerProps, { children: [loading && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%",
546
561
  // scale={5}
547
- overflow: "hidden", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
562
+ overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
548
563
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
549
564
  display: "block",
550
- pointerEvents: disabled ? "none" : "all",
565
+ // pointerEvents: disabled ? "none" : "all",
551
566
  touchAction: "none",
552
567
  userSelect: "none",
553
568
  } }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", "clip-path": "url(#contentCrop)", children: _jsx(Layers, { components: [
@@ -77,13 +77,19 @@ export interface LayerViewProps<TMeta = undefined> {
77
77
  paddingRight?: number;
78
78
  paddingBottom?: number;
79
79
  };
80
- disabled?: boolean;
81
80
  loadingRender?: {
82
81
  state: boolean;
83
82
  element: React.JSX.Element;
84
83
  };
85
84
  defaultBoundingBox?: PropertiesProps;
86
85
  viewOnly?: boolean;
86
+ actionPrivileged?: {
87
+ select: boolean;
88
+ move: boolean;
89
+ switch: boolean;
90
+ drop: boolean;
91
+ rightClick: boolean;
92
+ };
87
93
  }
88
- declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
94
+ declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
89
95
  export default LayerView;