seat-editor 3.3.46 → 3.4.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.
- package/dist/app/constant.d.ts +3 -0
- package/dist/app/constant.js +2 -1
- package/dist/app/new-board/page.js +9 -1
- package/dist/app/new-board/page.jsx +9 -1
- package/dist/app/only-view/page.js +7 -7
- package/dist/components/form-tools/label.js +8 -4
- package/dist/components/form-tools/label.jsx +27 -21
- package/dist/components/form-tools/shape.js +41 -16
- package/dist/components/form-tools/shape.jsx +35 -14
- package/dist/features/board-v3/index.js +12 -5
- package/dist/features/board-v3/index.jsx +12 -5
- package/dist/features/package/index.d.ts +1 -0
- package/dist/features/package/index.js +22 -17
- package/dist/features/package/index.jsx +22 -17
- 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.js +31 -14
- package/dist/features/panel/select-tool.jsx +31 -24
- package/dist/features/panel/table-seat-circle.js +3 -2
- package/dist/features/panel/table-seat-circle.jsx +7 -14
- package/dist/features/panel/table-seat-square.js +8 -2
- package/dist/features/panel/table-seat-square.jsx +15 -8
- 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.js +9 -3
- package/dist/features/side-tool/index.jsx +16 -4
- 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.js +7 -5
- package/dist/features/view-only-3/index.jsx +7 -9
- package/package.json +1 -1
package/dist/app/constant.d.ts
CHANGED
|
@@ -342,6 +342,7 @@ export declare const test4: ({
|
|
|
342
342
|
export declare const data4: ({
|
|
343
343
|
uuid_table: string;
|
|
344
344
|
status: number;
|
|
345
|
+
capacity: number;
|
|
345
346
|
properties: {
|
|
346
347
|
x: number;
|
|
347
348
|
y: number;
|
|
@@ -523,6 +524,7 @@ export declare const data4: ({
|
|
|
523
524
|
labels?: undefined;
|
|
524
525
|
};
|
|
525
526
|
uuid_table?: undefined;
|
|
527
|
+
capacity?: undefined;
|
|
526
528
|
} | {
|
|
527
529
|
properties: {
|
|
528
530
|
x: number;
|
|
@@ -583,6 +585,7 @@ export declare const data4: ({
|
|
|
583
585
|
};
|
|
584
586
|
uuid_table?: undefined;
|
|
585
587
|
status?: undefined;
|
|
588
|
+
capacity?: undefined;
|
|
586
589
|
})[];
|
|
587
590
|
export declare const extraComponent: any[];
|
|
588
591
|
export declare const data5: {
|
package/dist/app/constant.js
CHANGED
|
@@ -3441,7 +3441,7 @@ export const test4 = [
|
|
|
3441
3441
|
},
|
|
3442
3442
|
{
|
|
3443
3443
|
status: 1,
|
|
3444
|
-
rsvp:
|
|
3444
|
+
rsvp: 1,
|
|
3445
3445
|
properties: {
|
|
3446
3446
|
x: 400,
|
|
3447
3447
|
y: 20,
|
|
@@ -3527,6 +3527,7 @@ export const data4 = [
|
|
|
3527
3527
|
{
|
|
3528
3528
|
uuid_table: "axxxxx",
|
|
3529
3529
|
status: 0,
|
|
3530
|
+
capacity: 5,
|
|
3530
3531
|
properties: {
|
|
3531
3532
|
x: 500,
|
|
3532
3533
|
y: 520,
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import SeatEditor from "../../features/package";
|
|
5
|
+
// import { constantData, data2, data3, extraComponent } from "../constant";
|
|
6
|
+
// import LayerView from "@/features/view-only-2";
|
|
7
|
+
// import SeatEdit from "@/features/package";
|
|
5
8
|
import { data4 } from "../constant";
|
|
6
9
|
export default function NewBoard() {
|
|
7
10
|
const [initialValue, setInitialValue] = useState([]);
|
|
@@ -54,5 +57,10 @@ export default function NewBoard() {
|
|
|
54
57
|
}
|
|
55
58
|
}, extraComponentProps: extraComponents, defaultBackground: backgroundColor,
|
|
56
59
|
// dragOnly={true}
|
|
57
|
-
statusKey: "status"
|
|
60
|
+
statusKey: "status",
|
|
61
|
+
// action={async (action: any) => {
|
|
62
|
+
// console.log({ action });
|
|
63
|
+
// return null
|
|
64
|
+
// }}
|
|
65
|
+
defaultSeatCountKey: "capacity" }) })] }) }));
|
|
58
66
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import SeatEditor from "../../features/package";
|
|
4
|
+
// import { constantData, data2, data3, extraComponent } from "../constant";
|
|
5
|
+
// import LayerView from "@/features/view-only-2";
|
|
6
|
+
// import SeatEdit from "@/features/package";
|
|
4
7
|
import { data4 } from "../constant";
|
|
5
8
|
export default function NewBoard() {
|
|
6
9
|
const [initialValue, setInitialValue] = useState([]);
|
|
@@ -64,7 +67,12 @@ export default function NewBoard() {
|
|
|
64
67
|
}
|
|
65
68
|
}} extraComponentProps={extraComponents} defaultBackground={backgroundColor}
|
|
66
69
|
// dragOnly={true}
|
|
67
|
-
statusKey="status"
|
|
70
|
+
statusKey="status"
|
|
71
|
+
// action={async (action: any) => {
|
|
72
|
+
// console.log({ action });
|
|
73
|
+
// return null
|
|
74
|
+
// }}
|
|
75
|
+
defaultSeatCountKey="capacity"/>
|
|
68
76
|
</div>
|
|
69
77
|
|
|
70
78
|
</div>
|
|
@@ -165,7 +165,7 @@ const TouchScrollDetect = () => {
|
|
|
165
165
|
return (_jsx(Modal, { open: open, onCancel: () => setOpen(false), width: 700, title: "Preview Board", centered: true, footer: null, children: _jsx("div", { className: "flex flex-col p-4 h-[500px] overflow-auto", children: _jsx(JsonView, { value: table }) }) }));
|
|
166
166
|
};
|
|
167
167
|
const testData = [];
|
|
168
|
-
return (_jsxs("div", { className: "w-full h-screen border-2 border-black overflow-auto", id: "scroll-container", children: [renderModal(), _jsxs("div", { className: "flex", children: [_jsx("div", { className: "h-screen bg-gray-500 w-1/3", children: _jsx("div", { className: "p-4", children: data4.map((item, index) => (_jsx(Card, Object.assign({}, item), index))) }) }), _jsxs("div", { className: "h-screen w-2/3 relative", children: [_jsxs("div", { className: "absolute top-1 right-1 flex gap-4 z-[10]", children: [_jsx("button", { className: "p-4 bg-gray-400", onClick: () => handleZoomIn(), children: "+" }), _jsx("button", { className: "p-4 bg-gray-400", onClick: () => handleZoomOut(), children: "-" })] }), _jsx(LayerView, { refs: refLayer, statusKey: "
|
|
168
|
+
return (_jsxs("div", { className: "w-full h-screen border-2 border-black overflow-auto", id: "scroll-container", children: [renderModal(), _jsxs("div", { className: "flex", children: [_jsx("div", { className: "h-screen bg-gray-500 w-1/3", children: _jsx("div", { className: "p-4", children: data4.map((item, index) => (_jsx(Card, Object.assign({}, item), index))) }) }), _jsxs("div", { className: "h-screen w-2/3 relative", children: [_jsxs("div", { className: "absolute top-1 right-1 flex gap-4 z-[10]", children: [_jsx("button", { className: "p-4 bg-gray-400", onClick: () => handleZoomIn(), children: "+" }), _jsx("button", { className: "p-4 bg-gray-400", onClick: () => handleZoomOut(), children: "-" })] }), _jsx(LayerView, { refs: refLayer, statusKey: "is_late", privilegedTags: [
|
|
169
169
|
{
|
|
170
170
|
key: "table",
|
|
171
171
|
items: ["text", "icon"],
|
|
@@ -178,13 +178,13 @@ const TouchScrollDetect = () => {
|
|
|
178
178
|
handleSelectTable(component);
|
|
179
179
|
}, dragTableBlockKey: [
|
|
180
180
|
{
|
|
181
|
-
key: "
|
|
182
|
-
value:
|
|
181
|
+
key: "code",
|
|
182
|
+
value: "V1",
|
|
183
183
|
},
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
184
|
+
// {
|
|
185
|
+
// key: "rsvp",
|
|
186
|
+
// value: 1
|
|
187
|
+
// }
|
|
188
188
|
], tableMatchKey: [
|
|
189
189
|
{
|
|
190
190
|
key: 0,
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
|
|
3
|
+
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
|
|
4
4
|
const SectionLabel = () => {
|
|
5
|
-
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Form.Item, { label: "Labels in
|
|
5
|
+
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Form.Item, { label: "Labels in table", name: "labels", className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { className: "w-full", children: [_jsx(Flex, { gap: 5, className: "w-full flex justify-between", children: _jsx(Form.Item, { name: [field.name, "label"], label: "Text", className: "w-full", children: _jsx(Input, {}) }) }), _jsxs(Flex, { gap: 5, className: "w-full flex justify-between", children: [_jsx(Form.Item, { name: [field.name, "x"], label: "Position X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Position Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "rotation"], label: "Rotation", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
|
|
6
6
|
if (!value)
|
|
7
7
|
return 0;
|
|
8
8
|
const num = Number(value.replace(/\D/g, ""));
|
|
9
9
|
if (Number.isNaN(num))
|
|
10
10
|
return 0;
|
|
11
11
|
return Math.min(360, Math.max(0, num));
|
|
12
|
-
} }) })] })
|
|
12
|
+
} }) })] }), _jsxs(Flex, { gap: 5, children: [_jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] })] }, field.key))), _jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Button
|
|
13
|
+
// type="dashed"
|
|
14
|
+
, {
|
|
15
|
+
// type="dashed"
|
|
16
|
+
onClick: () => remove(fields.length - 1), className: "w-full", children: "Remove" }), _jsx(Button, { type: "primary", onClick: () => add({
|
|
13
17
|
label: "",
|
|
14
18
|
fontColor: "#000000",
|
|
15
19
|
x: 0,
|
|
16
20
|
y: 0,
|
|
17
21
|
fontSize: 12,
|
|
18
22
|
rotation: 0
|
|
19
|
-
}), className: "
|
|
23
|
+
}), className: "w-full", children: "Add" })] })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
|
|
20
24
|
};
|
|
21
25
|
export default SectionLabel;
|
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
|
|
2
|
+
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
|
|
3
3
|
const SectionLabel = () => {
|
|
4
4
|
return (<div className="py-2">
|
|
5
5
|
<h1 className="heading-s">Section Labeling</h1>
|
|
6
|
-
<
|
|
6
|
+
<Divider style={{ margin: 4 }}/>
|
|
7
|
+
|
|
8
|
+
<Form.Item label="Labels in table" name={"labels"} className="w-full">
|
|
7
9
|
<Form.List name="labels">
|
|
8
10
|
{(fields, { add, remove }) => (<>
|
|
9
|
-
{fields.map((field) => (<div key={field.key}>
|
|
10
|
-
<Flex gap={
|
|
11
|
-
<Form.Item name={[field.name, "label"]} label="Text">
|
|
11
|
+
{fields.map((field) => (<div key={field.key} className="w-full">
|
|
12
|
+
<Flex gap={5} className="w-full flex justify-between">
|
|
13
|
+
<Form.Item name={[field.name, "label"]} label="Text" className="w-full">
|
|
12
14
|
<Input />
|
|
13
15
|
</Form.Item>
|
|
14
|
-
|
|
15
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
16
|
-
</Form.Item>
|
|
16
|
+
|
|
17
17
|
</Flex>
|
|
18
|
-
<Flex gap={
|
|
19
|
-
<Form.Item name={[field.name, "x"]} label="X">
|
|
18
|
+
<Flex gap={5} className="w-full flex justify-between">
|
|
19
|
+
<Form.Item name={[field.name, "x"]} label="Position X">
|
|
20
20
|
<InputNumber />
|
|
21
21
|
</Form.Item>
|
|
22
|
-
<Form.Item name={[field.name, "y"]} label="Y">
|
|
22
|
+
<Form.Item name={[field.name, "y"]} label="Position Y">
|
|
23
23
|
<InputNumber />
|
|
24
24
|
</Form.Item>
|
|
25
|
-
</Flex>
|
|
26
|
-
<Flex gap={2}>
|
|
27
|
-
<Form.Item name={[field.name, "fontSize"]} label="Size">
|
|
28
|
-
<InputNumber suffix="px"/>
|
|
29
|
-
</Form.Item>
|
|
30
25
|
<Form.Item name={[field.name, "rotation"]} label="Rotation">
|
|
31
26
|
<InputNumber suffix="°" min={0} max={360} parser={(value) => {
|
|
32
27
|
if (!value)
|
|
@@ -38,8 +33,22 @@ const SectionLabel = () => {
|
|
|
38
33
|
}}/>
|
|
39
34
|
</Form.Item>
|
|
40
35
|
</Flex>
|
|
36
|
+
<Flex gap={5}>
|
|
37
|
+
<Form.Item name={[field.name, "fontSize"]} label="Size">
|
|
38
|
+
<InputNumber suffix="px"/>
|
|
39
|
+
</Form.Item>
|
|
40
|
+
<Form.Item name={[field.name, "fontColor"]} label="Color" getValueFromEvent={(color) => color.toHexString()}>
|
|
41
|
+
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
42
|
+
</Form.Item>
|
|
43
|
+
</Flex>
|
|
41
44
|
</div>))}
|
|
42
|
-
<Flex gap={2}>
|
|
45
|
+
<Flex gap={2} className="w-full">
|
|
46
|
+
|
|
47
|
+
<Button
|
|
48
|
+
// type="dashed"
|
|
49
|
+
onClick={() => remove(fields.length - 1)} className="w-full">
|
|
50
|
+
Remove
|
|
51
|
+
</Button>
|
|
43
52
|
<Button type="primary" onClick={() => add({
|
|
44
53
|
label: "",
|
|
45
54
|
fontColor: "#000000",
|
|
@@ -47,12 +56,9 @@ const SectionLabel = () => {
|
|
|
47
56
|
y: 0,
|
|
48
57
|
fontSize: 12,
|
|
49
58
|
rotation: 0
|
|
50
|
-
})} className="
|
|
59
|
+
})} className="w-full">
|
|
51
60
|
Add
|
|
52
61
|
</Button>
|
|
53
|
-
<Button type="primary" onClick={() => remove(fields.length - 1)} className="btn btn-primary">
|
|
54
|
-
Remove
|
|
55
|
-
</Button>
|
|
56
62
|
</Flex>
|
|
57
63
|
</>)}
|
|
58
64
|
</Form.List>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
3
4
|
import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
|
|
5
|
+
const { Option } = Select;
|
|
4
6
|
export const optionsShape = [
|
|
5
7
|
{
|
|
6
8
|
value: "circle",
|
|
@@ -28,7 +30,7 @@ export const optionsShape = [
|
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
32
|
value: "table-seat-rect-circle",
|
|
31
|
-
label: "Type 5",
|
|
33
|
+
label: "Type 5 ",
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
label: "Image Table",
|
|
@@ -37,7 +39,30 @@ export const optionsShape = [
|
|
|
37
39
|
];
|
|
38
40
|
const SectionShape = ({ allowChangeShape = true, }) => {
|
|
39
41
|
const shape = Form.useWatch("shape");
|
|
40
|
-
|
|
42
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
43
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
44
|
+
const maxSeat = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey]) || 0;
|
|
45
|
+
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Shape" }), allowChangeShape && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select
|
|
46
|
+
// options={optionsShape.map((item) => ({
|
|
47
|
+
// ...item,
|
|
48
|
+
// label:
|
|
49
|
+
// item.value === "table-seat-rect-circle"
|
|
50
|
+
// ? `Type 5 (only for 4 ${seatKey})`
|
|
51
|
+
// : item.label,
|
|
52
|
+
// }))}
|
|
53
|
+
, {
|
|
54
|
+
// options={optionsShape.map((item) => ({
|
|
55
|
+
// ...item,
|
|
56
|
+
// label:
|
|
57
|
+
// item.value === "table-seat-rect-circle"
|
|
58
|
+
// ? `Type 5 (only for 4 ${seatKey})`
|
|
59
|
+
// : item.label,
|
|
60
|
+
// }))}
|
|
61
|
+
className: "w-full", children: optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
62
|
+
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
63
|
+
return (_jsx(Option, { value: item.value, disabled: disabled, children: item.value === "table-seat-rect-circle" ?
|
|
64
|
+
`Type 5 (only for 4 ${seatKey})` : item.label }, item.value));
|
|
65
|
+
}) }) }) })), _jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Form.Item, { label: "Width", name: "width", className: "w-full", children: _jsx(InputNumber, { suffix: "px", controls: true, parser: (value) => {
|
|
41
66
|
var _a;
|
|
42
67
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
43
68
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
@@ -45,25 +70,25 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
45
70
|
var _a;
|
|
46
71
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
47
72
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
48
|
-
} }) })
|
|
73
|
+
} }) }), !(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && (_jsx(Form.Item, { label: "Radius", name: "radius", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
|
|
74
|
+
var _a;
|
|
75
|
+
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
76
|
+
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
77
|
+
} }) }))] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Position X", name: "x", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Position Y", name: "y", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Rotation", name: "rotation", className: "w-full", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
|
|
49
78
|
if (!value)
|
|
50
79
|
return 0;
|
|
51
80
|
const num = Number(value.replace(/\D/g, ""));
|
|
52
81
|
if (Number.isNaN(num))
|
|
53
82
|
return 0;
|
|
54
83
|
return Math.min(360, Math.max(0, num));
|
|
55
|
-
} }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke", name: "stroke", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (Number.isNaN(num))
|
|
65
|
-
return null;
|
|
66
|
-
return Math.min(1, Math.max(0, num));
|
|
67
|
-
} }) })] })] }));
|
|
84
|
+
} }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke Fill", name: "stroke", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke", name: "strokeWidth", className: "w-full", children: _jsx(InputNumber, {}) })] }), _jsx(Flex, { children: _jsx(Form.Item, { label: "opacity", name: "opacity", className: "w-full", children: _jsx(InputNumber, { step: 10, max: 100, min: 0, parser: (value) => {
|
|
85
|
+
if (value === undefined || value === null || value === "")
|
|
86
|
+
return null;
|
|
87
|
+
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
88
|
+
const num = Number(cleaned);
|
|
89
|
+
if (Number.isNaN(num))
|
|
90
|
+
return null;
|
|
91
|
+
return Math.min(0, Math.max(0, num));
|
|
92
|
+
} }) }) })] }));
|
|
68
93
|
};
|
|
69
94
|
export default SectionShape;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
2
3
|
import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
|
|
4
|
+
const { Option } = Select;
|
|
3
5
|
export const optionsShape = [
|
|
4
6
|
{
|
|
5
7
|
value: "circle",
|
|
@@ -27,7 +29,7 @@ export const optionsShape = [
|
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
value: "table-seat-rect-circle",
|
|
30
|
-
label: "Type 5",
|
|
32
|
+
label: "Type 5 ",
|
|
31
33
|
},
|
|
32
34
|
{
|
|
33
35
|
label: "Image Table",
|
|
@@ -36,11 +38,30 @@ export const optionsShape = [
|
|
|
36
38
|
];
|
|
37
39
|
const SectionShape = ({ allowChangeShape = true, }) => {
|
|
38
40
|
const shape = Form.useWatch("shape");
|
|
41
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
42
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
43
|
+
const maxSeat = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey]) || 0;
|
|
39
44
|
return (<div className="py-2">
|
|
40
45
|
<h1 className="heading-s">Shape</h1>
|
|
41
46
|
{allowChangeShape && (<Flex gap={2} className="w-full">
|
|
42
47
|
<Form.Item label="Name" name="shape" className="w-full">
|
|
43
|
-
<Select
|
|
48
|
+
<Select
|
|
49
|
+
// options={optionsShape.map((item) => ({
|
|
50
|
+
// ...item,
|
|
51
|
+
// label:
|
|
52
|
+
// item.value === "table-seat-rect-circle"
|
|
53
|
+
// ? `Type 5 (only for 4 ${seatKey})`
|
|
54
|
+
// : item.label,
|
|
55
|
+
// }))}
|
|
56
|
+
className="w-full">
|
|
57
|
+
{optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
58
|
+
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
59
|
+
return (<Option key={item.value} value={item.value} disabled={disabled}>
|
|
60
|
+
{item.value === "table-seat-rect-circle" ?
|
|
61
|
+
`Type 5 (only for 4 ${seatKey})` : item.label}
|
|
62
|
+
</Option>);
|
|
63
|
+
})}
|
|
64
|
+
</Select>
|
|
44
65
|
</Form.Item>
|
|
45
66
|
</Flex>)}
|
|
46
67
|
<Flex gap={2} className="w-full">
|
|
@@ -58,6 +79,13 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
58
79
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
59
80
|
}}/>
|
|
60
81
|
</Form.Item>
|
|
82
|
+
{!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && (<Form.Item label="Radius" name="radius" className="w-full">
|
|
83
|
+
<InputNumber suffix="px" parser={(value) => {
|
|
84
|
+
var _a;
|
|
85
|
+
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
86
|
+
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
87
|
+
}}/>
|
|
88
|
+
</Form.Item>)}
|
|
61
89
|
</Flex>
|
|
62
90
|
<Flex gap={2}>
|
|
63
91
|
<Form.Item label="Position X" name="x" className="w-full">
|
|
@@ -81,30 +109,23 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
81
109
|
<Form.Item label="Fill" name={"fill"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
82
110
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
83
111
|
</Form.Item>
|
|
84
|
-
<Form.Item label="Stroke" name={"stroke"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
112
|
+
<Form.Item label="Stroke Fill" name={"stroke"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
85
113
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
86
114
|
</Form.Item>
|
|
87
|
-
</Flex>
|
|
88
|
-
<Flex>
|
|
89
115
|
<Form.Item label="Stroke" name={"strokeWidth"} className="w-full">
|
|
90
116
|
<InputNumber />
|
|
91
117
|
</Form.Item>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var _a;
|
|
95
|
-
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
96
|
-
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
97
|
-
}}/>
|
|
98
|
-
</Form.Item>)}
|
|
118
|
+
</Flex>
|
|
119
|
+
<Flex>
|
|
99
120
|
<Form.Item label="opacity" name={"opacity"} className="w-full">
|
|
100
|
-
<InputNumber step={
|
|
121
|
+
<InputNumber step={10} max={100} min={0} parser={(value) => {
|
|
101
122
|
if (value === undefined || value === null || value === "")
|
|
102
123
|
return null;
|
|
103
124
|
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
104
125
|
const num = Number(cleaned);
|
|
105
126
|
if (Number.isNaN(num))
|
|
106
127
|
return null;
|
|
107
|
-
return Math.min(
|
|
128
|
+
return Math.min(0, Math.max(0, num));
|
|
108
129
|
}}/>
|
|
109
130
|
</Form.Item>
|
|
110
131
|
</Flex>
|
|
@@ -67,6 +67,8 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
67
67
|
//polygon
|
|
68
68
|
const polygonElementRef = useRef([]);
|
|
69
69
|
const isOnMakePolygonRef = useRef(false);
|
|
70
|
+
//boundingbox
|
|
71
|
+
const isInialBoundingBox = useRef(false);
|
|
70
72
|
const { components: componentsProps, extraComponents: extraComponentsProps, boundingBox, flagChange, updateBy, isShowTagType, } = useAppSelector((state) => state.board);
|
|
71
73
|
const { selectionLines } = useAppSelector((state) => state.panel);
|
|
72
74
|
const [selectedLines, setSelectedLines] = useState(null);
|
|
@@ -338,6 +340,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
338
340
|
const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
|
|
339
341
|
const isInitialCreateBoundingBox = activeTool === "bounding-box";
|
|
340
342
|
const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
|
|
343
|
+
console.log({ isInitialCreateText, }, isCreateElementRef.current);
|
|
341
344
|
if (isInitialCreateElemente) {
|
|
342
345
|
const tables = createTableGhost({
|
|
343
346
|
x,
|
|
@@ -429,6 +432,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
429
432
|
hadSelectionRef.current = true;
|
|
430
433
|
}
|
|
431
434
|
if (downOutSelectionBox) {
|
|
435
|
+
console.log("downOutSelectionBox");
|
|
432
436
|
hadSelectionRef.current = false;
|
|
433
437
|
onMoveSelectionBoxRef.current = false;
|
|
434
438
|
handleUnSelectComponent();
|
|
@@ -1352,11 +1356,14 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1352
1356
|
if (isInitialCreateBoundingBox) {
|
|
1353
1357
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
1354
1358
|
const getBBox = getGlobalBBox(svg, ghost);
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
+
if (getBBox.width > 90 || getBBox.height > 90) {
|
|
1360
|
+
dispatch({
|
|
1361
|
+
type: "board/setBoundingBox",
|
|
1362
|
+
payload: Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "bounding-box", fill: "transparent" }),
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1359
1365
|
(_m = (_l = svgRef.current) === null || _l === void 0 ? void 0 : _l.querySelectorAll("#ghost-element-create")) === null || _m === void 0 ? void 0 : _m.forEach((el) => el.remove());
|
|
1366
|
+
isCreateElementRef.current = false;
|
|
1360
1367
|
}
|
|
1361
1368
|
if (isInitialCreateText) {
|
|
1362
1369
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
@@ -1553,7 +1560,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1553
1560
|
switch: false,
|
|
1554
1561
|
drop: false,
|
|
1555
1562
|
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,
|
|
1563
|
+
}, defaultBoundingBox: boundingBox }), _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,
|
|
1557
1564
|
// limitToBounds={true}
|
|
1558
1565
|
panning: {
|
|
1559
1566
|
disabled: [
|
|
@@ -66,6 +66,8 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
66
66
|
//polygon
|
|
67
67
|
const polygonElementRef = useRef([]);
|
|
68
68
|
const isOnMakePolygonRef = useRef(false);
|
|
69
|
+
//boundingbox
|
|
70
|
+
const isInialBoundingBox = useRef(false);
|
|
69
71
|
const { components: componentsProps, extraComponents: extraComponentsProps, boundingBox, flagChange, updateBy, isShowTagType, } = useAppSelector((state) => state.board);
|
|
70
72
|
const { selectionLines } = useAppSelector((state) => state.panel);
|
|
71
73
|
const [selectedLines, setSelectedLines] = useState(null);
|
|
@@ -337,6 +339,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
337
339
|
const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
|
|
338
340
|
const isInitialCreateBoundingBox = activeTool === "bounding-box";
|
|
339
341
|
const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
|
|
342
|
+
console.log({ isInitialCreateText, }, isCreateElementRef.current);
|
|
340
343
|
if (isInitialCreateElemente) {
|
|
341
344
|
const tables = createTableGhost({
|
|
342
345
|
x,
|
|
@@ -428,6 +431,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
428
431
|
hadSelectionRef.current = true;
|
|
429
432
|
}
|
|
430
433
|
if (downOutSelectionBox) {
|
|
434
|
+
console.log("downOutSelectionBox");
|
|
431
435
|
hadSelectionRef.current = false;
|
|
432
436
|
onMoveSelectionBoxRef.current = false;
|
|
433
437
|
handleUnSelectComponent();
|
|
@@ -1351,11 +1355,14 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1351
1355
|
if (isInitialCreateBoundingBox) {
|
|
1352
1356
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
1353
1357
|
const getBBox = getGlobalBBox(svg, ghost);
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
+
if (getBBox.width > 90 || getBBox.height > 90) {
|
|
1359
|
+
dispatch({
|
|
1360
|
+
type: "board/setBoundingBox",
|
|
1361
|
+
payload: Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "bounding-box", fill: "transparent" }),
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1358
1364
|
(_m = (_l = svgRef.current) === null || _l === void 0 ? void 0 : _l.querySelectorAll("#ghost-element-create")) === null || _m === void 0 ? void 0 : _m.forEach((el) => el.remove());
|
|
1365
|
+
isCreateElementRef.current = false;
|
|
1359
1366
|
}
|
|
1360
1367
|
if (isInitialCreateText) {
|
|
1361
1368
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
@@ -1554,7 +1561,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1554
1561
|
switch: false,
|
|
1555
1562
|
drop: false,
|
|
1556
1563
|
rightClick: false,
|
|
1557
|
-
}}/>
|
|
1564
|
+
}} defaultBoundingBox={boundingBox}/>
|
|
1558
1565
|
<div className="flex gap-2 mt-2">
|
|
1559
1566
|
<Radio.Group value={isShowTagType} onChange={handleCheckPreview}>
|
|
1560
1567
|
<Radio value="default">Default</Radio>
|
|
@@ -43,6 +43,7 @@ export interface TableEditorProps<TMeta = undefined> {
|
|
|
43
43
|
element: React.JSX.Element;
|
|
44
44
|
};
|
|
45
45
|
disabledView?: boolean;
|
|
46
|
+
defaultSeatCountKey?: string;
|
|
46
47
|
}
|
|
47
48
|
declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react").JSX.Element;
|
|
48
49
|
export default TableEditor;
|