@rjsf/react-bootstrap 6.4.1 → 6.5.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/index.cjs +17 -13
- package/dist/index.cjs.map +2 -2
- package/dist/react-bootstrap.esm.js +26 -17
- package/dist/react-bootstrap.esm.js.map +3 -3
- package/dist/react-bootstrap.umd.js +17 -13
- package/lib/CheckboxesWidget/CheckboxesWidget.js +4 -3
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.js +6 -5
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js +8 -7
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +5 -3
- package/src/RadioWidget/RadioWidget.tsx +8 -5
- package/src/SelectWidget/SelectWidget.tsx +11 -8
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/react-bootstrap",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"node": ">=20"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@rjsf/core": "6.
|
|
75
|
-
"@rjsf/snapshot-tests": "6.
|
|
76
|
-
"@rjsf/utils": "6.
|
|
77
|
-
"@rjsf/validator-ajv8": "6.
|
|
74
|
+
"@rjsf/core": "6.5.0",
|
|
75
|
+
"@rjsf/snapshot-tests": "6.5.0",
|
|
76
|
+
"@rjsf/utils": "6.5.0",
|
|
77
|
+
"@rjsf/validator-ajv8": "6.5.0",
|
|
78
78
|
"eslint": "^8.57.1",
|
|
79
79
|
"react-bootstrap": "^2.10.10"
|
|
80
80
|
},
|
|
@@ -2,10 +2,11 @@ import { ChangeEvent, FocusEvent } from 'react';
|
|
|
2
2
|
import Form from 'react-bootstrap/Form';
|
|
3
3
|
import {
|
|
4
4
|
ariaDescribedByIds,
|
|
5
|
+
enumOptionValueDecoder,
|
|
5
6
|
enumOptionsDeselectValue,
|
|
6
7
|
enumOptionsIsSelected,
|
|
7
8
|
enumOptionsSelectValue,
|
|
8
|
-
|
|
9
|
+
getOptionValueFormat,
|
|
9
10
|
optionId,
|
|
10
11
|
FormContextType,
|
|
11
12
|
RJSFSchema,
|
|
@@ -31,6 +32,7 @@ export default function CheckboxesWidget<
|
|
|
31
32
|
onFocus,
|
|
32
33
|
}: WidgetProps<T, S, F>) {
|
|
33
34
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
35
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
34
36
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
35
37
|
|
|
36
38
|
const _onChange =
|
|
@@ -44,9 +46,9 @@ export default function CheckboxesWidget<
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
47
|
-
onBlur(id,
|
|
49
|
+
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
48
50
|
const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
49
|
-
onFocus(id,
|
|
51
|
+
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
54
|
<Form.Group>
|
|
@@ -2,8 +2,10 @@ import { ChangeEvent, FocusEvent } from 'react';
|
|
|
2
2
|
import Form from 'react-bootstrap/Form';
|
|
3
3
|
import {
|
|
4
4
|
ariaDescribedByIds,
|
|
5
|
+
enumOptionValueDecoder,
|
|
6
|
+
enumOptionValueEncoder,
|
|
5
7
|
enumOptionsIsSelected,
|
|
6
|
-
|
|
8
|
+
getOptionValueFormat,
|
|
7
9
|
optionId,
|
|
8
10
|
FormContextType,
|
|
9
11
|
RJSFSchema,
|
|
@@ -24,13 +26,14 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
24
26
|
onFocus,
|
|
25
27
|
}: WidgetProps<T, S, F>) {
|
|
26
28
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
29
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
27
30
|
|
|
28
31
|
const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
|
|
29
|
-
onChange(
|
|
32
|
+
onChange(enumOptionValueDecoder<S>(value, enumOptions, optionValueFormat, emptyValue));
|
|
30
33
|
const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
31
|
-
onBlur(id,
|
|
34
|
+
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
32
35
|
const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
33
|
-
onFocus(id,
|
|
36
|
+
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
34
37
|
|
|
35
38
|
const inline = Boolean(options && options.inline);
|
|
36
39
|
|
|
@@ -52,7 +55,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
52
55
|
disabled={disabled || itemDisabled || readonly}
|
|
53
56
|
checked={checked}
|
|
54
57
|
required={required}
|
|
55
|
-
value={
|
|
58
|
+
value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
|
|
56
59
|
onChange={_onChange}
|
|
57
60
|
onBlur={_onBlur}
|
|
58
61
|
onFocus={_onFocus}
|
|
@@ -2,9 +2,11 @@ import { ChangeEvent, FocusEvent } from 'react';
|
|
|
2
2
|
import FormSelect from 'react-bootstrap/FormSelect';
|
|
3
3
|
import {
|
|
4
4
|
ariaDescribedByIds,
|
|
5
|
+
enumOptionSelectedValue,
|
|
6
|
+
enumOptionValueDecoder,
|
|
7
|
+
enumOptionValueEncoder,
|
|
8
|
+
getOptionValueFormat,
|
|
5
9
|
FormContextType,
|
|
6
|
-
enumOptionsIndexForValue,
|
|
7
|
-
enumOptionsValueForIndex,
|
|
8
10
|
RJSFSchema,
|
|
9
11
|
StrictRJSFSchema,
|
|
10
12
|
WidgetProps,
|
|
@@ -34,6 +36,7 @@ export default function SelectWidget<
|
|
|
34
36
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
35
37
|
|
|
36
38
|
const emptyValue = multiple ? [] : '';
|
|
39
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
37
40
|
|
|
38
41
|
function getValue(event: FocusEvent | ChangeEvent | any, multiple?: boolean) {
|
|
39
42
|
if (multiple) {
|
|
@@ -45,14 +48,14 @@ export default function SelectWidget<
|
|
|
45
48
|
return event.target.value;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
const
|
|
51
|
+
const selectValue = enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
49
52
|
const showPlaceholderOption = !multiple && schema.default === undefined;
|
|
50
53
|
|
|
51
54
|
return (
|
|
52
55
|
<FormSelect
|
|
53
56
|
id={id}
|
|
54
57
|
name={htmlName || id}
|
|
55
|
-
value={
|
|
58
|
+
value={selectValue}
|
|
56
59
|
required={required}
|
|
57
60
|
multiple={multiple}
|
|
58
61
|
disabled={disabled || readonly}
|
|
@@ -62,19 +65,19 @@ export default function SelectWidget<
|
|
|
62
65
|
onBlur &&
|
|
63
66
|
((event: FocusEvent) => {
|
|
64
67
|
const newValue = getValue(event, multiple);
|
|
65
|
-
onBlur(id,
|
|
68
|
+
onBlur(id, enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyValue));
|
|
66
69
|
})
|
|
67
70
|
}
|
|
68
71
|
onFocus={
|
|
69
72
|
onFocus &&
|
|
70
73
|
((event: FocusEvent) => {
|
|
71
74
|
const newValue = getValue(event, multiple);
|
|
72
|
-
onFocus(id,
|
|
75
|
+
onFocus(id, enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyValue));
|
|
73
76
|
})
|
|
74
77
|
}
|
|
75
78
|
onChange={(event: ChangeEvent) => {
|
|
76
79
|
const newValue = getValue(event, multiple);
|
|
77
|
-
onChange(
|
|
80
|
+
onChange(enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyValue));
|
|
78
81
|
}}
|
|
79
82
|
aria-describedby={ariaDescribedByIds(id)}
|
|
80
83
|
>
|
|
@@ -82,7 +85,7 @@ export default function SelectWidget<
|
|
|
82
85
|
{(enumOptions as any).map(({ value, label }: any, i: number) => {
|
|
83
86
|
const disabled: any = Array.isArray(enumDisabled) && (enumDisabled as any).indexOf(value) != -1;
|
|
84
87
|
return (
|
|
85
|
-
<option key={i} id={label} value={
|
|
88
|
+
<option key={i} id={label} value={enumOptionValueEncoder(value, i, optionValueFormat)} disabled={disabled}>
|
|
86
89
|
{label}
|
|
87
90
|
</option>
|
|
88
91
|
);
|