@payloadcms/next 3.71.0-canary.2 → 3.71.0-internal-debug.dea9d74
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/auth/login.js +52 -58
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.js +39 -44
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.js +45 -47
- package/dist/auth/refresh.js.map +1 -1
- package/dist/cjs/withPayload.cjs +61 -23
- package/dist/cjs/withPayload.cjs.map +2 -2
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +9 -15
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +40 -71
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +65 -59
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +38 -0
- package/dist/elements/DocumentHeader/Tabs/index.js +80 -70
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.scss +54 -0
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +16 -23
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.scss +9 -0
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +61 -69
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +48 -28
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.scss +64 -0
- package/dist/elements/FormHeader/index.js +30 -16
- package/dist/elements/FormHeader/index.js.map +1 -1
- package/dist/elements/FormHeader/index.scss +8 -0
- package/dist/elements/Logo/index.js +19 -34
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +23 -44
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +28 -54
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.scss +27 -0
- package/dist/elements/Nav/SettingsMenuButton/index.js +33 -39
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.scss +11 -0
- package/dist/elements/Nav/getNavPrefs.js +27 -22
- package/dist/elements/Nav/getNavPrefs.js.map +1 -1
- package/dist/elements/Nav/index.client.js +97 -118
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +148 -127
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/Nav/index.scss +173 -0
- package/dist/esbuildEntry.d.ts +5 -0
- package/dist/esbuildEntry.d.ts.map +1 -0
- package/dist/esbuildEntry.js +6 -0
- package/dist/esbuildEntry.js.map +1 -0
- package/dist/exports/auth.js +1 -0
- package/dist/exports/auth.js.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.js +1 -0
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.js +1 -0
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/rsc.js +1 -0
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/templates.js +1 -0
- package/dist/exports/templates.js.map +1 -1
- package/dist/exports/utilities.js +7 -12
- package/dist/exports/utilities.js.map +1 -1
- package/dist/exports/views.js +1 -0
- package/dist/exports/views.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/NestProviders.js +21 -20
- package/dist/layouts/Root/NestProviders.js.map +1 -1
- package/dist/layouts/Root/checkDependencies.js +49 -41
- package/dist/layouts/Root/checkDependencies.js.map +1 -1
- package/dist/layouts/Root/index.js +128 -103
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +5 -1
- package/dist/routes/graphql/handler.js +114 -122
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/index.js +1 -0
- package/dist/routes/graphql/index.js.map +1 -1
- package/dist/routes/graphql/playground.js +28 -27
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/rest/index.js +23 -22
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.js +103 -79
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +59 -54
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/templates/Default/NavHamburger/index.js +12 -20
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +20 -44
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.scss +58 -0
- package/dist/templates/Default/index.js +147 -116
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Default/index.scss +79 -0
- package/dist/templates/Minimal/index.js +26 -17
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/templates/Minimal/index.scss +30 -0
- package/dist/utilities/getExistingAuthToken.js +3 -2
- package/dist/utilities/getExistingAuthToken.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +12 -13
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.js +5 -5
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getPreferences.js +27 -22
- package/dist/utilities/getPreferences.js.map +1 -1
- package/dist/utilities/getRequestLocale.js +13 -14
- package/dist/utilities/getRequestLocale.js.map +1 -1
- package/dist/utilities/getRequestTheme.js +19 -19
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/getRouteWithoutAdmin.js +3 -5
- package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +22 -36
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/handleServerFunctions.js +34 -41
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/initReq.js +78 -96
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/utilities/isCustomAdminView.js +22 -26
- package/dist/utilities/isCustomAdminView.js.map +1 -1
- package/dist/utilities/isPublicAdminRoute.js +26 -20
- package/dist/utilities/isPublicAdminRoute.js.map +1 -1
- package/dist/utilities/meta.js +68 -63
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/selectiveCache.js +25 -26
- package/dist/utilities/selectiveCache.js.map +1 -1
- package/dist/utilities/setPayloadAuthCookie.js +19 -22
- package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
- package/dist/utilities/slugify.js +24 -33
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/utilities/timestamp.js +7 -6
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +17 -39
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +171 -126
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.scss +129 -0
- package/dist/views/API/index.client.js +290 -197
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +7 -2
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/index.scss +119 -0
- package/dist/views/API/metadata.js +18 -23
- package/dist/views/API/metadata.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +78 -102
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +18 -47
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +60 -25
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/Settings/index.scss +48 -0
- package/dist/views/Account/ToggleTheme/index.js +38 -55
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.client.js +16 -32
- package/dist/views/Account/index.client.js.map +1 -1
- package/dist/views/Account/index.js +147 -158
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Account/metadata.js +8 -12
- package/dist/views/Account/metadata.js.map +1 -1
- package/dist/views/BrowseByFolder/buildView.js +138 -157
- package/dist/views/BrowseByFolder/buildView.js.map +1 -1
- package/dist/views/BrowseByFolder/index.js +16 -16
- package/dist/views/BrowseByFolder/index.js.map +1 -1
- package/dist/views/BrowseByFolder/metadata.js +13 -15
- package/dist/views/BrowseByFolder/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/buildView.js +122 -142
- package/dist/views/CollectionFolders/buildView.js.map +1 -1
- package/dist/views/CollectionFolders/index.js +16 -16
- package/dist/views/CollectionFolders/index.js.map +1 -1
- package/dist/views/CollectionFolders/metadata.js +18 -21
- package/dist/views/CollectionFolders/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/renderFolderViewSlots.js +58 -61
- package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
- package/dist/views/CollectionTrash/index.js +17 -17
- package/dist/views/CollectionTrash/index.js.map +1 -1
- package/dist/views/CollectionTrash/metadata.js +18 -21
- package/dist/views/CollectionTrash/metadata.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +117 -103
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +87 -81
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.scss +21 -0
- package/dist/views/CreateFirstUser/metadata.js +8 -12
- package/dist/views/CreateFirstUser/metadata.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +147 -138
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +423 -405
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.js +72 -75
- package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.scss +316 -0
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +62 -89
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +40 -47
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +64 -65
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js +164 -147
- package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js +31 -30
- package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js +223 -229
- package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +59 -45
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +46 -42
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Dashboard/metadata.js +10 -14
- package/dist/views/Dashboard/metadata.js.map +1 -1
- package/dist/views/Document/getCustomDocumentViewByKey.js +3 -2
- package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.js +27 -30
- package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Document/getDocPreferences.js +40 -41
- package/dist/views/Document/getDocPreferences.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +44 -55
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +77 -80
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getDocumentView.js +313 -283
- package/dist/views/Document/getDocumentView.js.map +1 -1
- package/dist/views/Document/getIsLocked.js +66 -66
- package/dist/views/Document/getIsLocked.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +130 -136
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getVersions.js +205 -195
- package/dist/views/Document/getVersions.js.map +1 -1
- package/dist/views/Document/handleServerFunction.js +103 -128
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.js +316 -355
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/metadata.js +2 -1
- package/dist/views/Document/metadata.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +121 -132
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.js +10 -6
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/metadata.js +36 -46
- package/dist/views/Edit/metadata.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +130 -164
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +79 -62
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/ForgotPassword/metadata.js +8 -12
- package/dist/views/ForgotPassword/metadata.js.map +1 -1
- package/dist/views/List/createSerializableValue.js +12 -11
- package/dist/views/List/createSerializableValue.js.map +1 -1
- package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
- package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
- package/dist/views/List/extractRelationshipDisplayValue.js +15 -14
- package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
- package/dist/views/List/extractValueOrRelationshipID.js +16 -15
- package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
- package/dist/views/List/handleGroupBy.js +133 -150
- package/dist/views/List/handleGroupBy.js.map +1 -1
- package/dist/views/List/handleServerFunction.js +98 -121
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.js +305 -323
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/metadata.js +17 -20
- package/dist/views/List/metadata.js.map +1 -1
- package/dist/views/List/renderListViewSlots.js +82 -75
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/List/resolveAllFilterOptions.js +43 -45
- package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
- package/dist/views/List/transformColumnsToSelect.js +9 -8
- package/dist/views/List/transformColumnsToSelect.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +57 -89
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +107 -160
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.scss +10 -0
- package/dist/views/Login/index.js +82 -85
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/index.scss +10 -0
- package/dist/views/Login/metadata.js +8 -12
- package/dist/views/Login/metadata.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +84 -120
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +29 -29
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/index.scss +25 -0
- package/dist/views/Logout/metadata.js +7 -11
- package/dist/views/Logout/metadata.js.map +1 -1
- package/dist/views/NotFound/index.client.js +71 -82
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +72 -73
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/index.scss +57 -0
- package/dist/views/NotFound/metadata.js +7 -9
- package/dist/views/NotFound/metadata.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +97 -108
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.js +93 -73
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/index.scss +11 -0
- package/dist/views/ResetPassword/metadata.js +8 -12
- package/dist/views/ResetPassword/metadata.js.map +1 -1
- package/dist/views/Root/attachViewActions.js +18 -23
- package/dist/views/Root/attachViewActions.js.map +1 -1
- package/dist/views/Root/generateCustomViewMetadata.js +19 -21
- package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js +12 -14
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Root/getCustomViewByRoute.js +31 -42
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getDocumentViewInfo.js +24 -23
- package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
- package/dist/views/Root/getRouteData.js +333 -325
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.js +248 -270
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +21 -26
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/metadata.js +176 -181
- package/dist/views/Root/metadata.js.map +1 -1
- package/dist/views/Unauthorized/index.js +54 -46
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/index.scss +14 -0
- package/dist/views/Unauthorized/metadata.js +8 -12
- package/dist/views/Unauthorized/metadata.js.map +1 -1
- package/dist/views/Verify/index.client.js +25 -43
- package/dist/views/Verify/index.client.js.map +1 -1
- package/dist/views/Verify/index.js +69 -64
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/index.scss +16 -0
- package/dist/views/Verify/metadata.js +8 -12
- package/dist/views/Verify/metadata.js.map +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +86 -127
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.js +380 -236
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/index.scss +170 -0
- package/dist/views/Version/Default/types.js +2 -1
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +102 -119
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +81 -0
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +78 -73
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +363 -408
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +40 -51
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +35 -67
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +12 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +59 -56
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +9 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +139 -117
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +59 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +36 -41
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +192 -178
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +91 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +17 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +48 -73
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +132 -143
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +9 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +56 -81
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +252 -211
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.scss +121 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +23 -22
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +12 -9
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.scss +24 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +213 -228
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +1005 -826
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +2 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +44 -43
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +32 -36
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +145 -129
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
- package/dist/views/Version/Restore/index.js +117 -93
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/index.scss +84 -0
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +33 -50
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js +170 -226
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.scss +18 -0
- package/dist/views/Version/SelectComparison/index.js +73 -50
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.scss +9 -0
- package/dist/views/Version/SelectComparison/types.js +2 -1
- package/dist/views/Version/SelectComparison/types.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +34 -32
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +104 -95
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js +23 -27
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/index.scss +26 -0
- package/dist/views/Version/fetchVersions.js +113 -138
- package/dist/views/Version/fetchVersions.js.map +1 -1
- package/dist/views/Version/index.js +325 -323
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/metadata.js +43 -50
- package/dist/views/Version/metadata.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +95 -79
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +34 -38
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.scss +9 -0
- package/dist/views/Versions/cells/CreatedAt/index.js +32 -53
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +10 -8
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/index.client.js +106 -83
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +143 -143
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/index.scss +110 -0
- package/dist/views/Versions/metadata.js +37 -44
- package/dist/views/Versions/metadata.js.map +1 -1
- package/dist/views/Versions/types.js +2 -1
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/withPayload/withPayload.js +198 -144
- package/dist/withPayload/withPayload.js.map +1 -1
- package/dist/withPayload/withPayload.utils.js +65 -73
- package/dist/withPayload/withPayload.utils.js.map +1 -1
- package/dist/withPayload/withPayloadLegacy.js +41 -40
- package/dist/withPayload/withPayloadLegacy.js.map +1 -1
- package/package.json +6 -6
|
@@ -4,93 +4,93 @@
|
|
|
4
4
|
* This function checks if draft documents also have a published version to determine "changed" status.
|
|
5
5
|
*
|
|
6
6
|
* Performance: Uses a single query to find all documents with "changed" status instead of N queries.
|
|
7
|
-
*/export async function enrichDocsWithVersionStatus({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
7
|
+
*/ export async function enrichDocsWithVersionStatus({ collectionConfig, data, req }) {
|
|
8
|
+
const draftsEnabled = collectionConfig?.versions?.drafts;
|
|
9
|
+
if (!draftsEnabled || !data?.docs?.length) {
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
// Find all draft documents
|
|
13
|
+
// When querying with draft:true, we get the latest draft if it exists
|
|
14
|
+
// We need to check if these drafts have a published version
|
|
15
|
+
const draftDocs = data.docs.filter((doc)=>doc._status === 'draft');
|
|
16
|
+
if (draftDocs.length === 0) {
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
const draftDocIds = draftDocs.map((doc)=>doc.id).filter(Boolean);
|
|
20
|
+
if (draftDocIds.length === 0) {
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
// OPTIMIZATION: Single query to find all document IDs that have BOTH:
|
|
24
|
+
// 1. A draft version (latest=true, _status='draft')
|
|
25
|
+
// 2. A published version (_status='published')
|
|
26
|
+
// These are the documents with "changed" status
|
|
27
|
+
try {
|
|
28
|
+
// TODO: This could be more efficient with a findDistinctVersions() API:
|
|
29
|
+
// const { values } = await req.payload.findDistinctVersions({
|
|
30
|
+
// collection: collectionConfig.slug,
|
|
31
|
+
// field: 'parent',
|
|
32
|
+
// where: {
|
|
33
|
+
// and: [
|
|
34
|
+
// { parent: { in: draftDocIds } },
|
|
35
|
+
// { 'version._status': { equals: 'published' } },
|
|
36
|
+
// ],
|
|
37
|
+
// },
|
|
38
|
+
// })
|
|
39
|
+
// const hasPublishedVersionSet = new Set(values)
|
|
40
|
+
//
|
|
41
|
+
// For now, we query all published versions but only select the 'parent' field
|
|
42
|
+
// to minimize data transfer, then deduplicate with a Set
|
|
43
|
+
const publishedVersions = await req.payload.findVersions({
|
|
44
|
+
collection: collectionConfig.slug,
|
|
45
|
+
depth: 0,
|
|
46
|
+
limit: 0,
|
|
47
|
+
pagination: false,
|
|
48
|
+
select: {
|
|
49
|
+
parent: true
|
|
50
|
+
},
|
|
51
|
+
where: {
|
|
52
|
+
and: [
|
|
53
|
+
{
|
|
54
|
+
parent: {
|
|
55
|
+
in: draftDocIds
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
'version._status': {
|
|
60
|
+
equals: 'published'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// Create a Set of document IDs that have published versions
|
|
67
|
+
const hasPublishedVersionSet = new Set(publishedVersions.docs.map((version)=>version.parent).filter(Boolean));
|
|
68
|
+
// Enrich documents with display status
|
|
69
|
+
const enrichedDocs = data.docs.map((doc)=>{
|
|
70
|
+
// If it's a draft and has a published version, show "changed"
|
|
71
|
+
if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {
|
|
72
|
+
return {
|
|
73
|
+
...doc,
|
|
74
|
+
_displayStatus: 'changed'
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
...doc,
|
|
79
|
+
_displayStatus: doc._status
|
|
80
|
+
};
|
|
81
|
+
});
|
|
73
82
|
return {
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
...data,
|
|
84
|
+
docs: enrichedDocs
|
|
76
85
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
docs: enrichedDocs
|
|
86
|
-
};
|
|
87
|
-
} catch (error) {
|
|
88
|
-
// If there's an error querying versions, just return the original data
|
|
89
|
-
req.payload.logger.error({
|
|
90
|
-
err: error,
|
|
91
|
-
msg: `Error checking version status for collection ${collectionConfig.slug}`
|
|
92
|
-
});
|
|
93
|
-
return data;
|
|
94
|
-
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
// If there's an error querying versions, just return the original data
|
|
88
|
+
req.payload.logger.error({
|
|
89
|
+
err: error,
|
|
90
|
+
msg: `Error checking version status for collection ${collectionConfig.slug}`
|
|
91
|
+
});
|
|
92
|
+
return data;
|
|
93
|
+
}
|
|
95
94
|
}
|
|
95
|
+
|
|
96
96
|
//# sourceMappingURL=enrichDocsWithVersionStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/views/List/enrichDocsWithVersionStatus.ts"],"sourcesContent":["import type { PaginatedDocs, PayloadRequest, SanitizedCollectionConfig } from 'payload'\n\n/**\n * Enriches list view documents with correct draft status display.\n * When draft=true is used in the query, Payload returns the latest draft version if it exists.\n * This function checks if draft documents also have a published version to determine \"changed\" status.\n *\n * Performance: Uses a single query to find all documents with \"changed\" status instead of N queries.\n */\nexport async function enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n}: {\n collectionConfig: SanitizedCollectionConfig\n data: PaginatedDocs\n req: PayloadRequest\n}): Promise<PaginatedDocs> {\n const draftsEnabled = collectionConfig?.versions?.drafts\n\n if (!draftsEnabled || !data?.docs?.length) {\n return data\n }\n\n // Find all draft documents\n // When querying with draft:true, we get the latest draft if it exists\n // We need to check if these drafts have a published version\n const draftDocs = data.docs.filter((doc) => doc._status === 'draft')\n\n if (draftDocs.length === 0) {\n return data\n }\n\n const draftDocIds = draftDocs.map((doc) => doc.id).filter(Boolean)\n\n if (draftDocIds.length === 0) {\n return data\n }\n\n // OPTIMIZATION: Single query to find all document IDs that have BOTH:\n // 1. A draft version (latest=true, _status='draft')\n // 2. A published version (_status='published')\n // These are the documents with \"changed\" status\n try {\n // TODO: This could be more efficient with a findDistinctVersions() API:\n // const { values } = await req.payload.findDistinctVersions({\n // collection: collectionConfig.slug,\n // field: 'parent',\n // where: {\n // and: [\n // { parent: { in: draftDocIds } },\n // { 'version._status': { equals: 'published' } },\n // ],\n // },\n // })\n // const hasPublishedVersionSet = new Set(values)\n //\n // For now, we query all published versions but only select the 'parent' field\n // to minimize data transfer, then deduplicate with a Set\n const publishedVersions = await req.payload.findVersions({\n collection: collectionConfig.slug,\n depth: 0,\n limit: 0,\n pagination: false,\n select: {\n parent: true,\n },\n where: {\n and: [\n {\n parent: {\n in: draftDocIds,\n },\n },\n {\n 'version._status': {\n equals: 'published',\n },\n },\n ],\n },\n })\n\n // Create a Set of document IDs that have published versions\n const hasPublishedVersionSet = new Set(\n publishedVersions.docs.map((version) => version.parent).filter(Boolean),\n )\n\n // Enrich documents with display status\n const enrichedDocs = data.docs.map((doc) => {\n // If it's a draft and has a published version, show \"changed\"\n if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {\n return {\n ...doc,\n _displayStatus: 'changed' as const,\n }\n }\n\n return {\n ...doc,\n _displayStatus: doc._status as 'draft' | 'published',\n }\n })\n\n return {\n ...data,\n docs: enrichedDocs,\n }\n } catch (error) {\n // If there's an error querying versions, just return the original data\n req.payload.logger.error({\n err: error,\n msg: `Error checking version status for collection ${collectionConfig.slug}`,\n })\n return data\n }\n}\n"],"names":["enrichDocsWithVersionStatus","collectionConfig","data","req","draftsEnabled","versions","drafts","docs","length","draftDocs","filter","doc","_status","draftDocIds","map","id","Boolean","publishedVersions","payload","findVersions","collection","slug","depth","limit","pagination","select","parent","where","and","in","equals","hasPublishedVersionSet","Set","version","enrichedDocs","has","_displayStatus","error","logger","err","msg"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,eAAeA,4BAA4B,EAChDC,gBAAgB,EAChBC,IAAI,EACJC,GAAG,EAKJ;IACC,MAAMC,gBAAgBH,kBAAkBI,UAAUC;IAElD,IAAI,CAACF,iBAAiB,CAACF,MAAMK,MAAMC,QAAQ;QACzC,OAAON;IACT;IAEA,2BAA2B;IAC3B,sEAAsE;IACtE,4DAA4D;IAC5D,MAAMO,YAAYP,KAAKK,IAAI,CAACG,MAAM,CAAC,CAACC,MAAQA,IAAIC,OAAO,KAAK;IAE5D,IAAIH,UAAUD,MAAM,KAAK,GAAG;QAC1B,OAAON;IACT;IAEA,MAAMW,cAAcJ,UAAUK,GAAG,CAAC,CAACH,MAAQA,IAAII,EAAE,EAAEL,MAAM,CAACM;IAE1D,IAAIH,YAAYL,MAAM,KAAK,GAAG;QAC5B,OAAON;IACT;IAEA,sEAAsE;IACtE,oDAAoD;IACpD,+CAA+C;IAC/C,gDAAgD;IAChD,IAAI;QACF,wEAAwE;QACxE,8DAA8D;QAC9D,uCAAuC;QACvC,qBAAqB;QACrB,aAAa;QACb,aAAa;QACb,yCAAyC;QACzC,wDAAwD;QACxD,SAAS;QACT,OAAO;QACP,KAAK;QACL,iDAAiD;QACjD,EAAE;QACF,8EAA8E;QAC9E,yDAAyD;QACzD,MAAMe,oBAAoB,MAAMd,IAAIe,OAAO,CAACC,YAAY,CAAC;YACvDC,YAAYnB,iBAAiBoB,IAAI;YACjCC,OAAO;YACPC,OAAO;YACPC,YAAY;YACZC,QAAQ;gBACNC,QAAQ;YACV;YACAC,OAAO;gBACLC,KAAK;oBACH;wBACEF,QAAQ;4BACNG,IAAIhB;wBACN;oBACF;oBACA;wBACE,mBAAmB;4BACjBiB,QAAQ;wBACV;oBACF;iBACD;YACH;QACF;QAEA,4DAA4D;QAC5D,MAAMC,yBAAyB,IAAIC,IACjCf,kBAAkBV,IAAI,CAACO,GAAG,CAAC,CAACmB,UAAYA,QAAQP,MAAM,EAAEhB,MAAM,CAACM;QAGjE,uCAAuC;QACvC,MAAMkB,eAAehC,KAAKK,IAAI,CAACO,GAAG,CAAC,CAACH;YAClC,8DAA8D;YAC9D,IAAIA,IAAIC,OAAO,KAAK,WAAWmB,uBAAuBI,GAAG,CAACxB,IAAII,EAAE,GAAG;gBACjE,OAAO;oBACL,GAAGJ,GAAG;oBACNyB,gBAAgB;gBAClB;YACF;YAEA,OAAO;gBACL,GAAGzB,GAAG;gBACNyB,gBAAgBzB,IAAIC,OAAO;YAC7B;QACF;QAEA,OAAO;YACL,GAAGV,IAAI;YACPK,MAAM2B;QACR;IACF,EAAE,OAAOG,OAAO;QACd,uEAAuE;QACvElC,IAAIe,OAAO,CAACoB,MAAM,CAACD,KAAK,CAAC;YACvBE,KAAKF;YACLG,KAAK,CAAC,6CAA6C,EAAEvC,iBAAiBoB,IAAI,EAAE;QAC9E;QACA,OAAOnB;IACT;AACF"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// Helper function to extract display value from relationship
|
|
2
|
-
export const extractRelationshipDisplayValue = (relationship, clientConfig, relationshipConfig)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
export const extractRelationshipDisplayValue = (relationship, clientConfig, relationshipConfig)=>{
|
|
3
|
+
if (!relationship) {
|
|
4
|
+
return '';
|
|
5
|
+
}
|
|
6
|
+
// Handle polymorphic relationships
|
|
7
|
+
if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {
|
|
8
|
+
const config = clientConfig.collections.find((c)=>c.slug === relationship.relationTo);
|
|
9
|
+
return relationship.value?.[config?.admin?.useAsTitle || 'id'] || '';
|
|
10
|
+
}
|
|
11
|
+
// Handle regular relationships
|
|
12
|
+
if (typeof relationship === 'object' && relationship?.id) {
|
|
13
|
+
return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || '';
|
|
14
|
+
}
|
|
15
|
+
return String(relationship);
|
|
16
16
|
};
|
|
17
|
+
|
|
17
18
|
//# sourceMappingURL=extractRelationshipDisplayValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/views/List/extractRelationshipDisplayValue.ts"],"sourcesContent":["import type { ClientCollectionConfig, ClientConfig } from 'payload'\n\n// Helper function to extract display value from relationship\nexport const extractRelationshipDisplayValue = (\n relationship: any,\n clientConfig: ClientConfig,\n relationshipConfig?: ClientCollectionConfig,\n): string => {\n if (!relationship) {\n return ''\n }\n\n // Handle polymorphic relationships\n if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {\n const config = clientConfig.collections.find((c) => c.slug === relationship.relationTo)\n return relationship.value?.[config?.admin?.useAsTitle || 'id'] || ''\n }\n\n // Handle regular relationships\n if (typeof relationship === 'object' && relationship?.id) {\n return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || ''\n }\n\n return String(relationship)\n}\n"],"names":["extractRelationshipDisplayValue","relationship","clientConfig","relationshipConfig","relationTo","value","config","collections","find","c","slug","admin","useAsTitle","id","String"],"mappings":"AAEA,6DAA6D;AAC7D,OAAO,MAAMA,kCAAkC,CAC7CC,cACAC,cACAC;IAEA,IAAI,CAACF,cAAc;QACjB,OAAO;IACT;IAEA,mCAAmC;IACnC,IAAI,OAAOA,iBAAiB,YAAYA,cAAcG,cAAcH,cAAcI,OAAO;QACvF,MAAMC,SAASJ,aAAaK,WAAW,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAKT,aAAaG,UAAU;QACtF,OAAOH,aAAaI,KAAK,EAAE,CAACC,QAAQK,OAAOC,cAAc,KAAK,IAAI;IACpE;IAEA,+BAA+B;IAC/B,IAAI,OAAOX,iBAAiB,YAAYA,cAAcY,IAAI;QACxD,OAAOZ,YAAY,CAACE,oBAAoBQ,OAAOC,cAAc,KAAK,IAAI;IACxE;IAEA,OAAOE,OAAOb;AAChB,EAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// Helper function to extract value or relationship ID for database queries
|
|
2
|
-
export const extractValueOrRelationshipID = relationship
|
|
3
|
-
|
|
2
|
+
export const extractValueOrRelationshipID = (relationship)=>{
|
|
3
|
+
if (!relationship || typeof relationship !== 'object') {
|
|
4
|
+
return relationship;
|
|
5
|
+
}
|
|
6
|
+
// For polymorphic relationships, preserve structure but ensure IDs are strings
|
|
7
|
+
if (relationship?.relationTo && relationship?.value) {
|
|
8
|
+
return {
|
|
9
|
+
relationTo: relationship.relationTo,
|
|
10
|
+
value: String(relationship.value?.id || relationship.value)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
// For regular relationships, extract ID
|
|
14
|
+
if (relationship?.id) {
|
|
15
|
+
return String(relationship.id);
|
|
16
|
+
}
|
|
4
17
|
return relationship;
|
|
5
|
-
}
|
|
6
|
-
// For polymorphic relationships, preserve structure but ensure IDs are strings
|
|
7
|
-
if (relationship?.relationTo && relationship?.value) {
|
|
8
|
-
return {
|
|
9
|
-
relationTo: relationship.relationTo,
|
|
10
|
-
value: String(relationship.value?.id || relationship.value)
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
// For regular relationships, extract ID
|
|
14
|
-
if (relationship?.id) {
|
|
15
|
-
return String(relationship.id);
|
|
16
|
-
}
|
|
17
|
-
return relationship;
|
|
18
18
|
};
|
|
19
|
+
|
|
19
20
|
//# sourceMappingURL=extractValueOrRelationshipID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/views/List/extractValueOrRelationshipID.ts"],"sourcesContent":["// Helper function to extract value or relationship ID for database queries\nexport const extractValueOrRelationshipID = (relationship: any): any => {\n if (!relationship || typeof relationship !== 'object') {\n return relationship\n }\n\n // For polymorphic relationships, preserve structure but ensure IDs are strings\n if (relationship?.relationTo && relationship?.value) {\n return {\n relationTo: relationship.relationTo,\n value: String(relationship.value?.id || relationship.value),\n }\n }\n\n // For regular relationships, extract ID\n if (relationship?.id) {\n return String(relationship.id)\n }\n\n return relationship\n}\n"],"names":["extractValueOrRelationshipID","relationship","relationTo","value","String","id"],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,MAAMA,+BAA+B,CAACC;IAC3C,IAAI,CAACA,gBAAgB,OAAOA,iBAAiB,UAAU;QACrD,OAAOA;IACT;IAEA,+EAA+E;IAC/E,IAAIA,cAAcC,cAAcD,cAAcE,OAAO;QACnD,OAAO;YACLD,YAAYD,aAAaC,UAAU;YACnCC,OAAOC,OAAOH,aAAaE,KAAK,EAAEE,MAAMJ,aAAaE,KAAK;QAC5D;IACF;IAEA,wCAAwC;IACxC,IAAIF,cAAcI,IAAI;QACpB,OAAOD,OAAOH,aAAaI,EAAE;IAC/B;IAEA,OAAOJ;AACT,EAAC"}
|
|
@@ -4,157 +4,140 @@ import { flattenAllFields } from 'payload';
|
|
|
4
4
|
import { createSerializableValue } from './createSerializableValue.js';
|
|
5
5
|
import { extractRelationshipDisplayValue } from './extractRelationshipDisplayValue.js';
|
|
6
6
|
import { extractValueOrRelationshipID } from './extractValueOrRelationshipID.js';
|
|
7
|
-
export const handleGroupBy = async ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
drawerSlug,
|
|
15
|
-
enableRowSelections,
|
|
16
|
-
fieldPermissions,
|
|
17
|
-
query,
|
|
18
|
-
req,
|
|
19
|
-
select,
|
|
20
|
-
trash = false,
|
|
21
|
-
user,
|
|
22
|
-
viewType,
|
|
23
|
-
where: whereWithMergedSearch
|
|
24
|
-
}) => {
|
|
25
|
-
let Table = null;
|
|
26
|
-
let columnState;
|
|
27
|
-
const dataByGroup = {};
|
|
28
|
-
// NOTE: is there a faster/better way to do this?
|
|
29
|
-
const flattenedFields = flattenAllFields({
|
|
30
|
-
fields: collectionConfig.fields
|
|
31
|
-
});
|
|
32
|
-
const groupByFieldPath = query.groupBy.replace(/^-/, '');
|
|
33
|
-
const groupByField = flattenedFields.find(f => f.name === groupByFieldPath);
|
|
34
|
-
// Set up population for relationships
|
|
35
|
-
let populate;
|
|
36
|
-
if (groupByField?.type === 'relationship' && groupByField.relationTo) {
|
|
37
|
-
const relationTo = Array.isArray(groupByField.relationTo) ? groupByField.relationTo : [groupByField.relationTo];
|
|
38
|
-
populate = {};
|
|
39
|
-
relationTo.forEach(rel => {
|
|
40
|
-
const config = clientConfig.collections.find(c => c.slug === rel);
|
|
41
|
-
populate[rel] = {
|
|
42
|
-
[config?.admin?.useAsTitle || 'id']: true
|
|
43
|
-
};
|
|
7
|
+
export const handleGroupBy = async ({ clientCollectionConfig, clientConfig, collectionConfig, collectionSlug, columns, customCellProps, drawerSlug, enableRowSelections, fieldPermissions, query, req, select, trash = false, user, viewType, where: whereWithMergedSearch })=>{
|
|
8
|
+
let Table = null;
|
|
9
|
+
let columnState;
|
|
10
|
+
const dataByGroup = {};
|
|
11
|
+
// NOTE: is there a faster/better way to do this?
|
|
12
|
+
const flattenedFields = flattenAllFields({
|
|
13
|
+
fields: collectionConfig.fields
|
|
44
14
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const data = {
|
|
61
|
-
...distinct,
|
|
62
|
-
docs: distinct.values?.map(() => ({})) || [],
|
|
63
|
-
values: undefined
|
|
64
|
-
};
|
|
65
|
-
await Promise.all((distinct.values || []).map(async (distinctValue, i) => {
|
|
66
|
-
const potentiallyPopulatedRelationship = distinctValue[groupByFieldPath];
|
|
67
|
-
// Extract value or relationship ID for database query
|
|
68
|
-
const valueOrRelationshipID = extractValueOrRelationshipID(potentiallyPopulatedRelationship);
|
|
69
|
-
const groupData = await req.payload.find({
|
|
70
|
-
collection: collectionSlug,
|
|
71
|
-
depth: 0,
|
|
72
|
-
draft: true,
|
|
73
|
-
fallbackLocale: false,
|
|
74
|
-
includeLockStatus: true,
|
|
75
|
-
limit: query?.queryByGroup?.[valueOrRelationshipID]?.limit ? Number(query.queryByGroup[valueOrRelationshipID].limit) : undefined,
|
|
76
|
-
locale: req.locale,
|
|
77
|
-
overrideAccess: false,
|
|
78
|
-
page: query?.queryByGroup?.[valueOrRelationshipID]?.page ? Number(query.queryByGroup[valueOrRelationshipID].page) : undefined,
|
|
79
|
-
req,
|
|
80
|
-
// Note: if we wanted to enable table-by-table sorting, we could use this:
|
|
81
|
-
// sort: query?.queryByGroup?.[valueOrRelationshipID]?.sort,
|
|
82
|
-
select,
|
|
83
|
-
sort: query?.sort,
|
|
84
|
-
trash,
|
|
85
|
-
user,
|
|
86
|
-
where: {
|
|
87
|
-
...(whereWithMergedSearch || {}),
|
|
88
|
-
[groupByFieldPath]: {
|
|
89
|
-
equals: valueOrRelationshipID
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
// Extract heading
|
|
94
|
-
let heading;
|
|
95
|
-
if (potentiallyPopulatedRelationship === null) {
|
|
96
|
-
heading = req.i18n.t('general:noValue');
|
|
97
|
-
} else if (groupByField?.type === 'relationship') {
|
|
98
|
-
const relationshipConfig = Array.isArray(groupByField.relationTo) ? undefined : clientConfig.collections.find(c => c.slug === groupByField.relationTo);
|
|
99
|
-
heading = extractRelationshipDisplayValue(potentiallyPopulatedRelationship, clientConfig, relationshipConfig);
|
|
100
|
-
} else if (groupByField?.type === 'date') {
|
|
101
|
-
heading = formatDate({
|
|
102
|
-
date: String(valueOrRelationshipID),
|
|
103
|
-
i18n: req.i18n,
|
|
104
|
-
pattern: clientConfig.admin.dateFormat
|
|
105
|
-
});
|
|
106
|
-
} else if (groupByField?.type === 'checkbox') {
|
|
107
|
-
if (valueOrRelationshipID === true) {
|
|
108
|
-
heading = req.i18n.t('general:true');
|
|
109
|
-
}
|
|
110
|
-
if (valueOrRelationshipID === false) {
|
|
111
|
-
heading = req.i18n.t('general:false');
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
heading = String(valueOrRelationshipID);
|
|
115
|
-
}
|
|
116
|
-
// Create serializable value for client
|
|
117
|
-
const serializableValue = createSerializableValue(valueOrRelationshipID);
|
|
118
|
-
if (groupData.docs && groupData.docs.length > 0) {
|
|
119
|
-
const {
|
|
120
|
-
columnState: newColumnState,
|
|
121
|
-
Table: NewTable
|
|
122
|
-
} = renderTable({
|
|
123
|
-
clientCollectionConfig,
|
|
124
|
-
collectionConfig,
|
|
125
|
-
columns,
|
|
126
|
-
customCellProps,
|
|
127
|
-
data: groupData,
|
|
128
|
-
drawerSlug,
|
|
129
|
-
enableRowSelections,
|
|
130
|
-
fieldPermissions,
|
|
131
|
-
groupByFieldPath,
|
|
132
|
-
groupByValue: serializableValue,
|
|
133
|
-
heading: heading || req.i18n.t('general:noValue'),
|
|
134
|
-
i18n: req.i18n,
|
|
135
|
-
key: `table-${serializableValue}`,
|
|
136
|
-
orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
|
|
137
|
-
payload: req.payload,
|
|
138
|
-
query,
|
|
139
|
-
useAsTitle: collectionConfig.admin.useAsTitle,
|
|
140
|
-
viewType
|
|
141
|
-
});
|
|
142
|
-
// Only need to set `columnState` once, using the first table's column state
|
|
143
|
-
// This will avoid needing to generate column state explicitly for root context that wraps all tables
|
|
144
|
-
if (!columnState) {
|
|
145
|
-
columnState = newColumnState;
|
|
146
|
-
}
|
|
147
|
-
if (!Table) {
|
|
148
|
-
Table = [];
|
|
149
|
-
}
|
|
150
|
-
dataByGroup[serializableValue] = groupData;
|
|
151
|
-
Table[i] = NewTable;
|
|
15
|
+
const groupByFieldPath = query.groupBy.replace(/^-/, '');
|
|
16
|
+
const groupByField = flattenedFields.find((f)=>f.name === groupByFieldPath);
|
|
17
|
+
// Set up population for relationships
|
|
18
|
+
let populate;
|
|
19
|
+
if (groupByField?.type === 'relationship' && groupByField.relationTo) {
|
|
20
|
+
const relationTo = Array.isArray(groupByField.relationTo) ? groupByField.relationTo : [
|
|
21
|
+
groupByField.relationTo
|
|
22
|
+
];
|
|
23
|
+
populate = {};
|
|
24
|
+
relationTo.forEach((rel)=>{
|
|
25
|
+
const config = clientConfig.collections.find((c)=>c.slug === rel);
|
|
26
|
+
populate[rel] = {
|
|
27
|
+
[config?.admin?.useAsTitle || 'id']: true
|
|
28
|
+
};
|
|
29
|
+
});
|
|
152
30
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
31
|
+
const distinct = await req.payload.findDistinct({
|
|
32
|
+
collection: collectionSlug,
|
|
33
|
+
depth: 1,
|
|
34
|
+
field: groupByFieldPath,
|
|
35
|
+
limit: query?.limit ? Number(query.limit) : undefined,
|
|
36
|
+
locale: req.locale,
|
|
37
|
+
overrideAccess: false,
|
|
38
|
+
page: query?.page ? Number(query.page) : undefined,
|
|
39
|
+
populate,
|
|
40
|
+
req,
|
|
41
|
+
sort: query?.groupBy,
|
|
42
|
+
trash,
|
|
43
|
+
where: whereWithMergedSearch
|
|
44
|
+
});
|
|
45
|
+
const data = {
|
|
46
|
+
...distinct,
|
|
47
|
+
docs: distinct.values?.map(()=>({})) || [],
|
|
48
|
+
values: undefined
|
|
49
|
+
};
|
|
50
|
+
await Promise.all((distinct.values || []).map(async (distinctValue, i)=>{
|
|
51
|
+
const potentiallyPopulatedRelationship = distinctValue[groupByFieldPath];
|
|
52
|
+
// Extract value or relationship ID for database query
|
|
53
|
+
const valueOrRelationshipID = extractValueOrRelationshipID(potentiallyPopulatedRelationship);
|
|
54
|
+
const groupData = await req.payload.find({
|
|
55
|
+
collection: collectionSlug,
|
|
56
|
+
depth: 0,
|
|
57
|
+
draft: true,
|
|
58
|
+
fallbackLocale: false,
|
|
59
|
+
includeLockStatus: true,
|
|
60
|
+
limit: query?.queryByGroup?.[valueOrRelationshipID]?.limit ? Number(query.queryByGroup[valueOrRelationshipID].limit) : undefined,
|
|
61
|
+
locale: req.locale,
|
|
62
|
+
overrideAccess: false,
|
|
63
|
+
page: query?.queryByGroup?.[valueOrRelationshipID]?.page ? Number(query.queryByGroup[valueOrRelationshipID].page) : undefined,
|
|
64
|
+
req,
|
|
65
|
+
// Note: if we wanted to enable table-by-table sorting, we could use this:
|
|
66
|
+
// sort: query?.queryByGroup?.[valueOrRelationshipID]?.sort,
|
|
67
|
+
select,
|
|
68
|
+
sort: query?.sort,
|
|
69
|
+
trash,
|
|
70
|
+
user,
|
|
71
|
+
where: {
|
|
72
|
+
...whereWithMergedSearch || {},
|
|
73
|
+
[groupByFieldPath]: {
|
|
74
|
+
equals: valueOrRelationshipID
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// Extract heading
|
|
79
|
+
let heading;
|
|
80
|
+
if (potentiallyPopulatedRelationship === null) {
|
|
81
|
+
heading = req.i18n.t('general:noValue');
|
|
82
|
+
} else if (groupByField?.type === 'relationship') {
|
|
83
|
+
const relationshipConfig = Array.isArray(groupByField.relationTo) ? undefined : clientConfig.collections.find((c)=>c.slug === groupByField.relationTo);
|
|
84
|
+
heading = extractRelationshipDisplayValue(potentiallyPopulatedRelationship, clientConfig, relationshipConfig);
|
|
85
|
+
} else if (groupByField?.type === 'date') {
|
|
86
|
+
heading = formatDate({
|
|
87
|
+
date: String(valueOrRelationshipID),
|
|
88
|
+
i18n: req.i18n,
|
|
89
|
+
pattern: clientConfig.admin.dateFormat
|
|
90
|
+
});
|
|
91
|
+
} else if (groupByField?.type === 'checkbox') {
|
|
92
|
+
if (valueOrRelationshipID === true) {
|
|
93
|
+
heading = req.i18n.t('general:true');
|
|
94
|
+
}
|
|
95
|
+
if (valueOrRelationshipID === false) {
|
|
96
|
+
heading = req.i18n.t('general:false');
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
heading = String(valueOrRelationshipID);
|
|
100
|
+
}
|
|
101
|
+
// Create serializable value for client
|
|
102
|
+
const serializableValue = createSerializableValue(valueOrRelationshipID);
|
|
103
|
+
if (groupData.docs && groupData.docs.length > 0) {
|
|
104
|
+
const { columnState: newColumnState, Table: NewTable } = renderTable({
|
|
105
|
+
clientCollectionConfig,
|
|
106
|
+
collectionConfig,
|
|
107
|
+
columns,
|
|
108
|
+
customCellProps,
|
|
109
|
+
data: groupData,
|
|
110
|
+
drawerSlug,
|
|
111
|
+
enableRowSelections,
|
|
112
|
+
fieldPermissions,
|
|
113
|
+
groupByFieldPath,
|
|
114
|
+
groupByValue: serializableValue,
|
|
115
|
+
heading: heading || req.i18n.t('general:noValue'),
|
|
116
|
+
i18n: req.i18n,
|
|
117
|
+
key: `table-${serializableValue}`,
|
|
118
|
+
orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
|
|
119
|
+
payload: req.payload,
|
|
120
|
+
query,
|
|
121
|
+
useAsTitle: collectionConfig.admin.useAsTitle,
|
|
122
|
+
viewType
|
|
123
|
+
});
|
|
124
|
+
// Only need to set `columnState` once, using the first table's column state
|
|
125
|
+
// This will avoid needing to generate column state explicitly for root context that wraps all tables
|
|
126
|
+
if (!columnState) {
|
|
127
|
+
columnState = newColumnState;
|
|
128
|
+
}
|
|
129
|
+
if (!Table) {
|
|
130
|
+
Table = [];
|
|
131
|
+
}
|
|
132
|
+
dataByGroup[serializableValue] = groupData;
|
|
133
|
+
Table[i] = NewTable;
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
return {
|
|
137
|
+
columnState,
|
|
138
|
+
data,
|
|
139
|
+
Table
|
|
140
|
+
};
|
|
159
141
|
};
|
|
142
|
+
|
|
160
143
|
//# sourceMappingURL=handleGroupBy.js.map
|