seat-editor 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/new-board/page.js +19 -4
- package/dist/app/new-board/page.jsx +30 -22
- package/dist/features/panel/index.js +1 -1
- package/dist/features/panel/index.jsx +1 -1
- package/dist/features/panel/select-tool.d.ts +3 -1
- package/dist/features/panel/select-tool.js +7 -3
- package/dist/features/panel/select-tool.jsx +11 -4
- package/package.json +1 -1
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
12
|
import { useEffect, useState } from "react";
|
|
13
|
+
import SeatEditor from "../../features/package";
|
|
4
14
|
import { constantData } from "../constant";
|
|
5
|
-
import LayerView from "@/features/view-only";
|
|
6
15
|
export default function NewBoard() {
|
|
7
16
|
const [initialValue, setInitialValue] = useState([]);
|
|
8
17
|
const [viewOnly, setViewOnly] = useState(true);
|
|
@@ -10,7 +19,13 @@ export default function NewBoard() {
|
|
|
10
19
|
useEffect(() => {
|
|
11
20
|
setInitialValue(constantData);
|
|
12
21
|
}, []);
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx(
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("button", { className: "bg-blue-500 text-white px-4 py-2 rounded", onClick: () => setViewOnly(!viewOnly), children: viewOnly ? "Edit Mode" : "View Mode" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, mappingKey: "properties", onCurrentStateChange: (setState) => {
|
|
23
|
+
var _a;
|
|
24
|
+
console.log("setState", setState);
|
|
25
|
+
setInitialValue((_a = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _a !== void 0 ? _a : []);
|
|
26
|
+
}, extraComponentProps: [], defaultBackground: "#ffffff",
|
|
27
|
+
// dragOnly={true}
|
|
28
|
+
statusKey: "status", action: (action) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
console.log("action", action);
|
|
30
|
+
}) }) })] }) }));
|
|
16
31
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
import { useEffect, useState } from "react";
|
|
12
|
+
import SeatEditor from "../../features/package";
|
|
3
13
|
import { constantData } from "../constant";
|
|
4
|
-
import LayerView from "@/features/view-only";
|
|
5
14
|
export default function NewBoard() {
|
|
6
15
|
const [initialValue, setInitialValue] = useState([]);
|
|
7
16
|
const [viewOnly, setViewOnly] = useState(true);
|
|
@@ -12,31 +21,30 @@ export default function NewBoard() {
|
|
|
12
21
|
return (<>
|
|
13
22
|
<div className="w-full h-screen flex flex-col relative justify-center">
|
|
14
23
|
{/* <div className="w-full h-[1000px] bg-white border-r border-gray-200"> */}
|
|
15
|
-
<LayerView
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
{/* <LayerView
|
|
25
|
+
componentProps={initialValue}
|
|
26
|
+
mappingKey="properties"
|
|
27
|
+
extraComponentProps={[]}
|
|
28
|
+
defaultBackground="#ffffff"
|
|
29
|
+
// dragOnly={true}
|
|
30
|
+
statusKey="status"
|
|
31
|
+
|
|
32
|
+
/> */}
|
|
18
33
|
{/* </div> */}
|
|
19
34
|
<button className="bg-blue-500 text-white px-4 py-2 rounded" onClick={() => setViewOnly(!viewOnly)}>
|
|
20
35
|
{viewOnly ? "Edit Mode" : "View Mode"}
|
|
21
36
|
</button>
|
|
22
|
-
|
|
23
|
-
<SeatEditor
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// dragOnly={true}
|
|
34
|
-
statusKey="status"
|
|
35
|
-
action={async (action: any) => {
|
|
36
|
-
console.log("action", action);
|
|
37
|
-
}}
|
|
38
|
-
/>
|
|
39
|
-
</div> */}
|
|
37
|
+
<div className="flex-1 h-full">
|
|
38
|
+
<SeatEditor componentProps={initialValue} viewOnly={viewOnly} mappingKey="properties" onCurrentStateChange={(setState) => {
|
|
39
|
+
var _a;
|
|
40
|
+
console.log("setState", setState);
|
|
41
|
+
setInitialValue((_a = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _a !== void 0 ? _a : []);
|
|
42
|
+
}} extraComponentProps={[]} defaultBackground="#ffffff"
|
|
43
|
+
// dragOnly={true}
|
|
44
|
+
statusKey="status" action={(action) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
console.log("action", action);
|
|
46
|
+
})}/>
|
|
47
|
+
</div>
|
|
40
48
|
|
|
41
49
|
</div>
|
|
42
50
|
</>);
|
|
@@ -70,7 +70,7 @@ const ControlPanels = (props) => {
|
|
|
70
70
|
const renderFormPanel = () => {
|
|
71
71
|
switch (tool.active) {
|
|
72
72
|
case "select":
|
|
73
|
-
return _jsx(SelectToolForm, {});
|
|
73
|
+
return _jsx(SelectToolForm, { action: action, responseMapping: responseMapping });
|
|
74
74
|
case "square":
|
|
75
75
|
case "circle":
|
|
76
76
|
return _jsx(SquareToolForm, {});
|
|
@@ -69,7 +69,7 @@ const ControlPanels = (props) => {
|
|
|
69
69
|
const renderFormPanel = () => {
|
|
70
70
|
switch (tool.active) {
|
|
71
71
|
case "select":
|
|
72
|
-
return <SelectToolForm />;
|
|
72
|
+
return <SelectToolForm action={action} responseMapping={responseMapping}/>;
|
|
73
73
|
case "square":
|
|
74
74
|
case "circle":
|
|
75
75
|
return <SquareToolForm />;
|
|
@@ -5,7 +5,7 @@ import SquareToolForm from "./square-circle-tool";
|
|
|
5
5
|
import SeatCircle from "./table-seat-circle";
|
|
6
6
|
import UploadTool from "./upload-tool";
|
|
7
7
|
import TextTool from "./text-tool";
|
|
8
|
-
const SelectToolForm = ({ title = "Title" }) => {
|
|
8
|
+
const SelectToolForm = ({ title = "Title", action, responseMapping }) => {
|
|
9
9
|
const components = useAppSelector((state) => state.board.components);
|
|
10
10
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
11
11
|
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
@@ -19,7 +19,9 @@ const SelectToolForm = ({ title = "Title" }) => {
|
|
|
19
19
|
return acc;
|
|
20
20
|
}, {});
|
|
21
21
|
const variableFormatToString = (variable) => {
|
|
22
|
-
return variable
|
|
22
|
+
return variable
|
|
23
|
+
.replace(/-/g, " ")
|
|
24
|
+
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
23
25
|
};
|
|
24
26
|
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))) })] }));
|
|
25
27
|
};
|
|
@@ -32,7 +34,9 @@ const SelectToolForm = ({ title = "Title" }) => {
|
|
|
32
34
|
return _jsx(SeatCircle, {});
|
|
33
35
|
case "image-table":
|
|
34
36
|
case "background":
|
|
35
|
-
return _jsx(UploadTool, { name: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape, defaultValue: selectedComponent, type: (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background"
|
|
37
|
+
return (_jsx(UploadTool, { action: action, responseMapping: responseMapping, name: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape, defaultValue: selectedComponent, type: (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background"
|
|
38
|
+
? "background"
|
|
39
|
+
: "component" }));
|
|
36
40
|
case "text":
|
|
37
41
|
return _jsx(TextTool, {});
|
|
38
42
|
default:
|
|
@@ -4,7 +4,7 @@ import SquareToolForm from "./square-circle-tool";
|
|
|
4
4
|
import SeatCircle from "./table-seat-circle";
|
|
5
5
|
import UploadTool from "./upload-tool";
|
|
6
6
|
import TextTool from "./text-tool";
|
|
7
|
-
const SelectToolForm = ({ title = "Title" }) => {
|
|
7
|
+
const SelectToolForm = ({ title = "Title", action, responseMapping }) => {
|
|
8
8
|
const components = useAppSelector((state) => state.board.components);
|
|
9
9
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
10
10
|
const extraComponents = useAppSelector((state) => state.board.extraComponents);
|
|
@@ -18,13 +18,18 @@ const SelectToolForm = ({ title = "Title" }) => {
|
|
|
18
18
|
return acc;
|
|
19
19
|
}, {});
|
|
20
20
|
const variableFormatToString = (variable) => {
|
|
21
|
-
return variable
|
|
21
|
+
return variable
|
|
22
|
+
.replace(/-/g, " ")
|
|
23
|
+
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
22
24
|
};
|
|
23
25
|
return (<div className="flex flex-col">
|
|
24
26
|
<h1 className="heading-s">{title}</h1>
|
|
25
27
|
<div className="flex flex-col gap-2 mt-5">
|
|
26
28
|
{Object.entries(countByShape).map(([shape, count]) => (<div key={shape}>
|
|
27
|
-
<span className="font-bold">
|
|
29
|
+
<span className="font-bold">
|
|
30
|
+
{variableFormatToString(shape)}:
|
|
31
|
+
</span>{" "}
|
|
32
|
+
{count}
|
|
28
33
|
</div>))}
|
|
29
34
|
</div>
|
|
30
35
|
</div>);
|
|
@@ -38,7 +43,9 @@ const SelectToolForm = ({ title = "Title" }) => {
|
|
|
38
43
|
return <SeatCircle />;
|
|
39
44
|
case "image-table":
|
|
40
45
|
case "background":
|
|
41
|
-
return <UploadTool name={selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape} defaultValue={selectedComponent} type={(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background"
|
|
46
|
+
return (<UploadTool action={action} responseMapping={responseMapping} name={selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape} defaultValue={selectedComponent} type={(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background"
|
|
47
|
+
? "background"
|
|
48
|
+
: "component"}/>);
|
|
42
49
|
case "text":
|
|
43
50
|
return <TextTool />;
|
|
44
51
|
default:
|