@jmruthers/pace-core 0.5.134 → 0.5.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-C7GaRZye.d.ts → DataTable-CWAZZcXC.d.ts} +1 -1
- package/dist/{DataTable-A36PJG6N.js → DataTable-CYOHOX3O.js} +25 -13
- package/dist/{PublicLoadingSpinner-CUAnTvcg.d.ts → EventLogo-801uofbR.d.ts} +51 -135
- package/dist/UnifiedAuthProvider-5E5TUNMS.js +17 -0
- package/dist/{UnifiedAuthProvider-BVKmQd9u.d.ts → UnifiedAuthProvider-DJxGTftH.d.ts} +1 -1
- package/dist/{api-TNIBJWLM.js → api-45XYYO2A.js} +4 -3
- package/dist/{audit-T36HM7IM.js → audit-64X3VJXB.js} +3 -2
- package/dist/{chunk-CTJRBUX2.js → chunk-2TWNJ46Y.js} +2 -2
- package/dist/{chunk-UJI6WSMD.js → chunk-444EZN6N.js} +3 -3
- package/dist/chunk-444EZN6N.js.map +1 -0
- package/dist/{chunk-3CG5L6RN.js → chunk-4MT5BGGL.js} +90 -73
- package/dist/chunk-4MT5BGGL.js.map +1 -0
- package/dist/{chunk-PYUXFQJ3.js → chunk-56XJ3TU6.js} +2 -2
- package/dist/chunk-56XJ3TU6.js.map +1 -0
- package/dist/chunk-5DPZ5EAT.js +60 -0
- package/dist/chunk-5DPZ5EAT.js.map +1 -0
- package/dist/{chunk-66C4BSAY.js → chunk-ANBQRTPX.js} +9 -2
- package/dist/chunk-ANBQRTPX.js.map +1 -0
- package/dist/chunk-APIBCTL2.js +670 -0
- package/dist/chunk-APIBCTL2.js.map +1 -0
- package/dist/{chunk-GKHF54DI.js → chunk-BESYRHQM.js} +10 -4
- package/dist/chunk-BESYRHQM.js.map +1 -0
- package/dist/{chunk-WP5I5GLN.js → chunk-BVYWGZVV.js} +112 -97
- package/dist/chunk-BVYWGZVV.js.map +1 -0
- package/dist/{chunk-GEVIB2UB.js → chunk-ERISIBYU.js} +14 -5
- package/dist/chunk-ERISIBYU.js.map +1 -0
- package/dist/{chunk-CQZU6TFE.js → chunk-FHWWBIHA.js} +100 -62
- package/dist/chunk-FHWWBIHA.js.map +1 -0
- package/dist/{chunk-O3NWNXDY.js → chunk-FMUCXFII.js} +2 -2
- package/dist/chunk-FMUCXFII.js.map +1 -0
- package/dist/{chunk-GVDR7WNV.js → chunk-HJGGOMQ6.js} +194 -518
- package/dist/chunk-HJGGOMQ6.js.map +1 -0
- package/dist/{chunk-BDZUMRBD.js → chunk-K2WWTH7O.js} +13 -6
- package/dist/chunk-K2WWTH7O.js.map +1 -0
- package/dist/{chunk-BYXRHAIF.js → chunk-L6PGMCMD.js} +23 -14
- package/dist/chunk-L6PGMCMD.js.map +1 -0
- package/dist/chunk-LMC26NLJ.js +84 -0
- package/dist/chunk-LMC26NLJ.js.map +1 -0
- package/dist/{chunk-M6DDYFUD.js → chunk-LS353YLY.js} +19 -16
- package/dist/chunk-LS353YLY.js.map +1 -0
- package/dist/{chunk-ZYZCRSBD.js → chunk-LTV3XIJJ.js} +16 -11
- package/dist/chunk-LTV3XIJJ.js.map +1 -0
- package/dist/{chunk-HMNOSGVA.js → chunk-NOHEVYVX.js} +377 -666
- package/dist/chunk-NOHEVYVX.js.map +1 -0
- package/dist/{chunk-JCQZ6LA7.js → chunk-Q5QRDWKI.js} +9 -3
- package/dist/chunk-Q5QRDWKI.js.map +1 -0
- package/dist/chunk-S5OFRT4M.js +94 -0
- package/dist/chunk-S5OFRT4M.js.map +1 -0
- package/dist/{chunk-3DBFLLLU.js → chunk-SBVILCCA.js} +14 -9
- package/dist/chunk-SBVILCCA.js.map +1 -0
- package/dist/{chunk-TGIY2AR2.js → chunk-SL2YQDR6.js} +4 -3
- package/dist/{chunk-TGIY2AR2.js.map → chunk-SL2YQDR6.js.map} +1 -1
- package/dist/{chunk-VZ5OR6HD.js → chunk-TVYPTYOY.js} +55 -179
- package/dist/chunk-TVYPTYOY.js.map +1 -0
- package/dist/{chunk-ZV77RZMU.js → chunk-XARJS7CD.js} +2 -2
- package/dist/chunk-XDNLUEXI.js +138 -0
- package/dist/chunk-XDNLUEXI.js.map +1 -0
- package/dist/{chunk-F64FFPOZ.js → chunk-YLKIDTUK.js} +26 -20
- package/dist/chunk-YLKIDTUK.js.map +1 -0
- package/dist/{chunk-5F3NDPJV.js → chunk-ZZ2SS7NI.js} +10 -5
- package/dist/chunk-ZZ2SS7NI.js.map +1 -0
- package/dist/components.d.ts +7 -287
- package/dist/components.js +26 -157
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-C9isKNPn.d.ts → file-reference-C6Gkn77H.d.ts} +1 -1
- package/dist/{formatting-DFcCxUEk.d.ts → formatting-CvUXy2mF.d.ts} +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +22 -16
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +219 -9
- package/dist/index.js +49 -31
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +5 -4
- package/dist/rbac/index.js +13 -12
- package/dist/styles/index.js +2 -1
- package/dist/theming/runtime.d.ts +2 -19
- package/dist/theming/runtime.js +2 -1
- package/dist/{types-D5rqZQXk.d.ts → types-Dfz9dmVH.d.ts} +12 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/{useInactivityTracker-MRUU55XI.js → useInactivityTracker-TO6ZOF35.js} +3 -2
- package/dist/{usePublicRouteParams-Dyt1tzI9.d.ts → usePublicRouteParams-B7PabvuH.d.ts} +1 -1
- package/dist/utils.d.ts +195 -232
- package/dist/utils.js +173 -331
- package/dist/utils.js.map +1 -1
- package/dist/{validation-DnhrNMju.d.ts → validation-8npbysjg.d.ts} +26 -8
- package/dist/validation.d.ts +261 -10
- package/dist/validation.js +82 -440
- package/dist/validation.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +6 -6
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +6 -6
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +7 -7
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +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 +29 -4
- package/docs/api/interfaces/DataAccessRecord.md +9 -9
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +18 -18
- package/docs/api/interfaces/DataTableColumn.md +61 -1
- package/docs/api/interfaces/DataTableProps.md +3 -3
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +14 -14
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +152 -0
- package/docs/api/interfaces/ExportColumn.md +90 -0
- package/docs/api/interfaces/ExportOptions.md +126 -0
- package/docs/api/interfaces/FileDisplayProps.md +15 -15
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +10 -10
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- package/docs/api/interfaces/NavigationGuardProps.md +10 -10
- 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 +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +4 -4
- package/docs/api/interfaces/PageAccessRecord.md +8 -8
- package/docs/api/interfaces/PagePermissionContextType.md +8 -8
- package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +7 -7
- package/docs/api/interfaces/PaletteData.md +4 -4
- package/docs/api/interfaces/PermissionEnforcerProps.md +11 -11
- package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +8 -8
- package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +10 -10
- package/docs/api/interfaces/RouteConfig.md +10 -10
- package/docs/api/interfaces/SecureDataContextType.md +9 -9
- package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +21 -0
- 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 +53 -53
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +9 -9
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +8 -8
- package/docs/api/interfaces/UsePublicEventOptions.md +3 -3
- package/docs/api/interfaces/UsePublicEventReturn.md +5 -5
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +4 -4
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +9 -9
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +4 -4
- package/docs/api/interfaces/UseResolvedScopeReturn.md +4 -4
- 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 +648 -212
- package/docs/api-reference/components.md +106 -26
- package/docs/architecture/README.md +0 -2
- package/docs/implementation-guides/data-tables.md +277 -13
- package/docs/implementation-guides/forms.md +1 -16
- package/docs/implementation-guides/permission-enforcement.md +8 -2
- package/examples/README.md +30 -14
- package/examples/STRUCTURE.md +125 -0
- package/examples/components/DataTable/HierarchicalActionsExample.tsx +421 -0
- package/examples/components/DataTable/HierarchicalExample.tsx +475 -0
- package/examples/components/DataTable/InitialPageSizeExample.tsx +177 -0
- package/examples/components/DataTable/PerformanceExample.tsx +506 -0
- package/examples/components/DataTable/index.ts +13 -0
- package/examples/components/Dialog/BasicHtmlTest.tsx +55 -0
- package/examples/components/Dialog/DebugHtmlExample.tsx +68 -0
- package/examples/components/Dialog/HtmlDialogExample.tsx +202 -0
- package/examples/components/Dialog/ScrollableDialogExample.tsx +290 -0
- package/examples/components/Dialog/SimpleHtmlTest.tsx +61 -0
- package/examples/components/Dialog/SmartDialogExample.tsx +322 -0
- package/examples/components/Dialog/index.ts +15 -0
- package/examples/components/index.ts +11 -0
- package/examples/features/index.ts +12 -0
- package/examples/{public-pages → features/public-pages}/CorrectPublicPageImplementation.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicEventPage.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageApp.tsx +1 -1
- package/examples/{public-pages → features/public-pages}/PublicPageUsageExample.tsx +1 -1
- package/examples/index.ts +11 -3
- package/package.json +30 -10
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +1 -30
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +562 -0
- package/src/components/DataTable/__tests__/styles.test.ts +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +0 -15
- package/src/components/DataTable/components/DataTableCore.tsx +4 -185
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +1 -1
- package/src/components/DataTable/components/DataTableModals.tsx +1 -27
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/ImportModal.tsx +2 -14
- package/src/components/DataTable/components/PaginationControls.tsx +1 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +109 -82
- package/src/components/DataTable/components/__tests__/ActionButtons.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +1 -1
- package/src/components/DataTable/examples/GroupingAggregationExample.tsx +273 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +1 -1
- package/src/components/DataTable/examples/__tests__/HierarchicalActionsExample.test.tsx +1 -1
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +2 -23
- package/src/components/DataTable/index.ts +4 -0
- package/src/components/DataTable/styles.ts +1 -1
- package/src/components/DataTable/types.ts +13 -0
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +1 -1
- package/src/components/DataTable/utils/aggregationUtils.ts +161 -0
- package/src/components/DataTable/utils/exportUtils.ts +1 -1
- package/src/components/DataTable/utils/flexibleImport.ts +1 -11
- package/src/components/DataTable/utils/index.ts +1 -0
- package/src/components/DataTable/utils/paginationUtils.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +35 -7
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +5 -4
- package/src/components/EventSelector/EventSelector.tsx +3 -2
- package/src/components/FileDisplay/FileDisplay.tsx +2 -36
- package/src/components/FileUpload/FileUpload.test.tsx +2 -2
- package/src/components/FileUpload/FileUpload.tsx +2 -2
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +4 -509
- package/src/components/Form/Form.tsx +1 -1
- package/src/components/Form/FormField.tsx +1 -1
- package/src/components/Form/index.ts +0 -12
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoginForm/LoginForm.tsx +1 -1
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -3
- package/src/components/NavigationMenu/NavigationMenu.tsx +9 -8
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +4 -3
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +14 -12
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +0 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +0 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +0 -9
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +35 -3
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +13 -12
- package/src/components/PasswordReset/PasswordChangeForm.tsx +1 -1
- package/src/components/PasswordReset/index.ts +0 -2
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +35 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +3 -2
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicLoadingSpinner.tsx +1 -1
- package/src/components/PublicLayout/PublicPageContextChecker.tsx +44 -43
- package/src/components/PublicLayout/PublicPageFooter.tsx +1 -1
- package/src/components/PublicLayout/PublicPageHeader.tsx +1 -15
- package/src/components/PublicLayout/PublicPageProvider.tsx +3 -2
- package/src/components/PublicLayout/__tests__/PublicPageContextChecker.test.tsx +2 -0
- package/src/components/PublicLayout/index.ts +4 -2
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/{SessionRestorationLoader.tsx → SessionRestorationLoader/SessionRestorationLoader.tsx} +3 -2
- package/src/components/SessionRestorationLoader/index.ts +3 -0
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/index.ts +4 -10
- package/src/hooks/__tests__/hooks.integration.test.tsx +37 -22
- package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +33 -17
- package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +28 -3
- package/src/hooks/__tests__/useFileDisplay.unit.test.ts +36 -9
- package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +26 -2
- package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +19 -6
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +17 -4
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +17 -4
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +26 -6
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +16 -6
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +3 -3
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +17 -3
- package/src/hooks/public/usePublicEvent.ts +7 -6
- package/src/hooks/public/usePublicEventLogo.ts +7 -4
- package/src/hooks/public/usePublicFileDisplay.ts +6 -150
- package/src/hooks/useComponentPerformance.ts +4 -1
- package/src/hooks/useDataTablePerformance.ts +4 -3
- package/src/hooks/useEventTheme.test.ts +18 -5
- package/src/hooks/useEventTheme.ts +4 -1
- package/src/hooks/useEvents.ts +2 -0
- package/src/hooks/useFileDisplay.ts +9 -8
- package/src/hooks/useFileReference.ts +4 -1
- package/src/hooks/useFileUrl.ts +4 -1
- package/src/hooks/useInactivityTracker.ts +5 -4
- package/src/hooks/useOrganisationSecurity.test.ts +33 -12
- package/src/hooks/useOrganisationSecurity.ts +8 -7
- package/src/hooks/usePerformanceMonitor.ts +6 -3
- package/src/hooks/usePermissionCache.ts +13 -6
- package/src/hooks/useSecureDataAccess.test.ts +2 -2
- package/src/hooks/useSecureDataAccess.ts +9 -8
- package/src/hooks/useSessionRestoration.ts +4 -1
- package/src/hooks/useStorage.ts +4 -1
- package/src/index.ts +25 -8
- package/src/providers/services/AuthServiceProvider.tsx +3 -2
- package/src/providers/services/EventServiceProvider.tsx +2 -1
- package/src/providers/services/InactivityServiceProvider.tsx +2 -1
- package/src/providers/services/OrganisationServiceProvider.tsx +2 -1
- package/src/providers/services/UnifiedAuthProvider.tsx +4 -3
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +22 -2
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +24 -2
- package/src/rbac/__tests__/cache-invalidation.test.ts +20 -6
- package/src/rbac/api.ts +5 -2
- package/src/rbac/audit-enhanced.ts +6 -6
- package/src/rbac/audit.test.ts +60 -38
- package/src/rbac/audit.ts +8 -8
- package/src/rbac/cache-invalidation.ts +7 -4
- package/src/rbac/components/EnhancedNavigationMenu.tsx +11 -5
- package/src/rbac/components/NavigationGuard.tsx +7 -3
- package/src/rbac/components/NavigationProvider.tsx +6 -3
- package/src/rbac/components/PagePermissionGuard.tsx +28 -16
- package/src/rbac/components/PagePermissionProvider.tsx +4 -1
- package/src/rbac/components/PermissionEnforcer.tsx +9 -3
- package/src/rbac/components/RoleBasedRouter.tsx +3 -1
- package/src/rbac/components/SecureDataProvider.tsx +7 -3
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +87 -61
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +83 -33
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +36 -13
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +2 -2
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +22 -8
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +19 -6
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +43 -17
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +42 -17
- package/src/rbac/engine.ts +15 -7
- package/src/rbac/hooks/usePermissions.ts +7 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +2 -2
- package/src/rbac/hooks/useResolvedScope.ts +10 -7
- package/src/rbac/permissions.ts +5 -2
- package/src/rbac/security.test.ts +27 -16
- package/src/rbac/security.ts +5 -4
- package/src/services/AuthService.ts +22 -21
- package/src/services/EventService.ts +12 -12
- package/src/services/InactivityService.ts +5 -4
- package/src/services/OrganisationService.ts +26 -25
- package/src/services/__tests__/AuthService.test.ts +51 -19
- package/src/services/__tests__/EventService.test.ts +37 -5
- package/src/services/__tests__/InactivityService.test.ts +38 -4
- package/src/services/__tests__/OrganisationService.test.ts +3 -8
- package/src/services/base/BaseService.ts +3 -1
- package/src/theming/__tests__/runtime.test.ts +21 -12
- package/src/theming/parseEventColours.ts +5 -19
- package/src/theming/runtime.ts +8 -4
- package/src/types/validation.ts +2 -29
- package/src/utils/__tests__/appConfig.unit.test.ts +1 -1
- package/src/utils/__tests__/audit.unit.test.ts +1 -1
- package/src/utils/__tests__/auth-utils.unit.test.ts +1 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +19 -19
- package/src/utils/__tests__/cn.unit.test.ts +1 -1
- package/src/utils/__tests__/debugLogger.test.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -1
- package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/formatting.unit.test.ts +1 -1
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +1 -1
- package/src/utils/__tests__/logger.unit.test.ts +1 -1
- package/src/utils/__tests__/organisationContext.unit.test.ts +1 -1
- package/src/utils/__tests__/performanceBenchmark.test.ts +1 -1
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionTypes.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/sanitization.unit.test.ts +1 -1
- package/src/utils/__tests__/schemaUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +1 -1
- package/src/utils/__tests__/secureErrors.unit.test.ts +33 -15
- package/src/utils/__tests__/secureStorage.unit.test.ts +1 -1
- package/src/utils/__tests__/security.unit.test.ts +40 -18
- package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -1
- package/src/utils/__tests__/sessionTracking.unit.test.ts +40 -29
- package/src/utils/__tests__/validationUtils.unit.test.ts +19 -6
- package/src/utils/{appIdResolver.test.ts → app/appIdResolver.test.ts} +28 -30
- package/src/utils/{appIdResolver.ts → app/appIdResolver.ts} +8 -5
- package/src/utils/{appNameResolver.test.ts → app/appNameResolver.test.ts} +1 -1
- package/src/utils/{appNameResolver.ts → app/appNameResolver.ts} +5 -1
- package/src/utils/{organisationContext.ts → context/organisationContext.ts} +6 -3
- package/src/utils/{sessionTracking.ts → context/sessionTracking.ts} +11 -12
- package/src/utils/{logger.ts → core/logger.ts} +4 -2
- package/src/utils/{deviceFingerprint.ts → device/deviceFingerprint.ts} +1 -1
- package/src/utils/{lazyLoad.tsx → dynamic/lazyLoad.tsx} +2 -2
- package/src/utils/{file-reference.test.ts → file-reference/__tests__/file-reference.test.ts} +5 -5
- package/src/utils/{file-reference.ts → file-reference/index.ts} +20 -38
- package/src/utils/index.ts +32 -54
- package/src/utils/{secureErrors.ts → security/secureErrors.ts} +6 -3
- package/src/utils/{security.ts → security/security.ts} +5 -2
- package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -4
- package/src/utils/storage/helpers.ts +15 -8
- package/src/{components/Dialog/utils/__tests__/safeHtml.unit.test.ts → utils/validation/__tests__/htmlSanitization.unit.test.ts} +9 -15
- package/src/{validation → utils/validation}/csrf.ts +1 -1
- package/src/{components/Dialog/utils/safeHtml.ts → utils/validation/htmlSanitization.ts} +9 -10
- package/src/utils/validation/index.ts +79 -0
- package/src/utils/{sanitization.ts → validation/sanitization.ts} +71 -2
- package/src/{validation/schemaUtils.ts → utils/validation/schema.ts} +11 -6
- package/src/{validation → utils/validation}/sqlInjectionProtection.ts +2 -0
- package/src/utils/{validationUtils.ts → validation/validationUtils.ts} +4 -1
- package/src/validation/index.ts +3 -34
- package/dist/UnifiedAuthProvider-CQDZRJIS.js +0 -16
- package/dist/chunk-24MKLB7U.js +0 -81
- package/dist/chunk-24MKLB7U.js.map +0 -1
- package/dist/chunk-3CG5L6RN.js.map +0 -1
- package/dist/chunk-3DBFLLLU.js.map +0 -1
- package/dist/chunk-5F3NDPJV.js.map +0 -1
- package/dist/chunk-66C4BSAY.js.map +0 -1
- package/dist/chunk-BDZUMRBD.js.map +0 -1
- package/dist/chunk-BYXRHAIF.js.map +0 -1
- package/dist/chunk-CDQ3PX7L.js +0 -18
- package/dist/chunk-CDQ3PX7L.js.map +0 -1
- package/dist/chunk-CQZU6TFE.js.map +0 -1
- package/dist/chunk-F64FFPOZ.js.map +0 -1
- package/dist/chunk-GEVIB2UB.js.map +0 -1
- package/dist/chunk-GKHF54DI.js.map +0 -1
- package/dist/chunk-GVDR7WNV.js.map +0 -1
- package/dist/chunk-HMNOSGVA.js.map +0 -1
- package/dist/chunk-JCQZ6LA7.js.map +0 -1
- package/dist/chunk-M6DDYFUD.js.map +0 -1
- package/dist/chunk-O3NWNXDY.js.map +0 -1
- package/dist/chunk-PYUXFQJ3.js.map +0 -1
- package/dist/chunk-UJI6WSMD.js.map +0 -1
- package/dist/chunk-VZ5OR6HD.js.map +0 -1
- package/dist/chunk-WP5I5GLN.js.map +0 -1
- package/dist/chunk-ZYZCRSBD.js.map +0 -1
- package/src/components/Dialog/README.md +0 -804
- package/src/components/Form/FormErrorSummary.tsx +0 -113
- package/src/components/Form/FormFieldset.tsx +0 -127
- package/src/components/Form/FormLiveRegion.tsx +0 -198
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +0 -597
- package/src/components/PasswordReset/PasswordResetForm.tsx +0 -201
- package/src/components/PublicLayout/PublicPageDebugger.tsx +0 -104
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +0 -162
- package/src/components/PublicLayout/__tests__/PublicPageDebugger.test.tsx +0 -185
- package/src/examples/CorrectPublicPageImplementation.tsx +0 -304
- package/src/examples/PublicEventPage.tsx +0 -287
- package/src/examples/PublicPageApp.tsx +0 -321
- package/src/examples/PublicPageUsageExample.tsx +0 -218
- package/src/utils/schemaUtils.ts +0 -37
- package/src/validation/__tests__/common.unit.test.ts +0 -101
- package/src/validation/__tests__/csrf.unit.test.ts +0 -365
- package/src/validation/__tests__/passwordSchema.unit.test.ts +0 -203
- package/src/validation/__tests__/sanitization.unit.test.ts +0 -250
- package/src/validation/__tests__/schemaUtils.unit.test.ts +0 -451
- package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +0 -462
- package/src/validation/__tests__/user.unit.test.ts +0 -440
- package/src/validation/sanitization.ts +0 -96
- /package/dist/{DataTable-A36PJG6N.js.map → DataTable-CYOHOX3O.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-CQDZRJIS.js.map → UnifiedAuthProvider-5E5TUNMS.js.map} +0 -0
- /package/dist/{api-TNIBJWLM.js.map → api-45XYYO2A.js.map} +0 -0
- /package/dist/{audit-T36HM7IM.js.map → audit-64X3VJXB.js.map} +0 -0
- /package/dist/{chunk-CTJRBUX2.js.map → chunk-2TWNJ46Y.js.map} +0 -0
- /package/dist/{chunk-ZV77RZMU.js.map → chunk-XARJS7CD.js.map} +0 -0
- /package/dist/{useInactivityTracker-MRUU55XI.js.map → useInactivityTracker-TO6ZOF35.js.map} +0 -0
- /package/examples/{public-pages → features/public-pages}/index.ts +0 -0
- /package/examples/{RBAC → features/rbac}/CompleteRBACExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/EventBasedApp.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/PermissionExample.tsx +0 -0
- /package/examples/{RBAC → features/rbac}/index.ts +0 -0
- /package/src/utils/{appConfig.ts → app/appConfig.ts} +0 -0
- /package/src/utils/{appNameResolver.simple.test.ts → app/appNameResolver.simple.test.ts} +0 -0
- /package/src/utils/{audit.ts → audit/audit.ts} +0 -0
- /package/src/utils/{organisationContext.test.ts → context/organisationContext.test.ts} +0 -0
- /package/src/utils/{cn.ts → core/cn.ts} +0 -0
- /package/src/utils/{debugLogger.ts → core/debugLogger.ts} +0 -0
- /package/src/utils/{dynamicUtils.ts → dynamic/dynamicUtils.ts} +0 -0
- /package/src/utils/{formatDate.test.ts → formatting/formatDate.test.ts} +0 -0
- /package/src/utils/{formatting.ts → formatting/formatting.ts} +0 -0
- /package/src/utils/{bundleAnalysis.ts → performance/bundleAnalysis.ts} +0 -0
- /package/src/utils/{performanceBenchmark.ts → performance/performanceBenchmark.ts} +0 -0
- /package/src/utils/{performanceBudgets.ts → performance/performanceBudgets.ts} +0 -0
- /package/src/utils/{permissionTypes.ts → permissions/permissionTypes.ts} +0 -0
- /package/src/utils/{permissionUtils.test.ts → permissions/permissionUtils.test.ts} +0 -0
- /package/src/utils/{permissionUtils.ts → permissions/permissionUtils.ts} +0 -0
- /package/src/utils/{auth-utils.ts → security/auth-utils.ts} +0 -0
- /package/src/utils/{secureDataAccess.test.ts → security/secureDataAccess.test.ts} +0 -0
- /package/src/utils/{secureDataAccess.ts → security/secureDataAccess.ts} +0 -0
- /package/src/utils/{secureStorage.ts → security/secureStorage.ts} +0 -0
- /package/src/utils/{securityMonitor.ts → security/securityMonitor.ts} +0 -0
- /package/src/{validation → utils/validation}/common.ts +0 -0
- /package/src/{validation → utils/validation}/passwordSchema.ts +0 -0
- /package/src/{validation → utils/validation}/user.ts +0 -0
- /package/src/utils/{validation.ts → validation/validation.ts} +0 -0
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan,
|
|
3
3
|
useResolvedScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L6PGMCMD.js";
|
|
5
5
|
import {
|
|
6
6
|
toast,
|
|
7
7
|
useDataTablePerformance
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BESYRHQM.js";
|
|
9
9
|
import {
|
|
10
10
|
init_UnifiedAuthProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2TWNJ46Y.js";
|
|
12
12
|
import {
|
|
13
13
|
useUnifiedAuth
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4MT5BGGL.js";
|
|
15
|
+
import {
|
|
16
|
+
renderSafeHtml
|
|
17
|
+
} from "./chunk-5DPZ5EAT.js";
|
|
15
18
|
import {
|
|
16
19
|
cn
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-56XJ3TU6.js";
|
|
21
|
+
import {
|
|
22
|
+
createLogger,
|
|
23
|
+
init_logger
|
|
24
|
+
} from "./chunk-XDNLUEXI.js";
|
|
18
25
|
import {
|
|
19
26
|
__commonJS,
|
|
20
27
|
__toESM
|
|
@@ -3077,16 +3084,16 @@ var require_lodash = __commonJS({
|
|
|
3077
3084
|
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
|
|
3078
3085
|
}
|
|
3079
3086
|
function shortOut(func) {
|
|
3080
|
-
var
|
|
3087
|
+
var count2 = 0, lastCalled = 0;
|
|
3081
3088
|
return function() {
|
|
3082
3089
|
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
3083
3090
|
lastCalled = stamp;
|
|
3084
3091
|
if (remaining > 0) {
|
|
3085
|
-
if (++
|
|
3092
|
+
if (++count2 >= HOT_COUNT) {
|
|
3086
3093
|
return arguments[0];
|
|
3087
3094
|
}
|
|
3088
3095
|
} else {
|
|
3089
|
-
|
|
3096
|
+
count2 = 0;
|
|
3090
3097
|
}
|
|
3091
3098
|
return func.apply(undefined2, arguments);
|
|
3092
3099
|
};
|
|
@@ -4979,7 +4986,7 @@ var require_lodash = __commonJS({
|
|
|
4979
4986
|
return dividend / divisor;
|
|
4980
4987
|
}, 1);
|
|
4981
4988
|
var floor = createRound("floor");
|
|
4982
|
-
function
|
|
4989
|
+
function max2(array) {
|
|
4983
4990
|
return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
|
|
4984
4991
|
}
|
|
4985
4992
|
function maxBy(array, iteratee2) {
|
|
@@ -4991,7 +4998,7 @@ var require_lodash = __commonJS({
|
|
|
4991
4998
|
function meanBy(array, iteratee2) {
|
|
4992
4999
|
return baseMean(array, getIteratee(iteratee2, 2));
|
|
4993
5000
|
}
|
|
4994
|
-
function
|
|
5001
|
+
function min2(array) {
|
|
4995
5002
|
return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
|
|
4996
5003
|
}
|
|
4997
5004
|
function minBy(array, iteratee2) {
|
|
@@ -5004,7 +5011,7 @@ var require_lodash = __commonJS({
|
|
|
5004
5011
|
var subtract = createMathOperation(function(minuend, subtrahend) {
|
|
5005
5012
|
return minuend - subtrahend;
|
|
5006
5013
|
}, 0);
|
|
5007
|
-
function
|
|
5014
|
+
function sum2(array) {
|
|
5008
5015
|
return array && array.length ? baseSum(array, identity) : 0;
|
|
5009
5016
|
}
|
|
5010
5017
|
function sumBy(array, iteratee2) {
|
|
@@ -5252,11 +5259,11 @@ var require_lodash = __commonJS({
|
|
|
5252
5259
|
lodash.lowerFirst = lowerFirst;
|
|
5253
5260
|
lodash.lt = lt;
|
|
5254
5261
|
lodash.lte = lte;
|
|
5255
|
-
lodash.max =
|
|
5262
|
+
lodash.max = max2;
|
|
5256
5263
|
lodash.maxBy = maxBy;
|
|
5257
5264
|
lodash.mean = mean;
|
|
5258
5265
|
lodash.meanBy = meanBy;
|
|
5259
|
-
lodash.min =
|
|
5266
|
+
lodash.min = min2;
|
|
5260
5267
|
lodash.minBy = minBy;
|
|
5261
5268
|
lodash.stubArray = stubArray;
|
|
5262
5269
|
lodash.stubFalse = stubFalse;
|
|
@@ -5293,7 +5300,7 @@ var require_lodash = __commonJS({
|
|
|
5293
5300
|
lodash.startCase = startCase;
|
|
5294
5301
|
lodash.startsWith = startsWith;
|
|
5295
5302
|
lodash.subtract = subtract;
|
|
5296
|
-
lodash.sum =
|
|
5303
|
+
lodash.sum = sum2;
|
|
5297
5304
|
lodash.sumBy = sumBy;
|
|
5298
5305
|
lodash.template = template;
|
|
5299
5306
|
lodash.times = times;
|
|
@@ -6875,118 +6882,6 @@ function FilterRow({ table, visibleColumns }) {
|
|
|
6875
6882
|
// src/components/DataTable/components/ActionButtons.tsx
|
|
6876
6883
|
import React8, { useMemo as useMemo2 } from "react";
|
|
6877
6884
|
import { MoreHorizontal } from "lucide-react";
|
|
6878
|
-
|
|
6879
|
-
// src/utils/logger.ts
|
|
6880
|
-
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
6881
|
-
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
6882
|
-
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
6883
|
-
LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
|
|
6884
|
-
LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
|
|
6885
|
-
return LogLevel2;
|
|
6886
|
-
})(LogLevel || {});
|
|
6887
|
-
var Logger = class {
|
|
6888
|
-
/**
|
|
6889
|
-
* Check if we're in development mode
|
|
6890
|
-
*/
|
|
6891
|
-
static get isDevelopment() {
|
|
6892
|
-
return import.meta.env.MODE === "development";
|
|
6893
|
-
}
|
|
6894
|
-
/**
|
|
6895
|
-
* Configure the logger
|
|
6896
|
-
*/
|
|
6897
|
-
static configure(config) {
|
|
6898
|
-
this.config = { ...this.config, ...config };
|
|
6899
|
-
}
|
|
6900
|
-
/**
|
|
6901
|
-
* Format a log message with optional timestamp and component
|
|
6902
|
-
*/
|
|
6903
|
-
static formatMessage(level, component, message) {
|
|
6904
|
-
const parts = [];
|
|
6905
|
-
if (this.config.prefix) {
|
|
6906
|
-
parts.push(`[${this.config.prefix}]`);
|
|
6907
|
-
}
|
|
6908
|
-
if (this.config.includeTimestamp) {
|
|
6909
|
-
parts.push(`[${(/* @__PURE__ */ new Date()).toISOString()}]`);
|
|
6910
|
-
}
|
|
6911
|
-
parts.push(`[${LogLevel[level]}]`);
|
|
6912
|
-
if (this.config.includeComponent && component) {
|
|
6913
|
-
parts.push(`[${component}]`);
|
|
6914
|
-
}
|
|
6915
|
-
parts.push(message);
|
|
6916
|
-
return parts.join(" ");
|
|
6917
|
-
}
|
|
6918
|
-
/**
|
|
6919
|
-
* Check if a log level should be output
|
|
6920
|
-
*/
|
|
6921
|
-
static shouldLog(level) {
|
|
6922
|
-
return this.isDevelopment && level >= this.config.level;
|
|
6923
|
-
}
|
|
6924
|
-
/**
|
|
6925
|
-
* Log debug information (development only)
|
|
6926
|
-
*/
|
|
6927
|
-
static debug(component, message, ...args) {
|
|
6928
|
-
if (this.shouldLog(0 /* DEBUG */)) {
|
|
6929
|
-
try {
|
|
6930
|
-
console.debug(this.formatMessage(0 /* DEBUG */, component, message), ...args);
|
|
6931
|
-
} catch (e) {
|
|
6932
|
-
}
|
|
6933
|
-
}
|
|
6934
|
-
}
|
|
6935
|
-
/**
|
|
6936
|
-
* Log info information (development only)
|
|
6937
|
-
*/
|
|
6938
|
-
static info(component, message, ...args) {
|
|
6939
|
-
if (this.shouldLog(1 /* INFO */)) {
|
|
6940
|
-
try {
|
|
6941
|
-
console.info(this.formatMessage(1 /* INFO */, component, message), ...args);
|
|
6942
|
-
} catch (e) {
|
|
6943
|
-
}
|
|
6944
|
-
}
|
|
6945
|
-
}
|
|
6946
|
-
/**
|
|
6947
|
-
* Log warning information (development only)
|
|
6948
|
-
*/
|
|
6949
|
-
static warn(component, message, ...args) {
|
|
6950
|
-
if (this.shouldLog(2 /* WARN */)) {
|
|
6951
|
-
try {
|
|
6952
|
-
console.warn(this.formatMessage(2 /* WARN */, component, message), ...args);
|
|
6953
|
-
} catch (e) {
|
|
6954
|
-
}
|
|
6955
|
-
}
|
|
6956
|
-
}
|
|
6957
|
-
/**
|
|
6958
|
-
* Log error information (development only)
|
|
6959
|
-
*/
|
|
6960
|
-
static error(component, message, ...args) {
|
|
6961
|
-
if (this.shouldLog(3 /* ERROR */)) {
|
|
6962
|
-
try {
|
|
6963
|
-
console.error(this.formatMessage(3 /* ERROR */, component, message), ...args);
|
|
6964
|
-
} catch (e) {
|
|
6965
|
-
}
|
|
6966
|
-
}
|
|
6967
|
-
}
|
|
6968
|
-
/**
|
|
6969
|
-
* Create a scoped logger for a specific component
|
|
6970
|
-
*/
|
|
6971
|
-
static createScopedLogger(component) {
|
|
6972
|
-
return {
|
|
6973
|
-
debug: (message, ...args) => this.debug(component, message, ...args),
|
|
6974
|
-
info: (message, ...args) => this.info(component, message, ...args),
|
|
6975
|
-
warn: (message, ...args) => this.warn(component, message, ...args),
|
|
6976
|
-
error: (message, ...args) => this.error(component, message, ...args)
|
|
6977
|
-
};
|
|
6978
|
-
}
|
|
6979
|
-
};
|
|
6980
|
-
Logger.config = {
|
|
6981
|
-
level: 0 /* DEBUG */,
|
|
6982
|
-
includeTimestamp: false,
|
|
6983
|
-
includeComponent: true
|
|
6984
|
-
};
|
|
6985
|
-
function createLogger(component) {
|
|
6986
|
-
return Logger.createScopedLogger(component);
|
|
6987
|
-
}
|
|
6988
|
-
|
|
6989
|
-
// src/components/DataTable/components/ActionButtons.tsx
|
|
6990
6885
|
import { Fragment, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6991
6886
|
var evaluateCondition = (condition, row, defaultValue) => {
|
|
6992
6887
|
if (typeof condition === "boolean") {
|
|
@@ -7005,7 +6900,6 @@ function ActionButtonsComponent({
|
|
|
7005
6900
|
hierarchical = false,
|
|
7006
6901
|
permissions
|
|
7007
6902
|
}) {
|
|
7008
|
-
const logger = createLogger("ActionButtons");
|
|
7009
6903
|
const rowData = row.original;
|
|
7010
6904
|
if (actions.length === 0) {
|
|
7011
6905
|
return null;
|
|
@@ -7058,13 +6952,6 @@ function ActionButtonsComponent({
|
|
|
7058
6952
|
variant: action.variant === "destructive" ? "destructive" : "ghost",
|
|
7059
6953
|
size: "sm",
|
|
7060
6954
|
onClick: () => {
|
|
7061
|
-
if (import.meta.env.MODE === "development" && !isDisabled) {
|
|
7062
|
-
logger.debug("Action clicked:", {
|
|
7063
|
-
actionLabel: action.label,
|
|
7064
|
-
rowOriginal: rowData,
|
|
7065
|
-
actionOnClick: typeof action.onClick
|
|
7066
|
-
});
|
|
7067
|
-
}
|
|
7068
6955
|
if (!isDisabled) {
|
|
7069
6956
|
action.onClick(rowData);
|
|
7070
6957
|
}
|
|
@@ -7093,12 +6980,6 @@ function ActionButtonsComponent({
|
|
|
7093
6980
|
{
|
|
7094
6981
|
value: `action-${actionIndex}`,
|
|
7095
6982
|
onClick: () => {
|
|
7096
|
-
if (import.meta.env.MODE === "development" && !isDisabled) {
|
|
7097
|
-
logger.debug("Action clicked from dropdown:", {
|
|
7098
|
-
actionLabel: action.label,
|
|
7099
|
-
rowOriginal: rowData
|
|
7100
|
-
});
|
|
7101
|
-
}
|
|
7102
6983
|
if (!isDisabled) {
|
|
7103
6984
|
action.onClick(rowData);
|
|
7104
6985
|
}
|
|
@@ -7122,6 +7003,7 @@ var ActionButtons = React8.memo(ActionButtonsComponent);
|
|
|
7122
7003
|
import React9 from "react";
|
|
7123
7004
|
import { flexRender } from "@tanstack/react-table";
|
|
7124
7005
|
import { X as X3, Check as Check3 } from "lucide-react";
|
|
7006
|
+
init_logger();
|
|
7125
7007
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
7126
7008
|
function SelectEditField({
|
|
7127
7009
|
columnDef,
|
|
@@ -7430,6 +7312,9 @@ function EditableRow({
|
|
|
7430
7312
|
);
|
|
7431
7313
|
}
|
|
7432
7314
|
|
|
7315
|
+
// src/components/DataTable/components/UnifiedTableBody.tsx
|
|
7316
|
+
init_logger();
|
|
7317
|
+
|
|
7433
7318
|
// src/components/DataTable/utils/hierarchicalUtils.ts
|
|
7434
7319
|
function validateHierarchicalData(data) {
|
|
7435
7320
|
const errors = [];
|
|
@@ -7687,18 +7572,6 @@ function SelectEditField2({
|
|
|
7687
7572
|
};
|
|
7688
7573
|
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7689
7574
|
const shouldShow = isCreatable && !!columnDef.onCreateNew;
|
|
7690
|
-
if (import.meta.env.MODE === "development" && isCreatable) {
|
|
7691
|
-
logger.debug("[SelectEditField] Creatable select check:", {
|
|
7692
|
-
searchTerm: currentSearch,
|
|
7693
|
-
searchLower,
|
|
7694
|
-
hasMatch,
|
|
7695
|
-
isCreatable,
|
|
7696
|
-
hasOnCreateNew: !!columnDef.onCreateNew,
|
|
7697
|
-
shouldShow,
|
|
7698
|
-
fieldOptionsCount: columnDef.fieldOptions?.length || 0,
|
|
7699
|
-
note: "Create option shows when search term exists, regardless of matches"
|
|
7700
|
-
});
|
|
7701
|
-
}
|
|
7702
7575
|
setShowCreateOption(shouldShow);
|
|
7703
7576
|
} else {
|
|
7704
7577
|
setShowCreateOption(false);
|
|
@@ -7893,6 +7766,7 @@ var RowComponent = React10.memo(({
|
|
|
7893
7766
|
}) => {
|
|
7894
7767
|
const rowRef = useRef3(null);
|
|
7895
7768
|
const firstInputRef = useRef3(null);
|
|
7769
|
+
const logger = React10.useMemo(() => createLogger("RowComponent"), []);
|
|
7896
7770
|
const rowId = getRowIdSafe(row.original, row.index, getRowId);
|
|
7897
7771
|
const hierarchicalRow = row.original;
|
|
7898
7772
|
const isHierarchical = hierarchical?.enabled && hierarchicalRow?.isParent !== void 0;
|
|
@@ -7930,34 +7804,100 @@ var RowComponent = React10.memo(({
|
|
|
7930
7804
|
const groupValue = row.getValue(grouping[0]);
|
|
7931
7805
|
const subRowsCount = row.subRows?.length || 0;
|
|
7932
7806
|
const isExpanded = row.getIsExpanded();
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7807
|
+
const visibleCells2 = row.getVisibleCells();
|
|
7808
|
+
const childRows = row.subRows?.map((subRow) => subRow.original) || [];
|
|
7809
|
+
return /* @__PURE__ */ jsx14("tr", { className: "bg-sec-50 hover:bg-sec-100", style, children: visibleCells2.map((cell, cellIndex) => {
|
|
7810
|
+
const columnDef = cell.column.columnDef;
|
|
7811
|
+
const isGroupingColumn = cellIndex === 0 || grouping.includes(cell.column.id || "");
|
|
7812
|
+
if (isGroupingColumn && cellIndex === 0) {
|
|
7813
|
+
return /* @__PURE__ */ jsxs10(
|
|
7814
|
+
"td",
|
|
7815
|
+
{
|
|
7816
|
+
className: getTableCellClasses({
|
|
7817
|
+
isCompact: true,
|
|
7818
|
+
className: "px-3 py-2 flex items-center font-medium"
|
|
7819
|
+
}),
|
|
7820
|
+
children: [
|
|
7821
|
+
/* @__PURE__ */ jsx14(
|
|
7822
|
+
Button,
|
|
7823
|
+
{
|
|
7824
|
+
variant: "ghost",
|
|
7825
|
+
size: "sm",
|
|
7826
|
+
onClick: () => row.toggleExpanded(),
|
|
7827
|
+
className: "p-0 h-auto mr-2",
|
|
7828
|
+
children: isExpanded ? /* @__PURE__ */ jsx14(ChevronDown2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx14(ChevronRight, { className: "h-4 w-4" })
|
|
7829
|
+
}
|
|
7830
|
+
),
|
|
7831
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-sm", children: [
|
|
7832
|
+
String(groupValue),
|
|
7833
|
+
" (",
|
|
7834
|
+
subRowsCount,
|
|
7835
|
+
" items)"
|
|
7836
|
+
] })
|
|
7837
|
+
]
|
|
7838
|
+
},
|
|
7839
|
+
cell.id
|
|
7840
|
+
);
|
|
7841
|
+
}
|
|
7842
|
+
if (columnDef.aggregateFn && childRows.length > 0) {
|
|
7843
|
+
try {
|
|
7844
|
+
const aggregatedValue = columnDef.aggregateFn(childRows, columnDef);
|
|
7845
|
+
let cellContent;
|
|
7846
|
+
if (columnDef.aggregateCell) {
|
|
7847
|
+
cellContent = columnDef.aggregateCell(aggregatedValue, childRows, columnDef);
|
|
7848
|
+
} else if (columnDef.cell) {
|
|
7849
|
+
const mockCell = {
|
|
7850
|
+
...cell,
|
|
7851
|
+
getValue: () => aggregatedValue,
|
|
7852
|
+
renderValue: () => aggregatedValue
|
|
7853
|
+
};
|
|
7854
|
+
cellContent = flexRender2(columnDef.cell, {
|
|
7855
|
+
...mockCell,
|
|
7856
|
+
row,
|
|
7857
|
+
column: cell.column,
|
|
7858
|
+
cell: mockCell,
|
|
7859
|
+
getValue: () => aggregatedValue,
|
|
7860
|
+
renderValue: () => aggregatedValue
|
|
7861
|
+
});
|
|
7862
|
+
} else {
|
|
7863
|
+
cellContent = aggregatedValue != null ? String(aggregatedValue) : "";
|
|
7864
|
+
}
|
|
7865
|
+
return /* @__PURE__ */ jsx14(
|
|
7866
|
+
"td",
|
|
7944
7867
|
{
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
children:
|
|
7950
|
-
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
"
|
|
7957
|
-
|
|
7958
|
-
|
|
7868
|
+
className: getTableCellClasses({
|
|
7869
|
+
isCompact: true,
|
|
7870
|
+
className: `px-3 py-2 ${cell.column.columnDef.meta?.align === "right" ? "text-right" : ""}`
|
|
7871
|
+
}),
|
|
7872
|
+
children: cellContent
|
|
7873
|
+
},
|
|
7874
|
+
cell.id
|
|
7875
|
+
);
|
|
7876
|
+
} catch (error) {
|
|
7877
|
+
logger.warn("Error in aggregation function:", error);
|
|
7878
|
+
return /* @__PURE__ */ jsx14(
|
|
7879
|
+
"td",
|
|
7880
|
+
{
|
|
7881
|
+
className: getTableCellClasses({
|
|
7882
|
+
isCompact: true,
|
|
7883
|
+
className: "px-3 py-2"
|
|
7884
|
+
})
|
|
7885
|
+
},
|
|
7886
|
+
cell.id
|
|
7887
|
+
);
|
|
7888
|
+
}
|
|
7959
7889
|
}
|
|
7960
|
-
|
|
7890
|
+
return /* @__PURE__ */ jsx14(
|
|
7891
|
+
"td",
|
|
7892
|
+
{
|
|
7893
|
+
className: getTableCellClasses({
|
|
7894
|
+
isCompact: true,
|
|
7895
|
+
className: "px-3 py-2"
|
|
7896
|
+
})
|
|
7897
|
+
},
|
|
7898
|
+
cell.id
|
|
7899
|
+
);
|
|
7900
|
+
}) });
|
|
7961
7901
|
}
|
|
7962
7902
|
if (isEditing && editingData && onEditingDataChange && onSaveEditing && onCancelEditing) {
|
|
7963
7903
|
return /* @__PURE__ */ jsx14(
|
|
@@ -8083,46 +8023,6 @@ function UnifiedTableBody({
|
|
|
8083
8023
|
const shouldVirtualize = forceVirtualization || dataLength > VIRTUALIZATION_THRESHOLD;
|
|
8084
8024
|
const rows = table.getRowModel().rows;
|
|
8085
8025
|
const headerGroups = table.getHeaderGroups();
|
|
8086
|
-
useEffect3(() => {
|
|
8087
|
-
if (rows.length === 0 && dataLength > 0) {
|
|
8088
|
-
const tableState = table.getState();
|
|
8089
|
-
const pagination = tableState.pagination;
|
|
8090
|
-
const columnFilters = tableState.columnFilters;
|
|
8091
|
-
const globalFilter = tableState.globalFilter;
|
|
8092
|
-
const coreRows = table.getCoreRowModel().rows;
|
|
8093
|
-
const prePaginationRows = table.getPrePaginationRowModel?.()?.rows || [];
|
|
8094
|
-
const filteredRows = table.getFilteredRowModel?.()?.rows || [];
|
|
8095
|
-
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
8096
|
-
const rowCount = table.getRowCount();
|
|
8097
|
-
const pageCount = table.getPageCount();
|
|
8098
|
-
logger.warn("Rows empty but data exists!", {
|
|
8099
|
-
dataLength,
|
|
8100
|
-
rowsLength: rows.length,
|
|
8101
|
-
coreRowsLength: coreRows.length,
|
|
8102
|
-
prePaginationRowsLength: prePaginationRows.length,
|
|
8103
|
-
filteredRowsLength: filteredRows.length,
|
|
8104
|
-
sortedRowsLength: sortedRows.length,
|
|
8105
|
-
rowCount,
|
|
8106
|
-
pageCount,
|
|
8107
|
-
pagination: {
|
|
8108
|
-
pageIndex: pagination.pageIndex,
|
|
8109
|
-
pageSize: pagination.pageSize
|
|
8110
|
-
},
|
|
8111
|
-
columnFilters,
|
|
8112
|
-
globalFilter,
|
|
8113
|
-
tableOptions: {
|
|
8114
|
-
getCoreRowModel: !!table.options.getCoreRowModel,
|
|
8115
|
-
getFilteredRowModel: !!table.options.getFilteredRowModel,
|
|
8116
|
-
getSortedRowModel: !!table.options.getSortedRowModel,
|
|
8117
|
-
getPaginationRowModel: !!table.options.getPaginationRowModel,
|
|
8118
|
-
manualPagination: table.options.manualPagination,
|
|
8119
|
-
manualFiltering: table.options.manualFiltering,
|
|
8120
|
-
manualSorting: table.options.manualSorting
|
|
8121
|
-
},
|
|
8122
|
-
tableDataLength: table.options.data?.length || 0
|
|
8123
|
-
});
|
|
8124
|
-
}
|
|
8125
|
-
}, [rows.length, dataLength, table, logger]);
|
|
8126
8026
|
const hasScrollContainer = !!parentRef.current;
|
|
8127
8027
|
const effectiveShouldVirtualize = shouldVirtualize && hasScrollContainer;
|
|
8128
8028
|
const virtualizer = useVirtualizer({
|
|
@@ -8330,6 +8230,7 @@ import {
|
|
|
8330
8230
|
} from "lucide-react";
|
|
8331
8231
|
|
|
8332
8232
|
// src/components/DataTable/utils/paginationUtils.ts
|
|
8233
|
+
init_logger();
|
|
8333
8234
|
function getPaginationBinding(config) {
|
|
8334
8235
|
const { mode, table, serverData, totalCount, onPageChange, onPageSizeChange } = config;
|
|
8335
8236
|
const state = calculatePaginationState(config);
|
|
@@ -8701,64 +8602,6 @@ import { useState as useState4, useRef as useRef4, useEffect as useEffect5 } fro
|
|
|
8701
8602
|
import * as React12 from "react";
|
|
8702
8603
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
8703
8604
|
import { X as X4 } from "lucide-react";
|
|
8704
|
-
|
|
8705
|
-
// src/components/Dialog/utils/safeHtml.ts
|
|
8706
|
-
function sanitizeHtml(html) {
|
|
8707
|
-
if (!html || typeof html !== "string") {
|
|
8708
|
-
return "";
|
|
8709
|
-
}
|
|
8710
|
-
console.log("\u{1F50D} sanitizeHtml input:", html);
|
|
8711
|
-
let sanitized = html.replace(/<script\b[^>]*>.*?<\/script>/gi, "").replace(/<script\b[^>]*\/>/gi, "").replace(/<iframe\b[^>]*>.*?<\/iframe>/gi, "").replace(/<iframe\b[^>]*\/>/gi, "").replace(/<object\b[^>]*>.*?<\/object>/gi, "").replace(/<object\b[^>]*\/>/gi, "").replace(/<embed\b[^>]*\/?>/gi, "").replace(/<form\b[^>]*>.*?<\/form>/gi, "").replace(/<form\b[^>]*\/>/gi, "").replace(/<input\b[^>]*\/?>/gi, "").replace(/<button\b[^>]*>.*?<\/button>/gi, "").replace(/<button\b[^>]*\/>/gi, "").replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi, "").replace(/javascript:[^"'\s>]*/gi, "").replace(/data:[^"'\s>]*/gi, "");
|
|
8712
|
-
console.log("\u{1F50D} sanitizeHtml output:", sanitized);
|
|
8713
|
-
return sanitized;
|
|
8714
|
-
}
|
|
8715
|
-
function validateHtml(html) {
|
|
8716
|
-
const warnings = [];
|
|
8717
|
-
if (!html || typeof html !== "string") {
|
|
8718
|
-
return { isValid: false, warnings: ["HTML content must be a non-empty string"] };
|
|
8719
|
-
}
|
|
8720
|
-
const dangerousPatterns = [
|
|
8721
|
-
{ pattern: /<script\b[^>]*>.*?<\/script>/gi, message: "Script tags are not allowed" },
|
|
8722
|
-
{ pattern: /<script\b[^>]*\/>/gi, message: "Script tags are not allowed" },
|
|
8723
|
-
{ pattern: /<iframe\b[^>]*>.*?<\/iframe>/gi, message: "Iframe tags are not allowed" },
|
|
8724
|
-
{ pattern: /<iframe\b[^>]*\/>/gi, message: "Iframe tags are not allowed" },
|
|
8725
|
-
{ pattern: /<object\b[^>]*>.*?<\/object>/gi, message: "Object tags are not allowed" },
|
|
8726
|
-
{ pattern: /<object\b[^>]*\/>/gi, message: "Object tags are not allowed" },
|
|
8727
|
-
{ pattern: /<embed\b[^>]*\/?>/gi, message: "Embed tags are not allowed" },
|
|
8728
|
-
{ pattern: /<form\b[^>]*>.*?<\/form>/gi, message: "Form tags are not allowed" },
|
|
8729
|
-
{ pattern: /<form\b[^>]*\/>/gi, message: "Form tags are not allowed" },
|
|
8730
|
-
{ pattern: /<input\b[^>]*\/?>/gi, message: "Input tags are not allowed" },
|
|
8731
|
-
{ pattern: /<button\b[^>]*>.*?<\/button>/gi, message: "Button tags are not allowed" },
|
|
8732
|
-
{ pattern: /<button\b[^>]*\/>/gi, message: "Button tags are not allowed" },
|
|
8733
|
-
{ pattern: /on\w+\s*=/gi, message: "Event handlers are not allowed" },
|
|
8734
|
-
{ pattern: /javascript:/gi, message: "JavaScript protocols are not allowed" },
|
|
8735
|
-
{ pattern: /data:/gi, message: "Data protocols are not allowed" }
|
|
8736
|
-
];
|
|
8737
|
-
dangerousPatterns.forEach(({ pattern, message }) => {
|
|
8738
|
-
if (pattern.test(html)) {
|
|
8739
|
-
warnings.push(message);
|
|
8740
|
-
}
|
|
8741
|
-
});
|
|
8742
|
-
return {
|
|
8743
|
-
isValid: warnings.length === 0,
|
|
8744
|
-
warnings
|
|
8745
|
-
};
|
|
8746
|
-
}
|
|
8747
|
-
function renderSafeHtml(html, options = {}) {
|
|
8748
|
-
const { strict = true, logWarnings = false } = options;
|
|
8749
|
-
const validation = validateHtml(html);
|
|
8750
|
-
const sanitizedHtml = sanitizeHtml(html);
|
|
8751
|
-
if (logWarnings && validation.warnings.length > 0) {
|
|
8752
|
-
console.warn("Dialog HTML content warnings:", validation.warnings);
|
|
8753
|
-
}
|
|
8754
|
-
return {
|
|
8755
|
-
html: sanitizedHtml,
|
|
8756
|
-
isValid: validation.isValid,
|
|
8757
|
-
warnings: validation.warnings
|
|
8758
|
-
};
|
|
8759
|
-
}
|
|
8760
|
-
|
|
8761
|
-
// src/components/Dialog/Dialog.tsx
|
|
8762
8605
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
8763
8606
|
import { useState as useState3, useEffect as useEffect4 } from "react";
|
|
8764
8607
|
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
@@ -9076,7 +8919,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
9076
8919
|
import * as React13 from "react";
|
|
9077
8920
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
9078
8921
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
9079
|
-
var Progress = React13.forwardRef(({ className, value, max = 100, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
8922
|
+
var Progress = React13.forwardRef(({ className, value, max: max2 = 100, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
9080
8923
|
ProgressPrimitive.Root,
|
|
9081
8924
|
{
|
|
9082
8925
|
ref,
|
|
@@ -9086,9 +8929,9 @@ var Progress = React13.forwardRef(({ className, value, max = 100, ...props }, re
|
|
|
9086
8929
|
),
|
|
9087
8930
|
...props,
|
|
9088
8931
|
value,
|
|
9089
|
-
max,
|
|
8932
|
+
max: max2,
|
|
9090
8933
|
"aria-valuenow": value,
|
|
9091
|
-
"aria-valuemax":
|
|
8934
|
+
"aria-valuemax": max2,
|
|
9092
8935
|
"aria-valuemin": 0,
|
|
9093
8936
|
children: /* @__PURE__ */ jsx18(
|
|
9094
8937
|
ProgressPrimitive.Indicator,
|
|
@@ -9102,6 +8945,7 @@ var Progress = React13.forwardRef(({ className, value, max = 100, ...props }, re
|
|
|
9102
8945
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
9103
8946
|
|
|
9104
8947
|
// src/components/DataTable/components/ImportModal.tsx
|
|
8948
|
+
init_logger();
|
|
9105
8949
|
import { Upload as Upload2, FileText, AlertCircle } from "lucide-react";
|
|
9106
8950
|
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9107
8951
|
function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
@@ -9146,10 +8990,7 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9146
8990
|
totalRowsText = "Total rows to import: {count}"
|
|
9147
8991
|
} = config;
|
|
9148
8992
|
const processCSV = (csvText) => {
|
|
9149
|
-
logger.debug("Raw CSV text:", csvText.substring(0, 200) + "...");
|
|
9150
8993
|
const lines = csvText.split("\n").filter((line) => line.trim());
|
|
9151
|
-
logger.debug("CSV lines count:", lines.length);
|
|
9152
|
-
logger.debug("First few lines:", lines.slice(0, 3));
|
|
9153
8994
|
if (lines.length < 2) {
|
|
9154
8995
|
throw new Error("CSV must have at least a header row and one data row");
|
|
9155
8996
|
}
|
|
@@ -9172,17 +9013,14 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9172
9013
|
return result;
|
|
9173
9014
|
};
|
|
9174
9015
|
const headers = parseCSVLine(lines[0]).map((h) => h.replace(/"/g, "").trim());
|
|
9175
|
-
|
|
9176
|
-
const data = lines.slice(1).map((line, index) => {
|
|
9016
|
+
const data = lines.slice(1).map((line) => {
|
|
9177
9017
|
const values = parseCSVLine(line).map((v) => v.replace(/"/g, "").trim());
|
|
9178
9018
|
const row = {};
|
|
9179
9019
|
headers.forEach((header, colIndex) => {
|
|
9180
9020
|
row[header] = values[colIndex] || "";
|
|
9181
9021
|
});
|
|
9182
|
-
logger.debug(`Row ${index + 1}:`, row);
|
|
9183
9022
|
return row;
|
|
9184
9023
|
});
|
|
9185
|
-
logger.debug("Final parsed data:", data);
|
|
9186
9024
|
return data;
|
|
9187
9025
|
};
|
|
9188
9026
|
const handleImport = async () => {
|
|
@@ -9293,20 +9131,15 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9293
9131
|
};
|
|
9294
9132
|
const handleFileSelect = async (event) => {
|
|
9295
9133
|
const selectedFile = event.target.files?.[0];
|
|
9296
|
-
logger.debug("File selected:", selectedFile?.name);
|
|
9297
9134
|
if (selectedFile) {
|
|
9298
9135
|
setFile(selectedFile);
|
|
9299
9136
|
setError(null);
|
|
9300
9137
|
setValidationErrors([]);
|
|
9301
9138
|
try {
|
|
9302
9139
|
const text = await selectedFile.text();
|
|
9303
|
-
logger.debug("File content length:", text.length);
|
|
9304
9140
|
const data = processCSV(text);
|
|
9305
|
-
logger.debug("Parsed CSV data:", data.length, "rows");
|
|
9306
|
-
logger.debug("Setting preview data:", data.slice(0, 5));
|
|
9307
9141
|
setPreviewData(data.slice(0, 5));
|
|
9308
9142
|
setTotalCount(data.length);
|
|
9309
|
-
logger.debug("Preview data state should be updated");
|
|
9310
9143
|
} catch (err) {
|
|
9311
9144
|
logger.error("CSV parsing error:", err);
|
|
9312
9145
|
setError(err instanceof Error ? err.message : "Failed to preview file");
|
|
@@ -9423,30 +9256,26 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9423
9256
|
}
|
|
9424
9257
|
|
|
9425
9258
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
9259
|
+
init_logger();
|
|
9426
9260
|
import { Fragment as Fragment4, jsx as jsx20 } from "react/jsx-runtime";
|
|
9427
9261
|
function mapCSVToTableColumns(csvData, columns) {
|
|
9428
9262
|
const logger = createLogger("mapCSVToTableColumns");
|
|
9429
9263
|
const columnMap = /* @__PURE__ */ new Map();
|
|
9430
|
-
logger.debug("Building column map from", columns.length, "column definitions");
|
|
9431
9264
|
columns.forEach((col) => {
|
|
9432
9265
|
const fieldName = col.editAccessorKey || col.accessorKey || col.id;
|
|
9433
9266
|
const header = typeof col.header === "string" ? col.header : "";
|
|
9434
9267
|
if (fieldName && header) {
|
|
9435
9268
|
const headerLower = header.toLowerCase();
|
|
9436
9269
|
columnMap.set(headerLower, fieldName);
|
|
9437
|
-
logger.debug(`Mapped "${header}" -> "${fieldName}"`);
|
|
9438
9270
|
const colId = col.id || col.accessorKey;
|
|
9439
9271
|
if (colId && colId !== header && colId !== fieldName) {
|
|
9440
9272
|
columnMap.set(colId.toLowerCase(), fieldName);
|
|
9441
|
-
logger.debug(`Also mapped "${colId}" -> "${fieldName}"`);
|
|
9442
9273
|
}
|
|
9443
9274
|
if (col.editAccessorKey && header) {
|
|
9444
9275
|
const editAccessorKey = col.editAccessorKey;
|
|
9445
9276
|
const idColumnHeader = `${header} (ID)`;
|
|
9446
9277
|
columnMap.set(idColumnHeader.toLowerCase(), editAccessorKey);
|
|
9447
|
-
logger.debug(`Mapped ID column "${idColumnHeader}" -> "${editAccessorKey}"`);
|
|
9448
9278
|
columnMap.set(editAccessorKey.toLowerCase(), editAccessorKey);
|
|
9449
|
-
logger.debug(`Also mapped "${editAccessorKey}" -> "${editAccessorKey}"`);
|
|
9450
9279
|
}
|
|
9451
9280
|
} else {
|
|
9452
9281
|
logger.warn("Skipping column with missing fieldName or header:", col);
|
|
@@ -9456,9 +9285,6 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9456
9285
|
logger.warn("No CSV data to map");
|
|
9457
9286
|
return [];
|
|
9458
9287
|
}
|
|
9459
|
-
const csvHeaders = Object.keys(csvData[0]);
|
|
9460
|
-
logger.debug("CSV headers found:", csvHeaders);
|
|
9461
|
-
logger.debug("Column map size:", columnMap.size);
|
|
9462
9288
|
const mappedData = csvData.map((row, index) => {
|
|
9463
9289
|
const mappedRow = {};
|
|
9464
9290
|
Object.keys(row).forEach((csvHeader) => {
|
|
@@ -9469,18 +9295,12 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9469
9295
|
const keyWithSpace = ` ${mapKey}`;
|
|
9470
9296
|
if (csvHeaderLower === mapKey || csvHeaderLower.endsWith(keyWithSpace)) {
|
|
9471
9297
|
fieldName = mapValue;
|
|
9472
|
-
if (index === 0) {
|
|
9473
|
-
logger.debug(`Flexible match: "${csvHeader}" -> "${mapValue}" (matched "${mapKey}")`);
|
|
9474
|
-
}
|
|
9475
9298
|
break;
|
|
9476
9299
|
}
|
|
9477
9300
|
}
|
|
9478
9301
|
}
|
|
9479
9302
|
if (fieldName) {
|
|
9480
9303
|
mappedRow[fieldName] = row[csvHeader];
|
|
9481
|
-
if (index === 0) {
|
|
9482
|
-
logger.debug(`Row 0: "${csvHeader}" -> "${fieldName}"`);
|
|
9483
|
-
}
|
|
9484
9304
|
} else {
|
|
9485
9305
|
mappedRow[csvHeaderLower] = row[csvHeader];
|
|
9486
9306
|
if (index === 0) {
|
|
@@ -9490,10 +9310,6 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9490
9310
|
});
|
|
9491
9311
|
return mappedRow;
|
|
9492
9312
|
});
|
|
9493
|
-
logger.debug("Mapped", mappedData.length, "rows");
|
|
9494
|
-
if (mappedData.length > 0) {
|
|
9495
|
-
logger.debug("First mapped row keys:", Object.keys(mappedData[0]));
|
|
9496
|
-
}
|
|
9497
9313
|
return mappedData;
|
|
9498
9314
|
}
|
|
9499
9315
|
function DataTableModals({
|
|
@@ -9525,10 +9341,7 @@ function DataTableModals({
|
|
|
9525
9341
|
try {
|
|
9526
9342
|
let mappedData;
|
|
9527
9343
|
if (columns && columns.length > 0) {
|
|
9528
|
-
logger.debug("Mapping CSV data with", columns.length, "column definitions");
|
|
9529
|
-
logger.debug("Raw CSV headers:", rawData.length > 0 ? Object.keys(rawData[0]) : []);
|
|
9530
9344
|
mappedData = mapCSVToTableColumns(rawData, columns);
|
|
9531
|
-
logger.debug("Mapped data sample:", mappedData.length > 0 ? mappedData[0] : null);
|
|
9532
9345
|
} else {
|
|
9533
9346
|
logger.warn("No columns provided for mapping, using raw data");
|
|
9534
9347
|
mappedData = rawData;
|
|
@@ -9537,12 +9350,10 @@ function DataTableModals({
|
|
|
9537
9350
|
logger.error("onImport callback is not provided");
|
|
9538
9351
|
throw new Error("Import handler is not configured. Please provide an onImport callback.");
|
|
9539
9352
|
}
|
|
9540
|
-
logger.debug("Calling onImport with", mappedData.length, "rows");
|
|
9541
9353
|
const result = onImport(mappedData);
|
|
9542
9354
|
if (result && typeof result.then === "function") {
|
|
9543
9355
|
await result;
|
|
9544
9356
|
}
|
|
9545
|
-
logger.debug("Import completed successfully");
|
|
9546
9357
|
} catch (error) {
|
|
9547
9358
|
logger.error("Import error:", error);
|
|
9548
9359
|
throw error;
|
|
@@ -9618,6 +9429,7 @@ var AlertDescription = React16.forwardRef(({ className, ...props }, ref) => {
|
|
|
9618
9429
|
AlertDescription.displayName = "AlertDescription";
|
|
9619
9430
|
|
|
9620
9431
|
// src/components/DataTable/components/DataTableErrorBoundary.tsx
|
|
9432
|
+
init_logger();
|
|
9621
9433
|
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9622
9434
|
var DataTableErrorBoundary = class extends Component {
|
|
9623
9435
|
constructor(props) {
|
|
@@ -9737,6 +9549,7 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
9737
9549
|
};
|
|
9738
9550
|
|
|
9739
9551
|
// src/components/DataTable/hooks/useColumnOrderPersistence.ts
|
|
9552
|
+
init_logger();
|
|
9740
9553
|
import { useState as useState5, useEffect as useEffect7, useCallback as useCallback4 } from "react";
|
|
9741
9554
|
function useColumnOrderPersistence({
|
|
9742
9555
|
tableId,
|
|
@@ -9817,6 +9630,7 @@ function useColumnOrderPersistence({
|
|
|
9817
9630
|
}
|
|
9818
9631
|
|
|
9819
9632
|
// src/components/DataTable/hooks/useColumnVisibilityPersistence.ts
|
|
9633
|
+
init_logger();
|
|
9820
9634
|
import { useState as useState6, useEffect as useEffect8, useCallback as useCallback5 } from "react";
|
|
9821
9635
|
function useColumnVisibilityPersistence({
|
|
9822
9636
|
tableId,
|
|
@@ -10784,6 +10598,7 @@ function AccessDeniedPage({
|
|
|
10784
10598
|
}
|
|
10785
10599
|
|
|
10786
10600
|
// src/components/DataTable/utils/exportUtils.ts
|
|
10601
|
+
init_logger();
|
|
10787
10602
|
function escapeCSVValue(value, sanitizeForSecurity = true) {
|
|
10788
10603
|
if (value === null || value === void 0) {
|
|
10789
10604
|
return sanitizeForSecurity ? '""' : "";
|
|
@@ -10963,6 +10778,7 @@ init_UnifiedAuthProvider();
|
|
|
10963
10778
|
// src/components/DataTable/hooks/useDataTablePermissions.ts
|
|
10964
10779
|
init_UnifiedAuthProvider();
|
|
10965
10780
|
import { useMemo as useMemo12, useRef as useRef5 } from "react";
|
|
10781
|
+
init_logger();
|
|
10966
10782
|
|
|
10967
10783
|
// src/components/DataTable/types.ts
|
|
10968
10784
|
var defaultDataTableFeatures = {
|
|
@@ -11000,14 +10816,7 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
11000
10816
|
throw new Error("DataTable requires either rbac.pageId or rbac.pageName for permission checking");
|
|
11001
10817
|
}
|
|
11002
10818
|
const effectivePageId = pageId || pageName;
|
|
11003
|
-
const { selectedOrganisation, selectedEvent, supabase
|
|
11004
|
-
logger.debug("Organisation context:", {
|
|
11005
|
-
hasSelectedOrg: !!selectedOrganisation,
|
|
11006
|
-
selectedOrgId: selectedOrganisation?.id,
|
|
11007
|
-
hasOrganisations: organisations?.length > 0,
|
|
11008
|
-
organisationCount: organisations?.length,
|
|
11009
|
-
selectedEvent: selectedEvent?.event_id
|
|
11010
|
-
});
|
|
10819
|
+
const { selectedOrganisation, selectedEvent, supabase } = useUnifiedAuth();
|
|
11011
10820
|
const { resolvedScope: rawResolvedScope, isLoading: scopeLoading } = useResolvedScope({
|
|
11012
10821
|
supabase,
|
|
11013
10822
|
selectedOrganisationId: selectedOrganisation?.id || null,
|
|
@@ -11052,16 +10861,6 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
11052
10861
|
canImport: useCan(userId, consistentScope, createPermission, effectivePageId, true)
|
|
11053
10862
|
// Use create permission for import
|
|
11054
10863
|
};
|
|
11055
|
-
logger.debug("Permission check results:", {
|
|
11056
|
-
canRead: permissions.canRead.can,
|
|
11057
|
-
canReadLoading: permissions.canRead.isLoading,
|
|
11058
|
-
canReadError: permissions.canRead.error?.message,
|
|
11059
|
-
canCreate: permissions.canCreate.can,
|
|
11060
|
-
pageName: effectivePageId,
|
|
11061
|
-
scope: consistentScope,
|
|
11062
|
-
hasValidScope: !!effectiveScope,
|
|
11063
|
-
scopeLoading
|
|
11064
|
-
});
|
|
11065
10864
|
const normalizedFeatures = useMemo12(
|
|
11066
10865
|
() => normalizeDataTableFeatures(features),
|
|
11067
10866
|
[features]
|
|
@@ -11464,8 +11263,8 @@ function announceLoadingState(isLoading, hasError = false) {
|
|
|
11464
11263
|
announce("Data loaded");
|
|
11465
11264
|
}
|
|
11466
11265
|
}
|
|
11467
|
-
function announceBulkOperation(operation,
|
|
11468
|
-
const message = `${operation} completed for ${
|
|
11266
|
+
function announceBulkOperation(operation, count2) {
|
|
11267
|
+
const message = `${operation} completed for ${count2} ${count2 === 1 ? "item" : "items"}`;
|
|
11469
11268
|
announce(message);
|
|
11470
11269
|
}
|
|
11471
11270
|
function getAriaSortValue(sortDirection) {
|
|
@@ -11774,6 +11573,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
11774
11573
|
}
|
|
11775
11574
|
|
|
11776
11575
|
// src/components/DataTable/components/DataTableCore.tsx
|
|
11576
|
+
init_logger();
|
|
11777
11577
|
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
11778
11578
|
var isCellValue = (value) => {
|
|
11779
11579
|
if (value === null || value === void 0) {
|
|
@@ -11842,12 +11642,6 @@ function DataTableInternal(props) {
|
|
|
11842
11642
|
storageKey,
|
|
11843
11643
|
onLayoutChange
|
|
11844
11644
|
} = props;
|
|
11845
|
-
console.log("[DataTableInternal] Props received:", {
|
|
11846
|
-
"onExport in props": !!props.onExport,
|
|
11847
|
-
"onExport after destructuring": !!onExport,
|
|
11848
|
-
"onExport type": typeof onExport,
|
|
11849
|
-
"props keys with Export": Object.keys(props).filter((k) => k.toLowerCase().includes("export"))
|
|
11850
|
-
});
|
|
11851
11645
|
const logger = React20.useMemo(() => createLogger("DataTableCore"), []);
|
|
11852
11646
|
const authResult = useUnifiedAuth();
|
|
11853
11647
|
const user = authResult.user;
|
|
@@ -11856,15 +11650,6 @@ function DataTableInternal(props) {
|
|
|
11856
11650
|
[incomingFeatures]
|
|
11857
11651
|
);
|
|
11858
11652
|
const { permissions, secureFeatures, effectivePageId } = useDataTablePermissions(rbac, requestedFeatures);
|
|
11859
|
-
if (import.meta.env.MODE === "development") {
|
|
11860
|
-
logger.debug("[DataTableCore] Creation feature check:", {
|
|
11861
|
-
"incomingFeatures.creation": incomingFeatures.creation,
|
|
11862
|
-
"requestedFeatures.creation": requestedFeatures.creation,
|
|
11863
|
-
"secureFeatures.creation": secureFeatures.creation,
|
|
11864
|
-
"permissions.canCreate.can": permissions.canCreate.can,
|
|
11865
|
-
"onCreateRow prop provided": !!onCreateRow
|
|
11866
|
-
});
|
|
11867
|
-
}
|
|
11868
11653
|
const effectiveColumnOrder = useEffectiveColumnOrder({
|
|
11869
11654
|
columns,
|
|
11870
11655
|
externalColumnOrder,
|
|
@@ -12006,20 +11791,6 @@ function DataTableInternal(props) {
|
|
|
12006
11791
|
logger.error("Hierarchical data validation failed:", hierarchicalValidation.errors);
|
|
12007
11792
|
}
|
|
12008
11793
|
}, [hierarchicalValidation, logger]);
|
|
12009
|
-
useEffect12(() => {
|
|
12010
|
-
if (finalTableData.length === 0 && data.length > 0) {
|
|
12011
|
-
logger.warn("Diagnostic: finalTableData empty but input data exists", {
|
|
12012
|
-
inputDataLength: data.length,
|
|
12013
|
-
finalTableDataLength: finalTableData.length,
|
|
12014
|
-
dataCount: finalDataCount,
|
|
12015
|
-
finalPaginationMode,
|
|
12016
|
-
hasServerData: !!serverData,
|
|
12017
|
-
serverDataLength: serverData?.data?.length || 0,
|
|
12018
|
-
hierarchicalEnabled: Boolean(secureFeatures.hierarchical && hierarchical?.enabled),
|
|
12019
|
-
hierarchicalValid: hierarchicalValidation.isValid
|
|
12020
|
-
});
|
|
12021
|
-
}
|
|
12022
|
-
}, [finalTableData.length, data.length, finalDataCount, finalPaginationMode, serverData, secureFeatures.hierarchical, hierarchical, hierarchicalValidation.isValid, logger]);
|
|
12023
11794
|
const {
|
|
12024
11795
|
columnOrder: savedColumnOrder,
|
|
12025
11796
|
isLoaded: isColumnOrderLoaded,
|
|
@@ -12039,16 +11810,12 @@ function DataTableInternal(props) {
|
|
|
12039
11810
|
useEffect12(() => {
|
|
12040
11811
|
if (secureFeatures.selection && state.columnOrder.includes("select") && state.columnOrder[0] !== "select") {
|
|
12041
11812
|
const normalizedOrder = ["select", ...state.columnOrder.filter((id) => id !== "select")];
|
|
12042
|
-
logger.warn("Correcting column order state - moving select to first position:", {
|
|
12043
|
-
before: state.columnOrder,
|
|
12044
|
-
after: normalizedOrder
|
|
12045
|
-
});
|
|
12046
11813
|
stateActions.setColumnOrder(normalizedOrder);
|
|
12047
11814
|
if (secureFeatures.columnReordering) {
|
|
12048
11815
|
updateColumnOrder(normalizedOrder);
|
|
12049
11816
|
}
|
|
12050
11817
|
}
|
|
12051
|
-
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder
|
|
11818
|
+
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder]);
|
|
12052
11819
|
const finalPageSizeOptions = optimizedPageSizeOptions;
|
|
12053
11820
|
const validatedInitialPageSize = useMemo14(() => {
|
|
12054
11821
|
if (!secureFeatures.pagination || !finalPageSizeOptions.length) {
|
|
@@ -12128,62 +11895,10 @@ function DataTableInternal(props) {
|
|
|
12128
11895
|
onExport: permissions.canExport.can ? onExport : void 0,
|
|
12129
11896
|
onDeleteSelected: permissions.canDelete.can ? onDeleteSelected : void 0
|
|
12130
11897
|
};
|
|
12131
|
-
console.log("[DataTableCore] Secure handlers setup:", {
|
|
12132
|
-
"permissions.canExport.can": permissions.canExport.can,
|
|
12133
|
-
"onExport prop provided": !!onExport,
|
|
12134
|
-
"onExport type": typeof onExport,
|
|
12135
|
-
"secureHandlers.onExport": !!handlers.onExport
|
|
12136
|
-
});
|
|
12137
|
-
if (import.meta.env.MODE === "development") {
|
|
12138
|
-
logger.debug("[DataTableCore] Handler check:", {
|
|
12139
|
-
"permissions.canCreate.can": permissions.canCreate.can,
|
|
12140
|
-
"onCreateRow prop provided": !!onCreateRow,
|
|
12141
|
-
"secureHandlers.onCreateRow": !!handlers.onCreateRow,
|
|
12142
|
-
"secureFeatures.creation": secureFeatures.creation,
|
|
12143
|
-
"will pass onCreateRow to toolbar": secureFeatures.creation && !!handlers.onCreateRow,
|
|
12144
|
-
"permissions.canExport.can": permissions.canExport.can,
|
|
12145
|
-
"onExport prop provided": !!onExport,
|
|
12146
|
-
"secureHandlers.onExport": !!handlers.onExport
|
|
12147
|
-
});
|
|
12148
|
-
}
|
|
12149
11898
|
return handlers;
|
|
12150
|
-
}, [permissions.canUpdate.can, permissions.canDelete.can, permissions.canCreate.can, permissions.canImport.can, permissions.canExport.can, onEditRow, onDeleteRow, onCreateRow, onImport, onExport, onDeleteSelected, secureFeatures.creation
|
|
12151
|
-
if (import.meta.env.MODE === "development") {
|
|
12152
|
-
logger.debug("[DataTableCore] \u26A0\uFE0F CREATION BUTTON DIAGNOSIS:", {
|
|
12153
|
-
"\u2705 permissions.canCreate.can": permissions.canCreate.can,
|
|
12154
|
-
"\u2753 features.creation enabled": secureFeatures.creation,
|
|
12155
|
-
"\u2753 onCreateRow handler provided": !!onCreateRow,
|
|
12156
|
-
"\u2753 secureHandlers.onCreateRow": !!secureHandlers.onCreateRow,
|
|
12157
|
-
"\u{1F50D} WILL SHOW BUTTON": secureFeatures.creation && permissions.canCreate.can && !!onCreateRow,
|
|
12158
|
-
"\u{1F4A1} SOLUTION": !secureFeatures.creation ? "Enable features={{ creation: true }} in DataTable props" : !onCreateRow ? "Provide onCreateRow handler in DataTable props" : "All conditions met - button should be visible"
|
|
12159
|
-
});
|
|
12160
|
-
}
|
|
11899
|
+
}, [permissions.canUpdate.can, permissions.canDelete.can, permissions.canCreate.can, permissions.canImport.can, permissions.canExport.can, onEditRow, onDeleteRow, onCreateRow, onImport, onExport, onDeleteSelected, secureFeatures.creation]);
|
|
12161
11900
|
const effectiveActions = useMemo14(() => {
|
|
12162
11901
|
const result = [...actions];
|
|
12163
|
-
logger.debug("Action Configuration Debug:", {
|
|
12164
|
-
originalActions: actions.length,
|
|
12165
|
-
secureFeatures: {
|
|
12166
|
-
editing: secureFeatures.editing,
|
|
12167
|
-
deletion: secureFeatures.deletion,
|
|
12168
|
-
creation: secureFeatures.creation,
|
|
12169
|
-
import: secureFeatures.import,
|
|
12170
|
-
export: secureFeatures.export
|
|
12171
|
-
},
|
|
12172
|
-
secureHandlers: {
|
|
12173
|
-
onEditRow: !!secureHandlers.onEditRow,
|
|
12174
|
-
onDeleteRow: !!secureHandlers.onDeleteRow,
|
|
12175
|
-
onCreateRow: !!secureHandlers.onCreateRow,
|
|
12176
|
-
onImport: !!secureHandlers.onImport,
|
|
12177
|
-
onExport: !!secureHandlers.onExport
|
|
12178
|
-
},
|
|
12179
|
-
permissions: {
|
|
12180
|
-
canUpdate: permissions.canUpdate.can,
|
|
12181
|
-
canDelete: permissions.canDelete.can,
|
|
12182
|
-
canCreate: permissions.canCreate.can,
|
|
12183
|
-
canImport: permissions.canImport.can,
|
|
12184
|
-
canExport: permissions.canExport.can
|
|
12185
|
-
}
|
|
12186
|
-
});
|
|
12187
11902
|
if (secureFeatures.editing && secureHandlers.onEditRow && !result.some((a) => a.label === "Edit")) {
|
|
12188
11903
|
result.push({
|
|
12189
11904
|
label: "Edit",
|
|
@@ -12237,11 +11952,6 @@ function DataTableInternal(props) {
|
|
|
12237
11952
|
hidden: !permissions.canDelete.can
|
|
12238
11953
|
});
|
|
12239
11954
|
}
|
|
12240
|
-
logger.debug("Final Actions:", {
|
|
12241
|
-
totalActions: result.length,
|
|
12242
|
-
actionLabels: result.map((a) => a.label),
|
|
12243
|
-
hiddenActions: result.filter((a) => a.hidden).map((a) => a.label)
|
|
12244
|
-
});
|
|
12245
11955
|
return result;
|
|
12246
11956
|
}, [actions, secureFeatures, permissions, secureHandlers, resolvedGetRowId, stateActions, data]);
|
|
12247
11957
|
const normalizedColumnOrderForColumns = useMemo14(() => {
|
|
@@ -12262,14 +11972,6 @@ function DataTableInternal(props) {
|
|
|
12262
11972
|
}), [state.pagination, effectivePageSize]);
|
|
12263
11973
|
const tableStateSnapshot = useMemo14(() => {
|
|
12264
11974
|
const normalizedColumnOrder = secureFeatures.selection && state.columnOrder.includes("select") ? ["select", ...state.columnOrder.filter((id) => id !== "select")] : state.columnOrder;
|
|
12265
|
-
if (secureFeatures.selection && state.columnOrder[0] !== "select") {
|
|
12266
|
-
logger.warn("Column order normalized:", {
|
|
12267
|
-
original: state.columnOrder,
|
|
12268
|
-
normalized: normalizedColumnOrder,
|
|
12269
|
-
firstColumnOriginal: state.columnOrder[0],
|
|
12270
|
-
firstColumnNormalized: normalizedColumnOrder[0]
|
|
12271
|
-
});
|
|
12272
|
-
}
|
|
12273
11975
|
return {
|
|
12274
11976
|
sorting: state.sorting,
|
|
12275
11977
|
columnFilters: state.columnFilters,
|
|
@@ -12319,40 +12021,6 @@ function DataTableInternal(props) {
|
|
|
12319
12021
|
hasServerSideConfig: !!serverSide
|
|
12320
12022
|
});
|
|
12321
12023
|
const table = useReactTable(tableConfig);
|
|
12322
|
-
useEffect12(() => {
|
|
12323
|
-
const rows = table.getRowModel().rows;
|
|
12324
|
-
if (rows.length === 0 && finalTableData.length > 0) {
|
|
12325
|
-
const coreRows = table.getCoreRowModel().rows;
|
|
12326
|
-
const prePaginationRows = table.getPrePaginationRowModel?.()?.rows || [];
|
|
12327
|
-
const filteredRows = table.getFilteredRowModel?.()?.rows || [];
|
|
12328
|
-
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
12329
|
-
const tableState = table.getState();
|
|
12330
|
-
logger.warn("Table created but rows are empty!", {
|
|
12331
|
-
finalTableDataLength: finalTableData.length,
|
|
12332
|
-
tableConfigDataLength: tableConfig.data?.length || 0,
|
|
12333
|
-
coreRowsLength: coreRows.length,
|
|
12334
|
-
prePaginationRowsLength: prePaginationRows.length,
|
|
12335
|
-
filteredRowsLength: filteredRows.length,
|
|
12336
|
-
sortedRowsLength: sortedRows.length,
|
|
12337
|
-
finalRowsLength: rows.length,
|
|
12338
|
-
pagination: tableState.pagination,
|
|
12339
|
-
finalPaginationMode,
|
|
12340
|
-
hasServerSideConfig: !!serverSide,
|
|
12341
|
-
tableOptions: {
|
|
12342
|
-
getCoreRowModel: !!tableConfig.getCoreRowModel,
|
|
12343
|
-
getFilteredRowModel: !!tableConfig.getFilteredRowModel,
|
|
12344
|
-
getSortedRowModel: !!tableConfig.getSortedRowModel,
|
|
12345
|
-
getPaginationRowModel: !!tableConfig.getPaginationRowModel,
|
|
12346
|
-
manualPagination: tableConfig.manualPagination,
|
|
12347
|
-
manualFiltering: tableConfig.manualFiltering,
|
|
12348
|
-
manualSorting: tableConfig.manualSorting,
|
|
12349
|
-
pageCount: tableConfig.pageCount
|
|
12350
|
-
},
|
|
12351
|
-
hasRowId: !!resolvedGetRowId,
|
|
12352
|
-
effectivePageSize
|
|
12353
|
-
});
|
|
12354
|
-
}
|
|
12355
|
-
}, [table, finalTableData.length, tableConfig, resolvedGetRowId, finalPaginationMode, serverSide, effectivePageSize, logger]);
|
|
12356
12024
|
if (!user) {
|
|
12357
12025
|
throw new Error("DataTable requires authenticated user for RBAC");
|
|
12358
12026
|
}
|
|
@@ -12448,30 +12116,9 @@ function DataTableInternal(props) {
|
|
|
12448
12116
|
filename,
|
|
12449
12117
|
table
|
|
12450
12118
|
};
|
|
12451
|
-
console.log("[DataTableCore] Export handler check:", {
|
|
12452
|
-
"secureHandlers.onExport exists": !!secureHandlers.onExport,
|
|
12453
|
-
"permissions.canExport.can": permissions.canExport.can,
|
|
12454
|
-
"onExport prop provided": !!onExport,
|
|
12455
|
-
"onExport type": typeof onExport
|
|
12456
|
-
});
|
|
12457
12119
|
if (secureHandlers.onExport) {
|
|
12458
|
-
console.log("[DataTableCore] \u2705 Calling custom onExport handler");
|
|
12459
|
-
logger.debug("[DataTableCore] Calling custom onExport handler");
|
|
12460
12120
|
await secureHandlers.onExport(exportOptions);
|
|
12461
|
-
console.log("[DataTableCore] \u2705 Custom onExport handler completed");
|
|
12462
|
-
logger.debug("[DataTableCore] Custom onExport handler completed");
|
|
12463
12121
|
return;
|
|
12464
|
-
} else {
|
|
12465
|
-
console.warn("[DataTableCore] \u26A0\uFE0F No custom onExport handler, using default export", {
|
|
12466
|
-
"secureHandlers.onExport": !!secureHandlers.onExport,
|
|
12467
|
-
"permissions.canExport.can": permissions.canExport.can,
|
|
12468
|
-
"onExport prop provided": !!onExport
|
|
12469
|
-
});
|
|
12470
|
-
logger.debug("[DataTableCore] No custom onExport handler, using default export", {
|
|
12471
|
-
"secureHandlers.onExport": !!secureHandlers.onExport,
|
|
12472
|
-
"permissions.canExport.can": permissions.canExport.can,
|
|
12473
|
-
"onExport prop provided": !!onExport
|
|
12474
|
-
});
|
|
12475
12122
|
}
|
|
12476
12123
|
const exportColumns = exportOptions.visibleColumns.map((col) => {
|
|
12477
12124
|
const colId = col.id || col.accessorKey;
|
|
@@ -12494,7 +12141,6 @@ function DataTableInternal(props) {
|
|
|
12494
12141
|
description: `Data exported to ${exportOptions.filename}`,
|
|
12495
12142
|
variant: "default"
|
|
12496
12143
|
});
|
|
12497
|
-
logger.debug("Export completed successfully");
|
|
12498
12144
|
} catch (error) {
|
|
12499
12145
|
logger.error("Failed to export data:", error);
|
|
12500
12146
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -12706,12 +12352,10 @@ function DataTableInternal(props) {
|
|
|
12706
12352
|
onImport: async (data2) => {
|
|
12707
12353
|
if (onImport) {
|
|
12708
12354
|
try {
|
|
12709
|
-
logger.debug("onImport called with", data2.length, "rows");
|
|
12710
12355
|
const result = onImport(data2);
|
|
12711
12356
|
if (result && typeof result.then === "function") {
|
|
12712
12357
|
await result;
|
|
12713
12358
|
}
|
|
12714
|
-
logger.debug("onImport completed successfully");
|
|
12715
12359
|
toast({
|
|
12716
12360
|
title: "Import Successful",
|
|
12717
12361
|
description: `Successfully imported ${data2.length} ${data2.length === 1 ? "row" : "rows"}`,
|
|
@@ -12753,6 +12397,7 @@ function DataTableCore(props) {
|
|
|
12753
12397
|
}
|
|
12754
12398
|
|
|
12755
12399
|
// src/components/DataTable/DataTable.tsx
|
|
12400
|
+
init_logger();
|
|
12756
12401
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
12757
12402
|
function DataTable(props) {
|
|
12758
12403
|
const logger = React21.useMemo(() => createLogger("DataTable"), []);
|
|
@@ -12761,35 +12406,11 @@ function DataTable(props) {
|
|
|
12761
12406
|
() => normalizeDataTableFeatures(features),
|
|
12762
12407
|
[features]
|
|
12763
12408
|
);
|
|
12764
|
-
React21.useEffect(() => {
|
|
12765
|
-
if (!features && import.meta.env?.MODE === "development") {
|
|
12766
|
-
logger.info("DataTable: no features provided; all capabilities default to disabled. Pass a features object to enable functionality.");
|
|
12767
|
-
}
|
|
12768
|
-
}, [features, logger]);
|
|
12769
12409
|
React21.useEffect(() => {
|
|
12770
12410
|
if (normalizedFeatures.deleteSelected && !normalizedFeatures.deletion) {
|
|
12771
12411
|
logger.warn("deleteSelected requires deletion to be enabled");
|
|
12772
12412
|
}
|
|
12773
12413
|
}, [normalizedFeatures.deleteSelected, normalizedFeatures.deletion, logger]);
|
|
12774
|
-
const allPropsKeys = Object.keys(props);
|
|
12775
|
-
const allRestKeys = Object.keys(rest);
|
|
12776
|
-
const tableTitle = props.title || props.description || "unnamed";
|
|
12777
|
-
console.log(`[DataTable] Wrapper prop check (${tableTitle}):`, {
|
|
12778
|
-
"onExport in props": !!props.onExport,
|
|
12779
|
-
"onExport in rest": !!rest.onExport,
|
|
12780
|
-
"onExport type": typeof rest.onExport,
|
|
12781
|
-
"rest keys": Object.keys(rest).filter((k) => k.includes("Export") || k.includes("export")),
|
|
12782
|
-
"all rest keys": allRestKeys,
|
|
12783
|
-
// All keys for debugging
|
|
12784
|
-
"props keys": allPropsKeys,
|
|
12785
|
-
// All props keys
|
|
12786
|
-
"has onExport key": "onExport" in props,
|
|
12787
|
-
"has onExport in rest": "onExport" in rest,
|
|
12788
|
-
"props.onExport value": props.onExport,
|
|
12789
|
-
"rest.onExport value": rest.onExport
|
|
12790
|
-
});
|
|
12791
|
-
console.log(`[DataTable] All props keys for ${tableTitle}:`, allPropsKeys);
|
|
12792
|
-
console.log(`[DataTable] All rest keys for ${tableTitle}:`, allRestKeys);
|
|
12793
12414
|
return /* @__PURE__ */ jsx26(DataTableCore, { ...rest, features: normalizedFeatures });
|
|
12794
12415
|
}
|
|
12795
12416
|
var DataTableComponent = React21.memo(DataTable);
|
|
@@ -12899,6 +12520,56 @@ function GroupHeader({
|
|
|
12899
12520
|
] });
|
|
12900
12521
|
}
|
|
12901
12522
|
|
|
12523
|
+
// src/components/DataTable/utils/aggregationUtils.ts
|
|
12524
|
+
function sum(accessorKey) {
|
|
12525
|
+
return (rows, column) => {
|
|
12526
|
+
return rows.reduce((total, row) => {
|
|
12527
|
+
const value = row[accessorKey];
|
|
12528
|
+
const numValue = typeof value === "number" ? value : parseFloat(String(value || 0));
|
|
12529
|
+
return total + (isNaN(numValue) ? 0 : numValue);
|
|
12530
|
+
}, 0);
|
|
12531
|
+
};
|
|
12532
|
+
}
|
|
12533
|
+
function average(accessorKey) {
|
|
12534
|
+
return (rows, column) => {
|
|
12535
|
+
if (rows.length === 0) return 0;
|
|
12536
|
+
const validValues = rows.map((row) => row[accessorKey]).filter((value) => value != null && value !== "").map((value) => {
|
|
12537
|
+
const numValue = typeof value === "number" ? value : parseFloat(String(value));
|
|
12538
|
+
return isNaN(numValue) ? null : numValue;
|
|
12539
|
+
}).filter((value) => value !== null);
|
|
12540
|
+
if (validValues.length === 0) return 0;
|
|
12541
|
+
const sum2 = validValues.reduce((total, value) => total + value, 0);
|
|
12542
|
+
return sum2 / validValues.length;
|
|
12543
|
+
};
|
|
12544
|
+
}
|
|
12545
|
+
function count() {
|
|
12546
|
+
return (rows, column) => {
|
|
12547
|
+
return rows.length;
|
|
12548
|
+
};
|
|
12549
|
+
}
|
|
12550
|
+
function min(accessorKey) {
|
|
12551
|
+
return (rows, column) => {
|
|
12552
|
+
if (rows.length === 0) return null;
|
|
12553
|
+
const validValues = rows.map((row) => row[accessorKey]).filter((value) => value != null && value !== "").map((value) => {
|
|
12554
|
+
const numValue = typeof value === "number" ? value : parseFloat(String(value));
|
|
12555
|
+
return isNaN(numValue) ? null : numValue;
|
|
12556
|
+
}).filter((value) => value !== null);
|
|
12557
|
+
if (validValues.length === 0) return null;
|
|
12558
|
+
return Math.min(...validValues);
|
|
12559
|
+
};
|
|
12560
|
+
}
|
|
12561
|
+
function max(accessorKey) {
|
|
12562
|
+
return (rows, column) => {
|
|
12563
|
+
if (rows.length === 0) return null;
|
|
12564
|
+
const validValues = rows.map((row) => row[accessorKey]).filter((value) => value != null && value !== "").map((value) => {
|
|
12565
|
+
const numValue = typeof value === "number" ? value : parseFloat(String(value));
|
|
12566
|
+
return isNaN(numValue) ? null : numValue;
|
|
12567
|
+
}).filter((value) => value !== null);
|
|
12568
|
+
if (validValues.length === 0) return null;
|
|
12569
|
+
return Math.max(...validValues);
|
|
12570
|
+
};
|
|
12571
|
+
}
|
|
12572
|
+
|
|
12902
12573
|
export {
|
|
12903
12574
|
Dialog,
|
|
12904
12575
|
DialogTrigger,
|
|
@@ -12992,7 +12663,12 @@ export {
|
|
|
12992
12663
|
DataTableCore,
|
|
12993
12664
|
DataTable,
|
|
12994
12665
|
BulkOperationsDropdown,
|
|
12995
|
-
GroupHeader
|
|
12666
|
+
GroupHeader,
|
|
12667
|
+
sum,
|
|
12668
|
+
average,
|
|
12669
|
+
count,
|
|
12670
|
+
min,
|
|
12671
|
+
max
|
|
12996
12672
|
};
|
|
12997
12673
|
/*! Bundled license information:
|
|
12998
12674
|
|
|
@@ -13006,4 +12682,4 @@ lodash/lodash.js:
|
|
|
13006
12682
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
13007
12683
|
*)
|
|
13008
12684
|
*/
|
|
13009
|
-
//# sourceMappingURL=chunk-
|
|
12685
|
+
//# sourceMappingURL=chunk-HJGGOMQ6.js.map
|