@jmruthers/pace-core 0.5.97 → 0.5.99
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/{DataTable-FB22ES46.js → DataTable-VSJWLCVT.js} +4 -2
- package/dist/{chunk-UBPRDNPY.js → chunk-2PWJ6NFH.js} +2 -2
- package/dist/{chunk-QX5I62KP.js → chunk-D7CZVI3K.js} +167 -17
- package/dist/{chunk-QX5I62KP.js.map → chunk-D7CZVI3K.js.map} +1 -1
- package/dist/components.js +2 -2
- package/dist/index.js +2 -2
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UseEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +2 -2
- package/package.json +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +60 -16
- package/src/components/DataTable/components/DataTableModals.tsx +67 -8
- package/src/components/DataTable/utils/exportUtils.ts +115 -0
- /package/dist/{DataTable-FB22ES46.js.map → DataTable-VSJWLCVT.js.map} +0 -0
- /package/dist/{chunk-UBPRDNPY.js.map → chunk-2PWJ6NFH.js.map} +0 -0
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
createHierarchicalStructure,
|
|
34
34
|
defaultDataTableFeatures,
|
|
35
35
|
exportToCSV,
|
|
36
|
+
exportToCSVWithTableRows,
|
|
36
37
|
generateCSVContent,
|
|
37
38
|
getAriaSortValue,
|
|
38
39
|
getCellRenderer,
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
sortHierarchicalDataWithSorting,
|
|
54
55
|
validateHierarchicalData,
|
|
55
56
|
validatePaginationConfig
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-D7CZVI3K.js";
|
|
57
58
|
import "./chunk-2KLAOD4M.js";
|
|
58
59
|
import "./chunk-S63MFSY6.js";
|
|
59
60
|
import "./chunk-Q7APDV6H.js";
|
|
@@ -130,6 +131,7 @@ export {
|
|
|
130
131
|
defaultDataTableFeatures,
|
|
131
132
|
determinePaginationMode,
|
|
132
133
|
exportToCSV,
|
|
134
|
+
exportToCSVWithTableRows,
|
|
133
135
|
generateCSVContent,
|
|
134
136
|
getAriaSortValue,
|
|
135
137
|
getCellRenderer,
|
|
@@ -155,4 +157,4 @@ export {
|
|
|
155
157
|
validateHierarchicalData,
|
|
156
158
|
validatePaginationConfig
|
|
157
159
|
};
|
|
158
|
-
//# sourceMappingURL=DataTable-
|
|
160
|
+
//# sourceMappingURL=DataTable-VSJWLCVT.js.map
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
SelectSeparator,
|
|
26
26
|
SelectTrigger,
|
|
27
27
|
SelectValue
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-D7CZVI3K.js";
|
|
29
29
|
import {
|
|
30
30
|
isPermitted,
|
|
31
31
|
isSuperAdmin
|
|
@@ -4799,4 +4799,4 @@ export {
|
|
|
4799
4799
|
EventLogoCompact,
|
|
4800
4800
|
EventLogoLarge
|
|
4801
4801
|
};
|
|
4802
|
-
//# sourceMappingURL=chunk-
|
|
4802
|
+
//# sourceMappingURL=chunk-2PWJ6NFH.js.map
|
|
@@ -8916,31 +8916,60 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
8916
8916
|
import { Fragment as Fragment3, jsx as jsx19 } from "react/jsx-runtime";
|
|
8917
8917
|
function mapCSVToTableColumns(csvData, columns) {
|
|
8918
8918
|
const columnMap = /* @__PURE__ */ new Map();
|
|
8919
|
+
console.log("[mapCSVToTableColumns] Building column map from", columns.length, "column definitions");
|
|
8919
8920
|
columns.forEach((col) => {
|
|
8920
8921
|
const fieldName = col.editAccessorKey || col.accessorKey || col.id;
|
|
8921
8922
|
const header = typeof col.header === "string" ? col.header : "";
|
|
8922
8923
|
if (fieldName && header) {
|
|
8923
8924
|
columnMap.set(header.toLowerCase(), fieldName);
|
|
8925
|
+
console.log(`[mapCSVToTableColumns] Mapped "${header}" -> "${fieldName}"`);
|
|
8924
8926
|
const colId = col.id || col.accessorKey;
|
|
8925
8927
|
if (colId && colId !== header && colId !== fieldName) {
|
|
8926
8928
|
columnMap.set(colId.toLowerCase(), fieldName);
|
|
8929
|
+
console.log(`[mapCSVToTableColumns] Also mapped "${colId}" -> "${fieldName}"`);
|
|
8927
8930
|
}
|
|
8928
8931
|
if (col.editAccessorKey && header) {
|
|
8929
8932
|
const idColumnHeader = `${header} (ID)`;
|
|
8930
8933
|
columnMap.set(idColumnHeader.toLowerCase(), col.editAccessorKey);
|
|
8934
|
+
console.log(`[mapCSVToTableColumns] Mapped ID column "${idColumnHeader}" -> "${col.editAccessorKey}"`);
|
|
8931
8935
|
columnMap.set(col.editAccessorKey.toLowerCase(), col.editAccessorKey);
|
|
8936
|
+
console.log(`[mapCSVToTableColumns] Also mapped "${col.editAccessorKey}" -> "${col.editAccessorKey}"`);
|
|
8932
8937
|
}
|
|
8938
|
+
} else {
|
|
8939
|
+
console.warn("[mapCSVToTableColumns] Skipping column with missing fieldName or header:", col);
|
|
8933
8940
|
}
|
|
8934
8941
|
});
|
|
8935
|
-
|
|
8942
|
+
if (csvData.length === 0) {
|
|
8943
|
+
console.warn("[mapCSVToTableColumns] No CSV data to map");
|
|
8944
|
+
return [];
|
|
8945
|
+
}
|
|
8946
|
+
const csvHeaders = Object.keys(csvData[0]);
|
|
8947
|
+
console.log("[mapCSVToTableColumns] CSV headers found:", csvHeaders);
|
|
8948
|
+
console.log("[mapCSVToTableColumns] Column map size:", columnMap.size);
|
|
8949
|
+
const mappedData = csvData.map((row, index) => {
|
|
8936
8950
|
const mappedRow = {};
|
|
8937
8951
|
Object.keys(row).forEach((csvHeader) => {
|
|
8938
8952
|
const csvHeaderLower = csvHeader.toLowerCase();
|
|
8939
|
-
const fieldName = columnMap.get(csvHeaderLower)
|
|
8940
|
-
|
|
8953
|
+
const fieldName = columnMap.get(csvHeaderLower);
|
|
8954
|
+
if (fieldName) {
|
|
8955
|
+
mappedRow[fieldName] = row[csvHeader];
|
|
8956
|
+
if (index === 0) {
|
|
8957
|
+
console.log(`[mapCSVToTableColumns] Row 0: "${csvHeader}" -> "${fieldName}"`);
|
|
8958
|
+
}
|
|
8959
|
+
} else {
|
|
8960
|
+
mappedRow[csvHeaderLower] = row[csvHeader];
|
|
8961
|
+
if (index === 0) {
|
|
8962
|
+
console.warn(`[mapCSVToTableColumns] No mapping found for "${csvHeader}", using as-is`);
|
|
8963
|
+
}
|
|
8964
|
+
}
|
|
8941
8965
|
});
|
|
8942
8966
|
return mappedRow;
|
|
8943
8967
|
});
|
|
8968
|
+
console.log("[mapCSVToTableColumns] Mapped", mappedData.length, "rows");
|
|
8969
|
+
if (mappedData.length > 0) {
|
|
8970
|
+
console.log("[mapCSVToTableColumns] First mapped row keys:", Object.keys(mappedData[0]));
|
|
8971
|
+
}
|
|
8972
|
+
return mappedData;
|
|
8944
8973
|
}
|
|
8945
8974
|
function DataTableModals({
|
|
8946
8975
|
showImportModal,
|
|
@@ -8967,10 +8996,30 @@ function DataTableModals({
|
|
|
8967
8996
|
isOpen: showImportModal,
|
|
8968
8997
|
onClose: onCloseImportModal,
|
|
8969
8998
|
onImport: async (rawData) => {
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8999
|
+
try {
|
|
9000
|
+
let mappedData;
|
|
9001
|
+
if (columns && columns.length > 0) {
|
|
9002
|
+
console.log("[DataTableModals] Mapping CSV data with", columns.length, "column definitions");
|
|
9003
|
+
console.log("[DataTableModals] Raw CSV headers:", rawData.length > 0 ? Object.keys(rawData[0]) : []);
|
|
9004
|
+
mappedData = mapCSVToTableColumns(rawData, columns);
|
|
9005
|
+
console.log("[DataTableModals] Mapped data sample:", mappedData.length > 0 ? mappedData[0] : null);
|
|
9006
|
+
} else {
|
|
9007
|
+
console.warn("[DataTableModals] No columns provided for mapping, using raw data");
|
|
9008
|
+
mappedData = rawData;
|
|
9009
|
+
}
|
|
9010
|
+
if (!onImport) {
|
|
9011
|
+
console.error("[DataTableModals] onImport callback is not provided");
|
|
9012
|
+
throw new Error("Import handler is not configured. Please provide an onImport callback.");
|
|
9013
|
+
}
|
|
9014
|
+
console.log("[DataTableModals] Calling onImport with", mappedData.length, "rows");
|
|
9015
|
+
const result = onImport(mappedData);
|
|
9016
|
+
if (result && typeof result.then === "function") {
|
|
9017
|
+
await result;
|
|
9018
|
+
}
|
|
9019
|
+
console.log("[DataTableModals] Import completed successfully");
|
|
9020
|
+
} catch (error) {
|
|
9021
|
+
console.error("[DataTableModals] Import error:", error);
|
|
9022
|
+
throw error;
|
|
8974
9023
|
}
|
|
8975
9024
|
},
|
|
8976
9025
|
config: importModalConfig
|
|
@@ -10274,6 +10323,76 @@ function generateCSVContent(data, columns, options = {}) {
|
|
|
10274
10323
|
const csvContent = includeHeaders ? [headers.join(","), ...csvData].join("\n") : csvData.join("\n");
|
|
10275
10324
|
return csvContent;
|
|
10276
10325
|
}
|
|
10326
|
+
async function exportToCSVWithTableRows(tableRows, columns, columnIdToTableColumn, filename = "download.csv", options = {}) {
|
|
10327
|
+
const logger = createLogger("ExportUtils");
|
|
10328
|
+
return new Promise((resolve, reject) => {
|
|
10329
|
+
try {
|
|
10330
|
+
if (typeof window === "undefined") {
|
|
10331
|
+
throw new Error("CSV export is only available in browser environments");
|
|
10332
|
+
}
|
|
10333
|
+
if (!tableRows || tableRows.length === 0) {
|
|
10334
|
+
throw new Error("No data to export");
|
|
10335
|
+
}
|
|
10336
|
+
if (!columns || columns.length === 0) {
|
|
10337
|
+
throw new Error("No columns defined for export");
|
|
10338
|
+
}
|
|
10339
|
+
const headers = columns.map((col) => {
|
|
10340
|
+
const headerValue = col.header || col.id || "Column";
|
|
10341
|
+
return escapeCSVValue(headerValue, options.sanitizeForSecurity !== false);
|
|
10342
|
+
});
|
|
10343
|
+
const csvData = tableRows.map((tableRow) => {
|
|
10344
|
+
return columns.map((col) => {
|
|
10345
|
+
let value;
|
|
10346
|
+
if (col.isIdColumn && col.accessorKey) {
|
|
10347
|
+
value = tableRow.original[col.accessorKey];
|
|
10348
|
+
} else if (col.id && columnIdToTableColumn.has(col.id)) {
|
|
10349
|
+
try {
|
|
10350
|
+
value = tableRow.getValue(col.id);
|
|
10351
|
+
} catch (error) {
|
|
10352
|
+
if (col.accessorFn) {
|
|
10353
|
+
try {
|
|
10354
|
+
value = col.accessorFn(tableRow.original);
|
|
10355
|
+
} catch (accessorError) {
|
|
10356
|
+
console.warn("Error evaluating accessorFn for column:", col.id || col.header, accessorError);
|
|
10357
|
+
value = void 0;
|
|
10358
|
+
}
|
|
10359
|
+
} else {
|
|
10360
|
+
const key = col.accessorKey || col.id;
|
|
10361
|
+
value = key ? tableRow.original[key] : void 0;
|
|
10362
|
+
}
|
|
10363
|
+
}
|
|
10364
|
+
} else {
|
|
10365
|
+
const key = col.accessorKey || col.id;
|
|
10366
|
+
value = key ? tableRow.original[key] : void 0;
|
|
10367
|
+
}
|
|
10368
|
+
if (options.locale && (typeof value === "number" || value instanceof Date || typeof value === "boolean")) {
|
|
10369
|
+
value = formatLocaleValue(value, options.locale);
|
|
10370
|
+
}
|
|
10371
|
+
return escapeCSVValue(value, options.sanitizeForSecurity !== false);
|
|
10372
|
+
}).join(",");
|
|
10373
|
+
});
|
|
10374
|
+
const csvContent = [headers.join(","), ...csvData].join("\n");
|
|
10375
|
+
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
|
|
10376
|
+
const link = document.createElement("a");
|
|
10377
|
+
const url = URL.createObjectURL(blob);
|
|
10378
|
+
link.setAttribute("href", url);
|
|
10379
|
+
link.setAttribute("download", filename);
|
|
10380
|
+
link.style.display = "none";
|
|
10381
|
+
link.onclick = () => {
|
|
10382
|
+
setTimeout(() => {
|
|
10383
|
+
URL.revokeObjectURL(url);
|
|
10384
|
+
resolve();
|
|
10385
|
+
}, 100);
|
|
10386
|
+
};
|
|
10387
|
+
document.body.appendChild(link);
|
|
10388
|
+
link.click();
|
|
10389
|
+
document.body.removeChild(link);
|
|
10390
|
+
} catch (error) {
|
|
10391
|
+
logger.error("Failed to export data to CSV:", error);
|
|
10392
|
+
reject(error);
|
|
10393
|
+
}
|
|
10394
|
+
});
|
|
10395
|
+
}
|
|
10277
10396
|
function exportToCSV(data, columns, filename = "download.csv", options = {}) {
|
|
10278
10397
|
const logger = createLogger("ExportUtils");
|
|
10279
10398
|
return new Promise((resolve, reject) => {
|
|
@@ -11716,33 +11835,38 @@ function DataTableInternal({
|
|
|
11716
11835
|
onImportClick: () => stateActions.setImportModal(true),
|
|
11717
11836
|
onExport: secureHandlers.onExport || (async () => {
|
|
11718
11837
|
try {
|
|
11719
|
-
const
|
|
11838
|
+
const tableRows = table.getFilteredRowModel().rows;
|
|
11720
11839
|
const tableColumns = table.getAllColumns();
|
|
11721
11840
|
const visibleTableColumns = tableColumns.filter((col) => {
|
|
11722
11841
|
const isSystemColumn = col.id === "select" || col.id === "actions";
|
|
11723
11842
|
return !isSystemColumn && col.getIsVisible();
|
|
11724
11843
|
});
|
|
11725
11844
|
const visibleColumns2 = [];
|
|
11845
|
+
const columnIdToTableColumn = /* @__PURE__ */ new Map();
|
|
11726
11846
|
visibleTableColumns.forEach((tableCol) => {
|
|
11727
11847
|
const originalCol = columns.find((col) => {
|
|
11728
11848
|
const colId = col.id || col.accessorKey;
|
|
11729
11849
|
return colId && String(colId) === tableCol.id;
|
|
11730
11850
|
});
|
|
11731
11851
|
if (!originalCol) return;
|
|
11852
|
+
columnIdToTableColumn.set(tableCol.id, tableCol);
|
|
11732
11853
|
const hasAccessorFn = "accessorFn" in originalCol && originalCol.accessorFn;
|
|
11733
11854
|
const editAccessorKey = originalCol.editAccessorKey;
|
|
11855
|
+
const displayHeader = typeof originalCol.header === "string" ? originalCol.header : originalCol.accessorKey || tableCol.id || "Column";
|
|
11734
11856
|
visibleColumns2.push({
|
|
11735
11857
|
...originalCol,
|
|
11736
|
-
header:
|
|
11737
|
-
//
|
|
11738
|
-
|
|
11858
|
+
header: displayHeader,
|
|
11859
|
+
// Store table column ID for getValue() lookup
|
|
11860
|
+
id: tableCol.id,
|
|
11861
|
+
// Preserve accessorFn if present (will use getValue() if available)
|
|
11739
11862
|
accessorFn: hasAccessorFn ? originalCol.accessorFn : void 0
|
|
11740
11863
|
});
|
|
11741
11864
|
if (hasAccessorFn && editAccessorKey) {
|
|
11865
|
+
const idHeader = `${displayHeader} (ID)`;
|
|
11742
11866
|
visibleColumns2.push({
|
|
11743
11867
|
id: editAccessorKey,
|
|
11744
11868
|
accessorKey: editAccessorKey,
|
|
11745
|
-
header:
|
|
11869
|
+
header: idHeader,
|
|
11746
11870
|
isIdColumn: true,
|
|
11747
11871
|
editAccessorKey
|
|
11748
11872
|
});
|
|
@@ -11750,7 +11874,7 @@ function DataTableInternal({
|
|
|
11750
11874
|
});
|
|
11751
11875
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
11752
11876
|
const filename = title ? `${title.replace(/[^a-z0-9]/gi, "_").toLowerCase()}_${timestamp}.csv` : `data_export_${timestamp}.csv`;
|
|
11753
|
-
await
|
|
11877
|
+
await exportToCSVWithTableRows(tableRows, visibleColumns2, columnIdToTableColumn, filename);
|
|
11754
11878
|
toast({
|
|
11755
11879
|
title: "Export Successful",
|
|
11756
11880
|
description: `Data exported to ${filename}`,
|
|
@@ -11934,10 +12058,35 @@ function DataTableInternal({
|
|
|
11934
12058
|
onCloseImportModal: () => stateActions.setImportModal(false),
|
|
11935
12059
|
onImport: async (data2) => {
|
|
11936
12060
|
if (onImport) {
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
12061
|
+
try {
|
|
12062
|
+
console.log("[DataTableCore] onImport called with", data2.length, "rows");
|
|
12063
|
+
const result = onImport(data2);
|
|
12064
|
+
if (result && typeof result.then === "function") {
|
|
12065
|
+
await result;
|
|
12066
|
+
}
|
|
12067
|
+
console.log("[DataTableCore] onImport completed successfully");
|
|
12068
|
+
toast({
|
|
12069
|
+
title: "Import Successful",
|
|
12070
|
+
description: `Successfully imported ${data2.length} ${data2.length === 1 ? "row" : "rows"}`,
|
|
12071
|
+
variant: "default"
|
|
12072
|
+
});
|
|
12073
|
+
} catch (error) {
|
|
12074
|
+
console.error("[DataTableCore] Import error:", error);
|
|
12075
|
+
toast({
|
|
12076
|
+
title: "Import Failed",
|
|
12077
|
+
description: error instanceof Error ? error.message : "Failed to import data",
|
|
12078
|
+
variant: "destructive"
|
|
12079
|
+
});
|
|
12080
|
+
return;
|
|
11940
12081
|
}
|
|
12082
|
+
} else {
|
|
12083
|
+
console.error("[DataTableCore] onImport handler not provided");
|
|
12084
|
+
toast({
|
|
12085
|
+
title: "Import Not Configured",
|
|
12086
|
+
description: "Import functionality requires an onImport handler to be provided.",
|
|
12087
|
+
variant: "destructive"
|
|
12088
|
+
});
|
|
12089
|
+
return;
|
|
11941
12090
|
}
|
|
11942
12091
|
stateActions.setImportModal(false);
|
|
11943
12092
|
},
|
|
@@ -12160,6 +12309,7 @@ export {
|
|
|
12160
12309
|
isHierarchicalSortableColumn,
|
|
12161
12310
|
getHierarchicalSortConfig,
|
|
12162
12311
|
generateCSVContent,
|
|
12312
|
+
exportToCSVWithTableRows,
|
|
12163
12313
|
exportToCSV,
|
|
12164
12314
|
defaultDataTableFeatures,
|
|
12165
12315
|
normalizeDataTableFeatures,
|
|
@@ -12194,4 +12344,4 @@ lodash/lodash.js:
|
|
|
12194
12344
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12195
12345
|
*)
|
|
12196
12346
|
*/
|
|
12197
|
-
//# sourceMappingURL=chunk-
|
|
12347
|
+
//# sourceMappingURL=chunk-D7CZVI3K.js.map
|