@payloadcms/ui 3.0.0-beta.103 → 3.0.0-beta.105
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/DeleteDocument/index.d.ts +9 -6
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +40 -8
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.d.ts +8 -0
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +26 -8
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +97 -35
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts +5 -0
- package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/types.js.map +1 -1
- package/dist/elements/Drawer/index.d.ts +1 -0
- package/dist/elements/Drawer/index.d.ts.map +1 -1
- package/dist/elements/Drawer/index.js +2 -2
- package/dist/elements/Drawer/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts +6 -3
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +101 -151
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +4 -2
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/SelectRow/index.js +29 -20
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Blocks/index.d.ts +2 -2
- package/dist/elements/Table/DefaultCell/fields/Blocks/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Blocks/index.js.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.js +0 -1
- package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
- package/dist/elements/WhereBuilder/reduceClientFields.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/reduceClientFields.js +3 -1
- package/dist/elements/WhereBuilder/reduceClientFields.js.map +1 -1
- package/dist/exports/client/index.js +19 -19
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +6 -3
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +2 -2
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts +5 -5
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +0 -3
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.js +1 -1
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.scss +13 -0
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js +31 -36
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts +141 -4
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js +48 -41
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/DateTime/index.d.ts.map +1 -1
- package/dist/fields/DateTime/index.js +32 -37
- package/dist/fields/DateTime/index.js.map +1 -1
- package/dist/fields/Email/index.d.ts.map +1 -1
- package/dist/fields/Email/index.js +28 -32
- package/dist/fields/Email/index.js.map +1 -1
- package/dist/fields/FieldLabel/index.d.ts.map +1 -1
- package/dist/fields/FieldLabel/index.js +7 -1
- package/dist/fields/FieldLabel/index.js.map +1 -1
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js +0 -2
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/Number/index.d.ts.map +1 -1
- package/dist/fields/Number/index.js +35 -40
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Password/types.d.ts +2 -2
- package/dist/fields/Password/types.d.ts.map +1 -1
- package/dist/fields/Password/types.js.map +1 -1
- package/dist/fields/Point/index.d.ts.map +1 -1
- package/dist/fields/Point/index.js +1 -0
- package/dist/fields/Point/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js +34 -39
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/index.d.ts +4 -4
- package/dist/fields/Relationship/index.d.ts.map +1 -1
- package/dist/fields/Relationship/index.js +64 -19
- package/dist/fields/Relationship/index.js.map +1 -1
- package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
- package/dist/fields/Relationship/optionsReducer.js +17 -0
- package/dist/fields/Relationship/optionsReducer.js.map +1 -1
- package/dist/fields/Relationship/types.d.ts +11 -4
- package/dist/fields/Relationship/types.d.ts.map +1 -1
- package/dist/fields/Relationship/types.js.map +1 -1
- package/dist/fields/Row/index.scss +12 -2
- package/dist/fields/Select/Input.d.ts +2 -2
- package/dist/fields/Select/Input.d.ts.map +1 -1
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js +0 -2
- 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 +0 -2
- package/dist/fields/Text/index.js.map +1 -1
- package/dist/fields/Text/types.d.ts +2 -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 +0 -2
- package/dist/fields/Textarea/index.js.map +1 -1
- package/dist/fields/Textarea/types.d.ts +2 -2
- package/dist/fields/Textarea/types.d.ts.map +1 -1
- package/dist/fields/Textarea/types.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts +2 -2
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +11 -12
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js +14 -17
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/providers/Config/createClientConfig/fields.d.ts.map +1 -1
- package/dist/providers/Config/createClientConfig/fields.js +31 -11
- package/dist/providers/Config/createClientConfig/fields.js.map +1 -1
- package/dist/providers/DocumentInfo/index.d.ts +1 -1
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/DocumentInfo/types.d.ts +18 -1
- package/dist/providers/DocumentInfo/types.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/types.js.map +1 -1
- package/dist/providers/Selection/index.d.ts +1 -1
- package/dist/providers/Selection/index.d.ts.map +1 -1
- package/dist/providers/Selection/index.js +43 -29
- package/dist/providers/Selection/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -6
|
@@ -17,7 +17,7 @@ import { RenderComponent } from '../../providers/Config/RenderComponent.js';
|
|
|
17
17
|
import { FieldDescription } from '../FieldDescription/index.js';
|
|
18
18
|
import { FieldError } from '../FieldError/index.js';
|
|
19
19
|
const DateTimeFieldComponent = props => {
|
|
20
|
-
const $ = _c(
|
|
20
|
+
const $ = _c(37);
|
|
21
21
|
const {
|
|
22
22
|
descriptionProps,
|
|
23
23
|
errorProps,
|
|
@@ -31,7 +31,6 @@ const DateTimeFieldComponent = props => {
|
|
|
31
31
|
name,
|
|
32
32
|
_path: pathFromProps,
|
|
33
33
|
admin: t1,
|
|
34
|
-
label,
|
|
35
34
|
required
|
|
36
35
|
} = t0;
|
|
37
36
|
let t2;
|
|
@@ -112,43 +111,43 @@ const DateTimeFieldComponent = props => {
|
|
|
112
111
|
}
|
|
113
112
|
const t9 = t8.join(" ");
|
|
114
113
|
let t10;
|
|
115
|
-
if ($[12] !== style || $[13] !== width || $[14] !== field || $[15] !== labelProps || $[16] !==
|
|
114
|
+
if ($[12] !== style || $[13] !== width || $[14] !== field || $[15] !== labelProps || $[16] !== path || $[17] !== errorProps || $[18] !== disabled || $[19] !== setValue || $[20] !== placeholder || $[21] !== i18n || $[22] !== datePickerProps || $[23] !== value_0 || $[24] !== descriptionProps || $[25] !== description || $[26] !== t9) {
|
|
116
115
|
let t11;
|
|
117
|
-
if ($[
|
|
116
|
+
if ($[28] !== labelProps) {
|
|
118
117
|
t11 = labelProps || {};
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
118
|
+
$[28] = labelProps;
|
|
119
|
+
$[29] = t11;
|
|
121
120
|
} else {
|
|
122
|
-
t11 = $[
|
|
121
|
+
t11 = $[29];
|
|
123
122
|
}
|
|
124
123
|
let t12;
|
|
125
|
-
if ($[
|
|
124
|
+
if ($[30] !== errorProps) {
|
|
126
125
|
t12 = errorProps || {};
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
126
|
+
$[30] = errorProps;
|
|
127
|
+
$[31] = t12;
|
|
129
128
|
} else {
|
|
130
|
-
t12 = $[
|
|
129
|
+
t12 = $[31];
|
|
131
130
|
}
|
|
132
131
|
let t13;
|
|
133
|
-
if ($[
|
|
132
|
+
if ($[32] !== disabled || $[33] !== setValue) {
|
|
134
133
|
t13 = incomingDate => {
|
|
135
134
|
if (!disabled) {
|
|
136
135
|
setValue(incomingDate?.toISOString() || null);
|
|
137
136
|
}
|
|
138
137
|
};
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
138
|
+
$[32] = disabled;
|
|
139
|
+
$[33] = setValue;
|
|
140
|
+
$[34] = t13;
|
|
142
141
|
} else {
|
|
143
|
-
t13 = $[
|
|
142
|
+
t13 = $[34];
|
|
144
143
|
}
|
|
145
144
|
let t14;
|
|
146
|
-
if ($[
|
|
145
|
+
if ($[35] !== descriptionProps) {
|
|
147
146
|
t14 = descriptionProps || {};
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
147
|
+
$[35] = descriptionProps;
|
|
148
|
+
$[36] = t14;
|
|
150
149
|
} else {
|
|
151
|
-
t14 = $[
|
|
150
|
+
t14 = $[36];
|
|
152
151
|
}
|
|
153
152
|
t10 = _jsxs("div", {
|
|
154
153
|
className: t9,
|
|
@@ -159,8 +158,6 @@ const DateTimeFieldComponent = props => {
|
|
|
159
158
|
children: [_jsx(FieldLabel, {
|
|
160
159
|
field,
|
|
161
160
|
Label: field?.admin?.components?.Label,
|
|
162
|
-
label,
|
|
163
|
-
required,
|
|
164
161
|
...t11
|
|
165
162
|
}), _jsxs("div", {
|
|
166
163
|
className: `${fieldBaseClass}__wrap`,
|
|
@@ -192,22 +189,20 @@ const DateTimeFieldComponent = props => {
|
|
|
192
189
|
$[13] = width;
|
|
193
190
|
$[14] = field;
|
|
194
191
|
$[15] = labelProps;
|
|
195
|
-
$[16] =
|
|
196
|
-
$[17] =
|
|
197
|
-
$[18] =
|
|
198
|
-
$[19] =
|
|
199
|
-
$[20] =
|
|
200
|
-
$[21] =
|
|
201
|
-
$[22] =
|
|
202
|
-
$[23] =
|
|
203
|
-
$[24] =
|
|
204
|
-
$[25] =
|
|
205
|
-
$[26] =
|
|
206
|
-
$[27] =
|
|
207
|
-
$[28] = t9;
|
|
208
|
-
$[29] = t10;
|
|
192
|
+
$[16] = path;
|
|
193
|
+
$[17] = errorProps;
|
|
194
|
+
$[18] = disabled;
|
|
195
|
+
$[19] = setValue;
|
|
196
|
+
$[20] = placeholder;
|
|
197
|
+
$[21] = i18n;
|
|
198
|
+
$[22] = datePickerProps;
|
|
199
|
+
$[23] = value_0;
|
|
200
|
+
$[24] = descriptionProps;
|
|
201
|
+
$[25] = description;
|
|
202
|
+
$[26] = t9;
|
|
203
|
+
$[27] = t10;
|
|
209
204
|
} else {
|
|
210
|
-
t10 = $[
|
|
205
|
+
t10 = $[27];
|
|
211
206
|
}
|
|
212
207
|
return t10;
|
|
213
208
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","DatePickerField","useField","useTranslation","FieldLabel","fieldBaseClass","baseClass","useFieldProps","withCondition","RenderComponent","FieldDescription","FieldError","DateTimeFieldComponent","props","$","descriptionProps","errorProps","field","t0","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","DatePickerField","useField","useTranslation","FieldLabel","fieldBaseClass","baseClass","useFieldProps","withCondition","RenderComponent","FieldDescription","FieldError","DateTimeFieldComponent","props","$","descriptionProps","errorProps","field","t0","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t1","required","t2","undefined","className","date","datePickerProps","description","placeholder","readOnlyFromAdmin","style","width","readOnlyFromProps","i18n","t3","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t4","t5","formInitializing","formProcessing","setValue","showError","value_0","disabled","t6","t7","t8","filter","Boolean","t9","join","t10","t11","t12","t13","incomingDate","toISOString","t14","_jsxs","children","_jsx","Label","components","id","replace","CustomError","Error","mappedComponent","beforeInput","onChange","afterInput","Description","DateTimeField"],"sources":["../../../src/fields/DateTime/index.tsx"],"sourcesContent":["'use client'\nimport type { DateFieldClientComponent, DateFieldValidation } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { DatePickerField } from '../../elements/DatePicker/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'date-time-field'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nconst DateTimeFieldComponent: DateFieldClientComponent = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n date: datePickerProps,\n description,\n placeholder,\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n label,\n required,\n },\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: DateFieldValidation = 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<Date>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && `${baseClass}--has-error`,\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel field={field} Label={field?.admin?.components?.Label} {...(labelProps || {})} />\n <div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\\./g, '__')}`}>\n <FieldError\n CustomError={field?.admin?.components?.Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.beforeInput} />\n <DatePickerField\n {...datePickerProps}\n onChange={(incomingDate) => {\n if (!disabled) {\n setValue(incomingDate?.toISOString() || null)\n }\n }}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n value={value}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.afterInput} />\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n field={field}\n {...(descri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;QAAA,C,GAET8B,IAAA,CAAA/D,eAAA;UAAAsE,eAAA,EAAkC9D,KAAA,EAAAS,KAAA,EAAAgD,UAAA,EAAAQ;QAAA,C;UAEpCV,IAAA,CAAA9D,gBAAA;QAAAyE,WAAA,EACelE,KAAA,EAAAS,KAAA,EAAAgD,UAAA,EAAAS,WAAA;QAAAjD,WAAA;QAAAjB,KAAA;QAAA,GAGRoD;MAAsB,C;;;;;;;;;;;;;;;;;;;;;SAzC/BN,G;CA6CJ;AAEA,OAAO,MAAMqB,aAAA,GAAgB5E,aAAA,CAAcI,sBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAsB,MAAM,OAAO,CAAA;AAW1C,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAsB,MAAM,OAAO,CAAA;AAW1C,OAAO,cAAc,CAAA;AA8FrB,eAAO,MAAM,UAAU;;;;;;;;oCAAqC,CAAA"}
|
|
@@ -15,7 +15,7 @@ import { FieldLabel } from '../FieldLabel/index.js';
|
|
|
15
15
|
import { fieldBaseClass } from '../shared/index.js';
|
|
16
16
|
import './index.scss';
|
|
17
17
|
const EmailFieldComponent = props => {
|
|
18
|
-
const $ = _c(
|
|
18
|
+
const $ = _c(37);
|
|
19
19
|
const {
|
|
20
20
|
autoComplete,
|
|
21
21
|
descriptionProps,
|
|
@@ -38,7 +38,6 @@ const EmailFieldComponent = props => {
|
|
|
38
38
|
name,
|
|
39
39
|
_path: pathFromProps,
|
|
40
40
|
admin: t2,
|
|
41
|
-
label,
|
|
42
41
|
required
|
|
43
42
|
} = t1;
|
|
44
43
|
let t3;
|
|
@@ -118,30 +117,30 @@ const EmailFieldComponent = props => {
|
|
|
118
117
|
}
|
|
119
118
|
const t10 = t9.join(" ");
|
|
120
119
|
let t11;
|
|
121
|
-
if ($[14] !== style || $[15] !== width || $[16] !== field || $[17] !== labelProps || $[18] !==
|
|
120
|
+
if ($[14] !== style || $[15] !== width || $[16] !== field || $[17] !== labelProps || $[18] !== errorProps || $[19] !== path || $[20] !== placeholder || $[21] !== i18n || $[22] !== value_0 || $[23] !== autoComplete || $[24] !== disabled || $[25] !== setValue || $[26] !== required || $[27] !== descriptionProps || $[28] !== description || $[29] !== t10) {
|
|
122
121
|
let t12;
|
|
123
|
-
if ($[
|
|
122
|
+
if ($[31] !== labelProps) {
|
|
124
123
|
t12 = labelProps || {};
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
124
|
+
$[31] = labelProps;
|
|
125
|
+
$[32] = t12;
|
|
127
126
|
} else {
|
|
128
|
-
t12 = $[
|
|
127
|
+
t12 = $[32];
|
|
129
128
|
}
|
|
130
129
|
let t13;
|
|
131
|
-
if ($[
|
|
130
|
+
if ($[33] !== errorProps) {
|
|
132
131
|
t13 = errorProps || {};
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
132
|
+
$[33] = errorProps;
|
|
133
|
+
$[34] = t13;
|
|
135
134
|
} else {
|
|
136
|
-
t13 = $[
|
|
135
|
+
t13 = $[34];
|
|
137
136
|
}
|
|
138
137
|
let t14;
|
|
139
|
-
if ($[
|
|
138
|
+
if ($[35] !== descriptionProps) {
|
|
140
139
|
t14 = descriptionProps || {};
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
140
|
+
$[35] = descriptionProps;
|
|
141
|
+
$[36] = t14;
|
|
143
142
|
} else {
|
|
144
|
-
t14 = $[
|
|
143
|
+
t14 = $[36];
|
|
145
144
|
}
|
|
146
145
|
t11 = _jsxs("div", {
|
|
147
146
|
className: t10,
|
|
@@ -152,8 +151,6 @@ const EmailFieldComponent = props => {
|
|
|
152
151
|
children: [_jsx(FieldLabel, {
|
|
153
152
|
field,
|
|
154
153
|
Label: field?.admin?.components?.Label,
|
|
155
|
-
label,
|
|
156
|
-
required,
|
|
157
154
|
...t12
|
|
158
155
|
}), _jsxs("div", {
|
|
159
156
|
className: `${fieldBaseClass}__wrap`,
|
|
@@ -188,22 +185,21 @@ const EmailFieldComponent = props => {
|
|
|
188
185
|
$[15] = width;
|
|
189
186
|
$[16] = field;
|
|
190
187
|
$[17] = labelProps;
|
|
191
|
-
$[18] =
|
|
192
|
-
$[19] =
|
|
193
|
-
$[20] =
|
|
194
|
-
$[21] =
|
|
195
|
-
$[22] =
|
|
196
|
-
$[23] =
|
|
197
|
-
$[24] =
|
|
198
|
-
$[25] =
|
|
199
|
-
$[26] =
|
|
200
|
-
$[27] =
|
|
201
|
-
$[28] =
|
|
202
|
-
$[29] =
|
|
203
|
-
$[30] =
|
|
204
|
-
$[31] = t11;
|
|
188
|
+
$[18] = errorProps;
|
|
189
|
+
$[19] = path;
|
|
190
|
+
$[20] = placeholder;
|
|
191
|
+
$[21] = i18n;
|
|
192
|
+
$[22] = value_0;
|
|
193
|
+
$[23] = autoComplete;
|
|
194
|
+
$[24] = disabled;
|
|
195
|
+
$[25] = setValue;
|
|
196
|
+
$[26] = required;
|
|
197
|
+
$[27] = descriptionProps;
|
|
198
|
+
$[28] = description;
|
|
199
|
+
$[29] = t10;
|
|
200
|
+
$[30] = t11;
|
|
205
201
|
} else {
|
|
206
|
-
t11 = $[
|
|
202
|
+
t11 = $[30];
|
|
207
203
|
}
|
|
208
204
|
return t11;
|
|
209
205
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","useFieldProps","useField","withCondition","RenderComponent","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","EmailFieldComponent","props","$","autoComplete","descriptionProps","errorProps","field","t0","labelProps","readOnly","readOnlyFromTopLevelProps","validate","t1","undefined","name","_path","pathFromProps","admin","t2","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","useFieldProps","useField","withCondition","RenderComponent","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","EmailFieldComponent","props","$","autoComplete","descriptionProps","errorProps","field","t0","labelProps","readOnly","readOnlyFromTopLevelProps","validate","t1","undefined","name","_path","pathFromProps","admin","t2","required","t3","readOnlyFromAdmin","className","description","placeholder","style","width","readOnlyFromProps","i18n","t4","value","options","memoizedValidate","path","pathFromContext","readOnlyFromContext","t5","t6","formInitializing","formProcessing","setValue","showError","value_0","disabled","t7","t8","t9","filter","Boolean","t10","join","t11","t12","t13","t14","_jsxs","children","_jsx","Label","components","CustomError","Error","mappedComponent","beforeInput","id","replace","onChange","type","afterInput","Description","EmailField"],"sources":["../../../src/fields/Email/index.tsx"],"sourcesContent":["'use client'\nimport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldValidation,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.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\nconst EmailFieldComponent: EmailFieldClientComponent = (props) => {\n const {\n autoComplete,\n descriptionProps,\n errorProps,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n readOnly: readOnlyFromAdmin,\n\n className,\n description,\n placeholder,\n style,\n width,\n } = {} as EmailFieldClientProps['field']['admin'],\n label,\n required,\n } = {} as EmailFieldClientProps['field'],\n field,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: EmailFieldValidation = 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 path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[fieldBaseClass, 'email', className, showError && 'error', disabled && 'read-only']\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel field={field} Label={field?.admin?.components?.Label} {...(labelProps || {})} />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError\n CustomError={field?.admin?.components?.Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.beforeInput} />\n {/* disable eslint here because the label is dynamic */}\n {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}\n <input\n autoComplete={autoComplete}\n disabled={disabled}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n placeholder={getTranslation(placeholder, i18n)}\n required={required}\n type=\"email\"\n value={(value as string) || ''}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.afterInput} />\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n field={field}\n {...(descriptionProps || {})}\n />\n </div>\n )\n}\n\nexport const EmailField = withCondition(EmailFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAOA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAEnC,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,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O,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAkC,MAAM,SAAS,CAAA;AAWxF,OAAO,cAAc,CAAA;AA8BrB,eAAO,MAAM,UAAU,EAAE,yBAwBxB,CAAA"}
|
|
@@ -86,6 +86,8 @@ export const FieldLabel = props => {
|
|
|
86
86
|
Label,
|
|
87
87
|
...rest
|
|
88
88
|
} = props;
|
|
89
|
+
// Don't get `Label` from `field.admin.components.Label` here because
|
|
90
|
+
// this will cause an infinite loop when threading field through custom usages of `FieldLabel`
|
|
89
91
|
if (Label) {
|
|
90
92
|
return /*#__PURE__*/_jsx(RenderComponent, {
|
|
91
93
|
clientProps: rest,
|
|
@@ -93,7 +95,11 @@ export const FieldLabel = props => {
|
|
|
93
95
|
});
|
|
94
96
|
}
|
|
95
97
|
return /*#__PURE__*/_jsx(DefaultFieldLabel, {
|
|
96
|
-
...rest
|
|
98
|
+
...rest,
|
|
99
|
+
label: typeof props?.label !== 'undefined' ? props.label : props?.field && 'label' in props.field && props.field.label // type assertion needed for `row` fields
|
|
100
|
+
,
|
|
101
|
+
|
|
102
|
+
required: typeof props.required !== 'undefined' ? props.required : props?.field && 'required' in props.field && props.field?.required // type assertion needed for `group` fields
|
|
97
103
|
});
|
|
98
104
|
};
|
|
99
105
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useFieldProps","useForm","RenderComponent","useEditDepth","useTranslation","generateFieldID","DefaultFieldLabel","props","$","as","t0","htmlFor","htmlForFromProps","label","labelFromProps","required","t1","unstyled","t2","Element","undefined","uuid","path","editDepth","t3","i18n","t4","t5","t6","_jsx","className","children","_jsxs","FieldLabel","Label","rest","clientProps","mappedComponent"],"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldLabelClientComponent, GenericLabelProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<GenericLabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: FieldLabelClientComponent = (props) => {\n const { Label, ...rest } = props\n\n if (Label) {\n return <RenderComponent clientProps={rest} mappedComponent={Label} />\n }\n\n return <DefaultFieldLabel
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useFieldProps","useForm","RenderComponent","useEditDepth","useTranslation","generateFieldID","DefaultFieldLabel","props","$","as","t0","htmlFor","htmlForFromProps","label","labelFromProps","required","t1","unstyled","t2","Element","undefined","uuid","path","editDepth","t3","i18n","t4","t5","t6","_jsx","className","children","_jsxs","FieldLabel","Label","rest","clientProps","mappedComponent","field"],"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldLabelClientComponent, GenericLabelProps, StaticLabel } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<GenericLabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: FieldLabelClientComponent = (props) => {\n const { Label, ...rest } = props\n\n // Don't get `Label` from `field.admin.components.Label` here because\n // this will cause an infinite loop when threading field through custom usages of `FieldLabel`\n if (Label) {\n return <RenderComponent clientProps={rest} mappedComponent={Label} />\n }\n\n return (\n <DefaultFieldLabel\n {...rest}\n label={\n typeof props?.label !== 'undefined'\n ? props.label\n : props?.field && 'label' in props.field && (props.field.label as StaticLabel) // type assertion needed for `row` fields\n }\n required={\n typeof props.required !== 'undefined'\n ? props.required\n : props?.field && 'required' in props.field && (props.field?.required as boolean) // type assertion needed for `group` fields\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAA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IAAK/B,KAAA,CAAM+B,KAAK,EAAEvB,QAAA,CAAqB;;AAI5F","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/JSON/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAO/D,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/JSON/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAO/D,OAAO,cAAc,CAAA;AA0JrB,eAAO,MAAM,SAAS;;;;;;;oCAAoC,CAAA"}
|
|
@@ -110,8 +110,6 @@ const JSONFieldComponent = props => {
|
|
|
110
110
|
children: [/*#__PURE__*/_jsx(FieldLabel, {
|
|
111
111
|
field: field,
|
|
112
112
|
Label: field?.admin?.components?.Label,
|
|
113
|
-
label: label,
|
|
114
|
-
required: required,
|
|
115
113
|
...(labelProps || {})
|
|
116
114
|
}), /*#__PURE__*/_jsxs("div", {
|
|
117
115
|
className: `${fieldBaseClass}__wrap`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","CodeEditor","useField","withCondition","FieldLabel","fieldBaseClass","baseClass","useFieldProps","RenderComponent","FieldDescription","FieldError","JSONFieldComponent","props","descriptionProps","errorProps","field","name","_path","pathFromProps","admin","className","description","editorOptions","readOnly","readOnlyFromAdmin","style","width","jsonSchema","label","required","labelProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","stringValue","setStringValue","jsonError","setJsonError","hasLoadedValue","setHasLoadedValue","memoizedValidate","value","options","path","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","_jsxs","filter","Boolean","join","_jsx","Label","components","CustomError","Error","mappedComponent","beforeInput","defaultLanguage","onChange","onMount","afterInput","Description","JSONField"],"sources":["../../../src/fields/JSON/index.tsx"],"sourcesContent":["'use client'\nimport type { JSONFieldClientComponent } 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 { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nconst JSONFieldComponent: JSONFieldClientComponent = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n description,\n editorOptions,\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n jsonSchema,\n label,\n required,\n },\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const [stringValue, setStringValue] = useState<string>()\n const [jsonError, setJsonError] = useState<string>()\n const [hasLoadedValue, setHasLoadedValue] = useState(false)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, jsonError, required })\n }\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) {\n return\n }\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) {\n return\n }\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) {\n return\n }\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
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","CodeEditor","useField","withCondition","FieldLabel","fieldBaseClass","baseClass","useFieldProps","RenderComponent","FieldDescription","FieldError","JSONFieldComponent","props","descriptionProps","errorProps","field","name","_path","pathFromProps","admin","className","description","editorOptions","readOnly","readOnlyFromAdmin","style","width","jsonSchema","label","required","labelProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","stringValue","setStringValue","jsonError","setJsonError","hasLoadedValue","setHasLoadedValue","memoizedValidate","value","options","path","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","_jsxs","filter","Boolean","join","_jsx","Label","components","CustomError","Error","mappedComponent","beforeInput","defaultLanguage","onChange","onMount","afterInput","Description","JSONField"],"sources":["../../../src/fields/JSON/index.tsx"],"sourcesContent":["'use client'\nimport type { JSONFieldClientComponent } 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 { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nconst JSONFieldComponent: JSONFieldClientComponent = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n description,\n editorOptions,\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n jsonSchema,\n label,\n required,\n },\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const [stringValue, setStringValue] = useState<string>()\n const [jsonError, setJsonError] = useState<string>()\n const [hasLoadedValue, setHasLoadedValue] = useState(false)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, jsonError, required })\n }\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) {\n return\n }\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) {\n return\n }\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) {\n return\n }\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 field={field} Label={field?.admin?.components?.Label} {...(labelProps || {})} />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError\n CustomError={field?.admin?.components?.Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.beforeInput} />\n <CodeEditor\n defaultLanguage=\"json\"\n onChange={handleChange}\n onMount={handleMount}\n options={editorOptions}\n readOnly={disabled}\n value={stringValue}\n />\n <RenderComponent mappedComponent={field?.admin?.components?.afterInput} />\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n field={field}\n {...(descriptionProps || {})}\n />\n </div>\n )\n}\n\nexport const JSONField = withCondition(JSONFieldComponent)\n"],"mappings":"AA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AAA,EAAOI,KAAA,EAAO+D,UAAA,EAAYI;uBAC5DN,IAAA,CAAC/E,UAAA;QACCsF,eAAA,EAAgB;QAChBC,QAAA,EAAUhB,YAAA;QACViB,OAAA,EAASrC,WAAA;QACTV,OAAA,EAASpB,aAAA;QACTC,QAAA,EAAU4B,QAAA;QACVV,KAAA,EAAOP;uBAET8C,IAAA,CAACxE,eAAA;QAAgB6E,eAAA,EAAiBtE,KAAA,EAAOI,KAAA,EAAO+D,UAAA,EAAYQ;;qBAE9DV,IAAA,CAACvE,gBAAA;MACCkF,WAAA,EAAa5E,KAAA,EAAOI,KAAA,EAAO+D,UAAA,EAAYS,WAAA;MACvCtE,WAAA,EAAaA,WAAA;MACbN,KAAA,EAAOA,KAAA;MACN,IAAIF,gBAAA,IAAoB,CAAC,CAAC;;;AAInC;AAEA,OAAO,MAAM+E,SAAA,GAAYzF,aAAA,CAAcQ,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Number/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAc/D,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Number/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAc/D,OAAO,cAAc,CAAA;AAqMrB,eAAO,MAAM,WAAW;;;;;;;;oCAAsC,CAAA"}
|
|
@@ -17,7 +17,7 @@ import { FieldLabel } from '../FieldLabel/index.js';
|
|
|
17
17
|
import { fieldBaseClass } from '../shared/index.js';
|
|
18
18
|
import './index.scss';
|
|
19
19
|
const NumberFieldComponent = props => {
|
|
20
|
-
const $ = _c(
|
|
20
|
+
const $ = _c(56);
|
|
21
21
|
const {
|
|
22
22
|
descriptionProps,
|
|
23
23
|
errorProps,
|
|
@@ -33,7 +33,6 @@ const NumberFieldComponent = props => {
|
|
|
33
33
|
_path: pathFromProps,
|
|
34
34
|
admin: t1,
|
|
35
35
|
hasMany: t2,
|
|
36
|
-
label,
|
|
37
36
|
max: t3,
|
|
38
37
|
maxRows: t4,
|
|
39
38
|
min: t5,
|
|
@@ -206,30 +205,30 @@ const NumberFieldComponent = props => {
|
|
|
206
205
|
}
|
|
207
206
|
const t20 = t19.join(" ");
|
|
208
207
|
let t21;
|
|
209
|
-
if ($[26] !== style || $[27] !== width || $[28] !== field || $[29] !== labelProps || $[30] !==
|
|
208
|
+
if ($[26] !== style || $[27] !== width || $[28] !== field || $[29] !== labelProps || $[30] !== errorProps || $[31] !== path || $[32] !== hasMany || $[33] !== value_0 || $[34] !== maxRows || $[35] !== t || $[36] !== disabled || $[37] !== handleHasManyChange || $[38] !== showError || $[39] !== valueToRender || $[40] !== placeholder || $[41] !== i18n || $[42] !== max || $[43] !== min || $[44] !== handleChange || $[45] !== step || $[46] !== descriptionProps || $[47] !== description || $[48] !== t20) {
|
|
210
209
|
let t22;
|
|
211
|
-
if ($[
|
|
210
|
+
if ($[50] !== labelProps) {
|
|
212
211
|
t22 = labelProps || {};
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
212
|
+
$[50] = labelProps;
|
|
213
|
+
$[51] = t22;
|
|
215
214
|
} else {
|
|
216
|
-
t22 = $[
|
|
215
|
+
t22 = $[51];
|
|
217
216
|
}
|
|
218
217
|
let t23;
|
|
219
|
-
if ($[
|
|
218
|
+
if ($[52] !== errorProps) {
|
|
220
219
|
t23 = errorProps || {};
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
220
|
+
$[52] = errorProps;
|
|
221
|
+
$[53] = t23;
|
|
223
222
|
} else {
|
|
224
|
-
t23 = $[
|
|
223
|
+
t23 = $[53];
|
|
225
224
|
}
|
|
226
225
|
let t24;
|
|
227
|
-
if ($[
|
|
226
|
+
if ($[54] !== descriptionProps) {
|
|
228
227
|
t24 = descriptionProps || {};
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
228
|
+
$[54] = descriptionProps;
|
|
229
|
+
$[55] = t24;
|
|
231
230
|
} else {
|
|
232
|
-
t24 = $[
|
|
231
|
+
t24 = $[55];
|
|
233
232
|
}
|
|
234
233
|
t21 = _jsxs("div", {
|
|
235
234
|
className: t20,
|
|
@@ -240,8 +239,6 @@ const NumberFieldComponent = props => {
|
|
|
240
239
|
children: [_jsx(FieldLabel, {
|
|
241
240
|
field,
|
|
242
241
|
Label: field?.admin?.components?.Label,
|
|
243
|
-
label,
|
|
244
|
-
required,
|
|
245
242
|
...t22
|
|
246
243
|
}), _jsxs("div", {
|
|
247
244
|
className: `${fieldBaseClass}__wrap`,
|
|
@@ -306,30 +303,28 @@ const NumberFieldComponent = props => {
|
|
|
306
303
|
$[27] = width;
|
|
307
304
|
$[28] = field;
|
|
308
305
|
$[29] = labelProps;
|
|
309
|
-
$[30] =
|
|
310
|
-
$[31] =
|
|
311
|
-
$[32] =
|
|
312
|
-
$[33] =
|
|
313
|
-
$[34] =
|
|
314
|
-
$[35] =
|
|
315
|
-
$[36] =
|
|
316
|
-
$[37] =
|
|
317
|
-
$[38] =
|
|
318
|
-
$[39] =
|
|
319
|
-
$[40] =
|
|
320
|
-
$[41] =
|
|
321
|
-
$[42] =
|
|
322
|
-
$[43] =
|
|
323
|
-
$[44] =
|
|
324
|
-
$[45] =
|
|
325
|
-
$[46] =
|
|
326
|
-
$[47] =
|
|
327
|
-
$[48] =
|
|
328
|
-
$[49] =
|
|
329
|
-
$[50] = t20;
|
|
330
|
-
$[51] = t21;
|
|
306
|
+
$[30] = errorProps;
|
|
307
|
+
$[31] = path;
|
|
308
|
+
$[32] = hasMany;
|
|
309
|
+
$[33] = value_0;
|
|
310
|
+
$[34] = maxRows;
|
|
311
|
+
$[35] = t;
|
|
312
|
+
$[36] = disabled;
|
|
313
|
+
$[37] = handleHasManyChange;
|
|
314
|
+
$[38] = showError;
|
|
315
|
+
$[39] = valueToRender;
|
|
316
|
+
$[40] = placeholder;
|
|
317
|
+
$[41] = i18n;
|
|
318
|
+
$[42] = max;
|
|
319
|
+
$[43] = min;
|
|
320
|
+
$[44] = handleChange;
|
|
321
|
+
$[45] = step;
|
|
322
|
+
$[46] = descriptionProps;
|
|
323
|
+
$[47] = description;
|
|
324
|
+
$[48] = t20;
|
|
325
|
+
$[49] = t21;
|
|
331
326
|
} else {
|
|
332
|
-
t21 = $[
|
|
327
|
+
t21 = $[49];
|
|
333
328
|
}
|
|
334
329
|
return t21;
|
|
335
330
|
};
|