seat-editor 3.5.21 → 3.5.23
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/features/board-v3/index.js +0 -1
- package/dist/features/board-v3/index.jsx +0 -1
- package/dist/features/board-v3/resize-element.js +0 -1
- package/dist/features/board-v3/utils.js +0 -1
- package/dist/features/package/index.js +28 -11
- package/dist/features/package/index.jsx +28 -11
- package/dist/features/view-only-3/index.js +11 -10
- package/dist/features/view-only-3/index.jsx +11 -10
- package/dist/features/view-only-5/index.js +11 -10
- package/dist/features/view-only-5/index.jsx +11 -10
- package/package.json +1 -1
|
@@ -1607,7 +1607,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1607
1607
|
if (isInitialCreateText) {
|
|
1608
1608
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
1609
1609
|
const getBBox = getGlobalBBox(svg, ghost);
|
|
1610
|
-
console.log({ getBBox });
|
|
1611
1610
|
const text = Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "text", fill: "#000000", text: "Text", fontSize: 14, rotation: 0 });
|
|
1612
1611
|
addComponents(text);
|
|
1613
1612
|
dispatch({
|
|
@@ -1606,7 +1606,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
1606
1606
|
if (isInitialCreateText) {
|
|
1607
1607
|
const ghost = svg.querySelector("#ghost-element-create");
|
|
1608
1608
|
const getBBox = getGlobalBBox(svg, ghost);
|
|
1609
|
-
console.log({ getBBox });
|
|
1610
1609
|
const text = Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "text", fill: "#000000", text: "Text", fontSize: 14, rotation: 0 });
|
|
1611
1610
|
addComponents(text);
|
|
1612
1611
|
dispatch({
|
|
@@ -7,7 +7,6 @@ export function getAttributeElement(root, id) {
|
|
|
7
7
|
const boundingBox = root.querySelector(`g[data-bounding-box="${id}"]`);
|
|
8
8
|
const text = root === null || root === void 0 ? void 0 : root.querySelector(`g[data-text="${id}-text"]`);
|
|
9
9
|
const textRaw = root === null || root === void 0 ? void 0 : root.querySelector(`text[data-text-raw="${id}-text"]`);
|
|
10
|
-
console.log({ textRaw });
|
|
11
10
|
if (boundingBox) {
|
|
12
11
|
const element = boundingBox.querySelector("rect");
|
|
13
12
|
return { g: boundingBox, inner: null, element, seats, seatGroup };
|
|
@@ -1031,7 +1031,6 @@ const updateSvgAttrs = (el, attrs) => {
|
|
|
1031
1031
|
export function applyResizeToSvgElement(element, group, resize, text, textRaw) {
|
|
1032
1032
|
var _a, _b, _c, _d;
|
|
1033
1033
|
const tagName = element.tagName.toLowerCase();
|
|
1034
|
-
console.log({ tagName, textRaw });
|
|
1035
1034
|
switch (tagName) {
|
|
1036
1035
|
case "rect":
|
|
1037
1036
|
case "image": {
|
|
@@ -43,9 +43,22 @@ const TableEditor = (props) => {
|
|
|
43
43
|
}
|
|
44
44
|
}, [viewOnly]);
|
|
45
45
|
const onUpdateCurrentState = () => {
|
|
46
|
+
let reverseComponentHidden = (props === null || props === void 0 ? void 0 : props.hiddenStatusKey)
|
|
47
|
+
? components === null || components === void 0 ? void 0 : components.map((c, i) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const findHidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i);
|
|
50
|
+
if (findHidden) {
|
|
51
|
+
if (mappingKey && ((_a = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _a === void 0 ? void 0 : _a[mappingKey])) {
|
|
52
|
+
return Object.assign({}, omit((_b = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _b === void 0 ? void 0 : _b[mappingKey], `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`));
|
|
53
|
+
}
|
|
54
|
+
return omit(findHidden === null || findHidden === void 0 ? void 0 : findHidden.data, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`) || {};
|
|
55
|
+
}
|
|
56
|
+
return c;
|
|
57
|
+
})
|
|
58
|
+
: components;
|
|
46
59
|
let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
|
|
47
60
|
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
48
|
-
let findComponent =
|
|
61
|
+
let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
49
62
|
if (!findComponent)
|
|
50
63
|
return undefined;
|
|
51
64
|
if (findComponent) {
|
|
@@ -53,7 +66,7 @@ const TableEditor = (props) => {
|
|
|
53
66
|
}
|
|
54
67
|
}
|
|
55
68
|
else {
|
|
56
|
-
let findComponent =
|
|
69
|
+
let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
|
|
57
70
|
if (!findComponent)
|
|
58
71
|
return undefined;
|
|
59
72
|
if (findComponent) {
|
|
@@ -62,15 +75,18 @@ const TableEditor = (props) => {
|
|
|
62
75
|
}
|
|
63
76
|
});
|
|
64
77
|
const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
|
|
65
|
-
if (props
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
78
|
+
// if (props?.hiddenStatusKey) {
|
|
79
|
+
// matchInitialValueWithComponents = matchInitialValueWithComponents?.map(
|
|
80
|
+
// (_, i) => {
|
|
81
|
+
// const hidden = hiddenIdList?.find((h) => h?.key === i); // find by key, bukan index
|
|
82
|
+
// if (hidden) {
|
|
83
|
+
// return hidden?.data;
|
|
84
|
+
// }
|
|
85
|
+
// return _;
|
|
86
|
+
// }
|
|
87
|
+
// );
|
|
88
|
+
// }
|
|
89
|
+
console.log({ hasUndefined, matchInitialValueWithComponents }, !hasUndefined && !viewOnly);
|
|
74
90
|
if (!hasUndefined && !viewOnly) {
|
|
75
91
|
onCurrentStateChange({
|
|
76
92
|
// @ts-ignore
|
|
@@ -116,6 +132,7 @@ const TableEditor = (props) => {
|
|
|
116
132
|
}
|
|
117
133
|
return item;
|
|
118
134
|
});
|
|
135
|
+
console.log({ mappingData });
|
|
119
136
|
setHiddenIdList(hiddenIdList);
|
|
120
137
|
return mappingData;
|
|
121
138
|
};
|
|
@@ -42,9 +42,22 @@ const TableEditor = (props) => {
|
|
|
42
42
|
}
|
|
43
43
|
}, [viewOnly]);
|
|
44
44
|
const onUpdateCurrentState = () => {
|
|
45
|
+
let reverseComponentHidden = (props === null || props === void 0 ? void 0 : props.hiddenStatusKey)
|
|
46
|
+
? components === null || components === void 0 ? void 0 : components.map((c, i) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const findHidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i);
|
|
49
|
+
if (findHidden) {
|
|
50
|
+
if (mappingKey && ((_a = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _a === void 0 ? void 0 : _a[mappingKey])) {
|
|
51
|
+
return Object.assign({}, omit((_b = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _b === void 0 ? void 0 : _b[mappingKey], `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`));
|
|
52
|
+
}
|
|
53
|
+
return omit(findHidden === null || findHidden === void 0 ? void 0 : findHidden.data, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`) || {};
|
|
54
|
+
}
|
|
55
|
+
return c;
|
|
56
|
+
})
|
|
57
|
+
: components;
|
|
45
58
|
let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
|
|
46
59
|
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
47
|
-
let findComponent =
|
|
60
|
+
let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
48
61
|
if (!findComponent)
|
|
49
62
|
return undefined;
|
|
50
63
|
if (findComponent) {
|
|
@@ -52,7 +65,7 @@ const TableEditor = (props) => {
|
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
else {
|
|
55
|
-
let findComponent =
|
|
68
|
+
let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
|
|
56
69
|
if (!findComponent)
|
|
57
70
|
return undefined;
|
|
58
71
|
if (findComponent) {
|
|
@@ -61,15 +74,18 @@ const TableEditor = (props) => {
|
|
|
61
74
|
}
|
|
62
75
|
});
|
|
63
76
|
const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
|
|
64
|
-
if (props
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
77
|
+
// if (props?.hiddenStatusKey) {
|
|
78
|
+
// matchInitialValueWithComponents = matchInitialValueWithComponents?.map(
|
|
79
|
+
// (_, i) => {
|
|
80
|
+
// const hidden = hiddenIdList?.find((h) => h?.key === i); // find by key, bukan index
|
|
81
|
+
// if (hidden) {
|
|
82
|
+
// return hidden?.data;
|
|
83
|
+
// }
|
|
84
|
+
// return _;
|
|
85
|
+
// }
|
|
86
|
+
// );
|
|
87
|
+
// }
|
|
88
|
+
console.log({ hasUndefined, matchInitialValueWithComponents }, !hasUndefined && !viewOnly);
|
|
73
89
|
if (!hasUndefined && !viewOnly) {
|
|
74
90
|
onCurrentStateChange({
|
|
75
91
|
// @ts-ignore
|
|
@@ -115,6 +131,7 @@ const TableEditor = (props) => {
|
|
|
115
131
|
}
|
|
116
132
|
return item;
|
|
117
133
|
});
|
|
134
|
+
console.log({ mappingData });
|
|
118
135
|
setHiddenIdList(hiddenIdList);
|
|
119
136
|
return mappingData;
|
|
120
137
|
};
|
|
@@ -7,6 +7,7 @@ import Layers from "../../components/layer-v4";
|
|
|
7
7
|
import { getTranslate } from "../board-v3/utils";
|
|
8
8
|
import { Spin } from "antd";
|
|
9
9
|
const LayerView = (props) => {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
10
11
|
const { componentProps, extraComponentProps, onSelectComponent, onDoubleClick, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
|
|
11
12
|
select: true,
|
|
12
13
|
move: true,
|
|
@@ -165,7 +166,7 @@ const LayerView = (props) => {
|
|
|
165
166
|
setSelectedTable(seletedTable);
|
|
166
167
|
};
|
|
167
168
|
const boundingBox = useMemo(() => {
|
|
168
|
-
var _a, _b, _c, _d, _e, _f
|
|
169
|
+
var _a, _b, _c, _d, _e, _f;
|
|
169
170
|
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
170
171
|
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
171
172
|
}
|
|
@@ -228,10 +229,10 @@ const LayerView = (props) => {
|
|
|
228
229
|
if (hasBoundingBox) {
|
|
229
230
|
hasBoundingBoxRef.current = true;
|
|
230
231
|
return {
|
|
231
|
-
minX: boundingBoxProps.x
|
|
232
|
-
minY: boundingBoxProps.y
|
|
233
|
-
width: boundingBoxProps.width
|
|
234
|
-
height: boundingBoxProps.height
|
|
232
|
+
minX: boundingBoxProps.x,
|
|
233
|
+
minY: boundingBoxProps.y,
|
|
234
|
+
width: boundingBoxProps.width,
|
|
235
|
+
height: boundingBoxProps.height,
|
|
235
236
|
};
|
|
236
237
|
}
|
|
237
238
|
// return {
|
|
@@ -242,10 +243,10 @@ const LayerView = (props) => {
|
|
|
242
243
|
// };
|
|
243
244
|
// console.log(minX, minY, maxX, maxY, props?.viewStyles, "bounding box");
|
|
244
245
|
return {
|
|
245
|
-
minX: minX
|
|
246
|
-
minY: minY
|
|
247
|
-
width: maxX
|
|
248
|
-
height: maxY
|
|
246
|
+
minX: minX,
|
|
247
|
+
minY: minY,
|
|
248
|
+
width: maxX,
|
|
249
|
+
height: maxY,
|
|
249
250
|
};
|
|
250
251
|
}, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
|
|
251
252
|
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
@@ -605,7 +606,7 @@ const LayerView = (props) => {
|
|
|
605
606
|
boundingBox.width > 0 &&
|
|
606
607
|
boundingBox.height > 0;
|
|
607
608
|
const viewBox = isValidBoundingBox
|
|
608
|
-
? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
|
|
609
|
+
? `${boundingBox.minX - (((_a = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _a === void 0 ? void 0 : _a.paddingLeft) || 0)} ${boundingBox.minY - (((_b = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0)} ${boundingBox.width + (((_c = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _c === void 0 ? void 0 : _c.paddingRight) || 0)} ${boundingBox.height + (((_d = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _d === void 0 ? void 0 : _d.paddingBottom) || 0)}`
|
|
609
610
|
: "0 0 1000 1000";
|
|
610
611
|
return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
|
|
611
612
|
overflow: "auto",
|
|
@@ -6,6 +6,7 @@ import Layers from "../../components/layer-v4";
|
|
|
6
6
|
import { getTranslate } from "../board-v3/utils";
|
|
7
7
|
import { Spin } from "antd";
|
|
8
8
|
const LayerView = (props) => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
9
10
|
const { componentProps, extraComponentProps, onSelectComponent, onDoubleClick, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
|
|
10
11
|
select: true,
|
|
11
12
|
move: true,
|
|
@@ -164,7 +165,7 @@ const LayerView = (props) => {
|
|
|
164
165
|
setSelectedTable(seletedTable);
|
|
165
166
|
};
|
|
166
167
|
const boundingBox = useMemo(() => {
|
|
167
|
-
var _a, _b, _c, _d, _e, _f
|
|
168
|
+
var _a, _b, _c, _d, _e, _f;
|
|
168
169
|
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
169
170
|
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
170
171
|
}
|
|
@@ -227,10 +228,10 @@ const LayerView = (props) => {
|
|
|
227
228
|
if (hasBoundingBox) {
|
|
228
229
|
hasBoundingBoxRef.current = true;
|
|
229
230
|
return {
|
|
230
|
-
minX: boundingBoxProps.x
|
|
231
|
-
minY: boundingBoxProps.y
|
|
232
|
-
width: boundingBoxProps.width
|
|
233
|
-
height: boundingBoxProps.height
|
|
231
|
+
minX: boundingBoxProps.x,
|
|
232
|
+
minY: boundingBoxProps.y,
|
|
233
|
+
width: boundingBoxProps.width,
|
|
234
|
+
height: boundingBoxProps.height,
|
|
234
235
|
};
|
|
235
236
|
}
|
|
236
237
|
// return {
|
|
@@ -241,10 +242,10 @@ const LayerView = (props) => {
|
|
|
241
242
|
// };
|
|
242
243
|
// console.log(minX, minY, maxX, maxY, props?.viewStyles, "bounding box");
|
|
243
244
|
return {
|
|
244
|
-
minX: minX
|
|
245
|
-
minY: minY
|
|
246
|
-
width: maxX
|
|
247
|
-
height: maxY
|
|
245
|
+
minX: minX,
|
|
246
|
+
minY: minY,
|
|
247
|
+
width: maxX,
|
|
248
|
+
height: maxY,
|
|
248
249
|
};
|
|
249
250
|
}, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
|
|
250
251
|
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
@@ -604,7 +605,7 @@ const LayerView = (props) => {
|
|
|
604
605
|
boundingBox.width > 0 &&
|
|
605
606
|
boundingBox.height > 0;
|
|
606
607
|
const viewBox = isValidBoundingBox
|
|
607
|
-
? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
|
|
608
|
+
? `${boundingBox.minX - (((_a = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _a === void 0 ? void 0 : _a.paddingLeft) || 0)} ${boundingBox.minY - (((_b = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0)} ${boundingBox.width + (((_c = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _c === void 0 ? void 0 : _c.paddingRight) || 0)} ${boundingBox.height + (((_d = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _d === void 0 ? void 0 : _d.paddingBottom) || 0)}`
|
|
608
609
|
: "0 0 1000 1000";
|
|
609
610
|
return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{
|
|
610
611
|
overflow: "auto",
|
|
@@ -12,6 +12,7 @@ import { ConnectionLayer } from "./connection-layer";
|
|
|
12
12
|
import { ConnectHandle } from "./connect-handle";
|
|
13
13
|
import { getAttributeElement } from "../board-v3/resize-element";
|
|
14
14
|
const LayerView = (props) => {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
15
16
|
const { componentProps, extraComponentProps, onSelectComponent, onDoubleClick, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
|
|
16
17
|
select: true,
|
|
17
18
|
move: true,
|
|
@@ -137,7 +138,7 @@ const LayerView = (props) => {
|
|
|
137
138
|
setSelectedTable(mappingKey ? find[mappingKey] : find);
|
|
138
139
|
};
|
|
139
140
|
const boundingBox = useMemo(() => {
|
|
140
|
-
var _a, _b
|
|
141
|
+
var _a, _b;
|
|
141
142
|
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
142
143
|
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
143
144
|
}
|
|
@@ -190,17 +191,17 @@ const LayerView = (props) => {
|
|
|
190
191
|
if (boundingBoxProps) {
|
|
191
192
|
hasBoundingBoxRef.current = true;
|
|
192
193
|
return {
|
|
193
|
-
minX: boundingBoxProps.x
|
|
194
|
-
minY: boundingBoxProps.y
|
|
195
|
-
width: boundingBoxProps.width
|
|
196
|
-
height: boundingBoxProps.height
|
|
194
|
+
minX: boundingBoxProps.x,
|
|
195
|
+
minY: boundingBoxProps.y,
|
|
196
|
+
width: boundingBoxProps.width,
|
|
197
|
+
height: boundingBoxProps.height,
|
|
197
198
|
};
|
|
198
199
|
}
|
|
199
200
|
return {
|
|
200
|
-
minX: minX
|
|
201
|
-
minY: minY
|
|
202
|
-
width: maxX
|
|
203
|
-
height: maxY
|
|
201
|
+
minX: minX,
|
|
202
|
+
minY: minY,
|
|
203
|
+
width: maxX,
|
|
204
|
+
height: maxY,
|
|
204
205
|
};
|
|
205
206
|
}, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
|
|
206
207
|
const [fingerCount, setFingerCount] = useState(0);
|
|
@@ -560,7 +561,7 @@ const LayerView = (props) => {
|
|
|
560
561
|
boundingBox.width > 0 &&
|
|
561
562
|
boundingBox.height > 0;
|
|
562
563
|
const viewBox = isValidBoundingBox
|
|
563
|
-
? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
|
|
564
|
+
? `${boundingBox.minX - (((_a = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _a === void 0 ? void 0 : _a.paddingLeft) || 0)} ${boundingBox.minY - (((_b = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0)} ${boundingBox.width + (((_c = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _c === void 0 ? void 0 : _c.paddingRight) || 0)} ${boundingBox.height + (((_d = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _d === void 0 ? void 0 : _d.paddingBottom) || 0)}`
|
|
564
565
|
: "0 0 1000 1000";
|
|
565
566
|
const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, statusKey), [componentsEditor, mappingKey, tableMatchKey, statusKey]);
|
|
566
567
|
return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: { overflow: "auto", WebkitOverflowScrolling: "touch" } }, props.containerProps, { children: [loading && (_jsx("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", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(TransformWrapper, Object.assign({ ref: transformRef, disablePadding: true, centerZoomedOut: true, panning: { disabled: panningGroup, wheelPanning: true }, wheel: { disabled: false }, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, smooth: true, centerOnInit: true }, props.transformProps, { children: _jsxs(TransformComponent, { wrapperStyle: { width: "100%", height: "100%" }, contentStyle: { width: "100%", height: "100%" }, children: [_jsxs("svg", Object.assign({ id: "workspace", ref: svgRef, width: "100%", height: "100%", overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, onMouseMove: (e) => graph.onMouseMove(e), onMouseUp: () => graph.onMouseUp(), onClick: (e) => {
|
|
@@ -11,6 +11,7 @@ import { ConnectionLayer } from "./connection-layer";
|
|
|
11
11
|
import { ConnectHandle } from "./connect-handle";
|
|
12
12
|
import { getAttributeElement } from "../board-v3/resize-element";
|
|
13
13
|
const LayerView = (props) => {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
14
15
|
const { componentProps, extraComponentProps, onSelectComponent, onDoubleClick, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
|
|
15
16
|
select: true,
|
|
16
17
|
move: true,
|
|
@@ -136,7 +137,7 @@ const LayerView = (props) => {
|
|
|
136
137
|
setSelectedTable(mappingKey ? find[mappingKey] : find);
|
|
137
138
|
};
|
|
138
139
|
const boundingBox = useMemo(() => {
|
|
139
|
-
var _a, _b
|
|
140
|
+
var _a, _b;
|
|
140
141
|
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
141
142
|
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
142
143
|
}
|
|
@@ -189,17 +190,17 @@ const LayerView = (props) => {
|
|
|
189
190
|
if (boundingBoxProps) {
|
|
190
191
|
hasBoundingBoxRef.current = true;
|
|
191
192
|
return {
|
|
192
|
-
minX: boundingBoxProps.x
|
|
193
|
-
minY: boundingBoxProps.y
|
|
194
|
-
width: boundingBoxProps.width
|
|
195
|
-
height: boundingBoxProps.height
|
|
193
|
+
minX: boundingBoxProps.x,
|
|
194
|
+
minY: boundingBoxProps.y,
|
|
195
|
+
width: boundingBoxProps.width,
|
|
196
|
+
height: boundingBoxProps.height,
|
|
196
197
|
};
|
|
197
198
|
}
|
|
198
199
|
return {
|
|
199
|
-
minX: minX
|
|
200
|
-
minY: minY
|
|
201
|
-
width: maxX
|
|
202
|
-
height: maxY
|
|
200
|
+
minX: minX,
|
|
201
|
+
minY: minY,
|
|
202
|
+
width: maxX,
|
|
203
|
+
height: maxY,
|
|
203
204
|
};
|
|
204
205
|
}, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
|
|
205
206
|
const [fingerCount, setFingerCount] = useState(0);
|
|
@@ -559,7 +560,7 @@ const LayerView = (props) => {
|
|
|
559
560
|
boundingBox.width > 0 &&
|
|
560
561
|
boundingBox.height > 0;
|
|
561
562
|
const viewBox = isValidBoundingBox
|
|
562
|
-
? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
|
|
563
|
+
? `${boundingBox.minX - (((_a = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _a === void 0 ? void 0 : _a.paddingLeft) || 0)} ${boundingBox.minY - (((_b = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0)} ${boundingBox.width + (((_c = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _c === void 0 ? void 0 : _c.paddingRight) || 0)} ${boundingBox.height + (((_d = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _d === void 0 ? void 0 : _d.paddingBottom) || 0)}`
|
|
563
564
|
: "0 0 1000 1000";
|
|
564
565
|
const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, statusKey), [componentsEditor, mappingKey, tableMatchKey, statusKey]);
|
|
565
566
|
return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{ overflow: "auto", WebkitOverflowScrolling: "touch" }} {...props.containerProps}>
|