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
|
@@ -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
|
</>);
|
|
@@ -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(),
|
|
@@ -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]);
|
|
@@ -88,9 +88,11 @@ const LayerView = (props) => {
|
|
|
88
88
|
payload: defaultBoundingBox,
|
|
89
89
|
});
|
|
90
90
|
// }
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
if (loading) {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
dispatch({ type: "panel/setLoading", payload: false });
|
|
94
|
+
}, 1000);
|
|
95
|
+
}
|
|
94
96
|
}, [
|
|
95
97
|
componentProps,
|
|
96
98
|
extraComponentProps,
|
|
@@ -90,9 +90,11 @@ const LayerView = (props) => {
|
|
|
90
90
|
payload: defaultBoundingBox,
|
|
91
91
|
});
|
|
92
92
|
// }
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
if (loading) {
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
dispatch({ type: "panel/setLoading", payload: false });
|
|
96
|
+
}, 1000);
|
|
97
|
+
}
|
|
96
98
|
}, [
|
|
97
99
|
componentProps,
|
|
98
100
|
extraComponentProps,
|
|
@@ -326,7 +328,7 @@ const LayerView = (props) => {
|
|
|
326
328
|
: !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
327
329
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
328
330
|
return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
329
|
-
}))) &&
|
|
331
|
+
}))) && ((actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.move) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch));
|
|
330
332
|
if (ghostAttributes) {
|
|
331
333
|
Object.keys(ghostAttributes).forEach((key) => {
|
|
332
334
|
ghost.setAttribute(key, ghostAttributes[key]);
|
|
@@ -433,7 +435,7 @@ const LayerView = (props) => {
|
|
|
433
435
|
}
|
|
434
436
|
if (isDragging.current && hasMoved && allowedDrag) {
|
|
435
437
|
// drag between group
|
|
436
|
-
console.log("drag between group");
|
|
438
|
+
// console.log("drag between group");
|
|
437
439
|
const dataHoveredGhost = hoverUnderghostId.current;
|
|
438
440
|
const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
439
441
|
const data = {
|
|
@@ -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,
|
|
@@ -300,7 +302,7 @@ const LayerView = (props) => {
|
|
|
300
302
|
return { x: transformed.x, y: transformed.y };
|
|
301
303
|
};
|
|
302
304
|
const handlePointerDown = (e) => {
|
|
303
|
-
var _a
|
|
305
|
+
var _a;
|
|
304
306
|
const svg = svgRef.current;
|
|
305
307
|
if (!e.isPrimary)
|
|
306
308
|
return;
|
|
@@ -326,10 +328,6 @@ const LayerView = (props) => {
|
|
|
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
|
-
console.log({ allowedDrag }, !((_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
|
|
330
|
-
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
331
|
-
return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
332
|
-
})), ((actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.move) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch)));
|
|
333
331
|
if (ghostAttributes) {
|
|
334
332
|
Object.keys(ghostAttributes).forEach((key) => {
|
|
335
333
|
ghost.setAttribute(key, ghostAttributes[key]);
|
|
@@ -436,7 +434,7 @@ const LayerView = (props) => {
|
|
|
436
434
|
}
|
|
437
435
|
if (isDragging.current && hasMoved && allowedDrag) {
|
|
438
436
|
// drag between group
|
|
439
|
-
console.log("drag between group");
|
|
437
|
+
// console.log("drag between group");
|
|
440
438
|
const dataHoveredGhost = hoverUnderghostId.current;
|
|
441
439
|
const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
442
440
|
const data = {
|