@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
|
|
@@ -3267,7 +3540,8 @@ function DataGrid({
|
|
|
3267
3540
|
const {
|
|
3268
3541
|
columns: tableColumns,
|
|
3269
3542
|
setColumns: setTableColumns,
|
|
3270
|
-
getSavedLayout
|
|
3543
|
+
getSavedLayout,
|
|
3544
|
+
resetToDefaults
|
|
3271
3545
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3272
3546
|
const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
|
|
3273
3547
|
tableColumns.map((c) => c.id)
|
|
@@ -3295,21 +3569,8 @@ function DataGrid({
|
|
|
3295
3569
|
[tableColumns]
|
|
3296
3570
|
);
|
|
3297
3571
|
const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
var _a2, _b2;
|
|
3301
|
-
const columnId = column.id;
|
|
3302
|
-
const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
3303
|
-
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
3304
|
-
if (persistedIndex !== -1) {
|
|
3305
|
-
prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
|
|
3306
|
-
visible: isVisible
|
|
3307
|
-
});
|
|
3308
|
-
}
|
|
3309
|
-
});
|
|
3310
|
-
return [...prev];
|
|
3311
|
-
}, true);
|
|
3312
|
-
}, [columns, setTableColumns]);
|
|
3572
|
+
resetToDefaults();
|
|
3573
|
+
}, [resetToDefaults]);
|
|
3313
3574
|
(0, import_react17.useEffect)(() => {
|
|
3314
3575
|
updateColumnVisibility(true);
|
|
3315
3576
|
}, [updateColumnVisibility]);
|
|
@@ -3345,14 +3606,18 @@ function DataGrid({
|
|
|
3345
3606
|
const toggleColumnVisibility = (0, import_react17.useCallback)(
|
|
3346
3607
|
(columnId, isVisible) => {
|
|
3347
3608
|
setTableColumns((prev) => {
|
|
3348
|
-
const
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3609
|
+
const newColumns = prev.map((col) => {
|
|
3610
|
+
if (col.id === columnId) {
|
|
3611
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
3612
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
3613
|
+
visible: isVisible
|
|
3614
|
+
})
|
|
3615
|
+
});
|
|
3616
|
+
}
|
|
3617
|
+
return col;
|
|
3618
|
+
});
|
|
3619
|
+
return newColumns;
|
|
3620
|
+
});
|
|
3356
3621
|
},
|
|
3357
3622
|
[setTableColumns]
|
|
3358
3623
|
);
|
|
@@ -4124,7 +4389,8 @@ var Button = (_a) => {
|
|
|
4124
4389
|
href,
|
|
4125
4390
|
id,
|
|
4126
4391
|
testid,
|
|
4127
|
-
isLoading
|
|
4392
|
+
isLoading,
|
|
4393
|
+
fontNormal = false
|
|
4128
4394
|
} = _b, props = __objRest(_b, [
|
|
4129
4395
|
"variant",
|
|
4130
4396
|
"as",
|
|
@@ -4140,7 +4406,8 @@ var Button = (_a) => {
|
|
|
4140
4406
|
"href",
|
|
4141
4407
|
"id",
|
|
4142
4408
|
"testid",
|
|
4143
|
-
"isLoading"
|
|
4409
|
+
"isLoading",
|
|
4410
|
+
"fontNormal"
|
|
4144
4411
|
]);
|
|
4145
4412
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx17.default)(
|
|
4146
4413
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -4167,6 +4434,15 @@ var Button = (_a) => {
|
|
|
4167
4434
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
4168
4435
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4169
4436
|
);
|
|
4437
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx17.default)(
|
|
4438
|
+
"bg-transparent border-transparent",
|
|
4439
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
4440
|
+
"bg-transparent border-transparent",
|
|
4441
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
4442
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
4443
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
4444
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4445
|
+
);
|
|
4170
4446
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx17.default)(
|
|
4171
4447
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
4172
4448
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -4210,6 +4486,7 @@ var Button = (_a) => {
|
|
|
4210
4486
|
primaryVariantStyles,
|
|
4211
4487
|
secondaryVariantStyles,
|
|
4212
4488
|
tertiaryVariantStyles,
|
|
4489
|
+
quarternaryOutlinedVariantStyles,
|
|
4213
4490
|
primaryCriticalVariantStyles,
|
|
4214
4491
|
secondaryCriticalVariantStyles,
|
|
4215
4492
|
tertiaryCriticalVariantStyles,
|
|
@@ -4220,6 +4497,7 @@ var Button = (_a) => {
|
|
|
4220
4497
|
const labelClasses = (0, import_clsx17.default)(
|
|
4221
4498
|
"min-h-6 flex items-center justify-center",
|
|
4222
4499
|
classNameLabel,
|
|
4500
|
+
fontNormal && "font-normal!",
|
|
4223
4501
|
componentPaddingXUsingComponentGap,
|
|
4224
4502
|
typography.buttonLabel
|
|
4225
4503
|
);
|
|
@@ -5325,7 +5603,8 @@ var ModalHeader = ({
|
|
|
5325
5603
|
id,
|
|
5326
5604
|
"data-testid": testid,
|
|
5327
5605
|
className: (0, import_clsx25.default)(
|
|
5328
|
-
"flex
|
|
5606
|
+
"flex items-center",
|
|
5607
|
+
headerIconAlign === void 0 && "justify-between",
|
|
5329
5608
|
headerIconAlign === "center" && "justify-center",
|
|
5330
5609
|
headerIconAlign === "right" && "justify-end",
|
|
5331
5610
|
headerIconAlign === "left" && "justify-start",
|
|
@@ -6156,7 +6435,7 @@ var import_react40 = require("react");
|
|
|
6156
6435
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6157
6436
|
|
|
6158
6437
|
// src/components/EmblaCarousel/index.tsx
|
|
6159
|
-
var import_react43 = require("react");
|
|
6438
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
6160
6439
|
var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
|
|
6161
6440
|
var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
|
|
6162
6441
|
|