seat-editor 3.5.56 → 3.5.58

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.
@@ -8,7 +8,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
8
8
  import { isEqual, omit } from "lodash";
9
9
  import LayerView from "../view-only-3";
10
10
  import { Spin } from "antd";
11
- import { objectDataKlenik } from "../panel/utils";
11
+ import { objectDataExtraKlenik, objectDataKlenik } from "../panel/utils";
12
12
  const TableEditor = (props) => {
13
13
  var _a;
14
14
  const [initialValue, setInitialValue] = useState(null);
@@ -68,7 +68,9 @@ const TableEditor = (props) => {
68
68
  if (!objectDataKlenik.includes(key))
69
69
  return [key, value];
70
70
  const num = Number(value);
71
- return [key, isNaN(num) ? 0 : num];
71
+ if (isNaN(num))
72
+ return [key, key === "opacity" ? 0.5 : 0];
73
+ return [key, num];
72
74
  }));
73
75
  if (findComponent) {
74
76
  return Object.assign(Object.assign({}, item), { [mappingKey]: normalized });
@@ -82,7 +84,9 @@ const TableEditor = (props) => {
82
84
  if (!objectDataKlenik.includes(key))
83
85
  return [key, value];
84
86
  const num = Number(value);
85
- return [key, isNaN(num) ? 0 : num];
87
+ if (isNaN(num))
88
+ return [key, key === "opacity" ? 0.5 : 0];
89
+ return [key, num];
86
90
  }));
87
91
  return Object.assign(Object.assign({}, normalizeObject(item)), normalizeObject(findComponent));
88
92
  }
@@ -100,11 +104,19 @@ const TableEditor = (props) => {
100
104
  // );
101
105
  // }
102
106
  if (!hasUndefined && !viewOnly) {
107
+ const extraComponentFilterFromDataKlenik = Object.fromEntries(Object.entries(extraComponents !== null && extraComponents !== void 0 ? extraComponents : {}).map(([key, value]) => {
108
+ if (!objectDataExtraKlenik.includes(key))
109
+ return [key, value];
110
+ const num = Number(value);
111
+ if (isNaN(num))
112
+ return [key, key === "opacity" ? 0.5 : 0];
113
+ return [key, num];
114
+ }));
103
115
  onCurrentStateChange({
104
116
  // @ts-ignore
105
117
  components: matchInitialValueWithComponents,
106
118
  // @ts-ignore
107
- extraComponents: extraComponents,
119
+ extraComponents: extraComponentFilterFromDataKlenik,
108
120
  background: backgroundColor,
109
121
  boundingBox,
110
122
  });
@@ -7,7 +7,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
7
7
  import { isEqual, omit } from "lodash";
8
8
  import LayerView from "../view-only-3";
9
9
  import { Spin } from "antd";
10
- import { objectDataKlenik } from "../panel/utils";
10
+ import { objectDataExtraKlenik, objectDataKlenik } from "../panel/utils";
11
11
  const TableEditor = (props) => {
12
12
  var _a;
13
13
  const [initialValue, setInitialValue] = useState(null);
@@ -67,7 +67,9 @@ const TableEditor = (props) => {
67
67
  if (!objectDataKlenik.includes(key))
68
68
  return [key, value];
69
69
  const num = Number(value);
70
- return [key, isNaN(num) ? 0 : num];
70
+ if (isNaN(num))
71
+ return [key, key === "opacity" ? 0.5 : 0];
72
+ return [key, num];
71
73
  }));
72
74
  if (findComponent) {
73
75
  return Object.assign(Object.assign({}, item), { [mappingKey]: normalized });
@@ -81,7 +83,9 @@ const TableEditor = (props) => {
81
83
  if (!objectDataKlenik.includes(key))
82
84
  return [key, value];
83
85
  const num = Number(value);
84
- return [key, isNaN(num) ? 0 : num];
86
+ if (isNaN(num))
87
+ return [key, key === "opacity" ? 0.5 : 0];
88
+ return [key, num];
85
89
  }));
86
90
  return Object.assign(Object.assign({}, normalizeObject(item)), normalizeObject(findComponent));
87
91
  }
@@ -99,11 +103,19 @@ const TableEditor = (props) => {
99
103
  // );
100
104
  // }
101
105
  if (!hasUndefined && !viewOnly) {
106
+ const extraComponentFilterFromDataKlenik = Object.fromEntries(Object.entries(extraComponents !== null && extraComponents !== void 0 ? extraComponents : {}).map(([key, value]) => {
107
+ if (!objectDataExtraKlenik.includes(key))
108
+ return [key, value];
109
+ const num = Number(value);
110
+ if (isNaN(num))
111
+ return [key, key === "opacity" ? 0.5 : 0];
112
+ return [key, num];
113
+ }));
102
114
  onCurrentStateChange({
103
115
  // @ts-ignore
104
116
  components: matchInitialValueWithComponents,
105
117
  // @ts-ignore
106
- extraComponents: extraComponents,
118
+ extraComponents: extraComponentFilterFromDataKlenik,
107
119
  background: backgroundColor,
108
120
  boundingBox,
109
121
  });
@@ -25,5 +25,6 @@ export declare function getValueIfSame<T>(arr: T[], key: keyof T): number | any[
25
25
  export declare function getAllValuesKey<T>(arr: T[], key: keyof T): T[keyof T][];
26
26
  export declare function showAllValueNotSame(arr: any[], key: string): string;
27
27
  export declare const objectDataKlenik: string[];
28
+ export declare const objectDataExtraKlenik: string[];
28
29
  export declare const sanitizeData: (data: TableProps) => _.Omit<TableProps, string>;
29
30
  export {};
@@ -164,6 +164,17 @@ export const objectDataKlenik = [
164
164
  "fontSize",
165
165
  "openSpace",
166
166
  ];
167
+ export const objectDataExtraKlenik = [
168
+ "width",
169
+ "height",
170
+ "x",
171
+ "y",
172
+ "opacity",
173
+ "rotation",
174
+ "strokeWidth",
175
+ "radius",
176
+ "fontSize",
177
+ ];
167
178
  export const sanitizeData = (data) => {
168
179
  const shape = data === null || data === void 0 ? void 0 : data.shape;
169
180
  switch (shape) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.5.56",
3
+ "version": "3.5.58",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",