@rjsf/mui 5.3.1 → 5.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/mui.cjs.development.js +57 -42
- package/dist/mui.cjs.development.js.map +1 -1
- package/dist/mui.cjs.production.min.js +1 -1
- package/dist/mui.cjs.production.min.js.map +1 -1
- package/dist/mui.esm.js +58 -43
- package/dist/mui.esm.js.map +1 -1
- package/dist/mui.umd.development.js +57 -42
- package/dist/mui.umd.development.js.map +1 -1
- package/dist/mui.umd.production.min.js +1 -1
- package/dist/mui.umd.production.min.js.map +1 -1
- package/package.json +8 -8
|
@@ -260,7 +260,7 @@ function ArrayFieldTemplate(props) {
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
var _excluded$2 = ["id", "name", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onChangeOverride", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry", "InputLabelProps"],
|
|
263
|
+
var _excluded$2 = ["id", "name", "placeholder", "required", "readonly", "disabled", "type", "label", "hideLabel", "value", "onChange", "onChangeOverride", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry", "InputLabelProps"],
|
|
264
264
|
_excluded2$1 = ["step", "min", "max"];
|
|
265
265
|
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
266
266
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -277,6 +277,7 @@ function BaseInputTemplate(props) {
|
|
|
277
277
|
disabled = props.disabled,
|
|
278
278
|
type = props.type,
|
|
279
279
|
label = props.label,
|
|
280
|
+
hideLabel = props.hideLabel,
|
|
280
281
|
value = props.value,
|
|
281
282
|
onChange = props.onChange,
|
|
282
283
|
onChangeOverride = props.onChangeOverride,
|
|
@@ -285,10 +286,8 @@ function BaseInputTemplate(props) {
|
|
|
285
286
|
autofocus = props.autofocus,
|
|
286
287
|
options = props.options,
|
|
287
288
|
schema = props.schema,
|
|
288
|
-
uiSchema = props.uiSchema,
|
|
289
289
|
_props$rawErrors = props.rawErrors,
|
|
290
290
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
291
|
-
registry = props.registry,
|
|
292
291
|
InputLabelProps = props.InputLabelProps,
|
|
293
292
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
294
293
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
@@ -318,8 +317,6 @@ function BaseInputTemplate(props) {
|
|
|
318
317
|
var value = _ref3.target.value;
|
|
319
318
|
return onFocus(id, value);
|
|
320
319
|
};
|
|
321
|
-
var schemaUtils = registry.schemaUtils;
|
|
322
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
323
320
|
var DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? _extends({}, InputLabelProps, {
|
|
324
321
|
shrink: true
|
|
325
322
|
}) : InputLabelProps;
|
|
@@ -328,7 +325,7 @@ function BaseInputTemplate(props) {
|
|
|
328
325
|
id: id,
|
|
329
326
|
name: id,
|
|
330
327
|
placeholder: placeholder,
|
|
331
|
-
label:
|
|
328
|
+
label: utils.labelValue(label || undefined, hideLabel, false),
|
|
332
329
|
autoFocus: autofocus,
|
|
333
330
|
required: required,
|
|
334
331
|
disabled: disabled || readonly
|
|
@@ -593,16 +590,16 @@ function ObjectFieldTemplate(props) {
|
|
|
593
590
|
// Button templates are not overridden in the uiSchema
|
|
594
591
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
595
592
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
596
|
-
children: [
|
|
593
|
+
children: [title && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
597
594
|
id: utils.titleId(idSchema),
|
|
598
595
|
title: title,
|
|
599
596
|
required: required,
|
|
600
597
|
schema: schema,
|
|
601
598
|
uiSchema: uiSchema,
|
|
602
599
|
registry: registry
|
|
603
|
-
}),
|
|
600
|
+
}), description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
604
601
|
id: utils.descriptionId(idSchema),
|
|
605
|
-
description:
|
|
602
|
+
description: description,
|
|
606
603
|
schema: schema,
|
|
607
604
|
uiSchema: uiSchema,
|
|
608
605
|
registry: registry
|
|
@@ -799,16 +796,23 @@ var Templates = /*#__PURE__*/generateTemplates();
|
|
|
799
796
|
* @param props - The `WidgetProps` for this component
|
|
800
797
|
*/
|
|
801
798
|
function CheckboxWidget(props) {
|
|
799
|
+
var _options$description;
|
|
802
800
|
var schema = props.schema,
|
|
803
801
|
id = props.id,
|
|
804
802
|
value = props.value,
|
|
805
803
|
disabled = props.disabled,
|
|
806
804
|
readonly = props.readonly,
|
|
807
|
-
label = props.label,
|
|
805
|
+
_props$label = props.label,
|
|
806
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
807
|
+
hideLabel = props.hideLabel,
|
|
808
808
|
autofocus = props.autofocus,
|
|
809
809
|
onChange = props.onChange,
|
|
810
810
|
onBlur = props.onBlur,
|
|
811
|
-
onFocus = props.onFocus
|
|
811
|
+
onFocus = props.onFocus,
|
|
812
|
+
registry = props.registry,
|
|
813
|
+
options = props.options,
|
|
814
|
+
uiSchema = props.uiSchema;
|
|
815
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
812
816
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
813
817
|
// the "required" attribute if the field value must be "true", due to the
|
|
814
818
|
// "const" or "enum" keywords
|
|
@@ -824,20 +828,29 @@ function CheckboxWidget(props) {
|
|
|
824
828
|
var value = _ref2.target.value;
|
|
825
829
|
return onFocus(id, value);
|
|
826
830
|
};
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
831
|
+
var description = (_options$description = options.description) != null ? _options$description : schema.description;
|
|
832
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
833
|
+
children: [!hideLabel && !!description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
834
|
+
id: utils.descriptionId(id),
|
|
835
|
+
description: description,
|
|
836
|
+
schema: schema,
|
|
837
|
+
uiSchema: uiSchema,
|
|
838
|
+
registry: registry
|
|
839
|
+
}), jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
840
|
+
control: jsxRuntime.jsx(Checkbox__default["default"], {
|
|
841
|
+
id: id,
|
|
842
|
+
name: id,
|
|
843
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
844
|
+
required: required,
|
|
845
|
+
disabled: disabled || readonly,
|
|
846
|
+
autoFocus: autofocus,
|
|
847
|
+
onChange: _onChange,
|
|
848
|
+
onBlur: _onBlur,
|
|
849
|
+
onFocus: _onFocus,
|
|
850
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
851
|
+
}),
|
|
852
|
+
label: utils.labelValue(label, hideLabel, false)
|
|
853
|
+
})]
|
|
841
854
|
});
|
|
842
855
|
}
|
|
843
856
|
|
|
@@ -847,8 +860,8 @@ function CheckboxWidget(props) {
|
|
|
847
860
|
* @param props - The `WidgetProps` for this component
|
|
848
861
|
*/
|
|
849
862
|
function CheckboxesWidget(_ref) {
|
|
850
|
-
var
|
|
851
|
-
|
|
863
|
+
var label = _ref.label,
|
|
864
|
+
hideLabel = _ref.hideLabel,
|
|
852
865
|
id = _ref.id,
|
|
853
866
|
disabled = _ref.disabled,
|
|
854
867
|
options = _ref.options,
|
|
@@ -883,11 +896,11 @@ function CheckboxesWidget(_ref) {
|
|
|
883
896
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
884
897
|
};
|
|
885
898
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
886
|
-
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
899
|
+
children: [utils.labelValue(jsxRuntime.jsx(FormLabel__default["default"], {
|
|
887
900
|
required: required,
|
|
888
901
|
htmlFor: id,
|
|
889
|
-
children: label ||
|
|
890
|
-
}), jsxRuntime.jsx(FormGroup__default["default"], {
|
|
902
|
+
children: label || undefined
|
|
903
|
+
}), hideLabel), jsxRuntime.jsx(FormGroup__default["default"], {
|
|
891
904
|
id: id,
|
|
892
905
|
row: !!inline,
|
|
893
906
|
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
@@ -919,14 +932,15 @@ function CheckboxesWidget(_ref) {
|
|
|
919
932
|
* @param props - The `WidgetProps` for this component
|
|
920
933
|
*/
|
|
921
934
|
function RadioWidget(_ref) {
|
|
935
|
+
var _enumOptionsIndexForV;
|
|
922
936
|
var id = _ref.id,
|
|
923
|
-
schema = _ref.schema,
|
|
924
937
|
options = _ref.options,
|
|
925
938
|
value = _ref.value,
|
|
926
939
|
required = _ref.required,
|
|
927
940
|
disabled = _ref.disabled,
|
|
928
941
|
readonly = _ref.readonly,
|
|
929
942
|
label = _ref.label,
|
|
943
|
+
hideLabel = _ref.hideLabel,
|
|
930
944
|
onChange = _ref.onChange,
|
|
931
945
|
onBlur = _ref.onBlur,
|
|
932
946
|
onFocus = _ref.onFocus;
|
|
@@ -945,13 +959,13 @@ function RadioWidget(_ref) {
|
|
|
945
959
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
946
960
|
};
|
|
947
961
|
var row = options ? options.inline : false;
|
|
948
|
-
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
962
|
+
var selectedIndex = (_enumOptionsIndexForV = utils.enumOptionsIndexForValue(value, enumOptions)) != null ? _enumOptionsIndexForV : null;
|
|
949
963
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
950
|
-
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
964
|
+
children: [utils.labelValue(jsxRuntime.jsx(FormLabel__default["default"], {
|
|
951
965
|
required: required,
|
|
952
966
|
htmlFor: id,
|
|
953
|
-
children: label ||
|
|
954
|
-
}), jsxRuntime.jsx(RadioGroup__default["default"], {
|
|
967
|
+
children: label || undefined
|
|
968
|
+
}), hideLabel), jsxRuntime.jsx(RadioGroup__default["default"], {
|
|
955
969
|
id: id,
|
|
956
970
|
name: id,
|
|
957
971
|
value: selectedIndex,
|
|
@@ -994,6 +1008,7 @@ function RangeWidget(props) {
|
|
|
994
1008
|
onChange = props.onChange,
|
|
995
1009
|
required = props.required,
|
|
996
1010
|
label = props.label,
|
|
1011
|
+
hideLabel = props.hideLabel,
|
|
997
1012
|
id = props.id;
|
|
998
1013
|
var sliderProps = _extends({
|
|
999
1014
|
value: value,
|
|
@@ -1013,11 +1028,11 @@ function RangeWidget(props) {
|
|
|
1013
1028
|
return onFocus(id, value);
|
|
1014
1029
|
};
|
|
1015
1030
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1016
|
-
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
1031
|
+
children: [utils.labelValue(jsxRuntime.jsx(FormLabel__default["default"], {
|
|
1017
1032
|
required: required,
|
|
1018
1033
|
htmlFor: id,
|
|
1019
|
-
children: label ||
|
|
1020
|
-
}), jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1034
|
+
children: label || undefined
|
|
1035
|
+
}), hideLabel), jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1021
1036
|
disabled: disabled || readonly,
|
|
1022
1037
|
onChange: _onChange,
|
|
1023
1038
|
onBlur: _onBlur,
|
|
@@ -1029,17 +1044,17 @@ function RangeWidget(props) {
|
|
|
1029
1044
|
});
|
|
1030
1045
|
}
|
|
1031
1046
|
|
|
1032
|
-
var _excluded = ["schema", "id", "name", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
1047
|
+
var _excluded = ["schema", "id", "name", "options", "label", "hideLabel", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
1033
1048
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1034
1049
|
* It is typically used with string properties constrained with enum options.
|
|
1035
1050
|
*
|
|
1036
1051
|
* @param props - The `WidgetProps` for this component
|
|
1037
1052
|
*/
|
|
1038
1053
|
function SelectWidget(_ref) {
|
|
1039
|
-
var
|
|
1040
|
-
id = _ref.id,
|
|
1054
|
+
var id = _ref.id,
|
|
1041
1055
|
options = _ref.options,
|
|
1042
1056
|
label = _ref.label,
|
|
1057
|
+
hideLabel = _ref.hideLabel,
|
|
1043
1058
|
required = _ref.required,
|
|
1044
1059
|
disabled = _ref.disabled,
|
|
1045
1060
|
placeholder = _ref.placeholder,
|
|
@@ -1075,7 +1090,7 @@ function SelectWidget(_ref) {
|
|
|
1075
1090
|
return jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
1076
1091
|
id: id,
|
|
1077
1092
|
name: id,
|
|
1078
|
-
label: label ||
|
|
1093
|
+
label: utils.labelValue(label || undefined, hideLabel, false),
|
|
1079
1094
|
value: isEmpty ? emptyValue : selectedIndexes,
|
|
1080
1095
|
required: required,
|
|
1081
1096
|
disabled: disabled || readonly,
|