@payloadcms/next 3.59.0-internal.ee5f42c → 3.59.0-internal.ff6711a
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/elements/DocumentHeader/index.d.ts +3 -0
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js +3 -0
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.d.ts +3 -0
- package/dist/elements/Nav/NavHamburger/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +3 -0
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.d.ts +3 -0
- package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +3 -0
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/index.client.d.ts +3 -0
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +3 -0
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/exports/elements.d.ts +4 -0
- package/dist/exports/elements.d.ts.map +1 -0
- package/dist/exports/elements.js +6 -0
- package/dist/exports/elements.js.map +1 -0
- package/dist/exports/rsc.d.ts +4 -0
- package/dist/exports/rsc.d.ts.map +1 -0
- package/dist/exports/rsc.js +4 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/exports/views.d.ts +5 -0
- package/dist/exports/views.d.ts.map +1 -1
- package/dist/exports/views.js +5 -0
- package/dist/exports/views.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/getRequestLocale.js +1 -1
- package/dist/utilities/getRequestLocale.js.map +1 -1
- package/dist/views/Account/index.d.ts +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +1 -1
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts +2 -2
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.d.ts +1 -1
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +10 -10
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/index.d.ts +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +2 -2
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +8 -0
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/List/index.d.ts +12 -3
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +4 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/getRouteData.js +5 -5
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/package.json +16 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestLocale.js","names":["upsertPreferences","findLocaleFromCode","getPreferences","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","
|
|
1
|
+
{"version":3,"file":"getRequestLocale.js","names":["upsertPreferences","findLocaleFromCode","getPreferences","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","user","key","value","id","collection","defaultLocale","undefined"],"sources":["../../src/utilities/getRequestLocale.ts"],"sourcesContent":["import type { Locale, PayloadRequest } from 'payload'\n\nimport { upsertPreferences } from '@payloadcms/ui/rsc'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\n\nimport { getPreferences } from './getPreferences.js'\n\ntype GetRequestLocalesArgs = {\n req: PayloadRequest\n}\n\nexport async function getRequestLocale({ req }: GetRequestLocalesArgs): Promise<Locale> {\n if (req.payload.config.localization) {\n const localeFromParams = req.query.locale as string | undefined\n\n if (req.user && localeFromParams) {\n await upsertPreferences<Locale['code']>({ key: 'locale', req, value: localeFromParams })\n }\n\n return (\n (req.user &&\n findLocaleFromCode(\n req.payload.config.localization,\n localeFromParams ||\n (\n await getPreferences<Locale['code']>(\n 'locale',\n req.payload,\n req.user.id,\n req.user.collection,\n )\n )?.value,\n )) ||\n findLocaleFromCode(\n req.payload.config.localization,\n req.payload.config.localization.defaultLocale || 'en',\n )\n )\n }\n\n return undefined\n}\n"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ;AAClC,SAASC,kBAAkB,QAAQ;AAEnC,SAASC,cAAc,QAAQ;AAM/B,OAAO,eAAeC,iBAAiB;EAAEC;AAAG,CAAyB;EACnE,IAAIA,GAAA,CAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;IACnC,MAAMC,gBAAA,GAAmBJ,GAAA,CAAIK,KAAK,CAACC,MAAM;IAEzC,IAAIN,GAAA,CAAIO,IAAI,IAAIH,gBAAA,EAAkB;MAChC,MAAMR,iBAAA,CAAkC;QAAEY,GAAA,EAAK;QAAUR,GAAA;QAAKS,KAAA,EAAOL;MAAiB;IACxF;IAEA,OACEJ,GAAC,CAAIO,IAAI,IACPV,kBAAA,CACEG,GAAA,CAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BC,gBAAA,IAEI,OAAMN,cAAA,CACJ,UACAE,GAAA,CAAIC,OAAO,EACXD,GAAA,CAAIO,IAAI,CAACG,EAAE,EACXV,GAAA,CAAIO,IAAI,CAACI,UAAU,CACrB,GACCF,KAAA,KAETZ,kBAAA,CACEG,GAAA,CAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BH,GAAA,CAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,CAACS,aAAa,IAAI;EAGvD;EAEA,OAAOC,SAAA;AACT","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AdminViewServerProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function AccountView({ initPageResult, params, searchParams }: AdminViewServerProps): Promise<React.JSX.Element>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Account/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA+B,MAAM,SAAS,CAAA;AAMhF,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,wBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Account/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA+B,MAAM,SAAS,CAAA;AAMhF,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,wBAAsB,WAAW,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,oBAAoB,8BAsJ/F"}
|
|
@@ -13,7 +13,7 @@ import { getVersions } from '../Document/getVersions.js';
|
|
|
13
13
|
import { EditView } from '../Edit/index.js';
|
|
14
14
|
import { AccountClient } from './index.client.js';
|
|
15
15
|
import { Settings } from './Settings/index.js';
|
|
16
|
-
export async function
|
|
16
|
+
export async function AccountView({
|
|
17
17
|
initPageResult,
|
|
18
18
|
params,
|
|
19
19
|
searchParams
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderServerComponent","buildFormState","notFound","React","DocumentHeader","getDocPreferences","getDocumentData","getDocumentPermissions","getIsLocked","getVersions","EditView","AccountClient","Settings","
|
|
1
|
+
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderServerComponent","buildFormState","notFound","React","DocumentHeader","getDocPreferences","getDocumentData","getDocumentPermissions","getIsLocked","getVersions","EditView","AccountClient","Settings","AccountView","initPageResult","params","searchParams","languageOptions","locale","permissions","req","i18n","payload","config","user","admin","theme","userSlug","routes","api","serverURL","collectionConfig","collections","id","data","collectionSlug","slug","Error","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","state","formState","code","operation","renderAllFields","schemaPath","skipValidation","currentEditor","isLocked","lastUpdateTime","isEditing","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","doc","_jsx","AfterFields","apiURL","initialData","initialState","_jsxs","hideTabs","Component","components","views","account","Fallback","importMap","serverProps","routeSegments"],"sources":["../../../src/views/Account/index.tsx"],"sourcesContent":["import type { AdminViewServerProps, DocumentViewServerPropsOnly } from 'payload'\n\nimport { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound } from 'next/navigation.js'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getDocPreferences } from '../Document/getDocPreferences.js'\nimport { getDocumentData } from '../Document/getDocumentData.js'\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { getIsLocked } from '../Document/getIsLocked.js'\nimport { getVersions } from '../Document/getVersions.js'\nimport { EditView } from '../Edit/index.js'\nimport { AccountClient } from './index.client.js'\nimport { Settings } from './Settings/index.js'\n\nexport async function AccountView({ initPageResult, params, searchParams }: AdminViewServerProps) {\n const {\n languageOptions,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: { theme, user: userSlug },\n routes: { api },\n serverURL,\n } = config\n\n const collectionConfig = payload?.collections?.[userSlug]?.config\n\n if (collectionConfig && user?.id) {\n // Fetch the data required for the view\n const data = await getDocumentData({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n locale,\n payload,\n req,\n user,\n })\n\n if (!data) {\n throw new Error('not-found')\n }\n\n // Get document preferences\n const docPreferences = await getDocPreferences({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n payload,\n user,\n })\n\n // Get permissions\n const { docPermissions, hasPublishPermission, hasSavePermission } =\n await getDocumentPermissions({\n id: user.id,\n collectionConfig,\n data,\n req,\n })\n\n // Build initial form state from data\n const { state: formState } = await buildFormState({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n data,\n docPermissions,\n docPreferences,\n locale: locale?.code,\n operation: 'update',\n renderAllFields: true,\n req,\n schemaPath: collectionConfig.slug,\n skipValidation: true,\n })\n\n // Fetch document lock state\n const { currentEditor, isLocked, lastUpdateTime } = await getIsLocked({\n id: user.id,\n collectionConfig,\n isEditing: true,\n req,\n })\n\n // Get all versions required for UI\n const { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount } =\n await getVersions({\n id: user.id,\n collectionConfig,\n doc: data,\n docPermissions,\n locale: locale?.code,\n payload,\n user,\n })\n\n return (\n <DocumentInfoProvider\n AfterFields={\n <Settings\n i18n={i18n}\n languageOptions={languageOptions}\n payload={payload}\n theme={theme}\n user={user}\n />\n }\n apiURL={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n collectionSlug={userSlug}\n currentEditor={currentEditor}\n docPermissions={docPermissions}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={user?.id}\n initialData={data}\n initialState={formState}\n isEditing\n isLocked={isLocked}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <EditDepthProvider>\n <DocumentHeader\n collectionConfig={collectionConfig}\n hideTabs\n permissions={permissions}\n req={req}\n />\n <HydrateAuthProvider permissions={permissions} />\n {RenderServerComponent({\n Component: config.admin?.components?.views?.account?.Component,\n Fallback: EditView,\n importMap: payload.importMap,\n serverProps: {\n doc: data,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: [],\n searchParams,\n user,\n } satisfies DocumentViewServerProp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;YACAH,WAAA;YACAqD,aAAA,EAAe,EAAE;YACjBxD,YAAA;YACAQ;UACF;QACF,I,aACAkC,IAAA,CAAC/C,aAAA;;;EAIT;EAEA,OAAOT,QAAA;AACT","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { groupNavItems } from '@payloadcms/ui/shared';
|
|
2
|
-
import type { ClientUser, Locale
|
|
2
|
+
import type { AdminViewServerPropsOnly, ClientUser, Locale } from 'payload';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
export type DashboardViewClientProps = {
|
|
@@ -22,7 +22,7 @@ export type DashboardViewServerPropsOnly = {
|
|
|
22
22
|
*/
|
|
23
23
|
Link?: React.ComponentType;
|
|
24
24
|
navGroups?: ReturnType<typeof groupNavItems>;
|
|
25
|
-
} &
|
|
25
|
+
} & AdminViewServerPropsOnly;
|
|
26
26
|
export type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly;
|
|
27
27
|
export declare function DefaultDashboard(props: DashboardViewServerProps): React.JSX.Element;
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,SAAS,CAAA;AAOxF,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,aAAa,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QAC/F,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;CAC7C,GAAG,wBAAwB,CAAA;AAE5B,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,4BAA4B,CAAA;AAE9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,qBA+J/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { ClientUser, Locale, ServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardViewClientProps = {\n locale: Locale\n}\n\nexport type DashboardViewServerPropsOnly = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n} & ServerProps\n\nexport type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly\n\nexport function DefaultDashboard(props: DashboardViewServerProps) {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAE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;aAzFwCH,UAAA;QA6FhD;UAGHjB,cAAA,IACClB,qBAAA,CAAsB;QACpB4B,SAAA,EAAWV,cAAA;QACXW,SAAA,EAAWf,OAAA,CAAQe,SAAS;QAC5BC,WAAA,EAAa;UACXrB,IAAA;UACAE,MAAA;UACAE,MAAA;UACAC,OAAA;UACAQ,WAAA;UACAC,YAAA;UACAC;QACF;MACF;;;AAIV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { AdminViewServerPropsOnly, ClientUser, Locale, ServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardViewClientProps = {\n locale: Locale\n}\n\nexport type DashboardViewServerPropsOnly = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n} & AdminViewServerPropsOnly\n\nexport type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly\n\nexport function DefaultDashboard(props: DashboardViewServerProps) {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,MAAMC,SAAA,GAAY;AAuBlB,OAAO,SAASC,iBAAiBC,KAA+B;EAC9D,MAAM;IACJC,UAAU;IACVC,IAAI;IACJA,IAAA,EAAM;MAAEC;IAAC,CAAE;IACXC,MAAM;IACNC,SAAS;IACTC,MA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from 'react';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function DashboardView(props: AdminViewServerProps): Promise<React.JSX.Element>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Dashboard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Dashboard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAa,MAAM,SAAS,CAAA;AAK9D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC,wBAAsB,aAAa,CAAC,KAAK,EAAE,oBAAoB,8BAmH9D"}
|
|
@@ -4,11 +4,8 @@ import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerCompo
|
|
|
4
4
|
import { EntityType, groupNavItems } from '@payloadcms/ui/shared';
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import { DefaultDashboard } from './Default/index.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
params,
|
|
10
|
-
searchParams
|
|
11
|
-
}) {
|
|
7
|
+
const globalLockDurationDefault = 300;
|
|
8
|
+
export async function DashboardView(props) {
|
|
12
9
|
const {
|
|
13
10
|
locale,
|
|
14
11
|
permissions,
|
|
@@ -22,7 +19,7 @@ export async function Dashboard({
|
|
|
22
19
|
},
|
|
23
20
|
req,
|
|
24
21
|
visibleEntities
|
|
25
|
-
} = initPageResult;
|
|
22
|
+
} = props.initPageResult;
|
|
26
23
|
const collections = config.collections.filter(collection => permissions?.collections?.[collection.slug]?.read && visibleEntities.collections.includes(collection.slug));
|
|
27
24
|
const globals = config.globals.filter(global => permissions?.globals?.[global.slug]?.read && visibleEntities.globals.includes(global.slug));
|
|
28
25
|
// Query locked global documents only if there are globals in the config
|
|
@@ -34,6 +31,11 @@ export async function Dashboard({
|
|
|
34
31
|
overrideAccess: false,
|
|
35
32
|
pagination: false,
|
|
36
33
|
req,
|
|
34
|
+
select: {
|
|
35
|
+
globalSlug: true,
|
|
36
|
+
updatedAt: true,
|
|
37
|
+
user: true
|
|
38
|
+
},
|
|
37
39
|
where: {
|
|
38
40
|
globalSlug: {
|
|
39
41
|
exists: true
|
|
@@ -42,8 +44,7 @@ export async function Dashboard({
|
|
|
42
44
|
});
|
|
43
45
|
// Map over globals to include `lockDuration` and lock data for each global slug
|
|
44
46
|
globalData = config.globals.map(global => {
|
|
45
|
-
const
|
|
46
|
-
const lockDuration = typeof global.lockDocuments === 'object' ? global.lockDocuments.duration : lockDurationDefault;
|
|
47
|
+
const lockDuration = typeof global.lockDocuments === 'object' ? global.lockDocuments.duration : globalLockDurationDefault;
|
|
47
48
|
const lockedDoc = lockedDocuments.docs.find(doc => doc.globalSlug === global.slug);
|
|
48
49
|
return {
|
|
49
50
|
slug: global.slug,
|
|
@@ -82,14 +83,13 @@ export async function Dashboard({
|
|
|
82
83
|
Fallback: DefaultDashboard,
|
|
83
84
|
importMap: payload.importMap,
|
|
84
85
|
serverProps: {
|
|
86
|
+
...props,
|
|
85
87
|
globalData,
|
|
86
88
|
i18n,
|
|
87
89
|
locale,
|
|
88
90
|
navGroups,
|
|
89
|
-
params,
|
|
90
91
|
payload,
|
|
91
92
|
permissions,
|
|
92
|
-
searchParams,
|
|
93
93
|
user,
|
|
94
94
|
visibleEntities
|
|
95
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["HydrateAuthProvider","SetStepNav","RenderServerComponent","EntityType","groupNavItems","React","Fragment","DefaultDashboard","
|
|
1
|
+
{"version":3,"file":"index.js","names":["HydrateAuthProvider","SetStepNav","RenderServerComponent","EntityType","groupNavItems","React","Fragment","DefaultDashboard","globalLockDurationDefault","DashboardView","props","locale","permissions","req","i18n","payload","config","user","visibleEntities","initPageResult","collections","filter","collection","slug","read","includes","globals","global","globalData","length","lockedDocuments","find","depth","overrideAccess","pagination","select","globalSlug","updatedAt","where","exists","map","lockDuration","lockDocuments","duration","lockedDoc","docs","doc","data","_isLocked","_lastEditedAt","_userEditing","value","navGroups","entityToGroup","type","entity","_jsxs","_jsx","nav","clientProps","Component","admin","components","views","dashboard","Fallback","importMap","serverProps"],"sources":["../../../src/views/Dashboard/index.tsx"],"sourcesContent":["import type { EntityToGroup } from '@payloadcms/ui/shared'\nimport type { AdminViewServerProps, TypedUser } from 'payload'\n\nimport { HydrateAuthProvider, SetStepNav } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType, groupNavItems } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport type { DashboardViewClientProps, DashboardViewServerPropsOnly } from './Default/index.js'\n\nimport { DefaultDashboard } from './Default/index.js'\n\nconst globalLockDurationDefault = 300\n\nexport async function DashboardView(props: AdminViewServerProps) {\n const {\n locale,\n permissions,\n req: {\n i18n,\n payload: { config },\n payload,\n user,\n },\n req,\n visibleEntities,\n } = props.initPageResult\n const collections = config.collections.filter(\n (collection) =>\n permissions?.collections?.[collection.slug]?.read &&\n visibleEntities.collections.includes(collection.slug),\n )\n\n const globals = config.globals.filter(\n (global) =>\n permissions?.globals?.[global.slug]?.read && visibleEntities.globals.includes(global.slug),\n )\n\n // Query locked global documents only if there are globals in the config\n let globalData: DashboardViewServerPropsOnly['globalData'] = []\n\n if (config.globals.length > 0) {\n const lockedDocuments = await payload.find({\n collection: 'payload-locked-documents',\n depth: 1,\n overrideAccess: false,\n pagination: false,\n req,\n select: {\n globalSlug: true,\n updatedAt: true,\n user: true,\n },\n where: {\n globalSlug: {\n exists: true,\n },\n },\n })\n\n // Map over globals to include `lockDuration` and lock data for each global slug\n globalData = config.globals.map((global) => {\n const lockDuration =\n typeof global.lockDocuments === 'object'\n ? global.lockDocuments.duration\n : globalLockDurationDefault\n\n const lockedDoc = lockedDocuments.docs.find((doc) => doc.globalSlug === global.slug)\n\n return {\n slug: global.slug,\n data: {\n _isLocked: !!lockedDoc,\n _lastEditedAt: (lockedDoc?.updatedAt as string) ?? null,\n _userEditing: (lockedDoc?.user as { value?: TypedUser })?.value ?? null,\n },\n lockDuration,\n }\n })\n }\n\n const navGroups = groupNavItems(\n [\n ...(collections.map((collection) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.collection,\n entity: collection,\n }\n\n return entityToGroup\n }) ?? []),\n ...(globals.map((global) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.global,\n entity: global,\n }\n\n return entityToGroup\n }) ?? []),\n ],\n permissions,\n i18n,\n )\n\n return (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <SetStepNav nav={[]} />\n {RenderServerComponent({\n clientProps: {\n locale,\n } satisfies DashboardViewClientProps,\n Component: config.admin?.components?.views?.dashboard?.Component,\n Fallback: DefaultDashboard,\n importMap: payload.importMap,\n serverProps: {\n ...props,\n globalData,\n i18n,\n locale,\n navGroups,\n payload,\n permissions,\n user,\n visibleEntities,\n } satisfies DashboardViewServerPropsOnly,\n })}\n </Fragment>\n )\n}\n"],"mappings":";AAGA,SAASA,mBAAmB,EAAEC,UAAU,QAAQ;AAChD,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,aAAa,QAAQ;AAC1C,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,SAASC,gBAAgB,QAAQ;AAEjC,MAAMC,yBAAA,GAA4B;AAElC,OAAO,eAAeC,cAAcC,KAA2B;EAC7D,MAAM;IACJC,MAAM;IACNC,WAAW;IACXC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBD,OAAO;MACPE;IAAI,CACL;IACDJ,GAAG;IACHK;EAAe,CAChB,GAAGR,KAAA,CAAMS,cAAc;EACxB,MAAMC,WAAA,GAAcJ,MAAA,CAAOI,WAAW,CAACC,MAAM,CAC1CC,UAAA,IACCV,WAAA,EAAaQ,WAAA,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IAAA,EAAgCkC,KAAA,IAAS;QACrE;QACAV;MACF;IACF;EACF;EAEA,MAAMW,SAAA,GAAYhD,aAAA,CAChB,C,IACMgB,WAAA,CAAYoB,GAAG,CAAElB,UAAA;IACnB,MAAM+B,aAAA,GAA+B;MACnCC,IAAA,EAAMnD,UAAA,CAAWmB,UAAU;MAC3BiC,MAAA,EAAQjC;IACV;IAEA,OAAO+B,aAAA;EACT,MAAM,EAAE,G,IACJ3B,OAAA,CAAQc,GAAG,CAAEb,MAAA;IACf,MAAM0B,aAAA,GAA+B;MACnCC,IAAA,EAAMnD,UAAA,CAAWwB,MAAM;MACvB4B,MAAA,EAAQ5B;IACV;IAEA,OAAO0B,aAAA;EACT,MAAM,EAAE,EACT,EACDzC,WAAA,EACAE,IAAA;EAGF,oBACE0C,KAAA,CAAClD,QAAA;4BACCmD,IAAA,CAACzD,mBAAA;MAAoBY,WAAA,EAAaA;qBAClC6C,IAAA,CAACxD,UAAA;MAAWyD,GAAA,EAAK;QAChBxD,qBAAA,CAAsB;MACrByD,WAAA,EAAa;QACXhD;MACF;MACAiD,SAAA,EAAW5C,MAAA,CAAO6C,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAOC,SAAA,EAAWJ,SAAA;MACvDK,QAAA,EAAU1D,gBAAA;MACV2D,SAAA,EAAWnD,OAAA,CAAQmD,SAAS;MAC5BC,WAAA,EAAa;QACX,GAAGzD,KAAK;QACRkB,UAAA;QACAd,IAAA;QACAH,MAAA;QACAyC,SAAA;QACArC,OAAA;QACAH,WAAA;QACAK,IAAA;QACAC;MACF;IACF;;AAGN","ignoreList":[]}
|
|
@@ -21,5 +21,5 @@ export declare const renderDocument: ({ disableActions, documentSubViewType, dra
|
|
|
21
21
|
data: Data;
|
|
22
22
|
Document: React.ReactNode;
|
|
23
23
|
}>;
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function DocumentView(props: AdminViewServerProps): Promise<React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | (string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>)>;
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAehB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAcrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,6PAgBxB;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAehB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAcrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,6PAgBxB;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAoVA,CAAA;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,oBAAoB,+QAe7D"}
|
|
@@ -311,7 +311,7 @@ export const renderDocument = async ({
|
|
|
311
311
|
children: /*#__PURE__*/_jsxs(LivePreviewProvider, {
|
|
312
312
|
breakpoints: livePreviewConfig?.breakpoints,
|
|
313
313
|
isLivePreviewEnabled: isLivePreviewEnabled && operation !== 'create',
|
|
314
|
-
isLivePreviewing: entityPreferences?.value?.editViewType === 'live-preview',
|
|
314
|
+
isLivePreviewing: Boolean(entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL),
|
|
315
315
|
typeofLivePreviewURL: typeof livePreviewConfig?.url,
|
|
316
316
|
url: livePreviewURL,
|
|
317
317
|
children: [showHeader && !drawerSlug && /*#__PURE__*/_jsx(DocumentHeader, {
|
|
@@ -334,7 +334,7 @@ export const renderDocument = async ({
|
|
|
334
334
|
}, locale?.code)
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
|
-
export async function
|
|
337
|
+
export async function DocumentView(props) {
|
|
338
338
|
try {
|
|
339
339
|
const {
|
|
340
340
|
Document: RenderedDocument
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","RenderServerComponent","handleLivePreview","isEditing","getIsEditing","buildFormState","notFound","redirect","logError","formatAdminURL","React","DocumentHeader","getPreferences","NotFoundView","getDocPreferences","getDocumentData","getDocumentPermissions","getDocumentView","getIsLocked","getMetaBySegment","getVersions","renderDocumentSlots","generateMetadata","args","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","Error","isTrashedDoc","deletedAt","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","drafts","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","autosave","validateDraftData","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","props","RenderedDocument","error","message","err"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { handleLivePreview } from '@payloadcms/ui/rsc'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/shared'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound, redirect } from 'next/navigation.js'\nimport { logError } from 'payload'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getPreferences } from '../../utilities/getPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocPreferences } from './getDocPreferences.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { getIsLocked } from './getIsLocked.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getVersions } from './getVersions.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = typeof doc?.deletedAt === 'string'\n\n const [\n docPreferences,\n { docPermissions, hasPublishPermission, hasSavePermission },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req,\n }),\n\n // Fetch document lock state\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n ])\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = collectionSlug\n ? `${serverURL}${apiRoute}/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n : ''\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n }\n\n if (!View) {\n View = NotFoundView\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n\n redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n globalConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={entityPreferences?.value?.editViewType === 'live-preview'}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function Document(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n notFound()\n }\n }\n}\n"],"mappings":";AAYA,SACEA,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,EAAEC,QAAQ,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,eAAe,QAAQ;AAChC,SAASC,WAAW,QAAQ;AAC5B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,WAAW,QAAQ;AAC5B,SAASC,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,gBAAA,GAA6C,MAAOC,IAAA,IAASJ,gBAAA,CAAiBI,IAAA;AAQ3F;;;;;;AAMA,OAAO,MAAMC,cAAA,GAAiB,MAAAA,CAAO;EACnCC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,wBAAwB;EACxBC,MAAM;EACNC,mBAAmB;EACnBC,mBAAmB;EACnBC,sBAAsB;EACtBC,oBAAoB;EACpBC,YAAY;EACZC,QAAQ;EACRC;AAAQ,CASc;EAItB,MAAM;IACJC,gBA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,UAAA,iBACd0G,IAAA,CAAC1H,cAAA;UACCoI,WAAA,EAAahB,WAAA;UACbvF,gBAAA,EAAkBA,gBAAA;UAClBG,YAAA,EAAcA,YAAA;UACdE,WAAA,EAAaA,WAAA;UACbC,GAAA,EAAKA;yBAGTuF,IAAA,CAACtI,mBAAA;UAAoB8C,WAAA,EAAaA;yBAClCwF,IAAA,CAACvI,iBAAA;oBACEG,qBAAA,CAAsB;YACrB+H,WAAA;YACAV,SAAA,EAAWP,IAAA;YACXnF,SAAA;YACAoH,WAAA,EAAa9C;UACf;;;OAjCCtD,MAAA,EAAQgD,IAAA;EAsCnB;AACF;AAEA,OAAO,eAAewC,SAASa,KAA2B;EACxD,IAAI;IACF,MAAM;MAAEb,QAAA,EAAUc;IAAgB,CAAE,GAAG,MAAM1H,cAAA,CAAeyH,KAAA;IAC5D,OAAOC,gBAAA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEA3I,QAAA,CAAS;MAAE6I,GAAA,EAAKF,KAAA;MAAOnG,OAAA,EAASiG,KAAA,CAAMnH,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAImG,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjC9I,QAAA;IACF;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","RenderServerComponent","handleLivePreview","isEditing","getIsEditing","buildFormState","notFound","redirect","logError","formatAdminURL","React","DocumentHeader","getPreferences","NotFoundView","getDocPreferences","getDocumentData","getDocumentPermissions","getDocumentView","getIsLocked","getMetaBySegment","getVersions","renderDocumentSlots","generateMetadata","args","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","Error","isTrashedDoc","deletedAt","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","drafts","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","autosave","validateDraftData","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","Boolean","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { handleLivePreview } from '@payloadcms/ui/rsc'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/shared'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound, redirect } from 'next/navigation.js'\nimport { logError } from 'payload'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getPreferences } from '../../utilities/getPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocPreferences } from './getDocPreferences.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { getIsLocked } from './getIsLocked.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getVersions } from './getVersions.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = typeof doc?.deletedAt === 'string'\n\n const [\n docPreferences,\n { docPermissions, hasPublishPermission, hasSavePermission },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req,\n }),\n\n // Fetch document lock state\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n ])\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = collectionSlug\n ? `${serverURL}${apiRoute}/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n : ''\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n }\n\n if (!View) {\n View = NotFoundView\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n\n redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n globalConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL,\n )}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n notFound()\n }\n }\n}\n"],"mappings":";AAYA,SACEA,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,EAAEC,QAAQ,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,eAAe,QAAQ;AAChC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AAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAIqG,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjChJ,QAAA;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDocumentSlots.d.ts","sourceRoot":"","sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EAEb,cAAc,EAGd,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EAGrB,cAAc,EAKf,MAAM,SAAS,CAAA;AAOhB,eAAO,MAAM,mBAAmB,EAAE,CAAC,IAAI,EAAE;IACvC,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,WAAW,EAAE,4BAA4B,CAAA;IACzC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,
|
|
1
|
+
{"version":3,"file":"renderDocumentSlots.d.ts","sourceRoot":"","sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EAEb,cAAc,EAGd,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EAGrB,cAAc,EAKf,MAAM,SAAS,CAAA;AAOhB,eAAO,MAAM,mBAAmB,EAAE,CAAC,IAAI,EAAE;IACvC,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,WAAW,EAAE,4BAA4B,CAAA;IACzC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,aAuJL,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,cAAc,CAAC;IACtD,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB,CAsBA,CAAA"}
|
|
@@ -42,6 +42,14 @@ export const renderDocumentSlots = args => {
|
|
|
42
42
|
serverProps: serverProps
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
const LivePreview = collectionConfig?.admin?.components?.views?.edit?.livePreview || globalConfig?.admin?.components?.views?.edit?.livePreview;
|
|
46
|
+
if (LivePreview?.Component) {
|
|
47
|
+
components.LivePreview = RenderServerComponent({
|
|
48
|
+
Component: LivePreview.Component,
|
|
49
|
+
importMap: req.payload.importMap,
|
|
50
|
+
serverProps
|
|
51
|
+
});
|
|
52
|
+
}
|
|
45
53
|
const descriptionFromConfig = collectionConfig?.admin?.description || globalConfig?.admin?.description;
|
|
46
54
|
const staticDescription = typeof descriptionFromConfig === 'function' ? descriptionFromConfig({
|
|
47
55
|
t: req.i18n.t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDocumentSlots.js","names":["ViewDescription","RenderServerComponent","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","globalConfig","hasSavePermission","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","user","BeforeDocumentControls","edit","beforeDocumentControls","elements","Component","importMap","EditMenuItems","editMenuItems","CustomPreviewButton","PreviewButton","descriptionFromConfig","description","staticDescription","t","CustomDescription","Description","hasDescription","clientProps","collectionSlug","slug","Fallback","versions","drafts","CustomPublishButton","PublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","autosave","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","renderDocumentSlotsHandler","collections","config","Error","docPermissions","data","permissions"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { ViewDescription } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\n\nexport const renderDocumentSlots: (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n hasSavePermission: boolean\n id?: number | string\n permissions: SanitizedDocumentPermissions\n req: PayloadRequest\n}) => DocumentSlots = (args) => {\n const { id, collectionConfig, globalConfig, hasSavePermission, req } = args\n\n const components: DocumentSlots = {} as DocumentSlots\n\n const unsavedDraftWithValidations = undefined\n\n const isPreviewEnabled = collectionConfig?.admin?.preview || globalConfig?.admin?.preview\n\n const serverProps: ServerProps = {\n id,\n i18n: req.i18n,\n payload: req.payload,\n user: req.user,\n // TODO: Add remaining serverProps\n }\n\n const BeforeDocumentControls =\n collectionConfig?.admin?.components?.edit?.beforeDocumentControls ||\n globalConfig?.admin?.components?.elements?.beforeDocumentControls\n\n if (BeforeDocumentControls) {\n components.BeforeDocumentControls = RenderServerComponent({\n Component: BeforeDocumentControls,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies BeforeDocumentControlsServerPropsOnly,\n })\n }\n\n const EditMenuItems = collectionConfig?.admin?.components?.edit?.editMenuItems\n\n if (EditMenuItems) {\n components.EditMenuItems = RenderServerComponent({\n Component: EditMenuItems,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies EditMenuItemsServerPropsOnly,\n })\n }\n\n const CustomPreviewButton =\n collectionConfig?.admin?.components?.edit?.PreviewButton ||\n globalConfig?.admin?.components?.elements?.PreviewButton\n\n if (isPreviewEnabled && CustomPreviewButton) {\n components.PreviewButton = RenderServerComponent({\n Component: CustomPreviewButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PreviewButtonServerPropsOnly,\n })\n }\n\n const descriptionFromConfig =\n collectionConfig?.admin?.description || globalConfig?.admin?.description\n\n const staticDescription: StaticDescription =\n typeof descriptionFromConfig === 'function'\n ? descriptionFromConfig({ t: req.i18n.t })\n : descriptionFromConfig\n\n const CustomDescription =\n collectionConfig?.admin?.components?.Description ||\n globalConfig?.admin?.components?.elements?.Description\n\n const hasDescription = CustomDescription || staticDescription\n\n if (hasDescription) {\n components.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig?.slug,\n description: staticDescription,\n } satisfies ViewDescriptionClientProps,\n Component: CustomDescription,\n Fallback: ViewDescription,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n if (hasSavePermission) {\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomPublishButton =\n collectionConfig?.admin?.components?.edit?.PublishButton ||\n globalConfig?.admin?.components?.elements?.PublishButton\n\n if (CustomPublishButton) {\n components.PublishButton = RenderServerComponent({\n Component: CustomPublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.elements?.SaveDraftButton\n\n const draftsEnabled =\n (collectionConfig?.versions?.drafts && !collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && !globalConfig?.versions?.drafts?.autosave)\n\n if ((draftsEnabled || unsavedDraftWithValidations) && CustomSaveDraftButton) {\n components.SaveDraftButton = RenderServerComponent({\n Component: CustomSaveDraftButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveDraftButtonServerPropsOnly,\n })\n }\n } else {\n const CustomSaveButton =\n collectionConfig?.admin?.components?.edit?.SaveButton ||\n globalConfig?.admin?.components?.elements?.SaveButton\n\n if (CustomSaveButton) {\n components.SaveButton = RenderServerComponent({\n Component: CustomSaveButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveButtonServerPropsOnly,\n })\n }\n }\n }\n\n if (collectionConfig?.upload && collectionConfig?.admin?.components?.edit?.Upload) {\n components.Upload = RenderServerComponent({\n Component: collectionConfig.admin.components.edit.Upload,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n if (collectionConfig?.upload && collectionConfig.upload.admin?.components?.controls) {\n components.UploadControls = RenderServerComponent({\n Component: collectionConfig.upload.admin.components.controls,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n return components\n}\n\nexport const renderDocumentSlotsHandler: ServerFunction<{\n collectionSlug: string\n id?: number | string\n}> = async (args) => {\n const { id, collectionSlug, req } = args\n\n const collectionConfig = req.payload.collections[collectionSlug]?.config\n\n if (!collectionConfig) {\n throw new Error(req.t('error:incorrectCollection'))\n }\n\n const { docPermissions, hasSavePermission } = await getDocumentPermissions({\n collectionConfig,\n data: {},\n req,\n })\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n}\n"],"mappings":"AAmBA,SAASA,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AAEtC,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GAOUC,IAAA;EACrB,MAAM;IAAEC,EAAE;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC,iBAAiB;IAAEC;EAAG,CAAE,GAAGL,IAAA;EAEvE,MAAMM,UAAA,GAA4B,CAAC;EAEnC,MAAMC,2BAAA,GAA8BC,SAAA;EAEpC,MAAMC,gBAAA,GAAmBP,gBAAA,EAAkBQ,KAAA,EAAOC,OAAA,IAAWR,YAAA,EAAcO,KAAA,EAAOC,OAAA;EAElF,MAAMC,WAAA,GAA2B;IAC/BX,EAAA;IACAY,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdC,OAAA,EAAST,GAAA,CAA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rC,KAAK,EAAEJ,UAAA,EAAY2C,QAAA,EAAU;IACnF3C,UAAA,CAAW4C,cAAc,GAAGrD,qBAAA,CAAsB;MAChDuB,SAAA,EAAWlB,gBAAA,CAAiB6C,MAAM,CAACrC,KAAK,CAACJ,UAAU,CAAC2C,QAAQ;MAC5D5B,SAAA,EAAWhB,GAAA,CAAIS,OAAO,CAACO,SAAS;MAChCT;IACF;EACF;EAEA,OAAON,UAAA;AACT;AAEA,OAAO,MAAM6C,0BAAA,GAGR,MAAOnD,IAAA;EACV,MAAM;IAAEC,EAAE;IAAEiC,cAAc;IAAE7B;EAAG,CAAE,GAAGL,IAAA;EAEpC,MAAME,gBAAA,GAAmBG,GAAA,CAAIS,OAAO,CAACsC,WAAW,CAAClB,cAAA,CAAe,EAAEmB,MAAA;EAElE,IAAI,CAACnD,gBAAA,EAAkB;IACrB,MAAM,IAAIoD,KAAA,CAAMjD,GAAA,CAAIwB,CAAC,CAAC;EACxB;EAEA,MAAM;IAAE0B,cAAc;IAAEnD;EAAiB,CAAE,GAAG,MAAMN,sBAAA,CAAuB;IACzEI,gBAAA;IACAsD,IAAA,EAAM,CAAC;IACPnD;EACF;EAEA,OAAON,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAE,iBAAA;IACAqD,WAAA,EAAaF,cAAA;IACblD;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderDocumentSlots.js","names":["ViewDescription","RenderServerComponent","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","globalConfig","hasSavePermission","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","user","BeforeDocumentControls","edit","beforeDocumentControls","elements","Component","importMap","EditMenuItems","editMenuItems","CustomPreviewButton","PreviewButton","LivePreview","views","livePreview","descriptionFromConfig","description","staticDescription","t","CustomDescription","Description","hasDescription","clientProps","collectionSlug","slug","Fallback","versions","drafts","CustomPublishButton","PublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","autosave","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","renderDocumentSlotsHandler","collections","config","Error","docPermissions","data","permissions"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { ViewDescription } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\n\nexport const renderDocumentSlots: (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n hasSavePermission: boolean\n id?: number | string\n permissions: SanitizedDocumentPermissions\n req: PayloadRequest\n}) => DocumentSlots = (args) => {\n const { id, collectionConfig, globalConfig, hasSavePermission, req } = args\n\n const components: DocumentSlots = {} as DocumentSlots\n\n const unsavedDraftWithValidations = undefined\n\n const isPreviewEnabled = collectionConfig?.admin?.preview || globalConfig?.admin?.preview\n\n const serverProps: ServerProps = {\n id,\n i18n: req.i18n,\n payload: req.payload,\n user: req.user,\n // TODO: Add remaining serverProps\n }\n\n const BeforeDocumentControls =\n collectionConfig?.admin?.components?.edit?.beforeDocumentControls ||\n globalConfig?.admin?.components?.elements?.beforeDocumentControls\n\n if (BeforeDocumentControls) {\n components.BeforeDocumentControls = RenderServerComponent({\n Component: BeforeDocumentControls,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies BeforeDocumentControlsServerPropsOnly,\n })\n }\n\n const EditMenuItems = collectionConfig?.admin?.components?.edit?.editMenuItems\n\n if (EditMenuItems) {\n components.EditMenuItems = RenderServerComponent({\n Component: EditMenuItems,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies EditMenuItemsServerPropsOnly,\n })\n }\n\n const CustomPreviewButton =\n collectionConfig?.admin?.components?.edit?.PreviewButton ||\n globalConfig?.admin?.components?.elements?.PreviewButton\n\n if (isPreviewEnabled && CustomPreviewButton) {\n components.PreviewButton = RenderServerComponent({\n Component: CustomPreviewButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PreviewButtonServerPropsOnly,\n })\n }\n\n const LivePreview =\n collectionConfig?.admin?.components?.views?.edit?.livePreview ||\n globalConfig?.admin?.components?.views?.edit?.livePreview\n\n if (LivePreview?.Component) {\n components.LivePreview = RenderServerComponent({\n Component: LivePreview.Component,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const descriptionFromConfig =\n collectionConfig?.admin?.description || globalConfig?.admin?.description\n\n const staticDescription: StaticDescription =\n typeof descriptionFromConfig === 'function'\n ? descriptionFromConfig({ t: req.i18n.t })\n : descriptionFromConfig\n\n const CustomDescription =\n collectionConfig?.admin?.components?.Description ||\n globalConfig?.admin?.components?.elements?.Description\n\n const hasDescription = CustomDescription || staticDescription\n\n if (hasDescription) {\n components.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig?.slug,\n description: staticDescription,\n } satisfies ViewDescriptionClientProps,\n Component: CustomDescription,\n Fallback: ViewDescription,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n if (hasSavePermission) {\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomPublishButton =\n collectionConfig?.admin?.components?.edit?.PublishButton ||\n globalConfig?.admin?.components?.elements?.PublishButton\n\n if (CustomPublishButton) {\n components.PublishButton = RenderServerComponent({\n Component: CustomPublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.elements?.SaveDraftButton\n\n const draftsEnabled =\n (collectionConfig?.versions?.drafts && !collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && !globalConfig?.versions?.drafts?.autosave)\n\n if ((draftsEnabled || unsavedDraftWithValidations) && CustomSaveDraftButton) {\n components.SaveDraftButton = RenderServerComponent({\n Component: CustomSaveDraftButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveDraftButtonServerPropsOnly,\n })\n }\n } else {\n const CustomSaveButton =\n collectionConfig?.admin?.components?.edit?.SaveButton ||\n globalConfig?.admin?.components?.elements?.SaveButton\n\n if (CustomSaveButton) {\n components.SaveButton = RenderServerComponent({\n Component: CustomSaveButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveButtonServerPropsOnly,\n })\n }\n }\n }\n\n if (collectionConfig?.upload && collectionConfig?.admin?.components?.edit?.Upload) {\n components.Upload = RenderServerComponent({\n Component: collectionConfig.admin.components.edit.Upload,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n if (collectionConfig?.upload && collectionConfig.upload.admin?.components?.controls) {\n components.UploadControls = RenderServerComponent({\n Component: collectionConfig.upload.admin.components.controls,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n return components\n}\n\nexport const renderDocumentSlotsHandler: ServerFunction<{\n collectionSlug: string\n id?: number | string\n}> = async (args) => {\n const { id, collectionSlug, req } = args\n\n const collectionConfig = req.payload.collections[collectionSlug]?.config\n\n if (!collectionConfig) {\n throw new Error(req.t('error:incorrectCollection'))\n }\n\n const { docPermissions, hasSavePermission } = await getDocumentPermissions({\n collectionConfig,\n data: {},\n req,\n })\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n}\n"],"mappings":"AAmBA,SAASA,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AAEtC,SAASC,sBAAsB,QAAQ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EpC,MAAME,gBAAA,GAAmBG,GAAA,CAAIS,OAAO,CAACyC,WAAW,CAAClB,cAAA,CAAe,EAAEmB,MAAA;EAElE,IAAI,CAACtD,gBAAA,EAAkB;IACrB,MAAM,IAAIuD,KAAA,CAAMpD,GAAA,CAAI2B,CAAC,CAAC;EACxB;EAEA,MAAM;IAAE0B,cAAc;IAAEtD;EAAiB,CAAE,GAAG,MAAMN,sBAAA,CAAuB;IACzEI,gBAAA;IACAyD,IAAA,EAAM,CAAC;IACPtD;EACF;EAEA,OAAON,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAE,iBAAA;IACAwD,WAAA,EAAaF,cAAA;IACbrD;EACF;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import type { AdminViewServerProps, ListQuery } from 'payload';
|
|
1
|
+
import type { AdminViewServerProps, ListQuery, ListViewClientProps, ListViewServerPropsOnly, PayloadComponent } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type RenderListViewArgs = {
|
|
7
|
+
/**
|
|
8
|
+
* Allows providing your own list view component. This will override the default list view component and
|
|
9
|
+
* the collection's configured list view component (if any).
|
|
10
|
+
*/
|
|
11
|
+
ComponentOverride?: PayloadComponent | React.ComponentType<ListViewClientProps | (ListViewClientProps & ListViewServerPropsOnly)>;
|
|
4
12
|
customCellProps?: Record<string, any>;
|
|
5
13
|
disableBulkDelete?: boolean;
|
|
6
14
|
disableBulkEdit?: boolean;
|
|
@@ -21,10 +29,11 @@ type RenderListViewArgs = {
|
|
|
21
29
|
* the list view on the server for both:
|
|
22
30
|
* - default list view
|
|
23
31
|
* - list view within drawers
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
24
34
|
*/
|
|
25
35
|
export declare const renderListView: (args: RenderListViewArgs) => Promise<{
|
|
26
36
|
List: React.ReactNode;
|
|
27
37
|
}>;
|
|
28
38
|
export declare const ListView: React.FC<RenderListViewArgs>;
|
|
29
|
-
export {};
|
|
30
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIpB,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIpB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EAEvB,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AAehB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EACd,gBAAgB,GAChB,KAAK,CAAC,aAAa,CAAC,mBAAmB,GAAG,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,CAAC,CAAA;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,KAAK,EAAE,SAAS,CAAA;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,oBAAoB,CAAA;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC;IACT,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAoVA,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAWjD,CAAA"}
|