@payloadcms/ui 3.0.0-beta.9 → 3.0.0-canary.f6e77b8
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/ArrayAction/index.d.ts +1 -0
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +3 -3
- 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 +15 -3
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.js +1 -1
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.scss +2 -2
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +7 -7
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/DocumentFields/index.js +1 -1
- package/dist/elements/DocumentFields/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +3 -2
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.d.ts +2 -0
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +3 -2
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.d.ts +2 -0
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js +3 -2
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/EditMany/index.js +2 -2
- package/dist/elements/EditMany/index.js.map +1 -1
- package/dist/elements/EditUpload/index.d.ts +12 -0
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +25 -25
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/FieldSelect/index.d.ts.map +1 -1
- package/dist/elements/FieldSelect/index.js +4 -1
- package/dist/elements/FieldSelect/index.js.map +1 -1
- package/dist/elements/HydrateClientUser/index.d.ts +2 -2
- package/dist/elements/HydrateClientUser/index.d.ts.map +1 -1
- package/dist/elements/HydrateClientUser/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +16 -3
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/PublishMany/index.js +1 -1
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/Save/index.d.ts.map +1 -1
- package/dist/elements/Save/index.js +7 -1
- package/dist/elements/Save/index.js.map +1 -1
- package/dist/elements/SaveDraft/index.d.ts.map +1 -1
- package/dist/elements/SaveDraft/index.js +8 -5
- package/dist/elements/SaveDraft/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts +2 -4
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +7 -6
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.scss +1 -1
- package/dist/elements/Table/DefaultCell/fields/Checkbox/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Checkbox/index.js +6 -2
- package/dist/elements/Table/DefaultCell/fields/Checkbox/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/JSON/index.js +1 -1
- package/dist/elements/Table/DefaultCell/fields/JSON/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +1 -1
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.js +3 -1
- package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +37 -1
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/Upload/index.scss +12 -1
- package/dist/{providers/ComponentMap/buildComponentMap/WithServerSideProps.d.ts → elements/WithServerSideProps/index.d.ts} +1 -1
- package/dist/elements/WithServerSideProps/index.d.ts.map +1 -0
- package/dist/{providers/ComponentMap/buildComponentMap/WithServerSideProps.js → elements/WithServerSideProps/index.js} +3 -3
- package/dist/elements/WithServerSideProps/index.js.map +1 -0
- package/dist/exports/elements.d.ts +3 -2
- package/dist/exports/elements.d.ts.map +1 -1
- package/dist/exports/elements.js +5 -2
- package/dist/exports/elements.js.map +1 -1
- package/dist/exports/fields.d.ts +2 -0
- package/dist/exports/fields.d.ts.map +1 -0
- package/dist/exports/fields.js +3 -0
- package/dist/exports/fields.js.map +1 -0
- package/dist/exports/providers.d.ts +2 -0
- package/dist/exports/providers.d.ts.map +1 -0
- package/dist/exports/providers.js +3 -0
- package/dist/exports/providers.js.map +1 -0
- package/dist/fields/Array/ArrayRow.d.ts +1 -0
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js +4 -3
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts +1 -2
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +4 -3
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +1 -0
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +4 -3
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts +1 -0
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +2 -1
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts +2 -2
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +3 -2
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +3 -3
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/types.d.ts +0 -2
- package/dist/fields/Checkbox/types.d.ts.map +1 -1
- package/dist/fields/Checkbox/types.js.map +1 -1
- package/dist/fields/Code/index.d.ts +1 -2
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts +0 -2
- 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/ConfirmPassword/index.js +1 -1
- package/dist/fields/ConfirmPassword/index.js.map +1 -1
- package/dist/fields/DateTime/index.d.ts +1 -2
- package/dist/fields/DateTime/index.d.ts.map +1 -1
- package/dist/fields/DateTime/index.js.map +1 -1
- package/dist/fields/Email/index.d.ts +1 -2
- package/dist/fields/Email/index.d.ts.map +1 -1
- package/dist/fields/Email/index.js.map +1 -1
- package/dist/fields/Group/index.d.ts +0 -2
- package/dist/fields/Group/index.d.ts.map +1 -1
- package/dist/fields/Group/index.js +3 -3
- package/dist/fields/Group/index.js.map +1 -1
- package/dist/fields/JSON/index.d.ts +2 -2
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js +20 -1
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/Number/index.d.ts +1 -2
- package/dist/fields/Number/index.d.ts.map +1 -1
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Password/index.d.ts +0 -1
- package/dist/fields/Password/index.d.ts.map +1 -1
- package/dist/fields/Password/index.js.map +1 -1
- package/dist/fields/Point/index.d.ts +0 -2
- 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/index.d.ts +1 -2
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/types.d.ts +1 -2
- 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 +0 -2
- package/dist/fields/RichText/index.d.ts.map +1 -1
- package/dist/fields/RichText/index.js.map +1 -1
- package/dist/fields/Select/index.d.ts +1 -2
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js.map +1 -1
- package/dist/fields/Text/index.d.ts.map +1 -1
- package/dist/fields/Text/index.js +2 -1
- package/dist/fields/Text/index.js.map +1 -1
- package/dist/fields/Text/types.d.ts +1 -2
- 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.map +1 -1
- package/dist/fields/Textarea/index.js +2 -1
- package/dist/fields/Textarea/index.js.map +1 -1
- package/dist/fields/Textarea/types.d.ts +1 -2
- package/dist/fields/Textarea/types.d.ts.map +1 -1
- package/dist/fields/Textarea/types.js.map +1 -1
- package/dist/fields/Upload/types.d.ts +0 -1
- package/dist/fields/Upload/types.d.ts.map +1 -1
- package/dist/fields/Upload/types.js.map +1 -1
- package/dist/fields/shared/index.d.ts +4 -2
- package/dist/fields/shared/index.d.ts.map +1 -1
- package/dist/fields/shared/index.js.map +1 -1
- package/dist/forms/FieldPropsProvider/index.d.ts +2 -0
- package/dist/forms/FieldPropsProvider/index.d.ts.map +1 -1
- package/dist/forms/FieldPropsProvider/index.js +5 -3
- package/dist/forms/FieldPropsProvider/index.js.map +1 -1
- package/dist/forms/RenderFields/RenderField.d.ts +1 -0
- package/dist/forms/RenderFields/RenderField.d.ts.map +1 -1
- package/dist/forms/RenderFields/RenderField.js +2 -1
- package/dist/forms/RenderFields/RenderField.js.map +1 -1
- package/dist/forms/RenderFields/index.d.ts.map +1 -1
- package/dist/forms/RenderFields/index.js +2 -1
- package/dist/forms/RenderFields/index.js.map +1 -1
- package/dist/forms/RowLabel/types.d.ts +2 -3
- package/dist/forms/RowLabel/types.d.ts.map +1 -1
- package/dist/forms/RowLabel/types.js +1 -4
- package/dist/forms/RowLabel/types.js.map +1 -1
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.d.ts +3 -5
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.js +2 -1
- package/dist/forms/buildStateFromSchema/addFieldStatePromise.js.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/index.d.ts +2 -2
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/index.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/index.js.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/iterateFields.d.ts +2 -2
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/iterateFields.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/iterateFields.js.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/promise.d.ts +2 -2
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/promise.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/promise.js +1 -0
- package/dist/forms/buildStateFromSchema/calculateDefaultValues/promise.js.map +1 -1
- package/dist/forms/buildStateFromSchema/index.d.ts +3 -5
- package/dist/forms/buildStateFromSchema/index.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/index.js.map +1 -1
- package/dist/forms/buildStateFromSchema/iterateFields.d.ts +3 -5
- package/dist/forms/buildStateFromSchema/iterateFields.d.ts.map +1 -1
- package/dist/forms/buildStateFromSchema/iterateFields.js.map +1 -1
- package/dist/forms/useField/index.d.ts.map +1 -1
- package/dist/forms/useField/index.js +3 -1
- package/dist/forms/useField/index.js.map +1 -1
- package/dist/graphics/Account/index.js +0 -9
- package/dist/graphics/Account/index.js.map +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +2 -1
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/collections.js +16 -4
- package/dist/providers/ComponentMap/buildComponentMap/collections.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js +50 -36
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.js +16 -4
- package/dist/providers/ComponentMap/buildComponentMap/globals.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/index.js +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/types.d.ts +2 -0
- 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 +0 -1
- package/dist/providers/ComponentMap/index.d.ts.map +1 -1
- package/dist/providers/ComponentMap/index.js +0 -1
- package/dist/providers/ComponentMap/index.js.map +1 -1
- package/dist/providers/DocumentInfo/index.js +8 -7
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/EntityVisibility/index.d.ts +1 -1
- package/dist/providers/EntityVisibility/index.d.ts.map +1 -1
- package/dist/providers/EntityVisibility/index.js.map +1 -1
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js +2 -1
- package/dist/providers/Root/index.js.map +1 -1
- package/package.json +32 -31
- package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.d.ts.map +0 -1
- package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.js.map +0 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { I18n } from '@payloadcms/translations';
|
|
2
|
-
import type { ClientCollectionConfig,
|
|
2
|
+
import type { ClientCollectionConfig, RelationshipField } from 'payload/types';
|
|
3
3
|
import type { SanitizedConfig } from 'payload/types';
|
|
4
4
|
import type { FormFieldBase } from '../shared/index.js';
|
|
5
5
|
export type RelationshipFieldProps = FormFieldBase & {
|
|
6
6
|
allowCreate?: RelationshipField['admin']['allowCreate'];
|
|
7
7
|
hasMany?: boolean;
|
|
8
8
|
isSortable?: boolean;
|
|
9
|
-
label?: FieldBase['label'];
|
|
10
9
|
name: string;
|
|
11
10
|
relationTo?: RelationshipField['relationTo'];
|
|
12
11
|
sortOptions?: RelationshipField['admin']['sortOptions'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAa,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,sBAAsB,G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I,EAAE,IAAI,CAAA;IACV,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,MAAM,CAAA;AAEzC,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAA;CACxB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { ClientCollectionConfig, FieldBase, RelationshipField } from 'payload/types'\nimport type { SanitizedConfig } from 'payload/types'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RelationshipFieldProps = FormFieldBase & {\n allowCreate?: RelationshipField['admin']['allowCreate']\n hasMany?: boolean\n isSortable?: boolean\n
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { ClientCollectionConfig, FieldBase, RelationshipField } from 'payload/types'\nimport type { SanitizedConfig } from 'payload/types'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RelationshipFieldProps = FormFieldBase & {\n allowCreate?: RelationshipField['admin']['allowCreate']\n hasMany?: boolean\n isSortable?: boolean\n name: string\n relationTo?: RelationshipField['relationTo']\n sortOptions?: RelationshipField['admin']['sortOptions']\n width?: string\n}\n\nexport type Option = {\n label: string\n options?: Option[]\n relationTo?: string\n value: number | string\n}\n\nexport type OptionGroup = {\n label: string\n options: Option[]\n}\n\nexport type ValueWithRelation = {\n relationTo: string\n value: number | string\n}\n\nexport type Value = ValueWithRelation | number | string\n\ntype CLEAR = {\n type: 'CLEAR'\n}\n\ntype UPDATE = {\n collection: ClientCollectionConfig\n config: SanitizedConfig\n doc: any\n i18n: I18n\n type: 'UPDATE'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n config: SanitizedConfig\n docs: any[]\n i18n: I18n\n ids?: (number | string)[]\n sort?: boolean\n type: 'ADD'\n}\n\nexport type Action = ADD | CLEAR | UPDATE\n\nexport type GetResults = (args: {\n lastFullyLoadedRelation?: number\n lastLoadedPage: Record<string, number>\n onSuccess?: () => void\n search?: string\n sort?: boolean\n value?: Value | Value[]\n}) => Promise<void>\n"],"names":[],"rangeMappings":"","mappings":"AA2DA,WAOmB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { FieldBase } from 'packages/payload/src/exports/types.js';
|
|
2
1
|
import type React from 'react';
|
|
3
2
|
import type { MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js';
|
|
4
3
|
import type { FormFieldBase } from '../shared/index.js';
|
|
5
4
|
export type RichTextFieldProps = FormFieldBase & {
|
|
6
|
-
label?: FieldBase['label'];
|
|
7
5
|
name: string;
|
|
8
6
|
richTextComponentMap?: Map<string, MappedField[] | React.ReactNode>;
|
|
9
7
|
width?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/RichText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/RichText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAEjD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/RichText/index.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/RichText/index.tsx"],"sourcesContent":["import type React from 'react'\n\nimport type { MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RichTextFieldProps = FormFieldBase & {\n name: string\n richTextComponentMap?: Map<string, MappedField[] | React.ReactNode>\n width?: string\n}\n\nexport const RichText: React.FC<RichTextFieldProps> = () => {\n return null\n}\n"],"names":["RichText"],"rangeMappings":";;","mappings":"AAWA,OAAO,MAAMA,WAAyC;IACpD,OAAO;AACT,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Option } from 'payload/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { FormFieldBase } from '../shared/index.js';
|
|
4
4
|
import './index.scss';
|
|
@@ -6,7 +6,6 @@ export type SelectFieldProps = FormFieldBase & {
|
|
|
6
6
|
hasMany?: boolean;
|
|
7
7
|
isClearable?: boolean;
|
|
8
8
|
isSortable?: boolean;
|
|
9
|
-
label?: FieldBase['label'];
|
|
10
9
|
name?: string;
|
|
11
10
|
onChange?: (e: string) => void;
|
|
12
11
|
options?: Option[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,MAAM,EAAgB,MAAM,eAAe,CAAA;AAOzE,OAAO,KAAgC,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAOvD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AA0JD,eAAO,MAAM,MAAM,4BAA6B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Select/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate,
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Select/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate, Option, OptionObject } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback, useState } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { ReactSelect } from '../../elements/ReactSelect/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type SelectFieldProps = FormFieldBase & {\n hasMany?: boolean\n isClearable?: boolean\n isSortable?: boolean\n name?: string\n onChange?: (e: string) => void\n options?: Option[]\n path?: string\n value?: string\n width?: string\n}\n\nconst formatOptions = (options: Option[]): OptionObject[] =>\n options.map((option) => {\n if (typeof option === 'object' && (option.value || option.value === '')) {\n return option\n }\n\n return {\n label: option,\n value: option,\n } as OptionObject\n })\n\nconst SelectField: React.FC<SelectFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n hasMany = false,\n isClearable = true,\n isSortable = true,\n label,\n labelProps,\n onChange: onChangeFromProps,\n options: optionsFromProps = [],\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const [options] = useState(formatOptions(optionsFromProps))\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function')\n return validate(value, { ...validationOptions, hasMany, options, required })\n },\n [validate, required, hasMany, options],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { path, setValue, showError, value } = useField({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n let valueToRender\n\n if (hasMany && Array.isArray(value)) {\n valueToRender = value.map((val) => {\n const matchingOption = options.find((option) => option.value === val)\n return {\n label: matchingOption ? getTranslation(matchingOption.label, i18n) : val,\n value: matchingOption?.value ?? val,\n }\n })\n } else if (value) {\n const matchingOption = options.find((option) => option.value === value)\n valueToRender = {\n label: matchingOption ? getTranslation(matchingOption.label, i18n) : value,\n value: matchingOption?.value ?? value,\n }\n }\n\n const onChange = useCallback(\n (selectedOption) => {\n if (!readOnly) {\n let newValue\n if (!selectedOption) {\n newValue = null\n } else if (hasMany) {\n if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value)\n } else {\n newValue = []\n }\n } else {\n newValue = selectedOption.value\n }\n\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(newValue)\n }\n\n setValue(newValue)\n }\n },\n [readOnly, hasMany, setValue, onChangeFromProps],\n )\n\n return (\n <div\n className={[\n fieldBaseClass,\n 'select',\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div>\n {BeforeInput}\n <ReactSelect\n disabled={readOnly}\n isClearable={isClearable}\n isMulti={hasMany}\n isSortable={isSortable}\n onChange={onChange}\n options={options.map((option) => ({\n ...option,\n label: getTranslation(option.label, i18n),\n }))}\n showError={showError}\n value={valueToRender as OptionObject}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const Select = withCondition(SelectField)\n"],"names":["getTranslation","FieldDescription","FieldError","FieldLabel","useFieldProps","React","useCallback","useState","ReactSelect","useField","withCondition","useTranslation","fieldBaseClass","formatOptions","options","map","option","value","label","SelectField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","isClearable","isSortable","labelProps","onChange","onChangeFromProps","optionsFromProps","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","i18n","memoizedValidate","validationOptions","pathFromContext","readOnlyFromContext","setValue","showError","valueToRender","Array","isArray","val","matchingOption","find","selectedOption","newValue","div","filter","Boolean","join","id","replace","disabled","isMulti","undefined","Select"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,iDAAiD,GACjD;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,OAAOC,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AAIpD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AAenD,MAAMC,gBAAgB,CAACC,UACrBA,QAAQC,GAAG,CAAC,CAACC;QACX,IAAI,OAAOA,WAAW,YAAaA,CAAAA,OAAOC,KAAK,IAAID,OAAOC,KAAK,KAAK,EAAC,GAAI;YACvE,OAAOD;QACT;QAEA,OAAO;YACLE,OAAOF;YACPC,OAAOD;QACT;IACF;AAEF,MAAMG,cAA0C,CAACC;IAC/C,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,KAAK,EACfC,cAAc,IAAI,EAClBC,aAAa,IAAI,EACjBd,KAAK,EACLe,UAAU,EACVC,UAAUC,iBAAiB,EAC3BrB,SAASsB,mBAAmB,EAAE,EAC9BC,MAAM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,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Text/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Text/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,CAAA;AAyIpD,eAAO,MAAM,IAAI,0BAA2B,CAAA"}
|
|
@@ -9,7 +9,7 @@ import { isFieldRTL } from '../shared/index.js';
|
|
|
9
9
|
import { TextInput } from './Input.js';
|
|
10
10
|
export { TextInput };
|
|
11
11
|
const TextField = (props)=>{
|
|
12
|
-
const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, descriptionProps, errorProps, hasMany, inputRef, labelProps, localized, maxLength, maxRows, minLength, minRows, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, rtl, style, validate, width } = props;
|
|
12
|
+
const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, descriptionProps, errorProps, hasMany, inputRef, label, labelProps, localized, maxLength, maxRows, minLength, minRows, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, rtl, style, validate, width } = props;
|
|
13
13
|
const locale = useLocale();
|
|
14
14
|
const { localization: localizationConfig } = useConfig();
|
|
15
15
|
const memoizedValidate = useCallback((value, options)=>{
|
|
@@ -87,6 +87,7 @@ const TextField = (props)=>{
|
|
|
87
87
|
errorProps: errorProps,
|
|
88
88
|
hasMany: hasMany,
|
|
89
89
|
inputRef: inputRef,
|
|
90
|
+
label: label,
|
|
90
91
|
labelProps: labelProps,
|
|
91
92
|
maxRows: maxRows,
|
|
92
93
|
minRows: minRows,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload/types'\nimport type {} from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextFieldProps, TextInputProps } from './types.js'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextInput } from './Input.js'\nimport './index.scss'\n\nexport { TextFieldProps, TextInput, TextInputProps }\n\nconst TextField: React.FC<TextFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n hasMany,\n inputRef,\n labelProps,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const locale = useLocale()\n\n const { localization: localizationConfig } = useConfig()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!readOnly) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [readOnly, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n hasMany={hasMany}\n inputRef={inputRef}\n labelProps={labelProps}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={formProcessing || readOnly}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const Text = withCondition(TextField)\n"],"names":["useFieldProps","React","useCallback","useEffect","useState","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","inputRef","labelProps","localized","maxLength","maxRows","minLength","minRows","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rtl","style","validate","width","locale","localization","localizationConfig","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formProcessing","setValue","showError","renderRTL","fieldLocalized","fieldRTL","undefined","valueToRender","setValueToRender","handleHasManyChange","selectedOption","newValue","Array","isArray","map","option","val","index","id","
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload/types'\nimport type {} from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextFieldProps, TextInputProps } from './types.js'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextInput } from './Input.js'\nimport './index.scss'\n\nexport { TextFieldProps, TextInput, TextInputProps }\n\nconst TextField: React.FC<TextFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n hasMany,\n inputRef,\n label,\n labelProps,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const locale = useLocale()\n\n const { localization: localizationConfig } = useConfig()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!readOnly) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [readOnly, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n hasMany={hasMany}\n inputRef={inputRef}\n label={label}\n labelProps={labelProps}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={formProcessing || readOnly}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const Text = withCondition(TextField)\n"],"names":["useFieldProps","React","useCallback","useEffect","useState","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","inputRef","label","labelProps","localized","maxLength","maxRows","minLength","minRows","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rtl","style","validate","width","locale","localization","localizationConfig","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formProcessing","setValue","showError","renderRTL","fieldLocalized","fieldRTL","undefined","valueToRender","setValueToRender","handleHasManyChange","selectedOption","newValue","Array","isArray","map","option","val","index","id","toString","onChange","e","target","Text"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,SAAS,QAAQ,aAAY;AAGtC,SAAyBA,SAAS,GAAkB;AAEpD,MAAMC,YAAsC,CAACC;IAC3C,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAU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WAAWuC,MAAMC,OAAO,CAACjB,QAAQ;YACnCY,iBACEZ,MAAMkB,GAAG,CAAC,CAACE,KAAKC;gBACd,OAAO;oBACLC,IAAI,CAAC,EAAEF,IAAI,EAAEC,MAAM,CAAC;oBACpB1C,OAAO,CAAC,EAAEyC,IAAI,CAAC;oBACfpB,OAAO;wBACL,4RAA4R;wBAC5RuB,UAAU,IAAM,CAAC,EAAEH,IAAI,EAAEC,MAAM,CAAC;wBAChCrB,OAAOoB,KAAKpB,SAASoB;oBACvB;gBACF;YACF;QAEJ;IACF,GAAG;QAACpB;QAAOvB;KAAQ;IAEnB,qBACE,oBAACZ;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,SAASA;QACTC,UAAUA;QACVC,OAAOA;QACPC,YAAYA;QACZG,SAASA;QACTE,SAASA;QACTuC,UACE/C,UACIoC,sBACA,CAACY;YACCpB,SAASoB,EAAEC,MAAM,CAAC1B,KAAK;QACzB;QAENd,MAAMA;QACNE,aAAaA;QACbC,UAAUe,kBAAkBf;QAC5BE,UAAUA;QACVC,KAAKe;QACLD,WAAWA;QACXb,OAAOA;QACPO,OAAO,AAACA,SAAoB;QAC5BW,eAAeA;QACfhB,OAAOA;;AAGb;AAEA,OAAO,MAAMgC,OAAOlE,cAAcK,WAAU"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextField } from 'payload/types';
|
|
2
2
|
import type { ChangeEvent } from 'react';
|
|
3
3
|
import type { Option } from '../../elements/ReactSelect/types.js';
|
|
4
4
|
import type { FormFieldBase } from '../shared/index.js';
|
|
5
5
|
export type TextFieldProps = FormFieldBase & {
|
|
6
6
|
hasMany?: boolean;
|
|
7
7
|
inputRef?: React.MutableRefObject<HTMLInputElement>;
|
|
8
|
-
label?: FieldBase['label'];
|
|
9
8
|
maxLength?: number;
|
|
10
9
|
maxRows?: number;
|
|
11
10
|
minLength?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;IACnD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;IACxD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Text/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Text/types.ts"],"sourcesContent":["import type { TextField } from 'payload/types'\nimport type { ChangeEvent } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type TextFieldProps = FormFieldBase & {\n hasMany?: boolean\n inputRef?: React.MutableRefObject<HTMLInputElement>\n maxLength?: number\n maxRows?: number\n minLength?: number\n minRows?: number\n name?: string\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n path?: string\n placeholder?: TextField['admin']['placeholder']\n width?: string\n}\n\nexport type TextInputProps = Omit<TextFieldProps, 'type'> & {\n hasMany?: boolean\n inputRef?: React.MutableRefObject<HTMLInputElement>\n maxRows?: number\n minRows?: number\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n showError?: boolean\n value?: string\n valueToRender?: Option[]\n}\n"],"names":[],"rangeMappings":"","mappings":"AAoBA,WAUC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAOxE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAOxE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;AAsFhE,eAAO,MAAM,QAAQ,8BAA+B,CAAA"}
|
|
@@ -10,7 +10,7 @@ import { isFieldRTL } from '../shared/index.js';
|
|
|
10
10
|
import { TextareaInput } from './Input.js';
|
|
11
11
|
export { TextareaInput };
|
|
12
12
|
const TextareaField = (props)=>{
|
|
13
|
-
const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, descriptionProps, errorProps, labelProps, locale, localized, maxLength, minLength, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, rows, rtl, style, validate, width } = props;
|
|
13
|
+
const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, descriptionProps, errorProps, label, labelProps, locale, localized, maxLength, minLength, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, rows, rtl, style, validate, width } = props;
|
|
14
14
|
const { i18n } = useTranslation();
|
|
15
15
|
const { localization } = useConfig();
|
|
16
16
|
const isRTL = isFieldRTL({
|
|
@@ -47,6 +47,7 @@ const TextareaField = (props)=>{
|
|
|
47
47
|
className: className,
|
|
48
48
|
descriptionProps: descriptionProps,
|
|
49
49
|
errorProps: errorProps,
|
|
50
|
+
label: label,
|
|
50
51
|
labelProps: labelProps,
|
|
51
52
|
onChange: (e)=>{
|
|
52
53
|
setValue(e.target.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps, TextareaFieldProps } from './types.js'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextareaInput } from './Input.js'\nimport './index.scss'\n\nexport { TextAreaInputProps, TextareaFieldProps, TextareaInput }\n\nconst TextareaField: React.FC<TextareaFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n labelProps,\n locale,\n localized,\n maxLength,\n minLength,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rows,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const { localization } = useConfig()\n\n const isRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localization || undefined,\n })\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, required, maxLength, minLength],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n return (\n <TextareaInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n labelProps={labelProps}\n onChange={(e) => {\n setValue(e.target.value)\n }}\n path={path}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={readOnly}\n required={required}\n rows={rows}\n rtl={isRTL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const Textarea = withCondition(TextareaField)\n"],"names":["getTranslation","useFieldProps","React","useCallback","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","labelProps","locale","localized","maxLength","minLength","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rows","rtl","style","validate","width","i18n","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","undefined","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","setValue","showError","onChange","e","target","Textarea"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps, TextareaFieldProps } from './types.js'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextareaInput } from './Input.js'\nimport './index.scss'\n\nexport { TextAreaInputProps, TextareaFieldProps, TextareaInput }\n\nconst TextareaField: React.FC<TextareaFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n locale,\n localized,\n maxLength,\n minLength,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rows,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const { localization } = useConfig()\n\n const isRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localization || undefined,\n })\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, required, maxLength, minLength],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n return (\n <TextareaInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n label={label}\n labelProps={labelProps}\n onChange={(e) => {\n setValue(e.target.value)\n }}\n path={path}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={readOnly}\n required={required}\n rows={rows}\n rtl={isRTL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const Textarea = withCondition(TextareaField)\n"],"names":["getTranslation","useFieldProps","React","useCallback","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","locale","localized","maxLength","minLength","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rows","rtl","style","validate","width","i18n","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","undefined","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","setValue","showError","onChange","e","target","Textarea"],"rangeMappings":";;;;;;;;;;;;;;;;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mB,EAAE,GAAGhD;IACjE,MAAM6B,WAAWC,qBAAqBkB;IAEtC,MAAM,EAAEtB,IAAI,EAAEuB,QAAQ,EAAEC,SAAS,EAAEL,KAAK,EAAE,GAAG1C,SAAiB;QAC5DuB,MAAMqB,mBAAmBpB,iBAAiBhB;QAC1CwB,UAAUS;IACZ;IAEA,qBACE,oBAACpC;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,OAAOA;QACPC,YAAYA;QACZ8B,UAAU,CAACC;YACTH,SAASG,EAAEC,MAAM,CAACR,KAAK;QACzB;QACAnB,MAAMA;QACNE,aAAa7B,eAAe6B,aAAaS;QACzCR,UAAUA;QACVE,UAAUA;QACVC,MAAMA;QACNC,KAAKM;QACLW,WAAWA;QACXhB,OAAOA;QACPW,OAAOA;QACPT,OAAOA;;AAGb;AAEA,OAAO,MAAMkB,WAAWlD,cAAcK,eAAc"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextareaField as TextareaFieldType } from 'payload/types';
|
|
2
2
|
import { type ChangeEvent } from 'react';
|
|
3
3
|
import type { FormFieldBase } from '../shared/index.js';
|
|
4
4
|
export type TextareaFieldProps = FormFieldBase & {
|
|
5
|
-
label?: FieldBase['label'];
|
|
6
5
|
maxLength?: number;
|
|
7
6
|
minLength?: number;
|
|
8
7
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEvE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAA;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IACvD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Textarea/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Textarea/types.ts"],"sourcesContent":["import type { TextareaField as TextareaFieldType } from 'payload/types'\n\nimport { type ChangeEvent } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type TextareaFieldProps = FormFieldBase & {\n maxLength?: number\n minLength?: number\n name?: string\n path?: string\n placeholder?: TextareaFieldType['admin']['placeholder']\n rows?: number\n width?: string\n}\n\nexport type TextAreaInputProps = TextareaFieldProps & {\n onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void\n rows?: number\n showError?: boolean\n value?: string\n}\n"],"names":[],"rangeMappings":"","mappings":"AAgBA,WAKC"}
|
|
@@ -2,7 +2,6 @@ import type { UploadField } from 'payload/types';
|
|
|
2
2
|
import type { FormFieldBase } from '../shared/index.js';
|
|
3
3
|
export type UploadFieldProps = FormFieldBase & {
|
|
4
4
|
filterOptions?: UploadField['filterOptions'];
|
|
5
|
-
label?: UploadField['label'];
|
|
6
5
|
name?: string;
|
|
7
6
|
path?: string;
|
|
8
7
|
relationTo?: UploadField['relationTo'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IAC5C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Upload/types.ts"],"sourcesContent":["import type { UploadField } from 'payload/types'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type UploadFieldProps = FormFieldBase & {\n filterOptions?: UploadField['filterOptions']\n
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Upload/types.ts"],"sourcesContent":["import type { UploadField } from 'payload/types'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type UploadFieldProps = FormFieldBase & {\n filterOptions?: UploadField['filterOptions']\n name?: string\n path?: string\n relationTo?: UploadField['relationTo']\n width?: string\n}\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAMC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
2
|
import type { User } from 'payload/auth';
|
|
3
3
|
import type { Locale, SanitizedLocalizationConfig } from 'payload/config';
|
|
4
|
-
import type { DocumentPreferences, ErrorProps, FieldDescriptionProps, LabelProps, Validate } from 'payload/types';
|
|
4
|
+
import type { DocumentPreferences, ErrorProps, FieldDescriptionProps, LabelProps, SanitizedLabelProps, Validate } from 'payload/types';
|
|
5
5
|
export declare const fieldBaseClass = "field-type";
|
|
6
6
|
export type FormFieldBase = {
|
|
7
7
|
AfterInput?: React.ReactNode;
|
|
@@ -10,11 +10,13 @@ export type FormFieldBase = {
|
|
|
10
10
|
CustomError?: React.ReactNode;
|
|
11
11
|
CustomLabel?: React.ReactNode;
|
|
12
12
|
className?: string;
|
|
13
|
+
custom?: Record<string, any>;
|
|
13
14
|
descriptionProps?: FieldDescriptionProps;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
docPreferences?: DocumentPreferences;
|
|
16
17
|
errorProps?: ErrorProps;
|
|
17
|
-
|
|
18
|
+
label?: LabelProps['label'];
|
|
19
|
+
labelProps?: SanitizedLabelProps;
|
|
18
20
|
locale?: Locale;
|
|
19
21
|
localized?: boolean;
|
|
20
22
|
path?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,gBAA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,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,cAAc,EACd,QAAQ,EACR,MAAM,EACN,kBAAkB,GACnB,EAAE;IACD,cAAc,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,2BAA2B,CAAA;CACjD,WAiBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/shared/index.tsx"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Locale, SanitizedLocalizationConfig } from 'payload/config'\nimport type {\n DocumentPreferences,\n ErrorProps,\n FieldDescriptionProps,\n LabelProps,\n Validate,\n} from 'payload/types'\n\nexport const fieldBaseClass = 'field-type'\n\nexport type FormFieldBase = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomDescription?: React.ReactNode\n CustomError?: React.ReactNode\n CustomLabel?: React.ReactNode\n className?: string\n descriptionProps?: FieldDescriptionProps\n disabled?: boolean\n docPreferences?: DocumentPreferences\n errorProps?: ErrorProps\n
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/shared/index.tsx"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Locale, SanitizedLocalizationConfig } from 'payload/config'\nimport type {\n DocumentPreferences,\n ErrorProps,\n FieldDescriptionProps,\n LabelProps,\n SanitizedLabelProps,\n Validate,\n} from 'payload/types'\n\nexport const fieldBaseClass = 'field-type'\n\nexport type FormFieldBase = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomDescription?: React.ReactNode\n CustomError?: React.ReactNode\n CustomLabel?: React.ReactNode\n className?: string\n custom?: Record<string, any>\n descriptionProps?: FieldDescriptionProps\n disabled?: boolean\n docPreferences?: DocumentPreferences\n errorProps?: ErrorProps\n label?: LabelProps['label']\n labelProps?: SanitizedLabelProps\n locale?: Locale\n localized?: boolean\n path?: string\n readOnly?: boolean\n required?: boolean\n rtl?: boolean\n style?: React.CSSProperties\n user?: User\n validate?: Validate\n}\n\n/**\n * Determines whether a field should be displayed as right-to-left (RTL) based on its configuration, payload's localization configuration and the adming user's currently enabled locale.\n\n * @returns Whether the field should be displayed as RTL.\n */\nexport function isFieldRTL({\n fieldLocalized,\n fieldRTL,\n locale,\n localizationConfig,\n}: {\n fieldLocalized: boolean\n fieldRTL: boolean\n locale: Locale\n localizationConfig?: SanitizedLocalizationConfig\n}) {\n const hasMultipleLocales =\n locale &&\n localizationConfig &&\n localizationConfig.locales &&\n localizationConfig.locales.length > 1\n\n const isCurrentLocaleDefaultLocale = locale?.code === localizationConfig?.defaultLocale\n\n return (\n (fieldRTL !== false &&\n locale?.rtl === true &&\n (fieldLocalized ||\n (!fieldLocalized && !hasMultipleLocales) || // If there is only one locale which is also rtl, that field is rtl too\n (!fieldLocalized && isCurrentLocaleDefaultLocale))) || // If the current locale is the default locale, but the field is not localized, that field is rtl too\n fieldRTL === true\n ) // If fieldRTL is true. This should be useful for when no localization is set at all in the payload config, but you still want fields to be rtl.\n}\n"],"names":["fieldBaseClass","isFieldRTL","fieldLocalized","fieldRTL","locale","localizationConfig","hasMultipleLocales","locales","length","isCurrentLocaleDefaultLocale","code","defaultLocale","rtl"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAWA,OAAO,MAAMA,iBAAiB,aAAY;AA2B1C;;;;CAIC,GACD,OAAO,SAASC,WAAW,EACzBC,cAAc,EACdC,QAAQ,EACRC,MAAM,EACNC,kBAAkB,EAMnB;IACC,MAAMC,qBACJF,UACAC,sBACAA,mBAAmBE,OAAO,IAC1BF,mBAAmBE,OAAO,CAACC,MAAM,GAAG;IAEtC,MAAMC,+BAA+BL,QAAQM,SAASL,oBAAoBM;IAE1E,OACE,AAACR,aAAa,SACZC,QAAQQ,QAAQ,QACfV,CAAAA,kBACE,CAACA,kBAAkB,CAACI,sBAAuB,uEAAuE;IAClH,CAACJ,kBAAkBO,4BAA4B,KAAO,qGAAqG;IAChKN,aAAa,KACb,gJAAgJ;;AACpJ"}
|
|
@@ -2,6 +2,7 @@ import type { FieldTypes } from 'payload/config';
|
|
|
2
2
|
import type { FieldPermissions } from 'payload/types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export type FieldPropsContextType = {
|
|
5
|
+
custom?: Record<any, string>;
|
|
5
6
|
indexPath?: string;
|
|
6
7
|
path: string;
|
|
7
8
|
permissions?: FieldPermissions;
|
|
@@ -14,6 +15,7 @@ export type FieldPropsContextType = {
|
|
|
14
15
|
};
|
|
15
16
|
export type Props = {
|
|
16
17
|
children: React.ReactNode;
|
|
18
|
+
custom?: Record<any, string>;
|
|
17
19
|
indexPath?: string;
|
|
18
20
|
path: string;
|
|
19
21
|
permissions?: FieldPermissions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,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;AAaD,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,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,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2B9C,CAAA;AAED,eAAO,MAAM,aAAa,6BAGzB,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
const FieldPropsContext = /*#__PURE__*/ React.createContext({
|
|
4
4
|
type: '',
|
|
5
|
+
custom: {},
|
|
5
6
|
indexPath: '',
|
|
6
7
|
path: '',
|
|
7
8
|
permissions: {},
|
|
@@ -9,10 +10,11 @@ const FieldPropsContext = /*#__PURE__*/ React.createContext({
|
|
|
9
10
|
schemaPath: '',
|
|
10
11
|
siblingPermissions: {}
|
|
11
12
|
});
|
|
12
|
-
export const FieldPropsProvider = ({ type, children, indexPath, path, permissions, readOnly, schemaPath, siblingPermissions })=>{
|
|
13
|
+
export const FieldPropsProvider = ({ type, children, custom, indexPath, path, permissions, readOnly, schemaPath, siblingPermissions })=>{
|
|
13
14
|
return /*#__PURE__*/ React.createElement(FieldPropsContext.Provider, {
|
|
14
15
|
value: {
|
|
15
16
|
type,
|
|
17
|
+
custom,
|
|
16
18
|
indexPath,
|
|
17
19
|
path,
|
|
18
20
|
permissions,
|
|
@@ -23,8 +25,8 @@ export const FieldPropsProvider = ({ type, children, indexPath, path, permission
|
|
|
23
25
|
}, children);
|
|
24
26
|
};
|
|
25
27
|
export const useFieldProps = ()=>{
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
+
const props = React.useContext(FieldPropsContext);
|
|
29
|
+
return props;
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nexport type FieldPropsContextType = {\n indexPath?: 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\nconst FieldPropsContext = React.createContext<FieldPropsContextType>({\n type: '' as keyof FieldTypes,\n indexPath: '',\n path: '',\n permissions: {} as FieldPermissions,\n readOnly: false,\n schemaPath: '',\n siblingPermissions: {},\n})\n\nexport type Props = {\n children: React.ReactNode\n indexPath?: 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 FieldPropsProvider: React.FC<Props> = ({\n type,\n children,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n}) => {\n return (\n <FieldPropsContext.Provider\n value={{\n type,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n }}\n >\n {children}\n </FieldPropsContext.Provider>\n )\n}\n\nexport const useFieldProps = () => {\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nexport type FieldPropsContextType = {\n custom?: Record<any, string>\n indexPath?: 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\nconst FieldPropsContext = React.createContext<FieldPropsContextType>({\n type: '' as keyof FieldTypes,\n custom: {},\n indexPath: '',\n path: '',\n permissions: {} as FieldPermissions,\n readOnly: false,\n schemaPath: '',\n siblingPermissions: {},\n})\n\nexport type Props = {\n children: React.ReactNode\n custom?: Record<any, string>\n indexPath?: 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 FieldPropsProvider: React.FC<Props> = ({\n type,\n children,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n}) => {\n return (\n <FieldPropsContext.Provider\n value={{\n type,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n }}\n >\n {children}\n </FieldPropsContext.Provider>\n )\n}\n\nexport const useFieldProps = () => {\n const props = React.useContext(FieldPropsContext)\n return props\n}\n"],"names":["React","FieldPropsContext","createContext","type","custom","indexPath","path","permissions","readOnly","schemaPath","siblingPermissions","FieldPropsProvider","children","Provider","value","useFieldProps","props","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAezB,MAAMC,kCAAoBD,MAAME,aAAa,CAAwB;IACnEC,MAAM;IACNC,QAAQ,CAAC;IACTC,WAAW;IACXC,MAAM;IACNC,aAAa,CAAC;IACdC,UAAU;IACVC,YAAY;IACZC,oBAAoB,CAAC;AACvB;AAgBA,OAAO,MAAMC,qBAAsC,CAAC,EAClDR,IAAI,EACJS,QAAQ,EACRR,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,EACnB;IACC,qBACE,oBAACT,kBAAkBY,QAAQ;QACzBC,OAAO;YACLX;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;OAECE;AAGP,EAAC;AAED,OAAO,MAAMG,gBAAgB;IAC3B,MAAMC,QAAQhB,MAAMiB,UAAU,CAAChB;IAC/B,OAAOe;AACT,EAAC"}
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import type { FieldComponentProps, MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js';
|
|
5
5
|
type Props = {
|
|
6
6
|
CustomField: MappedField['CustomField'];
|
|
7
|
+
custom?: Record<any, string>;
|
|
7
8
|
disabled: boolean;
|
|
8
9
|
fieldComponentProps?: FieldComponentProps;
|
|
9
10
|
indexPath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderField.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/RenderField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACZ,MAAM,yDAAyD,CAAA;AAOhE,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACvC,QAAQ,EAAE,OAAO,CAAA;IACjB,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,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,
|
|
1
|
+
{"version":3,"file":"RenderField.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/RenderField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACZ,MAAM,yDAAyD,CAAA;AAOhE,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,mBAAmB,CAAA;IACzC,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"}
|
|
@@ -4,7 +4,7 @@ import { HiddenInput } from '../../fields/HiddenInput/index.js';
|
|
|
4
4
|
import { useFieldComponents } from '../../providers/FieldComponents/index.js';
|
|
5
5
|
import { useOperation } from '../../providers/Operation/index.js';
|
|
6
6
|
import { FieldPropsProvider, useFieldProps } from '../FieldPropsProvider/index.js';
|
|
7
|
-
export const RenderField = ({ name, type, CustomField, disabled, fieldComponentProps, indexPath, isHidden, path: pathFromProps, permissions, readOnly: readOnlyFromProps, schemaPath: schemaPathFromProps, siblingPermissions })=>{
|
|
7
|
+
export const RenderField = ({ name, type, CustomField, custom, disabled, fieldComponentProps, indexPath, isHidden, path: pathFromProps, permissions, readOnly: readOnlyFromProps, schemaPath: schemaPathFromProps, siblingPermissions })=>{
|
|
8
8
|
const operation = useOperation();
|
|
9
9
|
const { readOnly: readOnlyFromContext } = useFieldProps();
|
|
10
10
|
const fieldComponents = useFieldComponents();
|
|
@@ -34,6 +34,7 @@ export const RenderField = ({ name, type, CustomField, disabled, fieldComponentP
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
return /*#__PURE__*/ React.createElement(FieldPropsProvider, {
|
|
37
|
+
custom: custom,
|
|
37
38
|
indexPath: indexPath,
|
|
38
39
|
path: path,
|
|
39
40
|
permissions: permissions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/RenderFields/RenderField.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nimport type {\n FieldComponentProps,\n MappedField,\n} from '../../providers/ComponentMap/buildComponentMap/types.js'\n\nimport { HiddenInput } from '../../fields/HiddenInput/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 disabled: boolean\n fieldComponentProps?: 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 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 ? HiddenInput : fieldComponents[type]\n\n if (CustomField === undefined && !DefaultField) {\n return null\n }\n\n return (\n <FieldPropsProvider\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","HiddenInput","useFieldComponents","useOperation","FieldPropsProvider","useFieldProps","RenderField","name","type","CustomField","disabled","fieldComponentProps","indexPath","isHidden","path","pathFromProps","permissions","readOnly","readOnlyFromProps","schemaPath","schemaPathFromProps","siblingPermissions","operation","readOnlyFromContext","fieldComponents","filter","Boolean","join","read","permission","DefaultField","undefined"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/RenderFields/RenderField.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nimport type {\n FieldComponentProps,\n MappedField,\n} from '../../providers/ComponentMap/buildComponentMap/types.js'\n\nimport { HiddenInput } from '../../fields/HiddenInput/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?: 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 ? HiddenInput : 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","HiddenInput","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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAKA,OAAOA,WAAW,QAAO;AAOzB,SAASC,WAAW,QAAQ,oCAAmC;AAC/D,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,iCAAgC;AAoBlF,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,oBAAC3B;QACCM,QAAQA;QACRG,WAAWA;QACXE,MAAMA;QACNE,aAAaA;QACbC,UAAUA;QACVE,YAAYA;QACZE,oBAAoBA;QACpBd,MAAMA;OAELC,gBAAgBuB,YAAYvB,4BAAc,oBAACsB,cAAiBnB;AAGnE,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAKvC,OAAO,cAAc,CAAA;AAIrB,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/RenderFields/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAKvC,OAAO,cAAc,CAAA;AAIrB,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiFxC,CAAA"}
|
|
@@ -39,10 +39,11 @@ export const RenderFields = (props)=>{
|
|
|
39
39
|
].filter(Boolean).join(' '),
|
|
40
40
|
ref: intersectionRef
|
|
41
41
|
}, hasRendered && fieldMap?.map((f, fieldIndex)=>{
|
|
42
|
-
const { type, CustomField, disabled, fieldComponentProps, fieldComponentProps: { readOnly }, isHidden } = f;
|
|
42
|
+
const { type, CustomField, custom, disabled, fieldComponentProps, fieldComponentProps: { readOnly }, isHidden } = f;
|
|
43
43
|
const name = 'name' in f ? f.name : undefined;
|
|
44
44
|
return /*#__PURE__*/ React.createElement(RenderField, {
|
|
45
45
|
CustomField: CustomField,
|
|
46
|
+
custom: custom,
|
|
46
47
|
disabled: disabled,
|
|
47
48
|
fieldComponentProps: fieldComponentProps,
|
|
48
49
|
indexPath: indexPath !== undefined ? `${indexPath}.${fieldIndex}` : `${fieldIndex}`,
|