seat-editor 3.3.6 → 3.3.7

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.
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { useEffect, useState } from "react";
3
3
  import SeatEditor from "../../features/package";
4
- import { data5, dummyExtra6 } from "../constant";
4
+ import { dummyExtra6 } from "../constant";
5
5
  export default function NewBoard() {
6
6
  const [initialValue, setInitialValue] = useState([]);
7
7
  const [extraComponents, setExtraComponents] = useState([]);
8
8
  const [backgroundColor, setBackgroundColor] = useState("#000000");
9
9
  const [viewOnly, setViewOnly] = useState(false);
10
10
  useEffect(() => {
11
- setInitialValue(data5);
11
+ setInitialValue([]);
12
12
  setExtraComponents(dummyExtra6);
13
13
  }, []);
14
14
  const handleUploadImage = (file) => {
@@ -174,7 +174,7 @@ const boardSlice = createSlice({
174
174
  state.historyChanges.shift();
175
175
  }
176
176
  state.pointer += 1;
177
- state.extraComponents = action.payload.filter((item) => item.shape);
177
+ state.extraComponents = action.payload.filter((item) => item.shape) || [];
178
178
  },
179
179
  setExtraComponent: (state, action) => {
180
180
  const currentPointer = state.pointer;
@@ -237,7 +237,7 @@ const boardSlice = createSlice({
237
237
  setInitialValue: (state, action) => {
238
238
  const { components, extraComponents, backgroundColor, boundingBox } = action.payload;
239
239
  state.components = components;
240
- state.extraComponents = extraComponents === null || extraComponents === void 0 ? void 0 : extraComponents.filter((item) => item.shape);
240
+ state.extraComponents = (extraComponents === null || extraComponents === void 0 ? void 0 : extraComponents.filter((item) => item.shape)) || [];
241
241
  state.pointer = 0;
242
242
  state.backgroundColor = backgroundColor;
243
243
  state.boundingBox = boundingBox;
@@ -82,6 +82,31 @@ const TableEditor = (props) => {
82
82
  return mappingData;
83
83
  };
84
84
  useEffect(() => {
85
+ // const isEmptyComponents = components?.length === 0
86
+ // const isEmptyExtraComponents = extraComponents?.length === 0;
87
+ // // const isEmptyBoundingBox = boundingBox === null;
88
+ // if(isEmptyComponents){
89
+ // dispatch({
90
+ // type: "board/setInitialValue",
91
+ // payload: {
92
+ // components: [],
93
+ // extraComponents: extraComponents,
94
+ // backgroundColor: props?.defaultBackground,
95
+ // boundingBox: props?.defaultBoundingBox || null,
96
+ // },
97
+ // });
98
+ // }
99
+ // if(isEmptyExtraComponents){
100
+ // dispatch({
101
+ // type: "board/setInitialValue",
102
+ // payload: {
103
+ // components: components,
104
+ // extraComponents: [],
105
+ // backgroundColor: props?.defaultBackground,
106
+ // boundingBox: props?.defaultBoundingBox || null,
107
+ // },
108
+ // })
109
+ // }
85
110
  const initialComponent = !isEqual(components, convertComponentProps()) && componentProps;
86
111
  const initialExtraComponent = !isEqual(extraComponents, extraComponentProps) && extraComponentProps;
87
112
  if (initialComponent || initialExtraComponent) {
@@ -41,6 +41,23 @@ const LayerView = (props) => {
41
41
  if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
42
42
  dispatch({ type: "panel/setLoading", payload: true });
43
43
  }
44
+ // check in null
45
+ const isEmptyComponents = (componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) === 0;
46
+ const isEmptyExtraComponents = (extraComponentProps === null || extraComponentProps === void 0 ? void 0 : extraComponentProps.length) === 0;
47
+ // const isEmptyBoundingBox = boundingBox === null;
48
+ if (isEmptyComponents) {
49
+ dispatch({
50
+ type: "board/setNewComponents",
51
+ payload: [],
52
+ });
53
+ setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
54
+ }
55
+ if (isEmptyExtraComponents) {
56
+ dispatch({
57
+ type: "board/setNewExtraComponents",
58
+ payload: [],
59
+ });
60
+ }
44
61
  if ((componentProps === null || componentProps === void 0 ? void 0 : componentProps.length) > 0) {
45
62
  dispatch({
46
63
  type: "board/setNewComponents",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.3.6",
3
+ "version": "3.3.7",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",