@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.
- package/dist/{chunk-XX5GVIPZ.js → chunk-3MV3KMQH.js} +2 -2
- package/dist/{chunk-V7GPM6Z3.js → chunk-3PBA2EZ5.js} +1 -1
- package/dist/{chunk-3R3AY5MT.js → chunk-B3T7KBDA.js} +1 -1
- package/dist/{chunk-FIOXWZWU.js → chunk-ECYXZZWC.js} +1 -1
- package/dist/{chunk-RQMOWYB7.js → chunk-EXCAOI2L.js} +3 -3
- package/dist/{chunk-MQB6BSRX.js → chunk-FCGPQNS2.js} +1 -1
- package/dist/{chunk-SJ3SULQB.js → chunk-FJXWYGB7.js} +7 -7
- package/dist/{chunk-QJZ3XHNH.js → chunk-HCHKYUNQ.js} +19 -5
- package/dist/{chunk-5JHKFK73.js → chunk-HIGNJAQA.js} +2 -2
- package/dist/{chunk-IATOG76G.js → chunk-ISRG77J6.js} +1 -1
- package/dist/{chunk-UB3GEENN.js → chunk-OZEKRO4L.js} +1 -1
- package/dist/{chunk-LGX34HML.js → chunk-Q4AANHJY.js} +1 -1
- package/dist/{chunk-PS7MBNUT.js → chunk-REC2XOPI.js} +1 -1
- package/dist/{chunk-ARWHCWG7.js → chunk-XT4BQXSX.js} +1 -1
- package/dist/{chunk-YR4ZO2XL.js → chunk-ZSRTAMSW.js} +56 -23
- package/dist/components/CalendarRange.cjs +202 -180
- package/dist/components/CalendarRange.js +15 -15
- package/dist/components/CompactImagesPreview.cjs +6 -3
- package/dist/components/CompactImagesPreview.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +202 -180
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +15 -15
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +202 -180
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +15 -15
- package/dist/components/DataGrid/PinnedColumns.cjs +202 -180
- package/dist/components/DataGrid/PinnedColumns.js +15 -15
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +202 -180
- package/dist/components/DataGrid/TableBody/LoadingCell.js +15 -15
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +202 -180
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +15 -15
- package/dist/components/DataGrid/TableBody/index.cjs +202 -180
- package/dist/components/DataGrid/TableBody/index.js +15 -15
- package/dist/components/DataGrid/index.cjs +203 -181
- package/dist/components/DataGrid/index.js +15 -15
- package/dist/components/DataGrid/utils.cjs +202 -180
- package/dist/components/DataGrid/utils.js +15 -15
- package/dist/components/DataGridCell.cjs +61 -58
- package/dist/components/DataGridCell.js +6 -6
- package/dist/components/DateInput.cjs +195 -173
- package/dist/components/DateInput.js +15 -15
- package/dist/components/DateRangeInput.cjs +208 -186
- package/dist/components/DateRangeInput.js +15 -15
- package/dist/components/Menu.cjs +15 -12
- package/dist/components/Menu.js +4 -4
- package/dist/components/MenuOption.cjs +8 -5
- package/dist/components/MenuOption.js +3 -3
- package/dist/components/MobileDataGrid/ColumnList.js +4 -4
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +206 -184
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +15 -15
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +206 -184
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +15 -15
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +19 -16
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +6 -6
- package/dist/components/MobileDataGrid/index.cjs +215 -193
- package/dist/components/MobileDataGrid/index.js +15 -15
- package/dist/components/Modal.cjs +15 -12
- package/dist/components/Modal.js +3 -3
- package/dist/components/NestedMenu.cjs +11 -8
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/PDFViewer/index.cjs +31 -28
- package/dist/components/PDFViewer/index.js +3 -3
- package/dist/components/ProductImagePreview/index.cjs +18 -15
- package/dist/components/ProductImagePreview/index.js +3 -3
- package/dist/components/ProjectBar.cjs +3 -0
- package/dist/components/ProjectBar.js +2 -2
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +263 -241
- package/dist/components/index.js +15 -15
- package/dist/components/useMenuSystem.cjs +22 -19
- package/dist/components/useMenuSystem.js +3 -3
- package/dist/hooks/index.cjs +76 -26
- package/dist/hooks/index.js +4 -2
- package/dist/utils/index.cjs +21 -5
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ModalContent
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
9
|
+
} from "./chunk-3PBA2EZ5.js";
|
|
10
10
|
import {
|
|
11
11
|
Heading2
|
|
12
12
|
} from "./chunk-MXSJF6TW.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Menu
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HIGNJAQA.js";
|
|
4
4
|
import {
|
|
5
5
|
useSubMenuSystem
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ISRG77J6.js";
|
|
7
7
|
import {
|
|
8
8
|
MenuOption
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-REC2XOPI.js";
|
|
10
10
|
import {
|
|
11
11
|
Search
|
|
12
12
|
} from "./chunk-FHXCCVOG.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RowDetailModalProvider
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
28
|
+
} from "./chunk-EXCAOI2L.js";
|
|
29
29
|
import {
|
|
30
30
|
Menu
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-HIGNJAQA.js";
|
|
32
32
|
import {
|
|
33
33
|
MenuOption
|
|
34
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocalStoragePrefixVersion,
|
|
3
3
|
mergeObjectArrays
|
|
4
|
-
} from "./chunk-
|
|
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
|
|
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 (!
|
|
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(`${
|
|
106
|
+
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
101
107
|
JSON.stringify(newColumns)
|
|
102
108
|
);
|
|
103
109
|
return newColumns;
|
|
104
110
|
});
|
|
105
111
|
},
|
|
106
|
-
[
|
|
112
|
+
[]
|
|
107
113
|
);
|
|
108
114
|
useEffect3(() => {
|
|
109
115
|
if (!autosync) return;
|
|
110
|
-
if (!key)
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
};
|