@rjsf/fluentui-rc 6.4.2 → 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/core.umd.js +13 -9
- package/dist/index.cjs +13 -9
- package/dist/index.cjs.map +2 -2
- package/dist/index.esm.js +21 -12
- package/dist/index.esm.js.map +3 -3
- 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 +4 -3
- 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 +8 -8
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +5 -3
- package/src/RadioWidget/RadioWidget.tsx +8 -5
- package/src/SelectWidget/SelectWidget.tsx +6 -3
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/fluentui-rc",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "FluentUI React Components theme, fields and widgets for react-jsonschema-form",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:ts": "tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"react": ">=18"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@fluentui/react-components": "^9.
|
|
77
|
-
"@fluentui/react-icons": "^2.0.
|
|
78
|
-
"@fluentui/react-migration-v0-v9": "^9.6.
|
|
79
|
-
"@rjsf/core": "6.
|
|
80
|
-
"@rjsf/snapshot-tests": "6.
|
|
81
|
-
"@rjsf/utils": "6.
|
|
82
|
-
"@rjsf/validator-ajv8": "6.
|
|
76
|
+
"@fluentui/react-components": "^9.73.5",
|
|
77
|
+
"@fluentui/react-icons": "^2.0.323",
|
|
78
|
+
"@fluentui/react-migration-v0-v9": "^9.6.25",
|
|
79
|
+
"@rjsf/core": "6.5.0",
|
|
80
|
+
"@rjsf/snapshot-tests": "6.5.0",
|
|
81
|
+
"@rjsf/utils": "6.5.0",
|
|
82
|
+
"@rjsf/validator-ajv8": "6.5.0",
|
|
83
83
|
"eslint": "^8.57.1"
|
|
84
84
|
},
|
|
85
85
|
"directories": {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ChangeEvent, FocusEvent } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
ariaDescribedByIds,
|
|
4
|
+
enumOptionValueDecoder,
|
|
4
5
|
enumOptionsDeselectValue,
|
|
5
6
|
enumOptionsIsSelected,
|
|
6
7
|
enumOptionsSelectValue,
|
|
7
|
-
|
|
8
|
+
getOptionValueFormat,
|
|
8
9
|
labelValue,
|
|
9
10
|
optionId,
|
|
10
11
|
FormContextType,
|
|
@@ -40,6 +41,7 @@ export default function CheckboxesWidget<
|
|
|
40
41
|
onFocus,
|
|
41
42
|
}: WidgetProps<T, S, F>) {
|
|
42
43
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
44
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
43
45
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
44
46
|
|
|
45
47
|
const _onChange =
|
|
@@ -53,9 +55,9 @@ export default function CheckboxesWidget<
|
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
56
|
-
onBlur(id,
|
|
58
|
+
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
57
59
|
const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
58
|
-
onFocus(id,
|
|
60
|
+
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
59
61
|
|
|
60
62
|
return (
|
|
61
63
|
<>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { FocusEvent } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
ariaDescribedByIds,
|
|
4
|
+
enumOptionValueDecoder,
|
|
5
|
+
enumOptionValueEncoder,
|
|
4
6
|
enumOptionsIndexForValue,
|
|
5
|
-
|
|
7
|
+
getOptionValueFormat,
|
|
6
8
|
labelValue,
|
|
7
9
|
optionId,
|
|
8
10
|
FormContextType,
|
|
@@ -32,13 +34,14 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
32
34
|
onFocus,
|
|
33
35
|
}: WidgetProps<T, S, F>) {
|
|
34
36
|
const { enumOptions, enumDisabled, emptyValue, inline } = options;
|
|
37
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
35
38
|
|
|
36
39
|
const _onChange = (_: any, data: RadioGroupOnChangeData) =>
|
|
37
|
-
onChange(
|
|
40
|
+
onChange(enumOptionValueDecoder<S>(data.value, enumOptions, optionValueFormat, emptyValue));
|
|
38
41
|
const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
39
|
-
onBlur(id,
|
|
42
|
+
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
40
43
|
const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
|
|
41
|
-
onFocus(id,
|
|
44
|
+
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
42
45
|
|
|
43
46
|
const selectedIndex = enumOptionsIndexForValue<S>(value, enumOptions) ?? undefined;
|
|
44
47
|
|
|
@@ -67,7 +70,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
67
70
|
<Radio
|
|
68
71
|
id={optionId(id, index)}
|
|
69
72
|
label={option.label}
|
|
70
|
-
value={
|
|
73
|
+
value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
|
|
71
74
|
key={index}
|
|
72
75
|
disabled={disabled || itemDisabled || readonly}
|
|
73
76
|
/>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ariaDescribedByIds,
|
|
3
|
+
enumOptionValueDecoder,
|
|
4
|
+
enumOptionValueEncoder,
|
|
3
5
|
enumOptionsIndexForValue,
|
|
4
|
-
|
|
6
|
+
getOptionValueFormat,
|
|
5
7
|
FormContextType,
|
|
6
8
|
labelValue,
|
|
7
9
|
RJSFSchema,
|
|
@@ -43,6 +45,7 @@ function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
43
45
|
placeholder,
|
|
44
46
|
}: WidgetProps<T, S, F>) {
|
|
45
47
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
48
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
46
49
|
|
|
47
50
|
const selectedIndexes = enumOptionsIndexForValue<S>(value, enumOptions, multiple);
|
|
48
51
|
let selectedIndexesAsArray: string[] = [];
|
|
@@ -61,7 +64,7 @@ function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
61
64
|
const _onFocus = () => onFocus(id, selectedIndexes);
|
|
62
65
|
const _onChange = (_: any, data: OptionOnSelectData) => {
|
|
63
66
|
const newValue = getValue(data, multiple);
|
|
64
|
-
return onChange(
|
|
67
|
+
return onChange(enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
65
68
|
};
|
|
66
69
|
const showPlaceholderOption = !multiple && schema.default === undefined;
|
|
67
70
|
|
|
@@ -90,7 +93,7 @@ function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
90
93
|
enumOptions.map(({ value, label }, i) => {
|
|
91
94
|
const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;
|
|
92
95
|
return (
|
|
93
|
-
<Option key={i} value={
|
|
96
|
+
<Option key={i} value={enumOptionValueEncoder(value, i, optionValueFormat)} disabled={disabled}>
|
|
94
97
|
{label}
|
|
95
98
|
</Option>
|
|
96
99
|
);
|
|
@@ -94,6 +94,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
94
94
|
<div className={classes.halfWidth}>
|
|
95
95
|
<Field label={displayLabel ? keyLabel : undefined} required={required}>
|
|
96
96
|
<Input
|
|
97
|
+
key={label}
|
|
97
98
|
required={required}
|
|
98
99
|
defaultValue={label}
|
|
99
100
|
disabled={disabled || readonly}
|