@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,40 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
4
|
import { getTranslation } from '@payloadcms/translations';
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import Label from '../../Label/index.js';
|
|
5
7
|
import RenderFieldsToDiff from '../../index.js';
|
|
6
8
|
const baseClass = 'nested-diff';
|
|
7
|
-
const Nested = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
const Nested = ({
|
|
10
|
+
comparison,
|
|
11
|
+
diffComponents,
|
|
12
|
+
disableGutter = false,
|
|
13
|
+
field,
|
|
14
|
+
fields,
|
|
15
|
+
i18n,
|
|
16
|
+
locale,
|
|
17
|
+
locales,
|
|
18
|
+
permissions,
|
|
19
|
+
version
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
22
|
+
className: baseClass,
|
|
23
|
+
children: ['label' in field && field.label && typeof field.label !== 'function' && /*#__PURE__*/_jsxs(Label, {
|
|
24
|
+
children: [locale && /*#__PURE__*/_jsx("span", {
|
|
25
|
+
className: `${baseClass}__locale-label`,
|
|
26
|
+
children: locale
|
|
27
|
+
}), getTranslation(field.label, i18n)]
|
|
28
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
29
|
+
className: [`${baseClass}__wrap`, !disableGutter && `${baseClass}__wrap--gutter`].filter(Boolean).join(' '),
|
|
30
|
+
children: /*#__PURE__*/_jsx(RenderFieldsToDiff, {
|
|
31
|
+
comparison: comparison,
|
|
32
|
+
diffComponents: diffComponents,
|
|
33
|
+
fieldPermissions: permissions,
|
|
34
|
+
fields: fields,
|
|
35
|
+
i18n: i18n,
|
|
36
|
+
locales: locales,
|
|
37
|
+
version: version
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
37
41
|
};
|
|
38
42
|
export default Nested;
|
|
39
|
-
|
|
40
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Nested/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","React","Label","RenderFieldsToDiff","baseClass","Nested","comparison","diffComponents","disableGutter","field","fields","i18n","locale","locales","permissions","version","_jsxs","className","label","_jsx","filter","Boolean","join","fieldPermissions"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Nested/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport Label from '../../Label/index.js'\nimport RenderFieldsToDiff from '../../index.js'\nimport './index.scss'\n\nconst baseClass = 'nested-diff'\n\nconst Nested: React.FC<DiffComponentProps> = ({\n comparison,\n diffComponents,\n disableGutter = false,\n field,\n fields,\n i18n,\n locale,\n locales,\n permissions,\n version,\n}) => {\n return (\n <div className={baseClass}>\n {'label' in field && field.label && typeof field.label !== 'function' && (\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(field.label, i18n)}\n </Label>\n )}\n <div\n className={[`${baseClass}__wrap`, !disableGutter && `${baseClass}__wrap--gutter`]\n .filter(Boolean)\n .join(' ')}\n >\n <RenderFieldsToDiff\n comparison={comparison}\n diffComponents={diffComponents}\n fieldPermissions={permissions}\n fields={fields}\n i18n={i18n}\n locales={locales}\n version={version}\n />\n </div>\n </div>\n )\n}\n\nexport default Nested\n"],"mappings":"AAAA;;;AACA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,OAAOC,KAAA,MAAW;AAClB,OAAOC,kBAAA,MAAwB;AAG/B,MAAMC,SAAA,GAAY;AAElB,MAAMC,MAAA,GAAuCA,CAAC;EAC5CC,UAAU;EACVC,cAAc;EACdC,aAAA,GAAgB,KAAK;EACrBC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC,OAAO;EACPC,WAAW;EACXC;AAAO,CACR;EACC,oBACEC,KAAA,CAAC;IAAIC,SAAA,EAAWb,SAAA;eACb,WAAWK,KAAA,IAASA,KAAA,CAAMS,KAAK,IAAI,OAAOT,KAAA,CAAMS,KAAK,KAAK,2BACzDF,KAAA,CAACd,KAAA;iBACEU,MAAA,iBAAUO,IAAA,CAAC;QAAKF,SAAA,EAAW,GAAGb,SAAA,gBAAyB;kBAAGQ;UAC1DZ,cAAA,CAAeS,KAAA,CAAMS,KAAK,EAAEP,IAAA;qBAGjCQ,IAAA,CAAC;MACCF,SAAA,EAAW,CAAC,GAAGb,SAAA,QAAiB,EAAE,CAACI,aAAA,IAAiB,GAAGJ,SAAA,gBAAyB,CAAC,CAC9EgB,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;gBAER,aAAAH,IAAA,CAAChB,kBAAA;QACCG,UAAA,EAAYA,UAAA;QACZC,cAAA,EAAgBA,cAAA;QAChBgB,gBAAA,EAAkBT,WAAA;QAClBJ,MAAA,EAAQA,MAAA;QACRC,IAAA,EAAMA,IAAA;QACNE,OAAA,EAASA,OAAA;QACTE,OAAA,EAASA;;;;AAKnB;AAEA,eAAeV,MAAA","ignoreList":[]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
4
6
|
import { useConfig } from '@payloadcms/ui';
|
|
@@ -9,97 +11,125 @@ import Label from '../../Label/index.js';
|
|
|
9
11
|
import { diffStyles } from '../styles.js';
|
|
10
12
|
const ReactDiffViewer = ReactDiffViewerImport.default || ReactDiffViewerImport;
|
|
11
13
|
const baseClass = 'relationship-diff';
|
|
12
|
-
const generateLabelFromValue = (collections, field, locale, value)=>{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const generateLabelFromValue = (collections, field, locale, value) => {
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return value.map(v => generateLabelFromValue(collections, field, locale, v)).filter(Boolean) // Filters out any undefined or empty values
|
|
17
|
+
.join(', ');
|
|
18
|
+
}
|
|
19
|
+
let relatedDoc;
|
|
20
|
+
let valueToReturn = '';
|
|
21
|
+
const relationTo = 'relationTo' in field ? field.relationTo : undefined;
|
|
22
|
+
if (value === null || typeof value === 'undefined') {
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
if (typeof value === 'object' && 'relationTo' in value) {
|
|
26
|
+
relatedDoc = value.value;
|
|
27
|
+
} else {
|
|
28
|
+
// Non-polymorphic relationship
|
|
29
|
+
relatedDoc = value;
|
|
30
|
+
}
|
|
31
|
+
const relatedCollection = relationTo ? collections.find(c => c.slug === (typeof value === 'object' && 'relationTo' in value ? value.relationTo : relationTo)) : null;
|
|
32
|
+
if (relatedCollection) {
|
|
33
|
+
const useAsTitle = relatedCollection?.admin?.useAsTitle;
|
|
34
|
+
const useAsTitleField = relatedCollection.fields.find(f => fieldAffectsData(f) && !fieldIsPresentationalOnly(f) && f.name === useAsTitle);
|
|
35
|
+
let titleFieldIsLocalized = false;
|
|
36
|
+
if (useAsTitleField && fieldAffectsData(useAsTitleField)) {
|
|
37
|
+
titleFieldIsLocalized = useAsTitleField.localized;
|
|
22
38
|
}
|
|
23
|
-
if (typeof
|
|
24
|
-
|
|
39
|
+
if (typeof relatedDoc?.[useAsTitle] !== 'undefined') {
|
|
40
|
+
valueToReturn = relatedDoc[useAsTitle];
|
|
41
|
+
} else if (typeof relatedDoc?.id !== 'undefined') {
|
|
42
|
+
valueToReturn = relatedDoc.id;
|
|
25
43
|
} else {
|
|
26
|
-
|
|
27
|
-
relatedDoc = value;
|
|
44
|
+
valueToReturn = relatedDoc;
|
|
28
45
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const useAsTitle = relatedCollection?.admin?.useAsTitle;
|
|
32
|
-
const useAsTitleField = relatedCollection.fields.find((f)=>fieldAffectsData(f) && !fieldIsPresentationalOnly(f) && f.name === useAsTitle);
|
|
33
|
-
let titleFieldIsLocalized = false;
|
|
34
|
-
if (useAsTitleField && fieldAffectsData(useAsTitleField)) {
|
|
35
|
-
titleFieldIsLocalized = useAsTitleField.localized;
|
|
36
|
-
}
|
|
37
|
-
if (typeof relatedDoc?.[useAsTitle] !== 'undefined') {
|
|
38
|
-
valueToReturn = relatedDoc[useAsTitle];
|
|
39
|
-
} else if (typeof relatedDoc?.id !== 'undefined') {
|
|
40
|
-
valueToReturn = relatedDoc.id;
|
|
41
|
-
} else {
|
|
42
|
-
valueToReturn = relatedDoc;
|
|
43
|
-
}
|
|
44
|
-
if (typeof valueToReturn === 'object' && titleFieldIsLocalized) {
|
|
45
|
-
valueToReturn = valueToReturn[locale];
|
|
46
|
-
}
|
|
47
|
-
} else if (relatedDoc) {
|
|
48
|
-
// Handle non-polymorphic `hasMany` relationships or fallback
|
|
49
|
-
if (typeof relatedDoc?.id !== 'undefined') {
|
|
50
|
-
valueToReturn = relatedDoc.id;
|
|
51
|
-
} else {
|
|
52
|
-
valueToReturn = relatedDoc;
|
|
53
|
-
}
|
|
46
|
+
if (typeof valueToReturn === 'object' && titleFieldIsLocalized) {
|
|
47
|
+
valueToReturn = valueToReturn[locale];
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
} else if (relatedDoc) {
|
|
50
|
+
// Handle non-polymorphic `hasMany` relationships or fallback
|
|
51
|
+
if (typeof relatedDoc?.id !== 'undefined') {
|
|
52
|
+
valueToReturn = relatedDoc.id;
|
|
53
|
+
} else {
|
|
54
|
+
valueToReturn = relatedDoc;
|
|
57
55
|
}
|
|
58
|
-
|
|
56
|
+
}
|
|
57
|
+
if (typeof valueToReturn === 'object' && valueToReturn !== null) {
|
|
58
|
+
valueToReturn = JSON.stringify(valueToReturn);
|
|
59
|
+
}
|
|
60
|
+
return valueToReturn;
|
|
59
61
|
};
|
|
60
|
-
const Relationship =
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const Relationship = t0 => {
|
|
63
|
+
const $ = _c(10);
|
|
64
|
+
const {
|
|
65
|
+
comparison,
|
|
66
|
+
field,
|
|
67
|
+
i18n,
|
|
68
|
+
locale,
|
|
69
|
+
version
|
|
70
|
+
} = t0;
|
|
71
|
+
const placeholder = `[${i18n.t("general:noValue")}]`;
|
|
72
|
+
const {
|
|
73
|
+
config: t1
|
|
74
|
+
} = useConfig();
|
|
75
|
+
const {
|
|
76
|
+
collections
|
|
77
|
+
} = t1;
|
|
78
|
+
let t2;
|
|
79
|
+
if ($[0] !== placeholder || $[1] !== version || $[2] !== field || $[3] !== collections || $[4] !== locale || $[5] !== comparison || $[6] !== i18n) {
|
|
63
80
|
let versionToRender = placeholder;
|
|
64
81
|
let comparisonToRender = placeholder;
|
|
65
82
|
if (version) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
if ("hasMany" in field && field.hasMany && Array.isArray(version)) {
|
|
84
|
+
versionToRender = version.map(val => generateLabelFromValue(collections, field, locale, val)).join(", ") || placeholder;
|
|
85
|
+
} else {
|
|
86
|
+
versionToRender = generateLabelFromValue(collections, field, locale, version) || placeholder;
|
|
87
|
+
}
|
|
71
88
|
}
|
|
72
89
|
if (comparison) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
if ("hasMany" in field && field.hasMany && Array.isArray(comparison)) {
|
|
91
|
+
comparisonToRender = comparison.map(val_0 => generateLabelFromValue(collections, field, locale, val_0)).join(", ") || placeholder;
|
|
92
|
+
} else {
|
|
93
|
+
comparisonToRender = generateLabelFromValue(collections, field, locale, comparison) || placeholder;
|
|
94
|
+
}
|
|
78
95
|
}
|
|
79
|
-
const label =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
const label = "label" in field && typeof field.label !== "boolean" && typeof field.label !== "function" ? field.label : "";
|
|
97
|
+
let t3;
|
|
98
|
+
if ($[8] !== locale) {
|
|
99
|
+
t3 = locale && _jsx("span", {
|
|
100
|
+
className: `${baseClass}__locale-label`,
|
|
101
|
+
children: locale
|
|
102
|
+
});
|
|
103
|
+
$[8] = locale;
|
|
104
|
+
$[9] = t3;
|
|
105
|
+
} else {
|
|
106
|
+
t3 = $[9];
|
|
107
|
+
}
|
|
108
|
+
t2 = _jsxs("div", {
|
|
109
|
+
className: baseClass,
|
|
110
|
+
children: [_jsxs(Label, {
|
|
111
|
+
children: [t3, getTranslation(label, i18n)]
|
|
112
|
+
}), _jsx(ReactDiffViewer, {
|
|
113
|
+
hideLineNumbers: true,
|
|
114
|
+
newValue: versionToRender,
|
|
115
|
+
oldValue: comparisonToRender,
|
|
116
|
+
showDiffOnly: false,
|
|
117
|
+
splitView: true,
|
|
118
|
+
styles: diffStyles
|
|
119
|
+
})]
|
|
101
120
|
});
|
|
121
|
+
$[0] = placeholder;
|
|
122
|
+
$[1] = version;
|
|
123
|
+
$[2] = field;
|
|
124
|
+
$[3] = collections;
|
|
125
|
+
$[4] = locale;
|
|
126
|
+
$[5] = comparison;
|
|
127
|
+
$[6] = i18n;
|
|
128
|
+
$[7] = t2;
|
|
129
|
+
} else {
|
|
130
|
+
t2 = $[7];
|
|
131
|
+
}
|
|
132
|
+
return t2;
|
|
102
133
|
};
|
|
103
134
|
export default Relationship;
|
|
104
|
-
|
|
105
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Relationship/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, ClientField, RelationshipFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useConfig } from '@payloadcms/ui'\nimport { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared'\nimport React from 'react'\nimport ReactDiffViewerImport from 'react-diff-viewer-continued'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport Label from '../../Label/index.js'\nimport { diffStyles } from '../styles.js'\nimport './index.scss'\n\nconst ReactDiffViewer = (ReactDiffViewerImport.default ||\n ReactDiffViewerImport) as unknown as typeof ReactDiffViewerImport.default\n\nconst baseClass = 'relationship-diff'\n\ntype RelationshipValue = Record<string, any>\n\nconst generateLabelFromValue = (\n collections: ClientCollectionConfig[],\n field: ClientField,\n locale: string,\n value: { relationTo: string; value: RelationshipValue } | RelationshipValue,\n): string => {\n if (Array.isArray(value)) {\n return value\n .map((v) => generateLabelFromValue(collections, field, locale, v))\n .filter(Boolean) // Filters out any undefined or empty values\n .join(', ')\n }\n\n let relatedDoc: RelationshipValue\n let valueToReturn = '' as any\n\n const relationTo = 'relationTo' in field ? field.relationTo : undefined\n\n if (value === null || typeof value === 'undefined') {\n return String(value)\n }\n\n if (typeof value === 'object' && 'relationTo' in value) {\n relatedDoc = value.value\n } else {\n // Non-polymorphic relationship\n relatedDoc = value\n }\n\n const relatedCollection = relationTo\n ? collections.find(\n (c) =>\n c.slug ===\n (typeof value === 'object' && 'relationTo' in value ? value.relationTo : relationTo),\n )\n : null\n\n if (relatedCollection) {\n const useAsTitle = relatedCollection?.admin?.useAsTitle\n const useAsTitleField = relatedCollection.fields.find(\n (f) => fieldAffectsData(f) && !fieldIsPresentationalOnly(f) && f.name === useAsTitle,\n )\n let titleFieldIsLocalized = false\n\n if (useAsTitleField && fieldAffectsData(useAsTitleField)) {\n titleFieldIsLocalized = useAsTitleField.localized\n }\n\n if (typeof relatedDoc?.[useAsTitle] !== 'undefined') {\n valueToReturn = relatedDoc[useAsTitle]\n } else if (typeof relatedDoc?.id !== 'undefined') {\n valueToReturn = relatedDoc.id\n } else {\n valueToReturn = relatedDoc\n }\n\n if (typeof valueToReturn === 'object' && titleFieldIsLocalized) {\n valueToReturn = valueToReturn[locale]\n }\n } else if (relatedDoc) {\n // Handle non-polymorphic `hasMany` relationships or fallback\n if (typeof relatedDoc?.id !== 'undefined') {\n valueToReturn = relatedDoc.id\n } else {\n valueToReturn = relatedDoc\n }\n }\n\n if (typeof valueToReturn === 'object' && valueToReturn !== null) {\n valueToReturn = JSON.stringify(valueToReturn)\n }\n\n return valueToReturn\n}\n\nconst Relationship: React.FC<DiffComponentProps<RelationshipFieldClient>> = ({\n comparison,\n field,\n i18n,\n locale,\n version,\n}) => {\n const placeholder = `[${i18n.t('general:noValue')}]`\n\n const {\n config: { collections },\n } = useConfig()\n\n let versionToRender: string | undefined = placeholder\n let comparisonToRender: string | undefined = placeholder\n\n if (version) {\n if ('hasMany' in field && field.hasMany && Array.isArray(version)) {\n versionToRender =\n version.map((val) => generateLabelFromValue(collections, field, locale, val)).join(', ') ||\n placeholder\n } else {\n versionToRender = generateLabelFromValue(collections, field, locale, version) || placeholder\n }\n }\n\n if (comparison) {\n if ('hasMany' in field && field.hasMany && Array.isArray(comparison)) {\n comparisonToRender =\n comparison\n .map((val) => generateLabelFromValue(collections, field, locale, val))\n .join(', ') || placeholder\n } else {\n comparisonToRender =\n generateLabelFromValue(collections, field, locale, comparison) || placeholder\n }\n }\n\n const label =\n 'label' in field && typeof field.label !== 'boolean' && typeof field.label !== 'function'\n ? field.label\n : ''\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(label, i18n)}\n </Label>\n <ReactDiffViewer\n hideLineNumbers\n newValue={versionToRender}\n oldValue={comparisonToRender}\n showDiffOnly={false}\n splitView\n styles={diffStyles}\n />\n </div>\n )\n}\n\nexport default Relationship\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useConfig","fieldAffectsData","fieldIsPresentationalOnly","React","ReactDiffViewerImport","Label","diffStyles","ReactDiffViewer","default","baseClass","generateLabelFromValue","collections","field","locale","value","Array","isArray","map","v","filter","Boolean","join","relatedDoc","valueToReturn","relationTo","undefined","String","relatedCollection","find","slug","useAsTitle","admin","useAsTitleField","fields","f","name","titleFieldIsLocalized","localized","id","JSON","stringify","Relationship","t0","$","comparison","i18n","version","placeholder","t","config","t1","t2","versionToRender","comparisonToRender","hasMany","val","val_0","label","t3","_jsx","className","children","_jsxs","hideLineNumbers","newValue","oldValue","showDiffOnly","splitView","styles"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Relationship/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, ClientField, RelationshipFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useConfig } from '@payloadcms/ui'\nimport { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared'\nimport React from 'react'\nimport ReactDiffViewerImport from 'react-diff-viewer-continued'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport Label from '../../Label/index.js'\nimport { diffStyles } from '../styles.js'\nimport './index.scss'\n\nconst ReactDiffViewer = (ReactDiffViewerImport.default ||\n ReactDiffViewerImport) as unknown as typeof ReactDiffViewerImport.default\n\nconst baseClass = 'relationship-diff'\n\ntype RelationshipValue = Record<string, any>\n\nconst generateLabelFromValue = (\n collections: ClientCollectionConfig[],\n field: ClientField,\n locale: string,\n value: { relationTo: string; value: RelationshipValue } | RelationshipValue,\n): string => {\n if (Array.isArray(value)) {\n return value\n .map((v) => generateLabelFromValue(collections, field, locale, v))\n .filter(Boolean) // Filters out any undefined or empty values\n .join(', ')\n }\n\n let relatedDoc: RelationshipValue\n let valueToReturn = '' as any\n\n const relationTo = 'relationTo' in field ? field.relationTo : undefined\n\n if (value === null || typeof value === 'undefined') {\n return String(value)\n }\n\n if (typeof value === 'object' && 'relationTo' in value) {\n relatedDoc = value.value\n } else {\n // Non-polymorphic relationship\n relatedDoc = value\n }\n\n const relatedCollection = relationTo\n ? collections.find(\n (c) =>\n c.slug ===\n (typeof value === 'object' && 'relationTo' in value ? value.relationTo : relationTo),\n )\n : null\n\n if (relatedCollection) {\n const useAsTitle = relatedCollection?.admin?.useAsTitle\n const useAsTitleField = relatedCollection.fields.find(\n (f) => fieldAffectsData(f) && !fieldIsPresentationalOnly(f) && f.name === useAsTitle,\n )\n let titleFieldIsLocalized = false\n\n if (useAsTitleField && fieldAffectsData(useAsTitleField)) {\n titleFieldIsLocalized = useAsTitleField.localized\n }\n\n if (typeof relatedDoc?.[useAsTitle] !== 'undefined') {\n valueToReturn = relatedDoc[useAsTitle]\n } else if (typeof relatedDoc?.id !== 'undefined') {\n valueToReturn = relatedDoc.id\n } else {\n valueToReturn = relatedDoc\n }\n\n if (typeof valueToReturn === 'object' && titleFieldIsLocalized) {\n valueToReturn = valueToReturn[locale]\n }\n } else if (relatedDoc) {\n // Handle non-polymorphic `hasMany` relationships or fallback\n if (typeof relatedDoc?.id !== 'undefined') {\n valueToReturn = relatedDoc.id\n } else {\n valueToReturn = relatedDoc\n }\n }\n\n if (typeof valueToReturn === 'object' && valueToReturn !== null) {\n valueToReturn = JSON.stringify(valueToReturn)\n }\n\n return valueToReturn\n}\n\nconst Relationship: React.FC<DiffComponentProps<RelationshipFieldClient>> = ({\n comparison,\n field,\n i18n,\n locale,\n version,\n}) => {\n const placeholder = `[${i18n.t('general:noValue')}]`\n\n const {\n config: { collections },\n } = useConfig()\n\n let versionToRender: string | undefined = placeholder\n let comparisonToRender: string | undefined = placeholder\n\n if (version) {\n if ('hasMany' in field && field.hasMany && Array.isArray(version)) {\n versionToRender =\n version.map((val) => generateLabelFromValue(collections, field, locale, val)).join(', ') ||\n placeholder\n } else {\n versionToRender = generateLabelFromValue(collections, field, locale, version) || placeholder\n }\n }\n\n if (comparison) {\n if ('hasMany' in field && field.hasMany && Array.isArray(comparison)) {\n comparisonToRender =\n comparison\n .map((val) => generateLabelFromValue(collections, field, locale, val))\n .join(', ') || placeholder\n } else {\n comparisonToRender =\n generateLabelFromValue(collections, field, locale, comparison) || placeholder\n }\n }\n\n const label =\n 'label' in field && typeof field.label !== 'boolean' && typeof field.label !== 'function'\n ? field.label\n : ''\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(label, i18n)}\n </Label>\n <ReactDiffViewer\n hideLineNumbers\n newValue={versionToRender}\n oldValue={comparisonToRender}\n showDiffOnly={false}\n splitView\n styles={diffStyles}\n />\n </div>\n )\n}\n\nexport default Relationship\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,gBAAgB,EAAEC,yBAAyB,QAAQ;AAC5D,OAAOC,KAAA,MAAW;AAClB,OAAOC,qBAAA,MAA2B;AAIlC,OAAOC,KAAA,MAAW;AAClB,SAASC,UAAU,QAAQ;AAG3B,MAAMC,eAAA,GAAmBH,qBAAA,CAAsBI,OAAO,IACpDJ,qBAAA;AAEF,MAAMK,SAAA,GAAY;AAIlB,MAAMC,sBAAA,GAAyBA,CAC7BC,WAAA,EACAC,KAAA,EACAC,MAAA,EACAC,KAAA;EAEA,IAAIC,KAAA,CAAMC,OAAO,CAACF,KAAA,GAAQ;IACxB,OAAOA,KAAA,CACJG,GAAG,CAAEC,CAAA,IAAMR,sBAAA,CAAuBC,WAAA,EAAaC,KAAA,EAAOC,MAAA,EAAQK,CAAA,GAC9DC,MAAM,CAACC,OAAA,EAAS;IAAA,CAChBC,IAAI,CAAC;EACV;EAEA,IAAIC,UAAA;EACJ,IAAIC,aAAA,GAAgB;EAEpB,MAAMC,UAAA,GAAa,gBAAgBZ,KAAA,GAAQA,KAAA,CAAMY,UAAU,GAAGC,SAAA;EAE9D,IAAIX,KAAA,KAAU,QAAQ,OAAOA,KAAA,KAAU,aAAa;IAClD,OAAOY,M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sx as _jsx } from "react/jsx-runtime";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import ReactDiffViewerImport, { DiffMethod } from 'react-diff-viewer-continued';
|
|
5
6
|
const ReactDiffViewer = ReactDiffViewerImport.default || ReactDiffViewerImport;
|
|
6
|
-
export const DiffViewer = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export const DiffViewer = ({
|
|
8
|
+
comparisonToRender,
|
|
9
|
+
diffMethod,
|
|
10
|
+
diffStyles,
|
|
11
|
+
placeholder,
|
|
12
|
+
versionToRender
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/_jsx(ReactDiffViewer, {
|
|
15
|
+
compareMethod: DiffMethod[diffMethod],
|
|
16
|
+
hideLineNumbers: true,
|
|
17
|
+
newValue: typeof versionToRender !== 'undefined' ? versionToRender : placeholder,
|
|
18
|
+
oldValue: comparisonToRender,
|
|
19
|
+
showDiffOnly: false,
|
|
20
|
+
splitView: true,
|
|
21
|
+
styles: diffStyles
|
|
22
|
+
});
|
|
16
23
|
};
|
|
17
|
-
|
|
18
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\nimport ReactDiffViewerImport, { DiffMethod } from 'react-diff-viewer-continued'\n\nconst ReactDiffViewer = (ReactDiffViewerImport.default ||\n ReactDiffViewerImport) as unknown as typeof ReactDiffViewerImport.default\n\nexport const DiffViewer: React.FC<{\n comparisonToRender: string\n diffMethod: string\n diffStyles: any\n placeholder: string\n versionToRender: string\n}> = ({ comparisonToRender, diffMethod, diffStyles, placeholder, versionToRender }) => {\n return (\n <ReactDiffViewer\n compareMethod={DiffMethod[diffMethod]}\n hideLineNumbers\n newValue={typeof versionToRender !== 'undefined' ? versionToRender : placeholder}\n oldValue={comparisonToRender}\n showDiffOnly={false}\n splitView\n styles={diffStyles}\n />\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","ReactDiffViewerImport","DiffMethod","ReactDiffViewer","default","DiffViewer","comparisonToRender","diffMethod","diffStyles","placeholder","versionToRender","_jsx","compareMethod","hideLineNumbers","newValue","oldValue","showDiffOnly","splitView","styles"],"sources":["../../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\nimport ReactDiffViewerImport, { DiffMethod } from 'react-diff-viewer-continued'\n\nconst ReactDiffViewer = (ReactDiffViewerImport.default ||\n ReactDiffViewerImport) as unknown as typeof ReactDiffViewerImport.default\n\nexport const DiffViewer: React.FC<{\n comparisonToRender: string\n diffMethod: string\n diffStyles: any\n placeholder: string\n versionToRender: string\n}> = ({ comparisonToRender, diffMethod, diffStyles, placeholder, versionToRender }) => {\n return (\n <ReactDiffViewer\n compareMethod={DiffMethod[diffMethod]}\n hideLineNumbers\n newValue={typeof versionToRender !== 'undefined' ? versionToRender : placeholder}\n oldValue={comparisonToRender}\n showDiffOnly={false}\n splitView\n styles={diffStyles}\n />\n )\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAClB,OAAOC,qBAAA,IAAyBC,UAAU,QAAQ;AAElD,MAAMC,eAAA,GAAmBF,qBAAA,CAAsBG,OAAO,IACpDH,qBAAA;AAEF,OAAO,MAAMI,UAAA,GAMRA,CAAC;EAAEC,kBAAkB;EAAEC,UAAU;EAAEC,UAAU;EAAEC,WAAW;EAAEC;AAAe,CAAE;EAChF,oBACEC,IAAA,CAACR,eAAA;IACCS,aAAA,EAAeV,UAAU,CAACK,UAAA,CAAW;IACrCM,eAAe;IACfC,QAAA,EAAU,OAAOJ,eAAA,KAAoB,cAAcA,eAAA,GAAkBD,WAAA;IACrEM,QAAA,EAAUT,kBAAA;IACVU,YAAA,EAAc;IACdC,SAAS;IACTC,MAAA,EAAQV;;AAGd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6B,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAG3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAKrD,OAAO,cAAc,CAAA;AAmCrB,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAuC3D,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
4
|
import { getTranslation } from '@payloadcms/translations';
|
|
3
5
|
import React from 'react';
|
|
@@ -5,46 +7,46 @@ import Label from '../../Label/index.js';
|
|
|
5
7
|
import { diffStyles } from '../styles.js';
|
|
6
8
|
import { DiffViewer } from './DiffViewer/index.js';
|
|
7
9
|
const baseClass = 'select-diff';
|
|
8
|
-
const getOptionsToRender = (value, options, hasMany)=>{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const getOptionsToRender = (value, options, hasMany) => {
|
|
11
|
+
if (hasMany && Array.isArray(value)) {
|
|
12
|
+
return value.map(val => options.find(option => (typeof option === 'string' ? option : option.value) === val) || String(val));
|
|
13
|
+
}
|
|
14
|
+
return options.find(option => (typeof option === 'string' ? option : option.value) === value) || String(value);
|
|
13
15
|
};
|
|
14
|
-
const getTranslatedOptions = (options, i18n)=>{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const getTranslatedOptions = (options, i18n) => {
|
|
17
|
+
if (Array.isArray(options)) {
|
|
18
|
+
return options.map(option => typeof option === 'string' ? option : getTranslation(option.label, i18n)).join(', ');
|
|
19
|
+
}
|
|
20
|
+
return typeof options === 'string' ? options : getTranslation(options.label, i18n);
|
|
19
21
|
};
|
|
20
|
-
const Select = ({
|
|
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
|
-
})
|
|
22
|
+
const Select = ({
|
|
23
|
+
comparison,
|
|
24
|
+
diffMethod,
|
|
25
|
+
field,
|
|
26
|
+
i18n,
|
|
27
|
+
locale,
|
|
28
|
+
version
|
|
29
|
+
}) => {
|
|
30
|
+
let placeholder = '';
|
|
31
|
+
if (version === comparison) placeholder = `[${i18n.t('general:noValue')}]`;
|
|
32
|
+
const options = 'options' in field && field.options;
|
|
33
|
+
const comparisonToRender = typeof comparison !== 'undefined' ? getTranslatedOptions(getOptionsToRender(comparison, options, field.hasMany), i18n) : placeholder;
|
|
34
|
+
const versionToRender = typeof version !== 'undefined' ? getTranslatedOptions(getOptionsToRender(version, options, field.hasMany), i18n) : placeholder;
|
|
35
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
36
|
+
className: baseClass,
|
|
37
|
+
children: [/*#__PURE__*/_jsxs(Label, {
|
|
38
|
+
children: [locale && /*#__PURE__*/_jsx("span", {
|
|
39
|
+
className: `${baseClass}__locale-label`,
|
|
40
|
+
children: locale
|
|
41
|
+
}), 'label' in field && getTranslation(field.label || '', i18n)]
|
|
42
|
+
}), /*#__PURE__*/_jsx(DiffViewer, {
|
|
43
|
+
comparisonToRender: comparisonToRender,
|
|
44
|
+
diffMethod: diffMethod,
|
|
45
|
+
diffStyles: diffStyles,
|
|
46
|
+
placeholder: placeholder,
|
|
47
|
+
versionToRender: versionToRender
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
47
50
|
};
|
|
48
51
|
export default Select;
|
|
49
|
-
|
|
50
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","React","Label","diffStyles","DiffViewer","baseClass","getOptionsToRender","value","options","hasMany","Array","isArray","map","val","find","option","String","getTranslatedOptions","i18n","label","join","Select","comparison","diffMethod","field","locale","version","placeholder","t","comparisonToRender","versionToRender","_jsxs","className","_jsx"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { OptionObject, SelectField, SelectFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport Label from '../../Label/index.js'\nimport { diffStyles } from '../styles.js'\nimport { DiffViewer } from './DiffViewer/index.js'\nimport './index.scss'\n\nconst baseClass = 'select-diff'\n\nconst getOptionsToRender = (\n value: string,\n options: SelectField['options'],\n hasMany: boolean,\n): (OptionObject | string)[] | OptionObject | string => {\n if (hasMany && Array.isArray(value)) {\n return value.map(\n (val) =>\n options.find((option) => (typeof option === 'string' ? option : option.value) === val) ||\n String(val),\n )\n }\n return (\n options.find((option) => (typeof option === 'string' ? option : option.value) === value) ||\n String(value)\n )\n}\n\nconst getTranslatedOptions = (\n options: (OptionObject | string)[] | OptionObject | string,\n i18n: I18nClient,\n): string => {\n if (Array.isArray(options)) {\n return options\n .map((option) => (typeof option === 'string' ? option : getTranslation(option.label, i18n)))\n .join(', ')\n }\n\n return typeof options === 'string' ? options : getTranslation(options.label, i18n)\n}\n\nconst Select: React.FC<DiffComponentProps<SelectFieldClient>> = ({\n comparison,\n diffMethod,\n field,\n i18n,\n locale,\n version,\n}) => {\n let placeholder = ''\n\n if (version === comparison) placeholder = `[${i18n.t('general:noValue')}]`\n\n const options = 'options' in field && field.options\n\n const comparisonToRender =\n typeof comparison !== 'undefined'\n ? getTranslatedOptions(getOptionsToRender(comparison, options, field.hasMany), i18n)\n : placeholder\n\n const versionToRender =\n typeof version !== 'undefined'\n ? getTranslatedOptions(getOptionsToRender(version, options, field.hasMany), i18n)\n : placeholder\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {'label' in field && getTranslation(field.label || '', i18n)}\n </Label>\n <DiffViewer\n comparisonToRender={comparisonToRender}\n diffMethod={diffMethod}\n diffStyles={diffStyles}\n placeholder={placeholder}\n versionToRender={versionToRender}\n />\n </div>\n )\n}\n\nexport default Select\n"],"mappings":"AAAA;;;AAIA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,OAAOC,KAAA,MAAW;AAClB,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAG3B,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAqBA,CACzBC,KAAA,EACAC,OAAA,EACAC,OAAA;EAEA,IAAIA,OAAA,IAAWC,KAAA,CAAMC,OAAO,CAACJ,KAAA,GAAQ;IACnC,OAAOA,KAAA,CAAMK,GAAG,CACbC,GAAA,IACCL,OAAA,CAAQM,IAAI,CAAEC,MAAA,IAAW,CAAC,OAAOA,MAAA,KAAW,WAAWA,MAAA,GAASA,MAAA,CAAOR,KAAK,MAAMM,GAAA,KAClFG,MAAA,CAAOH,GAAA;EA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ACEuB,MAAA,iBAAUQ,IAAA,CAAC;QAAKD,SAAA,EAAW,GAAG3B,SAAA,gBAAyB;kBAAGoB;UAC1D,WAAWD,KAAA,IAASxB,cAAA,CAAewB,KAAA,CAAML,KAAK,IAAI,IAAID,IAAA;qBAEzDe,IAAA,CAAC7B,UAAA;MACCyB,kBAAA,EAAoBA,kBAAA;MACpBN,UAAA,EAAYA,UAAA;MACZpB,UAAA,EAAYA,UAAA;MACZwB,WAAA,EAAaA,WAAA;MACbG,eAAA,EAAiBA;;;AAIzB;AAEA,eAAeT,MAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAOrD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,CA+CvD,CAAA;AAED,eAAe,IAAI,CAAA"}
|