seat-editor 3.2.14 → 3.2.16

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.
@@ -12,7 +12,6 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
12
12
  const renderTags = (data) => {
13
13
  const tags = data !== null && data !== void 0 ? data : tagsDummy("tes");
14
14
  const privileged = !isEmpty(privilegedTags) ? privilegedTags : isShowTagType === "type-1" ? PRIVILEGED_TAGS["CURRENT_TIME"] : isShowTagType === "type-2" ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"] : undefined;
15
- console.log({ privileged, privilegedTags });
16
15
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
17
16
  const gapBetweenTags = Number(gapTags || 20);
18
17
  const defaultFontSize = Number(fontSize || 12);
@@ -6,8 +6,10 @@ export interface PanelState {
6
6
  show: boolean;
7
7
  selectedGroup: any;
8
8
  selectionLines?: any;
9
+ loading?: boolean;
9
10
  }
10
11
  export declare const panelSlice: import("@reduxjs/toolkit").Slice<PanelState, {
12
+ setLoading: (state: import("immer").WritableDraft<PanelState>, action: PayloadAction<boolean>) => void;
11
13
  setSelectedComponent: (state: import("immer").WritableDraft<PanelState>, action: PayloadAction<any>) => void;
12
14
  setUnSelectedComponent: (state: import("immer").WritableDraft<PanelState>) => void;
13
15
  updateSelectedComponent: (state: import("immer").WritableDraft<PanelState>, action: PayloadAction<any>) => void;
@@ -6,11 +6,15 @@ const initialState = {
6
6
  show: false,
7
7
  selectedGroup: null,
8
8
  selectionLines: null,
9
+ loading: false,
9
10
  };
10
11
  export const panelSlice = createSlice({
11
12
  name: "panel",
12
13
  initialState,
13
14
  reducers: {
15
+ setLoading: (state, action) => {
16
+ state.loading = action.payload;
17
+ },
14
18
  setSelectedComponent: (state, action) => {
15
19
  state.selectedComponent = action.payload;
16
20
  },
@@ -78,6 +78,7 @@ export interface LayerViewProps<TMeta = undefined> {
78
78
  paddingBottom?: number;
79
79
  };
80
80
  disabled?: boolean;
81
+ loadingComponent?: React.JSX.Element;
81
82
  }
82
83
  declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
83
84
  export default LayerView;
@@ -4,8 +4,9 @@ import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
4
4
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
5
5
  import Layers from "../../components/layer-v4";
6
6
  import { getTranslate } from "../board-v3/utils";
7
+ import { Spin } from "antd";
7
8
  const LayerView = (props) => {
8
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled, loadingComponent, } = props;
9
10
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
10
11
  const tableGhost = useRef(null);
11
12
  const hoverUnderghostId = useRef(null);
@@ -24,6 +25,7 @@ const LayerView = (props) => {
24
25
  const [selectedTable, setSelectedTable] = useState(null);
25
26
  const { components: componentsEditor, extraComponents: extraComponentsEditor, } = useAppSelector((state) => state.board);
26
27
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
28
+ const { loading } = useAppSelector((state) => state.panel);
27
29
  useImperativeHandle(refs, () => ({
28
30
  svgRef: svgRef === null || svgRef === void 0 ? void 0 : svgRef.current,
29
31
  transformRef: transformRef === null || transformRef === void 0 ? void 0 : transformRef.current,
@@ -36,6 +38,9 @@ const LayerView = (props) => {
36
38
  }));
37
39
  const dispatch = useAppDispatch();
38
40
  useEffect(() => {
41
+ if (!loading) {
42
+ dispatch({ type: "panel/setLoading", payload: true });
43
+ }
39
44
  if ((componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) > 0) {
40
45
  dispatch({
41
46
  type: "board/setNewComponents",
@@ -55,6 +60,9 @@ const LayerView = (props) => {
55
60
  payload: defaultBackground,
56
61
  });
57
62
  }
63
+ setTimeout(() => {
64
+ dispatch({ type: "panel/setLoading", payload: true });
65
+ }, 1000);
58
66
  }, [componentProps, extraComponentProps, defaultBackground]);
59
67
  useEffect(() => {
60
68
  setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
@@ -517,6 +525,10 @@ const LayerView = (props) => {
517
525
  filter: disabled ? "grayscale(100%)" : "none",
518
526
  pointerEvents: disabled ? "none" : "auto",
519
527
  }} {...props.containerProps}>
528
+ {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">
529
+ {loadingComponent || <Spin />}
530
+ </div>)}
531
+
520
532
  {/* {isDragging?.current && (
521
533
  <div className="absolute bottom-1/2 left-1 flex gap-4 z-[10]">
522
534
  <button className="p-4 bg-gray-400">+</button>
@@ -548,7 +560,7 @@ const LayerView = (props) => {
548
560
  display: "block",
549
561
  pointerEvents: disabled ? "none" : "all",
550
562
  touchAction: "none",
551
- userSelect: "none"
563
+ userSelect: "none",
552
564
  }} {...props.svgProps}>
553
565
  {hasBoundingBox && (<defs>
554
566
  <clipPath id="contentCrop">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.2.14",
3
+ "version": "3.2.16",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",