seat-editor 3.1.3 → 3.1.5-ck
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.
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { ReactZoomPanPinchRef } from "react-zoom-pan-pinch";
|
|
3
|
+
export type RefsType = {
|
|
4
|
+
svgRef: SVGSVGElement | null;
|
|
5
|
+
transformRef: ReactZoomPanPinchRef | null;
|
|
6
|
+
containerRef: HTMLDivElement | null;
|
|
7
|
+
};
|
|
8
|
+
interface BoardTemplateProps {
|
|
9
|
+
refs?: React.ForwardedRef<RefsType>;
|
|
10
|
+
}
|
|
11
|
+
declare const BoardTemplate: ({ refs }: BoardTemplateProps) => React.JSX.Element;
|
|
3
12
|
export default BoardTemplate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
3
3
|
import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
|
|
4
4
|
import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
|
|
5
5
|
import Layers from "../../components/layer-v3";
|
|
@@ -14,7 +14,7 @@ import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlo
|
|
|
14
14
|
const toolElement = ["square", "circle", "table-seat-circle"];
|
|
15
15
|
const idSelectionBoxGhost = "selection-box-ghost";
|
|
16
16
|
const nameShapeSelectionBoxGhost = "selection-box";
|
|
17
|
-
const BoardTemplate = () => {
|
|
17
|
+
const BoardTemplate = ({ refs }) => {
|
|
18
18
|
const dispatch = useAppDispatch();
|
|
19
19
|
const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
|
|
20
20
|
const selectedComponentProps = useAppSelector((state) => state.panel.selectedComponent);
|
|
@@ -25,6 +25,11 @@ const BoardTemplate = () => {
|
|
|
25
25
|
const svgRef = useRef(null);
|
|
26
26
|
const containerRef = useRef(null);
|
|
27
27
|
const releaseGroupRef = useRef(false);
|
|
28
|
+
useImperativeHandle(refs, () => ({
|
|
29
|
+
svgRef: svgRef === null || svgRef === void 0 ? void 0 : svgRef.current,
|
|
30
|
+
transformRef: transformRef === null || transformRef === void 0 ? void 0 : transformRef.current,
|
|
31
|
+
containerRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current,
|
|
32
|
+
}));
|
|
28
33
|
const widthBoardRef = useRef(20000);
|
|
29
34
|
const heightBoardRef = useRef(20000);
|
|
30
35
|
const widthBoard = widthBoardRef.current;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RefsType } from "../board-v3";
|
|
1
2
|
import { PropertiesProps } from "@/dto/table";
|
|
2
3
|
import { UploadFile } from "antd";
|
|
3
4
|
export interface TableEditorProps {
|
|
@@ -32,6 +33,7 @@ export interface TableEditorProps {
|
|
|
32
33
|
component: boolean;
|
|
33
34
|
extraComponent: boolean;
|
|
34
35
|
};
|
|
36
|
+
refs?: React.RefObject<RefsType>;
|
|
35
37
|
}
|
|
36
38
|
declare const TableEditor: (props: TableEditorProps) => import("react").JSX.Element;
|
|
37
39
|
export default TableEditor;
|
|
@@ -8,7 +8,7 @@ import { isEqual } from "lodash";
|
|
|
8
8
|
import LayerView from "../view-only";
|
|
9
9
|
const TableEditor = (props) => {
|
|
10
10
|
const [initialValue, setInitialValue] = useState(null);
|
|
11
|
-
const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized } = props;
|
|
11
|
+
const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized, refs } = props;
|
|
12
12
|
const { components, extraComponents, backgroundColor } = useAppSelector((state) => state.board);
|
|
13
13
|
const dispatch = useAppDispatch();
|
|
14
14
|
useEffect(() => {
|
|
@@ -105,7 +105,7 @@ const TableEditor = (props) => {
|
|
|
105
105
|
display: viewOnly ? "none" : "flex",
|
|
106
106
|
}}>
|
|
107
107
|
<SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
|
|
108
|
-
<Board />
|
|
108
|
+
<Board refs={refs}/>
|
|
109
109
|
<ControlPanels action={props.action} responseMapping={props.responseMapping}/>
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
@@ -21,7 +21,7 @@ import { debounce } from "lodash";
|
|
|
21
21
|
import clsx from "clsx";
|
|
22
22
|
import { getAttributeElement } from "../board-v3/resize-element";
|
|
23
23
|
import { applyResizeToSvgElement, getGlobalBBox, updateSelectionBox, } from "../board-v3/utils";
|
|
24
|
-
import { SEAT_SHAPES } from "
|
|
24
|
+
import { SEAT_SHAPES } from "../../utils/constant";
|
|
25
25
|
import { adjustHeightWidthForSeatShape, getSeatCount, getSeatPosition, isSeatShape, } from "./utils";
|
|
26
26
|
import SeatSquare from "./table-seat-square";
|
|
27
27
|
const ControlPanels = (props) => {
|