@payloadcms/next 3.0.0-beta.90 → 3.0.0-beta.92
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/cjs/withPayload.js +111 -0
- package/dist/cjs/withPayload.js.map +1 -0
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +100 -35
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +74 -63
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +86 -79
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +32 -13
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +24 -23
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/EmailAndUsername/index.js +107 -75
- package/dist/elements/EmailAndUsername/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.js +150 -83
- package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +119 -101
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
- package/dist/elements/Logo/index.js +36 -21
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +41 -13
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +48 -16
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/index.client.js +149 -76
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +56 -50
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/exports/layouts.js +0 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.js +0 -1
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/templates.js +0 -1
- package/dist/exports/templates.js.map +1 -1
- package/dist/exports/utilities.js +0 -1
- package/dist/exports/utilities.js.map +1 -1
- package/dist/exports/views.js +0 -1
- package/dist/exports/views.js.map +1 -1
- package/dist/fetchAPI-multipart/fileFactory.js +35 -34
- package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
- package/dist/fetchAPI-multipart/handlers.js +77 -78
- package/dist/fetchAPI-multipart/handlers.js.map +1 -1
- package/dist/fetchAPI-multipart/index.js +33 -31
- package/dist/fetchAPI-multipart/index.js.map +1 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
- package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.js +158 -141
- package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/fetchAPI-multipart/processNested.js +23 -21
- package/dist/fetchAPI-multipart/processNested.js.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +16 -17
- package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
- package/dist/fetchAPI-multipart/utilities.js +166 -166
- package/dist/fetchAPI-multipart/utilities.js.map +1 -1
- package/dist/fetchAPI-stream-file/index.js +19 -17
- package/dist/fetchAPI-stream-file/index.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/index.js +118 -115
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.js +109 -103
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/index.js +0 -1
- package/dist/routes/graphql/index.js.map +1 -1
- package/dist/routes/graphql/playground.js +23 -24
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/index.js +0 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/rest/auth/access.js +22 -21
- package/dist/routes/rest/auth/access.js.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.js +29 -25
- package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
- package/dist/routes/rest/auth/init.js +16 -14
- package/dist/routes/rest/auth/init.js.map +1 -1
- package/dist/routes/rest/auth/login.js +43 -38
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/logout.js +31 -27
- package/dist/routes/rest/auth/logout.js.map +1 -1
- package/dist/routes/rest/auth/me.js +23 -21
- package/dist/routes/rest/auth/me.js.map +1 -1
- package/dist/routes/rest/auth/refresh.js +31 -27
- package/dist/routes/rest/auth/refresh.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +43 -38
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/resetPassword.js +38 -33
- package/dist/routes/rest/auth/resetPassword.js.map +1 -1
- package/dist/routes/rest/auth/unlock.js +27 -23
- package/dist/routes/rest/auth/unlock.js.map +1 -1
- package/dist/routes/rest/auth/verifyEmail.js +22 -17
- package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
- package/dist/routes/rest/buildFormState.js +38 -37
- package/dist/routes/rest/buildFormState.js.map +1 -1
- package/dist/routes/rest/checkEndpoints.js +11 -9
- package/dist/routes/rest/checkEndpoints.js.map +1 -1
- package/dist/routes/rest/collections/count.js +15 -11
- package/dist/routes/rest/collections/count.js.map +1 -1
- package/dist/routes/rest/collections/create.js +30 -26
- package/dist/routes/rest/collections/create.js.map +1 -1
- package/dist/routes/rest/collections/delete.js +40 -35
- package/dist/routes/rest/collections/delete.js.map +1 -1
- package/dist/routes/rest/collections/deleteByID.js +36 -31
- package/dist/routes/rest/collections/deleteByID.js.map +1 -1
- package/dist/routes/rest/collections/docAccess.js +17 -14
- package/dist/routes/rest/collections/docAccess.js.map +1 -1
- package/dist/routes/rest/collections/duplicate.js +36 -31
- package/dist/routes/rest/collections/duplicate.js.map +1 -1
- package/dist/routes/rest/collections/find.js +29 -20
- package/dist/routes/rest/collections/find.js.map +1 -1
- package/dist/routes/rest/collections/findByID.js +28 -23
- package/dist/routes/rest/collections/findByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.js +27 -22
- package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersions.js +27 -19
- package/dist/routes/rest/collections/findVersions.js.map +1 -1
- package/dist/routes/rest/collections/preview.js +39 -34
- package/dist/routes/rest/collections/preview.js.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +32 -27
- package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
- package/dist/routes/rest/collections/update.js +43 -37
- package/dist/routes/rest/collections/update.js.map +1 -1
- package/dist/routes/rest/collections/updateByID.js +38 -33
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js +46 -44
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.js +52 -49
- package/dist/routes/rest/files/getFile.js.map +1 -1
- package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
- package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
- package/dist/routes/rest/globals/docAccess.js +15 -13
- package/dist/routes/rest/globals/docAccess.js.map +1 -1
- package/dist/routes/rest/globals/findOne.js +22 -18
- package/dist/routes/rest/globals/findOne.js.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.js +22 -17
- package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
- package/dist/routes/rest/globals/findVersions.js +27 -19
- package/dist/routes/rest/globals/findVersions.js.map +1 -1
- package/dist/routes/rest/globals/preview.js +38 -34
- package/dist/routes/rest/globals/preview.js.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +27 -22
- package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
- package/dist/routes/rest/globals/update.js +32 -28
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.js +651 -626
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.js +74 -76
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +60 -59
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.js +102 -95
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/types.js +1 -2
- package/dist/routes/rest/types.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +14 -11
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
- package/dist/scss/app.scss +4 -4
- package/dist/scss/type.scss +4 -4
- package/dist/templates/Default/NavHamburger/index.js +18 -6
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +42 -13
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.js +54 -47
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Minimal/index.js +16 -16
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +40 -35
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +44 -36
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequest.js +85 -74
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +13 -11
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.d.ts +1 -1
- package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
- package/dist/utilities/getPayloadHMR.js +91 -94
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getRequestLanguage.js +16 -13
- package/dist/utilities/getRequestLanguage.js.map +1 -1
- package/dist/utilities/getRequestLocales.js +27 -24
- package/dist/utilities/getRequestLocales.js.map +1 -1
- package/dist/utilities/getRequestTheme.js +16 -16
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/headersWithCors.js +21 -30
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +46 -42
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +45 -32
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.js +146 -120
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/shared.js +26 -25
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/initPage/types.js +1 -2
- package/dist/utilities/initPage/types.js.map +1 -1
- package/dist/utilities/mergeHeaders.js +8 -9
- package/dist/utilities/mergeHeaders.js.map +1 -1
- package/dist/utilities/meta.js +66 -68
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/timestamp.js +4 -5
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +38 -11
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +124 -112
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.js +190 -202
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +2 -3
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/meta.js +22 -18
- package/dist/views/API/meta.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +45 -12
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +21 -28
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +51 -30
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.client.js +32 -16
- package/dist/views/Account/index.client.js.map +1 -1
- package/dist/views/Account/index.js +99 -68
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Account/meta.js +12 -8
- package/dist/views/Account/meta.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +95 -57
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +42 -28
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/meta.js +12 -8
- package/dist/views/CreateFirstUser/meta.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +132 -115
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +61 -52
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Dashboard/meta.js +16 -12
- package/dist/views/Dashboard/meta.js.map +1 -1
- package/dist/views/Document/getCustomViewByKey.js +2 -3
- package/dist/views/Document/getCustomViewByKey.js.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.js +30 -27
- package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +34 -28
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +83 -74
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +113 -107
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +309 -331
- package/dist/views/Document/getViewsFromConfig.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +193 -159
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/meta.js +1 -2
- package/dist/views/Document/meta.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +118 -132
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.js +293 -196
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js +1 -2
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
- package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
- package/dist/views/Edit/Default/index.js +190 -187
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/Edit/Default/types.js +1 -2
- package/dist/views/Edit/Default/types.js.map +1 -1
- package/dist/views/Edit/index.client.js +45 -21
- package/dist/views/Edit/index.client.js.map +1 -1
- package/dist/views/Edit/index.js +2 -3
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/meta.js +43 -35
- package/dist/views/Edit/meta.js.map +1 -1
- package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
- package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -94
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +59 -46
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/ForgotPassword/meta.js +12 -8
- package/dist/views/ForgotPassword/meta.js.map +1 -1
- package/dist/views/List/Default/index.js +348 -208
- package/dist/views/List/Default/index.js.map +1 -1
- package/dist/views/List/Default/types.js +1 -2
- package/dist/views/List/Default/types.js.map +1 -1
- package/dist/views/List/index.js +153 -137
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/meta.js +20 -17
- package/dist/views/List/meta.js.map +1 -1
- package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
- package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
- package/dist/views/LivePreview/Context/context.d.ts +2 -1
- package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
- package/dist/views/LivePreview/Context/context.js +39 -36
- package/dist/views/LivePreview/Context/context.js.map +1 -1
- package/dist/views/LivePreview/Context/index.js +134 -142
- package/dist/views/LivePreview/Context/index.js.map +1 -1
- package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
- package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
- package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Device/index.js +78 -71
- package/dist/views/LivePreview/Device/index.js.map +1 -1
- package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
- package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
- package/dist/views/LivePreview/IFrame/index.js +21 -16
- package/dist/views/LivePreview/IFrame/index.js.map +1 -1
- package/dist/views/LivePreview/Preview/index.js +145 -92
- package/dist/views/LivePreview/Preview/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.js +136 -115
- package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
- package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/index.js +82 -50
- package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
- package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
- package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
- package/dist/views/LivePreview/index.client.js +316 -160
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/index.js +67 -55
- package/dist/views/LivePreview/index.js.map +1 -1
- package/dist/views/LivePreview/meta.js +14 -9
- package/dist/views/LivePreview/meta.js.map +1 -1
- package/dist/views/LivePreview/usePopupWindow.js +91 -94
- package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +83 -39
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +130 -66
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.js +77 -54
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/meta.js +12 -8
- package/dist/views/Login/meta.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +84 -39
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +29 -16
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/meta.js +11 -7
- package/dist/views/Logout/meta.js.map +1 -1
- package/dist/views/NotFound/index.client.js +78 -40
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +47 -37
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/meta.js +9 -7
- package/dist/views/NotFound/meta.js.map +1 -1
- package/dist/views/ResetPassword/index.client.js +97 -59
- package/dist/views/ResetPassword/index.client.js.map +1 -1
- package/dist/views/ResetPassword/index.js +68 -53
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/meta.js +12 -8
- package/dist/views/ResetPassword/meta.js.map +1 -1
- package/dist/views/Root/generateCustomViewMetadata.js +21 -19
- package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
- package/dist/views/Root/getCustomViewByRoute.js +42 -31
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +162 -156
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.js +99 -82
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +18 -13
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/meta.js +141 -136
- package/dist/views/Root/meta.js.map +1 -1
- package/dist/views/Unauthorized/index.js +32 -22
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/meta.js +12 -8
- package/dist/views/Unauthorized/meta.js.map +1 -1
- package/dist/views/Verify/index.js +58 -43
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/meta.js +12 -8
- package/dist/views/Verify/meta.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +147 -103
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.js +198 -114
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/types.js +1 -2
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/Label/index.js +6 -5
- package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +65 -69
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +34 -31
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +108 -78
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +40 -38
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +34 -31
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +20 -21
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +102 -97
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
- package/dist/views/Version/Restore/index.js +107 -110
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/types.js +1 -2
- package/dist/views/Version/Restore/types.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +130 -138
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/types.js +1 -2
- package/dist/views/Version/SelectComparison/types.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +58 -30
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/SelectLocales/types.js +1 -2
- package/dist/views/Version/SelectLocales/types.js.map +1 -1
- package/dist/views/Version/index.js +126 -105
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/meta.js +49 -43
- package/dist/views/Version/meta.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +87 -82
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +69 -42
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +17 -5
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +33 -29
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/dist/views/Versions/index.client.js +80 -77
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +148 -127
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/meta.js +43 -37
- package/dist/views/Versions/meta.js.map +1 -1
- package/dist/views/Versions/types.js +1 -2
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/withPayload.js +83 -117
- package/dist/withPayload.js.map +1 -1
- package/package.json +20 -10
- package/dist/cjs/withPayload.cjs +0 -145
- package/dist/cjs/withPayload.cjs.map +0 -1
|
@@ -1,107 +1,112 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
4
|
import { fieldAffectsData } from 'payload/shared';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import Nested from './fields/Nested/index.js';
|
|
6
7
|
import { diffMethods } from './fields/diffMethods.js';
|
|
7
8
|
const baseClass = 'render-field-diffs';
|
|
8
|
-
const RenderFieldsToDiff = ({
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
9
|
+
const RenderFieldsToDiff = ({
|
|
10
|
+
comparison,
|
|
11
|
+
diffComponents: __diffComponents,
|
|
12
|
+
fieldPermissions,
|
|
13
|
+
fields,
|
|
14
|
+
i18n,
|
|
15
|
+
locales,
|
|
16
|
+
version
|
|
17
|
+
}) => {
|
|
18
|
+
// typing it as `as typeof _diffComponents` here ensures the TField generics of DiffComponentProps are respected.
|
|
19
|
+
// Without it, you could pass a UI field to the Tabs component, without it erroring
|
|
20
|
+
const diffComponents = __diffComponents;
|
|
21
|
+
return /*#__PURE__*/_jsx("div", {
|
|
22
|
+
className: baseClass,
|
|
23
|
+
children: fields?.map((field, i) => {
|
|
24
|
+
if ('name' in field && field.name === 'id') return null;
|
|
25
|
+
const Component = diffComponents[field.type];
|
|
26
|
+
const isRichText = field.type === 'richText';
|
|
27
|
+
const diffMethod = diffMethods[field.type] || 'CHARS';
|
|
28
|
+
if (Component) {
|
|
29
|
+
if (fieldAffectsData(field)) {
|
|
30
|
+
const fieldName = field.name;
|
|
31
|
+
const valueIsObject = field.type === 'code' || field.type === 'json';
|
|
32
|
+
const versionValue = valueIsObject ? JSON.stringify(version?.[fieldName]) : version?.[fieldName];
|
|
33
|
+
const comparisonValue = valueIsObject ? JSON.stringify(comparison?.[fieldName]) : comparison?.[fieldName];
|
|
34
|
+
const hasPermission = fieldPermissions?.[fieldName]?.read?.permission;
|
|
35
|
+
const subFieldPermissions = fieldPermissions?.[fieldName]?.fields;
|
|
36
|
+
if (hasPermission === false) return null;
|
|
37
|
+
const baseCellProps = {
|
|
38
|
+
comparison: comparisonValue,
|
|
39
|
+
diffComponents,
|
|
40
|
+
diffMethod,
|
|
41
|
+
field,
|
|
42
|
+
fieldPermissions: subFieldPermissions,
|
|
43
|
+
fields: 'fields' in field ? field?.fields : fields,
|
|
44
|
+
i18n,
|
|
45
|
+
isRichText,
|
|
46
|
+
locales,
|
|
47
|
+
version: versionValue
|
|
48
|
+
};
|
|
49
|
+
if (field.localized) {
|
|
50
|
+
return /*#__PURE__*/_jsx("div", {
|
|
51
|
+
className: `${baseClass}__field`,
|
|
52
|
+
children: locales.map((locale, index) => {
|
|
53
|
+
const versionLocaleValue = versionValue?.[locale];
|
|
54
|
+
const comparisonLocaleValue = comparisonValue?.[locale];
|
|
55
|
+
const cellProps = {
|
|
56
|
+
...baseCellProps,
|
|
57
|
+
comparison: comparisonLocaleValue,
|
|
58
|
+
version: versionLocaleValue
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/_jsx("div", {
|
|
61
|
+
className: `${baseClass}__locale`,
|
|
62
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
63
|
+
className: `${baseClass}__locale-value`,
|
|
64
|
+
children: /*#__PURE__*/_jsx(Component, {
|
|
65
|
+
...cellProps,
|
|
66
|
+
locale: locale
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
}, [locale, index].join('-'));
|
|
70
|
+
})
|
|
71
|
+
}, i);
|
|
72
|
+
}
|
|
73
|
+
return /*#__PURE__*/_jsx("div", {
|
|
74
|
+
className: `${baseClass}__field`,
|
|
75
|
+
children: /*#__PURE__*/_jsx(Component, {
|
|
76
|
+
...baseCellProps
|
|
77
|
+
})
|
|
78
|
+
}, i);
|
|
79
|
+
}
|
|
80
|
+
if (field.type === 'tabs' && 'fields' in field) {
|
|
81
|
+
const Tabs = diffComponents.tabs;
|
|
82
|
+
return /*#__PURE__*/_jsx(Tabs, {
|
|
83
|
+
comparison: comparison,
|
|
84
|
+
diffComponents: diffComponents,
|
|
85
|
+
field: field,
|
|
86
|
+
fields: [],
|
|
87
|
+
i18n: i18n,
|
|
88
|
+
locales: locales,
|
|
89
|
+
version: version
|
|
90
|
+
}, i);
|
|
91
|
+
}
|
|
92
|
+
// At this point, we are dealing with a `row`, etc
|
|
93
|
+
if ('fields' in field) {
|
|
94
|
+
return /*#__PURE__*/_jsx(Nested, {
|
|
95
|
+
comparison: comparison,
|
|
96
|
+
diffComponents: diffComponents,
|
|
97
|
+
disableGutter: true,
|
|
98
|
+
field: field,
|
|
99
|
+
fields: field.fields,
|
|
100
|
+
i18n: i18n,
|
|
101
|
+
locales: locales,
|
|
102
|
+
permissions: fieldPermissions,
|
|
103
|
+
version: version
|
|
104
|
+
}, i);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
})
|
|
109
|
+
});
|
|
104
110
|
};
|
|
105
111
|
export default RenderFieldsToDiff;
|
|
106
|
-
|
|
107
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/RenderFieldsToDiff/index.tsx"],"sourcesContent":["'use client'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { UIFieldClient } from 'payload'\nimport { fieldAffectsData } from 'payload/shared'\nimport React from 'react'\n\nimport type { diffComponents as _diffComponents } from './fields/index.js'\nimport type { FieldDiffProps, Props } from './types.js'\n\nimport Nested from './fields/Nested/index.js'\nimport { diffMethods } from './fields/diffMethods.js'\nimport './index.scss'\n\nconst baseClass = 'render-field-diffs'\n\nconst RenderFieldsToDiff: React.FC<Props> = ({\n comparison,\n diffComponents: __diffComponents,\n fieldPermissions,\n fields,\n i18n,\n locales,\n version,\n}) => {\n // typing it as `as typeof _diffComponents` here ensures the TField generics of DiffComponentProps are respected.\n // Without it, you could pass a UI field to the Tabs component, without it erroring\n const diffComponents: typeof _diffComponents = __diffComponents as typeof _diffComponents\n return (\n <div className={baseClass}>\n {fields?.map((field, i) => {\n if ('name' in field && field.name === 'id') return null\n\n const Component = diffComponents[field.type]\n\n const isRichText = field.type === 'richText'\n const diffMethod: DiffMethod = diffMethods[field.type] || 'CHARS'\n\n if (Component) {\n if (fieldAffectsData(field)) {\n const fieldName = field.name\n const valueIsObject = field.type === 'code' || field.type === 'json'\n\n const versionValue = valueIsObject\n ? JSON.stringify(version?.[fieldName])\n : version?.[fieldName]\n\n const comparisonValue = valueIsObject\n ? JSON.stringify(comparison?.[fieldName])\n : comparison?.[fieldName]\n\n const hasPermission = fieldPermissions?.[fieldName]?.read?.permission\n\n const subFieldPermissions = fieldPermissions?.[fieldName]?.fields\n\n if (hasPermission === false) return null\n\n const baseCellProps: FieldDiffProps = {\n comparison: comparisonValue,\n diffComponents,\n diffMethod,\n field,\n fieldPermissions: subFieldPermissions,\n fields: 'fields' in field ? field?.fields : fields,\n i18n,\n isRichText,\n locales,\n version: versionValue,\n }\n\n if (field.localized) {\n return (\n <div className={`${baseClass}__field`} key={i}>\n {locales.map((locale, index) => {\n const versionLocaleValue = versionValue?.[locale]\n const comparisonLocaleValue = comparisonValue?.[locale]\n\n const cellProps = {\n ...baseCellProps,\n comparison: comparisonLocaleValue,\n version: versionLocaleValue,\n }\n\n return (\n <div className={`${baseClass}__locale`} key={[locale, index].join('-')}>\n <div className={`${baseClass}__locale-value`}>\n <Component {...cellProps} locale={locale} />\n </div>\n </div>\n )\n })}\n </div>\n )\n }\n\n return (\n <div className={`${baseClass}__field`} key={i}>\n <Component {...baseCellProps} />\n </div>\n )\n }\n\n if (field.type === 'tabs' && 'fields' in field) {\n const Tabs = diffComponents.tabs\n\n return (\n <Tabs\n comparison={comparison}\n diffComponents={diffComponents}\n field={field}\n fields={[]}\n i18n={i18n}\n key={i}\n locales={locales}\n version={version}\n />\n )\n }\n\n // At this point, we are dealing with a `row`, etc\n if ('fields' in field) {\n return (\n <Nested\n comparison={comparison}\n diffComponents={diffComponents}\n disableGutter\n field={field}\n fields={field.fields}\n i18n={i18n}\n key={i}\n locales={locales}\n permissions={fieldPermissions}\n version={version}\n />\n )\n }\n }\n\n return null\n })}\n </div>\n )\n}\n\nexport default RenderFieldsToDiff\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["fieldAffectsData","React","Nested","diffMethods","baseClass","RenderFieldsToDiff","comparison","diffComponents","__diffComponents","fieldPermissions","fields","i18n","locales","version","_jsx","className","map","field","i","name","Component","type","isRichText","diffMethod","fieldName","valueIsObject","versionValue","JSON","stringify","comparisonValue","hasPermission","read","permission","subFieldPermissions","baseCellProps","localized","locale","index","versionLocaleValue","comparisonLocaleValue","cellProps","join","Tabs","tabs","disableGutter","permissions"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/index.tsx"],"sourcesContent":["'use client'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { UIFieldClient } from 'payload'\nimport { fieldAffectsData } from 'payload/shared'\nimport React from 'react'\n\nimport type { diffComponents as _diffComponents } from './fields/index.js'\nimport type { FieldDiffProps, Props } from './types.js'\n\nimport Nested from './fields/Nested/index.js'\nimport { diffMethods } from './fields/diffMethods.js'\nimport './index.scss'\n\nconst baseClass = 'render-field-diffs'\n\nconst RenderFieldsToDiff: React.FC<Props> = ({\n comparison,\n diffComponents: __diffComponents,\n fieldPermissions,\n fields,\n i18n,\n locales,\n version,\n}) => {\n // typing it as `as typeof _diffComponents` here ensures the TField generics of DiffComponentProps are respected.\n // Without it, you could pass a UI field to the Tabs component, without it erroring\n const diffComponents: typeof _diffComponents = __diffComponents as typeof _diffComponents\n return (\n <div className={baseClass}>\n {fields?.map((field, i) => {\n if ('name' in field && field.name === 'id') return null\n\n const Component = diffComponents[field.type]\n\n const isRichText = field.type === 'richText'\n const diffMethod: DiffMethod = diffMethods[field.type] || 'CHARS'\n\n if (Component) {\n if (fieldAffectsData(field)) {\n const fieldName = field.name\n const valueIsObject = field.type === 'code' || field.type === 'json'\n\n const versionValue = valueIsObject\n ? JSON.stringify(version?.[fieldName])\n : version?.[fieldName]\n\n const comparisonValue = valueIsObject\n ? JSON.stringify(comparison?.[fieldName])\n : comparison?.[fieldName]\n\n const hasPermission = fieldPermissions?.[fieldName]?.read?.permission\n\n const subFieldPermissions = fieldPermissions?.[fieldName]?.fields\n\n if (hasPermission === false) return null\n\n const baseCellProps: FieldDiffProps = {\n comparison: comparisonValue,\n diffComponents,\n diffMethod,\n field,\n fieldPermissions: subFieldPermissions,\n fields: 'fields' in field ? field?.fields : fields,\n i18n,\n isRichText,\n locales,\n version: versionValue,\n }\n\n if (field.localized) {\n return (\n <div className={`${baseClass}__field`} key={i}>\n {locales.map((locale, index) => {\n const versionLocaleValue = versionValue?.[locale]\n const comparisonLocaleValue = comparisonValue?.[locale]\n\n const cellProps = {\n ...baseCellProps,\n comparison: comparisonLocaleValue,\n version: versionLocaleValue,\n }\n\n return (\n <div className={`${baseClass}__locale`} key={[locale, index].join('-')}>\n <div className={`${baseClass}__locale-value`}>\n <Component {...cellProps} locale={locale} />\n </div>\n </div>\n )\n })}\n </div>\n )\n }\n\n return (\n <div className={`${baseClass}__field`} key={i}>\n <Component {...baseCellProps} />\n </div>\n )\n }\n\n if (field.type === 'tabs' && 'fields' in field) {\n const Tabs = diffComponents.tabs\n\n return (\n <Tabs\n comparison={comparison}\n diffComponents={diffComponents}\n field={field}\n fields={[]}\n i18n={i18n}\n key={i}\n locales={locales}\n version={version}\n />\n )\n }\n\n // At this point, we are dealing with a `row`, etc\n if ('fields' in field) {\n return (\n <Nested\n comparison={comparison}\n diffComponents={diffComponents}\n disableGutter\n field={field}\n fields={field.fields}\n i18n={i18n}\n key={i}\n locales={locales}\n permissions={fieldPermissions}\n version={version}\n />\n )\n }\n }\n\n return null\n })}\n </div>\n )\n}\n\nexport default RenderFieldsToDiff\n"],"mappings":"AAAA;;;AAIA,SAASA,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,MAAW;AAKlB,OAAOC,MAAA,MAAY;AACnB,SAASC,WAAW,QAAQ;AAG5B,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAsCA,CAAC;EAC3CC,UAAU;EACVC,cAAA,EAAgBC,gBAAgB;EAChCC,gBAAgB;EAChBC,MAAM;EACNC,IAAI;EACJC,OAAO;EACPC;AAAO,CACR;EACC;EACA;EACA,MAAMN,cAAA,GAAyCC,gBAAA;EAC/C,oBACEM,IAAA,CAAC;IAAIC,SAAA,EAAWX,SAAA;cACbM,MAAA,EAAQM,GAAA,CAAI,CAACC,KAAA,EAAOC,CAAA;MACnB,IAAI,UAAUD,KAAA,IAASA,KAAA,CAAME,IAAI,KAAK,MAAM,OAAO;MAEnD,MAAMC,SAAA,GAAYb,cAAc,CAACU,KAAA,CAAMI,IAAI,CAAC;MAE5C,MAAMC,UAAA,GAAaL,KAAA,CAAMI,IAAI,KAAK;MAClC,MAAME,UAAA,GAAyBpB,WAAW,CAACc,KAA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,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/RenderFieldsToDiff/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientField, FieldPermissions } from 'payload'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport type { DiffComponents } from './fields/types.js'\n\nexport type Props = {\n readonly comparison: Record<string, any>\n readonly diffComponents: DiffComponents\n readonly fieldPermissions: Record<string, FieldPermissions>\n readonly fields: ClientField[]\n readonly i18n: I18nClient\n readonly locales: string[]\n readonly version: Record<string, any>\n}\n\nexport type FieldDiffProps = {\n diffMethod: DiffMethod\n field: ClientField\n isRichText: boolean\n} & Props\n"],"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/views/Version/RenderFieldsToDiff/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientField, FieldPermissions } from 'payload'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport type { DiffComponents } from './fields/types.js'\n\nexport type Props = {\n readonly comparison: Record<string, any>\n readonly diffComponents: DiffComponents\n readonly fieldPermissions: Record<string, FieldPermissions>\n readonly fields: ClientField[]\n readonly i18n: I18nClient\n readonly locales: string[]\n readonly version: Record<string, any>\n}\n\nexport type FieldDiffProps = {\n diffMethod: DiffMethod\n field: ClientField\n isRichText: boolean\n} & Props\n"],"mappings":"AAgBA","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
2
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { getTranslation } from '@payloadcms/translations';
|
|
4
5
|
import { Button, ChevronIcon, Modal, Pill, Popup, PopupList, useConfig, useModal, useTranslation } from '@payloadcms/ui';
|
|
@@ -9,118 +10,114 @@ import { toast } from 'sonner';
|
|
|
9
10
|
import { MinimalTemplate } from '../../../templates/Minimal/index.js';
|
|
10
11
|
const baseClass = 'restore-version';
|
|
11
12
|
const modalSlug = 'restore-version';
|
|
12
|
-
const Restore = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
adminRoute,
|
|
30
|
-
path: `/collections/${collectionSlug}/${originalDocID}`
|
|
31
|
-
});
|
|
13
|
+
const Restore = ({
|
|
14
|
+
className,
|
|
15
|
+
collectionSlug,
|
|
16
|
+
globalSlug,
|
|
17
|
+
label,
|
|
18
|
+
originalDocID,
|
|
19
|
+
status,
|
|
20
|
+
versionDate,
|
|
21
|
+
versionID
|
|
22
|
+
}) => {
|
|
23
|
+
const {
|
|
24
|
+
config: {
|
|
25
|
+
routes: {
|
|
26
|
+
admin: adminRoute,
|
|
27
|
+
api: apiRoute
|
|
28
|
+
},
|
|
29
|
+
serverURL
|
|
32
30
|
}
|
|
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
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
64
|
-
className: [
|
|
65
|
-
baseClass,
|
|
66
|
-
className
|
|
67
|
-
].filter(Boolean).join(' '),
|
|
68
|
-
children: [
|
|
69
|
-
/*#__PURE__*/ _jsx(Pill, {
|
|
70
|
-
className: [
|
|
71
|
-
canRestoreAsDraft && `${baseClass}__button`
|
|
72
|
-
].filter(Boolean).join(' '),
|
|
73
|
-
onClick: ()=>toggleModal(modalSlug),
|
|
74
|
-
children: t('version:restoreThisVersion')
|
|
75
|
-
}),
|
|
76
|
-
canRestoreAsDraft && /*#__PURE__*/ _jsx(Popup, {
|
|
77
|
-
button: /*#__PURE__*/ _jsx(Pill, {
|
|
78
|
-
className: `${baseClass}__chevron`,
|
|
79
|
-
children: /*#__PURE__*/ _jsx(ChevronIcon, {})
|
|
80
|
-
}),
|
|
81
|
-
caret: false,
|
|
82
|
-
render: ()=>/*#__PURE__*/ _jsx(PopupList.ButtonGroup, {
|
|
83
|
-
children: /*#__PURE__*/ _jsx(PopupList.Button, {
|
|
84
|
-
onClick: ()=>[
|
|
85
|
-
setDraft(true),
|
|
86
|
-
toggleModal(modalSlug)
|
|
87
|
-
],
|
|
88
|
-
children: t('version:restoreAsDraft')
|
|
89
|
-
})
|
|
90
|
-
}),
|
|
91
|
-
size: "large",
|
|
92
|
-
verticalAlign: "bottom"
|
|
93
|
-
})
|
|
94
|
-
]
|
|
95
|
-
}),
|
|
96
|
-
/*#__PURE__*/ _jsx(Modal, {
|
|
97
|
-
className: `${baseClass}__modal`,
|
|
98
|
-
slug: modalSlug,
|
|
99
|
-
children: /*#__PURE__*/ _jsxs(MinimalTemplate, {
|
|
100
|
-
className: `${baseClass}__modal-template`,
|
|
101
|
-
children: [
|
|
102
|
-
/*#__PURE__*/ _jsx("h1", {
|
|
103
|
-
children: t('version:confirmVersionRestoration')
|
|
104
|
-
}),
|
|
105
|
-
/*#__PURE__*/ _jsx("p", {
|
|
106
|
-
children: restoreMessage
|
|
107
|
-
}),
|
|
108
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
109
|
-
buttonStyle: "secondary",
|
|
110
|
-
onClick: processing ? undefined : ()=>toggleModal(modalSlug),
|
|
111
|
-
type: "button",
|
|
112
|
-
children: t('general:cancel')
|
|
113
|
-
}),
|
|
114
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
115
|
-
onClick: processing ? undefined : ()=>void handleRestore(),
|
|
116
|
-
children: processing ? t('version:restoring') : t('general:confirm')
|
|
117
|
-
})
|
|
118
|
-
]
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
]
|
|
31
|
+
} = useConfig();
|
|
32
|
+
const {
|
|
33
|
+
toggleModal
|
|
34
|
+
} = useModal();
|
|
35
|
+
const [processing, setProcessing] = useState(false);
|
|
36
|
+
const router = useRouter();
|
|
37
|
+
const {
|
|
38
|
+
i18n,
|
|
39
|
+
t
|
|
40
|
+
} = useTranslation();
|
|
41
|
+
const [draft, setDraft] = useState(false);
|
|
42
|
+
const restoreMessage = t('version:aboutToRestoreGlobal', {
|
|
43
|
+
label: getTranslation(label, i18n),
|
|
44
|
+
versionDate
|
|
45
|
+
});
|
|
46
|
+
let fetchURL = `${serverURL}${apiRoute}`;
|
|
47
|
+
let redirectURL;
|
|
48
|
+
const canRestoreAsDraft = status !== 'draft';
|
|
49
|
+
if (collectionSlug) {
|
|
50
|
+
fetchURL = `${fetchURL}/${collectionSlug}/versions/${versionID}?draft=${draft}`;
|
|
51
|
+
redirectURL = formatAdminURL({
|
|
52
|
+
adminRoute,
|
|
53
|
+
path: `/collections/${collectionSlug}/${originalDocID}`
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (globalSlug) {
|
|
57
|
+
fetchURL = `${fetchURL}/globals/${globalSlug}/versions/${versionID}?draft=${draft}`;
|
|
58
|
+
redirectURL = formatAdminURL({
|
|
59
|
+
adminRoute,
|
|
60
|
+
path: `/globals/${globalSlug}`
|
|
122
61
|
});
|
|
62
|
+
}
|
|
63
|
+
const handleRestore = useCallback(async () => {
|
|
64
|
+
setProcessing(true);
|
|
65
|
+
const res = await requests.post(fetchURL, {
|
|
66
|
+
headers: {
|
|
67
|
+
'Accept-Language': i18n.language
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (res.status === 200) {
|
|
71
|
+
const json = await res.json();
|
|
72
|
+
toast.success(json.message);
|
|
73
|
+
router.push(redirectURL);
|
|
74
|
+
} else {
|
|
75
|
+
toast.error(t('version:problemRestoringVersion'));
|
|
76
|
+
}
|
|
77
|
+
}, [fetchURL, redirectURL, t, i18n, router]);
|
|
78
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
79
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
80
|
+
className: [baseClass, className].filter(Boolean).join(' '),
|
|
81
|
+
children: [/*#__PURE__*/_jsx(Pill, {
|
|
82
|
+
className: [canRestoreAsDraft && `${baseClass}__button`].filter(Boolean).join(' '),
|
|
83
|
+
onClick: () => toggleModal(modalSlug),
|
|
84
|
+
children: t('version:restoreThisVersion')
|
|
85
|
+
}), canRestoreAsDraft && /*#__PURE__*/_jsx(Popup, {
|
|
86
|
+
button: /*#__PURE__*/_jsx(Pill, {
|
|
87
|
+
className: `${baseClass}__chevron`,
|
|
88
|
+
children: /*#__PURE__*/_jsx(ChevronIcon, {})
|
|
89
|
+
}),
|
|
90
|
+
caret: false,
|
|
91
|
+
render: () => /*#__PURE__*/_jsx(PopupList.ButtonGroup, {
|
|
92
|
+
children: /*#__PURE__*/_jsx(PopupList.Button, {
|
|
93
|
+
onClick: () => [setDraft(true), toggleModal(modalSlug)],
|
|
94
|
+
children: t('version:restoreAsDraft')
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
size: "large",
|
|
98
|
+
verticalAlign: "bottom"
|
|
99
|
+
})]
|
|
100
|
+
}), /*#__PURE__*/_jsx(Modal, {
|
|
101
|
+
className: `${baseClass}__modal`,
|
|
102
|
+
slug: modalSlug,
|
|
103
|
+
children: /*#__PURE__*/_jsxs(MinimalTemplate, {
|
|
104
|
+
className: `${baseClass}__modal-template`,
|
|
105
|
+
children: [/*#__PURE__*/_jsx("h1", {
|
|
106
|
+
children: t('version:confirmVersionRestoration')
|
|
107
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
108
|
+
children: restoreMessage
|
|
109
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
110
|
+
buttonStyle: "secondary",
|
|
111
|
+
onClick: processing ? undefined : () => toggleModal(modalSlug),
|
|
112
|
+
type: "button",
|
|
113
|
+
children: t('general:cancel')
|
|
114
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
115
|
+
onClick: processing ? undefined : () => void handleRestore(),
|
|
116
|
+
children: processing ? t('version:restoring') : t('general:confirm')
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
});
|
|
123
121
|
};
|
|
124
122
|
export default Restore;
|
|
125
|
-
|
|
126
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/Restore/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n ChevronIcon,\n Modal,\n Pill,\n Popup,\n PopupList,\n useConfig,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatAdminURL, requests } from '@payloadcms/ui/shared'\nimport { useRouter } from 'next/navigation.js'\nimport React, { Fragment, useCallback, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type { Props } from './types.js'\n\nimport { MinimalTemplate } from '../../../templates/Minimal/index.js'\nimport './index.scss'\n\nconst baseClass = 'restore-version'\nconst modalSlug = 'restore-version'\n\nconst Restore: React.FC<Props> = ({\n className,\n collectionSlug,\n globalSlug,\n label,\n originalDocID,\n status,\n versionDate,\n versionID,\n}) => {\n const {\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n } = useConfig()\n\n const { toggleModal } = useModal()\n const [processing, setProcessing] = useState(false)\n const router = useRouter()\n const { i18n, t } = useTranslation()\n const [draft, setDraft] = useState(false)\n\n const restoreMessage = t('version:aboutToRestoreGlobal', {\n label: getTranslation(label, i18n),\n versionDate,\n })\n\n let fetchURL = `${serverURL}${apiRoute}`\n let redirectURL: string\n const canRestoreAsDraft = status !== 'draft'\n\n if (collectionSlug) {\n fetchURL = `${fetchURL}/${collectionSlug}/versions/${versionID}?draft=${draft}`\n redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${originalDocID}`,\n })\n }\n\n if (globalSlug) {\n fetchURL = `${fetchURL}/globals/${globalSlug}/versions/${versionID}?draft=${draft}`\n redirectURL = formatAdminURL({\n adminRoute,\n path: `/globals/${globalSlug}`,\n })\n }\n\n const handleRestore = useCallback(async () => {\n setProcessing(true)\n\n const res = await requests.post(fetchURL, {\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n\n if (res.status === 200) {\n const json = await res.json()\n toast.success(json.message)\n router.push(redirectURL)\n } else {\n toast.error(t('version:problemRestoringVersion'))\n }\n }, [fetchURL, redirectURL, t, i18n, router])\n return (\n <Fragment>\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <Pill\n className={[canRestoreAsDraft && `${baseClass}__button`].filter(Boolean).join(' ')}\n onClick={() => toggleModal(modalSlug)}\n >\n {t('version:restoreThisVersion')}\n </Pill>\n {canRestoreAsDraft && (\n <Popup\n button={\n <Pill className={`${baseClass}__chevron`}>\n <ChevronIcon />\n </Pill>\n }\n caret={false}\n render={() => (\n <PopupList.ButtonGroup>\n <PopupList.Button onClick={() => [setDraft(true), toggleModal(modalSlug)]}>\n {t('version:restoreAsDraft')}\n </PopupList.Button>\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n verticalAlign=\"bottom\"\n />\n )}\n </div>\n <Modal className={`${baseClass}__modal`} slug={modalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmVersionRestoration')}</h1>\n <p>{restoreMessage}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(modalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button onClick={processing ? undefined : () => void handleRestore()}>\n {processing ? t('version:restoring') : t('general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </Fragment>\n )\n}\n\nexport default Restore\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","Button","ChevronIcon","Modal","Pill","Popup","PopupList","useConfig","useModal","useTranslation","formatAdminURL","requests","useRouter","React","Fragment","useCallback","useState","toast","MinimalTemplate","baseClass","modalSlug","Restore","className","collectionSlug","globalSlug","label","originalDocID","status","versionDate","versionID","config","routes","admin","adminRoute","api","apiRoute","serverURL","toggleModal","processing","setProcessing","router","i18n","t","draft","setDraft","restoreMessage","fetchURL","redirectURL","canRestoreAsDraft","path","handleRestore","res","post","headers","language","json","success","message","push","error","_jsxs","filter","Boolean","join","_jsx","onClick","button","caret","render","ButtonGroup","size","verticalAlign","slug","buttonStyle","undefined","type"],"sources":["../../../../src/views/Version/Restore/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n ChevronIcon,\n Modal,\n Pill,\n Popup,\n PopupList,\n useConfig,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatAdminURL, requests } from '@payloadcms/ui/shared'\nimport { useRouter } from 'next/navigation.js'\nimport React, { Fragment, useCallback, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type { Props } from './types.js'\n\nimport { MinimalTemplate } from '../../../templates/Minimal/index.js'\nimport './index.scss'\n\nconst baseClass = 'restore-version'\nconst modalSlug = 'restore-version'\n\nconst Restore: React.FC<Props> = ({\n className,\n collectionSlug,\n globalSlug,\n label,\n originalDocID,\n status,\n versionDate,\n versionID,\n}) => {\n const {\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n } = useConfig()\n\n const { toggleModal } = useModal()\n const [processing, setProcessing] = useState(false)\n const router = useRouter()\n const { i18n, t } = useTranslation()\n const [draft, setDraft] = useState(false)\n\n const restoreMessage = t('version:aboutToRestoreGlobal', {\n label: getTranslation(label, i18n),\n versionDate,\n })\n\n let fetchURL = `${serverURL}${apiRoute}`\n let redirectURL: string\n const canRestoreAsDraft = status !== 'draft'\n\n if (collectionSlug) {\n fetchURL = `${fetchURL}/${collectionSlug}/versions/${versionID}?draft=${draft}`\n redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${originalDocID}`,\n })\n }\n\n if (globalSlug) {\n fetchURL = `${fetchURL}/globals/${globalSlug}/versions/${versionID}?draft=${draft}`\n redirectURL = formatAdminURL({\n adminRoute,\n path: `/globals/${globalSlug}`,\n })\n }\n\n const handleRestore = useCallback(async () => {\n setProcessing(true)\n\n const res = await requests.post(fetchURL, {\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n\n if (res.status === 200) {\n const json = await res.json()\n toast.success(json.message)\n router.push(redirectURL)\n } else {\n toast.error(t('version:problemRestoringVersion'))\n }\n }, [fetchURL, redirectURL, t, i18n, router])\n return (\n <Fragment>\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <Pill\n className={[canRestoreAsDraft && `${baseClass}__button`].filter(Boolean).join(' ')}\n onClick={() => toggleModal(modalSlug)}\n >\n {t('version:restoreThisVersion')}\n </Pill>\n {canRestoreAsDraft && (\n <Popup\n button={\n <Pill className={`${baseClass}__chevron`}>\n <ChevronIcon />\n </Pill>\n }\n caret={false}\n render={() => (\n <PopupList.ButtonGroup>\n <PopupList.Button onClick={() => [setDraft(true), toggleModal(modalSlug)]}>\n {t('version:restoreAsDraft')}\n </PopupList.Button>\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n verticalAlign=\"bottom\"\n />\n )}\n </div>\n <Modal className={`${baseClass}__modal`} slug={modalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmVersionRestoration')}</h1>\n <p>{restoreMessage}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(modalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button onClick={processing ? undefined : () => void handleRestore()}>\n {processing ? t('version:restoring') : t('general:confirm')}\n </Button>\n </MinimalT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/Version/Restore/types.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload'\n\nexport type Props = {\n className?: string\n collectionSlug?: SanitizedCollectionConfig['slug']\n globalSlug?: SanitizedGlobalConfig['slug']\n label: SanitizedCollectionConfig['labels']['singular']\n originalDocID: number | string\n status?: string\n versionDate: string\n versionID: string\n}\n"],"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/views/Version/Restore/types.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload'\n\nexport type Props = {\n className?: string\n collectionSlug?: SanitizedCollectionConfig['slug']\n globalSlug?: SanitizedGlobalConfig['slug']\n label: SanitizedCollectionConfig['labels']['singular']\n originalDocID: number | string\n status?: string\n versionDate: string\n versionID: string\n}\n"],"mappings":"AAEA","ignoreList":[]}
|