@dmsi/wedgekit-react 0.0.922 → 0.0.987
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-LFBTRFTS.js → chunk-2UNLVJU5.js} +4 -4
- package/dist/{chunk-PXIW3XJX.js → chunk-34J6RA4C.js} +1 -1
- package/dist/{chunk-NGXKXYB5.js → chunk-6FZNEFN3.js} +1 -1
- package/dist/{chunk-Z7XANQ47.js → chunk-6M2N7DVS.js} +4 -2
- package/dist/{chunk-RAJY6INK.js → chunk-BBU7JOY2.js} +1 -1
- package/dist/{chunk-UUKHQUSF.js → chunk-F6QO73TV.js} +1 -1
- package/dist/{chunk-BRCBTEQ2.js → chunk-FGXTI3WE.js} +1 -1
- package/dist/{chunk-EJVCDJ7U.js → chunk-HDFO56DN.js} +1 -1
- package/dist/{chunk-XWYDWH4W.js → chunk-HTICQWRA.js} +1 -1
- package/dist/{chunk-N36EJLRW.js → chunk-JZZ4LF6B.js} +2 -2
- package/dist/{chunk-27DJTEAB.js → chunk-MB6IRHTN.js} +1 -1
- package/dist/{chunk-ZACRFGND.js → chunk-NBTWFTSF.js} +94 -65
- package/dist/{chunk-FAW3WWOQ.js → chunk-OC5AXLJY.js} +1 -1
- package/dist/{chunk-VABOQRYA.js → chunk-POZD6R3P.js} +1 -1
- package/dist/{chunk-YYRFXTO7.js → chunk-RLJU65SD.js} +21 -29
- package/dist/{chunk-F7F5BKW5.js → chunk-TBZ243DS.js} +1 -1
- package/dist/{chunk-2EAVEFWY.js → chunk-WHWZ5VVQ.js} +3 -2
- package/dist/{chunk-FSXKJXPN.js → chunk-Y7RCYDF6.js} +8 -2
- package/dist/{chunk-BMAZBFUU.js → chunk-ZMTHWJ7F.js} +15 -2
- package/dist/chunk-ZRFXUER3.js +468 -0
- package/dist/components/Alert.cjs +15 -2
- package/dist/components/Alert.js +2 -2
- package/dist/components/Breadcrumbs.cjs +8 -2
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Button.cjs +15 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/CalendarRange.cjs +385 -106
- package/dist/components/CalendarRange.css +55 -3
- package/dist/components/CalendarRange.js +14 -14
- package/dist/components/CompactImagesPreview.cjs +7 -4
- package/dist/components/CompactImagesPreview.js +2 -2
- package/dist/components/ContentTab.cjs +15 -2
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +15 -2
- package/dist/components/ContentTabs.js +2 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +385 -106
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +55 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +14 -14
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +385 -106
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +55 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +14 -14
- package/dist/components/DataGrid/PinnedColumns.cjs +385 -106
- package/dist/components/DataGrid/PinnedColumns.css +55 -3
- package/dist/components/DataGrid/PinnedColumns.js +14 -14
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +385 -106
- package/dist/components/DataGrid/TableBody/LoadingCell.css +55 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.js +14 -14
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +385 -106
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +55 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +14 -14
- package/dist/components/DataGrid/TableBody/index.cjs +385 -106
- package/dist/components/DataGrid/TableBody/index.css +55 -3
- package/dist/components/DataGrid/TableBody/index.js +14 -14
- package/dist/components/DataGrid/index.cjs +385 -106
- package/dist/components/DataGrid/index.css +55 -3
- package/dist/components/DataGrid/index.js +14 -14
- package/dist/components/DataGrid/utils.cjs +385 -106
- package/dist/components/DataGrid/utils.css +55 -3
- package/dist/components/DataGrid/utils.js +14 -14
- package/dist/components/DataGridCell.cjs +7 -4
- package/dist/components/DataGridCell.js +2 -2
- package/dist/components/DateInput.cjs +385 -106
- package/dist/components/DateInput.css +55 -3
- package/dist/components/DateInput.js +14 -14
- package/dist/components/DateRangeInput.cjs +385 -106
- package/dist/components/DateRangeInput.css +55 -3
- package/dist/components/DateRangeInput.js +14 -14
- package/dist/components/EmblaCarousel/index.cjs +94 -65
- package/dist/components/EmblaCarousel/index.js +1 -1
- package/dist/components/FilterGroup.cjs +23 -4
- package/dist/components/FilterGroup.js +3 -3
- package/dist/components/Link.cjs +8 -2
- package/dist/components/Link.js +1 -1
- package/dist/components/Menu.cjs +7 -4
- package/dist/components/Menu.js +2 -2
- package/dist/components/MenuOption.cjs +7 -4
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/MobileDataGrid/ColumnList.css +55 -3
- package/dist/components/MobileDataGrid/ColumnList.js +4 -4
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +385 -106
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +55 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +14 -14
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +385 -106
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +55 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +14 -14
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +24 -7
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +9 -9
- package/dist/components/MobileDataGrid/index.cjs +386 -107
- package/dist/components/MobileDataGrid/index.css +55 -3
- package/dist/components/MobileDataGrid/index.js +14 -14
- package/dist/components/Modal.cjs +23 -6
- package/dist/components/Modal.js +6 -6
- package/dist/components/ModalButtons.cjs +15 -2
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalHeader.cjs +17 -3
- package/dist/components/ModalHeader.js +2 -2
- package/dist/components/NavigationTab.cjs +15 -2
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.cjs +15 -2
- package/dist/components/NavigationTabs.js +2 -2
- package/dist/components/NestedMenu.cjs +22 -6
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/Notification.cjs +15 -2
- package/dist/components/Notification.js +1 -1
- package/dist/components/OptionPill.cjs +15 -2
- package/dist/components/OptionPill.js +2 -2
- package/dist/components/PDFViewer/DownloadIcon.cjs +25 -7
- package/dist/components/PDFViewer/DownloadIcon.js +4 -4
- package/dist/components/PDFViewer/PDFNavigation.cjs +15 -2
- package/dist/components/PDFViewer/PDFNavigation.js +2 -2
- package/dist/components/PDFViewer/index.cjs +40 -13
- package/dist/components/PDFViewer/index.js +15 -13
- package/dist/components/Password.cjs +7 -4
- package/dist/components/Password.js +2 -2
- package/dist/components/ProductImagePreview/index.cjs +7 -4
- package/dist/components/ProductImagePreview/index.js +2 -2
- package/dist/components/ProjectBar.cjs +7 -4
- package/dist/components/ProjectBar.js +2 -2
- package/dist/components/Stepper.cjs +61 -15
- package/dist/components/Stepper.js +42 -12
- package/dist/components/Time.js +1 -1
- package/dist/components/Toast.cjs +15 -2
- package/dist/components/Toast.js +1 -1
- package/dist/components/Tooltip.cjs +7 -4
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/Upload.cjs +15 -2
- package/dist/components/Upload.js +1 -1
- package/dist/components/index.cjs +479 -171
- package/dist/components/index.css +55 -3
- package/dist/components/index.js +14 -14
- package/dist/components/useMenuSystem.cjs +7 -4
- package/dist/components/useMenuSystem.js +2 -2
- package/dist/hooks/index.cjs +346 -73
- package/dist/hooks/index.js +2 -2
- package/dist/index.css +55 -3
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-WOWPMA26.js +0 -170
package/dist/hooks/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
useInfiniteScroll,
|
|
4
4
|
useKeydown,
|
|
5
5
|
useTableLayout
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-ZRFXUER3.js";
|
|
7
7
|
import {
|
|
8
8
|
useMatchesMedia,
|
|
9
9
|
useMatchesMobile
|
|
10
10
|
} from "../chunk-WVGXD7HT.js";
|
|
11
11
|
import "../chunk-VXWSAIB5.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-TBZ243DS.js";
|
|
13
13
|
import "../chunk-5UH6QUFB.js";
|
|
14
14
|
import "../chunk-ORMEWXMH.js";
|
|
15
15
|
export {
|
package/dist/index.css
CHANGED
|
@@ -2122,9 +2122,6 @@
|
|
|
2122
2122
|
.pb-2 {
|
|
2123
2123
|
padding-bottom: calc(var(--spacing) * 2);
|
|
2124
2124
|
}
|
|
2125
|
-
.pb-3 {
|
|
2126
|
-
padding-bottom: calc(var(--spacing) * 3);
|
|
2127
|
-
}
|
|
2128
2125
|
.pb-mobile-component-padding {
|
|
2129
2126
|
padding-bottom: var(--spacing-mobile-component-padding);
|
|
2130
2127
|
}
|
|
@@ -2287,6 +2284,10 @@
|
|
|
2287
2284
|
--tw-font-weight: var(--font-weight-normal);
|
|
2288
2285
|
font-weight: var(--font-weight-normal);
|
|
2289
2286
|
}
|
|
2287
|
+
.font-normal\! {
|
|
2288
|
+
--tw-font-weight: var(--font-weight-normal) !important;
|
|
2289
|
+
font-weight: var(--font-weight-normal) !important;
|
|
2290
|
+
}
|
|
2290
2291
|
.font-semibold {
|
|
2291
2292
|
--tw-font-weight: var(--font-weight-semibold);
|
|
2292
2293
|
font-weight: var(--font-weight-semibold);
|
|
@@ -3155,6 +3156,13 @@
|
|
|
3155
3156
|
}
|
|
3156
3157
|
}
|
|
3157
3158
|
}
|
|
3159
|
+
.hover\:border-border-primary-normal {
|
|
3160
|
+
&:hover {
|
|
3161
|
+
@media (hover: hover) {
|
|
3162
|
+
border-color: var(--color-border-primary-normal);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3158
3166
|
.hover\:\!bg-background-action-primary-normal {
|
|
3159
3167
|
&:hover {
|
|
3160
3168
|
@media (hover: hover) {
|
|
@@ -3218,6 +3226,13 @@
|
|
|
3218
3226
|
}
|
|
3219
3227
|
}
|
|
3220
3228
|
}
|
|
3229
|
+
.hover\:bg-transparent {
|
|
3230
|
+
&:hover {
|
|
3231
|
+
@media (hover: hover) {
|
|
3232
|
+
background-color: transparent;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3221
3236
|
.hover\:\!text-brand-text-on-action-primary-hover {
|
|
3222
3237
|
&:hover {
|
|
3223
3238
|
@media (hover: hover) {
|
|
@@ -3295,6 +3310,13 @@
|
|
|
3295
3310
|
}
|
|
3296
3311
|
}
|
|
3297
3312
|
}
|
|
3313
|
+
.hover\:text-text-primary-normal {
|
|
3314
|
+
&:hover {
|
|
3315
|
+
@media (hover: hover) {
|
|
3316
|
+
color: var(--color-text-primary-normal);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3298
3320
|
.hover\:text-white {
|
|
3299
3321
|
&:hover {
|
|
3300
3322
|
@media (hover: hover) {
|
|
@@ -3339,6 +3361,11 @@
|
|
|
3339
3361
|
border-color: var(--color-border-action-hover);
|
|
3340
3362
|
}
|
|
3341
3363
|
}
|
|
3364
|
+
.focus\:border-border-primary-normal {
|
|
3365
|
+
&:focus {
|
|
3366
|
+
border-color: var(--color-border-primary-normal);
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3342
3369
|
.focus\:bg-background-action-critical-primary-hover {
|
|
3343
3370
|
&:focus {
|
|
3344
3371
|
background-color: var(--color-background-action-critical-primary-hover);
|
|
@@ -3364,6 +3391,11 @@
|
|
|
3364
3391
|
background-color: var(--color-background-grouped-secondary-normal);
|
|
3365
3392
|
}
|
|
3366
3393
|
}
|
|
3394
|
+
.focus\:bg-transparent {
|
|
3395
|
+
&:focus {
|
|
3396
|
+
background-color: transparent;
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3367
3399
|
.focus\:text-text-action-critical-hover {
|
|
3368
3400
|
&:focus {
|
|
3369
3401
|
color: var(--color-text-action-critical-hover);
|
|
@@ -3374,6 +3406,11 @@
|
|
|
3374
3406
|
color: var(--color-text-action-primary-hover);
|
|
3375
3407
|
}
|
|
3376
3408
|
}
|
|
3409
|
+
.focus\:text-text-primary-normal {
|
|
3410
|
+
&:focus {
|
|
3411
|
+
color: var(--color-text-primary-normal);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3377
3414
|
.focus\:outline-0 {
|
|
3378
3415
|
&:focus {
|
|
3379
3416
|
outline-style: var(--tw-outline-style);
|
|
@@ -3509,6 +3546,11 @@
|
|
|
3509
3546
|
background-color: var(--color-background-action-secondary-active);
|
|
3510
3547
|
}
|
|
3511
3548
|
}
|
|
3549
|
+
.active\:bg-transparent {
|
|
3550
|
+
&:active {
|
|
3551
|
+
background-color: transparent;
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3512
3554
|
.active\:\!text-brand-text-on-action-primary-active {
|
|
3513
3555
|
&:active {
|
|
3514
3556
|
color: var(--color-brand-text-on-action-primary-active) !important;
|
|
@@ -3559,6 +3601,11 @@
|
|
|
3559
3601
|
color: var(--color-text-link-active);
|
|
3560
3602
|
}
|
|
3561
3603
|
}
|
|
3604
|
+
.active\:text-text-primary-active {
|
|
3605
|
+
&:active {
|
|
3606
|
+
color: var(--color-text-primary-active);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3562
3609
|
.active\:text-white {
|
|
3563
3610
|
&:active {
|
|
3564
3611
|
color: var(--color-white);
|
|
@@ -4577,6 +4624,11 @@
|
|
|
4577
4624
|
padding-right: var(--spacing-desktop-layout-padding);
|
|
4578
4625
|
}
|
|
4579
4626
|
}
|
|
4627
|
+
.desktop\:pb-3 {
|
|
4628
|
+
@container root (width >= 48rem) {
|
|
4629
|
+
padding-bottom: calc(var(--spacing) * 3);
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4580
4632
|
.desktop\:pb-desktop-component-padding {
|
|
4581
4633
|
@container root (width >= 48rem) {
|
|
4582
4634
|
padding-bottom: var(--spacing-desktop-component-padding);
|
package/dist/utils/index.cjs
CHANGED
|
@@ -240,7 +240,7 @@ function mergeObjectArrays(arr1, arr2) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
// src/utils/index.ts
|
|
243
|
-
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.
|
|
243
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
244
244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
245
245
|
0 && (module.exports = {
|
|
246
246
|
LocalStoragePrefixVersion,
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-WOWPMA26.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LocalStoragePrefixVersion,
|
|
3
|
-
mergeObjectArrays
|
|
4
|
-
} from "./chunk-F7F5BKW5.js";
|
|
5
|
-
|
|
6
|
-
// src/hooks/useKeydown.ts
|
|
7
|
-
import { useEffect } from "react";
|
|
8
|
-
function useKeydown(keys, isActive) {
|
|
9
|
-
function handleKeyDown(event) {
|
|
10
|
-
if (!Object.keys(keys).includes(event.key) && !Object.keys(keys).join("").includes("/"))
|
|
11
|
-
return;
|
|
12
|
-
Object.entries(keys).forEach(([key, handler]) => {
|
|
13
|
-
if (event.key !== key && !key.includes("/")) return;
|
|
14
|
-
if (key.includes("/") && key.replace("Space", " ").split("/").includes(event.key)) {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
handler(event);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (event.key === key) {
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
handler(event);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (!isActive)
|
|
27
|
-
return document.removeEventListener("keydown", handleKeyDown);
|
|
28
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
29
|
-
return () => {
|
|
30
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
31
|
-
};
|
|
32
|
-
}, [keys, isActive]);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/hooks/useInfiniteScroll.tsx
|
|
36
|
-
import { useEffect as useEffect2 } from "react";
|
|
37
|
-
function useInfiniteScroll({
|
|
38
|
-
containerRef,
|
|
39
|
-
onLoadMore,
|
|
40
|
-
isLoading,
|
|
41
|
-
offset = 50,
|
|
42
|
-
enabled = true
|
|
43
|
-
// ✅ Add this
|
|
44
|
-
}) {
|
|
45
|
-
useEffect2(() => {
|
|
46
|
-
if (!enabled) return;
|
|
47
|
-
const handleScroll = () => {
|
|
48
|
-
const el2 = containerRef.current;
|
|
49
|
-
if (!el2 || isLoading) return;
|
|
50
|
-
const { scrollTop, scrollHeight, clientHeight } = el2;
|
|
51
|
-
const isNearBottom = scrollTop + clientHeight >= scrollHeight - offset;
|
|
52
|
-
if (isNearBottom) {
|
|
53
|
-
onLoadMore();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const el = containerRef.current;
|
|
57
|
-
if (el) el.addEventListener("scroll", handleScroll);
|
|
58
|
-
return () => {
|
|
59
|
-
if (el) el.removeEventListener("scroll", handleScroll);
|
|
60
|
-
};
|
|
61
|
-
}, [containerRef, onLoadMore, isLoading, offset, enabled]);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// src/hooks/useTableLayout.ts
|
|
65
|
-
import {
|
|
66
|
-
useState,
|
|
67
|
-
useEffect as useEffect3,
|
|
68
|
-
useCallback,
|
|
69
|
-
useRef
|
|
70
|
-
} from "react";
|
|
71
|
-
var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
72
|
-
var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
|
|
73
|
-
function useTableLayout(initialColumns, key, autosync = true) {
|
|
74
|
-
const [columns, setColumns] = useState(initialColumns);
|
|
75
|
-
const [isReady, setIsReady] = useState(false);
|
|
76
|
-
const isReadyRef = useRef(false);
|
|
77
|
-
const keyRef = useRef(key);
|
|
78
|
-
useEffect3(() => {
|
|
79
|
-
isReadyRef.current = isReady;
|
|
80
|
-
keyRef.current = key;
|
|
81
|
-
}, [isReady, key]);
|
|
82
|
-
const handleSaveLayout = useCallback(
|
|
83
|
-
(setter, _internal) => {
|
|
84
|
-
if (!isReadyRef.current && !_internal || !keyRef.current) return;
|
|
85
|
-
setColumns((prevColumns) => {
|
|
86
|
-
const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
|
|
87
|
-
if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
|
|
88
|
-
return prevColumns;
|
|
89
|
-
}
|
|
90
|
-
localStorage.setItem(
|
|
91
|
-
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
92
|
-
JSON.stringify(newColumns)
|
|
93
|
-
);
|
|
94
|
-
return newColumns;
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
[]
|
|
98
|
-
);
|
|
99
|
-
useEffect3(() => {
|
|
100
|
-
if (!autosync) return;
|
|
101
|
-
if (!key) {
|
|
102
|
-
setIsReady(true);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const savedLayout = localStorage.getItem(
|
|
106
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
|
|
107
|
-
);
|
|
108
|
-
if (savedLayout) {
|
|
109
|
-
setColumns(
|
|
110
|
-
mergeObjectArrays(
|
|
111
|
-
initialColumns,
|
|
112
|
-
JSON.parse(savedLayout)
|
|
113
|
-
)
|
|
114
|
-
);
|
|
115
|
-
} else {
|
|
116
|
-
localStorage.setItem(
|
|
117
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
118
|
-
JSON.stringify(initialColumns)
|
|
119
|
-
);
|
|
120
|
-
setColumns((prev) => {
|
|
121
|
-
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
122
|
-
return prev;
|
|
123
|
-
return initialColumns;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
setIsReady(true);
|
|
127
|
-
}, [initialColumns, key, autosync]);
|
|
128
|
-
const getSavedLayout = useCallback(() => {
|
|
129
|
-
const savedLayout = localStorage.getItem(
|
|
130
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
|
|
131
|
-
);
|
|
132
|
-
if (savedLayout) {
|
|
133
|
-
return JSON.parse(savedLayout);
|
|
134
|
-
}
|
|
135
|
-
}, [key]);
|
|
136
|
-
return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// src/hooks/useEditCell.tsx
|
|
140
|
-
import { useRef as useRef2, useState as useState2 } from "react";
|
|
141
|
-
function useEditCell(initialValue) {
|
|
142
|
-
const [value, setValue] = useState2(initialValue);
|
|
143
|
-
const [isEdit, setIsEdit] = useState2(false);
|
|
144
|
-
const inputRef = useRef2(null);
|
|
145
|
-
function changeToEditMode() {
|
|
146
|
-
setIsEdit(true);
|
|
147
|
-
requestAnimationFrame(() => {
|
|
148
|
-
var _a;
|
|
149
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function changeToViewMode() {
|
|
153
|
-
setIsEdit(false);
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
value,
|
|
157
|
-
setValue,
|
|
158
|
-
isEdit,
|
|
159
|
-
inputRef,
|
|
160
|
-
changeToEditMode,
|
|
161
|
-
changeToViewMode
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export {
|
|
166
|
-
useKeydown,
|
|
167
|
-
useInfiniteScroll,
|
|
168
|
-
useTableLayout,
|
|
169
|
-
useEditCell
|
|
170
|
-
};
|