@dmsi/wedgekit-react 0.0.643 → 0.0.645

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 (77) hide show
  1. package/dist/{chunk-XX5GVIPZ.js → chunk-3MV3KMQH.js} +2 -2
  2. package/dist/{chunk-V7GPM6Z3.js → chunk-3PBA2EZ5.js} +1 -1
  3. package/dist/{chunk-3R3AY5MT.js → chunk-B3T7KBDA.js} +1 -1
  4. package/dist/{chunk-FIOXWZWU.js → chunk-ECYXZZWC.js} +1 -1
  5. package/dist/{chunk-RQMOWYB7.js → chunk-EXCAOI2L.js} +3 -3
  6. package/dist/{chunk-MQB6BSRX.js → chunk-FCGPQNS2.js} +1 -1
  7. package/dist/{chunk-SJ3SULQB.js → chunk-FJXWYGB7.js} +7 -7
  8. package/dist/{chunk-QJZ3XHNH.js → chunk-HCHKYUNQ.js} +19 -5
  9. package/dist/{chunk-5JHKFK73.js → chunk-HIGNJAQA.js} +2 -2
  10. package/dist/{chunk-IATOG76G.js → chunk-ISRG77J6.js} +1 -1
  11. package/dist/{chunk-UB3GEENN.js → chunk-OZEKRO4L.js} +1 -1
  12. package/dist/{chunk-LGX34HML.js → chunk-Q4AANHJY.js} +1 -1
  13. package/dist/{chunk-PS7MBNUT.js → chunk-REC2XOPI.js} +1 -1
  14. package/dist/{chunk-ARWHCWG7.js → chunk-XT4BQXSX.js} +1 -1
  15. package/dist/{chunk-YR4ZO2XL.js → chunk-ZSRTAMSW.js} +56 -23
  16. package/dist/components/CalendarRange.cjs +202 -180
  17. package/dist/components/CalendarRange.js +15 -15
  18. package/dist/components/CompactImagesPreview.cjs +6 -3
  19. package/dist/components/CompactImagesPreview.js +3 -3
  20. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +202 -180
  21. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +15 -15
  22. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +202 -180
  23. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +15 -15
  24. package/dist/components/DataGrid/PinnedColumns.cjs +202 -180
  25. package/dist/components/DataGrid/PinnedColumns.js +15 -15
  26. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +202 -180
  27. package/dist/components/DataGrid/TableBody/LoadingCell.js +15 -15
  28. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +202 -180
  29. package/dist/components/DataGrid/TableBody/TableBodyRow.js +15 -15
  30. package/dist/components/DataGrid/TableBody/index.cjs +202 -180
  31. package/dist/components/DataGrid/TableBody/index.js +15 -15
  32. package/dist/components/DataGrid/index.cjs +203 -181
  33. package/dist/components/DataGrid/index.js +15 -15
  34. package/dist/components/DataGrid/utils.cjs +202 -180
  35. package/dist/components/DataGrid/utils.js +15 -15
  36. package/dist/components/DataGridCell.cjs +61 -58
  37. package/dist/components/DataGridCell.js +6 -6
  38. package/dist/components/DateInput.cjs +195 -173
  39. package/dist/components/DateInput.js +15 -15
  40. package/dist/components/DateRangeInput.cjs +208 -186
  41. package/dist/components/DateRangeInput.js +15 -15
  42. package/dist/components/Menu.cjs +15 -12
  43. package/dist/components/Menu.js +4 -4
  44. package/dist/components/MenuOption.cjs +8 -5
  45. package/dist/components/MenuOption.js +3 -3
  46. package/dist/components/MobileDataGrid/ColumnList.js +4 -4
  47. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +206 -184
  48. package/dist/components/MobileDataGrid/ColumnSelector/index.js +15 -15
  49. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
  50. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
  51. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +206 -184
  52. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +15 -15
  53. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
  54. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +19 -16
  55. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +6 -6
  56. package/dist/components/MobileDataGrid/index.cjs +215 -193
  57. package/dist/components/MobileDataGrid/index.js +15 -15
  58. package/dist/components/Modal.cjs +15 -12
  59. package/dist/components/Modal.js +3 -3
  60. package/dist/components/NestedMenu.cjs +11 -8
  61. package/dist/components/NestedMenu.js +3 -3
  62. package/dist/components/PDFViewer/index.cjs +31 -28
  63. package/dist/components/PDFViewer/index.js +3 -3
  64. package/dist/components/ProductImagePreview/index.cjs +18 -15
  65. package/dist/components/ProductImagePreview/index.js +3 -3
  66. package/dist/components/ProjectBar.cjs +3 -0
  67. package/dist/components/ProjectBar.js +2 -2
  68. package/dist/components/Time.js +1 -1
  69. package/dist/components/index.cjs +263 -241
  70. package/dist/components/index.js +15 -15
  71. package/dist/components/useMenuSystem.cjs +22 -19
  72. package/dist/components/useMenuSystem.js +3 -3
  73. package/dist/hooks/index.cjs +76 -26
  74. package/dist/hooks/index.js +4 -2
  75. package/dist/utils/index.cjs +21 -5
  76. package/dist/utils/index.js +1 -1
  77. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ModalContent
3
- } from "./chunk-ARWHCWG7.js";
3
+ } from "./chunk-XT4BQXSX.js";
4
4
  import {
5
5
  useGridContext
6
6
  } from "./chunk-5IFPG6TS.js";
7
7
  import {
8
8
  Modal
9
- } from "./chunk-V7GPM6Z3.js";
9
+ } from "./chunk-3PBA2EZ5.js";
10
10
  import {
11
11
  Heading2
12
12
  } from "./chunk-MXSJF6TW.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-AG43RS4Q.js";
16
16
  import {
17
17
  useMatchesMobile
18
- } from "./chunk-YR4ZO2XL.js";
18
+ } from "./chunk-ZSRTAMSW.js";
19
19
  import {
20
20
  findDocumentRoot
21
21
  } from "./chunk-VXWSAIB5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useMatchesMobile
3
- } from "./chunk-YR4ZO2XL.js";
3
+ } from "./chunk-ZSRTAMSW.js";
4
4
  import {
5
5
  Stack
6
6
  } from "./chunk-MTGNBARV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MobileDataGridCard
3
- } from "./chunk-LGX34HML.js";
3
+ } from "./chunk-Q4AANHJY.js";
4
4
  import {
5
5
  useGridContext
6
6
  } from "./chunk-5IFPG6TS.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Menu
3
- } from "./chunk-5JHKFK73.js";
3
+ } from "./chunk-HIGNJAQA.js";
4
4
  import {
5
5
  useSubMenuSystem
6
- } from "./chunk-IATOG76G.js";
6
+ } from "./chunk-ISRG77J6.js";
7
7
  import {
8
8
  MenuOption
9
- } from "./chunk-PS7MBNUT.js";
9
+ } from "./chunk-REC2XOPI.js";
10
10
  import {
11
11
  Search
12
12
  } from "./chunk-FHXCCVOG.js";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-BWPNXY7T.js";
19
19
  import {
20
20
  useMatchesMobile
21
- } from "./chunk-YR4ZO2XL.js";
21
+ } from "./chunk-ZSRTAMSW.js";
22
22
  import {
23
23
  Stack
24
24
  } from "./chunk-MTGNBARV.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  RowDetailModalProvider
3
- } from "./chunk-XX5GVIPZ.js";
3
+ } from "./chunk-3MV3KMQH.js";
4
4
  import {
5
5
  GridContextProvider
6
6
  } from "./chunk-M7INAUAJ.js";
7
7
  import {
8
8
  ColumnList,
9
9
  no_results_image_default
10
- } from "./chunk-FIOXWZWU.js";
10
+ } from "./chunk-ECYXZZWC.js";
11
11
  import {
12
12
  useGridContext
13
13
  } from "./chunk-5IFPG6TS.js";
@@ -25,13 +25,13 @@ import {
25
25
  DataGridCell,
26
26
  DragAlongCell,
27
27
  DraggableCellHeader
28
- } from "./chunk-RQMOWYB7.js";
28
+ } from "./chunk-EXCAOI2L.js";
29
29
  import {
30
30
  Menu
31
- } from "./chunk-5JHKFK73.js";
31
+ } from "./chunk-HIGNJAQA.js";
32
32
  import {
33
33
  MenuOption
34
- } from "./chunk-PS7MBNUT.js";
34
+ } from "./chunk-REC2XOPI.js";
35
35
  import {
36
36
  Search
37
37
  } from "./chunk-FHXCCVOG.js";
@@ -48,7 +48,7 @@ import {
48
48
  import {
49
49
  useInfiniteScroll,
50
50
  useTableLayout
51
- } from "./chunk-YR4ZO2XL.js";
51
+ } from "./chunk-ZSRTAMSW.js";
52
52
  import {
53
53
  findDocumentRoot
54
54
  } from "./chunk-VXWSAIB5.js";
@@ -58,7 +58,7 @@ import {
58
58
  formatInputValue,
59
59
  isValidDate,
60
60
  parseInputDate
61
- } from "./chunk-QJZ3XHNH.js";
61
+ } from "./chunk-HCHKYUNQ.js";
62
62
  import {
63
63
  formatCurrencyDisplay
64
64
  } from "./chunk-5UH6QUFB.js";
@@ -1,4 +1,5 @@
1
1
  import {
2
+ __spreadProps,
2
3
  __spreadValues
3
4
  } from "./chunk-ORMEWXMH.js";
4
5
 
@@ -130,11 +131,24 @@ function isValidDateRangeOrder(fromDate, toDate) {
130
131
 
131
132
  // src/utils/mergeObjectArrays.ts
132
133
  function mergeObjectArrays(arr1, arr2) {
133
- const maxLength = Math.max(arr1.length, arr2.length);
134
- return Array.from(
135
- { length: maxLength },
136
- (_, i) => __spreadValues(__spreadValues({}, arr1[i] || {}), arr2[i] || {})
137
- );
134
+ const arr2Map = /* @__PURE__ */ new Map();
135
+ for (const item of arr2) {
136
+ const id = item.id;
137
+ if (id !== void 0) {
138
+ arr2Map.set(id, item);
139
+ }
140
+ }
141
+ return arr1.map((item1) => {
142
+ const id = item1.id;
143
+ if (id !== void 0 && arr2Map.has(id)) {
144
+ const item2 = arr2Map.get(id);
145
+ const meta1 = item1.meta;
146
+ const meta2 = item2.meta;
147
+ const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
148
+ return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
149
+ }
150
+ return item1;
151
+ });
138
152
  }
139
153
 
140
154
  // src/utils/index.ts
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useMenuPosition
3
- } from "./chunk-IATOG76G.js";
3
+ } from "./chunk-ISRG77J6.js";
4
4
  import {
5
5
  useMatchesMobile
6
- } from "./chunk-YR4ZO2XL.js";
6
+ } from "./chunk-ZSRTAMSW.js";
7
7
  import {
8
8
  findDocumentRoot
9
9
  } from "./chunk-VXWSAIB5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useMatchesMobile
3
- } from "./chunk-YR4ZO2XL.js";
3
+ } from "./chunk-ZSRTAMSW.js";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-ORMEWXMH.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-QJZ3XHNH.js";
3
+ } from "./chunk-HCHKYUNQ.js";
4
4
  import {
5
5
  Paragraph
6
6
  } from "./chunk-WMPWWFUJ.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5IFPG6TS.js";
4
4
  import {
5
5
  MobileDataGridColumn
6
- } from "./chunk-UB3GEENN.js";
6
+ } from "./chunk-OZEKRO4L.js";
7
7
  import {
8
8
  Checkbox
9
9
  } from "./chunk-M7WHWZ2J.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-HXGJVYGQ.js";
4
4
  import {
5
5
  useMatchesMobile
6
- } from "./chunk-YR4ZO2XL.js";
6
+ } from "./chunk-ZSRTAMSW.js";
7
7
  import {
8
8
  Caption
9
9
  } from "./chunk-PS6UJZVH.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5IFPG6TS.js";
4
4
  import {
5
5
  MobileDataGridColumn
6
- } from "./chunk-UB3GEENN.js";
6
+ } from "./chunk-OZEKRO4L.js";
7
7
  import {
8
8
  Stack
9
9
  } from "./chunk-MTGNBARV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LocalStoragePrefixVersion,
3
3
  mergeObjectArrays
4
- } from "./chunk-QJZ3XHNH.js";
4
+ } from "./chunk-HCHKYUNQ.js";
5
5
 
6
6
  // src/hooks/useKeydown.ts
7
7
  import { useEffect } from "react";
@@ -88,52 +88,58 @@ var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
88
88
  function useTableLayout(initialColumns, key, autosync = true) {
89
89
  const [columns, setColumns] = useState2(initialColumns);
90
90
  const [isReady, setIsReady] = useState2(false);
91
- const renderCountRef = useRef(0);
91
+ const isReadyRef = useRef(false);
92
+ const keyRef = useRef(key);
93
+ useEffect3(() => {
94
+ isReadyRef.current = isReady;
95
+ keyRef.current = key;
96
+ }, [isReady, key]);
92
97
  const handleSaveLayout = useCallback(
93
98
  (setter, _internal) => {
94
- if (!isReady && !_internal || !key) return;
99
+ if (!isReadyRef.current && !_internal || !keyRef.current) return;
95
100
  setColumns((prevColumns) => {
96
101
  const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
97
- if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal)
102
+ if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
98
103
  return prevColumns;
104
+ }
99
105
  localStorage.setItem(
100
- getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
106
+ getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
101
107
  JSON.stringify(newColumns)
102
108
  );
103
109
  return newColumns;
104
110
  });
105
111
  },
106
- [isReady, key]
112
+ []
107
113
  );
108
114
  useEffect3(() => {
109
115
  if (!autosync) return;
110
- if (!key) return setIsReady(true);
111
- if (renderCountRef.current > 1) {
112
- throw new Error(
113
- `useTableLayout should only be called once per component render cycle.
114
- ${renderCountRef.current} Renders detected.
115
- Check dependency stability`
116
- );
116
+ if (!key) {
117
+ setIsReady(true);
118
+ return;
117
119
  }
118
- renderCountRef.current += 1;
119
120
  const savedLayout = localStorage.getItem(
120
121
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
121
122
  );
122
123
  if (savedLayout) {
123
- handleSaveLayout(
124
+ setColumns(
124
125
  mergeObjectArrays(
125
126
  initialColumns,
126
127
  JSON.parse(savedLayout)
127
- ),
128
- true
128
+ )
129
129
  );
130
+ } else {
131
+ localStorage.setItem(
132
+ getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
133
+ JSON.stringify(initialColumns)
134
+ );
135
+ setColumns((prev) => {
136
+ if (JSON.stringify(initialColumns) === JSON.stringify(prev))
137
+ return prev;
138
+ return initialColumns;
139
+ });
130
140
  }
131
- if (!savedLayout) handleSaveLayout(initialColumns, true);
132
141
  setIsReady(true);
133
- return () => {
134
- renderCountRef.current = 0;
135
- };
136
- }, [handleSaveLayout, initialColumns, key, autosync]);
142
+ }, [initialColumns, key, autosync]);
137
143
  const getSavedLayout = useCallback(() => {
138
144
  const savedLayout = localStorage.getItem(
139
145
  getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
@@ -145,10 +151,37 @@ function useTableLayout(initialColumns, key, autosync = true) {
145
151
  return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
146
152
  }
147
153
 
154
+ // src/hooks/useEditCell.tsx
155
+ import { useRef as useRef2, useState as useState3 } from "react";
156
+ function useEditCell(initialValue) {
157
+ const [value, setValue] = useState3(initialValue);
158
+ const [isEdit, setIsEdit] = useState3(false);
159
+ const inputRef = useRef2(null);
160
+ function changeToEditMode() {
161
+ setIsEdit(true);
162
+ requestAnimationFrame(() => {
163
+ var _a;
164
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
165
+ });
166
+ }
167
+ function changeToViewMode() {
168
+ setIsEdit(false);
169
+ }
170
+ return {
171
+ value,
172
+ setValue,
173
+ isEdit,
174
+ inputRef,
175
+ changeToEditMode,
176
+ changeToViewMode
177
+ };
178
+ }
179
+
148
180
  export {
149
181
  useKeydown,
150
182
  useInfiniteScroll,
151
183
  useMatchesMedia,
152
184
  useMatchesMobile,
153
- useTableLayout
185
+ useTableLayout,
186
+ useEditCell
154
187
  };