seat-editor 3.3.38 → 3.3.40

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.
Files changed (46) hide show
  1. package/dist/app/layout.d.ts +1 -1
  2. package/dist/app/new-board/page.d.ts +1 -1
  3. package/dist/app/old-board/page.d.ts +2 -1
  4. package/dist/app/only-view/chair.d.ts +1 -1
  5. package/dist/app/only-view/chair.js +10 -2
  6. package/dist/app/only-view/page.d.ts +1 -1
  7. package/dist/app/only-view/page.jsx +2 -4
  8. package/dist/app/only-view/user.d.ts +1 -1
  9. package/dist/app/only-view/user.js +10 -2
  10. package/dist/app/page.d.ts +1 -1
  11. package/dist/app/test/page.d.ts +2 -1
  12. package/dist/app/v2/page.d.ts +1 -1
  13. package/dist/components/button-tools/index.d.ts +1 -1
  14. package/dist/components/form-tools/label.d.ts +1 -1
  15. package/dist/components/form-tools/shape.d.ts +1 -1
  16. package/dist/components/input/number-indicator.d.ts +1 -1
  17. package/dist/components/joystick/index.d.ts +2 -1
  18. package/dist/components/layer/index.d.ts +1 -1
  19. package/dist/components/layer-v2/index.d.ts +1 -1
  20. package/dist/components/layer-v3/index.d.ts +1 -1
  21. package/dist/components/layer-v4/index.d.ts +1 -1
  22. package/dist/components/layer-v4/index.jsx +7 -7
  23. package/dist/components/lib/index.d.ts +1 -1
  24. package/dist/components/modal-preview/index.d.ts +1 -1
  25. package/dist/features/board/index.d.ts +1 -1
  26. package/dist/features/board-v2/index.d.ts +2 -1
  27. package/dist/features/board-v3/index.d.ts +1 -1
  28. package/dist/features/navbar/index.d.ts +1 -1
  29. package/dist/features/package/index.d.ts +1 -1
  30. package/dist/features/panel/index.d.ts +1 -1
  31. package/dist/features/panel/select-tool.d.ts +1 -1
  32. package/dist/features/panel/selected-group.d.ts +1 -1
  33. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  34. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  35. package/dist/features/panel/table-seat-square.d.ts +1 -1
  36. package/dist/features/panel/text-tool.d.ts +1 -1
  37. package/dist/features/panel/upload-tool.d.ts +1 -1
  38. package/dist/features/side-tool/index.d.ts +1 -1
  39. package/dist/features/view-only/index.d.ts +1 -1
  40. package/dist/features/view-only-2/index.d.ts +1 -1
  41. package/dist/features/view-only-2/index.jsx +472 -77
  42. package/dist/features/view-only-3/index.d.ts +1 -1
  43. package/dist/features/view-only-3/index.jsx +53 -44
  44. package/dist/provider/redux-provider.d.ts +1 -1
  45. package/dist/provider/store-provider.d.ts +1 -1
  46. package/package.json +1 -1
@@ -6,7 +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
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled, loadingRender, } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled = true, loadingRender, } = props;
10
10
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
11
11
  const tableGhost = useRef(null);
12
12
  const hoverUnderghostId = useRef(null);
@@ -92,7 +92,7 @@ const LayerView = (props) => {
92
92
  defaultBackground,
93
93
  loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
94
94
  props === null || props === void 0 ? void 0 : props.viewOnly,
95
- defaultBoundingBox
95
+ defaultBoundingBox,
96
96
  ]);
97
97
  useEffect(() => {
98
98
  setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
@@ -138,7 +138,7 @@ const LayerView = (props) => {
138
138
  setSelectedTable(seletedTable);
139
139
  };
140
140
  const boundingBox = useMemo(() => {
141
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
142
142
  if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
143
143
  return { minX: 0, minY: 0, width: 500, height: 500 };
144
144
  }
@@ -196,10 +196,10 @@ const LayerView = (props) => {
196
196
  if (hasBoundingBox) {
197
197
  hasBoundingBoxRef.current = true;
198
198
  return {
199
- minX: boundingBoxProps.x,
200
- minY: boundingBoxProps.y,
201
- width: boundingBoxProps.width,
202
- height: boundingBoxProps.height,
199
+ minX: boundingBoxProps.x - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
200
+ minY: boundingBoxProps.y - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
201
+ width: boundingBoxProps.width + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
202
+ height: boundingBoxProps.height + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
203
203
  };
204
204
  }
205
205
  // return {
@@ -210,10 +210,10 @@ const LayerView = (props) => {
210
210
  // };
211
211
  // console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
212
212
  return {
213
- minX: minX - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
214
- minY: minY - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
215
- width: maxX + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
216
- height: maxY + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
213
+ minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
214
+ minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
215
+ width: maxX + (((_o = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _o === void 0 ? void 0 : _o.paddingRight) || 0),
216
+ height: maxY + (((_p = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _p === void 0 ? void 0 : _p.paddingBottom) || 0),
217
217
  };
218
218
  }, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
219
219
  const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
@@ -314,12 +314,12 @@ const LayerView = (props) => {
314
314
  // clone element yang diklik
315
315
  let ghost = targetGroup.cloneNode(true);
316
316
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
317
- const allowedDrag = !(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
317
+ const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
318
318
  ? true
319
319
  : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
320
320
  const dataRaw = originalData({ id: ghostId, type: "find" });
321
- return _.value !== (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
- });
321
+ return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
+ })) && !disabled;
323
323
  if (ghostAttributes) {
324
324
  Object.keys(ghostAttributes).forEach((key) => {
325
325
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -345,35 +345,35 @@ const LayerView = (props) => {
345
345
  };
346
346
  const pointerMoveGhost = (ev) => {
347
347
  var _a;
348
- isDragging.current = true;
349
- const p = svg.createSVGPoint();
350
- p.x = ev.clientX;
351
- p.y = ev.clientY;
352
- const dx = ev.clientX - startX;
353
- const dy = ev.clientY - startY;
354
- const distance = Math.sqrt(dx * dx + dy * dy);
355
- onPanning(ev);
356
- if (!hasMoved && distance > 0) {
357
- // transformRef?.current?.instance
358
- // only move ghost if the mouse has moved more than 5 pixels
359
- hasMoved = true;
360
- isDragging.current = true;
361
- }
362
- // ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
363
- ghost.style.display = "none";
364
- const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
365
- ghost.style.display = "";
366
- const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
367
- const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
368
- const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
369
- if (dataHoveredGhostId !== dataGhostId) {
370
- hoverUnderghostId.current = dataHoveredGhostId;
371
- }
372
- const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
373
- // posisi awal ghost di bawah kursor tanpa matrix dulu
374
- const newX = posSVG.x - offset.x;
375
- const newY = posSVG.y - offset.y;
376
348
  if (allowedDrag) {
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
377
  ghost.setAttribute("transform", `translate(${newX}, ${newY})`);
378
378
  }
379
379
  };
@@ -539,6 +539,15 @@ const LayerView = (props) => {
539
539
  }
540
540
  };
541
541
  const hasBoundingBox = hasBoundingBoxRef.current;
542
+ const isValidBoundingBox = Number.isFinite(boundingBox.minX) &&
543
+ Number.isFinite(boundingBox.minY) &&
544
+ Number.isFinite(boundingBox.width) &&
545
+ Number.isFinite(boundingBox.height) &&
546
+ boundingBox.width > 0 &&
547
+ boundingBox.height > 0;
548
+ const viewBox = isValidBoundingBox
549
+ ? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
550
+ : "0 0 1000 1000";
542
551
  return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{
543
552
  overflow: "auto",
544
553
  WebkitOverflowScrolling: "touch",
@@ -575,7 +584,7 @@ const LayerView = (props) => {
575
584
  }}>
576
585
  <svg id="workspace" onContextMenu={(e) => e.preventDefault()} onDrop={(e) => handleTableEvent(e, "drop")} onPointerDown={handlePointerDown} onPointerUp={handleMouseUp} ref={svgRef} width="100%" height="100%"
577
586
  // scale={5}
578
- 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={{
587
+ overflow="hidden" viewBox={viewBox} className={"h-full"} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
579
588
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
580
589
  display: "block",
581
590
  pointerEvents: disabled ? "none" : "all",
@@ -587,7 +596,7 @@ const LayerView = (props) => {
587
596
  <rect x={boundingBox.minX} y={boundingBox.minY} width={boundingBox.width} height={boundingBox.height}/>
588
597
  </clipPath>
589
598
  </defs>)}
590
- <g id="main-layer" clip-path="url(#contentCrop)">
599
+ <g id="main-layer" clipPath="url(#contentCrop)">
591
600
  <Layers components={[
592
601
  ...extraComponentsEditor,
593
602
  ...renderElements(componentsEditor, mappingKey, tableMatchKey),
@@ -1,3 +1,3 @@
1
1
  export declare const ReduxProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  export declare const StoreProvider: ({ children, themeColor, }: {
2
2
  children: React.ReactNode;
3
3
  themeColor?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.3.38",
3
+ "version": "3.3.40",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",