@payloadcms/ui 3.0.0-canary.ef0a8d0 → 3.0.0-canary.f1f97ff
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/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +5 -1
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ArrayAction/index.d.ts +1 -1
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +1 -1
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +53 -28
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/Collapsible/index.d.ts +1 -1
- package/dist/elements/Collapsible/index.d.ts.map +1 -1
- package/dist/elements/Collapsible/index.js +1 -1
- package/dist/elements/Collapsible/index.js.map +1 -1
- package/dist/elements/DatePicker/index.scss +3 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +7 -3
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +4 -2
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +5 -1
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +0 -6
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/DocumentFields/index.d.ts +1 -2
- package/dist/elements/DocumentFields/index.d.ts.map +1 -1
- package/dist/elements/DocumentFields/index.js +46 -48
- package/dist/elements/DocumentFields/index.js.map +1 -1
- package/dist/elements/Drawer/index.d.ts.map +1 -1
- package/dist/elements/Drawer/index.js +3 -0
- package/dist/elements/Drawer/index.js.map +1 -1
- package/dist/elements/Drawer/index.scss +2 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +10 -6
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/index.d.ts +1 -2
- package/dist/elements/EditMany/index.d.ts.map +1 -1
- package/dist/elements/EditMany/index.js.map +1 -1
- package/dist/elements/EditUpload/index.d.ts +3 -6
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +20 -25
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/FieldSelect/index.d.ts +1 -2
- package/dist/elements/FieldSelect/index.d.ts.map +1 -1
- package/dist/elements/FieldSelect/index.js.map +1 -1
- package/dist/elements/ListControls/getTextFieldsToBeSearched.d.ts +1 -1
- package/dist/elements/ListControls/getTextFieldsToBeSearched.d.ts.map +1 -1
- package/dist/elements/ListControls/getTextFieldsToBeSearched.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts +1 -2
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +38 -3
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/Localizer/index.d.ts.map +1 -1
- package/dist/elements/Localizer/index.js +6 -13
- package/dist/elements/Localizer/index.js.map +1 -1
- package/dist/elements/Logout/index.d.ts.map +1 -1
- package/dist/elements/Logout/index.js +6 -3
- package/dist/elements/Logout/index.js.map +1 -1
- package/dist/elements/SearchFilter/index.d.ts +5 -3
- package/dist/elements/SearchFilter/index.d.ts.map +1 -1
- package/dist/elements/SearchFilter/index.js +14 -53
- package/dist/elements/SearchFilter/index.js.map +1 -1
- package/dist/elements/SortColumn/index.d.ts +2 -2
- package/dist/elements/SortColumn/index.d.ts.map +1 -1
- package/dist/elements/SortColumn/index.js +4 -4
- package/dist/elements/SortColumn/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +6 -2
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/StepNav/types.d.ts +2 -2
- package/dist/elements/StepNav/types.d.ts.map +1 -1
- package/dist/elements/StepNav/types.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +5 -1
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/Table/index.d.ts +1 -2
- package/dist/elements/Table/index.d.ts.map +1 -1
- package/dist/elements/Table/index.js.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.d.ts +1 -2
- package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
- package/dist/elements/TableColumns/filterFields.d.ts +1 -1
- package/dist/elements/TableColumns/filterFields.d.ts.map +1 -1
- package/dist/elements/TableColumns/filterFields.js.map +1 -1
- package/dist/elements/TableColumns/getInitialColumns.d.ts +1 -1
- package/dist/elements/TableColumns/getInitialColumns.d.ts.map +1 -1
- package/dist/elements/TableColumns/getInitialColumns.js.map +1 -1
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +13 -28
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js +11 -5
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js +4 -2
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +7 -4
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/elements/WhereBuilder/reduceFieldMap.d.ts +1 -1
- package/dist/elements/WhereBuilder/reduceFieldMap.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/reduceFieldMap.js +3 -3
- package/dist/elements/WhereBuilder/reduceFieldMap.js.map +1 -1
- package/dist/elements/WhereBuilder/types.d.ts +1 -2
- package/dist/elements/WhereBuilder/types.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/types.js.map +1 -1
- package/dist/elements/withMergedProps/index.js +8 -2
- package/dist/elements/withMergedProps/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +6 -7
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +19 -18
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/shared/index.d.ts +1 -0
- package/dist/exports/shared/index.d.ts.map +1 -1
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +4 -4
- package/dist/fields/Array/ArrayRow.d.ts +2 -3
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts +2 -15
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +25 -8
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +2 -3
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +5 -1
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.d.ts +2 -3
- package/dist/fields/Blocks/BlocksDrawer/index.d.ts.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts +2 -3
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +1 -1
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts +1 -14
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +22 -9
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +1 -1
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.d.ts +1 -1
- package/dist/fields/Checkbox/index.d.ts.map +1 -1
- package/dist/fields/Checkbox/index.js +2 -2
- package/dist/fields/Checkbox/index.js.map +1 -1
- package/dist/fields/Code/index.d.ts +1 -9
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js +2 -2
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts +1 -7
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js +2 -2
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/DateTime/index.d.ts +1 -9
- package/dist/fields/DateTime/index.d.ts.map +1 -1
- package/dist/fields/DateTime/index.js +2 -2
- package/dist/fields/DateTime/index.js.map +1 -1
- package/dist/fields/Email/index.d.ts +1 -9
- package/dist/fields/Email/index.d.ts.map +1 -1
- package/dist/fields/Email/index.js +2 -2
- package/dist/fields/Email/index.js.map +1 -1
- package/dist/fields/FieldDescription/index.d.ts +2 -2
- package/dist/fields/FieldDescription/index.d.ts.map +1 -1
- package/dist/fields/FieldDescription/index.js.map +1 -1
- package/dist/fields/FieldError/index.d.ts +2 -2
- package/dist/fields/FieldError/index.d.ts.map +1 -1
- package/dist/fields/FieldError/index.js.map +1 -1
- package/dist/fields/FieldLabel/index.d.ts +2 -2
- package/dist/fields/FieldLabel/index.d.ts.map +1 -1
- package/dist/fields/FieldLabel/index.js.map +1 -1
- package/dist/fields/Group/index.d.ts +2 -10
- package/dist/fields/Group/index.d.ts.map +1 -1
- package/dist/fields/Group/index.js +2 -2
- package/dist/fields/Group/index.js.map +1 -1
- package/dist/fields/Hidden/index.d.ts +2 -9
- package/dist/fields/Hidden/index.d.ts.map +1 -1
- package/dist/fields/Hidden/index.js +2 -2
- package/dist/fields/Hidden/index.js.map +1 -1
- package/dist/fields/JSON/index.d.ts +1 -9
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js +2 -2
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/Number/index.d.ts +1 -14
- package/dist/fields/Number/index.d.ts.map +1 -1
- package/dist/fields/Number/index.js +2 -2
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Password/index.d.ts +1 -2
- package/dist/fields/Password/index.d.ts.map +1 -1
- package/dist/fields/Password/index.js +2 -2
- package/dist/fields/Password/index.js.map +1 -1
- package/dist/fields/Point/index.d.ts +2 -9
- package/dist/fields/Point/index.d.ts.map +1 -1
- package/dist/fields/Point/index.js +2 -2
- package/dist/fields/Point/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.d.ts +2 -3
- package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.d.ts +1 -12
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js +2 -2
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/index.d.ts +1 -2
- package/dist/fields/Relationship/index.d.ts.map +1 -1
- package/dist/fields/Relationship/index.js +2 -2
- package/dist/fields/Relationship/index.js.map +1 -1
- package/dist/fields/Relationship/types.d.ts +1 -11
- package/dist/fields/Relationship/types.d.ts.map +1 -1
- package/dist/fields/Relationship/types.js.map +1 -1
- package/dist/fields/RichText/index.d.ts +2 -8
- package/dist/fields/RichText/index.d.ts.map +1 -1
- package/dist/fields/RichText/index.js.map +1 -1
- package/dist/fields/Row/index.d.ts +1 -2
- package/dist/fields/Row/index.d.ts.map +1 -1
- package/dist/fields/Row/index.js +2 -2
- package/dist/fields/Row/index.js.map +1 -1
- package/dist/fields/Row/index.scss +1 -5
- package/dist/fields/Select/Input.d.ts +1 -2
- package/dist/fields/Select/Input.d.ts.map +1 -1
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/fields/Select/index.d.ts +1 -13
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js +2 -2
- package/dist/fields/Select/index.js.map +1 -1
- package/dist/fields/Tabs/Tab/index.d.ts +1 -1
- package/dist/fields/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/fields/Tabs/Tab/index.js.map +1 -1
- package/dist/fields/Tabs/index.d.ts +1 -9
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js +24 -24
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Text/index.d.ts +3 -2
- package/dist/fields/Text/index.d.ts.map +1 -1
- package/dist/fields/Text/index.js +2 -2
- package/dist/fields/Text/index.js.map +1 -1
- package/dist/fields/Text/types.d.ts +1 -15
- package/dist/fields/Text/types.d.ts.map +1 -1
- package/dist/fields/Text/types.js.map +1 -1
- package/dist/fields/Textarea/index.d.ts +3 -2
- package/dist/fields/Textarea/index.d.ts.map +1 -1
- package/dist/fields/Textarea/index.js +2 -2
- package/dist/fields/Textarea/index.js.map +1 -1
- package/dist/fields/Textarea/types.d.ts +1 -11
- package/dist/fields/Textarea/types.d.ts.map +1 -1
- package/dist/fields/Textarea/types.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts +5 -2
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +2 -2
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.d.ts +1 -1
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js +20 -5
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/fields/shared/index.d.ts +1 -25
- package/dist/fields/shared/index.d.ts.map +1 -1
- package/dist/fields/shared/index.js.map +1 -1
- package/dist/forms/Form/createNestedFieldPath.d.ts +1 -2
- package/dist/forms/Form/createNestedFieldPath.d.ts.map +1 -1
- package/dist/forms/Form/createNestedFieldPath.js.map +1 -1
- package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
- package/dist/forms/Form/fieldReducer.js +11 -38
- package/dist/forms/Form/fieldReducer.js.map +1 -1
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +5 -15
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/Form/rowHelpers.d.ts +17 -0
- package/dist/forms/Form/rowHelpers.d.ts.map +1 -0
- package/dist/forms/Form/rowHelpers.js +24 -0
- package/dist/forms/Form/rowHelpers.js.map +1 -0
- package/dist/forms/Form/types.d.ts +3 -10
- package/dist/forms/Form/types.d.ts.map +1 -1
- package/dist/forms/Form/types.js.map +1 -1
- package/dist/forms/RenderFields/RenderField.d.ts +4 -3
- package/dist/forms/RenderFields/RenderField.d.ts.map +1 -1
- package/dist/forms/RenderFields/RenderField.js.map +1 -1
- package/dist/forms/RenderFields/types.d.ts +1 -2
- package/dist/forms/RenderFields/types.d.ts.map +1 -1
- package/dist/forms/RenderFields/types.js.map +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.d.ts +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.js.map +1 -1
- package/dist/forms/WatchChildErrors/index.d.ts +1 -1
- package/dist/forms/WatchChildErrors/index.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/index.js.map +1 -1
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.js +39 -18
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.js.map +1 -1
- package/dist/graphics/Account/index.d.ts.map +1 -1
- package/dist/graphics/Account/index.js +5 -1
- package/dist/graphics/Account/index.js.map +1 -1
- package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
- package/dist/hooks/usePayloadAPI.js +5 -1
- package/dist/hooks/usePayloadAPI.js.map +1 -1
- package/dist/hooks/useUseAsTitle.d.ts +1 -2
- package/dist/hooks/useUseAsTitle.d.ts.map +1 -1
- package/dist/hooks/useUseAsTitle.js.map +1 -1
- package/dist/providers/Auth/index.d.ts +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +47 -76
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts +1 -2
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js +128 -95
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/types.d.ts +1 -55
- package/dist/providers/ComponentMap/buildComponentMap/types.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/types.js.map +1 -1
- package/dist/providers/ComponentMap/index.d.ts +2 -1
- package/dist/providers/ComponentMap/index.d.ts.map +1 -1
- package/dist/providers/ComponentMap/index.js.map +1 -1
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js +58 -16
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/ListQuery/index.d.ts +16 -9
- package/dist/providers/ListQuery/index.d.ts.map +1 -1
- package/dist/providers/ListQuery/index.js +8 -6
- package/dist/providers/ListQuery/index.js.map +1 -1
- package/dist/providers/UploadEdits/index.d.ts +12 -0
- package/dist/providers/UploadEdits/index.d.ts.map +1 -0
- package/dist/providers/UploadEdits/index.js +30 -0
- package/dist/providers/UploadEdits/index.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utilities/buildFormState.d.ts.map +1 -1
- package/dist/utilities/buildFormState.js +3 -2
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/flattenFieldMap.d.ts +1 -1
- package/dist/utilities/flattenFieldMap.d.ts.map +1 -1
- package/dist/utilities/flattenFieldMap.js.map +1 -1
- package/dist/utilities/formatAdminURL.d.ts +8 -0
- package/dist/utilities/formatAdminURL.d.ts.map +1 -0
- package/dist/utilities/formatAdminURL.js +15 -0
- package/dist/utilities/formatAdminURL.js.map +1 -0
- package/package.json +4 -4
- package/dist/fields/Checkbox/types.d.ts +0 -12
- package/dist/fields/Checkbox/types.d.ts.map +0 -1
- package/dist/fields/Checkbox/types.js +0 -3
- package/dist/fields/Checkbox/types.js.map +0 -1
- package/dist/fields/Row/types.d.ts +0 -12
- package/dist/fields/Row/types.d.ts.map +0 -1
- package/dist/fields/Row/types.js +0 -3
- package/dist/fields/Row/types.js.map +0 -1
- package/dist/fields/Upload/types.d.ts +0 -10
- package/dist/fields/Upload/types.d.ts.map +0 -1
- package/dist/fields/Upload/types.js +0 -3
- package/dist/fields/Upload/types.js.map +0 -1
- package/dist/providers/FormQueryParams/index.d.ts +0 -13
- package/dist/providers/FormQueryParams/index.d.ts.map +0 -1
- package/dist/providers/FormQueryParams/index.js +0 -53
- package/dist/providers/FormQueryParams/index.js.map +0 -1
- package/dist/providers/FormQueryParams/types.d.ts +0 -16
- package/dist/providers/FormQueryParams/types.d.ts.map +0 -1
- package/dist/providers/FormQueryParams/types.js +0 -3
- package/dist/providers/FormQueryParams/types.js.map +0 -1
package/dist/forms/Form/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { dequal } from 'dequal/lite'; // lite: no need for Map and Set support
|
|
|
4
4
|
import { useRouter } from 'next/navigation.js';
|
|
5
5
|
import { serialize } from 'object-to-formdata';
|
|
6
6
|
import { getDataByPath as getDataByPathFunc, getSiblingData as getSiblingDataFunc, reduceFieldsToValues, wait } from 'payload/shared';
|
|
7
|
-
import * as qs from 'qs-esm';
|
|
8
7
|
import React, { useCallback, useEffect, useReducer, useRef, useState } from 'react';
|
|
9
8
|
import { toast } from 'sonner';
|
|
10
9
|
import { useDebouncedEffect } from '../../hooks/useDebouncedEffect.js';
|
|
@@ -12,7 +11,6 @@ import { useThrottledEffect } from '../../hooks/useThrottledEffect.js';
|
|
|
12
11
|
import { useAuth } from '../../providers/Auth/index.js';
|
|
13
12
|
import { useConfig } from '../../providers/Config/index.js';
|
|
14
13
|
import { useDocumentInfo } from '../../providers/DocumentInfo/index.js';
|
|
15
|
-
import { useFormQueryParams } from '../../providers/FormQueryParams/index.js';
|
|
16
14
|
import { useLocale } from '../../providers/Locale/index.js';
|
|
17
15
|
import { useOperation } from '../../providers/Operation/index.js';
|
|
18
16
|
import { useTranslation } from '../../providers/Translation/index.js';
|
|
@@ -34,7 +32,6 @@ export const Form = (props)=>{
|
|
|
34
32
|
const { i18n, t } = useTranslation();
|
|
35
33
|
const { refreshCookie, user } = useAuth();
|
|
36
34
|
const operation = useOperation();
|
|
37
|
-
const { formQueryParams } = useFormQueryParams();
|
|
38
35
|
const config = useConfig();
|
|
39
36
|
const { routes: { api: apiRoute }, serverURL } = config;
|
|
40
37
|
const [disabled, setDisabled] = useState(disabledFromProps || false);
|
|
@@ -105,7 +102,7 @@ export const Form = (props)=>{
|
|
|
105
102
|
config
|
|
106
103
|
]);
|
|
107
104
|
const submit = useCallback(async (options = {}, e)=>{
|
|
108
|
-
const { action: actionArg, method: methodToUse = method, overrides = {}, skipValidation } = options;
|
|
105
|
+
const { action: actionArg = action, method: methodToUse = method, overrides = {}, skipValidation } = options;
|
|
109
106
|
if (disabled) {
|
|
110
107
|
if (e) {
|
|
111
108
|
e.preventDefault();
|
|
@@ -191,11 +188,8 @@ export const Form = (props)=>{
|
|
|
191
188
|
const formData = contextRef.current.createFormData(overrides);
|
|
192
189
|
try {
|
|
193
190
|
let res;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
})}` : null);
|
|
197
|
-
if (actionEndpoint) {
|
|
198
|
-
res = await requests[methodToUse.toLowerCase()](actionEndpoint, {
|
|
191
|
+
if (typeof actionArg === 'string') {
|
|
192
|
+
res = await requests[methodToUse.toLowerCase()](actionArg, {
|
|
199
193
|
body: formData,
|
|
200
194
|
headers: {
|
|
201
195
|
'Accept-Language': i18n.language
|
|
@@ -300,8 +294,7 @@ export const Form = (props)=>{
|
|
|
300
294
|
router,
|
|
301
295
|
t,
|
|
302
296
|
i18n,
|
|
303
|
-
waitForAutocomplete
|
|
304
|
-
formQueryParams
|
|
297
|
+
waitForAutocomplete
|
|
305
298
|
]);
|
|
306
299
|
const getFields = useCallback(()=>contextRef.current.fields, []);
|
|
307
300
|
const getField = useCallback((path)=>contextRef.current.fields[path], []);
|
|
@@ -534,11 +527,8 @@ export const Form = (props)=>{
|
|
|
534
527
|
onChange,
|
|
535
528
|
modified
|
|
536
529
|
]);
|
|
537
|
-
const actionString = typeof action === 'string' ? `${action}${qs.stringify(formQueryParams, {
|
|
538
|
-
addQueryPrefix: true
|
|
539
|
-
})}` : '';
|
|
540
530
|
return /*#__PURE__*/ _jsx("form", {
|
|
541
|
-
action:
|
|
531
|
+
action: action,
|
|
542
532
|
className: classes,
|
|
543
533
|
method: method,
|
|
544
534
|
noValidate: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/Form/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\nimport { useRouter } from 'next/navigation.js'\nimport { serialize } from 'object-to-formdata'\nimport {\n getDataByPath as getDataByPathFunc,\n getSiblingData as getSiblingDataFunc,\n reduceFieldsToValues,\n wait,\n} from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type {\n Context as FormContextType,\n FormProps,\n GetDataByPath,\n SubmitOptions,\n} from './types.js'\n\nimport { useDebouncedEffect } from '../../hooks/useDebouncedEffect.js'\nimport { useThrottledEffect } from '../../hooks/useThrottledEffect.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useFormQueryParams } from '../../providers/FormQueryParams/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { getFormState } from '../../utilities/getFormState.js'\nimport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n InitializingContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n} from './context.js'\nimport { errorMessages } from './errorMessages.js'\nimport { fieldReducer } from './fieldReducer.js'\nimport { initContextState } from './initContextState.js'\nimport { mergeServerFormState } from './mergeServerFormState.js'\n\nconst baseClass = 'form'\n\nexport const Form: React.FC<FormProps> = (props) => {\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n\n const {\n action,\n beforeSubmit,\n children,\n className,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled: disabledFromProps,\n // fields: fieldsFromProps = collection?.fields || global?.fields,\n handleResponse,\n initialState, // fully formed initial field state\n isInitializing: initializingFromProps,\n onChange,\n onSubmit,\n onSuccess,\n redirect,\n submitted: submittedFromProps,\n uuid,\n waitForAutocomplete,\n } = props\n\n const method = 'method' in props ? props?.method : undefined\n\n const router = useRouter()\n\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { refreshCookie, user } = useAuth()\n const operation = useOperation()\n const { formQueryParams } = useFormQueryParams()\n\n const config = useConfig()\n const {\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const [disabled, setDisabled] = useState(disabledFromProps || false)\n const [isMounted, setIsMounted] = useState(false)\n const [modified, setModified] = useState(false)\n const [initializing, setInitializing] = useState(initializingFromProps)\n const [processing, setProcessing] = useState(false)\n const [submitted, setSubmitted] = useState(false)\n const formRef = useRef<HTMLFormElement>(null)\n const contextRef = useRef({} as FormContextType)\n\n const fieldsReducer = useReducer(fieldReducer, {}, () => initialState)\n\n /**\n * `fields` is the current, up-to-date state/data of all fields in the form. It can be modified by using dispatchFields,\n * which calls the fieldReducer, which then updates the state.\n */\n const [fields, dispatchFields] = fieldsReducer\n\n contextRef.current.fields = fields\n\n const validateForm = useCallback(async () => {\n const validatedFieldState = {}\n let isValid = true\n\n const dataFromContext = contextRef.current.getData()\n const data = dataFromContext\n\n const validationPromises = Object.entries(contextRef.current.fields).map(\n async ([path, field]) => {\n const validatedField = field\n\n if (field.passesCondition !== false) {\n let validationResult: boolean | string = validatedField.valid\n\n if (typeof field.validate === 'function') {\n let valueToValidate = field.value\n\n if (field?.rows && Array.isArray(field.rows)) {\n valueToValidate = contextRef.current.getDataByPath(path)\n }\n\n validationResult = await field.validate(valueToValidate, {\n id,\n config,\n data,\n operation,\n siblingData: contextRef.current.getSiblingData(path),\n t,\n user,\n })\n\n if (typeof validationResult === 'string') {\n validatedField.errorMessage = validationResult\n validatedField.valid = false\n } else {\n validatedField.valid = true\n validatedField.errorMessage = undefined\n }\n }\n\n if (validatedField.valid === false) {\n isValid = false\n }\n }\n\n validatedFieldState[path] = validatedField\n },\n )\n\n await Promise.all(validationPromises)\n\n if (!dequal(contextRef.current.fields, validatedFieldState)) {\n dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState })\n }\n\n return isValid\n }, [id, user, operation, t, dispatchFields, config])\n\n const submit = useCallback(\n async (options: SubmitOptions = {}, e): Promise<void> => {\n const {\n action: actionArg,\n method: methodToUse = method,\n overrides = {},\n skipValidation,\n } = options\n\n if (disabled) {\n if (e) {\n e.preventDefault()\n }\n return\n }\n\n // create new toast promise which will resolve manually later\n let successToast, errorToast\n const promise = new Promise((resolve, reject) => {\n successToast = resolve\n errorToast = reject\n })\n\n const hasFormSubmitAction =\n actionArg || typeof action === 'string' || typeof action === 'function'\n\n if (redirect || disableSuccessStatus || !hasFormSubmitAction) {\n // Do not show submitting toast, as the promise toast may never disappear under these conditions.\n // Instead, make successToast() or errorToast() throw toast.success / toast.error\n successToast = (data) => toast.success(data)\n errorToast = (data) => toast.error(data)\n } else {\n toast.promise(promise, {\n error: (data) => {\n return data as string\n },\n loading: t('general:submitting'),\n success: (data) => {\n return data as string\n },\n })\n }\n\n if (e) {\n e.stopPropagation()\n e.preventDefault()\n }\n\n setProcessing(true)\n setDisabled(true)\n\n if (waitForAutocomplete) await wait(100)\n\n // Execute server side validations\n if (Array.isArray(beforeSubmit)) {\n let revalidatedFormState: FormState\n\n await beforeSubmit.reduce(async (priorOnChange, beforeSubmitFn) => {\n await priorOnChange\n\n const result = await beforeSubmitFn({\n formState: fields,\n })\n\n revalidatedFormState = result\n }, Promise.resolve())\n\n const isValid = Object.entries(revalidatedFormState).every(([, field]) => field.valid)\n\n if (!isValid) {\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return dispatchFields({ type: 'REPLACE_STATE', state: revalidatedFormState })\n }\n }\n\n const isValid =\n skipValidation || disableValidationOnSubmit ? true : await contextRef.current.validateForm()\n\n // If not valid, prevent submission\n if (!isValid) {\n errorToast(t('error:correctInvalidFields'))\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n // If submit handler comes through via props, run that\n if (onSubmit) {\n const data = {\n ...reduceFieldsToValues(fields, true),\n ...overrides,\n }\n\n onSubmit(fields, data)\n }\n\n if (!hasFormSubmitAction) {\n // No action provided, so we should return. An example where this happens are lexical link drawers. Upon submitting the drawer, we\n // want to close it without submitting the form. Stuff like validation would be handled by lexical before this, through beforeSubmit\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n const formData = contextRef.current.createFormData(overrides)\n\n try {\n let res\n const actionEndpoint =\n actionArg ||\n (typeof action === 'string'\n ? `${action}${qs.stringify(formQueryParams, { addQueryPrefix: true })}`\n : null)\n\n if (actionEndpoint) {\n res = await requests[methodToUse.toLowerCase()](actionEndpoint, {\n body: formData,\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n } else if (typeof action === 'function') {\n res = await action(formData)\n }\n\n setModified(false)\n setDisabled(false)\n\n if (typeof handleResponse === 'function') {\n handleResponse(res, successToast, errorToast)\n return\n }\n\n const contentType = res.headers.get('content-type')\n const isJSON = contentType && contentType.indexOf('application/json') !== -1\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let json: Record<string, any> = {}\n\n if (isJSON) json = await res.json()\n if (res.status < 400) {\n if (typeof onSuccess === 'function') await onSuccess(json)\n setSubmitted(false)\n setProcessing(false)\n\n if (redirect) {\n router.push(redirect)\n } else if (!disableSuccessStatus) {\n successToast(json.message || t('general:submissionSuccessful'))\n }\n } else {\n setProcessing(false)\n setSubmitted(true)\n\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n if (json.message) {\n errorToast(json.message)\n\n return\n }\n\n if (Array.isArray(json.errors)) {\n const [fieldErrors, nonFieldErrors] = json.errors.reduce(\n ([fieldErrs, nonFieldErrs], err) => {\n const newFieldErrs = []\n const newNonFieldErrs = []\n\n if (err?.message) {\n newNonFieldErrs.push(err)\n }\n\n if (Array.isArray(err?.data?.errors)) {\n err.data?.errors.forEach((dataError) => {\n if (dataError?.field) {\n newFieldErrs.push(dataError)\n } else {\n newNonFieldErrs.push(dataError)\n }\n })\n }\n\n return [\n [...fieldErrs, ...newFieldErrs],\n [...nonFieldErrs, ...newNonFieldErrs],\n ]\n },\n [[], []],\n )\n\n dispatchFields({\n type: 'ADD_SERVER_ERRORS',\n errors: fieldErrors,\n })\n\n nonFieldErrors.forEach((err) => {\n errorToast(err.message || t('error:unknown'))\n })\n\n return\n }\n\n const message = errorMessages?.[res.status] || res?.statusText || t('error:unknown')\n\n errorToast(message)\n }\n } catch (err) {\n console.error('Error submitting form', err)\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n\n errorToast(err.message)\n }\n },\n [\n beforeSubmit,\n action,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled,\n dispatchFields,\n fields,\n handleResponse,\n method,\n onSubmit,\n onSuccess,\n redirect,\n router,\n t,\n i18n,\n waitForAutocomplete,\n formQueryParams,\n ],\n )\n\n const getFields = useCallback(() => contextRef.current.fields, [])\n\n const getField = useCallback((path: string) => contextRef.current.fields[path], [])\n\n const getData = useCallback(() => reduceFieldsToValues(contextRef.current.fields, true), [])\n\n const getSiblingData = useCallback(\n (path: string) => getSiblingDataFunc(contextRef.current.fields, path),\n [],\n )\n const getDataByPath = useCallback<GetDataByPath>(\n (path: string) => getDataByPathFunc(contextRef.current.fields, path),\n [],\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const createFormData = useCallback((overrides: any = {}) => {\n const data = reduceFieldsToValues(contextRef.current.fields, true)\n\n const file = data?.file\n\n if (file) {\n delete data.file\n }\n\n const dataWithOverrides = {\n ...data,\n ...overrides,\n }\n\n const dataToSerialize = {\n _payload: JSON.stringify(dataWithOverrides),\n file,\n }\n\n // nullAsUndefineds is important to allow uploads and relationship fields to clear themselves\n const formData = serialize(dataToSerialize, { indices: true, nullsAsUndefineds: false })\n\n return formData\n }, [])\n\n const reset = useCallback(\n async (data: unknown) => {\n const newState = await getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n data,\n globalSlug,\n operation,\n schemaPath: collectionSlug || globalSlug,\n },\n serverURL,\n })\n\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state: newState })\n },\n [apiRoute, collectionSlug, dispatchFields, globalSlug, id, operation, serverURL],\n )\n\n const replaceState = useCallback(\n (state: FormState) => {\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state })\n },\n [dispatchFields],\n )\n\n const getFieldStateBySchemaPath = useCallback(\n async ({ data, schemaPath }) => {\n const fieldSchema = await getFormState({\n apiRoute,\n body: {\n collectionSlug,\n data,\n globalSlug,\n schemaPath,\n },\n serverURL,\n })\n return fieldSchema\n },\n [apiRoute, collectionSlug, globalSlug, serverURL],\n )\n\n const addFieldRow: FormContextType['addFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'ADD_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n const removeFieldRow: FormContextType['removeFieldRow'] = useCallback(\n ({ path, rowIndex }) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n },\n [dispatchFields],\n )\n\n const replaceFieldRow: FormContextType['replaceFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'REPLACE_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n useEffect(() => {\n if (initializingFromProps !== undefined) {\n setInitializing(initializingFromProps)\n }\n }, [initializingFromProps])\n\n contextRef.current.submit = submit\n contextRef.current.getFields = getFields\n contextRef.current.getField = getField\n contextRef.current.getData = getData\n contextRef.current.getSiblingData = getSiblingData\n contextRef.current.getDataByPath = getDataByPath\n contextRef.current.validateForm = validateForm\n contextRef.current.createFormData = createFormData\n contextRef.current.setModified = setModified\n contextRef.current.setProcessing = setProcessing\n contextRef.current.setSubmitted = setSubmitted\n contextRef.current.disabled = disabled\n contextRef.current.setDisabled = setDisabled\n contextRef.current.formRef = formRef\n contextRef.current.reset = reset\n contextRef.current.replaceState = replaceState\n contextRef.current.dispatchFields = dispatchFields\n contextRef.current.addFieldRow = addFieldRow\n contextRef.current.removeFieldRow = removeFieldRow\n contextRef.current.replaceFieldRow = replaceFieldRow\n contextRef.current.uuid = uuid\n contextRef.current.initializing = initializing\n\n useEffect(() => {\n setIsMounted(true)\n }, [])\n\n useEffect(() => {\n if (typeof disabledFromProps === 'boolean') setDisabled(disabledFromProps)\n }, [disabledFromProps])\n\n useEffect(() => {\n if (typeof submittedFromProps === 'boolean') setSubmitted(submittedFromProps)\n }, [submittedFromProps])\n\n useEffect(() => {\n if (initialState) {\n contextRef.current = { ...initContextState } as FormContextType\n dispatchFields({ type: 'REPLACE_STATE', optimize: false, state: initialState })\n }\n }, [initialState, dispatchFields])\n\n useThrottledEffect(\n () => {\n refreshCookie()\n },\n 15000,\n [fields],\n )\n\n useEffect(() => {\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n setModified(false)\n }, [locale])\n\n const classes = [className, baseClass].filter(Boolean).join(' ')\n\n useDebouncedEffect(\n () => {\n const executeOnChange = async () => {\n if (Array.isArray(onChange)) {\n let revalidatedFormState: FormState = contextRef.current.fields\n\n for (const onChangeFn of onChange) {\n revalidatedFormState = await onChangeFn({\n formState: revalidatedFormState,\n })\n }\n\n const { changed, newState } = mergeServerFormState(\n contextRef.current.fields || {},\n revalidatedFormState,\n )\n\n if (changed) {\n dispatchFields({\n type: 'REPLACE_STATE',\n optimize: false,\n state: newState,\n })\n }\n }\n }\n\n if (modified) void executeOnChange()\n },\n 150,\n // Make sure we trigger this whenever modified changes (not just when `fields` changes), otherwise we will miss merging server form state for the first form update/onChange. Here's why:\n // `fields` updates before `modified`, because setModified is in a setTimeout. So on the first change, modified is false, so we don't trigger the effect even though we should.\n [contextRef.current.fields, dispatchFields, onChange, modified],\n )\n\n const actionString =\n typeof action === 'string'\n ? `${action}${qs.stringify(formQueryParams, { addQueryPrefix: true })}`\n : ''\n\n return (\n <form\n action={method ? actionString : (action as string)}\n className={classes}\n method={method}\n noValidate\n onSubmit={(e) => contextRef.current.submit({}, e)}\n ref={formRef}\n >\n <FormContext.Provider value={contextRef.current}>\n <FormWatchContext.Provider\n value={{\n fields,\n ...contextRef.current,\n }}\n >\n <SubmittedContext.Provider value={submitted}>\n <InitializingContext.Provider value={!isMounted || (isMounted && initializing)}>\n <ProcessingContext.Provider value={processing}>\n <ModifiedContext.Provider value={modified}>\n <FormFieldsContext.Provider value={fieldsReducer}>\n {children}\n </FormFieldsContext.Provider>\n </ModifiedContext.Provider>\n </ProcessingContext.Provider>\n </InitializingContext.Provider>\n </SubmittedContext.Provider>\n </FormWatchContext.Provider>\n </FormContext.Provider>\n </form>\n )\n}\n\nexport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n useAllFormFields,\n useForm,\n useFormFields,\n useFormModified,\n useFormProcessing,\n useFormSubmitted,\n useWatchForm,\n} from './context.js'\n\nexport { FormProps }\n"],"names":["dequal","useRouter","serialize","getDataByPath","getDataByPathFunc","getSiblingData","getSiblingDataFunc","reduceFieldsToValues","wait","qs","React","useCallback","useEffect","useReducer","useRef","useState","toast","useDebouncedEffect","useThrottledEffect","useAuth","useConfig","useDocumentInfo","useFormQueryParams","useLocale","useOperation","useTranslation","requests","getFormState","FormContext","FormFieldsContext","FormWatchContext","InitializingContext","ModifiedContext","ProcessingContext","SubmittedContext","errorMessages","fieldReducer","initContextState","mergeServerFormState","baseClass","Form","props","id","collectionSlug","globalSlug","action","beforeSubmit","children","className","disableSuccessStatus","disableValidationOnSubmit","disabled","disabledFromProps","handleResponse","initialState","isInitializing","initializingFromProps","onChange","onSubmit","onSuccess","redirect","submitted","submittedFromProps","uuid","waitForAutocomplete","method","undefined","router","code","locale","i18n","t","refreshCookie","user","operation","formQueryParams","config","routes","api","apiRoute","serverURL","setDisabled","isMounted","setIsMounted","modified","setModified","initializing","setInitializing","processing","setProcessing","setSubmitted","formRef","contextRef","fieldsReducer","fields","dispatchFields","current","validateForm","validatedFieldState","isValid","dataFromContext","getData","data","validationPromises","Object","entries","map","path","field","validatedField","passesCondition","validationResult","valid","validate","valueToValidate","value","rows","Array","isArray","siblingData","errorMessage","Promise","all","type","state","submit","options","e","actionArg","methodToUse","overrides","skipValidation","preventDefault","successToast","errorToast","promise","resolve","reject","hasFormSubmitAction","success","error","loading","stopPropagation","revalidatedFormState","reduce","priorOnChange","beforeSubmitFn","result","formState","every","formData","createFormData","res","actionEndpoint","stringify","addQueryPrefix","toLowerCase","body","headers","language","contentType","get","isJSON","indexOf","json","status","push","message","errors","fieldErrors","nonFieldErrors","fieldErrs","nonFieldErrs","err","newFieldErrs","newNonFieldErrs","forEach","dataError","statusText","console","getFields","getField","file","dataWithOverrides","dataToSerialize","_payload","JSON","indices","nullsAsUndefineds","reset","newState","schemaPath","replaceState","getFieldStateBySchemaPath","fieldSchema","addFieldRow","rowIndex","subFieldState","blockType","removeFieldRow","replaceFieldRow","optimize","classes","filter","Boolean","join","executeOnChange","onChangeFn","changed","actionString","form","noValidate","ref","Provider","useAllFormFields","useForm","useFormFields","useFormModified","useFormProcessing","useFormSubmitted","useWatchForm"],"mappings":"AAAA;;AAGA,SAASA,MAAM,QAAQ,cAAa,CAAC,wCAAwC;AAC7E,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SACEC,iBAAiBC,iBAAiB,EAClCC,kBAAkBC,kBAAkB,EACpCC,oBAAoB,EACpBC,IAAI,QACC,iBAAgB;AACvB,YAAYC,QAAQ,SAAQ;AAC5B,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AACnF,SAASC,KAAK,QAAQ,SAAQ;AAS9B,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,OAAO,QAAQ,gCAA+B;AACvD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,SACEC,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,QACX,eAAc;AACrB,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,YAAY,QAAQ,oB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D,kBAAkBoL,QAAQ;4BAAClG,OAAO3B;sCACjC,cAAA,KAACxD,gBAAgBqL,QAAQ;gCAAClG,OAAO/B;0CAC/B,cAAA,KAACvD,kBAAkBwL,QAAQ;oCAAClG,OAAOtB;8CAChC9C;;;;;;;;;AAUrB,EAAC;AAED,SACEnB,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,EAChBE,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBoL,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBC,YAAY,QACP,eAAc"}
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/Form/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\nimport { useRouter } from 'next/navigation.js'\nimport { serialize } from 'object-to-formdata'\nimport {\n getDataByPath as getDataByPathFunc,\n getSiblingData as getSiblingDataFunc,\n reduceFieldsToValues,\n wait,\n} from 'payload/shared'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type {\n Context as FormContextType,\n FormProps,\n GetDataByPath,\n SubmitOptions,\n} from './types.js'\n\nimport { useDebouncedEffect } from '../../hooks/useDebouncedEffect.js'\nimport { useThrottledEffect } from '../../hooks/useThrottledEffect.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { getFormState } from '../../utilities/getFormState.js'\nimport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n InitializingContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n} from './context.js'\nimport { errorMessages } from './errorMessages.js'\nimport { fieldReducer } from './fieldReducer.js'\nimport { initContextState } from './initContextState.js'\nimport { mergeServerFormState } from './mergeServerFormState.js'\n\nconst baseClass = 'form'\n\nexport const Form: React.FC<FormProps> = (props) => {\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n\n const {\n action,\n beforeSubmit,\n children,\n className,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled: disabledFromProps,\n // fields: fieldsFromProps = collection?.fields || global?.fields,\n handleResponse,\n initialState, // fully formed initial field state\n isInitializing: initializingFromProps,\n onChange,\n onSubmit,\n onSuccess,\n redirect,\n submitted: submittedFromProps,\n uuid,\n waitForAutocomplete,\n } = props\n\n const method = 'method' in props ? props?.method : undefined\n\n const router = useRouter()\n\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { refreshCookie, user } = useAuth()\n const operation = useOperation()\n\n const config = useConfig()\n const {\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const [disabled, setDisabled] = useState(disabledFromProps || false)\n const [isMounted, setIsMounted] = useState(false)\n const [modified, setModified] = useState(false)\n const [initializing, setInitializing] = useState(initializingFromProps)\n const [processing, setProcessing] = useState(false)\n const [submitted, setSubmitted] = useState(false)\n const formRef = useRef<HTMLFormElement>(null)\n const contextRef = useRef({} as FormContextType)\n\n const fieldsReducer = useReducer(fieldReducer, {}, () => initialState)\n\n /**\n * `fields` is the current, up-to-date state/data of all fields in the form. It can be modified by using dispatchFields,\n * which calls the fieldReducer, which then updates the state.\n */\n const [fields, dispatchFields] = fieldsReducer\n\n contextRef.current.fields = fields\n\n const validateForm = useCallback(async () => {\n const validatedFieldState = {}\n let isValid = true\n\n const dataFromContext = contextRef.current.getData()\n const data = dataFromContext\n\n const validationPromises = Object.entries(contextRef.current.fields).map(\n async ([path, field]) => {\n const validatedField = field\n\n if (field.passesCondition !== false) {\n let validationResult: boolean | string = validatedField.valid\n\n if (typeof field.validate === 'function') {\n let valueToValidate = field.value\n\n if (field?.rows && Array.isArray(field.rows)) {\n valueToValidate = contextRef.current.getDataByPath(path)\n }\n\n validationResult = await field.validate(valueToValidate, {\n id,\n config,\n data,\n operation,\n siblingData: contextRef.current.getSiblingData(path),\n t,\n user,\n })\n\n if (typeof validationResult === 'string') {\n validatedField.errorMessage = validationResult\n validatedField.valid = false\n } else {\n validatedField.valid = true\n validatedField.errorMessage = undefined\n }\n }\n\n if (validatedField.valid === false) {\n isValid = false\n }\n }\n\n validatedFieldState[path] = validatedField\n },\n )\n\n await Promise.all(validationPromises)\n\n if (!dequal(contextRef.current.fields, validatedFieldState)) {\n dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState })\n }\n\n return isValid\n }, [id, user, operation, t, dispatchFields, config])\n\n const submit = useCallback(\n async (options: SubmitOptions = {}, e): Promise<void> => {\n const {\n action: actionArg = action,\n method: methodToUse = method,\n overrides = {},\n skipValidation,\n } = options\n\n if (disabled) {\n if (e) {\n e.preventDefault()\n }\n return\n }\n\n // create new toast promise which will resolve manually later\n let successToast, errorToast\n const promise = new Promise((resolve, reject) => {\n successToast = resolve\n errorToast = reject\n })\n\n const hasFormSubmitAction =\n actionArg || typeof action === 'string' || typeof action === 'function'\n\n if (redirect || disableSuccessStatus || !hasFormSubmitAction) {\n // Do not show submitting toast, as the promise toast may never disappear under these conditions.\n // Instead, make successToast() or errorToast() throw toast.success / toast.error\n successToast = (data) => toast.success(data)\n errorToast = (data) => toast.error(data)\n } else {\n toast.promise(promise, {\n error: (data) => {\n return data as string\n },\n loading: t('general:submitting'),\n success: (data) => {\n return data as string\n },\n })\n }\n\n if (e) {\n e.stopPropagation()\n e.preventDefault()\n }\n\n setProcessing(true)\n setDisabled(true)\n\n if (waitForAutocomplete) await wait(100)\n\n // Execute server side validations\n if (Array.isArray(beforeSubmit)) {\n let revalidatedFormState: FormState\n\n await beforeSubmit.reduce(async (priorOnChange, beforeSubmitFn) => {\n await priorOnChange\n\n const result = await beforeSubmitFn({\n formState: fields,\n })\n\n revalidatedFormState = result\n }, Promise.resolve())\n\n const isValid = Object.entries(revalidatedFormState).every(([, field]) => field.valid)\n\n if (!isValid) {\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return dispatchFields({ type: 'REPLACE_STATE', state: revalidatedFormState })\n }\n }\n\n const isValid =\n skipValidation || disableValidationOnSubmit ? true : await contextRef.current.validateForm()\n\n // If not valid, prevent submission\n if (!isValid) {\n errorToast(t('error:correctInvalidFields'))\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n // If submit handler comes through via props, run that\n if (onSubmit) {\n const data = {\n ...reduceFieldsToValues(fields, true),\n ...overrides,\n }\n\n onSubmit(fields, data)\n }\n\n if (!hasFormSubmitAction) {\n // No action provided, so we should return. An example where this happens are lexical link drawers. Upon submitting the drawer, we\n // want to close it without submitting the form. Stuff like validation would be handled by lexical before this, through beforeSubmit\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n const formData = contextRef.current.createFormData(overrides)\n\n try {\n let res\n\n if (typeof actionArg === 'string') {\n res = await requests[methodToUse.toLowerCase()](actionArg, {\n body: formData,\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n } else if (typeof action === 'function') {\n res = await action(formData)\n }\n\n setModified(false)\n setDisabled(false)\n\n if (typeof handleResponse === 'function') {\n handleResponse(res, successToast, errorToast)\n return\n }\n\n const contentType = res.headers.get('content-type')\n const isJSON = contentType && contentType.indexOf('application/json') !== -1\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let json: Record<string, any> = {}\n\n if (isJSON) json = await res.json()\n if (res.status < 400) {\n if (typeof onSuccess === 'function') await onSuccess(json)\n setSubmitted(false)\n setProcessing(false)\n\n if (redirect) {\n router.push(redirect)\n } else if (!disableSuccessStatus) {\n successToast(json.message || t('general:submissionSuccessful'))\n }\n } else {\n setProcessing(false)\n setSubmitted(true)\n\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n if (json.message) {\n errorToast(json.message)\n\n return\n }\n\n if (Array.isArray(json.errors)) {\n const [fieldErrors, nonFieldErrors] = json.errors.reduce(\n ([fieldErrs, nonFieldErrs], err) => {\n const newFieldErrs = []\n const newNonFieldErrs = []\n\n if (err?.message) {\n newNonFieldErrs.push(err)\n }\n\n if (Array.isArray(err?.data?.errors)) {\n err.data?.errors.forEach((dataError) => {\n if (dataError?.field) {\n newFieldErrs.push(dataError)\n } else {\n newNonFieldErrs.push(dataError)\n }\n })\n }\n\n return [\n [...fieldErrs, ...newFieldErrs],\n [...nonFieldErrs, ...newNonFieldErrs],\n ]\n },\n [[], []],\n )\n\n dispatchFields({\n type: 'ADD_SERVER_ERRORS',\n errors: fieldErrors,\n })\n\n nonFieldErrors.forEach((err) => {\n errorToast(err.message || t('error:unknown'))\n })\n\n return\n }\n\n const message = errorMessages?.[res.status] || res?.statusText || t('error:unknown')\n\n errorToast(message)\n }\n } catch (err) {\n console.error('Error submitting form', err)\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n\n errorToast(err.message)\n }\n },\n [\n beforeSubmit,\n action,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled,\n dispatchFields,\n fields,\n handleResponse,\n method,\n onSubmit,\n onSuccess,\n redirect,\n router,\n t,\n i18n,\n waitForAutocomplete,\n ],\n )\n\n const getFields = useCallback(() => contextRef.current.fields, [])\n\n const getField = useCallback((path: string) => contextRef.current.fields[path], [])\n\n const getData = useCallback(() => reduceFieldsToValues(contextRef.current.fields, true), [])\n\n const getSiblingData = useCallback(\n (path: string) => getSiblingDataFunc(contextRef.current.fields, path),\n [],\n )\n const getDataByPath = useCallback<GetDataByPath>(\n (path: string) => getDataByPathFunc(contextRef.current.fields, path),\n [],\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const createFormData = useCallback((overrides: any = {}) => {\n const data = reduceFieldsToValues(contextRef.current.fields, true)\n\n const file = data?.file\n\n if (file) {\n delete data.file\n }\n\n const dataWithOverrides = {\n ...data,\n ...overrides,\n }\n\n const dataToSerialize = {\n _payload: JSON.stringify(dataWithOverrides),\n file,\n }\n\n // nullAsUndefineds is important to allow uploads and relationship fields to clear themselves\n const formData = serialize(dataToSerialize, { indices: true, nullsAsUndefineds: false })\n\n return formData\n }, [])\n\n const reset = useCallback(\n async (data: unknown) => {\n const newState = await getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n data,\n globalSlug,\n operation,\n schemaPath: collectionSlug || globalSlug,\n },\n serverURL,\n })\n\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state: newState })\n },\n [apiRoute, collectionSlug, dispatchFields, globalSlug, id, operation, serverURL],\n )\n\n const replaceState = useCallback(\n (state: FormState) => {\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state })\n },\n [dispatchFields],\n )\n\n const getFieldStateBySchemaPath = useCallback(\n async ({ data, schemaPath }) => {\n const fieldSchema = await getFormState({\n apiRoute,\n body: {\n collectionSlug,\n data,\n globalSlug,\n schemaPath,\n },\n serverURL,\n })\n return fieldSchema\n },\n [apiRoute, collectionSlug, globalSlug, serverURL],\n )\n\n const addFieldRow: FormContextType['addFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'ADD_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n const removeFieldRow: FormContextType['removeFieldRow'] = useCallback(\n ({ path, rowIndex }) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n },\n [dispatchFields],\n )\n\n const replaceFieldRow: FormContextType['replaceFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'REPLACE_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n useEffect(() => {\n if (initializingFromProps !== undefined) {\n setInitializing(initializingFromProps)\n }\n }, [initializingFromProps])\n\n contextRef.current.submit = submit\n contextRef.current.getFields = getFields\n contextRef.current.getField = getField\n contextRef.current.getData = getData\n contextRef.current.getSiblingData = getSiblingData\n contextRef.current.getDataByPath = getDataByPath\n contextRef.current.validateForm = validateForm\n contextRef.current.createFormData = createFormData\n contextRef.current.setModified = setModified\n contextRef.current.setProcessing = setProcessing\n contextRef.current.setSubmitted = setSubmitted\n contextRef.current.disabled = disabled\n contextRef.current.setDisabled = setDisabled\n contextRef.current.formRef = formRef\n contextRef.current.reset = reset\n contextRef.current.replaceState = replaceState\n contextRef.current.dispatchFields = dispatchFields\n contextRef.current.addFieldRow = addFieldRow\n contextRef.current.removeFieldRow = removeFieldRow\n contextRef.current.replaceFieldRow = replaceFieldRow\n contextRef.current.uuid = uuid\n contextRef.current.initializing = initializing\n\n useEffect(() => {\n setIsMounted(true)\n }, [])\n\n useEffect(() => {\n if (typeof disabledFromProps === 'boolean') setDisabled(disabledFromProps)\n }, [disabledFromProps])\n\n useEffect(() => {\n if (typeof submittedFromProps === 'boolean') setSubmitted(submittedFromProps)\n }, [submittedFromProps])\n\n useEffect(() => {\n if (initialState) {\n contextRef.current = { ...initContextState } as FormContextType\n dispatchFields({ type: 'REPLACE_STATE', optimize: false, state: initialState })\n }\n }, [initialState, dispatchFields])\n\n useThrottledEffect(\n () => {\n refreshCookie()\n },\n 15000,\n [fields],\n )\n\n useEffect(() => {\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n setModified(false)\n }, [locale])\n\n const classes = [className, baseClass].filter(Boolean).join(' ')\n\n useDebouncedEffect(\n () => {\n const executeOnChange = async () => {\n if (Array.isArray(onChange)) {\n let revalidatedFormState: FormState = contextRef.current.fields\n\n for (const onChangeFn of onChange) {\n revalidatedFormState = await onChangeFn({\n formState: revalidatedFormState,\n })\n }\n\n const { changed, newState } = mergeServerFormState(\n contextRef.current.fields || {},\n revalidatedFormState,\n )\n\n if (changed) {\n dispatchFields({\n type: 'REPLACE_STATE',\n optimize: false,\n state: newState,\n })\n }\n }\n }\n\n if (modified) void executeOnChange()\n },\n 150,\n // Make sure we trigger this whenever modified changes (not just when `fields` changes), otherwise we will miss merging server form state for the first form update/onChange. Here's why:\n // `fields` updates before `modified`, because setModified is in a setTimeout. So on the first change, modified is false, so we don't trigger the effect even though we should.\n [contextRef.current.fields, dispatchFields, onChange, modified],\n )\n\n return (\n <form\n action={action}\n className={classes}\n method={method}\n noValidate\n onSubmit={(e) => contextRef.current.submit({}, e)}\n ref={formRef}\n >\n <FormContext.Provider value={contextRef.current}>\n <FormWatchContext.Provider\n value={{\n fields,\n ...contextRef.current,\n }}\n >\n <SubmittedContext.Provider value={submitted}>\n <InitializingContext.Provider value={!isMounted || (isMounted && initializing)}>\n <ProcessingContext.Provider value={processing}>\n <ModifiedContext.Provider value={modified}>\n <FormFieldsContext.Provider value={fieldsReducer}>\n {children}\n </FormFieldsContext.Provider>\n </ModifiedContext.Provider>\n </ProcessingContext.Provider>\n </InitializingContext.Provider>\n </SubmittedContext.Provider>\n </FormWatchContext.Provider>\n </FormContext.Provider>\n </form>\n )\n}\n\nexport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n useAllFormFields,\n useForm,\n useFormFields,\n useFormModified,\n useFormProcessing,\n useFormSubmitted,\n useWatchForm,\n} from './context.js'\n\nexport { FormProps }\n"],"names":["dequal","useRouter","serialize","getDataByPath","getDataByPathFunc","getSiblingData","getSiblingDataFunc","reduceFieldsToValues","wait","React","useCallback","useEffect","useReducer","useRef","useState","toast","useDebouncedEffect","useThrottledEffect","useAuth","useConfig","useDocumentInfo","useLocale","useOperation","useTranslation","requests","getFormState","FormContext","FormFieldsContext","FormWatchContext","InitializingContext","ModifiedContext","ProcessingContext","SubmittedContext","errorMessages","fieldReducer","initContextState","mergeServerFormState","baseClass","Form","props","id","collectionSlug","globalSlug","action","beforeSubmit","children","className","disableSuccessStatus","disableValidationOnSubmit","disabled","disabledFromProps","handleResponse","initialState","isInitializing","initializingFromProps","onChange","onSubmit","onSuccess","redirect","submitted","submittedFromProps","uuid","waitForAutocomplete","method","undefined","router","code","locale","i18n","t","refreshCookie","user","operation","config","routes","api","apiRoute","serverURL","setDisabled","isMounted","setIsMounted","modified","setModified","initializing","setInitializing","processing","setProcessing","setSubmitted","formRef","contextRef","fieldsReducer","fields","dispatchFields","current","validateForm","validatedFieldState","isValid","dataFromContext","getData","data","validationPromises","Object","entries","map","path","field","validatedField","passesCondition","validationResult","valid","validate","valueToValidate","value","rows","Array","isArray","siblingData","errorMessage","Promise","all","type","state","submit","options","e","actionArg","methodToUse","overrides","skipValidation","preventDefault","successToast","errorToast","promise","resolve","reject","hasFormSubmitAction","success","error","loading","stopPropagation","revalidatedFormState","reduce","priorOnChange","beforeSubmitFn","result","formState","every","formData","createFormData","res","toLowerCase","body","headers","language","contentType","get","isJSON","indexOf","json","status","push","message","errors","fieldErrors","nonFieldErrors","fieldErrs","nonFieldErrs","err","newFieldErrs","newNonFieldErrs","forEach","dataError","statusText","console","getFields","getField","file","dataWithOverrides","dataToSerialize","_payload","JSON","stringify","indices","nullsAsUndefineds","reset","newState","schemaPath","replaceState","getFieldStateBySchemaPath","fieldSchema","addFieldRow","rowIndex","subFieldState","blockType","removeFieldRow","replaceFieldRow","optimize","classes","filter","Boolean","join","executeOnChange","onChangeFn","changed","form","noValidate","ref","Provider","useAllFormFields","useForm","useFormFields","useFormModified","useFormProcessing","useFormSubmitted","useWatchForm"],"mappings":"AAAA;;AAGA,SAASA,MAAM,QAAQ,cAAa,CAAC,wCAAwC;AAC7E,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SACEC,iBAAiBC,iBAAiB,EAClCC,kBAAkBC,kBAAkB,EACpCC,oBAAoB,EACpBC,IAAI,QACC,iBAAgB;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AAA,KAAC9D,YAAYqL,QAAQ;YAAC/F,OAAOvB,WAAWI,OAAO;sBAC7C,cAAA,KAACjE,iBAAiBmL,QAAQ;gBACxB/F,OAAO;oBACLrB;oBACA,GAAGF,WAAWI,OAAO;gBACvB;0BAEA,cAAA,KAAC7D,iBAAiB+K,QAAQ;oBAAC/F,OAAOrD;8BAChC,cAAA,KAAC9B,oBAAoBkL,QAAQ;wBAAC/F,OAAO,CAACjC,aAAcA,aAAaI;kCAC/D,cAAA,KAACpD,kBAAkBgL,QAAQ;4BAAC/F,OAAO3B;sCACjC,cAAA,KAACvD,gBAAgBiL,QAAQ;gCAAC/F,OAAO/B;0CAC/B,cAAA,KAACtD,kBAAkBoL,QAAQ;oCAAC/F,OAAOtB;8CAChC7C;;;;;;;;;AAUrB,EAAC;AAED,SACEnB,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,EAChBE,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBgL,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBC,YAAY,QACP,eAAc"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Row } from 'payload';
|
|
2
|
+
export declare const extractRowsAndCollapsedIDs: ({ collapsed, rowID, rows, }: {
|
|
3
|
+
collapsed: boolean;
|
|
4
|
+
rowID: string;
|
|
5
|
+
rows: Row[];
|
|
6
|
+
}) => {
|
|
7
|
+
collapsedIDs: string[];
|
|
8
|
+
updatedRows: Row[];
|
|
9
|
+
};
|
|
10
|
+
export declare const toggleAllRows: ({ collapsed, rows, }: {
|
|
11
|
+
collapsed: any;
|
|
12
|
+
rows: any;
|
|
13
|
+
}) => {
|
|
14
|
+
collapsedIDs: string[];
|
|
15
|
+
updatedRows: Row[];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=rowHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowHelpers.d.ts","sourceRoot":"","sources":["../../../src/forms/Form/rowHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,eAAO,MAAM,0BAA0B,gCAIpC;IACD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ,KAAG;IACF,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,GAAG,EAAE,CAAA;CAcnB,CAAA;AAED,eAAO,MAAM,aAAa;;;MAGtB;IACF,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,GAAG,EAAE,CAAA;CAcnB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const extractRowsAndCollapsedIDs = ({ collapsed, rowID, rows })=>{
|
|
2
|
+
return rows.reduce((acc, row)=>{
|
|
3
|
+
if (rowID === row.id) row.collapsed = collapsed;
|
|
4
|
+
if (row.collapsed) acc.collapsedIDs.push(row.id);
|
|
5
|
+
acc.updatedRows.push(row);
|
|
6
|
+
return acc;
|
|
7
|
+
}, {
|
|
8
|
+
collapsedIDs: [],
|
|
9
|
+
updatedRows: []
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export const toggleAllRows = ({ collapsed, rows })=>{
|
|
13
|
+
return rows.reduce((acc, row)=>{
|
|
14
|
+
row.collapsed = collapsed;
|
|
15
|
+
if (collapsed) acc.collapsedIDs.push(row.id);
|
|
16
|
+
acc.updatedRows.push(row);
|
|
17
|
+
return acc;
|
|
18
|
+
}, {
|
|
19
|
+
collapsedIDs: [],
|
|
20
|
+
updatedRows: []
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=rowHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/Form/rowHelpers.ts"],"sourcesContent":["import type { Row } from 'payload'\n\nexport const extractRowsAndCollapsedIDs = ({\n collapsed,\n rowID,\n rows,\n}: {\n collapsed: boolean\n rowID: string\n rows: Row[]\n}): {\n collapsedIDs: string[]\n updatedRows: Row[]\n} => {\n return rows.reduce(\n (acc, row) => {\n if (rowID === row.id) row.collapsed = collapsed\n if (row.collapsed) acc.collapsedIDs.push(row.id)\n acc.updatedRows.push(row)\n return acc\n },\n {\n collapsedIDs: [],\n updatedRows: [],\n },\n )\n}\n\nexport const toggleAllRows = ({\n collapsed,\n rows,\n}): {\n collapsedIDs: string[]\n updatedRows: Row[]\n} => {\n return rows.reduce(\n (acc, row) => {\n row.collapsed = collapsed\n if (collapsed) acc.collapsedIDs.push(row.id)\n acc.updatedRows.push(row)\n return acc\n },\n {\n collapsedIDs: [],\n updatedRows: [],\n },\n )\n}\n"],"names":["extractRowsAndCollapsedIDs","collapsed","rowID","rows","reduce","acc","row","id","collapsedIDs","push","updatedRows","toggleAllRows"],"mappings":"AAEA,OAAO,MAAMA,6BAA6B,CAAC,EACzCC,SAAS,EACTC,KAAK,EACLC,IAAI,EAKL;IAIC,OAAOA,KAAKC,MAAM,CAChB,CAACC,KAAKC;QACJ,IAAIJ,UAAUI,IAAIC,EAAE,EAAED,IAAIL,SAAS,GAAGA;QACtC,IAAIK,IAAIL,SAAS,EAAEI,IAAIG,YAAY,CAACC,IAAI,CAACH,IAAIC,EAAE;QAC/CF,IAAIK,WAAW,CAACD,IAAI,CAACH;QACrB,OAAOD;IACT,GACA;QACEG,cAAc,EAAE;QAChBE,aAAa,EAAE;IACjB;AAEJ,EAAC;AAED,OAAO,MAAMC,gBAAgB,CAAC,EAC5BV,SAAS,EACTE,IAAI,EACL;IAIC,OAAOA,KAAKC,MAAM,CAChB,CAACC,KAAKC;QACJA,IAAIL,SAAS,GAAGA;QAChB,IAAIA,WAAWI,IAAIG,YAAY,CAACC,IAAI,CAACH,IAAIC,EAAE;QAC3CF,IAAIK,WAAW,CAACD,IAAI,CAACH;QACrB,OAAOD;IACT,GACA;QACEG,cAAc,EAAE;QAChBE,aAAa,EAAE;IACjB;AAEJ,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Data, Field, FormField, FormState, User } from 'payload';
|
|
1
|
+
import type { Data, Field, FormField, FormState, Row, User } from 'payload';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { Dispatch } from 'react';
|
|
4
4
|
export type Preferences = {
|
|
@@ -119,21 +119,14 @@ export type ADD_SERVER_ERRORS = {
|
|
|
119
119
|
type: 'ADD_SERVER_ERRORS';
|
|
120
120
|
};
|
|
121
121
|
export type SET_ROW_COLLAPSED = {
|
|
122
|
-
collapsed: boolean;
|
|
123
122
|
path: string;
|
|
124
|
-
rowID: string;
|
|
125
|
-
setDocFieldPreferences: (field: string, fieldPreferences: {
|
|
126
|
-
[key: string]: unknown;
|
|
127
|
-
}) => void;
|
|
128
123
|
type: 'SET_ROW_COLLAPSED';
|
|
124
|
+
updatedRows: Row[];
|
|
129
125
|
};
|
|
130
126
|
export type SET_ALL_ROWS_COLLAPSED = {
|
|
131
|
-
collapsed: boolean;
|
|
132
127
|
path: string;
|
|
133
|
-
setDocFieldPreferences: (field: string, fieldPreferences: {
|
|
134
|
-
[key: string]: unknown;
|
|
135
|
-
}) => void;
|
|
136
128
|
type: 'SET_ALL_ROWS_COLLAPSED';
|
|
129
|
+
updatedRows: Row[];
|
|
137
130
|
};
|
|
138
131
|
export type FieldAction = ADD_ROW | ADD_SERVER_ERRORS | DUPLICATE_ROW | MODIFY_CONDITION | MOVE_ROW | REMOVE | REMOVE_ROW | REPLACE_ROW | REPLACE_STATE | SET_ALL_ROWS_COLLAPSED | SET_ROW_COLLAPSED | UPDATE;
|
|
139
132
|
export type FormFieldsContext = [FormState, Dispatch<FieldAction>];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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Ae,EAAE,CAAC,EAChB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,GACX,EAAE;QACD,IAAI,CAAC,EAAE,IAAI,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;KACnB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACxC,KAAK,EAAE,KAAK,CAAA;IACZ,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/Form/types.ts"],"sourcesContent":["import type { Data, Field, FormField, FormState, User } from 'payload'\nimport type React from 'react'\nimport type { Dispatch } from 'react'\n\nexport type Preferences = {\n [key: string]: unknown\n}\n\nexport type FormProps = {\n beforeSubmit?: ((args: { formState: FormState }) => Promise<FormState>)[]\n children?: React.ReactNode\n className?: string\n disableSuccessStatus?: boolean\n /**\n * If you would like to solely leverage server-side validation on submit,\n * you can disable checks that the form makes before it submits\n */\n disableValidationOnSubmit?: boolean\n disabled?: boolean\n /**\n * By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior.\n * This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks\n * feature of the Lexical Rich Text field)\n */\n fields?: Field[]\n handleResponse?: (\n res: Response,\n successToast: (value: string) => void,\n errorToast: (value: string) => void,\n ) => void\n initialState?: FormState\n isInitializing?: boolean\n log?: boolean\n onChange?: ((args: { formState: FormState }) => Promise<FormState>)[]\n onSubmit?: (fields: FormState, data: Data) => void\n onSuccess?: (json: unknown) => Promise<void> | void\n redirect?: string\n submitted?: boolean\n uuid?: string\n validationOperation?: 'create' | 'update'\n waitForAutocomplete?: boolean\n} & (\n | {\n action: (formData: FormData) => Promise<void>\n }\n | {\n action?: string\n method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'\n }\n)\n\nexport type SubmitOptions = {\n action?: string\n method?: string\n overrides?: Record<string, unknown>\n skipValidation?: boolean\n}\n\nexport type DispatchFields = React.Dispatch<any>\nexport type Submit = (\n options?: SubmitOptions,\n e?: React.FormEvent<HTMLFormElement>,\n) => Promise<void>\nexport type ValidateForm = () => Promise<boolean>\nexport type CreateFormData = (overrides?: any) => FormData\nexport type GetFields = () => FormState\nexport type GetField = (path: string) => FormField\nexport type GetData = () => Data\nexport type GetSiblingData = (path: string) => Data\nexport type GetDataByPath = <T = unknown>(path: string) => T\nexport type SetModified = (modified: boolean) => void\nexport type SetSubmitted = (submitted: boolean) => void\nexport type SetProcessing = (processing: boolean) => void\n\nexport type Reset = (data: unknown) => Promise<void>\n\nexport type REPLACE_STATE = {\n optimize?: boolean\n state: FormState\n type: 'REPLACE_STATE'\n}\n\nexport type REMOVE = {\n path: string\n type: 'REMOVE'\n}\n\nexport type MODIFY_CONDITION = {\n path: string\n result: boolean\n type: 'MODIFY_CONDITION'\n user: User\n}\n\nexport type UPDATE = {\n path: string\n type: 'UPDATE'\n} & Partial<FormField>\n\nexport type REMOVE_ROW = {\n path: string\n rowIndex: number\n type: 'REMOVE_ROW'\n}\n\nexport type ADD_ROW = {\n blockType?: string\n path: string\n rowIndex?: number\n subFieldState?: FormState\n type: 'ADD_ROW'\n}\n\nexport type REPLACE_ROW = {\n blockType?: string\n path: string\n rowIndex: number\n subFieldState?: FormState\n type: 'REPLACE_ROW'\n}\n\nexport type DUPLICATE_ROW = {\n path: string\n rowIndex: number\n type: 'DUPLICATE_ROW'\n}\n\nexport type MOVE_ROW = {\n moveFromIndex: number\n moveToIndex: number\n path: string\n type: 'MOVE_ROW'\n}\n\nexport type ADD_SERVER_ERRORS = {\n errors: {\n field: string\n message: string\n }[]\n type: 'ADD_SERVER_ERRORS'\n}\n\nexport type SET_ROW_COLLAPSED = {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/Form/types.ts"],"sourcesContent":["import type { Data, Field, FormField, FormState, Row, User } from 'payload'\nimport type React from 'react'\nimport type { Dispatch } from 'react'\n\nexport type Preferences = {\n [key: string]: unknown\n}\n\nexport type FormProps = {\n beforeSubmit?: ((args: { formState: FormState }) => Promise<FormState>)[]\n children?: React.ReactNode\n className?: string\n disableSuccessStatus?: boolean\n /**\n * If you would like to solely leverage server-side validation on submit,\n * you can disable checks that the form makes before it submits\n */\n disableValidationOnSubmit?: boolean\n disabled?: boolean\n /**\n * By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior.\n * This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks\n * feature of the Lexical Rich Text field)\n */\n fields?: Field[]\n handleResponse?: (\n res: Response,\n successToast: (value: string) => void,\n errorToast: (value: string) => void,\n ) => void\n initialState?: FormState\n isInitializing?: boolean\n log?: boolean\n onChange?: ((args: { formState: FormState }) => Promise<FormState>)[]\n onSubmit?: (fields: FormState, data: Data) => void\n onSuccess?: (json: unknown) => Promise<void> | void\n redirect?: string\n submitted?: boolean\n uuid?: string\n validationOperation?: 'create' | 'update'\n waitForAutocomplete?: boolean\n} & (\n | {\n action: (formData: FormData) => Promise<void>\n }\n | {\n action?: string\n method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'\n }\n)\n\nexport type SubmitOptions = {\n action?: string\n method?: string\n overrides?: Record<string, unknown>\n skipValidation?: boolean\n}\n\nexport type DispatchFields = React.Dispatch<any>\nexport type Submit = (\n options?: SubmitOptions,\n e?: React.FormEvent<HTMLFormElement>,\n) => Promise<void>\nexport type ValidateForm = () => Promise<boolean>\nexport type CreateFormData = (overrides?: any) => FormData\nexport type GetFields = () => FormState\nexport type GetField = (path: string) => FormField\nexport type GetData = () => Data\nexport type GetSiblingData = (path: string) => Data\nexport type GetDataByPath = <T = unknown>(path: string) => T\nexport type SetModified = (modified: boolean) => void\nexport type SetSubmitted = (submitted: boolean) => void\nexport type SetProcessing = (processing: boolean) => void\n\nexport type Reset = (data: unknown) => Promise<void>\n\nexport type REPLACE_STATE = {\n optimize?: boolean\n state: FormState\n type: 'REPLACE_STATE'\n}\n\nexport type REMOVE = {\n path: string\n type: 'REMOVE'\n}\n\nexport type MODIFY_CONDITION = {\n path: string\n result: boolean\n type: 'MODIFY_CONDITION'\n user: User\n}\n\nexport type UPDATE = {\n path: string\n type: 'UPDATE'\n} & Partial<FormField>\n\nexport type REMOVE_ROW = {\n path: string\n rowIndex: number\n type: 'REMOVE_ROW'\n}\n\nexport type ADD_ROW = {\n blockType?: string\n path: string\n rowIndex?: number\n subFieldState?: FormState\n type: 'ADD_ROW'\n}\n\nexport type REPLACE_ROW = {\n blockType?: string\n path: string\n rowIndex: number\n subFieldState?: FormState\n type: 'REPLACE_ROW'\n}\n\nexport type DUPLICATE_ROW = {\n path: string\n rowIndex: number\n type: 'DUPLICATE_ROW'\n}\n\nexport type MOVE_ROW = {\n moveFromIndex: number\n moveToIndex: number\n path: string\n type: 'MOVE_ROW'\n}\n\nexport type ADD_SERVER_ERRORS = {\n errors: {\n field: string\n message: string\n }[]\n type: 'ADD_SERVER_ERRORS'\n}\n\nexport type SET_ROW_COLLAPSED = {\n path: string\n type: 'SET_ROW_COLLAPSED'\n updatedRows: Row[]\n}\n\nexport type SET_ALL_ROWS_COLLAPSED = {\n path: string\n type: 'SET_ALL_ROWS_COLLAPSED'\n updatedRows: Row[]\n}\n\nexport type FieldAction =\n | ADD_ROW\n | ADD_SERVER_ERRORS\n | DUPLICATE_ROW\n | MODIFY_CONDITION\n | MOVE_ROW\n | REMOVE\n | REMOVE_ROW\n | REPLACE_ROW\n | REPLACE_STATE\n | SET_ALL_ROWS_COLLAPSED\n | SET_ROW_COLLAPSED\n | UPDATE\n\nexport type FormFieldsContext = [FormState, Dispatch<FieldAction>]\n\nexport type Context = {\n addFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n /*\n * by default the new row will be added to the end of the list\n */\n rowIndex?: number\n schemaPath: string\n }) => Promise<void>\n buildRowErrors: () => void\n createFormData: CreateFormData\n disabled: boolean\n dispatchFields: Dispatch<FieldAction>\n /**\n * Form context fields may be outdated and should not be relied on. Instead, prefer `useFormFields`.\n */\n fields: FormState\n formRef: React.MutableRefObject<HTMLFormElement>\n getData: GetData\n getDataByPath: GetDataByPath\n getField: GetField\n getFields: GetFields\n getSiblingData: GetSiblingData\n initializing: boolean\n removeFieldRow: ({ path, rowIndex }: { path: string; rowIndex: number }) => void\n replaceFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n rowIndex: number\n schemaPath: string\n }) => Promise<void>\n replaceState: (state: FormState) => void\n reset: Reset\n setDisabled: (disabled: boolean) => void\n setModified: SetModified\n setProcessing: SetProcessing\n setSubmitted: SetSubmitted\n submit: Submit\n uuid?: string\n validateForm: ValidateForm\n}\n"],"names":[],"mappings":"AA0KA,WAmDC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { FieldPermissions, FieldTypes } from 'payload';
|
|
1
|
+
import type { FieldComponentProps, FieldPermissions, FieldTypes, MappedField } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { FieldComponentProps, MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js';
|
|
4
3
|
type Props = {
|
|
5
4
|
CustomField: MappedField['CustomField'];
|
|
6
5
|
custom?: Record<any, string>;
|
|
7
6
|
disabled: boolean;
|
|
8
|
-
fieldComponentProps?:
|
|
7
|
+
fieldComponentProps?: {
|
|
8
|
+
forceRender?: boolean;
|
|
9
|
+
} & FieldComponentProps;
|
|
9
10
|
indexPath?: string;
|
|
10
11
|
isHidden?: boolean;
|
|
11
12
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderField.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/RenderField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"RenderField.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/RenderField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE7F,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC5B,QAAQ,EAAE,OAAO,CAAA;IACjB,mBAAmB,CAAC,EAAE;QACpB,WAAW,CAAC,EAAE,OAAO,CAAA;KACtB,GAAG,mBAAmB,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE;QAClB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;KACtC,CAAA;IACD,IAAI,EAAE,MAAM,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2DvC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/RenderFields/RenderField.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldPermissions, FieldTypes } from 'payload'\n\nimport React from 'react'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/RenderFields/RenderField.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldComponentProps, FieldPermissions, FieldTypes, MappedField } from 'payload'\n\nimport React from 'react'\n\nimport { HiddenField } from '../../fields/Hidden/index.js'\nimport { useFieldComponents } from '../../providers/FieldComponents/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { FieldPropsProvider, useFieldProps } from '../FieldPropsProvider/index.js'\n\ntype Props = {\n CustomField: MappedField['CustomField']\n custom?: Record<any, string>\n disabled: boolean\n fieldComponentProps?: {\n forceRender?: boolean\n } & FieldComponentProps\n indexPath?: string\n isHidden?: boolean\n name?: string\n path: string\n permissions?: FieldPermissions\n readOnly?: boolean\n schemaPath: string\n siblingPermissions: {\n [fieldName: string]: FieldPermissions\n }\n type: keyof FieldTypes\n}\n\nexport const RenderField: React.FC<Props> = ({\n name,\n type,\n CustomField,\n custom,\n disabled,\n fieldComponentProps,\n indexPath,\n isHidden,\n path: pathFromProps,\n permissions,\n readOnly: readOnlyFromProps,\n schemaPath: schemaPathFromProps,\n siblingPermissions,\n}) => {\n const operation = useOperation()\n const { readOnly: readOnlyFromContext } = useFieldProps()\n const fieldComponents = useFieldComponents()\n\n const path = [pathFromProps, name].filter(Boolean).join('.')\n const schemaPath = [schemaPathFromProps, name].filter(Boolean).join('.')\n\n // if the user cannot read the field, then filter it out\n // this is different from `admin.readOnly` which is executed based on `operation`\n if (permissions?.read?.permission === false || disabled) {\n return null\n }\n\n // `admin.readOnly` displays the value but prevents the field from being edited\n let readOnly = readOnlyFromProps\n\n // if parent field is `readOnly: true`, but this field is `readOnly: false`, the field should still be editable\n if (readOnlyFromContext && readOnly !== false) readOnly = true\n\n // if the user does not have access control to begin with, force it to be read-only\n if (permissions?.[operation]?.permission === false) {\n readOnly = true\n }\n\n const DefaultField = isHidden ? HiddenField : fieldComponents[type]\n\n if (CustomField === undefined && !DefaultField) {\n return null\n }\n\n return (\n <FieldPropsProvider\n custom={custom}\n indexPath={indexPath}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n schemaPath={schemaPath}\n siblingPermissions={siblingPermissions}\n type={type}\n >\n {CustomField !== undefined ? CustomField : <DefaultField {...fieldComponentProps} />}\n </FieldPropsProvider>\n )\n}\n"],"names":["React","HiddenField","useFieldComponents","useOperation","FieldPropsProvider","useFieldProps","RenderField","name","type","CustomField","custom","disabled","fieldComponentProps","indexPath","isHidden","path","pathFromProps","permissions","readOnly","readOnlyFromProps","schemaPath","schemaPathFromProps","siblingPermissions","operation","readOnlyFromContext","fieldComponents","filter","Boolean","join","read","permission","DefaultField","undefined"],"mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAEzB,SAASC,WAAW,QAAQ,+BAA8B;AAC1D,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,iCAAgC;AAsBlF,OAAO,MAAMC,cAA+B,CAAC,EAC3CC,IAAI,EACJC,IAAI,EACJC,WAAW,EACXC,MAAM,EACNC,QAAQ,EACRC,mBAAmB,EACnBC,SAAS,EACTC,QAAQ,EACRC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAUC,iBAAiB,EAC3BC,YAAYC,mBAAmB,EAC/BC,kBAAkB,EACnB;IACC,MAAMC,YAAYpB;IAClB,MAAM,EAAEe,UAAUM,mBAAmB,EAAE,GAAGnB;IAC1C,MAAMoB,kBAAkBvB;IAExB,MAAMa,OAAO;QAACC;QAAeT;KAAK,CAACmB,MAAM,CAACC,SAASC,IAAI,CAAC;IACxD,MAAMR,aAAa;QAACC;QAAqBd;KAAK,CAACmB,MAAM,CAACC,SAASC,IAAI,CAAC;IAEpE,wDAAwD;IACxD,iFAAiF;IACjF,IAAIX,aAAaY,MAAMC,eAAe,SAASnB,UAAU;QACvD,OAAO;IACT;IAEA,+EAA+E;IAC/E,IAAIO,WAAWC;IAEf,+GAA+G;IAC/G,IAAIK,uBAAuBN,aAAa,OAAOA,WAAW;IAE1D,mFAAmF;IACnF,IAAID,aAAa,CAACM,UAAU,EAAEO,eAAe,OAAO;QAClDZ,WAAW;IACb;IAEA,MAAMa,eAAejB,WAAWb,cAAcwB,eAAe,CAACjB,KAAK;IAEnE,IAAIC,gBAAgBuB,aAAa,CAACD,cAAc;QAC9C,OAAO;IACT;IAEA,qBACE,KAAC3B;QACCM,QAAQA;QACRG,WAAWA;QACXE,MAAMA;QACNE,aAAaA;QACbC,UAAUA;QACVE,YAAYA;QACZE,oBAAoBA;QACpBd,MAAMA;kBAELC,gBAAgBuB,YAAYvB,4BAAc,KAACsB;YAAc,GAAGnB,mBAAmB;;;AAGtF,EAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { FieldPermissions, Operation } from 'payload';
|
|
2
|
-
import type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js';
|
|
1
|
+
import type { FieldMap, FieldPermissions, Operation } from 'payload';
|
|
3
2
|
export type Props = {
|
|
4
3
|
className?: string;
|
|
5
4
|
fieldMap: FieldMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEpE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;IAClB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IACzB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE;QACZ,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;KACtC,CAAA;IACD,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/RenderFields/types.ts"],"sourcesContent":["import type { FieldPermissions, Operation } from 'payload'\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/RenderFields/types.ts"],"sourcesContent":["import type { FieldMap, FieldPermissions, Operation } from 'payload'\n\nexport type Props = {\n className?: string\n fieldMap: FieldMap\n /**\n * Controls the rendering behavior of the fields, i.e. defers rendering until they intersect with the viewport using the Intersection Observer API.\n *\n * If true, the fields will be rendered immediately, rather than waiting for them to intersect with the viewport.\n *\n * If a number is provided, will immediately render fields _up to that index_.\n */\n forceRender?: boolean | number\n indexPath?: string\n margins?: 'small' | false\n operation?: Operation\n path: string\n permissions?: {\n [fieldName: string]: FieldPermissions\n }\n readOnly: boolean\n schemaPath: string\n}\n"],"names":[],"mappings":"AAEA,WAoBC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { FieldMap } from '
|
|
1
|
+
import type { FieldMap } from 'payload';
|
|
2
2
|
export declare const buildPathSegments: (parentPath: string, fieldMap: FieldMap) => string[];
|
|
3
3
|
//# sourceMappingURL=buildPathSegments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPathSegments.d.ts","sourceRoot":"","sources":["../../../src/forms/WatchChildErrors/buildPathSegments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"buildPathSegments.d.ts","sourceRoot":"","sources":["../../../src/forms/WatchChildErrors/buildPathSegments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,iBAAiB,eAAgB,MAAM,YAAY,QAAQ,KAAG,MAAM,EAmChF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/WatchChildErrors/buildPathSegments.ts"],"sourcesContent":["import type { FieldMap } from '
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/WatchChildErrors/buildPathSegments.ts"],"sourcesContent":["import type { FieldMap } from 'payload'\n\nexport const buildPathSegments = (parentPath: string, fieldMap: FieldMap): string[] => {\n const pathNames = fieldMap.reduce((acc, field) => {\n const fieldMap =\n 'fieldMap' in field.fieldComponentProps ? field.fieldComponentProps.fieldMap : undefined\n\n if (fieldMap) {\n if (field.isFieldAffectingData) {\n // group, block, array\n const name = 'name' in field ? field.name : 'unnamed'\n acc.push(parentPath ? `${parentPath}.${name}.` : `${name}.`)\n } else {\n // rows, collapsibles, unnamed-tab\n acc.push(...buildPathSegments(parentPath, fieldMap))\n }\n } else if (field.type === 'tabs') {\n // tabs\n if ('tabs' in field.fieldComponentProps) {\n field.fieldComponentProps.tabs?.forEach((tab) => {\n let tabPath = parentPath\n if ('name' in tab) {\n tabPath = parentPath ? `${parentPath}.${tab.name}` : tab.name\n }\n acc.push(...buildPathSegments(tabPath, tab.fieldMap))\n })\n }\n } else if (field.isFieldAffectingData) {\n // text, number, date, etc.\n const name = 'name' in field ? field.name : 'unnamed'\n acc.push(parentPath ? `${parentPath}.${name}` : name)\n }\n\n return acc\n }, [])\n\n return pathNames\n}\n"],"names":["buildPathSegments","parentPath","fieldMap","pathNames","reduce","acc","field","fieldComponentProps","undefined","isFieldAffectingData","name","push","type","tabs","forEach","tab","tabPath"],"mappings":"AAEA,OAAO,MAAMA,oBAAoB,CAACC,YAAoBC;IACpD,MAAMC,YAAYD,SAASE,MAAM,CAAC,CAACC,KAAKC;QACtC,MAAMJ,WACJ,cAAcI,MAAMC,mBAAmB,GAAGD,MAAMC,mBAAmB,CAACL,QAAQ,GAAGM;QAEjF,IAAIN,UAAU;YACZ,IAAII,MAAMG,oBAAoB,EAAE;gBAC9B,sBAAsB;gBACtB,MAAMC,OAAO,UAAUJ,QAAQA,MAAMI,IAAI,GAAG;gBAC5CL,IAAIM,IAAI,CAACV,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAES,KAAK,CAAC,CAAC,GAAG,CAAC,EAAEA,KAAK,CAAC,CAAC;YAC7D,OAAO;gBACL,kCAAkC;gBAClCL,IAAIM,IAAI,IAAIX,kBAAkBC,YAAYC;YAC5C;QACF,OAAO,IAAII,MAAMM,IAAI,KAAK,QAAQ;YAChC,OAAO;YACP,IAAI,UAAUN,MAAMC,mBAAmB,EAAE;gBACvCD,MAAMC,mBAAmB,CAACM,IAAI,EAAEC,QAAQ,CAACC;oBACvC,IAAIC,UAAUf;oBACd,IAAI,UAAUc,KAAK;wBACjBC,UAAUf,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAEc,IAAIL,IAAI,CAAC,CAAC,GAAGK,IAAIL,IAAI;oBAC/D;oBACAL,IAAIM,IAAI,IAAIX,kBAAkBgB,SAASD,IAAIb,QAAQ;gBACrD;YACF;QACF,OAAO,IAAII,MAAMG,oBAAoB,EAAE;YACrC,2BAA2B;YAC3B,MAAMC,OAAO,UAAUJ,QAAQA,MAAMI,IAAI,GAAG;YAC5CL,IAAIM,IAAI,CAACV,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAES,KAAK,CAAC,GAAGA;QAClD;QAEA,OAAOL;IACT,GAAG,EAAE;IAEL,OAAOF;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/WatchChildErrors/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/WatchChildErrors/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,KAAK,6BAA6B,GAAG;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAsBpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/WatchChildErrors/index.tsx"],"sourcesContent":["'use client'\nimport type
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/WatchChildErrors/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldMap } from 'payload'\nimport type React from 'react'\n\nimport { useThrottledEffect } from '../../hooks/useThrottledEffect.js'\nimport { useAllFormFields, useFormSubmitted } from '../Form/context.js'\nimport { buildPathSegments } from './buildPathSegments.js'\nimport { getFieldStateFromPaths } from './getFieldStateFromPaths.js'\n\ntype TrackSubSchemaErrorCountProps = {\n fieldMap?: FieldMap\n path: string\n setErrorCount: (count: number) => void\n}\n\nexport const WatchChildErrors: React.FC<TrackSubSchemaErrorCountProps> = ({\n fieldMap,\n path,\n setErrorCount,\n}) => {\n const [formState] = useAllFormFields()\n const hasSubmitted = useFormSubmitted()\n\n const pathSegments = buildPathSegments(path, fieldMap)\n\n useThrottledEffect(\n () => {\n if (hasSubmitted) {\n const { errorCount } = getFieldStateFromPaths({ formState, pathSegments })\n setErrorCount(errorCount)\n }\n },\n 250,\n [formState, hasSubmitted, fieldMap],\n )\n\n return null\n}\n"],"names":["useThrottledEffect","useAllFormFields","useFormSubmitted","buildPathSegments","getFieldStateFromPaths","WatchChildErrors","fieldMap","path","setErrorCount","formState","hasSubmitted","pathSegments","errorCount"],"mappings":"AAAA;AAIA,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,qBAAoB;AACvE,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,sBAAsB,QAAQ,8BAA6B;AAQpE,OAAO,MAAMC,mBAA4D,CAAC,EACxEC,QAAQ,EACRC,IAAI,EACJC,aAAa,EACd;IACC,MAAM,CAACC,UAAU,GAAGR;IACpB,MAAMS,eAAeR;IAErB,MAAMS,eAAeR,kBAAkBI,MAAMD;IAE7CN,mBACE;QACE,IAAIU,cAAc;YAChB,MAAM,EAAEE,UAAU,EAAE,GAAGR,uBAAuB;gBAAEK;gBAAWE;YAAa;YACxEH,cAAcI;QAChB;IACF,GACA,KACA;QAACH;QAAWC;QAAcJ;KAAS;IAGrC,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addFieldStatePromise.d.ts","sourceRoot":"","sources":["../../../src/forms/buildStateFromSchema/addFieldStatePromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,mBAAmB,EACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"addFieldStatePromise.d.ts","sourceRoot":"","sources":["../../../src/forms/buildStateFromSchema/addFieldStatePromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,mBAAmB,EACnB,KAAK,EAGL,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAA;AAWhB,MAAM,MAAM,wBAAwB,GAAG;IACrC,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,KAAK,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,IAAI,CAAA;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,eAAe,EAAE,OAAO,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,mBAAmB,CAAA;IAEhC;;;OAGG;IACH,GAAG,EAAE,cAAc,CAAA;IACnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,SAAgB,wBAAwB,KAAG,OAAO,CAAC,IAAI,CAqgBvF,CAAA"}
|