seat-editor 3.2.7 → 3.2.10
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.js +149 -0
- package/dist/app/new-board/page.jsx +11 -6
- package/dist/app/only-view/page.jsx +7 -2
- package/dist/components/layer-v3/index.jsx +2 -2
- package/dist/components/layer-v4/constant.d.ts +48 -0
- package/dist/components/layer-v4/constant.js +74 -0
- package/dist/components/layer-v4/index.jsx +125 -118
- package/dist/features/board-v3/board-slice.d.ts +1 -0
- package/dist/features/board-v3/board-slice.js +55 -45
- package/dist/features/board-v3/index.jsx +40 -34
- package/dist/features/panel/index.jsx +23 -29
- package/dist/features/panel/panel-slice.js +1 -5
- package/dist/features/panel/selected-group.jsx +4 -0
- package/dist/features/panel/upload-tool.jsx +10 -7
- package/dist/features/view-only-3/index.d.ts +2 -0
- package/dist/features/view-only-3/index.jsx +12 -8
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import ModalPreview from "../../components/modal-preview";
|
|
|
8
8
|
import LayerView from "../view-only-3";
|
|
9
9
|
import { isEqual, debounce } from "lodash";
|
|
10
10
|
import { ZoomIn, ZoomOut } from "lucide-react";
|
|
11
|
-
import { Button } from "antd";
|
|
11
|
+
import { Button, Radio } from "antd";
|
|
12
12
|
import { getAttributeElement, getAttributeElements } from "./resize-element";
|
|
13
13
|
import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlobalBBox, getRotation, getSvgElementSize, getTranslate, isClosingPolygon, normalizeAngle, pointsStringToArray, resizeBox, resizeSeatCircle, resizeSeatRectCircle, resizeSeatRectSquare, resizeSeatSide, resizeSeatSquare, stabilizeRotation, stabilizeTranslateOnRotate, updateManyComponents, updateSelectionBox, updateSelectionGuides, updateSingleComponent, } from "./utils";
|
|
14
14
|
const toolElement = ["square", "circle", "table-seat-circle"];
|
|
@@ -66,7 +66,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
66
66
|
//polygon
|
|
67
67
|
const polygonElementRef = useRef([]);
|
|
68
68
|
const isOnMakePolygonRef = useRef(false);
|
|
69
|
-
const { components: componentsProps, extraComponents: extraComponentsProps, flagChange, updateBy, } = useAppSelector((state) => state.board);
|
|
69
|
+
const { components: componentsProps, extraComponents: extraComponentsProps, flagChange, updateBy, isShowTagType } = useAppSelector((state) => state.board);
|
|
70
70
|
const { selectionLines } = useAppSelector((state) => state.panel);
|
|
71
71
|
const [selectedLines, setSelectedLines] = useState(null);
|
|
72
72
|
useEffect(() => {
|
|
@@ -214,19 +214,15 @@ const BoardTemplate = ({ refs }) => {
|
|
|
214
214
|
const updateComponentsAttribute = (components) => {
|
|
215
215
|
if (!components.length)
|
|
216
216
|
return;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// components,
|
|
222
|
-
// setExtraComponentsState
|
|
223
|
-
// );
|
|
224
|
-
// dispatch({ type: "board/setUpdateBy", payload: "local" });
|
|
225
|
-
// queueUpdateComponents(nextExtra);
|
|
226
|
-
// }
|
|
217
|
+
const nextExtraComponents = updateManyComponents(extraComponentsState, components, setExtraComponentsState);
|
|
218
|
+
if (nextExtraComponents) {
|
|
219
|
+
queueUpdateComponents(nextExtraComponents);
|
|
220
|
+
}
|
|
227
221
|
const nextComponents = updateManyComponents(componentsState, components, setComponentsState);
|
|
222
|
+
if (nextComponents) {
|
|
223
|
+
queueUpdateComponents(nextComponents);
|
|
224
|
+
}
|
|
228
225
|
dispatch({ type: "board/setUpdateBy", payload: "local" });
|
|
229
|
-
// queueUpdateExtraComponents(nextComponents);
|
|
230
226
|
};
|
|
231
227
|
const addComponents = (component) => {
|
|
232
228
|
const index = extraComponentsState.findIndex((c) => (c === null || c === void 0 ? void 0 : c.shape) === "bounding-box");
|
|
@@ -1077,7 +1073,7 @@ const BoardTemplate = ({ refs }) => {
|
|
|
1077
1073
|
}
|
|
1078
1074
|
};
|
|
1079
1075
|
const pointerHandleUp = (e) => {
|
|
1080
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
1076
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1081
1077
|
updateSelectionGuides(svg, {
|
|
1082
1078
|
x: 0,
|
|
1083
1079
|
y: 0,
|
|
@@ -1352,13 +1348,6 @@ const BoardTemplate = ({ refs }) => {
|
|
|
1352
1348
|
});
|
|
1353
1349
|
const newDataComponent = results.map((r) => r.newDataComponent);
|
|
1354
1350
|
const dataSelection = results.map((r) => r.newDataSelection);
|
|
1355
|
-
// const currentRotation = getRotation(
|
|
1356
|
-
// (selectionLines?.children[0] as SVGGraphicsElement)?.transform
|
|
1357
|
-
// ?.baseVal
|
|
1358
|
-
// );
|
|
1359
|
-
// rotationSelectionRef.current = currentRotation;
|
|
1360
|
-
const sizeSelection = getSvgElementSize((_q = selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.children[0]) === null || _q === void 0 ? void 0 : _q.children[0]);
|
|
1361
|
-
// const newBoxSelection = getGlobalBBox(svg, selectionLines);
|
|
1362
1351
|
updateComponentsAttribute(newDataComponent);
|
|
1363
1352
|
const newDataSelection = {
|
|
1364
1353
|
x: Math.min(...dataSelection.map((d) => d.x)),
|
|
@@ -1381,19 +1370,14 @@ const BoardTemplate = ({ refs }) => {
|
|
|
1381
1370
|
});
|
|
1382
1371
|
setSelectedLines(newDataSelection);
|
|
1383
1372
|
dataElementSelectionGroupRef.current = newDataComponent;
|
|
1384
|
-
// // remove ghost element
|
|
1385
|
-
// svgRef.current
|
|
1386
|
-
// ?.querySelectorAll("#ghost-element-has-selection")
|
|
1387
|
-
// .forEach((el) => el.remove());
|
|
1388
1373
|
hadSelectionRef.current = false;
|
|
1389
1374
|
}
|
|
1390
1375
|
//MOVE SELECTION BOX UP
|
|
1391
1376
|
if (downOutResizePositionAndInSelectionBox &&
|
|
1392
1377
|
!shiftActive &&
|
|
1393
1378
|
!isRotateSelectionBox) {
|
|
1394
|
-
const selectionLines = (_r = svgRef.current) === null || _r === void 0 ? void 0 : _r.querySelector("#selection-lines");
|
|
1395
1379
|
isResizeSelectionRef.current = false;
|
|
1396
|
-
const results = (
|
|
1380
|
+
const results = (_q = dataElementSelectionGroupRef.current) === null || _q === void 0 ? void 0 : _q.map((item) => {
|
|
1397
1381
|
const { g, element, inner } = getAttributeElement(svg, item.id);
|
|
1398
1382
|
const { x, y } = getTranslate(g);
|
|
1399
1383
|
const getBBox = getGlobalBBox(svg, g);
|
|
@@ -1431,17 +1415,11 @@ const BoardTemplate = ({ refs }) => {
|
|
|
1431
1415
|
payload: null,
|
|
1432
1416
|
});
|
|
1433
1417
|
setSelectedLines(newDataSelection);
|
|
1434
|
-
// if (newDataSelection?.height?.id) {
|
|
1435
|
-
// newDataSelection.height = newDataSelection.height.id;
|
|
1436
|
-
// }
|
|
1437
|
-
// if (newDataSelection?.x) {
|
|
1438
|
-
// setSelectedLines(newDataSelection);
|
|
1439
|
-
// }
|
|
1440
1418
|
dataElementSelectionGroupRef.current = newDataComponent;
|
|
1441
1419
|
hadSelectionRef.current = false;
|
|
1442
1420
|
}
|
|
1443
1421
|
//DELETE GHOST ELEMENT BISA MEMBU
|
|
1444
|
-
(
|
|
1422
|
+
(_r = svgRef.current) === null || _r === void 0 ? void 0 : _r.querySelectorAll("#ghost-element").forEach((el) => el.remove());
|
|
1445
1423
|
//UPDATE DATASET TO STATE IF MOVEk
|
|
1446
1424
|
// if (releaseGroupRef.current) return;
|
|
1447
1425
|
if ((isMightMove &&
|
|
@@ -1500,9 +1478,37 @@ const BoardTemplate = ({ refs }) => {
|
|
|
1500
1478
|
//lin helper from start to move
|
|
1501
1479
|
}
|
|
1502
1480
|
};
|
|
1481
|
+
const handleCheckPreview = (e) => {
|
|
1482
|
+
const type = e.target.value;
|
|
1483
|
+
if (type === "type-1") {
|
|
1484
|
+
dispatch({
|
|
1485
|
+
type: "board/setTagType",
|
|
1486
|
+
payload: type,
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
if (type === "type-2") {
|
|
1490
|
+
dispatch({
|
|
1491
|
+
type: "board/setTagType",
|
|
1492
|
+
payload: type,
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
if (type === "default") {
|
|
1496
|
+
dispatch({
|
|
1497
|
+
type: "board/setTagType",
|
|
1498
|
+
payload: type,
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1503
1502
|
return (<>
|
|
1504
1503
|
<ModalPreview>
|
|
1505
1504
|
<LayerView statusKey="status"/>
|
|
1505
|
+
<div className="flex gap-2 mt-2">
|
|
1506
|
+
<Radio.Group value={isShowTagType} onChange={handleCheckPreview}>
|
|
1507
|
+
<Radio value="default">Default</Radio>
|
|
1508
|
+
<Radio value="type-1">Type 1</Radio>
|
|
1509
|
+
<Radio value="type-2">Type 2</Radio>
|
|
1510
|
+
</Radio.Group>
|
|
1511
|
+
</div>
|
|
1506
1512
|
</ModalPreview>
|
|
1507
1513
|
<div className="relative w-full h-screen flex-1 overflow-hidden" ref={containerRef}>
|
|
1508
1514
|
<div className="absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10">
|
|
@@ -43,7 +43,6 @@ const ControlPanels = (props) => {
|
|
|
43
43
|
let values = Form.useWatch([], form);
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
if (selectedComponent) {
|
|
46
|
-
console.log("selectedComponent", selectedComponent);
|
|
47
46
|
const isDifferentId = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) !== (values === null || values === void 0 ? void 0 : values.id) || !(values === null || values === void 0 ? void 0 : values.id);
|
|
48
47
|
const isSameIdAndSameDimensions = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) === (values === null || values === void 0 ? void 0 : values.id) &&
|
|
49
48
|
(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.height) === (values === null || values === void 0 ? void 0 : values.height) &&
|
|
@@ -56,7 +55,6 @@ const ControlPanels = (props) => {
|
|
|
56
55
|
form.setFieldsValue(selectedComponent);
|
|
57
56
|
}
|
|
58
57
|
else if (selectedGroup) {
|
|
59
|
-
console.log("selectedGroup", selectedGroup);
|
|
60
58
|
if (show)
|
|
61
59
|
setOpen(true);
|
|
62
60
|
if (!show)
|
|
@@ -67,32 +65,24 @@ const ControlPanels = (props) => {
|
|
|
67
65
|
const firstValue = arr[0][key];
|
|
68
66
|
return arr.every((item) => item[key] === firstValue);
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
isSameFill,
|
|
85
|
-
isSameStroke,
|
|
86
|
-
isSameOpacity,
|
|
87
|
-
isSampeRotation,
|
|
88
|
-
isSameStrokeWidth,
|
|
68
|
+
function getValueIfSame(arr, key) {
|
|
69
|
+
return isSameAllByKey(arr, key) ? arr[0][key] : undefined;
|
|
70
|
+
}
|
|
71
|
+
form.setFieldsValue({
|
|
72
|
+
width: getValueIfSame(selectedGroup, "width"),
|
|
73
|
+
height: getValueIfSame(selectedGroup, "height"),
|
|
74
|
+
x: getValueIfSame(selectedGroup, "x"),
|
|
75
|
+
y: getValueIfSame(selectedGroup, "y"),
|
|
76
|
+
fill: getValueIfSame(selectedGroup, "fill"),
|
|
77
|
+
stroke: getValueIfSame(selectedGroup, "stroke"),
|
|
78
|
+
opacity: getValueIfSame(selectedGroup, "opacity"),
|
|
79
|
+
rotation: getValueIfSame(selectedGroup, "rotation"),
|
|
80
|
+
strokeWidth: getValueIfSame(selectedGroup, "strokeWidth"),
|
|
81
|
+
radius: getValueIfSame(selectedGroup, "radius"),
|
|
89
82
|
});
|
|
90
|
-
|
|
91
|
-
? { strokeWidth: selectedGroup[0].strokeWidth }
|
|
92
|
-
: {})));
|
|
83
|
+
const values = form.getFieldsValue();
|
|
93
84
|
}
|
|
94
85
|
else {
|
|
95
|
-
console.log("selectedGroup", selectedGroup);
|
|
96
86
|
setOpen(false);
|
|
97
87
|
}
|
|
98
88
|
}, [selectedComponent, selectedGroup, show]);
|
|
@@ -140,7 +130,11 @@ const ControlPanels = (props) => {
|
|
|
140
130
|
}, 300));
|
|
141
131
|
const debounceSyncDataSelectedGroup = useRef(debounce((data) => {
|
|
142
132
|
dispatch({
|
|
143
|
-
type: "
|
|
133
|
+
type: "panel/updateSelectedGroup",
|
|
134
|
+
payload: data,
|
|
135
|
+
});
|
|
136
|
+
dispatch({
|
|
137
|
+
type: "board/updateComponentsBulk",
|
|
144
138
|
payload: data,
|
|
145
139
|
});
|
|
146
140
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
@@ -178,8 +172,8 @@ const ControlPanels = (props) => {
|
|
|
178
172
|
debouncedSyncComponents.current(Object.assign(Object.assign({}, (selectedComponent || {})), newValues));
|
|
179
173
|
}
|
|
180
174
|
if ((selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.length) > 0) {
|
|
181
|
-
const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, } = newValues;
|
|
182
|
-
const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {}))));
|
|
175
|
+
const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, } = newValues;
|
|
176
|
+
const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {}))));
|
|
183
177
|
let minX = Infinity;
|
|
184
178
|
let minY = Infinity;
|
|
185
179
|
let maxX = -Infinity;
|
|
@@ -216,7 +210,7 @@ const ControlPanels = (props) => {
|
|
|
216
210
|
const renderFormPanel = () => {
|
|
217
211
|
switch (tool.active) {
|
|
218
212
|
case "select":
|
|
219
|
-
return
|
|
213
|
+
return <SelectToolForm action={action} tranform={transform}/>;
|
|
220
214
|
case "square":
|
|
221
215
|
case "circle":
|
|
222
216
|
return <SquareToolForm />;
|
|
@@ -31,11 +31,7 @@ export const panelSlice = createSlice({
|
|
|
31
31
|
state.selectedGroup = action.payload;
|
|
32
32
|
},
|
|
33
33
|
updateSelectedGroup: (state, action) => {
|
|
34
|
-
state.selectedGroup =
|
|
35
|
-
state.history.push(state.selectedGroup);
|
|
36
|
-
if (state.history.length > 20) {
|
|
37
|
-
state.history.shift();
|
|
38
|
-
}
|
|
34
|
+
state.selectedGroup = action.payload;
|
|
39
35
|
},
|
|
40
36
|
setSelectionLines: (state, action) => {
|
|
41
37
|
state.selectionLines = action.payload;
|
|
@@ -12,6 +12,9 @@ const SelectedGroup = () => {
|
|
|
12
12
|
<Form.Item label="Height" name="height" className="w-full">
|
|
13
13
|
<InputNumber suffix="px"/>
|
|
14
14
|
</Form.Item>
|
|
15
|
+
<Form.Item label="Radius" name={"radius"} className="w-full">
|
|
16
|
+
<InputNumber step={1} max={1} min={0}/>
|
|
17
|
+
</Form.Item>
|
|
15
18
|
</Flex>
|
|
16
19
|
<Flex gap={2}>
|
|
17
20
|
<Form.Item label="Position X" name="x" className="w-full">
|
|
@@ -39,6 +42,7 @@ const SelectedGroup = () => {
|
|
|
39
42
|
<Form.Item label="opacity" name={"opacity"} className="w-full">
|
|
40
43
|
<InputNumber step={0.1} max={1} min={0}/>
|
|
41
44
|
</Form.Item>
|
|
45
|
+
|
|
42
46
|
</Flex>
|
|
43
47
|
</div>
|
|
44
48
|
</div>
|
|
@@ -35,8 +35,8 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
|
|
|
35
35
|
id: id || new Date().getTime(),
|
|
36
36
|
x: Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionX),
|
|
37
37
|
y: Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionY),
|
|
38
|
-
width: width < 1 ?
|
|
39
|
-
height: height < 1 ?
|
|
38
|
+
width: width < 1 ? 200 : width,
|
|
39
|
+
height: height < 1 ? 200 : height,
|
|
40
40
|
rotation: 0,
|
|
41
41
|
shape: name,
|
|
42
42
|
src,
|
|
@@ -59,24 +59,27 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
|
|
|
59
59
|
if (isEdit) {
|
|
60
60
|
dispatch({
|
|
61
61
|
type: "board/updateComponent",
|
|
62
|
-
payload: Object.assign({}, defaultFormatValue(
|
|
62
|
+
payload: Object.assign({}, defaultFormatValue(defaultValue.width, defaultValue.height, src, Number(defaultValue.id))),
|
|
63
63
|
});
|
|
64
64
|
dispatch({
|
|
65
65
|
type: "panel/setSelectedComponent",
|
|
66
|
-
payload: Object.assign({}, defaultFormatValue(
|
|
66
|
+
payload: Object.assign({}, defaultFormatValue(0, 0, src, Number(defaultValue.id))),
|
|
67
67
|
});
|
|
68
68
|
setDefaultSrc(src);
|
|
69
69
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
70
70
|
dispatch({ type: "board/setUpdateBy", payload: "global" });
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
+
const defaultValue = Object.assign({}, defaultFormatValue(0, 0, src));
|
|
73
74
|
dispatch({
|
|
74
|
-
type: "
|
|
75
|
-
|
|
75
|
+
type: type === "component"
|
|
76
|
+
? "board/addComponent"
|
|
77
|
+
: "board/setExtraComponent",
|
|
78
|
+
payload: defaultValue,
|
|
76
79
|
});
|
|
77
80
|
dispatch({
|
|
78
81
|
type: "panel/setSelectedComponent",
|
|
79
|
-
payload:
|
|
82
|
+
payload: defaultValue,
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
85
|
}
|
|
@@ -9,6 +9,7 @@ export type TableGhost = {
|
|
|
9
9
|
export type TableMatchKey = {
|
|
10
10
|
key: string | number;
|
|
11
11
|
properties: PropertiesProps;
|
|
12
|
+
className?: string;
|
|
12
13
|
};
|
|
13
14
|
export type TableMatchEvent = {
|
|
14
15
|
event: EventHandleType;
|
|
@@ -76,6 +77,7 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
76
77
|
paddingRight?: number;
|
|
77
78
|
paddingBottom?: number;
|
|
78
79
|
};
|
|
80
|
+
disabled?: boolean;
|
|
79
81
|
}
|
|
80
82
|
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
|
|
81
83
|
export default LayerView;
|
|
@@ -5,7 +5,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
|
|
|
5
5
|
import Layers from "../../components/layer-v4";
|
|
6
6
|
import { getTranslate } from "../board-v3/utils";
|
|
7
7
|
const LayerView = (props) => {
|
|
8
|
-
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, } = props;
|
|
8
|
+
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled } = props;
|
|
9
9
|
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
10
10
|
const tableGhost = useRef(null);
|
|
11
11
|
const hoverUnderghostId = useRef(null);
|
|
@@ -186,10 +186,10 @@ const LayerView = (props) => {
|
|
|
186
186
|
// height: maxY + paddingY + (maxY + paddingY) * 0.5,
|
|
187
187
|
// };
|
|
188
188
|
return {
|
|
189
|
-
minX: minX - ((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop),
|
|
190
|
-
minY: minY - ((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingLeft),
|
|
191
|
-
width: maxX + ((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingRight),
|
|
192
|
-
height: maxY + ((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingBottom),
|
|
189
|
+
minX: minX - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
|
|
190
|
+
minY: minY - (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingLeft) || 0),
|
|
191
|
+
width: maxX + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingRight) || 0),
|
|
192
|
+
height: maxY + (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingBottom) || 0),
|
|
193
193
|
};
|
|
194
194
|
}, [componentsEditor, extraComponentsEditor]);
|
|
195
195
|
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
@@ -200,7 +200,7 @@ const LayerView = (props) => {
|
|
|
200
200
|
let finalProps = isUsingMapping ? editorItem[mappingKey] : editorItem;
|
|
201
201
|
if (tableMatchKey) {
|
|
202
202
|
const tableMatch = tableMatchKey.find((item) => item.key == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[statusKey]));
|
|
203
|
-
finalProps = Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties);
|
|
203
|
+
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 });
|
|
204
204
|
}
|
|
205
205
|
return finalProps;
|
|
206
206
|
});
|
|
@@ -514,6 +514,8 @@ const LayerView = (props) => {
|
|
|
514
514
|
return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{
|
|
515
515
|
overflow: "auto",
|
|
516
516
|
WebkitOverflowScrolling: "touch",
|
|
517
|
+
filter: disabled ? "grayscale(100%)" : "none",
|
|
518
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
517
519
|
}} {...props.containerProps}>
|
|
518
520
|
{/* {isDragging?.current && (
|
|
519
521
|
<div className="absolute bottom-1/2 left-1 flex gap-4 z-[10]">
|
|
@@ -533,18 +535,20 @@ const LayerView = (props) => {
|
|
|
533
535
|
width: "100%",
|
|
534
536
|
height: "100%",
|
|
535
537
|
// overflow: "visible",
|
|
538
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
536
539
|
}} contentStyle={{
|
|
537
540
|
width: "100%",
|
|
538
541
|
height: "100%",
|
|
542
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
539
543
|
}}>
|
|
540
544
|
<svg id="workspace" onContextMenu={(e) => e.preventDefault()} onDrop={(e) => handleTableEvent(e, "drop")} onPointerDown={handlePointerDown} onPointerUp={handleMouseUp} ref={svgRef} width="100%" height="100%"
|
|
541
545
|
// scale={5}
|
|
542
546
|
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={{
|
|
543
547
|
background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
|
|
544
548
|
display: "block",
|
|
545
|
-
pointerEvents: "all",
|
|
549
|
+
pointerEvents: disabled ? "none" : "all",
|
|
546
550
|
touchAction: "none",
|
|
547
|
-
userSelect: "none"
|
|
551
|
+
userSelect: "none"
|
|
548
552
|
}} {...props.svgProps}>
|
|
549
553
|
{hasBoundingBox && (<defs>
|
|
550
554
|
<clipPath id="contentCrop">
|