@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
|
|
@@ -3023,7 +3296,8 @@ function DataGrid({
|
|
|
3023
3296
|
const {
|
|
3024
3297
|
columns: tableColumns,
|
|
3025
3298
|
setColumns: setTableColumns,
|
|
3026
|
-
getSavedLayout
|
|
3299
|
+
getSavedLayout,
|
|
3300
|
+
resetToDefaults
|
|
3027
3301
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3028
3302
|
const [columnOrder, setColumnOrder] = (0, import_react14.useState)(
|
|
3029
3303
|
tableColumns.map((c) => c.id)
|
|
@@ -3051,21 +3325,8 @@ function DataGrid({
|
|
|
3051
3325
|
[tableColumns]
|
|
3052
3326
|
);
|
|
3053
3327
|
const resetDefaultColumnVisibility = (0, import_react14.useCallback)(() => {
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
var _a2, _b2;
|
|
3057
|
-
const columnId = column.id;
|
|
3058
|
-
const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
3059
|
-
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
3060
|
-
if (persistedIndex !== -1) {
|
|
3061
|
-
prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
|
|
3062
|
-
visible: isVisible
|
|
3063
|
-
});
|
|
3064
|
-
}
|
|
3065
|
-
});
|
|
3066
|
-
return [...prev];
|
|
3067
|
-
}, true);
|
|
3068
|
-
}, [columns, setTableColumns]);
|
|
3328
|
+
resetToDefaults();
|
|
3329
|
+
}, [resetToDefaults]);
|
|
3069
3330
|
(0, import_react14.useEffect)(() => {
|
|
3070
3331
|
updateColumnVisibility(true);
|
|
3071
3332
|
}, [updateColumnVisibility]);
|
|
@@ -3101,14 +3362,18 @@ function DataGrid({
|
|
|
3101
3362
|
const toggleColumnVisibility = (0, import_react14.useCallback)(
|
|
3102
3363
|
(columnId, isVisible) => {
|
|
3103
3364
|
setTableColumns((prev) => {
|
|
3104
|
-
const
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3365
|
+
const newColumns = prev.map((col) => {
|
|
3366
|
+
if (col.id === columnId) {
|
|
3367
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
3368
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
3369
|
+
visible: isVisible
|
|
3370
|
+
})
|
|
3371
|
+
});
|
|
3372
|
+
}
|
|
3373
|
+
return col;
|
|
3374
|
+
});
|
|
3375
|
+
return newColumns;
|
|
3376
|
+
});
|
|
3112
3377
|
},
|
|
3113
3378
|
[setTableColumns]
|
|
3114
3379
|
);
|
|
@@ -3880,7 +4145,8 @@ var Button = (_a) => {
|
|
|
3880
4145
|
href,
|
|
3881
4146
|
id,
|
|
3882
4147
|
testid,
|
|
3883
|
-
isLoading
|
|
4148
|
+
isLoading,
|
|
4149
|
+
fontNormal = false
|
|
3884
4150
|
} = _b, props = __objRest(_b, [
|
|
3885
4151
|
"variant",
|
|
3886
4152
|
"as",
|
|
@@ -3896,7 +4162,8 @@ var Button = (_a) => {
|
|
|
3896
4162
|
"href",
|
|
3897
4163
|
"id",
|
|
3898
4164
|
"testid",
|
|
3899
|
-
"isLoading"
|
|
4165
|
+
"isLoading",
|
|
4166
|
+
"fontNormal"
|
|
3900
4167
|
]);
|
|
3901
4168
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx17.default)(
|
|
3902
4169
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -3923,6 +4190,15 @@ var Button = (_a) => {
|
|
|
3923
4190
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
3924
4191
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
3925
4192
|
);
|
|
4193
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx17.default)(
|
|
4194
|
+
"bg-transparent border-transparent",
|
|
4195
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
4196
|
+
"bg-transparent border-transparent",
|
|
4197
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
4198
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
4199
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
4200
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4201
|
+
);
|
|
3926
4202
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx17.default)(
|
|
3927
4203
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
3928
4204
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -3966,6 +4242,7 @@ var Button = (_a) => {
|
|
|
3966
4242
|
primaryVariantStyles,
|
|
3967
4243
|
secondaryVariantStyles,
|
|
3968
4244
|
tertiaryVariantStyles,
|
|
4245
|
+
quarternaryOutlinedVariantStyles,
|
|
3969
4246
|
primaryCriticalVariantStyles,
|
|
3970
4247
|
secondaryCriticalVariantStyles,
|
|
3971
4248
|
tertiaryCriticalVariantStyles,
|
|
@@ -3976,6 +4253,7 @@ var Button = (_a) => {
|
|
|
3976
4253
|
const labelClasses = (0, import_clsx17.default)(
|
|
3977
4254
|
"min-h-6 flex items-center justify-center",
|
|
3978
4255
|
classNameLabel,
|
|
4256
|
+
fontNormal && "font-normal!",
|
|
3979
4257
|
componentPaddingXUsingComponentGap,
|
|
3980
4258
|
typography.buttonLabel
|
|
3981
4259
|
);
|
|
@@ -5081,7 +5359,8 @@ var ModalHeader = ({
|
|
|
5081
5359
|
id,
|
|
5082
5360
|
"data-testid": testid,
|
|
5083
5361
|
className: (0, import_clsx25.default)(
|
|
5084
|
-
"flex
|
|
5362
|
+
"flex items-center",
|
|
5363
|
+
headerIconAlign === void 0 && "justify-between",
|
|
5085
5364
|
headerIconAlign === "center" && "justify-center",
|
|
5086
5365
|
headerIconAlign === "right" && "justify-end",
|
|
5087
5366
|
headerIconAlign === "left" && "justify-start",
|
|
@@ -5912,7 +6191,7 @@ var import_react37 = require("react");
|
|
|
5912
6191
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
5913
6192
|
|
|
5914
6193
|
// src/components/EmblaCarousel/index.tsx
|
|
5915
|
-
var import_react40 = require("react");
|
|
6194
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
5916
6195
|
var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
|
|
5917
6196
|
var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
|
|
5918
6197
|
|