seat-editor 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/app/constant.d.ts +0 -101
- package/dist/app/constant.js +0 -3064
- package/dist/app/layout.d.ts +0 -6
- package/dist/app/layout.jsx +0 -27
- package/dist/app/new-board/page.d.ts +0 -1
- package/dist/app/new-board/page.jsx +0 -56
- package/dist/app/old-board/page.d.ts +0 -3
- package/dist/app/old-board/page.jsx +0 -510
- package/dist/app/only-view/constant.d.ts +0 -40
- package/dist/app/only-view/constant.js +0 -1336
- package/dist/app/only-view/page.d.ts +0 -2
- package/dist/app/only-view/page.jsx +0 -40
- package/dist/app/page.d.ts +0 -2
- package/dist/app/page.jsx +0 -13
- package/dist/app/test/page.d.ts +0 -2
- package/dist/app/test/page.jsx +0 -45
- package/dist/app/v2/page.d.ts +0 -2
- package/dist/app/v2/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 -4
- package/dist/components/form-tools/shape.jsx +0 -66
- package/dist/components/input/number-indicator.d.ts +0 -7
- package/dist/components/input/number-indicator.jsx +0 -36
- package/dist/components/joystick/index.d.ts +0 -12
- package/dist/components/joystick/index.jsx +0 -49
- package/dist/components/layer/index.d.ts +0 -19
- package/dist/components/layer/index.jsx +0 -383
- package/dist/components/layer-v2/index.d.ts +0 -19
- package/dist/components/layer-v2/index.jsx +0 -370
- package/dist/components/layer-v3/index.d.ts +0 -19
- package/dist/components/layer-v3/index.jsx +0 -418
- package/dist/components/lib/index.d.ts +0 -8
- 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 -14
- package/dist/features/board/board-slice.js +0 -52
- package/dist/features/board/index.d.ts +0 -6
- package/dist/features/board/index.jsx +0 -725
- package/dist/features/board-v2/board-slice.d.ts +0 -14
- package/dist/features/board-v2/board-slice.js +0 -52
- package/dist/features/board-v2/index.d.ts +0 -8
- package/dist/features/board-v2/index.jsx +0 -869
- package/dist/features/board-v3/board-slice.d.ts +0 -16
- package/dist/features/board-v3/board-slice.js +0 -83
- package/dist/features/board-v3/history-slice.d.ts +0 -27
- package/dist/features/board-v3/history-slice.js +0 -27
- package/dist/features/board-v3/index.d.ts +0 -8
- package/dist/features/board-v3/index.jsx +0 -863
- package/dist/features/navbar/index.d.ts +0 -2
- package/dist/features/navbar/index.jsx +0 -5
- package/dist/features/package/index.d.ts +0 -31
- package/dist/features/package/index.jsx +0 -114
- package/dist/features/panel/index.d.ts +0 -11
- package/dist/features/panel/index.jsx +0 -138
- 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 -6
- package/dist/features/panel/select-tool.jsx +0 -60
- 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 -26
- package/dist/features/panel/upload-tool.d.ts +0 -14
- package/dist/features/panel/upload-tool.jsx +0 -152
- package/dist/features/side-tool/index.d.ts +0 -8
- package/dist/features/side-tool/index.jsx +0 -371
- package/dist/features/side-tool/side-tool-slice.d.ts +0 -16
- package/dist/features/side-tool/side-tool-slice.js +0 -28
- package/dist/features/theme/theme-slice.d.ts +0 -12
- package/dist/features/theme/theme-slice.js +0 -15
- package/dist/features/view/index.d.ts +0 -19
- package/dist/features/view/index.jsx +0 -228
- package/dist/features/view-only/index.d.ts +0 -19
- package/dist/features/view-only/index.jsx +0 -206
- package/dist/features/view-only-2/index.d.ts +0 -19
- package/dist/features/view-only-2/index.jsx +0 -181
- package/dist/hooks/use-redux.d.ts +0 -4
- package/dist/hooks/use-redux.js +0 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/libs/middleware.d.ts +0 -2
- package/dist/libs/middleware.js +0 -5
- package/dist/libs/rootReducer.d.ts +0 -12
- package/dist/libs/rootReducer.js +0 -14
- package/dist/libs/store.d.ts +0 -18
- package/dist/libs/store.js +0 -19
- package/dist/provider/antd-provider.d.ts +0 -4
- package/dist/provider/antd-provider.jsx +0 -46
- 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 -4
- package/dist/provider/store-provider.jsx +0 -10
- package/dist/utils/injectCss.d.ts +0 -1
- package/dist/utils/injectCss.js +0 -13
|
@@ -1,152 +0,0 @@
|
|
|
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
|
-
};
|
|
11
|
-
import { useState, useEffect } from "react";
|
|
12
|
-
import { Upload, Image, Button } from "antd";
|
|
13
|
-
import { InboxOutlined } from "@ant-design/icons";
|
|
14
|
-
import { useAppDispatch } from "../../hooks/use-redux";
|
|
15
|
-
import SectionLabel from "../../components/form-tools/label";
|
|
16
|
-
import SectionShape from "../../components/form-tools/shape";
|
|
17
|
-
const { Dragger } = Upload;
|
|
18
|
-
// const actionResponseBased = {
|
|
19
|
-
// status: 200,
|
|
20
|
-
// message: "Upload successful",
|
|
21
|
-
// data: {
|
|
22
|
-
// id: "12345",
|
|
23
|
-
// url: "https://example.com/image.png",
|
|
24
|
-
// },
|
|
25
|
-
// };
|
|
26
|
-
const UploadTool = ({ name, type, action, responseMapping, defaultValue, }) => {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
const [defaultSrc, setDefaultSrc] = useState(null);
|
|
29
|
-
const [isEdit, setIsEdit] = useState(false);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (defaultValue) {
|
|
32
|
-
setDefaultSrc(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.src);
|
|
33
|
-
setIsEdit(true);
|
|
34
|
-
}
|
|
35
|
-
}, [defaultValue]);
|
|
36
|
-
const dispatch = useAppDispatch();
|
|
37
|
-
const widthWorkspace = ((_a = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
|
|
38
|
-
const heightWorkspace = ((_b = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
|
|
39
|
-
const defaultFormatValue = (width, height, src, id) => ({
|
|
40
|
-
id: id || new Date().getTime(),
|
|
41
|
-
x: 0,
|
|
42
|
-
y: 0,
|
|
43
|
-
width: width < 1 ? 100 : width,
|
|
44
|
-
height: height < 1 ? 100 : height,
|
|
45
|
-
rotation: 0,
|
|
46
|
-
shape: name,
|
|
47
|
-
src,
|
|
48
|
-
});
|
|
49
|
-
const propsUpload = {
|
|
50
|
-
name: "file",
|
|
51
|
-
multiple: true,
|
|
52
|
-
maxCount: 1,
|
|
53
|
-
showUploadList: false,
|
|
54
|
-
onChange: (info) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const { status } = info.file;
|
|
56
|
-
if (status !== "uploading" && info.file.originFileObj) {
|
|
57
|
-
const file = info.file.originFileObj;
|
|
58
|
-
const img = new window.Image();
|
|
59
|
-
let srcFromResponse = "";
|
|
60
|
-
try {
|
|
61
|
-
// ⬇️ IF ada custom action (upload ke server)
|
|
62
|
-
if (action) {
|
|
63
|
-
yield action(file, type, defaultValue);
|
|
64
|
-
}
|
|
65
|
-
// ⬇️ IF local upload
|
|
66
|
-
// else {
|
|
67
|
-
// img.onload = () => {
|
|
68
|
-
// const scaleX = widthWorkspace / img.width;
|
|
69
|
-
// const scaleY = heightWorkspace / img.height;
|
|
70
|
-
// const scale = Math.min(1, scaleX, scaleY);
|
|
71
|
-
// const width = img.width * scale;
|
|
72
|
-
// const height = img.height * scale;
|
|
73
|
-
// if (isEdit) {
|
|
74
|
-
// dispatch({
|
|
75
|
-
// type:
|
|
76
|
-
// type === "component"
|
|
77
|
-
// ? "board/updateComponent"
|
|
78
|
-
// : "board/updateExtraComponent",
|
|
79
|
-
// payload: {
|
|
80
|
-
// ...defaultFormatValue(
|
|
81
|
-
// width,
|
|
82
|
-
// height,
|
|
83
|
-
// img.src,
|
|
84
|
-
// defaultValue.id
|
|
85
|
-
// ),
|
|
86
|
-
// },
|
|
87
|
-
// });
|
|
88
|
-
// dispatch({
|
|
89
|
-
// type: "panel/setSelectedComponent",
|
|
90
|
-
// payload: {
|
|
91
|
-
// ...defaultFormatValue(
|
|
92
|
-
// width,
|
|
93
|
-
// height,
|
|
94
|
-
// srcFromResponse,
|
|
95
|
-
// defaultValue.id
|
|
96
|
-
// ),
|
|
97
|
-
// },
|
|
98
|
-
// });
|
|
99
|
-
// setDefaultSrc(img.src);
|
|
100
|
-
// } else {
|
|
101
|
-
// dispatch({
|
|
102
|
-
// type:
|
|
103
|
-
// type === "component"
|
|
104
|
-
// ? "board/addComponent"
|
|
105
|
-
// : "board/setExtraComponent",
|
|
106
|
-
// payload: {
|
|
107
|
-
// ...defaultFormatValue(width, height, img.src),
|
|
108
|
-
// },
|
|
109
|
-
// });
|
|
110
|
-
// }
|
|
111
|
-
// dispatch({ type: "board/setFlagChange", payload: true });
|
|
112
|
-
// // message.success(`${info.file.name} uploaded successfully.`);
|
|
113
|
-
// };
|
|
114
|
-
// // Set img src AFTER onload
|
|
115
|
-
// img.src = URL.createObjectURL(file);
|
|
116
|
-
// }
|
|
117
|
-
}
|
|
118
|
-
catch (e) {
|
|
119
|
-
// message.error("Upload failed, please try again.");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}),
|
|
123
|
-
};
|
|
124
|
-
const handleDelete = () => {
|
|
125
|
-
setDefaultSrc(null);
|
|
126
|
-
};
|
|
127
|
-
return (<>
|
|
128
|
-
{defaultSrc ? (<>
|
|
129
|
-
<div className="w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto">
|
|
130
|
-
<Image src={defaultSrc}/>
|
|
131
|
-
</div>
|
|
132
|
-
<Button type="primary" onClick={handleDelete}>
|
|
133
|
-
Edit
|
|
134
|
-
</Button>
|
|
135
|
-
</>) : (<Dragger {...propsUpload} action={""}>
|
|
136
|
-
<p className="ant-upload-drag-icon">
|
|
137
|
-
<InboxOutlined />
|
|
138
|
-
</p>
|
|
139
|
-
<p className="ant-upload-text">
|
|
140
|
-
Click or drag file to this area to upload
|
|
141
|
-
</p>
|
|
142
|
-
<p className="ant-upload-hint">
|
|
143
|
-
Support for a single or bulk upload. Strictly prohibited from
|
|
144
|
-
uploading company data or other banned files.
|
|
145
|
-
</p>
|
|
146
|
-
</Dragger>)}
|
|
147
|
-
|
|
148
|
-
<SectionShape allowChangeShape={type === "component"}/>
|
|
149
|
-
<SectionLabel />
|
|
150
|
-
</>);
|
|
151
|
-
};
|
|
152
|
-
export default UploadTool;
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2, Lock, LockOpen, Undo2, Redo2, } from "lucide-react";
|
|
3
|
-
import ButtonTools from "../../components/button-tools";
|
|
4
|
-
import { Divider, ColorPicker, Button, message, } from "antd";
|
|
5
|
-
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
const SideTool = ({ dragOnly, deleteAutorized, }) => {
|
|
8
|
-
const [color, setColor] = useState("#000000");
|
|
9
|
-
const dispatch = useAppDispatch();
|
|
10
|
-
const { active, grid, lockBackground } = useAppSelector((state) => state.tool);
|
|
11
|
-
const { selectedComponent } = useAppSelector((state) => state.panel);
|
|
12
|
-
const { components, extraComponents } = 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
|
-
id: "grab",
|
|
22
|
-
name: "Grab Tool",
|
|
23
|
-
icon: <Hand />,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "ruler",
|
|
27
|
-
name: "Ruler",
|
|
28
|
-
icon: <Ruler />,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "node",
|
|
32
|
-
name: "Node Tool",
|
|
33
|
-
icon: <MousePointer2 />,
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
const actionsTools = [
|
|
37
|
-
// {
|
|
38
|
-
// id: "table-split",
|
|
39
|
-
// name: "Table Split",
|
|
40
|
-
// icon: <TableCellsSplit />,
|
|
41
|
-
// },
|
|
42
|
-
{
|
|
43
|
-
id: "square",
|
|
44
|
-
name: "Square",
|
|
45
|
-
icon: <SquareMousePointer />,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: "circle",
|
|
49
|
-
name: "Circle",
|
|
50
|
-
icon: <Circle />,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: "table-seat-circle",
|
|
54
|
-
name: "Table Seat Circle",
|
|
55
|
-
icon: <Ratio />,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: "image-table",
|
|
59
|
-
name: "Image Table",
|
|
60
|
-
icon: <Upload />,
|
|
61
|
-
},
|
|
62
|
-
// {
|
|
63
|
-
// id: "table-seat-square",
|
|
64
|
-
// name: "Table Seat Square",
|
|
65
|
-
// icon: <Dock />,
|
|
66
|
-
// },
|
|
67
|
-
// {
|
|
68
|
-
// id: "diamond",
|
|
69
|
-
// name: "Diamond",
|
|
70
|
-
// icon: <Diamond />,
|
|
71
|
-
// },
|
|
72
|
-
];
|
|
73
|
-
const controlTools = [
|
|
74
|
-
{
|
|
75
|
-
id: "background",
|
|
76
|
-
name: "Background",
|
|
77
|
-
icon: <Image />,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: "text",
|
|
81
|
-
name: "Text",
|
|
82
|
-
icon: <Type />,
|
|
83
|
-
},
|
|
84
|
-
// {
|
|
85
|
-
// id: "background-color",
|
|
86
|
-
// name: "Background Color",
|
|
87
|
-
// icon: <PaintBucket/>
|
|
88
|
-
// }
|
|
89
|
-
];
|
|
90
|
-
const hanldeSelectTool = (id) => {
|
|
91
|
-
if (active === id) {
|
|
92
|
-
dispatch({
|
|
93
|
-
type: "tool/setActiveTool",
|
|
94
|
-
payload: "",
|
|
95
|
-
});
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (id === "background" || id === "image-table") {
|
|
99
|
-
dispatch({
|
|
100
|
-
type: "panel/setShow",
|
|
101
|
-
payload: true,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
dispatch({
|
|
105
|
-
type: "tool/setActiveTool",
|
|
106
|
-
payload: id,
|
|
107
|
-
});
|
|
108
|
-
dispatch({
|
|
109
|
-
type: "panel/setSelectedComponent",
|
|
110
|
-
payload: null,
|
|
111
|
-
});
|
|
112
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
113
|
-
};
|
|
114
|
-
const toggleGrid = () => {
|
|
115
|
-
dispatch({
|
|
116
|
-
type: "tool/setToogleGrid",
|
|
117
|
-
payload: !grid,
|
|
118
|
-
});
|
|
119
|
-
dispatch({
|
|
120
|
-
type: "panel/setSelectedComponent",
|
|
121
|
-
payload: null,
|
|
122
|
-
});
|
|
123
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
124
|
-
};
|
|
125
|
-
const toogleSetLockBackground = () => {
|
|
126
|
-
dispatch({
|
|
127
|
-
type: "tool/setToogleBackground",
|
|
128
|
-
payload: !lockBackground,
|
|
129
|
-
});
|
|
130
|
-
// dispatch({ type: "board/setFlagChange", payload: true });
|
|
131
|
-
};
|
|
132
|
-
const handleChangeColorBackground = (color) => {
|
|
133
|
-
setColor(color.toHexString());
|
|
134
|
-
dispatch({
|
|
135
|
-
type: "board/setBackgroundColor",
|
|
136
|
-
payload: color.toHexString(),
|
|
137
|
-
});
|
|
138
|
-
dispatch({
|
|
139
|
-
type: "panel/setSelectedComponent",
|
|
140
|
-
payload: null,
|
|
141
|
-
});
|
|
142
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
143
|
-
};
|
|
144
|
-
const handleOpenModalPreview = () => {
|
|
145
|
-
dispatch({
|
|
146
|
-
type: "tool/setTooglePreview",
|
|
147
|
-
payload: true,
|
|
148
|
-
});
|
|
149
|
-
dispatch({
|
|
150
|
-
type: "panel/setSelectedComponent",
|
|
151
|
-
payload: null,
|
|
152
|
-
});
|
|
153
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
154
|
-
};
|
|
155
|
-
const handleRemoveComponent = () => {
|
|
156
|
-
const exludedShapes = ["background", "text"];
|
|
157
|
-
if (!selectedComponent)
|
|
158
|
-
return;
|
|
159
|
-
if (!exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component)) {
|
|
160
|
-
message.error("You are not authorized to delete this table.");
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) && !(deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent)) {
|
|
164
|
-
message.error("You are not authorized to delete this background.");
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.component) && !exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
|
|
168
|
-
dispatch({
|
|
169
|
-
type: "board/removeComponent",
|
|
170
|
-
payload: selectedComponent,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
if ((deleteAutorized === null || deleteAutorized === void 0 ? void 0 : deleteAutorized.extraComponent) && exludedShapes.includes(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape)) {
|
|
174
|
-
dispatch({
|
|
175
|
-
type: "board/removeExtraComponent",
|
|
176
|
-
payload: selectedComponent,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
180
|
-
dispatch({
|
|
181
|
-
type: "panel/setSelectedComponent",
|
|
182
|
-
payload: null,
|
|
183
|
-
});
|
|
184
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
185
|
-
};
|
|
186
|
-
const handleDuplicateComponent = () => {
|
|
187
|
-
const newComponent = Object.assign(Object.assign({}, selectedComponent), { x: selectedComponent.x + 20, y: selectedComponent.y + 20, id: Date.now() });
|
|
188
|
-
dispatch({
|
|
189
|
-
type: "board/addComponent",
|
|
190
|
-
payload: newComponent,
|
|
191
|
-
});
|
|
192
|
-
dispatch({
|
|
193
|
-
type: "panel/setSelectedComponent",
|
|
194
|
-
payload: newComponent,
|
|
195
|
-
});
|
|
196
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
197
|
-
};
|
|
198
|
-
function swapOneStepById(arr, id, direction) {
|
|
199
|
-
const index = arr.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
|
200
|
-
if (index === -1)
|
|
201
|
-
return arr; // id tidak ditemukan
|
|
202
|
-
const newArr = [...arr];
|
|
203
|
-
if (direction === "left" && index > 0) {
|
|
204
|
-
[newArr[index - 1], newArr[index]] = [newArr[index], newArr[index - 1]];
|
|
205
|
-
}
|
|
206
|
-
if (direction === "right" && index < arr.length - 1) {
|
|
207
|
-
[newArr[index + 1], newArr[index]] = [newArr[index], newArr[index + 1]];
|
|
208
|
-
}
|
|
209
|
-
return newArr;
|
|
210
|
-
}
|
|
211
|
-
const handleOverride = () => {
|
|
212
|
-
if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
|
|
213
|
-
const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
|
|
214
|
-
dispatch({
|
|
215
|
-
type: "board/setNewExtraComponents",
|
|
216
|
-
payload: setNewExtraComponents,
|
|
217
|
-
});
|
|
218
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "right");
|
|
222
|
-
dispatch({
|
|
223
|
-
type: "board/setNewComponents",
|
|
224
|
-
payload: newArr,
|
|
225
|
-
});
|
|
226
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
227
|
-
};
|
|
228
|
-
const handleOverrideLeft = () => {
|
|
229
|
-
if ((selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "background") {
|
|
230
|
-
const setNewExtraComponents = swapOneStepById(extraComponents, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
|
|
231
|
-
dispatch({
|
|
232
|
-
type: "board/setNewExtraComponents",
|
|
233
|
-
payload: setNewExtraComponents,
|
|
234
|
-
});
|
|
235
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const newArr = swapOneStepById(components, selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id, "left");
|
|
239
|
-
dispatch({
|
|
240
|
-
type: "board/setNewComponents",
|
|
241
|
-
payload: newArr,
|
|
242
|
-
});
|
|
243
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
244
|
-
};
|
|
245
|
-
const handleUndo = () => {
|
|
246
|
-
dispatch({ type: "board/undoHistory" });
|
|
247
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
248
|
-
};
|
|
249
|
-
const handleRedo = () => {
|
|
250
|
-
dispatch({ type: "board/redoHistory" });
|
|
251
|
-
dispatch({ type: "board/setFlagChange", payload: true });
|
|
252
|
-
};
|
|
253
|
-
return (<div className="h-full left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4">
|
|
254
|
-
{tools === null || tools === void 0 ? void 0 : tools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
255
|
-
icon: tool.icon,
|
|
256
|
-
type: "text",
|
|
257
|
-
name: tool.name,
|
|
258
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
259
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
260
|
-
}} popoverProps={{
|
|
261
|
-
content: <div>{tool.name}</div>,
|
|
262
|
-
trigger: "hover",
|
|
263
|
-
placement: "right",
|
|
264
|
-
}} items={[]}/>))}
|
|
265
|
-
{!dragOnly && (<>
|
|
266
|
-
<ButtonTools buttonProps={{
|
|
267
|
-
icon: <CopyPlus />,
|
|
268
|
-
type: "text",
|
|
269
|
-
name: "duplicate",
|
|
270
|
-
onClick: () => handleDuplicateComponent(),
|
|
271
|
-
}} items={[]} popoverProps={{
|
|
272
|
-
content: <div>Duplicate</div>,
|
|
273
|
-
trigger: "hover",
|
|
274
|
-
placement: "right",
|
|
275
|
-
}}/>
|
|
276
|
-
|
|
277
|
-
<ButtonTools buttonProps={{
|
|
278
|
-
onClick: () => handleOverride(),
|
|
279
|
-
icon: <Layers2 />,
|
|
280
|
-
type: "text",
|
|
281
|
-
name: "override",
|
|
282
|
-
}} items={[]} popoverProps={{
|
|
283
|
-
content: <div>Override Right</div>,
|
|
284
|
-
trigger: "hover",
|
|
285
|
-
placement: "right",
|
|
286
|
-
}}/>
|
|
287
|
-
<ButtonTools buttonProps={{
|
|
288
|
-
onClick: () => handleOverrideLeft(),
|
|
289
|
-
icon: <Layers />,
|
|
290
|
-
type: "text",
|
|
291
|
-
name: "override",
|
|
292
|
-
}} items={[]} popoverProps={{
|
|
293
|
-
content: <div>Override Left</div>,
|
|
294
|
-
trigger: "hover",
|
|
295
|
-
placement: "right",
|
|
296
|
-
}}/>
|
|
297
|
-
|
|
298
|
-
<Divider />
|
|
299
|
-
{actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
300
|
-
icon: tool.icon,
|
|
301
|
-
type: "text",
|
|
302
|
-
name: tool.name,
|
|
303
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
304
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
305
|
-
}} popoverProps={{
|
|
306
|
-
content: <div>{tool.name}</div>,
|
|
307
|
-
trigger: "hover",
|
|
308
|
-
placement: "right",
|
|
309
|
-
}} items={[]}/>))}
|
|
310
|
-
|
|
311
|
-
<Divider />
|
|
312
|
-
</>)}
|
|
313
|
-
{controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
|
|
314
|
-
icon: tool.icon,
|
|
315
|
-
type: "text",
|
|
316
|
-
name: tool.name,
|
|
317
|
-
onClick: () => hanldeSelectTool(tool.id),
|
|
318
|
-
style: active === tool.id ? { color: "red" } : {},
|
|
319
|
-
}} popoverProps={{
|
|
320
|
-
content: <div>{tool.name}</div>,
|
|
321
|
-
trigger: "hover",
|
|
322
|
-
placement: "right",
|
|
323
|
-
}} items={[]}/>))}
|
|
324
|
-
<ColorPicker value={color} onChange={handleChangeColorBackground}>
|
|
325
|
-
<Button icon={<PaintBucket />} type="text" name="Background Color" onClick={() => hanldeSelectTool("background-color")} style={active === "background-color" ? { color: "red" } : {}}/>
|
|
326
|
-
</ColorPicker>
|
|
327
|
-
<Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
|
|
328
|
-
<Button icon={<Grid />} type="text" name="Grid" onClick={() => toggleGrid()}/>
|
|
329
|
-
<ButtonTools buttonProps={{
|
|
330
|
-
onClick: () => handleRemoveComponent(),
|
|
331
|
-
icon: <Trash />,
|
|
332
|
-
type: "text",
|
|
333
|
-
name: "trash",
|
|
334
|
-
}} items={[]} popoverProps={{
|
|
335
|
-
content: <div>Trash</div>,
|
|
336
|
-
trigger: "hover",
|
|
337
|
-
placement: "right",
|
|
338
|
-
}}/>
|
|
339
|
-
<ButtonTools buttonProps={{
|
|
340
|
-
onClick: () => toogleSetLockBackground(),
|
|
341
|
-
icon: lockBackground ? <Lock /> : <LockOpen />,
|
|
342
|
-
type: "text",
|
|
343
|
-
name: "trash",
|
|
344
|
-
}} items={[]} popoverProps={{
|
|
345
|
-
content: <div>{lockBackground ? "Unlock Background" : "Lock Background"}</div>,
|
|
346
|
-
trigger: "hover",
|
|
347
|
-
placement: "right",
|
|
348
|
-
}}/>
|
|
349
|
-
<ButtonTools buttonProps={{
|
|
350
|
-
onClick: () => handleUndo(),
|
|
351
|
-
icon: <Undo2 />,
|
|
352
|
-
type: "text",
|
|
353
|
-
name: "undo",
|
|
354
|
-
}} items={[]} popoverProps={{
|
|
355
|
-
content: <div>Undo</div>,
|
|
356
|
-
trigger: "hover",
|
|
357
|
-
placement: "right",
|
|
358
|
-
}}/>
|
|
359
|
-
<ButtonTools buttonProps={{
|
|
360
|
-
onClick: () => handleRedo(),
|
|
361
|
-
icon: <Redo2 />,
|
|
362
|
-
type: "text",
|
|
363
|
-
name: "redo",
|
|
364
|
-
}} items={[]} popoverProps={{
|
|
365
|
-
content: <div>Redo</div>,
|
|
366
|
-
trigger: "hover",
|
|
367
|
-
placement: "right",
|
|
368
|
-
}}/>
|
|
369
|
-
</div>);
|
|
370
|
-
};
|
|
371
|
-
export default SideTool;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
export interface ToolState {
|
|
3
|
-
active: "circle" | "square" | "diamond" | string;
|
|
4
|
-
isPreview: boolean;
|
|
5
|
-
grid: boolean;
|
|
6
|
-
lockBackground: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const sideToolSlice: import("@reduxjs/toolkit").Slice<ToolState, {
|
|
9
|
-
setActiveTool: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<string>) => void;
|
|
10
|
-
setTooglePreview: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
11
|
-
setToogleGrid: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
12
|
-
setToogleBackground: (state: import("immer").WritableDraft<ToolState>, action: PayloadAction<boolean>) => void;
|
|
13
|
-
}, "tool", "tool", import("@reduxjs/toolkit").SliceSelectors<ToolState>>;
|
|
14
|
-
export declare const setActiveTool: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string, "tool/setActiveTool">, setTooglePreview: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setTooglePreview">, setToogleGrid: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setToogleGrid">, setToogleBackground: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<boolean, "tool/setToogleBackground">;
|
|
15
|
-
declare const _default: import("redux").Reducer<ToolState>;
|
|
16
|
-
export default _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
3
|
-
const initialState = {
|
|
4
|
-
active: "",
|
|
5
|
-
isPreview: false,
|
|
6
|
-
grid: false,
|
|
7
|
-
lockBackground: false
|
|
8
|
-
};
|
|
9
|
-
export const sideToolSlice = createSlice({
|
|
10
|
-
name: "tool",
|
|
11
|
-
initialState,
|
|
12
|
-
reducers: {
|
|
13
|
-
setActiveTool: (state, action) => {
|
|
14
|
-
state.active = action.payload;
|
|
15
|
-
},
|
|
16
|
-
setTooglePreview: (state, action) => {
|
|
17
|
-
state.isPreview = action.payload;
|
|
18
|
-
},
|
|
19
|
-
setToogleGrid: (state, action) => {
|
|
20
|
-
state.grid = action.payload;
|
|
21
|
-
},
|
|
22
|
-
setToogleBackground: (state, action) => {
|
|
23
|
-
state.lockBackground = action.payload;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
export const { setActiveTool, setTooglePreview, setToogleGrid, setToogleBackground } = sideToolSlice.actions;
|
|
28
|
-
export default sideToolSlice.reducer;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface ThemeProps {
|
|
2
|
-
primaryColor: string;
|
|
3
|
-
}
|
|
4
|
-
export declare const themeSlice: import("@reduxjs/toolkit").Slice<ThemeProps, {
|
|
5
|
-
setPrimaryColor: (state: import("immer").WritableDraft<ThemeProps>, action: {
|
|
6
|
-
payload: any;
|
|
7
|
-
type: string;
|
|
8
|
-
}) => void;
|
|
9
|
-
}, "theme", "theme", import("@reduxjs/toolkit").SliceSelectors<ThemeProps>>;
|
|
10
|
-
export declare const setPrimaryColor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "theme/setPrimaryColor">;
|
|
11
|
-
declare const _default: import("redux").Reducer<ThemeProps>;
|
|
12
|
-
export default _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
-
const initialState = {
|
|
3
|
-
primaryColor: "#4A90E2",
|
|
4
|
-
};
|
|
5
|
-
export const themeSlice = createSlice({
|
|
6
|
-
name: "theme",
|
|
7
|
-
initialState,
|
|
8
|
-
reducers: {
|
|
9
|
-
setPrimaryColor: (state, action) => {
|
|
10
|
-
state.primaryColor = action.payload;
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
export const { setPrimaryColor } = themeSlice.actions;
|
|
15
|
-
export default themeSlice.reducer;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface LayerViewProps {
|
|
2
|
-
componentProps?: any[];
|
|
3
|
-
extraComponentProps?: any[];
|
|
4
|
-
onCurrentStateChange?: (state: any) => void;
|
|
5
|
-
onSelectComponent?: (component: any) => void;
|
|
6
|
-
mappingKey?: string;
|
|
7
|
-
selectedTableColor?: string;
|
|
8
|
-
colorMatchKey?: {
|
|
9
|
-
color: string;
|
|
10
|
-
key: string;
|
|
11
|
-
}[];
|
|
12
|
-
statusKey: string;
|
|
13
|
-
defaultBackground?: string;
|
|
14
|
-
transformProps?: any;
|
|
15
|
-
containerProps?: any;
|
|
16
|
-
svgProps?: any;
|
|
17
|
-
}
|
|
18
|
-
declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
|
|
19
|
-
export default LayerView;
|