@payloadcms/ui 4.0.0-canary.2 → 4.0.0-canary.4
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/css/colors.css +6 -0
- package/dist/css/design-tokens.css +5 -0
- package/dist/css/elevations.css +4 -0
- package/dist/css/utilities.css +3 -2
- package/dist/elements/AppHeader/index.d.ts +3 -2
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +9 -2
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +1 -2
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.css +4 -8
- package/dist/elements/BulkUpload/ActionsBar/index.d.ts +1 -5
- package/dist/elements/BulkUpload/ActionsBar/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.js +15 -22
- package/dist/elements/BulkUpload/ActionsBar/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.css +14 -8
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts +2 -2
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.js +41 -36
- package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.css +158 -6
- package/dist/elements/BulkUpload/AddingFilesView/index.d.ts +5 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.js +134 -65
- package/dist/elements/BulkUpload/AddingFilesView/index.js.map +1 -1
- package/dist/elements/BulkUpload/DiscardWithoutSaving/index.js +4 -4
- package/dist/elements/BulkUpload/DiscardWithoutSaving/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.d.ts +1 -1
- package/dist/elements/BulkUpload/EditForm/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.js +16 -17
- package/dist/elements/BulkUpload/EditForm/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditForm/types.d.ts +2 -3
- package/dist/elements/BulkUpload/EditForm/types.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditForm/types.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js +78 -64
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditMany/index.js +28 -10
- package/dist/elements/BulkUpload/EditMany/index.js.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.css +63 -143
- package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.js +42 -175
- package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/BulkUpload/index.css +48 -0
- package/dist/elements/BulkUpload/index.d.ts +6 -5
- package/dist/elements/BulkUpload/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/index.js +42 -41
- package/dist/elements/BulkUpload/index.js.map +1 -1
- package/dist/elements/Card/index.css +1 -1
- package/dist/elements/ColumnSelection/Popup.d.ts +12 -0
- package/dist/elements/ColumnSelection/Popup.d.ts.map +1 -0
- package/dist/elements/{ColumnSelector/index.js → ColumnSelection/Popup.js} +23 -12
- package/dist/elements/ColumnSelection/Popup.js.map +1 -0
- package/dist/elements/ColumnSelection/index.d.ts +10 -0
- package/dist/elements/ColumnSelection/index.d.ts.map +1 -0
- package/dist/elements/{ColumnsButton → ColumnSelection}/index.js +23 -17
- package/dist/elements/ColumnSelection/index.js.map +1 -0
- package/dist/elements/CopyLocaleData/index.js +1 -1
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/CreateDocumentButton/index.d.ts.map +1 -1
- package/dist/elements/CreateDocumentButton/index.js +0 -1
- package/dist/elements/CreateDocumentButton/index.js.map +1 -1
- package/dist/elements/DatePicker/index.css +8 -8
- package/dist/elements/Dialog/DialogHeader/index.d.ts +4 -0
- package/dist/elements/Dialog/DialogHeader/index.d.ts.map +1 -1
- package/dist/elements/Dialog/DialogHeader/index.js +45 -30
- package/dist/elements/Dialog/DialogHeader/index.js.map +1 -1
- package/dist/elements/Dialog/DialogModal/index.d.ts +5 -0
- package/dist/elements/Dialog/DialogModal/index.d.ts.map +1 -1
- package/dist/elements/Dialog/DialogModal/index.js +58 -31
- package/dist/elements/Dialog/DialogModal/index.js.map +1 -1
- package/dist/elements/Dialog/DialogTitle/index.css +9 -0
- package/dist/elements/Dialog/DialogTitle/index.d.ts +5 -0
- package/dist/elements/Dialog/DialogTitle/index.d.ts.map +1 -0
- package/dist/elements/Dialog/DialogTitle/index.js +10 -0
- package/dist/elements/Dialog/DialogTitle/index.js.map +1 -0
- package/dist/elements/Dialog/index.css +7 -1
- package/dist/elements/DocumentControls/index.css +8 -2
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +12 -3
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js +5 -3
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js.map +1 -1
- package/dist/elements/DocumentFields/index.css +5 -2
- package/dist/elements/DocumentFields/index.d.ts +5 -0
- package/dist/elements/DocumentFields/index.d.ts.map +1 -1
- package/dist/elements/DocumentFields/index.js +9 -1
- package/dist/elements/DocumentFields/index.js.map +1 -1
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.d.ts +12 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.d.ts.map +1 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js +28 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js.map +1 -0
- package/dist/elements/DocumentHeader/index.js +2 -3
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/DraggableSortable/DragOverlayPreview/index.css +1 -1
- package/dist/elements/DrawerActionHeader/index.css +1 -1
- package/dist/elements/{BulkUpload/Header → DrawerHeader}/index.css +7 -1
- package/dist/elements/DrawerHeader/index.d.ts +10 -0
- package/dist/elements/DrawerHeader/index.d.ts.map +1 -0
- package/dist/elements/{BulkUpload/Header → DrawerHeader}/index.js +16 -11
- package/dist/elements/DrawerHeader/index.js.map +1 -0
- package/dist/elements/Dropzone/index.css +5 -13
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js +1 -1
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js.map +1 -1
- package/dist/elements/EditUpload/index.css +97 -158
- package/dist/elements/EditUpload/index.d.ts +2 -1
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +205 -231
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/EditUpload/{library.scss → library.css} +108 -46
- package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts +1 -1
- package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/DraggableFileDetails/index.js.map +1 -1
- package/dist/elements/FileDetails/FileMeta/index.css +27 -0
- package/dist/elements/FileDetails/FileMeta/index.d.ts +1 -1
- package/dist/elements/FileDetails/FileMeta/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/FileMeta/index.js +1 -1
- package/dist/elements/FileDetails/FileMeta/index.js.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.css +140 -0
- package/dist/elements/FileDetails/StaticFileDetails/index.d.ts +2 -2
- package/dist/elements/FileDetails/StaticFileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js.map +1 -1
- package/dist/elements/FileDetails/index.d.ts +1 -1
- package/dist/elements/FileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/index.js.map +1 -1
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.css +8 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.d.ts +10 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.js +24 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.css +9 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.d.ts +12 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.js +27 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.css +8 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.d.ts +10 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.js +24 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/index.css +83 -0
- package/dist/elements/FileManager/FilePreview/index.d.ts +13 -0
- package/dist/elements/FileManager/FilePreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/index.js +140 -0
- package/dist/elements/FileManager/FilePreview/index.js.map +1 -0
- package/dist/elements/FileManager/FileToolbar/index.css +91 -0
- package/dist/elements/FileManager/FileToolbar/index.d.ts +14 -0
- package/dist/elements/FileManager/FileToolbar/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FileToolbar/index.js +106 -0
- package/dist/elements/FileManager/FileToolbar/index.js.map +1 -0
- package/dist/elements/FileManager/index.css +154 -0
- package/dist/elements/FileManager/index.d.ts +19 -0
- package/dist/elements/FileManager/index.d.ts.map +1 -0
- package/dist/elements/FileManager/index.js +424 -0
- package/dist/elements/FileManager/index.js.map +1 -0
- package/dist/elements/GroupBy/Popup.d.ts +21 -0
- package/dist/elements/GroupBy/Popup.d.ts.map +1 -0
- package/dist/elements/GroupBy/Popup.js +268 -0
- package/dist/elements/GroupBy/Popup.js.map +1 -0
- package/dist/elements/GroupBy/index.d.ts +12 -0
- package/dist/elements/GroupBy/index.d.ts.map +1 -0
- package/dist/elements/GroupBy/index.js +91 -0
- package/dist/elements/GroupBy/index.js.map +1 -0
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +2 -2
- package/dist/elements/Hierarchy/Drawer/index.css +1 -1
- package/dist/elements/ListColumnSelectionButton/index.d.ts +11 -0
- package/dist/elements/ListColumnSelectionButton/index.d.ts.map +1 -0
- package/dist/elements/ListColumnSelectionButton/index.js +37 -0
- package/dist/elements/ListColumnSelectionButton/index.js.map +1 -0
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +7 -8
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/ListDrawer/Provider.d.ts +1 -1
- package/dist/elements/ListDrawer/Provider.d.ts.map +1 -1
- package/dist/elements/ListDrawer/Provider.js.map +1 -1
- package/dist/elements/ListGroupByButton/index.d.ts +12 -0
- package/dist/elements/ListGroupByButton/index.d.ts.map +1 -0
- package/dist/elements/ListGroupByButton/index.js +55 -0
- package/dist/elements/ListGroupByButton/index.js.map +1 -0
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.d.ts.map +1 -1
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js +2 -0
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +4 -4
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
- package/dist/elements/ListWhereBuilder/index.d.ts +16 -0
- package/dist/elements/ListWhereBuilder/index.d.ts.map +1 -0
- package/dist/elements/ListWhereBuilder/index.js +62 -0
- package/dist/elements/ListWhereBuilder/index.js.map +1 -0
- package/dist/elements/LivePreview/Toolbar/Controls/index.js +2 -2
- package/dist/elements/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.css +5 -44
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.js +25 -43
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
- package/dist/elements/MiniCarousel/index.css +94 -0
- package/dist/elements/MiniCarousel/index.d.ts +15 -0
- package/dist/elements/MiniCarousel/index.d.ts.map +1 -0
- package/dist/elements/MiniCarousel/index.js +84 -0
- package/dist/elements/MiniCarousel/index.js.map +1 -0
- package/dist/elements/Nav/SettingsMenuButton/index.css +5 -0
- package/dist/elements/Nav/SettingsMenuButton/index.d.ts +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.d.ts.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/index.css +2 -2
- package/dist/elements/NavGroup/index.css +1 -1
- package/dist/elements/Popup/PopupButtonList/index.css +5 -0
- package/dist/elements/Popup/PopupGroupLabel/index.css +8 -5
- package/dist/elements/Popup/index.d.ts +1 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +43 -12
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PreviewSizes/index.css +149 -0
- package/dist/elements/PreviewSizes/index.d.ts +2 -2
- package/dist/elements/PreviewSizes/index.d.ts.map +1 -1
- package/dist/elements/PreviewSizes/index.js +1 -1
- package/dist/elements/PreviewSizes/index.js.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts +2 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/PublishMany/index.d.ts +2 -6
- package/dist/elements/PublishMany/index.d.ts.map +1 -1
- package/dist/elements/PublishMany/index.js +0 -38
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/{index.scss → index.css} +1 -3
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js +77 -48
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.js +12 -21
- package/dist/elements/QueryPresets/fields/GroupByField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/Heading/index.css +52 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts +7 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts.map +1 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js +31 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js.map +1 -0
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.js +24 -23
- package/dist/elements/QueryPresets/fields/WhereField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/fields.css +23 -0
- package/dist/elements/ReactSelect/DropdownIndicator/index.css +1 -1
- package/dist/elements/ReactSelect/getCaptureMenuScroll.d.ts +5 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.d.ts.map +1 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.js +10 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.js.map +1 -0
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts +6 -0
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts.map +1 -0
- package/dist/elements/ReactSelect/getMenuListStyles.js +7 -0
- package/dist/elements/ReactSelect/getMenuListStyles.js.map +1 -0
- package/dist/elements/ReactSelect/index.css +0 -1
- package/dist/elements/ReactSelect/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/index.js +168 -148
- package/dist/elements/ReactSelect/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +1 -0
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/RelationshipTable/AddNewButton.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/AddNewButton.js +1 -2
- package/dist/elements/RelationshipTable/AddNewButton.js.map +1 -1
- package/dist/elements/RelationshipTable/index.js +2 -2
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/Search/SearchInput/index.js +1 -1
- package/dist/elements/Search/SearchInput/index.js.map +1 -1
- package/dist/elements/SortColumn/index.css +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +21 -2
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
- package/dist/elements/Table/index.css +24 -2
- package/dist/elements/Thumbnail/index.css +41 -0
- package/dist/elements/Thumbnail/index.d.ts +3 -3
- package/dist/elements/Thumbnail/index.d.ts.map +1 -1
- package/dist/elements/Thumbnail/index.js +1 -1
- package/dist/elements/Thumbnail/index.js.map +1 -1
- package/dist/elements/Toasts/fieldErrors.d.ts +1 -0
- package/dist/elements/Toasts/fieldErrors.d.ts.map +1 -1
- package/dist/elements/Toasts/fieldErrors.js +25 -9
- package/dist/elements/Toasts/fieldErrors.js.map +1 -1
- package/dist/elements/Toasts/index.css +5 -0
- package/dist/elements/UnpublishMany/DrawerContent.d.ts +2 -1
- package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/UnpublishMany/index.d.ts +2 -4
- package/dist/elements/UnpublishMany/index.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/index.js +0 -38
- package/dist/elements/UnpublishMany/index.js.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts +11 -0
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -0
- package/dist/elements/Upload/UploadFromURLModal/index.js +88 -0
- package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -0
- package/dist/elements/Upload/index.css +134 -45
- package/dist/elements/Upload/index.d.ts +3 -8
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +71 -92
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts +6 -2
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.js +15 -10
- package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/index.d.ts +2 -1
- package/dist/elements/UserMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/index.js +8 -5
- package/dist/elements/UserMenu/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.d.ts +1 -0
- package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js +17 -2
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.d.ts +4 -3
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +71 -62
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/elements/WhereBuilder/types.d.ts +6 -5
- package/dist/elements/WhereBuilder/types.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/types.js.map +1 -1
- package/dist/exports/client/index.d.ts +6 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +26 -26
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +2 -2
- package/dist/fields/Blocks/BlockSelector/BlockSearch/index.css +1 -1
- package/dist/fields/Blocks/BlockSelector/index.css +2 -5
- package/dist/fields/Checkbox/index.css +2 -2
- package/dist/fields/Group/index.css +3 -3
- package/dist/fields/Number/Input.d.ts.map +1 -1
- package/dist/fields/Number/Input.js +47 -35
- package/dist/fields/Number/Input.js.map +1 -1
- package/dist/fields/Number/index.css +19 -0
- package/dist/fields/Number/types.d.ts +6 -0
- package/dist/fields/Number/types.d.ts.map +1 -1
- package/dist/fields/Number/types.js.map +1 -1
- package/dist/fields/RadioGroup/index.css +6 -0
- package/dist/fields/Relationship/select-components/MultiValueLabel/index.css +1 -1
- package/dist/fields/Text/Input.d.ts.map +1 -1
- package/dist/fields/Text/Input.js +31 -28
- package/dist/fields/Text/Input.js.map +1 -1
- package/dist/fields/Text/types.d.ts +5 -0
- package/dist/fields/Text/types.d.ts.map +1 -1
- package/dist/fields/Text/types.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +12 -11
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.js +1 -1
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/graphics/Icon/index.js +1 -1
- package/dist/graphics/Icon/index.js.map +1 -1
- package/dist/hooks/useElementHeightVariable.d.ts +15 -0
- package/dist/hooks/useElementHeightVariable.d.ts.map +1 -0
- package/dist/hooks/useElementHeightVariable.js +53 -0
- package/dist/hooks/useElementHeightVariable.js.map +1 -0
- package/dist/icons/Check/index.css +1 -2
- package/dist/icons/Check/index.js +1 -1
- package/dist/icons/Check/index.js.map +1 -1
- package/dist/icons/Crop/index.css +5 -0
- package/dist/icons/Crop/index.d.ts +7 -0
- package/dist/icons/Crop/index.d.ts.map +1 -0
- package/dist/icons/Crop/index.js +24 -0
- package/dist/icons/Crop/index.js.map +1 -0
- package/dist/icons/Download/index.css +5 -0
- package/dist/icons/{ExternalLink → Download}/index.d.ts +1 -1
- package/dist/icons/Download/index.d.ts.map +1 -0
- package/dist/icons/Download/index.js +27 -0
- package/dist/icons/Download/index.js.map +1 -0
- package/dist/icons/{ExternalLink → NewTab}/index.css +1 -1
- package/dist/icons/NewTab/index.d.ts +7 -0
- package/dist/icons/NewTab/index.d.ts.map +1 -0
- package/dist/icons/NewTab/index.js +25 -0
- package/dist/icons/NewTab/index.js.map +1 -0
- package/dist/icons/Replace/index.css +5 -0
- package/dist/icons/Replace/index.d.ts +6 -0
- package/dist/icons/Replace/index.d.ts.map +1 -0
- package/dist/icons/Replace/index.js +20 -0
- package/dist/icons/Replace/index.js.map +1 -0
- package/dist/icons/Reset/index.css +5 -0
- package/dist/icons/Reset/index.d.ts +7 -0
- package/dist/icons/Reset/index.d.ts.map +1 -0
- package/dist/icons/Reset/index.js +25 -0
- package/dist/icons/Reset/index.js.map +1 -0
- package/dist/icons/Swap/index.js +1 -1
- package/dist/icons/Swap/index.js.map +1 -1
- package/dist/icons/Warning/index.css +1 -7
- package/dist/icons/Warning/index.d.ts +1 -1
- package/dist/icons/Warning/index.d.ts.map +1 -1
- package/dist/icons/Warning/index.js +11 -16
- package/dist/icons/Warning/index.js.map +1 -1
- package/dist/providers/ToastContainer/index.css +208 -0
- package/dist/providers/ToastContainer/index.d.ts +1 -0
- package/dist/providers/ToastContainer/index.d.ts.map +1 -1
- package/dist/providers/ToastContainer/index.js +19 -6
- package/dist/providers/ToastContainer/index.js.map +1 -1
- package/dist/scss/app.scss +10 -4
- package/dist/styles.css +1 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +52 -10
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/reduceFieldsToOptions.js +1 -1
- package/dist/utilities/reduceFieldsToOptions.js.map +1 -1
- package/dist/views/API/index.client.js +2 -2
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +2 -2
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +2 -2
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +1 -0
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts +1 -0
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +47 -1
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.css +143 -6
- package/dist/views/Edit/index.d.ts +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +34 -31
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.js +4 -4
- package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +2 -2
- package/dist/views/List/ListHeader/index.css +5 -0
- package/dist/views/List/ListSelection/index.js +4 -4
- package/dist/views/List/ListSelection/index.js.map +1 -1
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +6 -6
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/List/renderListViewSlots.d.ts.map +1 -1
- package/dist/views/List/renderListViewSlots.js +9 -6
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +1 -1
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Versions/index.css +0 -4
- package/package.json +4 -4
- package/dist/elements/BulkUpload/Header/index.d.ts +0 -9
- package/dist/elements/BulkUpload/Header/index.d.ts.map +0 -1
- package/dist/elements/BulkUpload/Header/index.js.map +0 -1
- package/dist/elements/ColumnSelector/index.d.ts +0 -9
- package/dist/elements/ColumnSelector/index.d.ts.map +0 -1
- package/dist/elements/ColumnSelector/index.js.map +0 -1
- package/dist/elements/ColumnsButton/index.d.ts +0 -7
- package/dist/elements/ColumnsButton/index.d.ts.map +0 -1
- package/dist/elements/ColumnsButton/index.js.map +0 -1
- package/dist/elements/FileDetails/FileMeta/index.scss +0 -31
- package/dist/elements/FileDetails/StaticFileDetails/index.scss +0 -134
- package/dist/elements/GroupByBuilder/index.d.ts +0 -12
- package/dist/elements/GroupByBuilder/index.d.ts.map +0 -1
- package/dist/elements/GroupByBuilder/index.js +0 -164
- package/dist/elements/GroupByBuilder/index.js.map +0 -1
- package/dist/elements/GroupByBuilder/index.scss +0 -39
- package/dist/elements/GroupByControl/index.d.ts +0 -9
- package/dist/elements/GroupByControl/index.d.ts.map +0 -1
- package/dist/elements/GroupByControl/index.js +0 -254
- package/dist/elements/GroupByControl/index.js.map +0 -1
- package/dist/elements/Nav/SettingsMenuButton/index.scss +0 -11
- package/dist/elements/PreviewSizes/index.scss +0 -147
- package/dist/elements/QueryPresets/fields/ColumnsField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/GroupByField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/WhereField/index.scss +0 -23
- package/dist/elements/Thumbnail/index.scss +0 -53
- package/dist/icons/ExternalLink/index.d.ts.map +0 -1
- package/dist/icons/ExternalLink/index.js +0 -26
- package/dist/icons/ExternalLink/index.js.map +0 -1
- package/dist/scss/toasts.scss +0 -146
- /package/dist/elements/{ColumnSelector/index.css → ColumnSelection/Popup.css} +0 -0
- /package/dist/elements/{GroupByControl/index.css → GroupBy/Popup.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","renderDocumentSlots","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","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err","notFound"],"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 { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\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 },\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 })\n req.server.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 = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\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 - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\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 hasScheduledPublish,\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 getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n user,\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 server: req.server,\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 (hasDraftsEnabled(collectionConfig || globalConfig)) {\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 = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\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 if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\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 = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\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 })\n\n req.server.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 locale,\n permissions,\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 const { isPreviewEnabled, previewURL } = await handlePreview({\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 hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\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 isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\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 props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC;AACA,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP;AACA,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SAASC,WAAW,QAAQ;AAC5B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AAEpC,SAASD,eAAe,QAAQ;AAQhC;;;;;;AAMA,OAAO,MAAME,cAAA,GAAiB,MAAAA,CAAO;EACnCC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,wBAAwB;EACxBC,MAAM;EACNC,mBAAmB;EACnBC,mBAAmB;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UACf;;;OArCC9D,MAAA,EAAQwD,IAAA;EA0CnB;AACF;AAEA,OAAO,eAAesD,aAAaC,KAA2B;EAC5D,IAAI;IACF,MAAM;MAAEd,QAAA,EAAUe;IAAgB,CAAE,GAAG,MAAMpI,cAAA,CAAemI,KAAA;IAC5D,OAAOC,gBAAA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEAhK,QAAA,CAAS;MAAEkK,GAAA,EAAKF,KAAA;MAAO7G,OAAA,EAAS2G,KAAA,CAAM7H,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAI6G,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCH,KAAA,CAAM7H,cAAc,CAACgB,GAAG,CAACuB,MAAM,CAAC2F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","renderDocumentSlots","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","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err","notFound"],"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 { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\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 },\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 })\n req.server.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 = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\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 - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\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 hasScheduledPublish,\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 getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n user,\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 server: req.server,\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 (hasDraftsEnabled(collectionConfig || globalConfig)) {\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 = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\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 if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\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 = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\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 })\n\n req.server.redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n doc: doc as Record<string, unknown>,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\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 const { isPreviewEnabled, previewURL } = await handlePreview({\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 hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\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 isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\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 props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC;AACA,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP;AACA,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SAASC,WAAW,QAAQ;AAC5B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,0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,cAAA;UACCsJ,WAAA,EAAalB,WAAA;UACb9F,gBAAA,EAAkBA,gBAAA;UAClBG,YAAA,EAAcA,YAAA;UACdE,WAAA,EAAaA,WAAA;UACbC,GAAA,EAAKA;yBAGTgG,IAAA,CAACxI,mBAAA;UAAoBuC,WAAA,EAAaA;yBAClCiG,IAAA,CAACzI,iBAAA;oBACEF,qBAAA,CAAsB;YACrBoI,WAAA;YACAV,SAAA,EAAWP,IAAA;YACX1F,SAAA;YACA6H,WAAA,EAAa/C;UACf;;;OArCC9D,MAAA,EAAQwD,IAAA;EA0CnB;AACF;AAEA,OAAO,eAAesD,aAAaC,KAA2B;EAC5D,IAAI;IACF,MAAM;MAAEd,QAAA,EAAUe;IAAgB,CAAE,GAAG,MAAMpI,cAAA,CAAemI,KAAA;IAC5D,OAAOC,gBAAA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEAhK,QAAA,CAAS;MAAEkK,GAAA,EAAKF,KAAA;MAAO7G,OAAA,EAAS2G,KAAA,CAAM7H,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAI6G,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCH,KAAA,CAAM7H,cAAc,CAACgB,GAAG,CAACuB,MAAM,CAAC2F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DocumentSlots, Locale, PayloadRequest, SanitizedCollectionConfig, SanitizedGlobalConfig, SanitizedPermissions, ServerFunction } from 'payload';
|
|
2
2
|
export declare const renderDocumentSlots: (args: {
|
|
3
3
|
collectionConfig?: SanitizedCollectionConfig;
|
|
4
|
+
doc?: Record<string, unknown>;
|
|
4
5
|
globalConfig?: SanitizedGlobalConfig;
|
|
5
6
|
hasSavePermission: boolean;
|
|
6
7
|
id?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDocumentSlots.d.ts","sourceRoot":"","sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EAEb,MAAM,
|
|
1
|
+
{"version":3,"file":"renderDocumentSlots.d.ts","sourceRoot":"","sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EAEb,MAAM,EAEN,cAAc,EAGd,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EAGpB,cAAc,EAOf,MAAM,SAAS,CAAA;AAShB,eAAO,MAAM,mBAAmB,EAAE,CAAC,IAAI,EAAE;IACvC,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,oBAAoB,CAAA;IACjC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,aAgOL,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,cAAc,CAAC;IACtD,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB,CA6CA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasDraftsEnabled } from 'payload/shared';
|
|
1
|
+
import { hasDraftsEnabled, matchMimeType } from 'payload/shared';
|
|
2
2
|
import { RenderServerComponent } from '../../elements/RenderServerComponent/index.js';
|
|
3
3
|
// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds
|
|
4
4
|
import { ViewDescription } from '../../exports/client/index.js';
|
|
@@ -7,6 +7,7 @@ export const renderDocumentSlots = args => {
|
|
|
7
7
|
const {
|
|
8
8
|
id,
|
|
9
9
|
collectionConfig,
|
|
10
|
+
doc,
|
|
10
11
|
globalConfig,
|
|
11
12
|
hasSavePermission,
|
|
12
13
|
locale,
|
|
@@ -145,6 +146,31 @@ export const renderDocumentSlots = args => {
|
|
|
145
146
|
serverProps
|
|
146
147
|
});
|
|
147
148
|
}
|
|
149
|
+
const filePreviewConfig = collectionConfig?.upload?.admin?.components?.filePreview;
|
|
150
|
+
if (collectionConfig?.upload && filePreviewConfig) {
|
|
151
|
+
const mimeType = doc?.mimeType ?? '';
|
|
152
|
+
let filePreviewComponent;
|
|
153
|
+
if (typeof filePreviewConfig === 'string' || typeof filePreviewConfig === 'object' && 'path' in filePreviewConfig) {
|
|
154
|
+
filePreviewComponent = filePreviewConfig;
|
|
155
|
+
} else {
|
|
156
|
+
filePreviewComponent = matchMimeType(filePreviewConfig, mimeType);
|
|
157
|
+
}
|
|
158
|
+
if (filePreviewComponent) {
|
|
159
|
+
components.UploadFilePreview = RenderServerComponent({
|
|
160
|
+
clientProps: {
|
|
161
|
+
filename: doc?.filename,
|
|
162
|
+
filesize: doc?.filesize,
|
|
163
|
+
fileSrc: doc?.url,
|
|
164
|
+
height: doc?.height,
|
|
165
|
+
mimeType,
|
|
166
|
+
width: doc?.width
|
|
167
|
+
},
|
|
168
|
+
Component: filePreviewComponent,
|
|
169
|
+
importMap: req.payload.importMap,
|
|
170
|
+
serverProps
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
148
174
|
return components;
|
|
149
175
|
};
|
|
150
176
|
export const renderDocumentSlotsHandler = async args => {
|
|
@@ -167,9 +193,29 @@ export const renderDocumentSlotsHandler = async args => {
|
|
|
167
193
|
data: {},
|
|
168
194
|
req
|
|
169
195
|
});
|
|
196
|
+
let doc;
|
|
197
|
+
if (id && collectionConfig.upload) {
|
|
198
|
+
const result = await req.payload.findByID({
|
|
199
|
+
id,
|
|
200
|
+
collection: collectionSlug,
|
|
201
|
+
depth: 0,
|
|
202
|
+
overrideAccess: false,
|
|
203
|
+
req,
|
|
204
|
+
select: {
|
|
205
|
+
filename: true,
|
|
206
|
+
filesize: true,
|
|
207
|
+
height: true,
|
|
208
|
+
mimeType: true,
|
|
209
|
+
url: true,
|
|
210
|
+
width: true
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
doc = result;
|
|
214
|
+
}
|
|
170
215
|
return renderDocumentSlots({
|
|
171
216
|
id,
|
|
172
217
|
collectionConfig,
|
|
218
|
+
doc,
|
|
173
219
|
hasSavePermission,
|
|
174
220
|
locale,
|
|
175
221
|
permissions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDocumentSlots.js","names":["hasDraftsEnabled","RenderServerComponent","ViewDescription","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","globalConfig","hasSavePermission","locale","permissions","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","server","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 { hasDraftsEnabled } from 'payload/shared'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds\nimport { ViewDescription } from '../../exports/client/index.js'\nimport { getDocumentPermissions } from '../../utilities/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 server: req.server,\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,gBAAgB,QAAQ;AAEjC,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,eAAe,QAAQ;AAChC,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,MAAA,EAAQV,GAAA,CAAIU,MAAM;IAClBC,IAAA,EAAMX,GAAA,CAAIW;EAEZ;EAEA,MAAMC,sBAAA,GACJjB,gBAAA,EAAkBU,KAAA,EAAOJ,UAAA,EAAYY,IAAA,EAAMC,sBAAA,IAC3ClB,YAAA,EAAcS,KAAA,EAAOJ,UAAA,EAAYY,IAAA,EAAMC,sBAAA;EAEzC,IAAIF,sBAAA,EAAwB;IAC1BX,UAAA,CAAWW,sBAAsB,GAAGvB,qBAAA,CAAsB;MACxD0B,SAAA,EAAWH,sBAAA;MACXI,SAAA,EAAWhB,GAAA,CAAIS,OAAO,CAAC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AAEA,OAAO,MAAMoD,0BAAA,GAGR,MAAO5D,IAAA;EACV,MAAM;IAAEC,EAAE;IAAEuC,cAAc;IAAEnC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGP,IAAA;EAEzD,MAAME,gBAAA,GAAmBK,GAAA,CAAIS,OAAO,CAAC6C,WAAW,CAACrB,cAAA,CAAe,EAAEsB,MAAA;EAElE,IAAI,CAAC5D,gBAAA,EAAkB;IACrB,MAAM,IAAI6D,KAAA,CAAMxD,GAAA,CAAI4B,CAAC,CAAC;EACxB;EAEA,MAAM;IAAE/B;EAAiB,CAAE,GAAG,MAAMN,sBAAA,CAAuB;IACzDG,EAAA;IACAC,gBAAA;IACA8D,IAAA,EAAM,CAAC;IACPzD;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":["hasDraftsEnabled","matchMimeType","RenderServerComponent","ViewDescription","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","doc","globalConfig","hasSavePermission","locale","permissions","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","server","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","filePreviewConfig","filePreview","mimeType","filePreviewComponent","UploadFilePreview","filename","filesize","fileSrc","url","height","width","renderDocumentSlotsHandler","collections","config","Error","data","result","findByID","collection","depth","overrideAccess","select"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n Locale,\n PayloadComponent,\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 UploadFilePreviewClientProps,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { hasDraftsEnabled, matchMimeType } from 'payload/shared'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds\nimport { ViewDescription } from '../../exports/client/index.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\n\nexport const renderDocumentSlots: (args: {\n collectionConfig?: SanitizedCollectionConfig\n doc?: Record<string, unknown>\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, doc, globalConfig, hasSavePermission, locale, permissions, req } =\n 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 server: req.server,\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 const filePreviewConfig = collectionConfig?.upload?.admin?.components?.filePreview\n if (collectionConfig?.upload && filePreviewConfig) {\n const mimeType = (doc?.mimeType as string) ?? ''\n let filePreviewComponent: PayloadComponent | undefined\n\n if (\n typeof filePreviewConfig === 'string' ||\n (typeof filePreviewConfig === 'object' && 'path' in filePreviewConfig)\n ) {\n filePreviewComponent = filePreviewConfig as PayloadComponent\n } else {\n filePreviewComponent = matchMimeType(\n filePreviewConfig as Record<string, PayloadComponent>,\n mimeType,\n )\n }\n\n if (filePreviewComponent) {\n components.UploadFilePreview = RenderServerComponent({\n clientProps: {\n filename: doc?.filename,\n filesize: doc?.filesize,\n fileSrc: doc?.url,\n height: doc?.height,\n mimeType,\n width: doc?.width,\n } as UploadFilePreviewClientProps,\n Component: filePreviewComponent,\n importMap: req.payload.importMap,\n serverProps,\n })\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 let doc: Record<string, unknown> | undefined\n if (id && collectionConfig.upload) {\n const result = await req.payload.findByID({\n id,\n collection: collectionSlug,\n depth: 0,\n overrideAccess: false,\n req,\n select: {\n filename: true,\n filesize: true,\n height: true,\n mimeType: true,\n url: true,\n width: true,\n },\n })\n doc = result as Record<string, unknown>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IF,EAAA,IAAMC,gBAAA,CAAiBuD,MAAM,EAAE;IACjC,MAAMoB,MAAA,GAAS,MAAMrE,GAAA,CAAIS,OAAO,CAAC6D,QAAQ,CAAC;MACxC7E,EAAA;MACA8E,UAAA,EAAYtC,cAAA;MACZuC,KAAA,EAAO;MACPC,cAAA,EAAgB;MAChBzE,GAAA;MACA0E,MAAA,EAAQ;QACNhB,QAAA,EAAU;QACVC,QAAA,EAAU;QACVG,MAAA,EAAQ;QACRP,QAAA,EAAU;QACVM,GAAA,EAAK;QACLE,KAAA,EAAO;MACT;IACF;IACApE,GAAA,GAAM0E,MAAA;EACR;EAEA,OAAO9E,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAC,GAAA;IACAE,iBAAA;IACAC,MAAA;IACAC,WAAA;IACAC;EACF;AACF","ignoreList":[]}
|
|
@@ -1,18 +1,160 @@
|
|
|
1
1
|
@layer payload-default {
|
|
2
|
+
.collection-edit__form {
|
|
3
|
+
height: 100%;
|
|
4
|
+
width: 100%;
|
|
5
|
+
container-type: inline-size;
|
|
6
|
+
container-name: edit-main;
|
|
7
|
+
}
|
|
8
|
+
|
|
2
9
|
.collection-edit__main-wrapper {
|
|
3
10
|
width: 100%;
|
|
4
11
|
display: flex;
|
|
5
12
|
}
|
|
6
13
|
|
|
14
|
+
.collection-edit__main-wrapper--scroll-fields-only {
|
|
15
|
+
height: calc(
|
|
16
|
+
100dvh - var(--app-header-height, 0px) - var(--doc-controls-height, 0px) -
|
|
17
|
+
var(--doc-header-height, 0px)
|
|
18
|
+
);
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
|
|
21
|
+
.collection-edit__main {
|
|
22
|
+
min-height: 0;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.document-fields {
|
|
27
|
+
height: 100%;
|
|
28
|
+
min-height: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.document-fields--force-sidebar-wrap {
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
overscroll-behavior: contain;
|
|
34
|
+
scrollbar-width: thin;
|
|
35
|
+
scrollbar-color: var(--scrollbar-color) transparent;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.document-fields:not(.document-fields--force-sidebar-wrap) .document-fields__main {
|
|
39
|
+
min-height: 0;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
overscroll-behavior: contain;
|
|
42
|
+
scrollbar-width: thin;
|
|
43
|
+
scrollbar-color: var(--scrollbar-color) transparent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.document-fields--force-sidebar-wrap .document-fields__main {
|
|
47
|
+
overflow-y: visible;
|
|
48
|
+
overscroll-behavior: auto;
|
|
49
|
+
scrollbar-width: auto;
|
|
50
|
+
scrollbar-color: auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.document-fields__sidebar {
|
|
54
|
+
overscroll-behavior: contain;
|
|
55
|
+
scrollbar-width: thin;
|
|
56
|
+
scrollbar-color: var(--scrollbar-color) transparent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.document-fields__sidebar-wrap {
|
|
60
|
+
--sidebar-wrap-top: 0px;
|
|
61
|
+
--sidebar-wrap-height: 100%;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.template-default__wrap:has(.collection-edit__main-wrapper--scroll-fields-only) {
|
|
66
|
+
height: 100dvh;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
|
|
7
70
|
.collection-edit__main {
|
|
8
71
|
width: 100%;
|
|
9
|
-
container-type: inline-size;
|
|
10
72
|
}
|
|
11
73
|
|
|
12
74
|
.collection-edit__main--popup-open {
|
|
13
75
|
width: 100%;
|
|
14
76
|
}
|
|
15
77
|
|
|
78
|
+
.collection-edit__main-wrapper--has-upload-panel {
|
|
79
|
+
.collection-edit__main {
|
|
80
|
+
flex: 1;
|
|
81
|
+
}
|
|
82
|
+
.file-manager {
|
|
83
|
+
flex: 2;
|
|
84
|
+
border-inline-start: var(--stroke-width-small) solid var(--color-border);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.collection-edit__main:not(:has(.field-type)) {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.collection-edit__main:not(:has(.field-type)) ~ .file-manager {
|
|
92
|
+
border-inline-start: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Container query (not viewport) so the layout stacks based on the space actually available
|
|
97
|
+
to the edit view — e.g. inside a narrow document drawer it uses the stacked mobile layout. */
|
|
98
|
+
@container edit-main (max-width: 1024px) {
|
|
99
|
+
.collection-edit__main-wrapper--scroll-fields-only {
|
|
100
|
+
height: auto;
|
|
101
|
+
overflow: visible;
|
|
102
|
+
|
|
103
|
+
.collection-edit__main {
|
|
104
|
+
min-height: initial;
|
|
105
|
+
overflow: visible;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.document-fields {
|
|
109
|
+
height: auto;
|
|
110
|
+
min-height: initial;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.document-fields--force-sidebar-wrap {
|
|
114
|
+
overflow-y: visible;
|
|
115
|
+
overscroll-behavior: auto;
|
|
116
|
+
scrollbar-width: auto;
|
|
117
|
+
scrollbar-color: auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.document-fields:not(.document-fields--force-sidebar-wrap) .document-fields__main {
|
|
121
|
+
min-height: initial;
|
|
122
|
+
overflow-y: visible;
|
|
123
|
+
overscroll-behavior: auto;
|
|
124
|
+
scrollbar-width: auto;
|
|
125
|
+
scrollbar-color: auto;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.document-fields__sidebar {
|
|
129
|
+
overscroll-behavior: auto;
|
|
130
|
+
scrollbar-width: auto;
|
|
131
|
+
scrollbar-color: auto;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.template-default__wrap:has(.collection-edit__main-wrapper--scroll-fields-only) {
|
|
136
|
+
height: auto;
|
|
137
|
+
overflow: visible;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.collection-edit__main-wrapper--has-upload-panel {
|
|
141
|
+
flex-direction: column-reverse;
|
|
142
|
+
gap: var(--spacer-5);
|
|
143
|
+
|
|
144
|
+
.file-manager {
|
|
145
|
+
order: 0;
|
|
146
|
+
flex: 1 0 0;
|
|
147
|
+
/* Stacked — no vertical divider; the file manager's own bottom border separates it. */
|
|
148
|
+
border-inline-start: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.document-fields {
|
|
152
|
+
flex: 0 0 auto;
|
|
153
|
+
width: 100%;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
16
158
|
.collection-edit__main--is-live-previewing {
|
|
17
159
|
width: 40%;
|
|
18
160
|
position: relative;
|
|
@@ -29,11 +171,6 @@
|
|
|
29
171
|
}
|
|
30
172
|
}
|
|
31
173
|
|
|
32
|
-
.collection-edit__form {
|
|
33
|
-
height: 100%;
|
|
34
|
-
width: 100%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
174
|
.collection-edit__auth {
|
|
38
175
|
border-radius: var(--radius-small);
|
|
39
176
|
}
|
|
@@ -5,5 +5,5 @@ export type OnSaveContext = {
|
|
|
5
5
|
getDocPermissions?: boolean;
|
|
6
6
|
incrementVersionCount?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare function DefaultEditView({ BeforeDocumentControls, BeforeDocumentMeta, Description, EditMenuItems, LivePreview: CustomLivePreview, PreviewButton, PublishButton, SaveButton, SaveDraftButton, Status, UnpublishButton, Upload: CustomUpload, UploadControls, }: DocumentViewClientProps): React.JSX.Element;
|
|
8
|
+
export declare function DefaultEditView({ BeforeDocumentControls, BeforeDocumentMeta, Description, EditMenuItems, LivePreview: CustomLivePreview, PreviewButton, PublishButton, SaveButton, SaveDraftButton, Status, UnpublishButton, Upload: CustomUpload, UploadControls, UploadFilePreview, }: DocumentViewClientProps): React.JSX.Element;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Edit/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Edit/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGlE,OAAO,KAA4D,MAAM,OAAO,CAAA;AAsChF,OAAO,aAAa,CAAA;AAKpB,MAAM,MAAM,aAAa,GAAG;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAKD,wBAAgB,eAAe,CAAC,EAC9B,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,eAAe,EACf,MAAM,EAAE,YAAY,EACpB,cAAc,EACd,iBAAiB,GAClB,EAAE,uBAAuB,qBAixBzB"}
|
package/dist/views/Edit/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
4
|
import { formatAdminURL, hasAutosaveEnabled } from 'payload/shared';
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { toast } from 'sonner';
|
|
7
7
|
import { DocumentControls } from '../../elements/DocumentControls/index.js';
|
|
8
8
|
import { DocumentDrawerHeader } from '../../elements/DocumentDrawer/DrawerHeader/index.js';
|
|
@@ -11,9 +11,9 @@ import { DocumentFields } from '../../elements/DocumentFields/index.js';
|
|
|
11
11
|
import { DocumentLocked } from '../../elements/DocumentLocked/index.js';
|
|
12
12
|
import { DocumentStaleData } from '../../elements/DocumentStaleData/index.js';
|
|
13
13
|
import { DocumentTakeOver } from '../../elements/DocumentTakeOver/index.js';
|
|
14
|
+
import { FileManager } from '../../elements/FileManager/index.js';
|
|
14
15
|
import { LeaveWithoutSaving } from '../../elements/LeaveWithoutSaving/index.js';
|
|
15
16
|
import { LivePreviewWindow } from '../../elements/LivePreview/Window/index.js';
|
|
16
|
-
import { Upload } from '../../elements/Upload/index.js';
|
|
17
17
|
import { Form } from '../../forms/Form/index.js';
|
|
18
18
|
import { useAuth } from '../../providers/Auth/index.js';
|
|
19
19
|
import { useConfig } from '../../providers/Config/index.js';
|
|
@@ -54,7 +54,8 @@ export function DefaultEditView({
|
|
|
54
54
|
Status,
|
|
55
55
|
UnpublishButton,
|
|
56
56
|
Upload: CustomUpload,
|
|
57
|
-
UploadControls
|
|
57
|
+
UploadControls,
|
|
58
|
+
UploadFilePreview
|
|
58
59
|
}) {
|
|
59
60
|
const {
|
|
60
61
|
id,
|
|
@@ -496,6 +497,23 @@ export function DefaultEditView({
|
|
|
496
497
|
redirectAfterRestore,
|
|
497
498
|
user: currentEditor
|
|
498
499
|
};
|
|
500
|
+
const renderAuth = auth ? /*#__PURE__*/_jsx(Auth, {
|
|
501
|
+
className: `${baseClass}__auth`,
|
|
502
|
+
collectionSlug: collectionConfig.slug,
|
|
503
|
+
disableLocalStrategy: collectionConfig.auth?.disableLocalStrategy,
|
|
504
|
+
email: data?.email,
|
|
505
|
+
loginWithUsername: auth?.loginWithUsername,
|
|
506
|
+
operation: operation,
|
|
507
|
+
readOnly: !hasSavePermission,
|
|
508
|
+
requirePassword: !id,
|
|
509
|
+
setValidateBeforeSubmit: setValidateBeforeSubmit,
|
|
510
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
511
|
+
useAPIKey: auth.useAPIKey,
|
|
512
|
+
username: data?.username,
|
|
513
|
+
verify: auth.verify
|
|
514
|
+
}) : undefined;
|
|
515
|
+
const shouldRenderUploadPanel = Boolean(upload) && !(operation === 'create' && upload.hideFileInputOnCreate);
|
|
516
|
+
const shouldScrollFieldsOnly = shouldRenderUploadPanel;
|
|
499
517
|
return /*#__PURE__*/_jsx("main", {
|
|
500
518
|
className: [baseClass, (id || globalSlug) && `${baseClass}--is-editing`, globalSlug && `global-edit--${globalSlug}`, collectionSlug && `collection-edit--${collectionSlug}`, isLivePreviewing && `${baseClass}--is-live-previewing`].filter(Boolean).join(' '),
|
|
501
519
|
children: /*#__PURE__*/_jsx(OperationProvider, {
|
|
@@ -588,45 +606,30 @@ export function DefaultEditView({
|
|
|
588
606
|
...documentControlsProps,
|
|
589
607
|
variant: "default"
|
|
590
608
|
}), /*#__PURE__*/_jsxs("div", {
|
|
591
|
-
className: [`${baseClass}__main-wrapper`, isPopupOpen && `${baseClass}--detached`].filter(Boolean).join(' '),
|
|
609
|
+
className: [`${baseClass}__main-wrapper`, shouldRenderUploadPanel && `${baseClass}__main-wrapper--has-upload-panel`, shouldScrollFieldsOnly && `${baseClass}__main-wrapper--scroll-fields-only`, isPopupOpen && `${baseClass}--detached`].filter(Boolean).join(' '),
|
|
592
610
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
593
611
|
className: [`${baseClass}__main`, isPopupOpen && `${baseClass}__main--popup-open`].filter(Boolean).join(' '),
|
|
594
612
|
children: [/*#__PURE__*/_jsx(DocumentFields, {
|
|
595
613
|
AfterFields: AfterFields,
|
|
596
|
-
BeforeFields:
|
|
597
|
-
children: [
|
|
598
|
-
|
|
599
|
-
collectionSlug: collectionConfig.slug,
|
|
600
|
-
disableLocalStrategy: collectionConfig.auth?.disableLocalStrategy,
|
|
601
|
-
email: data?.email,
|
|
602
|
-
loginWithUsername: auth?.loginWithUsername,
|
|
603
|
-
operation: operation,
|
|
604
|
-
readOnly: !hasSavePermission,
|
|
605
|
-
requirePassword: !id,
|
|
606
|
-
setValidateBeforeSubmit: setValidateBeforeSubmit,
|
|
607
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
608
|
-
useAPIKey: auth.useAPIKey,
|
|
609
|
-
username: data?.username,
|
|
610
|
-
verify: auth.verify
|
|
611
|
-
}), upload && /*#__PURE__*/_jsx(React.Fragment, {
|
|
612
|
-
children: /*#__PURE__*/_jsx(UploadControlsProvider, {
|
|
613
|
-
children: CustomUpload || /*#__PURE__*/_jsx(Upload, {
|
|
614
|
-
collectionSlug: collectionConfig.slug,
|
|
615
|
-
initialState: initialState,
|
|
616
|
-
uploadConfig: upload,
|
|
617
|
-
UploadControls: UploadControls
|
|
618
|
-
})
|
|
619
|
-
})
|
|
620
|
-
})]
|
|
621
|
-
}),
|
|
614
|
+
BeforeFields: renderAuth || BeforeFields ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
615
|
+
children: [renderAuth, BeforeFields]
|
|
616
|
+
}) : null,
|
|
622
617
|
Description: Description,
|
|
623
618
|
docPermissions: docPermissions,
|
|
624
619
|
fields: docConfig.fields,
|
|
625
|
-
forceSidebarWrap: isLivePreviewing,
|
|
620
|
+
forceSidebarWrap: shouldRenderUploadPanel || isLivePreviewing,
|
|
626
621
|
isTrashed: isTrashed,
|
|
627
622
|
readOnly: isReadOnlyForIncomingUser || !hasSavePermission || isTrashed,
|
|
628
623
|
schemaPathSegments: schemaPathSegments
|
|
629
624
|
}), AfterDocument]
|
|
625
|
+
}), shouldRenderUploadPanel && /*#__PURE__*/_jsx(UploadControlsProvider, {
|
|
626
|
+
children: CustomUpload || /*#__PURE__*/_jsx(FileManager, {
|
|
627
|
+
collectionSlug: collectionConfig.slug,
|
|
628
|
+
initialState: initialState,
|
|
629
|
+
uploadConfig: upload,
|
|
630
|
+
UploadControls: UploadControls,
|
|
631
|
+
UploadFilePreview: UploadFilePreview
|
|
632
|
+
})
|
|
630
633
|
}), isLivePreviewEnabled && !isInDrawer && livePreviewURL && /*#__PURE__*/_jsx(_Fragment, {
|
|
631
634
|
children: CustomLivePreview || /*#__PURE__*/_jsx(LivePreviewWindow, {
|
|
632
635
|
collectionSlug: collectionSlug,
|