@payloadcms/next 4.0.0-internal.5b1e7cd → 4.0.0-internal.d28e9fb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/withPayload.cjs +15 -180
- package/dist/cjs/withPayload.cjs.map +4 -4
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +0 -4
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/HierarchyTypeField/index.d.ts +9 -0
- package/dist/elements/HierarchyTypeField/index.d.ts.map +1 -0
- package/dist/elements/HierarchyTypeField/index.js +114 -0
- package/dist/elements/HierarchyTypeField/index.js.map +1 -0
- package/dist/elements/HierarchyTypeField/index.server.d.ts +9 -0
- package/dist/elements/HierarchyTypeField/index.server.d.ts.map +1 -0
- package/dist/elements/HierarchyTypeField/index.server.js +32 -0
- package/dist/elements/HierarchyTypeField/index.server.js.map +1 -0
- package/dist/elements/Nav/SidebarTabs/TabError/index.css +29 -0
- package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts +8 -0
- package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts.map +1 -0
- package/dist/elements/Nav/SidebarTabs/TabError/index.js +42 -0
- package/dist/elements/Nav/SidebarTabs/TabError/index.js.map +1 -0
- package/dist/elements/Nav/SidebarTabs/constants.d.ts +2 -0
- package/dist/elements/Nav/SidebarTabs/constants.d.ts.map +1 -0
- package/dist/elements/Nav/SidebarTabs/constants.js +2 -0
- package/dist/elements/Nav/SidebarTabs/constants.js.map +1 -0
- package/dist/elements/Nav/SidebarTabs/index.client.d.ts +22 -0
- package/dist/elements/Nav/SidebarTabs/index.client.d.ts.map +1 -0
- package/dist/elements/Nav/SidebarTabs/index.client.js +195 -0
- package/dist/elements/Nav/SidebarTabs/index.client.js.map +1 -0
- package/dist/elements/Nav/SidebarTabs/index.css +80 -0
- package/dist/elements/Nav/SidebarTabs/index.d.ts +17 -0
- package/dist/elements/Nav/SidebarTabs/index.d.ts.map +1 -0
- package/dist/elements/Nav/SidebarTabs/index.js +85 -0
- package/dist/elements/Nav/SidebarTabs/index.js.map +1 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts +10 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts.map +1 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +54 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -0
- package/dist/elements/Nav/getNavPrefs.d.ts.map +1 -1
- package/dist/elements/Nav/getNavPrefs.js +36 -2
- package/dist/elements/Nav/getNavPrefs.js.map +1 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +47 -61
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.css +155 -0
- package/dist/elements/Nav/index.d.ts +1 -1
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +37 -7
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/exports/client.d.ts +2 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +2 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/rsc.d.ts +2 -1
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +2 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/utilities.d.ts +2 -0
- package/dist/exports/utilities.d.ts.map +1 -1
- package/dist/exports/utilities.js +1 -0
- package/dist/exports/utilities.js.map +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +11 -1
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/getHierarchyAncestry.d.ts +24 -0
- package/dist/utilities/getHierarchyAncestry.d.ts.map +1 -0
- package/dist/utilities/getHierarchyAncestry.js +103 -0
- package/dist/utilities/getHierarchyAncestry.js.map +1 -0
- package/dist/utilities/handleServerFunctions.js +2 -2
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +3 -3
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
- package/dist/views/Document/getDocumentView.d.ts.map +1 -1
- package/dist/views/Document/getDocumentView.js +3 -9
- package/dist/views/Document/getDocumentView.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +16 -8
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Hierarchy/index.d.ts +18 -0
- package/dist/views/Hierarchy/index.d.ts.map +1 -0
- package/dist/views/Hierarchy/index.js +20 -0
- package/dist/views/Hierarchy/index.js.map +1 -0
- package/dist/views/List/handleHierarchy.d.ts +18 -0
- package/dist/views/List/handleHierarchy.d.ts.map +1 -0
- package/dist/views/List/handleHierarchy.js +258 -0
- package/dist/views/List/handleHierarchy.js.map +1 -0
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +101 -30
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts +12 -0
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -0
- package/dist/views/Root/getCustomGlobalViewByRoute.js +46 -0
- package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -0
- package/dist/views/Root/getRouteData.d.ts +1 -4
- package/dist/views/Root/getRouteData.d.ts.map +1 -1
- package/dist/views/Root/getRouteData.js +83 -110
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +7 -16
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/metadata.d.ts.map +1 -1
- package/dist/views/Root/metadata.js +1 -37
- package/dist/views/Root/metadata.js.map +1 -1
- package/dist/views/Version/Restore/index.js +1 -1
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/withPayload/withPayload.d.ts +127 -1
- package/dist/withPayload/withPayload.d.ts.map +1 -1
- package/dist/withPayload/withPayload.js +8 -26
- package/dist/withPayload/withPayload.js.map +1 -1
- package/dist/withPayload/withPayload.utils.d.ts +0 -14
- package/dist/withPayload/withPayload.utils.d.ts.map +1 -1
- package/dist/withPayload/withPayload.utils.js +0 -73
- package/dist/withPayload/withPayload.utils.js.map +1 -1
- package/package.json +11 -11
- package/dist/views/BrowseByFolder/buildView.d.ts +0 -13
- package/dist/views/BrowseByFolder/buildView.d.ts.map +0 -1
- package/dist/views/BrowseByFolder/buildView.js +0 -170
- package/dist/views/BrowseByFolder/buildView.js.map +0 -1
- package/dist/views/BrowseByFolder/index.d.ts +0 -4
- package/dist/views/BrowseByFolder/index.d.ts.map +0 -1
- package/dist/views/BrowseByFolder/index.js +0 -20
- package/dist/views/BrowseByFolder/index.js.map +0 -1
- package/dist/views/BrowseByFolder/metadata.d.ts +0 -4
- package/dist/views/BrowseByFolder/metadata.d.ts.map +0 -1
- package/dist/views/BrowseByFolder/metadata.js +0 -18
- package/dist/views/BrowseByFolder/metadata.js.map +0 -1
- package/dist/views/CollectionFolders/buildView.d.ts +0 -15
- package/dist/views/CollectionFolders/buildView.d.ts.map +0 -1
- package/dist/views/CollectionFolders/buildView.js +0 -156
- package/dist/views/CollectionFolders/buildView.js.map +0 -1
- package/dist/views/CollectionFolders/index.d.ts +0 -4
- package/dist/views/CollectionFolders/index.d.ts.map +0 -1
- package/dist/views/CollectionFolders/index.js +0 -20
- package/dist/views/CollectionFolders/index.js.map +0 -1
- package/dist/views/CollectionFolders/metadata.d.ts +0 -7
- package/dist/views/CollectionFolders/metadata.d.ts.map +0 -1
- package/dist/views/CollectionFolders/metadata.js +0 -25
- package/dist/views/CollectionFolders/metadata.js.map +0 -1
- package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts +0 -11
- package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts.map +0 -1
- package/dist/views/CollectionFolders/renderFolderViewSlots.js +0 -64
- package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +0 -1
- package/dist/withPayload/withPayloadLegacy.d.ts +0 -2
- package/dist/withPayload/withPayloadLegacy.d.ts.map +0 -1
- package/dist/withPayload/withPayloadLegacy.js +0 -47
- package/dist/withPayload/withPayloadLegacy.js.map +0 -1
|
@@ -23,7 +23,7 @@ export const renderDocumentSlots = args => {
|
|
|
23
23
|
permissions,
|
|
24
24
|
user: req.user
|
|
25
25
|
};
|
|
26
|
-
const BeforeDocumentControls = collectionConfig?.admin?.components?.edit?.beforeDocumentControls || globalConfig?.admin?.components?.
|
|
26
|
+
const BeforeDocumentControls = collectionConfig?.admin?.components?.edit?.beforeDocumentControls || globalConfig?.admin?.components?.edit?.beforeDocumentControls;
|
|
27
27
|
if (BeforeDocumentControls) {
|
|
28
28
|
components.BeforeDocumentControls = RenderServerComponent({
|
|
29
29
|
Component: BeforeDocumentControls,
|
|
@@ -31,6 +31,14 @@ export const renderDocumentSlots = args => {
|
|
|
31
31
|
serverProps: serverProps
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
const BeforeDocumentMeta = collectionConfig?.admin?.components?.edit?.BeforeDocumentMeta || globalConfig?.admin?.components?.edit?.BeforeDocumentMeta;
|
|
35
|
+
if (BeforeDocumentMeta) {
|
|
36
|
+
components.BeforeDocumentMeta = RenderServerComponent({
|
|
37
|
+
Component: BeforeDocumentMeta,
|
|
38
|
+
importMap: req.payload.importMap,
|
|
39
|
+
serverProps
|
|
40
|
+
});
|
|
41
|
+
}
|
|
34
42
|
const EditMenuItems = collectionConfig?.admin?.components?.edit?.editMenuItems;
|
|
35
43
|
if (EditMenuItems) {
|
|
36
44
|
components.EditMenuItems = RenderServerComponent({
|
|
@@ -39,7 +47,7 @@ export const renderDocumentSlots = args => {
|
|
|
39
47
|
serverProps: serverProps
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
|
-
const CustomPreviewButton = collectionConfig?.admin?.components?.edit?.PreviewButton || globalConfig?.admin?.components?.
|
|
50
|
+
const CustomPreviewButton = collectionConfig?.admin?.components?.edit?.PreviewButton || globalConfig?.admin?.components?.edit?.PreviewButton;
|
|
43
51
|
if (isPreviewEnabled && CustomPreviewButton) {
|
|
44
52
|
components.PreviewButton = RenderServerComponent({
|
|
45
53
|
Component: CustomPreviewButton,
|
|
@@ -59,7 +67,7 @@ export const renderDocumentSlots = args => {
|
|
|
59
67
|
const staticDescription = typeof descriptionFromConfig === 'function' ? descriptionFromConfig({
|
|
60
68
|
t: req.i18n.t
|
|
61
69
|
}) : descriptionFromConfig;
|
|
62
|
-
const CustomDescription = collectionConfig?.admin?.components?.Description || globalConfig?.admin?.components?.
|
|
70
|
+
const CustomDescription = collectionConfig?.admin?.components?.Description || globalConfig?.admin?.components?.Description;
|
|
63
71
|
const hasDescription = CustomDescription || staticDescription;
|
|
64
72
|
if (hasDescription) {
|
|
65
73
|
components.Description = RenderServerComponent({
|
|
@@ -74,7 +82,7 @@ export const renderDocumentSlots = args => {
|
|
|
74
82
|
});
|
|
75
83
|
}
|
|
76
84
|
if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {
|
|
77
|
-
const CustomStatus = collectionConfig?.admin?.components?.edit?.Status || globalConfig?.admin?.components?.
|
|
85
|
+
const CustomStatus = collectionConfig?.admin?.components?.edit?.Status || globalConfig?.admin?.components?.edit?.Status;
|
|
78
86
|
if (CustomStatus) {
|
|
79
87
|
components.Status = RenderServerComponent({
|
|
80
88
|
Component: CustomStatus,
|
|
@@ -85,7 +93,7 @@ export const renderDocumentSlots = args => {
|
|
|
85
93
|
}
|
|
86
94
|
if (hasSavePermission) {
|
|
87
95
|
if (hasDraftsEnabled(collectionConfig || globalConfig)) {
|
|
88
|
-
const CustomPublishButton = collectionConfig?.admin?.components?.edit?.PublishButton || globalConfig?.admin?.components?.
|
|
96
|
+
const CustomPublishButton = collectionConfig?.admin?.components?.edit?.PublishButton || globalConfig?.admin?.components?.edit?.PublishButton;
|
|
89
97
|
if (CustomPublishButton) {
|
|
90
98
|
components.PublishButton = RenderServerComponent({
|
|
91
99
|
Component: CustomPublishButton,
|
|
@@ -93,7 +101,7 @@ export const renderDocumentSlots = args => {
|
|
|
93
101
|
serverProps: serverProps
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
|
-
const CustomUnpublishButton = collectionConfig?.admin?.components?.edit?.UnpublishButton || globalConfig?.admin?.components?.
|
|
104
|
+
const CustomUnpublishButton = collectionConfig?.admin?.components?.edit?.UnpublishButton || globalConfig?.admin?.components?.edit?.UnpublishButton;
|
|
97
105
|
if (CustomUnpublishButton) {
|
|
98
106
|
components.UnpublishButton = RenderServerComponent({
|
|
99
107
|
Component: CustomUnpublishButton,
|
|
@@ -101,7 +109,7 @@ export const renderDocumentSlots = args => {
|
|
|
101
109
|
serverProps: serverProps
|
|
102
110
|
});
|
|
103
111
|
}
|
|
104
|
-
const CustomSaveDraftButton = collectionConfig?.admin?.components?.edit?.SaveDraftButton || globalConfig?.admin?.components?.
|
|
112
|
+
const CustomSaveDraftButton = collectionConfig?.admin?.components?.edit?.SaveDraftButton || globalConfig?.admin?.components?.edit?.SaveDraftButton;
|
|
105
113
|
const draftsEnabled = hasDraftsEnabled(collectionConfig || globalConfig);
|
|
106
114
|
if ((draftsEnabled || unsavedDraftWithValidations) && CustomSaveDraftButton) {
|
|
107
115
|
components.SaveDraftButton = RenderServerComponent({
|
|
@@ -111,7 +119,7 @@ export const renderDocumentSlots = args => {
|
|
|
111
119
|
});
|
|
112
120
|
}
|
|
113
121
|
} else {
|
|
114
|
-
const CustomSaveButton = collectionConfig?.admin?.components?.edit?.SaveButton || globalConfig?.admin?.components?.
|
|
122
|
+
const CustomSaveButton = collectionConfig?.admin?.components?.edit?.SaveButton || globalConfig?.admin?.components?.edit?.SaveButton;
|
|
115
123
|
if (CustomSaveButton) {
|
|
116
124
|
components.SaveButton = RenderServerComponent({
|
|
117
125
|
Component: CustomSaveButton,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDocumentSlots.js","names":["ViewDescription","RenderServerComponent","hasDraftsEnabled","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","globalConfig","hasSavePermission","locale","permissions","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","CustomStatus","Status","CustomPublishButton","PublishButton","CustomUnpublishButton","UnpublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","renderDocumentSlotsHandler","collections","config","Error","data"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n Locale,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n UnpublishButtonServerPropsOnly,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { ViewDescription } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { hasDraftsEnabled } from 'payload/shared'\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 locale: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n}) => DocumentSlots = (args) => {\n const { id, collectionConfig, globalConfig, hasSavePermission, locale, permissions, 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 locale,\n payload: req.payload,\n permissions,\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 (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomStatus =\n collectionConfig?.admin?.components?.edit?.Status ||\n globalConfig?.admin?.components?.elements?.Status\n\n if (CustomStatus) {\n components.Status = RenderServerComponent({\n Component: CustomStatus,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n if (hasSavePermission) {\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\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 CustomUnpublishButton =\n collectionConfig?.admin?.components?.edit?.UnpublishButton ||\n globalConfig?.admin?.components?.elements?.UnpublishButton\n\n if (CustomUnpublishButton) {\n components.UnpublishButton = RenderServerComponent({\n Component: CustomUnpublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies UnpublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.elements?.SaveDraftButton\n\n const draftsEnabled = hasDraftsEnabled(collectionConfig || globalConfig)\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, locale, permissions, 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 { hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data: {},\n req,\n })\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n}\n"],"mappings":"AAqBA,SAASA,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GAQUC,IAAA;EACrB,MAAM;IAAEC,EAAE;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC,iBAAiB;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGP,IAAA;EAE5F,MAAMQ,UAAA,GAA4B,CAAC;EAEnC,MAAMC,2BAAA,GAA8BC,S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C,KAAK,EAAEJ,UAAA,EAAYiD,QAAA,EAAU;IACnFjD,UAAA,CAAWkD,cAAc,GAAG9D,qBAAA,CAAsB;MAChD0B,SAAA,EAAWpB,gBAAA,CAAiBqD,MAAM,CAAC3C,KAAK,CAACJ,UAAU,CAACiD,QAAQ;MAC5DlC,SAAA,EAAWhB,GAAA,CAAIS,OAAO,CAACO,SAAS;MAChCT;IACF;EACF;EAEA,OAAON,UAAA;AACT;AAEA,OAAO,MAAMmD,0BAAA,GAGR,MAAO3D,IAAA;EACV,MAAM;IAAEC,EAAE;IAAEsC,cAAc;IAAElC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGP,IAAA;EAEzD,MAAME,gBAAA,GAAmBK,GAAA,CAAIS,OAAO,CAAC4C,WAAW,CAACrB,cAAA,CAAe,EAAEsB,MAAA;EAElE,IAAI,CAAC3D,gBAAA,EAAkB;IACrB,MAAM,IAAI4D,KAAA,CAAMvD,GAAA,CAAI2B,CAAC,CAAC;EACxB;EAEA,MAAM;IAAE9B;EAAiB,CAAE,GAAG,MAAMN,sBAAA,CAAuB;IACzDG,EAAA;IACAC,gBAAA;IACA6D,IAAA,EAAM,CAAC;IACPxD;EACF;EAEA,OAAOR,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAE,iBAAA;IACAC,MAAA;IACAC,WAAA;IACAC;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderDocumentSlots.js","names":["ViewDescription","RenderServerComponent","hasDraftsEnabled","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","globalConfig","hasSavePermission","locale","permissions","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","user","BeforeDocumentControls","edit","beforeDocumentControls","Component","importMap","BeforeDocumentMeta","EditMenuItems","editMenuItems","CustomPreviewButton","PreviewButton","LivePreview","views","livePreview","descriptionFromConfig","description","staticDescription","t","CustomDescription","Description","hasDescription","clientProps","collectionSlug","slug","Fallback","versions","drafts","CustomStatus","Status","CustomPublishButton","PublishButton","CustomUnpublishButton","UnpublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","renderDocumentSlotsHandler","collections","config","Error","data"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n Locale,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n UnpublishButtonServerPropsOnly,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { ViewDescription } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { hasDraftsEnabled } from 'payload/shared'\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 locale: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n}) => DocumentSlots = (args) => {\n const { id, collectionConfig, globalConfig, hasSavePermission, locale, permissions, 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 locale,\n payload: req.payload,\n permissions,\n user: req.user,\n // TODO: Add remaining serverProps\n }\n\n const BeforeDocumentControls =\n collectionConfig?.admin?.components?.edit?.beforeDocumentControls ||\n globalConfig?.admin?.components?.edit?.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 BeforeDocumentMeta =\n collectionConfig?.admin?.components?.edit?.BeforeDocumentMeta ||\n globalConfig?.admin?.components?.edit?.BeforeDocumentMeta\n\n if (BeforeDocumentMeta) {\n components.BeforeDocumentMeta = RenderServerComponent({\n Component: BeforeDocumentMeta,\n importMap: req.payload.importMap,\n serverProps,\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?.edit?.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 || globalConfig?.admin?.components?.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 (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomStatus =\n collectionConfig?.admin?.components?.edit?.Status ||\n globalConfig?.admin?.components?.edit?.Status\n\n if (CustomStatus) {\n components.Status = RenderServerComponent({\n Component: CustomStatus,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n if (hasSavePermission) {\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n const CustomPublishButton =\n collectionConfig?.admin?.components?.edit?.PublishButton ||\n globalConfig?.admin?.components?.edit?.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 CustomUnpublishButton =\n collectionConfig?.admin?.components?.edit?.UnpublishButton ||\n globalConfig?.admin?.components?.edit?.UnpublishButton\n\n if (CustomUnpublishButton) {\n components.UnpublishButton = RenderServerComponent({\n Component: CustomUnpublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies UnpublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.edit?.SaveDraftButton\n\n const draftsEnabled = hasDraftsEnabled(collectionConfig || globalConfig)\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?.edit?.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, locale, permissions, 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 { hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data: {},\n req,\n })\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n}\n"],"mappings":"AAqBA,SAASA,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GAQUC,IAAA;EACrB,MAAM;IAAEC,EAAE;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC,iBAAiB;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGP,IAAA;EAE5F,MAAMQ,UAAA,GAA4B,CAAC;EAEnC,MAAMC,2BAAA,GAA8BC,SAAA;EAEpC,MAAMC,gBAAA,GAAmBT,gBAAA,EAAkBU,KAAA,EAAOC,OAAA,IAAWV,YAAA,EAAcS,KAAA,EAAOC,OAAA;EAElF,MAAMC,WAAA,GAA2B;IAC/Bb,EAAA;IACAc,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdV,MAAA;IACAW,OAAA,EAAST,GAAA,CAAIS,OAAO;IACpBV,WAAA;IACAW,IAAA,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kBqD,MAAA,IAAUrD,gBAAA,CAAiBqD,MAAM,CAAC3C,KAAK,EAAEJ,UAAA,EAAYiD,QAAA,EAAU;IACnFjD,UAAA,CAAWkD,cAAc,GAAG9D,qBAAA,CAAsB;MAChDyB,SAAA,EAAWnB,gBAAA,CAAiBqD,MAAM,CAAC3C,KAAK,CAACJ,UAAU,CAACiD,QAAQ;MAC5DnC,SAAA,EAAWf,GAAA,CAAIS,OAAO,CAACM,SAAS;MAChCR;IACF;EACF;EAEA,OAAON,UAAA;AACT;AAEA,OAAO,MAAMmD,0BAAA,GAGR,MAAO3D,IAAA;EACV,MAAM;IAAEC,EAAE;IAAEsC,cAAc;IAAElC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGP,IAAA;EAEzD,MAAME,gBAAA,GAAmBK,GAAA,CAAIS,OAAO,CAAC4C,WAAW,CAACrB,cAAA,CAAe,EAAEsB,MAAA;EAElE,IAAI,CAAC3D,gBAAA,EAAkB;IACrB,MAAM,IAAI4D,KAAA,CAAMvD,GAAA,CAAI2B,CAAC,CAAC;EACxB;EAEA,MAAM;IAAE9B;EAAiB,CAAE,GAAG,MAAMN,sBAAA,CAAuB;IACzDG,EAAA;IACAC,gBAAA;IACA6D,IAAA,EAAM,CAAC;IACPxD;EACF;EAEA,OAAOR,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAE,iBAAA;IACAC,MAAA;IACAC,WAAA;IACAC;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdminViewServerProps, ListQuery } from 'payload';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
type RenderHierarchyViewArgs = {
|
|
4
|
+
customCellProps?: Record<string, any>;
|
|
5
|
+
disableBulkDelete?: boolean;
|
|
6
|
+
disableBulkEdit?: boolean;
|
|
7
|
+
disableQueryPresets?: boolean;
|
|
8
|
+
drawerSlug?: string;
|
|
9
|
+
enableRowSelections: boolean;
|
|
10
|
+
overrideEntityVisibility?: boolean;
|
|
11
|
+
query: ListQuery;
|
|
12
|
+
redirectAfterDelete?: boolean;
|
|
13
|
+
redirectAfterDuplicate?: boolean;
|
|
14
|
+
redirectAfterRestore?: boolean;
|
|
15
|
+
} & AdminViewServerProps;
|
|
16
|
+
export declare const HierarchyView: React.FC<Omit<RenderHierarchyViewArgs, 'enableRowSelections'>>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Hierarchy/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,uBAAuB,GAAG;IAC7B,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,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,GAAG,oBAAoB,CAAA;AAExB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAiBxF,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { notFound } from 'next/navigation.js';
|
|
2
|
+
import { renderListView } from '../List/index.js';
|
|
3
|
+
export const HierarchyView = async args => {
|
|
4
|
+
try {
|
|
5
|
+
const {
|
|
6
|
+
List: HierarchyList
|
|
7
|
+
} = await renderListView({
|
|
8
|
+
...args,
|
|
9
|
+
enableRowSelections: true,
|
|
10
|
+
viewType: 'hierarchy'
|
|
11
|
+
});
|
|
12
|
+
return HierarchyList;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (error.message === 'not-found') {
|
|
15
|
+
notFound();
|
|
16
|
+
}
|
|
17
|
+
console.error(error); // eslint-disable-line no-console
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["notFound","renderListView","HierarchyView","args","List","HierarchyList","enableRowSelections","viewType","error","message","console"],"sources":["../../../src/views/Hierarchy/index.tsx"],"sourcesContent":["import type { AdminViewServerProps, ListQuery } from 'payload'\nimport type React from 'react'\n\nimport { notFound } from 'next/navigation.js'\n\nimport { renderListView } from '../List/index.js'\n\ntype RenderHierarchyViewArgs = {\n customCellProps?: Record<string, any>\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n disableQueryPresets?: boolean\n drawerSlug?: string\n enableRowSelections: boolean\n overrideEntityVisibility?: boolean\n query: ListQuery\n redirectAfterDelete?: boolean\n redirectAfterDuplicate?: boolean\n redirectAfterRestore?: boolean\n} & AdminViewServerProps\n\nexport const HierarchyView: React.FC<Omit<RenderHierarchyViewArgs, 'enableRowSelections'>> = async (\n args,\n) => {\n try {\n const { List: HierarchyList } = await renderListView({\n ...args,\n enableRowSelections: true,\n viewType: 'hierarchy',\n })\n\n return HierarchyList\n } catch (error) {\n if (error.message === 'not-found') {\n notFound()\n }\n console.error(error) // eslint-disable-line no-console\n }\n}\n"],"mappings":"AAGA,SAASA,QAAQ,QAAQ;AAEzB,SAASC,cAAc,QAAQ;AAgB/B,OAAO,MAAMC,aAAA,GAAgF,MAC3FC,IAAA;EAEA,IAAI;IACF,MAAM;MAAEC,IAAA,EAAMC;IAAa,CAAE,GAAG,MAAMJ,cAAA,CAAe;MACnD,GAAGE,IAAI;MACPG,mBAAA,EAAqB;MACrBC,QAAA,EAAU;IACZ;IAEA,OAAOF,aAAA;EACT,EAAE,OAAOG,KAAA,EAAO;IACd,IAAIA,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCT,QAAA;IACF;IACAU,OAAA,CAAQF,KAAK,CAACA,KAAA,GAAO;EACvB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HierarchyViewData, PayloadRequest, SanitizedCollectionConfig, SanitizedPermissions, Where } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches hierarchy data for a collection with a selected parent.
|
|
4
|
+
* Returns data that can be rendered client-side by HierarchyTable.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleHierarchy: ({ baseFilter, collectionConfig, collectionSlug, parentId, permissions, req, search, typeFilter, user, }: {
|
|
7
|
+
baseFilter?: null | Where;
|
|
8
|
+
collectionConfig: SanitizedCollectionConfig;
|
|
9
|
+
collectionSlug: string;
|
|
10
|
+
parentId: null | number | string;
|
|
11
|
+
permissions?: SanitizedPermissions;
|
|
12
|
+
req: PayloadRequest;
|
|
13
|
+
search?: string;
|
|
14
|
+
/** Filter hierarchy items by their collectionSpecific type field */
|
|
15
|
+
typeFilter?: string[];
|
|
16
|
+
user: PayloadRequest["user"];
|
|
17
|
+
}) => Promise<HierarchyViewData>;
|
|
18
|
+
//# sourceMappingURL=handleHierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHierarchy.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleHierarchy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EAEd,yBAAyB,EACzB,oBAAoB,EAEpB,KAAK,EACN,MAAM,SAAS,CAAA;AAMhB;;;GAGG;AACH,eAAO,MAAM,eAAe,4GAUzB;IACD,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAClC,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC7B,KAAG,OAAO,CAAC,iBAAiB,CAkP5B,CAAA"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { getTranslation } from '@payloadcms/translations';
|
|
2
|
+
import { getAncestors } from 'payload';
|
|
3
|
+
import { combineWhereConstraints, DEFAULT_HIERARCHY_LIST_LIMIT } from 'payload/shared';
|
|
4
|
+
/**
|
|
5
|
+
* Fetches hierarchy data for a collection with a selected parent.
|
|
6
|
+
* Returns data that can be rendered client-side by HierarchyTable.
|
|
7
|
+
*/
|
|
8
|
+
export const handleHierarchy = async ({
|
|
9
|
+
baseFilter,
|
|
10
|
+
collectionConfig,
|
|
11
|
+
collectionSlug,
|
|
12
|
+
parentId,
|
|
13
|
+
permissions,
|
|
14
|
+
req,
|
|
15
|
+
search,
|
|
16
|
+
typeFilter,
|
|
17
|
+
user
|
|
18
|
+
}) => {
|
|
19
|
+
const hierarchyConfig = collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy : undefined;
|
|
20
|
+
if (!hierarchyConfig) {
|
|
21
|
+
throw new Error('Collection is not a hierarchy');
|
|
22
|
+
}
|
|
23
|
+
const parentFieldName = hierarchyConfig.parentFieldName;
|
|
24
|
+
const useAsTitle = collectionConfig.admin?.useAsTitle || 'id';
|
|
25
|
+
// Fetch the parent item and breadcrumbs (skip for root level)
|
|
26
|
+
let parent = null;
|
|
27
|
+
let breadcrumbs = [];
|
|
28
|
+
if (parentId !== null) {
|
|
29
|
+
try {
|
|
30
|
+
const [item, ancestors] = await Promise.all([req.payload.findByID({
|
|
31
|
+
id: parentId,
|
|
32
|
+
collection: collectionSlug,
|
|
33
|
+
depth: 0,
|
|
34
|
+
overrideAccess: false,
|
|
35
|
+
req,
|
|
36
|
+
user
|
|
37
|
+
}), getAncestors({
|
|
38
|
+
id: parentId,
|
|
39
|
+
collectionSlug,
|
|
40
|
+
req
|
|
41
|
+
})]);
|
|
42
|
+
parent = item;
|
|
43
|
+
breadcrumbs = ancestors;
|
|
44
|
+
} catch (_error) {
|
|
45
|
+
req.payload.logger.warn({
|
|
46
|
+
msg: `Hierarchy item not found: ${parentId}`
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Build children where clause
|
|
51
|
+
// For root level (parentId is null), find items without a parent
|
|
52
|
+
// For nested level, find items with this specific parent
|
|
53
|
+
const parentCondition = parentId === null ? {
|
|
54
|
+
or: [{
|
|
55
|
+
[parentFieldName]: {
|
|
56
|
+
exists: false
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
[parentFieldName]: {
|
|
60
|
+
equals: null
|
|
61
|
+
}
|
|
62
|
+
}]
|
|
63
|
+
} : {
|
|
64
|
+
[parentFieldName]: {
|
|
65
|
+
equals: parentId
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
// Build type filter condition if typeFilter is provided and collectionSpecific is configured
|
|
69
|
+
// Filter to folders that allow ANY of the selected types OR are unrestricted
|
|
70
|
+
let typeCondition;
|
|
71
|
+
if (typeFilter && typeFilter.length > 0 && hierarchyConfig.collectionSpecific && typeof hierarchyConfig.collectionSpecific === 'object') {
|
|
72
|
+
const typeFieldName = hierarchyConfig.collectionSpecific.fieldName;
|
|
73
|
+
// Exclude the hierarchy collection itself from the filter (folders always show folders)
|
|
74
|
+
const filteredTypes = typeFilter.filter(t => t !== collectionSlug);
|
|
75
|
+
if (filteredTypes.length > 0) {
|
|
76
|
+
typeCondition = {
|
|
77
|
+
or: [{
|
|
78
|
+
[typeFieldName]: {
|
|
79
|
+
in: filteredTypes
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
[typeFieldName]: {
|
|
83
|
+
exists: false
|
|
84
|
+
}
|
|
85
|
+
}]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Combine conditions: parent + search + typeFilter
|
|
90
|
+
const conditions = [parentCondition];
|
|
91
|
+
if (search) {
|
|
92
|
+
conditions.push({
|
|
93
|
+
[useAsTitle]: {
|
|
94
|
+
like: search
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (typeCondition) {
|
|
99
|
+
conditions.push(typeCondition);
|
|
100
|
+
}
|
|
101
|
+
const childrenWhere = conditions.length > 1 ? {
|
|
102
|
+
and: conditions
|
|
103
|
+
} : parentCondition;
|
|
104
|
+
// Fetch children (hierarchy items with this parent, or root items if parentId is null)
|
|
105
|
+
const childrenData = await req.payload.find({
|
|
106
|
+
collection: collectionSlug,
|
|
107
|
+
depth: 0,
|
|
108
|
+
draft: true,
|
|
109
|
+
fallbackLocale: false,
|
|
110
|
+
includeLockStatus: true,
|
|
111
|
+
limit: DEFAULT_HIERARCHY_LIST_LIMIT,
|
|
112
|
+
locale: req.locale,
|
|
113
|
+
overrideAccess: false,
|
|
114
|
+
page: 1,
|
|
115
|
+
req,
|
|
116
|
+
user,
|
|
117
|
+
where: combineWhereConstraints([childrenWhere, baseFilter])
|
|
118
|
+
});
|
|
119
|
+
// Fetch related documents from other collections
|
|
120
|
+
// At root level: show unassigned documents (where hierarchy field doesn't exist)
|
|
121
|
+
// At nested level: show documents assigned to the selected hierarchy item
|
|
122
|
+
const relatedDocumentsByCollection = {};
|
|
123
|
+
const relatedBaseFilters = {};
|
|
124
|
+
// Use pre-computed relatedCollections from sanitized hierarchy config
|
|
125
|
+
const relatedCollectionsConfig = hierarchyConfig.relatedCollections || {};
|
|
126
|
+
for (const [relatedSlug, fieldInfo] of Object.entries(relatedCollectionsConfig)) {
|
|
127
|
+
if (relatedSlug === collectionSlug) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const relatedCollectionConfig = req.payload.collections[relatedSlug]?.config;
|
|
131
|
+
if (!relatedCollectionConfig) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// Check if user has read permission for this collection
|
|
135
|
+
if (!permissions?.collections?.[relatedSlug]?.read) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const {
|
|
139
|
+
fieldName,
|
|
140
|
+
hasMany
|
|
141
|
+
} = fieldInfo;
|
|
142
|
+
// Get baseFilter for this related collection
|
|
143
|
+
const relatedBaseFilter = await (relatedCollectionConfig.admin?.baseFilter ?? relatedCollectionConfig.admin?.baseListFilter)?.({
|
|
144
|
+
limit: DEFAULT_HIERARCHY_LIST_LIMIT,
|
|
145
|
+
page: 1,
|
|
146
|
+
req,
|
|
147
|
+
sort: undefined
|
|
148
|
+
});
|
|
149
|
+
if (relatedBaseFilter) {
|
|
150
|
+
relatedBaseFilters[relatedSlug] = relatedBaseFilter;
|
|
151
|
+
}
|
|
152
|
+
// Build where clause based on whether we're at root or nested level
|
|
153
|
+
let relationshipWhere;
|
|
154
|
+
if (parentId === null) {
|
|
155
|
+
// Root level: find documents where hierarchy field doesn't exist, is null, or is empty array
|
|
156
|
+
const conditions = [{
|
|
157
|
+
[fieldName]: {
|
|
158
|
+
exists: false
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
[fieldName]: {
|
|
162
|
+
equals: null
|
|
163
|
+
}
|
|
164
|
+
}];
|
|
165
|
+
if (hasMany) {
|
|
166
|
+
// hasMany fields store cleared values as empty arrays
|
|
167
|
+
conditions.push({
|
|
168
|
+
[fieldName]: {
|
|
169
|
+
equals: []
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
relationshipWhere = {
|
|
174
|
+
or: conditions
|
|
175
|
+
};
|
|
176
|
+
} else {
|
|
177
|
+
// Nested level: find documents assigned to this hierarchy item
|
|
178
|
+
// "in" operator works for both hasMany and single relationship fields
|
|
179
|
+
relationshipWhere = {
|
|
180
|
+
[fieldName]: {
|
|
181
|
+
in: [parentId]
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// Add search filter if provided
|
|
186
|
+
const relatedUseAsTitle = relatedCollectionConfig.admin?.useAsTitle || 'id';
|
|
187
|
+
const whereWithSearch = search ? {
|
|
188
|
+
and: [relationshipWhere, {
|
|
189
|
+
[relatedUseAsTitle]: {
|
|
190
|
+
like: search
|
|
191
|
+
}
|
|
192
|
+
}]
|
|
193
|
+
} : relationshipWhere;
|
|
194
|
+
// Combine relationship where with related collection's baseFilter
|
|
195
|
+
const where = combineWhereConstraints([whereWithSearch, relatedBaseFilter]);
|
|
196
|
+
try {
|
|
197
|
+
const data = await req.payload.find({
|
|
198
|
+
collection: relatedSlug,
|
|
199
|
+
depth: 0,
|
|
200
|
+
draft: true,
|
|
201
|
+
fallbackLocale: false,
|
|
202
|
+
includeLockStatus: true,
|
|
203
|
+
limit: DEFAULT_HIERARCHY_LIST_LIMIT,
|
|
204
|
+
locale: req.locale,
|
|
205
|
+
overrideAccess: false,
|
|
206
|
+
page: 1,
|
|
207
|
+
req,
|
|
208
|
+
user,
|
|
209
|
+
where
|
|
210
|
+
});
|
|
211
|
+
if (data.totalDocs > 0) {
|
|
212
|
+
relatedDocumentsByCollection[relatedSlug] = {
|
|
213
|
+
hasMany,
|
|
214
|
+
label: getTranslation(relatedCollectionConfig.labels?.plural, req.i18n),
|
|
215
|
+
result: data
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
} catch (error) {
|
|
219
|
+
req.payload.logger.warn({
|
|
220
|
+
err: error,
|
|
221
|
+
msg: `Failed to query related collection ${relatedSlug}`
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Extract allowed collections from parent's collectionSpecific field
|
|
226
|
+
// - undefined: collectionSpecific not configured, no filtering needed
|
|
227
|
+
// - []: parent folder accepts everything, can only move to unrestricted destinations
|
|
228
|
+
// - [{ slug, label }, ...]: parent folder has restrictions
|
|
229
|
+
let allowedCollections;
|
|
230
|
+
if (hierarchyConfig.collectionSpecific && parent) {
|
|
231
|
+
const typeFieldName = hierarchyConfig.collectionSpecific.fieldName;
|
|
232
|
+
const typeValues = parent[typeFieldName];
|
|
233
|
+
if (typeValues && typeValues.length > 0) {
|
|
234
|
+
allowedCollections = typeValues.map(slug => {
|
|
235
|
+
const config = req.payload.collections[slug]?.config;
|
|
236
|
+
const label = config ? getTranslation(config.labels?.plural, req.i18n) : slug;
|
|
237
|
+
return {
|
|
238
|
+
slug,
|
|
239
|
+
label
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
// Parent folder accepts everything (type is null or empty)
|
|
244
|
+
allowedCollections = [];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
allowedCollections,
|
|
249
|
+
breadcrumbs,
|
|
250
|
+
childrenData,
|
|
251
|
+
parent,
|
|
252
|
+
parentFieldName,
|
|
253
|
+
parentId,
|
|
254
|
+
relatedBaseFilters: Object.keys(relatedBaseFilters).length > 0 ? relatedBaseFilters : undefined,
|
|
255
|
+
relatedDocumentsByCollection
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=handleHierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHierarchy.js","names":["getTranslation","getAncestors","combineWhereConstraints","DEFAULT_HIERARCHY_LIST_LIMIT","handleHierarchy","baseFilter","collectionConfig","collectionSlug","parentId","permissions","req","search","typeFilter","user","hierarchyConfig","hierarchy","undefined","Error","parentFieldName","useAsTitle","admin","parent","breadcrumbs","item","ancestors","Promise","all","payload","findByID","id","collection","depth","overrideAccess","_error","logger","warn","msg","parentCondition","or","exists","equals","typeCondition","length","collectionSpecific","typeFieldName","fieldName","filteredTypes","filter","t","in","conditions","push","like","childrenWhere","and","childrenData","find","draft","fallbackLocale","includeLockStatus","limit","locale","page","where","relatedDocumentsByCollection","relatedBaseFilters","relatedCollectionsConfig","relatedCollections","relatedSlug","fieldInfo","Object","entries","relatedCollectionConfig","collections","config","read","hasMany","relatedBaseFilter","baseListFilter","sort","relationshipWhere","relatedUseAsTitle","whereWithSearch","data","totalDocs","label","labels","plural","i18n","result","error","err","allowedCollections","typeValues","map","slug","keys"],"sources":["../../../src/views/List/handleHierarchy.ts"],"sourcesContent":["import type {\n HierarchyViewData,\n PayloadRequest,\n RelatedDocumentsGrouped,\n SanitizedCollectionConfig,\n SanitizedPermissions,\n TypeWithID,\n Where,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getAncestors } from 'payload'\nimport { combineWhereConstraints, DEFAULT_HIERARCHY_LIST_LIMIT } from 'payload/shared'\n\n/**\n * Fetches hierarchy data for a collection with a selected parent.\n * Returns data that can be rendered client-side by HierarchyTable.\n */\nexport const handleHierarchy = async ({\n baseFilter,\n collectionConfig,\n collectionSlug,\n parentId,\n permissions,\n req,\n search,\n typeFilter,\n user,\n}: {\n baseFilter?: null | Where\n collectionConfig: SanitizedCollectionConfig\n collectionSlug: string\n parentId: null | number | string\n permissions?: SanitizedPermissions\n req: PayloadRequest\n search?: string\n /** Filter hierarchy items by their collectionSpecific type field */\n typeFilter?: string[]\n user: PayloadRequest['user']\n}): Promise<HierarchyViewData> => {\n const hierarchyConfig =\n collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n\n if (!hierarchyConfig) {\n throw new Error('Collection is not a hierarchy')\n }\n\n const parentFieldName = hierarchyConfig.parentFieldName\n\n const useAsTitle = collectionConfig.admin?.useAsTitle || 'id'\n\n // Fetch the parent item and breadcrumbs (skip for root level)\n let parent: null | (Record<string, unknown> & TypeWithID) = null\n let breadcrumbs: Array<{ id: number | string; title: string }> = []\n\n if (parentId !== null) {\n try {\n const [item, ancestors] = await Promise.all([\n req.payload.findByID({\n id: parentId,\n collection: collectionSlug,\n depth: 0,\n overrideAccess: false,\n req,\n user,\n }),\n getAncestors({\n id: parentId,\n collectionSlug,\n req,\n }),\n ])\n\n parent = item\n breadcrumbs = ancestors\n } catch (_error) {\n req.payload.logger.warn({\n msg: `Hierarchy item not found: ${parentId}`,\n })\n }\n }\n\n // Build children where clause\n // For root level (parentId is null), find items without a parent\n // For nested level, find items with this specific parent\n const parentCondition =\n parentId === null\n ? {\n or: [{ [parentFieldName]: { exists: false } }, { [parentFieldName]: { equals: null } }],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n // Build type filter condition if typeFilter is provided and collectionSpecific is configured\n // Filter to folders that allow ANY of the selected types OR are unrestricted\n let typeCondition: Record<string, unknown> | undefined\n\n if (\n typeFilter &&\n typeFilter.length > 0 &&\n hierarchyConfig.collectionSpecific &&\n typeof hierarchyConfig.collectionSpecific === 'object'\n ) {\n const typeFieldName = hierarchyConfig.collectionSpecific.fieldName\n // Exclude the hierarchy collection itself from the filter (folders always show folders)\n const filteredTypes = typeFilter.filter((t) => t !== collectionSlug)\n\n if (filteredTypes.length > 0) {\n typeCondition = {\n or: [\n { [typeFieldName]: { in: filteredTypes } },\n { [typeFieldName]: { exists: false } }, // Include unrestricted folders\n ],\n }\n }\n }\n\n // Combine conditions: parent + search + typeFilter\n const conditions: Record<string, unknown>[] = [parentCondition]\n\n if (search) {\n conditions.push({ [useAsTitle]: { like: search } })\n }\n\n if (typeCondition) {\n conditions.push(typeCondition)\n }\n\n const childrenWhere = conditions.length > 1 ? { and: conditions } : parentCondition\n\n // Fetch children (hierarchy items with this parent, or root items if parentId is null)\n const childrenData = await req.payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n locale: req.locale,\n overrideAccess: false,\n page: 1,\n req,\n user,\n where: combineWhereConstraints([childrenWhere, baseFilter]),\n })\n\n // Fetch related documents from other collections\n // At root level: show unassigned documents (where hierarchy field doesn't exist)\n // At nested level: show documents assigned to the selected hierarchy item\n const relatedDocumentsByCollection: RelatedDocumentsGrouped = {}\n const relatedBaseFilters: Record<string, Where> = {}\n\n // Use pre-computed relatedCollections from sanitized hierarchy config\n const relatedCollectionsConfig = hierarchyConfig.relatedCollections || {}\n\n for (const [relatedSlug, fieldInfo] of Object.entries(relatedCollectionsConfig)) {\n if (relatedSlug === collectionSlug) {\n continue\n }\n\n const relatedCollectionConfig = req.payload.collections[relatedSlug]?.config\n if (!relatedCollectionConfig) {\n continue\n }\n\n // Check if user has read permission for this collection\n if (!permissions?.collections?.[relatedSlug]?.read) {\n continue\n }\n\n const { fieldName, hasMany } = fieldInfo\n\n // Get baseFilter for this related collection\n const relatedBaseFilter = await (\n relatedCollectionConfig.admin?.baseFilter ?? relatedCollectionConfig.admin?.baseListFilter\n )?.({\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n page: 1,\n req,\n sort: undefined,\n })\n\n if (relatedBaseFilter) {\n relatedBaseFilters[relatedSlug] = relatedBaseFilter\n }\n\n // Build where clause based on whether we're at root or nested level\n let relationshipWhere: Record<string, unknown>\n\n if (parentId === null) {\n // Root level: find documents where hierarchy field doesn't exist, is null, or is empty array\n const conditions: Record<string, unknown>[] = [\n { [fieldName]: { exists: false } },\n { [fieldName]: { equals: null } },\n ]\n if (hasMany) {\n // hasMany fields store cleared values as empty arrays\n conditions.push({ [fieldName]: { equals: [] } })\n }\n relationshipWhere = { or: conditions }\n } else {\n // Nested level: find documents assigned to this hierarchy item\n // \"in\" operator works for both hasMany and single relationship fields\n relationshipWhere = {\n [fieldName]: { in: [parentId] },\n }\n }\n\n // Add search filter if provided\n const relatedUseAsTitle = relatedCollectionConfig.admin?.useAsTitle || 'id'\n const whereWithSearch = search\n ? { and: [relationshipWhere, { [relatedUseAsTitle]: { like: search } }] }\n : relationshipWhere\n\n // Combine relationship where with related collection's baseFilter\n const where = combineWhereConstraints([whereWithSearch, relatedBaseFilter])\n\n try {\n const data = await req.payload.find({\n collection: relatedSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n locale: req.locale,\n overrideAccess: false,\n page: 1,\n req,\n user,\n where,\n })\n\n if (data.totalDocs > 0) {\n relatedDocumentsByCollection[relatedSlug] = {\n hasMany,\n label: getTranslation(relatedCollectionConfig.labels?.plural, req.i18n),\n result: data,\n }\n }\n } catch (error) {\n req.payload.logger.warn({\n err: error,\n msg: `Failed to query related collection ${relatedSlug}`,\n })\n }\n }\n\n // Extract allowed collections from parent's collectionSpecific field\n // - undefined: collectionSpecific not configured, no filtering needed\n // - []: parent folder accepts everything, can only move to unrestricted destinations\n // - [{ slug, label }, ...]: parent folder has restrictions\n let allowedCollections: Array<{ label: string; slug: string }> | undefined\n\n if (hierarchyConfig.collectionSpecific && parent) {\n const typeFieldName = hierarchyConfig.collectionSpecific.fieldName\n const typeValues = parent[typeFieldName] as null | string[] | undefined\n\n if (typeValues && typeValues.length > 0) {\n allowedCollections = typeValues.map((slug) => {\n const config = req.payload.collections[slug]?.config\n const label = config ? getTranslation(config.labels?.plural, req.i18n) : slug\n return { slug, label }\n })\n } else {\n // Parent folder accepts everything (type is null or empty)\n allowedCollections = []\n }\n }\n\n return {\n allowedCollections,\n breadcrumbs,\n childrenData,\n parent,\n parentFieldName,\n parentId,\n relatedBaseFilters: Object.keys(relatedBaseFilters).length > 0 ? relatedBaseFilters : undefined,\n relatedDocumentsByCollection,\n }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,EAAEC,4BAA4B,QAAQ;AAEtE;;;;AAIA,OAAO,MAAMC,eAAA,GAAkB,MAAAA,CAAO;EACpCC,U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AAA,CAAI8E,IAAI;UACtEC,MAAA,EAAQN;QACV;MACF;IACF,EAAE,OAAOO,KAAA,EAAO;MACdhF,GAAA,CAAIiB,OAAO,CAACO,MAAM,CAACC,IAAI,CAAC;QACtBwD,GAAA,EAAKD,KAAA;QACLtD,GAAA,EAAK,sCAAsCgC,WAAA;MAC7C;IACF;EACF;EAEA;EACA;EACA;EACA;EACA,IAAIwB,kBAAA;EAEJ,IAAI9E,eAAA,CAAgB6B,kBAAkB,IAAItB,MAAA,EAAQ;IAChD,MAAMuB,aAAA,GAAgB9B,eAAA,CAAgB6B,kBAAkB,CAACE,SAAS;IAClE,MAAMgD,UAAA,GAAaxE,MAAM,CAACuB,aAAA,CAAc;IAExC,IAAIiD,UAAA,IAAcA,UAAA,CAAWnD,MAAM,GAAG,GAAG;MACvCkD,kBAAA,GAAqBC,UAAA,CAAWC,GAAG,CAAEC,IAAA;QACnC,MAAMrB,MAAA,GAAShE,GAAA,CAAIiB,OAAO,CAAC8C,WAAW,CAACsB,IAAA,CAAK,EAAErB,MAAA;QAC9C,MAAMW,KAAA,GAAQX,MAAA,GAAS1E,cAAA,CAAe0E,MAAA,CAAOY,MAAM,EAAEC,MAAA,EAAQ7E,GAAA,CAAI8E,IAAI,IAAIO,IAAA;QACzE,OAAO;UAAEA,IAAA;UAAMV;QAAM;MACvB;IACF,OAAO;MACL;MACAO,kBAAA,GAAqB,EAAE;IACzB;EACF;EAEA,OAAO;IACLA,kBAAA;IACAtE,WAAA;IACAiC,YAAA;IACAlC,MAAA;IACAH,eAAA;IACAV,QAAA;IACAyD,kBAAA,EAAoBK,MAAA,CAAO0B,IAAI,CAAC/B,kBAAA,EAAoBvB,MAAM,GAAG,IAAIuB,kBAAA,GAAqBjD,SAAA;IACtFgD;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAKpB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EAEvB,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AAsBhB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAUvC;;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;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,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,CAydA,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAYjD,CAAA"}
|