@dmsi/wedgekit-react 0.0.922 → 0.0.986
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
|
@@ -2144,9 +2144,6 @@
|
|
|
2144
2144
|
.pb-2 {
|
|
2145
2145
|
padding-bottom: calc(var(--spacing) * 2);
|
|
2146
2146
|
}
|
|
2147
|
-
.pb-3 {
|
|
2148
|
-
padding-bottom: calc(var(--spacing) * 3);
|
|
2149
|
-
}
|
|
2150
2147
|
.pb-mobile-component-padding {
|
|
2151
2148
|
padding-bottom: var(--spacing-mobile-component-padding);
|
|
2152
2149
|
}
|
|
@@ -2309,6 +2306,10 @@
|
|
|
2309
2306
|
--tw-font-weight: var(--font-weight-normal);
|
|
2310
2307
|
font-weight: var(--font-weight-normal);
|
|
2311
2308
|
}
|
|
2309
|
+
.font-normal\! {
|
|
2310
|
+
--tw-font-weight: var(--font-weight-normal) !important;
|
|
2311
|
+
font-weight: var(--font-weight-normal) !important;
|
|
2312
|
+
}
|
|
2312
2313
|
.font-semibold {
|
|
2313
2314
|
--tw-font-weight: var(--font-weight-semibold);
|
|
2314
2315
|
font-weight: var(--font-weight-semibold);
|
|
@@ -3177,6 +3178,13 @@
|
|
|
3177
3178
|
}
|
|
3178
3179
|
}
|
|
3179
3180
|
}
|
|
3181
|
+
.hover\:border-border-primary-normal {
|
|
3182
|
+
&:hover {
|
|
3183
|
+
@media (hover: hover) {
|
|
3184
|
+
border-color: var(--color-border-primary-normal);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3180
3188
|
.hover\:\!bg-background-action-primary-normal {
|
|
3181
3189
|
&:hover {
|
|
3182
3190
|
@media (hover: hover) {
|
|
@@ -3240,6 +3248,13 @@
|
|
|
3240
3248
|
}
|
|
3241
3249
|
}
|
|
3242
3250
|
}
|
|
3251
|
+
.hover\:bg-transparent {
|
|
3252
|
+
&:hover {
|
|
3253
|
+
@media (hover: hover) {
|
|
3254
|
+
background-color: transparent;
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3243
3258
|
.hover\:\!text-brand-text-on-action-primary-hover {
|
|
3244
3259
|
&:hover {
|
|
3245
3260
|
@media (hover: hover) {
|
|
@@ -3317,6 +3332,13 @@
|
|
|
3317
3332
|
}
|
|
3318
3333
|
}
|
|
3319
3334
|
}
|
|
3335
|
+
.hover\:text-text-primary-normal {
|
|
3336
|
+
&:hover {
|
|
3337
|
+
@media (hover: hover) {
|
|
3338
|
+
color: var(--color-text-primary-normal);
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3320
3342
|
.hover\:text-white {
|
|
3321
3343
|
&:hover {
|
|
3322
3344
|
@media (hover: hover) {
|
|
@@ -3361,6 +3383,11 @@
|
|
|
3361
3383
|
border-color: var(--color-border-action-hover);
|
|
3362
3384
|
}
|
|
3363
3385
|
}
|
|
3386
|
+
.focus\:border-border-primary-normal {
|
|
3387
|
+
&:focus {
|
|
3388
|
+
border-color: var(--color-border-primary-normal);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3364
3391
|
.focus\:bg-background-action-critical-primary-hover {
|
|
3365
3392
|
&:focus {
|
|
3366
3393
|
background-color: var(--color-background-action-critical-primary-hover);
|
|
@@ -3386,6 +3413,11 @@
|
|
|
3386
3413
|
background-color: var(--color-background-grouped-secondary-normal);
|
|
3387
3414
|
}
|
|
3388
3415
|
}
|
|
3416
|
+
.focus\:bg-transparent {
|
|
3417
|
+
&:focus {
|
|
3418
|
+
background-color: transparent;
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3389
3421
|
.focus\:text-text-action-critical-hover {
|
|
3390
3422
|
&:focus {
|
|
3391
3423
|
color: var(--color-text-action-critical-hover);
|
|
@@ -3396,6 +3428,11 @@
|
|
|
3396
3428
|
color: var(--color-text-action-primary-hover);
|
|
3397
3429
|
}
|
|
3398
3430
|
}
|
|
3431
|
+
.focus\:text-text-primary-normal {
|
|
3432
|
+
&:focus {
|
|
3433
|
+
color: var(--color-text-primary-normal);
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3399
3436
|
.focus\:outline-0 {
|
|
3400
3437
|
&:focus {
|
|
3401
3438
|
outline-style: var(--tw-outline-style);
|
|
@@ -3531,6 +3568,11 @@
|
|
|
3531
3568
|
background-color: var(--color-background-action-secondary-active);
|
|
3532
3569
|
}
|
|
3533
3570
|
}
|
|
3571
|
+
.active\:bg-transparent {
|
|
3572
|
+
&:active {
|
|
3573
|
+
background-color: transparent;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3534
3576
|
.active\:\!text-brand-text-on-action-primary-active {
|
|
3535
3577
|
&:active {
|
|
3536
3578
|
color: var(--color-brand-text-on-action-primary-active) !important;
|
|
@@ -3581,6 +3623,11 @@
|
|
|
3581
3623
|
color: var(--color-text-link-active);
|
|
3582
3624
|
}
|
|
3583
3625
|
}
|
|
3626
|
+
.active\:text-text-primary-active {
|
|
3627
|
+
&:active {
|
|
3628
|
+
color: var(--color-text-primary-active);
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3584
3631
|
.active\:text-white {
|
|
3585
3632
|
&:active {
|
|
3586
3633
|
color: var(--color-white);
|
|
@@ -4599,6 +4646,11 @@
|
|
|
4599
4646
|
padding-right: var(--spacing-desktop-layout-padding);
|
|
4600
4647
|
}
|
|
4601
4648
|
}
|
|
4649
|
+
.desktop\:pb-3 {
|
|
4650
|
+
@container root (width >= 48rem) {
|
|
4651
|
+
padding-bottom: calc(var(--spacing) * 3);
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4602
4654
|
.desktop\:pb-desktop-component-padding {
|
|
4603
4655
|
@container root (width >= 48rem) {
|
|
4604
4656
|
padding-bottom: var(--spacing-desktop-component-padding);
|
package/dist/components/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
DataGrid,
|
|
3
3
|
DateInput,
|
|
4
4
|
MobileDataGrid
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-RLJU65SD.js";
|
|
6
|
+
import "../chunk-2UNLVJU5.js";
|
|
7
|
+
import "../chunk-POZD6R3P.js";
|
|
8
8
|
import "../chunk-M7INAUAJ.js";
|
|
9
9
|
import {
|
|
10
10
|
ProductImagePreview
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
} from "../chunk-Y5GD2FJA.js";
|
|
20
20
|
import {
|
|
21
21
|
EmblaCarousel
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-NBTWFTSF.js";
|
|
23
|
+
import "../chunk-HDFO56DN.js";
|
|
24
|
+
import "../chunk-MB6IRHTN.js";
|
|
25
25
|
import {
|
|
26
26
|
useGridContext
|
|
27
27
|
} from "../chunk-5IFPG6TS.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-HTICQWRA.js";
|
|
29
29
|
import "../chunk-AJ5M6MVX.js";
|
|
30
30
|
import "../chunk-7IPESTQS.js";
|
|
31
31
|
import "../chunk-Z2HPSFEQ.js";
|
|
@@ -49,11 +49,11 @@ import {
|
|
|
49
49
|
import {
|
|
50
50
|
Tooltip
|
|
51
51
|
} from "../chunk-HT57FLRW.js";
|
|
52
|
-
import "../chunk-
|
|
52
|
+
import "../chunk-JZZ4LF6B.js";
|
|
53
53
|
import "../chunk-4RJKB7LC.js";
|
|
54
|
-
import "../chunk-
|
|
54
|
+
import "../chunk-F6QO73TV.js";
|
|
55
55
|
import "../chunk-WVVEOCEH.js";
|
|
56
|
-
import "../chunk-
|
|
56
|
+
import "../chunk-WHWZ5VVQ.js";
|
|
57
57
|
import "../chunk-E7LGUC2B.js";
|
|
58
58
|
import "../chunk-QVWYTQKL.js";
|
|
59
59
|
import {
|
|
@@ -95,10 +95,10 @@ import {
|
|
|
95
95
|
import {
|
|
96
96
|
CompactImagesPreview
|
|
97
97
|
} from "../chunk-FXHH2K6I.js";
|
|
98
|
-
import "../chunk-
|
|
98
|
+
import "../chunk-ZRFXUER3.js";
|
|
99
99
|
import "../chunk-WVGXD7HT.js";
|
|
100
100
|
import "../chunk-VXWSAIB5.js";
|
|
101
|
-
import "../chunk-
|
|
101
|
+
import "../chunk-TBZ243DS.js";
|
|
102
102
|
import "../chunk-5UH6QUFB.js";
|
|
103
103
|
import {
|
|
104
104
|
AccessCard
|
|
@@ -119,11 +119,11 @@ import {
|
|
|
119
119
|
} from "../chunk-F4VE3THQ.js";
|
|
120
120
|
import {
|
|
121
121
|
Alert
|
|
122
|
-
} from "../chunk-
|
|
122
|
+
} from "../chunk-6FZNEFN3.js";
|
|
123
123
|
import "../chunk-MXSJF6TW.js";
|
|
124
124
|
import {
|
|
125
125
|
Button
|
|
126
|
-
} from "../chunk-
|
|
126
|
+
} from "../chunk-ZMTHWJ7F.js";
|
|
127
127
|
import "../chunk-SBRRNFOP.js";
|
|
128
128
|
import "../chunk-BGBIXG5Y.js";
|
|
129
129
|
import {
|
|
@@ -62,12 +62,15 @@ var useMatchesMedia = (query) => {
|
|
|
62
62
|
};
|
|
63
63
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
64
64
|
|
|
65
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
66
|
+
var import_react4 = require("react");
|
|
67
|
+
|
|
65
68
|
// src/utils/index.ts
|
|
66
|
-
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.
|
|
69
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
67
70
|
|
|
68
|
-
// src/hooks/useTableLayout.ts
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
+
// src/hooks/useTableLayout/storage.ts
|
|
72
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
73
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
71
74
|
|
|
72
75
|
// src/hooks/useEditCell.tsx
|
|
73
76
|
var import_react5 = require("react");
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
useMenuPosition,
|
|
4
4
|
useSubMenuSystem
|
|
5
5
|
} from "../chunk-PE3EZP56.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-ZRFXUER3.js";
|
|
7
7
|
import "../chunk-WVGXD7HT.js";
|
|
8
8
|
import "../chunk-VXWSAIB5.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-TBZ243DS.js";
|
|
10
10
|
import "../chunk-5UH6QUFB.js";
|
|
11
11
|
import "../chunk-ORMEWXMH.js";
|
|
12
12
|
export {
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -119,99 +119,372 @@ var useMatchesMedia = (query) => {
|
|
|
119
119
|
};
|
|
120
120
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
121
121
|
|
|
122
|
-
// src/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
123
|
+
var import_react4 = require("react");
|
|
124
|
+
|
|
125
|
+
// src/utils/index.ts
|
|
126
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
127
|
+
|
|
128
|
+
// src/hooks/useTableLayout/storage.ts
|
|
129
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
130
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
131
|
+
var CURRENT_SCHEMA_VERSION = 2;
|
|
132
|
+
function getStorageKey(key) {
|
|
133
|
+
return `${STORAGE_PREFIX}__${key}`;
|
|
134
|
+
}
|
|
135
|
+
function getLegacyStorageKey(key) {
|
|
136
|
+
return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
|
|
137
|
+
}
|
|
138
|
+
function loadPreferences(key) {
|
|
139
|
+
const storageKey = getStorageKey(key);
|
|
140
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
141
|
+
const newData = localStorage.getItem(storageKey);
|
|
142
|
+
if (newData) {
|
|
143
|
+
try {
|
|
144
|
+
const parsed = JSON.parse(newData);
|
|
145
|
+
if (parsed.version === CURRENT_SCHEMA_VERSION) {
|
|
146
|
+
return parsed;
|
|
147
|
+
}
|
|
148
|
+
localStorage.removeItem(storageKey);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
localStorage.removeItem(storageKey);
|
|
129
151
|
}
|
|
130
152
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
153
|
+
const legacyData = localStorage.getItem(legacyKey);
|
|
154
|
+
if (legacyData) {
|
|
155
|
+
localStorage.removeItem(legacyKey);
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
function savePreferences(key, preferences) {
|
|
160
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
161
|
+
const storageKey = getStorageKey(key);
|
|
162
|
+
const hasPreferences = ((_b = (_a = preferences.columnOrder) == null ? void 0 : _a.length) != null ? _b : 0) > 0 || ((_d = (_c = preferences.hiddenByUser) == null ? void 0 : _c.length) != null ? _d : 0) > 0 || ((_f = (_e = preferences.shownByUser) == null ? void 0 : _e.length) != null ? _f : 0) > 0 || Object.keys((_g = preferences.columnWidths) != null ? _g : {}).length > 0;
|
|
163
|
+
if (!hasPreferences) {
|
|
164
|
+
localStorage.removeItem(storageKey);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const data = __spreadProps(__spreadValues({}, preferences), {
|
|
168
|
+
version: CURRENT_SCHEMA_VERSION
|
|
169
|
+
});
|
|
170
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
171
|
+
}
|
|
172
|
+
function clearPreferences(key) {
|
|
173
|
+
const storageKey = getStorageKey(key);
|
|
174
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
175
|
+
localStorage.removeItem(storageKey);
|
|
176
|
+
localStorage.removeItem(legacyKey);
|
|
177
|
+
}
|
|
178
|
+
function clearAllLegacyData() {
|
|
179
|
+
if (typeof window === "undefined") return;
|
|
180
|
+
const keysToRemove = [];
|
|
181
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
182
|
+
const key = localStorage.key(i);
|
|
183
|
+
if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
|
|
184
|
+
keysToRemove.push(key);
|
|
139
185
|
}
|
|
140
|
-
|
|
186
|
+
}
|
|
187
|
+
keysToRemove.forEach((key) => {
|
|
188
|
+
localStorage.removeItem(key);
|
|
141
189
|
});
|
|
142
190
|
}
|
|
191
|
+
function hasPerformedLegacyMigration() {
|
|
192
|
+
if (typeof window === "undefined") return true;
|
|
193
|
+
return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
|
|
194
|
+
}
|
|
195
|
+
function markLegacyMigrationComplete() {
|
|
196
|
+
if (typeof window === "undefined") return;
|
|
197
|
+
localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
|
|
198
|
+
}
|
|
143
199
|
|
|
144
|
-
// src/
|
|
145
|
-
|
|
200
|
+
// src/hooks/useTableLayout/computeColumns.ts
|
|
201
|
+
function computeColumnVisibility(column, preferences) {
|
|
202
|
+
var _a, _b, _c, _d, _e, _f;
|
|
203
|
+
const columnId = column.id;
|
|
204
|
+
if (!columnId) return true;
|
|
205
|
+
const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
206
|
+
const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
|
|
207
|
+
if (!canUserToggle) {
|
|
208
|
+
return systemVisible;
|
|
209
|
+
}
|
|
210
|
+
if (preferences) {
|
|
211
|
+
if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return systemVisible;
|
|
219
|
+
}
|
|
220
|
+
function applyPreferencesToColumns(systemColumns, preferences) {
|
|
221
|
+
var _a;
|
|
222
|
+
let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
|
|
223
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
224
|
+
// Compute visibility based on system + user preferences
|
|
225
|
+
visible: computeColumnVisibility(col, preferences)
|
|
226
|
+
})
|
|
227
|
+
}));
|
|
228
|
+
if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
|
|
229
|
+
const orderMap = new Map(
|
|
230
|
+
preferences.columnOrder.map((id, index) => [id, index])
|
|
231
|
+
);
|
|
232
|
+
columns = columns.sort((a, b) => {
|
|
233
|
+
var _a2, _b;
|
|
234
|
+
const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
235
|
+
const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
|
|
236
|
+
if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
|
|
237
|
+
return 0;
|
|
238
|
+
}
|
|
239
|
+
return orderA - orderB;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
if (preferences == null ? void 0 : preferences.columnWidths) {
|
|
243
|
+
columns = columns.map((col) => {
|
|
244
|
+
var _a2;
|
|
245
|
+
const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
|
|
246
|
+
if (width !== void 0) {
|
|
247
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
248
|
+
size: width
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return col;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
return columns;
|
|
255
|
+
}
|
|
256
|
+
function extractColumnOrder(columns) {
|
|
257
|
+
return columns.filter((c) => c.id).map((c) => c.id);
|
|
258
|
+
}
|
|
259
|
+
function extractVisibilityChanges(columns, systemColumns) {
|
|
260
|
+
const hiddenByUser = [];
|
|
261
|
+
const shownByUser = [];
|
|
262
|
+
columns.forEach((col) => {
|
|
263
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
264
|
+
if (!col.id) return;
|
|
265
|
+
const systemCol = systemColumns.find((c) => c.id === col.id);
|
|
266
|
+
if (!systemCol) return;
|
|
267
|
+
const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
268
|
+
const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
|
|
269
|
+
const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
|
|
270
|
+
if (!canToggle) return;
|
|
271
|
+
if (systemVisible && !currentVisible) {
|
|
272
|
+
hiddenByUser.push(col.id);
|
|
273
|
+
} else if (!systemVisible && currentVisible) {
|
|
274
|
+
if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
|
|
275
|
+
shownByUser.push(col.id);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
return { hiddenByUser, shownByUser };
|
|
280
|
+
}
|
|
146
281
|
|
|
147
|
-
// src/hooks/useTableLayout.ts
|
|
148
|
-
var
|
|
149
|
-
var LocalStoragePrefix = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
150
|
-
var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
|
|
282
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
283
|
+
var hasCleanedLegacyDataThisSession = false;
|
|
151
284
|
function useTableLayout(initialColumns, key, autosync = true) {
|
|
152
|
-
const [
|
|
285
|
+
const [preferences, setPreferences] = (0, import_react4.useState)(null);
|
|
286
|
+
const [columns, setColumnsState] = (0, import_react4.useState)(
|
|
287
|
+
() => (
|
|
288
|
+
// Initialize with system columns (no preferences applied yet)
|
|
289
|
+
initialColumns.map((col) => __spreadValues({}, col))
|
|
290
|
+
)
|
|
291
|
+
);
|
|
153
292
|
const [isReady, setIsReady] = (0, import_react4.useState)(false);
|
|
154
|
-
const isReadyRef = (0, import_react4.useRef)(false);
|
|
155
293
|
const keyRef = (0, import_react4.useRef)(key);
|
|
294
|
+
const initialColumnsRef = (0, import_react4.useRef)(initialColumns);
|
|
295
|
+
const preferencesRef = (0, import_react4.useRef)(preferences);
|
|
296
|
+
const autosyncRef = (0, import_react4.useRef)(autosync);
|
|
156
297
|
(0, import_react4.useEffect)(() => {
|
|
157
|
-
isReadyRef.current = isReady;
|
|
158
298
|
keyRef.current = key;
|
|
159
|
-
}, [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
);
|
|
299
|
+
}, [key]);
|
|
300
|
+
(0, import_react4.useEffect)(() => {
|
|
301
|
+
initialColumnsRef.current = initialColumns;
|
|
302
|
+
}, [initialColumns]);
|
|
303
|
+
(0, import_react4.useEffect)(() => {
|
|
304
|
+
preferencesRef.current = preferences;
|
|
305
|
+
}, [preferences]);
|
|
306
|
+
(0, import_react4.useEffect)(() => {
|
|
307
|
+
autosyncRef.current = autosync;
|
|
308
|
+
}, [autosync]);
|
|
309
|
+
(0, import_react4.useEffect)(() => {
|
|
310
|
+
if (typeof window === "undefined") return;
|
|
311
|
+
if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
|
|
312
|
+
clearAllLegacyData();
|
|
313
|
+
markLegacyMigrationComplete();
|
|
314
|
+
hasCleanedLegacyDataThisSession = true;
|
|
315
|
+
}
|
|
316
|
+
}, []);
|
|
177
317
|
(0, import_react4.useEffect)(() => {
|
|
178
|
-
if (!autosync)
|
|
318
|
+
if (!autosync) {
|
|
319
|
+
setIsReady(true);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
179
322
|
if (!key) {
|
|
180
323
|
setIsReady(true);
|
|
181
324
|
return;
|
|
182
325
|
}
|
|
183
|
-
const
|
|
184
|
-
|
|
326
|
+
const savedPrefs = loadPreferences(key);
|
|
327
|
+
setPreferences(savedPrefs);
|
|
328
|
+
const computedColumns = applyPreferencesToColumns(
|
|
329
|
+
initialColumns,
|
|
330
|
+
savedPrefs
|
|
185
331
|
);
|
|
186
|
-
|
|
187
|
-
setColumns(
|
|
188
|
-
mergeObjectArrays(
|
|
189
|
-
initialColumns,
|
|
190
|
-
JSON.parse(savedLayout)
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
} else {
|
|
194
|
-
localStorage.setItem(
|
|
195
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
196
|
-
JSON.stringify(initialColumns)
|
|
197
|
-
);
|
|
198
|
-
setColumns((prev) => {
|
|
199
|
-
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
200
|
-
return prev;
|
|
201
|
-
return initialColumns;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
332
|
+
setColumnsState(computedColumns);
|
|
204
333
|
setIsReady(true);
|
|
205
|
-
}, [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
334
|
+
}, [key, autosync]);
|
|
335
|
+
(0, import_react4.useEffect)(() => {
|
|
336
|
+
if (!isReady) return;
|
|
337
|
+
const computedColumns = applyPreferencesToColumns(
|
|
338
|
+
initialColumns,
|
|
339
|
+
preferencesRef.current
|
|
209
340
|
);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
341
|
+
setColumnsState(computedColumns);
|
|
342
|
+
}, [initialColumns, isReady]);
|
|
343
|
+
const persistPreferences = (0, import_react4.useCallback)(
|
|
344
|
+
(newPrefs) => {
|
|
345
|
+
if (!keyRef.current) return;
|
|
346
|
+
const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
|
|
347
|
+
version: 2
|
|
348
|
+
});
|
|
349
|
+
setPreferences(updated);
|
|
350
|
+
if (autosyncRef.current) {
|
|
351
|
+
savePreferences(keyRef.current, updated);
|
|
352
|
+
}
|
|
353
|
+
const computedColumns = applyPreferencesToColumns(
|
|
354
|
+
initialColumnsRef.current,
|
|
355
|
+
updated
|
|
356
|
+
);
|
|
357
|
+
setColumnsState(computedColumns);
|
|
358
|
+
},
|
|
359
|
+
[]
|
|
360
|
+
);
|
|
361
|
+
const hideColumn = (0, import_react4.useCallback)(
|
|
362
|
+
(columnId) => {
|
|
363
|
+
var _a, _b;
|
|
364
|
+
const currentPrefs = preferencesRef.current;
|
|
365
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
366
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
367
|
+
const newShown = currentShown.filter((id) => id !== columnId);
|
|
368
|
+
const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
|
|
369
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
370
|
+
hiddenByUser: newHidden,
|
|
371
|
+
shownByUser: newShown
|
|
372
|
+
}));
|
|
373
|
+
},
|
|
374
|
+
[persistPreferences]
|
|
375
|
+
);
|
|
376
|
+
const showColumn = (0, import_react4.useCallback)(
|
|
377
|
+
(columnId) => {
|
|
378
|
+
var _a, _b;
|
|
379
|
+
const currentPrefs = preferencesRef.current;
|
|
380
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
381
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
382
|
+
const newHidden = currentHidden.filter((id) => id !== columnId);
|
|
383
|
+
const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
|
|
384
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
385
|
+
hiddenByUser: newHidden,
|
|
386
|
+
shownByUser: newShown
|
|
387
|
+
}));
|
|
388
|
+
},
|
|
389
|
+
[persistPreferences]
|
|
390
|
+
);
|
|
391
|
+
const reorderColumns = (0, import_react4.useCallback)(
|
|
392
|
+
(columnIds) => {
|
|
393
|
+
persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
|
|
394
|
+
columnOrder: columnIds
|
|
395
|
+
}));
|
|
396
|
+
},
|
|
397
|
+
[persistPreferences]
|
|
398
|
+
);
|
|
399
|
+
const setColumnWidth = (0, import_react4.useCallback)(
|
|
400
|
+
(columnId, width) => {
|
|
401
|
+
var _a;
|
|
402
|
+
const currentPrefs = preferencesRef.current;
|
|
403
|
+
const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
|
|
404
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
405
|
+
columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
|
|
406
|
+
}));
|
|
407
|
+
},
|
|
408
|
+
[persistPreferences]
|
|
409
|
+
);
|
|
410
|
+
const resetToDefaults = (0, import_react4.useCallback)(() => {
|
|
411
|
+
if (!keyRef.current) return;
|
|
412
|
+
clearPreferences(keyRef.current);
|
|
413
|
+
setPreferences(null);
|
|
414
|
+
const computedColumns = applyPreferencesToColumns(
|
|
415
|
+
initialColumnsRef.current,
|
|
416
|
+
null
|
|
417
|
+
);
|
|
418
|
+
setColumnsState(computedColumns);
|
|
419
|
+
}, []);
|
|
420
|
+
const getUserPreferences = (0, import_react4.useCallback)(() => {
|
|
421
|
+
var _a;
|
|
422
|
+
return (_a = preferencesRef.current) != null ? _a : { version: 2 };
|
|
423
|
+
}, []);
|
|
424
|
+
const getSavedLayout = (0, import_react4.useCallback)(() => {
|
|
425
|
+
return columns;
|
|
426
|
+
}, [columns]);
|
|
427
|
+
const setColumns = (0, import_react4.useCallback)(
|
|
428
|
+
(setter) => {
|
|
429
|
+
setColumnsState((prev) => {
|
|
430
|
+
var _a, _b, _c, _d;
|
|
431
|
+
const newColumns = typeof setter === "function" ? setter(prev) : setter;
|
|
432
|
+
const newOrder = extractColumnOrder(newColumns);
|
|
433
|
+
const { hiddenByUser, shownByUser } = extractVisibilityChanges(
|
|
434
|
+
newColumns,
|
|
435
|
+
initialColumnsRef.current
|
|
436
|
+
);
|
|
437
|
+
const existingPrefs = preferencesRef.current;
|
|
438
|
+
const mergedHidden = Array.from(
|
|
439
|
+
/* @__PURE__ */ new Set([
|
|
440
|
+
...hiddenByUser,
|
|
441
|
+
// Keep existing hidden prefs for columns that are still hidden
|
|
442
|
+
...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
|
|
443
|
+
var _a2;
|
|
444
|
+
const col = newColumns.find((c) => c.id === id);
|
|
445
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
|
|
446
|
+
})) != null ? _b : []
|
|
447
|
+
])
|
|
448
|
+
);
|
|
449
|
+
const mergedShown = Array.from(
|
|
450
|
+
/* @__PURE__ */ new Set([
|
|
451
|
+
...shownByUser,
|
|
452
|
+
// Keep existing shown prefs for columns that are still visible
|
|
453
|
+
...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
|
|
454
|
+
var _a2;
|
|
455
|
+
const col = newColumns.find((c) => c.id === id);
|
|
456
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
|
|
457
|
+
})) != null ? _d : []
|
|
458
|
+
])
|
|
459
|
+
);
|
|
460
|
+
if (keyRef.current && autosync) {
|
|
461
|
+
const newPrefs = {
|
|
462
|
+
columnOrder: newOrder,
|
|
463
|
+
hiddenByUser: mergedHidden,
|
|
464
|
+
shownByUser: mergedShown,
|
|
465
|
+
columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
|
|
466
|
+
version: 2
|
|
467
|
+
};
|
|
468
|
+
setPreferences(newPrefs);
|
|
469
|
+
savePreferences(keyRef.current, newPrefs);
|
|
470
|
+
}
|
|
471
|
+
return newColumns;
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
[autosync]
|
|
475
|
+
);
|
|
476
|
+
return {
|
|
477
|
+
columns,
|
|
478
|
+
setColumns,
|
|
479
|
+
isReady,
|
|
480
|
+
getSavedLayout,
|
|
481
|
+
hideColumn,
|
|
482
|
+
showColumn,
|
|
483
|
+
reorderColumns,
|
|
484
|
+
setColumnWidth,
|
|
485
|
+
resetToDefaults,
|
|
486
|
+
getUserPreferences
|
|
487
|
+
};
|
|
215
488
|
}
|
|
216
489
|
|
|
217
490
|
// src/hooks/useEditCell.tsx
|