@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
|
@@ -441,6 +441,9 @@ var useMatchesMedia = (query) => {
|
|
|
441
441
|
};
|
|
442
442
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
443
443
|
|
|
444
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
445
|
+
var import_react5 = require("react");
|
|
446
|
+
|
|
444
447
|
// src/utils/formatting.tsx
|
|
445
448
|
function getDecimalPlaceholder(decimals) {
|
|
446
449
|
if (!decimals || decimals <= 0) {
|
|
@@ -572,30 +575,8 @@ function formatDate(date) {
|
|
|
572
575
|
}
|
|
573
576
|
}
|
|
574
577
|
|
|
575
|
-
// src/utils/mergeObjectArrays.ts
|
|
576
|
-
function mergeObjectArrays(arr1, arr2) {
|
|
577
|
-
const arr2Map = /* @__PURE__ */ new Map();
|
|
578
|
-
for (const item of arr2) {
|
|
579
|
-
const id = item.id;
|
|
580
|
-
if (id !== void 0) {
|
|
581
|
-
arr2Map.set(id, item);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
return arr1.map((item1) => {
|
|
585
|
-
const id = item1.id;
|
|
586
|
-
if (id !== void 0 && arr2Map.has(id)) {
|
|
587
|
-
const item2 = arr2Map.get(id);
|
|
588
|
-
const meta1 = item1.meta;
|
|
589
|
-
const meta2 = item2.meta;
|
|
590
|
-
const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
|
|
591
|
-
return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
|
|
592
|
-
}
|
|
593
|
-
return item1;
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
|
|
597
578
|
// src/utils/index.ts
|
|
598
|
-
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.
|
|
579
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
599
580
|
|
|
600
581
|
// src/utils.ts
|
|
601
582
|
function findDocumentRoot(element) {
|
|
@@ -620,74 +601,366 @@ function findDocumentRoot(element) {
|
|
|
620
601
|
return window.document.body;
|
|
621
602
|
}
|
|
622
603
|
|
|
623
|
-
// src/hooks/useTableLayout.ts
|
|
624
|
-
var
|
|
625
|
-
var
|
|
626
|
-
var
|
|
604
|
+
// src/hooks/useTableLayout/storage.ts
|
|
605
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
606
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
607
|
+
var CURRENT_SCHEMA_VERSION = 2;
|
|
608
|
+
function getStorageKey(key) {
|
|
609
|
+
return `${STORAGE_PREFIX}__${key}`;
|
|
610
|
+
}
|
|
611
|
+
function getLegacyStorageKey(key) {
|
|
612
|
+
return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
|
|
613
|
+
}
|
|
614
|
+
function loadPreferences(key) {
|
|
615
|
+
const storageKey = getStorageKey(key);
|
|
616
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
617
|
+
const newData = localStorage.getItem(storageKey);
|
|
618
|
+
if (newData) {
|
|
619
|
+
try {
|
|
620
|
+
const parsed = JSON.parse(newData);
|
|
621
|
+
if (parsed.version === CURRENT_SCHEMA_VERSION) {
|
|
622
|
+
return parsed;
|
|
623
|
+
}
|
|
624
|
+
localStorage.removeItem(storageKey);
|
|
625
|
+
} catch (e) {
|
|
626
|
+
localStorage.removeItem(storageKey);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const legacyData = localStorage.getItem(legacyKey);
|
|
630
|
+
if (legacyData) {
|
|
631
|
+
localStorage.removeItem(legacyKey);
|
|
632
|
+
}
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
function savePreferences(key, preferences) {
|
|
636
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
637
|
+
const storageKey = getStorageKey(key);
|
|
638
|
+
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;
|
|
639
|
+
if (!hasPreferences) {
|
|
640
|
+
localStorage.removeItem(storageKey);
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
const data = __spreadProps(__spreadValues({}, preferences), {
|
|
644
|
+
version: CURRENT_SCHEMA_VERSION
|
|
645
|
+
});
|
|
646
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
647
|
+
}
|
|
648
|
+
function clearPreferences(key) {
|
|
649
|
+
const storageKey = getStorageKey(key);
|
|
650
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
651
|
+
localStorage.removeItem(storageKey);
|
|
652
|
+
localStorage.removeItem(legacyKey);
|
|
653
|
+
}
|
|
654
|
+
function clearAllLegacyData() {
|
|
655
|
+
if (typeof window === "undefined") return;
|
|
656
|
+
const keysToRemove = [];
|
|
657
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
658
|
+
const key = localStorage.key(i);
|
|
659
|
+
if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
|
|
660
|
+
keysToRemove.push(key);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
keysToRemove.forEach((key) => {
|
|
664
|
+
localStorage.removeItem(key);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
function hasPerformedLegacyMigration() {
|
|
668
|
+
if (typeof window === "undefined") return true;
|
|
669
|
+
return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
|
|
670
|
+
}
|
|
671
|
+
function markLegacyMigrationComplete() {
|
|
672
|
+
if (typeof window === "undefined") return;
|
|
673
|
+
localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// src/hooks/useTableLayout/computeColumns.ts
|
|
677
|
+
function computeColumnVisibility(column, preferences) {
|
|
678
|
+
var _a, _b, _c, _d, _e, _f;
|
|
679
|
+
const columnId = column.id;
|
|
680
|
+
if (!columnId) return true;
|
|
681
|
+
const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
682
|
+
const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
|
|
683
|
+
if (!canUserToggle) {
|
|
684
|
+
return systemVisible;
|
|
685
|
+
}
|
|
686
|
+
if (preferences) {
|
|
687
|
+
if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
|
|
691
|
+
return true;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return systemVisible;
|
|
695
|
+
}
|
|
696
|
+
function applyPreferencesToColumns(systemColumns, preferences) {
|
|
697
|
+
var _a;
|
|
698
|
+
let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
|
|
699
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
700
|
+
// Compute visibility based on system + user preferences
|
|
701
|
+
visible: computeColumnVisibility(col, preferences)
|
|
702
|
+
})
|
|
703
|
+
}));
|
|
704
|
+
if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
|
|
705
|
+
const orderMap = new Map(
|
|
706
|
+
preferences.columnOrder.map((id, index) => [id, index])
|
|
707
|
+
);
|
|
708
|
+
columns = columns.sort((a, b) => {
|
|
709
|
+
var _a2, _b;
|
|
710
|
+
const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
711
|
+
const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
|
|
712
|
+
if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
|
|
713
|
+
return 0;
|
|
714
|
+
}
|
|
715
|
+
return orderA - orderB;
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
if (preferences == null ? void 0 : preferences.columnWidths) {
|
|
719
|
+
columns = columns.map((col) => {
|
|
720
|
+
var _a2;
|
|
721
|
+
const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
|
|
722
|
+
if (width !== void 0) {
|
|
723
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
724
|
+
size: width
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
return col;
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
return columns;
|
|
731
|
+
}
|
|
732
|
+
function extractColumnOrder(columns) {
|
|
733
|
+
return columns.filter((c) => c.id).map((c) => c.id);
|
|
734
|
+
}
|
|
735
|
+
function extractVisibilityChanges(columns, systemColumns) {
|
|
736
|
+
const hiddenByUser = [];
|
|
737
|
+
const shownByUser = [];
|
|
738
|
+
columns.forEach((col) => {
|
|
739
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
740
|
+
if (!col.id) return;
|
|
741
|
+
const systemCol = systemColumns.find((c) => c.id === col.id);
|
|
742
|
+
if (!systemCol) return;
|
|
743
|
+
const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
744
|
+
const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
|
|
745
|
+
const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
|
|
746
|
+
if (!canToggle) return;
|
|
747
|
+
if (systemVisible && !currentVisible) {
|
|
748
|
+
hiddenByUser.push(col.id);
|
|
749
|
+
} else if (!systemVisible && currentVisible) {
|
|
750
|
+
if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
|
|
751
|
+
shownByUser.push(col.id);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
return { hiddenByUser, shownByUser };
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
759
|
+
var hasCleanedLegacyDataThisSession = false;
|
|
627
760
|
function useTableLayout(initialColumns, key, autosync = true) {
|
|
628
|
-
const [
|
|
761
|
+
const [preferences, setPreferences] = (0, import_react5.useState)(null);
|
|
762
|
+
const [columns, setColumnsState] = (0, import_react5.useState)(
|
|
763
|
+
() => (
|
|
764
|
+
// Initialize with system columns (no preferences applied yet)
|
|
765
|
+
initialColumns.map((col) => __spreadValues({}, col))
|
|
766
|
+
)
|
|
767
|
+
);
|
|
629
768
|
const [isReady, setIsReady] = (0, import_react5.useState)(false);
|
|
630
|
-
const isReadyRef = (0, import_react5.useRef)(false);
|
|
631
769
|
const keyRef = (0, import_react5.useRef)(key);
|
|
770
|
+
const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
|
|
771
|
+
const preferencesRef = (0, import_react5.useRef)(preferences);
|
|
772
|
+
const autosyncRef = (0, import_react5.useRef)(autosync);
|
|
632
773
|
(0, import_react5.useEffect)(() => {
|
|
633
|
-
isReadyRef.current = isReady;
|
|
634
774
|
keyRef.current = key;
|
|
635
|
-
}, [
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
return prevColumns;
|
|
643
|
-
}
|
|
644
|
-
localStorage.setItem(
|
|
645
|
-
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
646
|
-
JSON.stringify(newColumns)
|
|
647
|
-
);
|
|
648
|
-
return newColumns;
|
|
649
|
-
});
|
|
650
|
-
},
|
|
651
|
-
[]
|
|
652
|
-
);
|
|
775
|
+
}, [key]);
|
|
776
|
+
(0, import_react5.useEffect)(() => {
|
|
777
|
+
initialColumnsRef.current = initialColumns;
|
|
778
|
+
}, [initialColumns]);
|
|
779
|
+
(0, import_react5.useEffect)(() => {
|
|
780
|
+
preferencesRef.current = preferences;
|
|
781
|
+
}, [preferences]);
|
|
653
782
|
(0, import_react5.useEffect)(() => {
|
|
654
|
-
|
|
783
|
+
autosyncRef.current = autosync;
|
|
784
|
+
}, [autosync]);
|
|
785
|
+
(0, import_react5.useEffect)(() => {
|
|
786
|
+
if (typeof window === "undefined") return;
|
|
787
|
+
if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
|
|
788
|
+
clearAllLegacyData();
|
|
789
|
+
markLegacyMigrationComplete();
|
|
790
|
+
hasCleanedLegacyDataThisSession = true;
|
|
791
|
+
}
|
|
792
|
+
}, []);
|
|
793
|
+
(0, import_react5.useEffect)(() => {
|
|
794
|
+
if (!autosync) {
|
|
795
|
+
setIsReady(true);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
655
798
|
if (!key) {
|
|
656
799
|
setIsReady(true);
|
|
657
800
|
return;
|
|
658
801
|
}
|
|
659
|
-
const
|
|
660
|
-
|
|
802
|
+
const savedPrefs = loadPreferences(key);
|
|
803
|
+
setPreferences(savedPrefs);
|
|
804
|
+
const computedColumns = applyPreferencesToColumns(
|
|
805
|
+
initialColumns,
|
|
806
|
+
savedPrefs
|
|
661
807
|
);
|
|
662
|
-
|
|
663
|
-
setColumns(
|
|
664
|
-
mergeObjectArrays(
|
|
665
|
-
initialColumns,
|
|
666
|
-
JSON.parse(savedLayout)
|
|
667
|
-
)
|
|
668
|
-
);
|
|
669
|
-
} else {
|
|
670
|
-
localStorage.setItem(
|
|
671
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
672
|
-
JSON.stringify(initialColumns)
|
|
673
|
-
);
|
|
674
|
-
setColumns((prev) => {
|
|
675
|
-
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
676
|
-
return prev;
|
|
677
|
-
return initialColumns;
|
|
678
|
-
});
|
|
679
|
-
}
|
|
808
|
+
setColumnsState(computedColumns);
|
|
680
809
|
setIsReady(true);
|
|
681
|
-
}, [
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
810
|
+
}, [key, autosync]);
|
|
811
|
+
(0, import_react5.useEffect)(() => {
|
|
812
|
+
if (!isReady) return;
|
|
813
|
+
const computedColumns = applyPreferencesToColumns(
|
|
814
|
+
initialColumns,
|
|
815
|
+
preferencesRef.current
|
|
685
816
|
);
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
817
|
+
setColumnsState(computedColumns);
|
|
818
|
+
}, [initialColumns, isReady]);
|
|
819
|
+
const persistPreferences = (0, import_react5.useCallback)(
|
|
820
|
+
(newPrefs) => {
|
|
821
|
+
if (!keyRef.current) return;
|
|
822
|
+
const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
|
|
823
|
+
version: 2
|
|
824
|
+
});
|
|
825
|
+
setPreferences(updated);
|
|
826
|
+
if (autosyncRef.current) {
|
|
827
|
+
savePreferences(keyRef.current, updated);
|
|
828
|
+
}
|
|
829
|
+
const computedColumns = applyPreferencesToColumns(
|
|
830
|
+
initialColumnsRef.current,
|
|
831
|
+
updated
|
|
832
|
+
);
|
|
833
|
+
setColumnsState(computedColumns);
|
|
834
|
+
},
|
|
835
|
+
[]
|
|
836
|
+
);
|
|
837
|
+
const hideColumn = (0, import_react5.useCallback)(
|
|
838
|
+
(columnId) => {
|
|
839
|
+
var _a, _b;
|
|
840
|
+
const currentPrefs = preferencesRef.current;
|
|
841
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
842
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
843
|
+
const newShown = currentShown.filter((id) => id !== columnId);
|
|
844
|
+
const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
|
|
845
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
846
|
+
hiddenByUser: newHidden,
|
|
847
|
+
shownByUser: newShown
|
|
848
|
+
}));
|
|
849
|
+
},
|
|
850
|
+
[persistPreferences]
|
|
851
|
+
);
|
|
852
|
+
const showColumn = (0, import_react5.useCallback)(
|
|
853
|
+
(columnId) => {
|
|
854
|
+
var _a, _b;
|
|
855
|
+
const currentPrefs = preferencesRef.current;
|
|
856
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
857
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
858
|
+
const newHidden = currentHidden.filter((id) => id !== columnId);
|
|
859
|
+
const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
|
|
860
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
861
|
+
hiddenByUser: newHidden,
|
|
862
|
+
shownByUser: newShown
|
|
863
|
+
}));
|
|
864
|
+
},
|
|
865
|
+
[persistPreferences]
|
|
866
|
+
);
|
|
867
|
+
const reorderColumns = (0, import_react5.useCallback)(
|
|
868
|
+
(columnIds) => {
|
|
869
|
+
persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
|
|
870
|
+
columnOrder: columnIds
|
|
871
|
+
}));
|
|
872
|
+
},
|
|
873
|
+
[persistPreferences]
|
|
874
|
+
);
|
|
875
|
+
const setColumnWidth = (0, import_react5.useCallback)(
|
|
876
|
+
(columnId, width) => {
|
|
877
|
+
var _a;
|
|
878
|
+
const currentPrefs = preferencesRef.current;
|
|
879
|
+
const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
|
|
880
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
881
|
+
columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
|
|
882
|
+
}));
|
|
883
|
+
},
|
|
884
|
+
[persistPreferences]
|
|
885
|
+
);
|
|
886
|
+
const resetToDefaults = (0, import_react5.useCallback)(() => {
|
|
887
|
+
if (!keyRef.current) return;
|
|
888
|
+
clearPreferences(keyRef.current);
|
|
889
|
+
setPreferences(null);
|
|
890
|
+
const computedColumns = applyPreferencesToColumns(
|
|
891
|
+
initialColumnsRef.current,
|
|
892
|
+
null
|
|
893
|
+
);
|
|
894
|
+
setColumnsState(computedColumns);
|
|
895
|
+
}, []);
|
|
896
|
+
const getUserPreferences = (0, import_react5.useCallback)(() => {
|
|
897
|
+
var _a;
|
|
898
|
+
return (_a = preferencesRef.current) != null ? _a : { version: 2 };
|
|
899
|
+
}, []);
|
|
900
|
+
const getSavedLayout = (0, import_react5.useCallback)(() => {
|
|
901
|
+
return columns;
|
|
902
|
+
}, [columns]);
|
|
903
|
+
const setColumns = (0, import_react5.useCallback)(
|
|
904
|
+
(setter) => {
|
|
905
|
+
setColumnsState((prev) => {
|
|
906
|
+
var _a, _b, _c, _d;
|
|
907
|
+
const newColumns = typeof setter === "function" ? setter(prev) : setter;
|
|
908
|
+
const newOrder = extractColumnOrder(newColumns);
|
|
909
|
+
const { hiddenByUser, shownByUser } = extractVisibilityChanges(
|
|
910
|
+
newColumns,
|
|
911
|
+
initialColumnsRef.current
|
|
912
|
+
);
|
|
913
|
+
const existingPrefs = preferencesRef.current;
|
|
914
|
+
const mergedHidden = Array.from(
|
|
915
|
+
/* @__PURE__ */ new Set([
|
|
916
|
+
...hiddenByUser,
|
|
917
|
+
// Keep existing hidden prefs for columns that are still hidden
|
|
918
|
+
...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
|
|
919
|
+
var _a2;
|
|
920
|
+
const col = newColumns.find((c) => c.id === id);
|
|
921
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
|
|
922
|
+
})) != null ? _b : []
|
|
923
|
+
])
|
|
924
|
+
);
|
|
925
|
+
const mergedShown = Array.from(
|
|
926
|
+
/* @__PURE__ */ new Set([
|
|
927
|
+
...shownByUser,
|
|
928
|
+
// Keep existing shown prefs for columns that are still visible
|
|
929
|
+
...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
|
|
930
|
+
var _a2;
|
|
931
|
+
const col = newColumns.find((c) => c.id === id);
|
|
932
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
|
|
933
|
+
})) != null ? _d : []
|
|
934
|
+
])
|
|
935
|
+
);
|
|
936
|
+
if (keyRef.current && autosync) {
|
|
937
|
+
const newPrefs = {
|
|
938
|
+
columnOrder: newOrder,
|
|
939
|
+
hiddenByUser: mergedHidden,
|
|
940
|
+
shownByUser: mergedShown,
|
|
941
|
+
columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
|
|
942
|
+
version: 2
|
|
943
|
+
};
|
|
944
|
+
setPreferences(newPrefs);
|
|
945
|
+
savePreferences(keyRef.current, newPrefs);
|
|
946
|
+
}
|
|
947
|
+
return newColumns;
|
|
948
|
+
});
|
|
949
|
+
},
|
|
950
|
+
[autosync]
|
|
951
|
+
);
|
|
952
|
+
return {
|
|
953
|
+
columns,
|
|
954
|
+
setColumns,
|
|
955
|
+
isReady,
|
|
956
|
+
getSavedLayout,
|
|
957
|
+
hideColumn,
|
|
958
|
+
showColumn,
|
|
959
|
+
reorderColumns,
|
|
960
|
+
setColumnWidth,
|
|
961
|
+
resetToDefaults,
|
|
962
|
+
getUserPreferences
|
|
963
|
+
};
|
|
691
964
|
}
|
|
692
965
|
|
|
693
966
|
// src/hooks/useEditCell.tsx
|
|
@@ -3248,7 +3521,8 @@ function DataGrid({
|
|
|
3248
3521
|
const {
|
|
3249
3522
|
columns: tableColumns,
|
|
3250
3523
|
setColumns: setTableColumns,
|
|
3251
|
-
getSavedLayout
|
|
3524
|
+
getSavedLayout,
|
|
3525
|
+
resetToDefaults
|
|
3252
3526
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3253
3527
|
const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
|
|
3254
3528
|
tableColumns.map((c) => c.id)
|
|
@@ -3276,21 +3550,8 @@ function DataGrid({
|
|
|
3276
3550
|
[tableColumns]
|
|
3277
3551
|
);
|
|
3278
3552
|
const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
var _a2, _b2;
|
|
3282
|
-
const columnId = column.id;
|
|
3283
|
-
const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
3284
|
-
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
3285
|
-
if (persistedIndex !== -1) {
|
|
3286
|
-
prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
|
|
3287
|
-
visible: isVisible
|
|
3288
|
-
});
|
|
3289
|
-
}
|
|
3290
|
-
});
|
|
3291
|
-
return [...prev];
|
|
3292
|
-
}, true);
|
|
3293
|
-
}, [columns, setTableColumns]);
|
|
3553
|
+
resetToDefaults();
|
|
3554
|
+
}, [resetToDefaults]);
|
|
3294
3555
|
(0, import_react17.useEffect)(() => {
|
|
3295
3556
|
updateColumnVisibility(true);
|
|
3296
3557
|
}, [updateColumnVisibility]);
|
|
@@ -3326,14 +3587,18 @@ function DataGrid({
|
|
|
3326
3587
|
const toggleColumnVisibility = (0, import_react17.useCallback)(
|
|
3327
3588
|
(columnId, isVisible) => {
|
|
3328
3589
|
setTableColumns((prev) => {
|
|
3329
|
-
const
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3590
|
+
const newColumns = prev.map((col) => {
|
|
3591
|
+
if (col.id === columnId) {
|
|
3592
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
3593
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
3594
|
+
visible: isVisible
|
|
3595
|
+
})
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
return col;
|
|
3599
|
+
});
|
|
3600
|
+
return newColumns;
|
|
3601
|
+
});
|
|
3337
3602
|
},
|
|
3338
3603
|
[setTableColumns]
|
|
3339
3604
|
);
|
|
@@ -4105,7 +4370,8 @@ var Button = (_a) => {
|
|
|
4105
4370
|
href,
|
|
4106
4371
|
id,
|
|
4107
4372
|
testid,
|
|
4108
|
-
isLoading
|
|
4373
|
+
isLoading,
|
|
4374
|
+
fontNormal = false
|
|
4109
4375
|
} = _b, props = __objRest(_b, [
|
|
4110
4376
|
"variant",
|
|
4111
4377
|
"as",
|
|
@@ -4121,7 +4387,8 @@ var Button = (_a) => {
|
|
|
4121
4387
|
"href",
|
|
4122
4388
|
"id",
|
|
4123
4389
|
"testid",
|
|
4124
|
-
"isLoading"
|
|
4390
|
+
"isLoading",
|
|
4391
|
+
"fontNormal"
|
|
4125
4392
|
]);
|
|
4126
4393
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
|
|
4127
4394
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -4148,6 +4415,15 @@ var Button = (_a) => {
|
|
|
4148
4415
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
4149
4416
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4150
4417
|
);
|
|
4418
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
|
|
4419
|
+
"bg-transparent border-transparent",
|
|
4420
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
4421
|
+
"bg-transparent border-transparent",
|
|
4422
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
4423
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
4424
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
4425
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4426
|
+
);
|
|
4151
4427
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
|
|
4152
4428
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
4153
4429
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -4191,6 +4467,7 @@ var Button = (_a) => {
|
|
|
4191
4467
|
primaryVariantStyles,
|
|
4192
4468
|
secondaryVariantStyles,
|
|
4193
4469
|
tertiaryVariantStyles,
|
|
4470
|
+
quarternaryOutlinedVariantStyles,
|
|
4194
4471
|
primaryCriticalVariantStyles,
|
|
4195
4472
|
secondaryCriticalVariantStyles,
|
|
4196
4473
|
tertiaryCriticalVariantStyles,
|
|
@@ -4201,6 +4478,7 @@ var Button = (_a) => {
|
|
|
4201
4478
|
const labelClasses = (0, import_clsx18.default)(
|
|
4202
4479
|
"min-h-6 flex items-center justify-center",
|
|
4203
4480
|
classNameLabel,
|
|
4481
|
+
fontNormal && "font-normal!",
|
|
4204
4482
|
componentPaddingXUsingComponentGap,
|
|
4205
4483
|
typography.buttonLabel
|
|
4206
4484
|
);
|
|
@@ -5306,7 +5584,8 @@ var ModalHeader = ({
|
|
|
5306
5584
|
id,
|
|
5307
5585
|
"data-testid": testid,
|
|
5308
5586
|
className: (0, import_clsx26.default)(
|
|
5309
|
-
"flex
|
|
5587
|
+
"flex items-center",
|
|
5588
|
+
headerIconAlign === void 0 && "justify-between",
|
|
5310
5589
|
headerIconAlign === "center" && "justify-center",
|
|
5311
5590
|
headerIconAlign === "right" && "justify-end",
|
|
5312
5591
|
headerIconAlign === "left" && "justify-start",
|
|
@@ -6137,7 +6416,7 @@ var import_react40 = require("react");
|
|
|
6137
6416
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6138
6417
|
|
|
6139
6418
|
// src/components/EmblaCarousel/index.tsx
|
|
6140
|
-
var import_react43 = require("react");
|
|
6419
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
6141
6420
|
var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
|
|
6142
6421
|
var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
|
|
6143
6422
|
|