seat-editor 3.3.13 → 3.3.15
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 -0
- package/dist/app/constant.js +1 -0
- package/dist/app/layout.d.ts +6 -0
- package/dist/app/layout.jsx +27 -0
- package/dist/app/new-board/page.jsx +55 -0
- package/dist/app/old-board/page.d.ts +3 -0
- package/dist/app/old-board/page.jsx +510 -0
- package/dist/app/only-view/chair.d.ts +1 -0
- package/dist/app/only-view/chair.js +12 -0
- package/dist/app/only-view/constant.d.ts +60 -0
- package/dist/app/only-view/constant.js +1336 -0
- package/dist/app/only-view/page.jsx +248 -0
- package/dist/app/only-view/user.d.ts +1 -0
- package/dist/app/only-view/user.js +12 -0
- package/dist/app/page.d.ts +2 -0
- package/dist/app/page.jsx +13 -0
- package/dist/app/test/page.d.ts +2 -0
- package/dist/app/test/page.jsx +45 -0
- package/dist/app/v2/page.d.ts +2 -0
- package/dist/app/v2/page.jsx +13 -0
- package/dist/components/button-tools/index.d.ts +11 -0
- package/dist/components/button-tools/index.jsx +17 -0
- package/dist/components/form-tools/label.d.ts +2 -0
- package/dist/components/form-tools/label.jsx +63 -0
- package/dist/components/form-tools/shape.d.ts +8 -0
- package/dist/components/form-tools/shape.jsx +113 -0
- package/dist/components/input/number-indicator.d.ts +7 -0
- package/dist/components/input/number-indicator.jsx +36 -0
- package/dist/components/joystick/index.d.ts +12 -0
- package/dist/components/joystick/index.jsx +49 -0
- package/dist/components/layer/index.d.ts +19 -0
- package/dist/components/layer/index.jsx +383 -0
- package/dist/components/layer-v2/index.d.ts +19 -0
- package/dist/components/layer-v2/index.jsx +370 -0
- package/dist/components/layer-v3/index.d.ts +13 -0
- package/dist/components/layer-v3/index.jsx +631 -0
- package/dist/components/layer-v3/utils.d.ts +19 -0
- package/dist/components/layer-v3/utils.js +72 -0
- package/dist/components/layer-v4/constant.d.ts +60 -0
- package/dist/components/layer-v4/constant.js +93 -0
- package/dist/components/layer-v4/index.d.ts +24 -0
- package/dist/components/layer-v4/index.jsx +1046 -0
- package/dist/components/lib/index.d.ts +8 -0
- package/dist/components/lib/index.jsx +33 -0
- package/dist/components/modal-preview/index.d.ts +4 -0
- package/dist/components/modal-preview/index.jsx +11 -0
- package/dist/dto/event-handler.d.ts +1 -0
- package/dist/dto/event-handler.js +1 -0
- package/dist/dto/table.d.ts +80 -0
- package/dist/dto/table.js +1 -0
- package/dist/features/board/board-slice.d.ts +14 -0
- package/dist/features/board/board-slice.js +52 -0
- package/dist/features/board/index.d.ts +6 -0
- package/dist/features/board/index.jsx +725 -0
- package/dist/features/board-v2/board-slice.d.ts +14 -0
- package/dist/features/board-v2/board-slice.js +52 -0
- package/dist/features/board-v2/index.d.ts +8 -0
- package/dist/features/board-v2/index.jsx +869 -0
- package/dist/features/board-v3/board-slice.d.ts +19 -0
- package/dist/features/board-v3/board-slice.js +274 -0
- package/dist/features/board-v3/constant.d.ts +5 -0
- package/dist/features/board-v3/constant.js +5 -0
- package/dist/features/board-v3/history-slice.d.ts +27 -0
- package/dist/features/board-v3/history-slice.js +27 -0
- package/dist/features/board-v3/icons.d.ts +4 -0
- package/dist/features/board-v3/icons.jsx +100 -0
- package/dist/features/board-v3/index.d.ts +16 -0
- package/dist/features/board-v3/index.jsx +1678 -0
- package/dist/features/board-v3/polygon.d.ts +28 -0
- package/dist/features/board-v3/polygon.js +109 -0
- package/dist/features/board-v3/rect.d.ts +9 -0
- package/dist/features/board-v3/rect.js +152 -0
- package/dist/features/board-v3/resize-element.d.ts +12 -0
- package/dist/features/board-v3/resize-element.js +43 -0
- package/dist/features/board-v3/utils.d.ts +180 -0
- package/dist/features/board-v3/utils.js +1235 -0
- package/dist/features/navbar/index.d.ts +2 -0
- package/dist/features/navbar/index.jsx +5 -0
- package/dist/features/panel/index.d.ts +6 -0
- package/dist/features/panel/index.jsx +251 -0
- package/dist/features/panel/panel-slice.d.ts +23 -0
- package/dist/features/panel/panel-slice.js +46 -0
- package/dist/features/panel/select-tool.d.ts +6 -0
- package/dist/features/panel/select-tool.jsx +70 -0
- package/dist/features/panel/selected-group.d.ts +2 -0
- package/dist/features/panel/selected-group.jsx +93 -0
- package/dist/features/panel/square-circle-tool.d.ts +2 -0
- package/dist/features/panel/square-circle-tool.jsx +10 -0
- package/dist/features/panel/table-seat-circle.d.ts +2 -0
- package/dist/features/panel/table-seat-circle.jsx +36 -0
- package/dist/features/panel/table-seat-square.d.ts +2 -0
- package/dist/features/panel/table-seat-square.jsx +51 -0
- package/dist/features/panel/text-tool.d.ts +2 -0
- package/dist/features/panel/text-tool.jsx +57 -0
- package/dist/features/panel/upload-tool.d.ts +10 -0
- package/dist/features/panel/upload-tool.jsx +176 -0
- package/dist/features/panel/utils.d.ts +5 -0
- package/dist/features/panel/utils.js +47 -0
- package/dist/features/side-tool/index.d.ts +8 -0
- package/dist/features/side-tool/index.jsx +390 -0
- package/dist/features/side-tool/side-tool-slice.d.ts +16 -0
- package/dist/features/side-tool/side-tool-slice.js +28 -0
- package/dist/features/theme/theme-slice.d.ts +12 -0
- package/dist/features/theme/theme-slice.js +15 -0
- package/dist/features/view-only/index.d.ts +19 -0
- package/dist/features/view-only/index.jsx +205 -0
- package/dist/features/view-only-2/index.d.ts +19 -0
- package/dist/features/view-only-2/index.jsx +190 -0
- package/dist/features/view-only-3/index.d.ts +89 -0
- package/dist/features/view-only-3/index.jsx +590 -0
- package/dist/features/view-only-3/utils.d.ts +1 -0
- package/dist/features/view-only-3/utils.js +3 -0
- package/dist/hooks/use-redux.d.ts +4 -0
- package/dist/hooks/use-redux.js +3 -0
- package/dist/index.js +10 -0
- package/dist/libs/middleware.d.ts +2 -0
- package/dist/libs/middleware.js +5 -0
- package/dist/libs/rootReducer.d.ts +12 -0
- package/dist/libs/rootReducer.js +14 -0
- package/dist/libs/store.d.ts +18 -0
- package/dist/libs/store.js +19 -0
- package/dist/provider/antd-provider.d.ts +4 -0
- package/dist/provider/antd-provider.jsx +46 -0
- package/dist/provider/redux-provider.d.ts +3 -0
- package/dist/provider/redux-provider.jsx +6 -0
- package/dist/provider/store-provider.d.ts +4 -0
- package/dist/provider/store-provider.jsx +10 -0
- package/dist/utils/constant.d.ts +3 -0
- package/dist/utils/constant.js +13 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.js +29 -0
- package/dist/utils/injectCss.d.ts +1 -0
- package/dist/utils/injectCss.js +13 -0
- package/dist/utils/regex.d.ts +3 -0
- package/dist/utils/regex.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState, useImperativeHandle, } from "react";
|
|
3
|
+
import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
5
|
+
import Layers from "../../components/layer-v4";
|
|
6
|
+
import { getTranslate } from "../board-v3/utils";
|
|
7
|
+
import { Spin } from "antd";
|
|
8
|
+
const LayerView = (props) => {
|
|
9
|
+
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled, loadingRender, } = props;
|
|
10
|
+
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
11
|
+
const tableGhost = useRef(null);
|
|
12
|
+
const hoverUnderghostId = useRef(null);
|
|
13
|
+
const transformRef = useRef(null);
|
|
14
|
+
const containerRef = useRef(null);
|
|
15
|
+
const svgRef = useRef(null);
|
|
16
|
+
const hasBoundingBoxRef = useRef(false);
|
|
17
|
+
const [tooltip, setTooltip] = useState({
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
visible: false,
|
|
21
|
+
});
|
|
22
|
+
const isDragging = useRef(false);
|
|
23
|
+
const [panningGroup, setPanningGroup] = useState(false);
|
|
24
|
+
const [scale, setScale] = useState(1);
|
|
25
|
+
const [selectedTable, setSelectedTable] = useState(null);
|
|
26
|
+
const { components: componentsEditor, extraComponents: extraComponentsEditor, boundingBox: boundingBoxProps, } = useAppSelector((state) => state.board);
|
|
27
|
+
const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
|
|
28
|
+
const { loading } = useAppSelector((state) => state.panel);
|
|
29
|
+
useImperativeHandle(refs, () => ({
|
|
30
|
+
svgRef: svgRef === null || svgRef === void 0 ? void 0 : svgRef.current,
|
|
31
|
+
transformRef: transformRef === null || transformRef === void 0 ? void 0 : transformRef.current,
|
|
32
|
+
containerRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current,
|
|
33
|
+
tableGhost: tableGhost === null || tableGhost === void 0 ? void 0 : tableGhost.current,
|
|
34
|
+
hoverUnderghost: originalData({
|
|
35
|
+
id: hoverUnderghostId === null || hoverUnderghostId === void 0 ? void 0 : hoverUnderghostId.current,
|
|
36
|
+
type: "find",
|
|
37
|
+
}),
|
|
38
|
+
}));
|
|
39
|
+
const dispatch = useAppDispatch();
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
|
|
42
|
+
dispatch({ type: "panel/setLoading", payload: true });
|
|
43
|
+
}
|
|
44
|
+
// check in null
|
|
45
|
+
const isEmptyComponents = (componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) === 0;
|
|
46
|
+
const isEmptyExtraComponents = (extraComponentProps === null || extraComponentProps === void 0 ? void 0 : extraComponentProps.length) === 0;
|
|
47
|
+
// const isEmptyBoundingBox = boundingBox === null;
|
|
48
|
+
if (isEmptyComponents) {
|
|
49
|
+
dispatch({
|
|
50
|
+
type: "board/setNewComponents",
|
|
51
|
+
payload: [],
|
|
52
|
+
});
|
|
53
|
+
setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
|
|
54
|
+
}
|
|
55
|
+
if (isEmptyExtraComponents) {
|
|
56
|
+
dispatch({
|
|
57
|
+
type: "board/setNewExtraComponents",
|
|
58
|
+
payload: [],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if ((componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) > 0) {
|
|
62
|
+
dispatch({
|
|
63
|
+
type: "board/setNewComponents",
|
|
64
|
+
payload: componentProps,
|
|
65
|
+
});
|
|
66
|
+
setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
|
|
67
|
+
}
|
|
68
|
+
if ((extraComponentProps === null || extraComponentProps === void 0 ? void 0 : extraComponentProps.length) > 0) {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: "board/setNewExtraComponents",
|
|
71
|
+
payload: extraComponentProps,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (defaultBackground) {
|
|
75
|
+
dispatch({
|
|
76
|
+
type: "board/setBackgroundColor",
|
|
77
|
+
payload: defaultBackground,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
dispatch({ type: "panel/setLoading", payload: false });
|
|
82
|
+
}, 1000);
|
|
83
|
+
}, [componentProps, extraComponentProps, defaultBackground, loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
|
|
86
|
+
}, [privilegedTags]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
onCurrentStateChange &&
|
|
89
|
+
onCurrentStateChange({
|
|
90
|
+
components: componentsEditor,
|
|
91
|
+
extraComponents: extraComponentsEditor,
|
|
92
|
+
background: backgroundColor,
|
|
93
|
+
boundingBox: boundingBoxProps,
|
|
94
|
+
});
|
|
95
|
+
}, [componentsEditor, extraComponentsEditor]);
|
|
96
|
+
const originalData = ({ id, type, dataParams, }) => {
|
|
97
|
+
let data;
|
|
98
|
+
if (type === "find") {
|
|
99
|
+
data = componentsEditor.find((item) => {
|
|
100
|
+
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
101
|
+
return item[mappingKey].id == id;
|
|
102
|
+
}
|
|
103
|
+
return (item === null || item === void 0 ? void 0 : item.id) == id;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (type === "get" && dataParams) {
|
|
107
|
+
const mapped = mappingKey ? dataParams[mappingKey] : undefined;
|
|
108
|
+
data = mapped !== undefined ? mapped : dataParams;
|
|
109
|
+
}
|
|
110
|
+
return data;
|
|
111
|
+
};
|
|
112
|
+
const handleSelectComponent = (items, e) => {
|
|
113
|
+
const find = componentsEditor.find((item) => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
116
|
+
return item[mappingKey].id == ((_a = items[mappingKey]) === null || _a === void 0 ? void 0 : _a.id);
|
|
117
|
+
}
|
|
118
|
+
return (item === null || item === void 0 ? void 0 : item.id) == (items === null || items === void 0 ? void 0 : items.id);
|
|
119
|
+
});
|
|
120
|
+
const rightClick = e.button === 2;
|
|
121
|
+
const click = e.button === 0;
|
|
122
|
+
onRightClick && rightClick && onRightClick(e, find);
|
|
123
|
+
onSelectComponent && !rightClick && onSelectComponent(find);
|
|
124
|
+
const seletedTable = mappingKey ? find[mappingKey] : find;
|
|
125
|
+
setSelectedTable(seletedTable);
|
|
126
|
+
};
|
|
127
|
+
const boundingBox = useMemo(() => {
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
129
|
+
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
130
|
+
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
131
|
+
}
|
|
132
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
133
|
+
componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.forEach((_, i) => {
|
|
134
|
+
let values = mappingKey ? _[mappingKey] : _;
|
|
135
|
+
if (!values)
|
|
136
|
+
return;
|
|
137
|
+
if (values === null || values === void 0 ? void 0 : values.shape) {
|
|
138
|
+
minX = Math.min(minX, values.x);
|
|
139
|
+
minY = Math.min(minY, values.y);
|
|
140
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
141
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
142
|
+
}
|
|
143
|
+
if ((i === componentsEditor.length - 1) && (extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 0) {
|
|
144
|
+
minX = minX > 10 ? minX - 10 : minX;
|
|
145
|
+
minY = minY > 10 ? minY - 10 : minY;
|
|
146
|
+
maxX = maxX + 10;
|
|
147
|
+
maxY = maxY + 10;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.forEach((values) => {
|
|
151
|
+
var _a, _b, _c, _d, _e;
|
|
152
|
+
if (values === null || values === void 0 ? void 0 : values.shape) {
|
|
153
|
+
minX = Math.min(minX, values.x);
|
|
154
|
+
minY = Math.min(minY, values.y);
|
|
155
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
156
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
157
|
+
}
|
|
158
|
+
if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("polygon")) {
|
|
159
|
+
minX = Math.min(minX, (_b = values === null || values === void 0 ? void 0 : values.points) === null || _b === void 0 ? void 0 : _b.reduce((min, point) => Math.min(min, point.x), Infinity));
|
|
160
|
+
minY = Math.min(minY, (_c = values === null || values === void 0 ? void 0 : values.points) === null || _c === void 0 ? void 0 : _c.reduce((min, point) => Math.min(min, point.y), Infinity));
|
|
161
|
+
maxX = Math.max(maxX, (_d = values === null || values === void 0 ? void 0 : values.points) === null || _d === void 0 ? void 0 : _d.reduce((max, point) => Math.max(max, point.x), -Infinity));
|
|
162
|
+
maxY = Math.max(maxY, (_e = values === null || values === void 0 ? void 0 : values.points) === null || _e === void 0 ? void 0 : _e.reduce((max, point) => Math.max(max, point.y), -Infinity));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
let backgroundHasOne = false;
|
|
166
|
+
if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 1 &&
|
|
167
|
+
((_b = (_a = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _a === void 0 ? void 0 : _a.shape) === null || _b === void 0 ? void 0 : _b.includes("background"))) {
|
|
168
|
+
backgroundHasOne = true;
|
|
169
|
+
// console.log({ backgroundHasOne },"shini")
|
|
170
|
+
minX = (_c = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _c === void 0 ? void 0 : _c.x;
|
|
171
|
+
minY = (_d = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _d === void 0 ? void 0 : _d.y;
|
|
172
|
+
maxX = (_e = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _e === void 0 ? void 0 : _e.width;
|
|
173
|
+
maxY = (_f = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _f === void 0 ? void 0 : _f.height;
|
|
174
|
+
}
|
|
175
|
+
const hasBoundingBox = boundingBoxProps;
|
|
176
|
+
// const paddingY =
|
|
177
|
+
// maxY * (props?.viewStyles?.paddingY || 0) +
|
|
178
|
+
// minY * (props?.viewStyles?.paddingY || 0);
|
|
179
|
+
// const paddingX =
|
|
180
|
+
// maxX * (props?.viewStyles?.paddingX || 0) +
|
|
181
|
+
// minX * (props?.viewStyles?.paddingX || 0);
|
|
182
|
+
if (hasBoundingBox) {
|
|
183
|
+
hasBoundingBoxRef.current = true;
|
|
184
|
+
return {
|
|
185
|
+
minX: boundingBoxProps.x,
|
|
186
|
+
minY: boundingBoxProps.y,
|
|
187
|
+
width: boundingBoxProps.width,
|
|
188
|
+
height: boundingBoxProps.height,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// return {
|
|
192
|
+
// minX: minX - paddingX - (minX - paddingX) * 0.5,
|
|
193
|
+
// minY: minY - paddingY * 2,
|
|
194
|
+
// width: maxX + paddingX * 2,
|
|
195
|
+
// height: maxY + paddingY + (maxY + paddingY) * 0.5,
|
|
196
|
+
// };
|
|
197
|
+
// console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
|
|
198
|
+
return {
|
|
199
|
+
minX: minX - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
|
|
200
|
+
minY: minY - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
|
|
201
|
+
width: maxX + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
|
|
202
|
+
height: maxY + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
|
|
203
|
+
};
|
|
204
|
+
}, [componentsEditor, extraComponentsEditor]);
|
|
205
|
+
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
206
|
+
return elementEditor.map((editorItem) => {
|
|
207
|
+
const isUsingMapping = mappingKey &&
|
|
208
|
+
typeof editorItem[mappingKey] === "object" &&
|
|
209
|
+
editorItem[mappingKey] !== null;
|
|
210
|
+
let finalProps = isUsingMapping ? editorItem[mappingKey] : editorItem;
|
|
211
|
+
if (tableMatchKey) {
|
|
212
|
+
const tableMatch = tableMatchKey.find((item) => item.key == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[statusKey]));
|
|
213
|
+
finalProps = Object.assign(Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties), { className: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.className });
|
|
214
|
+
}
|
|
215
|
+
return finalProps;
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const [fingerCount, setFingerCount] = useState(0);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const container = document.getElementById("workspace");
|
|
221
|
+
const handleTouchStart = (e) => {
|
|
222
|
+
const count = e.touches.length;
|
|
223
|
+
setFingerCount(count);
|
|
224
|
+
};
|
|
225
|
+
const handleTouchEnd = () => {
|
|
226
|
+
setFingerCount(0);
|
|
227
|
+
};
|
|
228
|
+
if (container) {
|
|
229
|
+
container.addEventListener("touchstart", handleTouchStart);
|
|
230
|
+
container.addEventListener("touchend", handleTouchEnd);
|
|
231
|
+
}
|
|
232
|
+
return () => {
|
|
233
|
+
if (container) {
|
|
234
|
+
container.removeEventListener("touchstart", handleTouchStart);
|
|
235
|
+
container.removeEventListener("touchend", handleTouchEnd);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}, []);
|
|
239
|
+
const handleTableEvent = (event, type) => {
|
|
240
|
+
var _a;
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
// cari elemen yg diklik
|
|
243
|
+
const elementTarget = event.target;
|
|
244
|
+
if (!elementTarget)
|
|
245
|
+
return;
|
|
246
|
+
// cari group data-id terdekat
|
|
247
|
+
const group = elementTarget.closest("g[data-id]");
|
|
248
|
+
if (!group)
|
|
249
|
+
return;
|
|
250
|
+
try {
|
|
251
|
+
const tableId = JSON.parse(group.getAttribute("data-id") || "{}");
|
|
252
|
+
const dragEvent = event;
|
|
253
|
+
const dataTransfer = JSON.parse(((_a = dragEvent.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData("application/json")) || "{}");
|
|
254
|
+
const data = {
|
|
255
|
+
targetTable: originalData({ id: tableId, type: "find" }),
|
|
256
|
+
sourceTable: originalData({ dataParams: dataTransfer, type: "get" }),
|
|
257
|
+
};
|
|
258
|
+
// drop from out layout editor
|
|
259
|
+
if (type === "drop") {
|
|
260
|
+
onDrop && onDrop(event, data);
|
|
261
|
+
}
|
|
262
|
+
// cari elemen bentuk (rect / circle / path)
|
|
263
|
+
const shape = group.querySelector("rect") ||
|
|
264
|
+
group.querySelector("circle") ||
|
|
265
|
+
group.querySelector("path");
|
|
266
|
+
if (!shape)
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
console.error("Invalid data-id JSON:", err);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const getSvgCoords = (e) => {
|
|
274
|
+
var _a;
|
|
275
|
+
const svg = svgRef.current;
|
|
276
|
+
const point = svg.createSVGPoint();
|
|
277
|
+
point.x = e.clientX;
|
|
278
|
+
point.y = e.clientY;
|
|
279
|
+
const transformed = point.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
|
|
280
|
+
return { x: transformed.x, y: transformed.y };
|
|
281
|
+
};
|
|
282
|
+
const handlePointerDown = (e) => {
|
|
283
|
+
var _a;
|
|
284
|
+
const svg = svgRef.current;
|
|
285
|
+
if (!e.isPrimary)
|
|
286
|
+
return;
|
|
287
|
+
if (!svg)
|
|
288
|
+
return;
|
|
289
|
+
isDragging.current = false;
|
|
290
|
+
let hasMoved = false;
|
|
291
|
+
const startX = e.clientX;
|
|
292
|
+
const startY = e.clientY;
|
|
293
|
+
const { x, y } = getSvgCoords(e);
|
|
294
|
+
const targetGroup = e.target.closest("g[data-id]");
|
|
295
|
+
if (!targetGroup) {
|
|
296
|
+
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
setPanningGroup(true);
|
|
300
|
+
// clone element yang diklik
|
|
301
|
+
let ghost = targetGroup.cloneNode(true);
|
|
302
|
+
const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
303
|
+
const allowedDrag = !(props === null || props === void 0 ? void 0 : props.dragTableBlockKey) ? true :
|
|
304
|
+
(_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
305
|
+
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
306
|
+
return _.value !== (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
307
|
+
});
|
|
308
|
+
if (ghostAttributes) {
|
|
309
|
+
Object.keys(ghostAttributes).forEach((key) => {
|
|
310
|
+
ghost.setAttribute(key, ghostAttributes[key]);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
ghost.setAttribute("opacity", "0.5");
|
|
314
|
+
ghost.setAttribute("pointer-events", "none");
|
|
315
|
+
ghost.setAttribute("stroke-width", "1");
|
|
316
|
+
svg.appendChild(ghost);
|
|
317
|
+
tableGhost.current = ghost;
|
|
318
|
+
const pt = svg.createSVGPoint();
|
|
319
|
+
pt.x = e.clientX;
|
|
320
|
+
pt.y = e.clientY;
|
|
321
|
+
const startBox = getTranslate(targetGroup);
|
|
322
|
+
const groupCTM = targetGroup.getCTM();
|
|
323
|
+
if (!groupCTM) {
|
|
324
|
+
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const offset = {
|
|
328
|
+
x: x - startBox.x,
|
|
329
|
+
y: y - startBox.y,
|
|
330
|
+
};
|
|
331
|
+
const pointerMoveGhost = (ev) => {
|
|
332
|
+
var _a;
|
|
333
|
+
isDragging.current = true;
|
|
334
|
+
const p = svg.createSVGPoint();
|
|
335
|
+
p.x = ev.clientX;
|
|
336
|
+
p.y = ev.clientY;
|
|
337
|
+
const dx = ev.clientX - startX;
|
|
338
|
+
const dy = ev.clientY - startY;
|
|
339
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
340
|
+
onPanning(ev);
|
|
341
|
+
if (!hasMoved && distance > 0) {
|
|
342
|
+
// transformRef?.current?.instance
|
|
343
|
+
// only move ghost if the mouse has moved more than 5 pixels
|
|
344
|
+
hasMoved = true;
|
|
345
|
+
isDragging.current = true;
|
|
346
|
+
}
|
|
347
|
+
// ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
|
|
348
|
+
ghost.style.display = "none";
|
|
349
|
+
const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
|
|
350
|
+
ghost.style.display = "";
|
|
351
|
+
const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
|
|
352
|
+
const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
|
|
353
|
+
const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
|
|
354
|
+
if (dataHoveredGhostId !== dataGhostId) {
|
|
355
|
+
hoverUnderghostId.current = dataHoveredGhostId;
|
|
356
|
+
}
|
|
357
|
+
const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
|
|
358
|
+
// posisi awal ghost di bawah kursor tanpa matrix dulu
|
|
359
|
+
const newX = posSVG.x - offset.x;
|
|
360
|
+
const newY = posSVG.y - offset.y;
|
|
361
|
+
if (allowedDrag) {
|
|
362
|
+
ghost.setAttribute("transform", `translate(${newX}, ${newY})`);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
// tampilkan ghost di posisi awal
|
|
366
|
+
pointerMoveGhost(e.nativeEvent);
|
|
367
|
+
const pointerHandleUp = (e) => {
|
|
368
|
+
var _a;
|
|
369
|
+
if (!hasMoved) {
|
|
370
|
+
const dataId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
371
|
+
isDragging.current = false;
|
|
372
|
+
const dataGroupEmty = !dataId;
|
|
373
|
+
// TOOLTIP ACTION
|
|
374
|
+
const svgSize = svg.getBoundingClientRect();
|
|
375
|
+
const widthScreeen = svgSize.width;
|
|
376
|
+
const heightScreen = svgSize.height;
|
|
377
|
+
const clientX = e.clientX;
|
|
378
|
+
const clientY = e.clientY;
|
|
379
|
+
const relX = clientX - svgSize.left;
|
|
380
|
+
const relY = clientY - svgSize.top;
|
|
381
|
+
const centerX = widthScreeen / 2;
|
|
382
|
+
const centerY = heightScreen / 2;
|
|
383
|
+
let newX = 0;
|
|
384
|
+
let newY = 0;
|
|
385
|
+
if (relX > centerX) {
|
|
386
|
+
newX = relX - widthTooltip;
|
|
387
|
+
}
|
|
388
|
+
else if (relX < centerX) {
|
|
389
|
+
newX = relX;
|
|
390
|
+
}
|
|
391
|
+
else if (relX === centerX) {
|
|
392
|
+
newX = relX;
|
|
393
|
+
}
|
|
394
|
+
if (relY > centerY) {
|
|
395
|
+
newY = relY;
|
|
396
|
+
}
|
|
397
|
+
else if (relY < centerY) {
|
|
398
|
+
newY = relY;
|
|
399
|
+
}
|
|
400
|
+
else if (relY === centerY) {
|
|
401
|
+
newY = relY;
|
|
402
|
+
}
|
|
403
|
+
const rightClick = e.button === 2 && !dataGroupEmty && allowTooltip;
|
|
404
|
+
setTooltip({
|
|
405
|
+
x: newX / scale,
|
|
406
|
+
y: newY / scale,
|
|
407
|
+
visible: rightClick,
|
|
408
|
+
});
|
|
409
|
+
const findDayaById = originalData({ id: dataId, type: "find" });
|
|
410
|
+
handleSelectComponent(findDayaById, e);
|
|
411
|
+
}
|
|
412
|
+
if (isDragging.current && hasMoved && allowedDrag) {
|
|
413
|
+
// drag between group
|
|
414
|
+
const dataHoveredGhost = hoverUnderghostId.current;
|
|
415
|
+
hoverUnderghostId.current = null;
|
|
416
|
+
const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
417
|
+
const data = {
|
|
418
|
+
targetTable: originalData({ id: dataHoveredGhost, type: "find" }),
|
|
419
|
+
sourceTable: originalData({ id: sourceTable, type: "find" }),
|
|
420
|
+
};
|
|
421
|
+
const allowToSwitch = onSwitch && (data === null || data === void 0 ? void 0 : data.sourceTable) && (data === null || data === void 0 ? void 0 : data.targetTable);
|
|
422
|
+
allowToSwitch && onSwitch(e, data);
|
|
423
|
+
ghost.remove();
|
|
424
|
+
isDragging.current = false;
|
|
425
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
426
|
+
tableGhost.current = null;
|
|
427
|
+
}
|
|
428
|
+
setPanningGroup(false);
|
|
429
|
+
tableGhost.current = null;
|
|
430
|
+
isDragging.current = false;
|
|
431
|
+
window.removeEventListener("pointermove", pointerMoveGhost);
|
|
432
|
+
window.removeEventListener("pointerup", pointerHandleUp);
|
|
433
|
+
};
|
|
434
|
+
window.addEventListener("pointermove", pointerMoveGhost);
|
|
435
|
+
window.addEventListener("pointerup", pointerHandleUp);
|
|
436
|
+
};
|
|
437
|
+
const handleMouseUp = () => {
|
|
438
|
+
var _a;
|
|
439
|
+
// isDragging.current = false;
|
|
440
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
441
|
+
tableGhost.current = null;
|
|
442
|
+
};
|
|
443
|
+
useEffect(() => {
|
|
444
|
+
return () => {
|
|
445
|
+
var _a;
|
|
446
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
447
|
+
};
|
|
448
|
+
}, []);
|
|
449
|
+
const handlePan = (dx, dy) => {
|
|
450
|
+
var _a, _b;
|
|
451
|
+
const instance = (_a = transformRef.current) === null || _a === void 0 ? void 0 : _a.instance;
|
|
452
|
+
const setTransform = (_b = transformRef === null || transformRef === void 0 ? void 0 : transformRef.current) === null || _b === void 0 ? void 0 : _b.setTransform;
|
|
453
|
+
if (!instance)
|
|
454
|
+
return;
|
|
455
|
+
const bounds = instance.bounds;
|
|
456
|
+
const { positionX, positionY, scale } = instance.transformState;
|
|
457
|
+
let x = positionX + dx;
|
|
458
|
+
let y = positionY + dy;
|
|
459
|
+
if (x >= bounds.maxPositionX)
|
|
460
|
+
x = bounds.maxPositionX;
|
|
461
|
+
if (y >= bounds.maxPositionY)
|
|
462
|
+
y = bounds.maxPositionY;
|
|
463
|
+
if (y <= bounds.minPositionY)
|
|
464
|
+
y = bounds.minPositionY;
|
|
465
|
+
if (x <= bounds.minPositionX)
|
|
466
|
+
x = bounds.minPositionX;
|
|
467
|
+
setTransform(x, y, scale, 100, "linear");
|
|
468
|
+
};
|
|
469
|
+
// const instance = transformRef.current?.instance;
|
|
470
|
+
// console.log({ instance })
|
|
471
|
+
const getCoords = (e) => {
|
|
472
|
+
var _a;
|
|
473
|
+
const svg = svgRef.current;
|
|
474
|
+
const instance = (_a = transformRef.current) === null || _a === void 0 ? void 0 : _a.instance;
|
|
475
|
+
if (!svg || !instance)
|
|
476
|
+
return null;
|
|
477
|
+
const { positionX, positionY, scale } = instance.transformState;
|
|
478
|
+
let clientX, clientY;
|
|
479
|
+
if ("touches" in e && e.touches.length > 0) {
|
|
480
|
+
clientX = e.touches[0].clientX;
|
|
481
|
+
clientY = e.touches[0].clientY;
|
|
482
|
+
}
|
|
483
|
+
else if ("clientX" in e) {
|
|
484
|
+
clientX = e.clientX;
|
|
485
|
+
clientY = e.clientY;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
490
|
+
const svgRect = svg.getBoundingClientRect();
|
|
491
|
+
// const viewBox = svg.viewBox.baseVal;
|
|
492
|
+
const xLeft = (clientX - svgRect.left + positionX) / scale;
|
|
493
|
+
const yTop = (clientY - svgRect.top + positionY) / scale;
|
|
494
|
+
const xRight = clientX - svgRect.left + positionX - svgRect.width / scale;
|
|
495
|
+
const yBottom = clientY - svgRect.top + positionY - svgRect.height / scale;
|
|
496
|
+
const minX = svgRect.left + positionX;
|
|
497
|
+
const minY = svgRect.top + positionY;
|
|
498
|
+
const maxX = svgRect.right;
|
|
499
|
+
const maxY = svgRect.bottom;
|
|
500
|
+
return [
|
|
501
|
+
xLeft,
|
|
502
|
+
yTop,
|
|
503
|
+
Math.abs(xRight),
|
|
504
|
+
Math.abs(yBottom),
|
|
505
|
+
minX,
|
|
506
|
+
minY,
|
|
507
|
+
maxX,
|
|
508
|
+
maxY,
|
|
509
|
+
];
|
|
510
|
+
};
|
|
511
|
+
const onPanning = (e) => {
|
|
512
|
+
const [xLeft, yTop, xRight, yBottom, minX, minY, maxX, maxY] = getCoords(e);
|
|
513
|
+
const edgeThreshold = 100;
|
|
514
|
+
const speedPanning = 50;
|
|
515
|
+
if (scale !== 1) {
|
|
516
|
+
if (xLeft < edgeThreshold)
|
|
517
|
+
handlePan(speedPanning, 0);
|
|
518
|
+
if (xRight < edgeThreshold)
|
|
519
|
+
handlePan(-speedPanning, 0);
|
|
520
|
+
if (yTop < edgeThreshold)
|
|
521
|
+
handlePan(0, speedPanning);
|
|
522
|
+
if (yBottom < edgeThreshold)
|
|
523
|
+
handlePan(0, -speedPanning);
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
const hasBoundingBox = hasBoundingBoxRef.current;
|
|
527
|
+
return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{
|
|
528
|
+
overflow: "auto",
|
|
529
|
+
WebkitOverflowScrolling: "touch",
|
|
530
|
+
filter: disabled ? "grayscale(100%)" : "none",
|
|
531
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
532
|
+
}} {...props.containerProps}>
|
|
533
|
+
{loading && (<div className="absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center">
|
|
534
|
+
{(loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || <Spin />}
|
|
535
|
+
</div>)}
|
|
536
|
+
|
|
537
|
+
{/* {isDragging?.current && (
|
|
538
|
+
<div className="absolute bottom-1/2 left-1 flex gap-4 z-[10]">
|
|
539
|
+
<button className="p-4 bg-gray-400">+</button>
|
|
540
|
+
</div>
|
|
541
|
+
)} */}
|
|
542
|
+
|
|
543
|
+
<TransformWrapper ref={transformRef}
|
|
544
|
+
// disabled={fingerCount === 1 && scale === 1}
|
|
545
|
+
disablePadding={true} centerZoomedOut={true} panning={{
|
|
546
|
+
disabled: panningGroup,
|
|
547
|
+
wheelPanning: true,
|
|
548
|
+
}} wheel={{
|
|
549
|
+
disabled: false,
|
|
550
|
+
}} onTransformed={({ state: { scale } }) => setScale(scale)} minScale={1} maxScale={1000} initialScale={1} smooth={true} centerOnInit={true} {...props.transformProps}>
|
|
551
|
+
<TransformComponent wrapperStyle={{
|
|
552
|
+
width: "100%",
|
|
553
|
+
height: "100%",
|
|
554
|
+
// overflow: "visible",
|
|
555
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
556
|
+
}} contentStyle={{
|
|
557
|
+
width: "100%",
|
|
558
|
+
height: "100%",
|
|
559
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
560
|
+
}}>
|
|
561
|
+
<svg id="workspace" onContextMenu={(e) => e.preventDefault()} onDrop={(e) => handleTableEvent(e, "drop")} onPointerDown={handlePointerDown} onPointerUp={handleMouseUp} ref={svgRef} width="100%" height="100%"
|
|
562
|
+
// scale={5}
|
|
563
|
+
overflow="hidden" viewBox={`${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`} className={"h-full"} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
|
|
564
|
+
background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
|
|
565
|
+
display: "block",
|
|
566
|
+
pointerEvents: disabled ? "none" : "all",
|
|
567
|
+
touchAction: "none",
|
|
568
|
+
userSelect: "none",
|
|
569
|
+
}} {...props.svgProps}>
|
|
570
|
+
{hasBoundingBox && (<defs>
|
|
571
|
+
<clipPath id="contentCrop">
|
|
572
|
+
<rect x={boundingBox.minX} y={boundingBox.minY} width={boundingBox.width} height={boundingBox.height}/>
|
|
573
|
+
</clipPath>
|
|
574
|
+
</defs>)}
|
|
575
|
+
<g id="main-layer" clip-path="url(#contentCrop)">
|
|
576
|
+
<Layers components={[
|
|
577
|
+
...extraComponentsEditor,
|
|
578
|
+
...renderElements(componentsEditor, mappingKey, tableMatchKey),
|
|
579
|
+
]} selectedTable={selectedTable} iconTags={iconTags} eventMatchTable={eventMatchTable} privilegedTags={privilegedTags}/>
|
|
580
|
+
</g>
|
|
581
|
+
{/* 🧠 Ghost universal */}
|
|
582
|
+
</svg>
|
|
583
|
+
{tooltip.visible && (<div className={`seat-editor tooltip-container ${tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className}`} style={Object.assign({ top: tooltip.y, left: tooltip.x, transform: `scale(${1 / scale})`, transformOrigin: "top left", minWidth: widthTooltip + "px" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.style)}>
|
|
584
|
+
{tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.children}
|
|
585
|
+
</div>)}
|
|
586
|
+
</TransformComponent>
|
|
587
|
+
</TransformWrapper>
|
|
588
|
+
</div>);
|
|
589
|
+
};
|
|
590
|
+
export default LayerView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const findComponentById: (components: any[], id: string) => any;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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-only";
|
|
6
|
+
import LayerView2 from "./features/view-only-2";
|
|
7
|
+
import LayerView3 from "./features/view-only-3";
|
|
8
|
+
import TableEditor from "./features/package";
|
|
9
|
+
export * from "./dto/table";
|
|
10
|
+
export { StoreProvider as ProviderSeatEditor, Board, SideTool, ControlPanels, LayerView, LayerView2, TableEditor as SeatEditor, LayerView3, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const rootReducer: import("redux").Reducer<{
|
|
2
|
+
board: import("../features/board-v3/board-slice").InitialState;
|
|
3
|
+
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
4
|
+
panel: import("../features/panel/panel-slice").PanelState;
|
|
5
|
+
theme: import("../features/theme/theme-slice").ThemeProps;
|
|
6
|
+
}, import("redux").UnknownAction, Partial<{
|
|
7
|
+
board: import("../features/board-v3/board-slice").InitialState;
|
|
8
|
+
tool: import("../features/side-tool/side-tool-slice").ToolState;
|
|
9
|
+
panel: import("../features/panel/panel-slice").PanelState;
|
|
10
|
+
theme: import("../features/theme/theme-slice").ThemeProps;
|
|
11
|
+
}>>;
|
|
12
|
+
export type RootState = ReturnType<typeof rootReducer>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { combineReducers } from "redux";
|
|
3
|
+
import boardSlice from "../features/board-v3/board-slice";
|
|
4
|
+
import sideTool from "../features/side-tool/side-tool-slice";
|
|
5
|
+
import panelSlice from "../features/panel/panel-slice";
|
|
6
|
+
import themeSlice from "../features/theme/theme-slice";
|
|
7
|
+
export const rootReducer = combineReducers({
|
|
8
|
+
// Add your reducers here
|
|
9
|
+
board: boardSlice,
|
|
10
|
+
tool: sideTool,
|
|
11
|
+
panel: panelSlice,
|
|
12
|
+
theme: themeSlice
|
|
13
|
+
// Example: user: userReducer,
|
|
14
|
+
});
|