seat-editor 3.3.35 → 3.3.36
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/layout.d.ts +1 -1
- package/dist/app/layout.js +22 -0
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/new-board/page.js +58 -0
- package/dist/app/old-board/page.d.ts +1 -2
- package/dist/app/old-board/page.js +377 -0
- 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 +226 -0
- 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/page.js +8 -0
- package/dist/app/test/page.d.ts +1 -2
- package/dist/app/test/page.js +43 -0
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/app/v2/page.js +8 -0
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/button-tools/index.js +11 -0
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/label.js +21 -0
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/form-tools/shape.js +69 -0
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/input/number-indicator.js +27 -0
- package/dist/components/joystick/index.d.ts +1 -2
- package/dist/components/joystick/index.js +48 -0
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer/index.js +295 -0
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v2/index.js +282 -0
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v3/index.js +483 -0
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/layer-v4/index.js +924 -0
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/lib/index.js +28 -0
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/components/modal-preview/index.js +10 -0
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board/index.js +666 -0
- package/dist/features/board-v2/index.d.ts +1 -2
- package/dist/features/board-v2/index.js +807 -0
- package/dist/features/board-v3/icons.js +16 -0
- package/dist/features/board-v3/index.d.ts +1 -1
- package/dist/features/board-v3/index.js +1587 -0
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/navbar/index.js +6 -0
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/package/index.js +166 -0
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/index.js +243 -0
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/select-tool.js +57 -0
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/selected-group.js +35 -0
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/square-circle-tool.js +8 -0
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.js +9 -0
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/table-seat-square.js +9 -0
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/text-tool.js +22 -0
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.js +150 -0
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/side-tool/index.js +365 -0
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only/index.js +198 -0
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-2/index.js +187 -0
- package/dist/features/view-only-3/index.d.ts +1 -1
- package/dist/features/view-only-3/index.js +577 -0
- package/dist/provider/antd-provider.js +43 -0
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/redux-provider.js +7 -0
- package/dist/provider/store-provider.d.ts +1 -1
- package/dist/provider/store-provider.js +9 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const Navbar: () => import("react").JSX.Element;
|
|
1
|
+
declare const Navbar: () => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default Navbar;
|
|
@@ -43,5 +43,5 @@ export interface TableEditorProps<TMeta = undefined> {
|
|
|
43
43
|
element: React.JSX.Element;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react").JSX.Element;
|
|
46
|
+
declare const TableEditor: <TMeta>(props: TableEditorProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
47
47
|
export default TableEditor;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
+
import Board from "../board-v3";
|
|
5
|
+
import SideTool from "../side-tool";
|
|
6
|
+
import ControlPanels from "../panel";
|
|
7
|
+
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
8
|
+
import { isEqual } from "lodash";
|
|
9
|
+
import LayerView from "../view-only-3";
|
|
10
|
+
import { Spin } from "antd";
|
|
11
|
+
const TableEditor = (props) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const [initialValue, setInitialValue] = useState(null);
|
|
14
|
+
const { componentProps, extraComponentProps, onCurrentStateChange, dragOnly, mappingKey, viewOnly, deleteAutorized, refs, loadingRender, } = props;
|
|
15
|
+
const { components, extraComponents, backgroundColor, boundingBox } = useAppSelector((state) => state.board);
|
|
16
|
+
const { loading } = useAppSelector((state) => state.panel);
|
|
17
|
+
const { isPreview } = useAppSelector((state) => state.tool);
|
|
18
|
+
const dispatch = useAppDispatch();
|
|
19
|
+
const refsBoard = useRef(null);
|
|
20
|
+
useImperativeHandle(refs, () => {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
return ({
|
|
23
|
+
svgRef: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.svgRef,
|
|
24
|
+
transformRef: (_b = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _b === void 0 ? void 0 : _b.transformRef,
|
|
25
|
+
containerRef: (_c = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _c === void 0 ? void 0 : _c.containerRef,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!viewOnly) {
|
|
30
|
+
dispatch({
|
|
31
|
+
type: "panel/setSelectedComponent",
|
|
32
|
+
payload: null,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
dispatch({
|
|
36
|
+
type: "tool/setActiveTool",
|
|
37
|
+
payload: "",
|
|
38
|
+
});
|
|
39
|
+
if (viewOnly) {
|
|
40
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
41
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
42
|
+
}
|
|
43
|
+
}, [viewOnly]);
|
|
44
|
+
const onUpdateCurrentState = () => {
|
|
45
|
+
let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
|
|
46
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
47
|
+
let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
48
|
+
if (!findComponent)
|
|
49
|
+
return undefined;
|
|
50
|
+
if (findComponent) {
|
|
51
|
+
return Object.assign(Object.assign({}, item), { [mappingKey]: Object.assign({}, findComponent) });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
|
|
56
|
+
if (!findComponent)
|
|
57
|
+
return undefined;
|
|
58
|
+
if (findComponent) {
|
|
59
|
+
return Object.assign(Object.assign({}, item), findComponent);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
|
|
64
|
+
if (!hasUndefined && !viewOnly) {
|
|
65
|
+
onCurrentStateChange({
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
components: matchInitialValueWithComponents,
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
extraComponents: extraComponents,
|
|
70
|
+
background: backgroundColor,
|
|
71
|
+
boundingBox,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!isEqual(components, convertComponentProps()) ||
|
|
77
|
+
!isEqual(extraComponents, extraComponentProps) ||
|
|
78
|
+
!isEqual(backgroundColor, props === null || props === void 0 ? void 0 : props.defaultBackground) ||
|
|
79
|
+
!isEqual(boundingBox, props === null || props === void 0 ? void 0 : props.defaultBoundingBox)) {
|
|
80
|
+
onCurrentStateChange && onUpdateCurrentState();
|
|
81
|
+
}
|
|
82
|
+
}, [components, extraComponents, backgroundColor, boundingBox]);
|
|
83
|
+
const convertComponentProps = () => {
|
|
84
|
+
let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
|
|
85
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
86
|
+
return Object.assign({}, (typeof (item === null || item === void 0 ? void 0 : item[mappingKey]) === "object" &&
|
|
87
|
+
(item === null || item === void 0 ? void 0 : item[mappingKey]) !== null
|
|
88
|
+
? item === null || item === void 0 ? void 0 : item[mappingKey]
|
|
89
|
+
: {}));
|
|
90
|
+
}
|
|
91
|
+
return item;
|
|
92
|
+
});
|
|
93
|
+
return mappingData;
|
|
94
|
+
};
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
|
|
97
|
+
dispatch({ type: "panel/setLoading", payload: true });
|
|
98
|
+
}
|
|
99
|
+
const initialComponent = !isEqual(components, convertComponentProps()) && componentProps;
|
|
100
|
+
const initialExtraComponent = !isEqual(extraComponents, extraComponentProps) && extraComponentProps;
|
|
101
|
+
if (initialComponent || initialExtraComponent) {
|
|
102
|
+
let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
|
|
103
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[props.mappingKey])) {
|
|
104
|
+
return Object.assign({}, (typeof item[props.mappingKey] === "object" &&
|
|
105
|
+
item[props.mappingKey] !== null
|
|
106
|
+
? item[props.mappingKey]
|
|
107
|
+
: {}));
|
|
108
|
+
}
|
|
109
|
+
return item;
|
|
110
|
+
});
|
|
111
|
+
if (mappingKey) {
|
|
112
|
+
setInitialValue(componentProps);
|
|
113
|
+
}
|
|
114
|
+
dispatch({
|
|
115
|
+
type: "board/setInitialValue",
|
|
116
|
+
payload: {
|
|
117
|
+
components: mappingData,
|
|
118
|
+
extraComponents: extraComponentProps,
|
|
119
|
+
backgroundColor: props === null || props === void 0 ? void 0 : props.defaultBackground,
|
|
120
|
+
boundingBox: (props === null || props === void 0 ? void 0 : props.defaultBoundingBox) || null,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
// dispatch({
|
|
124
|
+
// type: "board/setNewComponents",
|
|
125
|
+
// payload: mappingData,
|
|
126
|
+
// });
|
|
127
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
128
|
+
}
|
|
129
|
+
// const isEmptyComponents = components?.length === 0
|
|
130
|
+
// const isEmptyExtraComponents = extraComponents?.length === 0;
|
|
131
|
+
// // const isEmptyBoundingBox = boundingBox === null;
|
|
132
|
+
// if(isEmptyComponents){
|
|
133
|
+
// dispatch({
|
|
134
|
+
// type: "board/setInitialValue",
|
|
135
|
+
// payload: {
|
|
136
|
+
// components: [],
|
|
137
|
+
// extraComponents: extraComponents,
|
|
138
|
+
// backgroundColor: props?.defaultBackground,
|
|
139
|
+
// boundingBox: props?.defaultBoundingBox || null,
|
|
140
|
+
// },
|
|
141
|
+
// });
|
|
142
|
+
// }
|
|
143
|
+
// if(isEmptyExtraComponents){
|
|
144
|
+
// dispatch({
|
|
145
|
+
// type: "board/setInitialValue",
|
|
146
|
+
// payload: {
|
|
147
|
+
// components: components,
|
|
148
|
+
// extraComponents: [],
|
|
149
|
+
// backgroundColor: props?.defaultBackground,
|
|
150
|
+
// boundingBox: props?.defaultBoundingBox || null,
|
|
151
|
+
// },
|
|
152
|
+
// })
|
|
153
|
+
// }
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
dispatch({ type: "panel/setLoading", payload: false });
|
|
156
|
+
}, 1000);
|
|
157
|
+
}, [
|
|
158
|
+
componentProps,
|
|
159
|
+
extraComponentProps,
|
|
160
|
+
props === null || props === void 0 ? void 0 : props.defaultBackground,
|
|
161
|
+
props === null || props === void 0 ? void 0 : props.defaultBoundingBox,
|
|
162
|
+
loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
|
|
163
|
+
]);
|
|
164
|
+
return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative", children: viewOnly ? (_jsx("div", { className: "w-full h-full flex relative", children: _jsx(LayerView, { statusKey: "status", loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`) })) : (_jsxs("div", { className: "w-full h-full flex relative", children: [(loading && !isPreview) && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`), _jsx(ControlPanels, { action: props.action, transform: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.transformRef })] }, `${viewOnly}`)) }) }));
|
|
165
|
+
};
|
|
166
|
+
export default TableEditor;
|
|
@@ -2,5 +2,5 @@ interface ControlPanelsProps {
|
|
|
2
2
|
action?: (file: File) => Promise<string>;
|
|
3
3
|
transform?: any;
|
|
4
4
|
}
|
|
5
|
-
declare const ControlPanels: (props: ControlPanelsProps) => import("react").JSX.Element;
|
|
5
|
+
declare const ControlPanels: (props: ControlPanelsProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default ControlPanels;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useEffect, useRef, useState } from "react";
|
|
15
|
+
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
16
|
+
import { Form, Input } from "antd";
|
|
17
|
+
import SelectToolForm from "./select-tool";
|
|
18
|
+
import SquareToolForm from "./square-circle-tool";
|
|
19
|
+
import SeatCircle from "./table-seat-circle";
|
|
20
|
+
import UploadTool from "./upload-tool";
|
|
21
|
+
import { debounce } from "lodash";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
import { getAttributeElement } from "../board-v3/resize-element";
|
|
24
|
+
import { applyResizeToSvgElement, getGlobalBBox, updateSelectionBox, } from "../board-v3/utils";
|
|
25
|
+
import { SEAT_SHAPES } from "../../utils/constant";
|
|
26
|
+
import { adjustHeightWidthForSeatShape, getSeatCount, getSeatPosition, isSeatShape, } from "./utils";
|
|
27
|
+
import SeatSquare from "./table-seat-square";
|
|
28
|
+
const ControlPanels = (props) => {
|
|
29
|
+
const { action, transform } = props;
|
|
30
|
+
const dispatch = useAppDispatch();
|
|
31
|
+
const theme = useAppSelector((state) => state.theme);
|
|
32
|
+
const tool = useAppSelector((state) => state.tool);
|
|
33
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
34
|
+
const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
|
|
35
|
+
const components = useAppSelector((state) => state.board.components);
|
|
36
|
+
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
37
|
+
const svgRef = useRef(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
svgRef.current = document.querySelectorAll("#workspace");
|
|
40
|
+
}, []);
|
|
41
|
+
const { show } = useAppSelector((state) => state.panel);
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const [form] = Form.useForm();
|
|
44
|
+
let values = Form.useWatch([], form);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (selectedComponent) {
|
|
47
|
+
const isDifferentId = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) !== (values === null || values === void 0 ? void 0 : values.id) || !(values === null || values === void 0 ? void 0 : values.id);
|
|
48
|
+
const isSameIdAndSameDimensions = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) === (values === null || values === void 0 ? void 0 : values.id) &&
|
|
49
|
+
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.height) === (values === null || values === void 0 ? void 0 : values.height) &&
|
|
50
|
+
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.width) === (values === null || values === void 0 ? void 0 : values.width) &&
|
|
51
|
+
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x) === (values === null || values === void 0 ? void 0 : values.x) &&
|
|
52
|
+
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y) === (values === null || values === void 0 ? void 0 : values.y);
|
|
53
|
+
if (show && (isDifferentId || isSameIdAndSameDimensions)) {
|
|
54
|
+
setOpen(true);
|
|
55
|
+
}
|
|
56
|
+
form.setFieldsValue(selectedComponent);
|
|
57
|
+
}
|
|
58
|
+
else if (selectedGroup) {
|
|
59
|
+
if (show)
|
|
60
|
+
setOpen(true);
|
|
61
|
+
if (!show)
|
|
62
|
+
setOpen(false);
|
|
63
|
+
function isSameAllByKey(arr, key) {
|
|
64
|
+
if (!arr || arr.length === 0)
|
|
65
|
+
return false;
|
|
66
|
+
const firstValue = arr[0][key];
|
|
67
|
+
return arr.every((item) => item[key] === firstValue);
|
|
68
|
+
}
|
|
69
|
+
function getValueIfSame(arr, key) {
|
|
70
|
+
return isSameAllByKey(arr, key) ? arr[0][key] : undefined;
|
|
71
|
+
}
|
|
72
|
+
form.setFieldsValue({
|
|
73
|
+
width: getValueIfSame(selectedGroup, "width"),
|
|
74
|
+
height: getValueIfSame(selectedGroup, "height"),
|
|
75
|
+
x: getValueIfSame(selectedGroup, "x"),
|
|
76
|
+
y: getValueIfSame(selectedGroup, "y"),
|
|
77
|
+
fill: getValueIfSame(selectedGroup, "fill"),
|
|
78
|
+
stroke: getValueIfSame(selectedGroup, "stroke"),
|
|
79
|
+
opacity: getValueIfSame(selectedGroup, "opacity"),
|
|
80
|
+
rotation: getValueIfSame(selectedGroup, "rotation"),
|
|
81
|
+
strokeWidth: getValueIfSame(selectedGroup, "strokeWidth"),
|
|
82
|
+
radius: getValueIfSame(selectedGroup, "radius"),
|
|
83
|
+
shape: getValueIfSame(selectedGroup, "shape"),
|
|
84
|
+
labels: getValueIfSame(selectedGroup, "labels"),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setOpen(false);
|
|
89
|
+
}
|
|
90
|
+
}, [selectedComponent, selectedGroup, show]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (tool.active === "background" || tool.active === "image-table") {
|
|
93
|
+
setOpen(true);
|
|
94
|
+
}
|
|
95
|
+
}, [tool, show]);
|
|
96
|
+
const createShape = (shape, props = {}) => {
|
|
97
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
98
|
+
const defaults = (_a = SEAT_SHAPES[shape]) !== null && _a !== void 0 ? _a : {};
|
|
99
|
+
return Object.assign(Object.assign(Object.assign({}, defaults), props), { shape: (_b = props.shape) !== null && _b !== void 0 ? _b : shape, height: (_c = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _c === void 0 ? void 0 : _c.height, width: (_d = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _d === void 0 ? void 0 : _d.width, fill: props.fill, seatCount: getSeatCount(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props), seatPositions: getSeatPosition(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props), openSpace: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape) ? (_e = props.openSpace) !== null && _e !== void 0 ? _e : 0 : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
|
|
100
|
+
? props.seatFill
|
|
101
|
+
: undefined, text: shape === "text" ? (_f = props.text) !== null && _f !== void 0 ? _f : defaults.text : undefined, fontColor: shape === "text" ? (_g = props.fontColor) !== null && _g !== void 0 ? _g : defaults.fontColor : undefined, radius: props.radius });
|
|
102
|
+
};
|
|
103
|
+
const debouncedSyncComponents = useRef(debounce((data) => {
|
|
104
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
105
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
106
|
+
dispatch({
|
|
107
|
+
type: "board/updateComponent",
|
|
108
|
+
payload: data,
|
|
109
|
+
});
|
|
110
|
+
dispatch({
|
|
111
|
+
type: "panel/updateSelectedComponent",
|
|
112
|
+
payload: data,
|
|
113
|
+
});
|
|
114
|
+
}, 300));
|
|
115
|
+
const debouncedSyncSelectedComponents = useRef(debounce((data) => {
|
|
116
|
+
dispatch({
|
|
117
|
+
type: "panel/updateSelectedComponent",
|
|
118
|
+
payload: data,
|
|
119
|
+
});
|
|
120
|
+
}, 300));
|
|
121
|
+
const debouncedSyncSelectedSelectionLines = useRef(debounce((data) => {
|
|
122
|
+
dispatch({
|
|
123
|
+
type: "panel/setSelectionLines",
|
|
124
|
+
payload: data,
|
|
125
|
+
});
|
|
126
|
+
}));
|
|
127
|
+
const debounceSyncSelectedGroup = useRef(debounce((data) => {
|
|
128
|
+
dispatch({
|
|
129
|
+
type: "panel/updateSelectedGroup",
|
|
130
|
+
payload: data,
|
|
131
|
+
});
|
|
132
|
+
}, 300));
|
|
133
|
+
const debounceSyncDataSelectedGroup = useRef(debounce((data) => {
|
|
134
|
+
dispatch({
|
|
135
|
+
type: "panel/updateSelectedGroup",
|
|
136
|
+
payload: data,
|
|
137
|
+
});
|
|
138
|
+
dispatch({
|
|
139
|
+
type: "board/updateComponentsBulk",
|
|
140
|
+
payload: data,
|
|
141
|
+
});
|
|
142
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
143
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
144
|
+
}, 300));
|
|
145
|
+
const debouncedSyncForm = useRef(debounce(() => {
|
|
146
|
+
dispatch({ type: "board/setFlagChange", payload: true });
|
|
147
|
+
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
148
|
+
}, 300));
|
|
149
|
+
const updateElement = (id, values) => {
|
|
150
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
151
|
+
let findElement = [...components, ...extraComponents].find((item) => item.id === id);
|
|
152
|
+
const isAdjustSize = ["circle"].includes((findElement === null || findElement === void 0 ? void 0 : findElement.shape) || "");
|
|
153
|
+
let forceSize = {
|
|
154
|
+
width: Math.min(findElement.width, findElement.height),
|
|
155
|
+
height: Math.min(findElement.width, findElement.height),
|
|
156
|
+
};
|
|
157
|
+
if (!findElement)
|
|
158
|
+
return;
|
|
159
|
+
const newElement = Object.assign(Object.assign(Object.assign({}, findElement), values), { x: (_a = values.x) !== null && _a !== void 0 ? _a : findElement.x, y: (_b = values.y) !== null && _b !== void 0 ? _b : findElement.y, width: isAdjustSize ? forceSize.width : (_c = values.width) !== null && _c !== void 0 ? _c : findElement.width, height: isAdjustSize
|
|
160
|
+
? forceSize.height
|
|
161
|
+
: (_d = values.height) !== null && _d !== void 0 ? _d : findElement.height });
|
|
162
|
+
const svg = (_f = (_e = svgRef === null || svgRef === void 0 ? void 0 : svgRef.current) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : (_g = svgRef === null || svgRef === void 0 ? void 0 : svgRef.current) === null || _g === void 0 ? void 0 : _g[0];
|
|
163
|
+
const { g, element } = getAttributeElement(svg, id);
|
|
164
|
+
applyResizeToSvgElement(element, g, newElement);
|
|
165
|
+
const getBBox = getGlobalBBox(svg, g);
|
|
166
|
+
debouncedSyncSelectedSelectionLines.current(Object.assign({}, getBBox));
|
|
167
|
+
updateSelectionBox(svg, getBBox);
|
|
168
|
+
};
|
|
169
|
+
const handleChangeComponent = (values, allValues) => {
|
|
170
|
+
const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
|
|
171
|
+
const newValues = createShape(shape, restProps);
|
|
172
|
+
if (selectedComponent) {
|
|
173
|
+
updateElement(allValues.id, values);
|
|
174
|
+
debouncedSyncComponents.current(Object.assign(Object.assign({}, (selectedComponent || {})), newValues));
|
|
175
|
+
}
|
|
176
|
+
if ((selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.length) > 0) {
|
|
177
|
+
const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, shape, seatCount, seatFill, seatPositions, labels } = newValues;
|
|
178
|
+
const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {})), (shape !== undefined ? { shape } : {})), (seatCount !== undefined ? { seatCount } : {})), (seatFill !== undefined ? { seatFill } : {})), (seatPositions !== undefined ? { seatPositions } : {})), (labels !== undefined ? { labels } : {}))));
|
|
179
|
+
let minX = Infinity;
|
|
180
|
+
let minY = Infinity;
|
|
181
|
+
let maxX = -Infinity;
|
|
182
|
+
let maxY = -Infinity;
|
|
183
|
+
updatedGroup.forEach((comp) => {
|
|
184
|
+
minX = Math.min(minX, comp.x);
|
|
185
|
+
minY = Math.min(minY, comp.y);
|
|
186
|
+
maxX = Math.max(maxX, comp.x + comp.width);
|
|
187
|
+
maxY = Math.max(maxY, comp.y + comp.height);
|
|
188
|
+
});
|
|
189
|
+
const newSelectionGroup = {
|
|
190
|
+
x: minX,
|
|
191
|
+
y: minY,
|
|
192
|
+
width: maxX - minX,
|
|
193
|
+
height: maxY - minY,
|
|
194
|
+
shape: "selection-box",
|
|
195
|
+
id: `${Date.now()}`,
|
|
196
|
+
fill: "transparent",
|
|
197
|
+
rotation: 0,
|
|
198
|
+
stroke: "red",
|
|
199
|
+
};
|
|
200
|
+
dispatch({
|
|
201
|
+
type: "panel/setSelectionLines",
|
|
202
|
+
payload: newSelectionGroup,
|
|
203
|
+
});
|
|
204
|
+
// dispatch({
|
|
205
|
+
// type: "panel/updateSelectedGroup",
|
|
206
|
+
// payload: updatedGroup,
|
|
207
|
+
// });
|
|
208
|
+
debounceSyncDataSelectedGroup.current(updatedGroup);
|
|
209
|
+
}
|
|
210
|
+
// debouncedSyncForm.current();
|
|
211
|
+
};
|
|
212
|
+
const renderFormPanel = () => {
|
|
213
|
+
switch (tool.active) {
|
|
214
|
+
case "select":
|
|
215
|
+
case "text":
|
|
216
|
+
return _jsx(SelectToolForm, { action: action, tranform: transform });
|
|
217
|
+
case "square":
|
|
218
|
+
case "circle":
|
|
219
|
+
return _jsx(SquareToolForm, {});
|
|
220
|
+
case "table-seat-circle":
|
|
221
|
+
return _jsx(SeatCircle, {});
|
|
222
|
+
case "table-seat-square":
|
|
223
|
+
return _jsx(SeatSquare, {});
|
|
224
|
+
case "image-table":
|
|
225
|
+
return (_jsx(UploadTool, { name: tool.active, type: "component", action: action, transform: transform }));
|
|
226
|
+
case "background":
|
|
227
|
+
return (_jsx(UploadTool, { name: tool.active, type: "background", action: action, transform: transform }));
|
|
228
|
+
default:
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const handleClose = () => {
|
|
233
|
+
setOpen(false);
|
|
234
|
+
// HIDE SEMENTARA
|
|
235
|
+
dispatch({
|
|
236
|
+
type: "panel/setShow",
|
|
237
|
+
payload: false,
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
// if(!show) return null
|
|
241
|
+
return (_jsx("div", { className: clsx("w-[300px] h-full absolute top-0 z-50 transition-all duration-300 overflow-y-scroll ", open ? "right-0" : "right-[-300px]"), children: _jsx("div", { className: "bg-white h-full max-h-screen w-full p-2 overflow-y-auto border-l border-gray-300", children: _jsxs(Form, { layout: "vertical", form: form, name: "table", onValuesChange: handleChangeComponent, initialValues: { labels: [{}] }, children: [_jsx(Form.Item, { name: "id", hidden: true, children: _jsx(Input, {}) }), renderFormPanel()] }) }) }));
|
|
242
|
+
};
|
|
243
|
+
export default ControlPanels;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
4
|
+
import SquareToolForm from "./square-circle-tool";
|
|
5
|
+
import SeatCircle from "./table-seat-circle";
|
|
6
|
+
import SeatSquare from "./table-seat-square";
|
|
7
|
+
import UploadTool from "./upload-tool";
|
|
8
|
+
import TextTool from "./text-tool";
|
|
9
|
+
import SelectedGroup from "./selected-group";
|
|
10
|
+
const SelectToolForm = ({ title = "Title", action, tranform }) => {
|
|
11
|
+
const components = useAppSelector((state) => state.board.components);
|
|
12
|
+
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
13
|
+
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
14
|
+
const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
|
|
15
|
+
const SummaryComponents = () => {
|
|
16
|
+
const countByShape = components === null || components === void 0 ? void 0 : components.reduce((acc, item) => {
|
|
17
|
+
acc[item.shape] = (acc[item.shape] || 0) + 1;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
const variableFormatToString = (variable) => {
|
|
21
|
+
return variable
|
|
22
|
+
.replace(/-/g, " ")
|
|
23
|
+
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs("div", { className: "flex flex-col", children: [_jsx("h1", { className: "heading-s", children: title }), _jsx("div", { className: "flex flex-col gap-2 mt-5", children: Object.entries(countByShape).map(([shape, count]) => (_jsxs("div", { children: [_jsxs("span", { className: "font-bold", children: [variableFormatToString(shape), ":"] }), " ", count] }, shape))) })] }));
|
|
26
|
+
};
|
|
27
|
+
const renderComponent = () => {
|
|
28
|
+
switch (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) {
|
|
29
|
+
case "square":
|
|
30
|
+
case "circle":
|
|
31
|
+
return _jsx(SquareToolForm, {});
|
|
32
|
+
case "table-seat-circle":
|
|
33
|
+
case "table-seat-rect-circle":
|
|
34
|
+
return _jsx(SeatCircle, {});
|
|
35
|
+
case "table-seat-square":
|
|
36
|
+
case "table-seat-half-square":
|
|
37
|
+
case "table-seat-rect-square":
|
|
38
|
+
return _jsx(SeatSquare, {});
|
|
39
|
+
case "image-table":
|
|
40
|
+
case "background":
|
|
41
|
+
return (_jsx(UploadTool, { action: action, name: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape, defaultValue: selectedComponent, type: (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background"
|
|
42
|
+
? "background"
|
|
43
|
+
: "component", transform: tranform }));
|
|
44
|
+
case "text":
|
|
45
|
+
return _jsx(TextTool, {});
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const renderSelectionComponent = () => {
|
|
51
|
+
if (selectedGroup) {
|
|
52
|
+
return _jsx(SelectedGroup, {});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(SummaryComponents, {}), renderComponent(), renderSelectionComponent()] }));
|
|
56
|
+
};
|
|
57
|
+
export default SelectToolForm;
|
|
@@ -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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { optionsShape } from "../../components/form-tools/shape";
|
|
4
|
+
import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
|
|
5
|
+
import SeatCircle from "./table-seat-circle";
|
|
6
|
+
import SeatSquare from "./table-seat-square";
|
|
7
|
+
import { useAppSelector } from "../../hooks/use-redux";
|
|
8
|
+
const SelectedGroup = () => {
|
|
9
|
+
const shape = Form.useWatch("shape");
|
|
10
|
+
const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
|
|
11
|
+
const sameShape = [
|
|
12
|
+
"table-seat-circle",
|
|
13
|
+
"table-seat-rect-circle",
|
|
14
|
+
"table-seat-square",
|
|
15
|
+
"table-seat-square",
|
|
16
|
+
"table-seat-rect-square",
|
|
17
|
+
"table-seat-half-square"
|
|
18
|
+
].includes(shape);
|
|
19
|
+
const allShapeSelected = selectedGroup.map((item) => item.shape);
|
|
20
|
+
const shapeIncludeImage = ["background", "image-table", "polygon"].some((shape) => allShapeSelected.includes(shape));
|
|
21
|
+
const shapeAllIncludePolygon = allShapeSelected.includes("polygon");
|
|
22
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Group Selection" }), _jsxs("div", { className: "py-2", children: [!shapeIncludeImage && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select, { options: optionsShape, className: "w-full" }) }) })), _jsxs(Flex, { gap: 2, className: "w-full", children: [["table-seat-circle", "table-seat-rect-circle"].includes(shape) && _jsx(SeatCircle, {}), [
|
|
23
|
+
"table-seat-square",
|
|
24
|
+
"table-seat-square",
|
|
25
|
+
"table-seat-rect-square",
|
|
26
|
+
"table-seat-half-square"
|
|
27
|
+
].includes(shape) && _jsx(SeatSquare, {})] }), !sameShape && (_jsxs(_Fragment, { children: [_jsxs(Flex, { gap: 2, className: "w-full", children: [!shapeAllIncludePolygon && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: "Width", name: "width", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) })] })), (!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && !shapeAllIncludePolygon) && (_jsx(Form.Item, { label: "Radius", name: "radius", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
30
|
+
return onlyNumber === ""
|
|
31
|
+
? 1
|
|
32
|
+
: Math.max(1, Number(onlyNumber));
|
|
33
|
+
} }) }))] }), !shapeAllIncludePolygon && (_jsx(_Fragment, { children: _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, { max: 360, min: 0 }) })] }) })), _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" }) })] }), _jsxs(Flex, { children: [_jsx(Form.Item, { label: "Stroke Width", name: "strokeWidth", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "opacity", name: "opacity", className: "w-full", children: _jsx(InputNumber, { step: 0.1, max: 1, min: 0 }) })] })] }))] })] }) }));
|
|
34
|
+
};
|
|
35
|
+
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;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import SectionLabel from "../../components/form-tools/label";
|
|
4
|
+
import SectionShape from "../../components/form-tools/shape";
|
|
5
|
+
const SquareToolForm = () => {
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx(SectionShape, {}), _jsx(SectionLabel, {})] }));
|
|
7
|
+
};
|
|
8
|
+
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { ColorPicker, Flex, Form, InputNumber } from "antd";
|
|
4
|
+
import SectionLabel from "../../components/form-tools/label";
|
|
5
|
+
import SectionShape from "../../components/form-tools/shape";
|
|
6
|
+
const SeatCircle = () => {
|
|
7
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Round table" }), _jsxs(Flex, { children: [_jsx(Form.Item, { name: "seatCount", label: "Seat Count", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 1, min: 0, step: 0.1 }) })] }), _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(SectionShape, {}), _jsx(SectionLabel, {})] }) }));
|
|
8
|
+
};
|
|
9
|
+
export default SeatCircle;
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
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";
|
|
4
|
+
import SectionLabel from "../../components/form-tools/label";
|
|
5
|
+
import SectionShape from "../../components/form-tools/shape";
|
|
6
|
+
const SeatSquare = () => {
|
|
7
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Square table" }), _jsx(Flex, { className: "w-full", children: _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 1, min: 0, step: 0.1 }) }) }), _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, { max: 100, min: 0, step: 1 }) }), _jsx(Form.Item, { name: ["seatPositions", "left"], label: "Left", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) })] }), _jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "right"], label: "Right", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) }), _jsx(Form.Item, { name: ["seatPositions", "bottom"], label: "Bottom", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 1 }) })] })] }), _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(SectionShape, {}), _jsx(SectionLabel, {})] }) }));
|
|
8
|
+
};
|
|
9
|
+
export default SeatSquare;
|
|
@@ -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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ColorPicker, Flex, Form, Input, InputNumber } from "antd";
|
|
4
|
+
const TextTool = () => {
|
|
5
|
+
return (_jsxs("div", { className: "py-2", children: [_jsx(Form.Item, { label: "Name", name: "shape", className: "w-full hidden", children: _jsx(Input, { defaultValue: "text" }) }), _jsx(Form.Item, { name: "text", label: "Text", children: _jsx(Input, {}) }), _jsxs(Flex, { className: "w-full", gap: 2, children: [_jsx(Form.Item, { name: "fontColor", label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { name: "fontSize", label: "Size", children: _jsx(InputNumber, { suffix: "px" }) })] }), _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) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
8
|
+
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
9
|
+
} }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
12
|
+
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
13
|
+
} }) })] }), _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) => {
|
|
14
|
+
if (!value)
|
|
15
|
+
return 0;
|
|
16
|
+
const num = Number(value.replace(/\D/g, ""));
|
|
17
|
+
if (Number.isNaN(num))
|
|
18
|
+
return 0;
|
|
19
|
+
return Math.min(360, Math.max(0, num));
|
|
20
|
+
} }) })] })] }));
|
|
21
|
+
};
|
|
22
|
+
export default TextTool;
|