@jmruthers/pace-core 0.5.76 → 0.5.78
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/CHANGELOG.md +8 -0
- package/dist/{RBACService-C4udt_Zp.d.ts → AuthService-Df3IozMG.d.ts} +10 -118
- package/dist/{DataTable-ntgmhO2W.d.ts → DataTable-BE0OXZKQ.d.ts} +9 -2
- package/dist/{DataTable-4GAVPIEG.js → DataTable-ETGVF4Y5.js} +50 -13
- package/dist/{PublicLoadingSpinner-BiNER8F5.d.ts → PublicLoadingSpinner-CnUaz0vG.d.ts} +5 -2
- package/dist/{UnifiedAuthProvider-Bj6YCf7c.d.ts → UnifiedAuthProvider-B391Aqum.d.ts} +42 -45
- package/dist/{UnifiedAuthProvider-3NKDOSOK.js → UnifiedAuthProvider-P5SOJAQ6.js} +4 -5
- package/dist/{api-DDMUKIUD.js → api-KG4A2X7P.js} +9 -3
- package/dist/{audit-6TOCAMKO.js → audit-65VNHEV2.js} +2 -2
- package/dist/{chunk-K34IM5CT.js → chunk-2OGV6IRV.js} +196 -626
- package/dist/chunk-2OGV6IRV.js.map +1 -0
- package/dist/{chunk-NTNILOBC.js → chunk-5BO3MI5Y.js} +4 -4
- package/dist/{chunk-XLZ7U46Z.js → chunk-CVMVPYAL.js} +9 -60
- package/dist/chunk-CVMVPYAL.js.map +1 -0
- package/dist/{chunk-URUTVZ7N.js → chunk-FL4ZCQLD.js} +2 -2
- package/dist/{chunk-LW7MMEAQ.js → chunk-FT2M4R4F.js} +2 -2
- package/dist/{chunk-5BSLGBYI.js → chunk-JCQZ6LA7.js} +2 -8
- package/dist/{chunk-5BSLGBYI.js.map → chunk-JCQZ6LA7.js.map} +1 -1
- package/dist/{chunk-KHJS6VIA.js → chunk-LRQ6RBJC.js} +157 -112
- package/dist/chunk-LRQ6RBJC.js.map +1 -0
- package/dist/{chunk-WN6XJWOS.js → chunk-MNJXXD6C.js} +274 -743
- package/dist/chunk-MNJXXD6C.js.map +1 -0
- package/dist/{chunk-KK73ZB4E.js → chunk-PTR5PMPE.js} +153 -132
- package/dist/chunk-PTR5PMPE.js.map +1 -0
- package/dist/{chunk-B2WTCLCV.js → chunk-Q7APDV6H.js} +18 -8
- package/dist/chunk-Q7APDV6H.js.map +1 -0
- package/dist/{chunk-A4FUBC7B.js → chunk-QGVSOUJ2.js} +2 -4
- package/dist/{chunk-A4FUBC7B.js.map → chunk-QGVSOUJ2.js.map} +1 -1
- package/dist/{chunk-FGMFQSHX.js → chunk-S63MFSY6.js} +500 -551
- package/dist/chunk-S63MFSY6.js.map +1 -0
- package/dist/{chunk-AFGTSUAD.js → chunk-VSOKOFRF.js} +4 -4
- package/dist/chunk-WUXCWRL6.js +20 -0
- package/dist/chunk-WUXCWRL6.js.map +1 -0
- package/dist/{chunk-Y6TXWPJO.js → chunk-YVVGHRGI.js} +105 -31
- package/dist/chunk-YVVGHRGI.js.map +1 -0
- package/dist/{chunk-M5IWZRBT.js → chunk-ZMNXIJP4.js} +2187 -981
- package/dist/chunk-ZMNXIJP4.js.map +1 -0
- package/dist/components.d.ts +6 -6
- package/dist/components.js +14 -18
- package/dist/components.js.map +1 -1
- package/dist/{database-C3Szpi5J.d.ts → database-BXAfr2Y_.d.ts} +18 -0
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +8 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +19 -27
- package/dist/index.js +21 -29
- package/dist/index.js.map +1 -1
- package/dist/{organisation-BtshODVF.d.ts → organisation-D6qRDtbF.d.ts} +1 -1
- package/dist/providers.d.ts +7 -21
- package/dist/providers.js +3 -10
- package/dist/rbac/index.d.ts +71 -221
- package/dist/rbac/index.js +15 -16
- package/dist/{types-CGX9Vyf5.d.ts → types-BDg1mAGG.d.ts} +36 -6
- package/dist/types.d.ts +3 -3
- package/dist/types.js +61 -18
- package/dist/types.js.map +1 -1
- package/dist/{unified-CM7T0aTK.d.ts → unified-DQ4VcT7H.d.ts} +1 -1
- package/dist/{usePublicRouteParams-B-CumWRc.d.ts → usePublicRouteParams-BlgwXweB.d.ts} +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +52 -9
- package/dist/utils.js.map +1 -1
- package/docs/CONTENT_AUDIT_REPORT.md +253 -0
- package/docs/DOCUMENTATION_AUDIT.md +172 -0
- package/docs/README.md +142 -147
- package/docs/STYLE_GUIDE.md +37 -0
- package/docs/api/classes/ColumnFactory.md +17 -17
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +4 -4
- package/docs/api/classes/MissingUserContextError.md +4 -4
- package/docs/api/classes/OrganisationContextRequiredError.md +4 -4
- package/docs/api/classes/PermissionDeniedError.md +5 -5
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +8 -8
- package/docs/api/classes/RBACCache.md +35 -5
- package/docs/api/classes/RBACEngine.md +49 -20
- package/docs/api/classes/RBACError.md +4 -4
- package/docs/api/classes/RBACNotInitializedError.md +4 -4
- 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 +4 -4
- 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 +11 -0
- package/docs/api/interfaces/DataTableAction.md +65 -29
- package/docs/api/interfaces/DataTableColumn.md +36 -23
- package/docs/api/interfaces/DataTableProps.md +80 -38
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- 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 +11 -11
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- 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 +7 -7
- 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 +16 -3
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- 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 +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- 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 +94 -521
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +16 -16
- 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/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +251 -269
- package/docs/api-reference/components.md +193 -0
- package/docs/api-reference/hooks.md +265 -0
- package/docs/api-reference/providers.md +6 -0
- package/docs/api-reference/types.md +6 -0
- package/docs/api-reference/utilities.md +207 -0
- package/docs/architecture/README.md +6 -0
- package/docs/{database-schema-requirements.md → architecture/database-schema-requirements.md} +6 -0
- package/docs/architecture/rbac-security-architecture.md +258 -0
- package/docs/architecture/services.md +9 -1
- package/docs/best-practices/README.md +6 -0
- package/docs/best-practices/accessibility.md +6 -0
- package/docs/{common-patterns.md → best-practices/common-patterns.md} +6 -0
- package/docs/best-practices/deployment.md +6 -0
- package/docs/best-practices/performance.md +475 -2
- package/docs/best-practices/security.md +6 -0
- package/docs/best-practices/testing.md +6 -0
- package/docs/core-concepts/authentication.md +6 -0
- package/docs/core-concepts/events.md +6 -0
- package/docs/core-concepts/organisations.md +6 -0
- package/docs/core-concepts/permissions.md +6 -0
- package/docs/core-concepts/rbac-system.md +8 -0
- package/docs/documentation-index.md +121 -182
- package/docs/{consuming-app-vite-config.md → getting-started/consuming-app-vite-config.md} +6 -0
- package/docs/getting-started/documentation-index.md +40 -0
- package/docs/getting-started/examples/README.md +878 -35
- package/docs/{faq.md → getting-started/faq.md} +7 -1
- package/docs/getting-started/installation-guide.md +6 -0
- package/docs/{quick-reference.md → getting-started/quick-reference.md} +6 -0
- package/docs/implementation-guides/app-layout.md +6 -0
- package/docs/implementation-guides/authentication.md +1021 -0
- package/docs/implementation-guides/component-styling.md +6 -0
- package/docs/implementation-guides/data-tables.md +1264 -2076
- package/docs/implementation-guides/dynamic-colors.md +6 -0
- package/docs/implementation-guides/event-theming-summary.md +6 -0
- package/docs/{file-reference-system.md → implementation-guides/file-reference-system.md} +6 -0
- package/docs/implementation-guides/file-upload-storage.md +6 -0
- package/docs/implementation-guides/forms.md +6 -0
- package/docs/implementation-guides/inactivity-tracking.md +6 -0
- package/docs/implementation-guides/navigation.md +6 -0
- package/docs/implementation-guides/organisation-security.md +6 -0
- package/docs/implementation-guides/permission-enforcement.md +6 -0
- package/docs/implementation-guides/public-pages-advanced.md +6 -0
- package/docs/implementation-guides/public-pages.md +6 -0
- package/docs/migration/MIGRATION_GUIDE.md +827 -351
- package/docs/migration/README.md +7 -1
- package/docs/migration/organisation-context-timing-fix.md +6 -0
- package/docs/migration/rbac-migration.md +44 -1
- package/docs/migration/service-architecture.md +6 -0
- package/docs/migration/v0.4.15-tailwind-scanning.md +6 -0
- package/docs/migration/v0.4.16-css-first-approach.md +6 -0
- package/docs/migration/v0.4.17-source-path-fix.md +6 -0
- package/docs/rbac/README-rbac-rls-integration.md +6 -0
- package/docs/rbac/README.md +6 -0
- package/docs/rbac/advanced-patterns.md +6 -0
- package/docs/rbac/api-reference.md +7 -1
- package/docs/rbac/breaking-changes-v3.md +222 -0
- package/docs/rbac/examples/rbac-rls-integration-example.md +6 -0
- package/docs/rbac/examples.md +6 -0
- package/docs/rbac/getting-started.md +6 -0
- package/docs/rbac/migration-guide.md +260 -0
- package/docs/rbac/quick-start.md +70 -13
- package/docs/rbac/rbac-rls-integration.md +6 -0
- package/docs/rbac/super-admin-guide.md +6 -0
- package/docs/rbac/troubleshooting.md +6 -0
- package/docs/security/README.md +6 -0
- package/docs/security/checklist.md +6 -0
- package/docs/styles/README.md +7 -1
- package/docs/{usage.md → styles/usage.md} +6 -0
- package/docs/testing/README.md +6 -0
- package/docs/{visual-testing.md → testing/visual-testing.md} +6 -0
- package/docs/troubleshooting/README.md +387 -5
- package/docs/troubleshooting/cake-page-permission-guard-issue-summary.md +6 -0
- package/docs/troubleshooting/common-issues.md +6 -0
- package/docs/troubleshooting/database-view-compatibility.md +6 -0
- package/docs/troubleshooting/organisation-context-setup.md +6 -0
- package/docs/troubleshooting/react-hooks-issue-analysis.md +6 -0
- package/docs/troubleshooting/styling-issues.md +6 -0
- package/docs/troubleshooting/tailwind-content-scanning.md +6 -0
- package/package.json +1 -1
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -1
- package/src/__tests__/helpers/test-providers.tsx +3 -53
- package/src/components/DataTable/DataTable.test.tsx +319 -0
- package/src/components/DataTable/DataTable.tsx +32 -11
- package/src/components/DataTable/__tests__/{DataTable.comprehensive.test.tsx → DataTable.comprehensive.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/{DataTable.test.tsx → DataTable.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +31 -9
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +601 -0
- package/src/components/DataTable/__tests__/keyboard.test.tsx +615 -0
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +639 -0
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx.skip +330 -0
- package/src/components/DataTable/components/AccessDeniedPage.tsx +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +88 -104
- package/src/components/DataTable/components/DataTableCore.tsx +309 -337
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +4 -2
- package/src/components/DataTable/components/DataTableModals.tsx +22 -1
- package/src/components/DataTable/components/EditableRow.tsx +69 -84
- package/src/components/DataTable/components/EmptyState.tsx +5 -1
- package/src/components/DataTable/components/ImportModal.tsx +65 -36
- package/src/components/DataTable/components/PaginationControls.tsx +40 -100
- package/src/components/DataTable/components/UnifiedTableBody.tsx +125 -148
- package/src/components/DataTable/context/DataTableContext.tsx +1 -1
- package/src/components/DataTable/core/ColumnFactory.ts +5 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +12 -10
- package/src/components/DataTable/examples/HierarchicalExample.tsx +1 -1
- package/src/components/DataTable/examples/InitialPageSizeExample.tsx +1 -0
- package/src/components/DataTable/examples/PerformanceExample.tsx +1 -0
- package/src/components/DataTable/hooks/__tests__/useColumnOrderPersistence.test.ts +1 -5
- package/src/components/DataTable/hooks/__tests__/useColumnVisibilityPersistence.test.ts +167 -0
- package/src/components/DataTable/hooks/index.ts +7 -0
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +32 -15
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +102 -0
- package/src/components/DataTable/hooks/useDataTableConfiguration.ts +89 -0
- package/src/components/DataTable/hooks/useDataTableDataPipeline.ts +117 -0
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +71 -27
- package/src/components/DataTable/hooks/useDataTableState.ts +39 -11
- package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +33 -0
- package/src/components/DataTable/hooks/useHierarchicalState.ts +15 -1
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +447 -0
- package/src/components/DataTable/hooks/useServerSideDataEffect.ts +94 -0
- package/src/components/DataTable/hooks/useTableColumns.ts +10 -7
- package/src/components/DataTable/hooks/useTableHandlers.ts +174 -0
- package/src/components/DataTable/index.ts +12 -3
- package/src/components/DataTable/types.ts +129 -9
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +159 -22
- package/src/components/DataTable/utils/__tests__/flexibleImport.test.ts +111 -0
- package/src/components/DataTable/utils/__tests__/rowUtils.test.ts +15 -29
- package/src/components/DataTable/utils/a11yUtils.ts +244 -0
- package/src/components/DataTable/utils/debugTools.ts +609 -0
- package/src/components/DataTable/utils/exportUtils.ts +114 -16
- package/src/components/DataTable/utils/flexibleImport.ts +202 -32
- package/src/components/DataTable/utils/hierarchicalUtils.ts +1 -1
- package/src/components/DataTable/utils/index.ts +2 -0
- package/src/components/DataTable/utils/paginationUtils.ts +350 -0
- package/src/components/DataTable/utils/rowUtils.ts +6 -5
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -24
- package/src/components/NavigationMenu/NavigationMenu.tsx +19 -8
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +1 -23
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +56 -6
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +137 -13
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -0
- package/src/components/examples/PermissionExample.tsx +173 -0
- package/src/examples/CorrectPublicPageImplementation.tsx +301 -0
- package/src/examples/PublicEventPage.tsx +274 -0
- package/src/examples/PublicPageApp.tsx +308 -0
- package/src/examples/PublicPageUsageExample.tsx +216 -0
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +12 -1
- package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +129 -17
- package/src/hooks/__tests__/useRBAC.unit.test.ts +151 -846
- package/src/hooks/useOrganisationPermissions.test.ts +42 -18
- package/src/hooks/useOrganisationPermissions.ts +12 -6
- package/src/hooks/useOrganisationSecurity.test.ts +138 -85
- package/src/hooks/useOrganisationSecurity.ts +41 -10
- package/src/index.ts +0 -1
- package/src/providers/AuthProvider.simplified.tsx +880 -0
- package/src/providers/UnifiedAuthProvider.test.simple.tsx +8 -8
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +29 -19
- package/src/providers/index.ts +0 -1
- package/src/providers/services/EventServiceProvider.tsx +19 -15
- package/src/providers/services/InactivityServiceProvider.tsx +19 -15
- package/src/providers/services/OrganisationServiceProvider.tsx +19 -15
- package/src/providers/services/UnifiedAuthProvider.tsx +156 -127
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +1 -1
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +3 -3
- package/src/rbac/README.md +1 -1
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +25 -27
- package/src/rbac/__tests__/auth-rbac-security.integration.test.tsx +313 -0
- package/src/rbac/__tests__/engine.comprehensive.test.ts +114 -348
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +28 -110
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +33 -85
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +2 -2
- package/src/rbac/adapters.tsx +26 -69
- package/src/rbac/api.test.ts +90 -27
- package/src/rbac/api.ts +61 -10
- package/src/rbac/audit.test.ts +33 -38
- package/src/rbac/audit.ts +21 -6
- package/src/rbac/cache.ts +33 -1
- package/src/rbac/components/NavigationGuard.tsx +11 -11
- package/src/rbac/components/NavigationProvider.test.tsx +11 -5
- package/src/rbac/components/NavigationProvider.tsx +37 -13
- package/src/rbac/components/PagePermissionGuard.tsx +111 -50
- package/src/rbac/components/PagePermissionProvider.tsx +5 -5
- package/src/rbac/components/PermissionEnforcer.tsx +11 -11
- package/src/rbac/components/RoleBasedRouter.tsx +5 -5
- package/src/rbac/components/SecureDataProvider.tsx +5 -5
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +8 -8
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +14 -14
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +12 -12
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +6 -6
- package/src/rbac/engine.test.simple.ts +19 -13
- package/src/rbac/engine.test.ts +1 -0
- package/src/rbac/engine.ts +330 -766
- package/src/rbac/errors.ts +156 -0
- package/src/rbac/hooks/usePermissions.ts +32 -10
- package/src/rbac/hooks/useRBAC.test.ts +126 -512
- package/src/rbac/hooks/useRBAC.ts +147 -193
- package/src/rbac/hooks/useResolvedScope.ts +12 -0
- package/src/rbac/index.ts +7 -4
- package/src/rbac/security.ts +109 -18
- package/src/rbac/types.ts +12 -1
- package/src/services/AuthService.ts +2 -15
- package/src/services/EventService.ts +43 -46
- package/src/services/OrganisationService.ts +51 -31
- package/src/services/__tests__/AuthService.test.ts +1 -1
- package/src/services/__tests__/EventService.test.ts +1 -1
- package/src/services/__tests__/OrganisationService.test.ts +1 -1
- package/src/services/base/BaseService.ts +8 -0
- package/src/styles/base.css +208 -0
- package/src/styles/semantic.css +24 -0
- package/src/types/database.generated.ts +7347 -0
- package/src/types/database.ts +20 -0
- package/src/utils/logger.ts +179 -0
- package/src/utils/organisationContext.ts +11 -4
- package/src/utils/storage/__tests__/helpers.unit.test.ts +6 -2
- package/dist/appNameResolver-UURKN7NF.js +0 -22
- package/dist/audit-6TOCAMKO.js.map +0 -1
- package/dist/chunk-B2WTCLCV.js.map +0 -1
- package/dist/chunk-FGMFQSHX.js.map +0 -1
- package/dist/chunk-K34IM5CT.js.map +0 -1
- package/dist/chunk-KHJS6VIA.js.map +0 -1
- package/dist/chunk-KK73ZB4E.js.map +0 -1
- package/dist/chunk-M5IWZRBT.js.map +0 -1
- package/dist/chunk-ULBI5JGB.js +0 -109
- package/dist/chunk-ULBI5JGB.js.map +0 -1
- package/dist/chunk-WN6XJWOS.js.map +0 -1
- package/dist/chunk-XLZ7U46Z.js.map +0 -1
- package/dist/chunk-Y6TXWPJO.js.map +0 -1
- package/docs/DOCUMENTATION_CHECKLIST.md +0 -281
- package/docs/TERMINOLOGY.md +0 -231
- package/docs/api/interfaces/RBACContextType.md +0 -468
- package/docs/api/interfaces/RBACProviderProps.md +0 -107
- package/docs/best-practices/performance-expansion.md +0 -473
- package/docs/breaking-changes.md +0 -179
- package/docs/consuming-app-example.md +0 -290
- package/docs/documentation-templates.md +0 -539
- package/docs/examples/navigation-menu-auth-fix.md +0 -344
- package/docs/getting-started/examples/basic-auth-app.md +0 -520
- package/docs/getting-started/examples/full-featured-app.md +0 -616
- package/docs/getting-started/quick-start.md +0 -376
- package/docs/implementation-guides/datatable-filtering.md +0 -313
- package/docs/implementation-guides/datatable-rbac-usage.md +0 -317
- package/docs/implementation-guides/hierarchical-datatable.md +0 -850
- package/docs/implementation-guides/large-datasets.md +0 -281
- package/docs/implementation-guides/performance.md +0 -403
- package/docs/migration/quick-migration-guide.md +0 -320
- package/docs/migration-guide.md +0 -193
- package/docs/migration-guides/unified-auth-provider-mandatory-timeouts.md +0 -226
- package/docs/performance/README.md +0 -551
- package/docs/style-guide.md +0 -964
- package/docs/troubleshooting/authentication-issues.md +0 -334
- package/docs/troubleshooting/debugging.md +0 -1117
- package/docs/troubleshooting/migration.md +0 -918
- package/src/__tests__/hooks/usePermissions.test.ts +0 -261
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +0 -574
- package/src/hooks/__tests__/ServiceHooks.test.tsx +0 -613
- package/src/hooks/services/__tests__/useServiceHooks.test.tsx +0 -137
- package/src/hooks/services/usePermissions.ts +0 -70
- package/src/hooks/services/useRBACService.ts +0 -30
- package/src/hooks/usePermissionCheck.ts +0 -150
- package/src/providers/__tests__/ServiceProviders.test.tsx +0 -477
- package/src/providers/services/RBACServiceProvider.tsx +0 -79
- package/src/rbac/__tests__/integration.authflow.test.tsx +0 -119
- package/src/rbac/__tests__/integration.navigation.test.tsx +0 -69
- package/src/rbac/__tests__/integration.securedata.test.tsx +0 -92
- package/src/rbac/__tests__/integration.smoke.test.tsx +0 -73
- package/src/rbac/providers/RBACProvider.tsx +0 -645
- package/src/rbac/providers/__tests__/RBACProvider.integration.test.tsx +0 -688
- package/src/rbac/providers/__tests__/RBACProvider.test.tsx +0 -1186
- package/src/rbac/providers/index.ts +0 -11
- package/src/services/RBACService.ts +0 -522
- package/src/services/__tests__/RBACService.test.ts +0 -492
- package/src/services/interfaces/IRBACService.ts +0 -62
- package/src/utils/appNameResolver.test 2.ts +0 -494
- /package/dist/{DataTable-4GAVPIEG.js.map → DataTable-ETGVF4Y5.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-3NKDOSOK.js.map → UnifiedAuthProvider-P5SOJAQ6.js.map} +0 -0
- /package/dist/{api-DDMUKIUD.js.map → api-KG4A2X7P.js.map} +0 -0
- /package/dist/{appNameResolver-UURKN7NF.js.map → audit-65VNHEV2.js.map} +0 -0
- /package/dist/{chunk-NTNILOBC.js.map → chunk-5BO3MI5Y.js.map} +0 -0
- /package/dist/{chunk-URUTVZ7N.js.map → chunk-FL4ZCQLD.js.map} +0 -0
- /package/dist/{chunk-LW7MMEAQ.js.map → chunk-FT2M4R4F.js.map} +0 -0
- /package/dist/{chunk-AFGTSUAD.js.map → chunk-VSOKOFRF.js.map} +0 -0
- /package/docs/{app.css.example → styles/app.css.example} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
ColumnFiltersState,
|
|
4
|
+
ExpandedState,
|
|
5
|
+
GroupingState,
|
|
6
|
+
PaginationState,
|
|
7
|
+
SortingState,
|
|
8
|
+
VisibilityState,
|
|
9
|
+
} from '@tanstack/react-table';
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
DataRecord,
|
|
13
|
+
DataTableState,
|
|
14
|
+
DataTableStateActions,
|
|
15
|
+
} from './useDataTableState';
|
|
16
|
+
|
|
17
|
+
export interface TableLayoutChange {
|
|
18
|
+
columnOrder: string[];
|
|
19
|
+
columnVisibility: VisibilityState;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TableStateSnapshot<TData extends DataRecord> {
|
|
23
|
+
sorting: SortingState;
|
|
24
|
+
columnFilters: ColumnFiltersState;
|
|
25
|
+
columnVisibility: VisibilityState;
|
|
26
|
+
rowSelection: Record<string, boolean>;
|
|
27
|
+
grouping: GroupingState;
|
|
28
|
+
expanded: ExpandedState;
|
|
29
|
+
pagination: PaginationState;
|
|
30
|
+
globalFilter: string;
|
|
31
|
+
columnOrder: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface TableHandlers {
|
|
35
|
+
onSortingChange: (updaterOrValue: unknown) => void;
|
|
36
|
+
onColumnFiltersChange: (updaterOrValue: unknown) => void;
|
|
37
|
+
onColumnVisibilityChange: (updaterOrValue: unknown) => void;
|
|
38
|
+
onRowSelectionChange: (updaterOrValue: unknown) => void;
|
|
39
|
+
onGroupingChange: (updaterOrValue: unknown) => void;
|
|
40
|
+
onExpandedChange: (updaterOrValue: unknown) => void;
|
|
41
|
+
onPaginationChange: (updaterOrValue: unknown) => void;
|
|
42
|
+
onColumnOrderChange: (updaterOrValue: unknown) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface UseTableHandlersOptions<TData extends DataRecord> {
|
|
46
|
+
state: DataTableState<TData>;
|
|
47
|
+
stateSnapshot: TableStateSnapshot<TData>;
|
|
48
|
+
actions: DataTableStateActions<TData>;
|
|
49
|
+
selection?: Record<string, boolean>;
|
|
50
|
+
onRowSelectionChange?: (selection: Record<string, boolean>) => void;
|
|
51
|
+
effectiveColumnOrder: string[];
|
|
52
|
+
canPersistVisibility: boolean;
|
|
53
|
+
canPersistOrder: boolean;
|
|
54
|
+
updateSavedColumnVisibility: (visibility: VisibilityState) => void;
|
|
55
|
+
updateColumnOrder: (order: string[]) => void;
|
|
56
|
+
onLayoutChange?: (layout: TableLayoutChange) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function useTableHandlers<TData extends DataRecord>({
|
|
60
|
+
state,
|
|
61
|
+
stateSnapshot,
|
|
62
|
+
actions,
|
|
63
|
+
selection,
|
|
64
|
+
onRowSelectionChange,
|
|
65
|
+
effectiveColumnOrder,
|
|
66
|
+
canPersistVisibility,
|
|
67
|
+
canPersistOrder,
|
|
68
|
+
updateSavedColumnVisibility,
|
|
69
|
+
updateColumnOrder,
|
|
70
|
+
onLayoutChange,
|
|
71
|
+
}: UseTableHandlersOptions<TData>): TableHandlers {
|
|
72
|
+
const handleSortingChange = useCallback((updaterOrValue: unknown) => {
|
|
73
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
74
|
+
? (updaterOrValue as (prev: SortingState) => SortingState)(stateSnapshot.sorting)
|
|
75
|
+
: updaterOrValue as SortingState;
|
|
76
|
+
actions.setSorting(nextValue);
|
|
77
|
+
}, [actions, stateSnapshot.sorting]);
|
|
78
|
+
|
|
79
|
+
const handleColumnFiltersChange = useCallback((updaterOrValue: unknown) => {
|
|
80
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
81
|
+
? (updaterOrValue as (prev: ColumnFiltersState) => ColumnFiltersState)(stateSnapshot.columnFilters)
|
|
82
|
+
: updaterOrValue as ColumnFiltersState;
|
|
83
|
+
actions.setColumnFilters(nextValue);
|
|
84
|
+
}, [actions, stateSnapshot.columnFilters]);
|
|
85
|
+
|
|
86
|
+
const handleColumnVisibilityChange = useCallback((updaterOrValue: unknown) => {
|
|
87
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
88
|
+
? (updaterOrValue as (prev: VisibilityState) => VisibilityState)(stateSnapshot.columnVisibility)
|
|
89
|
+
: updaterOrValue as VisibilityState;
|
|
90
|
+
|
|
91
|
+
actions.setColumnVisibility(nextValue);
|
|
92
|
+
|
|
93
|
+
if (canPersistVisibility) {
|
|
94
|
+
updateSavedColumnVisibility(nextValue);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onLayoutChange?.({
|
|
98
|
+
columnOrder: effectiveColumnOrder,
|
|
99
|
+
columnVisibility: nextValue,
|
|
100
|
+
});
|
|
101
|
+
}, [actions, stateSnapshot.columnVisibility, canPersistVisibility, updateSavedColumnVisibility, onLayoutChange, effectiveColumnOrder]);
|
|
102
|
+
|
|
103
|
+
const handleRowSelectionChange = useCallback((updaterOrValue: unknown) => {
|
|
104
|
+
const currentSelection = selection ?? state.rowSelection;
|
|
105
|
+
const nextSelection = typeof updaterOrValue === 'function'
|
|
106
|
+
? (updaterOrValue as (prev: Record<string, boolean>) => Record<string, boolean>)(currentSelection)
|
|
107
|
+
: updaterOrValue as Record<string, boolean>;
|
|
108
|
+
|
|
109
|
+
if (selection === undefined) {
|
|
110
|
+
actions.setRowSelection(nextSelection);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onRowSelectionChange?.(nextSelection);
|
|
115
|
+
}, [actions, selection, state.rowSelection, onRowSelectionChange]);
|
|
116
|
+
|
|
117
|
+
const handleGroupingChange = useCallback((updaterOrValue: unknown) => {
|
|
118
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
119
|
+
? (updaterOrValue as (prev: GroupingState) => GroupingState)(stateSnapshot.grouping)
|
|
120
|
+
: updaterOrValue as GroupingState;
|
|
121
|
+
actions.setGrouping(nextValue);
|
|
122
|
+
}, [actions, stateSnapshot.grouping]);
|
|
123
|
+
|
|
124
|
+
const handleExpandedChange = useCallback((updaterOrValue: unknown) => {
|
|
125
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
126
|
+
? (updaterOrValue as (prev: ExpandedState) => ExpandedState)(stateSnapshot.expanded)
|
|
127
|
+
: updaterOrValue as ExpandedState;
|
|
128
|
+
actions.setExpanded(nextValue);
|
|
129
|
+
}, [actions, stateSnapshot.expanded]);
|
|
130
|
+
|
|
131
|
+
const handlePaginationChange = useCallback((updaterOrValue: unknown) => {
|
|
132
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
133
|
+
? (updaterOrValue as (prev: PaginationState) => PaginationState)(stateSnapshot.pagination)
|
|
134
|
+
: updaterOrValue as PaginationState;
|
|
135
|
+
actions.setPagination(nextValue);
|
|
136
|
+
}, [actions, stateSnapshot.pagination]);
|
|
137
|
+
|
|
138
|
+
const handleColumnOrderChange = useCallback((updaterOrValue: unknown) => {
|
|
139
|
+
const nextValue = typeof updaterOrValue === 'function'
|
|
140
|
+
? (updaterOrValue as (prev: string[]) => string[])(stateSnapshot.columnOrder)
|
|
141
|
+
: updaterOrValue as string[];
|
|
142
|
+
|
|
143
|
+
actions.setColumnOrder(nextValue);
|
|
144
|
+
|
|
145
|
+
if (canPersistOrder) {
|
|
146
|
+
updateColumnOrder(nextValue);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
onLayoutChange?.({
|
|
150
|
+
columnOrder: nextValue,
|
|
151
|
+
columnVisibility: stateSnapshot.columnVisibility,
|
|
152
|
+
});
|
|
153
|
+
}, [actions, stateSnapshot.columnOrder, stateSnapshot.columnVisibility, canPersistOrder, updateColumnOrder, onLayoutChange]);
|
|
154
|
+
|
|
155
|
+
return useMemo(() => ({
|
|
156
|
+
onSortingChange: handleSortingChange,
|
|
157
|
+
onColumnFiltersChange: handleColumnFiltersChange,
|
|
158
|
+
onColumnVisibilityChange: handleColumnVisibilityChange,
|
|
159
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
160
|
+
onGroupingChange: handleGroupingChange,
|
|
161
|
+
onExpandedChange: handleExpandedChange,
|
|
162
|
+
onPaginationChange: handlePaginationChange,
|
|
163
|
+
onColumnOrderChange: handleColumnOrderChange,
|
|
164
|
+
}), [
|
|
165
|
+
handleSortingChange,
|
|
166
|
+
handleColumnFiltersChange,
|
|
167
|
+
handleColumnVisibilityChange,
|
|
168
|
+
handleRowSelectionChange,
|
|
169
|
+
handleGroupingChange,
|
|
170
|
+
handleExpandedChange,
|
|
171
|
+
handlePaginationChange,
|
|
172
|
+
handleColumnOrderChange,
|
|
173
|
+
]);
|
|
174
|
+
}
|
|
@@ -28,9 +28,9 @@ export { useDataTablePerformance } from '../../hooks/useDataTablePerformance';
|
|
|
28
28
|
export type { UseDataTablePerformanceOptions, UseDataTablePerformanceReturn } from '../../hooks/useDataTablePerformance';
|
|
29
29
|
|
|
30
30
|
// Type definitions
|
|
31
|
-
export type {
|
|
32
|
-
DataTableColumn,
|
|
33
|
-
DataTableAction,
|
|
31
|
+
export type {
|
|
32
|
+
DataTableColumn,
|
|
33
|
+
DataTableAction,
|
|
34
34
|
DataTableToolbarButton,
|
|
35
35
|
AggregateConfig,
|
|
36
36
|
EmptyStateConfig,
|
|
@@ -38,6 +38,7 @@ export type {
|
|
|
38
38
|
SimpleColumn,
|
|
39
39
|
// Feature configuration types
|
|
40
40
|
DataTableFeatureConfig,
|
|
41
|
+
NormalizedDataTableFeatureConfig,
|
|
41
42
|
// Performance types
|
|
42
43
|
PaginationMode,
|
|
43
44
|
PerformanceConfig,
|
|
@@ -46,6 +47,11 @@ export type {
|
|
|
46
47
|
SearchIndexConfig
|
|
47
48
|
} from './types';
|
|
48
49
|
|
|
50
|
+
export {
|
|
51
|
+
defaultDataTableFeatures,
|
|
52
|
+
normalizeDataTableFeatures,
|
|
53
|
+
} from './types';
|
|
54
|
+
|
|
49
55
|
// Re-export TanStack types for convenience
|
|
50
56
|
export type { ColumnDef, SortingState, ColumnFiltersState } from '@tanstack/react-table';
|
|
51
57
|
|
|
@@ -58,3 +64,6 @@ export * from './components';
|
|
|
58
64
|
// Utility functions
|
|
59
65
|
export * from './utils';
|
|
60
66
|
|
|
67
|
+
// Accessibility utilities
|
|
68
|
+
export { announce } from './utils/a11yUtils';
|
|
69
|
+
|
|
@@ -32,14 +32,38 @@ declare module '@tanstack/react-table' {
|
|
|
32
32
|
// ============================================================================
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Core value types that can exist in a data record
|
|
36
36
|
*/
|
|
37
|
-
export type
|
|
37
|
+
export type CellValue = string | number | boolean | null | undefined | Date;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base data record type - all DataTable data must extend this
|
|
41
|
+
* This is a marker type that allows any object to be used as a data record
|
|
42
|
+
* Individual implementations should define more specific types
|
|
43
|
+
*/
|
|
44
|
+
export interface DataRecord {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Row ID type - always a string
|
|
50
|
+
*/
|
|
51
|
+
export type RowId = string;
|
|
38
52
|
|
|
39
53
|
/**
|
|
40
54
|
* Row identifier function type
|
|
41
55
|
*/
|
|
42
|
-
export type GetRowId<TData extends DataRecord> = (row: TData, index: number) =>
|
|
56
|
+
export type GetRowId<TData extends DataRecord> = (row: TData, index: number) => RowId;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Generic type for partial data updates
|
|
60
|
+
*/
|
|
61
|
+
export type PartialDataRecord<TData extends DataRecord> = Partial<TData>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Generic type for complete data records
|
|
65
|
+
*/
|
|
66
|
+
export type CompleteDataRecord<TData extends DataRecord> = TData;
|
|
43
67
|
|
|
44
68
|
// ============================================================================
|
|
45
69
|
// HIERARCHICAL DATA TYPES
|
|
@@ -182,6 +206,32 @@ export interface ServerSideResponse<TData extends DataRecord> {
|
|
|
182
206
|
hasPreviousPage: boolean;
|
|
183
207
|
}
|
|
184
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Unified pagination configuration for consistent behavior across modes
|
|
211
|
+
*/
|
|
212
|
+
export interface PaginationConfig {
|
|
213
|
+
/** Pagination mode */
|
|
214
|
+
mode: PaginationMode;
|
|
215
|
+
/** Available page size options */
|
|
216
|
+
pageSizeOptions?: number[];
|
|
217
|
+
/** Initial page size */
|
|
218
|
+
initialPageSize?: number;
|
|
219
|
+
/** Show enhanced pagination controls (jump to page, etc.) */
|
|
220
|
+
enhanced?: boolean;
|
|
221
|
+
/** Show performance mode indicator */
|
|
222
|
+
showPerformanceInfo?: boolean;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Pagination callbacks for server-side and hybrid modes
|
|
227
|
+
*/
|
|
228
|
+
export interface PaginationCallbacks {
|
|
229
|
+
/** Called when page index changes */
|
|
230
|
+
onPageChange?: (pageIndex: number) => void;
|
|
231
|
+
/** Called when page size changes */
|
|
232
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
233
|
+
}
|
|
234
|
+
|
|
185
235
|
/**
|
|
186
236
|
* Data chunking configuration
|
|
187
237
|
*/
|
|
@@ -220,6 +270,8 @@ export interface DataTableColumn<TData extends DataRecord = DataRecord> extends
|
|
|
220
270
|
id?: string;
|
|
221
271
|
/** Accessor key for data */
|
|
222
272
|
accessorKey?: string;
|
|
273
|
+
/** Alternative accessor key used while editing */
|
|
274
|
+
editAccessorKey?: string;
|
|
223
275
|
/** Custom header label for the column */
|
|
224
276
|
header: string;
|
|
225
277
|
/** Whether this column should be searchable in global filter */
|
|
@@ -237,7 +289,7 @@ export interface DataTableColumn<TData extends DataRecord = DataRecord> extends
|
|
|
237
289
|
/** Enable virtual scrolling for this column */
|
|
238
290
|
virtualizable?: boolean;
|
|
239
291
|
/** Custom cell renderer with memoization */
|
|
240
|
-
memoizedCell?: React.ComponentType<
|
|
292
|
+
memoizedCell?: React.ComponentType<{ row: TData }>;
|
|
241
293
|
/** Field type for editing (text, select, date, etc.) */
|
|
242
294
|
fieldType?: 'text' | 'select' | 'date' | 'number' | 'boolean';
|
|
243
295
|
/** Options for select fields */
|
|
@@ -260,6 +312,18 @@ export interface DataTableColumn<TData extends DataRecord = DataRecord> extends
|
|
|
260
312
|
hideForChild?: boolean;
|
|
261
313
|
}
|
|
262
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Extended column definition used when rendering editable rows
|
|
317
|
+
*/
|
|
318
|
+
export interface EditableColumnDef<TData extends DataRecord = DataRecord> extends DataTableColumn<TData> {
|
|
319
|
+
/** Whether the column can be edited */
|
|
320
|
+
editable?: boolean;
|
|
321
|
+
/** Field type used to determine edit control */
|
|
322
|
+
fieldType?: 'text' | 'select' | 'date' | 'number' | 'boolean';
|
|
323
|
+
/** Options for select based editors */
|
|
324
|
+
fieldOptions?: Array<{ value: string | number; label: string }>;
|
|
325
|
+
}
|
|
326
|
+
|
|
263
327
|
/**
|
|
264
328
|
* Simple column interface for basic use cases
|
|
265
329
|
*/
|
|
@@ -281,6 +345,11 @@ export interface SimpleColumn<TData extends DataRecord = DataRecord> {
|
|
|
281
345
|
/**
|
|
282
346
|
* Action definition for row-level operations
|
|
283
347
|
*/
|
|
348
|
+
/**
|
|
349
|
+
* Boolean condition or predicate evaluated against a row
|
|
350
|
+
*/
|
|
351
|
+
export type ActionCondition<TData extends DataRecord> = boolean | ((row: TData) => boolean);
|
|
352
|
+
|
|
284
353
|
export interface DataTableAction<TData extends DataRecord> {
|
|
285
354
|
/** Display label for the action */
|
|
286
355
|
label: string;
|
|
@@ -291,9 +360,11 @@ export interface DataTableAction<TData extends DataRecord> {
|
|
|
291
360
|
/** Visual variant */
|
|
292
361
|
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost';
|
|
293
362
|
/** Whether action is disabled */
|
|
294
|
-
disabled?:
|
|
363
|
+
disabled?: ActionCondition<TData>;
|
|
295
364
|
/** Whether action is hidden (for RBAC) */
|
|
296
365
|
hidden?: boolean;
|
|
366
|
+
/** Explicit visibility override */
|
|
367
|
+
visible?: ActionCondition<TData>;
|
|
297
368
|
/** Test ID for testing */
|
|
298
369
|
testId?: string;
|
|
299
370
|
/** Whether this action should only show for parent rows (hierarchical mode) */
|
|
@@ -308,6 +379,12 @@ export interface DataTableAction<TData extends DataRecord> {
|
|
|
308
379
|
parentLabel?: string;
|
|
309
380
|
/** Label for child rows (overrides label when showForChild is true) */
|
|
310
381
|
childLabel?: string;
|
|
382
|
+
/** Whether the action should be shown while the row is in edit mode */
|
|
383
|
+
showInEditMode?: boolean;
|
|
384
|
+
/** Whether the action should be hidden while the row is in view mode */
|
|
385
|
+
hideInViewMode?: boolean;
|
|
386
|
+
/** Whether the action should explicitly render while in view mode */
|
|
387
|
+
showInViewMode?: boolean;
|
|
311
388
|
}
|
|
312
389
|
|
|
313
390
|
/**
|
|
@@ -362,7 +439,7 @@ export interface EmptyStateConfig {
|
|
|
362
439
|
* Unified feature configuration for DataTable
|
|
363
440
|
* All features are disabled by default and must be explicitly enabled
|
|
364
441
|
*/
|
|
365
|
-
export interface
|
|
442
|
+
export interface DataTableFeatureFlags {
|
|
366
443
|
// Core Features
|
|
367
444
|
/** Enable global search functionality */
|
|
368
445
|
search: boolean;
|
|
@@ -400,13 +477,56 @@ export interface DataTableFeatureConfig {
|
|
|
400
477
|
columnReordering: boolean;
|
|
401
478
|
/** Enable hierarchical parent/child rows */
|
|
402
479
|
hierarchical: boolean;
|
|
403
|
-
|
|
480
|
+
|
|
404
481
|
// Performance
|
|
405
482
|
// Virtualization is now handled automatically based on data size
|
|
406
|
-
|
|
483
|
+
|
|
407
484
|
// Layout
|
|
408
485
|
}
|
|
409
486
|
|
|
487
|
+
/**
|
|
488
|
+
* Consumer-facing feature configuration. All properties are optional and will be
|
|
489
|
+
* merged with {@link defaultDataTableFeatures} at runtime to keep the public API
|
|
490
|
+
* ergonomic while maintaining strict internal guarantees.
|
|
491
|
+
*/
|
|
492
|
+
export type DataTableFeatureConfig = Partial<DataTableFeatureFlags>;
|
|
493
|
+
|
|
494
|
+
/** Fully normalized feature configuration used internally by the table. */
|
|
495
|
+
export type NormalizedDataTableFeatureConfig = DataTableFeatureFlags;
|
|
496
|
+
|
|
497
|
+
/** Default feature configuration with every capability disabled. */
|
|
498
|
+
export const defaultDataTableFeatures: NormalizedDataTableFeatureConfig = {
|
|
499
|
+
search: false,
|
|
500
|
+
pagination: false,
|
|
501
|
+
sorting: false,
|
|
502
|
+
filtering: false,
|
|
503
|
+
import: false,
|
|
504
|
+
export: false,
|
|
505
|
+
selection: false,
|
|
506
|
+
creation: false,
|
|
507
|
+
editing: false,
|
|
508
|
+
deletion: false,
|
|
509
|
+
deleteSelected: false,
|
|
510
|
+
grouping: false,
|
|
511
|
+
columnVisibility: false,
|
|
512
|
+
columnReordering: false,
|
|
513
|
+
hierarchical: false,
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Normalize a potentially partial feature configuration. This keeps the
|
|
518
|
+
* rendering pipeline simple and predictable because downstream consumers can
|
|
519
|
+
* rely on every flag being present.
|
|
520
|
+
*/
|
|
521
|
+
export function normalizeDataTableFeatures(
|
|
522
|
+
features?: DataTableFeatureConfig
|
|
523
|
+
): NormalizedDataTableFeatureConfig {
|
|
524
|
+
return {
|
|
525
|
+
...defaultDataTableFeatures,
|
|
526
|
+
...(features ?? {}),
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
410
530
|
|
|
411
531
|
|
|
412
532
|
// ============================================================================
|
|
@@ -484,7 +604,7 @@ export interface DataTableProps<TData extends DataRecord> {
|
|
|
484
604
|
|
|
485
605
|
// NEW: Unified feature configuration
|
|
486
606
|
/** Feature configuration - all features are disabled by default */
|
|
487
|
-
features
|
|
607
|
+
features?: DataTableFeatureConfig;
|
|
488
608
|
|
|
489
609
|
// Hierarchical Configuration
|
|
490
610
|
/** Hierarchical parent/child row configuration */
|