seat-editor 3.5.66 → 3.6.1

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 (49) hide show
  1. package/dist/app/new-board/page.js +18 -1
  2. package/dist/app/new-board/page.jsx +18 -1
  3. package/dist/components/button-radio/index.d.ts +11 -0
  4. package/dist/components/button-radio/index.js +22 -0
  5. package/dist/components/button-radio/index.jsx +25 -0
  6. package/dist/components/form-tools/label.js +20 -2
  7. package/dist/components/form-tools/label.jsx +30 -2
  8. package/dist/components/layer-v3/index.d.ts +9 -1
  9. package/dist/components/layer-v3/index.js +65 -95
  10. package/dist/components/layer-v3/index.jsx +79 -115
  11. package/dist/components/layer-v4/constant.d.ts +16 -2
  12. package/dist/components/layer-v4/constant.js +57 -12
  13. package/dist/components/layer-v4/index.js +111 -188
  14. package/dist/components/layer-v4/index.jsx +124 -215
  15. package/dist/components/modal-preview/index.d.ts +3 -1
  16. package/dist/components/modal-preview/index.js +12 -2
  17. package/dist/components/modal-preview/index.jsx +13 -3
  18. package/dist/dto/table.d.ts +5 -0
  19. package/dist/features/board-v3/board-slice.d.ts +2 -1
  20. package/dist/features/board-v3/board-slice.js +4 -1
  21. package/dist/features/board-v3/constant.d.ts +5 -1
  22. package/dist/features/board-v3/constant.js +23 -1
  23. package/dist/features/board-v3/icons.d.ts +1 -0
  24. package/dist/features/board-v3/icons.js +3 -0
  25. package/dist/features/board-v3/icons.jsx +7 -0
  26. package/dist/features/board-v3/index.d.ts +6 -1
  27. package/dist/features/board-v3/index.js +63 -49
  28. package/dist/features/board-v3/index.jsx +116 -68
  29. package/dist/features/board-v3/utils.js +48 -28
  30. package/dist/features/package/index.d.ts +5 -0
  31. package/dist/features/package/index.js +1 -1
  32. package/dist/features/package/index.jsx +2 -2
  33. package/dist/features/panel/index.js +2 -2
  34. package/dist/features/panel/index.jsx +2 -2
  35. package/dist/features/panel/selected-group.js +2 -2
  36. package/dist/features/panel/selected-group.jsx +4 -2
  37. package/dist/features/side-tool/icons.d.ts +1 -0
  38. package/dist/features/side-tool/icons.js +2 -0
  39. package/dist/features/side-tool/icons.jsx +6 -0
  40. package/dist/features/side-tool/index.d.ts +6 -1
  41. package/dist/features/side-tool/index.js +31 -3
  42. package/dist/features/side-tool/index.jsx +32 -16
  43. package/dist/features/side-tool/side-tool-slice.d.ts +2 -0
  44. package/dist/features/side-tool/side-tool-slice.js +8 -1
  45. package/dist/features/view-only-3/index.js +0 -21
  46. package/dist/features/view-only-3/index.jsx +0 -21
  47. package/dist/provider/antd-provider.js +5 -2
  48. package/dist/provider/antd-provider.jsx +5 -2
  49. package/package.json +1 -1
@@ -14,3 +14,6 @@ export const RsvpIcons = {
14
14
  walk: (props) => (_jsx("svg", Object.assign({ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { d: "M13.0233 5.09302C14.1489 5.09302 15.0698 4.17209 15.0698 3.04651C15.0698 1.92093 14.1489 1 13.0233 1C11.8977 1 10.9768 1.92093 10.9768 3.04651C10.9768 4.17209 11.8977 5.09302 13.0233 5.09302ZM9.23725 8.57209L6.61771 21.7823C6.48469 22.4065 6.97585 23 7.62051 23H7.70237C8.1833 23 8.5926 22.6726 8.70516 22.2019L10.3628 14.814L12.5117 16.8605V21.9767C12.5117 22.5395 12.9721 23 13.5349 23C14.0977 23 14.5582 22.5395 14.5582 21.9767V16.2056C14.5582 15.6428 14.3331 15.1107 13.9238 14.7219L12.4093 13.2791L13.0233 10.2093C14.1764 11.5276 15.755 12.4002 17.4847 12.6753C18.0986 12.7674 18.6512 12.2763 18.6512 11.6521C18.6512 11.1507 18.2828 10.7312 17.7814 10.6493C16.2261 10.3935 14.9368 9.47256 14.2512 8.26512L13.2279 6.62791C12.9516 6.18602 12.527 5.85689 12.0302 5.69941C11.5334 5.54193 10.9968 5.56638 10.5163 5.76837L6.59725 7.42605C6.22654 7.5845 5.91057 7.84841 5.68862 8.18498C5.46667 8.52154 5.34853 8.91591 5.34888 9.31907V11.7442C5.34888 12.307 5.80934 12.7674 6.37213 12.7674C6.93492 12.7674 7.39539 12.307 7.39539 11.7442V9.28837L9.23725 8.57209Z", fill: "currentColor" }) }))),
15
15
  people: (props) => (_jsxs("svg", Object.assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: [_jsx("path", { d: "M8.40752 11.6627C9.79514 11.6627 10.92 10.5378 10.92 9.15019C10.92 7.76258 9.79514 6.6377 8.40752 6.6377C7.0199 6.6377 5.89502 7.76258 5.89502 9.15019C5.89502 10.5378 7.0199 11.6627 8.40752 11.6627Z", fill: "#5E6278" }), _jsx("path", { d: "M8.4076 16.5002C10.1307 16.5002 11.5276 15.6171 11.5276 14.5277C11.5276 13.4383 10.1307 12.5552 8.4076 12.5552C6.68447 12.5552 5.2876 13.4383 5.2876 14.5277C5.2876 15.6171 6.68447 16.5002 8.4076 16.5002Z", fill: "#5E6278" }), _jsx("path", { opacity: "0.3", d: "M12.3826 5.73C13.5507 5.73 14.4976 4.78308 14.4976 3.615C14.4976 2.44692 13.5507 1.5 12.3826 1.5C11.2145 1.5 10.2676 2.44692 10.2676 3.615C10.2676 4.78308 11.2145 5.73 12.3826 5.73Z", fill: "#5E6278" }), _jsx("path", { opacity: "0.3", d: "M4.41017 5.73C5.57825 5.73 6.52517 4.78308 6.52517 3.615C6.52517 2.44692 5.57825 1.5 4.41017 1.5C3.24208 1.5 2.29517 2.44692 2.29517 3.615C2.29517 4.78308 3.24208 5.73 4.41017 5.73Z", fill: "#5E6278" }), _jsxs("g", { opacity: "0.3", children: [_jsx("path", { d: "M12.2625 7.37256C12.0225 7.37256 11.79 7.37256 11.5575 7.41006C11.9105 8.02313 12.0701 8.72856 12.0152 9.43388C11.9603 10.1392 11.6936 10.8115 11.25 11.3626C11.586 11.4291 11.9275 11.4642 12.27 11.4676C14.175 11.4676 15.7125 10.5451 15.7125 9.42006C15.7125 8.29506 14.1675 7.37256 12.2625 7.37256Z", fill: "#5E6278" }), _jsx("path", { d: "M4.2375 7.5C4.4775 7.5 4.71 7.5 4.9425 7.5375C4.58947 8.15057 4.42993 8.856 4.4848 9.56132C4.53968 10.2666 4.8064 10.9389 5.25 11.49C4.91399 11.5565 4.57252 11.5917 4.23 11.595C2.325 11.595 0.7875 10.6725 0.7875 9.5475C0.7875 8.4225 2.3325 7.5 4.2375 7.5Z", fill: "#5E6278" })] })] }))),
16
16
  };
17
+ export const WarningIcon = () => {
18
+ return (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { opacity: "0.3", d: "M9.99935 18.3346C14.6017 18.3346 18.3327 14.6037 18.3327 10.0013C18.3327 5.39893 14.6017 1.66797 9.99935 1.66797C5.39698 1.66797 1.66602 5.39893 1.66602 10.0013C1.66602 14.6037 5.39698 18.3346 9.99935 18.3346Z", fill: "#5E6278" }), _jsx("path", { d: "M9.99935 8.83594C10.2204 8.83594 10.4323 8.92373 10.5886 9.08001C10.7449 9.23629 10.8327 9.44826 10.8327 9.66927V13.5526C10.8327 13.7736 10.7449 13.9856 10.5886 14.1419C10.4323 14.2981 10.2204 14.3859 9.99935 14.3859C9.77834 14.3859 9.56637 14.2981 9.41009 14.1419C9.25381 13.9856 9.16602 13.7736 9.16602 13.5526V9.66927C9.16602 9.44826 9.25381 9.23629 9.41009 9.08001C9.56637 8.92373 9.77834 8.83594 9.99935 8.83594Z", fill: "#5E6278" }), _jsx("path", { d: "M9.9987 7.70052C10.574 7.70052 11.0404 7.23415 11.0404 6.65885C11.0404 6.08356 10.574 5.61719 9.9987 5.61719C9.4234 5.61719 8.95703 6.08356 8.95703 6.65885C8.95703 7.23415 9.4234 7.70052 9.9987 7.70052Z", fill: "#5E6278" })] }));
19
+ };
@@ -98,3 +98,10 @@ export const RsvpIcons = {
98
98
  </g>
99
99
  </svg>),
100
100
  };
101
+ export const WarningIcon = () => {
102
+ return (<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
103
+ <path opacity="0.3" d="M9.99935 18.3346C14.6017 18.3346 18.3327 14.6037 18.3327 10.0013C18.3327 5.39893 14.6017 1.66797 9.99935 1.66797C5.39698 1.66797 1.66602 5.39893 1.66602 10.0013C1.66602 14.6037 5.39698 18.3346 9.99935 18.3346Z" fill="#5E6278"/>
104
+ <path d="M9.99935 8.83594C10.2204 8.83594 10.4323 8.92373 10.5886 9.08001C10.7449 9.23629 10.8327 9.44826 10.8327 9.66927V13.5526C10.8327 13.7736 10.7449 13.9856 10.5886 14.1419C10.4323 14.2981 10.2204 14.3859 9.99935 14.3859C9.77834 14.3859 9.56637 14.2981 9.41009 14.1419C9.25381 13.9856 9.16602 13.7736 9.16602 13.5526V9.66927C9.16602 9.44826 9.25381 9.23629 9.41009 9.08001C9.56637 8.92373 9.77834 8.83594 9.99935 8.83594Z" fill="#5E6278"/>
105
+ <path d="M9.9987 7.70052C10.574 7.70052 11.0404 7.23415 11.0404 6.65885C11.0404 6.08356 10.574 5.61719 9.9987 5.61719C9.4234 5.61719 8.95703 6.08356 8.95703 6.65885C8.95703 7.23415 9.4234 7.70052 9.9987 7.70052Z" fill="#5E6278"/>
106
+ </svg>);
107
+ };
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { ReactZoomPanPinchRef } from "react-zoom-pan-pinch";
3
+ import { ShowTagType } from "./board-slice";
3
4
  export type RefsType = {
4
5
  svgRef: SVGSVGElement | null;
5
6
  transformRef: ReactZoomPanPinchRef | null;
@@ -12,6 +13,10 @@ interface BoardTemplateProps {
12
13
  element: React.JSX.Element;
13
14
  };
14
15
  disabled?: boolean;
16
+ priviewActive?: {
17
+ type: ShowTagType;
18
+ label: string;
19
+ }[];
15
20
  }
16
- declare const BoardTemplate: ({ refs, loadingRender, disabled, }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const BoardTemplate: ({ refs, loadingRender, disabled, priviewActive, }: BoardTemplateProps) => import("react/jsx-runtime").JSX.Element;
17
22
  export default BoardTemplate;
@@ -13,11 +13,13 @@ import { Button, Flex, Radio, Slider, Tag, } from "antd";
13
13
  import { getAttributeElement, getAttributeElements } from "./resize-element";
14
14
  import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlobalBBox, getRotation, getSvgElementSize, getTranslate, isClosingPolygon, normalizeAngle, pointsStringToArray, resizeBox, resizeSeatCircle, resizeSeatRectCircle, resizeSeatRectSquare, resizeSeatSide, resizeSeatSquare, stabilizeRotation, stabilizeTranslateOnRotate, updateManyComponents, updateSelectionBox, updateSelectionGuides, updateSingleComponent, } from "./utils";
15
15
  import { getOS } from "../../utils/agent";
16
- import { MIN_HEIGHT, MIN_WIDTH, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, } from "./constant";
16
+ import { MIN_HEIGHT, MIN_WIDTH, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, FONT_SCALES, } from "./constant";
17
+ import ButtonRadio from "../../components/button-radio";
18
+ import { WarningIcon } from "./icons";
17
19
  const toolElement = ["square", "circle", "table-seat-circle"];
18
20
  const idSelectionBoxGhost = "selection-box-ghost";
19
21
  const nameShapeSelectionBoxGhost = "selection-box";
20
- const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
22
+ const BoardTemplate = ({ refs, loadingRender, disabled = false, priviewActive = [], }) => {
21
23
  const os = getOS();
22
24
  const dispatch = useAppDispatch();
23
25
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
@@ -74,6 +76,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
74
76
  //boundingbox
75
77
  const isInialBoundingBox = useRef(false);
76
78
  const { components: componentsProps, extraComponents: extraComponentsProps, boundingBox, flagChange, updateBy, isShowTagType, } = useAppSelector((state) => state.board);
79
+ console.log("isShowTagType", isShowTagType);
77
80
  const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
78
81
  const { selectionLines } = useAppSelector((state) => state.panel);
79
82
  const [selectedLines, setSelectedLines] = useState(null);
@@ -1398,7 +1401,14 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1398
1401
  polygonElementRef.current = [];
1399
1402
  addComponents(Object.assign(Object.assign({}, newPoints), { x: 0, y: 0, width,
1400
1403
  height, labels: [
1401
- { label: "", x: 0, y: 0, fontSize: 12, fontColor: "#000000", rotation: 0 },
1404
+ {
1405
+ label: "",
1406
+ x: 0,
1407
+ y: 0,
1408
+ fontSize: 12,
1409
+ fontColor: "#000000",
1410
+ rotation: 0,
1411
+ },
1402
1412
  ], opacity: 0.5, rotation: 0, strokeWidth: 0 }));
1403
1413
  (_e = svg.querySelector("#selection-box-ghost")) === null || _e === void 0 ? void 0 : _e.remove();
1404
1414
  (_f = svg.querySelector("#polyline-helper")) === null || _f === void 0 ? void 0 : _f.setAttribute("opacity", "0");
@@ -1840,26 +1850,11 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1840
1850
  //lin helper from start to move
1841
1851
  }
1842
1852
  };
1843
- const handleCheckPreview = (e) => {
1844
- const type = e.target.value;
1845
- if (type === "type-1") {
1846
- dispatch({
1847
- type: "board/setTagType",
1848
- payload: type,
1849
- });
1850
- }
1851
- if (type === "type-2") {
1852
- dispatch({
1853
- type: "board/setTagType",
1854
- payload: type,
1855
- });
1856
- }
1857
- if (type === "default") {
1858
- dispatch({
1859
- type: "board/setTagType",
1860
- payload: type,
1861
- });
1862
- }
1853
+ const handleCheckPreview = (v) => {
1854
+ dispatch({
1855
+ type: "board/setTagType",
1856
+ payload: v,
1857
+ });
1863
1858
  };
1864
1859
  const footerInfoList = useMemo(() => {
1865
1860
  return [
@@ -1953,32 +1948,51 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1953
1948
  value: 1.5,
1954
1949
  },
1955
1950
  ];
1956
- // const handleClickButtonFontScaling = (value: number, type: string) => {
1957
- // dispatch({
1958
- // type: "board/setScalingFontSize",
1959
- // payload: {
1960
- // value,
1961
- // type,
1962
- // },
1963
- // });
1964
- // };
1965
- // const valuesScalingFontSize = () => {
1966
- // const pickOneSample = componentsState?.[0];
1967
- // if (isShowTagType === "type-1") {
1968
- // console.log({ pickOneSample });
1969
- // return pickOneSample?.fontSizeType1;
1970
- // }
1971
- // if (isShowTagType === "type-2") {
1972
- // return pickOneSample?.fontSizeType2;
1973
- // }
1974
- // };
1975
- return (_jsxs(_Fragment, { children: [_jsxs(ModalPreview, { children: [_jsx(LayerView, { statusKey: "status", loadingRender: loadingRender, actionPrivileged: {
1976
- select: false,
1977
- move: false,
1978
- switch: false,
1979
- drop: false,
1980
- rightClick: false,
1981
- }, defaultBoundingBox: boundingBox }), _jsx("div", { className: "flex gap-2 mt-2", children: _jsxs(Radio.Group, { value: isShowTagType, onChange: handleCheckPreview, children: [_jsx(Radio, { value: "default", children: "Customer View" }), _jsx(Radio, { value: "type-1", children: "Layout View" }), _jsx(Radio, { value: "type-2", children: "Next 3 Reservation" })] }) })] }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden mt-[78px]", ref: containerRef, children: [_jsx("div", { style: {
1951
+ const handleClickButtonFontScaling = (value, type) => {
1952
+ dispatch({
1953
+ type: "board/setScalingFontSize",
1954
+ payload: {
1955
+ value,
1956
+ type,
1957
+ },
1958
+ });
1959
+ dispatch({ type: "board/setFlagChange", payload: true });
1960
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
1961
+ };
1962
+ const valuesScalingFontSize = () => {
1963
+ const pickOneSample = componentsState === null || componentsState === void 0 ? void 0 : componentsState[0];
1964
+ if (isShowTagType === "type-1") {
1965
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType1) || 1;
1966
+ }
1967
+ if (isShowTagType === "type-2") {
1968
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType2) || 1;
1969
+ }
1970
+ if (isShowTagType === "type-3") {
1971
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType3) || 1;
1972
+ }
1973
+ return 1;
1974
+ };
1975
+ const { typePreview } = useAppSelector((state) => state.tool);
1976
+ const previewTabValue = typePreview === "setting"
1977
+ ? priviewActive === null || priviewActive === void 0 ? void 0 : priviewActive.filter((item) => item.type !== "default")
1978
+ : priviewActive;
1979
+ return (_jsxs(_Fragment, { children: [_jsx(ModalPreview, { modalProps: {
1980
+ footer: typePreview === "setting" && isShowTagType !== "default" && (_jsx(_Fragment, { children: _jsxs("div", { className: "flex gap-2 p-[20px]", children: [_jsx("span", { className: "font-bold text-[14px]", children: "Select Font Size:" }), _jsx(Radio.Group, { value: valuesScalingFontSize(), onChange: (e) => {
1981
+ handleClickButtonFontScaling(e.target.value, isShowTagType);
1982
+ }, children: FONT_SCALES === null || FONT_SCALES === void 0 ? void 0 : FONT_SCALES.map((item) => (_jsx(Radio, { value: item.value, children: item.label }, item.value))) })] }) })),
1983
+ title: (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-[20px] p-[20px]", children: _jsx("h1", { className: "text-[22px] font-semibold leading-[22px]", children: typePreview === "setting"
1984
+ ? "Font Size Setting"
1985
+ : "Preview Board" }) }), _jsx("div", { className: "w-full h-[1px] bg-[#E6E6E6]" }), _jsx("div", { className: "p-[10px]", children: _jsx(ButtonRadio, { onChange: (val) => handleCheckPreview(val), options: previewTabValue === null || previewTabValue === void 0 ? void 0 : previewTabValue.map((item) => ({
1986
+ label: item.label,
1987
+ value: item.type,
1988
+ })), value: isShowTagType }) }), typePreview === "setting" && (_jsxs("div", { className: "py-2.5 px-3 bg-[#FFF8DD] border-[#FFC700] border text-[#181C32] flex gap-2.5 text-[12px] font-semibold items-center tracking-[0%]", children: [_jsx(WarningIcon, {}), " Font adjustments made here are scaled based on the original font sizes set in the main layout. Changes made here affect the operational layouts only, without changing your main editing canvas."] }))] })),
1989
+ }, children: _jsx(LayerView, { statusKey: "status", loadingRender: loadingRender, actionPrivileged: {
1990
+ select: false,
1991
+ move: false,
1992
+ switch: false,
1993
+ drop: false,
1994
+ rightClick: false,
1995
+ }, defaultBoundingBox: boundingBox }) }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden mt-[78px]", ref: containerRef, children: [_jsx("div", { style: {
1982
1996
  position: "absolute",
1983
1997
  bottom: "118px",
1984
1998
  left: "50%",
@@ -12,11 +12,13 @@ import { Button, Flex, Radio, Slider, Tag, } from "antd";
12
12
  import { getAttributeElement, getAttributeElements } from "./resize-element";
13
13
  import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlobalBBox, getRotation, getSvgElementSize, getTranslate, isClosingPolygon, normalizeAngle, pointsStringToArray, resizeBox, resizeSeatCircle, resizeSeatRectCircle, resizeSeatRectSquare, resizeSeatSide, resizeSeatSquare, stabilizeRotation, stabilizeTranslateOnRotate, updateManyComponents, updateSelectionBox, updateSelectionGuides, updateSingleComponent, } from "./utils";
14
14
  import { getOS } from "../../utils/agent";
15
- import { MIN_HEIGHT, MIN_WIDTH, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, } from "./constant";
15
+ import { MIN_HEIGHT, MIN_WIDTH, ZOOM_STEP, ZOOM_MAX, ZOOM_MIN, FONT_SCALES, } from "./constant";
16
+ import ButtonRadio from "../../components/button-radio";
17
+ import { WarningIcon } from "./icons";
16
18
  const toolElement = ["square", "circle", "table-seat-circle"];
17
19
  const idSelectionBoxGhost = "selection-box-ghost";
18
20
  const nameShapeSelectionBoxGhost = "selection-box";
19
- const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
21
+ const BoardTemplate = ({ refs, loadingRender, disabled = false, priviewActive = [], }) => {
20
22
  const os = getOS();
21
23
  const dispatch = useAppDispatch();
22
24
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
@@ -73,6 +75,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
73
75
  //boundingbox
74
76
  const isInialBoundingBox = useRef(false);
75
77
  const { components: componentsProps, extraComponents: extraComponentsProps, boundingBox, flagChange, updateBy, isShowTagType, } = useAppSelector((state) => state.board);
78
+ console.log("isShowTagType", isShowTagType);
76
79
  const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
77
80
  const { selectionLines } = useAppSelector((state) => state.panel);
78
81
  const [selectedLines, setSelectedLines] = useState(null);
@@ -1397,7 +1400,14 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1397
1400
  polygonElementRef.current = [];
1398
1401
  addComponents(Object.assign(Object.assign({}, newPoints), { x: 0, y: 0, width,
1399
1402
  height, labels: [
1400
- { label: "", x: 0, y: 0, fontSize: 12, fontColor: "#000000", rotation: 0 },
1403
+ {
1404
+ label: "",
1405
+ x: 0,
1406
+ y: 0,
1407
+ fontSize: 12,
1408
+ fontColor: "#000000",
1409
+ rotation: 0,
1410
+ },
1401
1411
  ], opacity: 0.5, rotation: 0, strokeWidth: 0 }));
1402
1412
  (_e = svg.querySelector("#selection-box-ghost")) === null || _e === void 0 ? void 0 : _e.remove();
1403
1413
  (_f = svg.querySelector("#polyline-helper")) === null || _f === void 0 ? void 0 : _f.setAttribute("opacity", "0");
@@ -1839,26 +1849,11 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1839
1849
  //lin helper from start to move
1840
1850
  }
1841
1851
  };
1842
- const handleCheckPreview = (e) => {
1843
- const type = e.target.value;
1844
- if (type === "type-1") {
1845
- dispatch({
1846
- type: "board/setTagType",
1847
- payload: type,
1848
- });
1849
- }
1850
- if (type === "type-2") {
1851
- dispatch({
1852
- type: "board/setTagType",
1853
- payload: type,
1854
- });
1855
- }
1856
- if (type === "default") {
1857
- dispatch({
1858
- type: "board/setTagType",
1859
- payload: type,
1860
- });
1861
- }
1852
+ const handleCheckPreview = (v) => {
1853
+ dispatch({
1854
+ type: "board/setTagType",
1855
+ payload: v,
1856
+ });
1862
1857
  };
1863
1858
  const footerInfoList = useMemo(() => {
1864
1859
  return [
@@ -1952,28 +1947,105 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1952
1947
  value: 1.5,
1953
1948
  },
1954
1949
  ];
1955
- // const handleClickButtonFontScaling = (value: number, type: string) => {
1956
- // dispatch({
1957
- // type: "board/setScalingFontSize",
1958
- // payload: {
1959
- // value,
1960
- // type,
1961
- // },
1962
- // });
1963
- // };
1964
- // const valuesScalingFontSize = () => {
1965
- // const pickOneSample = componentsState?.[0];
1966
- // if (isShowTagType === "type-1") {
1967
- // console.log({ pickOneSample });
1968
- // return pickOneSample?.fontSizeType1;
1969
- // }
1970
- // if (isShowTagType === "type-2") {
1971
- // return pickOneSample?.fontSizeType2;
1972
- // }
1973
- // };
1950
+ const handleClickButtonFontScaling = (value, type) => {
1951
+ dispatch({
1952
+ type: "board/setScalingFontSize",
1953
+ payload: {
1954
+ value,
1955
+ type,
1956
+ },
1957
+ });
1958
+ dispatch({ type: "board/setFlagChange", payload: true });
1959
+ dispatch({ type: "board/setUpdateBy", payload: "global" });
1960
+ };
1961
+ const valuesScalingFontSize = () => {
1962
+ const pickOneSample = componentsState === null || componentsState === void 0 ? void 0 : componentsState[0];
1963
+ if (isShowTagType === "type-1") {
1964
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType1) || 1;
1965
+ }
1966
+ if (isShowTagType === "type-2") {
1967
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType2) || 1;
1968
+ }
1969
+ if (isShowTagType === "type-3") {
1970
+ return (pickOneSample === null || pickOneSample === void 0 ? void 0 : pickOneSample.fontSizeType3) || 1;
1971
+ }
1972
+ return 1;
1973
+ };
1974
+ const { typePreview } = useAppSelector((state) => state.tool);
1975
+ const previewTabValue = typePreview === "setting"
1976
+ ? priviewActive === null || priviewActive === void 0 ? void 0 : priviewActive.filter((item) => item.type !== "default")
1977
+ : priviewActive;
1974
1978
  return (<>
1975
- <ModalPreview>
1976
-
1979
+ <ModalPreview modalProps={{
1980
+ footer: typePreview === "setting" && isShowTagType !== "default" && (<>
1981
+ <div className="flex gap-2 p-[20px]">
1982
+ <span className="font-bold text-[14px]">Select Font Size:</span>
1983
+
1984
+ <Radio.Group value={valuesScalingFontSize()} onChange={(e) => {
1985
+ handleClickButtonFontScaling(e.target.value, isShowTagType);
1986
+ }}>
1987
+ {FONT_SCALES === null || FONT_SCALES === void 0 ? void 0 : FONT_SCALES.map((item) => (<Radio key={item.value} value={item.value}>
1988
+ {item.label}
1989
+ </Radio>))}
1990
+ </Radio.Group>
1991
+ </div>
1992
+
1993
+ {/* <div className="w-full h-[1px] bg-[#E6E6E6]" /> */}
1994
+ {/* <div className="flex justify-between p-[20px]">
1995
+ <Button
1996
+ htmlType="button"
1997
+ style={{
1998
+ padding: "12px 23px",
1999
+ color: "black",
2000
+ border: "1px solid #E1E3EA",
2001
+ background: "white",
2002
+ fontSize: "13px",
2003
+ lineHeight: "14px",
2004
+ fontWeight: 600,
2005
+ height: 38,
2006
+ }}
2007
+ >
2008
+ Cancel
2009
+ </Button>
2010
+ <Button
2011
+ htmlType="button"
2012
+ style={{
2013
+ background: "#181E49",
2014
+ color: "white",
2015
+ padding: "12px 23px",
2016
+ fontSize: "13px",
2017
+ lineHeight: "14px",
2018
+ fontWeight: 600,
2019
+ height: 38,
2020
+ }}
2021
+ >
2022
+ Save
2023
+ </Button>
2024
+ </div> */}
2025
+ </>),
2026
+ title: (<>
2027
+ <div className="flex flex-col gap-[20px] p-[20px]">
2028
+ <h1 className="text-[22px] font-semibold leading-[22px]">
2029
+ {typePreview === "setting"
2030
+ ? "Font Size Setting"
2031
+ : "Preview Board"}
2032
+ </h1>
2033
+ </div>
2034
+ <div className="w-full h-[1px] bg-[#E6E6E6]"/>
2035
+ <div className="p-[10px]">
2036
+ <ButtonRadio onChange={(val) => handleCheckPreview(val)} options={previewTabValue === null || previewTabValue === void 0 ? void 0 : previewTabValue.map((item) => ({
2037
+ label: item.label,
2038
+ value: item.type,
2039
+ }))} value={isShowTagType}/>
2040
+ </div>
2041
+ {typePreview === "setting" && (<div className="py-2.5 px-3 bg-[#FFF8DD] border-[#FFC700] border text-[#181C32] flex gap-2.5 text-[12px] font-semibold items-center tracking-[0%]">
2042
+ <WarningIcon /> Font adjustments made here are scaled based on
2043
+ the original font sizes set in the main layout. Changes made
2044
+ here affect the operational layouts only, without changing your
2045
+ main editing canvas.
2046
+ </div>)}
2047
+ </>),
2048
+ }}>
1977
2049
  <LayerView statusKey="status" loadingRender={loadingRender} actionPrivileged={{
1978
2050
  select: false,
1979
2051
  move: false,
@@ -1981,30 +2053,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1981
2053
  drop: false,
1982
2054
  rightClick: false,
1983
2055
  }} defaultBoundingBox={boundingBox}/>
1984
- {/* {isShowTagType !== "default" && (
1985
- <div className="flex gap-2 mt-2">
1986
- {scalingFontSize?.map((item) => (
1987
- <Button
1988
- type="default"
1989
- htmlType="button"
1990
- onClick={() =>
1991
- handleClickButtonFontScaling(item.value, isShowTagType)
1992
- }
1993
- >
1994
- {item.label}
1995
- </Button>
1996
- ))}
1997
- <span>{valuesScalingFontSize()}</span>
1998
- <InputNumber prefix="x" value={valuesScalingFontSize()} />
1999
- </div>
2000
- )} */}
2001
- <div className="flex gap-2 mt-2">
2002
- <Radio.Group value={isShowTagType} onChange={handleCheckPreview}>
2003
- <Radio value="default">Customer View</Radio>
2004
- <Radio value="type-1">Layout View</Radio>
2005
- <Radio value="type-2">Next 3 Reservation</Radio>
2006
- </Radio.Group>
2007
- </div>
2008
2056
  </ModalPreview>
2009
2057
  <div className="relative w-full h-screen flex-1 overflow-hidden mt-[78px]" ref={containerRef}>
2010
2058
  <div style={{
@@ -226,7 +226,7 @@ export const resizeSeatSquare = ({ seatsPositions, r = 10, openSpace, newElement
226
226
  id: "left",
227
227
  }));
228
228
  const bottomXs = distributeWithSpacing({
229
- start: 0,
229
+ start: newElement.x,
230
230
  length: newElement.width,
231
231
  count: bottomCount,
232
232
  radius: r,
@@ -305,7 +305,7 @@ export const resizeSeatSide = ({ seatsPositions, r = 10, openSpace, newElement,
305
305
  let left = [];
306
306
  let bottom = [];
307
307
  let right = [];
308
- const seatRaidus = Math.max(newElement.width, newElement.height) * 0.15;
308
+ const seatRadius = Math.max(newElement.width, newElement.height) * 0.15;
309
309
  const topCount = seatsPositions.top;
310
310
  const rightCount = seatsPositions.right;
311
311
  const bottomCount = seatsPositions.bottom;
@@ -332,77 +332,77 @@ export const resizeSeatSide = ({ seatsPositions, r = 10, openSpace, newElement,
332
332
  }
333
333
  }
334
334
  const topXs = distributeWithSpacing({
335
- start: newElement.x,
335
+ start: 0,
336
336
  length: newElement.width,
337
337
  count: topCount,
338
- radius: seatRaidus,
338
+ radius: seatRadius,
339
339
  spacing: spacingWidth,
340
340
  });
341
341
  const topSeats = topXs.map((cx) => ({
342
342
  cx,
343
- cy: newElement.y - seatRaidus,
343
+ cy: seatRadius,
344
344
  id: "top",
345
345
  d: arcByDirection({
346
346
  cx,
347
- cy: newElement.y - seatRaidus * 0.1,
348
- r: seatRaidus,
347
+ cy: seatRadius * 0.1,
348
+ r: seatRadius,
349
349
  direction: "top",
350
350
  fraction: 0.4,
351
351
  }),
352
352
  }));
353
353
  const leftYs = distributeWithSpacing({
354
- start: newElement.y,
354
+ start: 0,
355
355
  length: newElement.height,
356
356
  count: leftCount,
357
- radius: seatRaidus,
357
+ radius: seatRadius,
358
358
  spacing: spacingHeight,
359
359
  });
360
360
  const leftSeats = leftYs.map((cy) => ({
361
- cx: newElement.x - seatRaidus * 0.1,
361
+ cx: seatRadius * 0.1,
362
362
  cy,
363
363
  id: "left",
364
364
  d: arcByDirection({
365
- cx: newElement.x - seatRaidus * 0.1,
365
+ cx: seatRadius * 0.1,
366
366
  cy,
367
- r: seatRaidus,
367
+ r: seatRadius,
368
368
  direction: "left",
369
369
  fraction: 0.4,
370
370
  }),
371
371
  }));
372
372
  const bottomXs = distributeWithSpacing({
373
- start: newElement.x,
373
+ start: 0,
374
374
  length: newElement.width,
375
375
  count: bottomCount,
376
- radius: seatRaidus,
376
+ radius: seatRadius,
377
377
  spacing: spacingWidth,
378
378
  });
379
379
  const bottomSeats = bottomXs.map((cx) => ({
380
380
  cx,
381
- cy: newElement.y + newElement.height + seatRaidus * 0.1,
381
+ cy: newElement.height + seatRadius * 0.1,
382
382
  id: "bottom",
383
383
  d: arcByDirection({
384
384
  cx,
385
- cy: newElement.y + newElement.height + seatRaidus * 0.1,
386
- r: seatRaidus,
385
+ cy: newElement.height + seatRadius * 0.1,
386
+ r: seatRadius,
387
387
  direction: "bottom",
388
388
  fraction: 0.4,
389
389
  }),
390
390
  }));
391
391
  const rightYs = distributeWithSpacing({
392
- start: newElement.y,
392
+ start: 0,
393
393
  length: newElement.height,
394
394
  count: rightCount,
395
- radius: seatRaidus,
395
+ radius: seatRadius,
396
396
  spacing: spacingHeight,
397
397
  });
398
398
  const rightSeats = rightYs.map((cy) => ({
399
- cx: newElement.x + newElement.width + seatRaidus * 0.1,
399
+ cx: newElement.width + seatRadius * 0.1,
400
400
  cy,
401
401
  id: "right",
402
402
  d: arcByDirection({
403
- cx: newElement.x + newElement.width + seatRaidus * 0.1,
403
+ cx: newElement.width + seatRadius * 0.1,
404
404
  cy,
405
- r: seatRaidus,
405
+ r: seatRadius,
406
406
  direction: "right",
407
407
  fraction: 0.4,
408
408
  }),
@@ -423,7 +423,10 @@ export const resizeSeatSide = ({ seatsPositions, r = 10, openSpace, newElement,
423
423
  var _a;
424
424
  seat.setAttribute("d", (_a = rightSeats[i]) === null || _a === void 0 ? void 0 : _a.d);
425
425
  });
426
- seatGroup === null || seatGroup === void 0 ? void 0 : seatGroup.setAttribute("transform", `translate(${-newElement.x}, ${-newElement.y})`);
426
+ // seatGroup?.setAttribute(
427
+ // "transform",
428
+ // `translate(${-newElement.x}, ${-newElement.y})`
429
+ // );
427
430
  };
428
431
  export const resizeSeatRectCircle = ({ seatsPositions, r = 10, openSpace, newElement, seats, seatGroup, }) => {
429
432
  let top = [];
@@ -1029,15 +1032,32 @@ const updateSvgAttrs = (el, attrs) => {
1029
1032
  }
1030
1033
  };
1031
1034
  export function applyResizeToSvgElement(element, group, resize, text, textRaw) {
1032
- var _a, _b, _c, _d;
1035
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1036
+ const horizontalAlign = (_c = (_b = (_a = resize === null || resize === void 0 ? void 0 : resize.labels) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.horizontalAlign) !== null && _c !== void 0 ? _c : "middle";
1037
+ const verticalAlign = (_f = (_e = (_d = resize === null || resize === void 0 ? void 0 : resize.labels) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.verticalAlign) !== null && _f !== void 0 ? _f : "middle";
1038
+ const PADDING = 0;
1039
+ const getX = (labelX = 0, horizontalAlign = "middle") => {
1040
+ if (horizontalAlign === "start")
1041
+ return PADDING + labelX;
1042
+ if (horizontalAlign === "end")
1043
+ return resize.width - PADDING + labelX;
1044
+ return resize.width / 2 + labelX;
1045
+ };
1046
+ const getY = (labelY = 0, verticalAlign = "middle") => {
1047
+ if (verticalAlign === "hanging")
1048
+ return PADDING + labelY;
1049
+ if (verticalAlign === "auto")
1050
+ return resize.height - PADDING + labelY;
1051
+ return resize.height / 2 + labelY;
1052
+ };
1033
1053
  const tagName = element.tagName.toLowerCase();
1034
1054
  switch (tagName) {
1035
1055
  case "rect":
1036
1056
  case "image": {
1037
1057
  const width = resize.width < MIN_WIDTH ? MIN_WIDTH : Math.round(resize.width);
1038
1058
  const height = resize.height < MIN_HEIGHT ? MIN_HEIGHT : Math.round(resize.height);
1039
- const rotation = (_a = resize.rotation) !== null && _a !== void 0 ? _a : 0;
1040
- const labelsDefault = (_b = resize === null || resize === void 0 ? void 0 : resize.labels) !== null && _b !== void 0 ? _b : [];
1059
+ const rotation = (_g = resize.rotation) !== null && _g !== void 0 ? _g : 0;
1060
+ const labelsDefault = (_h = resize === null || resize === void 0 ? void 0 : resize.labels) !== null && _h !== void 0 ? _h : [];
1041
1061
  updateSvgAttrs(element, {
1042
1062
  width,
1043
1063
  height,
@@ -1051,8 +1071,8 @@ export function applyResizeToSvgElement(element, group, resize, text, textRaw) {
1051
1071
  textRaw === null || textRaw === void 0 ? void 0 : textRaw.setAttribute("y", String(height / 2));
1052
1072
  const origintext = text === null || text === void 0 ? void 0 : text.querySelector("text");
1053
1073
  if (origintext) {
1054
- origintext.setAttribute("x", String((width / 2) + ((_c = labelsDefault === null || labelsDefault === void 0 ? void 0 : labelsDefault[0]) === null || _c === void 0 ? void 0 : _c.x)));
1055
- origintext.setAttribute("y", String((height / 2) + ((_d = labelsDefault === null || labelsDefault === void 0 ? void 0 : labelsDefault[0]) === null || _d === void 0 ? void 0 : _d.y)));
1074
+ origintext.setAttribute("x", String(getX((_j = labelsDefault === null || labelsDefault === void 0 ? void 0 : labelsDefault[0]) === null || _j === void 0 ? void 0 : _j.x, horizontalAlign)));
1075
+ origintext.setAttribute("y", String(getY((_k = labelsDefault === null || labelsDefault === void 0 ? void 0 : labelsDefault[0]) === null || _k === void 0 ? void 0 : _k.y, verticalAlign)));
1056
1076
  }
1057
1077
  break;
1058
1078
  }
@@ -3,6 +3,7 @@ import { RefsType } from "../board-v3";
3
3
  import { OnCurrentStateChange } from "../view-only-3";
4
4
  import { PropertiesProps } from "../../dto/table";
5
5
  import { ComponentProps } from "../view-only-3/index";
6
+ import { ShowTagType } from "../board-v3/board-slice";
6
7
  export interface TableEditorProps<TMeta = undefined> {
7
8
  componentProps: ComponentProps<TMeta>[];
8
9
  extraComponentProps: PropertiesProps[];
@@ -48,6 +49,10 @@ export interface TableEditorProps<TMeta = undefined> {
48
49
  key: string;
49
50
  value: number;
50
51
  };
52
+ priviewActive: {
53
+ type: ShowTagType;
54
+ label: string;
55
+ }[];
51
56
  }
52
57
  declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
53
58
  export default TableEditor;
@@ -237,6 +237,6 @@ const TableEditor = (props) => {
237
237
  switch: false,
238
238
  drop: false,
239
239
  rightClick: false,
240
- } }, `${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("div", { className: "absolute top-0 left-0 w-full bg-white py-[20px] z-[51] border-b border-gray-200", children: props.header ? (props.header) : (_jsx("div", { className: "text-xl font-bold h-[38px] leading-[38px] flex ", children: "Logo Navbar" })) }), _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}`)) }) }));
240
+ } }, `${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("div", { className: "absolute top-0 left-0 w-full bg-white py-[20px] z-[51] border-b border-gray-200", children: props.header ? (props.header) : (_jsx("div", { className: "text-xl font-bold h-[38px] leading-[38px] flex ", children: "Logo Navbar" })) }), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized, priviewActive: props === null || props === void 0 ? void 0 : props.priviewActive }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender, disabled: props === null || props === void 0 ? void 0 : props.disabledView, priviewActive: props === null || props === void 0 ? void 0 : props.priviewActive }, `${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}`)) }) }));
241
241
  };
242
242
  export default TableEditor;