@rjsf/antd 5.17.0 → 5.18.0
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 +121 -138
- package/dist/antd.esm.js.map +3 -3
- package/dist/antd.umd.js +133 -139
- package/dist/index.js +155 -172
- package/dist/index.js.map +3 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js +1 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js +10 -13
- package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
- package/lib/templates/BaseInputTemplate/index.js +1 -2
- package/lib/templates/BaseInputTemplate/index.js.map +1 -1
- package/lib/templates/ErrorList/index.js +1 -3
- package/lib/templates/ErrorList/index.js.map +1 -1
- package/lib/templates/FieldTemplate/index.js +1 -1
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/IconButton/index.d.ts +1 -1
- package/lib/templates/IconButton/index.js +1 -1
- package/lib/templates/IconButton/index.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate/index.js +11 -14
- package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
- package/lib/templates/SubmitButton/index.js +1 -1
- package/lib/templates/SubmitButton/index.js.map +1 -1
- package/lib/templates/TitleField/index.js +9 -10
- package/lib/templates/TitleField/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +1 -4
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/AltDateWidget/index.js +1 -3
- package/lib/widgets/AltDateWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxWidget/index.js +1 -1
- package/lib/widgets/CheckboxWidget/index.js.map +1 -1
- package/lib/widgets/CheckboxesWidget/index.js +1 -1
- package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
- package/lib/widgets/DateTimeWidget/index.js +1 -1
- package/lib/widgets/DateTimeWidget/index.js.map +1 -1
- package/lib/widgets/DateWidget/index.js +1 -1
- package/lib/widgets/DateWidget/index.js.map +1 -1
- package/lib/widgets/PasswordWidget/index.js +1 -1
- package/lib/widgets/PasswordWidget/index.js.map +1 -1
- package/lib/widgets/RadioWidget/index.js +1 -1
- package/lib/widgets/RadioWidget/index.js.map +1 -1
- package/lib/widgets/RangeWidget/index.js +1 -1
- package/lib/widgets/RangeWidget/index.js.map +1 -1
- package/lib/widgets/SelectWidget/index.js +1 -1
- package/lib/widgets/SelectWidget/index.js.map +1 -1
- package/lib/widgets/TextareaWidget/index.js +1 -1
- package/lib/widgets/TextareaWidget/index.js.map +1 -1
- package/package.json +6 -6
- package/src/templates/ArrayFieldItemTemplate/index.tsx +1 -3
- package/src/templates/ArrayFieldTemplate/index.tsx +57 -64
- package/src/templates/BaseInputTemplate/index.tsx +1 -2
- package/src/templates/ErrorList/index.tsx +1 -3
- package/src/templates/FieldTemplate/index.tsx +1 -1
- package/src/templates/IconButton/index.tsx +2 -2
- package/src/templates/ObjectFieldTemplate/index.tsx +60 -67
- package/src/templates/SubmitButton/index.tsx +3 -1
- package/src/templates/TitleField/index.tsx +17 -22
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +1 -4
- package/src/widgets/AltDateWidget/index.tsx +1 -3
- package/src/widgets/CheckboxWidget/index.tsx +2 -2
- package/src/widgets/CheckboxesWidget/index.tsx +1 -1
- package/src/widgets/DateTimeWidget/index.tsx +1 -1
- package/src/widgets/DateWidget/index.tsx +1 -1
- package/src/widgets/PasswordWidget/index.tsx +1 -1
- package/src/widgets/RadioWidget/index.tsx +1 -1
- package/src/widgets/RangeWidget/index.tsx +1 -1
- package/src/widgets/SelectWidget/index.tsx +2 -2
- package/src/widgets/TextareaWidget/index.tsx +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
|
|
3
2
|
import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
|
+
import { ConfigProvider } from 'antd';
|
|
4
|
+
import { useContext } from 'react';
|
|
4
5
|
|
|
5
6
|
/** The `TitleField` is the template to use to render the title of a field
|
|
6
7
|
*
|
|
@@ -31,27 +32,21 @@ export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[`${prefixCls}-item-required`]: required,
|
|
41
|
-
[`${prefixCls}-item-no-colon`]: !colon,
|
|
42
|
-
});
|
|
35
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
36
|
+
const prefixCls = getPrefixCls('form');
|
|
37
|
+
const labelClassName = classNames({
|
|
38
|
+
[`${prefixCls}-item-required`]: required,
|
|
39
|
+
[`${prefixCls}-item-no-colon`]: !colon,
|
|
40
|
+
});
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
}}
|
|
55
|
-
</ConfigConsumer>
|
|
42
|
+
return title ? (
|
|
43
|
+
<label
|
|
44
|
+
className={labelClassName}
|
|
45
|
+
htmlFor={id}
|
|
46
|
+
onClick={handleLabelClick}
|
|
47
|
+
title={typeof title === 'string' ? title : ''}
|
|
48
|
+
>
|
|
49
|
+
{labelChildren}
|
|
50
|
+
</label>
|
|
56
51
|
) : null;
|
|
57
52
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { FocusEvent } from 'react';
|
|
2
|
-
import Col from 'antd
|
|
3
|
-
import Form from 'antd/lib/form';
|
|
4
|
-
import Input from 'antd/lib/input';
|
|
5
|
-
import Row from 'antd/lib/row';
|
|
2
|
+
import { Col, Row, Form, Input } from 'antd';
|
|
6
3
|
import {
|
|
7
4
|
ADDITIONAL_PROPERTY_FLAG,
|
|
8
5
|
UI_OPTIONS_KEY,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FocusEvent } from 'react';
|
|
2
|
-
import Checkbox,
|
|
2
|
+
import { Checkbox, CheckboxProps } from 'antd';
|
|
3
3
|
import {
|
|
4
4
|
ariaDescribedByIds,
|
|
5
5
|
labelValue,
|
|
@@ -23,7 +23,7 @@ export default function CheckboxWidget<
|
|
|
23
23
|
const { autofocus, disabled, formContext, id, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
|
|
24
24
|
const { readonlyAsDisabled = true } = formContext as GenericObjectType;
|
|
25
25
|
|
|
26
|
-
const handleChange = ({ target }
|
|
26
|
+
const handleChange: NonNullable<CheckboxProps['onChange']> = ({ target }) => onChange(target.checked);
|
|
27
27
|
|
|
28
28
|
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target.checked);
|
|
29
29
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Select,
|
|
1
|
+
import { Select, SelectProps } from 'antd';
|
|
2
2
|
import {
|
|
3
3
|
ariaDescribedByIds,
|
|
4
4
|
enumOptionsIndexForValue,
|
|
@@ -48,7 +48,7 @@ export default function SelectWidget<
|
|
|
48
48
|
|
|
49
49
|
const handleFocus = () => onFocus(id, enumOptionsValueForIndex<S>(value, enumOptions, emptyValue));
|
|
50
50
|
|
|
51
|
-
const filterOption = (input
|
|
51
|
+
const filterOption: SelectProps['filterOption'] = (input, option) => {
|
|
52
52
|
if (option && isString(option.label)) {
|
|
53
53
|
// labels are strings in this context
|
|
54
54
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|