@jmruthers/pace-core 0.5.121 → 0.5.124
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/{AuthService-D4646R4b.d.ts → AuthService-DYuQPJj6.d.ts} +0 -9
- package/dist/{DataTable-DGZDJUYM.js → DataTable-OKDYRW2S.js} +7 -8
- package/dist/{PublicLoadingSpinner-DgDWTFqn.d.ts → PublicLoadingSpinner-CaoRbHvJ.d.ts} +30 -4
- package/dist/{UnifiedAuthProvider-UACKFATV.js → UnifiedAuthProvider-6C47WIML.js} +3 -4
- package/dist/{chunk-D6BOFXYR.js → chunk-35ZDPMBM.js} +3 -3
- package/dist/{chunk-CGURJ27Z.js → chunk-4MXVZVNS.js} +2 -2
- package/dist/{chunk-ZYJ6O5CA.js → chunk-C43QIDN3.js} +2 -2
- package/dist/{chunk-VKOCWWVY.js → chunk-CX5M4ZAG.js} +1 -6
- package/dist/{chunk-VKOCWWVY.js 3.map → chunk-CX5M4ZAG.js.map} +1 -1
- package/dist/{chunk-RIEJGKD3.js → chunk-ESJTIADP.js} +15 -6
- package/dist/{chunk-RIEJGKD3.js.map → chunk-ESJTIADP.js.map} +1 -1
- package/dist/{chunk-HFBOFZ3Z.js → chunk-GBGYYMC6.js} +317 -251
- package/dist/chunk-GBGYYMC6.js.map +1 -0
- package/dist/{chunk-SMJZMKYN.js → chunk-GEVIB2UB.js} +43 -10
- package/dist/chunk-GEVIB2UB.js.map +1 -0
- package/dist/{chunk-TDNI6ZWL.js → chunk-IJOZZOGT.js} +7 -7
- package/dist/chunk-IJOZZOGT.js.map +1 -0
- package/dist/{chunk-GZRXOUBE.js → chunk-M6DDYFUD.js} +2 -2
- package/dist/chunk-M6DDYFUD.js.map +1 -0
- package/dist/{chunk-B4GZ2BXO.js → chunk-NZGLXZGP.js} +3 -3
- package/dist/{chunk-NZ32EONV.js → chunk-QWNJCQXZ.js} +2 -2
- package/dist/{chunk-QPI2CCBA.js → chunk-VPUCTHTY.js} +149 -96
- package/dist/chunk-VPUCTHTY.js.map +1 -0
- package/dist/{chunk-FKFHZUGF.js → chunk-XN6GWKMV.js} +43 -56
- package/dist/chunk-XN6GWKMV.js.map +1 -0
- package/dist/{chunk-BHWIUEYH.js → chunk-ZBLK676C.js} +1 -61
- package/dist/chunk-ZBLK676C.js.map +1 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.js +11 -11
- package/dist/{formatting-B1jSqgl-.d.ts → formatting-DFcCxUEk.d.ts} +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +9 -8
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +2 -3
- package/dist/rbac/index.js +7 -8
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +5 -3
- package/dist/theming/runtime.d.ts +73 -1
- package/dist/theming/runtime.js +5 -5
- package/dist/{usePublicRouteParams-BdF8bZgs.d.ts → usePublicRouteParams-Dyt1tzI9.d.ts} +60 -8
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +5 -5
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +6 -6
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +6 -6
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +7 -7
- package/docs/api/interfaces/PublicErrorBoundaryState.md +5 -5
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +7 -7
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +51 -12
- package/docs/api/interfaces/PublicPageLayoutProps.md +72 -12
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +140 -30
- package/docs/best-practices/README.md +1 -1
- package/docs/implementation-guides/datatable-filtering.md +313 -0
- package/docs/implementation-guides/datatable-rbac-usage.md +317 -0
- package/docs/implementation-guides/hierarchical-datatable.md +850 -0
- package/docs/implementation-guides/large-datasets.md +281 -0
- package/docs/implementation-guides/performance.md +403 -0
- package/docs/implementation-guides/public-pages.md +4 -4
- package/docs/migration/quick-migration-guide.md +320 -0
- package/docs/rbac/quick-start.md +16 -16
- package/docs/troubleshooting/README.md +4 -4
- package/docs/troubleshooting/cake-page-permission-guard-issue-summary.md +1 -1
- package/docs/troubleshooting/debugging.md +1117 -0
- package/docs/troubleshooting/migration.md +918 -0
- package/examples/public-pages/CorrectPublicPageImplementation.tsx +30 -30
- package/examples/public-pages/PublicEventPage.tsx +41 -41
- package/examples/public-pages/PublicPageApp.tsx +33 -33
- package/examples/public-pages/PublicPageUsageExample.tsx +30 -30
- package/package.json +4 -4
- package/src/__tests__/hooks/usePermissions.test.ts +265 -0
- package/src/components/DataTable/DataTable.test.tsx +9 -38
- package/src/components/DataTable/DataTable.tsx +0 -7
- package/src/components/DataTable/components/DataTableCore.tsx +125 -144
- package/src/components/DataTable/components/DataTableModals.tsx +25 -22
- package/src/components/DataTable/components/DataTableToolbar.tsx +14 -1
- package/src/components/DataTable/components/EditableRow.tsx +118 -42
- package/src/components/DataTable/components/UnifiedTableBody.tsx +129 -76
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +33 -14
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +17 -5
- package/src/components/DataTable/utils/exportUtils.ts +3 -2
- package/src/components/Dialog/Dialog.tsx +1 -1
- package/src/components/Dialog/README.md +24 -24
- package/src/components/Dialog/examples/BasicHtmlTest.tsx +2 -2
- package/src/components/Dialog/examples/DebugHtmlExample.tsx +6 -6
- package/src/components/Dialog/examples/HtmlDialogExample.tsx +2 -2
- package/src/components/Dialog/examples/SimpleHtmlTest.tsx +3 -3
- package/src/components/Dialog/examples/__tests__/SimpleHtmlTest.test.tsx +4 -4
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +12 -1
- package/src/components/PublicLayout/EventLogo.tsx +175 -0
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +22 -18
- package/src/components/PublicLayout/PublicLoadingSpinner.tsx +22 -14
- package/src/components/PublicLayout/PublicPageHeader.tsx +133 -40
- package/src/components/PublicLayout/PublicPageLayout.tsx +75 -72
- package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +1 -1
- package/src/components/PublicLayout/__tests__/PublicLoadingSpinner.test.tsx +8 -8
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +23 -16
- package/src/components/PublicLayout/__tests__/PublicPageLayout.test.tsx +86 -14
- package/src/examples/CorrectPublicPageImplementation.tsx +30 -30
- package/src/examples/PublicEventPage.tsx +41 -41
- package/src/examples/PublicPageApp.tsx +33 -33
- package/src/examples/PublicPageUsageExample.tsx +30 -30
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +583 -0
- package/src/hooks/__tests__/usePublicRouteParams.unit.test.ts +10 -3
- package/src/hooks/index.ts +1 -1
- package/src/hooks/public/usePublicEventLogo.ts +285 -0
- package/src/hooks/public/usePublicRouteParams.ts +21 -4
- package/src/hooks/useEventTheme.test.ts +119 -43
- package/src/hooks/useEventTheme.ts +84 -55
- package/src/index.ts +3 -1
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +630 -0
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +667 -0
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +647 -0
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +496 -0
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +496 -0
- package/src/rbac/secureClient.ts +4 -2
- package/src/services/EventService.ts +0 -66
- package/src/services/__tests__/EventService.eventColours.test.ts +44 -40
- package/src/styles/index.ts +1 -1
- package/src/theming/__tests__/parseEventColours.test.ts +209 -0
- package/src/theming/parseEventColours.ts +123 -0
- package/src/theming/runtime.ts +3 -0
- package/src/types/__tests__/file-reference.test.ts +447 -0
- package/src/utils/formatDate.test.ts +11 -11
- package/src/utils/formatting.ts +3 -2
- package/dist/chunk-BDZUMRBD.js 3.map +0 -1
- package/dist/chunk-BHWIUEYH.js.map +0 -1
- package/dist/chunk-CGURJ27Z.js.map +0 -1
- package/dist/chunk-FKFHZUGF.js.map +0 -1
- package/dist/chunk-GKHF54DI 2.js +0 -619
- package/dist/chunk-GKHF54DI.js 2.map +0 -1
- package/dist/chunk-GZRXOUBE.js.map +0 -1
- package/dist/chunk-HFBOFZ3Z.js.map +0 -1
- package/dist/chunk-NZ32EONV.js.map +0 -1
- package/dist/chunk-O3NWNXDY 2.js +0 -76
- package/dist/chunk-QPI2CCBA.js.map +0 -1
- package/dist/chunk-SMJZMKYN.js.map +0 -1
- package/dist/chunk-TDNI6ZWL.js 2.map +0 -1
- package/dist/chunk-TDNI6ZWL.js.map +0 -1
- package/dist/chunk-VKOCWWVY.js.map +0 -1
- package/dist/chunk-WP5I5GLN 2.js +0 -1564
- package/dist/index 3.js +0 -856
- package/dist/providers 3.js +0 -38
- package/dist/providers.js 3.map +0 -1
- package/dist/types 3.js +0 -128
- package/dist/types.js 3.map +0 -1
- package/dist/useInactivityTracker-MRUU55XI.js 3.map +0 -1
- package/dist/utils.js 3.map +0 -1
- package/dist/validation 3.js +0 -479
- package/src/styles/semantic.css +0 -24
- /package/dist/{DataTable-DGZDJUYM.js.map → DataTable-OKDYRW2S.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-UACKFATV.js.map → UnifiedAuthProvider-6C47WIML.js.map} +0 -0
- /package/dist/{chunk-D6BOFXYR.js.map → chunk-35ZDPMBM.js.map} +0 -0
- /package/dist/{chunk-CGURJ27Z.js 2.map → chunk-4MXVZVNS.js.map} +0 -0
- /package/dist/{chunk-ZYJ6O5CA.js.map → chunk-C43QIDN3.js.map} +0 -0
- /package/dist/{chunk-B4GZ2BXO.js.map → chunk-NZGLXZGP.js.map} +0 -0
- /package/dist/{chunk-NZ32EONV.js 2.map → chunk-QWNJCQXZ.js.map} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan,
|
|
3
3
|
useResolvedScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-35ZDPMBM.js";
|
|
5
5
|
import {
|
|
6
6
|
toast,
|
|
7
7
|
useDataTablePerformance
|
|
8
8
|
} from "./chunk-GKHF54DI.js";
|
|
9
9
|
import {
|
|
10
10
|
init_UnifiedAuthProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C43QIDN3.js";
|
|
12
12
|
import {
|
|
13
13
|
useUnifiedAuth
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZBLK676C.js";
|
|
15
15
|
import {
|
|
16
16
|
cn
|
|
17
17
|
} from "./chunk-PYUXFQJ3.js";
|
|
@@ -6606,7 +6606,18 @@ function DataTableToolbar({
|
|
|
6606
6606
|
]
|
|
6607
6607
|
}
|
|
6608
6608
|
),
|
|
6609
|
-
|
|
6609
|
+
(() => {
|
|
6610
|
+
if (import.meta.env.MODE === "development") {
|
|
6611
|
+
const logger = console;
|
|
6612
|
+
logger.debug("[DataTableToolbar] Creation button check:", {
|
|
6613
|
+
"features.creation": features.creation,
|
|
6614
|
+
"permissions.canCreate.can": permissions.canCreate.can,
|
|
6615
|
+
"onCreateRow provided": !!onCreateRow,
|
|
6616
|
+
"will show button": features.creation && permissions.canCreate.can && onCreateRow
|
|
6617
|
+
});
|
|
6618
|
+
}
|
|
6619
|
+
return features.creation && permissions.canCreate.can && onCreateRow;
|
|
6620
|
+
})() && /* @__PURE__ */ jsxs5(
|
|
6610
6621
|
Button,
|
|
6611
6622
|
{
|
|
6612
6623
|
variant: "outline",
|
|
@@ -7131,6 +7142,7 @@ function SelectEditField({
|
|
|
7131
7142
|
onChange,
|
|
7132
7143
|
className
|
|
7133
7144
|
}) {
|
|
7145
|
+
const logger = React9.useMemo(() => createLogger("SelectEditField"), []);
|
|
7134
7146
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7135
7147
|
const isCreatable = columnDef.creatable === true;
|
|
7136
7148
|
const selectRef = React9.useRef(null);
|
|
@@ -7138,34 +7150,82 @@ function SelectEditField({
|
|
|
7138
7150
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
7139
7151
|
const [showCreateOption, setShowCreateOption] = React9.useState(false);
|
|
7140
7152
|
React9.useEffect(() => {
|
|
7141
|
-
if (!isOpen || !isSearchable || !isCreatable
|
|
7142
|
-
const
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
const
|
|
7150
|
-
|
|
7151
|
-
if (
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
if ("type" in opt && opt.type === "group") {
|
|
7155
|
-
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7153
|
+
if (!isOpen || !isSearchable || !isCreatable) return;
|
|
7154
|
+
const findAndAttachSearchInput = () => {
|
|
7155
|
+
let searchInput = null;
|
|
7156
|
+
if (selectRef.current) {
|
|
7157
|
+
searchInput = selectRef.current.querySelector('[data-testid="select-search-input"]');
|
|
7158
|
+
}
|
|
7159
|
+
if (!searchInput) {
|
|
7160
|
+
const allSearchInputs = document.querySelectorAll('[data-testid="select-search-input"]');
|
|
7161
|
+
for (const input of Array.from(allSearchInputs)) {
|
|
7162
|
+
const content = input.closest('[data-testid="select-content"]');
|
|
7163
|
+
if (content && content.getAttribute("aria-hidden") !== "true") {
|
|
7164
|
+
searchInput = input;
|
|
7165
|
+
break;
|
|
7156
7166
|
}
|
|
7157
|
-
|
|
7158
|
-
};
|
|
7159
|
-
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7160
|
-
setShowCreateOption(!hasMatch);
|
|
7161
|
-
} else {
|
|
7162
|
-
setShowCreateOption(false);
|
|
7167
|
+
}
|
|
7163
7168
|
}
|
|
7169
|
+
if (!searchInput) return null;
|
|
7170
|
+
const handleInput = (e) => {
|
|
7171
|
+
const target = e.target;
|
|
7172
|
+
const currentSearch = target.value;
|
|
7173
|
+
setSearchTerm(currentSearch);
|
|
7174
|
+
if (currentSearch.trim()) {
|
|
7175
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7176
|
+
const checkMatch = (opt) => {
|
|
7177
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7178
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7179
|
+
}
|
|
7180
|
+
if ("type" in opt && opt.type === "group") {
|
|
7181
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7182
|
+
}
|
|
7183
|
+
return false;
|
|
7184
|
+
};
|
|
7185
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7186
|
+
setShowCreateOption(!hasMatch);
|
|
7187
|
+
} else {
|
|
7188
|
+
setShowCreateOption(false);
|
|
7189
|
+
}
|
|
7190
|
+
};
|
|
7191
|
+
const initialValue = searchInput.value;
|
|
7192
|
+
if (initialValue) {
|
|
7193
|
+
const currentSearch = initialValue;
|
|
7194
|
+
setSearchTerm(currentSearch);
|
|
7195
|
+
if (currentSearch.trim()) {
|
|
7196
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7197
|
+
const checkMatch = (opt) => {
|
|
7198
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7199
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7200
|
+
}
|
|
7201
|
+
if ("type" in opt && opt.type === "group") {
|
|
7202
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7203
|
+
}
|
|
7204
|
+
return false;
|
|
7205
|
+
};
|
|
7206
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7207
|
+
setShowCreateOption(!hasMatch);
|
|
7208
|
+
} else {
|
|
7209
|
+
setShowCreateOption(false);
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
searchInput.addEventListener("input", handleInput);
|
|
7213
|
+
return () => {
|
|
7214
|
+
searchInput?.removeEventListener("input", handleInput);
|
|
7215
|
+
};
|
|
7164
7216
|
};
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7217
|
+
let cleanup = findAndAttachSearchInput();
|
|
7218
|
+
if (!cleanup) {
|
|
7219
|
+
let timeoutCleanup = null;
|
|
7220
|
+
const timeoutId = setTimeout(() => {
|
|
7221
|
+
timeoutCleanup = findAndAttachSearchInput();
|
|
7222
|
+
}, 50);
|
|
7223
|
+
return () => {
|
|
7224
|
+
clearTimeout(timeoutId);
|
|
7225
|
+
timeoutCleanup?.();
|
|
7226
|
+
};
|
|
7227
|
+
}
|
|
7228
|
+
return cleanup;
|
|
7169
7229
|
}, [isOpen, isSearchable, isCreatable, columnDef.fieldOptions]);
|
|
7170
7230
|
const handleCreateNew = React9.useCallback(async () => {
|
|
7171
7231
|
if (!isCreatable || !columnDef.onCreateNew || !searchTerm.trim()) return;
|
|
@@ -7175,9 +7235,9 @@ function SelectEditField({
|
|
|
7175
7235
|
setSearchTerm("");
|
|
7176
7236
|
setShowCreateOption(false);
|
|
7177
7237
|
} catch (error) {
|
|
7178
|
-
|
|
7238
|
+
logger.error("Error creating new item:", error);
|
|
7179
7239
|
}
|
|
7180
|
-
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange]);
|
|
7240
|
+
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange, logger]);
|
|
7181
7241
|
return /* @__PURE__ */ jsxs9(
|
|
7182
7242
|
Select,
|
|
7183
7243
|
{
|
|
@@ -7247,7 +7307,7 @@ function SelectEditField({
|
|
|
7247
7307
|
var renderEditField = (column, value, onChange, editingData = {}, placeholder, inputRef) => {
|
|
7248
7308
|
const columnDef = column.columnDef;
|
|
7249
7309
|
if (columnDef.editable === false) {
|
|
7250
|
-
return /* @__PURE__ */ jsx13("span", { className: "text-sm text-
|
|
7310
|
+
return /* @__PURE__ */ jsx13("span", { className: "text-sm text-sec-600", children: String(value ?? "") });
|
|
7251
7311
|
}
|
|
7252
7312
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
7253
7313
|
const accessorKey = columnDef.editAccessorKey || column.id;
|
|
@@ -7353,7 +7413,7 @@ function EditableRow({
|
|
|
7353
7413
|
onEditingDataChange({ ...editingData, [cell.column.id]: value });
|
|
7354
7414
|
}
|
|
7355
7415
|
}
|
|
7356
|
-
}) : /* @__PURE__ */ jsx13("span", { className: "text-sm text-
|
|
7416
|
+
}) : /* @__PURE__ */ jsx13("span", { className: "text-sm text-sec-600", children: String(cell.getValue() ?? "") });
|
|
7357
7417
|
}
|
|
7358
7418
|
const shouldGetRef = !hasAssignedRef.current;
|
|
7359
7419
|
if (shouldGetRef) {
|
|
@@ -7591,6 +7651,7 @@ function SelectEditField2({
|
|
|
7591
7651
|
placeholder,
|
|
7592
7652
|
onChange
|
|
7593
7653
|
}) {
|
|
7654
|
+
const logger = React10.useMemo(() => createLogger("SelectEditField"), []);
|
|
7594
7655
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7595
7656
|
const isCreatable = columnDef.creatable === true;
|
|
7596
7657
|
const selectRef = React10.useRef(null);
|
|
@@ -7598,34 +7659,82 @@ function SelectEditField2({
|
|
|
7598
7659
|
const [isOpen, setIsOpen] = React10.useState(false);
|
|
7599
7660
|
const [showCreateOption, setShowCreateOption] = React10.useState(false);
|
|
7600
7661
|
React10.useEffect(() => {
|
|
7601
|
-
if (!isOpen || !isSearchable || !isCreatable
|
|
7602
|
-
const
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
const
|
|
7610
|
-
|
|
7611
|
-
if (
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
if ("type" in opt && opt.type === "group") {
|
|
7615
|
-
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7662
|
+
if (!isOpen || !isSearchable || !isCreatable) return;
|
|
7663
|
+
const findAndAttachSearchInput = () => {
|
|
7664
|
+
let searchInput = null;
|
|
7665
|
+
if (selectRef.current) {
|
|
7666
|
+
searchInput = selectRef.current.querySelector('[data-testid="select-search-input"]');
|
|
7667
|
+
}
|
|
7668
|
+
if (!searchInput) {
|
|
7669
|
+
const allSearchInputs = document.querySelectorAll('[data-testid="select-search-input"]');
|
|
7670
|
+
for (const input of Array.from(allSearchInputs)) {
|
|
7671
|
+
const content = input.closest('[data-testid="select-content"]');
|
|
7672
|
+
if (content && content.getAttribute("aria-hidden") !== "true") {
|
|
7673
|
+
searchInput = input;
|
|
7674
|
+
break;
|
|
7616
7675
|
}
|
|
7617
|
-
|
|
7618
|
-
};
|
|
7619
|
-
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7620
|
-
setShowCreateOption(!hasMatch);
|
|
7621
|
-
} else {
|
|
7622
|
-
setShowCreateOption(false);
|
|
7676
|
+
}
|
|
7623
7677
|
}
|
|
7678
|
+
if (!searchInput) return null;
|
|
7679
|
+
const handleInput = (e) => {
|
|
7680
|
+
const target = e.target;
|
|
7681
|
+
const currentSearch = target.value;
|
|
7682
|
+
setSearchTerm(currentSearch);
|
|
7683
|
+
if (currentSearch.trim()) {
|
|
7684
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7685
|
+
const checkMatch = (opt) => {
|
|
7686
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7687
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7688
|
+
}
|
|
7689
|
+
if ("type" in opt && opt.type === "group") {
|
|
7690
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7691
|
+
}
|
|
7692
|
+
return false;
|
|
7693
|
+
};
|
|
7694
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7695
|
+
setShowCreateOption(!hasMatch);
|
|
7696
|
+
} else {
|
|
7697
|
+
setShowCreateOption(false);
|
|
7698
|
+
}
|
|
7699
|
+
};
|
|
7700
|
+
const initialValue = searchInput.value;
|
|
7701
|
+
if (initialValue) {
|
|
7702
|
+
const currentSearch = initialValue;
|
|
7703
|
+
setSearchTerm(currentSearch);
|
|
7704
|
+
if (currentSearch.trim()) {
|
|
7705
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7706
|
+
const checkMatch = (opt) => {
|
|
7707
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7708
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7709
|
+
}
|
|
7710
|
+
if ("type" in opt && opt.type === "group") {
|
|
7711
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7712
|
+
}
|
|
7713
|
+
return false;
|
|
7714
|
+
};
|
|
7715
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7716
|
+
setShowCreateOption(!hasMatch);
|
|
7717
|
+
} else {
|
|
7718
|
+
setShowCreateOption(false);
|
|
7719
|
+
}
|
|
7720
|
+
}
|
|
7721
|
+
searchInput.addEventListener("input", handleInput);
|
|
7722
|
+
return () => {
|
|
7723
|
+
searchInput?.removeEventListener("input", handleInput);
|
|
7724
|
+
};
|
|
7624
7725
|
};
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7726
|
+
let cleanup = findAndAttachSearchInput();
|
|
7727
|
+
if (!cleanup) {
|
|
7728
|
+
let timeoutCleanup = null;
|
|
7729
|
+
const timeoutId = setTimeout(() => {
|
|
7730
|
+
timeoutCleanup = findAndAttachSearchInput();
|
|
7731
|
+
}, 50);
|
|
7732
|
+
return () => {
|
|
7733
|
+
clearTimeout(timeoutId);
|
|
7734
|
+
timeoutCleanup?.();
|
|
7735
|
+
};
|
|
7736
|
+
}
|
|
7737
|
+
return cleanup;
|
|
7629
7738
|
}, [isOpen, isSearchable, isCreatable, columnDef.fieldOptions]);
|
|
7630
7739
|
const handleCreateNew = React10.useCallback(async () => {
|
|
7631
7740
|
if (!isCreatable || !columnDef.onCreateNew || !searchTerm.trim()) return;
|
|
@@ -7635,9 +7744,9 @@ function SelectEditField2({
|
|
|
7635
7744
|
setSearchTerm("");
|
|
7636
7745
|
setShowCreateOption(false);
|
|
7637
7746
|
} catch (error) {
|
|
7638
|
-
|
|
7747
|
+
logger.error("Error creating new item:", error);
|
|
7639
7748
|
}
|
|
7640
|
-
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange]);
|
|
7749
|
+
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange, logger]);
|
|
7641
7750
|
return /* @__PURE__ */ jsxs10(
|
|
7642
7751
|
Select,
|
|
7643
7752
|
{
|
|
@@ -7707,7 +7816,7 @@ function SelectEditField2({
|
|
|
7707
7816
|
var renderEditField2 = (column, value, onChange, editingData = {}, placeholder) => {
|
|
7708
7817
|
const columnDef = column.columnDef;
|
|
7709
7818
|
if (columnDef.editable === false) {
|
|
7710
|
-
return /* @__PURE__ */ jsx14("span", { className: "text-sm text-
|
|
7819
|
+
return /* @__PURE__ */ jsx14("span", { className: "text-sm text-sec-600", children: String(value ?? "") });
|
|
7711
7820
|
}
|
|
7712
7821
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
7713
7822
|
const accessorKey = columnDef.editAccessorKey || column.id;
|
|
@@ -7959,19 +8068,13 @@ function UnifiedTableBody({
|
|
|
7959
8068
|
rbac,
|
|
7960
8069
|
permissions
|
|
7961
8070
|
}) {
|
|
8071
|
+
const logger = React10.useMemo(() => createLogger("UnifiedTableBody"), []);
|
|
7962
8072
|
const headerRef = useRef3(null);
|
|
7963
8073
|
const bodyRef = useRef3(null);
|
|
7964
8074
|
const parentRef = useRef3(null);
|
|
7965
8075
|
const shouldVirtualize = forceVirtualization || dataLength > VIRTUALIZATION_THRESHOLD;
|
|
7966
8076
|
const rows = table.getRowModel().rows;
|
|
7967
8077
|
const headerGroups = table.getHeaderGroups();
|
|
7968
|
-
console.log("[DataTable] \u{1F50D} UnifiedTableBody Render:", {
|
|
7969
|
-
dataLength,
|
|
7970
|
-
rowsLength: rows.length,
|
|
7971
|
-
coreRowsLength: table.getCoreRowModel().rows.length,
|
|
7972
|
-
prePaginationRowsLength: table.getPrePaginationRowModel?.()?.rows?.length || 0,
|
|
7973
|
-
shouldVirtualize
|
|
7974
|
-
});
|
|
7975
8078
|
useEffect3(() => {
|
|
7976
8079
|
if (rows.length === 0 && dataLength > 0) {
|
|
7977
8080
|
const tableState = table.getState();
|
|
@@ -7984,7 +8087,7 @@ function UnifiedTableBody({
|
|
|
7984
8087
|
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
7985
8088
|
const rowCount = table.getRowCount();
|
|
7986
8089
|
const pageCount = table.getPageCount();
|
|
7987
|
-
|
|
8090
|
+
logger.warn("Rows empty but data exists!", {
|
|
7988
8091
|
dataLength,
|
|
7989
8092
|
rowsLength: rows.length,
|
|
7990
8093
|
coreRowsLength: coreRows.length,
|
|
@@ -8011,7 +8114,7 @@ function UnifiedTableBody({
|
|
|
8011
8114
|
tableDataLength: table.options.data?.length || 0
|
|
8012
8115
|
});
|
|
8013
8116
|
}
|
|
8014
|
-
}, [rows.length, dataLength, table]);
|
|
8117
|
+
}, [rows.length, dataLength, table, logger]);
|
|
8015
8118
|
const hasScrollContainer = !!parentRef.current;
|
|
8016
8119
|
const effectiveShouldVirtualize = shouldVirtualize && hasScrollContainer;
|
|
8017
8120
|
const virtualizer = useVirtualizer({
|
|
@@ -8022,24 +8125,14 @@ function UnifiedTableBody({
|
|
|
8022
8125
|
});
|
|
8023
8126
|
const virtualRows = effectiveShouldVirtualize ? virtualizer.getVirtualItems() : [];
|
|
8024
8127
|
const totalSize = effectiveShouldVirtualize ? virtualizer.getTotalSize() : 0;
|
|
8025
|
-
|
|
8026
|
-
shouldVirtualize
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
parentRefScrollHeight: parentRef.current?.scrollHeight || 0,
|
|
8034
|
-
willRenderVirtualized: effectiveShouldVirtualize && virtualRows.length > 0,
|
|
8035
|
-
willRenderStandard: !effectiveShouldVirtualize && rows.length > 0
|
|
8036
|
-
});
|
|
8037
|
-
if (shouldVirtualize && !hasScrollContainer) {
|
|
8038
|
-
console.warn("[DataTable] \u26A0\uFE0F Virtualization enabled but no scroll container found. Falling back to standard rendering.", {
|
|
8039
|
-
rowsLength: rows.length,
|
|
8040
|
-
dataLength
|
|
8041
|
-
});
|
|
8042
|
-
}
|
|
8128
|
+
useEffect3(() => {
|
|
8129
|
+
if (shouldVirtualize && !hasScrollContainer) {
|
|
8130
|
+
logger.warn("Virtualization enabled but no scroll container found. Falling back to standard rendering.", {
|
|
8131
|
+
rowsLength: rows.length,
|
|
8132
|
+
dataLength
|
|
8133
|
+
});
|
|
8134
|
+
}
|
|
8135
|
+
}, [shouldVirtualize, hasScrollContainer, rows.length, dataLength, logger]);
|
|
8043
8136
|
const renderTableContent = () => {
|
|
8044
8137
|
if (rows.length === 0) {
|
|
8045
8138
|
return /* @__PURE__ */ jsx14("tr", { children: /* @__PURE__ */ jsx14(
|
|
@@ -8591,7 +8684,7 @@ function LoadingState() {
|
|
|
8591
8684
|
}
|
|
8592
8685
|
|
|
8593
8686
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
8594
|
-
import { useEffect as useEffect6 } from "react";
|
|
8687
|
+
import React14, { useEffect as useEffect6 } from "react";
|
|
8595
8688
|
|
|
8596
8689
|
// src/components/DataTable/components/ImportModal.tsx
|
|
8597
8690
|
import { useState as useState4, useRef as useRef4, useEffect as useEffect5 } from "react";
|
|
@@ -8911,7 +9004,7 @@ var DialogBody = ({
|
|
|
8911
9004
|
className: "prose prose-sm max-w-none"
|
|
8912
9005
|
}
|
|
8913
9006
|
) : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
8914
|
-
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx17("div", { className: "text-
|
|
9007
|
+
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx17("div", { className: "text-acc-500 mb-2", children: "No HTML content processed. Showing children instead." }),
|
|
8915
9008
|
children
|
|
8916
9009
|
] })
|
|
8917
9010
|
}
|
|
@@ -9208,39 +9301,40 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9208
9301
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
9209
9302
|
import { Fragment as Fragment4, jsx as jsx19 } from "react/jsx-runtime";
|
|
9210
9303
|
function mapCSVToTableColumns(csvData, columns) {
|
|
9304
|
+
const logger = createLogger("mapCSVToTableColumns");
|
|
9211
9305
|
const columnMap = /* @__PURE__ */ new Map();
|
|
9212
|
-
|
|
9306
|
+
logger.debug("Building column map from", columns.length, "column definitions");
|
|
9213
9307
|
columns.forEach((col) => {
|
|
9214
9308
|
const fieldName = col.editAccessorKey || col.accessorKey || col.id;
|
|
9215
9309
|
const header = typeof col.header === "string" ? col.header : "";
|
|
9216
9310
|
if (fieldName && header) {
|
|
9217
9311
|
const headerLower = header.toLowerCase();
|
|
9218
9312
|
columnMap.set(headerLower, fieldName);
|
|
9219
|
-
|
|
9313
|
+
logger.debug(`Mapped "${header}" -> "${fieldName}"`);
|
|
9220
9314
|
const colId = col.id || col.accessorKey;
|
|
9221
9315
|
if (colId && colId !== header && colId !== fieldName) {
|
|
9222
9316
|
columnMap.set(colId.toLowerCase(), fieldName);
|
|
9223
|
-
|
|
9317
|
+
logger.debug(`Also mapped "${colId}" -> "${fieldName}"`);
|
|
9224
9318
|
}
|
|
9225
9319
|
if (col.editAccessorKey && header) {
|
|
9226
9320
|
const editAccessorKey = col.editAccessorKey;
|
|
9227
9321
|
const idColumnHeader = `${header} (ID)`;
|
|
9228
9322
|
columnMap.set(idColumnHeader.toLowerCase(), editAccessorKey);
|
|
9229
|
-
|
|
9323
|
+
logger.debug(`Mapped ID column "${idColumnHeader}" -> "${editAccessorKey}"`);
|
|
9230
9324
|
columnMap.set(editAccessorKey.toLowerCase(), editAccessorKey);
|
|
9231
|
-
|
|
9325
|
+
logger.debug(`Also mapped "${editAccessorKey}" -> "${editAccessorKey}"`);
|
|
9232
9326
|
}
|
|
9233
9327
|
} else {
|
|
9234
|
-
|
|
9328
|
+
logger.warn("Skipping column with missing fieldName or header:", col);
|
|
9235
9329
|
}
|
|
9236
9330
|
});
|
|
9237
9331
|
if (csvData.length === 0) {
|
|
9238
|
-
|
|
9332
|
+
logger.warn("No CSV data to map");
|
|
9239
9333
|
return [];
|
|
9240
9334
|
}
|
|
9241
9335
|
const csvHeaders = Object.keys(csvData[0]);
|
|
9242
|
-
|
|
9243
|
-
|
|
9336
|
+
logger.debug("CSV headers found:", csvHeaders);
|
|
9337
|
+
logger.debug("Column map size:", columnMap.size);
|
|
9244
9338
|
const mappedData = csvData.map((row, index) => {
|
|
9245
9339
|
const mappedRow = {};
|
|
9246
9340
|
Object.keys(row).forEach((csvHeader) => {
|
|
@@ -9252,7 +9346,7 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9252
9346
|
if (csvHeaderLower === mapKey || csvHeaderLower.endsWith(keyWithSpace)) {
|
|
9253
9347
|
fieldName = mapValue;
|
|
9254
9348
|
if (index === 0) {
|
|
9255
|
-
|
|
9349
|
+
logger.debug(`Flexible match: "${csvHeader}" -> "${mapValue}" (matched "${mapKey}")`);
|
|
9256
9350
|
}
|
|
9257
9351
|
break;
|
|
9258
9352
|
}
|
|
@@ -9261,20 +9355,20 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9261
9355
|
if (fieldName) {
|
|
9262
9356
|
mappedRow[fieldName] = row[csvHeader];
|
|
9263
9357
|
if (index === 0) {
|
|
9264
|
-
|
|
9358
|
+
logger.debug(`Row 0: "${csvHeader}" -> "${fieldName}"`);
|
|
9265
9359
|
}
|
|
9266
9360
|
} else {
|
|
9267
9361
|
mappedRow[csvHeaderLower] = row[csvHeader];
|
|
9268
9362
|
if (index === 0) {
|
|
9269
|
-
|
|
9363
|
+
logger.warn(`No mapping found for "${csvHeader}", using as-is`);
|
|
9270
9364
|
}
|
|
9271
9365
|
}
|
|
9272
9366
|
});
|
|
9273
9367
|
return mappedRow;
|
|
9274
9368
|
});
|
|
9275
|
-
|
|
9369
|
+
logger.debug("Mapped", mappedData.length, "rows");
|
|
9276
9370
|
if (mappedData.length > 0) {
|
|
9277
|
-
|
|
9371
|
+
logger.debug("First mapped row keys:", Object.keys(mappedData[0]));
|
|
9278
9372
|
}
|
|
9279
9373
|
return mappedData;
|
|
9280
9374
|
}
|
|
@@ -9287,6 +9381,7 @@ function DataTableModals({
|
|
|
9287
9381
|
onStoreFocus,
|
|
9288
9382
|
onRestoreFocus
|
|
9289
9383
|
}) {
|
|
9384
|
+
const logger = React14.useMemo(() => createLogger("DataTableModals"), []);
|
|
9290
9385
|
useEffect6(() => {
|
|
9291
9386
|
if (showImportModal) {
|
|
9292
9387
|
onStoreFocus?.();
|
|
@@ -9306,26 +9401,26 @@ function DataTableModals({
|
|
|
9306
9401
|
try {
|
|
9307
9402
|
let mappedData;
|
|
9308
9403
|
if (columns && columns.length > 0) {
|
|
9309
|
-
|
|
9310
|
-
|
|
9404
|
+
logger.debug("Mapping CSV data with", columns.length, "column definitions");
|
|
9405
|
+
logger.debug("Raw CSV headers:", rawData.length > 0 ? Object.keys(rawData[0]) : []);
|
|
9311
9406
|
mappedData = mapCSVToTableColumns(rawData, columns);
|
|
9312
|
-
|
|
9407
|
+
logger.debug("Mapped data sample:", mappedData.length > 0 ? mappedData[0] : null);
|
|
9313
9408
|
} else {
|
|
9314
|
-
|
|
9409
|
+
logger.warn("No columns provided for mapping, using raw data");
|
|
9315
9410
|
mappedData = rawData;
|
|
9316
9411
|
}
|
|
9317
9412
|
if (!onImport) {
|
|
9318
|
-
|
|
9413
|
+
logger.error("onImport callback is not provided");
|
|
9319
9414
|
throw new Error("Import handler is not configured. Please provide an onImport callback.");
|
|
9320
9415
|
}
|
|
9321
|
-
|
|
9416
|
+
logger.debug("Calling onImport with", mappedData.length, "rows");
|
|
9322
9417
|
const result = onImport(mappedData);
|
|
9323
9418
|
if (result && typeof result.then === "function") {
|
|
9324
9419
|
await result;
|
|
9325
9420
|
}
|
|
9326
|
-
|
|
9421
|
+
logger.debug("Import completed successfully");
|
|
9327
9422
|
} catch (error) {
|
|
9328
|
-
|
|
9423
|
+
logger.error("Import error:", error);
|
|
9329
9424
|
throw error;
|
|
9330
9425
|
}
|
|
9331
9426
|
},
|
|
@@ -10598,6 +10693,7 @@ function formatLocaleValue(value, locale) {
|
|
|
10598
10693
|
return String(value);
|
|
10599
10694
|
}
|
|
10600
10695
|
function generateCSVContent(data, columns, options = {}) {
|
|
10696
|
+
const logger = createLogger("generateCSVContent");
|
|
10601
10697
|
if (!data.length) return "";
|
|
10602
10698
|
const {
|
|
10603
10699
|
includeHeaders = true,
|
|
@@ -10615,7 +10711,7 @@ function generateCSVContent(data, columns, options = {}) {
|
|
|
10615
10711
|
try {
|
|
10616
10712
|
value = col.accessorFn(row);
|
|
10617
10713
|
} catch (error) {
|
|
10618
|
-
|
|
10714
|
+
logger.warn("Error evaluating accessorFn for column:", col.id || col.header, error);
|
|
10619
10715
|
value = void 0;
|
|
10620
10716
|
}
|
|
10621
10717
|
} else {
|
|
@@ -10661,7 +10757,7 @@ async function exportToCSVWithTableRows(tableRows, columns, columnIdToTableColum
|
|
|
10661
10757
|
try {
|
|
10662
10758
|
value = col.accessorFn(tableRow.original);
|
|
10663
10759
|
} catch (accessorError) {
|
|
10664
|
-
|
|
10760
|
+
logger.warn("Error evaluating accessorFn for column:", col.id || col.header, accessorError);
|
|
10665
10761
|
value = void 0;
|
|
10666
10762
|
}
|
|
10667
10763
|
} else {
|
|
@@ -11621,12 +11717,7 @@ function DataTableInternal({
|
|
|
11621
11717
|
storageKey,
|
|
11622
11718
|
onLayoutChange
|
|
11623
11719
|
}) {
|
|
11624
|
-
|
|
11625
|
-
dataLength: data.length,
|
|
11626
|
-
columnsCount: columns.length,
|
|
11627
|
-
isLoading: externalIsLoading,
|
|
11628
|
-
pageName: rbac?.pageName || rbac?.pageId
|
|
11629
|
-
});
|
|
11720
|
+
const logger = React19.useMemo(() => createLogger("DataTableCore"), []);
|
|
11630
11721
|
const authResult = useUnifiedAuth();
|
|
11631
11722
|
const user = authResult.user;
|
|
11632
11723
|
const requestedFeatures = useMemo14(
|
|
@@ -11634,6 +11725,15 @@ function DataTableInternal({
|
|
|
11634
11725
|
[incomingFeatures]
|
|
11635
11726
|
);
|
|
11636
11727
|
const { permissions, secureFeatures, effectivePageId } = useDataTablePermissions(rbac, requestedFeatures);
|
|
11728
|
+
if (import.meta.env.MODE === "development") {
|
|
11729
|
+
logger.debug("[DataTableCore] Creation feature check:", {
|
|
11730
|
+
"incomingFeatures.creation": incomingFeatures.creation,
|
|
11731
|
+
"requestedFeatures.creation": requestedFeatures.creation,
|
|
11732
|
+
"secureFeatures.creation": secureFeatures.creation,
|
|
11733
|
+
"permissions.canCreate.can": permissions.canCreate.can,
|
|
11734
|
+
"onCreateRow prop provided": !!onCreateRow
|
|
11735
|
+
});
|
|
11736
|
+
}
|
|
11637
11737
|
const effectiveColumnOrder = useEffectiveColumnOrder({
|
|
11638
11738
|
columns,
|
|
11639
11739
|
externalColumnOrder,
|
|
@@ -11771,13 +11871,13 @@ function DataTableInternal({
|
|
|
11771
11871
|
serverData
|
|
11772
11872
|
});
|
|
11773
11873
|
useEffect12(() => {
|
|
11774
|
-
if (!hierarchicalValidation.isValid
|
|
11775
|
-
|
|
11874
|
+
if (!hierarchicalValidation.isValid) {
|
|
11875
|
+
logger.error("Hierarchical data validation failed:", hierarchicalValidation.errors);
|
|
11776
11876
|
}
|
|
11777
|
-
}, [hierarchicalValidation]);
|
|
11877
|
+
}, [hierarchicalValidation, logger]);
|
|
11778
11878
|
useEffect12(() => {
|
|
11779
|
-
if (
|
|
11780
|
-
|
|
11879
|
+
if (finalTableData.length === 0 && data.length > 0) {
|
|
11880
|
+
logger.warn("Diagnostic: finalTableData empty but input data exists", {
|
|
11781
11881
|
inputDataLength: data.length,
|
|
11782
11882
|
finalTableDataLength: finalTableData.length,
|
|
11783
11883
|
dataCount: finalDataCount,
|
|
@@ -11788,7 +11888,7 @@ function DataTableInternal({
|
|
|
11788
11888
|
hierarchicalValid: hierarchicalValidation.isValid
|
|
11789
11889
|
});
|
|
11790
11890
|
}
|
|
11791
|
-
}, [finalTableData.length, data.length, finalDataCount, finalPaginationMode, serverData, secureFeatures.hierarchical, hierarchical, hierarchicalValidation.isValid]);
|
|
11891
|
+
}, [finalTableData.length, data.length, finalDataCount, finalPaginationMode, serverData, secureFeatures.hierarchical, hierarchical, hierarchicalValidation.isValid, logger]);
|
|
11792
11892
|
const {
|
|
11793
11893
|
columnOrder: savedColumnOrder,
|
|
11794
11894
|
isLoaded: isColumnOrderLoaded,
|
|
@@ -11808,18 +11908,16 @@ function DataTableInternal({
|
|
|
11808
11908
|
useEffect12(() => {
|
|
11809
11909
|
if (secureFeatures.selection && state.columnOrder.includes("select") && state.columnOrder[0] !== "select") {
|
|
11810
11910
|
const normalizedOrder = ["select", ...state.columnOrder.filter((id) => id !== "select")];
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
});
|
|
11816
|
-
}
|
|
11911
|
+
logger.warn("Correcting column order state - moving select to first position:", {
|
|
11912
|
+
before: state.columnOrder,
|
|
11913
|
+
after: normalizedOrder
|
|
11914
|
+
});
|
|
11817
11915
|
stateActions.setColumnOrder(normalizedOrder);
|
|
11818
11916
|
if (secureFeatures.columnReordering) {
|
|
11819
11917
|
updateColumnOrder(normalizedOrder);
|
|
11820
11918
|
}
|
|
11821
11919
|
}
|
|
11822
|
-
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder]);
|
|
11920
|
+
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder, logger]);
|
|
11823
11921
|
const finalPageSizeOptions = optimizedPageSizeOptions;
|
|
11824
11922
|
const validatedInitialPageSize = useMemo14(() => {
|
|
11825
11923
|
if (!secureFeatures.pagination || !finalPageSizeOptions.length) {
|
|
@@ -11832,13 +11930,11 @@ function DataTableInternal({
|
|
|
11832
11930
|
const closestOption = sortedOptions.reduce(
|
|
11833
11931
|
(prev, curr) => Math.abs(curr - initialPageSize) < Math.abs(prev - initialPageSize) ? curr : prev
|
|
11834
11932
|
);
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
);
|
|
11839
|
-
}
|
|
11933
|
+
logger.warn(
|
|
11934
|
+
`initialPageSize ${initialPageSize} is not available in page size options [${finalPageSizeOptions.join(", ")}]. Using closest option: ${closestOption}`
|
|
11935
|
+
);
|
|
11840
11936
|
return closestOption;
|
|
11841
|
-
}, [initialPageSize, finalPageSizeOptions, secureFeatures.pagination]);
|
|
11937
|
+
}, [initialPageSize, finalPageSizeOptions, secureFeatures.pagination, logger]);
|
|
11842
11938
|
const effectivePageSize = useMemo14(() => {
|
|
11843
11939
|
if (!secureFeatures.pagination || !finalPageSizeOptions.length) {
|
|
11844
11940
|
return state.pagination.pageSize;
|
|
@@ -11892,33 +11988,62 @@ function DataTableInternal({
|
|
|
11892
11988
|
fetchServerData,
|
|
11893
11989
|
cleanup
|
|
11894
11990
|
});
|
|
11895
|
-
const secureHandlers = useMemo14(() =>
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
const result = [...actions];
|
|
11991
|
+
const secureHandlers = useMemo14(() => {
|
|
11992
|
+
const handlers = {
|
|
11993
|
+
onEditRow: permissions.canUpdate.can ? onEditRow : void 0,
|
|
11994
|
+
onDeleteRow: permissions.canDelete.can ? onDeleteRow : void 0,
|
|
11995
|
+
onCreateRow: permissions.canCreate.can ? onCreateRow : void 0,
|
|
11996
|
+
onImport: permissions.canImport.can ? onImport : void 0,
|
|
11997
|
+
onExport: permissions.canExport.can ? onExport : void 0,
|
|
11998
|
+
onDeleteSelected: permissions.canDelete.can ? onDeleteSelected : void 0
|
|
11999
|
+
};
|
|
11905
12000
|
if (import.meta.env.MODE === "development") {
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
secureHandlers: {
|
|
11913
|
-
onEditRow: !!secureHandlers.onEditRow,
|
|
11914
|
-
onDeleteRow: !!secureHandlers.onDeleteRow
|
|
11915
|
-
},
|
|
11916
|
-
permissions: {
|
|
11917
|
-
canUpdate: permissions.canUpdate.can,
|
|
11918
|
-
canDelete: permissions.canDelete.can
|
|
11919
|
-
}
|
|
12001
|
+
logger.debug("[DataTableCore] Creation handler check:", {
|
|
12002
|
+
"permissions.canCreate.can": permissions.canCreate.can,
|
|
12003
|
+
"onCreateRow prop provided": !!onCreateRow,
|
|
12004
|
+
"secureHandlers.onCreateRow": !!handlers.onCreateRow,
|
|
12005
|
+
"secureFeatures.creation": secureFeatures.creation,
|
|
12006
|
+
"will pass onCreateRow to toolbar": secureFeatures.creation && !!handlers.onCreateRow
|
|
11920
12007
|
});
|
|
11921
12008
|
}
|
|
12009
|
+
return handlers;
|
|
12010
|
+
}, [permissions.canUpdate.can, permissions.canDelete.can, permissions.canCreate.can, permissions.canImport.can, permissions.canExport.can, onEditRow, onDeleteRow, onCreateRow, onImport, onExport, onDeleteSelected, secureFeatures.creation, logger]);
|
|
12011
|
+
if (import.meta.env.MODE === "development") {
|
|
12012
|
+
logger.debug("[DataTableCore] \u26A0\uFE0F CREATION BUTTON DIAGNOSIS:", {
|
|
12013
|
+
"\u2705 permissions.canCreate.can": permissions.canCreate.can,
|
|
12014
|
+
"\u2753 features.creation enabled": secureFeatures.creation,
|
|
12015
|
+
"\u2753 onCreateRow handler provided": !!onCreateRow,
|
|
12016
|
+
"\u2753 secureHandlers.onCreateRow": !!secureHandlers.onCreateRow,
|
|
12017
|
+
"\u{1F50D} WILL SHOW BUTTON": secureFeatures.creation && permissions.canCreate.can && !!onCreateRow,
|
|
12018
|
+
"\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"
|
|
12019
|
+
});
|
|
12020
|
+
}
|
|
12021
|
+
const effectiveActions = useMemo14(() => {
|
|
12022
|
+
const result = [...actions];
|
|
12023
|
+
logger.debug("Action Configuration Debug:", {
|
|
12024
|
+
originalActions: actions.length,
|
|
12025
|
+
secureFeatures: {
|
|
12026
|
+
editing: secureFeatures.editing,
|
|
12027
|
+
deletion: secureFeatures.deletion,
|
|
12028
|
+
creation: secureFeatures.creation,
|
|
12029
|
+
import: secureFeatures.import,
|
|
12030
|
+
export: secureFeatures.export
|
|
12031
|
+
},
|
|
12032
|
+
secureHandlers: {
|
|
12033
|
+
onEditRow: !!secureHandlers.onEditRow,
|
|
12034
|
+
onDeleteRow: !!secureHandlers.onDeleteRow,
|
|
12035
|
+
onCreateRow: !!secureHandlers.onCreateRow,
|
|
12036
|
+
onImport: !!secureHandlers.onImport,
|
|
12037
|
+
onExport: !!secureHandlers.onExport
|
|
12038
|
+
},
|
|
12039
|
+
permissions: {
|
|
12040
|
+
canUpdate: permissions.canUpdate.can,
|
|
12041
|
+
canDelete: permissions.canDelete.can,
|
|
12042
|
+
canCreate: permissions.canCreate.can,
|
|
12043
|
+
canImport: permissions.canImport.can,
|
|
12044
|
+
canExport: permissions.canExport.can
|
|
12045
|
+
}
|
|
12046
|
+
});
|
|
11922
12047
|
if (secureFeatures.editing && secureHandlers.onEditRow && !result.some((a) => a.label === "Edit")) {
|
|
11923
12048
|
result.push({
|
|
11924
12049
|
label: "Edit",
|
|
@@ -11958,7 +12083,7 @@ function DataTableInternal({
|
|
|
11958
12083
|
variant: "default"
|
|
11959
12084
|
});
|
|
11960
12085
|
} catch (error) {
|
|
11961
|
-
|
|
12086
|
+
logger.error("Delete error:", error);
|
|
11962
12087
|
toast({
|
|
11963
12088
|
title: "Delete Failed",
|
|
11964
12089
|
description: error instanceof Error ? error.message : "Failed to delete row",
|
|
@@ -11972,13 +12097,11 @@ function DataTableInternal({
|
|
|
11972
12097
|
hidden: !permissions.canDelete.can
|
|
11973
12098
|
});
|
|
11974
12099
|
}
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
});
|
|
11981
|
-
}
|
|
12100
|
+
logger.debug("Final Actions:", {
|
|
12101
|
+
totalActions: result.length,
|
|
12102
|
+
actionLabels: result.map((a) => a.label),
|
|
12103
|
+
hiddenActions: result.filter((a) => a.hidden).map((a) => a.label)
|
|
12104
|
+
});
|
|
11982
12105
|
return result;
|
|
11983
12106
|
}, [actions, secureFeatures, permissions, secureHandlers, resolvedGetRowId, stateActions, data]);
|
|
11984
12107
|
const normalizedColumnOrderForColumns = useMemo14(() => {
|
|
@@ -11999,15 +12122,13 @@ function DataTableInternal({
|
|
|
11999
12122
|
}), [state.pagination, effectivePageSize]);
|
|
12000
12123
|
const tableStateSnapshot = useMemo14(() => {
|
|
12001
12124
|
const normalizedColumnOrder = secureFeatures.selection && state.columnOrder.includes("select") ? ["select", ...state.columnOrder.filter((id) => id !== "select")] : state.columnOrder;
|
|
12002
|
-
if (
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
});
|
|
12010
|
-
}
|
|
12125
|
+
if (secureFeatures.selection && state.columnOrder[0] !== "select") {
|
|
12126
|
+
logger.warn("Column order normalized:", {
|
|
12127
|
+
original: state.columnOrder,
|
|
12128
|
+
normalized: normalizedColumnOrder,
|
|
12129
|
+
firstColumnOriginal: state.columnOrder[0],
|
|
12130
|
+
firstColumnNormalized: normalizedColumnOrder[0]
|
|
12131
|
+
});
|
|
12011
12132
|
}
|
|
12012
12133
|
return {
|
|
12013
12134
|
sorting: state.sorting,
|
|
@@ -12057,53 +12178,16 @@ function DataTableInternal({
|
|
|
12057
12178
|
pageSize: effectivePageSize,
|
|
12058
12179
|
hasServerSideConfig: !!serverSide
|
|
12059
12180
|
});
|
|
12060
|
-
useEffect12(() => {
|
|
12061
|
-
console.log("[DataTable] \u{1F50D} Table Config Created:", {
|
|
12062
|
-
finalTableDataLength: finalTableData.length,
|
|
12063
|
-
configDataLength: tableConfig.data?.length || 0,
|
|
12064
|
-
columnsCount: enhancedColumns.length,
|
|
12065
|
-
finalPaginationMode,
|
|
12066
|
-
hasServerSideConfig: !!serverSide,
|
|
12067
|
-
manualPagination: tableConfig.manualPagination,
|
|
12068
|
-
hasGetPaginationRowModel: !!tableConfig.getPaginationRowModel,
|
|
12069
|
-
effectivePageSize,
|
|
12070
|
-
paginationState: tableStateSnapshot.pagination
|
|
12071
|
-
});
|
|
12072
|
-
}, [finalTableData.length, tableConfig.data, tableConfig.manualPagination, tableConfig.getPaginationRowModel, finalPaginationMode, serverSide, effectivePageSize, tableStateSnapshot.pagination, enhancedColumns.length]);
|
|
12073
12181
|
const table = useReactTable(tableConfig);
|
|
12074
12182
|
useEffect12(() => {
|
|
12075
12183
|
const rows = table.getRowModel().rows;
|
|
12076
|
-
const coreRows = table.getCoreRowModel().rows;
|
|
12077
|
-
const prePaginationRows = table.getPrePaginationRowModel?.()?.rows || [];
|
|
12078
|
-
const filteredRows = table.getFilteredRowModel?.()?.rows || [];
|
|
12079
|
-
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
12080
|
-
const tableState = table.getState();
|
|
12081
|
-
console.log("[DataTable] \u{1F50D} Table Created - Row Counts:", {
|
|
12082
|
-
finalTableDataLength: finalTableData.length,
|
|
12083
|
-
tableConfigDataLength: tableConfig.data?.length || 0,
|
|
12084
|
-
coreRowsLength: coreRows.length,
|
|
12085
|
-
prePaginationRowsLength: prePaginationRows.length,
|
|
12086
|
-
filteredRowsLength: filteredRows.length,
|
|
12087
|
-
sortedRowsLength: sortedRows.length,
|
|
12088
|
-
finalRowsLength: rows.length,
|
|
12089
|
-
pagination: tableState.pagination,
|
|
12090
|
-
finalPaginationMode,
|
|
12091
|
-
hasServerSideConfig: !!serverSide,
|
|
12092
|
-
tableOptions: {
|
|
12093
|
-
getCoreRowModel: !!tableConfig.getCoreRowModel,
|
|
12094
|
-
getFilteredRowModel: !!tableConfig.getFilteredRowModel,
|
|
12095
|
-
getSortedRowModel: !!tableConfig.getSortedRowModel,
|
|
12096
|
-
getPaginationRowModel: !!tableConfig.getPaginationRowModel,
|
|
12097
|
-
manualPagination: tableConfig.manualPagination,
|
|
12098
|
-
manualFiltering: tableConfig.manualFiltering,
|
|
12099
|
-
manualSorting: tableConfig.manualSorting,
|
|
12100
|
-
pageCount: tableConfig.pageCount
|
|
12101
|
-
},
|
|
12102
|
-
hasRowId: !!resolvedGetRowId,
|
|
12103
|
-
effectivePageSize
|
|
12104
|
-
});
|
|
12105
12184
|
if (rows.length === 0 && finalTableData.length > 0) {
|
|
12106
|
-
|
|
12185
|
+
const coreRows = table.getCoreRowModel().rows;
|
|
12186
|
+
const prePaginationRows = table.getPrePaginationRowModel?.()?.rows || [];
|
|
12187
|
+
const filteredRows = table.getFilteredRowModel?.()?.rows || [];
|
|
12188
|
+
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
12189
|
+
const tableState = table.getState();
|
|
12190
|
+
logger.warn("Table created but rows are empty!", {
|
|
12107
12191
|
finalTableDataLength: finalTableData.length,
|
|
12108
12192
|
tableConfigDataLength: tableConfig.data?.length || 0,
|
|
12109
12193
|
coreRowsLength: coreRows.length,
|
|
@@ -12128,32 +12212,24 @@ function DataTableInternal({
|
|
|
12128
12212
|
effectivePageSize
|
|
12129
12213
|
});
|
|
12130
12214
|
}
|
|
12131
|
-
}, [table, finalTableData.length, tableConfig, resolvedGetRowId, finalPaginationMode, serverSide, effectivePageSize]);
|
|
12215
|
+
}, [table, finalTableData.length, tableConfig, resolvedGetRowId, finalPaginationMode, serverSide, effectivePageSize, logger]);
|
|
12132
12216
|
if (!user) {
|
|
12133
12217
|
throw new Error("DataTable requires authenticated user for RBAC");
|
|
12134
12218
|
}
|
|
12135
12219
|
if (permissions.canRead.isLoading) {
|
|
12136
|
-
console.log("[DataTable] \u23F3 Permission check in progress - showing loading state");
|
|
12137
12220
|
return /* @__PURE__ */ jsx24(LoadingComponent, {});
|
|
12138
12221
|
}
|
|
12139
12222
|
if (!permissions.canRead.can) {
|
|
12140
|
-
|
|
12223
|
+
logger.warn("Access denied - no read permission:", {
|
|
12141
12224
|
canRead: permissions.canRead,
|
|
12142
12225
|
pageId: effectivePageId,
|
|
12143
12226
|
isLoading: permissions.canRead.isLoading
|
|
12144
12227
|
});
|
|
12145
12228
|
return /* @__PURE__ */ jsx24(AccessDeniedPage, { resource: effectivePageId || "unknown-page", operation: "read" });
|
|
12146
12229
|
}
|
|
12147
|
-
console.log("[DataTable] \u2705 Permission check passed - rendering table");
|
|
12148
12230
|
if (isLoading) {
|
|
12149
|
-
console.log("[DataTable] \u23F3 Loading state - showing loading component");
|
|
12150
12231
|
return /* @__PURE__ */ jsx24(LoadingComponent, {});
|
|
12151
12232
|
}
|
|
12152
|
-
console.log("[DataTable] \u{1F4CA} About to render table with data:", {
|
|
12153
|
-
finalTableDataLength: finalTableData.length,
|
|
12154
|
-
tableExists: !!table,
|
|
12155
|
-
canGetRows: !!table?.getRowModel
|
|
12156
|
-
});
|
|
12157
12233
|
const PaginationComponent = enhancedPagination || finalPaginationMode !== "client" ? EnhancedPaginationControls : PaginationControls;
|
|
12158
12234
|
const visibleColumns = table?.getVisibleFlatColumns() || [];
|
|
12159
12235
|
const dataColumns = visibleColumns.filter(
|
|
@@ -12239,20 +12315,15 @@ function DataTableInternal({
|
|
|
12239
12315
|
description: `Data exported to ${filename}`,
|
|
12240
12316
|
variant: "default"
|
|
12241
12317
|
});
|
|
12242
|
-
|
|
12243
|
-
console.log("DataTable: Export completed successfully");
|
|
12244
|
-
}
|
|
12318
|
+
logger.debug("Export completed successfully");
|
|
12245
12319
|
} catch (error) {
|
|
12246
|
-
|
|
12320
|
+
logger.error("Failed to export data:", error);
|
|
12247
12321
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
12248
12322
|
toast({
|
|
12249
12323
|
title: "Export Failed",
|
|
12250
12324
|
description: `Failed to export data: ${errorMessage}`,
|
|
12251
12325
|
variant: "destructive"
|
|
12252
12326
|
});
|
|
12253
|
-
if (import.meta.env.MODE === "development") {
|
|
12254
|
-
console.error("DataTable: Export error details:", error);
|
|
12255
|
-
}
|
|
12256
12327
|
}
|
|
12257
12328
|
}),
|
|
12258
12329
|
rowSelection,
|
|
@@ -12277,7 +12348,7 @@ function DataTableInternal({
|
|
|
12277
12348
|
variant: "default"
|
|
12278
12349
|
});
|
|
12279
12350
|
} catch (error) {
|
|
12280
|
-
|
|
12351
|
+
logger.error("Bulk delete error:", error);
|
|
12281
12352
|
toast({
|
|
12282
12353
|
title: "Delete Failed",
|
|
12283
12354
|
description: error instanceof Error ? error.message : "Failed to delete selected rows",
|
|
@@ -12456,19 +12527,19 @@ function DataTableInternal({
|
|
|
12456
12527
|
onImport: async (data2) => {
|
|
12457
12528
|
if (onImport) {
|
|
12458
12529
|
try {
|
|
12459
|
-
|
|
12530
|
+
logger.debug("onImport called with", data2.length, "rows");
|
|
12460
12531
|
const result = onImport(data2);
|
|
12461
12532
|
if (result && typeof result.then === "function") {
|
|
12462
12533
|
await result;
|
|
12463
12534
|
}
|
|
12464
|
-
|
|
12535
|
+
logger.debug("onImport completed successfully");
|
|
12465
12536
|
toast({
|
|
12466
12537
|
title: "Import Successful",
|
|
12467
12538
|
description: `Successfully imported ${data2.length} ${data2.length === 1 ? "row" : "rows"}`,
|
|
12468
12539
|
variant: "default"
|
|
12469
12540
|
});
|
|
12470
12541
|
} catch (error) {
|
|
12471
|
-
|
|
12542
|
+
logger.error("Import error:", error);
|
|
12472
12543
|
toast({
|
|
12473
12544
|
title: "Import Failed",
|
|
12474
12545
|
description: error instanceof Error ? error.message : "Failed to import data",
|
|
@@ -12477,7 +12548,7 @@ function DataTableInternal({
|
|
|
12477
12548
|
return;
|
|
12478
12549
|
}
|
|
12479
12550
|
} else {
|
|
12480
|
-
|
|
12551
|
+
logger.error("onImport handler not provided");
|
|
12481
12552
|
toast({
|
|
12482
12553
|
title: "Import Not Configured",
|
|
12483
12554
|
description: "Import functionality requires an onImport handler to be provided.",
|
|
@@ -12507,11 +12578,6 @@ import { jsx as jsx25 } from "react/jsx-runtime";
|
|
|
12507
12578
|
function DataTable(props) {
|
|
12508
12579
|
const logger = React20.useMemo(() => createLogger("DataTable"), []);
|
|
12509
12580
|
const { features, ...rest } = props;
|
|
12510
|
-
console.log("[DataTable] \u{1F3AF} DataTable WRAPPER called:", {
|
|
12511
|
-
dataLength: props.data?.length || 0,
|
|
12512
|
-
columnsCount: props.columns?.length || 0,
|
|
12513
|
-
pageName: props.rbac?.pageName || props.rbac?.pageId
|
|
12514
|
-
});
|
|
12515
12581
|
const normalizedFeatures = React20.useMemo(
|
|
12516
12582
|
() => normalizeDataTableFeatures(features),
|
|
12517
12583
|
[features]
|
|
@@ -12741,4 +12807,4 @@ lodash/lodash.js:
|
|
|
12741
12807
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12742
12808
|
*)
|
|
12743
12809
|
*/
|
|
12744
|
-
//# sourceMappingURL=chunk-
|
|
12810
|
+
//# sourceMappingURL=chunk-GBGYYMC6.js.map
|