{"version":3,"file":"renderListViewSlots.js","names":["Banner","RenderServerComponent","React","renderListViewSlots","clientProps","collectionConfig","description","notFoundDocId","payload","serverProps","result","admin","components","afterList","AfterList","Component","importMap","listMenuItems","Array","isArray","afterListTable","AfterListTable","beforeList","BeforeList","existingBeforeListTable","beforeListTable","notFoundBanner","_jsx","type","i18n","t","id","BeforeListTable","_jsxs","Fragment","Description","collectionSlug","slug"],"sources":["../../../src/views/List/renderListViewSlots.tsx"],"sourcesContent":["import type {\n AfterListClientProps,\n AfterListTableClientProps,\n AfterListTableServerPropsOnly,\n BeforeListClientProps,\n BeforeListServerPropsOnly,\n BeforeListTableClientProps,\n BeforeListTableServerPropsOnly,\n ListViewServerPropsOnly,\n ListViewSlots,\n ListViewSlotSharedClientProps,\n Payload,\n SanitizedCollectionConfig,\n StaticDescription,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { Banner } from '@payloadcms/ui/elements/Banner'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport React from 'react'\n\ntype Args = {\n clientProps: ListViewSlotSharedClientProps\n collectionConfig: SanitizedCollectionConfig\n description?: StaticDescription\n notFoundDocId?: null | string\n payload: Payload\n serverProps: ListViewServerPropsOnly\n}\n\nexport const renderListViewSlots = ({\n clientProps,\n collectionConfig,\n description,\n notFoundDocId,\n payload,\n serverProps,\n}: Args): ListViewSlots => {\n const result: ListViewSlots = {} as ListViewSlots\n\n if (collectionConfig.admin.components?.afterList) {\n result.AfterList = RenderServerComponent({\n clientProps: clientProps satisfies AfterListClientProps,\n Component: collectionConfig.admin.components.afterList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n const listMenuItems = collectionConfig.admin.components?.listMenuItems\n\n if (Array.isArray(listMenuItems)) {\n result.listMenuItems = [\n RenderServerComponent({\n clientProps,\n Component: listMenuItems,\n importMap: payload.importMap,\n serverProps,\n }),\n ]\n }\n\n if (collectionConfig.admin.components?.afterListTable) {\n result.AfterListTable = RenderServerComponent({\n clientProps: clientProps satisfies AfterListTableClientProps,\n Component: collectionConfig.admin.components.afterListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.beforeList) {\n result.BeforeList = RenderServerComponent({\n clientProps: clientProps satisfies BeforeListClientProps,\n Component: collectionConfig.admin.components.beforeList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListServerPropsOnly,\n })\n }\n\n // Handle beforeListTable with optional banner\n const existingBeforeListTable = collectionConfig.admin.components?.beforeListTable\n ? RenderServerComponent({\n clientProps: clientProps satisfies BeforeListTableClientProps,\n Component: collectionConfig.admin.components.beforeListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListTableServerPropsOnly,\n })\n : null\n\n // Create banner for document not found\n const notFoundBanner = notFoundDocId ? (\n \n {serverProps.i18n.t('error:documentNotFound', { id: notFoundDocId })}\n \n ) : null\n\n // Combine banner and existing component\n if (notFoundBanner || existingBeforeListTable) {\n result.BeforeListTable = (\n \n {notFoundBanner}\n {existingBeforeListTable}\n \n )\n }\n\n if (collectionConfig.admin.components?.Description) {\n result.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig.slug,\n description,\n } satisfies ViewDescriptionClientProps,\n Component: collectionConfig.admin.components.Description,\n importMap: payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n return result\n}\n"],"mappings":";AAkBA,SAASA,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,OAAOC,KAAA,MAAW;AAWlB,OAAO,MAAMC,mBAAA,GAAsBA,CAAC;EAClCC,WAAW;EACXC,gBAAgB;EAChBC,WAAW;EACXC,aAAa;EACbC,OAAO;EACPC;AAAW,CACN;EACL,MAAMC,MAAA,GAAwB,CAAC;EAE/B,IAAIL,gBAAA,CAAiBM,KAAK,CAACC,UAAU,EAAEC,S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