seat-editor 3.5.55 → 3.5.57

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.
@@ -64,10 +64,14 @@ const TableEditor = (props) => {
64
64
  return undefined;
65
65
  const omitted = omit(findComponent, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`);
66
66
  // Transform objectDataKlenik keys to number
67
- const normalized = Object.fromEntries(Object.entries(omitted).map(([key, value]) => [
68
- key,
69
- objectDataKlenik.includes(key) ? Number(value) : value,
70
- ]));
67
+ const normalized = Object.fromEntries(Object.entries(omitted).map(([key, value]) => {
68
+ if (!objectDataKlenik.includes(key))
69
+ return [key, value];
70
+ const num = Number(value);
71
+ if (isNaN(num))
72
+ return [key, key === "opacity" ? 0.5 : 0];
73
+ return [key, num];
74
+ }));
71
75
  if (findComponent) {
72
76
  return Object.assign(Object.assign({}, item), { [mappingKey]: normalized });
73
77
  }
@@ -76,10 +80,14 @@ const TableEditor = (props) => {
76
80
  let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
77
81
  if (!findComponent)
78
82
  return undefined;
79
- const normalizeObject = (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [
80
- key,
81
- objectDataKlenik.includes(key) ? Number(value) : value,
82
- ]));
83
+ const normalizeObject = (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => {
84
+ if (!objectDataKlenik.includes(key))
85
+ return [key, value];
86
+ const num = Number(value);
87
+ if (isNaN(num))
88
+ return [key, key === "opacity" ? 0.5 : 0];
89
+ return [key, num];
90
+ }));
83
91
  return Object.assign(Object.assign({}, normalizeObject(item)), normalizeObject(findComponent));
84
92
  }
85
93
  });
@@ -96,11 +104,19 @@ const TableEditor = (props) => {
96
104
  // );
97
105
  // }
98
106
  if (!hasUndefined && !viewOnly) {
107
+ const extraComponentFilterFromDataKlenik = Object.fromEntries(Object.entries(extraComponents)
108
+ .filter(([key]) => objectDataKlenik.includes(key))
109
+ .map(([key, value]) => {
110
+ const num = Number(value);
111
+ if (isNaN(num))
112
+ return [key, key === "opacity" ? 0.5 : 0];
113
+ return [key, num];
114
+ }));
99
115
  onCurrentStateChange({
100
116
  // @ts-ignore
101
117
  components: matchInitialValueWithComponents,
102
118
  // @ts-ignore
103
- extraComponents: extraComponents,
119
+ extraComponents: extraComponentFilterFromDataKlenik,
104
120
  background: backgroundColor,
105
121
  boundingBox,
106
122
  });
@@ -63,10 +63,14 @@ const TableEditor = (props) => {
63
63
  return undefined;
64
64
  const omitted = omit(findComponent, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`);
65
65
  // Transform objectDataKlenik keys to number
66
- const normalized = Object.fromEntries(Object.entries(omitted).map(([key, value]) => [
67
- key,
68
- objectDataKlenik.includes(key) ? Number(value) : value,
69
- ]));
66
+ const normalized = Object.fromEntries(Object.entries(omitted).map(([key, value]) => {
67
+ if (!objectDataKlenik.includes(key))
68
+ return [key, value];
69
+ const num = Number(value);
70
+ if (isNaN(num))
71
+ return [key, key === "opacity" ? 0.5 : 0];
72
+ return [key, num];
73
+ }));
70
74
  if (findComponent) {
71
75
  return Object.assign(Object.assign({}, item), { [mappingKey]: normalized });
72
76
  }
@@ -75,10 +79,14 @@ const TableEditor = (props) => {
75
79
  let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
76
80
  if (!findComponent)
77
81
  return undefined;
78
- const normalizeObject = (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [
79
- key,
80
- objectDataKlenik.includes(key) ? Number(value) : value,
81
- ]));
82
+ const normalizeObject = (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => {
83
+ if (!objectDataKlenik.includes(key))
84
+ return [key, value];
85
+ const num = Number(value);
86
+ if (isNaN(num))
87
+ return [key, key === "opacity" ? 0.5 : 0];
88
+ return [key, num];
89
+ }));
82
90
  return Object.assign(Object.assign({}, normalizeObject(item)), normalizeObject(findComponent));
83
91
  }
84
92
  });
@@ -95,11 +103,19 @@ const TableEditor = (props) => {
95
103
  // );
96
104
  // }
97
105
  if (!hasUndefined && !viewOnly) {
106
+ const extraComponentFilterFromDataKlenik = Object.fromEntries(Object.entries(extraComponents)
107
+ .filter(([key]) => objectDataKlenik.includes(key))
108
+ .map(([key, value]) => {
109
+ const num = Number(value);
110
+ if (isNaN(num))
111
+ return [key, key === "opacity" ? 0.5 : 0];
112
+ return [key, num];
113
+ }));
98
114
  onCurrentStateChange({
99
115
  // @ts-ignore
100
116
  components: matchInitialValueWithComponents,
101
117
  // @ts-ignore
102
- extraComponents: extraComponents,
118
+ extraComponents: extraComponentFilterFromDataKlenik,
103
119
  background: backgroundColor,
104
120
  boundingBox,
105
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.55",
3
+ "version": "3.5.57",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",