@jmruthers/pace-core 0.5.133 → 0.5.135
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-O7VZ5UHT.js → DataTable-A36PJG6N.js} +2 -2
- package/dist/{chunk-ROXKK5IX.js → chunk-GVDR7WNV.js} +3 -1
- package/dist/chunk-GVDR7WNV.js.map +1 -0
- package/dist/{chunk-23C2SU3M.js → chunk-HMNOSGVA.js} +2 -2
- package/dist/components.js +2 -2
- package/dist/index.d.ts +120 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- 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 +3 -3
- 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/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +90 -0
- package/docs/api/interfaces/ExportOptions.md +126 -0
- 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/GrantEventAppRoleParams.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/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.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/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.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 +136 -2
- package/package.json +1 -1
- package/src/components/DataTable/DataTable.tsx +6 -0
- package/src/index.ts +9 -1
- package/dist/chunk-ROXKK5IX.js.map +0 -1
- /package/dist/{DataTable-O7VZ5UHT.js.map → DataTable-A36PJG6N.js.map} +0 -0
- /package/dist/{chunk-23C2SU3M.js.map → chunk-HMNOSGVA.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.135](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.135
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -61,6 +61,8 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
61
61
|
- [DataTableToolbarButton](interfaces/DataTableToolbarButton.md)
|
|
62
62
|
- [AggregateConfig](interfaces/AggregateConfig.md)
|
|
63
63
|
- [EmptyStateConfig](interfaces/EmptyStateConfig.md)
|
|
64
|
+
- [ExportOptions](interfaces/ExportOptions.md)
|
|
65
|
+
- [ExportColumn](interfaces/ExportColumn.md)
|
|
64
66
|
- [FileDisplayProps](interfaces/FileDisplayProps.md)
|
|
65
67
|
- [FileUploadProps](interfaces/FileUploadProps.md)
|
|
66
68
|
- [FooterProps](interfaces/FooterProps.md)
|
|
@@ -193,6 +195,9 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
193
195
|
- [CardActions](modules.md#cardactions)
|
|
194
196
|
- [Checkbox](modules.md#checkbox)
|
|
195
197
|
- [DataTable](modules.md#datatable)
|
|
198
|
+
- [generateCSVContent](modules.md#generatecsvcontent)
|
|
199
|
+
- [exportToCSVWithTableRows](modules.md#exporttocsvwithtablerows)
|
|
200
|
+
- [exportToCSV](modules.md#exporttocsv)
|
|
196
201
|
- [Dialog](modules.md#dialog)
|
|
197
202
|
- [DialogTrigger](modules.md#dialogtrigger)
|
|
198
203
|
- [DialogPortal](modules.md#dialogportal)
|
|
@@ -1305,6 +1310,135 @@ Features are configured through the unified `features` prop for maximum flexibil
|
|
|
1305
1310
|
|
|
1306
1311
|
___
|
|
1307
1312
|
|
|
1313
|
+
### generateCSVContent
|
|
1314
|
+
|
|
1315
|
+
▸ **generateCSVContent**\<`TData`\>(`data`, `columns`, `options?`): `string`
|
|
1316
|
+
|
|
1317
|
+
Generates CSV content from data without triggering download
|
|
1318
|
+
|
|
1319
|
+
#### Type parameters
|
|
1320
|
+
|
|
1321
|
+
| Name | Type |
|
|
1322
|
+
| :------ | :------ |
|
|
1323
|
+
| `TData` | extends [`DataRecord`](interfaces/DataRecord.md) |
|
|
1324
|
+
|
|
1325
|
+
#### Parameters
|
|
1326
|
+
|
|
1327
|
+
| Name | Type | Description |
|
|
1328
|
+
| :------ | :------ | :------ |
|
|
1329
|
+
| `data` | `TData`[] | Array of data objects to export |
|
|
1330
|
+
| `columns` | [`ExportColumn`](interfaces/ExportColumn.md)[] | Column definitions for mapping |
|
|
1331
|
+
| `options` | `Object` | Export options |
|
|
1332
|
+
| `options.includeHeaders?` | `boolean` | - |
|
|
1333
|
+
| `options.locale?` | `string` | - |
|
|
1334
|
+
| `options.sanitizeForSecurity?` | `boolean` | - |
|
|
1335
|
+
|
|
1336
|
+
#### Returns
|
|
1337
|
+
|
|
1338
|
+
`string`
|
|
1339
|
+
|
|
1340
|
+
CSV content as string
|
|
1341
|
+
|
|
1342
|
+
#### Defined in
|
|
1343
|
+
|
|
1344
|
+
[packages/core/src/components/DataTable/utils/exportUtils.ts:123](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/utils/exportUtils.ts#L123)
|
|
1345
|
+
|
|
1346
|
+
___
|
|
1347
|
+
|
|
1348
|
+
### exportToCSVWithTableRows
|
|
1349
|
+
|
|
1350
|
+
▸ **exportToCSVWithTableRows**(`tableRows`, `columns`, `columnIdToTableColumn`, `filename?`, `options?`): `Promise`\<`void`\>
|
|
1351
|
+
|
|
1352
|
+
Exports DataTable data using TanStack Table rows with getValue() for proper accessorFn evaluation
|
|
1353
|
+
This ensures computed columns (with accessorFn) export correctly with their displayed values
|
|
1354
|
+
|
|
1355
|
+
#### Parameters
|
|
1356
|
+
|
|
1357
|
+
| Name | Type | Default value |
|
|
1358
|
+
| :------ | :------ | :------ |
|
|
1359
|
+
| `tableRows` | \{ `original`: `any` ; `getValue`: (`columnId`: `string`) => `any` ; `id`: `string` }[] | `undefined` |
|
|
1360
|
+
| `columns` | [`ExportColumn`](interfaces/ExportColumn.md)[] | `undefined` |
|
|
1361
|
+
| `columnIdToTableColumn` | `Map`\<`string`, `any`\> | `undefined` |
|
|
1362
|
+
| `filename` | `string` | `"download.csv"` |
|
|
1363
|
+
| `options` | `Object` | `{}` |
|
|
1364
|
+
| `options.locale?` | `string` | `undefined` |
|
|
1365
|
+
| `options.sanitizeForSecurity?` | `boolean` | `undefined` |
|
|
1366
|
+
|
|
1367
|
+
#### Returns
|
|
1368
|
+
|
|
1369
|
+
`Promise`\<`void`\>
|
|
1370
|
+
|
|
1371
|
+
#### Defined in
|
|
1372
|
+
|
|
1373
|
+
[packages/core/src/components/DataTable/utils/exportUtils.ts:188](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/utils/exportUtils.ts#L188)
|
|
1374
|
+
|
|
1375
|
+
___
|
|
1376
|
+
|
|
1377
|
+
### exportToCSV
|
|
1378
|
+
|
|
1379
|
+
▸ **exportToCSV**\<`TData`\>(`data`, `columns`, `filename?`, `options?`): `Promise`\<`void`\>
|
|
1380
|
+
|
|
1381
|
+
Exports DataTable data to CSV format
|
|
1382
|
+
|
|
1383
|
+
#### Type parameters
|
|
1384
|
+
|
|
1385
|
+
| Name | Type |
|
|
1386
|
+
| :------ | :------ |
|
|
1387
|
+
| `TData` | extends [`DataRecord`](interfaces/DataRecord.md) |
|
|
1388
|
+
|
|
1389
|
+
#### Parameters
|
|
1390
|
+
|
|
1391
|
+
| Name | Type | Default value | Description |
|
|
1392
|
+
| :------ | :------ | :------ | :------ |
|
|
1393
|
+
| `data` | `TData`[] | `undefined` | Array of data objects to export |
|
|
1394
|
+
| `columns` | [`ExportColumn`](interfaces/ExportColumn.md)[] | `undefined` | Column definitions for mapping |
|
|
1395
|
+
| `filename` | `string` | `"download.csv"` | Optional filename for download (default: "download.csv") |
|
|
1396
|
+
| `options` | `Object` | `{}` | Optional export configuration |
|
|
1397
|
+
| `options.locale?` | `string` | `undefined` | - |
|
|
1398
|
+
| `options.sanitizeForSecurity?` | `boolean` | `undefined` | - |
|
|
1399
|
+
|
|
1400
|
+
#### Returns
|
|
1401
|
+
|
|
1402
|
+
`Promise`\<`void`\>
|
|
1403
|
+
|
|
1404
|
+
Promise that resolves when export is complete, rejects on error
|
|
1405
|
+
|
|
1406
|
+
**`Example`**
|
|
1407
|
+
|
|
1408
|
+
```tsx
|
|
1409
|
+
// Export user data
|
|
1410
|
+
const users = [
|
|
1411
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com' },
|
|
1412
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' }
|
|
1413
|
+
];
|
|
1414
|
+
|
|
1415
|
+
const columns = [
|
|
1416
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
1417
|
+
{ accessorKey: 'email', header: 'Email' }
|
|
1418
|
+
];
|
|
1419
|
+
|
|
1420
|
+
try {
|
|
1421
|
+
await exportToCSV(users, columns, 'users.csv', { locale: 'en-US' });
|
|
1422
|
+
showSuccessToast('Data exported successfully');
|
|
1423
|
+
} catch (error) {
|
|
1424
|
+
showErrorToast('Failed to export data');
|
|
1425
|
+
}
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
**`Remarks`**
|
|
1429
|
+
|
|
1430
|
+
- Automatically handles special characters in data
|
|
1431
|
+
- Uses column headers for CSV headers
|
|
1432
|
+
- Sanitizes data to prevent CSV injection
|
|
1433
|
+
- Triggers browser download
|
|
1434
|
+
- Throws error if export fails
|
|
1435
|
+
|
|
1436
|
+
#### Defined in
|
|
1437
|
+
|
|
1438
|
+
[packages/core/src/components/DataTable/utils/exportUtils.ts:336](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/utils/exportUtils.ts#L336)
|
|
1439
|
+
|
|
1440
|
+
___
|
|
1441
|
+
|
|
1308
1442
|
### Dialog
|
|
1309
1443
|
|
|
1310
1444
|
▸ **Dialog**(`props`, `deprecatedLegacyContext?`): `ReactNode`
|
package/package.json
CHANGED
|
@@ -487,6 +487,8 @@ export function DataTable<TData extends DataRecord>(props: DataTableProps<TData>
|
|
|
487
487
|
const allPropsKeys = Object.keys(props);
|
|
488
488
|
const allRestKeys = Object.keys(rest);
|
|
489
489
|
const tableTitle = props.title || props.description || 'unnamed';
|
|
490
|
+
|
|
491
|
+
// Log all prop keys explicitly so we can see them in console
|
|
490
492
|
console.log(`[DataTable] Wrapper prop check (${tableTitle}):`, {
|
|
491
493
|
'onExport in props': !!props.onExport,
|
|
492
494
|
'onExport in rest': !!rest.onExport,
|
|
@@ -499,6 +501,10 @@ export function DataTable<TData extends DataRecord>(props: DataTableProps<TData>
|
|
|
499
501
|
'props.onExport value': props.onExport,
|
|
500
502
|
'rest.onExport value': rest.onExport,
|
|
501
503
|
});
|
|
504
|
+
|
|
505
|
+
// Also log the keys as separate arrays for easier inspection
|
|
506
|
+
console.log(`[DataTable] All props keys for ${tableTitle}:`, allPropsKeys);
|
|
507
|
+
console.log(`[DataTable] All rest keys for ${tableTitle}:`, allRestKeys);
|
|
502
508
|
|
|
503
509
|
return <DataTableCore {...rest} features={normalizedFeatures} />;
|
|
504
510
|
}
|
package/src/index.ts
CHANGED
|
@@ -145,7 +145,15 @@ export {
|
|
|
145
145
|
} from './components/DataTable';
|
|
146
146
|
|
|
147
147
|
// Re-export types from DataTable types
|
|
148
|
-
export type { DataRecord } from './components/DataTable/types';
|
|
148
|
+
export type { DataRecord, ExportOptions } from './components/DataTable/types';
|
|
149
|
+
|
|
150
|
+
// Export DataTable utility functions
|
|
151
|
+
export {
|
|
152
|
+
exportToCSV,
|
|
153
|
+
exportToCSVWithTableRows,
|
|
154
|
+
generateCSVContent,
|
|
155
|
+
type ExportColumn
|
|
156
|
+
} from './components/DataTable/utils/exportUtils';
|
|
149
157
|
|
|
150
158
|
// FORM COMPONENTS
|
|
151
159
|
export { Form } from './components/Form/Form';
|