seat-editor 3.4.3 → 3.4.4
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/new-board/page.js +1 -1
- package/dist/app/new-board/page.jsx +1 -1
- package/dist/components/form-tools/shape.js +1 -17
- package/dist/components/form-tools/shape.jsx +1 -9
- package/dist/features/panel/table-seat-circle.js +6 -2
- package/dist/features/panel/table-seat-circle.jsx +6 -2
- package/dist/features/panel/utils.d.ts +1 -1
- package/dist/features/panel/utils.js +36 -11
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ export default function NewBoard() {
|
|
|
41
41
|
// properties: item?.properties?.
|
|
42
42
|
// }
|
|
43
43
|
// })
|
|
44
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("div", { className: "w-full h-[1000px] bg-white border-r border-gray-200" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly:
|
|
44
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("div", { className: "w-full h-[1000px] bg-white border-r border-gray-200" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, dragOnly: true, deleteAutorized: {
|
|
45
45
|
component: true,
|
|
46
46
|
extraComponent: true,
|
|
47
47
|
}, action: handleUploadImage, mappingKey: "properties", onCurrentStateChange: (setState) => {
|
|
@@ -51,7 +51,7 @@ export default function NewBoard() {
|
|
|
51
51
|
{viewOnly ? "Edit Mode ddd" : "View Mode"}
|
|
52
52
|
</button> */}
|
|
53
53
|
<div className="flex-1 h-full">
|
|
54
|
-
<SeatEditor componentProps={initialValue} viewOnly={
|
|
54
|
+
<SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly={true} deleteAutorized={{
|
|
55
55
|
component: true,
|
|
56
56
|
extraComponent: true,
|
|
57
57
|
}} action={handleUploadImage} mappingKey="properties" onCurrentStateChange={(setState) => {
|
|
@@ -42,23 +42,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
42
42
|
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
43
43
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
44
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) => {
|
|
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, { className: "w-full", children: optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
62
46
|
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
63
47
|
return (_jsx(Option, { value: item.value, disabled: disabled, children: item.value === "table-seat-rect-circle" ?
|
|
64
48
|
`Type 5 (only for 4 ${seatKey})` : item.label }, item.value));
|
|
@@ -45,15 +45,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
45
45
|
<h1 className="heading-s">Shape</h1>
|
|
46
46
|
{allowChangeShape && (<Flex gap={2} className="w-full">
|
|
47
47
|
<Form.Item label="Name" name="shape" className="w-full">
|
|
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">
|
|
48
|
+
<Select className="w-full">
|
|
57
49
|
{optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
58
50
|
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
59
51
|
return (<Option key={item.value} value={item.value} disabled={disabled}>
|
|
@@ -3,8 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
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
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
7
7
|
const SeatCircle = () => {
|
|
8
|
-
|
|
8
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
9
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
10
|
+
const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
|
|
11
|
+
const disabled = seatCountDefault > 0;
|
|
12
|
+
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: disabled }) }), _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, {})] }) }));
|
|
9
13
|
};
|
|
10
14
|
export default SeatCircle;
|
|
@@ -2,8 +2,12 @@
|
|
|
2
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
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
6
6
|
const SeatCircle = () => {
|
|
7
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
8
|
+
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
9
|
+
const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
|
|
10
|
+
const disabled = seatCountDefault > 0;
|
|
7
11
|
return (<>
|
|
8
12
|
<div className="py-2">
|
|
9
13
|
<SectionShape />
|
|
@@ -11,7 +15,7 @@ const SeatCircle = () => {
|
|
|
11
15
|
<Divider style={{ margin: 4 }}/>
|
|
12
16
|
<Flex>
|
|
13
17
|
<Form.Item name="seatCount" label="Seat Count" className="w-full">
|
|
14
|
-
<InputNumber min={0} disabled/>
|
|
18
|
+
<InputNumber min={0} disabled={disabled}/>
|
|
15
19
|
</Form.Item>
|
|
16
20
|
<Form.Item name="openSpace" label="Open Space" className="w-full">
|
|
17
21
|
<InputNumber max={100} min={0} step={10} suffix="%"/>
|
|
@@ -2,7 +2,7 @@ import { PropertiesProps } from "../../dto/table";
|
|
|
2
2
|
import { SeatShape } from "../../utils/constant";
|
|
3
3
|
export declare const isSeatShape: (shape: string) => shape is SeatShape;
|
|
4
4
|
export declare const getSeatCount: (shape: string, props: PropertiesProps, defaultValue: number) => number;
|
|
5
|
-
export declare const getSeatPosition: (shape: string, props: PropertiesProps, defaultValue: number) => {
|
|
5
|
+
export declare const getSeatPosition: (shape: string, props: PropertiesProps, defaultValue: number | undefined) => {
|
|
6
6
|
top: number;
|
|
7
7
|
right: number;
|
|
8
8
|
bottom: number;
|
|
@@ -10,32 +10,57 @@ export const getSeatCount = (shape, props, defaultValue) => {
|
|
|
10
10
|
// return top + bottom + left + right;
|
|
11
11
|
// }
|
|
12
12
|
// }
|
|
13
|
+
if (!defaultValue) {
|
|
14
|
+
if (props === null || props === void 0 ? void 0 : props.seatCount) {
|
|
15
|
+
return props.seatCount;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return 4;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
13
21
|
return (props === null || props === void 0 ? void 0 : props.seatCount) || defaultValue || 0;
|
|
14
22
|
};
|
|
15
23
|
export const getSeatPosition = (shape, props, defaultValue) => {
|
|
16
24
|
let seatCountDefault = defaultValue;
|
|
17
|
-
if (seatCountDefault === 0) {
|
|
18
|
-
return {
|
|
19
|
-
top: 0,
|
|
20
|
-
bottom: 0,
|
|
21
|
-
left: 0,
|
|
22
|
-
right: 0,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
25
|
if (shape === "table-seat-rect-circle") {
|
|
26
26
|
if (seatCountDefault > 4) {
|
|
27
27
|
seatCountDefault = 4;
|
|
28
28
|
}
|
|
29
|
+
console.log(props === null || props === void 0 ? void 0 : props.seatPositions);
|
|
30
|
+
if (getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) > 4) {
|
|
31
|
+
return distributeSeats(4);
|
|
32
|
+
}
|
|
33
|
+
console.log(getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions));
|
|
29
34
|
return (props === null || props === void 0 ? void 0 : props.seatPositions) &&
|
|
30
35
|
getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) <= seatCountDefault
|
|
31
36
|
? normalizeSeatPosition(props === null || props === void 0 ? void 0 : props.seatPositions)
|
|
32
37
|
: distributeSeats(seatCountDefault);
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
if (!defaultValue) {
|
|
40
|
+
if (props === null || props === void 0 ? void 0 : props.seatPositions) {
|
|
41
|
+
return props === null || props === void 0 ? void 0 : props.seatPositions;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return {
|
|
45
|
+
top: 1,
|
|
46
|
+
bottom: 1,
|
|
47
|
+
left: 1,
|
|
48
|
+
right: 1,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (seatCountDefault === 0) {
|
|
53
|
+
return {
|
|
54
|
+
top: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
right: 0,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) <= seatCountDefault &&
|
|
61
|
+
getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) !== 0) {
|
|
36
62
|
return props === null || props === void 0 ? void 0 : props.seatPositions;
|
|
37
63
|
}
|
|
38
|
-
console.log("seatCountDefault", seatCountDefault);
|
|
39
64
|
return distributeSeats(seatCountDefault);
|
|
40
65
|
};
|
|
41
66
|
export const adjustHeightWidthForSeatShape = (shape, props) => {
|