@payloadcms/next 3.70.0 → 3.71.0-internal-debug.80dab4c
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 -210
- 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/getFieldPathsModified.js +25 -22
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.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 -143
- package/dist/withPayload/withPayload.js.map +1 -1
- package/dist/withPayload/withPayload.utils.js +92 -95
- package/dist/withPayload/withPayload.utils.js.map +1 -1
- package/dist/withPayload/withPayloadLegacy.js +42 -40
- package/dist/withPayload/withPayloadLegacy.js.map +1 -1
- package/package.json +7 -7
|
@@ -9,431 +9,386 @@ import { diffComponents } from './fields/index.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Here, the server is responsible for traversing through the document data and building up this
|
|
11
11
|
* version state object.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
req,
|
|
27
|
-
selectedLocales,
|
|
28
|
-
versionFromSiblingData,
|
|
29
|
-
versionToSiblingData
|
|
30
|
-
}) => {
|
|
31
|
-
const versionFields = [];
|
|
32
|
-
let fieldIndex = -1;
|
|
33
|
-
for (const field of fields) {
|
|
34
|
-
fieldIndex++;
|
|
35
|
-
if (fieldIsID(field)) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const {
|
|
39
|
-
indexPath,
|
|
40
|
-
path,
|
|
41
|
-
schemaPath
|
|
42
|
-
} = getFieldPaths({
|
|
43
|
-
field,
|
|
44
|
-
index: fieldIndex,
|
|
45
|
-
parentIndexPath,
|
|
46
|
-
parentPath,
|
|
47
|
-
parentSchemaPath
|
|
48
|
-
});
|
|
49
|
-
const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath);
|
|
50
|
-
if (!clientField) {
|
|
51
|
-
req.payload.logger.error({
|
|
52
|
-
clientFieldKey: entitySlug + '.' + schemaPath,
|
|
53
|
-
clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),
|
|
54
|
-
msg: 'No client field found for ' + entitySlug + '.' + schemaPath,
|
|
55
|
-
parentPath,
|
|
56
|
-
parentSchemaPath,
|
|
57
|
-
path,
|
|
58
|
-
schemaPath
|
|
59
|
-
});
|
|
60
|
-
throw new Error('No client field found for ' + entitySlug + '.' + schemaPath);
|
|
61
|
-
}
|
|
62
|
-
const versionField = {};
|
|
63
|
-
const isLocalized = fieldShouldBeLocalized({
|
|
64
|
-
field,
|
|
65
|
-
parentIsLocalized
|
|
66
|
-
});
|
|
67
|
-
const fieldName = 'name' in field ? field.name : null;
|
|
68
|
-
const valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData;
|
|
69
|
-
const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData;
|
|
70
|
-
if (isLocalized) {
|
|
71
|
-
versionField.fieldByLocale = {};
|
|
72
|
-
for (const locale of selectedLocales) {
|
|
73
|
-
const localizedVersionField = buildVersionField({
|
|
74
|
-
clientField: clientField,
|
|
75
|
-
clientSchemaMap,
|
|
76
|
-
customDiffComponents,
|
|
77
|
-
entitySlug,
|
|
78
|
-
field,
|
|
79
|
-
i18n,
|
|
80
|
-
indexPath,
|
|
81
|
-
locale,
|
|
82
|
-
modifiedOnly,
|
|
83
|
-
nestingLevel,
|
|
84
|
-
parentFieldsPermissions: fieldsPermissions,
|
|
85
|
-
parentIsLocalized: true,
|
|
86
|
-
parentPath,
|
|
87
|
-
parentSchemaPath,
|
|
88
|
-
path,
|
|
89
|
-
req,
|
|
90
|
-
schemaPath,
|
|
91
|
-
selectedLocales,
|
|
92
|
-
valueFrom: valueFrom?.[locale],
|
|
93
|
-
valueTo: valueTo?.[locale]
|
|
12
|
+
*/ export const buildVersionFields = ({ clientSchemaMap, customDiffComponents, entitySlug, fields, fieldsPermissions, i18n, modifiedOnly, nestingLevel = 0, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, selectedLocales, versionFromSiblingData, versionToSiblingData })=>{
|
|
13
|
+
const versionFields = [];
|
|
14
|
+
let fieldIndex = -1;
|
|
15
|
+
for (const field of fields){
|
|
16
|
+
fieldIndex++;
|
|
17
|
+
if (fieldIsID(field)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const { indexPath, path, schemaPath } = getFieldPaths({
|
|
21
|
+
field,
|
|
22
|
+
index: fieldIndex,
|
|
23
|
+
parentIndexPath,
|
|
24
|
+
parentPath,
|
|
25
|
+
parentSchemaPath
|
|
94
26
|
});
|
|
95
|
-
|
|
96
|
-
|
|
27
|
+
const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath);
|
|
28
|
+
if (!clientField) {
|
|
29
|
+
req.payload.logger.error({
|
|
30
|
+
clientFieldKey: entitySlug + '.' + schemaPath,
|
|
31
|
+
clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),
|
|
32
|
+
msg: 'No client field found for ' + entitySlug + '.' + schemaPath,
|
|
33
|
+
parentPath,
|
|
34
|
+
parentSchemaPath,
|
|
35
|
+
path,
|
|
36
|
+
schemaPath
|
|
37
|
+
});
|
|
38
|
+
throw new Error('No client field found for ' + entitySlug + '.' + schemaPath);
|
|
39
|
+
}
|
|
40
|
+
const versionField = {};
|
|
41
|
+
const isLocalized = fieldShouldBeLocalized({
|
|
42
|
+
field,
|
|
43
|
+
parentIsLocalized
|
|
44
|
+
});
|
|
45
|
+
const fieldName = 'name' in field ? field.name : null;
|
|
46
|
+
const valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData;
|
|
47
|
+
const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData;
|
|
48
|
+
if (isLocalized) {
|
|
49
|
+
versionField.fieldByLocale = {};
|
|
50
|
+
for (const locale of selectedLocales){
|
|
51
|
+
const localizedVersionField = buildVersionField({
|
|
52
|
+
clientField: clientField,
|
|
53
|
+
clientSchemaMap,
|
|
54
|
+
customDiffComponents,
|
|
55
|
+
entitySlug,
|
|
56
|
+
field,
|
|
57
|
+
i18n,
|
|
58
|
+
indexPath,
|
|
59
|
+
locale,
|
|
60
|
+
modifiedOnly,
|
|
61
|
+
nestingLevel,
|
|
62
|
+
parentFieldsPermissions: fieldsPermissions,
|
|
63
|
+
parentIsLocalized: true,
|
|
64
|
+
parentPath,
|
|
65
|
+
parentSchemaPath,
|
|
66
|
+
path,
|
|
67
|
+
req,
|
|
68
|
+
schemaPath,
|
|
69
|
+
selectedLocales,
|
|
70
|
+
valueFrom: valueFrom?.[locale],
|
|
71
|
+
valueTo: valueTo?.[locale]
|
|
72
|
+
});
|
|
73
|
+
if (localizedVersionField) {
|
|
74
|
+
versionField.fieldByLocale[locale] = localizedVersionField;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
const baseVersionField = buildVersionField({
|
|
79
|
+
clientField: clientField,
|
|
80
|
+
clientSchemaMap,
|
|
81
|
+
customDiffComponents,
|
|
82
|
+
entitySlug,
|
|
83
|
+
field,
|
|
84
|
+
i18n,
|
|
85
|
+
indexPath,
|
|
86
|
+
modifiedOnly,
|
|
87
|
+
nestingLevel,
|
|
88
|
+
parentFieldsPermissions: fieldsPermissions,
|
|
89
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
90
|
+
parentPath,
|
|
91
|
+
parentSchemaPath,
|
|
92
|
+
path,
|
|
93
|
+
req,
|
|
94
|
+
schemaPath,
|
|
95
|
+
selectedLocales,
|
|
96
|
+
valueFrom,
|
|
97
|
+
valueTo
|
|
98
|
+
});
|
|
99
|
+
if (baseVersionField) {
|
|
100
|
+
versionField.field = baseVersionField;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (versionField.field || versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length) {
|
|
104
|
+
versionFields.push(versionField);
|
|
97
105
|
}
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
const baseVersionField = buildVersionField({
|
|
101
|
-
clientField: clientField,
|
|
102
|
-
clientSchemaMap,
|
|
103
|
-
customDiffComponents,
|
|
104
|
-
entitySlug,
|
|
105
|
-
field,
|
|
106
|
-
i18n,
|
|
107
|
-
indexPath,
|
|
108
|
-
modifiedOnly,
|
|
109
|
-
nestingLevel,
|
|
110
|
-
parentFieldsPermissions: fieldsPermissions,
|
|
111
|
-
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
112
|
-
parentPath,
|
|
113
|
-
parentSchemaPath,
|
|
114
|
-
path,
|
|
115
|
-
req,
|
|
116
|
-
schemaPath,
|
|
117
|
-
selectedLocales,
|
|
118
|
-
valueFrom,
|
|
119
|
-
valueTo
|
|
120
|
-
});
|
|
121
|
-
if (baseVersionField) {
|
|
122
|
-
versionField.field = baseVersionField;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (versionField.field || versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length) {
|
|
126
|
-
versionFields.push(versionField);
|
|
127
106
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
107
|
+
return {
|
|
108
|
+
versionFields
|
|
109
|
+
};
|
|
132
110
|
};
|
|
133
|
-
const buildVersionField = ({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
i18n,
|
|
140
|
-
indexPath,
|
|
141
|
-
locale,
|
|
142
|
-
modifiedOnly,
|
|
143
|
-
nestingLevel,
|
|
144
|
-
parentFieldsPermissions,
|
|
145
|
-
parentIsLocalized,
|
|
146
|
-
parentPath,
|
|
147
|
-
parentSchemaPath,
|
|
148
|
-
path,
|
|
149
|
-
req,
|
|
150
|
-
schemaPath,
|
|
151
|
-
selectedLocales,
|
|
152
|
-
valueFrom,
|
|
153
|
-
valueTo
|
|
154
|
-
}) => {
|
|
155
|
-
let hasReadPermission = false;
|
|
156
|
-
let fieldPermissions = undefined;
|
|
157
|
-
if (typeof parentFieldsPermissions === 'boolean') {
|
|
158
|
-
hasReadPermission = parentFieldsPermissions;
|
|
159
|
-
fieldPermissions = parentFieldsPermissions;
|
|
160
|
-
} else {
|
|
161
|
-
if ('name' in field) {
|
|
162
|
-
fieldPermissions = parentFieldsPermissions?.[field.name];
|
|
163
|
-
if (typeof fieldPermissions === 'boolean') {
|
|
164
|
-
hasReadPermission = fieldPermissions;
|
|
165
|
-
} else if (typeof fieldPermissions?.read === 'boolean') {
|
|
166
|
-
hasReadPermission = fieldPermissions.read;
|
|
167
|
-
}
|
|
111
|
+
const buildVersionField = ({ clientField, clientSchemaMap, customDiffComponents, entitySlug, field, i18n, indexPath, locale, modifiedOnly, nestingLevel, parentFieldsPermissions, parentIsLocalized, parentPath, parentSchemaPath, path, req, schemaPath, selectedLocales, valueFrom, valueTo })=>{
|
|
112
|
+
let hasReadPermission = false;
|
|
113
|
+
let fieldPermissions = undefined;
|
|
114
|
+
if (typeof parentFieldsPermissions === 'boolean') {
|
|
115
|
+
hasReadPermission = parentFieldsPermissions;
|
|
116
|
+
fieldPermissions = parentFieldsPermissions;
|
|
168
117
|
} else {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
if (modifiedOnly && dequal(valueFrom, valueTo)) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
let CustomComponent = customDiffComponents?.[field.type];
|
|
182
|
-
if (field?.type === 'richText') {
|
|
183
|
-
if (!field?.editor) {
|
|
184
|
-
throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor
|
|
185
|
-
;
|
|
186
|
-
}
|
|
187
|
-
if (typeof field?.editor === 'function') {
|
|
188
|
-
throw new Error('Attempted to access unsanitized rich text editor.');
|
|
189
|
-
}
|
|
190
|
-
if (field.editor.CellComponent) {
|
|
191
|
-
CustomComponent = field.editor.DiffComponent;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (field?.admin?.components?.Diff) {
|
|
195
|
-
CustomComponent = field.admin.components.Diff;
|
|
196
|
-
}
|
|
197
|
-
const DefaultComponent = diffComponents?.[field.type];
|
|
198
|
-
const baseVersionField = {
|
|
199
|
-
type: field.type,
|
|
200
|
-
fields: [],
|
|
201
|
-
path,
|
|
202
|
-
schemaPath
|
|
203
|
-
};
|
|
204
|
-
if (field.type === 'tabs' && 'tabs' in field) {
|
|
205
|
-
baseVersionField.tabs = [];
|
|
206
|
-
let tabIndex = -1;
|
|
207
|
-
for (const tab of field.tabs) {
|
|
208
|
-
tabIndex++;
|
|
209
|
-
const isNamedTab = tabHasName(tab);
|
|
210
|
-
const tabAsField = {
|
|
211
|
-
...tab,
|
|
212
|
-
type: 'tab'
|
|
213
|
-
};
|
|
214
|
-
const {
|
|
215
|
-
indexPath: tabIndexPath,
|
|
216
|
-
path: tabPath,
|
|
217
|
-
schemaPath: tabSchemaPath
|
|
218
|
-
} = getFieldPaths({
|
|
219
|
-
field: tabAsField,
|
|
220
|
-
index: tabIndex,
|
|
221
|
-
parentIndexPath: indexPath,
|
|
222
|
-
parentPath,
|
|
223
|
-
parentSchemaPath
|
|
224
|
-
});
|
|
225
|
-
let tabFieldsPermissions = undefined;
|
|
226
|
-
// The tabs field does not have its own permissions as it's unnamed => use parentFieldsPermissions
|
|
227
|
-
if (typeof parentFieldsPermissions === 'boolean') {
|
|
228
|
-
tabFieldsPermissions = parentFieldsPermissions;
|
|
229
|
-
} else {
|
|
230
|
-
if ('name' in tab) {
|
|
231
|
-
const tabPermissions = parentFieldsPermissions?.[tab.name];
|
|
232
|
-
if (typeof tabPermissions === 'boolean') {
|
|
233
|
-
tabFieldsPermissions = tabPermissions;
|
|
234
|
-
} else {
|
|
235
|
-
tabFieldsPermissions = tabPermissions?.fields;
|
|
236
|
-
}
|
|
118
|
+
if ('name' in field) {
|
|
119
|
+
fieldPermissions = parentFieldsPermissions?.[field.name];
|
|
120
|
+
if (typeof fieldPermissions === 'boolean') {
|
|
121
|
+
hasReadPermission = fieldPermissions;
|
|
122
|
+
} else if (typeof fieldPermissions?.read === 'boolean') {
|
|
123
|
+
hasReadPermission = fieldPermissions.read;
|
|
124
|
+
}
|
|
237
125
|
} else {
|
|
238
|
-
|
|
126
|
+
// If the field is unnamed and parentFieldsPermissions is an object, its sub-fields will decide their read permissions state.
|
|
127
|
+
// As far as this field is concerned, we are allowed to read it, as we need to reach its sub-fields to determine their read permissions.
|
|
128
|
+
hasReadPermission = true;
|
|
239
129
|
}
|
|
240
|
-
}
|
|
241
|
-
const tabVersion = {
|
|
242
|
-
name: 'name' in tab ? tab.name : null,
|
|
243
|
-
fields: buildVersionFields({
|
|
244
|
-
clientSchemaMap,
|
|
245
|
-
customDiffComponents,
|
|
246
|
-
entitySlug,
|
|
247
|
-
fields: tab.fields,
|
|
248
|
-
fieldsPermissions: tabFieldsPermissions,
|
|
249
|
-
i18n,
|
|
250
|
-
modifiedOnly,
|
|
251
|
-
nestingLevel: nestingLevel + 1,
|
|
252
|
-
parentIndexPath: isNamedTab ? '' : tabIndexPath,
|
|
253
|
-
parentIsLocalized: parentIsLocalized || tab.localized,
|
|
254
|
-
parentPath: isNamedTab ? tabPath : 'name' in field ? path : parentPath,
|
|
255
|
-
parentSchemaPath: isNamedTab ? tabSchemaPath : 'name' in field ? schemaPath : parentSchemaPath,
|
|
256
|
-
req,
|
|
257
|
-
selectedLocales,
|
|
258
|
-
versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,
|
|
259
|
-
versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo
|
|
260
|
-
}).versionFields,
|
|
261
|
-
label: typeof tab.label === 'function' ? tab.label({
|
|
262
|
-
i18n,
|
|
263
|
-
t: i18n.t
|
|
264
|
-
}) : tab.label
|
|
265
|
-
};
|
|
266
|
-
if (tabVersion?.fields?.length) {
|
|
267
|
-
baseVersionField.tabs.push(tabVersion);
|
|
268
|
-
}
|
|
269
130
|
}
|
|
270
|
-
if (
|
|
271
|
-
|
|
131
|
+
if (!hasReadPermission) {
|
|
132
|
+
// HasReadPermission is only valid if the field has a name. E.g. for a tabs field it would incorrectly return `false`.
|
|
133
|
+
return null;
|
|
272
134
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if ('name' in field && typeof fieldPermissions !== 'undefined') {
|
|
276
|
-
// Named fields like arrays
|
|
277
|
-
subFieldsPermissions = typeof fieldPermissions === 'boolean' ? fieldPermissions : fieldPermissions.fields;
|
|
278
|
-
} else {
|
|
279
|
-
// Unnamed fields like collapsible and row inherit directly from parent permissions
|
|
280
|
-
subFieldsPermissions = parentFieldsPermissions;
|
|
135
|
+
if (modifiedOnly && dequal(valueFrom, valueTo)) {
|
|
136
|
+
return null;
|
|
281
137
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
fieldsPermissions: subFieldsPermissions,
|
|
294
|
-
i18n,
|
|
295
|
-
modifiedOnly,
|
|
296
|
-
nestingLevel: nestingLevel + 1,
|
|
297
|
-
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
298
|
-
parentIsLocalized: parentIsLocalized || field.localized,
|
|
299
|
-
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
300
|
-
parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,
|
|
301
|
-
req,
|
|
302
|
-
selectedLocales,
|
|
303
|
-
versionFromSiblingData: fromRow,
|
|
304
|
-
versionToSiblingData: toRow
|
|
305
|
-
}).versionFields;
|
|
306
|
-
if (versionFields?.length) {
|
|
307
|
-
baseVersionField.rows[i] = versionFields;
|
|
138
|
+
let CustomComponent = customDiffComponents?.[field.type];
|
|
139
|
+
if (field?.type === 'richText') {
|
|
140
|
+
if (!field?.editor) {
|
|
141
|
+
throw new MissingEditorProp(field);
|
|
142
|
+
}
|
|
143
|
+
// while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor
|
|
144
|
+
if (typeof field?.editor === 'function') {
|
|
145
|
+
throw new Error('Attempted to access unsanitized rich text editor.');
|
|
146
|
+
}
|
|
147
|
+
if (field.editor.CellComponent) {
|
|
148
|
+
CustomComponent = field.editor.DiffComponent;
|
|
308
149
|
}
|
|
309
|
-
}
|
|
310
|
-
if (!baseVersionField.rows?.length && modifiedOnly) {
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
baseVersionField.fields = buildVersionFields({
|
|
315
|
-
clientSchemaMap,
|
|
316
|
-
customDiffComponents,
|
|
317
|
-
entitySlug,
|
|
318
|
-
fields: field.fields,
|
|
319
|
-
fieldsPermissions: subFieldsPermissions,
|
|
320
|
-
i18n,
|
|
321
|
-
modifiedOnly,
|
|
322
|
-
nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,
|
|
323
|
-
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
324
|
-
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
325
|
-
parentPath: 'name' in field ? path : parentPath,
|
|
326
|
-
parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,
|
|
327
|
-
req,
|
|
328
|
-
selectedLocales,
|
|
329
|
-
versionFromSiblingData: valueFrom,
|
|
330
|
-
versionToSiblingData: valueTo
|
|
331
|
-
}).versionFields;
|
|
332
|
-
if (modifiedOnly && !baseVersionField.fields?.length) {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
150
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
151
|
+
if (field?.admin?.components?.Diff) {
|
|
152
|
+
CustomComponent = field.admin.components.Diff;
|
|
153
|
+
}
|
|
154
|
+
const DefaultComponent = diffComponents?.[field.type];
|
|
155
|
+
const baseVersionField = {
|
|
156
|
+
type: field.type,
|
|
157
|
+
fields: [],
|
|
158
|
+
path,
|
|
159
|
+
schemaPath
|
|
160
|
+
};
|
|
161
|
+
if (field.type === 'tabs' && 'tabs' in field) {
|
|
162
|
+
baseVersionField.tabs = [];
|
|
163
|
+
let tabIndex = -1;
|
|
164
|
+
for (const tab of field.tabs){
|
|
165
|
+
tabIndex++;
|
|
166
|
+
const isNamedTab = tabHasName(tab);
|
|
167
|
+
const tabAsField = {
|
|
168
|
+
...tab,
|
|
169
|
+
type: 'tab'
|
|
170
|
+
};
|
|
171
|
+
const { indexPath: tabIndexPath, path: tabPath, schemaPath: tabSchemaPath } = getFieldPaths({
|
|
172
|
+
field: tabAsField,
|
|
173
|
+
index: tabIndex,
|
|
174
|
+
parentIndexPath: indexPath,
|
|
175
|
+
parentPath,
|
|
176
|
+
parentSchemaPath
|
|
177
|
+
});
|
|
178
|
+
let tabFieldsPermissions = undefined;
|
|
179
|
+
// The tabs field does not have its own permissions as it's unnamed => use parentFieldsPermissions
|
|
180
|
+
if (typeof parentFieldsPermissions === 'boolean') {
|
|
181
|
+
tabFieldsPermissions = parentFieldsPermissions;
|
|
182
|
+
} else {
|
|
183
|
+
if ('name' in tab) {
|
|
184
|
+
const tabPermissions = parentFieldsPermissions?.[tab.name];
|
|
185
|
+
if (typeof tabPermissions === 'boolean') {
|
|
186
|
+
tabFieldsPermissions = tabPermissions;
|
|
187
|
+
} else {
|
|
188
|
+
tabFieldsPermissions = tabPermissions?.fields;
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
tabFieldsPermissions = parentFieldsPermissions;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const tabVersion = {
|
|
195
|
+
name: 'name' in tab ? tab.name : null,
|
|
196
|
+
fields: buildVersionFields({
|
|
197
|
+
clientSchemaMap,
|
|
198
|
+
customDiffComponents,
|
|
199
|
+
entitySlug,
|
|
200
|
+
fields: tab.fields,
|
|
201
|
+
fieldsPermissions: tabFieldsPermissions,
|
|
202
|
+
i18n,
|
|
203
|
+
modifiedOnly,
|
|
204
|
+
nestingLevel: nestingLevel + 1,
|
|
205
|
+
parentIndexPath: isNamedTab ? '' : tabIndexPath,
|
|
206
|
+
parentIsLocalized: parentIsLocalized || tab.localized,
|
|
207
|
+
parentPath: isNamedTab ? tabPath : 'name' in field ? path : parentPath,
|
|
208
|
+
parentSchemaPath: isNamedTab ? tabSchemaPath : 'name' in field ? schemaPath : parentSchemaPath,
|
|
209
|
+
req,
|
|
210
|
+
selectedLocales,
|
|
211
|
+
versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,
|
|
212
|
+
versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo
|
|
213
|
+
}).versionFields,
|
|
214
|
+
label: typeof tab.label === 'function' ? tab.label({
|
|
215
|
+
i18n,
|
|
216
|
+
t: i18n.t
|
|
217
|
+
}) : tab.label
|
|
218
|
+
};
|
|
219
|
+
if (tabVersion?.fields?.length) {
|
|
220
|
+
baseVersionField.tabs.push(tabVersion);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (modifiedOnly && !baseVersionField.tabs.length) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
} else // At this point, we are dealing with a `row`, `collapsible`, array`, etc
|
|
227
|
+
if ('fields' in field) {
|
|
228
|
+
let subFieldsPermissions = undefined;
|
|
229
|
+
if ('name' in field && typeof fieldPermissions !== 'undefined') {
|
|
230
|
+
// Named fields like arrays
|
|
231
|
+
subFieldsPermissions = typeof fieldPermissions === 'boolean' ? fieldPermissions : fieldPermissions.fields;
|
|
352
232
|
} else {
|
|
353
|
-
|
|
233
|
+
// Unnamed fields like collapsible and row inherit directly from parent permissions
|
|
234
|
+
subFieldsPermissions = parentFieldsPermissions;
|
|
354
235
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
236
|
+
if (field.type === 'array' && (valueTo || valueFrom)) {
|
|
237
|
+
const maxLength = Math.max(Array.isArray(valueTo) ? valueTo.length : 0, Array.isArray(valueFrom) ? valueFrom.length : 0);
|
|
238
|
+
baseVersionField.rows = [];
|
|
239
|
+
for(let i = 0; i < maxLength; i++){
|
|
240
|
+
const fromRow = Array.isArray(valueFrom) && valueFrom?.[i] || {};
|
|
241
|
+
const toRow = Array.isArray(valueTo) && valueTo?.[i] || {};
|
|
242
|
+
const versionFields = buildVersionFields({
|
|
243
|
+
clientSchemaMap,
|
|
244
|
+
customDiffComponents,
|
|
245
|
+
entitySlug,
|
|
246
|
+
fields: field.fields,
|
|
247
|
+
fieldsPermissions: subFieldsPermissions,
|
|
248
|
+
i18n,
|
|
249
|
+
modifiedOnly,
|
|
250
|
+
nestingLevel: nestingLevel + 1,
|
|
251
|
+
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
252
|
+
parentIsLocalized: parentIsLocalized || field.localized,
|
|
253
|
+
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
254
|
+
parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,
|
|
255
|
+
req,
|
|
256
|
+
selectedLocales,
|
|
257
|
+
versionFromSiblingData: fromRow,
|
|
258
|
+
versionToSiblingData: toRow
|
|
259
|
+
}).versionFields;
|
|
260
|
+
if (versionFields?.length) {
|
|
261
|
+
baseVersionField.rows[i] = versionFields;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (!baseVersionField.rows?.length && modifiedOnly) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
366
267
|
} else {
|
|
367
|
-
|
|
268
|
+
baseVersionField.fields = buildVersionFields({
|
|
269
|
+
clientSchemaMap,
|
|
270
|
+
customDiffComponents,
|
|
271
|
+
entitySlug,
|
|
272
|
+
fields: field.fields,
|
|
273
|
+
fieldsPermissions: subFieldsPermissions,
|
|
274
|
+
i18n,
|
|
275
|
+
modifiedOnly,
|
|
276
|
+
nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,
|
|
277
|
+
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
278
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
279
|
+
parentPath: 'name' in field ? path : parentPath,
|
|
280
|
+
parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,
|
|
281
|
+
req,
|
|
282
|
+
selectedLocales,
|
|
283
|
+
versionFromSiblingData: valueFrom,
|
|
284
|
+
versionToSiblingData: valueTo
|
|
285
|
+
}).versionFields;
|
|
286
|
+
if (modifiedOnly && !baseVersionField.fields?.length) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
} else if (field.type === 'blocks') {
|
|
291
|
+
baseVersionField.rows = [];
|
|
292
|
+
const maxLength = Math.max(Array.isArray(valueTo) ? valueTo.length : 0, Array.isArray(valueFrom) ? valueFrom.length : 0);
|
|
293
|
+
for(let i = 0; i < maxLength; i++){
|
|
294
|
+
const fromRow = Array.isArray(valueFrom) && valueFrom?.[i] || {};
|
|
295
|
+
const toRow = Array.isArray(valueTo) && valueTo?.[i] || {};
|
|
296
|
+
const blockSlugToMatch = toRow?.blockType ?? fromRow?.blockType;
|
|
297
|
+
const toBlock = req.payload.blocks[blockSlugToMatch] ?? (field.blockReferences ?? field.blocks).find((block)=>typeof block !== 'string' && block.slug === blockSlugToMatch);
|
|
298
|
+
let fields = [];
|
|
299
|
+
if (toRow.blockType === fromRow.blockType) {
|
|
300
|
+
fields = toBlock.fields;
|
|
301
|
+
} else {
|
|
302
|
+
const fromBlockSlugToMatch = toRow?.blockType ?? fromRow?.blockType;
|
|
303
|
+
const fromBlock = req.payload.blocks[fromBlockSlugToMatch] ?? (field.blockReferences ?? field.blocks).find((block)=>typeof block !== 'string' && block.slug === fromBlockSlugToMatch);
|
|
304
|
+
if (fromBlock) {
|
|
305
|
+
fields = getUniqueListBy([
|
|
306
|
+
...toBlock.fields,
|
|
307
|
+
...fromBlock.fields
|
|
308
|
+
], 'name');
|
|
309
|
+
} else {
|
|
310
|
+
fields = toBlock.fields;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
let blockFieldsPermissions = undefined;
|
|
314
|
+
// fieldPermissions will be set here, as the blocks field has a name
|
|
315
|
+
if (typeof fieldPermissions === 'boolean') {
|
|
316
|
+
blockFieldsPermissions = fieldPermissions;
|
|
317
|
+
} else if (typeof fieldPermissions?.blocks === 'boolean') {
|
|
318
|
+
blockFieldsPermissions = fieldPermissions.blocks;
|
|
319
|
+
} else {
|
|
320
|
+
const permissionsBlockSpecific = fieldPermissions?.blocks?.[blockSlugToMatch];
|
|
321
|
+
if (typeof permissionsBlockSpecific === 'boolean') {
|
|
322
|
+
blockFieldsPermissions = permissionsBlockSpecific;
|
|
323
|
+
} else {
|
|
324
|
+
blockFieldsPermissions = permissionsBlockSpecific?.fields;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const versionFields = buildVersionFields({
|
|
328
|
+
clientSchemaMap,
|
|
329
|
+
customDiffComponents,
|
|
330
|
+
entitySlug,
|
|
331
|
+
fields,
|
|
332
|
+
fieldsPermissions: blockFieldsPermissions,
|
|
333
|
+
i18n,
|
|
334
|
+
modifiedOnly,
|
|
335
|
+
nestingLevel: nestingLevel + 1,
|
|
336
|
+
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
337
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
338
|
+
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
339
|
+
parentSchemaPath: ('name' in field ? schemaPath : parentSchemaPath) + '.' + toBlock.slug,
|
|
340
|
+
req,
|
|
341
|
+
selectedLocales,
|
|
342
|
+
versionFromSiblingData: fromRow,
|
|
343
|
+
versionToSiblingData: toRow
|
|
344
|
+
}).versionFields;
|
|
345
|
+
if (versionFields?.length) {
|
|
346
|
+
baseVersionField.rows[i] = versionFields;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (!baseVersionField.rows?.length && modifiedOnly) {
|
|
350
|
+
return null;
|
|
368
351
|
}
|
|
369
|
-
}
|
|
370
|
-
const versionFields = buildVersionFields({
|
|
371
|
-
clientSchemaMap,
|
|
372
|
-
customDiffComponents,
|
|
373
|
-
entitySlug,
|
|
374
|
-
fields,
|
|
375
|
-
fieldsPermissions: blockFieldsPermissions,
|
|
376
|
-
i18n,
|
|
377
|
-
modifiedOnly,
|
|
378
|
-
nestingLevel: nestingLevel + 1,
|
|
379
|
-
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
380
|
-
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
381
|
-
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
382
|
-
parentSchemaPath: ('name' in field ? schemaPath : parentSchemaPath) + '.' + toBlock.slug,
|
|
383
|
-
req,
|
|
384
|
-
selectedLocales,
|
|
385
|
-
versionFromSiblingData: fromRow,
|
|
386
|
-
versionToSiblingData: toRow
|
|
387
|
-
}).versionFields;
|
|
388
|
-
if (versionFields?.length) {
|
|
389
|
-
baseVersionField.rows[i] = versionFields;
|
|
390
|
-
}
|
|
391
352
|
}
|
|
392
|
-
|
|
393
|
-
|
|
353
|
+
const clientDiffProps = {
|
|
354
|
+
baseVersionField: {
|
|
355
|
+
...baseVersionField,
|
|
356
|
+
CustomComponent: undefined
|
|
357
|
+
},
|
|
358
|
+
/**
|
|
359
|
+
* TODO: Change to valueFrom in 4.0
|
|
360
|
+
*/ comparisonValue: valueFrom,
|
|
361
|
+
/**
|
|
362
|
+
* @deprecated remove in 4.0. Each field should handle its own diffing logic
|
|
363
|
+
*/ diffMethod: 'diffWordsWithSpace',
|
|
364
|
+
field: clientField,
|
|
365
|
+
fieldPermissions: typeof fieldPermissions === 'undefined' ? parentFieldsPermissions : fieldPermissions,
|
|
366
|
+
parentIsLocalized,
|
|
367
|
+
nestingLevel: nestingLevel ? nestingLevel : undefined,
|
|
368
|
+
/**
|
|
369
|
+
* TODO: Change to valueTo in 4.0
|
|
370
|
+
*/ versionValue: valueTo
|
|
371
|
+
};
|
|
372
|
+
if (locale) {
|
|
373
|
+
clientDiffProps.locale = locale;
|
|
394
374
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
nestingLevel: nestingLevel ? nestingLevel : undefined,
|
|
413
|
-
/**
|
|
414
|
-
* TODO: Change to valueTo in 4.0
|
|
415
|
-
*/
|
|
416
|
-
versionValue: valueTo
|
|
417
|
-
};
|
|
418
|
-
if (locale) {
|
|
419
|
-
clientDiffProps.locale = locale;
|
|
420
|
-
}
|
|
421
|
-
const serverDiffProps = {
|
|
422
|
-
...clientDiffProps,
|
|
423
|
-
clientField,
|
|
424
|
-
field,
|
|
425
|
-
i18n,
|
|
426
|
-
req,
|
|
427
|
-
selectedLocales
|
|
428
|
-
};
|
|
429
|
-
baseVersionField.CustomComponent = RenderServerComponent({
|
|
430
|
-
clientProps: clientDiffProps,
|
|
431
|
-
Component: CustomComponent,
|
|
432
|
-
Fallback: DefaultComponent,
|
|
433
|
-
importMap: req.payload.importMap,
|
|
434
|
-
key: 'diff component',
|
|
435
|
-
serverProps: serverDiffProps
|
|
436
|
-
});
|
|
437
|
-
return baseVersionField;
|
|
375
|
+
const serverDiffProps = {
|
|
376
|
+
...clientDiffProps,
|
|
377
|
+
clientField,
|
|
378
|
+
field,
|
|
379
|
+
i18n,
|
|
380
|
+
req,
|
|
381
|
+
selectedLocales
|
|
382
|
+
};
|
|
383
|
+
baseVersionField.CustomComponent = RenderServerComponent({
|
|
384
|
+
clientProps: clientDiffProps,
|
|
385
|
+
Component: CustomComponent,
|
|
386
|
+
Fallback: DefaultComponent,
|
|
387
|
+
importMap: req.payload.importMap,
|
|
388
|
+
key: 'diff component',
|
|
389
|
+
serverProps: serverDiffProps
|
|
390
|
+
});
|
|
391
|
+
return baseVersionField;
|
|
438
392
|
};
|
|
393
|
+
|
|
439
394
|
//# sourceMappingURL=buildVersionFields.js.map
|