@payloadcms/ui 3.2.3-canary.673b4b5 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/AddNewRelation/index.js +40 -40
- package/dist/elements/AddNewRelation/index.js.map +1 -1
- package/dist/elements/AddNewRelation/useRelatedCollections.js +3 -3
- package/dist/elements/AddNewRelation/useRelatedCollections.js.map +1 -1
- package/dist/elements/AnimateHeight/index.d.ts.map +1 -1
- package/dist/elements/AnimateHeight/index.js +4 -1
- package/dist/elements/AnimateHeight/index.js.map +1 -1
- package/dist/elements/AnimateHeight/usePatchAnimateHeight.d.ts +2 -1
- package/dist/elements/AnimateHeight/usePatchAnimateHeight.d.ts.map +1 -1
- package/dist/elements/AnimateHeight/usePatchAnimateHeight.js +67 -79
- package/dist/elements/AnimateHeight/usePatchAnimateHeight.js.map +1 -1
- package/dist/elements/ArrayAction/index.js +10 -10
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.js +13 -13
- package/dist/elements/BulkUpload/ActionsBar/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.js +14 -14
- 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/DrawerCloseButton/index.js +3 -3
- package/dist/elements/BulkUpload/DrawerCloseButton/index.js.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.js +29 -26
- package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +2 -0
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/BulkUpload/index.js +8 -8
- package/dist/elements/BulkUpload/index.js.map +1 -1
- package/dist/elements/CodeEditor/CodeEditor.js +28 -32
- package/dist/elements/CodeEditor/CodeEditor.js.map +1 -1
- package/dist/elements/Collapsible/index.js +13 -13
- package/dist/elements/Collapsible/index.js.map +1 -1
- package/dist/elements/ColumnSelector/index.js +10 -10
- package/dist/elements/ColumnSelector/index.js.map +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/DatePicker.js +4 -4
- package/dist/elements/DatePicker/DatePicker.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +10 -14
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.js +9 -9
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js +4 -4
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/index.js +47 -47
- package/dist/elements/DocumentDrawer/index.js.map +1 -1
- package/dist/elements/DocumentLocked/index.js +21 -21
- package/dist/elements/DocumentLocked/index.js.map +1 -1
- package/dist/elements/DocumentTakeOver/index.js +10 -10
- package/dist/elements/DocumentTakeOver/index.js.map +1 -1
- package/dist/elements/DraggableSortable/DraggableSortableItem/index.js +9 -9
- package/dist/elements/DraggableSortable/DraggableSortableItem/index.js.map +1 -1
- package/dist/elements/DraggableSortable/index.js +11 -11
- package/dist/elements/DraggableSortable/index.js.map +1 -1
- package/dist/elements/DraggableSortable/useDraggableSortable/index.js +8 -8
- package/dist/elements/DraggableSortable/useDraggableSortable/index.js.map +1 -1
- package/dist/elements/Drawer/index.js +38 -38
- package/dist/elements/Drawer/index.js.map +1 -1
- package/dist/elements/Drawer/useDrawerSlug.js +3 -3
- package/dist/elements/Drawer/useDrawerSlug.js.map +1 -1
- package/dist/elements/EditMany/index.d.ts.map +1 -1
- package/dist/elements/EditMany/index.js +32 -33
- package/dist/elements/EditMany/index.js.map +1 -1
- package/dist/elements/FieldSelect/index.js +17 -16
- package/dist/elements/FieldSelect/index.js.map +1 -1
- package/dist/elements/FileDetails/DraggableFileDetails/index.js +15 -15
- package/dist/elements/FileDetails/DraggableFileDetails/index.js.map +1 -1
- package/dist/elements/FileDetails/FileMeta/index.js +15 -15
- package/dist/elements/FileDetails/FileMeta/index.js.map +1 -1
- package/dist/elements/FullscreenModal/index.js +4 -4
- package/dist/elements/FullscreenModal/index.js.map +1 -1
- package/dist/elements/Hamburger/index.js +4 -4
- package/dist/elements/Hamburger/index.js.map +1 -1
- package/dist/elements/HydrateAuthProvider/index.js +3 -3
- package/dist/elements/HydrateAuthProvider/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.js +11 -11
- package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
- package/dist/elements/ListDrawer/index.js +19 -18
- package/dist/elements/ListDrawer/index.js.map +1 -1
- package/dist/elements/ListSelection/index.js +3 -3
- package/dist/elements/ListSelection/index.js.map +1 -1
- package/dist/elements/Loading/index.js +15 -15
- package/dist/elements/Loading/index.js.map +1 -1
- package/dist/elements/LoadingOverlay/index.js +18 -16
- package/dist/elements/LoadingOverlay/index.js.map +1 -1
- package/dist/elements/Localizer/LocalizerLabel/index.js +5 -5
- package/dist/elements/Localizer/LocalizerLabel/index.js.map +1 -1
- package/dist/elements/Localizer/index.d.ts.map +1 -1
- package/dist/elements/Localizer/index.js +20 -19
- package/dist/elements/Localizer/index.js.map +1 -1
- package/dist/elements/Locked/index.js +3 -3
- package/dist/elements/Locked/index.js.map +1 -1
- package/dist/elements/Logout/index.js +7 -7
- package/dist/elements/Logout/index.js.map +1 -1
- package/dist/elements/Nav/NavToggler/index.js +13 -13
- package/dist/elements/Nav/NavToggler/index.js.map +1 -1
- package/dist/elements/NavGroup/index.js +12 -12
- package/dist/elements/NavGroup/index.js.map +1 -1
- package/dist/elements/PerPage/index.js +7 -7
- package/dist/elements/PerPage/index.js.map +1 -1
- package/dist/elements/Pill/index.js +8 -8
- package/dist/elements/Pill/index.js.map +1 -1
- package/dist/elements/Popup/index.js +1 -0
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PreviewButton/index.js +3 -3
- package/dist/elements/PreviewButton/index.js.map +1 -1
- package/dist/elements/PublishButton/index.js +28 -28
- package/dist/elements/PublishButton/index.js.map +1 -1
- package/dist/elements/PublishMany/index.d.ts.map +1 -1
- package/dist/elements/PublishMany/index.js +10 -10
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/ReactSelect/Input/index.d.ts +2 -2
- package/dist/elements/ReactSelect/Input/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/Input/index.js.map +1 -1
- package/dist/elements/ReactSelect/MultiValue/index.js +10 -10
- package/dist/elements/ReactSelect/MultiValue/index.js.map +1 -1
- package/dist/elements/ReactSelect/MultiValueRemove/index.js +5 -5
- package/dist/elements/ReactSelect/MultiValueRemove/index.js.map +1 -1
- package/dist/elements/ReactSelect/index.js.map +1 -1
- package/dist/elements/RelationshipTable/cells/DrawerLink/index.js +4 -4
- package/dist/elements/RelationshipTable/cells/DrawerLink/index.js.map +1 -1
- package/dist/elements/RelationshipTable/index.js +278 -142
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/RenderIfInViewport/index.js +3 -3
- package/dist/elements/RenderIfInViewport/index.js.map +1 -1
- package/dist/elements/RenderTitle/index.js +6 -6
- package/dist/elements/RenderTitle/index.js.map +1 -1
- package/dist/elements/SelectAll/index.js +3 -3
- package/dist/elements/SelectAll/index.js.map +1 -1
- package/dist/elements/SelectRow/index.js +6 -6
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/ShimmerEffect/index.js +7 -7
- package/dist/elements/ShimmerEffect/index.js.map +1 -1
- package/dist/elements/SortColumn/index.js +16 -16
- package/dist/elements/SortColumn/index.js.map +1 -1
- package/dist/elements/SortComplex/index.d.ts.map +1 -1
- package/dist/elements/SortComplex/index.js +38 -51
- package/dist/elements/SortComplex/index.js.map +1 -1
- package/dist/elements/Status/index.js +38 -35
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +12 -12
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/StepNav/SetStepNav.js +3 -3
- package/dist/elements/StepNav/SetStepNav.js.map +1 -1
- package/dist/elements/StepNav/context.js +3 -3
- package/dist/elements/StepNav/context.js.map +1 -1
- package/dist/elements/StepNav/index.js +9 -9
- package/dist/elements/StepNav/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Date/index.js +3 -3
- package/dist/elements/Table/DefaultCell/fields/Date/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +31 -31
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Select/index.js +3 -3
- package/dist/elements/Table/DefaultCell/fields/Select/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +15 -15
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.js +12 -9
- package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
- package/dist/elements/TableColumns/RenderDefaultCell/index.js +6 -6
- package/dist/elements/TableColumns/RenderDefaultCell/index.js.map +1 -1
- package/dist/elements/Thumbnail/index.js +27 -27
- package/dist/elements/Thumbnail/index.js.map +1 -1
- package/dist/elements/ThumbnailCard/index.js +10 -10
- package/dist/elements/ThumbnailCard/index.js.map +1 -1
- package/dist/elements/Tooltip/index.js +29 -24
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/UnpublishMany/index.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/index.js +11 -11
- package/dist/elements/UnpublishMany/index.js.map +1 -1
- package/dist/elements/Upload/index.js +5 -5
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Number/index.js +3 -3
- package/dist/elements/WhereBuilder/Condition/Number/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Select/index.js +13 -10
- package/dist/elements/WhereBuilder/Condition/Select/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Text/index.js +5 -5
- package/dist/elements/WhereBuilder/Condition/Text/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js +45 -45
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.js +11 -11
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/exports/client/{DatePicker-QST7QHAX.js → CodeEditor-RZ32B2QF.js} +2 -2
- package/dist/exports/client/DatePicker-QW5V4BQV.js +14 -0
- package/dist/exports/client/DatePicker-QW5V4BQV.js.map +8 -0
- package/dist/exports/client/chunk-CKHKQPOO.js +26 -0
- package/dist/exports/client/{CodeEditor-5MCGR4GL.js.map → chunk-CKHKQPOO.js.map} +4 -4
- package/dist/exports/client/chunk-KZPVHMBR.js +29 -0
- package/dist/exports/client/chunk-KZPVHMBR.js.map +8 -0
- package/dist/exports/client/index.d.ts +4 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +16 -16
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Array/ArrayRow.js +38 -38
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +27 -25
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +51 -49
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/BlockSearch/index.js +3 -3
- package/dist/fields/Blocks/BlocksDrawer/BlockSearch/index.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js +13 -13
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/Blocks/RowActions.js +25 -25
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/SectionTitle/index.js +8 -8
- package/dist/fields/Blocks/SectionTitle/index.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +26 -24
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js +4 -2
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/ConfirmPassword/index.js +6 -6
- package/dist/fields/ConfirmPassword/index.js.map +1 -1
- package/dist/fields/FieldLabel/index.js +18 -18
- package/dist/fields/FieldLabel/index.js.map +1 -1
- package/dist/fields/Group/index.d.ts.map +1 -1
- package/dist/fields/Group/index.js +6 -4
- package/dist/fields/Group/index.js.map +1 -1
- package/dist/fields/Hidden/index.js +7 -7
- package/dist/fields/Hidden/index.js.map +1 -1
- package/dist/fields/Number/index.js +5 -5
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Password/input.js +24 -24
- package/dist/fields/Password/input.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.js +9 -9
- package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js +4 -2
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/index.d.ts.map +1 -1
- package/dist/fields/Relationship/index.js +4 -2
- package/dist/fields/Relationship/index.js.map +1 -1
- package/dist/fields/Relationship/select-components/MultiValueLabel/index.js +18 -18
- package/dist/fields/Relationship/select-components/MultiValueLabel/index.js.map +1 -1
- package/dist/fields/Relationship/select-components/SingleValue/index.js +18 -18
- package/dist/fields/Relationship/select-components/SingleValue/index.js.map +1 -1
- package/dist/fields/Select/Input.js +28 -28
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/fields/Tabs/Tab/index.js +10 -10
- package/dist/fields/Tabs/Tab/index.js.map +1 -1
- package/dist/fields/Tabs/index.js +69 -69
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Text/Input.js +24 -24
- package/dist/fields/Text/Input.js.map +1 -1
- package/dist/fields/Textarea/Input.js +19 -19
- package/dist/fields/Textarea/Input.js.map +1 -1
- package/dist/fields/Upload/HasMany/index.js +11 -11
- package/dist/fields/Upload/HasMany/index.js.map +1 -1
- package/dist/fields/Upload/Input.js +109 -104
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/RelationshipContent/index.js +20 -20
- package/dist/fields/Upload/RelationshipContent/index.js.map +1 -1
- package/dist/forms/NullifyField/index.js +3 -3
- package/dist/forms/NullifyField/index.js.map +1 -1
- package/dist/forms/RenderFields/RenderField.js +9 -9
- package/dist/forms/RenderFields/RenderField.js.map +1 -1
- package/dist/forms/RenderFields/index.js +16 -16
- package/dist/forms/RenderFields/index.js.map +1 -1
- package/dist/forms/WatchChildErrors/index.js +10 -10
- package/dist/forms/WatchChildErrors/index.js.map +1 -1
- package/dist/forms/useField/index.js +44 -44
- package/dist/forms/useField/index.js.map +1 -1
- package/dist/hooks/useDebounce.js +3 -3
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useDebouncedEffect.js +6 -6
- package/dist/hooks/useDebouncedEffect.js.map +1 -1
- package/dist/hooks/useDelay.js +3 -3
- package/dist/hooks/useDelay.js.map +1 -1
- package/dist/hooks/useHotkey.js +18 -14
- package/dist/hooks/useHotkey.js.map +1 -1
- package/dist/hooks/usePayloadAPI.js +13 -13
- package/dist/hooks/usePayloadAPI.js.map +1 -1
- package/dist/hooks/useThrottledEffect.js +3 -3
- package/dist/hooks/useThrottledEffect.js.map +1 -1
- package/dist/providers/Actions/index.js +4 -4
- package/dist/providers/Actions/index.js.map +1 -1
- package/dist/providers/ClientFunction/index.js +3 -3
- package/dist/providers/ClientFunction/index.js.map +1 -1
- package/dist/providers/Config/index.js +9 -10
- package/dist/providers/Config/index.js.map +1 -1
- package/dist/providers/DocumentEvents/index.js +3 -3
- package/dist/providers/DocumentEvents/index.js.map +1 -1
- package/dist/providers/EditDepth/index.js +3 -3
- package/dist/providers/EditDepth/index.js.map +1 -1
- package/dist/providers/EntityVisibility/index.js +9 -10
- package/dist/providers/EntityVisibility/index.js.map +1 -1
- package/dist/providers/ListQuery/index.js +2 -2
- package/dist/providers/ListQuery/index.js.map +1 -1
- package/dist/providers/Locale/index.d.ts.map +1 -1
- package/dist/providers/Locale/index.js +65 -59
- package/dist/providers/Locale/index.js.map +1 -1
- package/dist/providers/Params/index.d.ts +16 -0
- package/dist/providers/Params/index.d.ts.map +1 -1
- package/dist/providers/Params/index.js +19 -4
- package/dist/providers/Params/index.js.map +1 -1
- package/dist/providers/RouteCache/index.js +6 -6
- package/dist/providers/RouteCache/index.js.map +1 -1
- package/dist/providers/SearchParams/index.d.ts +22 -4
- package/dist/providers/SearchParams/index.d.ts.map +1 -1
- package/dist/providers/SearchParams/index.js +28 -14
- package/dist/providers/SearchParams/index.js.map +1 -1
- package/dist/providers/Selection/index.d.ts.map +1 -1
- package/dist/providers/Selection/index.js +7 -8
- package/dist/providers/Selection/index.js.map +1 -1
- package/dist/providers/Theme/index.js +7 -7
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/providers/Translation/index.js +12 -12
- package/dist/providers/Translation/index.js.map +1 -1
- package/dist/providers/UploadEdits/index.js +3 -3
- package/dist/providers/UploadEdits/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/buildClientFieldSchemaMap/index.js +2 -0
- package/dist/utilities/buildClientFieldSchemaMap/index.js.map +1 -1
- package/dist/utilities/buildFieldSchemaMap/index.js +2 -0
- package/dist/utilities/buildFieldSchemaMap/index.js.map +1 -1
- package/dist/utilities/groupNavItems.js +3 -3
- package/dist/utilities/groupNavItems.js.map +1 -1
- package/dist/utilities/parseSearchParams.d.ts +4 -0
- package/dist/utilities/parseSearchParams.d.ts.map +1 -0
- package/dist/utilities/parseSearchParams.js +9 -0
- package/dist/utilities/parseSearchParams.js.map +1 -0
- package/dist/views/Edit/Auth/index.js +47 -47
- package/dist/views/Edit/Auth/index.js.map +1 -1
- package/dist/views/Edit/Auth/types.d.ts +1 -1
- package/dist/views/Edit/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Auth/types.js.map +1 -1
- package/dist/views/Edit/SetDocumentStepNav/index.js +14 -14
- package/dist/views/Edit/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/SetDocumentTitle/index.js +5 -5
- package/dist/views/Edit/SetDocumentTitle/index.js.map +1 -1
- package/dist/views/Edit/index.js +1 -1
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/List/index.js +20 -24
- package/dist/views/List/index.js.map +1 -1
- package/package.json +16 -17
- package/dist/exports/client/CodeEditor-5MCGR4GL.js +0 -26
- package/dist/exports/client/chunk-4SO5UCQD.js +0 -14
- package/dist/exports/client/chunk-4SO5UCQD.js.map +0 -8
- package/dist/exports/client/chunk-5LUHGAPX.js +0 -30
- package/dist/exports/client/chunk-5LUHGAPX.js.map +0 -8
- /package/dist/exports/client/{DatePicker-QST7QHAX.js.map → CodeEditor-RZ32B2QF.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","RenderCustomComponent","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","field","t0","path","permissions","readOnly","schemaPath","schemaPathFromProps","validate","name","admin","t1","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t2","undefined","className","description","isSortable","t3","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t4","localization","drawerSlug","submitted","plural","singular","t5","bb0","fallback","defaultLocale","editingDefaultLocale","t6","value","options","memoizedValidate","t7","hasRows","customComponents","t8","errorPaths","rows","t9","showError","valid","value_0","t10","Description","Error","Label","t11","t12","rowIndex","blockType","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomComponent","Fallback","t21","count","withMessage","_jsxs","join","id","replace","children","onClick","fieldValue","ids","map","_temp","onDragEnd","t22","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","row","blockConfig","find","block","slug","rowPath","rowErrorCount","errorPath","startsWith","disabled","draggableSortableItemProps","errorCount","fields","parentPath","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlocksFieldClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: BlocksFieldClientComponent = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n field: {\n name,\n admin: { className, description, isSortable = true } = {},\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n validate,\n } = props\n const schemaPath = schemaPathFromProps ?? name\n\n const minRows = (minRowsProp ?? required) ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n customComponents: { Description, Error, Label } = {},\n errorPaths,\n rows = [],\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path,\n validate: memoizedValidate,\n })\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n addFieldRow({\n blockType,\n path,\n rowIndex,\n schemaPath,\n })\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = readOnly && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n >\n {showError && (\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockConfig = blocks.find((block) => block.slug === blockType)\n\n if (blockConfig) {\n const rowPath = `${path}.${i}`\n\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(rowPath + '.'),\n ).length\n\n return (\n <DraggableSortableItem disabled={readOnly || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockConfig}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={blockConfig.fields}\n hasMaxRows={hasMaxRows}\n isSortable={isSortable}\n Label={Label}\n labels={labels}\n moveRow={moveRow}\n parentPath={path}\n path={rowPath}\n permissions={permissions}\n readOnly={readOnly}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath + blockConfig.slug}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!hasMaxRows && (\n <Fragment>\n <DrawerToggler\n className={`${baseClass}__drawer-toggler`}\n disabled={readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n disabled={readOnly}\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,Q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CAAca,oBAAA;AAlUgB,SAAAyH,MAAAQ,GAAA;EAAA,OA8NxBA,GAAA,CAAAf,EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","RenderCustomComponent","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","field","t0","path","permissions","readOnly","schemaPath","schemaPathFromProps","validate","name","admin","t1","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t2","undefined","className","description","isSortable","t3","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t4","localization","drawerSlug","submitted","plural","singular","t5","bb0","fallback","defaultLocale","editingDefaultLocale","t6","value","options","memoizedValidate","t7","hasRows","customComponents","t8","errorPaths","rows","t9","showError","valid","value_0","t10","AfterInput","BeforeInput","Description","Error","Label","t11","t12","rowIndex","blockType","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomComponent","Fallback","t21","count","withMessage","_jsxs","join","id","replace","children","onClick","fieldValue","ids","map","_temp","onDragEnd","t22","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","row","blockConfig","find","block","slug","rowPath","rowErrorCount","errorPath","startsWith","disabled","draggableSortableItemProps","errorCount","fields","parentPath","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlocksFieldClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: BlocksFieldClientComponent = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n field: {\n name,\n admin: { className, description, isSortable = true } = {},\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n validate,\n } = props\n const schemaPath = schemaPathFromProps ?? name\n\n const minRows = (minRowsProp ?? required) ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n errorPaths,\n rows = [],\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path,\n validate: memoizedValidate,\n })\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n addFieldRow({\n blockType,\n path,\n rowIndex,\n schemaPath,\n })\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = readOnly && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n >\n {showError && (\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n {BeforeInput}\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockConfig = blocks.find((block) => block.slug === blockType)\n\n if (blockConfig) {\n const rowPath = `${path}.${i}`\n\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(rowPath + '.'),\n ).length\n\n return (\n <DraggableSortableItem disabled={readOnly || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockConfig}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={blockConfig.fields}\n hasMaxRows={hasMaxRows}\n isSortable={isSortable}\n Label={Label}\n labels={labels}\n moveRow={moveRow}\n parentPath={path}\n path={rowPath}\n permissions={permissions}\n readOnly={readOnly}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath + blockConfig.slug}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!hasMaxRows && (\n <Fragment>\n <DrawerToggler\n className={`${baseClass}__drawer-toggler`}\n disabled={readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n disabled={readOnly}\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n {AfterInput}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa,QAAQ;AAC1D,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU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gF,YAAA,IACCM,IAAA,CAAAvI,MAAA;UAAAiJ,QAAA,EACGlH,CAAA,CAAE;YAAAa,KAAA,EAAkChD,cAAA,CAAeiD,MAAA,CAAAwB,MAAA,EAAevC,IAAA;UAAA,CAAM;QAAA,C;;QAOpF,CAAC8F,UAAA,IACAiB,KAAA,CAAA/I,QAAA;MAAAmJ,QAAA,GACEV,IAAA,CAAAnI,aAAA;QAAAkD,SAAA,EACa,GAAA5B,SAAA,kBAA8B;QAAA6I,QAAA,EAC/BnI,QAAA;QAAA8H,IAAA,EACJ/F,UAAA;QAAA8E,QAAA,EAENV,IAAA,CAAAtI,MAAA;UAAA4K,WAAA,EACc;UAAAN,QAAA,EACFnI,QAAA;UAAA0I,EAAA,EACP;UAAAC,IAAA,EACE;UAAAC,YAAA,EACQ;UAAAC,SAAA,EACH;UAAAhC,QAAA,EAETlH,CAAA,CAAE;YAAAa,KAAA,EAA4BhD,cAAA,CAAeiD,MAAA,CAAAyB,QAAA,EAAiBxC,IAAA;UAAA,CAAM;QAAA,C;UAGzEyG,IAAA,CAAA9G,YAAA;QAAA4E,MAAA;QAAA6E,WAAA,EAEe7F,IAAA,EAAAwC,MAAA,KAAgB;QAAAlF,MAAA;QAAAwB,UAAA;QAAAtB;MAAA,C;QAOlC8C,UAAA;EAAA,C;CAGP;AAEA,OAAO,MAAMwF,WAAA,GAAcrK,aAAA,CAAca,oBAAA;AApUgB,SAAA2H,MAAAQ,GAAA;EAAA,OA+NxBA,GAAA,CAAAf,EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;AAwIrB,eAAO,MAAM,gBAAgB;;+EAA2C,CAAA"}
|
|
@@ -54,6 +54,8 @@ const CollapsibleFieldComponent = props => {
|
|
|
54
54
|
const fieldHasErrors = errorCount > 0;
|
|
55
55
|
const {
|
|
56
56
|
customComponents: {
|
|
57
|
+
AfterInput,
|
|
58
|
+
BeforeInput,
|
|
57
59
|
Description,
|
|
58
60
|
Label
|
|
59
61
|
} = {}
|
|
@@ -114,7 +116,7 @@ const CollapsibleFieldComponent = props => {
|
|
|
114
116
|
className: [fieldBaseClass, baseClass, className, fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`].filter(Boolean).join(' '),
|
|
115
117
|
id: `field-${fieldPreferencesKey}`,
|
|
116
118
|
style: styles,
|
|
117
|
-
children: [/*#__PURE__*/_jsx(CollapsibleElement, {
|
|
119
|
+
children: [BeforeInput, /*#__PURE__*/_jsx(CollapsibleElement, {
|
|
118
120
|
className: `${baseClass}__collapsible`,
|
|
119
121
|
collapsibleStyle: fieldHasErrors ? 'error' : 'default',
|
|
120
122
|
header: /*#__PURE__*/_jsxs("div", {
|
|
@@ -140,7 +142,7 @@ const CollapsibleFieldComponent = props => {
|
|
|
140
142
|
permissions: permissions,
|
|
141
143
|
readOnly: readOnly
|
|
142
144
|
})
|
|
143
|
-
}), /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
145
|
+
}), AfterInput, /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
144
146
|
CustomComponent: Description,
|
|
145
147
|
Fallback: /*#__PURE__*/_jsx(FieldDescription, {
|
|
146
148
|
description: description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","Description","Label","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { Description, Label } = {} } = useField({\n path,\n })\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean): Promise<void> => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors fields={fields} path={path.split('.')} setErrorCount={setErrorCount} />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}`}\n style={styles}\n >\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </CollapsibleElement>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAElB,MAAMC,yBAAA,GAA8DC,KAAA;EAClE,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MAAEC,KAAA,EAAO;QA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AA,EAAW,CACTN,cAAA,EACAC,SAAA,EACAK,SAAA,EACAqB,cAAA,GAAiB,GAAG1B,SAAA,aAAsB,GAAG,GAAGA,SAAA,gBAAyB,CAC1E,CACE2C,MAAM,CAACL,OAAA,EACPM,IAAI,CAAC;MACRC,EAAA,EAAI,SAASvB,mBAAA,EAAqB;MAClCwB,KAAA,EAAOP,MAAA;8BAEPE,IAAA,CAACvD,kBAAA;QACCmB,SAAA,EAAW,GAAGL,SAAA,eAAwB;QACtC+C,gBAAA,EAAkBrB,cAAA,GAAiB,UAAU;QAC7CsB,MAAA,eACER,KAAA,CAAC;UAAInC,SAAA,EAAW,GAAGL,SAAA,kBAA2B;kCAC5CyC,IAAA,CAAClD,QAAA;YAAS0D,eAAA,EAAiBpB,KAAA;YAAOpB,KAAA,EAAO/B,cAAA,CAAe+B,KAAA,EAAOO,IAAA;YAAOH,IAAA,EAAMA;cAC3Ea,cAAA,iBAAkBe,IAAA,CAACtD,SAAA;YAAU+D,KAAA,EAAO1B,UAAA;YAAYR,IAAA,EAAMA,IAAA;YAAMmC,WAAW;;;QAG5E5C,aAAA,EAAea,gBAAA;QACfU,QAAA,EAAUA,QAAA;kBAEV,aAAAW,IAAA,CAACnD,YAAA;UACCkB,MAAA,EAAQA,MAAA;UACR4C,OAAA,EAAQ;UACRC,eAAA,EAAiB3C,SAAA;UACjBC,UAAA,EAAYA,UAAA;UACZC,gBAAA,EAAkBA,gBAAA;UAClBE,WAAA,EAAaA,WAAA;UACbC,QAAA,EAAUA;;uBAGd0B,IAAA,CAACrD,qBAAA;QACC6D,eAAA,EAAiBrB,WAAA;QACjB0B,QAAA,eAAUb,IAAA,CAACpD,gBAAA;UAAiBiB,WAAA,EAAaA,WAAA;UAAaO,IAAA,EAAMA;;;;;AAKtE;AAEA,OAAO,MAAM0C,gBAAA,GAAmB7D,aAAA,CAAcO,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","AfterInput","BeforeInput","Description","Label","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {} } = useField({\n path,\n })\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean): Promise<void> => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors fields={fields} path={path.split('.')} setErrorCount={setErrorCount} />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}`}\n style={styles}\n >\n {BeforeInput}\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </CollapsibleElement>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B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BrB,WAAA;QACjB0B,QAAA,eAAUb,IAAA,CAACtD,gBAAA;UAAiBiB,WAAA,EAAaA,WAAA;UAAaO,IAAA,EAAMA;;;;;AAKtE;AAEA,OAAO,MAAM4C,gBAAA,GAAmB/D,aAAA,CAAcO,yBAAA","ignoreList":[]}
|
|
@@ -47,7 +47,7 @@ export const ConfirmPasswordField = props => {
|
|
|
47
47
|
}
|
|
48
48
|
const t4 = t3.join(" ");
|
|
49
49
|
let t5;
|
|
50
|
-
if ($[4] !==
|
|
50
|
+
if ($[4] !== disabled || $[5] !== path || $[6] !== setValue || $[7] !== t || $[8] !== t4 || $[9] !== value_0) {
|
|
51
51
|
t5 = _jsxs("div", {
|
|
52
52
|
className: t4,
|
|
53
53
|
children: [_jsx(FieldLabel, {
|
|
@@ -70,12 +70,12 @@ export const ConfirmPasswordField = props => {
|
|
|
70
70
|
})]
|
|
71
71
|
})]
|
|
72
72
|
});
|
|
73
|
-
$[4] =
|
|
73
|
+
$[4] = disabled;
|
|
74
74
|
$[5] = path;
|
|
75
|
-
$[6] =
|
|
76
|
-
$[7] =
|
|
77
|
-
$[8] =
|
|
78
|
-
$[9] =
|
|
75
|
+
$[6] = setValue;
|
|
76
|
+
$[7] = t;
|
|
77
|
+
$[8] = t4;
|
|
78
|
+
$[9] = value_0;
|
|
79
79
|
$[10] = t5;
|
|
80
80
|
} else {
|
|
81
81
|
t5 = $[10];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","confirmPassword","React","useField","useTranslation","FieldError","FieldLabel","fieldBaseClass","ConfirmPasswordField","props","$","disabled","path","t0","undefined","t","t1","validate","_temp","setValue","showError","value","value_0","t2","t3","filter","Boolean","t4","join","t5","_jsxs","className","children","_jsx","htmlFor","label","required","autoComplete","id","name","onChange","type","options"],"sources":["../../../src/fields/ConfirmPassword/index.tsx"],"sourcesContent":["'use client'\n\nimport { confirmPassword } from 'payload/shared'\nimport React from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type ConfirmPasswordFieldProps = {\n readonly disabled?: boolean\n readonly path?: string\n}\n\nexport const ConfirmPasswordField: React.FC<ConfirmPasswordFieldProps> = (props) => {\n const { disabled, path = 'confirm-password' } = props\n const { t } = useTranslation()\n\n const { setValue, showError, value } = useField({\n path,\n validate: (value, options) => {\n return confirmPassword(value, {\n name: 'confirm-password',\n type: 'text',\n required: true,\n ...options,\n })\n },\n })\n\n return (\n <div\n className={[fieldBaseClass, 'confirm-password', showError && 'error']\n .filter(Boolean)\n .join(' ')}\n >\n <FieldLabel\n htmlFor=\"field-confirm-password\"\n label={t('authentication:confirmPassword')}\n required\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError path={path} />\n <input\n aria-label={t('authentication:confirmPassword')}\n autoComplete=\"off\"\n disabled={!!disabled}\n id=\"field-confirm-password\"\n name=\"confirm-password\"\n onChange={setValue}\n type=\"password\"\n value={(value as string) || ''}\n />\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAOP,OAAO,MAAMC,oBAAA,GAA4DC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACvE;IAAAW,QAAA;IAAAC,IAAA,EAAAC;EAAA,IAAgDJ,KAAA;EAA9B,MAAAG,IAAA,GAAAC,EAAyB,KAAAC,SAAA,GAAlB,kBAAkB,GAAzBD,EAAyB;EAC3C;IAAAE;EAAA,IAAcX,cAAA;EAAA,IAAAY,EAAA;EAAA,IAAAN,CAAA,QAAAE,IAAA;IAEkCI,EAAA;MAAAJ,IAAA;MAAAK,QAAA,EAAAC;IAAA;IAUhDR,CAAA,MAAAE,IAAA;IAAAF,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAVA;IAAAS,QAAA;IAAAC,SAAA;IAAAC,KAAA,EAAAC;EAAA,IAAuCnB,QAAA,CAASa,EAUhD;EAIoD,MAAAO,EAAA,GAAAH,SAAA,IAAa;EAAA,IAAAI,EAAA;EAAA,IAAAd,CAAA,QAAAa,EAAA;IAAlDC,EAAA,IAAAjB,cAAA,EAAiB,oBAAoBgB,EAAa,EAAAE,MAAA,CAAAC,OACnD;IAAAhB,CAAA,MAAAa,EAAA;IAAAb,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EADC,MAAAiB,EAAA,GAAAH,EACD,CAAAI,IAAA,CACF;EAAA,IAAAC,EAAA;EAAA,IAAAnB,CAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","confirmPassword","React","useField","useTranslation","FieldError","FieldLabel","fieldBaseClass","ConfirmPasswordField","props","$","disabled","path","t0","undefined","t","t1","validate","_temp","setValue","showError","value","value_0","t2","t3","filter","Boolean","t4","join","t5","_jsxs","className","children","_jsx","htmlFor","label","required","autoComplete","id","name","onChange","type","options"],"sources":["../../../src/fields/ConfirmPassword/index.tsx"],"sourcesContent":["'use client'\n\nimport { confirmPassword } from 'payload/shared'\nimport React from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type ConfirmPasswordFieldProps = {\n readonly disabled?: boolean\n readonly path?: string\n}\n\nexport const ConfirmPasswordField: React.FC<ConfirmPasswordFieldProps> = (props) => {\n const { disabled, path = 'confirm-password' } = props\n const { t } = useTranslation()\n\n const { setValue, showError, value } = useField({\n path,\n validate: (value, options) => {\n return confirmPassword(value, {\n name: 'confirm-password',\n type: 'text',\n required: true,\n ...options,\n })\n },\n })\n\n return (\n <div\n className={[fieldBaseClass, 'confirm-password', showError && 'error']\n .filter(Boolean)\n .join(' ')}\n >\n <FieldLabel\n htmlFor=\"field-confirm-password\"\n label={t('authentication:confirmPassword')}\n required\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError path={path} />\n <input\n aria-label={t('authentication:confirmPassword')}\n autoComplete=\"off\"\n disabled={!!disabled}\n id=\"field-confirm-password\"\n name=\"confirm-password\"\n onChange={setValue}\n type=\"password\"\n value={(value as string) || ''}\n />\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAOP,OAAO,MAAMC,oBAAA,GAA4DC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACvE;IAAAW,QAAA;IAAAC,IAAA,EAAAC;EAAA,IAAgDJ,KAAA;EAA9B,MAAAG,IAAA,GAAAC,EAAyB,KAAAC,SAAA,GAAlB,kBAAkB,GAAzBD,EAAyB;EAC3C;IAAAE;EAAA,IAAcX,cAAA;EAAA,IAAAY,EAAA;EAAA,IAAAN,CAAA,QAAAE,IAAA;IAEkCI,EAAA;MAAAJ,IAAA;MAAAK,QAAA,EAAAC;IAAA;IAUhDR,CAAA,MAAAE,IAAA;IAAAF,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAVA;IAAAS,QAAA;IAAAC,SAAA;IAAAC,KAAA,EAAAC;EAAA,I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oreList":[]}
|
|
@@ -32,11 +32,11 @@ export const FieldLabel = props => {
|
|
|
32
32
|
} = useForm();
|
|
33
33
|
const editDepth = useEditDepth();
|
|
34
34
|
let t5;
|
|
35
|
-
if ($[0] !==
|
|
35
|
+
if ($[0] !== editDepth || $[1] !== htmlForFromProps || $[2] !== path || $[3] !== uuid) {
|
|
36
36
|
t5 = htmlForFromProps || generateFieldID(path, editDepth, uuid);
|
|
37
|
-
$[0] =
|
|
38
|
-
$[1] =
|
|
39
|
-
$[2] =
|
|
37
|
+
$[0] = editDepth;
|
|
38
|
+
$[1] = htmlForFromProps;
|
|
39
|
+
$[2] = path;
|
|
40
40
|
$[3] = uuid;
|
|
41
41
|
$[4] = t5;
|
|
42
42
|
} else {
|
|
@@ -53,7 +53,7 @@ export const FieldLabel = props => {
|
|
|
53
53
|
if (label) {
|
|
54
54
|
const t6 = `field-label ${unstyled ? "unstyled" : ""}`;
|
|
55
55
|
let t7;
|
|
56
|
-
if ($[5] !==
|
|
56
|
+
if ($[5] !== Element || $[6] !== code || $[7] !== hideLocale || $[8] !== htmlFor || $[9] !== i18n || $[10] !== label || $[11] !== localLabel || $[12] !== localized || $[13] !== required || $[14] !== t6 || $[15] !== unstyled) {
|
|
57
57
|
let t8;
|
|
58
58
|
if ($[17] !== required || $[18] !== unstyled) {
|
|
59
59
|
t8 = required && !unstyled && _jsx("span", {
|
|
@@ -67,15 +67,15 @@ export const FieldLabel = props => {
|
|
|
67
67
|
t8 = $[19];
|
|
68
68
|
}
|
|
69
69
|
let t9;
|
|
70
|
-
if ($[20] !==
|
|
70
|
+
if ($[20] !== code || $[21] !== hideLocale || $[22] !== localLabel || $[23] !== localized) {
|
|
71
71
|
t9 = localized && !hideLocale && _jsxs("span", {
|
|
72
72
|
className: "localized",
|
|
73
73
|
children: ["\u2014 ", typeof localLabel === "string" ? localLabel : code]
|
|
74
74
|
});
|
|
75
|
-
$[20] =
|
|
75
|
+
$[20] = code;
|
|
76
76
|
$[21] = hideLocale;
|
|
77
77
|
$[22] = localLabel;
|
|
78
|
-
$[23] =
|
|
78
|
+
$[23] = localized;
|
|
79
79
|
$[24] = t9;
|
|
80
80
|
} else {
|
|
81
81
|
t9 = $[24];
|
|
@@ -85,17 +85,17 @@ export const FieldLabel = props => {
|
|
|
85
85
|
htmlFor,
|
|
86
86
|
children: [getTranslation(label, i18n), t8, t9]
|
|
87
87
|
});
|
|
88
|
-
$[5] =
|
|
89
|
-
$[6] =
|
|
90
|
-
$[7] =
|
|
91
|
-
$[8] =
|
|
92
|
-
$[9] =
|
|
93
|
-
$[10] =
|
|
88
|
+
$[5] = Element;
|
|
89
|
+
$[6] = code;
|
|
90
|
+
$[7] = hideLocale;
|
|
91
|
+
$[8] = htmlFor;
|
|
92
|
+
$[9] = i18n;
|
|
93
|
+
$[10] = label;
|
|
94
94
|
$[11] = localLabel;
|
|
95
|
-
$[12] =
|
|
96
|
-
$[13] =
|
|
97
|
-
$[14] =
|
|
98
|
-
$[15] =
|
|
95
|
+
$[12] = localized;
|
|
96
|
+
$[13] = required;
|
|
97
|
+
$[14] = t6;
|
|
98
|
+
$[15] = unstyled;
|
|
99
99
|
$[16] = t7;
|
|
100
100
|
} else {
|
|
101
101
|
t7 = $[16];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useForm","useEditDepth","useLocale","useTranslation","generateFieldID","FieldLabel","props","$","as","t0","hideLocale","t1","htmlFor","htmlForFromProps","label","localized","t2","path","required","t3","unstyled","t4","Element","undefined","uuid","editDepth","t5","i18n","code","localLabel","t6","t7","t8","_jsx","className","children","t9","_jsxs"],"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GenericLabelProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nexport const FieldLabel: React.FC<GenericLabelProps> = (props) => {\n const {\n as: Element = 'label',\n hideLocale = false,\n htmlFor: htmlForFromProps,\n label,\n localized = false,\n path,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n const { i18n } = useTranslation()\n const { code, label: localLabel } = useLocale()\n\n if (label) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(label, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n {localized && !hideLocale && (\n <span className=\"localized\">\n — {typeof localLabel === 'string' ? localLabel : code}\n </span>\n )}\n </Element>\n )\n }\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,OAAO,QAAQ;AACxB,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,OAAO;AAEP,OAAO,MAAMC,UAAA,GAA0CC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACrD;IAAAW,EAAA,EAAAC,EAAA;IAAAC,UAAA,EAAAC,EAAA;IAAAC,OAAA,EAAAC,gBAAA;IAAAC,KAAA;IAAAC,SAAA,EAAAC,EAAA;IAAAC,IAAA;IAAAC,QAAA,EAAAC,EAAA;IAAAC,QAAA,EAAAC;EAAA,IASIf,KAAA;EARE,MAAAgB,OAAA,GAAAb,EAAiB,KAAAc,SAAA,GAAP,OAAO,GAAjBd,EAAiB;EACrB,MAAAC,UAAA,GAAAC,EAAkB,KAAAY,SAAA,WAAlBZ,EAAkB;EAGlB,MAAAI,SAAA,GAAAC,EAAiB,KAAAO,SAAA,WAAjBP,EAAiB;EAEjB,MAAAE,QAAA,GAAAC,EAAgB,KAAAI,SAAA,WAAhBJ,EAAgB;EAChB,MAAAC,QAAA,GAAAC,EAAgB,KAAAE,SAAA,WAAhBF,EAAgB;EAGlB;IAAAG;EAAA,IAAiBxB,OAAA;EACjB,MAAAyB,SAAA,GAAkBxB,YAAA;EAAA,IAAAyB,EAAA;EAAA,IAAAnB,CAAA,QAAAM,gBAAA,IAAAN,CAAA,QAAAU,IAAA,IAAAV,CAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useForm","useEditDepth","useLocale","useTranslation","generateFieldID","FieldLabel","props","$","as","t0","hideLocale","t1","htmlFor","htmlForFromProps","label","localized","t2","path","required","t3","unstyled","t4","Element","undefined","uuid","editDepth","t5","i18n","code","localLabel","t6","t7","t8","_jsx","className","children","t9","_jsxs"],"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GenericLabelProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nexport const FieldLabel: React.FC<GenericLabelProps> = (props) => {\n const {\n as: Element = 'label',\n hideLocale = false,\n htmlFor: htmlForFromProps,\n label,\n localized = false,\n path,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n const { i18n } = useTranslation()\n const { code, label: localLabel } = useLocale()\n\n if (label) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(label, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n {localized && !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AI,E;;;;;;;;;;;;;;;;;WAHHL,E;;;CAaN","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAkB,MAAM,OAAO,CAAA;AAetC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAkB,MAAM,OAAO,CAAA;AAetC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,eAAO,MAAM,mBAAmB,EAAE,yBAsFjC,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU;;+EAAqC,CAAA"}
|
|
@@ -50,6 +50,8 @@ export const GroupFieldComponent = props => {
|
|
|
50
50
|
const isWithinTab = useTabs();
|
|
51
51
|
const {
|
|
52
52
|
customComponents: {
|
|
53
|
+
AfterInput,
|
|
54
|
+
BeforeInput,
|
|
53
55
|
Description,
|
|
54
56
|
Label
|
|
55
57
|
} = {},
|
|
@@ -62,11 +64,11 @@ export const GroupFieldComponent = props => {
|
|
|
62
64
|
const fieldHasErrors = submitted && errorCount > 0;
|
|
63
65
|
const isTopLevel = !(isWithinCollapsible || isWithinGroup || isWithinRow);
|
|
64
66
|
const styles = useMemo(() => mergeFieldStyles(field), [field]);
|
|
65
|
-
return /*#__PURE__*/
|
|
67
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
66
68
|
className: [fieldBaseClass, baseClass, isTopLevel && `${baseClass}--top-level`, isWithinCollapsible && `${baseClass}--within-collapsible`, isWithinGroup && `${baseClass}--within-group`, isWithinRow && `${baseClass}--within-row`, isWithinTab && `${baseClass}--within-tab`, !hideGutter && isWithinGroup && `${baseClass}--gutter`, fieldHasErrors && `${baseClass}--has-error`, className].filter(Boolean).join(' '),
|
|
67
69
|
id: `field-${path?.replace(/\./g, '__')}`,
|
|
68
70
|
style: styles,
|
|
69
|
-
children: /*#__PURE__*/_jsx(GroupProvider, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(GroupProvider, {
|
|
70
72
|
children: /*#__PURE__*/_jsxs("div", {
|
|
71
73
|
className: `${baseClass}__wrap`,
|
|
72
74
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
@@ -95,7 +97,7 @@ export const GroupFieldComponent = props => {
|
|
|
95
97
|
i18n: i18n,
|
|
96
98
|
withMessage: true
|
|
97
99
|
})]
|
|
98
|
-
}), /*#__PURE__*/_jsx(RenderFields, {
|
|
100
|
+
}), BeforeInput, /*#__PURE__*/_jsx(RenderFields, {
|
|
99
101
|
fields: fields,
|
|
100
102
|
margins: "small",
|
|
101
103
|
parentIndexPath: "",
|
|
@@ -105,7 +107,7 @@ export const GroupFieldComponent = props => {
|
|
|
105
107
|
readOnly: readOnly
|
|
106
108
|
})]
|
|
107
109
|
})
|
|
108
|
-
})
|
|
110
|
+
}), AfterInput]
|
|
109
111
|
});
|
|
110
112
|
};
|
|
111
113
|
export { GroupProvider, useGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","useMemo","useCollapsible","ErrorPill","RenderCustomComponent","FieldDescription","FieldLabel","useFormSubmitted","RenderFields","useField","withCondition","useTranslation","mergeFieldStyles","useRow","fieldBaseClass","useTabs","GroupProvider","useGroup","baseClass","GroupFieldComponent","props","field","name","admin","className","description","hideGutter","fields","label","path","permissions","readOnly","schemaPath","schemaPathFromProps","i18n","isWithinCollapsible","isWithinGroup","isWithinRow","isWithinTab","customComponents","Description","Label","errorPaths","submitted","errorCount","length","fieldHasErrors","isTopLevel","styles","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","React","useMemo","useCollapsible","ErrorPill","RenderCustomComponent","FieldDescription","FieldLabel","useFormSubmitted","RenderFields","useField","withCondition","useTranslation","mergeFieldStyles","useRow","fieldBaseClass","useTabs","GroupProvider","useGroup","baseClass","GroupFieldComponent","props","field","name","admin","className","description","hideGutter","fields","label","path","permissions","readOnly","schemaPath","schemaPathFromProps","i18n","isWithinCollapsible","isWithinGroup","isWithinRow","isWithinTab","customComponents","AfterInput","BeforeInput","Description","Label","errorPaths","submitted","errorCount","length","fieldHasErrors","isTopLevel","styles","_jsxs","filter","Boolean","join","id","replace","style","_jsx","CustomComponent","Fallback","localized","required","count","withMessage","margins","parentIndexPath","parentPath","parentSchemaPath","GroupField"],"sources":["../../../src/fields/Group/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GroupFieldClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useMemo } from 'react'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useFormSubmitted } from '../../forms/Form/context.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport { useRow } from '../Row/provider.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\nimport { useTabs } from '../Tabs/provider.js'\nimport { GroupProvider, useGroup } from './provider.js'\n\nconst baseClass = 'group-field'\n\nexport const GroupFieldComponent: GroupFieldClientComponent = (props) => {\n const {\n field,\n field: { name, admin: { className, description, hideGutter } = {}, fields, label },\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n } = props\n const schemaPath = schemaPathFromProps ?? name\n\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const isWithinGroup = useGroup()\n const isWithinRow = useRow()\n const isWithinTab = useTabs()\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {}, errorPaths } =\n useField({ path })\n const submitted = useFormSubmitted()\n const errorCount = errorPaths.length\n const fieldHasErrors = submitted && errorCount > 0\n\n const isTopLevel = !(isWithinCollapsible || isWithinGroup || isWithinRow)\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n isTopLevel && `${baseClass}--top-level`,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n isWithinGroup && `${baseClass}--within-group`,\n isWithinRow && `${baseClass}--within-row`,\n isWithinTab && `${baseClass}--within-tab`,\n !hideGutter && isWithinGroup && `${baseClass}--gutter`,\n fieldHasErrors && `${baseClass}--has-error`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n style={styles}\n >\n <GroupProvider>\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__header`}>\n {Boolean(Label || Description || label) && (\n <header>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <h3 className={`${baseClass}__title`}>\n <FieldLabel\n label={getTranslation(label, i18n)}\n localized={false}\n path={path}\n required={false}\n />\n </h3>\n }\n />\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n )}\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {BeforeInput}\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath=\"\"\n parentPath={path}\n parentSchemaPath={schemaPath}\n permissions={permissions === true ? permissions : permissions?.fields}\n readOnly={readOnly}\n />\n </div>\n </GroupProvider>\n {AfterInput}\n </div>\n )\n}\n\nexport { GroupProvider, useGroup }\n\nexport const GroupField = withCondition(GroupFieldComponent)\n"],"mappings":"AAAA;;;AAIA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,OAAO,QAAQ;AAE/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,QAAQ;AACvB,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,OAAO,QAAQ;AACxB,SAASC,aAAa,EAAEC,QAAQ,QAAQ;AAExC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,mBAAA,GAAkDC,KAAA;EAC7D,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MAAEC,IAAI;MAAEC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC;MAAU,CAAE,GAAG,CAAC,CAAC;MAAEC,MAAM;MAAEC;IAAK,CAAE;IAClFC,IAAI;IACJC,WAAW;IACXC,QAAQ;IACRC,UAAA,EAAYC;EAAmB,CAChC,GAAGb,KAAA;EACJ,MAAMY,UAAA,GAAaC,mBAAA,IAAuBX,IAAA;EAE1C,MAAM;IAAEY;EAAI,CAAE,GAAGvB,cAAA;EACjB,MAAM;IAAEwB;EAAmB,CAAE,GAAGjC,cAAA;EAChC,MAAMkC,aAAA,GAAgBnB,QAAA;EACtB,MAAMoB,WAAA,GAAcxB,MAAA;EACpB,MAAMyB,WAAA,GAAcvB,OAAA;EACpB,MAAM;I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CAAC;oCACCO,IAAA,CAACtD,qBAAA;cACCuD,eAAA,EAAiBhB,KAAA;cACjBiB,QAAA,eACEF,IAAA,CAAC;gBAAGlC,SAAA,EAAW,GAAGN,SAAA,SAAkB;0BAClC,aAAAwC,IAAA,CAACpD,UAAA;kBACCsB,KAAA,EAAO7B,cAAA,CAAe6B,KAAA,EAAOM,IAAA;kBAC7B2B,SAAA,EAAW;kBACXhC,IAAA,EAAMA,IAAA;kBACNiC,QAAA,EAAU;;;6BAKlBJ,IAAA,CAACtD,qBAAA;cACCuD,eAAA,EAAiBjB,WAAA;cACjBkB,QAAA,eAAUF,IAAA,CAACrD,gBAAA;gBAAiBoB,WAAA,EAAaA,WAAA;gBAAaI,IAAA,EAAMA;;;cAIjEmB,cAAA,iBAAkBU,IAAA,CAACvD,SAAA;YAAU4D,KAAA,EAAOjB,UAAA;YAAYZ,IAAA,EAAMA,IAAA;YAAM8B,WAAW;;YAEzEvB,WAAA,E,aACDiB,IAAA,CAAClD,YAAA;UACCmB,MAAA,EAAQA,MAAA;UACRsC,OAAA,EAAQ;UACRC,eAAA,EAAgB;UAChBC,UAAA,EAAYtC,IAAA;UACZuC,gBAAA,EAAkBpC,UAAA;UAClBF,WAAA,EAAaA,WAAA,KAAgB,OAAOA,WAAA,GAAcA,WAAA,EAAaH,MAAA;UAC/DI,QAAA,EAAUA;;;QAIfS,UAAA;;AAGP;AAEA,SAASxB,aAAa,EAAEC,QAAQ;AAEhC,OAAO,MAAMoD,UAAA,GAAa3D,aAAA,CAAcS,mBAAA","ignoreList":[]}
|
|
@@ -33,16 +33,16 @@ const HiddenFieldComponent = props => {
|
|
|
33
33
|
} = useField(t1);
|
|
34
34
|
let t2;
|
|
35
35
|
let t3;
|
|
36
|
-
if ($[2] !==
|
|
36
|
+
if ($[2] !== disableModifyingForm || $[3] !== setValue || $[4] !== valueFromProps) {
|
|
37
37
|
t2 = () => {
|
|
38
38
|
if (valueFromProps !== undefined) {
|
|
39
39
|
setValue(valueFromProps, disableModifyingForm);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
t3 = [valueFromProps, setValue, disableModifyingForm];
|
|
43
|
-
$[2] =
|
|
43
|
+
$[2] = disableModifyingForm;
|
|
44
44
|
$[3] = setValue;
|
|
45
|
-
$[4] =
|
|
45
|
+
$[4] = valueFromProps;
|
|
46
46
|
$[5] = t2;
|
|
47
47
|
$[6] = t3;
|
|
48
48
|
} else {
|
|
@@ -53,7 +53,7 @@ const HiddenFieldComponent = props => {
|
|
|
53
53
|
const t4 = `field-${path?.replace(/\./g, "__")}`;
|
|
54
54
|
const t5 = value || "";
|
|
55
55
|
let t6;
|
|
56
|
-
if ($[7] !==
|
|
56
|
+
if ($[7] !== path || $[8] !== setValue || $[9] !== t4 || $[10] !== t5) {
|
|
57
57
|
t6 = _jsx("input", {
|
|
58
58
|
id: t4,
|
|
59
59
|
name: path,
|
|
@@ -61,9 +61,9 @@ const HiddenFieldComponent = props => {
|
|
|
61
61
|
type: "hidden",
|
|
62
62
|
value: t5
|
|
63
63
|
});
|
|
64
|
-
$[7] =
|
|
65
|
-
$[8] =
|
|
66
|
-
$[9] =
|
|
64
|
+
$[7] = path;
|
|
65
|
+
$[8] = setValue;
|
|
66
|
+
$[9] = t4;
|
|
67
67
|
$[10] = t5;
|
|
68
68
|
$[11] = t6;
|
|
69
69
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","useEffect","useField","withCondition","HiddenFieldComponent","props","$","disableModifyingForm","t0","path","value","valueFromProps","undefined","t1","setValue","t2","t3","t4","replace","t5","t6","_jsx","id","name","onChange","type","HiddenField"],"sources":["../../../src/fields/Hidden/index.tsx"],"sourcesContent":["'use client'\n\nimport type { HiddenFieldProps } from 'payload'\n\nimport React, { useEffect } from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\n\n/**\n * This is mainly used to save a value on the form that is not visible to the user.\n * For example, this sets the `ìd` property of a block in the Blocks field.\n */\nconst HiddenFieldComponent: React.FC<HiddenFieldProps> = (props) => {\n const { disableModifyingForm = true, path, value: valueFromProps } = props\n\n const { setValue, value } = useField({\n path,\n })\n\n useEffect(() => {\n if (valueFromProps !== undefined) {\n setValue(valueFromProps, disableModifyingForm)\n }\n }, [valueFromProps, setValue, disableModifyingForm])\n\n return (\n <input\n id={`field-${path?.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n type=\"hidden\"\n value={(value as string) || ''}\n />\n )\n}\n\nexport const HiddenField = withCondition(HiddenFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAEjC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAE9B;;;;AAIA,MAAMC,oBAAA,GAAmDC,KAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EACvD;IAAAQ,oBAAA,EAAAC,EAAA;IAAAC,IAAA;IAAAC,KAAA,EAAAC;EAAA,IAAqEN,KAAA;EAA7D,MAAAE,oBAAA,GAAAC,EAA2B,KAAAI,SAAA,UAA3BJ,EAA2B;EAAA,IAAAK,EAAA;EAAA,IAAAP,CAAA,QAAAG,IAAA;IAEEI,EAAA;MAAAJ;IAAA;IAErCH,CAAA,MAAAG,IAAA;IAAAH,CAAA,MAAAO,EAAA;EAAA;IAAAA,EAAA,GAAAP,CAAA;EAAA;EAFA;IAAAQ,QAAA;IAAAJ;EAAA,IAA4BR,QAAA,CAASW,EAErC;EAAA,IAAAE,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAV,CAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","useEffect","useField","withCondition","HiddenFieldComponent","props","$","disableModifyingForm","t0","path","value","valueFromProps","undefined","t1","setValue","t2","t3","t4","replace","t5","t6","_jsx","id","name","onChange","type","HiddenField"],"sources":["../../../src/fields/Hidden/index.tsx"],"sourcesContent":["'use client'\n\nimport type { HiddenFieldProps } from 'payload'\n\nimport React, { useEffect } from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\n\n/**\n * This is mainly used to save a value on the form that is not visible to the user.\n * For example, this sets the `ìd` property of a block in the Blocks field.\n */\nconst HiddenFieldComponent: React.FC<HiddenFieldProps> = (props) => {\n const { disableModifyingForm = true, path, value: valueFromProps } = props\n\n const { setValue, value } = useField({\n path,\n })\n\n useEffect(() => {\n if (valueFromProps !== undefined) {\n setValue(valueFromProps, disableModifyingForm)\n }\n }, [valueFromProps, setValue, disableModifyingForm])\n\n return (\n <input\n id={`field-${path?.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n type=\"hidden\"\n value={(value as string) || ''}\n />\n )\n}\n\nexport const HiddenField = withCondition(HiddenFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAEjC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAE9B;;;;AAIA,MAAMC,oBAAA,GAAmDC,KAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EACvD;IAAAQ,oBAAA,EAAAC,EAAA;IAAAC,IAAA;IAAAC,KAAA,EAAAC;EAAA,IAAqEN,KAAA;EAA7D,MAAAE,oBAAA,GAAAC,EAA2B,KAAAI,SAAA,UAA3BJ,EAA2B;EAAA,IAAAK,EAAA;EAAA,IAAAP,CAAA,QAAAG,IAAA;IAEEI,EAAA;MAAAJ;IAAA;IAErCH,CAAA,MAAAG,IAAA;IAAAH,CAAA,MAAAO,EAAA;EAAA;IAAAA,EAAA,GAAAP,CAAA;EAAA;EAFA;IAAAQ,QAAA;IAAAJ;EAAA,IAA4BR,QAAA,CAASW,EAErC;EAAA,IAAAE,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAV,CAAA,QAAAC,oBAAA,IAAAD,CAAA,QAAAQ,QAAA,IAAAR,CAAA,QAAAK,cAAA;IAEUI,EAAA,GAAAA,CAAA;MAAA,IACJJ,cAAA,KAAAC,SAAmB;QACrBE,QAAA,CAASH,cAAA,EAAgBJ,oBAAA;MAAA;IAAA;IAE1BS,EAAA,IAACL,cAAA,EAAgBG,QAAA,EAAUP,oBAAA;IAAqBD,CAAA,MAAAC,oBAAA;IAAAD,CAAA,MAAAQ,QAAA;IAAAR,CAAA,MAAAK,cAAA;IAAAL,CAAA,MAAAS,EAAA;IAAAT,CAAA,MAAAU,EAAA;EAAA;IAAAD,EAAA,GAAAT,CAAA;IAAAU,EAAA,GAAAV,CAAA;EAAA;EAJnDL,SAAA,CAAUc,EAIV,EAAGC,EAAgD;EAI3C,MAAAC,EAAA,YAASR,IAAA,EAAAS,OAAA,QAAqB,OAAO;EAIlC,MAAAC,EAAA,GAAAT,KAAC,IAAoB;EAAA,IAAAU,EAAA;EAAA,IAAAd,CAAA,QAAAG,IAAA,IAAAH,CAAA,QAAAQ,QAAA,IAAAR,CAAA,QAAAW,EAAA,IAAAX,CAAA,SAAAa,EAAA;IAL9BC,EAAA,GAAAC,IAAA,CAAC;MAAAC,EAAA,EACKL,EAAqC;MAAAM,IAAA,EACnCd,IAAA;MAAAe,QAAA,EACIV,QAAA;MAAAW,IAAA,EACL;MAAAf,KAAA,EACES;IAAqB,C;;;;;;;;;SAL9BC,E;CAQJ;AAEA,OAAO,MAAMM,WAAA,GAAcvB,aAAA,CAAcC,oBAAA","ignoreList":[]}
|
|
@@ -128,7 +128,7 @@ const NumberFieldComponent = props => {
|
|
|
128
128
|
path: path,
|
|
129
129
|
showError: showError
|
|
130
130
|
})
|
|
131
|
-
}), hasMany ? /*#__PURE__*/_jsx(ReactSelect, {
|
|
131
|
+
}), BeforeInput, hasMany ? /*#__PURE__*/_jsx(ReactSelect, {
|
|
132
132
|
className: `field-${path.replace(/\./g, '__')}`,
|
|
133
133
|
disabled: readOnly,
|
|
134
134
|
filterOption: (_, rawInput) => {
|
|
@@ -155,8 +155,8 @@ const NumberFieldComponent = props => {
|
|
|
155
155
|
placeholder: t('general:enterAValue'),
|
|
156
156
|
showError: showError,
|
|
157
157
|
value: valueToRender
|
|
158
|
-
}) : /*#__PURE__*/
|
|
159
|
-
children:
|
|
158
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
159
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
160
160
|
disabled: readOnly,
|
|
161
161
|
id: `field-${path.replace(/\./g, '__')}`,
|
|
162
162
|
max: max,
|
|
@@ -171,8 +171,8 @@ const NumberFieldComponent = props => {
|
|
|
171
171
|
step: step,
|
|
172
172
|
type: "number",
|
|
173
173
|
value: typeof value_0 === 'number' ? value_0 : ''
|
|
174
|
-
})
|
|
175
|
-
}), /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
174
|
+
})
|
|
175
|
+
}), AfterInput, /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
176
176
|
CustomComponent: Description,
|
|
177
177
|
Fallback: /*#__PURE__*/_jsx(FieldDescription, {
|
|
178
178
|
description: description,
|