@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
|
@@ -442,6 +442,9 @@ var useMatchesMedia = (query) => {
|
|
|
442
442
|
};
|
|
443
443
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
444
444
|
|
|
445
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
446
|
+
var import_react5 = require("react");
|
|
447
|
+
|
|
445
448
|
// src/utils/formatting.tsx
|
|
446
449
|
function getDecimalPlaceholder(decimals) {
|
|
447
450
|
if (!decimals || decimals <= 0) {
|
|
@@ -573,30 +576,8 @@ function formatDate(date) {
|
|
|
573
576
|
}
|
|
574
577
|
}
|
|
575
578
|
|
|
576
|
-
// src/utils/mergeObjectArrays.ts
|
|
577
|
-
function mergeObjectArrays(arr1, arr2) {
|
|
578
|
-
const arr2Map = /* @__PURE__ */ new Map();
|
|
579
|
-
for (const item of arr2) {
|
|
580
|
-
const id = item.id;
|
|
581
|
-
if (id !== void 0) {
|
|
582
|
-
arr2Map.set(id, item);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return arr1.map((item1) => {
|
|
586
|
-
const id = item1.id;
|
|
587
|
-
if (id !== void 0 && arr2Map.has(id)) {
|
|
588
|
-
const item2 = arr2Map.get(id);
|
|
589
|
-
const meta1 = item1.meta;
|
|
590
|
-
const meta2 = item2.meta;
|
|
591
|
-
const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
|
|
592
|
-
return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
|
|
593
|
-
}
|
|
594
|
-
return item1;
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
|
|
598
579
|
// src/utils/index.ts
|
|
599
|
-
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.
|
|
580
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
600
581
|
|
|
601
582
|
// src/utils.ts
|
|
602
583
|
function findDocumentRoot(element) {
|
|
@@ -621,74 +602,366 @@ function findDocumentRoot(element) {
|
|
|
621
602
|
return window.document.body;
|
|
622
603
|
}
|
|
623
604
|
|
|
624
|
-
// src/hooks/useTableLayout.ts
|
|
625
|
-
var
|
|
626
|
-
var
|
|
627
|
-
var
|
|
605
|
+
// src/hooks/useTableLayout/storage.ts
|
|
606
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
607
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
608
|
+
var CURRENT_SCHEMA_VERSION = 2;
|
|
609
|
+
function getStorageKey(key) {
|
|
610
|
+
return `${STORAGE_PREFIX}__${key}`;
|
|
611
|
+
}
|
|
612
|
+
function getLegacyStorageKey(key) {
|
|
613
|
+
return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
|
|
614
|
+
}
|
|
615
|
+
function loadPreferences(key) {
|
|
616
|
+
const storageKey = getStorageKey(key);
|
|
617
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
618
|
+
const newData = localStorage.getItem(storageKey);
|
|
619
|
+
if (newData) {
|
|
620
|
+
try {
|
|
621
|
+
const parsed = JSON.parse(newData);
|
|
622
|
+
if (parsed.version === CURRENT_SCHEMA_VERSION) {
|
|
623
|
+
return parsed;
|
|
624
|
+
}
|
|
625
|
+
localStorage.removeItem(storageKey);
|
|
626
|
+
} catch (e) {
|
|
627
|
+
localStorage.removeItem(storageKey);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
const legacyData = localStorage.getItem(legacyKey);
|
|
631
|
+
if (legacyData) {
|
|
632
|
+
localStorage.removeItem(legacyKey);
|
|
633
|
+
}
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
function savePreferences(key, preferences) {
|
|
637
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
638
|
+
const storageKey = getStorageKey(key);
|
|
639
|
+
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;
|
|
640
|
+
if (!hasPreferences) {
|
|
641
|
+
localStorage.removeItem(storageKey);
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const data = __spreadProps(__spreadValues({}, preferences), {
|
|
645
|
+
version: CURRENT_SCHEMA_VERSION
|
|
646
|
+
});
|
|
647
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
648
|
+
}
|
|
649
|
+
function clearPreferences(key) {
|
|
650
|
+
const storageKey = getStorageKey(key);
|
|
651
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
652
|
+
localStorage.removeItem(storageKey);
|
|
653
|
+
localStorage.removeItem(legacyKey);
|
|
654
|
+
}
|
|
655
|
+
function clearAllLegacyData() {
|
|
656
|
+
if (typeof window === "undefined") return;
|
|
657
|
+
const keysToRemove = [];
|
|
658
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
659
|
+
const key = localStorage.key(i);
|
|
660
|
+
if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
|
|
661
|
+
keysToRemove.push(key);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
keysToRemove.forEach((key) => {
|
|
665
|
+
localStorage.removeItem(key);
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function hasPerformedLegacyMigration() {
|
|
669
|
+
if (typeof window === "undefined") return true;
|
|
670
|
+
return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
|
|
671
|
+
}
|
|
672
|
+
function markLegacyMigrationComplete() {
|
|
673
|
+
if (typeof window === "undefined") return;
|
|
674
|
+
localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/hooks/useTableLayout/computeColumns.ts
|
|
678
|
+
function computeColumnVisibility(column, preferences) {
|
|
679
|
+
var _a, _b, _c, _d, _e, _f;
|
|
680
|
+
const columnId = column.id;
|
|
681
|
+
if (!columnId) return true;
|
|
682
|
+
const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
683
|
+
const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
|
|
684
|
+
if (!canUserToggle) {
|
|
685
|
+
return systemVisible;
|
|
686
|
+
}
|
|
687
|
+
if (preferences) {
|
|
688
|
+
if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return systemVisible;
|
|
696
|
+
}
|
|
697
|
+
function applyPreferencesToColumns(systemColumns, preferences) {
|
|
698
|
+
var _a;
|
|
699
|
+
let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
|
|
700
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
701
|
+
// Compute visibility based on system + user preferences
|
|
702
|
+
visible: computeColumnVisibility(col, preferences)
|
|
703
|
+
})
|
|
704
|
+
}));
|
|
705
|
+
if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
|
|
706
|
+
const orderMap = new Map(
|
|
707
|
+
preferences.columnOrder.map((id, index) => [id, index])
|
|
708
|
+
);
|
|
709
|
+
columns = columns.sort((a, b) => {
|
|
710
|
+
var _a2, _b;
|
|
711
|
+
const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
712
|
+
const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
|
|
713
|
+
if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
|
|
714
|
+
return 0;
|
|
715
|
+
}
|
|
716
|
+
return orderA - orderB;
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
if (preferences == null ? void 0 : preferences.columnWidths) {
|
|
720
|
+
columns = columns.map((col) => {
|
|
721
|
+
var _a2;
|
|
722
|
+
const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
|
|
723
|
+
if (width !== void 0) {
|
|
724
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
725
|
+
size: width
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
return col;
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
return columns;
|
|
732
|
+
}
|
|
733
|
+
function extractColumnOrder(columns) {
|
|
734
|
+
return columns.filter((c) => c.id).map((c) => c.id);
|
|
735
|
+
}
|
|
736
|
+
function extractVisibilityChanges(columns, systemColumns) {
|
|
737
|
+
const hiddenByUser = [];
|
|
738
|
+
const shownByUser = [];
|
|
739
|
+
columns.forEach((col) => {
|
|
740
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
741
|
+
if (!col.id) return;
|
|
742
|
+
const systemCol = systemColumns.find((c) => c.id === col.id);
|
|
743
|
+
if (!systemCol) return;
|
|
744
|
+
const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
745
|
+
const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
|
|
746
|
+
const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
|
|
747
|
+
if (!canToggle) return;
|
|
748
|
+
if (systemVisible && !currentVisible) {
|
|
749
|
+
hiddenByUser.push(col.id);
|
|
750
|
+
} else if (!systemVisible && currentVisible) {
|
|
751
|
+
if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
|
|
752
|
+
shownByUser.push(col.id);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
return { hiddenByUser, shownByUser };
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
760
|
+
var hasCleanedLegacyDataThisSession = false;
|
|
628
761
|
function useTableLayout(initialColumns, key, autosync = true) {
|
|
629
|
-
const [
|
|
762
|
+
const [preferences, setPreferences] = (0, import_react5.useState)(null);
|
|
763
|
+
const [columns, setColumnsState] = (0, import_react5.useState)(
|
|
764
|
+
() => (
|
|
765
|
+
// Initialize with system columns (no preferences applied yet)
|
|
766
|
+
initialColumns.map((col) => __spreadValues({}, col))
|
|
767
|
+
)
|
|
768
|
+
);
|
|
630
769
|
const [isReady, setIsReady] = (0, import_react5.useState)(false);
|
|
631
|
-
const isReadyRef = (0, import_react5.useRef)(false);
|
|
632
770
|
const keyRef = (0, import_react5.useRef)(key);
|
|
771
|
+
const initialColumnsRef = (0, import_react5.useRef)(initialColumns);
|
|
772
|
+
const preferencesRef = (0, import_react5.useRef)(preferences);
|
|
773
|
+
const autosyncRef = (0, import_react5.useRef)(autosync);
|
|
633
774
|
(0, import_react5.useEffect)(() => {
|
|
634
|
-
isReadyRef.current = isReady;
|
|
635
775
|
keyRef.current = key;
|
|
636
|
-
}, [
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return prevColumns;
|
|
644
|
-
}
|
|
645
|
-
localStorage.setItem(
|
|
646
|
-
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
647
|
-
JSON.stringify(newColumns)
|
|
648
|
-
);
|
|
649
|
-
return newColumns;
|
|
650
|
-
});
|
|
651
|
-
},
|
|
652
|
-
[]
|
|
653
|
-
);
|
|
776
|
+
}, [key]);
|
|
777
|
+
(0, import_react5.useEffect)(() => {
|
|
778
|
+
initialColumnsRef.current = initialColumns;
|
|
779
|
+
}, [initialColumns]);
|
|
780
|
+
(0, import_react5.useEffect)(() => {
|
|
781
|
+
preferencesRef.current = preferences;
|
|
782
|
+
}, [preferences]);
|
|
654
783
|
(0, import_react5.useEffect)(() => {
|
|
655
|
-
|
|
784
|
+
autosyncRef.current = autosync;
|
|
785
|
+
}, [autosync]);
|
|
786
|
+
(0, import_react5.useEffect)(() => {
|
|
787
|
+
if (typeof window === "undefined") return;
|
|
788
|
+
if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
|
|
789
|
+
clearAllLegacyData();
|
|
790
|
+
markLegacyMigrationComplete();
|
|
791
|
+
hasCleanedLegacyDataThisSession = true;
|
|
792
|
+
}
|
|
793
|
+
}, []);
|
|
794
|
+
(0, import_react5.useEffect)(() => {
|
|
795
|
+
if (!autosync) {
|
|
796
|
+
setIsReady(true);
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
656
799
|
if (!key) {
|
|
657
800
|
setIsReady(true);
|
|
658
801
|
return;
|
|
659
802
|
}
|
|
660
|
-
const
|
|
661
|
-
|
|
803
|
+
const savedPrefs = loadPreferences(key);
|
|
804
|
+
setPreferences(savedPrefs);
|
|
805
|
+
const computedColumns = applyPreferencesToColumns(
|
|
806
|
+
initialColumns,
|
|
807
|
+
savedPrefs
|
|
662
808
|
);
|
|
663
|
-
|
|
664
|
-
setColumns(
|
|
665
|
-
mergeObjectArrays(
|
|
666
|
-
initialColumns,
|
|
667
|
-
JSON.parse(savedLayout)
|
|
668
|
-
)
|
|
669
|
-
);
|
|
670
|
-
} else {
|
|
671
|
-
localStorage.setItem(
|
|
672
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
673
|
-
JSON.stringify(initialColumns)
|
|
674
|
-
);
|
|
675
|
-
setColumns((prev) => {
|
|
676
|
-
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
677
|
-
return prev;
|
|
678
|
-
return initialColumns;
|
|
679
|
-
});
|
|
680
|
-
}
|
|
809
|
+
setColumnsState(computedColumns);
|
|
681
810
|
setIsReady(true);
|
|
682
|
-
}, [
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
811
|
+
}, [key, autosync]);
|
|
812
|
+
(0, import_react5.useEffect)(() => {
|
|
813
|
+
if (!isReady) return;
|
|
814
|
+
const computedColumns = applyPreferencesToColumns(
|
|
815
|
+
initialColumns,
|
|
816
|
+
preferencesRef.current
|
|
686
817
|
);
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
818
|
+
setColumnsState(computedColumns);
|
|
819
|
+
}, [initialColumns, isReady]);
|
|
820
|
+
const persistPreferences = (0, import_react5.useCallback)(
|
|
821
|
+
(newPrefs) => {
|
|
822
|
+
if (!keyRef.current) return;
|
|
823
|
+
const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
|
|
824
|
+
version: 2
|
|
825
|
+
});
|
|
826
|
+
setPreferences(updated);
|
|
827
|
+
if (autosyncRef.current) {
|
|
828
|
+
savePreferences(keyRef.current, updated);
|
|
829
|
+
}
|
|
830
|
+
const computedColumns = applyPreferencesToColumns(
|
|
831
|
+
initialColumnsRef.current,
|
|
832
|
+
updated
|
|
833
|
+
);
|
|
834
|
+
setColumnsState(computedColumns);
|
|
835
|
+
},
|
|
836
|
+
[]
|
|
837
|
+
);
|
|
838
|
+
const hideColumn = (0, import_react5.useCallback)(
|
|
839
|
+
(columnId) => {
|
|
840
|
+
var _a, _b;
|
|
841
|
+
const currentPrefs = preferencesRef.current;
|
|
842
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
843
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
844
|
+
const newShown = currentShown.filter((id) => id !== columnId);
|
|
845
|
+
const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
|
|
846
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
847
|
+
hiddenByUser: newHidden,
|
|
848
|
+
shownByUser: newShown
|
|
849
|
+
}));
|
|
850
|
+
},
|
|
851
|
+
[persistPreferences]
|
|
852
|
+
);
|
|
853
|
+
const showColumn = (0, import_react5.useCallback)(
|
|
854
|
+
(columnId) => {
|
|
855
|
+
var _a, _b;
|
|
856
|
+
const currentPrefs = preferencesRef.current;
|
|
857
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
858
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
859
|
+
const newHidden = currentHidden.filter((id) => id !== columnId);
|
|
860
|
+
const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
|
|
861
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
862
|
+
hiddenByUser: newHidden,
|
|
863
|
+
shownByUser: newShown
|
|
864
|
+
}));
|
|
865
|
+
},
|
|
866
|
+
[persistPreferences]
|
|
867
|
+
);
|
|
868
|
+
const reorderColumns = (0, import_react5.useCallback)(
|
|
869
|
+
(columnIds) => {
|
|
870
|
+
persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
|
|
871
|
+
columnOrder: columnIds
|
|
872
|
+
}));
|
|
873
|
+
},
|
|
874
|
+
[persistPreferences]
|
|
875
|
+
);
|
|
876
|
+
const setColumnWidth = (0, import_react5.useCallback)(
|
|
877
|
+
(columnId, width) => {
|
|
878
|
+
var _a;
|
|
879
|
+
const currentPrefs = preferencesRef.current;
|
|
880
|
+
const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
|
|
881
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
882
|
+
columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
|
|
883
|
+
}));
|
|
884
|
+
},
|
|
885
|
+
[persistPreferences]
|
|
886
|
+
);
|
|
887
|
+
const resetToDefaults = (0, import_react5.useCallback)(() => {
|
|
888
|
+
if (!keyRef.current) return;
|
|
889
|
+
clearPreferences(keyRef.current);
|
|
890
|
+
setPreferences(null);
|
|
891
|
+
const computedColumns = applyPreferencesToColumns(
|
|
892
|
+
initialColumnsRef.current,
|
|
893
|
+
null
|
|
894
|
+
);
|
|
895
|
+
setColumnsState(computedColumns);
|
|
896
|
+
}, []);
|
|
897
|
+
const getUserPreferences = (0, import_react5.useCallback)(() => {
|
|
898
|
+
var _a;
|
|
899
|
+
return (_a = preferencesRef.current) != null ? _a : { version: 2 };
|
|
900
|
+
}, []);
|
|
901
|
+
const getSavedLayout = (0, import_react5.useCallback)(() => {
|
|
902
|
+
return columns;
|
|
903
|
+
}, [columns]);
|
|
904
|
+
const setColumns = (0, import_react5.useCallback)(
|
|
905
|
+
(setter) => {
|
|
906
|
+
setColumnsState((prev) => {
|
|
907
|
+
var _a, _b, _c, _d;
|
|
908
|
+
const newColumns = typeof setter === "function" ? setter(prev) : setter;
|
|
909
|
+
const newOrder = extractColumnOrder(newColumns);
|
|
910
|
+
const { hiddenByUser, shownByUser } = extractVisibilityChanges(
|
|
911
|
+
newColumns,
|
|
912
|
+
initialColumnsRef.current
|
|
913
|
+
);
|
|
914
|
+
const existingPrefs = preferencesRef.current;
|
|
915
|
+
const mergedHidden = Array.from(
|
|
916
|
+
/* @__PURE__ */ new Set([
|
|
917
|
+
...hiddenByUser,
|
|
918
|
+
// Keep existing hidden prefs for columns that are still hidden
|
|
919
|
+
...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
|
|
920
|
+
var _a2;
|
|
921
|
+
const col = newColumns.find((c) => c.id === id);
|
|
922
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
|
|
923
|
+
})) != null ? _b : []
|
|
924
|
+
])
|
|
925
|
+
);
|
|
926
|
+
const mergedShown = Array.from(
|
|
927
|
+
/* @__PURE__ */ new Set([
|
|
928
|
+
...shownByUser,
|
|
929
|
+
// Keep existing shown prefs for columns that are still visible
|
|
930
|
+
...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
|
|
931
|
+
var _a2;
|
|
932
|
+
const col = newColumns.find((c) => c.id === id);
|
|
933
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
|
|
934
|
+
})) != null ? _d : []
|
|
935
|
+
])
|
|
936
|
+
);
|
|
937
|
+
if (keyRef.current && autosync) {
|
|
938
|
+
const newPrefs = {
|
|
939
|
+
columnOrder: newOrder,
|
|
940
|
+
hiddenByUser: mergedHidden,
|
|
941
|
+
shownByUser: mergedShown,
|
|
942
|
+
columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
|
|
943
|
+
version: 2
|
|
944
|
+
};
|
|
945
|
+
setPreferences(newPrefs);
|
|
946
|
+
savePreferences(keyRef.current, newPrefs);
|
|
947
|
+
}
|
|
948
|
+
return newColumns;
|
|
949
|
+
});
|
|
950
|
+
},
|
|
951
|
+
[autosync]
|
|
952
|
+
);
|
|
953
|
+
return {
|
|
954
|
+
columns,
|
|
955
|
+
setColumns,
|
|
956
|
+
isReady,
|
|
957
|
+
getSavedLayout,
|
|
958
|
+
hideColumn,
|
|
959
|
+
showColumn,
|
|
960
|
+
reorderColumns,
|
|
961
|
+
setColumnWidth,
|
|
962
|
+
resetToDefaults,
|
|
963
|
+
getUserPreferences
|
|
964
|
+
};
|
|
692
965
|
}
|
|
693
966
|
|
|
694
967
|
// src/hooks/useEditCell.tsx
|
|
@@ -3256,7 +3529,8 @@ function DataGrid({
|
|
|
3256
3529
|
const {
|
|
3257
3530
|
columns: tableColumns,
|
|
3258
3531
|
setColumns: setTableColumns,
|
|
3259
|
-
getSavedLayout
|
|
3532
|
+
getSavedLayout,
|
|
3533
|
+
resetToDefaults
|
|
3260
3534
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3261
3535
|
const [columnOrder, setColumnOrder] = (0, import_react16.useState)(
|
|
3262
3536
|
tableColumns.map((c) => c.id)
|
|
@@ -3284,21 +3558,8 @@ function DataGrid({
|
|
|
3284
3558
|
[tableColumns]
|
|
3285
3559
|
);
|
|
3286
3560
|
const resetDefaultColumnVisibility = (0, import_react16.useCallback)(() => {
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
var _a2, _b2;
|
|
3290
|
-
const columnId = column.id;
|
|
3291
|
-
const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
3292
|
-
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
3293
|
-
if (persistedIndex !== -1) {
|
|
3294
|
-
prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
|
|
3295
|
-
visible: isVisible
|
|
3296
|
-
});
|
|
3297
|
-
}
|
|
3298
|
-
});
|
|
3299
|
-
return [...prev];
|
|
3300
|
-
}, true);
|
|
3301
|
-
}, [columns, setTableColumns]);
|
|
3561
|
+
resetToDefaults();
|
|
3562
|
+
}, [resetToDefaults]);
|
|
3302
3563
|
(0, import_react16.useEffect)(() => {
|
|
3303
3564
|
updateColumnVisibility(true);
|
|
3304
3565
|
}, [updateColumnVisibility]);
|
|
@@ -3334,14 +3595,18 @@ function DataGrid({
|
|
|
3334
3595
|
const toggleColumnVisibility = (0, import_react16.useCallback)(
|
|
3335
3596
|
(columnId, isVisible) => {
|
|
3336
3597
|
setTableColumns((prev) => {
|
|
3337
|
-
const
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3598
|
+
const newColumns = prev.map((col) => {
|
|
3599
|
+
if (col.id === columnId) {
|
|
3600
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
3601
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
3602
|
+
visible: isVisible
|
|
3603
|
+
})
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
return col;
|
|
3607
|
+
});
|
|
3608
|
+
return newColumns;
|
|
3609
|
+
});
|
|
3345
3610
|
},
|
|
3346
3611
|
[setTableColumns]
|
|
3347
3612
|
);
|
|
@@ -4113,7 +4378,8 @@ var Button = (_a) => {
|
|
|
4113
4378
|
href,
|
|
4114
4379
|
id,
|
|
4115
4380
|
testid,
|
|
4116
|
-
isLoading
|
|
4381
|
+
isLoading,
|
|
4382
|
+
fontNormal = false
|
|
4117
4383
|
} = _b, props = __objRest(_b, [
|
|
4118
4384
|
"variant",
|
|
4119
4385
|
"as",
|
|
@@ -4129,7 +4395,8 @@ var Button = (_a) => {
|
|
|
4129
4395
|
"href",
|
|
4130
4396
|
"id",
|
|
4131
4397
|
"testid",
|
|
4132
|
-
"isLoading"
|
|
4398
|
+
"isLoading",
|
|
4399
|
+
"fontNormal"
|
|
4133
4400
|
]);
|
|
4134
4401
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
|
|
4135
4402
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -4156,6 +4423,15 @@ var Button = (_a) => {
|
|
|
4156
4423
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
4157
4424
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4158
4425
|
);
|
|
4426
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
|
|
4427
|
+
"bg-transparent border-transparent",
|
|
4428
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
4429
|
+
"bg-transparent border-transparent",
|
|
4430
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
4431
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
4432
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
4433
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4434
|
+
);
|
|
4159
4435
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
|
|
4160
4436
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
4161
4437
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -4199,6 +4475,7 @@ var Button = (_a) => {
|
|
|
4199
4475
|
primaryVariantStyles,
|
|
4200
4476
|
secondaryVariantStyles,
|
|
4201
4477
|
tertiaryVariantStyles,
|
|
4478
|
+
quarternaryOutlinedVariantStyles,
|
|
4202
4479
|
primaryCriticalVariantStyles,
|
|
4203
4480
|
secondaryCriticalVariantStyles,
|
|
4204
4481
|
tertiaryCriticalVariantStyles,
|
|
@@ -4209,6 +4486,7 @@ var Button = (_a) => {
|
|
|
4209
4486
|
const labelClasses = (0, import_clsx18.default)(
|
|
4210
4487
|
"min-h-6 flex items-center justify-center",
|
|
4211
4488
|
classNameLabel,
|
|
4489
|
+
fontNormal && "font-normal!",
|
|
4212
4490
|
componentPaddingXUsingComponentGap,
|
|
4213
4491
|
typography.buttonLabel
|
|
4214
4492
|
);
|
|
@@ -5314,7 +5592,8 @@ var ModalHeader = ({
|
|
|
5314
5592
|
id,
|
|
5315
5593
|
"data-testid": testid,
|
|
5316
5594
|
className: (0, import_clsx26.default)(
|
|
5317
|
-
"flex
|
|
5595
|
+
"flex items-center",
|
|
5596
|
+
headerIconAlign === void 0 && "justify-between",
|
|
5318
5597
|
headerIconAlign === "center" && "justify-center",
|
|
5319
5598
|
headerIconAlign === "right" && "justify-end",
|
|
5320
5599
|
headerIconAlign === "left" && "justify-start",
|
|
@@ -6145,7 +6424,7 @@ var import_react39 = require("react");
|
|
|
6145
6424
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6146
6425
|
|
|
6147
6426
|
// src/components/EmblaCarousel/index.tsx
|
|
6148
|
-
var import_react42 = require("react");
|
|
6427
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
6149
6428
|
var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
|
|
6150
6429
|
var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
|
|
6151
6430
|
|