seat-editor 3.5.22 → 3.5.23

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.
@@ -1607,7 +1607,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1607
1607
  if (isInitialCreateText) {
1608
1608
  const ghost = svg.querySelector("#ghost-element-create");
1609
1609
  const getBBox = getGlobalBBox(svg, ghost);
1610
- console.log({ getBBox });
1611
1610
  const text = Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "text", fill: "#000000", text: "Text", fontSize: 14, rotation: 0 });
1612
1611
  addComponents(text);
1613
1612
  dispatch({
@@ -1606,7 +1606,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
1606
1606
  if (isInitialCreateText) {
1607
1607
  const ghost = svg.querySelector("#ghost-element-create");
1608
1608
  const getBBox = getGlobalBBox(svg, ghost);
1609
- console.log({ getBBox });
1610
1609
  const text = Object.assign(Object.assign({}, getBBox), { id: `${Date.now()}`, shape: "text", fill: "#000000", text: "Text", fontSize: 14, rotation: 0 });
1611
1610
  addComponents(text);
1612
1611
  dispatch({
@@ -7,7 +7,6 @@ export function getAttributeElement(root, id) {
7
7
  const boundingBox = root.querySelector(`g[data-bounding-box="${id}"]`);
8
8
  const text = root === null || root === void 0 ? void 0 : root.querySelector(`g[data-text="${id}-text"]`);
9
9
  const textRaw = root === null || root === void 0 ? void 0 : root.querySelector(`text[data-text-raw="${id}-text"]`);
10
- console.log({ textRaw });
11
10
  if (boundingBox) {
12
11
  const element = boundingBox.querySelector("rect");
13
12
  return { g: boundingBox, inner: null, element, seats, seatGroup };
@@ -1031,7 +1031,6 @@ const updateSvgAttrs = (el, attrs) => {
1031
1031
  export function applyResizeToSvgElement(element, group, resize, text, textRaw) {
1032
1032
  var _a, _b, _c, _d;
1033
1033
  const tagName = element.tagName.toLowerCase();
1034
- console.log({ tagName, textRaw });
1035
1034
  switch (tagName) {
1036
1035
  case "rect":
1037
1036
  case "image": {
@@ -43,9 +43,22 @@ const TableEditor = (props) => {
43
43
  }
44
44
  }, [viewOnly]);
45
45
  const onUpdateCurrentState = () => {
46
+ let reverseComponentHidden = (props === null || props === void 0 ? void 0 : props.hiddenStatusKey)
47
+ ? components === null || components === void 0 ? void 0 : components.map((c, i) => {
48
+ var _a, _b;
49
+ const findHidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i);
50
+ if (findHidden) {
51
+ if (mappingKey && ((_a = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _a === void 0 ? void 0 : _a[mappingKey])) {
52
+ return Object.assign({}, omit((_b = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _b === void 0 ? void 0 : _b[mappingKey], `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`));
53
+ }
54
+ return omit(findHidden === null || findHidden === void 0 ? void 0 : findHidden.data, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`) || {};
55
+ }
56
+ return c;
57
+ })
58
+ : components;
46
59
  let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
47
60
  if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
48
- let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
61
+ let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
49
62
  if (!findComponent)
50
63
  return undefined;
51
64
  if (findComponent) {
@@ -53,7 +66,7 @@ const TableEditor = (props) => {
53
66
  }
54
67
  }
55
68
  else {
56
- let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
69
+ let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
57
70
  if (!findComponent)
58
71
  return undefined;
59
72
  if (findComponent) {
@@ -62,15 +75,18 @@ const TableEditor = (props) => {
62
75
  }
63
76
  });
64
77
  const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
65
- if (props === null || props === void 0 ? void 0 : props.hiddenStatusKey) {
66
- matchInitialValueWithComponents = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.map((_, i) => {
67
- const hidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i); // find by key, bukan index
68
- if (hidden) {
69
- return hidden === null || hidden === void 0 ? void 0 : hidden.data;
70
- }
71
- return _;
72
- });
73
- }
78
+ // if (props?.hiddenStatusKey) {
79
+ // matchInitialValueWithComponents = matchInitialValueWithComponents?.map(
80
+ // (_, i) => {
81
+ // const hidden = hiddenIdList?.find((h) => h?.key === i); // find by key, bukan index
82
+ // if (hidden) {
83
+ // return hidden?.data;
84
+ // }
85
+ // return _;
86
+ // }
87
+ // );
88
+ // }
89
+ console.log({ hasUndefined, matchInitialValueWithComponents }, !hasUndefined && !viewOnly);
74
90
  if (!hasUndefined && !viewOnly) {
75
91
  onCurrentStateChange({
76
92
  // @ts-ignore
@@ -116,6 +132,7 @@ const TableEditor = (props) => {
116
132
  }
117
133
  return item;
118
134
  });
135
+ console.log({ mappingData });
119
136
  setHiddenIdList(hiddenIdList);
120
137
  return mappingData;
121
138
  };
@@ -42,9 +42,22 @@ const TableEditor = (props) => {
42
42
  }
43
43
  }, [viewOnly]);
44
44
  const onUpdateCurrentState = () => {
45
+ let reverseComponentHidden = (props === null || props === void 0 ? void 0 : props.hiddenStatusKey)
46
+ ? components === null || components === void 0 ? void 0 : components.map((c, i) => {
47
+ var _a, _b;
48
+ const findHidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i);
49
+ if (findHidden) {
50
+ if (mappingKey && ((_a = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _a === void 0 ? void 0 : _a[mappingKey])) {
51
+ return Object.assign({}, omit((_b = findHidden === null || findHidden === void 0 ? void 0 : findHidden.data) === null || _b === void 0 ? void 0 : _b[mappingKey], `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`));
52
+ }
53
+ return omit(findHidden === null || findHidden === void 0 ? void 0 : findHidden.data, `${props === null || props === void 0 ? void 0 : props.defaultSeatCountKey}`) || {};
54
+ }
55
+ return c;
56
+ })
57
+ : components;
45
58
  let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
46
59
  if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
47
- let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
60
+ let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
48
61
  if (!findComponent)
49
62
  return undefined;
50
63
  if (findComponent) {
@@ -52,7 +65,7 @@ const TableEditor = (props) => {
52
65
  }
53
66
  }
54
67
  else {
55
- let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
68
+ let findComponent = reverseComponentHidden === null || reverseComponentHidden === void 0 ? void 0 : reverseComponentHidden.find((c) => c.id === (item === null || item === void 0 ? void 0 : item.id));
56
69
  if (!findComponent)
57
70
  return undefined;
58
71
  if (findComponent) {
@@ -61,15 +74,18 @@ const TableEditor = (props) => {
61
74
  }
62
75
  });
63
76
  const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
64
- if (props === null || props === void 0 ? void 0 : props.hiddenStatusKey) {
65
- matchInitialValueWithComponents = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.map((_, i) => {
66
- const hidden = hiddenIdList === null || hiddenIdList === void 0 ? void 0 : hiddenIdList.find((h) => (h === null || h === void 0 ? void 0 : h.key) === i); // find by key, bukan index
67
- if (hidden) {
68
- return hidden === null || hidden === void 0 ? void 0 : hidden.data;
69
- }
70
- return _;
71
- });
72
- }
77
+ // if (props?.hiddenStatusKey) {
78
+ // matchInitialValueWithComponents = matchInitialValueWithComponents?.map(
79
+ // (_, i) => {
80
+ // const hidden = hiddenIdList?.find((h) => h?.key === i); // find by key, bukan index
81
+ // if (hidden) {
82
+ // return hidden?.data;
83
+ // }
84
+ // return _;
85
+ // }
86
+ // );
87
+ // }
88
+ console.log({ hasUndefined, matchInitialValueWithComponents }, !hasUndefined && !viewOnly);
73
89
  if (!hasUndefined && !viewOnly) {
74
90
  onCurrentStateChange({
75
91
  // @ts-ignore
@@ -115,6 +131,7 @@ const TableEditor = (props) => {
115
131
  }
116
132
  return item;
117
133
  });
134
+ console.log({ mappingData });
118
135
  setHiddenIdList(hiddenIdList);
119
136
  return mappingData;
120
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.5.22",
3
+ "version": "3.5.23",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",