seat-editor 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/only-view/constant.js +26 -26
- package/dist/app/only-view/page.jsx +10 -1
- package/dist/components/layer/index.jsx +1 -0
- package/dist/features/view/index.d.ts +4 -6
- package/dist/features/view/index.jsx +16 -11
- package/package.json +1 -1
- package/dist/app/constant.d.ts +0 -23
- package/dist/app/constant.js +0 -34
- package/dist/app/layout.d.ts +0 -6
- package/dist/app/layout.jsx +0 -27
- package/dist/app/new-board/page.jsx +0 -12
- package/dist/app/old-board/page.d.ts +0 -3
- package/dist/app/old-board/page.jsx +0 -515
- package/dist/app/page.jsx +0 -13
- package/dist/components/button-tools/index.d.ts +0 -11
- package/dist/components/button-tools/index.jsx +0 -17
- package/dist/components/form-tools/label.d.ts +0 -2
- package/dist/components/form-tools/label.jsx +0 -44
- package/dist/components/form-tools/shape.d.ts +0 -2
- package/dist/components/form-tools/shape.jsx +0 -43
- package/dist/components/input/number-indicator.d.ts +0 -7
- package/dist/components/input/number-indicator.jsx +0 -36
- package/dist/components/lib/index.jsx +0 -33
- package/dist/components/modal-preview/index.d.ts +0 -4
- package/dist/components/modal-preview/index.jsx +0 -11
- package/dist/features/board/board-slice.d.ts +0 -12
- package/dist/features/board/board-slice.js +0 -44
- package/dist/features/board/index.jsx +0 -290
- package/dist/features/navbar/index.d.ts +0 -2
- package/dist/features/navbar/index.jsx +0 -5
- package/dist/features/package/index.jsx +0 -39
- package/dist/features/panel/index.d.ts +0 -2
- package/dist/features/panel/index.jsx +0 -91
- package/dist/features/panel/panel-slice.d.ts +0 -16
- package/dist/features/panel/panel-slice.js +0 -31
- package/dist/features/panel/select-tool.d.ts +0 -4
- package/dist/features/panel/select-tool.jsx +0 -45
- package/dist/features/panel/square-circle-tool.d.ts +0 -2
- package/dist/features/panel/square-circle-tool.jsx +0 -10
- package/dist/features/panel/table-seat-circle.d.ts +0 -2
- package/dist/features/panel/table-seat-circle.jsx +0 -31
- package/dist/features/panel/text-tool.d.ts +0 -2
- package/dist/features/panel/text-tool.jsx +0 -22
- package/dist/features/panel/upload-tool.d.ts +0 -6
- package/dist/features/panel/upload-tool.jsx +0 -80
- package/dist/features/side-tool/index.d.ts +0 -2
- package/dist/features/side-tool/index.jsx +0 -211
- package/dist/features/side-tool/side-tool-slice.d.ts +0 -12
- package/dist/features/side-tool/side-tool-slice.js +0 -20
- package/dist/hooks/use-redux.d.ts +0 -4
- package/dist/hooks/use-redux.js +0 -3
- package/dist/index.js +0 -7
- package/dist/libs/middleware.d.ts +0 -2
- package/dist/libs/middleware.js +0 -5
- package/dist/libs/rootReducer.d.ts +0 -10
- package/dist/libs/rootReducer.js +0 -12
- package/dist/libs/store.d.ts +0 -16
- package/dist/libs/store.js +0 -20
- package/dist/provider/antd-provider.d.ts +0 -3
- package/dist/provider/antd-provider.jsx +0 -30
- package/dist/provider/redux-provider.d.ts +0 -3
- package/dist/provider/redux-provider.jsx +0 -6
- package/dist/provider/store-provider.d.ts +0 -3
- package/dist/provider/store-provider.jsx +0 -8
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useAppSelector } from "../../hooks/use-redux";
|
|
3
|
-
import SquareToolForm from "./square-circle-tool";
|
|
4
|
-
import SeatCircle from "./table-seat-circle";
|
|
5
|
-
import UploadTool from "./upload-tool";
|
|
6
|
-
import TextTool from "./text-tool";
|
|
7
|
-
const SelectToolForm = ({ title = "Title" }) => {
|
|
8
|
-
const components = useAppSelector((state) => state.board.components);
|
|
9
|
-
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
10
|
-
const SummaryComponents = () => {
|
|
11
|
-
const countByShape = components === null || components === void 0 ? void 0 : components.reduce((acc, item) => {
|
|
12
|
-
acc[item.shape] = (acc[item.shape] || 0) + 1;
|
|
13
|
-
return acc;
|
|
14
|
-
}, {});
|
|
15
|
-
return (<div className="flex flex-col">
|
|
16
|
-
<h1 className="heading-s">{title}</h1>
|
|
17
|
-
<div className="flex flex-col gap-2 mt-5">
|
|
18
|
-
{Object.entries(countByShape).map(([shape, count]) => (<div key={shape}>
|
|
19
|
-
<span className="font-bold">{shape}:</span> {count}
|
|
20
|
-
</div>))}
|
|
21
|
-
</div>
|
|
22
|
-
</div>);
|
|
23
|
-
};
|
|
24
|
-
const renderComponent = () => {
|
|
25
|
-
switch (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) {
|
|
26
|
-
case "square":
|
|
27
|
-
case "circle":
|
|
28
|
-
return <SquareToolForm />;
|
|
29
|
-
case "table-seat-circle":
|
|
30
|
-
return <SeatCircle />;
|
|
31
|
-
case "image-table":
|
|
32
|
-
case "background":
|
|
33
|
-
return <UploadTool name={selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.name}/>;
|
|
34
|
-
case "text":
|
|
35
|
-
return <TextTool />;
|
|
36
|
-
default:
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return (<div className="flex flex-col gap-2">
|
|
41
|
-
<SummaryComponents />
|
|
42
|
-
{renderComponent()}
|
|
43
|
-
</div>);
|
|
44
|
-
};
|
|
45
|
-
export default SelectToolForm;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import SectionLabel from "../../components/form-tools/label";
|
|
3
|
-
import SectionShape from "../../components/form-tools/shape";
|
|
4
|
-
const SquareToolForm = () => {
|
|
5
|
-
return (<>
|
|
6
|
-
<SectionShape />
|
|
7
|
-
<SectionLabel />
|
|
8
|
-
</>);
|
|
9
|
-
};
|
|
10
|
-
export default SquareToolForm;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ColorPicker, Flex, Form, InputNumber } from "antd";
|
|
3
|
-
import SectionLabel from "../../components/form-tools/label";
|
|
4
|
-
import SectionShape from "../../components/form-tools/shape";
|
|
5
|
-
const SeatCircle = () => {
|
|
6
|
-
return (<>
|
|
7
|
-
<div className="py-2">
|
|
8
|
-
<h1 className="heading-s"> Round table</h1>
|
|
9
|
-
<Flex>
|
|
10
|
-
<Form.Item name="seatCount" label="Seat Count" className="w-full">
|
|
11
|
-
<InputNumber />
|
|
12
|
-
</Form.Item>
|
|
13
|
-
<Form.Item name="openSpace" label="Open Space" className="w-full">
|
|
14
|
-
<InputNumber max={1} min={0} step={0.1}/>
|
|
15
|
-
</Form.Item>
|
|
16
|
-
|
|
17
|
-
</Flex>
|
|
18
|
-
<Flex gap={2}>
|
|
19
|
-
<Form.Item label="Seat Fill" name={"seatFill"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
20
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
21
|
-
</Form.Item>
|
|
22
|
-
<Form.Item label="Table Fill" name={"fill"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
|
|
23
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
24
|
-
</Form.Item>
|
|
25
|
-
</Flex>
|
|
26
|
-
<SectionShape />
|
|
27
|
-
<SectionLabel />
|
|
28
|
-
</div>
|
|
29
|
-
</>);
|
|
30
|
-
};
|
|
31
|
-
export default SeatCircle;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ColorPicker, Form, Input, InputNumber } from "antd";
|
|
3
|
-
const TextTool = () => {
|
|
4
|
-
return (<div className="py-2">
|
|
5
|
-
<Form.Item name="text" label="Text">
|
|
6
|
-
<Input />
|
|
7
|
-
</Form.Item>
|
|
8
|
-
<Form.Item name={"fontColor"} label="Color" getValueFromEvent={(color) => color.toHexString()}>
|
|
9
|
-
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
10
|
-
</Form.Item>
|
|
11
|
-
<Form.Item name={"x"} label="X">
|
|
12
|
-
<InputNumber />
|
|
13
|
-
</Form.Item>
|
|
14
|
-
<Form.Item name={"y"} label="Y">
|
|
15
|
-
<InputNumber />
|
|
16
|
-
</Form.Item>
|
|
17
|
-
<Form.Item name={"fontSize"} label="Size">
|
|
18
|
-
<InputNumber suffix="px"/>
|
|
19
|
-
</Form.Item>
|
|
20
|
-
</div>);
|
|
21
|
-
};
|
|
22
|
-
export default TextTool;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Upload, message, } from "antd";
|
|
3
|
-
import { InboxOutlined } from "@ant-design/icons";
|
|
4
|
-
import { useAppDispatch } from "../../hooks/use-redux";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import SectionLabel from "../../components/form-tools/label";
|
|
7
|
-
import SectionShape from "../../components/form-tools/shape";
|
|
8
|
-
const { Dragger } = Upload;
|
|
9
|
-
const UploadTool = ({ name, type }) => {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const [imageUrl, setImageUrl] = useState(null);
|
|
12
|
-
const dispatch = useAppDispatch();
|
|
13
|
-
const widthWorkspace = ((_a = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
|
|
14
|
-
const heightWorkspace = ((_b = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
|
|
15
|
-
const props = {
|
|
16
|
-
name: "file",
|
|
17
|
-
multiple: false,
|
|
18
|
-
maxCount: 1,
|
|
19
|
-
showUploadList: false,
|
|
20
|
-
onChange(info) {
|
|
21
|
-
const { status } = info.file;
|
|
22
|
-
if (status !== "uploading" && info.file.originFileObj) {
|
|
23
|
-
const file = info.file.originFileObj;
|
|
24
|
-
if (file) {
|
|
25
|
-
const img = new window.Image();
|
|
26
|
-
img.onload = () => {
|
|
27
|
-
const scaleX = widthWorkspace / img.width;
|
|
28
|
-
const scaleY = heightWorkspace / img.height;
|
|
29
|
-
// Ambil skala terkecil supaya semua image masuk workspace
|
|
30
|
-
const scale = Math.min(1, scaleX, scaleY); // maksimum 1 (jangan perbesar)
|
|
31
|
-
// Terapkan skala ke dimensi gambar
|
|
32
|
-
const width = img.width * scale;
|
|
33
|
-
const height = img.height * scale;
|
|
34
|
-
dispatch({
|
|
35
|
-
type: type === "component" ? "board/addComponent" : "board/setExtraComponent",
|
|
36
|
-
payload: {
|
|
37
|
-
id: new Date().getTime(),
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
width,
|
|
41
|
-
height,
|
|
42
|
-
rotation: 0,
|
|
43
|
-
shape: name,
|
|
44
|
-
src: img.src,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
img.src = URL.createObjectURL(file);
|
|
49
|
-
setImageUrl(img.src);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (status === "done") {
|
|
53
|
-
message.success(`${info.file.name} file uploaded successfully.`);
|
|
54
|
-
}
|
|
55
|
-
else if (status === "error") {
|
|
56
|
-
message.error(`${info.file.name} file upload failed.`);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
onDrop(e) {
|
|
60
|
-
console.log("Dropped files", e.dataTransfer.files);
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
return (<>
|
|
64
|
-
<Dragger {...props}>
|
|
65
|
-
<p className="ant-upload-drag-icon">
|
|
66
|
-
<InboxOutlined />
|
|
67
|
-
</p>
|
|
68
|
-
<p className="ant-upload-text">
|
|
69
|
-
Click or drag file to this area to upload
|
|
70
|
-
</p>
|
|
71
|
-
<p className="ant-upload-hint">
|
|
72
|
-
Support for a single or bulk upload. Strictly prohibited from
|
|
73
|
-
uploading company data or other banned files.
|
|
74
|
-
</p>
|
|
75
|
-
</Dragger>
|
|
76
|
-
<SectionShape />
|
|
77
|
-
<SectionLabel />
|
|
78
|
-
</>);
|
|
79
|
-
};
|
|
80
|
-
export default UploadTool;
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, } from "lucide-react";
|
|
3
|
-
import ButtonTools from "../../components/button-tools";
|
|
4
|
-
import { Divider, ColorPicker, Button, } from "antd";
|
|
5
|
-
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
const SideTool = () => {
|
|
8
|
-
const [color, setColor] = useState("#000000");
|
|
9
|
-
const dispatch = useAppDispatch();
|
|
10
|
-
const { active } = useAppSelector((state) => state.tool);
|
|
11
|
-
const { selectedComponent } = useAppSelector((state) => state.panel);
|
|
12
|
-
const { components } = useAppSelector((state) => state.board);
|
|
13
|
-
const [preview, setPreview] = useState(false);
|
|
14
|
-
const tools = [
|
|
15
|
-
{
|
|
16
|
-
id: "select",
|
|
17
|
-
name: "Select Tool",
|
|
18
|
-
icon: <MousePointer />,
|
|
19
|
-
},
|
|
20
|
-
];
|
|
21
|
-
const actionsTools = [
|
|
22
|
-
// {
|
|
23
|
-
// id: "table-split",
|
|
24
|
-
// name: "Table Split",
|
|
25
|
-
// icon: <TableCellsSplit />,
|
|
26
|
-
// },
|
|
27
|
-
{
|
|
28
|
-
id: "square",
|
|
29
|
-
name: "Square",
|
|
30
|
-
icon: <SquareMousePointer />,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: "circle",
|
|
34
|
-
name: "Circle",
|
|
35
|
-
icon: <Circle />,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: "table-seat-circle",
|
|
39
|
-
name: "Table Seat Circle",
|
|
40
|
-
icon: <Ratio />,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: "image-table",
|
|
44
|
-
name: "Image Table",
|
|
45
|
-
icon: <Upload />,
|
|
46
|
-
},
|
|
47
|
-
// {
|
|
48
|
-
// id: "table-seat-square",
|
|
49
|
-
// name: "Table Seat Square",
|
|
50
|
-
// icon: <Dock />,
|
|
51
|
-
// },
|
|
52
|
-
// {
|
|
53
|
-
// id: "diamond",
|
|
54
|
-
// name: "Diamond",
|
|
55
|
-
// icon: <Diamond />,
|
|
56
|
-
// },
|
|
57
|
-
];
|
|
58
|
-
const controlTools = [
|
|
59
|
-
{
|
|
60
|
-
id: "background",
|
|
61
|
-
name: "Background",
|
|
62
|
-
icon: <Image />,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "text",
|
|
66
|
-
name: "Text",
|
|
67
|
-
icon: <Type />,
|
|
68
|
-
},
|
|
69
|
-
// {
|
|
70
|
-
// id: "background-color",
|
|
71
|
-
// name: "Background Color",
|
|
72
|
-
// icon: <PaintBucket/>
|
|
73
|
-
// }
|
|
74
|
-
];
|
|
75
|
-
const hanldeSelectTool = (id) => {
|
|
76
|
-
if (id === "background" || id === "text" || id === "image-table") {
|
|
77
|
-
dispatch({
|
|
78
|
-
type: "panel/setShow",
|
|
79
|
-
payload: true
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
dispatch({
|
|
83
|
-
type: "tool/setActiveTool",
|
|
84
|
-
payload: id,
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
const handleChangeColorBackground = (color) => {
|
|
88
|
-
setColor(color.toHexString());
|
|
89
|
-
dispatch({
|
|
90
|
-
type: "board/setBackgroundColor",
|
|
91
|
-
payload: color.toHexString(),
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
const handleOpenModalPreview = () => {
|
|
95
|
-
dispatch({
|
|
96
|
-
type: "tool/setTooglePreview",
|
|
97
|
-
payload: true,
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
const handleRemoveComponent = () => {
|
|
101
|
-
dispatch({
|
|
102
|
-
type: "board/removeComponent",
|
|
103
|
-
payload: selectedComponent,
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
const handleDuplicateComponent = () => {
|
|
107
|
-
const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
|
|
108
|
-
dispatch({
|
|
109
|
-
type: "board/addComponent",
|
|
110
|
-
payload: newComponent
|
|
111
|
-
});
|
|
112
|
-
dispatch({
|
|
113
|
-
type: "panel/setSelectedComponent",
|
|
114
|
-
payload: newComponent
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
function swapOneStepById(arr, id, direction) {
|
|
118
|
-
const index = arr.findIndex(item => (item === null || item === void 0 ? void 0 : item.id) === id);
|
|
119
|
-
if (index === -1)
|
|
120
|
-
return arr; // id tidak ditemukan
|
|
121
|
-
const newArr = [...arr];
|
|
122
|
-
if (direction === 'left' && index > 0) {
|
|
123
|
-
[newArr[index - 1], newArr[index]] = [newArr[index], newArr[index - 1]];
|
|
124
|
-
}
|
|
125
|
-
if (direction === 'right' && index < arr.length - 1) {
|
|
126
|
-
[newArr[index + 1], newArr[index]] = [newArr[index], newArr[index + 1]];
|
|
127
|
-
}
|
|
128
|
-
return newArr;
|
|
129
|
-
}
|
|
130
|
-
const handleOverride = () => {
|
|
131
|
-
const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, 'right');
|
|
132
|
-
dispatch({
|
|
133
|
-
type: "board/setNewComponents",
|
|
134
|
-
payload: newArr
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
return (<div className="h-screen left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4">
|
|
138
|
-
{tools === null || tools === void 0 ? void 0 : tools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
139
|
-
icon: tool.icon,
|
|
140
|
-
type: "text",
|
|
141
|
-
name: tool.name,
|
|
142
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
143
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
144
|
-
}} popoverProps={{
|
|
145
|
-
content: <div>{tool.name}</div>,
|
|
146
|
-
trigger: "hover",
|
|
147
|
-
placement: "right",
|
|
148
|
-
}} items={[]}/>))}
|
|
149
|
-
<ButtonTools buttonProps={{
|
|
150
|
-
icon: <CopyPlus />,
|
|
151
|
-
type: "text",
|
|
152
|
-
name: "duplicate",
|
|
153
|
-
onClick: () => handleDuplicateComponent(),
|
|
154
|
-
}} items={[]} popoverProps={{
|
|
155
|
-
content: <div>Duplicate</div>,
|
|
156
|
-
trigger: "hover",
|
|
157
|
-
placement: "right",
|
|
158
|
-
}}/>
|
|
159
|
-
<ButtonTools buttonProps={{
|
|
160
|
-
onClick: () => handleRemoveComponent(),
|
|
161
|
-
icon: <Trash />,
|
|
162
|
-
type: "text",
|
|
163
|
-
name: "trash",
|
|
164
|
-
}} items={[]} popoverProps={{
|
|
165
|
-
content: <div>Trash</div>,
|
|
166
|
-
trigger: "hover",
|
|
167
|
-
placement: "right",
|
|
168
|
-
}}/>
|
|
169
|
-
<ButtonTools buttonProps={{
|
|
170
|
-
onClick: () => handleOverride(),
|
|
171
|
-
icon: <Layers2 />,
|
|
172
|
-
type: "text",
|
|
173
|
-
name: "override",
|
|
174
|
-
}} items={[]} popoverProps={{
|
|
175
|
-
content: <div>Override</div>,
|
|
176
|
-
trigger: "hover",
|
|
177
|
-
placement: "right",
|
|
178
|
-
}}/>
|
|
179
|
-
|
|
180
|
-
<Divider />
|
|
181
|
-
{actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
182
|
-
icon: tool.icon,
|
|
183
|
-
type: "text",
|
|
184
|
-
name: tool.name,
|
|
185
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
186
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
187
|
-
}} popoverProps={{
|
|
188
|
-
content: <div>{tool.name}</div>,
|
|
189
|
-
trigger: "hover",
|
|
190
|
-
placement: "right",
|
|
191
|
-
}} items={[]}/>))}
|
|
192
|
-
|
|
193
|
-
<Divider />
|
|
194
|
-
{controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
195
|
-
icon: tool.icon,
|
|
196
|
-
type: "text",
|
|
197
|
-
name: tool.name,
|
|
198
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
199
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
200
|
-
}} popoverProps={{
|
|
201
|
-
content: <div>{tool.name}</div>,
|
|
202
|
-
trigger: "hover",
|
|
203
|
-
placement: "right",
|
|
204
|
-
}} items={[]}/>))}
|
|
205
|
-
<ColorPicker value={color} onChange={handleChangeColorBackground}>
|
|
206
|
-
<Button icon={<PaintBucket />} type="text" name="Background Color" onClick={() => hanldeSelectTool("background-color")} style={active === "background-color" ? { color: "red" } : {}}/>
|
|
207
|
-
</ColorPicker>
|
|
208
|
-
<Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
|
|
209
|
-
</div>);
|
|
210
|
-
};
|
|
211
|
-
export default SideTool;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
export interface ToolState {
|
|
3
|
-
active: "circle" | "square" | "diamond" | string;
|
|
4
|
-
isPreview: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const sideToolSlice: import("@reduxjs/toolkit").Slice<ToolState, {
|
|
7
|
-
setActiveTool: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<string>) => void;
|
|
8
|
-
setTooglePreview: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
9
|
-
}, "tool", "tool", import("@reduxjs/toolkit").SliceSelectors<ToolState>>;
|
|
10
|
-
export declare const setActiveTool: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string, "tool/setActiveTool">;
|
|
11
|
-
declare const _default: import("redux").Reducer<ToolState>;
|
|
12
|
-
export default _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
3
|
-
const initialState = {
|
|
4
|
-
active: "",
|
|
5
|
-
isPreview: false
|
|
6
|
-
};
|
|
7
|
-
export const sideToolSlice = createSlice({
|
|
8
|
-
name: "tool",
|
|
9
|
-
initialState,
|
|
10
|
-
reducers: {
|
|
11
|
-
setActiveTool: (state, action) => {
|
|
12
|
-
state.active = action.payload;
|
|
13
|
-
},
|
|
14
|
-
setTooglePreview: (state, action) => {
|
|
15
|
-
state.isPreview = action.payload;
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
export const { setActiveTool } = sideToolSlice.actions;
|
|
20
|
-
export default sideToolSlice.reducer;
|
package/dist/hooks/use-redux.js
DELETED
package/dist/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { StoreProvider } from "./provider/store-provider";
|
|
2
|
-
import Board from "./features/board";
|
|
3
|
-
import SideTool from "./features/side-tool";
|
|
4
|
-
import ControlPanels from "./features/panel";
|
|
5
|
-
import LayerView from "./features/view";
|
|
6
|
-
import TableEditor from "./features/package";
|
|
7
|
-
export { StoreProvider as ProviderSeatEditor, Board, SideTool, ControlPanels, LayerView, TableEditor };
|
package/dist/libs/middleware.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const rootReducer: import("redux").Reducer<{
|
|
2
|
-
board: import("../features/board/board-slice").InitialState;
|
|
3
|
-
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
4
|
-
panel: import("../features/panel/panel-slice").PanelState;
|
|
5
|
-
}, import("redux").UnknownAction, Partial<{
|
|
6
|
-
board: import("../features/board/board-slice").InitialState;
|
|
7
|
-
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
8
|
-
panel: import("../features/panel/panel-slice").PanelState;
|
|
9
|
-
}>>;
|
|
10
|
-
export type RootState = ReturnType<typeof rootReducer>;
|
package/dist/libs/rootReducer.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { combineReducers } from "redux";
|
|
3
|
-
import boardSlice from "../features/board/board-slice";
|
|
4
|
-
import sideTool from "../features/side-tool/side-tool-slice";
|
|
5
|
-
import panelSlice from "../features/panel/panel-slice";
|
|
6
|
-
export const rootReducer = combineReducers({
|
|
7
|
-
// Add your reducers here
|
|
8
|
-
board: boardSlice,
|
|
9
|
-
tool: sideTool,
|
|
10
|
-
panel: panelSlice,
|
|
11
|
-
// Example: user: userReducer,
|
|
12
|
-
});
|
package/dist/libs/store.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Action, ThunkAction } from "@reduxjs/toolkit";
|
|
2
|
-
export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
3
|
-
board: import("../features/board/board-slice").InitialState;
|
|
4
|
-
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
5
|
-
panel: import("../features/panel/panel-slice").PanelState;
|
|
6
|
-
}, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
7
|
-
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
8
|
-
board: import("../features/board/board-slice").InitialState;
|
|
9
|
-
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
10
|
-
panel: import("../features/panel/panel-slice").PanelState;
|
|
11
|
-
}, undefined, import("redux").UnknownAction>;
|
|
12
|
-
}>, import("redux").StoreEnhancer]>>;
|
|
13
|
-
export type AppDispatch = typeof store.dispatch;
|
|
14
|
-
export type RootState = ReturnType<typeof store.getState>;
|
|
15
|
-
export type AppThunk = ThunkAction<void, RootState, unknown, Action<string>>;
|
|
16
|
-
export type AppStore = typeof store;
|
package/dist/libs/store.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { configureStore } from "@reduxjs/toolkit";
|
|
3
|
-
import { rootReducer } from "./rootReducer";
|
|
4
|
-
import { logger } from "redux-logger";
|
|
5
|
-
import { middleware } from "./middleware";
|
|
6
|
-
import { FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER } from "redux-persist";
|
|
7
|
-
if (process.env.NODE_ENV === "development") {
|
|
8
|
-
console.log("Development mode enabled");
|
|
9
|
-
middleware.push(logger);
|
|
10
|
-
}
|
|
11
|
-
// const rootPersistReducer = persistReducer<RootState>(rootPersistConfig, rootReducer);
|
|
12
|
-
export const store = configureStore({
|
|
13
|
-
reducer: rootReducer,
|
|
14
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
15
|
-
serializableCheck: {
|
|
16
|
-
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
|
|
17
|
-
},
|
|
18
|
-
}).concat(middleware),
|
|
19
|
-
devTools: process.env.NODE_ENV !== "production",
|
|
20
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ConfigProvider } from "antd";
|
|
3
|
-
import { AntdRegistry } from "@ant-design/nextjs-registry";
|
|
4
|
-
import { useAppSelector } from "../hooks/use-redux";
|
|
5
|
-
export const AntdProvider = ({ children, }) => {
|
|
6
|
-
const theme = useAppSelector((state) => state.theme);
|
|
7
|
-
return (<AntdRegistry>
|
|
8
|
-
<ConfigProvider theme={{
|
|
9
|
-
// token: {
|
|
10
|
-
// colorPrimary: theme.theme["--primary-color"],
|
|
11
|
-
// colorPrimaryBorderHover: theme.theme["--primary-color"],
|
|
12
|
-
// fontFamily: "var(--font-inter), sans-serif",
|
|
13
|
-
// colorError: theme.theme["--danger"],
|
|
14
|
-
// controlOutlineWidth: 4,
|
|
15
|
-
// controlOutline: theme.theme["--surface-color"],
|
|
16
|
-
// colorBgContainerDisabled: "var(--netral-03)",
|
|
17
|
-
// colorTextPlaceholder: "var(--netral-06)",
|
|
18
|
-
// },
|
|
19
|
-
components: {
|
|
20
|
-
Form: {
|
|
21
|
-
labelFontSize: 14,
|
|
22
|
-
fontWeightStrong: 500,
|
|
23
|
-
itemMarginBottom: 12,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}}>
|
|
27
|
-
{children}
|
|
28
|
-
</ConfigProvider>
|
|
29
|
-
</AntdRegistry>);
|
|
30
|
-
};
|