seat-editor 3.6.24 → 3.6.25

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.
@@ -27,8 +27,8 @@ const LayerView = (props) => {
27
27
  viewGraph: false,
28
28
  dragTable: false,
29
29
  selectNode: false,
30
- connectingNode: false
31
- }, onMakeSelection, groupSelection } = props;
30
+ connectingNode: false,
31
+ }, onMakeSelection, groupSelection, } = props;
32
32
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
33
33
  const tableGhost = useRef(null);
34
34
  const hoverUnderghostId = useRef(null);
@@ -62,7 +62,9 @@ const LayerView = (props) => {
62
62
  }));
63
63
  const dispatch = useAppDispatch();
64
64
  useEffect(() => {
65
- setTooltip(Object.assign(Object.assign({}, tooltip), { visible: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open }));
65
+ if (!(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open)) {
66
+ setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
67
+ }
66
68
  }, [tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open]);
67
69
  useEffect(() => {
68
70
  if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
@@ -309,7 +311,10 @@ const LayerView = (props) => {
309
311
  return;
310
312
  }
311
313
  setPanningGroup(true);
312
- if (makeSelection && (props === null || props === void 0 ? void 0 : props.allowTooltip) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.visible) && e.button !== 2) {
314
+ if (makeSelection &&
315
+ (props === null || props === void 0 ? void 0 : props.allowTooltip) &&
316
+ (tooltip === null || tooltip === void 0 ? void 0 : tooltip.visible) &&
317
+ e.button !== 2) {
313
318
  setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
314
319
  return;
315
320
  }
@@ -320,15 +325,16 @@ const LayerView = (props) => {
320
325
  : !((_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
321
326
  const dataRaw = originalData({ id: ghostId, type: "find" });
322
327
  return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
323
- }))) &&
324
- (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable);
328
+ }))) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable);
325
329
  if (ghostAttributes) {
326
330
  Object.keys(ghostAttributes).forEach((key) => ghost.setAttribute(key, ghostAttributes[key]));
327
331
  }
328
332
  if (allowedDrag) {
329
333
  (_c = e.dataTransfer) === null || _c === void 0 ? void 0 : _c.setData("application/json", JSON.stringify(ghostId));
330
334
  const dataRaw = originalData({ id: ghostId, type: "find" });
331
- (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) && (props === null || props === void 0 ? void 0 : props.onDragTable) && props.onDragTable(e, dataRaw);
335
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) &&
336
+ (props === null || props === void 0 ? void 0 : props.onDragTable) &&
337
+ props.onDragTable(e, dataRaw);
332
338
  }
333
339
  ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("opacity", "0.5");
334
340
  ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("pointer-events", "none");
@@ -464,7 +470,10 @@ const LayerView = (props) => {
464
470
  const rightClick = e.button === 2 && allowTooltip;
465
471
  setTooltip({ x: newX / scale, y: newY / scale, visible: rightClick });
466
472
  }
467
- if (makeSelection && ((_a = dataElementSelectionGroupRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0 && e.button === 0 && !targetSelectionGroup) {
473
+ if (makeSelection &&
474
+ ((_a = dataElementSelectionGroupRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
475
+ e.button === 0 &&
476
+ !targetSelectionGroup) {
468
477
  const allTableInSelection = (_b = dataElementSelectionGroupRef.current) === null || _b === void 0 ? void 0 : _b.map((d) => d.id);
469
478
  const filterTableInSelection = componentProps === null || componentProps === void 0 ? void 0 : componentProps.filter((item) => {
470
479
  var _a, _b;
@@ -505,7 +514,10 @@ const LayerView = (props) => {
505
514
  }
506
515
  (_c = svg.querySelector("#selection-box-ghost")) === null || _c === void 0 ? void 0 : _c.remove();
507
516
  }
508
- if (makeSelection && ((_d = dataElementSelectionGroupRef.current) === null || _d === void 0 ? void 0 : _d.length) === 0 && e.button === 0 && targetSelectionGroup) {
517
+ if (makeSelection &&
518
+ ((_d = dataElementSelectionGroupRef.current) === null || _d === void 0 ? void 0 : _d.length) === 0 &&
519
+ e.button === 0 &&
520
+ targetSelectionGroup) {
509
521
  (_e = svg.querySelector("#selection-box-ghost")) === null || _e === void 0 ? void 0 : _e.remove();
510
522
  setSelectedLines(null);
511
523
  }
@@ -630,7 +642,16 @@ const LayerView = (props) => {
630
642
  const viewBox = isValidBoundingBox
631
643
  ? `${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)}`
632
644
  : "0 0 1000 1000";
633
- const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [componentsEditor, mappingKey, tableMatchKey, statusKey, graph.connecting, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection]);
645
+ const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [
646
+ componentsEditor,
647
+ mappingKey,
648
+ tableMatchKey,
649
+ statusKey,
650
+ graph.connecting,
651
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection,
652
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey,
653
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
654
+ ]);
634
655
  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(),
635
656
  // onDrop={(e) => handleTableEvent(e, "drop")}
636
657
  onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, onMouseMove: (e) => graph.onMouseMove(e), onMouseUp: () => graph.onMouseUp(), onClick: (e) => {
@@ -26,8 +26,8 @@ const LayerView = (props) => {
26
26
  viewGraph: false,
27
27
  dragTable: false,
28
28
  selectNode: false,
29
- connectingNode: false
30
- }, onMakeSelection, groupSelection } = props;
29
+ connectingNode: false,
30
+ }, onMakeSelection, groupSelection, } = props;
31
31
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
32
32
  const tableGhost = useRef(null);
33
33
  const hoverUnderghostId = useRef(null);
@@ -61,7 +61,9 @@ const LayerView = (props) => {
61
61
  }));
62
62
  const dispatch = useAppDispatch();
63
63
  useEffect(() => {
64
- setTooltip(Object.assign(Object.assign({}, tooltip), { visible: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open }));
64
+ if (!(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open)) {
65
+ setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
66
+ }
65
67
  }, [tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.open]);
66
68
  useEffect(() => {
67
69
  if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
@@ -308,7 +310,10 @@ const LayerView = (props) => {
308
310
  return;
309
311
  }
310
312
  setPanningGroup(true);
311
- if (makeSelection && (props === null || props === void 0 ? void 0 : props.allowTooltip) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.visible) && e.button !== 2) {
313
+ if (makeSelection &&
314
+ (props === null || props === void 0 ? void 0 : props.allowTooltip) &&
315
+ (tooltip === null || tooltip === void 0 ? void 0 : tooltip.visible) &&
316
+ e.button !== 2) {
312
317
  setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
313
318
  return;
314
319
  }
@@ -319,15 +324,16 @@ const LayerView = (props) => {
319
324
  : !((_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
320
325
  const dataRaw = originalData({ id: ghostId, type: "find" });
321
326
  return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
- }))) &&
323
- (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable);
327
+ }))) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable);
324
328
  if (ghostAttributes) {
325
329
  Object.keys(ghostAttributes).forEach((key) => ghost.setAttribute(key, ghostAttributes[key]));
326
330
  }
327
331
  if (allowedDrag) {
328
332
  (_c = e.dataTransfer) === null || _c === void 0 ? void 0 : _c.setData("application/json", JSON.stringify(ghostId));
329
333
  const dataRaw = originalData({ id: ghostId, type: "find" });
330
- (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) && (props === null || props === void 0 ? void 0 : props.onDragTable) && props.onDragTable(e, dataRaw);
334
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) &&
335
+ (props === null || props === void 0 ? void 0 : props.onDragTable) &&
336
+ props.onDragTable(e, dataRaw);
331
337
  }
332
338
  ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("opacity", "0.5");
333
339
  ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("pointer-events", "none");
@@ -463,7 +469,10 @@ const LayerView = (props) => {
463
469
  const rightClick = e.button === 2 && allowTooltip;
464
470
  setTooltip({ x: newX / scale, y: newY / scale, visible: rightClick });
465
471
  }
466
- if (makeSelection && ((_a = dataElementSelectionGroupRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0 && e.button === 0 && !targetSelectionGroup) {
472
+ if (makeSelection &&
473
+ ((_a = dataElementSelectionGroupRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
474
+ e.button === 0 &&
475
+ !targetSelectionGroup) {
467
476
  const allTableInSelection = (_b = dataElementSelectionGroupRef.current) === null || _b === void 0 ? void 0 : _b.map((d) => d.id);
468
477
  const filterTableInSelection = componentProps === null || componentProps === void 0 ? void 0 : componentProps.filter((item) => {
469
478
  var _a, _b;
@@ -504,7 +513,10 @@ const LayerView = (props) => {
504
513
  }
505
514
  (_c = svg.querySelector("#selection-box-ghost")) === null || _c === void 0 ? void 0 : _c.remove();
506
515
  }
507
- if (makeSelection && ((_d = dataElementSelectionGroupRef.current) === null || _d === void 0 ? void 0 : _d.length) === 0 && e.button === 0 && targetSelectionGroup) {
516
+ if (makeSelection &&
517
+ ((_d = dataElementSelectionGroupRef.current) === null || _d === void 0 ? void 0 : _d.length) === 0 &&
518
+ e.button === 0 &&
519
+ targetSelectionGroup) {
508
520
  (_e = svg.querySelector("#selection-box-ghost")) === null || _e === void 0 ? void 0 : _e.remove();
509
521
  setSelectedLines(null);
510
522
  }
@@ -629,7 +641,16 @@ const LayerView = (props) => {
629
641
  const viewBox = isValidBoundingBox
630
642
  ? `${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)}`
631
643
  : "0 0 1000 1000";
632
- const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [componentsEditor, mappingKey, tableMatchKey, statusKey, graph.connecting, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey, groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection]);
644
+ const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [
645
+ componentsEditor,
646
+ mappingKey,
647
+ tableMatchKey,
648
+ statusKey,
649
+ graph.connecting,
650
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection,
651
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey,
652
+ groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
653
+ ]);
633
654
  return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{ overflow: "auto", WebkitOverflowScrolling: "touch" }} {...props.containerProps}>
634
655
  {loading && (<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">
635
656
  {(loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || <Spin />}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.6.24",
3
+ "version": "3.6.25",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",