seat-editor 3.3.43 → 3.3.44
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 +57 -63
- package/dist/app/constant.js +76 -71
- package/dist/app/layout.d.ts +1 -1
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/old-board/page.d.ts +1 -2
- package/dist/app/only-view/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +2 -10
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/page.js +12 -15
- package/dist/app/only-view/page.jsx +11 -14
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +2 -10
- package/dist/app/page.d.ts +1 -1
- package/dist/app/test/page.d.ts +1 -2
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/shape.d.ts +1 -1
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/joystick/index.d.ts +1 -2
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v3/index.d.ts +1 -1
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/layer-v4/index.js +7 -7
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board-v2/index.d.ts +1 -2
- package/dist/features/board-v3/index.d.ts +1 -1
- package/dist/features/board-v3/index.js +10 -4
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/package/index.js +7 -1
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.js +3 -3
- package/dist/features/panel/upload-tool.jsx +5 -4
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only-2/index.d.ts +8 -2
- package/dist/features/view-only-2/index.js +33 -18
- package/dist/features/view-only-3/index.d.ts +8 -2
- package/dist/features/view-only-3/index.js +67 -53
- package/dist/features/view-only-3/index.jsx +5 -1
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/store-provider.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,13 @@ 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
|
-
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags,
|
|
10
|
+
const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
|
|
11
|
+
select: true,
|
|
12
|
+
move: true,
|
|
13
|
+
switch: true,
|
|
14
|
+
drop: true,
|
|
15
|
+
rightClick: true
|
|
16
|
+
} } = props;
|
|
11
17
|
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
12
18
|
const tableGhost = useRef(null);
|
|
13
19
|
const hoverUnderghostId = useRef(null);
|
|
@@ -93,7 +99,7 @@ const LayerView = (props) => {
|
|
|
93
99
|
defaultBackground,
|
|
94
100
|
loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
|
|
95
101
|
props === null || props === void 0 ? void 0 : props.viewOnly,
|
|
96
|
-
defaultBoundingBox
|
|
102
|
+
defaultBoundingBox,
|
|
97
103
|
]);
|
|
98
104
|
useEffect(() => {
|
|
99
105
|
setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
|
|
@@ -133,13 +139,13 @@ const LayerView = (props) => {
|
|
|
133
139
|
});
|
|
134
140
|
const rightClick = e.button === 2;
|
|
135
141
|
const click = e.button === 0;
|
|
136
|
-
onRightClick && rightClick && onRightClick(e, find);
|
|
137
|
-
onSelectComponent && !rightClick && onSelectComponent(find);
|
|
142
|
+
(onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
|
|
143
|
+
(onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
|
|
138
144
|
const seletedTable = mappingKey ? find[mappingKey] : find;
|
|
139
145
|
setSelectedTable(seletedTable);
|
|
140
146
|
};
|
|
141
147
|
const boundingBox = useMemo(() => {
|
|
142
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
148
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
143
149
|
if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
|
|
144
150
|
return { minX: 0, minY: 0, width: 500, height: 500 };
|
|
145
151
|
}
|
|
@@ -197,10 +203,10 @@ const LayerView = (props) => {
|
|
|
197
203
|
if (hasBoundingBox) {
|
|
198
204
|
hasBoundingBoxRef.current = true;
|
|
199
205
|
return {
|
|
200
|
-
minX: boundingBoxProps.x,
|
|
201
|
-
minY: boundingBoxProps.y,
|
|
202
|
-
width: boundingBoxProps.width,
|
|
203
|
-
height: boundingBoxProps.height,
|
|
206
|
+
minX: boundingBoxProps.x - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
|
|
207
|
+
minY: boundingBoxProps.y - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
|
|
208
|
+
width: boundingBoxProps.width + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
|
|
209
|
+
height: boundingBoxProps.height + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
|
|
204
210
|
};
|
|
205
211
|
}
|
|
206
212
|
// return {
|
|
@@ -211,10 +217,10 @@ const LayerView = (props) => {
|
|
|
211
217
|
// };
|
|
212
218
|
// console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
|
|
213
219
|
return {
|
|
214
|
-
minX: minX - (((
|
|
215
|
-
minY: minY - (((
|
|
216
|
-
width: maxX + (((
|
|
217
|
-
height: maxY + (((
|
|
220
|
+
minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
|
|
221
|
+
minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
|
|
222
|
+
width: maxX + (((_o = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _o === void 0 ? void 0 : _o.paddingRight) || 0),
|
|
223
|
+
height: maxY + (((_p = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _p === void 0 ? void 0 : _p.paddingBottom) || 0),
|
|
218
224
|
};
|
|
219
225
|
}, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
|
|
220
226
|
const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
|
|
@@ -272,7 +278,7 @@ const LayerView = (props) => {
|
|
|
272
278
|
};
|
|
273
279
|
// drop from out layout editor
|
|
274
280
|
if (type === "drop") {
|
|
275
|
-
onDrop && onDrop(event, data);
|
|
281
|
+
(onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
|
|
276
282
|
}
|
|
277
283
|
// cari elemen bentuk (rect / circle / path)
|
|
278
284
|
const shape = group.querySelector("rect") ||
|
|
@@ -317,10 +323,10 @@ const LayerView = (props) => {
|
|
|
317
323
|
const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
318
324
|
const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
|
|
319
325
|
? true
|
|
320
|
-
: (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
326
|
+
: !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
|
|
321
327
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
322
|
-
return _.value
|
|
323
|
-
})) && (
|
|
328
|
+
return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
329
|
+
}))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
|
|
324
330
|
if (ghostAttributes) {
|
|
325
331
|
Object.keys(ghostAttributes).forEach((key) => {
|
|
326
332
|
ghost.setAttribute(key, ghostAttributes[key]);
|
|
@@ -346,35 +352,35 @@ const LayerView = (props) => {
|
|
|
346
352
|
};
|
|
347
353
|
const pointerMoveGhost = (ev) => {
|
|
348
354
|
var _a;
|
|
349
|
-
isDragging.current = true;
|
|
350
|
-
const p = svg.createSVGPoint();
|
|
351
|
-
p.x = ev.clientX;
|
|
352
|
-
p.y = ev.clientY;
|
|
353
|
-
const dx = ev.clientX - startX;
|
|
354
|
-
const dy = ev.clientY - startY;
|
|
355
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
356
|
-
onPanning(ev);
|
|
357
|
-
if (!hasMoved && distance > 0) {
|
|
358
|
-
// transformRef?.current?.instance
|
|
359
|
-
// only move ghost if the mouse has moved more than 5 pixels
|
|
360
|
-
hasMoved = true;
|
|
361
|
-
isDragging.current = true;
|
|
362
|
-
}
|
|
363
|
-
// ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
|
|
364
|
-
ghost.style.display = "none";
|
|
365
|
-
const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
|
|
366
|
-
ghost.style.display = "";
|
|
367
|
-
const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
|
|
368
|
-
const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
|
|
369
|
-
const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
|
|
370
|
-
if (dataHoveredGhostId !== dataGhostId) {
|
|
371
|
-
hoverUnderghostId.current = dataHoveredGhostId;
|
|
372
|
-
}
|
|
373
|
-
const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
|
|
374
|
-
// posisi awal ghost di bawah kursor tanpa matrix dulu
|
|
375
|
-
const newX = posSVG.x - offset.x;
|
|
376
|
-
const newY = posSVG.y - offset.y;
|
|
377
355
|
if (allowedDrag) {
|
|
356
|
+
isDragging.current = true;
|
|
357
|
+
const p = svg.createSVGPoint();
|
|
358
|
+
p.x = ev.clientX;
|
|
359
|
+
p.y = ev.clientY;
|
|
360
|
+
const dx = ev.clientX - startX;
|
|
361
|
+
const dy = ev.clientY - startY;
|
|
362
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
363
|
+
onPanning(ev);
|
|
364
|
+
if (!hasMoved && distance > 0) {
|
|
365
|
+
// transformRef?.current?.instance
|
|
366
|
+
// only move ghost if the mouse has moved more than 5 pixels
|
|
367
|
+
hasMoved = true;
|
|
368
|
+
isDragging.current = true;
|
|
369
|
+
}
|
|
370
|
+
// ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
|
|
371
|
+
ghost.style.display = "none";
|
|
372
|
+
const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
|
|
373
|
+
ghost.style.display = "";
|
|
374
|
+
const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
|
|
375
|
+
const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
|
|
376
|
+
const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
|
|
377
|
+
if (dataHoveredGhostId !== dataGhostId) {
|
|
378
|
+
hoverUnderghostId.current = dataHoveredGhostId;
|
|
379
|
+
}
|
|
380
|
+
const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
|
|
381
|
+
// posisi awal ghost di bawah kursor tanpa matrix dulu
|
|
382
|
+
const newX = posSVG.x - offset.x;
|
|
383
|
+
const newY = posSVG.y - offset.y;
|
|
378
384
|
ghost.setAttribute("transform", `translate(${newX}, ${newY})`);
|
|
379
385
|
}
|
|
380
386
|
};
|
|
@@ -427,8 +433,8 @@ const LayerView = (props) => {
|
|
|
427
433
|
}
|
|
428
434
|
if (isDragging.current && hasMoved && allowedDrag) {
|
|
429
435
|
// drag between group
|
|
436
|
+
console.log("drag between group");
|
|
430
437
|
const dataHoveredGhost = hoverUnderghostId.current;
|
|
431
|
-
hoverUnderghostId.current = null;
|
|
432
438
|
const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
433
439
|
const data = {
|
|
434
440
|
targetTable: originalData({ id: dataHoveredGhost, type: "find" }),
|
|
@@ -440,6 +446,7 @@ const LayerView = (props) => {
|
|
|
440
446
|
isDragging.current = false;
|
|
441
447
|
(_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
442
448
|
tableGhost.current = null;
|
|
449
|
+
hoverUnderghostId.current = null;
|
|
443
450
|
}
|
|
444
451
|
setPanningGroup(false);
|
|
445
452
|
tableGhost.current = null;
|
|
@@ -540,11 +547,18 @@ const LayerView = (props) => {
|
|
|
540
547
|
}
|
|
541
548
|
};
|
|
542
549
|
const hasBoundingBox = hasBoundingBoxRef.current;
|
|
550
|
+
const isValidBoundingBox = Number.isFinite(boundingBox.minX) &&
|
|
551
|
+
Number.isFinite(boundingBox.minY) &&
|
|
552
|
+
Number.isFinite(boundingBox.width) &&
|
|
553
|
+
Number.isFinite(boundingBox.height) &&
|
|
554
|
+
boundingBox.width > 0 &&
|
|
555
|
+
boundingBox.height > 0;
|
|
556
|
+
const viewBox = isValidBoundingBox
|
|
557
|
+
? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
|
|
558
|
+
: "0 0 1000 1000";
|
|
543
559
|
return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
|
|
544
560
|
overflow: "auto",
|
|
545
561
|
WebkitOverflowScrolling: "touch",
|
|
546
|
-
filter: disabled ? "grayscale(100%)" : "none",
|
|
547
|
-
pointerEvents: disabled ? "none" : "auto",
|
|
548
562
|
} }, 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,
|
|
549
563
|
// disabled={fingerCount === 1 && scale === 1}
|
|
550
564
|
disablePadding: true, centerZoomedOut: true, panning: {
|
|
@@ -556,20 +570,20 @@ const LayerView = (props) => {
|
|
|
556
570
|
width: "100%",
|
|
557
571
|
height: "100%",
|
|
558
572
|
// overflow: "visible",
|
|
559
|
-
pointerEvents: disabled ? "none" : "auto",
|
|
573
|
+
// pointerEvents: disabled ? "none" : "auto",
|
|
560
574
|
}, contentStyle: {
|
|
561
575
|
width: "100%",
|
|
562
576
|
height: "100%",
|
|
563
|
-
pointerEvents: disabled ? "none" : "auto",
|
|
577
|
+
// pointerEvents: disabled ? "none" : "auto",
|
|
564
578
|
}, children: [_jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%",
|
|
565
579
|
// scale={5}
|
|
566
|
-
overflow: "hidden", viewBox:
|
|
580
|
+
overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
|
|
567
581
|
background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
|
|
568
582
|
display: "block",
|
|
569
|
-
pointerEvents: disabled ? "none" : "all",
|
|
583
|
+
// pointerEvents: disabled ? "none" : "all",
|
|
570
584
|
touchAction: "none",
|
|
571
585
|
userSelect: "none",
|
|
572
|
-
} }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer",
|
|
586
|
+
} }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", clipPath: "url(#contentCrop)", children: _jsx(Layers, { components: [
|
|
573
587
|
...extraComponentsEditor,
|
|
574
588
|
...renderElements(componentsEditor, mappingKey, tableMatchKey),
|
|
575
589
|
], selectedTable: selectedTable, iconTags: iconTags, eventMatchTable: eventMatchTable, privilegedTags: privilegedTags }) })] })), 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, transform: `scale(${1 / scale})`, transformOrigin: "top left", minWidth: widthTooltip + "px" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.style), children: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.children }))] }) }))] })));
|
|
@@ -294,7 +294,7 @@ const LayerView = (props) => {
|
|
|
294
294
|
return { x: transformed.x, y: transformed.y };
|
|
295
295
|
};
|
|
296
296
|
const handlePointerDown = (e) => {
|
|
297
|
-
var _a;
|
|
297
|
+
var _a, _b;
|
|
298
298
|
const svg = svgRef.current;
|
|
299
299
|
if (!e.isPrimary)
|
|
300
300
|
return;
|
|
@@ -320,6 +320,10 @@ const LayerView = (props) => {
|
|
|
320
320
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
321
321
|
return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
322
322
|
})) && !disabled;
|
|
323
|
+
console.log({ allowedDrag }, (_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
|
|
324
|
+
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
325
|
+
return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
326
|
+
}), !disabled);
|
|
323
327
|
if (ghostAttributes) {
|
|
324
328
|
Object.keys(ghostAttributes).forEach((key) => {
|
|
325
329
|
ghost.setAttribute(key, ghostAttributes[key]);
|