@payloadcms/ui 4.0.0-canary.26 → 4.0.0-canary.27
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/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +10 -3
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +345 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -1
- package/dist/elements/WhereBuilder/conditionValue.d.ts +32 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.js +32 -0
- package/dist/elements/WhereBuilder/conditionValue.js.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js +65 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js.map +1 -0
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +15 -4
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/utilities/formatMetadata.d.ts.map +1 -1
- package/dist/utilities/formatMetadata.js +0 -5
- package/dist/utilities/formatMetadata.js.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.d.ts.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Version/generateVersionViewMetadata.js.map +1 -1
- package/dist/views/Versions/generateVersionsViewMetadata.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomGlobalViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCustomGlobalViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI/D,eAAO,MAAM,0BAA0B,2EAKpC;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAA;CAC7D,KAAG;IACF,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;CAwDvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomGlobalViewByRoute.js","names":["isPathMatchingRoute","getCustomGlobalViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getCustomGlobalViewByRoute.js","names":["isPathMatchingRoute","getCustomGlobalViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"sourcesContent":["import type { AdminViewConfig, SanitizedGlobalConfig } from 'payload'\n\nimport type { ViewFromConfig } from './getCustomViewByRoute.js'\n\nimport { isPathMatchingRoute } from '../../utilities/isPathMatchingRoute.js'\n\nexport const getCustomGlobalViewByRoute = ({\n adminRoute,\n baseRoute,\n currentRoute: currentRouteWithAdmin,\n views,\n}: {\n adminRoute: string\n baseRoute: string\n currentRoute: string\n views: SanitizedGlobalConfig['admin']['components']['views']\n}): {\n view: ViewFromConfig\n viewKey: null | string\n} => {\n const currentRoute =\n adminRoute === '/'\n ? currentRouteWithAdmin\n : currentRouteWithAdmin.startsWith(adminRoute)\n ? currentRouteWithAdmin.slice(adminRoute.length)\n : currentRouteWithAdmin\n\n if (views && typeof views === 'object') {\n const foundEntry = Object.entries(views).find(([key, view]) => {\n if (key === 'edit') {\n return false\n }\n\n const isAdminViewConfig =\n typeof view === 'object' &&\n view !== null &&\n 'path' in view &&\n 'Component' in view &&\n typeof view.path === 'string'\n\n if (isAdminViewConfig) {\n const adminView = view as AdminViewConfig\n const viewPath = `${baseRoute}${adminView.path}`\n\n return isPathMatchingRoute({\n currentRoute,\n exact: adminView.exact,\n path: viewPath,\n sensitive: adminView.sensitive,\n strict: adminView.strict,\n })\n }\n\n return false\n })\n\n if (foundEntry) {\n const [viewKey, foundViewConfig] = foundEntry\n const adminView = foundViewConfig as AdminViewConfig\n return {\n view: {\n payloadComponent: adminView.Component,\n },\n viewKey,\n }\n }\n }\n\n return {\n view: {\n Component: null,\n },\n viewKey: null,\n }\n}\n"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,0BAAA,GAA6BA,CAAC;EACzCC,UAAU;EACVC,SAAS;EACTC,YAAA,EAAcC,qBAAqB;EACnCC;AAAK,CAMN;EAIC,MAAMF,YAAA,GACJF,UAAA,KAAe,MACXG,qBAAA,GACAA,qBAAA,CAAsBE,UAAU,CAACL,UAAA,IAC/BG,qBAAA,CAAsBG,KAAK,CAACN,UAAA,CAAWO,MAAM,IAC7CJ,qBAAA;EAER,IAAIC,KAAA,IAAS,OAAOA,KAAA,KAAU,UAAU;IACtC,MAAMI,UAAA,GAAaC,MAAA,CAAOC,OAAO,CAACN,KAAA,EAAOO,IAAI,CAAC,CAAC,CAACC,GAAA,EAAKC,IAAA,CAAK;MACxD,IAAID,GAAA,KAAQ,QAAQ;QAClB,OAAO;MACT;MAEA,MAAME,iBAAA,GACJ,OAAOD,IAAA,KAAS,YAChBA,IAAA,KAAS,QACT,UAAUA,IAAA,IACV,eAAeA,IAAA,IACf,OAAOA,IAAA,CAAKE,IAAI,KAAK;MAEvB,IAAID,iBAAA,EAAmB;QACrB,MAAME,SAAA,GAAYH,IAAA;QAClB,MAAMI,QAAA,GAAW,GAAGhB,SAAA,GAAYe,SAAA,CAAUD,IAAI,EAAE;QAEhD,OAAOjB,mBAAA,CAAoB;UACzBI,YAAA;UACAgB,KAAA,EAAOF,SAAA,CAAUE,KAAK;UACtBH,IAAA,EAAME,QAAA;UACNE,SAAA,EAAWH,SAAA,CAAUG,SAAS;UAC9BC,MAAA,EAAQJ,SAAA,CAAUI;QACpB;MACF;MAEA,OAAO;IACT;IAEA,IAAIZ,UAAA,EAAY;MACd,MAAM,CAACa,OAAA,EAASC,eAAA,CAAgB,GAAGd,UAAA;MACnC,MAAMQ,SAAA,GAAYM,eAAA;MAClB,OAAO;QACLT,IAAA,EAAM;UACJU,gBAAA,EAAkBP,SAAA,CAAUQ;QAC9B;QACAH;MACF;IACF;EACF;EAEA,OAAO;IACLR,IAAA,EAAM;MACJW,SAAA,EAAW;IACb;IACAH,OAAA,EAAS;EACX;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomViewByKey.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomViewByKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCustomViewByKey.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomViewByKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D,eAAO,MAAM,kBAAkB,yBAG5B;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB,KAAG;IACF,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,IAaH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomViewByKey.js","names":["getCustomViewByKey","config","viewKey","customViewComponent","admin","components","views","view","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomViewByKey.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getCustomViewByKey.js","names":["getCustomViewByKey","config","viewKey","customViewComponent","admin","components","views","view","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomViewByKey.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type { ViewFromConfig } from './getCustomViewByRoute.js'\n\nexport const getCustomViewByKey = ({\n config,\n viewKey,\n}: {\n config: SanitizedConfig\n viewKey: string\n}): {\n view: ViewFromConfig\n viewKey: string\n} | null => {\n const customViewComponent = config.admin.components?.views?.[viewKey]\n\n if (!customViewComponent) {\n return null\n }\n\n return {\n view: {\n payloadComponent: customViewComponent.Component,\n },\n viewKey,\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,kBAAA,GAAqBA,CAAC;EACjCC,MAAM;EACNC;AAAO,CAIR;EAIC,MAAMC,mBAAA,GAAsBF,MAAA,CAAOG,KAAK,CAACC,UAAU,EAAEC,KAAA,GAAQJ,OAAA,CAAQ;EAErE,IAAI,CAACC,mBAAA,EAAqB;IACxB,OAAO;EACT;EAEA,OAAO;IACLI,IAAA,EAAM;MACJC,gBAAA,EAAkBL,mBAAA,CAAoBM;IACxC;IACAP;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVersionViewMetadata.js","names":["getTranslation","formatDate","formatMetadata","generateVersionViewMetadata","collectionConfig","config","globalConfig","i18n","t","metaToUse","admin","meta","doc","formattedCreatedAt","createdAt","date","pattern","dateFormat","useAsTitle","entityLabel","labels","singular","titleFromData","description","documentTitle","title","components","views","edit","version","label","serverURL"],"sources":["../../../src/views/Version/generateVersionViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatDate } from '../../utilities/formatDocTitle/formatDateTitle.js'\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const doc: any = {} // TODO: figure this out\n\n const formattedCreatedAt = doc?.createdAt\n ? formatDate({ date: doc.createdAt, i18n, pattern: config?.admin?.dateFormat })\n : ''\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const entityLabel = getTranslation(collectionConfig.labels.singular, i18n)\n const titleFromData = doc?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersion', { documentTitle: titleFromData, entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin?.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n if (globalConfig) {\n const entityLabel = getTranslation(globalConfig.label, i18n)\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionGlobal', { entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${entityLabel}`,\n ...(
|
|
1
|
+
{"version":3,"file":"generateVersionViewMetadata.js","names":["getTranslation","formatDate","formatMetadata","generateVersionViewMetadata","collectionConfig","config","globalConfig","i18n","t","metaToUse","admin","meta","doc","formattedCreatedAt","createdAt","date","pattern","dateFormat","useAsTitle","entityLabel","labels","singular","titleFromData","description","documentTitle","title","components","views","edit","version","label","serverURL"],"sources":["../../../src/views/Version/generateVersionViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatDate } from '../../utilities/formatDocTitle/formatDateTitle.js'\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const doc: any = {} // TODO: figure this out\n\n const formattedCreatedAt = doc?.createdAt\n ? formatDate({ date: doc.createdAt, i18n, pattern: config?.admin?.dateFormat })\n : ''\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const entityLabel = getTranslation(collectionConfig.labels.singular, i18n)\n const titleFromData = doc?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersion', { documentTitle: titleFromData, entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin?.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n if (globalConfig) {\n const entityLabel = getTranslation(globalConfig.label, i18n)\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionGlobal', { entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${entityLabel}`,\n ...(globalConfig?.admin?.meta || {}),\n ...(globalConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n return formatMetadata({\n ...metaToUse,\n serverURL: config.serverURL,\n })\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAE/B;;;AAGA,OAAO,MAAMC,2BAAA,GAAwD,MAAAA,CAAO;EAC1EC,gBAAgB;EAChBC,MAAM;EACNC,YAAY;EACZC;AAAI,CACL;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGD,IAAA;EAEd,IAAIE,SAAA,GAAwB;IAC1B,IAAIJ,MAAA,CAAOK,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;EAC7B;EAEA,MAAMC,GAAA,GAAW,CAAC,EAAE;AAAA;EAEpB,MAAMC,kBAAA,GAAqBD,GAAA,EAAKE,SAAA,GAC5Bb,UAAA,CAAW;IAAEc,IAAA,EAAMH,GAAA,CAAIE,SAAS;IAAEP,IAAA;IAAMS,OAAA,EAASX,MAAA,EAAQK,KAAA,EAAOO;EAAW,KAC3E;EAEJ,IAAIb,gBAAA,EAAkB;IACpB,MAAMc,UAAA,GAAad,gBAAA,EAAkBM,KAAA,EAAOQ,UAAA,IAAc;IAC1D,MAAMC,WAAA,GAAcnB,cAAA,CAAeI,gBAAA,CAAiBgB,MAAM,CAACC,QAAQ,EAAEd,IAAA;IACrE,MAAMe,aAAA,GAAgBV,GAAA,GAAMM,UAAA,CAAW;IAEvCT,SAAA,GAAY;MACV,IAAIJ,MAAA,CAAOK,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BY,WAAA,EAAaf,CAAA,CAAE,0BAA0B;QAAEgB,aAAA,EAAeF,aAAA;QAAeH;MAAY;MACrFM,KAAA,EAAO,GAAGjB,CAAA,CAAE,qBAAqBK,kBAAA,GAAqB,MAAMA,kBAAA,EAAoB,GAAG,KAAKS,aAAA,GAAgB,MAAMA,aAAA,EAAe,GAAG,QAAQH,WAAA,EAAa;MACrJ,IAAIf,gBAAA,EAAkBM,KAAA,EAAOC,IAAA,IAAQ,CAAC,CAAC;MACvC,IAAIP,gBAAA,EAAkBM,KAAA,EAAOgB,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,OAAA,EAASlB,IAAA,IAAQ,CAAC,CAAC;IAC3E;EACF;EAEA,IAAIL,YAAA,EAAc;IAChB,MAAMa,WAAA,GAAcnB,cAAA,CAAeM,YAAA,CAAawB,KAAK,EAAEvB,IAAA;IAEvDE,SAAA,GAAY;MACV,IAAIJ,MAAA,CAAOK,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BY,WAAA,EAAaf,CAAA,CAAE,gCAAgC;QAAEW;MAAY;MAC7DM,KAAA,EAAO,GAAGjB,CAAA,CAAE,qBAAqBK,kBAAA,GAAqB,MAAMA,kBAAA,EAAoB,GAAG,KAAKM,WAAA,EAAa;MACrG,IAAIb,YAAA,EAAcI,KAAA,EAAOC,IAAA,IAAQ,CAAC,CAAC;MACnC,IAAIL,YAAA,EAAcI,KAAA,EAAOgB,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,OAAA,EAASlB,IAAA,IAAQ,CAAC,CAAC;IACvE;EACF;EAEA,OAAOT,cAAA,CAAe;IACpB,GAAGO,SAAS;IACZsB,SAAA,EAAW1B,MAAA,CAAO0B;EACpB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVersionsViewMetadata.js","names":["getTranslation","formatMetadata","generateVersionsViewMetadata","collectionConfig","config","globalConfig","i18n","t","entityLabel","labels","singular","label","metaToUse","admin","meta","data","useAsTitle","titleFromData","description","documentTitle","entitySlug","slug","title","components","views","edit","versions","serverURL"],"sources":["../../../src/views/Versions/generateVersionsViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionsViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n const entityLabel = collectionConfig\n ? getTranslation(collectionConfig.labels.singular, i18n)\n : globalConfig\n ? getTranslation(globalConfig.label, i18n)\n : ''\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const data: any = {} // TODO: figure this out\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const titleFromData = data?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersions', {\n documentTitle: data?.[useAsTitle],\n entitySlug: collectionConfig.slug,\n }),\n title: `${t('version:versions')}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.versions?.meta || {}),\n }\n }\n\n if (globalConfig) {\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionsGlobal', { entitySlug: globalConfig.slug }),\n title: `${t('version:versions')} - ${entityLabel}`,\n ...((globalConfig?.admin.meta || {})
|
|
1
|
+
{"version":3,"file":"generateVersionsViewMetadata.js","names":["getTranslation","formatMetadata","generateVersionsViewMetadata","collectionConfig","config","globalConfig","i18n","t","entityLabel","labels","singular","label","metaToUse","admin","meta","data","useAsTitle","titleFromData","description","documentTitle","entitySlug","slug","title","components","views","edit","versions","serverURL"],"sources":["../../../src/views/Versions/generateVersionsViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionsViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n const entityLabel = collectionConfig\n ? getTranslation(collectionConfig.labels.singular, i18n)\n : globalConfig\n ? getTranslation(globalConfig.label, i18n)\n : ''\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const data: any = {} // TODO: figure this out\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const titleFromData = data?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersions', {\n documentTitle: data?.[useAsTitle],\n entitySlug: collectionConfig.slug,\n }),\n title: `${t('version:versions')}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.versions?.meta || {}),\n }\n }\n\n if (globalConfig) {\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionsGlobal', { entitySlug: globalConfig.slug }),\n title: `${t('version:versions')} - ${entityLabel}`,\n ...((globalConfig?.admin.meta || {})),\n ...((globalConfig?.admin?.components?.views?.edit?.versions?.meta || {})),\n }\n }\n\n return formatMetadata({\n ...metaToUse,\n serverURL: config.serverURL,\n })\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,cAAc,QAAQ;AAE/B;;;AAGA,OAAO,MAAMC,4BAAA,GAAyD,MAAAA,CAAO;EAC3EC,gBAAgB;EAChBC,MAAM;EACNC,YAAY;EACZC;AAAI,CACL;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGD,IAAA;EAEd,MAAME,WAAA,GAAcL,gBAAA,GAChBH,cAAA,CAAeG,gBAAA,CAAiBM,MAAM,CAACC,QAAQ,EAAEJ,IAAA,IACjDD,YAAA,GACEL,cAAA,CAAeK,YAAA,CAAaM,KAAK,EAAEL,IAAA,IACnC;EAEN,IAAIM,SAAA,GAAwB;IAC1B,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;EAC7B;EAEA,MAAMC,IAAA,GAAY,CAAC,EAAE;AAAA;EAErB,IAAIZ,gBAAA,EAAkB;IACpB,MAAMa,UAAA,GAAab,gBAAA,EAAkBU,KAAA,EAAOG,UAAA,IAAc;IAC1D,MAAMC,aAAA,GAAgBF,IAAA,GAAOC,UAAA,CAAW;IAExCJ,SAAA,GAAY;MACV,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BI,WAAA,EAAaX,CAAA,CAAE,2BAA2B;QACxCY,aAAA,EAAeJ,IAAA,GAAOC,UAAA,CAAW;QACjCI,UAAA,EAAYjB,gBAAA,CAAiBkB;MAC/B;MACAC,KAAA,EAAO,GAAGf,CAAA,CAAE,sBAAsBU,aAAA,GAAgB,MAAMA,aAAA,EAAe,GAAG,QAAQT,WAAA,EAAa;MAC/F,IAAIL,gBAAA,EAAkBU,KAAA,CAAMC,IAAA,IAAQ,CAAC,CAAC;MACtC,IAAIX,gBAAA,EAAkBU,KAAA,EAAOU,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,QAAA,EAAUZ,IAAA,IAAQ,CAAC,CAAC;IAC5E;EACF;EAEA,IAAIT,YAAA,EAAc;IAChBO,SAAA,GAAY;MACV,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BI,WAAA,EAAaX,CAAA,CAAE,iCAAiC;QAAEa,UAAA,EAAYf,YAAA,CAAagB;MAAK;MAChFC,KAAA,EAAO,GAAGf,CAAA,CAAE,yBAAyBC,WAAA,EAAa;MAClD,IAAKH,YAAA,EAAcQ,KAAA,CAAMC,IAAA,IAAQ,CAAC,CAAC;MACnC,IAAKT,YAAA,EAAcQ,KAAA,EAAOU,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,QAAA,EAAUZ,IAAA,IAAQ,CAAC,CAAC;IACzE;EACF;EAEA,OAAOb,cAAA,CAAe;IACpB,GAAGW,SAAS;IACZe,SAAA,EAAWvB,MAAA,CAAOuB;EACpB;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.27",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"ts-essentials": "10.0.3",
|
|
290
290
|
"use-context-selector": "2.0.0",
|
|
291
291
|
"uuid": "14.0.0",
|
|
292
|
-
"@payloadcms/translations": "4.0.0-canary.
|
|
292
|
+
"@payloadcms/translations": "4.0.0-canary.27"
|
|
293
293
|
},
|
|
294
294
|
"devDependencies": {
|
|
295
295
|
"@babel/cli": "7.27.2",
|
|
@@ -303,13 +303,13 @@
|
|
|
303
303
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
|
304
304
|
"esbuild": "0.27.1",
|
|
305
305
|
"esbuild-sass-plugin": "3.3.1",
|
|
306
|
-
"
|
|
307
|
-
"
|
|
306
|
+
"payload": "4.0.0-canary.27",
|
|
307
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
308
308
|
},
|
|
309
309
|
"peerDependencies": {
|
|
310
310
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
311
311
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
312
|
-
"payload": "4.0.0-canary.
|
|
312
|
+
"payload": "4.0.0-canary.27"
|
|
313
313
|
},
|
|
314
314
|
"engines": {
|
|
315
315
|
"node": ">=24.15.0"
|