seat-editor 3.6.51 → 3.6.53

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.
@@ -705,6 +705,7 @@ const LayerView = (props) => {
705
705
  initialEdges: props === null || props === void 0 ? void 0 : props.initialEdges,
706
706
  onTableMainConnection,
707
707
  groupSelection,
708
+ actionPrivileged
708
709
  });
709
710
  // ─── Render ───────────────────────────────────────────────────────────────
710
711
  const hasBoundingBox = hasBoundingBoxRef.current;
@@ -764,6 +765,7 @@ const LayerView = (props) => {
764
765
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
765
766
  graph.edges,
766
767
  connectionMatchKey,
768
+ displaySettings === null || displaySettings === void 0 ? void 0 : displaySettings.selectionGroup,
767
769
  graph.selectedNode
768
770
  ]);
769
771
  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(),
@@ -704,6 +704,7 @@ const LayerView = (props) => {
704
704
  initialEdges: props === null || props === void 0 ? void 0 : props.initialEdges,
705
705
  onTableMainConnection,
706
706
  groupSelection,
707
+ actionPrivileged
707
708
  });
708
709
  // ─── Render ───────────────────────────────────────────────────────────────
709
710
  const hasBoundingBox = hasBoundingBoxRef.current;
@@ -763,6 +764,7 @@ const LayerView = (props) => {
763
764
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
764
765
  graph.edges,
765
766
  connectionMatchKey,
767
+ displaySettings === null || displaySettings === void 0 ? void 0 : displaySettings.selectionGroup,
766
768
  graph.selectedNode
767
769
  ]);
768
770
  return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{ overflow: "auto", WebkitOverflowScrolling: "touch" }} {...props.containerProps}>
@@ -18,8 +18,20 @@ export type UseConnectionGraphOptions = {
18
18
  dataKey: string;
19
19
  selection: Record<number, string[]>;
20
20
  };
21
+ actionPrivileged?: {
22
+ select?: boolean;
23
+ rightClick?: boolean;
24
+ double?: boolean;
25
+ selection?: boolean;
26
+ grapConnection?: boolean;
27
+ viewGraph?: boolean;
28
+ dragTable?: boolean;
29
+ selectNode?: boolean;
30
+ connectingNode?: boolean;
31
+ dragTransferTable?: boolean;
32
+ };
21
33
  };
22
- export declare const useConnectionGraph: ({ svgRef, onEdgesChange, keyNode, mappingKey, initialEdges, onTableMainConnection, groupSelection, }: UseConnectionGraphOptions) => {
34
+ export declare const useConnectionGraph: ({ svgRef, onEdgesChange, keyNode, mappingKey, initialEdges, onTableMainConnection, groupSelection, actionPrivileged }: UseConnectionGraphOptions) => {
23
35
  edges: EdgeType[];
24
36
  setEdges: React.Dispatch<React.SetStateAction<EdgeType[]>>;
25
37
  selectedEdge: string;
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { rotatePoint, snap } from "./utils";
4
4
  import { useAppSelector } from "../../hooks/use-redux";
5
5
  import { isEmpty, isEqual } from "lodash";
6
- export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey, initialEdges, onTableMainConnection, groupSelection, }) => {
6
+ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey, initialEdges, onTableMainConnection, groupSelection, actionPrivileged }) => {
7
7
  const components = useAppSelector((state) => state.board.components);
8
8
  const [edges, setEdges] = useState([]);
9
9
  const [selectedEdge, setSelectedEdge] = useState(null);
@@ -263,6 +263,11 @@ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey,
263
263
  return;
264
264
  onUpdateEdges === null || onUpdateEdges === void 0 ? void 0 : onUpdateEdges();
265
265
  }, [edges]);
266
+ useEffect(() => {
267
+ setConnecting(null);
268
+ setSelectedEdge(null);
269
+ setSelectedNode(null);
270
+ }, [actionPrivileged]);
266
271
  return {
267
272
  edges,
268
273
  setEdges,
@@ -84,6 +84,7 @@ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connect
84
84
  editorItem[mappingKey] !== null;
85
85
  let finalProps = isUsingMapping ? editorItem[mappingKey] : editorItem;
86
86
  const findIndexSelection = findIndexByValue(groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection, finalProps === null || finalProps === void 0 ? void 0 : finalProps[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]);
87
+ console.log("findIndexSelection", findIndexSelection, { settingSelectionGroup });
87
88
  let fill = finalProps === null || finalProps === void 0 ? void 0 : finalProps.fill;
88
89
  let stroke = finalProps === null || finalProps === void 0 ? void 0 : finalProps.stroke;
89
90
  let seatFill = finalProps === null || finalProps === void 0 ? void 0 : finalProps.seatFill;
@@ -100,13 +101,14 @@ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connect
100
101
  }
101
102
  finalProps = Object.assign(Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties), { fill: fill, seatFill: seatFill, stroke, className: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.className, element: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.element });
102
103
  }
103
- if (findIndexSelection) {
104
- if (findIndexSelection !== undefined && settingSelectionGroup) {
105
- fill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
106
- seatFill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
107
- stroke = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
108
- finalProps = Object.assign(Object.assign({}, finalProps), { fill: fill, seatFill: seatFill, stroke });
109
- }
104
+ if (findIndexSelection && settingSelectionGroup) {
105
+ console.log("masukk");
106
+ // if (findIndexSelection !== undefined && settingSelectionGroup) {
107
+ fill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
108
+ seatFill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
109
+ stroke = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
110
+ finalProps = Object.assign(Object.assign({}, finalProps), { fill: fill, seatFill: seatFill, stroke });
111
+ // }
110
112
  }
111
113
  if (((connecting === null || connecting === void 0 ? void 0 : connecting.fromId) || selectedNodeId) ==
112
114
  ((finalProps === null || finalProps === void 0 ? void 0 : finalProps[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) || (finalProps === null || finalProps === void 0 ? void 0 : finalProps.id))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.6.51",
3
+ "version": "3.6.53",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",