@payloadcms/ui 3.0.0-beta.61 → 3.0.0-beta.63
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 +14 -0
- package/dist/elements/Banner/index.scss +4 -4
- package/dist/elements/Collapsible/index.scss +13 -47
- package/dist/elements/ErrorPill/index.scss +2 -14
- package/dist/elements/GenerateConfirmation/index.scss +1 -0
- package/dist/elements/Pill/index.scss +9 -21
- package/dist/elements/ReactSelect/index.scss +9 -2
- package/dist/elements/Status/index.scss +1 -0
- package/dist/elements/WhereBuilder/Condition/Relationship/index.scss +2 -2
- package/dist/exports/client/index.js +6 -6
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Checkbox/index.js +2 -1
- package/dist/fields/Checkbox/index.js.map +1 -1
- package/dist/fields/Checkbox/index.scss +2 -1
- package/dist/fields/Code/index.scss +3 -21
- package/dist/fields/Collapsible/index.scss +0 -4
- package/dist/fields/FieldError/index.scss +6 -5
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js +0 -5
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/JSON/index.scss +6 -25
- package/dist/fields/Point/index.js +5 -5
- package/dist/fields/Point/index.js.map +1 -1
- package/dist/fields/Point/index.scss +4 -0
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js +6 -5
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.scss +7 -0
- package/dist/fields/Relationship/index.scss +2 -2
- package/dist/fields/Select/Input.d.ts.map +1 -1
- package/dist/fields/Select/Input.js +0 -5
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js +1 -0
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\nimport type { CheckboxFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\nimport './index.scss'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldProps, CheckboxInput, type CheckboxInputProps }\n\nconst _CheckboxField: React.FC<CheckboxFieldProps> = (props) => {\n const {\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n checked: checkedFromProps,\n className,\n descriptionProps,\n disableFormData,\n errorProps,\n label,\n labelProps,\n onChange: onChangeFromProps,\n partialChecked,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n disableFormData,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onToggle = useCallback(() => {\n if (!disabled) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') onChangeFromProps(!value)\n }\n }, [onChangeFromProps, disabled, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomLabel={CustomLabel}\n checked={checked}\n id={fieldID}\n inputRef={null}\n label={label}\n labelProps={labelProps}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={disabled}\n required={required}\n />\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(_CheckboxField)\n"],"names":["React","useCallback","useFieldProps","useForm","useField","withCondition","useEditDepth","generateFieldID","FieldDescription","FieldError","fieldBaseClass","CheckboxInput","baseClass","_CheckboxField","props","id","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","checked","checkedFromProps","className","descriptionProps","disableFormData","errorProps","label","labelProps","onChange","onChangeFromProps","partialChecked","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","uuid","editDepth","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onToggle","Boolean","fieldID","div","filter","join","inputRef","undefined","CheckboxField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,eAA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,YAAYA,kBAAkB,CAACa;QAClE;IACF,GAAG;QAACb;QAAmBqB;QAAUF;QAAUN;KAAM;IAEjD,MAAMtB,UAAUC,oBAAoB+B,QAAQV;IAE5C,MAAMW,UAAUxC,MAAMR,gBAAgB0B,MAAMS,WAAWD;IAEvD,qBACE,MAACe;QACChC,WAAW;YACTd;YACAE;YACAuC,aAAa;YACb3B;YACAoB,SAAS,CAAC,EAAEhC,UAAU,SAAS,CAAC;YAChCwC,YAAY,CAAC,EAAExC,UAAU,WAAW,CAAC;SACtC,CACE6C,MAAM,CAACH,SACPI,IAAI,CAAC;QACRpB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAAC/B;gBAAWW,aAAaA;gBAAaa,MAAMA;gBAAO,GAAIN,cAAc,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\nimport type { CheckboxFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\nimport './index.scss'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldProps, CheckboxInput, type CheckboxInputProps }\n\nconst _CheckboxField: React.FC<CheckboxFieldProps> = (props) => {\n const {\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n checked: checkedFromProps,\n className,\n descriptionProps,\n disableFormData,\n errorProps,\n label,\n labelProps,\n onChange: onChangeFromProps,\n partialChecked,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n disableFormData,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onToggle = useCallback(() => {\n if (!disabled) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') onChangeFromProps(!value)\n }\n }, [onChangeFromProps, disabled, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} alignCaret=\"left\" />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomLabel={CustomLabel}\n checked={checked}\n id={fieldID}\n inputRef={null}\n label={label}\n labelProps={labelProps}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={disabled}\n required={required}\n />\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(_CheckboxField)\n"],"names":["React","useCallback","useFieldProps","useForm","useField","withCondition","useEditDepth","generateFieldID","FieldDescription","FieldError","fieldBaseClass","CheckboxInput","baseClass","_CheckboxField","props","id","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","checked","checkedFromProps","className","descriptionProps","disableFormData","errorProps","label","labelProps","onChange","onChangeFromProps","partialChecked","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","uuid","editDepth","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onToggle","Boolean","fieldID","div","filter","join","alignCaret","inputRef","undefined","CheckboxField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,QAAQ,aAAY;AAC1C,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,SAA6BD,aAAa,GAA2B;AAErE,MAAME,iBAA+C,CAACC;IACpD,MAAM,EACJC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAASC,gBAAgB,EACzBC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,UAAUC,iBAAiB,EAC3BC,cAAc,EACdC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAG1B;IAEJ,MAAM,EAAE2B,IAAI,EAAE,GAAGtC;IAEjB,MAAMuC,YAAYpC;IAElB,MAAMqC,mBAAmC1C,YACvC,CAAC2C,OAAOC;QACN,IAAI,OAAON,aAAa,YAAY;YAClC,OAAOA,SA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1C,kCAEA,KAACX;gBAAkB,GAAIiB,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMqC,gBAAgBzD,cAAcQ,gBAAe"}
|
|
@@ -10,27 +10,9 @@
|
|
|
10
10
|
.code-editor {
|
|
11
11
|
border-color: var(--theme-error-500);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
html[data-theme='light'] {
|
|
17
|
-
.code-field {
|
|
18
|
-
&.error {
|
|
19
|
-
.monaco-editor-background,
|
|
20
|
-
.margin {
|
|
21
|
-
background-color: var(--theme-error-50);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
html[data-theme='dark'] {
|
|
28
|
-
.code-field {
|
|
29
|
-
&.error {
|
|
30
|
-
.monaco-editor-background,
|
|
31
|
-
.margin {
|
|
32
|
-
background-color: var(--theme-error-100);
|
|
33
|
-
}
|
|
13
|
+
.monaco-editor-background,
|
|
14
|
+
.margin {
|
|
15
|
+
background-color: var(--theme-error-50);
|
|
34
16
|
}
|
|
35
17
|
}
|
|
36
18
|
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
font-family: var(--font-body);
|
|
5
5
|
left: auto;
|
|
6
6
|
max-width: 75%;
|
|
7
|
-
right:
|
|
8
|
-
transform:
|
|
9
|
-
|
|
7
|
+
right: 0;
|
|
8
|
+
transform: translateY(calc(var(--caret-size) * -1));
|
|
9
|
+
color: var(--theme-error-950);
|
|
10
|
+
background-color: var(--theme-error-300);
|
|
10
11
|
|
|
11
12
|
&::after {
|
|
12
|
-
border-top-color: var(--theme-error-
|
|
13
|
-
border-bottom-color: var(--theme-error-
|
|
13
|
+
border-top-color: var(--theme-error-300);
|
|
14
|
+
border-bottom-color: var(--theme-error-300);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/JSON/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAA2C,MAAM,OAAO,CAAA;AAO/D,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/JSON/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAA2C,MAAM,OAAO,CAAA;AAO/D,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AAwIjB,eAAO,MAAM,SAAS,0BAA4B,CAAA"}
|
|
@@ -94,11 +94,6 @@ const _JSONField = (props)=>{
|
|
|
94
94
|
required: required,
|
|
95
95
|
...labelProps || {}
|
|
96
96
|
}),
|
|
97
|
-
/*#__PURE__*/ _jsx(FieldError, {
|
|
98
|
-
CustomError: CustomError,
|
|
99
|
-
path: path,
|
|
100
|
-
...errorProps || {}
|
|
101
|
-
}),
|
|
102
97
|
/*#__PURE__*/ _jsxs("div", {
|
|
103
98
|
className: `${fieldBaseClass}__wrap`,
|
|
104
99
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/JSON/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate, JSONField as JSONFieldType } from 'payload'\n\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'json-field'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type JSONFieldProps = {\n editorOptions?: JSONFieldType['admin']['editorOptions']\n jsonSchema?: Record<string, unknown>\n name?: string\n path?: string\n width?: string\n} & FormFieldBase\n\nconst _JSONField: React.FC<JSONFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorOptions,\n errorProps,\n jsonSchema,\n label,\n labelProps,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const [stringValue, setStringValue] = useState<string>()\n const [jsonError, setJsonError] = useState<string>()\n const [hasLoadedValue, setHasLoadedValue] = useState(false)\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, jsonError, required })\n },\n [validate, required, jsonError],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, initialValue, path, setValue, showError, value } =\n useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const handleMount = useCallback(\n (editor, monaco) => {\n if (!jsonSchema) return\n\n const existingSchemas = monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas || []\n const modelUri = monaco.Uri.parse(jsonSchema.uri)\n\n const model = monaco.editor.createModel(JSON.stringify(value, null, 2), 'json', modelUri)\n monaco.languages.json.jsonDefaults.setDiagnosticsOptions({\n enableSchemaRequest: true,\n schemas: [...existingSchemas, jsonSchema],\n validate: true,\n })\n\n editor.setModel(model)\n },\n [jsonSchema, value],\n )\n\n const handleChange = useCallback(\n (val) => {\n if (disabled) return\n setStringValue(val)\n\n try {\n setValue(val ? JSON.parse(val) : null)\n setJsonError(undefined)\n } catch (e) {\n setValue(val ? val : null)\n setJsonError(e)\n }\n },\n [disabled, setValue, setStringValue],\n )\n\n useEffect(() => {\n if (hasLoadedValue || value === undefined) return\n\n setStringValue(\n value || initialValue ? JSON.stringify(value ? value : initialValue, null, 2) : '',\n )\n\n setHasLoadedValue(true)\n }, [initialValue, value, hasLoadedValue])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/JSON/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate, JSONField as JSONFieldType } from 'payload'\n\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'json-field'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type JSONFieldProps = {\n editorOptions?: JSONFieldType['admin']['editorOptions']\n jsonSchema?: Record<string, unknown>\n name?: string\n path?: string\n width?: string\n} & FormFieldBase\n\nconst _JSONField: React.FC<JSONFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorOptions,\n errorProps,\n jsonSchema,\n label,\n labelProps,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const [stringValue, setStringValue] = useState<string>()\n const [jsonError, setJsonError] = useState<string>()\n const [hasLoadedValue, setHasLoadedValue] = useState(false)\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, jsonError, required })\n },\n [validate, required, jsonError],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, initialValue, path, setValue, showError, value } =\n useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const handleMount = useCallback(\n (editor, monaco) => {\n if (!jsonSchema) return\n\n const existingSchemas = monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas || []\n const modelUri = monaco.Uri.parse(jsonSchema.uri)\n\n const model = monaco.editor.createModel(JSON.stringify(value, null, 2), 'json', modelUri)\n monaco.languages.json.jsonDefaults.setDiagnosticsOptions({\n enableSchemaRequest: true,\n schemas: [...existingSchemas, jsonSchema],\n validate: true,\n })\n\n editor.setModel(model)\n },\n [jsonSchema, value],\n )\n\n const handleChange = useCallback(\n (val) => {\n if (disabled) return\n setStringValue(val)\n\n try {\n setValue(val ? JSON.parse(val) : null)\n setJsonError(undefined)\n } catch (e) {\n setValue(val ? val : null)\n setJsonError(e)\n }\n },\n [disabled, setValue, setStringValue],\n )\n\n useEffect(() => {\n if (hasLoadedValue || value === undefined) return\n\n setStringValue(\n value || initialValue ? JSON.stringify(value ? value : initialValue, null, 2) : '',\n )\n\n setHasLoadedValue(true)\n }, [initialValue, value, hasLoadedValue])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <CodeEditor\n defaultLanguage=\"json\"\n onChange={handleChange}\n onMount={handleMount}\n options={editorOptions}\n readOnly={disabled}\n value={stringValue}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const JSONField = withCondition(_JSONField)\n"],"names":["React","useCallback","useEffect","useState","CodeEditor","useField","withCondition","FieldLabel","fieldBaseClass","baseClass","useFieldProps","FieldDescription","FieldError","_JSONField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","editorOptions","errorProps","jsonSchema","label","labelProps","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","stringValue","setStringValue","jsonError","setJsonError","hasLoadedValue","setHasLoadedValue","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","initialValue","setValue","showError","disabled","handleMount","editor","monaco","existingSchemas","languages","json","jsonDefaults","diagnosticsOptions","schemas","modelUri","Uri","parse","uri","model","createModel","JSON","stringify","setDiagnosticsOptions","enableSchemaRequest","setModel","handleChange","val","undefined","e","div","filter","Boolean","join","defaultLanguage","onChange","onMount","JSONField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE/D,SAASC,UAAU,QAAQ,qCAAoC;AAC/D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAIlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AAUnD,MAAMC,aAAuC,CAACC;IAC5C,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGrB;IAEJ,MAAM,CAACsB,aAAaC,eAAe,GAAGlC;IACtC,MAAM,CAACmC,WAAWC,aAAa,GAAGpC;IAClC,MAAM,CAACqC,gBAAgBC,kBAAkB,GAAGtC,SAAS;IAErD,MAAMuC,mBAAmCzC,YACvC,CAAC0C,OAAOC;QACN,IAAI,OAAOV,aAAa,YACtB,OAAOA,SAASS,OAAO;YAAE,GAAGC,OAAO;YAAEN;YAAWN;QAAS;IAC7D,GACA;QAACE;QAAUF;QAAUM;KAAU;IAGjC,MAAM,EAAEV,MAAMiB,eAAe,EAAEf,UAAUgB,mBAAmB,EAAE,GAAGpC;IAEjE,MAAM,EAAEqC,gBAAgB,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AW;YACTb;YACAC;YACAY;YACA8B,aAAa;YACbC,YAAY;SACb,CACE0B,MAAM,CAACC,SACPC,IAAI,CAAC;QACR/C,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAAC5B;gBACCa,aAAaA;gBACbM,OAAOA;gBACPM,UAAUA;gBACT,GAAIL,cAAc,CAAC,CAAC;;0BAEvB,MAACkD;gBAAIxD,WAAW,CAAC,EAAEb,eAAe,MAAM,CAAC;;kCACvC,KAACI;wBAAWO,aAAaA;wBAAaS,MAAMA;wBAAO,GAAIJ,cAAc,CAAC,CAAC;;oBACtEP;kCACD,KAACb;wBACC6E,iBAAgB;wBAChBC,UAAUT;wBACVU,SAAS9B;wBACTT,SAASrB;wBACTO,UAAUsB;wBACVT,OAAOP;;oBAERpB;;;YAEFE,sBAAsByD,YACrBzD,kCAEA,KAACP;gBAAkB,GAAIW,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAM8D,YAAY9E,cAAcO,YAAW"}
|
|
@@ -2,34 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
.json-field {
|
|
4
4
|
position: relative;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
html[data-theme='light'] {
|
|
8
|
-
.json-field {
|
|
9
|
-
&.error {
|
|
10
|
-
.code-editor {
|
|
11
|
-
border-color: var(--theme-error-500);
|
|
12
|
-
}
|
|
13
5
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
6
|
+
&.error {
|
|
7
|
+
.code-editor {
|
|
8
|
+
border-color: var(--theme-error-500);
|
|
18
9
|
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
html[data-theme='dark'] {
|
|
23
|
-
.json-field {
|
|
24
|
-
&.error {
|
|
25
|
-
.code-editor {
|
|
26
|
-
border-color: var(--theme-error-500);
|
|
27
|
-
}
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
11
|
+
.monaco-editor-background,
|
|
12
|
+
.margin {
|
|
13
|
+
background-color: var(--theme-error-50);
|
|
33
14
|
}
|
|
34
15
|
}
|
|
35
16
|
}
|
|
@@ -70,11 +70,6 @@ export const _PointField = (props)=>{
|
|
|
70
70
|
width
|
|
71
71
|
},
|
|
72
72
|
children: [
|
|
73
|
-
/*#__PURE__*/ _jsx(FieldError, {
|
|
74
|
-
CustomError: CustomError,
|
|
75
|
-
path: path,
|
|
76
|
-
...errorProps || {}
|
|
77
|
-
}),
|
|
78
73
|
/*#__PURE__*/ _jsxs("ul", {
|
|
79
74
|
className: `${baseClass}__wrap`,
|
|
80
75
|
children: [
|
|
@@ -110,6 +105,11 @@ export const _PointField = (props)=>{
|
|
|
110
105
|
/*#__PURE__*/ _jsxs("div", {
|
|
111
106
|
className: "input-wrapper",
|
|
112
107
|
children: [
|
|
108
|
+
/*#__PURE__*/ _jsx(FieldError, {
|
|
109
|
+
CustomError: CustomError,
|
|
110
|
+
path: path,
|
|
111
|
+
...errorProps || {}
|
|
112
|
+
}),
|
|
113
113
|
BeforeInput,
|
|
114
114
|
/*#__PURE__*/ _jsx("input", {
|
|
115
115
|
disabled: readOnly,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Point/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\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\nconst baseClass = 'point'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\n\nexport type PointFieldProps = {\n name?: string\n path?: string\n placeholder?: string\n step?: number\n width?: string\n} & FormFieldBase\n\nexport const _PointField: React.FC<PointFieldProps> = (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 path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n step,\n style,\n validate,\n width,\n } = props\n\n const { i18n, t } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const {\n path,\n setValue,\n showError,\n value = [null, null],\n } = useField<[number, number]>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const handleChange = useCallback(\n (e, index: 0 | 1) => {\n let val = parseFloat(e.target.value)\n if (Number.isNaN(val)) {\n val = e.target.value\n }\n const coordinates = [...value]\n coordinates[index] = val\n setValue(coordinates)\n },\n [setValue, value],\n )\n\n const getCoordinateFieldLabel = (type: 'latitude' | 'longitude') => {\n const suffix = type === 'longitude' ? t('fields:longitude') : t('fields:latitude')\n const fieldLabel = label ? getTranslation(label, i18n) : ''\n\n return {\n ...labelProps,\n label: `${fieldLabel}${fieldLabel ? ' - ' : ''}${suffix}`,\n }\n }\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Point/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\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\nconst baseClass = 'point'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\n\nexport type PointFieldProps = {\n name?: string\n path?: string\n placeholder?: string\n step?: number\n width?: string\n} & FormFieldBase\n\nexport const _PointField: React.FC<PointFieldProps> = (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 path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n step,\n style,\n validate,\n width,\n } = props\n\n const { i18n, t } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const {\n path,\n setValue,\n showError,\n value = [null, null],\n } = useField<[number, number]>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const handleChange = useCallback(\n (e, index: 0 | 1) => {\n let val = parseFloat(e.target.value)\n if (Number.isNaN(val)) {\n val = e.target.value\n }\n const coordinates = [...value]\n coordinates[index] = val\n setValue(coordinates)\n },\n [setValue, value],\n )\n\n const getCoordinateFieldLabel = (type: 'latitude' | 'longitude') => {\n const suffix = type === 'longitude' ? t('fields:longitude') : t('fields:latitude')\n const fieldLabel = label ? getTranslation(label, i18n) : ''\n\n return {\n ...labelProps,\n label: `${fieldLabel}${fieldLabel ? ' - ' : ''}${suffix}`,\n }\n }\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <ul className={`${baseClass}__wrap`}>\n <li>\n {CustomLabel !== undefined ? (\n CustomLabel\n ) : (\n <FieldLabel {...getCoordinateFieldLabel('longitude')} />\n )}\n <div className=\"input-wrapper\">\n {BeforeInput}\n <input\n disabled={readOnly}\n id={`field-longitude-${path.replace(/\\./g, '__')}`}\n name={`${path}.longitude`}\n onChange={(e) => handleChange(e, 0)}\n placeholder={getTranslation(placeholder, i18n)}\n step={step}\n type=\"number\"\n value={value && typeof value[0] === 'number' ? value[0] : ''}\n />\n {AfterInput}\n </div>\n </li>\n <li>\n {CustomLabel !== undefined ? (\n CustomLabel\n ) : (\n <FieldLabel {...getCoordinateFieldLabel('latitude')} />\n )}\n <div className=\"input-wrapper\">\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <input\n disabled={readOnly}\n id={`field-latitude-${path.replace(/\\./g, '__')}`}\n name={`${path}.latitude`}\n onChange={(e) => handleChange(e, 1)}\n placeholder={getTranslation(placeholder, i18n)}\n step={step}\n type=\"number\"\n value={value && typeof value[1] === 'number' ? value[1] : ''}\n />\n {AfterInput}\n </div>\n </li>\n </ul>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const PointField = withCondition(_PointField)\n"],"names":["getTranslation","React","useCallback","useField","withCondition","useTranslation","fieldBaseClass","baseClass","useFieldProps","FieldDescription","FieldError","FieldLabel","_PointField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","step","style","validate","width","i18n","t","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","setValue","showError","handleChange","e","index","val","parseFloat","target","Number","isNaN","coordinates","getCoordinateFieldLabel","type","suffix","fieldLabel","div","filter","Boolean","join","ul","li","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C,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AAEjB,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/RadioGroup/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,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,GAAG,aAAa,CAAA;AAEjB,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;AA6HrD,eAAO,MAAM,eAAe,2BAAkC,CAAA"}
|
|
@@ -48,6 +48,12 @@ const _RadioGroupField = (props)=>{
|
|
|
48
48
|
width
|
|
49
49
|
},
|
|
50
50
|
children: [
|
|
51
|
+
/*#__PURE__*/ _jsx(FieldError, {
|
|
52
|
+
CustomError: CustomError,
|
|
53
|
+
path: path,
|
|
54
|
+
...errorProps || {},
|
|
55
|
+
alignCaret: "left"
|
|
56
|
+
}),
|
|
51
57
|
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
52
58
|
CustomLabel: CustomLabel,
|
|
53
59
|
label: label,
|
|
@@ -57,11 +63,6 @@ const _RadioGroupField = (props)=>{
|
|
|
57
63
|
/*#__PURE__*/ _jsxs("div", {
|
|
58
64
|
className: `${fieldBaseClass}__wrap`,
|
|
59
65
|
children: [
|
|
60
|
-
/*#__PURE__*/ _jsx(FieldError, {
|
|
61
|
-
CustomError: CustomError,
|
|
62
|
-
path: path,
|
|
63
|
-
...errorProps || {}
|
|
64
|
-
}),
|
|
65
66
|
/*#__PURE__*/ _jsx("ul", {
|
|
66
67
|
className: `${baseClass}--group`,
|
|
67
68
|
id: `field-${path.replace(/\./g, '__')}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/RadioGroup/index.tsx"],"sourcesContent":["'use client'\nimport type { Option } from 'payload'\n\nimport { optionIsObject } from 'payload/shared'\nimport React, { useCallback } from 'react'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { Radio } from './Radio/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-group'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type RadioFieldProps = {\n layout?: 'horizontal' | 'vertical'\n name?: string\n onChange?: OnChange\n options?: Option[]\n path?: string\n value?: string\n width?: string\n} & FormFieldBase\n\nexport type OnChange<T = string> = (value: T) => void\n\nconst _RadioGroupField: React.FC<RadioFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n layout = 'horizontal',\n onChange: onChangeFromProps,\n options = [],\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n value: valueFromProps,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function')\n return validate(value, { ...validationOptions, options, required })\n },\n [validate, options, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const {\n formInitializing,\n formProcessing,\n path,\n setValue,\n showError,\n value: valueFromContext,\n } = useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const value = valueFromContext || valueFromProps\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n `${baseClass}--layout-${layout}`,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/RadioGroup/index.tsx"],"sourcesContent":["'use client'\nimport type { Option } from 'payload'\n\nimport { optionIsObject } from 'payload/shared'\nimport React, { useCallback } from 'react'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { Radio } from './Radio/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-group'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type RadioFieldProps = {\n layout?: 'horizontal' | 'vertical'\n name?: string\n onChange?: OnChange\n options?: Option[]\n path?: string\n value?: string\n width?: string\n} & FormFieldBase\n\nexport type OnChange<T = string> = (value: T) => void\n\nconst _RadioGroupField: React.FC<RadioFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n layout = 'horizontal',\n onChange: onChangeFromProps,\n options = [],\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n value: valueFromProps,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function')\n return validate(value, { ...validationOptions, options, required })\n },\n [validate, options, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const {\n formInitializing,\n formProcessing,\n path,\n setValue,\n showError,\n value: valueFromContext,\n } = useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const value = valueFromContext || valueFromProps\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n `${baseClass}--layout-${layout}`,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} alignCaret=\"left\" />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <ul className={`${baseClass}--group`} id={`field-${path.replace(/\\./g, '__')}`}>\n {options.map((option) => {\n let optionValue = ''\n\n if (optionIsObject(option)) {\n optionValue = option.value\n } else {\n optionValue = option\n }\n\n const isSelected = String(optionValue) === String(value)\n\n const id = `field-${path}-${optionValue}${uuid ? `-${uuid}` : ''}`\n\n return (\n <li key={`${path} - ${optionValue}`}>\n <Radio\n id={id}\n isSelected={isSelected}\n onChange={() => {\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(optionValue)\n }\n\n if (!disabled) {\n setValue(optionValue)\n }\n }}\n option={optionIsObject(option) ? option : { label: option, value: option }}\n path={path}\n readOnly={disabled}\n uuid={uuid}\n />\n </li>\n )\n })}\n </ul>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n </div>\n )\n}\n\nexport const RadioGroupField = withCondition(_RadioGroupField)\n"],"names":["optionIsObject","React","useCallback","useForm","useField","withCondition","FieldLabel","fieldBaseClass","Radio","baseClass","useFieldProps","FieldDescription","FieldError","_RadioGroupField","props","name","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","layout","onChange","onChangeFromProps","options","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","value","valueFromProps","width","uuid","memoizedValidate","validationOptions","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","valueFromContext","disabled","div","filter","Boolean","join","alignCaret","ul","id","replace","map","option","optionValue","isSelected","String","li","undefined","RadioGroupField"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAE1C,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,KAAK,QAAQ,mBAAkB;AACxC,OAAO,eAAc;AAErB,MAAMC,YAAY;AAIlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AAcnD,MAAMC,mBAA8C,CAACC;IACnD,MAAM,EACJC,IAAI,EACJC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,SAAS,YAAY,E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C+C;wBAAGnC,WAAW,CAAC,EAAEV,UAAU,OAAO,CAAC;wBAAE8C,IAAI,CAAC,MAAM,EAAE3B,KAAK4B,OAAO,CAAC,OAAO,MAAM,CAAC;kCAC3E7B,QAAQ8B,GAAG,CAAC,CAACC;4BACZ,IAAIC,cAAc;4BAElB,IAAI3D,eAAe0D,SAAS;gCAC1BC,cAAcD,OAAOvB,KAAK;4BAC5B,OAAO;gCACLwB,cAAcD;4BAChB;4BAEA,MAAME,aAAaC,OAAOF,iBAAiBE,OAAO1B;4BAElD,MAAMoB,KAAK,CAAC,MAAM,EAAE3B,KAAK,CAAC,EAAE+B,YAAY,EAAErB,OAAO,CAAC,CAAC,EAAEA,KAAK,CAAC,GAAG,GAAG,CAAC;4BAElE,qBACE,KAACwB;0CACC,cAAA,KAACtD;oCACC+C,IAAIA;oCACJK,YAAYA;oCACZnC,UAAU;wCACR,IAAI,OAAOC,sBAAsB,YAAY;4CAC3CA,kBAAkBiC;wCACpB;wCAEA,IAAI,CAACX,UAAU;4CACbH,SAASc;wCACX;oCACF;oCACAD,QAAQ1D,eAAe0D,UAAUA,SAAS;wCAAEpC,OAAOoC;wCAAQvB,OAAOuB;oCAAO;oCACzE9B,MAAMA;oCACNE,UAAUkB;oCACVV,MAAMA;;+BAhBD,CAAC,EAAEV,KAAK,GAAG,EAAE+B,YAAY,CAAC;wBAoBvC;;oBAED3C,sBAAsB+C,YACrB/C,kCAEA,KAACL;wBAAkB,GAAIS,oBAAoB,CAAC,CAAC;;;;;;AAKvD;AAEA,OAAO,MAAM4C,kBAAkB3D,cAAcQ,kBAAiB"}
|
|
@@ -33,7 +33,7 @@ html[data-theme='light'] {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
button {
|
|
36
|
+
button.relationship-add-new__add-button {
|
|
37
37
|
@include lightInputError;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -49,7 +49,7 @@ html[data-theme='dark'] {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
button {
|
|
52
|
+
button.relationship-add-new__add-button {
|
|
53
53
|
@include darkInputError;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/fields/Select/Input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQlD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1B,GAAG,IAAI,CACN,gBAAgB,EACd,QAAQ,GACR,UAAU,GACV,gBAAgB,GAChB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,SAAS,GACT,KAAK,GACL,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,CACV,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/fields/Select/Input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQlD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1B,GAAG,IAAI,CACN,gBAAgB,EACd,QAAQ,GACR,UAAU,GACV,gBAAgB,GAChB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,SAAS,GACT,KAAK,GACL,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,CACV,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8FlD,CAAA"}
|
|
@@ -48,11 +48,6 @@ export const SelectInput = (props)=>{
|
|
|
48
48
|
required: required,
|
|
49
49
|
...labelProps || {}
|
|
50
50
|
}),
|
|
51
|
-
/*#__PURE__*/ _jsx(FieldError, {
|
|
52
|
-
CustomError: CustomError,
|
|
53
|
-
path: path,
|
|
54
|
-
...errorProps || {}
|
|
55
|
-
}),
|
|
56
51
|
/*#__PURE__*/ _jsxs("div", {
|
|
57
52
|
className: `${fieldBaseClass}__wrap`,
|
|
58
53
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Select/Input.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { ReactSelectAdapterProps } from '../../elements/ReactSelect/types.js'\nimport type { SelectFieldProps } from './index.js'\n\nimport { ReactSelect } from '../../elements/ReactSelect/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type SelectInputProps = {\n onChange?: ReactSelectAdapterProps['onChange']\n options?: OptionObject[]\n showError?: boolean\n value?: string | string[]\n} & Omit<\n SelectFieldProps,\n | 'custom'\n | 'disabled'\n | 'docPreferences'\n | 'locale'\n | 'localized'\n | 'onChange'\n | 'options'\n | 'rtl'\n | 'type'\n | 'user'\n | 'validate'\n | 'value'\n>\n\nexport const SelectInput: React.FC<SelectInputProps> = (props) => {\n const {\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,\n options,\n path,\n readOnly,\n required,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n } = useTranslation()\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 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 <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Select/Input.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { ReactSelectAdapterProps } from '../../elements/ReactSelect/types.js'\nimport type { SelectFieldProps } from './index.js'\n\nimport { ReactSelect } from '../../elements/ReactSelect/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type SelectInputProps = {\n onChange?: ReactSelectAdapterProps['onChange']\n options?: OptionObject[]\n showError?: boolean\n value?: string | string[]\n} & Omit<\n SelectFieldProps,\n | 'custom'\n | 'disabled'\n | 'docPreferences'\n | 'locale'\n | 'localized'\n | 'onChange'\n | 'options'\n | 'rtl'\n | 'type'\n | 'user'\n | 'validate'\n | 'value'\n>\n\nexport const SelectInput: React.FC<SelectInputProps> = (props) => {\n const {\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,\n options,\n path,\n readOnly,\n required,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n } = useTranslation()\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 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 <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\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"],"names":["getTranslation","React","ReactSelect","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","SelectInput","props","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","isClearable","isSortable","label","labelProps","onChange","options","path","readOnly","required","showError","style","value","width","i18n","valueToRender","Array","isArray","map","val","matchingOption","find","option","div","filter","Boolean","join","id","replace","disabled","isMulti","undefined"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAKzB,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAuBrB,OAAO,MAAMC,cAA0C,CAACC;IACtD,MAAM,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,EACjBC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,OAAO,EACPC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACN,GAAGtB;IAEJ,MAAM,EAAEuB,IAAI,EAAE,GAAG7B;IAEjB,IAAI8B;IAEJ,IAAIf,WAAWgB,MAAMC,OAAO,CAACL,QAAQ;QACnCG,gB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IY,oBAAoB,CAAC,CAAC;;;;AAIrD,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAGV,KAAK,EAEL,aAAa,EAGb,eAAe,EAChB,MAAM,SAAS,CAAA;AA2BhB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAkBnB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,+BAA+B,CAAA;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAG,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAGV,KAAK,EAEL,aAAa,EAGb,eAAe,EAChB,MAAM,SAAS,CAAA;AA2BhB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAkBnB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,+BAA+B,CAAA;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAG,QA+uBH,CAAA"}
|
|
@@ -421,6 +421,7 @@ export const mapFields = (args)=>{
|
|
|
421
421
|
name: field.name,
|
|
422
422
|
className: field.admin?.className,
|
|
423
423
|
disabled: field.admin?.disabled,
|
|
424
|
+
layout: field.admin?.layout,
|
|
424
425
|
options: fieldOptions,
|
|
425
426
|
readOnly: field.admin?.readOnly,
|
|
426
427
|
required: field.required,
|