@rjsf/core 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.
@@ -88,9 +88,9 @@
88
88
  return typeof key === "symbol" ? key : String(key);
89
89
  }
90
90
 
91
- var _excluded$9 = ["widget"],
92
- _excluded2 = ["widget"],
93
- _excluded3 = ["widget"];
91
+ var _excluded$9 = ["widget", "title"],
92
+ _excluded2 = ["widget", "title"],
93
+ _excluded3 = ["widget", "title"];
94
94
  /** Used to generate a unique ID for an element in a row */
95
95
  function generateRowId() {
96
96
  return nanoid.nanoid();
@@ -511,6 +511,7 @@
511
511
  /** Renders an array using the custom widget provided by the user in the `uiSchema`
512
512
  */;
513
513
  _proto.renderCustomWidget = function renderCustomWidget() {
514
+ var _ref;
514
515
  var _this$props9 = this.props,
515
516
  schema = _this$props9.schema,
516
517
  idSchema = _this$props9.idSchema,
@@ -533,12 +534,16 @@
533
534
  rawErrors = _this$props9.rawErrors,
534
535
  name = _this$props9.name;
535
536
  var widgets = registry.widgets,
536
- formContext = registry.formContext;
537
- var title = schema.title || name;
538
- var _getUiOptions2 = utils.getUiOptions(uiSchema),
537
+ formContext = registry.formContext,
538
+ globalUiOptions = registry.globalUiOptions,
539
+ schemaUtils = registry.schemaUtils;
540
+ var _getUiOptions2 = utils.getUiOptions(uiSchema, globalUiOptions),
539
541
  widget = _getUiOptions2.widget,
542
+ uiTitle = _getUiOptions2.title,
540
543
  options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
541
544
  var Widget = utils.getWidget(schema, widget, widgets);
545
+ var label = (_ref = uiTitle != null ? uiTitle : schema.title) != null ? _ref : name;
546
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
542
547
  return jsxRuntime.jsx(Widget, {
543
548
  id: idSchema.$id,
544
549
  name: name,
@@ -555,7 +560,8 @@
555
560
  readonly: readonly,
556
561
  hideError: hideError,
557
562
  required: required,
558
- label: title,
563
+ label: label,
564
+ hideLabel: !displayLabel,
559
565
  placeholder: placeholder,
560
566
  formContext: formContext,
561
567
  autofocus: autofocus,
@@ -565,6 +571,7 @@
565
571
  /** Renders an array as a set of checkboxes
566
572
  */;
567
573
  _proto.renderMultiSelect = function renderMultiSelect() {
574
+ var _ref2;
568
575
  var _this$props10 = this.props,
569
576
  schema = _this$props10.schema,
570
577
  idSchema = _this$props10.idSchema,
@@ -587,15 +594,18 @@
587
594
  name = _this$props10.name;
588
595
  var widgets = registry.widgets,
589
596
  schemaUtils = registry.schemaUtils,
590
- formContext = registry.formContext;
597
+ formContext = registry.formContext,
598
+ globalUiOptions = registry.globalUiOptions;
591
599
  var itemsSchema = schemaUtils.retrieveSchema(schema.items, items);
592
- var title = schema.title || name;
593
600
  var enumOptions = utils.optionsList(itemsSchema);
594
- var _getUiOptions3 = utils.getUiOptions(uiSchema),
601
+ var _getUiOptions3 = utils.getUiOptions(uiSchema, globalUiOptions),
595
602
  _getUiOptions3$widget = _getUiOptions3.widget,
596
603
  widget = _getUiOptions3$widget === void 0 ? 'select' : _getUiOptions3$widget,
604
+ uiTitle = _getUiOptions3.title,
597
605
  options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
598
606
  var Widget = utils.getWidget(schema, widget, widgets);
607
+ var label = (_ref2 = uiTitle != null ? uiTitle : schema.title) != null ? _ref2 : name;
608
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
599
609
  return jsxRuntime.jsx(Widget, {
600
610
  id: idSchema.$id,
601
611
  name: name,
@@ -613,7 +623,8 @@
613
623
  disabled: disabled,
614
624
  readonly: readonly,
615
625
  required: required,
616
- label: title,
626
+ label: label,
627
+ hideLabel: !displayLabel,
617
628
  placeholder: placeholder,
618
629
  formContext: formContext,
619
630
  autofocus: autofocus,
@@ -623,6 +634,7 @@
623
634
  /** Renders an array of files using the `FileWidget`
624
635
  */;
625
636
  _proto.renderFiles = function renderFiles() {
637
+ var _ref3;
626
638
  var _this$props11 = this.props,
627
639
  schema = _this$props11.schema,
628
640
  uiSchema = _this$props11.uiSchema,
@@ -642,14 +654,18 @@
642
654
  _this$props11$formDat = _this$props11.formData,
643
655
  items = _this$props11$formDat === void 0 ? [] : _this$props11$formDat,
644
656
  rawErrors = _this$props11.rawErrors;
645
- var title = schema.title || name;
646
657
  var widgets = registry.widgets,
647
- formContext = registry.formContext;
648
- var _getUiOptions4 = utils.getUiOptions(uiSchema),
658
+ formContext = registry.formContext,
659
+ globalUiOptions = registry.globalUiOptions,
660
+ schemaUtils = registry.schemaUtils;
661
+ var _getUiOptions4 = utils.getUiOptions(uiSchema, globalUiOptions),
649
662
  _getUiOptions4$widget = _getUiOptions4.widget,
650
663
  widget = _getUiOptions4$widget === void 0 ? 'files' : _getUiOptions4$widget,
664
+ uiTitle = _getUiOptions4.title,
651
665
  options = _objectWithoutPropertiesLoose(_getUiOptions4, _excluded3);
652
666
  var Widget = utils.getWidget(schema, widget, widgets);
667
+ var label = (_ref3 = uiTitle != null ? uiTitle : schema.title) != null ? _ref3 : name;
668
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
653
669
  return jsxRuntime.jsx(Widget, {
654
670
  options: options,
655
671
  id: idSchema.$id,
@@ -660,7 +676,6 @@
660
676
  onFocus: onFocus,
661
677
  schema: schema,
662
678
  uiSchema: uiSchema,
663
- title: title,
664
679
  value: items,
665
680
  disabled: disabled,
666
681
  readonly: readonly,
@@ -669,7 +684,8 @@
669
684
  formContext: formContext,
670
685
  autofocus: autofocus,
671
686
  rawErrors: rawErrors,
672
- label: ''
687
+ label: label,
688
+ hideLabel: !displayLabel
673
689
  });
674
690
  }
675
691
  /** Renders an array that has a maximum limit of items
@@ -881,13 +897,14 @@
881
897
  return ArrayField;
882
898
  }(react.Component);
883
899
 
884
- var _excluded$8 = ["widget"];
900
+ var _excluded$8 = ["widget", "title", "label"];
885
901
  /** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
886
902
  * two boolean values based on the various alternatives in the schema.
887
903
  *
888
904
  * @param props - The `FieldProps` for this template
889
905
  */
890
906
  function BooleanField(props) {
907
+ var _ref;
891
908
  var schema = props.schema,
892
909
  name = props.name,
893
910
  uiSchema = props.uiSchema,
@@ -905,15 +922,20 @@
905
922
  var title = schema.title;
906
923
  var widgets = registry.widgets,
907
924
  formContext = registry.formContext,
908
- translateString = registry.translateString;
909
- var _getUiOptions = utils.getUiOptions(uiSchema),
925
+ translateString = registry.translateString,
926
+ globalUiOptions = registry.globalUiOptions;
927
+ var _getUiOptions = utils.getUiOptions(uiSchema, globalUiOptions),
910
928
  _getUiOptions$widget = _getUiOptions.widget,
911
929
  widget = _getUiOptions$widget === void 0 ? 'checkbox' : _getUiOptions$widget,
930
+ uiTitle = _getUiOptions.title,
931
+ _getUiOptions$label = _getUiOptions.label,
932
+ displayLabel = _getUiOptions$label === void 0 ? true : _getUiOptions$label,
912
933
  options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$8);
913
934
  var Widget = utils.getWidget(schema, widget, widgets);
914
935
  var yes = translateString(utils.TranslatableString.YesLabel);
915
936
  var no = translateString(utils.TranslatableString.NoLabel);
916
937
  var enumOptions;
938
+ var label = (_ref = uiTitle != null ? uiTitle : title) != null ? _ref : name;
917
939
  if (Array.isArray(schema.oneOf)) {
918
940
  enumOptions = utils.optionsList({
919
941
  oneOf: schema.oneOf.map(function (option) {
@@ -961,7 +983,8 @@
961
983
  onChange: onChange,
962
984
  onFocus: onFocus,
963
985
  onBlur: onBlur,
964
- label: title === undefined ? name : title,
986
+ label: label,
987
+ hideLabel: !displayLabel,
965
988
  value: formData,
966
989
  required: required,
967
990
  disabled: disabled,
@@ -1114,12 +1137,14 @@
1114
1137
  uiSchema = _this$props5.uiSchema;
1115
1138
  var widgets = registry.widgets,
1116
1139
  fields = registry.fields,
1117
- translateString = registry.translateString;
1140
+ translateString = registry.translateString,
1141
+ globalUiOptions = registry.globalUiOptions,
1142
+ schemaUtils = registry.schemaUtils;
1118
1143
  var _SchemaField = fields.SchemaField;
1119
1144
  var _this$state2 = this.state,
1120
1145
  selectedOption = _this$state2.selectedOption,
1121
1146
  retrievedOptions = _this$state2.retrievedOptions;
1122
- var _getUiOptions = utils.getUiOptions(uiSchema),
1147
+ var _getUiOptions = utils.getUiOptions(uiSchema, globalUiOptions),
1123
1148
  _getUiOptions$widget = _getUiOptions.widget,
1124
1149
  widget = _getUiOptions$widget === void 0 ? 'select' : _getUiOptions$widget,
1125
1150
  placeholder = _getUiOptions.placeholder,
@@ -1133,6 +1158,7 @@
1133
1158
  }, widget, widgets);
1134
1159
  var rawErrors = get__default["default"](errorSchema, utils.ERRORS_KEY, []);
1135
1160
  var fieldErrorSchema = omit__default["default"](errorSchema, [utils.ERRORS_KEY]);
1161
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1136
1162
  var option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
1137
1163
  var optionSchema;
1138
1164
  if (option) {
@@ -1177,7 +1203,8 @@
1177
1203
  placeholder: placeholder,
1178
1204
  autocomplete: autocomplete,
1179
1205
  autofocus: autofocus,
1180
- label: ''
1206
+ label: title != null ? title : name,
1207
+ hideLabel: !displayLabel
1181
1208
  })
1182
1209
  }), option !== null && jsxRuntime.jsx(_SchemaField, _extends({}, this.props, {
1183
1210
  schema: optionSchema
@@ -1432,7 +1459,10 @@
1432
1459
  /** Renders the `ObjectField` from the given props
1433
1460
  */
1434
1461
  _proto.render = function render() {
1435
- var _this2 = this;
1462
+ var _ref2,
1463
+ _uiOptions$title,
1464
+ _uiOptions$descriptio,
1465
+ _this2 = this;
1436
1466
  var _this$props6 = this.props,
1437
1467
  rawSchema = _this$props6.schema,
1438
1468
  _this$props6$uiSchema = _this$props6.uiSchema,
@@ -1456,14 +1486,15 @@
1456
1486
  var fields = registry.fields,
1457
1487
  formContext = registry.formContext,
1458
1488
  schemaUtils = registry.schemaUtils,
1459
- translateString = registry.translateString;
1489
+ translateString = registry.translateString,
1490
+ globalUiOptions = registry.globalUiOptions;
1460
1491
  var SchemaField = fields.SchemaField;
1461
1492
  var schema = schemaUtils.retrieveSchema(rawSchema, formData);
1462
- var uiOptions = utils.getUiOptions(uiSchema);
1493
+ var uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
1463
1494
  var _schema$properties = schema.properties,
1464
1495
  schemaProperties = _schema$properties === void 0 ? {} : _schema$properties;
1465
- var title = uiOptions.title || (schema.title === undefined ? name : schema.title);
1466
- var description = uiOptions.description || schema.description;
1496
+ var title = (_ref2 = (_uiOptions$title = uiOptions.title) != null ? _uiOptions$title : schema.title) != null ? _ref2 : name;
1497
+ var description = (_uiOptions$descriptio = uiOptions.description) != null ? _uiOptions$descriptio : schema.description;
1467
1498
  var orderedProperties;
1468
1499
  try {
1469
1500
  var properties = Object.keys(schemaProperties);
@@ -1485,8 +1516,9 @@
1485
1516
  }
1486
1517
  var Template = utils.getTemplate('ObjectFieldTemplate', registry, uiOptions);
1487
1518
  var templateProps = {
1488
- title: title,
1489
- description: description,
1519
+ // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
1520
+ title: uiOptions.label === false ? '' : title,
1521
+ description: uiOptions.label === false ? undefined : description,
1490
1522
  properties: orderedProperties.map(function (name) {
1491
1523
  var addedByAdditionalProperties = has__default["default"](schema, [utils.PROPERTIES_KEY, name, utils.ADDITIONAL_PROPERTY_FLAG]);
1492
1524
  var fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];
@@ -1527,6 +1559,7 @@
1527
1559
  required: required,
1528
1560
  idSchema: idSchema,
1529
1561
  uiSchema: uiSchema,
1562
+ errorSchema: errorSchema,
1530
1563
  schema: schema,
1531
1564
  formData: formData,
1532
1565
  formContext: formContext,
@@ -1803,12 +1836,13 @@
1803
1836
  return SchemaField;
1804
1837
  }(react.Component);
1805
1838
 
1806
- var _excluded$5 = ["widget", "placeholder"];
1839
+ var _excluded$5 = ["widget", "placeholder", "title"];
1807
1840
  /** The `StringField` component is used to render a schema field that represents a string type
1808
1841
  *
1809
1842
  * @param props - The `FieldProps` for this template
1810
1843
  */
1811
1844
  function StringField(props) {
1845
+ var _ref;
1812
1846
  var schema = props.schema,
1813
1847
  name = props.name,
1814
1848
  uiSchema = props.uiSchema,
@@ -1830,7 +1864,8 @@
1830
1864
  format = schema.format;
1831
1865
  var widgets = registry.widgets,
1832
1866
  formContext = registry.formContext,
1833
- schemaUtils = registry.schemaUtils;
1867
+ schemaUtils = registry.schemaUtils,
1868
+ globalUiOptions = registry.globalUiOptions;
1834
1869
  var enumOptions = schemaUtils.isSelect(schema) ? utils.optionsList(schema) : undefined;
1835
1870
  var defaultWidget = enumOptions ? 'select' : 'text';
1836
1871
  if (format && utils.hasWidget(schema, format, widgets)) {
@@ -1841,7 +1876,10 @@
1841
1876
  widget = _getUiOptions$widget === void 0 ? defaultWidget : _getUiOptions$widget,
1842
1877
  _getUiOptions$placeho = _getUiOptions.placeholder,
1843
1878
  placeholder = _getUiOptions$placeho === void 0 ? '' : _getUiOptions$placeho,
1879
+ uiTitle = _getUiOptions.title,
1844
1880
  options = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$5);
1881
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1882
+ var label = (_ref = uiTitle != null ? uiTitle : title) != null ? _ref : name;
1845
1883
  var Widget = utils.getWidget(schema, widget, widgets);
1846
1884
  return jsxRuntime.jsx(Widget, {
1847
1885
  options: _extends({}, options, {
@@ -1851,7 +1889,8 @@
1851
1889
  uiSchema: uiSchema,
1852
1890
  id: idSchema.$id,
1853
1891
  name: name,
1854
- label: title === undefined ? name : title,
1892
+ label: label,
1893
+ hideLabel: !displayLabel,
1855
1894
  value: formData,
1856
1895
  onChange: onChange,
1857
1896
  onBlur: onBlur,
@@ -1909,7 +1948,7 @@
1909
1948
  registry = props.registry,
1910
1949
  schema = props.schema,
1911
1950
  uiSchema = props.uiSchema;
1912
- var options = utils.getUiOptions(uiSchema);
1951
+ var options = utils.getUiOptions(uiSchema, registry.globalUiOptions);
1913
1952
  var _options$label = options.label,
1914
1953
  displayLabel = _options$label === void 0 ? true : _options$label;
1915
1954
  if (!description || !displayLabel) {
@@ -2068,7 +2107,7 @@
2068
2107
  uiSchema = props.uiSchema,
2069
2108
  required = props.required,
2070
2109
  registry = props.registry;
2071
- var options = utils.getUiOptions(uiSchema);
2110
+ var options = utils.getUiOptions(uiSchema, registry.globalUiOptions);
2072
2111
  var _options$label = options.label,
2073
2112
  displayLabel = _options$label === void 0 ? true : _options$label;
2074
2113
  if (!title || !displayLabel) {
@@ -2085,7 +2124,7 @@
2085
2124
  });
2086
2125
  }
2087
2126
 
2088
- var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type"];
2127
+ var _excluded$3 = ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type", "hideLabel", "hideError"];
2089
2128
  /** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
2090
2129
  * It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
2091
2130
  * It can be customized/overridden for other themes or individual implementations as needed.
@@ -2173,7 +2212,7 @@
2173
2212
  children: jsxRuntime.jsx("button", _extends({
2174
2213
  type: 'submit'
2175
2214
  }, submitButtonProps, {
2176
- className: "btn btn-info " + submitButtonProps.className,
2215
+ className: "btn btn-info " + (submitButtonProps.className || ''),
2177
2216
  children: submitText
2178
2217
  }))
2179
2218
  });
@@ -2457,16 +2496,16 @@
2457
2496
  var AddButton = registry.templates.ButtonTemplates.AddButton;
2458
2497
  return jsxRuntime.jsxs("fieldset", {
2459
2498
  id: idSchema.$id,
2460
- children: [(options.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
2499
+ children: [title && jsxRuntime.jsx(TitleFieldTemplate, {
2461
2500
  id: utils.titleId(idSchema),
2462
- title: options.title || title,
2501
+ title: title,
2463
2502
  required: required,
2464
2503
  schema: schema,
2465
2504
  uiSchema: uiSchema,
2466
2505
  registry: registry
2467
- }), (options.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
2506
+ }), description && jsxRuntime.jsx(DescriptionFieldTemplate, {
2468
2507
  id: utils.descriptionId(idSchema),
2469
- description: options.description || description,
2508
+ description: description,
2470
2509
  schema: schema,
2471
2510
  uiSchema: uiSchema,
2472
2511
  registry: registry
@@ -2842,6 +2881,7 @@
2842
2881
  * @param props - The `WidgetProps` for this component
2843
2882
  */
2844
2883
  function CheckboxWidget(_ref) {
2884
+ var _options$description;
2845
2885
  var schema = _ref.schema,
2846
2886
  uiSchema = _ref.uiSchema,
2847
2887
  options = _ref.options,
@@ -2850,6 +2890,7 @@
2850
2890
  disabled = _ref.disabled,
2851
2891
  readonly = _ref.readonly,
2852
2892
  label = _ref.label,
2893
+ hideLabel = _ref.hideLabel,
2853
2894
  _ref$autofocus = _ref.autofocus,
2854
2895
  autofocus = _ref$autofocus === void 0 ? false : _ref$autofocus,
2855
2896
  onBlur = _ref.onBlur,
@@ -2870,11 +2911,12 @@
2870
2911
  var handleFocus = react.useCallback(function (event) {
2871
2912
  return onFocus(id, event.target.checked);
2872
2913
  }, [onFocus, id]);
2914
+ var description = (_options$description = options.description) != null ? _options$description : schema.description;
2873
2915
  return jsxRuntime.jsxs("div", {
2874
2916
  className: "checkbox " + (disabled || readonly ? 'disabled' : ''),
2875
- children: [schema.description && jsxRuntime.jsx(DescriptionFieldTemplate, {
2917
+ children: [!hideLabel && !!description && jsxRuntime.jsx(DescriptionFieldTemplate, {
2876
2918
  id: utils.descriptionId(id),
2877
- description: schema.description,
2919
+ description: description,
2878
2920
  schema: schema,
2879
2921
  uiSchema: uiSchema,
2880
2922
  registry: registry
@@ -2891,9 +2933,9 @@
2891
2933
  onBlur: handleBlur,
2892
2934
  onFocus: handleFocus,
2893
2935
  "aria-describedby": utils.ariaDescribedByIds(id)
2894
- }), jsxRuntime.jsx("span", {
2936
+ }), utils.labelValue(jsxRuntime.jsx("span", {
2895
2937
  children: label
2896
- })]
2938
+ }), hideLabel)]
2897
2939
  })]
2898
2940
  });
2899
2941
  }
@@ -3081,9 +3123,38 @@
3081
3123
  function processFiles(files) {
3082
3124
  return Promise.all(Array.from(files).map(processFile));
3083
3125
  }
3084
- function FilesInfo(_ref) {
3085
- var filesInfo = _ref.filesInfo,
3126
+ function FileInfoPreview(_ref) {
3127
+ var fileInfo = _ref.fileInfo,
3086
3128
  registry = _ref.registry;
3129
+ var translateString = registry.translateString;
3130
+ var dataURL = fileInfo.dataURL,
3131
+ type = fileInfo.type,
3132
+ name = fileInfo.name;
3133
+ if (!dataURL) {
3134
+ return null;
3135
+ }
3136
+ if (type.indexOf('image') !== -1) {
3137
+ return jsxRuntime.jsx("img", {
3138
+ src: dataURL,
3139
+ style: {
3140
+ maxWidth: '100%'
3141
+ },
3142
+ className: 'file-preview'
3143
+ });
3144
+ }
3145
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3146
+ children: [' ', jsxRuntime.jsx("a", {
3147
+ download: "preview-" + name,
3148
+ href: dataURL,
3149
+ className: 'file-download',
3150
+ children: translateString(utils.TranslatableString.PreviewLabel)
3151
+ })]
3152
+ });
3153
+ }
3154
+ function FilesInfo(_ref2) {
3155
+ var filesInfo = _ref2.filesInfo,
3156
+ registry = _ref2.registry,
3157
+ preview = _ref2.preview;
3087
3158
  if (filesInfo.length === 0) {
3088
3159
  return null;
3089
3160
  }
@@ -3094,10 +3165,13 @@
3094
3165
  var name = fileInfo.name,
3095
3166
  size = fileInfo.size,
3096
3167
  type = fileInfo.type;
3097
- return jsxRuntime.jsx("li", {
3098
- children: jsxRuntime.jsx(Markdown__default["default"], {
3168
+ return jsxRuntime.jsxs("li", {
3169
+ children: [jsxRuntime.jsx(Markdown__default["default"], {
3099
3170
  children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)])
3100
- })
3171
+ }), preview && jsxRuntime.jsx(FileInfoPreview, {
3172
+ fileInfo: fileInfo,
3173
+ registry: registry
3174
+ })]
3101
3175
  }, key);
3102
3176
  })
3103
3177
  });
@@ -3110,6 +3184,7 @@
3110
3184
  blob = _dataURItoBlob.blob,
3111
3185
  name = _dataURItoBlob.name;
3112
3186
  return {
3187
+ dataURL: dataURL,
3113
3188
  name: name,
3114
3189
  size: blob.size,
3115
3190
  type: blob.type
@@ -3123,6 +3198,7 @@
3123
3198
  function FileWidget(props) {
3124
3199
  var disabled = props.disabled,
3125
3200
  readonly = props.readonly,
3201
+ required = props.required,
3126
3202
  multiple = props.multiple,
3127
3203
  onChange = props.onChange,
3128
3204
  value = props.value,
@@ -3155,12 +3231,14 @@
3155
3231
  children: [jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
3156
3232
  disabled: disabled || readonly,
3157
3233
  type: 'file',
3234
+ required: value ? false : required,
3158
3235
  onChangeOverride: handleChange,
3159
3236
  value: '',
3160
3237
  accept: options.accept ? String(options.accept) : undefined
3161
3238
  })), jsxRuntime.jsx(FilesInfo, {
3162
3239
  filesInfo: filesInfo,
3163
- registry: registry
3240
+ registry: registry,
3241
+ preview: options.filePreview
3164
3242
  })]
3165
3243
  });
3166
3244
  }
@@ -3211,8 +3289,6 @@
3211
3289
  onFocus = _ref.onFocus,
3212
3290
  onChange = _ref.onChange,
3213
3291
  id = _ref.id;
3214
- // Generating a unique field name to identify this set of radio buttons
3215
- var name = Math.random().toString();
3216
3292
  var enumOptions = options.enumOptions,
3217
3293
  enumDisabled = options.enumDisabled,
3218
3294
  inline = options.inline,
@@ -3240,7 +3316,7 @@
3240
3316
  type: 'radio',
3241
3317
  id: utils.optionId(id, i),
3242
3318
  checked: checked,
3243
- name: name,
3319
+ name: id,
3244
3320
  required: required,
3245
3321
  value: String(i),
3246
3322
  disabled: disabled || itemDisabled || readonly,
@@ -3923,6 +3999,10 @@
3923
3999
  // if not an exact match, try finding an input starting with the element id (like radio buttons or checkboxes)
3924
4000
  field = this.formElement.current.querySelector("input[id^=" + elementId);
3925
4001
  }
4002
+ if (field.length) {
4003
+ // If we got a list with length > 0
4004
+ field = field[0];
4005
+ }
3926
4006
  if (field) {
3927
4007
  field.focus();
3928
4008
  }