@jmruthers/pace-core 0.5.120 → 0.5.123
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-WTS4IRF2.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.map → chunk-CX5M4ZAG.js.map} +1 -1
- package/dist/{chunk-HFBOFZ3Z.js → chunk-DHMFMXFV.js} +258 -243
- package/dist/chunk-DHMFMXFV.js.map +1 -0
- 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-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-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/{chunk-QPI2CCBA.js → chunk-ZPJMYGEP.js} +149 -96
- package/dist/chunk-ZPJMYGEP.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 +66 -136
- package/src/components/DataTable/components/DataTableModals.tsx +25 -22
- 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/DataTable/utils/flexibleImport.ts +27 -6
- 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/types/database.generated.ts +1515 -424
- package/src/utils/formatDate.test.ts +11 -11
- package/src/utils/formatting.ts +3 -2
- package/dist/chunk-BHWIUEYH.js.map +0 -1
- package/dist/chunk-FKFHZUGF.js.map +0 -1
- package/dist/chunk-GZRXOUBE.js.map +0 -1
- package/dist/chunk-HFBOFZ3Z.js.map +0 -1
- package/dist/chunk-QPI2CCBA.js.map +0 -1
- package/dist/chunk-SMJZMKYN.js.map +0 -1
- package/dist/chunk-TDNI6ZWL.js.map +0 -1
- package/src/styles/semantic.css +0 -24
- /package/dist/{DataTable-DGZDJUYM.js.map → DataTable-WTS4IRF2.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.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.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";
|
|
@@ -7131,6 +7131,7 @@ function SelectEditField({
|
|
|
7131
7131
|
onChange,
|
|
7132
7132
|
className
|
|
7133
7133
|
}) {
|
|
7134
|
+
const logger = React9.useMemo(() => createLogger("SelectEditField"), []);
|
|
7134
7135
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7135
7136
|
const isCreatable = columnDef.creatable === true;
|
|
7136
7137
|
const selectRef = React9.useRef(null);
|
|
@@ -7138,34 +7139,82 @@ function SelectEditField({
|
|
|
7138
7139
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
7139
7140
|
const [showCreateOption, setShowCreateOption] = React9.useState(false);
|
|
7140
7141
|
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));
|
|
7142
|
+
if (!isOpen || !isSearchable || !isCreatable) return;
|
|
7143
|
+
const findAndAttachSearchInput = () => {
|
|
7144
|
+
let searchInput = null;
|
|
7145
|
+
if (selectRef.current) {
|
|
7146
|
+
searchInput = selectRef.current.querySelector('[data-testid="select-search-input"]');
|
|
7147
|
+
}
|
|
7148
|
+
if (!searchInput) {
|
|
7149
|
+
const allSearchInputs = document.querySelectorAll('[data-testid="select-search-input"]');
|
|
7150
|
+
for (const input of Array.from(allSearchInputs)) {
|
|
7151
|
+
const content = input.closest('[data-testid="select-content"]');
|
|
7152
|
+
if (content && content.getAttribute("aria-hidden") !== "true") {
|
|
7153
|
+
searchInput = input;
|
|
7154
|
+
break;
|
|
7156
7155
|
}
|
|
7157
|
-
|
|
7158
|
-
};
|
|
7159
|
-
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7160
|
-
setShowCreateOption(!hasMatch);
|
|
7161
|
-
} else {
|
|
7162
|
-
setShowCreateOption(false);
|
|
7156
|
+
}
|
|
7163
7157
|
}
|
|
7158
|
+
if (!searchInput) return null;
|
|
7159
|
+
const handleInput = (e) => {
|
|
7160
|
+
const target = e.target;
|
|
7161
|
+
const currentSearch = target.value;
|
|
7162
|
+
setSearchTerm(currentSearch);
|
|
7163
|
+
if (currentSearch.trim()) {
|
|
7164
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7165
|
+
const checkMatch = (opt) => {
|
|
7166
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7167
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7168
|
+
}
|
|
7169
|
+
if ("type" in opt && opt.type === "group") {
|
|
7170
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7171
|
+
}
|
|
7172
|
+
return false;
|
|
7173
|
+
};
|
|
7174
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7175
|
+
setShowCreateOption(!hasMatch);
|
|
7176
|
+
} else {
|
|
7177
|
+
setShowCreateOption(false);
|
|
7178
|
+
}
|
|
7179
|
+
};
|
|
7180
|
+
const initialValue = searchInput.value;
|
|
7181
|
+
if (initialValue) {
|
|
7182
|
+
const currentSearch = initialValue;
|
|
7183
|
+
setSearchTerm(currentSearch);
|
|
7184
|
+
if (currentSearch.trim()) {
|
|
7185
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7186
|
+
const checkMatch = (opt) => {
|
|
7187
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7188
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7189
|
+
}
|
|
7190
|
+
if ("type" in opt && opt.type === "group") {
|
|
7191
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7192
|
+
}
|
|
7193
|
+
return false;
|
|
7194
|
+
};
|
|
7195
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7196
|
+
setShowCreateOption(!hasMatch);
|
|
7197
|
+
} else {
|
|
7198
|
+
setShowCreateOption(false);
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7201
|
+
searchInput.addEventListener("input", handleInput);
|
|
7202
|
+
return () => {
|
|
7203
|
+
searchInput?.removeEventListener("input", handleInput);
|
|
7204
|
+
};
|
|
7164
7205
|
};
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7206
|
+
let cleanup = findAndAttachSearchInput();
|
|
7207
|
+
if (!cleanup) {
|
|
7208
|
+
let timeoutCleanup = null;
|
|
7209
|
+
const timeoutId = setTimeout(() => {
|
|
7210
|
+
timeoutCleanup = findAndAttachSearchInput();
|
|
7211
|
+
}, 50);
|
|
7212
|
+
return () => {
|
|
7213
|
+
clearTimeout(timeoutId);
|
|
7214
|
+
timeoutCleanup?.();
|
|
7215
|
+
};
|
|
7216
|
+
}
|
|
7217
|
+
return cleanup;
|
|
7169
7218
|
}, [isOpen, isSearchable, isCreatable, columnDef.fieldOptions]);
|
|
7170
7219
|
const handleCreateNew = React9.useCallback(async () => {
|
|
7171
7220
|
if (!isCreatable || !columnDef.onCreateNew || !searchTerm.trim()) return;
|
|
@@ -7175,9 +7224,9 @@ function SelectEditField({
|
|
|
7175
7224
|
setSearchTerm("");
|
|
7176
7225
|
setShowCreateOption(false);
|
|
7177
7226
|
} catch (error) {
|
|
7178
|
-
|
|
7227
|
+
logger.error("Error creating new item:", error);
|
|
7179
7228
|
}
|
|
7180
|
-
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange]);
|
|
7229
|
+
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange, logger]);
|
|
7181
7230
|
return /* @__PURE__ */ jsxs9(
|
|
7182
7231
|
Select,
|
|
7183
7232
|
{
|
|
@@ -7247,7 +7296,7 @@ function SelectEditField({
|
|
|
7247
7296
|
var renderEditField = (column, value, onChange, editingData = {}, placeholder, inputRef) => {
|
|
7248
7297
|
const columnDef = column.columnDef;
|
|
7249
7298
|
if (columnDef.editable === false) {
|
|
7250
|
-
return /* @__PURE__ */ jsx13("span", { className: "text-sm text-
|
|
7299
|
+
return /* @__PURE__ */ jsx13("span", { className: "text-sm text-sec-600", children: String(value ?? "") });
|
|
7251
7300
|
}
|
|
7252
7301
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
7253
7302
|
const accessorKey = columnDef.editAccessorKey || column.id;
|
|
@@ -7353,7 +7402,7 @@ function EditableRow({
|
|
|
7353
7402
|
onEditingDataChange({ ...editingData, [cell.column.id]: value });
|
|
7354
7403
|
}
|
|
7355
7404
|
}
|
|
7356
|
-
}) : /* @__PURE__ */ jsx13("span", { className: "text-sm text-
|
|
7405
|
+
}) : /* @__PURE__ */ jsx13("span", { className: "text-sm text-sec-600", children: String(cell.getValue() ?? "") });
|
|
7357
7406
|
}
|
|
7358
7407
|
const shouldGetRef = !hasAssignedRef.current;
|
|
7359
7408
|
if (shouldGetRef) {
|
|
@@ -7591,6 +7640,7 @@ function SelectEditField2({
|
|
|
7591
7640
|
placeholder,
|
|
7592
7641
|
onChange
|
|
7593
7642
|
}) {
|
|
7643
|
+
const logger = React10.useMemo(() => createLogger("SelectEditField"), []);
|
|
7594
7644
|
const isSearchable = columnDef.selectSearchable !== false;
|
|
7595
7645
|
const isCreatable = columnDef.creatable === true;
|
|
7596
7646
|
const selectRef = React10.useRef(null);
|
|
@@ -7598,34 +7648,82 @@ function SelectEditField2({
|
|
|
7598
7648
|
const [isOpen, setIsOpen] = React10.useState(false);
|
|
7599
7649
|
const [showCreateOption, setShowCreateOption] = React10.useState(false);
|
|
7600
7650
|
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));
|
|
7651
|
+
if (!isOpen || !isSearchable || !isCreatable) return;
|
|
7652
|
+
const findAndAttachSearchInput = () => {
|
|
7653
|
+
let searchInput = null;
|
|
7654
|
+
if (selectRef.current) {
|
|
7655
|
+
searchInput = selectRef.current.querySelector('[data-testid="select-search-input"]');
|
|
7656
|
+
}
|
|
7657
|
+
if (!searchInput) {
|
|
7658
|
+
const allSearchInputs = document.querySelectorAll('[data-testid="select-search-input"]');
|
|
7659
|
+
for (const input of Array.from(allSearchInputs)) {
|
|
7660
|
+
const content = input.closest('[data-testid="select-content"]');
|
|
7661
|
+
if (content && content.getAttribute("aria-hidden") !== "true") {
|
|
7662
|
+
searchInput = input;
|
|
7663
|
+
break;
|
|
7616
7664
|
}
|
|
7617
|
-
|
|
7618
|
-
};
|
|
7619
|
-
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7620
|
-
setShowCreateOption(!hasMatch);
|
|
7621
|
-
} else {
|
|
7622
|
-
setShowCreateOption(false);
|
|
7665
|
+
}
|
|
7623
7666
|
}
|
|
7667
|
+
if (!searchInput) return null;
|
|
7668
|
+
const handleInput = (e) => {
|
|
7669
|
+
const target = e.target;
|
|
7670
|
+
const currentSearch = target.value;
|
|
7671
|
+
setSearchTerm(currentSearch);
|
|
7672
|
+
if (currentSearch.trim()) {
|
|
7673
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7674
|
+
const checkMatch = (opt) => {
|
|
7675
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7676
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7677
|
+
}
|
|
7678
|
+
if ("type" in opt && opt.type === "group") {
|
|
7679
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7680
|
+
}
|
|
7681
|
+
return false;
|
|
7682
|
+
};
|
|
7683
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7684
|
+
setShowCreateOption(!hasMatch);
|
|
7685
|
+
} else {
|
|
7686
|
+
setShowCreateOption(false);
|
|
7687
|
+
}
|
|
7688
|
+
};
|
|
7689
|
+
const initialValue = searchInput.value;
|
|
7690
|
+
if (initialValue) {
|
|
7691
|
+
const currentSearch = initialValue;
|
|
7692
|
+
setSearchTerm(currentSearch);
|
|
7693
|
+
if (currentSearch.trim()) {
|
|
7694
|
+
const searchLower = currentSearch.toLowerCase().trim();
|
|
7695
|
+
const checkMatch = (opt) => {
|
|
7696
|
+
if ("value" in opt && !("type" in opt)) {
|
|
7697
|
+
return opt.label.toLowerCase().includes(searchLower);
|
|
7698
|
+
}
|
|
7699
|
+
if ("type" in opt && opt.type === "group") {
|
|
7700
|
+
return opt.items.some((item) => item.label.toLowerCase().includes(searchLower));
|
|
7701
|
+
}
|
|
7702
|
+
return false;
|
|
7703
|
+
};
|
|
7704
|
+
const hasMatch = (columnDef.fieldOptions || []).some(checkMatch);
|
|
7705
|
+
setShowCreateOption(!hasMatch);
|
|
7706
|
+
} else {
|
|
7707
|
+
setShowCreateOption(false);
|
|
7708
|
+
}
|
|
7709
|
+
}
|
|
7710
|
+
searchInput.addEventListener("input", handleInput);
|
|
7711
|
+
return () => {
|
|
7712
|
+
searchInput?.removeEventListener("input", handleInput);
|
|
7713
|
+
};
|
|
7624
7714
|
};
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7715
|
+
let cleanup = findAndAttachSearchInput();
|
|
7716
|
+
if (!cleanup) {
|
|
7717
|
+
let timeoutCleanup = null;
|
|
7718
|
+
const timeoutId = setTimeout(() => {
|
|
7719
|
+
timeoutCleanup = findAndAttachSearchInput();
|
|
7720
|
+
}, 50);
|
|
7721
|
+
return () => {
|
|
7722
|
+
clearTimeout(timeoutId);
|
|
7723
|
+
timeoutCleanup?.();
|
|
7724
|
+
};
|
|
7725
|
+
}
|
|
7726
|
+
return cleanup;
|
|
7629
7727
|
}, [isOpen, isSearchable, isCreatable, columnDef.fieldOptions]);
|
|
7630
7728
|
const handleCreateNew = React10.useCallback(async () => {
|
|
7631
7729
|
if (!isCreatable || !columnDef.onCreateNew || !searchTerm.trim()) return;
|
|
@@ -7635,9 +7733,9 @@ function SelectEditField2({
|
|
|
7635
7733
|
setSearchTerm("");
|
|
7636
7734
|
setShowCreateOption(false);
|
|
7637
7735
|
} catch (error) {
|
|
7638
|
-
|
|
7736
|
+
logger.error("Error creating new item:", error);
|
|
7639
7737
|
}
|
|
7640
|
-
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange]);
|
|
7738
|
+
}, [isCreatable, columnDef.onCreateNew, searchTerm, onChange, logger]);
|
|
7641
7739
|
return /* @__PURE__ */ jsxs10(
|
|
7642
7740
|
Select,
|
|
7643
7741
|
{
|
|
@@ -7707,7 +7805,7 @@ function SelectEditField2({
|
|
|
7707
7805
|
var renderEditField2 = (column, value, onChange, editingData = {}, placeholder) => {
|
|
7708
7806
|
const columnDef = column.columnDef;
|
|
7709
7807
|
if (columnDef.editable === false) {
|
|
7710
|
-
return /* @__PURE__ */ jsx14("span", { className: "text-sm text-
|
|
7808
|
+
return /* @__PURE__ */ jsx14("span", { className: "text-sm text-sec-600", children: String(value ?? "") });
|
|
7711
7809
|
}
|
|
7712
7810
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
7713
7811
|
const accessorKey = columnDef.editAccessorKey || column.id;
|
|
@@ -7959,19 +8057,13 @@ function UnifiedTableBody({
|
|
|
7959
8057
|
rbac,
|
|
7960
8058
|
permissions
|
|
7961
8059
|
}) {
|
|
8060
|
+
const logger = React10.useMemo(() => createLogger("UnifiedTableBody"), []);
|
|
7962
8061
|
const headerRef = useRef3(null);
|
|
7963
8062
|
const bodyRef = useRef3(null);
|
|
7964
8063
|
const parentRef = useRef3(null);
|
|
7965
8064
|
const shouldVirtualize = forceVirtualization || dataLength > VIRTUALIZATION_THRESHOLD;
|
|
7966
8065
|
const rows = table.getRowModel().rows;
|
|
7967
8066
|
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
8067
|
useEffect3(() => {
|
|
7976
8068
|
if (rows.length === 0 && dataLength > 0) {
|
|
7977
8069
|
const tableState = table.getState();
|
|
@@ -7984,7 +8076,7 @@ function UnifiedTableBody({
|
|
|
7984
8076
|
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
7985
8077
|
const rowCount = table.getRowCount();
|
|
7986
8078
|
const pageCount = table.getPageCount();
|
|
7987
|
-
|
|
8079
|
+
logger.warn("Rows empty but data exists!", {
|
|
7988
8080
|
dataLength,
|
|
7989
8081
|
rowsLength: rows.length,
|
|
7990
8082
|
coreRowsLength: coreRows.length,
|
|
@@ -8011,7 +8103,7 @@ function UnifiedTableBody({
|
|
|
8011
8103
|
tableDataLength: table.options.data?.length || 0
|
|
8012
8104
|
});
|
|
8013
8105
|
}
|
|
8014
|
-
}, [rows.length, dataLength, table]);
|
|
8106
|
+
}, [rows.length, dataLength, table, logger]);
|
|
8015
8107
|
const hasScrollContainer = !!parentRef.current;
|
|
8016
8108
|
const effectiveShouldVirtualize = shouldVirtualize && hasScrollContainer;
|
|
8017
8109
|
const virtualizer = useVirtualizer({
|
|
@@ -8022,24 +8114,14 @@ function UnifiedTableBody({
|
|
|
8022
8114
|
});
|
|
8023
8115
|
const virtualRows = effectiveShouldVirtualize ? virtualizer.getVirtualItems() : [];
|
|
8024
8116
|
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
|
-
}
|
|
8117
|
+
useEffect3(() => {
|
|
8118
|
+
if (shouldVirtualize && !hasScrollContainer) {
|
|
8119
|
+
logger.warn("Virtualization enabled but no scroll container found. Falling back to standard rendering.", {
|
|
8120
|
+
rowsLength: rows.length,
|
|
8121
|
+
dataLength
|
|
8122
|
+
});
|
|
8123
|
+
}
|
|
8124
|
+
}, [shouldVirtualize, hasScrollContainer, rows.length, dataLength, logger]);
|
|
8043
8125
|
const renderTableContent = () => {
|
|
8044
8126
|
if (rows.length === 0) {
|
|
8045
8127
|
return /* @__PURE__ */ jsx14("tr", { children: /* @__PURE__ */ jsx14(
|
|
@@ -8591,7 +8673,7 @@ function LoadingState() {
|
|
|
8591
8673
|
}
|
|
8592
8674
|
|
|
8593
8675
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
8594
|
-
import { useEffect as useEffect6 } from "react";
|
|
8676
|
+
import React14, { useEffect as useEffect6 } from "react";
|
|
8595
8677
|
|
|
8596
8678
|
// src/components/DataTable/components/ImportModal.tsx
|
|
8597
8679
|
import { useState as useState4, useRef as useRef4, useEffect as useEffect5 } from "react";
|
|
@@ -8911,7 +8993,7 @@ var DialogBody = ({
|
|
|
8911
8993
|
className: "prose prose-sm max-w-none"
|
|
8912
8994
|
}
|
|
8913
8995
|
) : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
8914
|
-
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx17("div", { className: "text-
|
|
8996
|
+
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx17("div", { className: "text-acc-500 mb-2", children: "No HTML content processed. Showing children instead." }),
|
|
8915
8997
|
children
|
|
8916
8998
|
] })
|
|
8917
8999
|
}
|
|
@@ -9208,39 +9290,40 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
9208
9290
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
9209
9291
|
import { Fragment as Fragment4, jsx as jsx19 } from "react/jsx-runtime";
|
|
9210
9292
|
function mapCSVToTableColumns(csvData, columns) {
|
|
9293
|
+
const logger = createLogger("mapCSVToTableColumns");
|
|
9211
9294
|
const columnMap = /* @__PURE__ */ new Map();
|
|
9212
|
-
|
|
9295
|
+
logger.debug("Building column map from", columns.length, "column definitions");
|
|
9213
9296
|
columns.forEach((col) => {
|
|
9214
9297
|
const fieldName = col.editAccessorKey || col.accessorKey || col.id;
|
|
9215
9298
|
const header = typeof col.header === "string" ? col.header : "";
|
|
9216
9299
|
if (fieldName && header) {
|
|
9217
9300
|
const headerLower = header.toLowerCase();
|
|
9218
9301
|
columnMap.set(headerLower, fieldName);
|
|
9219
|
-
|
|
9302
|
+
logger.debug(`Mapped "${header}" -> "${fieldName}"`);
|
|
9220
9303
|
const colId = col.id || col.accessorKey;
|
|
9221
9304
|
if (colId && colId !== header && colId !== fieldName) {
|
|
9222
9305
|
columnMap.set(colId.toLowerCase(), fieldName);
|
|
9223
|
-
|
|
9306
|
+
logger.debug(`Also mapped "${colId}" -> "${fieldName}"`);
|
|
9224
9307
|
}
|
|
9225
9308
|
if (col.editAccessorKey && header) {
|
|
9226
9309
|
const editAccessorKey = col.editAccessorKey;
|
|
9227
9310
|
const idColumnHeader = `${header} (ID)`;
|
|
9228
9311
|
columnMap.set(idColumnHeader.toLowerCase(), editAccessorKey);
|
|
9229
|
-
|
|
9312
|
+
logger.debug(`Mapped ID column "${idColumnHeader}" -> "${editAccessorKey}"`);
|
|
9230
9313
|
columnMap.set(editAccessorKey.toLowerCase(), editAccessorKey);
|
|
9231
|
-
|
|
9314
|
+
logger.debug(`Also mapped "${editAccessorKey}" -> "${editAccessorKey}"`);
|
|
9232
9315
|
}
|
|
9233
9316
|
} else {
|
|
9234
|
-
|
|
9317
|
+
logger.warn("Skipping column with missing fieldName or header:", col);
|
|
9235
9318
|
}
|
|
9236
9319
|
});
|
|
9237
9320
|
if (csvData.length === 0) {
|
|
9238
|
-
|
|
9321
|
+
logger.warn("No CSV data to map");
|
|
9239
9322
|
return [];
|
|
9240
9323
|
}
|
|
9241
9324
|
const csvHeaders = Object.keys(csvData[0]);
|
|
9242
|
-
|
|
9243
|
-
|
|
9325
|
+
logger.debug("CSV headers found:", csvHeaders);
|
|
9326
|
+
logger.debug("Column map size:", columnMap.size);
|
|
9244
9327
|
const mappedData = csvData.map((row, index) => {
|
|
9245
9328
|
const mappedRow = {};
|
|
9246
9329
|
Object.keys(row).forEach((csvHeader) => {
|
|
@@ -9252,7 +9335,7 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9252
9335
|
if (csvHeaderLower === mapKey || csvHeaderLower.endsWith(keyWithSpace)) {
|
|
9253
9336
|
fieldName = mapValue;
|
|
9254
9337
|
if (index === 0) {
|
|
9255
|
-
|
|
9338
|
+
logger.debug(`Flexible match: "${csvHeader}" -> "${mapValue}" (matched "${mapKey}")`);
|
|
9256
9339
|
}
|
|
9257
9340
|
break;
|
|
9258
9341
|
}
|
|
@@ -9261,20 +9344,20 @@ function mapCSVToTableColumns(csvData, columns) {
|
|
|
9261
9344
|
if (fieldName) {
|
|
9262
9345
|
mappedRow[fieldName] = row[csvHeader];
|
|
9263
9346
|
if (index === 0) {
|
|
9264
|
-
|
|
9347
|
+
logger.debug(`Row 0: "${csvHeader}" -> "${fieldName}"`);
|
|
9265
9348
|
}
|
|
9266
9349
|
} else {
|
|
9267
9350
|
mappedRow[csvHeaderLower] = row[csvHeader];
|
|
9268
9351
|
if (index === 0) {
|
|
9269
|
-
|
|
9352
|
+
logger.warn(`No mapping found for "${csvHeader}", using as-is`);
|
|
9270
9353
|
}
|
|
9271
9354
|
}
|
|
9272
9355
|
});
|
|
9273
9356
|
return mappedRow;
|
|
9274
9357
|
});
|
|
9275
|
-
|
|
9358
|
+
logger.debug("Mapped", mappedData.length, "rows");
|
|
9276
9359
|
if (mappedData.length > 0) {
|
|
9277
|
-
|
|
9360
|
+
logger.debug("First mapped row keys:", Object.keys(mappedData[0]));
|
|
9278
9361
|
}
|
|
9279
9362
|
return mappedData;
|
|
9280
9363
|
}
|
|
@@ -9287,6 +9370,7 @@ function DataTableModals({
|
|
|
9287
9370
|
onStoreFocus,
|
|
9288
9371
|
onRestoreFocus
|
|
9289
9372
|
}) {
|
|
9373
|
+
const logger = React14.useMemo(() => createLogger("DataTableModals"), []);
|
|
9290
9374
|
useEffect6(() => {
|
|
9291
9375
|
if (showImportModal) {
|
|
9292
9376
|
onStoreFocus?.();
|
|
@@ -9306,26 +9390,26 @@ function DataTableModals({
|
|
|
9306
9390
|
try {
|
|
9307
9391
|
let mappedData;
|
|
9308
9392
|
if (columns && columns.length > 0) {
|
|
9309
|
-
|
|
9310
|
-
|
|
9393
|
+
logger.debug("Mapping CSV data with", columns.length, "column definitions");
|
|
9394
|
+
logger.debug("Raw CSV headers:", rawData.length > 0 ? Object.keys(rawData[0]) : []);
|
|
9311
9395
|
mappedData = mapCSVToTableColumns(rawData, columns);
|
|
9312
|
-
|
|
9396
|
+
logger.debug("Mapped data sample:", mappedData.length > 0 ? mappedData[0] : null);
|
|
9313
9397
|
} else {
|
|
9314
|
-
|
|
9398
|
+
logger.warn("No columns provided for mapping, using raw data");
|
|
9315
9399
|
mappedData = rawData;
|
|
9316
9400
|
}
|
|
9317
9401
|
if (!onImport) {
|
|
9318
|
-
|
|
9402
|
+
logger.error("onImport callback is not provided");
|
|
9319
9403
|
throw new Error("Import handler is not configured. Please provide an onImport callback.");
|
|
9320
9404
|
}
|
|
9321
|
-
|
|
9405
|
+
logger.debug("Calling onImport with", mappedData.length, "rows");
|
|
9322
9406
|
const result = onImport(mappedData);
|
|
9323
9407
|
if (result && typeof result.then === "function") {
|
|
9324
9408
|
await result;
|
|
9325
9409
|
}
|
|
9326
|
-
|
|
9410
|
+
logger.debug("Import completed successfully");
|
|
9327
9411
|
} catch (error) {
|
|
9328
|
-
|
|
9412
|
+
logger.error("Import error:", error);
|
|
9329
9413
|
throw error;
|
|
9330
9414
|
}
|
|
9331
9415
|
},
|
|
@@ -10598,6 +10682,7 @@ function formatLocaleValue(value, locale) {
|
|
|
10598
10682
|
return String(value);
|
|
10599
10683
|
}
|
|
10600
10684
|
function generateCSVContent(data, columns, options = {}) {
|
|
10685
|
+
const logger = createLogger("generateCSVContent");
|
|
10601
10686
|
if (!data.length) return "";
|
|
10602
10687
|
const {
|
|
10603
10688
|
includeHeaders = true,
|
|
@@ -10615,7 +10700,7 @@ function generateCSVContent(data, columns, options = {}) {
|
|
|
10615
10700
|
try {
|
|
10616
10701
|
value = col.accessorFn(row);
|
|
10617
10702
|
} catch (error) {
|
|
10618
|
-
|
|
10703
|
+
logger.warn("Error evaluating accessorFn for column:", col.id || col.header, error);
|
|
10619
10704
|
value = void 0;
|
|
10620
10705
|
}
|
|
10621
10706
|
} else {
|
|
@@ -10661,7 +10746,7 @@ async function exportToCSVWithTableRows(tableRows, columns, columnIdToTableColum
|
|
|
10661
10746
|
try {
|
|
10662
10747
|
value = col.accessorFn(tableRow.original);
|
|
10663
10748
|
} catch (accessorError) {
|
|
10664
|
-
|
|
10749
|
+
logger.warn("Error evaluating accessorFn for column:", col.id || col.header, accessorError);
|
|
10665
10750
|
value = void 0;
|
|
10666
10751
|
}
|
|
10667
10752
|
} else {
|
|
@@ -11621,12 +11706,7 @@ function DataTableInternal({
|
|
|
11621
11706
|
storageKey,
|
|
11622
11707
|
onLayoutChange
|
|
11623
11708
|
}) {
|
|
11624
|
-
|
|
11625
|
-
dataLength: data.length,
|
|
11626
|
-
columnsCount: columns.length,
|
|
11627
|
-
isLoading: externalIsLoading,
|
|
11628
|
-
pageName: rbac?.pageName || rbac?.pageId
|
|
11629
|
-
});
|
|
11709
|
+
const logger = React19.useMemo(() => createLogger("DataTableCore"), []);
|
|
11630
11710
|
const authResult = useUnifiedAuth();
|
|
11631
11711
|
const user = authResult.user;
|
|
11632
11712
|
const requestedFeatures = useMemo14(
|
|
@@ -11771,13 +11851,13 @@ function DataTableInternal({
|
|
|
11771
11851
|
serverData
|
|
11772
11852
|
});
|
|
11773
11853
|
useEffect12(() => {
|
|
11774
|
-
if (!hierarchicalValidation.isValid
|
|
11775
|
-
|
|
11854
|
+
if (!hierarchicalValidation.isValid) {
|
|
11855
|
+
logger.error("Hierarchical data validation failed:", hierarchicalValidation.errors);
|
|
11776
11856
|
}
|
|
11777
|
-
}, [hierarchicalValidation]);
|
|
11857
|
+
}, [hierarchicalValidation, logger]);
|
|
11778
11858
|
useEffect12(() => {
|
|
11779
|
-
if (
|
|
11780
|
-
|
|
11859
|
+
if (finalTableData.length === 0 && data.length > 0) {
|
|
11860
|
+
logger.warn("Diagnostic: finalTableData empty but input data exists", {
|
|
11781
11861
|
inputDataLength: data.length,
|
|
11782
11862
|
finalTableDataLength: finalTableData.length,
|
|
11783
11863
|
dataCount: finalDataCount,
|
|
@@ -11788,7 +11868,7 @@ function DataTableInternal({
|
|
|
11788
11868
|
hierarchicalValid: hierarchicalValidation.isValid
|
|
11789
11869
|
});
|
|
11790
11870
|
}
|
|
11791
|
-
}, [finalTableData.length, data.length, finalDataCount, finalPaginationMode, serverData, secureFeatures.hierarchical, hierarchical, hierarchicalValidation.isValid]);
|
|
11871
|
+
}, [finalTableData.length, data.length, finalDataCount, finalPaginationMode, serverData, secureFeatures.hierarchical, hierarchical, hierarchicalValidation.isValid, logger]);
|
|
11792
11872
|
const {
|
|
11793
11873
|
columnOrder: savedColumnOrder,
|
|
11794
11874
|
isLoaded: isColumnOrderLoaded,
|
|
@@ -11808,18 +11888,16 @@ function DataTableInternal({
|
|
|
11808
11888
|
useEffect12(() => {
|
|
11809
11889
|
if (secureFeatures.selection && state.columnOrder.includes("select") && state.columnOrder[0] !== "select") {
|
|
11810
11890
|
const normalizedOrder = ["select", ...state.columnOrder.filter((id) => id !== "select")];
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
});
|
|
11816
|
-
}
|
|
11891
|
+
logger.warn("Correcting column order state - moving select to first position:", {
|
|
11892
|
+
before: state.columnOrder,
|
|
11893
|
+
after: normalizedOrder
|
|
11894
|
+
});
|
|
11817
11895
|
stateActions.setColumnOrder(normalizedOrder);
|
|
11818
11896
|
if (secureFeatures.columnReordering) {
|
|
11819
11897
|
updateColumnOrder(normalizedOrder);
|
|
11820
11898
|
}
|
|
11821
11899
|
}
|
|
11822
|
-
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder]);
|
|
11900
|
+
}, [secureFeatures.selection, secureFeatures.columnReordering, state.columnOrder, stateActions, updateColumnOrder, logger]);
|
|
11823
11901
|
const finalPageSizeOptions = optimizedPageSizeOptions;
|
|
11824
11902
|
const validatedInitialPageSize = useMemo14(() => {
|
|
11825
11903
|
if (!secureFeatures.pagination || !finalPageSizeOptions.length) {
|
|
@@ -11832,13 +11910,11 @@ function DataTableInternal({
|
|
|
11832
11910
|
const closestOption = sortedOptions.reduce(
|
|
11833
11911
|
(prev, curr) => Math.abs(curr - initialPageSize) < Math.abs(prev - initialPageSize) ? curr : prev
|
|
11834
11912
|
);
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
);
|
|
11839
|
-
}
|
|
11913
|
+
logger.warn(
|
|
11914
|
+
`initialPageSize ${initialPageSize} is not available in page size options [${finalPageSizeOptions.join(", ")}]. Using closest option: ${closestOption}`
|
|
11915
|
+
);
|
|
11840
11916
|
return closestOption;
|
|
11841
|
-
}, [initialPageSize, finalPageSizeOptions, secureFeatures.pagination]);
|
|
11917
|
+
}, [initialPageSize, finalPageSizeOptions, secureFeatures.pagination, logger]);
|
|
11842
11918
|
const effectivePageSize = useMemo14(() => {
|
|
11843
11919
|
if (!secureFeatures.pagination || !finalPageSizeOptions.length) {
|
|
11844
11920
|
return state.pagination.pageSize;
|
|
@@ -11902,23 +11978,21 @@ function DataTableInternal({
|
|
|
11902
11978
|
}), [permissions.canUpdate.can, permissions.canDelete.can, permissions.canCreate.can, permissions.canImport.can, permissions.canExport.can, onEditRow, onDeleteRow, onCreateRow, onImport, onExport, onDeleteSelected]);
|
|
11903
11979
|
const effectiveActions = useMemo14(() => {
|
|
11904
11980
|
const result = [...actions];
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
});
|
|
11921
|
-
}
|
|
11981
|
+
logger.debug("Action Configuration Debug:", {
|
|
11982
|
+
originalActions: actions.length,
|
|
11983
|
+
secureFeatures: {
|
|
11984
|
+
editing: secureFeatures.editing,
|
|
11985
|
+
deletion: secureFeatures.deletion
|
|
11986
|
+
},
|
|
11987
|
+
secureHandlers: {
|
|
11988
|
+
onEditRow: !!secureHandlers.onEditRow,
|
|
11989
|
+
onDeleteRow: !!secureHandlers.onDeleteRow
|
|
11990
|
+
},
|
|
11991
|
+
permissions: {
|
|
11992
|
+
canUpdate: permissions.canUpdate.can,
|
|
11993
|
+
canDelete: permissions.canDelete.can
|
|
11994
|
+
}
|
|
11995
|
+
});
|
|
11922
11996
|
if (secureFeatures.editing && secureHandlers.onEditRow && !result.some((a) => a.label === "Edit")) {
|
|
11923
11997
|
result.push({
|
|
11924
11998
|
label: "Edit",
|
|
@@ -11958,7 +12032,7 @@ function DataTableInternal({
|
|
|
11958
12032
|
variant: "default"
|
|
11959
12033
|
});
|
|
11960
12034
|
} catch (error) {
|
|
11961
|
-
|
|
12035
|
+
logger.error("Delete error:", error);
|
|
11962
12036
|
toast({
|
|
11963
12037
|
title: "Delete Failed",
|
|
11964
12038
|
description: error instanceof Error ? error.message : "Failed to delete row",
|
|
@@ -11972,13 +12046,11 @@ function DataTableInternal({
|
|
|
11972
12046
|
hidden: !permissions.canDelete.can
|
|
11973
12047
|
});
|
|
11974
12048
|
}
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
});
|
|
11981
|
-
}
|
|
12049
|
+
logger.debug("Final Actions:", {
|
|
12050
|
+
totalActions: result.length,
|
|
12051
|
+
actionLabels: result.map((a) => a.label),
|
|
12052
|
+
hiddenActions: result.filter((a) => a.hidden).map((a) => a.label)
|
|
12053
|
+
});
|
|
11982
12054
|
return result;
|
|
11983
12055
|
}, [actions, secureFeatures, permissions, secureHandlers, resolvedGetRowId, stateActions, data]);
|
|
11984
12056
|
const normalizedColumnOrderForColumns = useMemo14(() => {
|
|
@@ -11999,15 +12071,13 @@ function DataTableInternal({
|
|
|
11999
12071
|
}), [state.pagination, effectivePageSize]);
|
|
12000
12072
|
const tableStateSnapshot = useMemo14(() => {
|
|
12001
12073
|
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
|
-
}
|
|
12074
|
+
if (secureFeatures.selection && state.columnOrder[0] !== "select") {
|
|
12075
|
+
logger.warn("Column order normalized:", {
|
|
12076
|
+
original: state.columnOrder,
|
|
12077
|
+
normalized: normalizedColumnOrder,
|
|
12078
|
+
firstColumnOriginal: state.columnOrder[0],
|
|
12079
|
+
firstColumnNormalized: normalizedColumnOrder[0]
|
|
12080
|
+
});
|
|
12011
12081
|
}
|
|
12012
12082
|
return {
|
|
12013
12083
|
sorting: state.sorting,
|
|
@@ -12057,53 +12127,16 @@ function DataTableInternal({
|
|
|
12057
12127
|
pageSize: effectivePageSize,
|
|
12058
12128
|
hasServerSideConfig: !!serverSide
|
|
12059
12129
|
});
|
|
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
12130
|
const table = useReactTable(tableConfig);
|
|
12074
12131
|
useEffect12(() => {
|
|
12075
12132
|
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
12133
|
if (rows.length === 0 && finalTableData.length > 0) {
|
|
12106
|
-
|
|
12134
|
+
const coreRows = table.getCoreRowModel().rows;
|
|
12135
|
+
const prePaginationRows = table.getPrePaginationRowModel?.()?.rows || [];
|
|
12136
|
+
const filteredRows = table.getFilteredRowModel?.()?.rows || [];
|
|
12137
|
+
const sortedRows = table.getSortedRowModel?.()?.rows || [];
|
|
12138
|
+
const tableState = table.getState();
|
|
12139
|
+
logger.warn("Table created but rows are empty!", {
|
|
12107
12140
|
finalTableDataLength: finalTableData.length,
|
|
12108
12141
|
tableConfigDataLength: tableConfig.data?.length || 0,
|
|
12109
12142
|
coreRowsLength: coreRows.length,
|
|
@@ -12128,32 +12161,24 @@ function DataTableInternal({
|
|
|
12128
12161
|
effectivePageSize
|
|
12129
12162
|
});
|
|
12130
12163
|
}
|
|
12131
|
-
}, [table, finalTableData.length, tableConfig, resolvedGetRowId, finalPaginationMode, serverSide, effectivePageSize]);
|
|
12164
|
+
}, [table, finalTableData.length, tableConfig, resolvedGetRowId, finalPaginationMode, serverSide, effectivePageSize, logger]);
|
|
12132
12165
|
if (!user) {
|
|
12133
12166
|
throw new Error("DataTable requires authenticated user for RBAC");
|
|
12134
12167
|
}
|
|
12135
12168
|
if (permissions.canRead.isLoading) {
|
|
12136
|
-
console.log("[DataTable] \u23F3 Permission check in progress - showing loading state");
|
|
12137
12169
|
return /* @__PURE__ */ jsx24(LoadingComponent, {});
|
|
12138
12170
|
}
|
|
12139
12171
|
if (!permissions.canRead.can) {
|
|
12140
|
-
|
|
12172
|
+
logger.warn("Access denied - no read permission:", {
|
|
12141
12173
|
canRead: permissions.canRead,
|
|
12142
12174
|
pageId: effectivePageId,
|
|
12143
12175
|
isLoading: permissions.canRead.isLoading
|
|
12144
12176
|
});
|
|
12145
12177
|
return /* @__PURE__ */ jsx24(AccessDeniedPage, { resource: effectivePageId || "unknown-page", operation: "read" });
|
|
12146
12178
|
}
|
|
12147
|
-
console.log("[DataTable] \u2705 Permission check passed - rendering table");
|
|
12148
12179
|
if (isLoading) {
|
|
12149
|
-
console.log("[DataTable] \u23F3 Loading state - showing loading component");
|
|
12150
12180
|
return /* @__PURE__ */ jsx24(LoadingComponent, {});
|
|
12151
12181
|
}
|
|
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
12182
|
const PaginationComponent = enhancedPagination || finalPaginationMode !== "client" ? EnhancedPaginationControls : PaginationControls;
|
|
12158
12183
|
const visibleColumns = table?.getVisibleFlatColumns() || [];
|
|
12159
12184
|
const dataColumns = visibleColumns.filter(
|
|
@@ -12239,20 +12264,15 @@ function DataTableInternal({
|
|
|
12239
12264
|
description: `Data exported to ${filename}`,
|
|
12240
12265
|
variant: "default"
|
|
12241
12266
|
});
|
|
12242
|
-
|
|
12243
|
-
console.log("DataTable: Export completed successfully");
|
|
12244
|
-
}
|
|
12267
|
+
logger.debug("Export completed successfully");
|
|
12245
12268
|
} catch (error) {
|
|
12246
|
-
|
|
12269
|
+
logger.error("Failed to export data:", error);
|
|
12247
12270
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
12248
12271
|
toast({
|
|
12249
12272
|
title: "Export Failed",
|
|
12250
12273
|
description: `Failed to export data: ${errorMessage}`,
|
|
12251
12274
|
variant: "destructive"
|
|
12252
12275
|
});
|
|
12253
|
-
if (import.meta.env.MODE === "development") {
|
|
12254
|
-
console.error("DataTable: Export error details:", error);
|
|
12255
|
-
}
|
|
12256
12276
|
}
|
|
12257
12277
|
}),
|
|
12258
12278
|
rowSelection,
|
|
@@ -12277,7 +12297,7 @@ function DataTableInternal({
|
|
|
12277
12297
|
variant: "default"
|
|
12278
12298
|
});
|
|
12279
12299
|
} catch (error) {
|
|
12280
|
-
|
|
12300
|
+
logger.error("Bulk delete error:", error);
|
|
12281
12301
|
toast({
|
|
12282
12302
|
title: "Delete Failed",
|
|
12283
12303
|
description: error instanceof Error ? error.message : "Failed to delete selected rows",
|
|
@@ -12456,19 +12476,19 @@ function DataTableInternal({
|
|
|
12456
12476
|
onImport: async (data2) => {
|
|
12457
12477
|
if (onImport) {
|
|
12458
12478
|
try {
|
|
12459
|
-
|
|
12479
|
+
logger.debug("onImport called with", data2.length, "rows");
|
|
12460
12480
|
const result = onImport(data2);
|
|
12461
12481
|
if (result && typeof result.then === "function") {
|
|
12462
12482
|
await result;
|
|
12463
12483
|
}
|
|
12464
|
-
|
|
12484
|
+
logger.debug("onImport completed successfully");
|
|
12465
12485
|
toast({
|
|
12466
12486
|
title: "Import Successful",
|
|
12467
12487
|
description: `Successfully imported ${data2.length} ${data2.length === 1 ? "row" : "rows"}`,
|
|
12468
12488
|
variant: "default"
|
|
12469
12489
|
});
|
|
12470
12490
|
} catch (error) {
|
|
12471
|
-
|
|
12491
|
+
logger.error("Import error:", error);
|
|
12472
12492
|
toast({
|
|
12473
12493
|
title: "Import Failed",
|
|
12474
12494
|
description: error instanceof Error ? error.message : "Failed to import data",
|
|
@@ -12477,7 +12497,7 @@ function DataTableInternal({
|
|
|
12477
12497
|
return;
|
|
12478
12498
|
}
|
|
12479
12499
|
} else {
|
|
12480
|
-
|
|
12500
|
+
logger.error("onImport handler not provided");
|
|
12481
12501
|
toast({
|
|
12482
12502
|
title: "Import Not Configured",
|
|
12483
12503
|
description: "Import functionality requires an onImport handler to be provided.",
|
|
@@ -12507,11 +12527,6 @@ import { jsx as jsx25 } from "react/jsx-runtime";
|
|
|
12507
12527
|
function DataTable(props) {
|
|
12508
12528
|
const logger = React20.useMemo(() => createLogger("DataTable"), []);
|
|
12509
12529
|
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
12530
|
const normalizedFeatures = React20.useMemo(
|
|
12516
12531
|
() => normalizeDataTableFeatures(features),
|
|
12517
12532
|
[features]
|
|
@@ -12741,4 +12756,4 @@ lodash/lodash.js:
|
|
|
12741
12756
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
12742
12757
|
*)
|
|
12743
12758
|
*/
|
|
12744
|
-
//# sourceMappingURL=chunk-
|
|
12759
|
+
//# sourceMappingURL=chunk-DHMFMXFV.js.map
|