@dmsi/wedgekit-react 0.0.643 → 0.0.644

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.
Files changed (66) hide show
  1. package/dist/{chunk-FIOXWZWU.js → chunk-ECYXZZWC.js} +1 -1
  2. package/dist/{chunk-QJZ3XHNH.js → chunk-HCHKYUNQ.js} +19 -5
  3. package/dist/{chunk-SJ3SULQB.js → chunk-J2QD64F2.js} +7 -7
  4. package/dist/{chunk-YR4ZO2XL.js → chunk-K22B4L3G.js} +28 -22
  5. package/dist/{chunk-3R3AY5MT.js → chunk-LN3HVXH5.js} +1 -1
  6. package/dist/{chunk-IATOG76G.js → chunk-NUFBAJ6L.js} +1 -1
  7. package/dist/{chunk-MQB6BSRX.js → chunk-OXOMO76M.js} +1 -1
  8. package/dist/{chunk-UB3GEENN.js → chunk-OZEKRO4L.js} +1 -1
  9. package/dist/{chunk-LGX34HML.js → chunk-Q4AANHJY.js} +1 -1
  10. package/dist/{chunk-5JHKFK73.js → chunk-V2GSI3ZX.js} +2 -2
  11. package/dist/{chunk-RQMOWYB7.js → chunk-VAARSN7U.js} +3 -3
  12. package/dist/{chunk-ARWHCWG7.js → chunk-XT4BQXSX.js} +1 -1
  13. package/dist/{chunk-XX5GVIPZ.js → chunk-XVWCVBVF.js} +2 -2
  14. package/dist/{chunk-PS7MBNUT.js → chunk-YXZRGZ2I.js} +1 -1
  15. package/dist/{chunk-V7GPM6Z3.js → chunk-Z3Q7PLVD.js} +1 -1
  16. package/dist/components/CalendarRange.cjs +45 -26
  17. package/dist/components/CalendarRange.js +15 -15
  18. package/dist/components/CompactImagesPreview.js +3 -3
  19. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +45 -26
  20. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +15 -15
  21. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +45 -26
  22. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +15 -15
  23. package/dist/components/DataGrid/PinnedColumns.cjs +45 -26
  24. package/dist/components/DataGrid/PinnedColumns.js +15 -15
  25. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +45 -26
  26. package/dist/components/DataGrid/TableBody/LoadingCell.js +15 -15
  27. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +45 -26
  28. package/dist/components/DataGrid/TableBody/TableBodyRow.js +15 -15
  29. package/dist/components/DataGrid/TableBody/index.cjs +45 -26
  30. package/dist/components/DataGrid/TableBody/index.js +15 -15
  31. package/dist/components/DataGrid/index.cjs +45 -26
  32. package/dist/components/DataGrid/index.js +15 -15
  33. package/dist/components/DataGrid/utils.cjs +45 -26
  34. package/dist/components/DataGrid/utils.js +15 -15
  35. package/dist/components/DataGridCell.js +6 -6
  36. package/dist/components/DateInput.cjs +45 -26
  37. package/dist/components/DateInput.js +15 -15
  38. package/dist/components/DateRangeInput.cjs +45 -26
  39. package/dist/components/DateRangeInput.js +15 -15
  40. package/dist/components/Menu.js +4 -4
  41. package/dist/components/MenuOption.js +3 -3
  42. package/dist/components/MobileDataGrid/ColumnList.js +4 -4
  43. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +45 -26
  44. package/dist/components/MobileDataGrid/ColumnSelector/index.js +15 -15
  45. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
  46. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
  47. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +45 -26
  48. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +15 -15
  49. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
  50. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +6 -6
  51. package/dist/components/MobileDataGrid/index.cjs +45 -26
  52. package/dist/components/MobileDataGrid/index.js +15 -15
  53. package/dist/components/Modal.js +3 -3
  54. package/dist/components/NestedMenu.js +3 -3
  55. package/dist/components/PDFViewer/index.js +3 -3
  56. package/dist/components/ProductImagePreview/index.js +3 -3
  57. package/dist/components/ProjectBar.js +2 -2
  58. package/dist/components/Time.js +1 -1
  59. package/dist/components/index.cjs +45 -26
  60. package/dist/components/index.js +15 -15
  61. package/dist/components/useMenuSystem.js +3 -3
  62. package/dist/hooks/index.cjs +48 -26
  63. package/dist/hooks/index.js +2 -2
  64. package/dist/utils/index.cjs +21 -5
  65. package/dist/utils/index.js +1 -1
  66. package/package.json +1 -1
@@ -627,11 +627,24 @@ function formatDate(date) {
627
627
 
628
628
  // src/utils/mergeObjectArrays.ts
629
629
  function mergeObjectArrays(arr1, arr2) {
630
- const maxLength = Math.max(arr1.length, arr2.length);
631
- return Array.from(
632
- { length: maxLength },
633
- (_, i) => __spreadValues(__spreadValues({}, arr1[i] || {}), arr2[i] || {})
634
- );
630
+ const arr2Map = /* @__PURE__ */ new Map();
631
+ for (const item of arr2) {
632
+ const id = item.id;
633
+ if (id !== void 0) {
634
+ arr2Map.set(id, item);
635
+ }
636
+ }
637
+ return arr1.map((item1) => {
638
+ const id = item1.id;
639
+ if (id !== void 0 && arr2Map.has(id)) {
640
+ const item2 = arr2Map.get(id);
641
+ const meta1 = item1.meta;
642
+ const meta2 = item2.meta;
643
+ const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
644
+ return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
645
+ }
646
+ return item1;
647
+ });
635
648
  }
636
649
 
637
650
  // src/utils/index.ts
@@ -667,52 +680,58 @@ var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
667
680
  function useTableLayout(initialColumns, key, autosync = true) {
668
681
  const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
669
682
  const [isReady, setIsReady] = (0, import_react5.useState)(false);
670
- const renderCountRef = (0, import_react5.useRef)(0);
683
+ const isReadyRef = (0, import_react5.useRef)(false);
684
+ const keyRef = (0, import_react5.useRef)(key);
685
+ (0, import_react5.useEffect)(() => {
686
+ isReadyRef.current = isReady;
687
+ keyRef.current = key;
688
+ }, [isReady, key]);
671
689
  const handleSaveLayout = (0, import_react5.useCallback)(
672
690
  (setter, _internal) => {
673
- if (!isReady && !_internal || !key) return;
691
+ if (!isReadyRef.current && !_internal || !keyRef.current) return;
674
692
  setColumns((prevColumns) => {
675
693
  const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
676
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal)
694
+ if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
677
695
  return prevColumns;
696
+ }
678
697
  localStorage.setItem(
679
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
698
+ getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
680
699
  JSON.stringify(newColumns)
681
700
  );
682
701
  return newColumns;
683
702
  });
684
703
  },
685
- [isReady, key]
704
+ []
686
705
  );
687
706
  (0, import_react5.useEffect)(() => {
688
707
  if (!autosync) return;
689
- if (!key) return setIsReady(true);
690
- if (renderCountRef.current > 1) {
691
- throw new Error(
692
- `useTableLayout should only be called once per component render cycle.
693
- ${renderCountRef.current} Renders detected.
694
- Check dependency stability`
695
- );
708
+ if (!key) {
709
+ setIsReady(true);
710
+ return;
696
711
  }
697
- renderCountRef.current += 1;
698
712
  const savedLayout = localStorage.getItem(
699
713
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
700
714
  );
701
715
  if (savedLayout) {
702
- handleSaveLayout(
716
+ setColumns(
703
717
  mergeObjectArrays(
704
718
  initialColumns,
705
719
  JSON.parse(savedLayout)
706
- ),
707
- true
720
+ )
721
+ );
722
+ } else {
723
+ localStorage.setItem(
724
+ getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
725
+ JSON.stringify(initialColumns)
708
726
  );
727
+ setColumns((prev) => {
728
+ if (JSON.stringify(initialColumns) === JSON.stringify(prev))
729
+ return prev;
730
+ return initialColumns;
731
+ });
709
732
  }
710
- if (!savedLayout) handleSaveLayout(initialColumns, true);
711
733
  setIsReady(true);
712
- return () => {
713
- renderCountRef.current = 0;
714
- };
715
- }, [handleSaveLayout, initialColumns, key, autosync]);
734
+ }, [initialColumns, key, autosync]);
716
735
  const getSavedLayout = (0, import_react5.useCallback)(() => {
717
736
  const savedLayout = localStorage.getItem(
718
737
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
@@ -2,13 +2,13 @@ import {
2
2
  DataGrid,
3
3
  DateInput,
4
4
  MobileDataGrid
5
- } from "../chunk-SJ3SULQB.js";
6
- import "../chunk-XX5GVIPZ.js";
5
+ } from "../chunk-J2QD64F2.js";
6
+ import "../chunk-XVWCVBVF.js";
7
7
  import "../chunk-M7INAUAJ.js";
8
- import "../chunk-ARWHCWG7.js";
8
+ import "../chunk-XT4BQXSX.js";
9
9
  import {
10
10
  ProductImagePreview
11
- } from "../chunk-MQB6BSRX.js";
11
+ } from "../chunk-OXOMO76M.js";
12
12
  import "../chunk-YCDDBSVU.js";
13
13
  import "../chunk-3X3Y4TMS.js";
14
14
  import "../chunk-BQNPOGD5.js";
@@ -17,11 +17,11 @@ import {
17
17
  } from "../chunk-Y5GD2FJA.js";
18
18
  import "../chunk-MBZ55T2D.js";
19
19
  import "../chunk-2IKT6IHB.js";
20
- import "../chunk-FIOXWZWU.js";
21
- import "../chunk-LGX34HML.js";
20
+ import "../chunk-ECYXZZWC.js";
21
+ import "../chunk-Q4AANHJY.js";
22
22
  import "../chunk-5IFPG6TS.js";
23
+ import "../chunk-OZEKRO4L.js";
23
24
  import "../chunk-AJ5M6MVX.js";
24
- import "../chunk-UB3GEENN.js";
25
25
  import "../chunk-AT4AWD6B.js";
26
26
  import "../chunk-EWGHVZL5.js";
27
27
  import {
@@ -42,7 +42,7 @@ import {
42
42
  import {
43
43
  Tooltip
44
44
  } from "../chunk-AS57Y2D3.js";
45
- import "../chunk-V7GPM6Z3.js";
45
+ import "../chunk-Z3Q7PLVD.js";
46
46
  import "../chunk-4RJKB7LC.js";
47
47
  import "../chunk-UUKHQUSF.js";
48
48
  import "../chunk-WVVEOCEH.js";
@@ -64,14 +64,14 @@ import {
64
64
  DataGridCell,
65
65
  DragAlongCell,
66
66
  DraggableCellHeader
67
- } from "../chunk-RQMOWYB7.js";
67
+ } from "../chunk-VAARSN7U.js";
68
68
  import {
69
69
  Menu
70
- } from "../chunk-5JHKFK73.js";
71
- import "../chunk-IATOG76G.js";
70
+ } from "../chunk-V2GSI3ZX.js";
71
+ import "../chunk-NUFBAJ6L.js";
72
72
  import {
73
73
  MenuOption
74
- } from "../chunk-PS7MBNUT.js";
74
+ } from "../chunk-YXZRGZ2I.js";
75
75
  import {
76
76
  Search
77
77
  } from "../chunk-FHXCCVOG.js";
@@ -87,10 +87,10 @@ import {
87
87
  } from "../chunk-M7WHWZ2J.js";
88
88
  import {
89
89
  CompactImagesPreview
90
- } from "../chunk-3R3AY5MT.js";
91
- import "../chunk-YR4ZO2XL.js";
90
+ } from "../chunk-LN3HVXH5.js";
91
+ import "../chunk-K22B4L3G.js";
92
92
  import "../chunk-VXWSAIB5.js";
93
- import "../chunk-QJZ3XHNH.js";
93
+ import "../chunk-HCHKYUNQ.js";
94
94
  import "../chunk-5UH6QUFB.js";
95
95
  import {
96
96
  AccessCard
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  useMenuPosition,
4
4
  useSubMenuSystem
5
- } from "../chunk-IATOG76G.js";
6
- import "../chunk-YR4ZO2XL.js";
5
+ } from "../chunk-NUFBAJ6L.js";
6
+ import "../chunk-K22B4L3G.js";
7
7
  import "../chunk-VXWSAIB5.js";
8
- import "../chunk-QJZ3XHNH.js";
8
+ import "../chunk-HCHKYUNQ.js";
9
9
  import "../chunk-5UH6QUFB.js";
10
10
  import "../chunk-ORMEWXMH.js";
11
11
  export {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -17,6 +19,7 @@ var __spreadValues = (a, b) => {
17
19
  }
18
20
  return a;
19
21
  };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
23
  var __export = (target, all) => {
21
24
  for (var name in all)
22
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -117,11 +120,24 @@ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
117
120
 
118
121
  // src/utils/mergeObjectArrays.ts
119
122
  function mergeObjectArrays(arr1, arr2) {
120
- const maxLength = Math.max(arr1.length, arr2.length);
121
- return Array.from(
122
- { length: maxLength },
123
- (_, i) => __spreadValues(__spreadValues({}, arr1[i] || {}), arr2[i] || {})
124
- );
123
+ const arr2Map = /* @__PURE__ */ new Map();
124
+ for (const item of arr2) {
125
+ const id = item.id;
126
+ if (id !== void 0) {
127
+ arr2Map.set(id, item);
128
+ }
129
+ }
130
+ return arr1.map((item1) => {
131
+ const id = item1.id;
132
+ if (id !== void 0 && arr2Map.has(id)) {
133
+ const item2 = arr2Map.get(id);
134
+ const meta1 = item1.meta;
135
+ const meta2 = item2.meta;
136
+ const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
137
+ return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
138
+ }
139
+ return item1;
140
+ });
125
141
  }
126
142
 
127
143
  // src/utils/index.ts
@@ -134,52 +150,58 @@ var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
134
150
  function useTableLayout(initialColumns, key, autosync = true) {
135
151
  const [columns, setColumns] = (0, import_react4.useState)(initialColumns);
136
152
  const [isReady, setIsReady] = (0, import_react4.useState)(false);
137
- const renderCountRef = (0, import_react4.useRef)(0);
153
+ const isReadyRef = (0, import_react4.useRef)(false);
154
+ const keyRef = (0, import_react4.useRef)(key);
155
+ (0, import_react4.useEffect)(() => {
156
+ isReadyRef.current = isReady;
157
+ keyRef.current = key;
158
+ }, [isReady, key]);
138
159
  const handleSaveLayout = (0, import_react4.useCallback)(
139
160
  (setter, _internal) => {
140
- if (!isReady && !_internal || !key) return;
161
+ if (!isReadyRef.current && !_internal || !keyRef.current) return;
141
162
  setColumns((prevColumns) => {
142
163
  const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
143
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal)
164
+ if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
144
165
  return prevColumns;
166
+ }
145
167
  localStorage.setItem(
146
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
168
+ getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
147
169
  JSON.stringify(newColumns)
148
170
  );
149
171
  return newColumns;
150
172
  });
151
173
  },
152
- [isReady, key]
174
+ []
153
175
  );
154
176
  (0, import_react4.useEffect)(() => {
155
177
  if (!autosync) return;
156
- if (!key) return setIsReady(true);
157
- if (renderCountRef.current > 1) {
158
- throw new Error(
159
- `useTableLayout should only be called once per component render cycle.
160
- ${renderCountRef.current} Renders detected.
161
- Check dependency stability`
162
- );
178
+ if (!key) {
179
+ setIsReady(true);
180
+ return;
163
181
  }
164
- renderCountRef.current += 1;
165
182
  const savedLayout = localStorage.getItem(
166
183
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
167
184
  );
168
185
  if (savedLayout) {
169
- handleSaveLayout(
186
+ setColumns(
170
187
  mergeObjectArrays(
171
188
  initialColumns,
172
189
  JSON.parse(savedLayout)
173
- ),
174
- true
190
+ )
191
+ );
192
+ } else {
193
+ localStorage.setItem(
194
+ getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
195
+ JSON.stringify(initialColumns)
175
196
  );
197
+ setColumns((prev) => {
198
+ if (JSON.stringify(initialColumns) === JSON.stringify(prev))
199
+ return prev;
200
+ return initialColumns;
201
+ });
176
202
  }
177
- if (!savedLayout) handleSaveLayout(initialColumns, true);
178
203
  setIsReady(true);
179
- return () => {
180
- renderCountRef.current = 0;
181
- };
182
- }, [handleSaveLayout, initialColumns, key, autosync]);
204
+ }, [initialColumns, key, autosync]);
183
205
  const getSavedLayout = (0, import_react4.useCallback)(() => {
184
206
  const savedLayout = localStorage.getItem(
185
207
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
@@ -4,9 +4,9 @@ import {
4
4
  useMatchesMedia,
5
5
  useMatchesMobile,
6
6
  useTableLayout
7
- } from "../chunk-YR4ZO2XL.js";
7
+ } from "../chunk-K22B4L3G.js";
8
8
  import "../chunk-VXWSAIB5.js";
9
- import "../chunk-QJZ3XHNH.js";
9
+ import "../chunk-HCHKYUNQ.js";
10
10
  import "../chunk-5UH6QUFB.js";
11
11
  import "../chunk-ORMEWXMH.js";
12
12
  export {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -17,6 +19,7 @@ var __spreadValues = (a, b) => {
17
19
  }
18
20
  return a;
19
21
  };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
23
  var __export = (target, all) => {
21
24
  for (var name in all)
22
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -216,11 +219,24 @@ function isValidDateRangeOrder(fromDate, toDate) {
216
219
 
217
220
  // src/utils/mergeObjectArrays.ts
218
221
  function mergeObjectArrays(arr1, arr2) {
219
- const maxLength = Math.max(arr1.length, arr2.length);
220
- return Array.from(
221
- { length: maxLength },
222
- (_, i) => __spreadValues(__spreadValues({}, arr1[i] || {}), arr2[i] || {})
223
- );
222
+ const arr2Map = /* @__PURE__ */ new Map();
223
+ for (const item of arr2) {
224
+ const id = item.id;
225
+ if (id !== void 0) {
226
+ arr2Map.set(id, item);
227
+ }
228
+ }
229
+ return arr1.map((item1) => {
230
+ const id = item1.id;
231
+ if (id !== void 0 && arr2Map.has(id)) {
232
+ const item2 = arr2Map.get(id);
233
+ const meta1 = item1.meta;
234
+ const meta2 = item2.meta;
235
+ const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
236
+ return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
237
+ }
238
+ return item1;
239
+ });
224
240
  }
225
241
 
226
242
  // src/utils/index.ts
@@ -14,7 +14,7 @@ import {
14
14
  mergeObjectArrays,
15
15
  parseDateParts,
16
16
  parseInputDate
17
- } from "../chunk-QJZ3XHNH.js";
17
+ } from "../chunk-HCHKYUNQ.js";
18
18
  import {
19
19
  formatCurrencyDisplay,
20
20
  formatDecimalValue,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.643",
4
+ "version": "0.0.644",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",