seat-editor 3.3.46 → 3.4.0
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.
- package/dist/app/constant.d.ts +3 -0
- package/dist/app/constant.js +2 -1
- package/dist/app/layout.d.ts +1 -1
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/new-board/page.js +6 -1
- package/dist/app/new-board/page.jsx +6 -1
- package/dist/app/old-board/page.d.ts +1 -2
- package/dist/app/only-view/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +2 -10
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/page.js +7 -7
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +2 -10
- package/dist/app/page.d.ts +1 -1
- package/dist/app/test/page.d.ts +1 -2
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/label.js +8 -4
- package/dist/components/form-tools/label.jsx +27 -21
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/form-tools/shape.js +41 -16
- package/dist/components/form-tools/shape.jsx +35 -14
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/joystick/index.d.ts +1 -2
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board-v2/index.d.ts +1 -2
- package/dist/features/board-v3/index.d.ts +1 -1
- package/dist/features/board-v3/index.js +12 -5
- package/dist/features/board-v3/index.jsx +12 -5
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/package/index.d.ts +2 -1
- package/dist/features/package/index.js +22 -17
- package/dist/features/package/index.jsx +22 -17
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/index.js +26 -13
- package/dist/features/panel/index.jsx +26 -13
- package/dist/features/panel/panel-slice.d.ts +2 -0
- package/dist/features/panel/panel-slice.js +3 -0
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/select-tool.js +31 -14
- package/dist/features/panel/select-tool.jsx +31 -24
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.js +2 -2
- package/dist/features/panel/table-seat-circle.jsx +6 -14
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/table-seat-square.js +8 -2
- package/dist/features/panel/table-seat-square.jsx +15 -8
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.js +3 -1
- package/dist/features/panel/upload-tool.jsx +4 -2
- package/dist/features/panel/utils.d.ts +8 -2
- package/dist/features/panel/utils.js +60 -23
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/side-tool/index.js +9 -3
- package/dist/features/side-tool/index.jsx +16 -4
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-2/index.js +6 -4
- package/dist/features/view-only-2/index.jsx +5 -3
- package/dist/features/view-only-3/index.d.ts +1 -1
- package/dist/features/view-only-3/index.js +7 -5
- package/dist/features/view-only-3/index.jsx +7 -9
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/store-provider.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,26 +12,43 @@ const SelectToolForm = ({ title = "Title", action, tranform }) => {
|
|
|
12
12
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
13
13
|
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
14
14
|
const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
|
|
15
|
-
const SummaryComponents = () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
// const SummaryComponents = () => {
|
|
16
|
+
// const countByShape: Record<string, number> = components?.reduce(
|
|
17
|
+
// (acc: any, item: any) => {
|
|
18
|
+
// acc[item.shape] = (acc[item.shape] || 0) + 1;
|
|
19
|
+
// return acc;
|
|
20
|
+
// },
|
|
21
|
+
// {}
|
|
22
|
+
// );
|
|
23
|
+
// const variableFormatToString = (variable: string) => {
|
|
24
|
+
// return variable
|
|
25
|
+
// .replace(/-/g, " ")
|
|
26
|
+
// .replace(/\b\w/g, (char) => char.toUpperCase());
|
|
27
|
+
// };
|
|
28
|
+
// return (
|
|
29
|
+
// <div className="flex flex-col">
|
|
30
|
+
// <h1 className="heading-s">{title}</h1>
|
|
31
|
+
// <div className="flex flex-col gap-2 mt-5">
|
|
32
|
+
// {Object.entries(countByShape).map(([shape, count]) => (
|
|
33
|
+
// <div key={shape}>
|
|
34
|
+
// <span className="font-bold">
|
|
35
|
+
// {variableFormatToString(shape)}:
|
|
36
|
+
// </span>{" "}
|
|
37
|
+
// {count}
|
|
38
|
+
// </div>
|
|
39
|
+
// ))}
|
|
40
|
+
// </div>
|
|
41
|
+
// </div>
|
|
42
|
+
// );
|
|
43
|
+
// };
|
|
27
44
|
const renderComponent = () => {
|
|
28
45
|
switch (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) {
|
|
29
46
|
case "square":
|
|
30
47
|
case "circle":
|
|
31
48
|
return _jsx(SquareToolForm, {});
|
|
32
49
|
case "table-seat-circle":
|
|
33
|
-
case "table-seat-rect-circle":
|
|
34
50
|
return _jsx(SeatCircle, {});
|
|
51
|
+
case "table-seat-rect-circle":
|
|
35
52
|
case "table-seat-square":
|
|
36
53
|
case "table-seat-half-square":
|
|
37
54
|
case "table-seat-rect-square":
|
|
@@ -52,6 +69,6 @@ const SelectToolForm = ({ title = "Title", action, tranform }) => {
|
|
|
52
69
|
return _jsx(SelectedGroup, {});
|
|
53
70
|
}
|
|
54
71
|
};
|
|
55
|
-
return (_jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
72
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [renderComponent(), renderSelectionComponent()] }));
|
|
56
73
|
};
|
|
57
74
|
export default SelectToolForm;
|
|
@@ -11,36 +11,43 @@ const SelectToolForm = ({ title = "Title", action, tranform }) => {
|
|
|
11
11
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
12
12
|
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
13
13
|
const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
|
|
14
|
-
const SummaryComponents = () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
14
|
+
// const SummaryComponents = () => {
|
|
15
|
+
// const countByShape: Record<string, number> = components?.reduce(
|
|
16
|
+
// (acc: any, item: any) => {
|
|
17
|
+
// acc[item.shape] = (acc[item.shape] || 0) + 1;
|
|
18
|
+
// return acc;
|
|
19
|
+
// },
|
|
20
|
+
// {}
|
|
21
|
+
// );
|
|
22
|
+
// const variableFormatToString = (variable: string) => {
|
|
23
|
+
// return variable
|
|
24
|
+
// .replace(/-/g, " ")
|
|
25
|
+
// .replace(/\b\w/g, (char) => char.toUpperCase());
|
|
26
|
+
// };
|
|
27
|
+
// return (
|
|
28
|
+
// <div className="flex flex-col">
|
|
29
|
+
// <h1 className="heading-s">{title}</h1>
|
|
30
|
+
// <div className="flex flex-col gap-2 mt-5">
|
|
31
|
+
// {Object.entries(countByShape).map(([shape, count]) => (
|
|
32
|
+
// <div key={shape}>
|
|
33
|
+
// <span className="font-bold">
|
|
34
|
+
// {variableFormatToString(shape)}:
|
|
35
|
+
// </span>{" "}
|
|
36
|
+
// {count}
|
|
37
|
+
// </div>
|
|
38
|
+
// ))}
|
|
39
|
+
// </div>
|
|
40
|
+
// </div>
|
|
41
|
+
// );
|
|
42
|
+
// };
|
|
36
43
|
const renderComponent = () => {
|
|
37
44
|
switch (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) {
|
|
38
45
|
case "square":
|
|
39
46
|
case "circle":
|
|
40
47
|
return <SquareToolForm />;
|
|
41
48
|
case "table-seat-circle":
|
|
42
|
-
case "table-seat-rect-circle":
|
|
43
49
|
return <SeatCircle />;
|
|
50
|
+
case "table-seat-rect-circle":
|
|
44
51
|
case "table-seat-square":
|
|
45
52
|
case "table-seat-half-square":
|
|
46
53
|
case "table-seat-rect-square":
|
|
@@ -62,7 +69,7 @@ const SelectToolForm = ({ title = "Title", action, tranform }) => {
|
|
|
62
69
|
}
|
|
63
70
|
};
|
|
64
71
|
return (<div className="flex flex-col gap-2">
|
|
65
|
-
<SummaryComponents />
|
|
72
|
+
{/* <SummaryComponents /> */}
|
|
66
73
|
{renderComponent()}
|
|
67
74
|
{renderSelectionComponent()}
|
|
68
75
|
</div>);
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ColorPicker, Flex, Form, InputNumber } from "antd";
|
|
3
|
+
import { ColorPicker, Flex, Form, Divider, InputNumber } from "antd";
|
|
4
4
|
import SectionLabel from "../../components/form-tools/label";
|
|
5
5
|
import SectionShape from "../../components/form-tools/shape";
|
|
6
6
|
const SeatCircle = () => {
|
|
7
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "
|
|
7
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx(SectionShape, {}), _jsx("h1", { className: "heading-s", children: "Section Seating" }), _jsx(Divider, { style: { margin: 4 } }), _jsxs(Flex, { children: [_jsx(Form.Item, { name: "seatCount", label: "Seat Count", className: "w-full", children: _jsx(InputNumber, { min: 0, disabled: true }) }), _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 10, suffix: "%" }) })] }), _jsx(Flex, { gap: 2, children: _jsx(Form.Item, { label: "Seat Fill", name: "seatFill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }) }), _jsx(SectionLabel, {})] }) }));
|
|
8
8
|
};
|
|
9
9
|
export default SeatCircle;
|
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ColorPicker, Flex, Form, InputNumber } from "antd";
|
|
2
|
+
import { ColorPicker, Flex, Form, Divider, InputNumber } from "antd";
|
|
3
3
|
import SectionLabel from "../../components/form-tools/label";
|
|
4
4
|
import SectionShape from "../../components/form-tools/shape";
|
|
5
5
|
const SeatCircle = () => {
|
|
6
6
|
return (<>
|
|
7
7
|
<div className="py-2">
|
|
8
|
-
<
|
|
8
|
+
<SectionShape />
|
|
9
|
+
<h1 className="heading-s">Section Seating</h1>
|
|
10
|
+
<Divider style={{ margin: 4 }}/>
|
|
9
11
|
<Flex>
|
|
10
12
|
<Form.Item name="seatCount" label="Seat Count" className="w-full">
|
|
11
|
-
<InputNumber />
|
|
13
|
+
<InputNumber min={0} disabled/>
|
|
12
14
|
</Form.Item>
|
|
13
15
|
<Form.Item name="openSpace" label="Open Space" className="w-full">
|
|
14
|
-
<InputNumber max={
|
|
16
|
+
<InputNumber max={100} min={0} step={10} suffix="%"/>
|
|
15
17
|
</Form.Item>
|
|
16
|
-
|
|
17
18
|
</Flex>
|
|
18
19
|
<Flex gap={2}>
|
|
19
20
|
<Form.Item label="Seat Fill" name={"seatFill"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
20
21
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
21
22
|
</Form.Item>
|
|
22
|
-
{/* <Form.Item
|
|
23
|
-
label="Table Fill"
|
|
24
|
-
name={"fill"}
|
|
25
|
-
getValueFromEvent={(color) => color.toHexString()}
|
|
26
|
-
className="w-full "
|
|
27
|
-
>
|
|
28
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex" />
|
|
29
|
-
</Form.Item> */}
|
|
30
23
|
</Flex>
|
|
31
|
-
<SectionShape />
|
|
32
24
|
<SectionLabel />
|
|
33
25
|
</div>
|
|
34
26
|
</>);
|
|
@@ -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,9 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Col, ColorPicker, Flex, Form, InputNumber, Row, } from "antd";
|
|
3
|
+
import { Col, ColorPicker, Divider, Flex, Form, InputNumber, Row, } from "antd";
|
|
4
4
|
import SectionLabel from "../../components/form-tools/label";
|
|
5
5
|
import SectionShape from "../../components/form-tools/shape";
|
|
6
|
+
import { useAppSelector } from "@/hooks/use-redux";
|
|
6
7
|
const SeatSquare = () => {
|
|
7
|
-
|
|
8
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
9
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
10
|
+
const isSeatCustom = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "table-seat-rect-circle";
|
|
11
|
+
const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
|
|
12
|
+
const disabled = seatCountDefault > 0;
|
|
13
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx(SectionShape, {}), _jsx("h1", { className: "heading-s", children: "Section Seating" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Flex, { className: "w-full", children: _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 10, suffix: "%", disabled: isSeatCustom }) }) }), _jsxs(Row, { gutter: [16, 16], children: [_jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "top"], label: "Top", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "left"], label: "Left", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] }), _jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "right"], label: "Right", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "bottom"], label: "Bottom", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] })] }), _jsx(Flex, { gap: 2, children: _jsx(Form.Item, { label: "Seat Fill", name: "seatFill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }) }), _jsx(SectionLabel, {})] }) }));
|
|
8
14
|
};
|
|
9
15
|
export default SeatSquare;
|
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Col, ColorPicker, Flex, Form, InputNumber, Row, } from "antd";
|
|
2
|
+
import { Col, ColorPicker, Divider, Flex, Form, InputNumber, Row, } from "antd";
|
|
3
3
|
import SectionLabel from "../../components/form-tools/label";
|
|
4
4
|
import SectionShape from "../../components/form-tools/shape";
|
|
5
|
+
import { useAppSelector } from "@/hooks/use-redux";
|
|
5
6
|
const SeatSquare = () => {
|
|
7
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
8
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
9
|
+
const isSeatCustom = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "table-seat-rect-circle";
|
|
10
|
+
const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
|
|
11
|
+
const disabled = seatCountDefault > 0;
|
|
6
12
|
return (<>
|
|
7
13
|
<div className="py-2">
|
|
8
|
-
<
|
|
14
|
+
<SectionShape />
|
|
15
|
+
<h1 className="heading-s">Section Seating</h1>
|
|
16
|
+
<Divider style={{ margin: 4 }}/>
|
|
9
17
|
<Flex className="w-full">
|
|
10
18
|
<Form.Item name="openSpace" label="Open Space" className="w-full">
|
|
11
|
-
<InputNumber max={
|
|
19
|
+
<InputNumber max={100} min={0} step={10} suffix="%" disabled={isSeatCustom}/>
|
|
12
20
|
</Form.Item>
|
|
13
21
|
</Flex>
|
|
14
22
|
<Row gutter={[16, 16]}>
|
|
15
23
|
<Col span={12}>
|
|
16
24
|
<Form.Item name={["seatPositions", "top"]} label="Top" className="w-full">
|
|
17
|
-
|
|
25
|
+
<InputNumber min={0} step={1} disabled={disabled}/>
|
|
18
26
|
</Form.Item>
|
|
19
27
|
<Form.Item name={["seatPositions", "left"]} label="Left" className="w-full">
|
|
20
|
-
|
|
28
|
+
<InputNumber min={0} step={1} disabled={disabled}/>
|
|
21
29
|
</Form.Item>
|
|
22
30
|
</Col>
|
|
23
31
|
<Col span={12}>
|
|
24
32
|
<Form.Item name={["seatPositions", "right"]} label="Right" className="w-full">
|
|
25
|
-
|
|
33
|
+
<InputNumber min={0} step={1} disabled={disabled}/>
|
|
26
34
|
</Form.Item>
|
|
27
35
|
<Form.Item name={["seatPositions", "bottom"]} label="Bottom" className="w-full">
|
|
28
|
-
|
|
36
|
+
<InputNumber min={0} step={1} disabled={disabled}/>
|
|
29
37
|
</Form.Item>
|
|
30
38
|
</Col>
|
|
31
39
|
</Row>
|
|
@@ -43,7 +51,6 @@ const SeatSquare = () => {
|
|
|
43
51
|
<ColorPicker allowClear format="hex" defaultFormat="hex" />
|
|
44
52
|
</Form.Item> */}
|
|
45
53
|
</Flex>
|
|
46
|
-
<SectionShape />
|
|
47
54
|
<SectionLabel />
|
|
48
55
|
</div>
|
|
49
56
|
</>);
|
|
@@ -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;
|
|
@@ -96,6 +96,8 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
|
|
|
96
96
|
type: "panel/setSelectedComponent",
|
|
97
97
|
payload: defaultValue,
|
|
98
98
|
});
|
|
99
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
100
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
// ⬇️ IF local upload
|
|
@@ -145,6 +147,6 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
|
|
|
145
147
|
const handleDelete = () => {
|
|
146
148
|
setDefaultSrc(null);
|
|
147
149
|
};
|
|
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." })] })) }))),
|
|
150
|
+
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, className: "w-full mt-4", 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." })] })) }))), (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) && (_jsxs(_Fragment, { children: [_jsx(SectionShape, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }))] }));
|
|
149
151
|
};
|
|
150
152
|
export default UploadTool;
|
|
@@ -95,6 +95,8 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
|
|
|
95
95
|
type: "panel/setSelectedComponent",
|
|
96
96
|
payload: defaultValue,
|
|
97
97
|
});
|
|
98
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
99
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
// ⬇️ IF local upload
|
|
@@ -149,7 +151,7 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
|
|
|
149
151
|
<div className="w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto">
|
|
150
152
|
<Image src={defaultSrc}/>
|
|
151
153
|
</div>
|
|
152
|
-
<Button type="primary" onClick={handleDelete}>
|
|
154
|
+
<Button type="primary" onClick={handleDelete} className="w-full mt-4">
|
|
153
155
|
Edit
|
|
154
156
|
</Button>
|
|
155
157
|
</>) : (<Dragger beforeUpload={() => false} {...propsUpload}>
|
|
@@ -168,7 +170,7 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
|
|
|
168
170
|
</p>
|
|
169
171
|
</>)}
|
|
170
172
|
</Dragger>)}
|
|
171
|
-
{
|
|
173
|
+
{(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) && (<>
|
|
172
174
|
<SectionShape allowChangeShape={type === "component"}/>
|
|
173
175
|
<SectionLabel />
|
|
174
176
|
</>)}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { PropertiesProps } from "@/dto/table";
|
|
1
2
|
import { SeatShape } from "../../utils/constant";
|
|
2
3
|
export declare const isSeatShape: (shape: string) => shape is SeatShape;
|
|
3
|
-
export declare const getSeatCount: (shape: string, props:
|
|
4
|
-
export declare const getSeatPosition: (shape: string, props:
|
|
4
|
+
export declare const getSeatCount: (shape: string, props: PropertiesProps, defaultValue: number) => number;
|
|
5
|
+
export declare const getSeatPosition: (shape: string, props: PropertiesProps, defaultValue: number) => {
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
left: number;
|
|
10
|
+
};
|
|
5
11
|
export declare const adjustHeightWidthForSeatShape: (shape: string, props: any) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SEAT_SHAPES } from "../../utils/constant";
|
|
2
2
|
import { MIN_HEIGHT, MIN_WIDTH } from "../board-v3/constant";
|
|
3
3
|
export const isSeatShape = (shape) => SEAT_SHAPES.includes(shape);
|
|
4
|
-
export const getSeatCount = (shape, props) => {
|
|
4
|
+
export const getSeatCount = (shape, props, defaultValue) => {
|
|
5
5
|
// if (shape === "table-seat-circle") {
|
|
6
6
|
// if (props?.seatCount) {
|
|
7
7
|
// return props.seatCount;
|
|
@@ -10,32 +10,33 @@ export const getSeatCount = (shape, props) => {
|
|
|
10
10
|
// return top + bottom + left + right;
|
|
11
11
|
// }
|
|
12
12
|
// }
|
|
13
|
-
return (props === null || props === void 0 ? void 0 : props.seatCount) || 0;
|
|
13
|
+
return (props === null || props === void 0 ? void 0 : props.seatCount) || defaultValue || 0;
|
|
14
14
|
};
|
|
15
|
-
export const getSeatPosition = (shape, props) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// return props.seatPositions;
|
|
19
|
-
// } else if (props?.seatCount) {
|
|
20
|
-
// const totalSeat = props.seatCount;
|
|
21
|
-
// const seatPerSide = Math.floor(totalSeat / 4);
|
|
22
|
-
// return {
|
|
23
|
-
// top: seatPerSide,
|
|
24
|
-
// bottom: seatPerSide,
|
|
25
|
-
// left: seatPerSide,
|
|
26
|
-
// right: seatPerSide,
|
|
27
|
-
// };
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
|
-
if (shape === "table-seat-rect-circle") {
|
|
15
|
+
export const getSeatPosition = (shape, props, defaultValue) => {
|
|
16
|
+
let seatCountDefault = defaultValue;
|
|
17
|
+
if (seatCountDefault === 0) {
|
|
31
18
|
return {
|
|
32
|
-
top:
|
|
33
|
-
bottom:
|
|
34
|
-
left:
|
|
35
|
-
right:
|
|
19
|
+
top: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
left: 0,
|
|
22
|
+
right: 0,
|
|
36
23
|
};
|
|
37
24
|
}
|
|
38
|
-
|
|
25
|
+
if (shape === "table-seat-rect-circle") {
|
|
26
|
+
if (seatCountDefault > 4) {
|
|
27
|
+
seatCountDefault = 4;
|
|
28
|
+
}
|
|
29
|
+
return (props === null || props === void 0 ? void 0 : props.seatPositions) &&
|
|
30
|
+
getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) <= seatCountDefault
|
|
31
|
+
? normalizeSeatPosition(props === null || props === void 0 ? void 0 : props.seatPositions)
|
|
32
|
+
: distributeSeats(seatCountDefault);
|
|
33
|
+
}
|
|
34
|
+
console.log("seatCountDefault", props === null || props === void 0 ? void 0 : props.seatPositions);
|
|
35
|
+
if (getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) <= seatCountDefault && (getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) !== 0)) {
|
|
36
|
+
return props === null || props === void 0 ? void 0 : props.seatPositions;
|
|
37
|
+
}
|
|
38
|
+
console.log("seatCountDefault", seatCountDefault);
|
|
39
|
+
return distributeSeats(seatCountDefault);
|
|
39
40
|
};
|
|
40
41
|
export const adjustHeightWidthForSeatShape = (shape, props) => {
|
|
41
42
|
if (shape === null || shape === void 0 ? void 0 : shape.includes("circle")) {
|
|
@@ -45,3 +46,39 @@ export const adjustHeightWidthForSeatShape = (shape, props) => {
|
|
|
45
46
|
}
|
|
46
47
|
return props;
|
|
47
48
|
};
|
|
49
|
+
function distributeSeats(seatCount) {
|
|
50
|
+
const base = Math.floor(seatCount / 4);
|
|
51
|
+
let remainder = seatCount % 4;
|
|
52
|
+
const result = {
|
|
53
|
+
top: base,
|
|
54
|
+
right: base,
|
|
55
|
+
bottom: base,
|
|
56
|
+
left: base,
|
|
57
|
+
};
|
|
58
|
+
const positions = ["top", "right", "bottom", "left"];
|
|
59
|
+
let index = 0;
|
|
60
|
+
while (remainder > 0) {
|
|
61
|
+
result[positions[index]] += 1;
|
|
62
|
+
remainder--;
|
|
63
|
+
index++;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
function normalizeSeatPosition(input) {
|
|
68
|
+
const clamp = (value) => Math.max(0, Math.min(1, value));
|
|
69
|
+
return {
|
|
70
|
+
top: clamp(input.top),
|
|
71
|
+
right: clamp(input.right),
|
|
72
|
+
bottom: clamp(input.bottom),
|
|
73
|
+
left: clamp(input.left),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function getTotalSeats(position) {
|
|
77
|
+
const { top, right, bottom, left } = position || {
|
|
78
|
+
top: 0,
|
|
79
|
+
right: 0,
|
|
80
|
+
bottom: 0,
|
|
81
|
+
left: 0,
|
|
82
|
+
};
|
|
83
|
+
return top + right + bottom + left;
|
|
84
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
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, Grid, Lock, LockOpen, Undo2, Redo2, PenTool, Scan, } from "lucide-react";
|
|
3
|
+
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Grid, Lock, LockOpen, Undo2, Redo2, PenTool, Scan, ScanEye, } from "lucide-react";
|
|
4
4
|
import ButtonTools from "../../components/button-tools";
|
|
5
|
-
import { Divider, ColorPicker, Button, message, } from "antd";
|
|
5
|
+
import { Divider, ColorPicker, Button, message, Popover, Flex, } from "antd";
|
|
6
6
|
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
@@ -134,6 +134,11 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
134
134
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
135
135
|
};
|
|
136
136
|
const toogleSetLockBackground = () => {
|
|
137
|
+
dispatch({
|
|
138
|
+
type: "panel/setSelectedComponent",
|
|
139
|
+
payload: null,
|
|
140
|
+
});
|
|
141
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
137
142
|
dispatch({
|
|
138
143
|
type: "tool/setToogleBackground",
|
|
139
144
|
payload: !lockBackground,
|
|
@@ -197,6 +202,7 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
197
202
|
payload: null,
|
|
198
203
|
});
|
|
199
204
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
205
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
200
206
|
};
|
|
201
207
|
const handleDuplicateComponent = () => {
|
|
202
208
|
const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
|
|
@@ -324,7 +330,7 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
324
330
|
content: _jsx("div", { children: tool.name }),
|
|
325
331
|
trigger: "hover",
|
|
326
332
|
placement: "right",
|
|
327
|
-
}, 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: _jsx(Scan, {}), type: "text", name: "Bounding Box", onClick: () => hanldeSelectTool("bounding-box"), style: active === "bounding-box" ? { 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: {
|
|
333
|
+
}, 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(Popover, { trigger: "hover", placement: "right", content: _jsxs(Flex, { vertical: true, children: [_jsx(Button, { icon: _jsx(Scan, {}), type: "text", name: "Bounding Box", onClick: () => hanldeSelectTool("bounding-box"), style: active === "bounding-box" ? { color: "red" } : {} }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} })] }), children: _jsx(Button, { icon: _jsx(ScanEye, {}), type: "text" }) }), _jsx(Button, { icon: _jsx(Grid, {}), type: "text", name: "Grid", onClick: () => toggleGrid() }), _jsx(ButtonTools, { buttonProps: {
|
|
328
334
|
onClick: () => handleRemoveComponent(),
|
|
329
335
|
icon: _jsx(Trash, {}),
|
|
330
336
|
type: "text",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Grid, Lock, LockOpen, Undo2, Redo2, PenTool, Scan, } from "lucide-react";
|
|
2
|
+
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Grid, Lock, LockOpen, Undo2, Redo2, PenTool, Scan, ScanEye, } from "lucide-react";
|
|
3
3
|
import ButtonTools from "../../components/button-tools";
|
|
4
|
-
import { Divider, ColorPicker, Button, message, } from "antd";
|
|
4
|
+
import { Divider, ColorPicker, Button, message, Popover, Flex, } from "antd";
|
|
5
5
|
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
@@ -133,6 +133,11 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
133
133
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
134
134
|
};
|
|
135
135
|
const toogleSetLockBackground = () => {
|
|
136
|
+
dispatch({
|
|
137
|
+
type: "panel/setSelectedComponent",
|
|
138
|
+
payload: null,
|
|
139
|
+
});
|
|
140
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
136
141
|
dispatch({
|
|
137
142
|
type: "tool/setToogleBackground",
|
|
138
143
|
payload: !lockBackground,
|
|
@@ -196,6 +201,7 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
196
201
|
payload: null,
|
|
197
202
|
});
|
|
198
203
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
204
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
199
205
|
};
|
|
200
206
|
const handleDuplicateComponent = () => {
|
|
201
207
|
const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
|
|
@@ -340,8 +346,14 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
|
340
346
|
<ColorPicker value={color} onChange={handleChangeColorBackground}>
|
|
341
347
|
<Button icon={<PaintBucket />} type="text" name="Background Color" onClick={() => hanldeSelectTool("background-color")} style={active === "background-color" ? { color: "red" } : {}}/>
|
|
342
348
|
</ColorPicker>
|
|
343
|
-
|
|
344
|
-
<
|
|
349
|
+
|
|
350
|
+
<Popover trigger={"hover"} placement="right" content={<Flex vertical>
|
|
351
|
+
<Button icon={<Scan />} type="text" name="Bounding Box" onClick={() => hanldeSelectTool("bounding-box")} style={active === "bounding-box" ? { color: "red" } : {}}/>
|
|
352
|
+
<Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
|
|
353
|
+
</Flex>}>
|
|
354
|
+
<Button icon={<ScanEye />} type="text"/>
|
|
355
|
+
</Popover>
|
|
356
|
+
|
|
345
357
|
<Button icon={<Grid />} type="text" name="Grid" onClick={() => toggleGrid()}/>
|
|
346
358
|
<ButtonTools buttonProps={{
|
|
347
359
|
onClick: () => handleRemoveComponent(),
|
|
@@ -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;
|
|
@@ -91,5 +91,5 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
91
91
|
rightClick: boolean;
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) =>
|
|
94
|
+
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
95
95
|
export default LayerView;
|
|
@@ -89,9 +89,11 @@ const LayerView = (props) => {
|
|
|
89
89
|
payload: defaultBoundingBox,
|
|
90
90
|
});
|
|
91
91
|
// }
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
if (loading) {
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
dispatch({ type: "panel/setLoading", payload: false });
|
|
95
|
+
}, 1000);
|
|
96
|
+
}
|
|
95
97
|
}, [
|
|
96
98
|
componentProps,
|
|
97
99
|
extraComponentProps,
|
|
@@ -325,7 +327,7 @@ const LayerView = (props) => {
|
|
|
325
327
|
: !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
326
328
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
327
329
|
return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
328
|
-
}))) &&
|
|
330
|
+
}))) && ((actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.move) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch));
|
|
329
331
|
if (ghostAttributes) {
|
|
330
332
|
Object.keys(ghostAttributes).forEach((key) => {
|
|
331
333
|
ghost.setAttribute(key, ghostAttributes[key]);
|