@jmruthers/pace-core 0.5.191 → 0.6.1
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 +29 -0
- package/README.md +7 -1
- package/cursor-rules/00-pace-core-compliance.mdc +372 -0
- package/cursor-rules/01-standards-compliance.mdc +275 -0
- package/cursor-rules/02-project-structure.mdc +200 -0
- package/cursor-rules/03-solid-principles.mdc +341 -0
- package/cursor-rules/04-testing-standards.mdc +315 -0
- package/cursor-rules/05-bug-reports-and-features.mdc +246 -0
- package/cursor-rules/06-code-quality.mdc +392 -0
- package/cursor-rules/07-tech-stack-compliance.mdc +309 -0
- package/cursor-rules/CHANGELOG.md +101 -0
- package/cursor-rules/README.md +191 -0
- package/dist/{AuthService-CbP_utw2.d.ts → AuthService-DjnJHDtC.d.ts} +1 -0
- package/dist/{DataTable-Be6dH_dR.d.ts → DataTable-CH1U5Tpy.d.ts} +1 -1
- package/dist/{DataTable-WKRZD47S.js → DataTable-DQ7RSOHE.js} +8 -7
- package/dist/{PublicPageProvider-ULXC_u6U.d.ts → PublicPageProvider-ce4xlHYA.d.ts} +37 -156
- package/dist/{UnifiedAuthProvider-BYA9qB-o.d.ts → UnifiedAuthProvider-185Ih4dj.d.ts} +2 -0
- package/dist/{UnifiedAuthProvider-FTSG5XH7.js → UnifiedAuthProvider-ATAP5UTR.js} +3 -3
- package/dist/{api-IHKALJZD.js → api-N774RPUA.js} +2 -2
- package/dist/{chunk-6C4YBBJM.js → chunk-3QRJFVBR.js} +1 -1
- package/dist/chunk-3QRJFVBR.js.map +1 -0
- package/dist/{chunk-OETXORNB.js → chunk-3XTALGJF.js} +211 -136
- package/dist/chunk-3XTALGJF.js.map +1 -0
- package/dist/{chunk-6TQDD426.js → chunk-4N5C5XZU.js} +47 -228
- package/dist/chunk-4N5C5XZU.js.map +1 -0
- package/dist/{chunk-LOMZXPSN.js → chunk-4ZC4GX36.js} +47 -74
- package/dist/chunk-4ZC4GX36.js.map +1 -0
- package/dist/{chunk-6LTQQAT6.js → chunk-BYFSK72L.js} +357 -158
- package/dist/chunk-BYFSK72L.js.map +1 -0
- package/dist/{chunk-XYXSXPUK.js → chunk-EXUD6RNJ.js} +50 -10
- package/dist/chunk-EXUD6RNJ.js.map +1 -0
- package/dist/{chunk-VKB2CO4Z.js → chunk-GLK6VM3F.js} +244 -249
- package/dist/chunk-GLK6VM3F.js.map +1 -0
- package/dist/{chunk-HW3OVDUF.js → chunk-J36DSWQK.js} +1 -1
- package/dist/{chunk-HW3OVDUF.js.map → chunk-J36DSWQK.js.map} +1 -1
- package/dist/{chunk-XNYQOL3Z.js → chunk-JBKQ3SAO.js} +9 -18
- package/dist/chunk-JBKQ3SAO.js.map +1 -0
- package/dist/{chunk-ROXMHMY2.js → chunk-KNC55RTG.js} +13 -3
- package/dist/{chunk-ROXMHMY2.js.map → chunk-KNC55RTG.js.map} +1 -1
- package/dist/{chunk-QWWZ5CAQ.js → chunk-LXQLPRQ2.js} +2 -2
- package/dist/{chunk-ULHIJK66.js → chunk-T33XF5ZC.js} +255 -140
- package/dist/chunk-T33XF5ZC.js.map +1 -0
- package/dist/{chunk-VRGWKHDB.js → chunk-XM25TVIE.js} +100 -33
- package/dist/chunk-XM25TVIE.js.map +1 -0
- package/dist/components.d.ts +4 -4
- package/dist/components.js +9 -9
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +20 -25
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +3 -3
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +2 -20
- package/dist/rbac/index.js +7 -9
- package/dist/{usePublicRouteParams-TZe0gy-4.d.ts → usePublicRouteParams-BJAlWfuJ.d.ts} +3 -3
- package/dist/{useToast-C8gR5ir4.d.ts → useToast-AyaT-x7p.d.ts} +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- 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/Logger.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 +2 -2
- package/docs/api/classes/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +10 -10
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +1 -1
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AddressFieldProps.md +1 -1
- package/docs/api/interfaces/AddressFieldRef.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/AutocompleteOptions.md +1 -1
- package/docs/api/interfaces/AvatarProps.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.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/ComplianceResult.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/DatabaseComplianceResult.md +1 -1
- package/docs/api/interfaces/DatabaseIssue.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 +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +24 -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/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.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/LoggerConfig.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
- 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 +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.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/QuickFix.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +2 -2
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +2 -2
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +2 -2
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +2 -2
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +2 -2
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +2 -2
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.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 +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.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/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.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 +60 -38
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
- package/docs/api/interfaces/UseFormDialogReturn.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 +2 -2
- 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 +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.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 +194 -209
- package/docs/getting-started/cursor-rules.md +262 -0
- package/docs/getting-started/installation-guide.md +6 -1
- package/docs/getting-started/quick-start.md +6 -1
- package/docs/migration/MIGRATION_GUIDE.md +4 -4
- package/docs/migration/REACT_19_MIGRATION.md +227 -0
- package/docs/migration/database-changes-december-2025.md +2 -1
- package/docs/rbac/event-based-apps.md +124 -6
- package/docs/standards/README.md +39 -0
- package/docs/troubleshooting/migration.md +4 -4
- package/examples/PublicPages/PublicEventPage.tsx +1 -1
- package/package.json +11 -6
- package/scripts/audit-consuming-app.cjs +961 -0
- package/scripts/check-pace-core-compliance.cjs +315 -61
- package/scripts/install-cursor-rules.cjs +236 -0
- package/src/__tests__/helpers/test-providers.tsx +1 -1
- package/src/__tests__/helpers/test-utils.tsx +1 -1
- package/src/__tests__/rls-policies.test.ts +3 -1
- package/src/components/Badge/Badge.tsx +2 -4
- package/src/components/Button/Button.tsx +5 -4
- package/src/components/Calendar/Calendar.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +57 -93
- package/src/components/DataTable/DataTable.tsx +2 -2
- package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +172 -45
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +121 -28
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +9 -8
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +20 -52
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +170 -34
- package/src/components/DataTable/__tests__/keyboard.test.tsx +75 -12
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +88 -16
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx +12 -12
- package/src/components/DataTable/components/AccessDeniedPage.tsx +1 -1
- package/src/components/DataTable/components/BulkOperationsDropdown.tsx +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +4 -7
- package/src/components/DataTable/components/DataTableModals.tsx +1 -1
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +86 -17
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +23 -23
- package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +11 -11
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +36 -36
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +27 -27
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +39 -39
- package/src/components/DataTable/components/__tests__/UnifiedTableBody.test.tsx +33 -33
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +29 -29
- package/src/components/DataTable/hooks/useColumnReordering.ts +2 -2
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +75 -10
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +2 -2
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +8 -14
- package/src/components/Dialog/Dialog.tsx +6 -5
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +1 -1
- package/src/components/EventSelector/EventSelector.tsx +1 -1
- package/src/components/FileDisplay/FileDisplay.test.tsx +4 -3
- package/src/components/FileDisplay/FileDisplay.tsx +16 -4
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +36 -15
- package/src/components/Form/Form.tsx +30 -26
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +40 -40
- package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +1 -1
- package/src/components/Input/Input.tsx +28 -30
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoadingSpinner/LoadingSpinner.tsx +1 -1
- package/src/components/LoginForm/LoginForm.test.tsx +42 -42
- package/src/components/LoginForm/LoginForm.tsx +8 -8
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +6 -4
- package/src/components/NavigationMenu/NavigationMenu.tsx +2 -11
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +0 -1
- package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +1 -1
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +75 -52
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +98 -69
- package/src/components/PaceAppLayout/README.md +1 -1
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -8
- package/src/components/PasswordChange/PasswordChangeForm.test.tsx +33 -33
- package/src/components/PasswordChange/PasswordChangeForm.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +5 -9
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +0 -1
- package/src/components/PublicLayout/PublicPageLayout.tsx +1 -1
- package/src/components/PublicLayout/PublicPageProvider.tsx +0 -1
- package/src/components/Select/Select.tsx +33 -22
- package/src/components/SessionRestorationLoader/SessionRestorationLoader.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +27 -29
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/UserMenu/UserMenu.tsx +1 -1
- package/src/hooks/__tests__/hooks.integration.test.tsx +80 -55
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +14 -7
- package/src/hooks/__tests__/useStorage.unit.test.ts +36 -36
- package/src/hooks/public/usePublicEvent.ts +1 -1
- package/src/hooks/public/usePublicEventLogo.ts +1 -1
- package/src/hooks/public/usePublicRouteParams.ts +1 -1
- package/src/hooks/services/useAuthService.ts +21 -3
- package/src/hooks/services/useEventService.ts +21 -3
- package/src/hooks/services/useInactivityService.ts +21 -3
- package/src/hooks/services/useOrganisationService.ts +21 -3
- package/src/hooks/useDataTableState.ts +8 -18
- package/src/hooks/useFileDisplay.ts +10 -17
- package/src/hooks/useFocusManagement.ts +2 -2
- package/src/hooks/useFocusTrap.ts +4 -4
- package/src/hooks/useFormDialog.ts +8 -7
- package/src/hooks/useInactivityTracker.ts +1 -1
- package/src/hooks/usePermissionCache.ts +1 -1
- package/src/hooks/useSecureDataAccess.test.ts +16 -9
- package/src/hooks/useSecureDataAccess.ts +22 -6
- package/src/hooks/useToast.ts +2 -2
- package/src/providers/__tests__/OrganisationProvider.test.tsx +57 -13
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +21 -6
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +10 -10
- package/src/providers/services/EventServiceProvider.tsx +0 -8
- package/src/providers/services/UnifiedAuthProvider.tsx +196 -46
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +13 -3
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +34 -40
- package/src/rbac/__tests__/isSuperAdmin.real.test.ts +82 -0
- package/src/rbac/adapters.tsx +3 -22
- package/src/rbac/api.test.ts +2 -2
- package/src/rbac/api.ts +7 -1
- package/src/rbac/components/EnhancedNavigationMenu.tsx +3 -16
- package/src/rbac/components/NavigationGuard.tsx +2 -11
- package/src/rbac/components/NavigationProvider.tsx +1 -2
- package/src/rbac/components/PagePermissionGuard.tsx +1 -1
- package/src/rbac/components/PagePermissionProvider.tsx +1 -1
- package/src/rbac/components/PermissionEnforcer.tsx +46 -13
- package/src/rbac/components/RoleBasedRouter.tsx +1 -1
- package/src/rbac/components/SecureDataProvider.tsx +1 -2
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +7 -43
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +4 -11
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +3 -3
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +1 -1
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +1 -1
- package/src/rbac/engine.ts +14 -2
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/usePermissions.ts +51 -11
- package/src/rbac/hooks/useRBAC.ts +3 -13
- package/src/rbac/hooks/useResolvedScope.test.ts +75 -54
- package/src/rbac/hooks/useResolvedScope.ts +58 -33
- package/src/rbac/hooks/useSecureSupabase.ts +4 -9
- package/src/rbac/secureClient.ts +43 -0
- package/src/services/EventService.ts +4 -57
- package/src/services/InactivityService.ts +127 -34
- package/src/services/OrganisationService.ts +68 -10
- package/src/utils/security/secureDataAccess.test.ts +31 -20
- package/src/utils/security/secureDataAccess.ts +4 -3
- package/dist/chunk-6C4YBBJM.js.map +0 -1
- package/dist/chunk-6LTQQAT6.js.map +0 -1
- package/dist/chunk-6TQDD426.js.map +0 -1
- package/dist/chunk-LOMZXPSN.js.map +0 -1
- package/dist/chunk-OETXORNB.js.map +0 -1
- package/dist/chunk-ULHIJK66.js.map +0 -1
- package/dist/chunk-VKB2CO4Z.js.map +0 -1
- package/dist/chunk-VRGWKHDB.js.map +0 -1
- package/dist/chunk-XNYQOL3Z.js.map +0 -1
- package/dist/chunk-XYXSXPUK.js.map +0 -1
- package/scripts/check-pace-core-compliance.js +0 -512
- package/src/rbac/hooks/useSuperAdminBypass.ts +0 -126
- package/src/utils/context/superAdminOverride.ts +0 -58
- /package/dist/{DataTable-WKRZD47S.js.map → DataTable-DQ7RSOHE.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-FTSG5XH7.js.map → UnifiedAuthProvider-ATAP5UTR.js.map} +0 -0
- /package/dist/{api-IHKALJZD.js.map → api-N774RPUA.js.map} +0 -0
- /package/dist/{chunk-QWWZ5CAQ.js.map → chunk-LXQLPRQ2.js.map} +0 -0
- /package/examples/{rbac → RBAC}/CompleteRBACExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/EventBasedApp.tsx +0 -0
- /package/examples/{rbac → RBAC}/PermissionExample.tsx +0 -0
- /package/examples/{rbac → RBAC}/index.ts +0 -0
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XM25TVIE.js";
|
|
4
4
|
import {
|
|
5
5
|
toast,
|
|
6
6
|
useDataTablePerformance
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3QRJFVBR.js";
|
|
8
8
|
import {
|
|
9
9
|
useResolvedScope
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3XTALGJF.js";
|
|
11
11
|
import {
|
|
12
12
|
useUnifiedAuth
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BYFSK72L.js";
|
|
14
|
+
import {
|
|
15
|
+
isSuperAdmin
|
|
16
|
+
} from "./chunk-KNC55RTG.js";
|
|
14
17
|
import {
|
|
15
18
|
cn,
|
|
16
19
|
renderSafeHtml
|
|
@@ -5508,7 +5511,7 @@ var require_lodash = __commonJS({
|
|
|
5508
5511
|
import React21 from "react";
|
|
5509
5512
|
|
|
5510
5513
|
// src/components/DataTable/components/DataTableCore.tsx
|
|
5511
|
-
import React20, { useMemo as useMemo14, useCallback as
|
|
5514
|
+
import React20, { useMemo as useMemo14, useCallback as useCallback9, useEffect as useEffect12, useRef as useRef6 } from "react";
|
|
5512
5515
|
import { useReactTable } from "@tanstack/react-table";
|
|
5513
5516
|
import { Edit, Trash, ChevronUp as ChevronUp2, ChevronDown as ChevronDown3, ChevronsUpDown } from "lucide-react";
|
|
5514
5517
|
|
|
@@ -5647,6 +5650,21 @@ var getTableCellClasses = (options = {}) => {
|
|
|
5647
5650
|
className
|
|
5648
5651
|
);
|
|
5649
5652
|
};
|
|
5653
|
+
var getTableRowClasses = (options = {}) => {
|
|
5654
|
+
const { isSelected = false, isVirtualized = false, className } = options;
|
|
5655
|
+
if (isVirtualized) {
|
|
5656
|
+
return cn(
|
|
5657
|
+
tableStyles.rowHover,
|
|
5658
|
+
isSelected && tableStyles.rowSelected,
|
|
5659
|
+
className
|
|
5660
|
+
);
|
|
5661
|
+
}
|
|
5662
|
+
return cn(
|
|
5663
|
+
tableStyles.row,
|
|
5664
|
+
isSelected && tableStyles.rowSelected,
|
|
5665
|
+
className
|
|
5666
|
+
);
|
|
5667
|
+
};
|
|
5650
5668
|
var getTableClasses = (options = {}) => {
|
|
5651
5669
|
const { isFixed = false, variant = "default", className } = options;
|
|
5652
5670
|
if (isFixed) {
|
|
@@ -5672,34 +5690,32 @@ var getTableClasses = (options = {}) => {
|
|
|
5672
5690
|
// src/components/Input/Input.tsx
|
|
5673
5691
|
import * as React3 from "react";
|
|
5674
5692
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
}
|
|
5702
|
-
);
|
|
5693
|
+
function Input({ className, variant = "default", size = "md", error, type, ref, ...props }) {
|
|
5694
|
+
return /* @__PURE__ */ jsx3(
|
|
5695
|
+
"input",
|
|
5696
|
+
{
|
|
5697
|
+
type,
|
|
5698
|
+
className: cn(
|
|
5699
|
+
// Base styles
|
|
5700
|
+
"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
5701
|
+
// Variant styles
|
|
5702
|
+
{
|
|
5703
|
+
"border-input": variant === "default" && !error,
|
|
5704
|
+
"border-destructive focus-visible:ring-destructive": variant === "destructive" || error
|
|
5705
|
+
},
|
|
5706
|
+
// Size styles
|
|
5707
|
+
{
|
|
5708
|
+
"h-8 px-2 py-1 text-xs": size === "sm",
|
|
5709
|
+
"h-9 px-3 py-2 text-sm": size === "md",
|
|
5710
|
+
"h-10 px-4 py-3 text-base": size === "lg"
|
|
5711
|
+
},
|
|
5712
|
+
className
|
|
5713
|
+
),
|
|
5714
|
+
ref,
|
|
5715
|
+
...props
|
|
5716
|
+
}
|
|
5717
|
+
);
|
|
5718
|
+
}
|
|
5703
5719
|
Input.displayName = "Input";
|
|
5704
5720
|
var InputGroup = React3.forwardRef(
|
|
5705
5721
|
({ className, children, orientation = "vertical", spacing = "md", ...props }, ref) => {
|
|
@@ -5878,17 +5894,18 @@ var useSelectSearch = ({
|
|
|
5878
5894
|
const filterChildren = (nodes) => {
|
|
5879
5895
|
return React4.Children.map(nodes, (child) => {
|
|
5880
5896
|
if (!React4.isValidElement(child)) return child;
|
|
5881
|
-
const
|
|
5897
|
+
const childProps = child.props;
|
|
5898
|
+
const isSelectItem = childProps && (childProps["data-testid"] === "select-item" || childProps.value !== void 0);
|
|
5882
5899
|
if (isSelectItem) {
|
|
5883
|
-
const childText = React4.Children.toArray(
|
|
5900
|
+
const childText = React4.Children.toArray(childProps.children).join(" ").toLowerCase();
|
|
5884
5901
|
const searchLower = searchTerm.toLowerCase();
|
|
5885
5902
|
if (childText.includes(searchLower)) {
|
|
5886
5903
|
return child;
|
|
5887
5904
|
}
|
|
5888
5905
|
return null;
|
|
5889
5906
|
}
|
|
5890
|
-
if (
|
|
5891
|
-
const filteredChildChildren = filterChildren(
|
|
5907
|
+
if (childProps.children) {
|
|
5908
|
+
const filteredChildChildren = filterChildren(childProps.children);
|
|
5892
5909
|
if (React4.Children.count(filteredChildChildren) > 0) {
|
|
5893
5910
|
return React4.cloneElement(child, {}, filteredChildChildren);
|
|
5894
5911
|
}
|
|
@@ -6042,7 +6059,7 @@ var SelectTrigger = React4.forwardRef(
|
|
|
6042
6059
|
({ children, className, variant = "outline", size = "default", asChild = false, ...props }, ref) => {
|
|
6043
6060
|
const { open, disabled, value, actions, direction = "down" } = useSelectContext();
|
|
6044
6061
|
const opensUpward = direction === "up";
|
|
6045
|
-
const handleClickRef = React4.useRef();
|
|
6062
|
+
const handleClickRef = React4.useRef(void 0);
|
|
6046
6063
|
const handleClick = React4.useCallback((e) => {
|
|
6047
6064
|
if (disabled) {
|
|
6048
6065
|
e.preventDefault();
|
|
@@ -6101,10 +6118,15 @@ var SelectTrigger = React4.forwardRef(
|
|
|
6101
6118
|
...props
|
|
6102
6119
|
};
|
|
6103
6120
|
if (asChild) {
|
|
6104
|
-
const
|
|
6105
|
-
const
|
|
6106
|
-
|
|
6107
|
-
|
|
6121
|
+
const childElement = children;
|
|
6122
|
+
const childChildren = React4.Children.toArray(childElement.props.children);
|
|
6123
|
+
const hasChevron = childChildren.some((child) => {
|
|
6124
|
+
if (React4.isValidElement(child)) {
|
|
6125
|
+
const childProps = child.props;
|
|
6126
|
+
return child.type === ChevronDown || child.type === "svg" && childProps["data-testid"] === "chevron-down" || typeof child === "object" && "type" in child && typeof child.type === "function" && child.type.name === "ChevronDown";
|
|
6127
|
+
}
|
|
6128
|
+
return false;
|
|
6129
|
+
});
|
|
6108
6130
|
const childClassName = children.props.className;
|
|
6109
6131
|
const mergedClassName = cn(
|
|
6110
6132
|
triggerProps.className,
|
|
@@ -6300,8 +6322,11 @@ var SelectItem = React4.forwardRef(
|
|
|
6300
6322
|
const getTextContent = (children2) => {
|
|
6301
6323
|
if (typeof children2 === "string") return children2;
|
|
6302
6324
|
if (typeof children2 === "number") return children2.toString();
|
|
6303
|
-
if (React4.isValidElement(children2)
|
|
6304
|
-
|
|
6325
|
+
if (React4.isValidElement(children2)) {
|
|
6326
|
+
const props = children2.props;
|
|
6327
|
+
if (props.children) {
|
|
6328
|
+
return getTextContent(props.children);
|
|
6329
|
+
}
|
|
6305
6330
|
}
|
|
6306
6331
|
if (Array.isArray(children2)) {
|
|
6307
6332
|
return children2.map(getTextContent).join("");
|
|
@@ -7086,7 +7111,7 @@ function SelectEditField({
|
|
|
7086
7111
|
onChange,
|
|
7087
7112
|
className
|
|
7088
7113
|
}) {
|
|
7089
|
-
const logger2 =
|
|
7114
|
+
const logger2 = createLogger("SelectEditField");
|
|
7090
7115
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7091
7116
|
const isCreatable = columnDef.creatable === true;
|
|
7092
7117
|
const selectRef = React9.useRef(null);
|
|
@@ -7616,7 +7641,7 @@ function SelectEditField2({
|
|
|
7616
7641
|
placeholder,
|
|
7617
7642
|
onChange
|
|
7618
7643
|
}) {
|
|
7619
|
-
const logger2 =
|
|
7644
|
+
const logger2 = createLogger("SelectEditField");
|
|
7620
7645
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7621
7646
|
const isCreatable = columnDef.creatable === true;
|
|
7622
7647
|
const selectRef = React10.useRef(null);
|
|
@@ -7857,12 +7882,14 @@ var RowComponent = React10.memo(({
|
|
|
7857
7882
|
}) => {
|
|
7858
7883
|
const rowRef = useRef2(null);
|
|
7859
7884
|
const firstInputRef = useRef2(null);
|
|
7860
|
-
const logger2 =
|
|
7885
|
+
const logger2 = createLogger("RowComponent");
|
|
7861
7886
|
const rowId = getRowIdSafe(row.original, row.index, getRowId);
|
|
7862
7887
|
const hierarchicalRow = row.original;
|
|
7863
7888
|
const isHierarchical = hierarchical?.enabled && hierarchicalRow?.isParent !== void 0;
|
|
7864
7889
|
const isParent = isHierarchical && hierarchicalRow.isParent;
|
|
7865
7890
|
const isChild = isHierarchical && !hierarchicalRow.isParent;
|
|
7891
|
+
const visibleCells = row.getVisibleCells();
|
|
7892
|
+
const isSelected = typeof row.getIsSelected === "function" ? row.getIsSelected() : false;
|
|
7866
7893
|
useEffect2(() => {
|
|
7867
7894
|
if (isEditing && firstInputRef.current) {
|
|
7868
7895
|
firstInputRef.current.focus();
|
|
@@ -7895,9 +7922,8 @@ var RowComponent = React10.memo(({
|
|
|
7895
7922
|
const groupValue = row.getValue(grouping[0]);
|
|
7896
7923
|
const subRowsCount = row.subRows?.length || 0;
|
|
7897
7924
|
const isExpanded = row.getIsExpanded();
|
|
7898
|
-
const visibleCells2 = row.getVisibleCells();
|
|
7899
7925
|
const childRows = row.subRows?.map((subRow) => subRow.original) || [];
|
|
7900
|
-
return /* @__PURE__ */ jsx14("tr", { className: "bg-sec-50 hover:bg-sec-100", style, children:
|
|
7926
|
+
return /* @__PURE__ */ jsx14("tr", { className: "bg-sec-50 hover:bg-sec-100", style, children: visibleCells.map((cell, cellIndex) => {
|
|
7901
7927
|
const columnDef = cell.column.columnDef;
|
|
7902
7928
|
const isGroupingColumn = cellIndex === 0 || grouping.includes(cell.column.id || "");
|
|
7903
7929
|
if (isGroupingColumn && cellIndex === 0) {
|
|
@@ -8006,11 +8032,20 @@ var RowComponent = React10.memo(({
|
|
|
8006
8032
|
}
|
|
8007
8033
|
);
|
|
8008
8034
|
}
|
|
8009
|
-
const visibleCells = row.getVisibleCells();
|
|
8010
|
-
const allCells = row.getAllCells ? row.getAllCells() : [];
|
|
8011
8035
|
const indentSize = hierarchical?.indentSize || 24;
|
|
8012
|
-
const indentation =
|
|
8013
|
-
|
|
8036
|
+
const indentation = React10.useMemo(() => {
|
|
8037
|
+
return isChild && hierarchical?.state ? calculateIndentation(hierarchicalRow, [], indentSize) : 0;
|
|
8038
|
+
}, [isChild, hierarchical?.state, hierarchicalRow, indentSize]);
|
|
8039
|
+
const rowClassName = React10.useMemo(() => {
|
|
8040
|
+
if (isHierarchical) {
|
|
8041
|
+
const hierarchicalClass = isParent ? hierarchical?.parentRowClassName || "bg-main-50 hover:bg-main-100 font-medium" : hierarchical?.childRowClassName || "bg-sec-25 hover:bg-sec-50";
|
|
8042
|
+
return cn(
|
|
8043
|
+
getTableRowClasses({ isSelected, isVirtualized: false }),
|
|
8044
|
+
hierarchicalClass
|
|
8045
|
+
);
|
|
8046
|
+
}
|
|
8047
|
+
return getTableRowClasses({ isSelected, isVirtualized: false });
|
|
8048
|
+
}, [isHierarchical, isParent, isSelected, hierarchical]);
|
|
8014
8049
|
return /* @__PURE__ */ jsx14(
|
|
8015
8050
|
"tr",
|
|
8016
8051
|
{
|
|
@@ -8021,7 +8056,7 @@ var RowComponent = React10.memo(({
|
|
|
8021
8056
|
...isChild && indentation > 0 ? { paddingLeft: `${indentation}px` } : {}
|
|
8022
8057
|
},
|
|
8023
8058
|
className: rowClassName,
|
|
8024
|
-
"aria-selected":
|
|
8059
|
+
"aria-selected": isSelected ? "true" : "false",
|
|
8025
8060
|
children: visibleCells.map((cell, cellIndex) => {
|
|
8026
8061
|
const isFirstCell = cellIndex === 0;
|
|
8027
8062
|
const shouldShowExpansionButton = isHierarchical && isParent && isFirstCell && hierarchical?.state;
|
|
@@ -8078,7 +8113,43 @@ var RowComponent = React10.memo(({
|
|
|
8078
8113
|
);
|
|
8079
8114
|
});
|
|
8080
8115
|
RowComponent.displayName = "RowComponent";
|
|
8081
|
-
var
|
|
8116
|
+
var areRowPropsEqual = (prevProps, nextProps) => {
|
|
8117
|
+
if (prevProps.row.id !== nextProps.row.id || prevProps.row.index !== nextProps.row.index) {
|
|
8118
|
+
return false;
|
|
8119
|
+
}
|
|
8120
|
+
if (prevProps.isEditing !== nextProps.isEditing) {
|
|
8121
|
+
return false;
|
|
8122
|
+
}
|
|
8123
|
+
if (prevProps.editingRowId !== nextProps.editingRowId) {
|
|
8124
|
+
return false;
|
|
8125
|
+
}
|
|
8126
|
+
if (prevProps.style !== nextProps.style) {
|
|
8127
|
+
if (!prevProps.style || !nextProps.style) {
|
|
8128
|
+
return false;
|
|
8129
|
+
}
|
|
8130
|
+
const prevStyle = prevProps.style;
|
|
8131
|
+
const nextStyle = nextProps.style;
|
|
8132
|
+
const styleKeys = /* @__PURE__ */ new Set([...Object.keys(prevStyle), ...Object.keys(nextStyle)]);
|
|
8133
|
+
for (const key of styleKeys) {
|
|
8134
|
+
if (prevStyle[key] !== nextStyle[key]) {
|
|
8135
|
+
return false;
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
}
|
|
8139
|
+
if (prevProps.grouping.length !== nextProps.grouping.length || prevProps.grouping.some((id, i) => id !== nextProps.grouping[i])) {
|
|
8140
|
+
return false;
|
|
8141
|
+
}
|
|
8142
|
+
if (prevProps.hierarchical?.enabled !== nextProps.hierarchical?.enabled) {
|
|
8143
|
+
return false;
|
|
8144
|
+
}
|
|
8145
|
+
const prevSelected = typeof prevProps.row.getIsSelected === "function" ? prevProps.row.getIsSelected() : false;
|
|
8146
|
+
const nextSelected = typeof nextProps.row.getIsSelected === "function" ? nextProps.row.getIsSelected() : false;
|
|
8147
|
+
if (prevSelected !== nextSelected) {
|
|
8148
|
+
return false;
|
|
8149
|
+
}
|
|
8150
|
+
return true;
|
|
8151
|
+
};
|
|
8152
|
+
var MemoizedRow = React10.memo(RowComponent, areRowPropsEqual);
|
|
8082
8153
|
function UnifiedTableBody({
|
|
8083
8154
|
table,
|
|
8084
8155
|
isCreating,
|
|
@@ -8107,7 +8178,7 @@ function UnifiedTableBody({
|
|
|
8107
8178
|
rbac,
|
|
8108
8179
|
permissions
|
|
8109
8180
|
}) {
|
|
8110
|
-
const logger2 =
|
|
8181
|
+
const logger2 = createLogger("UnifiedTableBody");
|
|
8111
8182
|
const headerRef = useRef2(null);
|
|
8112
8183
|
const bodyRef = useRef2(null);
|
|
8113
8184
|
const parentRef = useRef2(null);
|
|
@@ -8684,7 +8755,7 @@ function LoadingState() {
|
|
|
8684
8755
|
}
|
|
8685
8756
|
|
|
8686
8757
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
8687
|
-
import
|
|
8758
|
+
import { useEffect as useEffect5 } from "react";
|
|
8688
8759
|
|
|
8689
8760
|
// src/components/DataTable/components/ImportModal.tsx
|
|
8690
8761
|
import { useState as useState4, useRef as useRef3, useEffect as useEffect4 } from "react";
|
|
@@ -8812,16 +8883,16 @@ var DialogContent = React12.forwardRef(({
|
|
|
8812
8883
|
minWidth,
|
|
8813
8884
|
enableScrolling
|
|
8814
8885
|
});
|
|
8815
|
-
const handleEscapeKeyDown =
|
|
8886
|
+
const handleEscapeKeyDown = (event) => {
|
|
8816
8887
|
if (preventCloseOnEscape) {
|
|
8817
8888
|
event.preventDefault();
|
|
8818
8889
|
}
|
|
8819
|
-
}
|
|
8820
|
-
const handlePointerDownOutside =
|
|
8890
|
+
};
|
|
8891
|
+
const handlePointerDownOutside = (event) => {
|
|
8821
8892
|
if (preventCloseOnOutsideClick) {
|
|
8822
8893
|
event.preventDefault();
|
|
8823
8894
|
}
|
|
8824
|
-
}
|
|
8895
|
+
};
|
|
8825
8896
|
const mergedStyle = React12.useMemo(() => {
|
|
8826
8897
|
if (Object.keys(smartDimensions).length === 0) {
|
|
8827
8898
|
return style;
|
|
@@ -9403,7 +9474,7 @@ function DataTableModals({
|
|
|
9403
9474
|
onStoreFocus,
|
|
9404
9475
|
onRestoreFocus
|
|
9405
9476
|
}) {
|
|
9406
|
-
const logger2 =
|
|
9477
|
+
const logger2 = createLogger("DataTableModals");
|
|
9407
9478
|
useEffect5(() => {
|
|
9408
9479
|
if (showImportModal) {
|
|
9409
9480
|
onStoreFocus?.();
|
|
@@ -9630,7 +9701,7 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
9630
9701
|
};
|
|
9631
9702
|
|
|
9632
9703
|
// src/components/DataTable/hooks/useColumnOrderPersistence.ts
|
|
9633
|
-
import { useState as useState5, useEffect as useEffect6, useCallback as
|
|
9704
|
+
import { useState as useState5, useEffect as useEffect6, useCallback as useCallback2 } from "react";
|
|
9634
9705
|
function useColumnOrderPersistence({
|
|
9635
9706
|
tableId,
|
|
9636
9707
|
defaultOrder = [],
|
|
@@ -9664,7 +9735,7 @@ function useColumnOrderPersistence({
|
|
|
9664
9735
|
setIsLoaded(true);
|
|
9665
9736
|
}
|
|
9666
9737
|
}, [enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
9667
|
-
const saveColumnOrder =
|
|
9738
|
+
const saveColumnOrder = useCallback2((newOrder) => {
|
|
9668
9739
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
9669
9740
|
if (!storageKey && !tableId) return;
|
|
9670
9741
|
try {
|
|
@@ -9673,11 +9744,11 @@ function useColumnOrderPersistence({
|
|
|
9673
9744
|
logger2.warn("Failed to save column order to localStorage:", error);
|
|
9674
9745
|
}
|
|
9675
9746
|
}, [enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
9676
|
-
const updateColumnOrder =
|
|
9747
|
+
const updateColumnOrder = useCallback2((newOrder) => {
|
|
9677
9748
|
setColumnOrder(newOrder);
|
|
9678
9749
|
saveColumnOrder(newOrder);
|
|
9679
9750
|
}, [saveColumnOrder]);
|
|
9680
|
-
const resetColumnOrder =
|
|
9751
|
+
const resetColumnOrder = useCallback2(() => {
|
|
9681
9752
|
setColumnOrder(defaultOrder);
|
|
9682
9753
|
if (enablePersistence && (storageKey || tableId) && typeof window !== "undefined") {
|
|
9683
9754
|
try {
|
|
@@ -9687,7 +9758,7 @@ function useColumnOrderPersistence({
|
|
|
9687
9758
|
}
|
|
9688
9759
|
}
|
|
9689
9760
|
}, [defaultOrder, enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
9690
|
-
const clearAllPreferences =
|
|
9761
|
+
const clearAllPreferences = useCallback2(() => {
|
|
9691
9762
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
9692
9763
|
try {
|
|
9693
9764
|
const keys = Object.keys(localStorage);
|
|
@@ -9710,7 +9781,7 @@ function useColumnOrderPersistence({
|
|
|
9710
9781
|
}
|
|
9711
9782
|
|
|
9712
9783
|
// src/components/DataTable/hooks/useColumnVisibilityPersistence.ts
|
|
9713
|
-
import { useState as useState6, useEffect as useEffect7, useCallback as
|
|
9784
|
+
import { useState as useState6, useEffect as useEffect7, useCallback as useCallback3 } from "react";
|
|
9714
9785
|
function useColumnVisibilityPersistence({
|
|
9715
9786
|
tableId,
|
|
9716
9787
|
defaultVisibility = {},
|
|
@@ -9740,7 +9811,7 @@ function useColumnVisibilityPersistence({
|
|
|
9740
9811
|
setIsLoaded(true);
|
|
9741
9812
|
}
|
|
9742
9813
|
}, [enablePersistence, finalStorageKey]);
|
|
9743
|
-
const saveColumnVisibility =
|
|
9814
|
+
const saveColumnVisibility = useCallback3((newVisibility) => {
|
|
9744
9815
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
9745
9816
|
try {
|
|
9746
9817
|
localStorage.setItem(finalStorageKey, JSON.stringify(newVisibility));
|
|
@@ -9748,11 +9819,11 @@ function useColumnVisibilityPersistence({
|
|
|
9748
9819
|
logger2.warn("Failed to save column visibility to localStorage:", error);
|
|
9749
9820
|
}
|
|
9750
9821
|
}, [enablePersistence, finalStorageKey]);
|
|
9751
|
-
const updateColumnVisibility =
|
|
9822
|
+
const updateColumnVisibility = useCallback3((newVisibility) => {
|
|
9752
9823
|
setColumnVisibility(newVisibility);
|
|
9753
9824
|
saveColumnVisibility(newVisibility);
|
|
9754
9825
|
}, [saveColumnVisibility]);
|
|
9755
|
-
const resetColumnVisibility =
|
|
9826
|
+
const resetColumnVisibility = useCallback3(() => {
|
|
9756
9827
|
setColumnVisibility(defaultVisibility);
|
|
9757
9828
|
if (enablePersistence && typeof window !== "undefined") {
|
|
9758
9829
|
try {
|
|
@@ -9762,7 +9833,7 @@ function useColumnVisibilityPersistence({
|
|
|
9762
9833
|
}
|
|
9763
9834
|
}
|
|
9764
9835
|
}, [defaultVisibility, enablePersistence, finalStorageKey]);
|
|
9765
|
-
const clearAllPreferences =
|
|
9836
|
+
const clearAllPreferences = useCallback3(() => {
|
|
9766
9837
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
9767
9838
|
try {
|
|
9768
9839
|
const keys = Object.keys(localStorage);
|
|
@@ -9785,7 +9856,7 @@ function useColumnVisibilityPersistence({
|
|
|
9785
9856
|
}
|
|
9786
9857
|
|
|
9787
9858
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
9788
|
-
import { useReducer, useCallback as
|
|
9859
|
+
import { useReducer, useCallback as useCallback4, useMemo as useMemo6 } from "react";
|
|
9789
9860
|
function dataTableReducer(state, action) {
|
|
9790
9861
|
switch (action.type) {
|
|
9791
9862
|
case "SET_SORTING":
|
|
@@ -9921,7 +9992,7 @@ function useDataTableState({
|
|
|
9921
9992
|
hasFilters: state.columnFilters.length > 0 || state.searchQuery !== "",
|
|
9922
9993
|
canClearFilters: state.columnFilters.length > 0 || state.searchQuery !== ""
|
|
9923
9994
|
}), [state]);
|
|
9924
|
-
const clearFilters =
|
|
9995
|
+
const clearFilters = useCallback4(() => {
|
|
9925
9996
|
dispatch({ type: "SET_COLUMN_FILTERS", payload: [] });
|
|
9926
9997
|
dispatch({ type: "SET_SEARCH_QUERY", payload: "" });
|
|
9927
9998
|
}, []);
|
|
@@ -9937,7 +10008,7 @@ function useDataTableState({
|
|
|
9937
10008
|
import { useMemo as useMemo8 } from "react";
|
|
9938
10009
|
|
|
9939
10010
|
// src/components/DataTable/hooks/useHierarchicalState.ts
|
|
9940
|
-
import { useState as useState7, useCallback as
|
|
10011
|
+
import { useState as useState7, useCallback as useCallback5, useMemo as useMemo7, useEffect as useEffect8 } from "react";
|
|
9941
10012
|
function useHierarchicalState(data, config) {
|
|
9942
10013
|
const initialExpandedState = useMemo7(() => {
|
|
9943
10014
|
if (!config?.defaultExpanded) {
|
|
@@ -9999,7 +10070,7 @@ function useHierarchicalState(data, config) {
|
|
|
9999
10070
|
}
|
|
10000
10071
|
return visible;
|
|
10001
10072
|
}, [data, expandedRows, parentChildMap]);
|
|
10002
|
-
const toggleRow =
|
|
10073
|
+
const toggleRow = useCallback5((rowId) => {
|
|
10003
10074
|
setExpandedRows((prev) => {
|
|
10004
10075
|
const newSet = new Set(prev);
|
|
10005
10076
|
if (newSet.has(rowId)) {
|
|
@@ -10013,32 +10084,32 @@ function useHierarchicalState(data, config) {
|
|
|
10013
10084
|
return newSet;
|
|
10014
10085
|
});
|
|
10015
10086
|
}, [config]);
|
|
10016
|
-
const expandAll =
|
|
10087
|
+
const expandAll = useCallback5(() => {
|
|
10017
10088
|
const parentIds = data.filter((row) => row.isParent).map((row) => row.id);
|
|
10018
10089
|
setExpandedRows(new Set(parentIds));
|
|
10019
10090
|
if (config?.onExpandedChange) {
|
|
10020
10091
|
config.onExpandedChange(parentIds);
|
|
10021
10092
|
}
|
|
10022
10093
|
}, [data, config]);
|
|
10023
|
-
const collapseAll =
|
|
10094
|
+
const collapseAll = useCallback5(() => {
|
|
10024
10095
|
setExpandedRows(/* @__PURE__ */ new Set());
|
|
10025
10096
|
if (config?.onExpandedChange) {
|
|
10026
10097
|
config.onExpandedChange([]);
|
|
10027
10098
|
}
|
|
10028
10099
|
}, [config]);
|
|
10029
|
-
const isExpanded =
|
|
10100
|
+
const isExpanded = useCallback5((rowId) => {
|
|
10030
10101
|
return expandedRows.has(rowId);
|
|
10031
10102
|
}, [expandedRows]);
|
|
10032
|
-
const hasChildren =
|
|
10103
|
+
const hasChildren = useCallback5((rowId) => {
|
|
10033
10104
|
return parentChildMap.has(rowId) && (parentChildMap.get(rowId)?.length || 0) > 0;
|
|
10034
10105
|
}, [parentChildMap]);
|
|
10035
|
-
const getChildrenCount =
|
|
10106
|
+
const getChildrenCount = useCallback5((rowId) => {
|
|
10036
10107
|
return parentChildMap.get(rowId)?.length || 0;
|
|
10037
10108
|
}, [parentChildMap]);
|
|
10038
|
-
const getExpandedIds =
|
|
10109
|
+
const getExpandedIds = useCallback5(() => {
|
|
10039
10110
|
return Array.from(expandedRows);
|
|
10040
10111
|
}, [expandedRows]);
|
|
10041
|
-
const setExpandedIds =
|
|
10112
|
+
const setExpandedIds = useCallback5((ids) => {
|
|
10042
10113
|
setExpandedRows(new Set(ids));
|
|
10043
10114
|
}, []);
|
|
10044
10115
|
return {
|
|
@@ -10219,7 +10290,7 @@ function useDataTableDataPipeline({
|
|
|
10219
10290
|
}
|
|
10220
10291
|
|
|
10221
10292
|
// src/components/DataTable/hooks/useServerSideDataEffect.ts
|
|
10222
|
-
import { useCallback as
|
|
10293
|
+
import { useCallback as useCallback6, useEffect as useEffect9 } from "react";
|
|
10223
10294
|
function useServerSideDataEffect({
|
|
10224
10295
|
finalPaginationMode,
|
|
10225
10296
|
serverSide,
|
|
@@ -10232,7 +10303,7 @@ function useServerSideDataEffect({
|
|
|
10232
10303
|
fetchServerData,
|
|
10233
10304
|
cleanup
|
|
10234
10305
|
}) {
|
|
10235
|
-
const handleServerSideChange =
|
|
10306
|
+
const handleServerSideChange = useCallback6(async () => {
|
|
10236
10307
|
if (finalPaginationMode !== "server" || !serverSide) {
|
|
10237
10308
|
return;
|
|
10238
10309
|
}
|
|
@@ -10299,7 +10370,7 @@ function useEffectiveColumnOrder({
|
|
|
10299
10370
|
}
|
|
10300
10371
|
|
|
10301
10372
|
// src/components/DataTable/hooks/useTableHandlers.ts
|
|
10302
|
-
import { useCallback as
|
|
10373
|
+
import { useCallback as useCallback7, useMemo as useMemo10 } from "react";
|
|
10303
10374
|
function useTableHandlers({
|
|
10304
10375
|
state,
|
|
10305
10376
|
stateSnapshot,
|
|
@@ -10313,15 +10384,15 @@ function useTableHandlers({
|
|
|
10313
10384
|
updateColumnOrder,
|
|
10314
10385
|
onLayoutChange
|
|
10315
10386
|
}) {
|
|
10316
|
-
const handleSortingChange =
|
|
10387
|
+
const handleSortingChange = useCallback7((updaterOrValue) => {
|
|
10317
10388
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.sorting) : updaterOrValue;
|
|
10318
10389
|
actions.setSorting(nextValue);
|
|
10319
10390
|
}, [actions, stateSnapshot.sorting]);
|
|
10320
|
-
const handleColumnFiltersChange =
|
|
10391
|
+
const handleColumnFiltersChange = useCallback7((updaterOrValue) => {
|
|
10321
10392
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnFilters) : updaterOrValue;
|
|
10322
10393
|
actions.setColumnFilters(nextValue);
|
|
10323
10394
|
}, [actions, stateSnapshot.columnFilters]);
|
|
10324
|
-
const handleColumnVisibilityChange =
|
|
10395
|
+
const handleColumnVisibilityChange = useCallback7((updaterOrValue) => {
|
|
10325
10396
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnVisibility) : updaterOrValue;
|
|
10326
10397
|
actions.setColumnVisibility(nextValue);
|
|
10327
10398
|
if (canPersistVisibility) {
|
|
@@ -10332,7 +10403,7 @@ function useTableHandlers({
|
|
|
10332
10403
|
columnVisibility: nextValue
|
|
10333
10404
|
});
|
|
10334
10405
|
}, [actions, stateSnapshot.columnVisibility, canPersistVisibility, updateSavedColumnVisibility, onLayoutChange, effectiveColumnOrder]);
|
|
10335
|
-
const handleRowSelectionChange =
|
|
10406
|
+
const handleRowSelectionChange = useCallback7((updaterOrValue) => {
|
|
10336
10407
|
const currentSelection = selection ?? state.rowSelection;
|
|
10337
10408
|
const nextSelection = typeof updaterOrValue === "function" ? updaterOrValue(currentSelection) : updaterOrValue;
|
|
10338
10409
|
if (selection === void 0) {
|
|
@@ -10342,19 +10413,19 @@ function useTableHandlers({
|
|
|
10342
10413
|
}
|
|
10343
10414
|
onRowSelectionChange?.(nextSelection);
|
|
10344
10415
|
}, [actions, selection, state.rowSelection, onRowSelectionChange]);
|
|
10345
|
-
const handleGroupingChange =
|
|
10416
|
+
const handleGroupingChange = useCallback7((updaterOrValue) => {
|
|
10346
10417
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.grouping) : updaterOrValue;
|
|
10347
10418
|
actions.setGrouping(nextValue);
|
|
10348
10419
|
}, [actions, stateSnapshot.grouping]);
|
|
10349
|
-
const handleExpandedChange =
|
|
10420
|
+
const handleExpandedChange = useCallback7((updaterOrValue) => {
|
|
10350
10421
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.expanded) : updaterOrValue;
|
|
10351
10422
|
actions.setExpanded(nextValue);
|
|
10352
10423
|
}, [actions, stateSnapshot.expanded]);
|
|
10353
|
-
const handlePaginationChange =
|
|
10424
|
+
const handlePaginationChange = useCallback7((updaterOrValue) => {
|
|
10354
10425
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.pagination) : updaterOrValue;
|
|
10355
10426
|
actions.setPagination(nextValue);
|
|
10356
10427
|
}, [actions, stateSnapshot.pagination]);
|
|
10357
|
-
const handleColumnOrderChange =
|
|
10428
|
+
const handleColumnOrderChange = useCallback7((updaterOrValue) => {
|
|
10358
10429
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnOrder) : updaterOrValue;
|
|
10359
10430
|
const normalizedOrder = nextValue.includes("select") ? ["select", ...nextValue.filter((id) => id !== "select")] : nextValue;
|
|
10360
10431
|
actions.setColumnOrder(normalizedOrder);
|
|
@@ -10898,7 +10969,7 @@ function exportToCSV(data, columns, filename = "download.csv", options = {}) {
|
|
|
10898
10969
|
}
|
|
10899
10970
|
|
|
10900
10971
|
// src/components/DataTable/hooks/useDataTablePermissions.ts
|
|
10901
|
-
import { useMemo as useMemo12, useRef as useRef4 } from "react";
|
|
10972
|
+
import { useMemo as useMemo12, useRef as useRef4, useState as useState8, useEffect as useEffect10 } from "react";
|
|
10902
10973
|
|
|
10903
10974
|
// src/components/DataTable/types.ts
|
|
10904
10975
|
var defaultDataTableFeatures = {
|
|
@@ -10930,6 +11001,28 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
10930
11001
|
const logger2 = createLogger("DataTablePermissions");
|
|
10931
11002
|
const authResult = useUnifiedAuth();
|
|
10932
11003
|
const user = authResult.user;
|
|
11004
|
+
const [isSuperAdminUser, setIsSuperAdminUser] = useState8(false);
|
|
11005
|
+
const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState8(false);
|
|
11006
|
+
useEffect10(() => {
|
|
11007
|
+
const checkSuperAdminStatus = async () => {
|
|
11008
|
+
if (!user?.id) {
|
|
11009
|
+
setIsSuperAdminUser(false);
|
|
11010
|
+
setIsCheckingSuperAdmin(false);
|
|
11011
|
+
return;
|
|
11012
|
+
}
|
|
11013
|
+
setIsCheckingSuperAdmin(true);
|
|
11014
|
+
try {
|
|
11015
|
+
const superAdminStatus = await isSuperAdmin(user.id);
|
|
11016
|
+
setIsSuperAdminUser(superAdminStatus);
|
|
11017
|
+
} catch (error) {
|
|
11018
|
+
logger2.error("useDataTablePermissions", "Error checking super admin status", { userId: user?.id, error });
|
|
11019
|
+
setIsSuperAdminUser(false);
|
|
11020
|
+
} finally {
|
|
11021
|
+
setIsCheckingSuperAdmin(false);
|
|
11022
|
+
}
|
|
11023
|
+
};
|
|
11024
|
+
checkSuperAdminStatus();
|
|
11025
|
+
}, [user?.id, logger2]);
|
|
10933
11026
|
const pageId = rbac?.pageId;
|
|
10934
11027
|
const pageName = rbac?.pageName;
|
|
10935
11028
|
if (!pageId && !pageName) {
|
|
@@ -10974,16 +11067,38 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
10974
11067
|
const updatePermission = `update:page.${effectivePageId}`;
|
|
10975
11068
|
const deletePermission = `delete:page.${effectivePageId}`;
|
|
10976
11069
|
const consistentScope = effectiveScope || { organisationId: void 0, eventId: void 0, appId: void 0 };
|
|
10977
|
-
const
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
11070
|
+
const canReadResult = useCan(userId, consistentScope, readPermission, effectivePageId, true);
|
|
11071
|
+
const canCreateResult = useCan(userId, consistentScope, createPermission, effectivePageId, true);
|
|
11072
|
+
const canUpdateResult = useCan(userId, consistentScope, updatePermission, effectivePageId, true);
|
|
11073
|
+
const canDeleteResult = useCan(userId, consistentScope, deletePermission, effectivePageId, true);
|
|
11074
|
+
const canExportResult = useCan(userId, consistentScope, readPermission, effectivePageId, true);
|
|
11075
|
+
const canImportResult = useCan(userId, consistentScope, createPermission, effectivePageId, true);
|
|
11076
|
+
const permissions = useMemo12(() => {
|
|
11077
|
+
const createSuperAdminAwarePermission = (result) => ({
|
|
11078
|
+
can: isSuperAdminUser ? true : result.can,
|
|
11079
|
+
// Show loading if super admin check is in progress OR if the underlying permission check is loading
|
|
11080
|
+
isLoading: isCheckingSuperAdmin || result.isLoading,
|
|
11081
|
+
error: result.error,
|
|
11082
|
+
refetch: result.refetch
|
|
11083
|
+
});
|
|
11084
|
+
return {
|
|
11085
|
+
canRead: createSuperAdminAwarePermission(canReadResult),
|
|
11086
|
+
canCreate: createSuperAdminAwarePermission(canCreateResult),
|
|
11087
|
+
canUpdate: createSuperAdminAwarePermission(canUpdateResult),
|
|
11088
|
+
canDelete: createSuperAdminAwarePermission(canDeleteResult),
|
|
11089
|
+
canExport: createSuperAdminAwarePermission(canExportResult),
|
|
11090
|
+
canImport: createSuperAdminAwarePermission(canImportResult)
|
|
11091
|
+
};
|
|
11092
|
+
}, [
|
|
11093
|
+
isSuperAdminUser,
|
|
11094
|
+
isCheckingSuperAdmin,
|
|
11095
|
+
canReadResult,
|
|
11096
|
+
canCreateResult,
|
|
11097
|
+
canUpdateResult,
|
|
11098
|
+
canDeleteResult,
|
|
11099
|
+
canExportResult,
|
|
11100
|
+
canImportResult
|
|
11101
|
+
]);
|
|
10987
11102
|
const normalizedFeatures = useMemo12(
|
|
10988
11103
|
() => normalizeDataTableFeatures(features),
|
|
10989
11104
|
[features]
|
|
@@ -11407,7 +11522,7 @@ function getRowDescription(rowIndex, totalRows, isSelected = false, isEditing =
|
|
|
11407
11522
|
}
|
|
11408
11523
|
|
|
11409
11524
|
// src/components/DataTable/hooks/useKeyboardNavigation.ts
|
|
11410
|
-
import { useCallback as
|
|
11525
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useRef as useRef5, useState as useState9 } from "react";
|
|
11411
11526
|
function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
11412
11527
|
const {
|
|
11413
11528
|
enabled = true,
|
|
@@ -11417,7 +11532,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11417
11532
|
onFocusChange,
|
|
11418
11533
|
tableRef: externalTableRef
|
|
11419
11534
|
} = options;
|
|
11420
|
-
const [state, setState] =
|
|
11535
|
+
const [state, setState] = useState9({
|
|
11421
11536
|
focusedRowIndex: 0,
|
|
11422
11537
|
focusedColumnIndex: 0,
|
|
11423
11538
|
isNavigating: false
|
|
@@ -11425,8 +11540,8 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11425
11540
|
const internalTableRef = useRef5(null);
|
|
11426
11541
|
const tableRef = externalTableRef || internalTableRef;
|
|
11427
11542
|
const storedFocusRef = useRef5(null);
|
|
11428
|
-
const navigationTimeoutRef = useRef5();
|
|
11429
|
-
const getCellElement =
|
|
11543
|
+
const navigationTimeoutRef = useRef5(void 0);
|
|
11544
|
+
const getCellElement = useCallback8((rowIndex, columnIndex) => {
|
|
11430
11545
|
if (!tableRef.current) return null;
|
|
11431
11546
|
const tbody = tableRef.current.querySelector("tbody");
|
|
11432
11547
|
if (!tbody) return null;
|
|
@@ -11436,7 +11551,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11436
11551
|
const cells = row.querySelectorAll('td[role="cell"], th[role="columnheader"]');
|
|
11437
11552
|
return cells[columnIndex] || null;
|
|
11438
11553
|
}, []);
|
|
11439
|
-
const getHeaderElement =
|
|
11554
|
+
const getHeaderElement = useCallback8((columnIndex) => {
|
|
11440
11555
|
if (!tableRef.current) return null;
|
|
11441
11556
|
const thead = tableRef.current.querySelector("thead");
|
|
11442
11557
|
if (!thead) return null;
|
|
@@ -11445,7 +11560,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11445
11560
|
const headers = headerRow.querySelectorAll('th[role="columnheader"]');
|
|
11446
11561
|
return headers[columnIndex] || null;
|
|
11447
11562
|
}, []);
|
|
11448
|
-
const focusCell =
|
|
11563
|
+
const focusCell = useCallback8((rowIndex, columnIndex) => {
|
|
11449
11564
|
if (!enabled) return;
|
|
11450
11565
|
const clampedRowIndex = Math.max(0, Math.min(rowIndex, rowCount - 1));
|
|
11451
11566
|
const clampedColumnIndex = Math.max(0, Math.min(columnIndex, columnCount - 1));
|
|
@@ -11464,7 +11579,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11464
11579
|
announce(`Row ${clampedRowIndex + 1}, Column ${clampedColumnIndex + 1}`);
|
|
11465
11580
|
}
|
|
11466
11581
|
}, [enabled, rowCount, columnCount, getCellElement, onFocusChange, announceNavigation]);
|
|
11467
|
-
const focusNext =
|
|
11582
|
+
const focusNext = useCallback8(() => {
|
|
11468
11583
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
11469
11584
|
if (focusedColumnIndex < columnCount - 1) {
|
|
11470
11585
|
focusCell(focusedRowIndex, focusedColumnIndex + 1);
|
|
@@ -11472,7 +11587,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11472
11587
|
focusCell(focusedRowIndex + 1, 0);
|
|
11473
11588
|
}
|
|
11474
11589
|
}, [state, columnCount, rowCount, focusCell]);
|
|
11475
|
-
const focusPrevious =
|
|
11590
|
+
const focusPrevious = useCallback8(() => {
|
|
11476
11591
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
11477
11592
|
if (focusedColumnIndex > 0) {
|
|
11478
11593
|
focusCell(focusedRowIndex, focusedColumnIndex - 1);
|
|
@@ -11480,37 +11595,37 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11480
11595
|
focusCell(focusedRowIndex - 1, columnCount - 1);
|
|
11481
11596
|
}
|
|
11482
11597
|
}, [state, columnCount, focusCell]);
|
|
11483
|
-
const focusUp =
|
|
11598
|
+
const focusUp = useCallback8(() => {
|
|
11484
11599
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
11485
11600
|
if (focusedRowIndex > 0) {
|
|
11486
11601
|
focusCell(focusedRowIndex - 1, focusedColumnIndex);
|
|
11487
11602
|
}
|
|
11488
11603
|
}, [state, focusCell]);
|
|
11489
|
-
const focusDown =
|
|
11604
|
+
const focusDown = useCallback8(() => {
|
|
11490
11605
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
11491
11606
|
if (focusedRowIndex < rowCount - 1) {
|
|
11492
11607
|
focusCell(focusedRowIndex + 1, focusedColumnIndex);
|
|
11493
11608
|
}
|
|
11494
11609
|
}, [state, rowCount, focusCell]);
|
|
11495
|
-
const focusRowStart =
|
|
11610
|
+
const focusRowStart = useCallback8(() => {
|
|
11496
11611
|
const { focusedRowIndex } = state;
|
|
11497
11612
|
focusCell(focusedRowIndex, 0);
|
|
11498
11613
|
}, [state, focusCell]);
|
|
11499
|
-
const focusRowEnd =
|
|
11614
|
+
const focusRowEnd = useCallback8(() => {
|
|
11500
11615
|
const { focusedRowIndex } = state;
|
|
11501
11616
|
focusCell(focusedRowIndex, columnCount - 1);
|
|
11502
11617
|
}, [state, columnCount, focusCell]);
|
|
11503
|
-
const focusTableStart =
|
|
11618
|
+
const focusTableStart = useCallback8(() => {
|
|
11504
11619
|
focusCell(0, 0);
|
|
11505
11620
|
}, [focusCell]);
|
|
11506
|
-
const focusTableEnd =
|
|
11621
|
+
const focusTableEnd = useCallback8(() => {
|
|
11507
11622
|
focusCell(rowCount - 1, columnCount - 1);
|
|
11508
11623
|
}, [rowCount, columnCount, focusCell]);
|
|
11509
|
-
const getCellTabIndex =
|
|
11624
|
+
const getCellTabIndex = useCallback8((rowIndex, columnIndex) => {
|
|
11510
11625
|
if (!enabled) return -1;
|
|
11511
11626
|
return state.focusedRowIndex === rowIndex && state.focusedColumnIndex === columnIndex ? 0 : -1;
|
|
11512
11627
|
}, [enabled, state.focusedRowIndex, state.focusedColumnIndex]);
|
|
11513
|
-
const getCellKeyboardHandlers =
|
|
11628
|
+
const getCellKeyboardHandlers = useCallback8((rowIndex, columnIndex) => {
|
|
11514
11629
|
const onKeyDown = (event) => {
|
|
11515
11630
|
if (!enabled) return;
|
|
11516
11631
|
switch (event.key) {
|
|
@@ -11590,7 +11705,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11590
11705
|
};
|
|
11591
11706
|
return { onKeyDown, onFocus, onBlur };
|
|
11592
11707
|
}, [enabled, focusNext, focusPrevious, focusUp, focusDown, focusRowStart, focusRowEnd, focusTableStart, focusTableEnd, onFocusChange]);
|
|
11593
|
-
const getHeaderKeyboardHandlers =
|
|
11708
|
+
const getHeaderKeyboardHandlers = useCallback8((columnIndex, onSort) => {
|
|
11594
11709
|
const onKeyDown = (event) => {
|
|
11595
11710
|
if (!enabled) return;
|
|
11596
11711
|
switch (event.key) {
|
|
@@ -11648,27 +11763,27 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11648
11763
|
};
|
|
11649
11764
|
return { onKeyDown, onFocus };
|
|
11650
11765
|
}, [enabled, getHeaderElement, columnCount, supportsColumnReorder, supportsColumnResize]);
|
|
11651
|
-
const resetFocus =
|
|
11766
|
+
const resetFocus = useCallback8(() => {
|
|
11652
11767
|
setState({
|
|
11653
11768
|
focusedRowIndex: 0,
|
|
11654
11769
|
focusedColumnIndex: 0,
|
|
11655
11770
|
isNavigating: false
|
|
11656
11771
|
});
|
|
11657
11772
|
}, []);
|
|
11658
|
-
const storeFocus =
|
|
11773
|
+
const storeFocus = useCallback8(() => {
|
|
11659
11774
|
storedFocusRef.current = {
|
|
11660
11775
|
rowIndex: state.focusedRowIndex,
|
|
11661
11776
|
columnIndex: state.focusedColumnIndex
|
|
11662
11777
|
};
|
|
11663
11778
|
}, [state.focusedRowIndex, state.focusedColumnIndex]);
|
|
11664
|
-
const restoreFocus =
|
|
11779
|
+
const restoreFocus = useCallback8(() => {
|
|
11665
11780
|
if (storedFocusRef.current) {
|
|
11666
11781
|
const { rowIndex, columnIndex } = storedFocusRef.current;
|
|
11667
11782
|
focusCell(rowIndex, columnIndex);
|
|
11668
11783
|
storedFocusRef.current = null;
|
|
11669
11784
|
}
|
|
11670
11785
|
}, [focusCell]);
|
|
11671
|
-
|
|
11786
|
+
useEffect11(() => {
|
|
11672
11787
|
return () => {
|
|
11673
11788
|
if (navigationTimeoutRef.current) {
|
|
11674
11789
|
clearTimeout(navigationTimeoutRef.current);
|
|
@@ -11764,7 +11879,7 @@ function DataTableInternal(props) {
|
|
|
11764
11879
|
storageKey,
|
|
11765
11880
|
onLayoutChange
|
|
11766
11881
|
} = props;
|
|
11767
|
-
const logger2 =
|
|
11882
|
+
const logger2 = createLogger("DataTableCore");
|
|
11768
11883
|
const authResult = useUnifiedAuth();
|
|
11769
11884
|
const user = authResult.user;
|
|
11770
11885
|
const requestedFeatures = useMemo14(
|
|
@@ -11801,21 +11916,21 @@ function DataTableInternal(props) {
|
|
|
11801
11916
|
defaultSorting: defaultSorting || [],
|
|
11802
11917
|
defaultGrouping: defaultGrouping || []
|
|
11803
11918
|
});
|
|
11804
|
-
|
|
11919
|
+
useEffect12(() => {
|
|
11805
11920
|
if (secureFeatures.columnVisibility && isColumnVisibilityLoaded && Object.keys(initialColumnVisibility).length > 0) {
|
|
11806
11921
|
stateActions.setColumnVisibility(initialColumnVisibility);
|
|
11807
11922
|
}
|
|
11808
11923
|
}, [secureFeatures.columnVisibility, isColumnVisibilityLoaded, initialColumnVisibility, stateActions]);
|
|
11809
|
-
|
|
11924
|
+
useEffect12(() => {
|
|
11810
11925
|
initializeLiveRegion();
|
|
11811
11926
|
}, []);
|
|
11812
11927
|
const rowSelection = selection !== void 0 ? selection : state.rowSelection;
|
|
11813
|
-
const resolvedGetRowId =
|
|
11928
|
+
const resolvedGetRowId = useCallback9(
|
|
11814
11929
|
(row, index) => getRowIdSafe(row, index, getRowId),
|
|
11815
11930
|
[getRowId]
|
|
11816
11931
|
);
|
|
11817
11932
|
const hasInitializedExpansion = useRef6(false);
|
|
11818
|
-
|
|
11933
|
+
useEffect12(() => {
|
|
11819
11934
|
if (!hasInitializedExpansion.current && defaultGrouping && defaultGrouping.length > 0) {
|
|
11820
11935
|
stateActions.setExpanded(true);
|
|
11821
11936
|
hasInitializedExpansion.current = true;
|
|
@@ -11868,7 +11983,7 @@ function DataTableInternal(props) {
|
|
|
11868
11983
|
);
|
|
11869
11984
|
const lastFocusedElementRef = useRef6(null);
|
|
11870
11985
|
const wasImportModalOpenRef = useRef6(false);
|
|
11871
|
-
|
|
11986
|
+
useEffect12(() => {
|
|
11872
11987
|
if (state.showImportModal) {
|
|
11873
11988
|
wasImportModalOpenRef.current = true;
|
|
11874
11989
|
keyboardNavigation.storeFocus();
|
|
@@ -11877,7 +11992,7 @@ function DataTableInternal(props) {
|
|
|
11877
11992
|
}
|
|
11878
11993
|
}
|
|
11879
11994
|
}, [state.showImportModal, keyboardNavigation]);
|
|
11880
|
-
|
|
11995
|
+
useEffect12(() => {
|
|
11881
11996
|
if (!state.showImportModal) {
|
|
11882
11997
|
if (!wasImportModalOpenRef.current) {
|
|
11883
11998
|
return;
|
|
@@ -11908,7 +12023,7 @@ function DataTableInternal(props) {
|
|
|
11908
12023
|
finalPaginationMode,
|
|
11909
12024
|
serverData
|
|
11910
12025
|
});
|
|
11911
|
-
|
|
12026
|
+
useEffect12(() => {
|
|
11912
12027
|
if (!hierarchicalValidation.isValid) {
|
|
11913
12028
|
logger2.error("Hierarchical data validation failed:", hierarchicalValidation.errors);
|
|
11914
12029
|
}
|
|
@@ -11923,13 +12038,13 @@ function DataTableInternal(props) {
|
|
|
11923
12038
|
enablePersistence: secureFeatures.columnReordering,
|
|
11924
12039
|
storageKey
|
|
11925
12040
|
});
|
|
11926
|
-
|
|
12041
|
+
useEffect12(() => {
|
|
11927
12042
|
if (secureFeatures.columnReordering && isColumnOrderLoaded && savedColumnOrder && savedColumnOrder.length > 0) {
|
|
11928
12043
|
const normalizedOrder = secureFeatures.selection && savedColumnOrder.includes("select") ? ["select", ...savedColumnOrder.filter((id) => id !== "select")] : savedColumnOrder;
|
|
11929
12044
|
stateActions.setColumnOrder(normalizedOrder);
|
|
11930
12045
|
}
|
|
11931
12046
|
}, [secureFeatures.columnReordering, secureFeatures.selection, isColumnOrderLoaded, savedColumnOrder, stateActions]);
|
|
11932
|
-
|
|
12047
|
+
useEffect12(() => {
|
|
11933
12048
|
if (secureFeatures.selection && state.columnOrder.includes("select") && state.columnOrder[0] !== "select") {
|
|
11934
12049
|
const normalizedOrder = ["select", ...state.columnOrder.filter((id) => id !== "select")];
|
|
11935
12050
|
stateActions.setColumnOrder(normalizedOrder);
|
|
@@ -11964,7 +12079,7 @@ function DataTableInternal(props) {
|
|
|
11964
12079
|
}
|
|
11965
12080
|
return state.pagination.pageSize;
|
|
11966
12081
|
}, [state.pagination.pageSize, validatedInitialPageSize, secureFeatures.pagination, finalPageSizeOptions]);
|
|
11967
|
-
|
|
12082
|
+
useEffect12(() => {
|
|
11968
12083
|
if (secureFeatures.pagination && finalPageSizeOptions.length > 0) {
|
|
11969
12084
|
const needsFix = !finalPageSizeOptions.includes(state.pagination.pageSize);
|
|
11970
12085
|
const currentPageSize = effectivePageSize || validatedInitialPageSize;
|
|
@@ -11989,7 +12104,7 @@ function DataTableInternal(props) {
|
|
|
11989
12104
|
finalDataCount
|
|
11990
12105
|
]);
|
|
11991
12106
|
const isLoading = externalIsLoading || performanceLoading;
|
|
11992
|
-
const handleSearch =
|
|
12107
|
+
const handleSearch = useCallback9((value) => {
|
|
11993
12108
|
stateActions.setSearchQuery(value);
|
|
11994
12109
|
setSearchQuery(value);
|
|
11995
12110
|
if (secureFeatures.pagination) {
|
|
@@ -12521,7 +12636,7 @@ function DataTableCore(props) {
|
|
|
12521
12636
|
// src/components/DataTable/DataTable.tsx
|
|
12522
12637
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
12523
12638
|
function DataTable(props) {
|
|
12524
|
-
const logger2 =
|
|
12639
|
+
const logger2 = createLogger("DataTable");
|
|
12525
12640
|
const { features, ...rest } = props;
|
|
12526
12641
|
const normalizedFeatures = React21.useMemo(
|
|
12527
12642
|
() => normalizeDataTableFeatures(features),
|
|
@@ -12804,4 +12919,4 @@ lodash/lodash.js:
|
|
|
12804
12919
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12805
12920
|
*)
|
|
12806
12921
|
*/
|
|
12807
|
-
//# sourceMappingURL=chunk-
|
|
12922
|
+
//# sourceMappingURL=chunk-T33XF5ZC.js.map
|