seat-editor 2.1.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/constant.d.ts +232 -0
- package/dist/app/constant.js +3683 -3045
- package/dist/app/new-board/page.js +5 -6
- package/dist/app/only-view/chair.d.ts +1 -0
- package/dist/app/only-view/chair.js +4 -0
- package/dist/app/only-view/constant.d.ts +22 -2
- package/dist/app/only-view/constant.js +4 -4
- package/dist/app/only-view/page.js +74 -37
- package/dist/app/only-view/user.d.ts +1 -0
- package/dist/app/only-view/user.js +4 -0
- package/dist/components/layer-v3/index.d.ts +23 -4
- package/dist/components/layer-v3/index.js +329 -146
- package/dist/components/layer-v4/index.d.ts +20 -0
- package/dist/components/layer-v4/index.js +445 -0
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/lib/index.js +1 -1
- package/dist/features/board/index.js +1 -1
- package/dist/features/board-v2/index.js +1 -1
- package/dist/features/board-v3/board-slice.d.ts +1 -0
- package/dist/features/board-v3/board-slice.js +26 -3
- package/dist/features/board-v3/constant.d.ts +5 -0
- package/dist/features/board-v3/constant.js +5 -0
- package/dist/features/board-v3/index copy.d.ts +47 -0
- package/dist/features/board-v3/index copy.js +2073 -0
- package/dist/features/board-v3/index.js +1409 -647
- 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 +40 -0
- package/dist/features/board-v3/utils.d.ts +162 -0
- package/dist/features/board-v3/utils.js +787 -0
- package/dist/features/package/index.js +1 -1
- package/dist/features/panel/index.js +130 -20
- package/dist/features/panel/panel-slice.d.ts +5 -0
- package/dist/features/panel/panel-slice.js +15 -0
- package/dist/features/panel/select-tool.js +11 -1
- package/dist/features/panel/selected-group.d.ts +2 -0
- package/dist/features/panel/selected-group.js +7 -0
- package/dist/features/panel/table-seat-square.d.ts +2 -0
- package/dist/features/panel/table-seat-square.js +9 -0
- package/dist/features/side-tool/index.js +13 -6
- package/dist/features/view-only/index.js +0 -1
- package/dist/features/view-only-2/index.js +0 -1
- package/dist/features/view-only-3/index.d.ts +68 -0
- package/dist/features/view-only-3/index.js +510 -0
- package/dist/features/view-only-3/utils.d.ts +1 -0
- package/dist/features/view-only-3/utils.js +3 -0
- package/dist/seat-editor.css +1 -1
- package/dist/utils/constant.d.ts +1 -0
- package/dist/utils/constant.js +11 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.js +29 -0
- package/package.json +3 -1
- package/dist/features/view/index.d.ts +0 -19
- package/dist/features/view/index.js +0 -221
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState, useImperativeHandle, } from "react";
|
|
4
|
+
import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
|
|
5
|
+
import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
6
|
+
import Layers from "../../components/layer-v4";
|
|
7
|
+
import { isEmpty } from "lodash";
|
|
8
|
+
const LayerView = (props) => {
|
|
9
|
+
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, } = 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 [tooltip, setTooltip] = useState({
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0,
|
|
19
|
+
visible: false,
|
|
20
|
+
});
|
|
21
|
+
const isDragging = useRef(false);
|
|
22
|
+
const [panningGroup, setPanningGroup] = useState(false);
|
|
23
|
+
const [scale, setScale] = useState(1);
|
|
24
|
+
const [selectedTable, setSelectedTable] = useState(null);
|
|
25
|
+
const { components: componentsEditor, extraComponents: extraComponentsEditor, } = useAppSelector((state) => state.board);
|
|
26
|
+
const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
|
|
27
|
+
useImperativeHandle(refs, () => ({
|
|
28
|
+
svgRef: svgRef === null || svgRef === void 0 ? void 0 : svgRef.current,
|
|
29
|
+
transformRef: transformRef === null || transformRef === void 0 ? void 0 : transformRef.current,
|
|
30
|
+
containerRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current,
|
|
31
|
+
tableGhost: tableGhost === null || tableGhost === void 0 ? void 0 : tableGhost.current,
|
|
32
|
+
hoverUnderghost: originalData({
|
|
33
|
+
id: hoverUnderghostId === null || hoverUnderghostId === void 0 ? void 0 : hoverUnderghostId.current,
|
|
34
|
+
type: "find",
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
const dispatch = useAppDispatch();
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if ((componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) > 0) {
|
|
40
|
+
dispatch({
|
|
41
|
+
type: "board/setNewComponents",
|
|
42
|
+
payload: componentProps,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if ((extraComponentProps === null || extraComponentProps === void 0 ? void 0 : extraComponentProps.length) > 0) {
|
|
46
|
+
dispatch({
|
|
47
|
+
type: "board/setNewExtraComponents",
|
|
48
|
+
payload: extraComponentProps,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (defaultBackground) {
|
|
52
|
+
dispatch({
|
|
53
|
+
type: "board/setBackgroundColor",
|
|
54
|
+
payload: defaultBackground,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [componentProps, extraComponentProps, defaultBackground]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
onCurrentStateChange &&
|
|
60
|
+
onCurrentStateChange({
|
|
61
|
+
components: componentsEditor,
|
|
62
|
+
extraComponents: extraComponentsEditor,
|
|
63
|
+
});
|
|
64
|
+
}, [componentsEditor, extraComponentsEditor]);
|
|
65
|
+
const originalData = ({ id, type, dataParams, }) => {
|
|
66
|
+
let data;
|
|
67
|
+
if (type === "find") {
|
|
68
|
+
data = componentsEditor.find((item) => {
|
|
69
|
+
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
70
|
+
return item[mappingKey].id == id;
|
|
71
|
+
}
|
|
72
|
+
return (item === null || item === void 0 ? void 0 : item.id) === id;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (type === "get" && dataParams) {
|
|
76
|
+
data = mappingKey ? dataParams[mappingKey] : dataParams;
|
|
77
|
+
}
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
const handleSelectComponent = (items, e) => {
|
|
81
|
+
const find = componentsEditor.find((item) => {
|
|
82
|
+
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
83
|
+
return item[mappingKey].id === (items === null || items === void 0 ? void 0 : items.id);
|
|
84
|
+
}
|
|
85
|
+
return (item === null || item === void 0 ? void 0 : item.id) === (items === null || items === void 0 ? void 0 : items.id);
|
|
86
|
+
});
|
|
87
|
+
const rightClick = e.button === 2;
|
|
88
|
+
onRightClick && rightClick && onRightClick(e, find);
|
|
89
|
+
onSelectComponent && !rightClick && onSelectComponent(find);
|
|
90
|
+
const seletedTable = mappingKey ? find[mappingKey] : find;
|
|
91
|
+
setSelectedTable(seletedTable);
|
|
92
|
+
};
|
|
93
|
+
const boundingBox = useMemo(() => {
|
|
94
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
95
|
+
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
96
|
+
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
97
|
+
}
|
|
98
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
99
|
+
componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.forEach((_) => {
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
let values = mappingKey ? _[mappingKey] : _;
|
|
102
|
+
if (!values)
|
|
103
|
+
return;
|
|
104
|
+
if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("square")) {
|
|
105
|
+
minX = Math.min(minX, values.x);
|
|
106
|
+
minY = Math.min(minY, values.y);
|
|
107
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
108
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
109
|
+
}
|
|
110
|
+
if ((_b = values === null || values === void 0 ? void 0 : values.shape) === null || _b === void 0 ? void 0 : _b.includes("circle")) {
|
|
111
|
+
minX = Math.min(minX, values.x);
|
|
112
|
+
minY = Math.min(minY, values.y);
|
|
113
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
114
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
115
|
+
}
|
|
116
|
+
if ((_c = values === null || values === void 0 ? void 0 : values.shape) === null || _c === void 0 ? void 0 : _c.includes("table-seat-circle")) {
|
|
117
|
+
minX = Math.min(minX, values.x);
|
|
118
|
+
minY = Math.min(minY, values.y);
|
|
119
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
120
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
121
|
+
}
|
|
122
|
+
if ((_d = values === null || values === void 0 ? void 0 : values.shape) === null || _d === void 0 ? void 0 : _d.includes("image-table")) {
|
|
123
|
+
minX = Math.min(minX, values.x);
|
|
124
|
+
minY = Math.min(minY, values.y);
|
|
125
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
126
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.forEach((values) => {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
if ((_a = values === null || values === void 0 ? void 0 : values.shape) === null || _a === void 0 ? void 0 : _a.includes("background")) {
|
|
132
|
+
minX = Math.min(minX, values.x);
|
|
133
|
+
minY = Math.min(minY, values.y);
|
|
134
|
+
maxX = Math.max(maxX, values.x + values.width);
|
|
135
|
+
maxY = Math.max(maxY, values.y + values.height);
|
|
136
|
+
}
|
|
137
|
+
if ((_b = values === null || values === void 0 ? void 0 : values.shape) === null || _b === void 0 ? void 0 : _b.includes("text")) {
|
|
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
|
+
});
|
|
144
|
+
let backgroundHasOne = false;
|
|
145
|
+
if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 1 &&
|
|
146
|
+
((_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"))) {
|
|
147
|
+
backgroundHasOne = true;
|
|
148
|
+
minX = (_c = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _c === void 0 ? void 0 : _c.x;
|
|
149
|
+
minY = (_d = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _d === void 0 ? void 0 : _d.y;
|
|
150
|
+
maxX = (_e = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _e === void 0 ? void 0 : _e.width;
|
|
151
|
+
maxY = (_f = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _f === void 0 ? void 0 : _f.height;
|
|
152
|
+
}
|
|
153
|
+
if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) < 1 &&
|
|
154
|
+
["background", "text"].includes((_g = componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor[0]) === null || _g === void 0 ? void 0 : _g.shape)) {
|
|
155
|
+
minX = minX - minX * 0.5;
|
|
156
|
+
minY = minY - minY * 0.5;
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
minX: backgroundHasOne ? minX : minX - minX * 0.5,
|
|
160
|
+
minY: backgroundHasOne ? minY : minY - minY * 0.5,
|
|
161
|
+
width: maxX,
|
|
162
|
+
height: maxY,
|
|
163
|
+
};
|
|
164
|
+
}, [componentsEditor, extraComponentsEditor]);
|
|
165
|
+
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
166
|
+
return elementEditor.map((editorItem) => {
|
|
167
|
+
const isUsingMapping = mappingKey &&
|
|
168
|
+
typeof editorItem[mappingKey] === "object" &&
|
|
169
|
+
editorItem[mappingKey] !== null;
|
|
170
|
+
let finalProps = isUsingMapping ? editorItem[mappingKey] : editorItem;
|
|
171
|
+
if (tableMatchKey) {
|
|
172
|
+
const tableMatch = tableMatchKey.find((item) => item.key == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[statusKey]));
|
|
173
|
+
finalProps = Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties);
|
|
174
|
+
}
|
|
175
|
+
return finalProps;
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
const [fingerCount, setFingerCount] = useState(0);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
const container = document.getElementById("workspace");
|
|
181
|
+
const handleTouchStart = (e) => {
|
|
182
|
+
const count = e.touches.length;
|
|
183
|
+
setFingerCount(count);
|
|
184
|
+
};
|
|
185
|
+
const handleTouchEnd = () => {
|
|
186
|
+
setFingerCount(0);
|
|
187
|
+
};
|
|
188
|
+
if (container) {
|
|
189
|
+
container.addEventListener("touchstart", handleTouchStart);
|
|
190
|
+
container.addEventListener("touchend", handleTouchEnd);
|
|
191
|
+
}
|
|
192
|
+
return () => {
|
|
193
|
+
if (container) {
|
|
194
|
+
container.removeEventListener("touchstart", handleTouchStart);
|
|
195
|
+
container.removeEventListener("touchend", handleTouchEnd);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}, []);
|
|
199
|
+
const handleTableEvent = (event, type) => {
|
|
200
|
+
var _a;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
console.log("drop");
|
|
203
|
+
// cari elemen yg diklik
|
|
204
|
+
const elementTarget = event.target;
|
|
205
|
+
if (!elementTarget)
|
|
206
|
+
return;
|
|
207
|
+
// cari group data-id terdekat
|
|
208
|
+
const group = elementTarget.closest("g[data-id]");
|
|
209
|
+
if (!group)
|
|
210
|
+
return;
|
|
211
|
+
try {
|
|
212
|
+
const tableId = JSON.parse(group.getAttribute("data-id") || "{}");
|
|
213
|
+
const dragEvent = event;
|
|
214
|
+
const dataTransfer = JSON.parse(((_a = dragEvent.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData("application/json")) || "{}");
|
|
215
|
+
const data = {
|
|
216
|
+
targetTable: originalData({ id: tableId, type: "find" }),
|
|
217
|
+
sourceTable: originalData({ dataParams: dataTransfer, type: "get" }),
|
|
218
|
+
};
|
|
219
|
+
// drop from out layout editor
|
|
220
|
+
if (type === "drop") {
|
|
221
|
+
onDrop && onDrop(event, data);
|
|
222
|
+
}
|
|
223
|
+
// cari elemen bentuk (rect / circle / path)
|
|
224
|
+
const shape = group.querySelector("rect") ||
|
|
225
|
+
group.querySelector("circle") ||
|
|
226
|
+
group.querySelector("path");
|
|
227
|
+
if (!shape)
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
console.error("Invalid data-id JSON:", err);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const handlePointerDown = (e) => {
|
|
235
|
+
var _a, _b;
|
|
236
|
+
const svg = svgRef.current;
|
|
237
|
+
if (!e.isPrimary)
|
|
238
|
+
return;
|
|
239
|
+
if (!svg)
|
|
240
|
+
return;
|
|
241
|
+
isDragging.current = false;
|
|
242
|
+
let hasMoved = false;
|
|
243
|
+
const startX = e.clientX;
|
|
244
|
+
const startY = e.clientY;
|
|
245
|
+
const targetGroup = e.target.closest("g[data-id]");
|
|
246
|
+
if (!targetGroup) {
|
|
247
|
+
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
setPanningGroup(true);
|
|
251
|
+
// clone element yang diklik
|
|
252
|
+
let ghost = targetGroup.cloneNode(true);
|
|
253
|
+
const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
254
|
+
const allowedDrag = (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
255
|
+
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
256
|
+
return _.value !== (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
257
|
+
});
|
|
258
|
+
if (ghostAttributes) {
|
|
259
|
+
Object.keys(ghostAttributes).forEach((key) => {
|
|
260
|
+
ghost.setAttribute(key, ghostAttributes[key]);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
ghost.setAttribute("opacity", "0.5");
|
|
264
|
+
ghost.setAttribute("pointer-events", "none");
|
|
265
|
+
ghost.setAttribute("stroke-width", "1");
|
|
266
|
+
svg.appendChild(ghost);
|
|
267
|
+
tableGhost.current = ghost;
|
|
268
|
+
const pt = svg.createSVGPoint();
|
|
269
|
+
pt.x = e.clientX;
|
|
270
|
+
pt.y = e.clientY;
|
|
271
|
+
const pointerSVG = pt.matrixTransform((_b = svg.getScreenCTM()) === null || _b === void 0 ? void 0 : _b.inverse());
|
|
272
|
+
const box = targetGroup.getBBox();
|
|
273
|
+
const mousePositionInGroup = {
|
|
274
|
+
x: pointerSVG.x - box.x,
|
|
275
|
+
y: pointerSVG.y - box.y,
|
|
276
|
+
};
|
|
277
|
+
const groupCTM = targetGroup.getCTM();
|
|
278
|
+
if (!groupCTM) {
|
|
279
|
+
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const offset = {
|
|
283
|
+
x: box.x + mousePositionInGroup.x,
|
|
284
|
+
y: box.y + mousePositionInGroup.y,
|
|
285
|
+
};
|
|
286
|
+
const pointerMoveGhost = (ev) => {
|
|
287
|
+
var _a;
|
|
288
|
+
isDragging.current = true;
|
|
289
|
+
const p = svg.createSVGPoint();
|
|
290
|
+
p.x = ev.clientX;
|
|
291
|
+
p.y = ev.clientY;
|
|
292
|
+
const dx = ev.clientX - startX;
|
|
293
|
+
const dy = ev.clientY - startY;
|
|
294
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
295
|
+
onPanning(ev);
|
|
296
|
+
if (!hasMoved && distance > 0) {
|
|
297
|
+
// transformRef?.current?.instance
|
|
298
|
+
// only move ghost if the mouse has moved more than 5 pixels
|
|
299
|
+
hasMoved = true;
|
|
300
|
+
isDragging.current = true;
|
|
301
|
+
}
|
|
302
|
+
// ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
|
|
303
|
+
ghost.style.display = "none";
|
|
304
|
+
const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
|
|
305
|
+
ghost.style.display = "";
|
|
306
|
+
const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
|
|
307
|
+
const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
|
|
308
|
+
const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
|
|
309
|
+
if (dataHoveredGhostId !== dataGhostId) {
|
|
310
|
+
hoverUnderghostId.current = dataHoveredGhostId;
|
|
311
|
+
}
|
|
312
|
+
const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
|
|
313
|
+
// posisi awal ghost di bawah kursor tanpa matrix dulu
|
|
314
|
+
const newX = posSVG.x - offset.x;
|
|
315
|
+
const newY = posSVG.y - offset.y;
|
|
316
|
+
if (allowedDrag) {
|
|
317
|
+
ghost.setAttribute("transform", `translate(${newX}, ${newY})`);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
// tampilkan ghost di posisi awal
|
|
321
|
+
pointerMoveGhost(e.nativeEvent);
|
|
322
|
+
const pointerHandleUp = (e) => {
|
|
323
|
+
var _a;
|
|
324
|
+
if (!hasMoved) {
|
|
325
|
+
const dataId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
326
|
+
isDragging.current = false;
|
|
327
|
+
const dataGroupEmty = isEmpty(dataId);
|
|
328
|
+
// TOOLTIP ACTION
|
|
329
|
+
const svgSize = svg.getBoundingClientRect();
|
|
330
|
+
const widthScreeen = svgSize.width;
|
|
331
|
+
const heightScreen = svgSize.height;
|
|
332
|
+
const clientX = e.clientX;
|
|
333
|
+
const clientY = e.clientY;
|
|
334
|
+
const relX = clientX - svgSize.left;
|
|
335
|
+
const relY = clientY - svgSize.top;
|
|
336
|
+
const centerX = widthScreeen / 2;
|
|
337
|
+
const centerY = heightScreen / 2;
|
|
338
|
+
let newX = 0;
|
|
339
|
+
let newY = 0;
|
|
340
|
+
if (relX > centerX) {
|
|
341
|
+
newX = relX - widthTooltip;
|
|
342
|
+
}
|
|
343
|
+
else if (relX < centerX) {
|
|
344
|
+
newX = relX;
|
|
345
|
+
}
|
|
346
|
+
else if (relX === centerX) {
|
|
347
|
+
newX = relX;
|
|
348
|
+
}
|
|
349
|
+
if (relY > centerY) {
|
|
350
|
+
newY = relY;
|
|
351
|
+
}
|
|
352
|
+
else if (relY < centerY) {
|
|
353
|
+
newY = relY;
|
|
354
|
+
}
|
|
355
|
+
else if (relY === centerY) {
|
|
356
|
+
newY = relY;
|
|
357
|
+
}
|
|
358
|
+
const rightClick = e.button === 2 && !dataGroupEmty && allowTooltip;
|
|
359
|
+
setTooltip({
|
|
360
|
+
x: newX,
|
|
361
|
+
y: newY,
|
|
362
|
+
visible: rightClick,
|
|
363
|
+
});
|
|
364
|
+
// console.log("klik");
|
|
365
|
+
const findDayaById = originalData({ id: dataId, type: "find" });
|
|
366
|
+
handleSelectComponent(findDayaById, e);
|
|
367
|
+
}
|
|
368
|
+
if (isDragging.current && hasMoved && allowedDrag) {
|
|
369
|
+
// drag between group
|
|
370
|
+
const dataHoveredGhost = hoverUnderghostId.current;
|
|
371
|
+
hoverUnderghostId.current = null;
|
|
372
|
+
const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
373
|
+
const data = {
|
|
374
|
+
targetTable: originalData({ id: dataHoveredGhost, type: "find" }),
|
|
375
|
+
sourceTable: originalData({ id: sourceTable, type: "find" }),
|
|
376
|
+
};
|
|
377
|
+
const allowToSwitch = onSwitch && (data === null || data === void 0 ? void 0 : data.sourceTable) && (data === null || data === void 0 ? void 0 : data.targetTable);
|
|
378
|
+
allowToSwitch && onSwitch(e, data);
|
|
379
|
+
ghost.remove();
|
|
380
|
+
isDragging.current = false;
|
|
381
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
382
|
+
tableGhost.current = null;
|
|
383
|
+
}
|
|
384
|
+
setPanningGroup(false);
|
|
385
|
+
tableGhost.current = null;
|
|
386
|
+
isDragging.current = false;
|
|
387
|
+
window.removeEventListener("pointermove", pointerMoveGhost);
|
|
388
|
+
window.removeEventListener("pointerup", pointerHandleUp);
|
|
389
|
+
};
|
|
390
|
+
window.addEventListener("pointermove", pointerMoveGhost);
|
|
391
|
+
window.addEventListener("pointerup", pointerHandleUp);
|
|
392
|
+
};
|
|
393
|
+
const handleMouseUp = () => {
|
|
394
|
+
var _a;
|
|
395
|
+
// isDragging.current = false;
|
|
396
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
397
|
+
tableGhost.current = null;
|
|
398
|
+
};
|
|
399
|
+
useEffect(() => {
|
|
400
|
+
return () => {
|
|
401
|
+
var _a;
|
|
402
|
+
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
403
|
+
};
|
|
404
|
+
}, []);
|
|
405
|
+
const handlePan = (dx, dy) => {
|
|
406
|
+
var _a, _b;
|
|
407
|
+
const instance = (_a = transformRef.current) === null || _a === void 0 ? void 0 : _a.instance;
|
|
408
|
+
const setTransform = (_b = transformRef === null || transformRef === void 0 ? void 0 : transformRef.current) === null || _b === void 0 ? void 0 : _b.setTransform;
|
|
409
|
+
if (!instance)
|
|
410
|
+
return;
|
|
411
|
+
const bounds = instance.bounds;
|
|
412
|
+
const { positionX, positionY, scale } = instance.transformState;
|
|
413
|
+
let x = positionX + dx;
|
|
414
|
+
let y = positionY + dy;
|
|
415
|
+
if (x >= bounds.maxPositionX)
|
|
416
|
+
x = bounds.maxPositionX;
|
|
417
|
+
if (y >= bounds.maxPositionY)
|
|
418
|
+
y = bounds.maxPositionY;
|
|
419
|
+
if (y <= bounds.minPositionY)
|
|
420
|
+
y = bounds.minPositionY;
|
|
421
|
+
if (x <= bounds.minPositionX)
|
|
422
|
+
x = bounds.minPositionX;
|
|
423
|
+
setTransform(x, y, scale, 100, "linear");
|
|
424
|
+
};
|
|
425
|
+
const getCoords = (e) => {
|
|
426
|
+
var _a;
|
|
427
|
+
const svg = svgRef.current;
|
|
428
|
+
const instance = (_a = transformRef.current) === null || _a === void 0 ? void 0 : _a.instance;
|
|
429
|
+
if (!svg || !instance)
|
|
430
|
+
return null;
|
|
431
|
+
const { positionX, positionY, scale } = instance.transformState;
|
|
432
|
+
let clientX, clientY;
|
|
433
|
+
if ("touches" in e && e.touches.length > 0) {
|
|
434
|
+
clientX = e.touches[0].clientX;
|
|
435
|
+
clientY = e.touches[0].clientY;
|
|
436
|
+
}
|
|
437
|
+
else if ("clientX" in e) {
|
|
438
|
+
clientX = e.clientX;
|
|
439
|
+
clientY = e.clientY;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
const svgRect = svg.getBoundingClientRect();
|
|
445
|
+
const viewBox = svg.viewBox.baseVal;
|
|
446
|
+
const xLeft = (clientX - svgRect.left + positionX) / scale;
|
|
447
|
+
const yTop = (clientY - svgRect.top + positionY) / scale;
|
|
448
|
+
const xRight = clientX - svgRect.left + positionX - svgRect.width / scale;
|
|
449
|
+
const yBottom = clientY - svgRect.top + positionY - svgRect.height / scale;
|
|
450
|
+
const minX = svgRect.left + positionX;
|
|
451
|
+
const minY = svgRect.top + positionY;
|
|
452
|
+
const maxX = svgRect.right;
|
|
453
|
+
const maxY = svgRect.bottom;
|
|
454
|
+
const hiddenLeft = Math.max(viewBox.x) / scale;
|
|
455
|
+
return [
|
|
456
|
+
xLeft,
|
|
457
|
+
yTop,
|
|
458
|
+
Math.abs(xRight),
|
|
459
|
+
Math.abs(yBottom),
|
|
460
|
+
minX,
|
|
461
|
+
minY,
|
|
462
|
+
maxX,
|
|
463
|
+
maxY,
|
|
464
|
+
];
|
|
465
|
+
};
|
|
466
|
+
const onPanning = (e) => {
|
|
467
|
+
const [xLeft, yTop, xRight, yBottom, minX, minY, maxX, maxY] = getCoords(e);
|
|
468
|
+
const edgeThreshold = 100;
|
|
469
|
+
const speedPanning = 50;
|
|
470
|
+
if (scale !== 1) {
|
|
471
|
+
if (xLeft < edgeThreshold)
|
|
472
|
+
handlePan(speedPanning, 0);
|
|
473
|
+
if (xRight < edgeThreshold)
|
|
474
|
+
handlePan(-speedPanning, 0);
|
|
475
|
+
if (yTop < edgeThreshold)
|
|
476
|
+
handlePan(0, speedPanning);
|
|
477
|
+
if (yBottom < edgeThreshold)
|
|
478
|
+
handlePan(0, -speedPanning);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
return (_jsx("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
|
|
482
|
+
height: "100vh",
|
|
483
|
+
overflow: "auto",
|
|
484
|
+
WebkitOverflowScrolling: "touch",
|
|
485
|
+
} }, props.containerProps, { children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, {
|
|
486
|
+
// disabled={fingerCount === 1 && scale === 1}
|
|
487
|
+
disablePadding: true, centerZoomedOut: true, panning: {
|
|
488
|
+
disabled: panningGroup,
|
|
489
|
+
wheelPanning: true,
|
|
490
|
+
}, wheel: {
|
|
491
|
+
disabled: false,
|
|
492
|
+
}, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, smooth: true, children: _jsxs(TransformComponent, { wrapperStyle: {
|
|
493
|
+
width: "100%",
|
|
494
|
+
height: "100%",
|
|
495
|
+
overflow: "visible",
|
|
496
|
+
}, contentStyle: {
|
|
497
|
+
width: "100%",
|
|
498
|
+
height: "100%",
|
|
499
|
+
}, children: [_jsx("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
|
|
500
|
+
background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
|
|
501
|
+
display: "block",
|
|
502
|
+
pointerEvents: "all",
|
|
503
|
+
touchAction: "none",
|
|
504
|
+
userSelect: "none",
|
|
505
|
+
} }, props.svgProps, { children: _jsx("g", { id: "main-layer", children: _jsx(Layers, { components: [
|
|
506
|
+
...extraComponentsEditor,
|
|
507
|
+
...renderElements(componentsEditor, mappingKey, tableMatchKey),
|
|
508
|
+
], selectedTable: selectedTable, iconTags: iconTags, eventMatchTable: eventMatchTable }) }) })), tooltip.visible && (_jsx("div", { className: `seat-editor tooltip-container ${tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className}`, style: Object.assign({ top: tooltip.y, left: tooltip.x, minWidth: widthTooltip + "px" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.style), children: "hallo dunia" }))] }) })) })));
|
|
509
|
+
};
|
|
510
|
+
export default LayerView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const findComponentById: (components: any[], id: string) => any;
|
package/dist/seat-editor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.bottom-2{bottom:.5rem}.bottom-5{bottom:1.25rem}.bottom-\[60px\]{bottom:60px}.left-0{left:0}.left-1\/2{left:50%}.right-0{right:0}.z-10{z-index:10}.mb-2{margin-bottom:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.flex{display:flex}.table{display:table}.\!grid{display:grid!important}.grid{display:grid}.hidden{display:none}.h-3{height:.75rem}.h-\[1000px\]{height:1000px}.h-\[500px\]{height:500px}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[200px\]{max-height:200px}.max-h-screen{max-height:100vh}.w-16{width:4rem}.w-3{width:.75rem}.w-full{width:100%}.flex-1{flex:1 1 0%}.-translate-x-1\/2{--tw-translate-x:-50%}.-translate-x-1\/2,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-ew-resize{cursor:ew-resize}.cursor-move{cursor:move}.cursor-nesw-resize{cursor:nesw-resize}.cursor-ns-resize{cursor:ns-resize}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-4{gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem*var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.border{border-width:1px}.border-2{border-width:2px}.border-r{border-right-width:1px}.border-r-2{border-right-width:2px}.border-dashed{border-style:dashed}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity,1))}.border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-bottom:1rem}.pt-4,.py-4{padding-top:1rem}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.heading-s{font-size:20px;font-weight:600;line-height:24px;letter-spacing:-.0006em}.text-sm{font-size:12px;font-weight:500;line-height:16px;letter-spacing:0}.divider-dashed{border-top:1px dashed var(--netral-04);width:100%;margin:16px 0}:root{--background:#fff;--foreground:#171717;--primary-color:#181e49;--secondary-color:#f0f2f5;--background-color:#f5f5f5;--success-color:#63cc47;--netral-03:#ededed;--netral-04:#e0e0e0;--netral-05:#c2c2c2;--netral-06:#9e9e9e;--netral-07:#757575;--netral-08:#616161;--netral-09:#404040;--netral-10:#0a0a0a;--danger:#cb3a31;--accent:#ff9800;--info:#3267e3}body{color:var(--foreground);background:var(--background);font-family:Arial,Helvetica,sans-serif}.custom-styles .excalidraw{--color-primary:#fcc6d9;--color-primary-darker:#f783ac;--color-primary-darkest:#e64980;--color-primary-light:#f2a9c4}.custom-styles .excalidraw.theme--dark{--color-primary:#d494aa;--color-primary-darker:#d64c7e;--color-primary-darkest:#e86e99;--color-primary-light:#dcbec9}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.ant-drawer-mask{background:none!important}
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.bottom-1\/2{bottom:50%}.bottom-2{bottom:.5rem}.bottom-5{bottom:1.25rem}.bottom-\[60px\]{bottom:60px}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-\[-300px\]{right:-300px}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[10\]{z-index:10}.m-4{margin:1rem}.mb-2{margin-bottom:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.flex{display:flex}.table{display:table}.\!grid{display:grid!important}.grid{display:grid}.hidden{display:none}.h-3{height:.75rem}.h-40{height:10rem}.h-\[1000px\]{height:1000px}.h-\[500px\]{height:500px}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[200px\]{max-height:200px}.max-h-screen{max-height:100vh}.w-1\/3{width:33.333333%}.w-16{width:4rem}.w-2\/3{width:66.666667%}.w-3{width:.75rem}.w-\[300px\]{width:300px}.w-full{width:100%}.flex-1{flex:1 1 0%}.-translate-x-1\/2{--tw-translate-x:-50%}.-translate-x-1\/2,.-translate-y-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-4{gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem*var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-r-2{border-right-width:2px}.border-dashed{border-style:dashed}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity,1))}.border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-bottom:1rem}.pt-4,.py-4{padding-top:1rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.heading-s{font-size:20px;font-weight:600;line-height:24px;letter-spacing:-.0006em}.text-sm{font-size:12px;font-weight:500;line-height:16px;letter-spacing:0}.divider-dashed{border-top:1px dashed var(--netral-04);width:100%;margin:16px 0}:root{--background:#fff;--foreground:#171717;--primary-color:#181e49;--secondary-color:#f0f2f5;--background-color:#f5f5f5;--success-color:#63cc47;--netral-03:#ededed;--netral-04:#e0e0e0;--netral-05:#c2c2c2;--netral-06:#9e9e9e;--netral-07:#757575;--netral-08:#616161;--netral-09:#404040;--netral-10:#0a0a0a;--danger:#cb3a31;--accent:#ff9800;--info:#3267e3}body{color:var(--foreground);background:var(--background);font-family:Arial,Helvetica,sans-serif}.custom-styles .excalidraw{--color-primary:#fcc6d9;--color-primary-darker:#f783ac;--color-primary-darkest:#e64980;--color-primary-light:#f2a9c4}.custom-styles .excalidraw.theme--dark{--color-primary:#d494aa;--color-primary-darker:#d64c7e;--color-primary-darkest:#e86e99;--color-primary-light:#dcbec9}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.ant-drawer-mask{background:none!important}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TABLE_KEYS: string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const parseDataAttribute = (el, attr, fallback) => {
|
|
2
|
+
if (!el)
|
|
3
|
+
return fallback;
|
|
4
|
+
const raw = el.getAttribute(attr);
|
|
5
|
+
if (!raw)
|
|
6
|
+
return fallback;
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(raw);
|
|
9
|
+
}
|
|
10
|
+
catch (err) {
|
|
11
|
+
console.warn(`Failed to parse attribute "${attr}":`, err);
|
|
12
|
+
return fallback;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const parseDataAttributeList = (elements, attr) => {
|
|
16
|
+
const result = [];
|
|
17
|
+
elements.forEach((el) => {
|
|
18
|
+
const raw = el.getAttribute(attr);
|
|
19
|
+
if (!raw)
|
|
20
|
+
return;
|
|
21
|
+
try {
|
|
22
|
+
result.push(JSON.parse(raw));
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.warn(`Failed to parse attribute "${attr}" on element`, err);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seat-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
"@ant-design/nextjs-registry": "^1.0.2",
|
|
23
23
|
"@babel/plugin-syntax-flow": "^7.27.1",
|
|
24
24
|
"@reduxjs/toolkit": "^2.7.0",
|
|
25
|
+
"@uiw/react-json-view": "^2.0.0-alpha.39",
|
|
25
26
|
"antd": "^5.24.3",
|
|
26
27
|
"antd-img-crop": "^4.25.0",
|
|
27
28
|
"axios": "^1.9.0",
|
|
28
29
|
"clsx": "^2.1.1",
|
|
30
|
+
"framer-motion": "^12.23.24",
|
|
29
31
|
"lodash": "^4.17.21",
|
|
30
32
|
"lucide-react": "^0.482.0",
|
|
31
33
|
"next": "^14.2.30",
|
|
@@ -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-runtime").JSX.Element;
|
|
19
|
-
export default LayerView;
|