@jmruthers/pace-core 0.5.94 → 0.5.97
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-CHX2EFO3.js → DataTable-FB22ES46.js} +2 -2
- package/dist/{PublicLoadingSpinner-BWUD6bLU.d.ts → PublicLoadingSpinner-B84QWsvB.d.ts} +8 -1
- package/dist/{chunk-PRM6EYO3.js → chunk-QX5I62KP.js} +87 -12
- package/dist/chunk-QX5I62KP.js.map +1 -0
- package/dist/{chunk-O6GASC4Q.js → chunk-UBPRDNPY.js} +267 -182
- package/dist/chunk-UBPRDNPY.js.map +1 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.js +2 -2
- package/dist/index.d.ts +1 -1
- 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 +37 -11
- 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 +3 -3
- package/docs/implementation-guides/data-tables.md +156 -1
- package/package.json +1 -1
- package/src/components/DataTable/DataTable.tsx +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +62 -11
- package/src/components/DataTable/components/DataTableModals.tsx +76 -5
- package/src/components/DataTable/utils/exportUtils.ts +18 -2
- package/src/components/FileDisplay/FileDisplay.tsx +189 -147
- package/src/hooks/useFileUrl.ts +130 -0
- package/dist/chunk-O6GASC4Q.js.map +0 -1
- package/dist/chunk-PRM6EYO3.js.map +0 -1
- /package/dist/{DataTable-CHX2EFO3.js.map → DataTable-FB22ES46.js.map} +0 -0
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
sortHierarchicalDataWithSorting,
|
|
54
54
|
validateHierarchicalData,
|
|
55
55
|
validatePaginationConfig
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-QX5I62KP.js";
|
|
57
57
|
import "./chunk-2KLAOD4M.js";
|
|
58
58
|
import "./chunk-S63MFSY6.js";
|
|
59
59
|
import "./chunk-Q7APDV6H.js";
|
|
@@ -155,4 +155,4 @@ export {
|
|
|
155
155
|
validateHierarchicalData,
|
|
156
156
|
validatePaginationConfig
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=DataTable-
|
|
158
|
+
//# sourceMappingURL=DataTable-FB22ES46.js.map
|
|
@@ -2962,6 +2962,13 @@ interface FileDisplayProps {
|
|
|
2962
2962
|
showDelete?: boolean;
|
|
2963
2963
|
className?: string;
|
|
2964
2964
|
children?: React__default.ReactNode;
|
|
2965
|
+
/** Custom loading component to render during data fetching */
|
|
2966
|
+
loadingComponent?: React__default.ComponentType;
|
|
2967
|
+
/** Custom error component to render when an error occurs */
|
|
2968
|
+
errorComponent?: React__default.ComponentType<{
|
|
2969
|
+
error: Error | string | null;
|
|
2970
|
+
retry?: () => void;
|
|
2971
|
+
}>;
|
|
2965
2972
|
}
|
|
2966
2973
|
/**
|
|
2967
2974
|
* Component for displaying file references with context-awareness
|
|
@@ -2979,7 +2986,7 @@ interface FileDisplayProps {
|
|
|
2979
2986
|
* @param props.category - Optional category filter. When specified, only displays files matching this category and uses single file display variant.
|
|
2980
2987
|
* @returns React element with file display
|
|
2981
2988
|
*/
|
|
2982
|
-
declare function FileDisplay({ supabase, table_name, record_id, organisation_id, category, displayOnly, showUpload, showDelete, className, children }: FileDisplayProps): react_jsx_runtime.JSX.Element;
|
|
2989
|
+
declare function FileDisplay({ supabase, table_name, record_id, organisation_id, category, displayOnly, showUpload, showDelete, className, children, loadingComponent, errorComponent }: FileDisplayProps): react_jsx_runtime.JSX.Element;
|
|
2983
2990
|
|
|
2984
2991
|
declare function useFileReference(supabase: SupabaseClient): {
|
|
2985
2992
|
isLoading: boolean;
|
|
@@ -8914,11 +8914,40 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
8914
8914
|
|
|
8915
8915
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
8916
8916
|
import { Fragment as Fragment3, jsx as jsx19 } from "react/jsx-runtime";
|
|
8917
|
+
function mapCSVToTableColumns(csvData, columns) {
|
|
8918
|
+
const columnMap = /* @__PURE__ */ new Map();
|
|
8919
|
+
columns.forEach((col) => {
|
|
8920
|
+
const fieldName = col.editAccessorKey || col.accessorKey || col.id;
|
|
8921
|
+
const header = typeof col.header === "string" ? col.header : "";
|
|
8922
|
+
if (fieldName && header) {
|
|
8923
|
+
columnMap.set(header.toLowerCase(), fieldName);
|
|
8924
|
+
const colId = col.id || col.accessorKey;
|
|
8925
|
+
if (colId && colId !== header && colId !== fieldName) {
|
|
8926
|
+
columnMap.set(colId.toLowerCase(), fieldName);
|
|
8927
|
+
}
|
|
8928
|
+
if (col.editAccessorKey && header) {
|
|
8929
|
+
const idColumnHeader = `${header} (ID)`;
|
|
8930
|
+
columnMap.set(idColumnHeader.toLowerCase(), col.editAccessorKey);
|
|
8931
|
+
columnMap.set(col.editAccessorKey.toLowerCase(), col.editAccessorKey);
|
|
8932
|
+
}
|
|
8933
|
+
}
|
|
8934
|
+
});
|
|
8935
|
+
return csvData.map((row) => {
|
|
8936
|
+
const mappedRow = {};
|
|
8937
|
+
Object.keys(row).forEach((csvHeader) => {
|
|
8938
|
+
const csvHeaderLower = csvHeader.toLowerCase();
|
|
8939
|
+
const fieldName = columnMap.get(csvHeaderLower) || csvHeaderLower;
|
|
8940
|
+
mappedRow[fieldName] = row[csvHeader];
|
|
8941
|
+
});
|
|
8942
|
+
return mappedRow;
|
|
8943
|
+
});
|
|
8944
|
+
}
|
|
8917
8945
|
function DataTableModals({
|
|
8918
8946
|
showImportModal,
|
|
8919
8947
|
onCloseImportModal,
|
|
8920
8948
|
onImport,
|
|
8921
8949
|
importModalConfig,
|
|
8950
|
+
columns,
|
|
8922
8951
|
onStoreFocus,
|
|
8923
8952
|
onRestoreFocus
|
|
8924
8953
|
}) {
|
|
@@ -8937,7 +8966,13 @@ function DataTableModals({
|
|
|
8937
8966
|
{
|
|
8938
8967
|
isOpen: showImportModal,
|
|
8939
8968
|
onClose: onCloseImportModal,
|
|
8940
|
-
onImport
|
|
8969
|
+
onImport: async (rawData) => {
|
|
8970
|
+
const mappedData = columns ? mapCSVToTableColumns(rawData, columns) : rawData;
|
|
8971
|
+
const result = onImport(mappedData);
|
|
8972
|
+
if (result && typeof result.then === "function") {
|
|
8973
|
+
await result;
|
|
8974
|
+
}
|
|
8975
|
+
},
|
|
8941
8976
|
config: importModalConfig
|
|
8942
8977
|
}
|
|
8943
8978
|
) });
|
|
@@ -10218,8 +10253,18 @@ function generateCSVContent(data, columns, options = {}) {
|
|
|
10218
10253
|
});
|
|
10219
10254
|
const csvData = data.map((row) => {
|
|
10220
10255
|
return columns.map((col) => {
|
|
10221
|
-
|
|
10222
|
-
|
|
10256
|
+
let value;
|
|
10257
|
+
if (col.accessorFn) {
|
|
10258
|
+
try {
|
|
10259
|
+
value = col.accessorFn(row);
|
|
10260
|
+
} catch (error) {
|
|
10261
|
+
console.warn("Error evaluating accessorFn for column:", col.id || col.header, error);
|
|
10262
|
+
value = void 0;
|
|
10263
|
+
}
|
|
10264
|
+
} else {
|
|
10265
|
+
const key = col.accessorKey || col.id;
|
|
10266
|
+
value = key ? row[key] : void 0;
|
|
10267
|
+
}
|
|
10223
10268
|
if (locale && (typeof value === "number" || value instanceof Date || typeof value === "boolean")) {
|
|
10224
10269
|
value = formatLocaleValue(value, locale);
|
|
10225
10270
|
}
|
|
@@ -11672,13 +11717,37 @@ function DataTableInternal({
|
|
|
11672
11717
|
onExport: secureHandlers.onExport || (async () => {
|
|
11673
11718
|
try {
|
|
11674
11719
|
const currentData = table.getFilteredRowModel().rows.map((row) => row.original);
|
|
11675
|
-
const
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11720
|
+
const tableColumns = table.getAllColumns();
|
|
11721
|
+
const visibleTableColumns = tableColumns.filter((col) => {
|
|
11722
|
+
const isSystemColumn = col.id === "select" || col.id === "actions";
|
|
11723
|
+
return !isSystemColumn && col.getIsVisible();
|
|
11724
|
+
});
|
|
11725
|
+
const visibleColumns2 = [];
|
|
11726
|
+
visibleTableColumns.forEach((tableCol) => {
|
|
11727
|
+
const originalCol = columns.find((col) => {
|
|
11728
|
+
const colId = col.id || col.accessorKey;
|
|
11729
|
+
return colId && String(colId) === tableCol.id;
|
|
11730
|
+
});
|
|
11731
|
+
if (!originalCol) return;
|
|
11732
|
+
const hasAccessorFn = "accessorFn" in originalCol && originalCol.accessorFn;
|
|
11733
|
+
const editAccessorKey = originalCol.editAccessorKey;
|
|
11734
|
+
visibleColumns2.push({
|
|
11735
|
+
...originalCol,
|
|
11736
|
+
header: typeof originalCol.header === "string" ? originalCol.header : originalCol.accessorKey || tableCol.id || "Column",
|
|
11737
|
+
// Preserve accessorFn if present (for computed/reference fields)
|
|
11738
|
+
// accessorFn is part of ColumnDef from TanStack Table
|
|
11739
|
+
accessorFn: hasAccessorFn ? originalCol.accessorFn : void 0
|
|
11740
|
+
});
|
|
11741
|
+
if (hasAccessorFn && editAccessorKey) {
|
|
11742
|
+
visibleColumns2.push({
|
|
11743
|
+
id: editAccessorKey,
|
|
11744
|
+
accessorKey: editAccessorKey,
|
|
11745
|
+
header: `${originalCol.header || "ID"} (ID)`,
|
|
11746
|
+
isIdColumn: true,
|
|
11747
|
+
editAccessorKey
|
|
11748
|
+
});
|
|
11749
|
+
}
|
|
11750
|
+
});
|
|
11682
11751
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
11683
11752
|
const filename = title ? `${title.replace(/[^a-z0-9]/gi, "_").toLowerCase()}_${timestamp}.csv` : `data_export_${timestamp}.csv`;
|
|
11684
11753
|
await exportToCSV(currentData, visibleColumns2, filename);
|
|
@@ -11872,7 +11941,13 @@ function DataTableInternal({
|
|
|
11872
11941
|
}
|
|
11873
11942
|
stateActions.setImportModal(false);
|
|
11874
11943
|
},
|
|
11875
|
-
importModalConfig
|
|
11944
|
+
importModalConfig,
|
|
11945
|
+
columns: columns.map((col) => ({
|
|
11946
|
+
id: col.id,
|
|
11947
|
+
accessorKey: col.accessorKey,
|
|
11948
|
+
header: typeof col.header === "string" ? col.header : void 0,
|
|
11949
|
+
editAccessorKey: col.editAccessorKey
|
|
11950
|
+
}))
|
|
11876
11951
|
}
|
|
11877
11952
|
)
|
|
11878
11953
|
] });
|
|
@@ -12119,4 +12194,4 @@ lodash/lodash.js:
|
|
|
12119
12194
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12120
12195
|
*)
|
|
12121
12196
|
*/
|
|
12122
|
-
//# sourceMappingURL=chunk-
|
|
12197
|
+
//# sourceMappingURL=chunk-QX5I62KP.js.map
|