@jmruthers/pace-core 0.5.61 → 0.5.63
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-5M6MV2VY.js → DataTable-7BER7PDS.js} +6 -6
- package/dist/{DataTable-DqDDvBfI.d.ts → DataTable-D15XipLZ.d.ts} +7 -0
- package/dist/{PublicLoadingSpinner-CrMOrhNz.d.ts → PublicLoadingSpinner-CXJ-W9wZ.d.ts} +2 -2
- package/dist/{chunk-44SAHU2N.js → chunk-2LPYEFXI.js} +5 -5
- package/dist/chunk-4BWGRQBG.js +74 -0
- package/dist/chunk-4BWGRQBG.js.map +1 -0
- package/dist/{chunk-XMTHMOOM.js → chunk-BTCA3ENN.js} +4 -4
- package/dist/{chunk-ESXTFEE6.js → chunk-C7GUF747.js} +3 -3
- package/dist/{chunk-W7PPXKTZ.js → chunk-CKNY7HYS.js} +2 -2
- package/dist/{chunk-5MLDIGHB.js → chunk-FVDOEGGG.js} +3 -3
- package/dist/{chunk-HFDYTSAP.js → chunk-QVEOQVD4.js} +3 -3
- package/dist/{chunk-XDXG6QVH.js → chunk-S66AJVI2.js} +13 -6
- package/dist/chunk-S66AJVI2.js.map +1 -0
- package/dist/{chunk-E4FPK232.js → chunk-T2MQY57J.js} +2 -2
- package/dist/{chunk-4ULBJNIT.js → chunk-T6HVDA24.js} +2 -2
- package/dist/{chunk-STT7INZR.js → chunk-ULBI5JGB.js} +2 -1
- package/dist/{chunk-CGSYCF2W.js → chunk-VTJ5HCZB.js} +2 -2
- package/dist/components.d.ts +82 -5
- package/dist/components.js +258 -9
- package/dist/components.js.map +1 -1
- package/dist/{appConfig-DjpeG6P-.d.ts → formatting-BfDeV-ja.d.ts} +29 -1
- package/dist/hooks.d.ts +3 -2
- package/dist/hooks.js +5 -5
- package/dist/index.d.ts +8 -11
- package/dist/index.js +25 -14
- package/dist/index.js.map +1 -1
- package/dist/{organisation-DD0yBbGU.d.ts → organisation-t-vvQC3g.d.ts} +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +4 -4
- package/dist/rbac/index.js +6 -6
- package/dist/types.js +1 -1
- package/dist/{usePublicRouteParams-Cu6oKazv.d.ts → usePublicRouteParams-CdoFxnJK.d.ts} +2 -63
- package/dist/useToast-Bm6TnSK-.d.ts +63 -0
- package/dist/utils.d.ts +3 -31
- package/dist/utils.js +8 -41
- package/dist/utils.js.map +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/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/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +44 -18
- 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/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.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/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/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.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/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/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/UsePublicRouteParamsReturn.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 +148 -26
- package/docs/implementation-guides/data-tables.md +67 -0
- package/package.json +1 -1
- package/src/components/DataTable/DataTable.tsx +13 -0
- package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +414 -0
- package/src/components/DataTable/components/DataTableCore.tsx +19 -2
- package/src/components/DataTable/types.ts +9 -0
- package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +151 -0
- package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +611 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +287 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +861 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +628 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +777 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +901 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/index.ts +15 -0
- package/src/hooks/__tests__/useApiFetch.unit.test.ts +1 -1
- package/src/hooks/useFileReference.ts +37 -0
- package/src/index.ts +10 -0
- package/src/styles/base.css +208 -0
- package/src/styles/semantic.css +24 -0
- package/dist/chunk-W66AZIOH.js +0 -29
- package/dist/chunk-W66AZIOH.js.map +0 -1
- package/dist/chunk-XDXG6QVH.js.map +0 -1
- /package/dist/{DataTable-5M6MV2VY.js.map → DataTable-7BER7PDS.js.map} +0 -0
- /package/dist/{chunk-44SAHU2N.js.map → chunk-2LPYEFXI.js.map} +0 -0
- /package/dist/{chunk-XMTHMOOM.js.map → chunk-BTCA3ENN.js.map} +0 -0
- /package/dist/{chunk-ESXTFEE6.js.map → chunk-C7GUF747.js.map} +0 -0
- /package/dist/{chunk-W7PPXKTZ.js.map → chunk-CKNY7HYS.js.map} +0 -0
- /package/dist/{chunk-5MLDIGHB.js.map → chunk-FVDOEGGG.js.map} +0 -0
- /package/dist/{chunk-HFDYTSAP.js.map → chunk-QVEOQVD4.js.map} +0 -0
- /package/dist/{chunk-E4FPK232.js.map → chunk-T2MQY57J.js.map} +0 -0
- /package/dist/{chunk-4ULBJNIT.js.map → chunk-T6HVDA24.js.map} +0 -0
- /package/dist/{chunk-STT7INZR.js.map → chunk-ULBI5JGB.js.map} +0 -0
- /package/dist/{chunk-CGSYCF2W.js.map → chunk-VTJ5HCZB.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.63](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.63
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -342,10 +342,15 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
342
342
|
- [getCurrentAppName](modules.md#getcurrentappname)
|
|
343
343
|
- [getCurrentAppId](modules.md#getcurrentappid)
|
|
344
344
|
- [cn](modules.md#cn)
|
|
345
|
+
- [formatDate](modules.md#formatdate)
|
|
346
|
+
- [formatCurrency](modules.md#formatcurrency)
|
|
347
|
+
- [formatNumber](modules.md#formatnumber)
|
|
348
|
+
- [formatPercent](modules.md#formatpercent)
|
|
349
|
+
- [formatCompactNumber](modules.md#formatcompactnumber)
|
|
350
|
+
- [formatFileSize](modules.md#formatfilesize)
|
|
345
351
|
- [createSecureDataAccess](modules.md#createsecuredataaccess)
|
|
346
352
|
- [getFileSizeLimit](modules.md#getfilesizelimit)
|
|
347
353
|
- [validateFileSize](modules.md#validatefilesize)
|
|
348
|
-
- [formatFileSize](modules.md#formatfilesize)
|
|
349
354
|
- [generateFilePath](modules.md#generatefilepath)
|
|
350
355
|
- [generateUniqueFileName](modules.md#generateuniquefilename)
|
|
351
356
|
- [extractFileMetadata](modules.md#extractfilemetadata)
|
|
@@ -1205,7 +1210,7 @@ Features are configured through the unified `features` prop for maximum flexibil
|
|
|
1205
1210
|
|
|
1206
1211
|
#### Defined in
|
|
1207
1212
|
|
|
1208
|
-
[packages/core/src/components/DataTable/DataTable.tsx:
|
|
1213
|
+
[packages/core/src/components/DataTable/DataTable.tsx:448](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/DataTable.tsx#L448)
|
|
1209
1214
|
|
|
1210
1215
|
___
|
|
1211
1216
|
|
|
@@ -6075,6 +6080,145 @@ ___
|
|
|
6075
6080
|
|
|
6076
6081
|
___
|
|
6077
6082
|
|
|
6083
|
+
### formatDate
|
|
6084
|
+
|
|
6085
|
+
▸ **formatDate**(`date`): `string`
|
|
6086
|
+
|
|
6087
|
+
Format a date as a readable string
|
|
6088
|
+
|
|
6089
|
+
#### Parameters
|
|
6090
|
+
|
|
6091
|
+
| Name | Type |
|
|
6092
|
+
| :------ | :------ |
|
|
6093
|
+
| `date` | `string` \| `number` \| `Date` |
|
|
6094
|
+
|
|
6095
|
+
#### Returns
|
|
6096
|
+
|
|
6097
|
+
`string`
|
|
6098
|
+
|
|
6099
|
+
#### Defined in
|
|
6100
|
+
|
|
6101
|
+
[packages/core/src/utils/formatting.ts:8](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L8)
|
|
6102
|
+
|
|
6103
|
+
___
|
|
6104
|
+
|
|
6105
|
+
### formatCurrency
|
|
6106
|
+
|
|
6107
|
+
▸ **formatCurrency**(`value`, `currencyCode?`, `locale?`): `string`
|
|
6108
|
+
|
|
6109
|
+
Format a number as a currency
|
|
6110
|
+
|
|
6111
|
+
#### Parameters
|
|
6112
|
+
|
|
6113
|
+
| Name | Type | Default value |
|
|
6114
|
+
| :------ | :------ | :------ |
|
|
6115
|
+
| `value` | `number` | `undefined` |
|
|
6116
|
+
| `currencyCode` | `string` | `'USD'` |
|
|
6117
|
+
| `locale` | `string` | `'en-US'` |
|
|
6118
|
+
|
|
6119
|
+
#### Returns
|
|
6120
|
+
|
|
6121
|
+
`string`
|
|
6122
|
+
|
|
6123
|
+
#### Defined in
|
|
6124
|
+
|
|
6125
|
+
[packages/core/src/utils/formatting.ts:23](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L23)
|
|
6126
|
+
|
|
6127
|
+
___
|
|
6128
|
+
|
|
6129
|
+
### formatNumber
|
|
6130
|
+
|
|
6131
|
+
▸ **formatNumber**(`value`, `options?`, `locale?`): `string`
|
|
6132
|
+
|
|
6133
|
+
Format a number with custom options
|
|
6134
|
+
|
|
6135
|
+
#### Parameters
|
|
6136
|
+
|
|
6137
|
+
| Name | Type | Default value |
|
|
6138
|
+
| :------ | :------ | :------ |
|
|
6139
|
+
| `value` | `number` | `undefined` |
|
|
6140
|
+
| `options` | `NumberFormatOptions` | `{}` |
|
|
6141
|
+
| `locale` | `string` | `'en-US'` |
|
|
6142
|
+
|
|
6143
|
+
#### Returns
|
|
6144
|
+
|
|
6145
|
+
`string`
|
|
6146
|
+
|
|
6147
|
+
#### Defined in
|
|
6148
|
+
|
|
6149
|
+
[packages/core/src/utils/formatting.ts:33](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L33)
|
|
6150
|
+
|
|
6151
|
+
___
|
|
6152
|
+
|
|
6153
|
+
### formatPercent
|
|
6154
|
+
|
|
6155
|
+
▸ **formatPercent**(`value`, `locale?`, `decimals?`): `string`
|
|
6156
|
+
|
|
6157
|
+
Format a number as a percentage
|
|
6158
|
+
|
|
6159
|
+
#### Parameters
|
|
6160
|
+
|
|
6161
|
+
| Name | Type | Default value |
|
|
6162
|
+
| :------ | :------ | :------ |
|
|
6163
|
+
| `value` | `number` | `undefined` |
|
|
6164
|
+
| `locale` | `string` | `'en-US'` |
|
|
6165
|
+
| `decimals` | `number` | `1` |
|
|
6166
|
+
|
|
6167
|
+
#### Returns
|
|
6168
|
+
|
|
6169
|
+
`string`
|
|
6170
|
+
|
|
6171
|
+
#### Defined in
|
|
6172
|
+
|
|
6173
|
+
[packages/core/src/utils/formatting.ts:44](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L44)
|
|
6174
|
+
|
|
6175
|
+
___
|
|
6176
|
+
|
|
6177
|
+
### formatCompactNumber
|
|
6178
|
+
|
|
6179
|
+
▸ **formatCompactNumber**(`value`, `locale?`): `string`
|
|
6180
|
+
|
|
6181
|
+
Format a large number with abbreviations (K, M, B)
|
|
6182
|
+
|
|
6183
|
+
#### Parameters
|
|
6184
|
+
|
|
6185
|
+
| Name | Type | Default value |
|
|
6186
|
+
| :------ | :------ | :------ |
|
|
6187
|
+
| `value` | `number` | `undefined` |
|
|
6188
|
+
| `locale` | `string` | `'en-US'` |
|
|
6189
|
+
|
|
6190
|
+
#### Returns
|
|
6191
|
+
|
|
6192
|
+
`string`
|
|
6193
|
+
|
|
6194
|
+
#### Defined in
|
|
6195
|
+
|
|
6196
|
+
[packages/core/src/utils/formatting.ts:59](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L59)
|
|
6197
|
+
|
|
6198
|
+
___
|
|
6199
|
+
|
|
6200
|
+
### formatFileSize
|
|
6201
|
+
|
|
6202
|
+
▸ **formatFileSize**(`bytes`): `string`
|
|
6203
|
+
|
|
6204
|
+
Format a file size in bytes to a human-readable string
|
|
6205
|
+
|
|
6206
|
+
#### Parameters
|
|
6207
|
+
|
|
6208
|
+
| Name | Type |
|
|
6209
|
+
| :------ | :------ |
|
|
6210
|
+
| `bytes` | `number` |
|
|
6211
|
+
|
|
6212
|
+
#### Returns
|
|
6213
|
+
|
|
6214
|
+
`string`
|
|
6215
|
+
|
|
6216
|
+
#### Defined in
|
|
6217
|
+
|
|
6218
|
+
[packages/core/src/utils/formatting.ts:69](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/formatting.ts#L69)
|
|
6219
|
+
|
|
6220
|
+
___
|
|
6221
|
+
|
|
6078
6222
|
### createSecureDataAccess
|
|
6079
6223
|
|
|
6080
6224
|
▸ **createSecureDataAccess**(`supabase`, `organisationId`, `isSuperAdmin?`): `SecureDataAccess`
|
|
@@ -6150,28 +6294,6 @@ Validate file size against limits
|
|
|
6150
6294
|
|
|
6151
6295
|
___
|
|
6152
6296
|
|
|
6153
|
-
### formatFileSize
|
|
6154
|
-
|
|
6155
|
-
▸ **formatFileSize**(`bytes`): `string`
|
|
6156
|
-
|
|
6157
|
-
Get human-readable file size
|
|
6158
|
-
|
|
6159
|
-
#### Parameters
|
|
6160
|
-
|
|
6161
|
-
| Name | Type |
|
|
6162
|
-
| :------ | :------ |
|
|
6163
|
-
| `bytes` | `number` |
|
|
6164
|
-
|
|
6165
|
-
#### Returns
|
|
6166
|
-
|
|
6167
|
-
`string`
|
|
6168
|
-
|
|
6169
|
-
#### Defined in
|
|
6170
|
-
|
|
6171
|
-
[packages/core/src/utils/storage/config.ts:88](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/utils/storage/config.ts#L88)
|
|
6172
|
-
|
|
6173
|
-
___
|
|
6174
|
-
|
|
6175
6297
|
### generateFilePath
|
|
6176
6298
|
|
|
6177
6299
|
▸ **generateFilePath**(`options`, `fileName`): `string`
|
|
@@ -941,6 +941,27 @@ const desktopColumnOrder = ['select', 'name', 'email', 'role', 'status', 'create
|
|
|
941
941
|
/>
|
|
942
942
|
```
|
|
943
943
|
|
|
944
|
+
#### Default Sorting
|
|
945
|
+
|
|
946
|
+
You can configure your DataTable to load with pre-applied sorting:
|
|
947
|
+
|
|
948
|
+
```tsx
|
|
949
|
+
<DataTable
|
|
950
|
+
data={recipes}
|
|
951
|
+
columns={columns}
|
|
952
|
+
features={{ sorting: true }}
|
|
953
|
+
defaultSorting={[
|
|
954
|
+
{ id: 'diettype_name', desc: false },
|
|
955
|
+
{ id: 'item_name', desc: false }
|
|
956
|
+
]}
|
|
957
|
+
rbac={{ pageId: 'recipes' }}
|
|
958
|
+
/>
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**Examples:**
|
|
962
|
+
- **Sort by Date (descending):** `defaultSorting={[{ id: 'created_at', desc: true }]}`
|
|
963
|
+
- **Multi-column sort:** `defaultSorting={[{ id: 'category', desc: false }, { id: 'name', desc: false }]}`
|
|
964
|
+
|
|
944
965
|
### Filtering
|
|
945
966
|
|
|
946
967
|
```tsx
|
|
@@ -1543,6 +1564,52 @@ function SelectableUserTable() {
|
|
|
1543
1564
|
/>
|
|
1544
1565
|
```
|
|
1545
1566
|
|
|
1567
|
+
#### Default Grouping
|
|
1568
|
+
|
|
1569
|
+
You can configure your DataTable to load with pre-applied grouping:
|
|
1570
|
+
|
|
1571
|
+
```tsx
|
|
1572
|
+
<DataTable
|
|
1573
|
+
data={recipes}
|
|
1574
|
+
columns={columns}
|
|
1575
|
+
features={{ grouping: true }}
|
|
1576
|
+
defaultGrouping={['diettype_name']}
|
|
1577
|
+
rbac={{ pageId: 'recipes' }}
|
|
1578
|
+
/>
|
|
1579
|
+
```
|
|
1580
|
+
|
|
1581
|
+
**Examples:**
|
|
1582
|
+
- **Group by Status:** `defaultGrouping={['status']}`
|
|
1583
|
+
- **Multi-level grouping:** `defaultGrouping={['category', 'status']}`
|
|
1584
|
+
|
|
1585
|
+
#### Combined Default Grouping and Sorting
|
|
1586
|
+
|
|
1587
|
+
You can combine both default grouping and sorting for a fully pre-organized view:
|
|
1588
|
+
|
|
1589
|
+
```tsx
|
|
1590
|
+
<DataTable
|
|
1591
|
+
data={recipes}
|
|
1592
|
+
columns={columns}
|
|
1593
|
+
features={{
|
|
1594
|
+
grouping: true,
|
|
1595
|
+
sorting: true,
|
|
1596
|
+
}}
|
|
1597
|
+
defaultGrouping={['diettype_name']}
|
|
1598
|
+
defaultSorting={[
|
|
1599
|
+
{ id: 'diettype_name', desc: false },
|
|
1600
|
+
{ id: 'item_name', desc: false }
|
|
1601
|
+
]}
|
|
1602
|
+
rbac={{ pageId: 'recipes' }}
|
|
1603
|
+
/>
|
|
1604
|
+
```
|
|
1605
|
+
|
|
1606
|
+
**Behavior:**
|
|
1607
|
+
- **defaultGrouping**: Array of column IDs to group by on initial load
|
|
1608
|
+
- **defaultSorting**: Array of sort configurations (column ID + direction)
|
|
1609
|
+
- Both props are optional and work independently or together
|
|
1610
|
+
- Users can still modify grouping/sorting via UI controls
|
|
1611
|
+
- Works with all DataTable features (pagination, filtering, etc.)
|
|
1612
|
+
|
|
1546
1613
|
## Performance Optimization
|
|
1547
1614
|
|
|
1548
1615
|
### Virtual Scrolling
|
package/package.json
CHANGED
|
@@ -368,6 +368,19 @@ export interface DataTableProps<TData extends DataRecord> {
|
|
|
368
368
|
virtualHeight?: number;
|
|
369
369
|
/** Initial page size for pagination */
|
|
370
370
|
initialPageSize?: number;
|
|
371
|
+
|
|
372
|
+
// ========================================
|
|
373
|
+
// DEFAULT STATE CONFIGURATION
|
|
374
|
+
// ========================================
|
|
375
|
+
|
|
376
|
+
/** Initial grouping configuration - columns to group by on load */
|
|
377
|
+
defaultGrouping?: string[];
|
|
378
|
+
/** Initial sorting configuration - sort state to apply on load */
|
|
379
|
+
defaultSorting?: Array<{
|
|
380
|
+
id: string;
|
|
381
|
+
desc: boolean;
|
|
382
|
+
}>;
|
|
383
|
+
|
|
371
384
|
/** Enable enhanced pagination controls */
|
|
372
385
|
enhancedPagination?: boolean;
|
|
373
386
|
/** Custom loading component */
|