@rjsf/antd 6.0.2 → 6.1.1
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/antd.esm.js +27 -49
- package/dist/antd.esm.js.map +4 -4
- package/dist/antd.umd.js +26 -48
- package/dist/index.cjs +27 -49
- package/dist/index.cjs.map +4 -4
- package/lib/templates/ArrayFieldItemTemplate/index.js +5 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js +1 -1
- package/lib/templates/ErrorList/index.js +1 -1
- package/lib/templates/FieldDescriptionTemplate/index.js.map +1 -0
- package/lib/templates/FieldHelpTemplate/index.d.ts +6 -0
- package/lib/templates/FieldHelpTemplate/index.js +15 -0
- package/lib/templates/FieldHelpTemplate/index.js.map +1 -0
- package/lib/templates/FieldTemplate/index.js +2 -2
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/IconButton/index.js +5 -5
- package/lib/templates/ObjectFieldTemplate/index.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -2
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/templates/index.js +1 -1
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/templates/ArrayFieldItemTemplate/index.tsx +5 -4
- package/src/templates/ArrayFieldTemplate/index.tsx +1 -1
- package/src/templates/FieldHelpTemplate/index.tsx +23 -0
- package/src/templates/FieldTemplate/index.tsx +2 -23
- package/src/templates/ObjectFieldTemplate/index.tsx +1 -1
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +3 -2
- package/src/templates/index.ts +1 -1
- package/lib/templates/DescriptionField/index.js.map +0 -1
- /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.d.ts +0 -0
- /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.js +0 -0
- /package/src/templates/{DescriptionField → FieldDescriptionTemplate}/index.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/antd",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Ant Design theme, fields and widgets for react-jsonschema-form",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
|
|
37
|
+
"compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs && move-file antdIconsReplacer.js antdIconsReplacer.cjs",
|
|
38
38
|
"build:ts": "npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
39
39
|
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
|
|
40
40
|
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/antd.esm.js --sourcemap --packages=external --format=esm",
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
const BTN_GRP_STYLE = {
|
|
12
12
|
width: '100%',
|
|
13
|
+
justifyContent: 'flex-end',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const BTN_STYLE = {
|
|
@@ -25,21 +26,21 @@ export default function ArrayFieldItemTemplate<
|
|
|
25
26
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
26
27
|
F extends FormContextType = any,
|
|
27
28
|
>(props: ArrayFieldItemTemplateProps<T, S, F>) {
|
|
28
|
-
const { children, buttonsProps, hasToolbar, index, registry, uiSchema } = props;
|
|
29
|
+
const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, index, registry, uiSchema } = props;
|
|
29
30
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
30
31
|
const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
|
|
31
32
|
'ArrayFieldItemButtonsTemplate',
|
|
32
33
|
registry,
|
|
33
34
|
uiOptions,
|
|
34
35
|
);
|
|
35
|
-
const { rowGutter = 24, toolbarAlign = 'top' } = registry.formContext;
|
|
36
|
+
const { rowGutter = 24, toolbarAlign = displayLabel ? 'middle' : 'top' } = registry.formContext;
|
|
37
|
+
const margin = hasDescription ? -8 : 16;
|
|
36
38
|
|
|
37
39
|
return (
|
|
38
40
|
<Row align={toolbarAlign} key={`rjsf-array-item-${index}`} gutter={rowGutter}>
|
|
39
41
|
<Col flex='1'>{children}</Col>
|
|
40
|
-
|
|
41
42
|
{hasToolbar && (
|
|
42
|
-
<Col flex='
|
|
43
|
+
<Col flex='120px' style={{ marginTop: displayLabel ? `${margin}px` : undefined }}>
|
|
43
44
|
<Space.Compact style={BTN_GRP_STYLE}>
|
|
44
45
|
<ArrayFieldItemButtonsTemplate {...buttonsProps} style={BTN_STYLE} />
|
|
45
46
|
</Space.Compact>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
import { RichHelp } from '@rjsf/core';
|
|
3
|
+
|
|
4
|
+
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `FieldHelpProps` to be rendered
|
|
7
|
+
*/
|
|
8
|
+
export default function FieldHelpTemplate<
|
|
9
|
+
T = any,
|
|
10
|
+
S extends StrictRJSFSchema = RJSFSchema,
|
|
11
|
+
F extends FormContextType = any,
|
|
12
|
+
>(props: FieldHelpProps<T, S, F>) {
|
|
13
|
+
const { fieldPathId, help, uiSchema, registry } = props;
|
|
14
|
+
if (!help) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div id={helpId(fieldPathId)} className='help-block'>
|
|
20
|
+
<RichHelp help={help} registry={registry} uiSchema={uiSchema} />
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -24,23 +24,16 @@ export default function FieldTemplate<
|
|
|
24
24
|
>(props: FieldTemplateProps<T, S, F>) {
|
|
25
25
|
const {
|
|
26
26
|
children,
|
|
27
|
-
classNames,
|
|
28
|
-
style,
|
|
29
27
|
description,
|
|
30
|
-
disabled,
|
|
31
28
|
displayLabel,
|
|
32
29
|
errors,
|
|
33
30
|
help,
|
|
31
|
+
rawHelp,
|
|
34
32
|
hidden,
|
|
35
33
|
id,
|
|
36
34
|
label,
|
|
37
|
-
onKeyRename,
|
|
38
|
-
onKeyRenameBlur,
|
|
39
|
-
onRemoveProperty,
|
|
40
35
|
rawErrors,
|
|
41
36
|
rawDescription,
|
|
42
|
-
rawHelp,
|
|
43
|
-
readonly,
|
|
44
37
|
registry,
|
|
45
38
|
required,
|
|
46
39
|
schema,
|
|
@@ -82,21 +75,7 @@ export default function FieldTemplate<
|
|
|
82
75
|
}
|
|
83
76
|
const isCheckbox = uiOptions.widget === 'checkbox';
|
|
84
77
|
return (
|
|
85
|
-
<WrapIfAdditionalTemplate
|
|
86
|
-
classNames={classNames}
|
|
87
|
-
style={style}
|
|
88
|
-
disabled={disabled}
|
|
89
|
-
id={id}
|
|
90
|
-
label={label}
|
|
91
|
-
onKeyRename={onKeyRename}
|
|
92
|
-
onKeyRenameBlur={onKeyRenameBlur}
|
|
93
|
-
onRemoveProperty={onRemoveProperty}
|
|
94
|
-
readonly={readonly}
|
|
95
|
-
required={required}
|
|
96
|
-
schema={schema}
|
|
97
|
-
uiSchema={uiSchema}
|
|
98
|
-
registry={registry}
|
|
99
|
-
>
|
|
78
|
+
<WrapIfAdditionalTemplate {...props}>
|
|
100
79
|
<Form.Item
|
|
101
80
|
colon={colon}
|
|
102
81
|
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
|
|
@@ -133,7 +133,7 @@ export default function ObjectFieldTemplate<
|
|
|
133
133
|
{canExpand(schema, uiSchema, formData) && (
|
|
134
134
|
<Col span={24}>
|
|
135
135
|
<Row gutter={rowGutter} justify='end'>
|
|
136
|
-
<Col flex='
|
|
136
|
+
<Col flex='120px'>
|
|
137
137
|
<AddButton
|
|
138
138
|
id={buttonId(fieldPathId, 'add')}
|
|
139
139
|
className='rjsf-object-property-expand'
|
|
@@ -32,6 +32,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
32
32
|
classNames,
|
|
33
33
|
style,
|
|
34
34
|
disabled,
|
|
35
|
+
displayLabel,
|
|
35
36
|
id,
|
|
36
37
|
label,
|
|
37
38
|
onRemoveProperty,
|
|
@@ -82,7 +83,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
82
83
|
className='form-group'
|
|
83
84
|
hasFeedback
|
|
84
85
|
htmlFor={`${id}-key`}
|
|
85
|
-
label={keyLabel}
|
|
86
|
+
label={displayLabel ? keyLabel : undefined}
|
|
86
87
|
labelCol={labelCol}
|
|
87
88
|
required={required}
|
|
88
89
|
style={wrapperStyle}
|
|
@@ -104,7 +105,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
104
105
|
<Col className='form-additional' flex='1'>
|
|
105
106
|
{children}
|
|
106
107
|
</Col>
|
|
107
|
-
<Col flex='
|
|
108
|
+
<Col flex='120px' style={{ marginTop: displayLabel ? '40px' : undefined }}>
|
|
108
109
|
<RemoveButton
|
|
109
110
|
id={buttonId(id, 'remove')}
|
|
110
111
|
className='rjsf-object-property-remove'
|
package/src/templates/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@r
|
|
|
3
3
|
import ArrayFieldItemTemplate from './ArrayFieldItemTemplate';
|
|
4
4
|
import ArrayFieldTemplate from './ArrayFieldTemplate';
|
|
5
5
|
import BaseInputTemplate from './BaseInputTemplate';
|
|
6
|
-
import DescriptionField from './
|
|
6
|
+
import DescriptionField from './FieldDescriptionTemplate';
|
|
7
7
|
import ErrorList from './ErrorList';
|
|
8
8
|
import { AddButton, CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from './IconButton';
|
|
9
9
|
import FieldErrorTemplate from './FieldErrorTemplate';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/DescriptionField/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAItC,KAAqC;IACrC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,eAAM,EAAE,EAAE,EAAE,YACV,KAAC,eAAe,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAChF,CACR,CAAC;AACJ,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|