seat-editor 3.4.7 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/constant.d.ts +1 -1
- package/dist/app/graph-view/page.d.ts +1 -0
- package/dist/app/graph-view/page.js +343 -0
- package/dist/app/graph-view/page.jsx +445 -0
- package/dist/app/graph-view-new/constant.d.ts +581 -0
- package/dist/app/graph-view-new/constant.js +6973 -0
- package/dist/app/graph-view-new/page.d.ts +1 -0
- package/dist/app/graph-view-new/page.js +71 -0
- package/dist/app/graph-view-new/page.jsx +98 -0
- package/dist/app/new-board/page.js +43 -7
- package/dist/app/new-board/page.jsx +45 -12
- package/dist/components/button-tools/index.js +7 -5
- package/dist/components/button-tools/index.jsx +21 -9
- package/dist/components/form-tools/label.js +9 -20
- package/dist/components/form-tools/label.jsx +38 -28
- package/dist/components/form-tools/shape.js +5 -5
- package/dist/components/form-tools/shape.jsx +8 -8
- package/dist/components/layer-v3/index.js +44 -3
- package/dist/components/layer-v3/index.jsx +120 -3
- package/dist/components/layer-v4/index.js +3 -2
- package/dist/components/layer-v4/index.jsx +3 -2
- package/dist/components/layer-v5/constant.d.ts +60 -0
- package/dist/components/layer-v5/constant.js +93 -0
- package/dist/components/layer-v5/index.d.ts +24 -0
- package/dist/components/layer-v5/index.js +927 -0
- package/dist/components/layer-v5/index.jsx +1049 -0
- package/dist/features/board-v3/index.js +350 -72
- package/dist/features/board-v3/index.jsx +369 -75
- package/dist/features/board-v3/resize-element.js +5 -0
- package/dist/features/board-v3/utils.d.ts +8 -0
- package/dist/features/board-v3/utils.js +23 -7
- package/dist/features/package/index.d.ts +2 -0
- package/dist/features/package/index.js +1 -1
- package/dist/features/package/index.jsx +6 -1
- package/dist/features/panel/index.d.ts +8 -0
- package/dist/features/panel/index.js +160 -38
- package/dist/features/panel/index.jsx +173 -46
- package/dist/features/panel/polygon.d.ts +2 -0
- package/dist/features/panel/polygon.js +44 -0
- package/dist/features/panel/polygon.jsx +70 -0
- package/dist/features/panel/select-tool.js +3 -0
- package/dist/features/panel/select-tool.jsx +3 -0
- package/dist/features/panel/selected-group.js +24 -26
- package/dist/features/panel/selected-group.jsx +56 -51
- package/dist/features/panel/text-tool.js +17 -2
- package/dist/features/panel/text-tool.jsx +19 -2
- package/dist/features/panel/upload-tool.js +17 -3
- package/dist/features/panel/upload-tool.jsx +23 -4
- package/dist/features/side-tool/index.js +43 -6
- package/dist/features/side-tool/index.jsx +47 -10
- package/dist/features/view-only-4/connect-handle.d.ts +13 -0
- package/dist/features/view-only-4/connect-handle.js +23 -0
- package/dist/features/view-only-4/connect-handle.jsx +30 -0
- package/dist/features/view-only-4/connection-layer.d.ts +21 -0
- package/dist/features/view-only-4/connection-layer.js +219 -0
- package/dist/features/view-only-4/connection-layer.jsx +291 -0
- package/dist/features/view-only-4/index.d.ts +99 -0
- package/dist/features/view-only-4/index.js +684 -0
- package/dist/features/view-only-4/index.jsx +722 -0
- package/dist/features/view-only-4/integration-guide.d.ts +0 -0
- package/dist/features/view-only-4/integration-guide.js +0 -0
- package/dist/features/view-only-4/use-connection-graph.d.ts +41 -0
- package/dist/features/view-only-4/use-connection-graph.js +182 -0
- package/dist/features/view-only-4/utils.d.ts +74 -0
- package/dist/features/view-only-4/utils.js +106 -0
- package/dist/features/view-only-5/connect-handle.d.ts +30 -0
- package/dist/features/view-only-5/connect-handle.js +88 -0
- package/dist/features/view-only-5/connect-handle.jsx +96 -0
- package/dist/features/view-only-5/connection-layer.d.ts +34 -0
- package/dist/features/view-only-5/connection-layer.js +182 -0
- package/dist/features/view-only-5/connection-layer.jsx +265 -0
- package/dist/features/view-only-5/index.d.ts +102 -0
- package/dist/features/view-only-5/index.js +585 -0
- package/dist/features/view-only-5/index.jsx +614 -0
- package/dist/features/view-only-5/use-connection-graph.d.ts +57 -0
- package/dist/features/view-only-5/use-connection-graph.js +196 -0
- package/dist/features/view-only-5/utils.d.ts +52 -0
- package/dist/features/view-only-5/utils.js +80 -0
- package/dist/features/view-only-6/connect-handle.d.ts +13 -0
- package/dist/features/view-only-6/connect-handle.js +20 -0
- package/dist/features/view-only-6/connect-handle.jsx +21 -0
- package/dist/features/view-only-6/connection-layer.d.ts +22 -0
- package/dist/features/view-only-6/connection-layer.js +191 -0
- package/dist/features/view-only-6/connection-layer.jsx +244 -0
- package/dist/features/view-only-6/index.d.ts +99 -0
- package/dist/features/view-only-6/index.js +687 -0
- package/dist/features/view-only-6/index.jsx +724 -0
- package/dist/features/view-only-6/use-connection-graph.d.ts +26 -0
- package/dist/features/view-only-6/use-connection-graph.js +103 -0
- package/dist/features/view-only-6/utils.d.ts +66 -0
- package/dist/features/view-only-6/utils.js +96 -0
- package/dist/features/view-only-7/connect-handle.d.ts +13 -0
- package/dist/features/view-only-7/connect-handle.js +23 -0
- package/dist/features/view-only-7/connect-handle.jsx +30 -0
- package/dist/features/view-only-7/connection-layer.d.ts +22 -0
- package/dist/features/view-only-7/connection-layer.js +165 -0
- package/dist/features/view-only-7/connection-layer.jsx +217 -0
- package/dist/features/view-only-7/index.d.ts +99 -0
- package/dist/features/view-only-7/index.js +687 -0
- package/dist/features/view-only-7/index.jsx +724 -0
- package/dist/features/view-only-7/use-connection-graph.d.ts +26 -0
- package/dist/features/view-only-7/use-connection-graph.js +104 -0
- package/dist/features/view-only-7/utils.d.ts +69 -0
- package/dist/features/view-only-7/utils.js +144 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/seat-editor.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function GraphView(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import LayerView from "../../features/view-only-5";
|
|
5
|
+
import { data } from "./constant";
|
|
6
|
+
import { Button } from "antd";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
export default function GraphView() {
|
|
9
|
+
const [isConnecting, setIsConnecting] = useState(false);
|
|
10
|
+
const [isSelectNode, setIsSelectNode] = useState(false);
|
|
11
|
+
const [sections, setSections] = useState([
|
|
12
|
+
{
|
|
13
|
+
id: 1,
|
|
14
|
+
name: "Section 1",
|
|
15
|
+
color: "#1e2d4a",
|
|
16
|
+
items: [],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 2,
|
|
20
|
+
name: "Section 2",
|
|
21
|
+
color: "#F6F6F6",
|
|
22
|
+
items: [],
|
|
23
|
+
}
|
|
24
|
+
]);
|
|
25
|
+
const [sectionActive, setSectionActive] = useState(null);
|
|
26
|
+
const componentSection = useMemo(() => data === null || data === void 0 ? void 0 : data.map((data) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
|
|
29
|
+
}), [data, sections]);
|
|
30
|
+
const onMakeSelection = (datas) => {
|
|
31
|
+
setSections((prev) => {
|
|
32
|
+
const uuidSet = new Set(datas.map((d) => d.uuid_table));
|
|
33
|
+
return prev.map((section) => {
|
|
34
|
+
// remove item dari section lain
|
|
35
|
+
if (section.id !== sectionActive) {
|
|
36
|
+
return Object.assign(Object.assign({}, section), { items: section.items.filter((item) => !uuidSet.has(item.uuid_table)) });
|
|
37
|
+
}
|
|
38
|
+
// section active
|
|
39
|
+
const filteredItems = section.items.filter((item) => !uuidSet.has(item.uuid_table));
|
|
40
|
+
const newItems = datas.filter((d) => !section.items.some((item) => item.uuid_table === d.uuid_table));
|
|
41
|
+
return Object.assign(Object.assign({}, section), { items: [...filteredItems, ...newItems] });
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const handleSelectItem = (data) => {
|
|
46
|
+
setSections((prev) => prev.map((section) => {
|
|
47
|
+
if (section.id !== sectionActive)
|
|
48
|
+
return section;
|
|
49
|
+
const isExist = section.items.some((item) => item.uuid_table === data.uuid_table);
|
|
50
|
+
return Object.assign(Object.assign({}, section), { items: isExist
|
|
51
|
+
? section.items.filter((item) => item.uuid_table !== data.uuid_table)
|
|
52
|
+
: [...section.items, data] });
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
return (_jsx("div", { className: "w-full h-screen flex relative", children: _jsxs("div", { className: "flex", children: [_jsxs("div", { className: "absolute top-0 left-0 z-10 flex gap-2", children: [_jsx(Button, { type: "primary", onClick: () => setIsConnecting(!isConnecting), children: isConnecting ? "Disconnect" : "Connect" }), _jsx(Button, { type: "primary", onClick: () => setIsSelectNode(!isSelectNode), children: isSelectNode ? "Deselect" : "Select" })] }), _jsx(LayerView, { componentProps: componentSection, statusKey: "section", defaultBackground: "#1e2d4a", mappingKey: "properties", keyNode: "nodes", onEdgesChange: (table, edges) => console.log({ edges, table }), isConnectEdge: isConnecting, isSelectNode: isSelectNode, onSelectComponent: handleSelectItem, actionPrivileged: {
|
|
56
|
+
select: true,
|
|
57
|
+
}, onMakeSelection: onMakeSelection, tableMatchKey: [
|
|
58
|
+
{
|
|
59
|
+
key: 1,
|
|
60
|
+
properties: {
|
|
61
|
+
fill: "#1e2d4a",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: 2,
|
|
66
|
+
properties: {
|
|
67
|
+
fill: "#F6F6F6",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
] }), _jsx("div", { className: "w-1/5 p-4", children: _jsxs("div", { className: "rounded-lg bg-white p-4", children: [_jsx("h1", { className: "text-2xl font-bold", children: "Section" }), sections.map((section) => (_jsxs("div", { className: clsx("font-bold text-white rounded-md p-2 cursor-pointer", sectionActive === section.id && "!bg-blue-500"), style: { backgroundColor: section.color }, onClick: () => setSectionActive(section.id), children: [_jsx("h2", { className: "text-lg", children: section.name }), section.items.length > 0 && (_jsx("ul", { className: "list-disc pl-5 bg-opacity-50 bg-white p-2 rounded ", children: section.items.map((item) => (_jsx("li", { children: item.name }, item.id))) }))] }, section.id)))] }) }), _jsx("div", { className: "w-1/5 p-4", children: _jsx("div", { className: "rounded-lg bg-white p-4", children: _jsx("h1", { className: "text-2xl font-bold", children: "Nodes" }) }) })] }) }));
|
|
71
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import LayerView from "../../features/view-only-5";
|
|
4
|
+
import { data } from "./constant";
|
|
5
|
+
import { Button } from "antd";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
export default function GraphView() {
|
|
8
|
+
const [isConnecting, setIsConnecting] = useState(false);
|
|
9
|
+
const [isSelectNode, setIsSelectNode] = useState(false);
|
|
10
|
+
const [sections, setSections] = useState([
|
|
11
|
+
{
|
|
12
|
+
id: 1,
|
|
13
|
+
name: "Section 1",
|
|
14
|
+
color: "#1e2d4a",
|
|
15
|
+
items: [],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 2,
|
|
19
|
+
name: "Section 2",
|
|
20
|
+
color: "#F6F6F6",
|
|
21
|
+
items: [],
|
|
22
|
+
}
|
|
23
|
+
]);
|
|
24
|
+
const [sectionActive, setSectionActive] = useState(null);
|
|
25
|
+
const componentSection = useMemo(() => data === null || data === void 0 ? void 0 : data.map((data) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
|
|
28
|
+
}), [data, sections]);
|
|
29
|
+
const onMakeSelection = (datas) => {
|
|
30
|
+
setSections((prev) => {
|
|
31
|
+
const uuidSet = new Set(datas.map((d) => d.uuid_table));
|
|
32
|
+
return prev.map((section) => {
|
|
33
|
+
// remove item dari section lain
|
|
34
|
+
if (section.id !== sectionActive) {
|
|
35
|
+
return Object.assign(Object.assign({}, section), { items: section.items.filter((item) => !uuidSet.has(item.uuid_table)) });
|
|
36
|
+
}
|
|
37
|
+
// section active
|
|
38
|
+
const filteredItems = section.items.filter((item) => !uuidSet.has(item.uuid_table));
|
|
39
|
+
const newItems = datas.filter((d) => !section.items.some((item) => item.uuid_table === d.uuid_table));
|
|
40
|
+
return Object.assign(Object.assign({}, section), { items: [...filteredItems, ...newItems] });
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const handleSelectItem = (data) => {
|
|
45
|
+
setSections((prev) => prev.map((section) => {
|
|
46
|
+
if (section.id !== sectionActive)
|
|
47
|
+
return section;
|
|
48
|
+
const isExist = section.items.some((item) => item.uuid_table === data.uuid_table);
|
|
49
|
+
return Object.assign(Object.assign({}, section), { items: isExist
|
|
50
|
+
? section.items.filter((item) => item.uuid_table !== data.uuid_table)
|
|
51
|
+
: [...section.items, data] });
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
return (<div className="w-full h-screen flex relative">
|
|
55
|
+
<div className="flex">
|
|
56
|
+
<div className="absolute top-0 left-0 z-10 flex gap-2">
|
|
57
|
+
<Button type="primary" onClick={() => setIsConnecting(!isConnecting)}>
|
|
58
|
+
{isConnecting ? "Disconnect" : "Connect"}
|
|
59
|
+
</Button>
|
|
60
|
+
<Button type="primary" onClick={() => setIsSelectNode(!isSelectNode)}>
|
|
61
|
+
{isSelectNode ? "Deselect" : "Select"}
|
|
62
|
+
</Button>
|
|
63
|
+
</div>
|
|
64
|
+
<LayerView componentProps={componentSection} statusKey="section" defaultBackground="#1e2d4a" mappingKey="properties" keyNode="nodes" onEdgesChange={(table, edges) => console.log({ edges, table })} isConnectEdge={isConnecting} isSelectNode={isSelectNode} onSelectComponent={handleSelectItem} actionPrivileged={{
|
|
65
|
+
select: true,
|
|
66
|
+
}} onMakeSelection={onMakeSelection} tableMatchKey={[
|
|
67
|
+
{
|
|
68
|
+
key: 1,
|
|
69
|
+
properties: {
|
|
70
|
+
fill: "#1e2d4a",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: 2,
|
|
75
|
+
properties: {
|
|
76
|
+
fill: "#F6F6F6",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
]}/>
|
|
80
|
+
<div className="w-1/5 p-4">
|
|
81
|
+
<div className="rounded-lg bg-white p-4">
|
|
82
|
+
<h1 className="text-2xl font-bold">Section</h1>
|
|
83
|
+
{sections.map((section) => (<div key={section.id} className={clsx("font-bold text-white rounded-md p-2 cursor-pointer", sectionActive === section.id && "!bg-blue-500")} style={{ backgroundColor: section.color }} onClick={() => setSectionActive(section.id)}>
|
|
84
|
+
<h2 className="text-lg">{section.name}</h2>
|
|
85
|
+
{section.items.length > 0 && (<ul className="list-disc pl-5 bg-opacity-50 bg-white p-2 rounded ">
|
|
86
|
+
{section.items.map((item) => (<li key={item.id}>{item.name}</li>))}
|
|
87
|
+
</ul>)}
|
|
88
|
+
</div>))}
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div className="w-1/5 p-4">
|
|
92
|
+
<div className="rounded-lg bg-white p-4">
|
|
93
|
+
<h1 className="text-2xl font-bold">Nodes</h1>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</div>);
|
|
98
|
+
}
|
|
@@ -6,6 +6,40 @@ import SeatEditor from "../../features/package";
|
|
|
6
6
|
// import LayerView from "@/features/view-only-2";
|
|
7
7
|
// import SeatEdit from "@/features/package";
|
|
8
8
|
import { data4 } from "../constant";
|
|
9
|
+
const background = [
|
|
10
|
+
{
|
|
11
|
+
id: "1776070944676",
|
|
12
|
+
shape: "polygon",
|
|
13
|
+
fill: "#ef0606",
|
|
14
|
+
points: [
|
|
15
|
+
{
|
|
16
|
+
x: 100,
|
|
17
|
+
y: 500,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
x: 400,
|
|
21
|
+
y: 500,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
x: 400,
|
|
25
|
+
y: 400,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
x: 100,
|
|
29
|
+
y: 400,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
x: 100,
|
|
33
|
+
y: 500,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
rotation: 0,
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0,
|
|
39
|
+
width: 340,
|
|
40
|
+
height: 179,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
9
43
|
export default function NewBoard() {
|
|
10
44
|
const [initialValue, setInitialValue] = useState([]);
|
|
11
45
|
const [extraComponents, setExtraComponents] = useState([]);
|
|
@@ -24,7 +58,8 @@ export default function NewBoard() {
|
|
|
24
58
|
});
|
|
25
59
|
return test;
|
|
26
60
|
};
|
|
27
|
-
const test = [
|
|
61
|
+
const test = [
|
|
62
|
+
{
|
|
28
63
|
test: "test",
|
|
29
64
|
properties: {
|
|
30
65
|
shape: "image-table",
|
|
@@ -34,8 +69,9 @@ export default function NewBoard() {
|
|
|
34
69
|
y: 100,
|
|
35
70
|
backgroundColor: "#ffffff",
|
|
36
71
|
src: "dummyImage",
|
|
37
|
-
}
|
|
38
|
-
}
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
39
75
|
// const ayo =test?.map((item) => {
|
|
40
76
|
// return {
|
|
41
77
|
// properties: item?.properties?.
|
|
@@ -45,15 +81,15 @@ export default function NewBoard() {
|
|
|
45
81
|
component: true,
|
|
46
82
|
extraComponent: true,
|
|
47
83
|
}, action: handleUploadImage, mappingKey: "properties", onCurrentStateChange: (setState) => {
|
|
48
|
-
var _a, _b, _c
|
|
84
|
+
var _a, _b, _c;
|
|
49
85
|
if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
50
86
|
setInitialValue((_b = setState.components) !== null && _b !== void 0 ? _b : []);
|
|
51
87
|
}
|
|
52
88
|
if (setState === null || setState === void 0 ? void 0 : setState.background) {
|
|
53
|
-
setBackgroundColor(setState.background);
|
|
89
|
+
// setBackgroundColor(setState.background);
|
|
54
90
|
}
|
|
55
|
-
if (
|
|
56
|
-
setExtraComponents((
|
|
91
|
+
if (setState === null || setState === void 0 ? void 0 : setState.extraComponents) {
|
|
92
|
+
setExtraComponents((_c = setState.extraComponents) !== null && _c !== void 0 ? _c : []);
|
|
57
93
|
}
|
|
58
94
|
}, extraComponentProps: extraComponents, defaultBackground: backgroundColor,
|
|
59
95
|
// dragOnly={true}
|
|
@@ -5,6 +5,40 @@ import SeatEditor from "../../features/package";
|
|
|
5
5
|
// import LayerView from "@/features/view-only-2";
|
|
6
6
|
// import SeatEdit from "@/features/package";
|
|
7
7
|
import { data4 } from "../constant";
|
|
8
|
+
const background = [
|
|
9
|
+
{
|
|
10
|
+
id: "1776070944676",
|
|
11
|
+
shape: "polygon",
|
|
12
|
+
fill: "#ef0606",
|
|
13
|
+
points: [
|
|
14
|
+
{
|
|
15
|
+
x: 100,
|
|
16
|
+
y: 500,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
x: 400,
|
|
20
|
+
y: 500,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
x: 400,
|
|
24
|
+
y: 400,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
x: 100,
|
|
28
|
+
y: 400,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
x: 100,
|
|
32
|
+
y: 500,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
rotation: 0,
|
|
36
|
+
x: 0,
|
|
37
|
+
y: 0,
|
|
38
|
+
width: 340,
|
|
39
|
+
height: 179,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
8
42
|
export default function NewBoard() {
|
|
9
43
|
const [initialValue, setInitialValue] = useState([]);
|
|
10
44
|
const [extraComponents, setExtraComponents] = useState([]);
|
|
@@ -23,7 +57,8 @@ export default function NewBoard() {
|
|
|
23
57
|
});
|
|
24
58
|
return test;
|
|
25
59
|
};
|
|
26
|
-
const test = [
|
|
60
|
+
const test = [
|
|
61
|
+
{
|
|
27
62
|
test: "test",
|
|
28
63
|
properties: {
|
|
29
64
|
shape: "image-table",
|
|
@@ -33,8 +68,9 @@ export default function NewBoard() {
|
|
|
33
68
|
y: 100,
|
|
34
69
|
backgroundColor: "#ffffff",
|
|
35
70
|
src: "dummyImage",
|
|
36
|
-
}
|
|
37
|
-
}
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
38
74
|
// const ayo =test?.map((item) => {
|
|
39
75
|
// return {
|
|
40
76
|
// properties: item?.properties?.
|
|
@@ -42,9 +78,7 @@ export default function NewBoard() {
|
|
|
42
78
|
// })
|
|
43
79
|
return (<>
|
|
44
80
|
<div className="w-full h-screen flex flex-col relative justify-center">
|
|
45
|
-
<div className="w-full h-[1000px] bg-white border-r border-gray-200">
|
|
46
|
-
|
|
47
|
-
</div>
|
|
81
|
+
<div className="w-full h-[1000px] bg-white border-r border-gray-200"></div>
|
|
48
82
|
{/* <button className="bg-blue-500 text-white px-4 py-2 rounded"
|
|
49
83
|
onClick={() => setViewOnly(!viewOnly)}
|
|
50
84
|
>
|
|
@@ -55,15 +89,15 @@ export default function NewBoard() {
|
|
|
55
89
|
component: true,
|
|
56
90
|
extraComponent: true,
|
|
57
91
|
}} action={handleUploadImage} mappingKey="properties" onCurrentStateChange={(setState) => {
|
|
58
|
-
var _a, _b, _c
|
|
92
|
+
var _a, _b, _c;
|
|
59
93
|
if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
60
94
|
setInitialValue((_b = setState.components) !== null && _b !== void 0 ? _b : []);
|
|
61
95
|
}
|
|
62
96
|
if (setState === null || setState === void 0 ? void 0 : setState.background) {
|
|
63
|
-
setBackgroundColor(setState.background);
|
|
97
|
+
// setBackgroundColor(setState.background);
|
|
64
98
|
}
|
|
65
|
-
if (
|
|
66
|
-
setExtraComponents((
|
|
99
|
+
if (setState === null || setState === void 0 ? void 0 : setState.extraComponents) {
|
|
100
|
+
setExtraComponents((_c = setState.extraComponents) !== null && _c !== void 0 ? _c : []);
|
|
67
101
|
}
|
|
68
102
|
}} extraComponentProps={extraComponents} defaultBackground={backgroundColor}
|
|
69
103
|
// dragOnly={true}
|
|
@@ -73,8 +107,7 @@ export default function NewBoard() {
|
|
|
73
107
|
// return null
|
|
74
108
|
// }}
|
|
75
109
|
defaultSeatCountKey="capacity"/>
|
|
76
|
-
|
|
77
|
-
|
|
110
|
+
</div>
|
|
78
111
|
</div>
|
|
79
112
|
</>);
|
|
80
113
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Button, Popover } from "antd";
|
|
4
4
|
const ButtonTools = (props) => {
|
|
5
5
|
const { buttonProps, items, popoverProps } = props;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const content = (_jsx("div", { children: items.map((item, i) => (_jsx(Button, { type: "text", onClick: item.onClick, children: item.label }, i))) }));
|
|
7
|
+
return (_jsx(Popover, Object.assign({ content: items.length > 0 ? content : null, trigger: "click", placement: "right", styles: {
|
|
8
|
+
body: {
|
|
9
|
+
maxWidth: "fit-content",
|
|
10
|
+
},
|
|
11
|
+
} }, popoverProps, { children: _jsx(Button, Object.assign({}, buttonProps)) })));
|
|
10
12
|
};
|
|
11
13
|
export default ButtonTools;
|
|
@@ -2,16 +2,28 @@
|
|
|
2
2
|
import { Button, Popover } from "antd";
|
|
3
3
|
const ButtonTools = (props) => {
|
|
4
4
|
const { buttonProps, items, popoverProps } = props;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const content = (<div>
|
|
6
|
+
{items.map((item, i) => (<Button key={i} type="text" onClick={item.onClick}>
|
|
7
|
+
{item.label}
|
|
8
|
+
</Button>))}
|
|
9
|
+
</div>);
|
|
10
|
+
return (<Popover content={items.length > 0 ? content : null} trigger="click" placement="right" styles={{
|
|
11
|
+
body: {
|
|
12
|
+
maxWidth: "fit-content",
|
|
13
|
+
},
|
|
14
|
+
}} {...popoverProps}>
|
|
15
|
+
{/* <Popover
|
|
16
|
+
title={buttonProps?.name}
|
|
17
|
+
trigger={"hover"}
|
|
18
|
+
placement="right"
|
|
19
|
+
styles={{
|
|
20
|
+
body: {
|
|
21
|
+
minWidth: "max-content",
|
|
22
|
+
},
|
|
23
|
+
}}
|
|
24
|
+
> */}
|
|
7
25
|
<Button {...buttonProps}/>
|
|
8
|
-
</Popover>
|
|
9
|
-
}
|
|
10
|
-
return (<Popover content={<div>
|
|
11
|
-
<Button>Button 1</Button>
|
|
12
|
-
<Button>Button 2</Button>
|
|
13
|
-
</div>} trigger="click">
|
|
14
|
-
<Button {...buttonProps}/>
|
|
26
|
+
{/* </Popover> */}
|
|
15
27
|
</Popover>);
|
|
16
28
|
};
|
|
17
29
|
export default ButtonTools;
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { 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(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 }) => (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// type="dashed"
|
|
14
|
-
, {
|
|
15
|
-
// type="dashed"
|
|
16
|
-
onClick: () => remove(fields.indexOf(field)), className: "w-full", children: "Remove" }) }))] }, field.key))), _jsx(Flex, { gap: 2, className: "w-full mt-2", children: _jsx(Button, { type: "primary", onClick: () => add({
|
|
17
|
-
label: "",
|
|
18
|
-
fontColor: "#000000",
|
|
19
|
-
x: 0,
|
|
20
|
-
y: 0,
|
|
21
|
-
fontSize: 12,
|
|
22
|
-
rotation: 0,
|
|
23
|
-
}), className: "w-full", children: "Add" }) })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
|
|
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", 0, "label"], className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsx(_Fragment, { children: fields.map((field) => (_jsxs("div", { className: "w-full flex-col mb-2", 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
|
+
if (!value)
|
|
7
|
+
return 0;
|
|
8
|
+
const num = Number(value.replace(/\D/g, ""));
|
|
9
|
+
if (Number.isNaN(num))
|
|
10
|
+
return 0;
|
|
11
|
+
return Math.min(360, Math.max(0, num));
|
|
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))) })) }) }), _jsx("div", { className: "divider-dashed" })] }));
|
|
24
13
|
};
|
|
25
14
|
export default SectionLabel;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { 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
7
|
|
|
8
|
-
<Form.Item label="Labels in table" name={"labels"} className="w-full">
|
|
8
|
+
<Form.Item label="Labels in table" name={["labels", 0, "label"]} className="w-full">
|
|
9
9
|
<Form.List name="labels">
|
|
10
10
|
{(fields, { add, remove }) => (<>
|
|
11
11
|
{fields.map((field) => (<div key={field.key} className="w-full flex-col mb-2">
|
|
@@ -40,33 +40,43 @@ const SectionLabel = () => {
|
|
|
40
40
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
41
41
|
</Form.Item>
|
|
42
42
|
</Flex>
|
|
43
|
-
{fields.length > 1 && (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
{/* {fields.length > 1 && (
|
|
44
|
+
<Flex gap={2} className="w-full">
|
|
45
|
+
<Button
|
|
46
|
+
// type="dashed"
|
|
47
|
+
onClick={() => remove(fields.indexOf(field))}
|
|
48
|
+
className="w-full"
|
|
49
|
+
>
|
|
50
|
+
Remove
|
|
51
|
+
</Button>
|
|
52
|
+
</Flex>
|
|
53
|
+
)} */}
|
|
50
54
|
</div>))}
|
|
51
|
-
<Flex gap={2} className="w-full mt-2">
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
{/* <Flex gap={2} className="w-full mt-2">
|
|
56
|
+
<Button
|
|
57
|
+
// type="dashed"
|
|
58
|
+
onClick={() => remove(fields.length - 1)}
|
|
59
|
+
className="w-full"
|
|
60
|
+
>
|
|
61
|
+
Remove
|
|
62
|
+
</Button>
|
|
63
|
+
<Button
|
|
64
|
+
type="primary"
|
|
65
|
+
onClick={() =>
|
|
66
|
+
add({
|
|
67
|
+
label: "",
|
|
68
|
+
fontColor: "#000000",
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 0,
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
rotation: 0,
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
className="w-full"
|
|
76
|
+
>
|
|
77
|
+
Add
|
|
78
|
+
</Button>
|
|
79
|
+
</Flex> */}
|
|
70
80
|
</>)}
|
|
71
81
|
</Form.List>
|
|
72
82
|
</Form.Item>
|
|
@@ -46,26 +46,26 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
46
46
|
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
47
47
|
return (_jsx(Option, { value: item.value, disabled: disabled, children: item.value === "table-seat-rect-circle" ?
|
|
48
48
|
`Type 5 (only for 4 ${seatKey})` : item.label }, item.value));
|
|
49
|
-
}) }) }) })), _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) => {
|
|
49
|
+
}) }) }) })), _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, name: "width", step: 1, parser: (value) => {
|
|
50
50
|
var _a;
|
|
51
51
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
52
52
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
53
|
-
} }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
|
|
53
|
+
} }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px", controls: true, step: 1, name: "height", parser: (value) => {
|
|
54
54
|
var _a;
|
|
55
55
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
56
56
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
57
|
-
} }) }), !(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) => {
|
|
57
|
+
} }) }), !(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", name: "radius", parser: (value) => {
|
|
58
58
|
var _a;
|
|
59
59
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
60
60
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
61
|
-
} }) }))] }), _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) => {
|
|
61
|
+
} }) }))] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Position X", name: "x", className: "w-full", children: _jsx(InputNumber, { name: "x", step: 1 }) }), _jsx(Form.Item, { label: "Position Y", name: "y", className: "w-full", children: _jsx(InputNumber, { name: "y", step: 1 }) }), _jsx(Form.Item, { label: "Rotation", name: "rotation", className: "w-full", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, step: 1, max: 360, name: "rotation", parser: (value) => {
|
|
62
62
|
if (!value)
|
|
63
63
|
return 0;
|
|
64
64
|
const num = Number(value.replace(/\D/g, ""));
|
|
65
65
|
if (Number.isNaN(num))
|
|
66
66
|
return 0;
|
|
67
67
|
return Math.min(360, Math.max(0, num));
|
|
68
|
-
} }) })] }), _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) => {
|
|
68
|
+
} }) })] }), _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 Size", 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, name: "opacity", parser: (value) => {
|
|
69
69
|
if (value === undefined || value === null || value === "")
|
|
70
70
|
return null;
|
|
71
71
|
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
@@ -58,21 +58,21 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
58
58
|
</Flex>)}
|
|
59
59
|
<Flex gap={2} className="w-full">
|
|
60
60
|
<Form.Item label="Width" name="width" className="w-full">
|
|
61
|
-
<InputNumber suffix="px" controls parser={(value) => {
|
|
61
|
+
<InputNumber suffix="px" controls name="width" step={1} parser={(value) => {
|
|
62
62
|
var _a;
|
|
63
63
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
64
64
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
65
65
|
}}/>
|
|
66
66
|
</Form.Item>
|
|
67
67
|
<Form.Item label="Height" name="height" className="w-full">
|
|
68
|
-
<InputNumber suffix="px" parser={(value) => {
|
|
68
|
+
<InputNumber suffix="px" controls step={1} name="height" parser={(value) => {
|
|
69
69
|
var _a;
|
|
70
70
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
71
71
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
72
72
|
}}/>
|
|
73
73
|
</Form.Item>
|
|
74
74
|
{!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && (<Form.Item label="Radius" name="radius" className="w-full">
|
|
75
|
-
<InputNumber suffix="px" parser={(value) => {
|
|
75
|
+
<InputNumber suffix="px" name="radius" parser={(value) => {
|
|
76
76
|
var _a;
|
|
77
77
|
const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
|
|
78
78
|
return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
|
|
@@ -81,13 +81,13 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
81
81
|
</Flex>
|
|
82
82
|
<Flex gap={2}>
|
|
83
83
|
<Form.Item label="Position X" name="x" className="w-full">
|
|
84
|
-
<InputNumber />
|
|
84
|
+
<InputNumber name="x" step={1}/>
|
|
85
85
|
</Form.Item>
|
|
86
86
|
<Form.Item label="Position Y" name="y" className="w-full">
|
|
87
|
-
<InputNumber />
|
|
87
|
+
<InputNumber name="y" step={1}/>
|
|
88
88
|
</Form.Item>
|
|
89
89
|
<Form.Item label="Rotation" name="rotation" className="w-full">
|
|
90
|
-
<InputNumber suffix="°" min={0} max={360} parser={(value) => {
|
|
90
|
+
<InputNumber suffix="°" min={0} step={1} max={360} name="rotation" parser={(value) => {
|
|
91
91
|
if (!value)
|
|
92
92
|
return 0;
|
|
93
93
|
const num = Number(value.replace(/\D/g, ""));
|
|
@@ -104,13 +104,13 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
104
104
|
<Form.Item label="Stroke Fill" name={"stroke"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
105
105
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
106
106
|
</Form.Item>
|
|
107
|
-
<Form.Item label="Stroke" name={"strokeWidth"} className="w-full">
|
|
107
|
+
<Form.Item label="Stroke Size" name={"strokeWidth"} className="w-full">
|
|
108
108
|
<InputNumber />
|
|
109
109
|
</Form.Item>
|
|
110
110
|
</Flex>
|
|
111
111
|
<Flex>
|
|
112
112
|
<Form.Item label="opacity" name={"opacity"} className="w-full">
|
|
113
|
-
<InputNumber step={10} max={100} min={0} parser={(value) => {
|
|
113
|
+
<InputNumber step={10} max={100} min={0} name="opacity" parser={(value) => {
|
|
114
114
|
if (value === undefined || value === null || value === "")
|
|
115
115
|
return null;
|
|
116
116
|
const cleaned = value.replace(/[^0-9.]/g, "");
|