@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
|
@@ -943,6 +943,9 @@ var useMatchesMedia = (query) => {
|
|
|
943
943
|
};
|
|
944
944
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
945
945
|
|
|
946
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
947
|
+
var import_react6 = require("react");
|
|
948
|
+
|
|
946
949
|
// src/utils/date.ts
|
|
947
950
|
function parseInputDate(input) {
|
|
948
951
|
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
@@ -1069,30 +1072,8 @@ function isValidDateRangeOrder(fromDate, toDate) {
|
|
|
1069
1072
|
return to >= from;
|
|
1070
1073
|
}
|
|
1071
1074
|
|
|
1072
|
-
// src/utils/mergeObjectArrays.ts
|
|
1073
|
-
function mergeObjectArrays(arr1, arr2) {
|
|
1074
|
-
const arr2Map = /* @__PURE__ */ new Map();
|
|
1075
|
-
for (const item of arr2) {
|
|
1076
|
-
const id = item.id;
|
|
1077
|
-
if (id !== void 0) {
|
|
1078
|
-
arr2Map.set(id, item);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
return arr1.map((item1) => {
|
|
1082
|
-
const id = item1.id;
|
|
1083
|
-
if (id !== void 0 && arr2Map.has(id)) {
|
|
1084
|
-
const item2 = arr2Map.get(id);
|
|
1085
|
-
const meta1 = item1.meta;
|
|
1086
|
-
const meta2 = item2.meta;
|
|
1087
|
-
const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
|
|
1088
|
-
return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
|
|
1089
|
-
}
|
|
1090
|
-
return item1;
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
1075
|
// src/utils/index.ts
|
|
1095
|
-
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.
|
|
1076
|
+
var LocalStoragePrefixVersion = `dmsi-acc-v1.1.5`;
|
|
1096
1077
|
|
|
1097
1078
|
// src/utils.ts
|
|
1098
1079
|
function findDocumentRoot(element) {
|
|
@@ -1117,74 +1098,366 @@ function findDocumentRoot(element) {
|
|
|
1117
1098
|
return window.document.body;
|
|
1118
1099
|
}
|
|
1119
1100
|
|
|
1120
|
-
// src/hooks/useTableLayout.ts
|
|
1121
|
-
var
|
|
1122
|
-
var
|
|
1123
|
-
var
|
|
1101
|
+
// src/hooks/useTableLayout/storage.ts
|
|
1102
|
+
var STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tablePrefs`;
|
|
1103
|
+
var LEGACY_STORAGE_PREFIX = `${LocalStoragePrefixVersion}-tableLayout`;
|
|
1104
|
+
var CURRENT_SCHEMA_VERSION = 2;
|
|
1105
|
+
function getStorageKey(key) {
|
|
1106
|
+
return `${STORAGE_PREFIX}__${key}`;
|
|
1107
|
+
}
|
|
1108
|
+
function getLegacyStorageKey(key) {
|
|
1109
|
+
return `${LEGACY_STORAGE_PREFIX}__${key}-tableLayout`;
|
|
1110
|
+
}
|
|
1111
|
+
function loadPreferences(key) {
|
|
1112
|
+
const storageKey = getStorageKey(key);
|
|
1113
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
1114
|
+
const newData = localStorage.getItem(storageKey);
|
|
1115
|
+
if (newData) {
|
|
1116
|
+
try {
|
|
1117
|
+
const parsed = JSON.parse(newData);
|
|
1118
|
+
if (parsed.version === CURRENT_SCHEMA_VERSION) {
|
|
1119
|
+
return parsed;
|
|
1120
|
+
}
|
|
1121
|
+
localStorage.removeItem(storageKey);
|
|
1122
|
+
} catch (e) {
|
|
1123
|
+
localStorage.removeItem(storageKey);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
const legacyData = localStorage.getItem(legacyKey);
|
|
1127
|
+
if (legacyData) {
|
|
1128
|
+
localStorage.removeItem(legacyKey);
|
|
1129
|
+
}
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
function savePreferences(key, preferences) {
|
|
1133
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1134
|
+
const storageKey = getStorageKey(key);
|
|
1135
|
+
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;
|
|
1136
|
+
if (!hasPreferences) {
|
|
1137
|
+
localStorage.removeItem(storageKey);
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
const data = __spreadProps(__spreadValues({}, preferences), {
|
|
1141
|
+
version: CURRENT_SCHEMA_VERSION
|
|
1142
|
+
});
|
|
1143
|
+
localStorage.setItem(storageKey, JSON.stringify(data));
|
|
1144
|
+
}
|
|
1145
|
+
function clearPreferences(key) {
|
|
1146
|
+
const storageKey = getStorageKey(key);
|
|
1147
|
+
const legacyKey = getLegacyStorageKey(key);
|
|
1148
|
+
localStorage.removeItem(storageKey);
|
|
1149
|
+
localStorage.removeItem(legacyKey);
|
|
1150
|
+
}
|
|
1151
|
+
function clearAllLegacyData() {
|
|
1152
|
+
if (typeof window === "undefined") return;
|
|
1153
|
+
const keysToRemove = [];
|
|
1154
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
1155
|
+
const key = localStorage.key(i);
|
|
1156
|
+
if ((key == null ? void 0 : key.includes("-tableLayout__")) && key.endsWith("-tableLayout")) {
|
|
1157
|
+
keysToRemove.push(key);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
keysToRemove.forEach((key) => {
|
|
1161
|
+
localStorage.removeItem(key);
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
function hasPerformedLegacyMigration() {
|
|
1165
|
+
if (typeof window === "undefined") return true;
|
|
1166
|
+
return localStorage.getItem(`${STORAGE_PREFIX}__migrated`) === "true";
|
|
1167
|
+
}
|
|
1168
|
+
function markLegacyMigrationComplete() {
|
|
1169
|
+
if (typeof window === "undefined") return;
|
|
1170
|
+
localStorage.setItem(`${STORAGE_PREFIX}__migrated`, "true");
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// src/hooks/useTableLayout/computeColumns.ts
|
|
1174
|
+
function computeColumnVisibility(column, preferences) {
|
|
1175
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1176
|
+
const columnId = column.id;
|
|
1177
|
+
if (!columnId) return true;
|
|
1178
|
+
const systemVisible = (_b = (_a = column.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
1179
|
+
const canUserToggle = (_d = (_c = column.meta) == null ? void 0 : _c.inVisibilityMenu) != null ? _d : true;
|
|
1180
|
+
if (!canUserToggle) {
|
|
1181
|
+
return systemVisible;
|
|
1182
|
+
}
|
|
1183
|
+
if (preferences) {
|
|
1184
|
+
if ((_e = preferences.hiddenByUser) == null ? void 0 : _e.includes(columnId)) {
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
1187
|
+
if ((_f = preferences.shownByUser) == null ? void 0 : _f.includes(columnId)) {
|
|
1188
|
+
return true;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
return systemVisible;
|
|
1192
|
+
}
|
|
1193
|
+
function applyPreferencesToColumns(systemColumns, preferences) {
|
|
1194
|
+
var _a;
|
|
1195
|
+
let columns = systemColumns.map((col) => __spreadProps(__spreadValues({}, col), {
|
|
1196
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
1197
|
+
// Compute visibility based on system + user preferences
|
|
1198
|
+
visible: computeColumnVisibility(col, preferences)
|
|
1199
|
+
})
|
|
1200
|
+
}));
|
|
1201
|
+
if ((_a = preferences == null ? void 0 : preferences.columnOrder) == null ? void 0 : _a.length) {
|
|
1202
|
+
const orderMap = new Map(
|
|
1203
|
+
preferences.columnOrder.map((id, index) => [id, index])
|
|
1204
|
+
);
|
|
1205
|
+
columns = columns.sort((a, b) => {
|
|
1206
|
+
var _a2, _b;
|
|
1207
|
+
const orderA = (_a2 = orderMap.get(a.id)) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
1208
|
+
const orderB = (_b = orderMap.get(b.id)) != null ? _b : Number.MAX_SAFE_INTEGER;
|
|
1209
|
+
if (orderA === Number.MAX_SAFE_INTEGER && orderB === Number.MAX_SAFE_INTEGER) {
|
|
1210
|
+
return 0;
|
|
1211
|
+
}
|
|
1212
|
+
return orderA - orderB;
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
if (preferences == null ? void 0 : preferences.columnWidths) {
|
|
1216
|
+
columns = columns.map((col) => {
|
|
1217
|
+
var _a2;
|
|
1218
|
+
const width = col.id ? (_a2 = preferences.columnWidths) == null ? void 0 : _a2[col.id] : void 0;
|
|
1219
|
+
if (width !== void 0) {
|
|
1220
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
1221
|
+
size: width
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
return col;
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
return columns;
|
|
1228
|
+
}
|
|
1229
|
+
function extractColumnOrder(columns) {
|
|
1230
|
+
return columns.filter((c) => c.id).map((c) => c.id);
|
|
1231
|
+
}
|
|
1232
|
+
function extractVisibilityChanges(columns, systemColumns) {
|
|
1233
|
+
const hiddenByUser = [];
|
|
1234
|
+
const shownByUser = [];
|
|
1235
|
+
columns.forEach((col) => {
|
|
1236
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1237
|
+
if (!col.id) return;
|
|
1238
|
+
const systemCol = systemColumns.find((c) => c.id === col.id);
|
|
1239
|
+
if (!systemCol) return;
|
|
1240
|
+
const systemVisible = (_b = (_a = systemCol.meta) == null ? void 0 : _a.visible) != null ? _b : true;
|
|
1241
|
+
const currentVisible = (_d = (_c = col.meta) == null ? void 0 : _c.visible) != null ? _d : true;
|
|
1242
|
+
const canToggle = (_f = (_e = systemCol.meta) == null ? void 0 : _e.inVisibilityMenu) != null ? _f : true;
|
|
1243
|
+
if (!canToggle) return;
|
|
1244
|
+
if (systemVisible && !currentVisible) {
|
|
1245
|
+
hiddenByUser.push(col.id);
|
|
1246
|
+
} else if (!systemVisible && currentVisible) {
|
|
1247
|
+
if (((_g = systemCol.meta) == null ? void 0 : _g.inVisibilityMenu) !== false) {
|
|
1248
|
+
shownByUser.push(col.id);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
return { hiddenByUser, shownByUser };
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// src/hooks/useTableLayout/useTableLayout.ts
|
|
1256
|
+
var hasCleanedLegacyDataThisSession = false;
|
|
1124
1257
|
function useTableLayout(initialColumns, key, autosync = true) {
|
|
1125
|
-
const [
|
|
1258
|
+
const [preferences, setPreferences] = (0, import_react6.useState)(null);
|
|
1259
|
+
const [columns, setColumnsState] = (0, import_react6.useState)(
|
|
1260
|
+
() => (
|
|
1261
|
+
// Initialize with system columns (no preferences applied yet)
|
|
1262
|
+
initialColumns.map((col) => __spreadValues({}, col))
|
|
1263
|
+
)
|
|
1264
|
+
);
|
|
1126
1265
|
const [isReady, setIsReady] = (0, import_react6.useState)(false);
|
|
1127
|
-
const isReadyRef = (0, import_react6.useRef)(false);
|
|
1128
1266
|
const keyRef = (0, import_react6.useRef)(key);
|
|
1267
|
+
const initialColumnsRef = (0, import_react6.useRef)(initialColumns);
|
|
1268
|
+
const preferencesRef = (0, import_react6.useRef)(preferences);
|
|
1269
|
+
const autosyncRef = (0, import_react6.useRef)(autosync);
|
|
1129
1270
|
(0, import_react6.useEffect)(() => {
|
|
1130
|
-
isReadyRef.current = isReady;
|
|
1131
1271
|
keyRef.current = key;
|
|
1132
|
-
}, [
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
return prevColumns;
|
|
1140
|
-
}
|
|
1141
|
-
localStorage.setItem(
|
|
1142
|
-
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
1143
|
-
JSON.stringify(newColumns)
|
|
1144
|
-
);
|
|
1145
|
-
return newColumns;
|
|
1146
|
-
});
|
|
1147
|
-
},
|
|
1148
|
-
[]
|
|
1149
|
-
);
|
|
1272
|
+
}, [key]);
|
|
1273
|
+
(0, import_react6.useEffect)(() => {
|
|
1274
|
+
initialColumnsRef.current = initialColumns;
|
|
1275
|
+
}, [initialColumns]);
|
|
1276
|
+
(0, import_react6.useEffect)(() => {
|
|
1277
|
+
preferencesRef.current = preferences;
|
|
1278
|
+
}, [preferences]);
|
|
1150
1279
|
(0, import_react6.useEffect)(() => {
|
|
1151
|
-
|
|
1280
|
+
autosyncRef.current = autosync;
|
|
1281
|
+
}, [autosync]);
|
|
1282
|
+
(0, import_react6.useEffect)(() => {
|
|
1283
|
+
if (typeof window === "undefined") return;
|
|
1284
|
+
if (!hasCleanedLegacyDataThisSession && !hasPerformedLegacyMigration()) {
|
|
1285
|
+
clearAllLegacyData();
|
|
1286
|
+
markLegacyMigrationComplete();
|
|
1287
|
+
hasCleanedLegacyDataThisSession = true;
|
|
1288
|
+
}
|
|
1289
|
+
}, []);
|
|
1290
|
+
(0, import_react6.useEffect)(() => {
|
|
1291
|
+
if (!autosync) {
|
|
1292
|
+
setIsReady(true);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1152
1295
|
if (!key) {
|
|
1153
1296
|
setIsReady(true);
|
|
1154
1297
|
return;
|
|
1155
1298
|
}
|
|
1156
|
-
const
|
|
1157
|
-
|
|
1299
|
+
const savedPrefs = loadPreferences(key);
|
|
1300
|
+
setPreferences(savedPrefs);
|
|
1301
|
+
const computedColumns = applyPreferencesToColumns(
|
|
1302
|
+
initialColumns,
|
|
1303
|
+
savedPrefs
|
|
1158
1304
|
);
|
|
1159
|
-
|
|
1160
|
-
setColumns(
|
|
1161
|
-
mergeObjectArrays(
|
|
1162
|
-
initialColumns,
|
|
1163
|
-
JSON.parse(savedLayout)
|
|
1164
|
-
)
|
|
1165
|
-
);
|
|
1166
|
-
} else {
|
|
1167
|
-
localStorage.setItem(
|
|
1168
|
-
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
1169
|
-
JSON.stringify(initialColumns)
|
|
1170
|
-
);
|
|
1171
|
-
setColumns((prev) => {
|
|
1172
|
-
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
1173
|
-
return prev;
|
|
1174
|
-
return initialColumns;
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1305
|
+
setColumnsState(computedColumns);
|
|
1177
1306
|
setIsReady(true);
|
|
1178
|
-
}, [
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1307
|
+
}, [key, autosync]);
|
|
1308
|
+
(0, import_react6.useEffect)(() => {
|
|
1309
|
+
if (!isReady) return;
|
|
1310
|
+
const computedColumns = applyPreferencesToColumns(
|
|
1311
|
+
initialColumns,
|
|
1312
|
+
preferencesRef.current
|
|
1182
1313
|
);
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1314
|
+
setColumnsState(computedColumns);
|
|
1315
|
+
}, [initialColumns, isReady]);
|
|
1316
|
+
const persistPreferences = (0, import_react6.useCallback)(
|
|
1317
|
+
(newPrefs) => {
|
|
1318
|
+
if (!keyRef.current) return;
|
|
1319
|
+
const updated = __spreadProps(__spreadValues(__spreadValues({}, preferencesRef.current), newPrefs), {
|
|
1320
|
+
version: 2
|
|
1321
|
+
});
|
|
1322
|
+
setPreferences(updated);
|
|
1323
|
+
if (autosyncRef.current) {
|
|
1324
|
+
savePreferences(keyRef.current, updated);
|
|
1325
|
+
}
|
|
1326
|
+
const computedColumns = applyPreferencesToColumns(
|
|
1327
|
+
initialColumnsRef.current,
|
|
1328
|
+
updated
|
|
1329
|
+
);
|
|
1330
|
+
setColumnsState(computedColumns);
|
|
1331
|
+
},
|
|
1332
|
+
[]
|
|
1333
|
+
);
|
|
1334
|
+
const hideColumn = (0, import_react6.useCallback)(
|
|
1335
|
+
(columnId) => {
|
|
1336
|
+
var _a, _b;
|
|
1337
|
+
const currentPrefs = preferencesRef.current;
|
|
1338
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
1339
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
1340
|
+
const newShown = currentShown.filter((id) => id !== columnId);
|
|
1341
|
+
const newHidden = currentHidden.includes(columnId) ? currentHidden : [...currentHidden, columnId];
|
|
1342
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
1343
|
+
hiddenByUser: newHidden,
|
|
1344
|
+
shownByUser: newShown
|
|
1345
|
+
}));
|
|
1346
|
+
},
|
|
1347
|
+
[persistPreferences]
|
|
1348
|
+
);
|
|
1349
|
+
const showColumn = (0, import_react6.useCallback)(
|
|
1350
|
+
(columnId) => {
|
|
1351
|
+
var _a, _b;
|
|
1352
|
+
const currentPrefs = preferencesRef.current;
|
|
1353
|
+
const currentHidden = (_a = currentPrefs == null ? void 0 : currentPrefs.hiddenByUser) != null ? _a : [];
|
|
1354
|
+
const currentShown = (_b = currentPrefs == null ? void 0 : currentPrefs.shownByUser) != null ? _b : [];
|
|
1355
|
+
const newHidden = currentHidden.filter((id) => id !== columnId);
|
|
1356
|
+
const newShown = currentShown.includes(columnId) ? currentShown : [...currentShown, columnId];
|
|
1357
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
1358
|
+
hiddenByUser: newHidden,
|
|
1359
|
+
shownByUser: newShown
|
|
1360
|
+
}));
|
|
1361
|
+
},
|
|
1362
|
+
[persistPreferences]
|
|
1363
|
+
);
|
|
1364
|
+
const reorderColumns = (0, import_react6.useCallback)(
|
|
1365
|
+
(columnIds) => {
|
|
1366
|
+
persistPreferences(__spreadProps(__spreadValues({}, preferencesRef.current), {
|
|
1367
|
+
columnOrder: columnIds
|
|
1368
|
+
}));
|
|
1369
|
+
},
|
|
1370
|
+
[persistPreferences]
|
|
1371
|
+
);
|
|
1372
|
+
const setColumnWidth = (0, import_react6.useCallback)(
|
|
1373
|
+
(columnId, width) => {
|
|
1374
|
+
var _a;
|
|
1375
|
+
const currentPrefs = preferencesRef.current;
|
|
1376
|
+
const currentWidths = (_a = currentPrefs == null ? void 0 : currentPrefs.columnWidths) != null ? _a : {};
|
|
1377
|
+
persistPreferences(__spreadProps(__spreadValues({}, currentPrefs), {
|
|
1378
|
+
columnWidths: __spreadProps(__spreadValues({}, currentWidths), { [columnId]: width })
|
|
1379
|
+
}));
|
|
1380
|
+
},
|
|
1381
|
+
[persistPreferences]
|
|
1382
|
+
);
|
|
1383
|
+
const resetToDefaults = (0, import_react6.useCallback)(() => {
|
|
1384
|
+
if (!keyRef.current) return;
|
|
1385
|
+
clearPreferences(keyRef.current);
|
|
1386
|
+
setPreferences(null);
|
|
1387
|
+
const computedColumns = applyPreferencesToColumns(
|
|
1388
|
+
initialColumnsRef.current,
|
|
1389
|
+
null
|
|
1390
|
+
);
|
|
1391
|
+
setColumnsState(computedColumns);
|
|
1392
|
+
}, []);
|
|
1393
|
+
const getUserPreferences = (0, import_react6.useCallback)(() => {
|
|
1394
|
+
var _a;
|
|
1395
|
+
return (_a = preferencesRef.current) != null ? _a : { version: 2 };
|
|
1396
|
+
}, []);
|
|
1397
|
+
const getSavedLayout = (0, import_react6.useCallback)(() => {
|
|
1398
|
+
return columns;
|
|
1399
|
+
}, [columns]);
|
|
1400
|
+
const setColumns = (0, import_react6.useCallback)(
|
|
1401
|
+
(setter) => {
|
|
1402
|
+
setColumnsState((prev) => {
|
|
1403
|
+
var _a, _b, _c, _d;
|
|
1404
|
+
const newColumns = typeof setter === "function" ? setter(prev) : setter;
|
|
1405
|
+
const newOrder = extractColumnOrder(newColumns);
|
|
1406
|
+
const { hiddenByUser, shownByUser } = extractVisibilityChanges(
|
|
1407
|
+
newColumns,
|
|
1408
|
+
initialColumnsRef.current
|
|
1409
|
+
);
|
|
1410
|
+
const existingPrefs = preferencesRef.current;
|
|
1411
|
+
const mergedHidden = Array.from(
|
|
1412
|
+
/* @__PURE__ */ new Set([
|
|
1413
|
+
...hiddenByUser,
|
|
1414
|
+
// Keep existing hidden prefs for columns that are still hidden
|
|
1415
|
+
...(_b = (_a = existingPrefs == null ? void 0 : existingPrefs.hiddenByUser) == null ? void 0 : _a.filter((id) => {
|
|
1416
|
+
var _a2;
|
|
1417
|
+
const col = newColumns.find((c) => c.id === id);
|
|
1418
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) === false;
|
|
1419
|
+
})) != null ? _b : []
|
|
1420
|
+
])
|
|
1421
|
+
);
|
|
1422
|
+
const mergedShown = Array.from(
|
|
1423
|
+
/* @__PURE__ */ new Set([
|
|
1424
|
+
...shownByUser,
|
|
1425
|
+
// Keep existing shown prefs for columns that are still visible
|
|
1426
|
+
...(_d = (_c = existingPrefs == null ? void 0 : existingPrefs.shownByUser) == null ? void 0 : _c.filter((id) => {
|
|
1427
|
+
var _a2;
|
|
1428
|
+
const col = newColumns.find((c) => c.id === id);
|
|
1429
|
+
return col && ((_a2 = col.meta) == null ? void 0 : _a2.visible) !== false;
|
|
1430
|
+
})) != null ? _d : []
|
|
1431
|
+
])
|
|
1432
|
+
);
|
|
1433
|
+
if (keyRef.current && autosync) {
|
|
1434
|
+
const newPrefs = {
|
|
1435
|
+
columnOrder: newOrder,
|
|
1436
|
+
hiddenByUser: mergedHidden,
|
|
1437
|
+
shownByUser: mergedShown,
|
|
1438
|
+
columnWidths: existingPrefs == null ? void 0 : existingPrefs.columnWidths,
|
|
1439
|
+
version: 2
|
|
1440
|
+
};
|
|
1441
|
+
setPreferences(newPrefs);
|
|
1442
|
+
savePreferences(keyRef.current, newPrefs);
|
|
1443
|
+
}
|
|
1444
|
+
return newColumns;
|
|
1445
|
+
});
|
|
1446
|
+
},
|
|
1447
|
+
[autosync]
|
|
1448
|
+
);
|
|
1449
|
+
return {
|
|
1450
|
+
columns,
|
|
1451
|
+
setColumns,
|
|
1452
|
+
isReady,
|
|
1453
|
+
getSavedLayout,
|
|
1454
|
+
hideColumn,
|
|
1455
|
+
showColumn,
|
|
1456
|
+
reorderColumns,
|
|
1457
|
+
setColumnWidth,
|
|
1458
|
+
resetToDefaults,
|
|
1459
|
+
getUserPreferences
|
|
1460
|
+
};
|
|
1188
1461
|
}
|
|
1189
1462
|
|
|
1190
1463
|
// src/hooks/useEditCell.tsx
|
|
@@ -3318,7 +3591,8 @@ function DataGrid({
|
|
|
3318
3591
|
const {
|
|
3319
3592
|
columns: tableColumns,
|
|
3320
3593
|
setColumns: setTableColumns,
|
|
3321
|
-
getSavedLayout
|
|
3594
|
+
getSavedLayout,
|
|
3595
|
+
resetToDefaults
|
|
3322
3596
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3323
3597
|
const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
|
|
3324
3598
|
tableColumns.map((c) => c.id)
|
|
@@ -3346,21 +3620,8 @@ function DataGrid({
|
|
|
3346
3620
|
[tableColumns]
|
|
3347
3621
|
);
|
|
3348
3622
|
const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
var _a2, _b2;
|
|
3352
|
-
const columnId = column.id;
|
|
3353
|
-
const isVisible = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
3354
|
-
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
3355
|
-
if (persistedIndex !== -1) {
|
|
3356
|
-
prev[persistedIndex].meta = __spreadProps(__spreadValues({}, prev[persistedIndex].meta), {
|
|
3357
|
-
visible: isVisible
|
|
3358
|
-
});
|
|
3359
|
-
}
|
|
3360
|
-
});
|
|
3361
|
-
return [...prev];
|
|
3362
|
-
}, true);
|
|
3363
|
-
}, [columns, setTableColumns]);
|
|
3623
|
+
resetToDefaults();
|
|
3624
|
+
}, [resetToDefaults]);
|
|
3364
3625
|
(0, import_react17.useEffect)(() => {
|
|
3365
3626
|
updateColumnVisibility(true);
|
|
3366
3627
|
}, [updateColumnVisibility]);
|
|
@@ -3396,14 +3657,18 @@ function DataGrid({
|
|
|
3396
3657
|
const toggleColumnVisibility = (0, import_react17.useCallback)(
|
|
3397
3658
|
(columnId, isVisible) => {
|
|
3398
3659
|
setTableColumns((prev) => {
|
|
3399
|
-
const
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3660
|
+
const newColumns = prev.map((col) => {
|
|
3661
|
+
if (col.id === columnId) {
|
|
3662
|
+
return __spreadProps(__spreadValues({}, col), {
|
|
3663
|
+
meta: __spreadProps(__spreadValues({}, col.meta), {
|
|
3664
|
+
visible: isVisible
|
|
3665
|
+
})
|
|
3666
|
+
});
|
|
3667
|
+
}
|
|
3668
|
+
return col;
|
|
3669
|
+
});
|
|
3670
|
+
return newColumns;
|
|
3671
|
+
});
|
|
3407
3672
|
},
|
|
3408
3673
|
[setTableColumns]
|
|
3409
3674
|
);
|
|
@@ -4175,7 +4440,8 @@ var Button = (_a) => {
|
|
|
4175
4440
|
href,
|
|
4176
4441
|
id,
|
|
4177
4442
|
testid,
|
|
4178
|
-
isLoading
|
|
4443
|
+
isLoading,
|
|
4444
|
+
fontNormal = false
|
|
4179
4445
|
} = _b, props = __objRest(_b, [
|
|
4180
4446
|
"variant",
|
|
4181
4447
|
"as",
|
|
@@ -4191,7 +4457,8 @@ var Button = (_a) => {
|
|
|
4191
4457
|
"href",
|
|
4192
4458
|
"id",
|
|
4193
4459
|
"testid",
|
|
4194
|
-
"isLoading"
|
|
4460
|
+
"isLoading",
|
|
4461
|
+
"fontNormal"
|
|
4195
4462
|
]);
|
|
4196
4463
|
const primaryVariantStyles = variant === "primary" && (0, import_clsx18.default)(
|
|
4197
4464
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
@@ -4218,6 +4485,15 @@ var Button = (_a) => {
|
|
|
4218
4485
|
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
4219
4486
|
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4220
4487
|
);
|
|
4488
|
+
const quarternaryOutlinedVariantStyles = variant === "quarternary-outlined" && (0, import_clsx18.default)(
|
|
4489
|
+
"bg-transparent border-transparent",
|
|
4490
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-primary-normal",
|
|
4491
|
+
"bg-transparent border-transparent",
|
|
4492
|
+
"hover:bg-transparent hover:border-border-primary-normal hover:text-text-primary-normal",
|
|
4493
|
+
"focus:bg-transparent focus:border-border-primary-normal focus:text-text-primary-normal focus:outline-0",
|
|
4494
|
+
"active:bg-transparent active:border-transparent active:text-text-primary-active",
|
|
4495
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
4496
|
+
);
|
|
4221
4497
|
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx18.default)(
|
|
4222
4498
|
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
4223
4499
|
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
@@ -4261,6 +4537,7 @@ var Button = (_a) => {
|
|
|
4261
4537
|
primaryVariantStyles,
|
|
4262
4538
|
secondaryVariantStyles,
|
|
4263
4539
|
tertiaryVariantStyles,
|
|
4540
|
+
quarternaryOutlinedVariantStyles,
|
|
4264
4541
|
primaryCriticalVariantStyles,
|
|
4265
4542
|
secondaryCriticalVariantStyles,
|
|
4266
4543
|
tertiaryCriticalVariantStyles,
|
|
@@ -4271,6 +4548,7 @@ var Button = (_a) => {
|
|
|
4271
4548
|
const labelClasses = (0, import_clsx18.default)(
|
|
4272
4549
|
"min-h-6 flex items-center justify-center",
|
|
4273
4550
|
classNameLabel,
|
|
4551
|
+
fontNormal && "font-normal!",
|
|
4274
4552
|
componentPaddingXUsingComponentGap,
|
|
4275
4553
|
typography.buttonLabel
|
|
4276
4554
|
);
|
|
@@ -4911,7 +5189,8 @@ var ModalHeader = ({
|
|
|
4911
5189
|
id,
|
|
4912
5190
|
"data-testid": testid,
|
|
4913
5191
|
className: (0, import_clsx25.default)(
|
|
4914
|
-
"flex
|
|
5192
|
+
"flex items-center",
|
|
5193
|
+
headerIconAlign === void 0 && "justify-between",
|
|
4915
5194
|
headerIconAlign === "center" && "justify-center",
|
|
4916
5195
|
headerIconAlign === "right" && "justify-end",
|
|
4917
5196
|
headerIconAlign === "left" && "justify-start",
|
|
@@ -5742,7 +6021,7 @@ var import_react39 = require("react");
|
|
|
5742
6021
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
5743
6022
|
|
|
5744
6023
|
// src/components/EmblaCarousel/index.tsx
|
|
5745
|
-
var import_react42 = require("react");
|
|
6024
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
5746
6025
|
var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
|
|
5747
6026
|
var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
|
|
5748
6027
|
|