@rjsf/react-bootstrap 6.6.0 → 6.6.2
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 +83 -64
- package/dist/index.cjs.map +3 -3
- package/dist/react-bootstrap.esm.js +90 -102
- package/dist/react-bootstrap.esm.js.map +3 -3
- package/dist/react-bootstrap.umd.js +82 -64
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +5 -5
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/ErrorList/ErrorList.js +1 -3
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +1 -3
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/Form/Form.d.ts +3 -3
- package/lib/Form/Form.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +15 -8
- package/lib/IconButton/IconButton.js +14 -6
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +5 -5
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +6 -6
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +6 -8
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +4 -4
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +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/AddButton/AddButton.tsx +2 -1
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -9
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +3 -10
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -19
- package/src/CheckboxWidget/CheckboxWidget.tsx +9 -18
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +10 -13
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +8 -8
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +8 -8
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/Form/Form.tsx +4 -3
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/IconButton.tsx +18 -8
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -14
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +11 -14
- package/src/RangeWidget/RangeWidget.tsx +9 -8
- package/src/SelectWidget/SelectWidget.tsx +15 -14
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -9
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +2 -1
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
package/dist/index.cjs
CHANGED
|
@@ -206,10 +206,10 @@ function BaseInputTemplate({
|
|
|
206
206
|
...extraProps,
|
|
207
207
|
...(0, import_utils4.getInputProps)(schema, type, options)
|
|
208
208
|
};
|
|
209
|
-
const
|
|
210
|
-
const
|
|
211
|
-
const
|
|
212
|
-
const
|
|
209
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
210
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
211
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
212
|
+
const handleClear = (0, import_react.useCallback)(
|
|
213
213
|
(e) => {
|
|
214
214
|
e.preventDefault();
|
|
215
215
|
e.stopPropagation();
|
|
@@ -232,13 +232,13 @@ function BaseInputTemplate({
|
|
|
232
232
|
list: schema.examples ? (0, import_utils4.examplesId)(id) : void 0,
|
|
233
233
|
...inputProps,
|
|
234
234
|
value: value || value === 0 ? value : "",
|
|
235
|
-
onChange: onChangeOverride ||
|
|
236
|
-
onBlur:
|
|
237
|
-
onFocus:
|
|
235
|
+
onChange: onChangeOverride || handleChange,
|
|
236
|
+
onBlur: handleBlur,
|
|
237
|
+
onFocus: handleFocus,
|
|
238
238
|
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
239
239
|
}
|
|
240
240
|
),
|
|
241
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick:
|
|
241
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
242
242
|
children,
|
|
243
243
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core.SchemaExamples, { id, schema })
|
|
244
244
|
] });
|
|
@@ -266,9 +266,10 @@ function ErrorList({
|
|
|
266
266
|
const { translateString } = registry;
|
|
267
267
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_Card.default, { border: "danger", className: "mb-4", children: [
|
|
268
268
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Card.default.Header, { className: "alert-danger", children: translateString(import_utils5.TranslatableString.ErrorsLabel) }),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Card.default.Body, { className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListGroup.default, { children: errors.map((error, i) =>
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Card.default.Body, { className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListGroup.default, { children: errors.map((error, i) => (
|
|
270
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListGroup.default.Item, { className: "border-0", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: error.stack }) }, i)
|
|
272
|
+
)) }) })
|
|
272
273
|
] });
|
|
273
274
|
}
|
|
274
275
|
|
|
@@ -282,9 +283,10 @@ function FieldErrorTemplate(props) {
|
|
|
282
283
|
return null;
|
|
283
284
|
}
|
|
284
285
|
const id = (0, import_utils6.errorId)(fieldPathId);
|
|
285
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ListGroup2.default, { as: "ul", id, children: errors.map((error, i) =>
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ListGroup2.default, { as: "ul", id, children: errors.map((error, i) => (
|
|
287
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ListGroup2.default.Item, { as: "li", className: "border-0 m-0 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "m-0 text-danger", children: error }) }, i)
|
|
289
|
+
)) });
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -382,6 +384,7 @@ function GridTemplate(props) {
|
|
|
382
384
|
}
|
|
383
385
|
|
|
384
386
|
// src/IconButton/IconButton.tsx
|
|
387
|
+
var import_react2 = require("react");
|
|
385
388
|
var import_AiOutlineArrowDown = require("@react-icons/all-files/ai/AiOutlineArrowDown");
|
|
386
389
|
var import_AiOutlineArrowUp = require("@react-icons/all-files/ai/AiOutlineArrowUp");
|
|
387
390
|
var import_IoIosCopy = require("@react-icons/all-files/io/IoIosCopy");
|
|
@@ -390,29 +393,34 @@ var import_IoMdClose = require("@react-icons/all-files/io/IoMdClose");
|
|
|
390
393
|
var import_utils9 = require("@rjsf/utils");
|
|
391
394
|
var import_Button2 = __toESM(require("react-bootstrap/Button"), 1);
|
|
392
395
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
393
|
-
function
|
|
396
|
+
function IconButtonFn(props) {
|
|
394
397
|
const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
|
|
395
398
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Button2.default, { ...otherProps, variant: props.variant || "light", size: "sm", children: icon });
|
|
396
399
|
}
|
|
397
|
-
|
|
400
|
+
var IconButton = (0, import_react2.memo)(IconButtonFn);
|
|
401
|
+
var IconButton_default = IconButton;
|
|
402
|
+
function CopyButtonFn(props) {
|
|
398
403
|
const {
|
|
399
404
|
registry: { translateString }
|
|
400
405
|
} = props;
|
|
401
406
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: translateString(import_utils9.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_IoIosCopy.IoIosCopy, {}) });
|
|
402
407
|
}
|
|
403
|
-
|
|
408
|
+
var CopyButton = (0, import_react2.memo)(CopyButtonFn);
|
|
409
|
+
function MoveDownButtonFn(props) {
|
|
404
410
|
const {
|
|
405
411
|
registry: { translateString }
|
|
406
412
|
} = props;
|
|
407
413
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: translateString(import_utils9.TranslatableString.MoveDownButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_AiOutlineArrowDown.AiOutlineArrowDown, {}) });
|
|
408
414
|
}
|
|
409
|
-
|
|
415
|
+
var MoveDownButton = (0, import_react2.memo)(MoveDownButtonFn);
|
|
416
|
+
function MoveUpButtonFn(props) {
|
|
410
417
|
const {
|
|
411
418
|
registry: { translateString }
|
|
412
419
|
} = props;
|
|
413
420
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: translateString(import_utils9.TranslatableString.MoveUpButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_AiOutlineArrowUp.AiOutlineArrowUp, {}) });
|
|
414
421
|
}
|
|
415
|
-
|
|
422
|
+
var MoveUpButton = (0, import_react2.memo)(MoveUpButtonFn);
|
|
423
|
+
function RemoveButtonFn(props) {
|
|
416
424
|
const {
|
|
417
425
|
registry: { translateString }
|
|
418
426
|
} = props;
|
|
@@ -426,12 +434,14 @@ function RemoveButton(props) {
|
|
|
426
434
|
}
|
|
427
435
|
);
|
|
428
436
|
}
|
|
429
|
-
|
|
437
|
+
var RemoveButton = (0, import_react2.memo)(RemoveButtonFn);
|
|
438
|
+
function ClearButtonFn(props) {
|
|
430
439
|
const {
|
|
431
440
|
registry: { translateString }
|
|
432
441
|
} = props;
|
|
433
442
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: translateString(import_utils9.TranslatableString.ClearButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_IoMdClose.IoMdClose, {}) });
|
|
434
443
|
}
|
|
444
|
+
var ClearButton = (0, import_react2.memo)(ClearButtonFn);
|
|
435
445
|
|
|
436
446
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
437
447
|
var import_Card2 = __toESM(require("react-bootstrap/Card"), 1);
|
|
@@ -500,10 +510,10 @@ function ObjectFieldTemplate({
|
|
|
500
510
|
),
|
|
501
511
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Container2.default, { fluid: true, className: "p-0", children: [
|
|
502
512
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
503
|
-
properties.map((element
|
|
513
|
+
properties.map((element) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Row4.default, { style: { marginBottom: "10px" }, className: element.hidden ? "d-none" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Col4.default, { xs: 12, children: [
|
|
504
514
|
" ",
|
|
505
515
|
element.content
|
|
506
|
-
] }) },
|
|
516
|
+
] }) }, element.name)),
|
|
507
517
|
(0, import_utils10.canExpand)(schema, uiSchema, formData) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Row4.default, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Col4.default, { xs: { offset: 11, span: 1 }, className: "py-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
508
518
|
AddButton2,
|
|
509
519
|
{
|
|
@@ -526,7 +536,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
526
536
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
527
537
|
if (onAddClick) {
|
|
528
538
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
529
|
-
|
|
539
|
+
IconButton_default,
|
|
530
540
|
{
|
|
531
541
|
id,
|
|
532
542
|
registry,
|
|
@@ -538,7 +548,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
538
548
|
variant: "secondary"
|
|
539
549
|
}
|
|
540
550
|
);
|
|
541
|
-
}
|
|
551
|
+
}
|
|
552
|
+
if (onRemoveClick) {
|
|
542
553
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
543
554
|
RemoveButton,
|
|
544
555
|
{
|
|
@@ -710,18 +721,18 @@ function CheckboxesWidget({
|
|
|
710
721
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
711
722
|
const optionValueFormat = (0, import_utils14.getOptionValueFormat)(options);
|
|
712
723
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
713
|
-
const
|
|
724
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
714
725
|
if (checked) {
|
|
715
726
|
onChange((0, import_utils14.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
716
727
|
} else {
|
|
717
728
|
onChange((0, import_utils14.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
718
729
|
}
|
|
719
730
|
};
|
|
720
|
-
const
|
|
721
|
-
const
|
|
731
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils14.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
732
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils14.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
722
733
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_Form5.default.Group, { children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
723
734
|
const checked = (0, import_utils14.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
724
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
735
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
725
736
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
726
737
|
import_Form5.default.Check,
|
|
727
738
|
{
|
|
@@ -734,9 +745,9 @@ function CheckboxesWidget({
|
|
|
734
745
|
name: htmlName || id,
|
|
735
746
|
label: option.label,
|
|
736
747
|
autoFocus: autofocus && index === 0,
|
|
737
|
-
onChange:
|
|
738
|
-
onBlur:
|
|
739
|
-
onFocus:
|
|
748
|
+
onChange: handleChange(index),
|
|
749
|
+
onBlur: handleBlur,
|
|
750
|
+
onFocus: handleFocus,
|
|
740
751
|
disabled: disabled || itemDisabled || readonly,
|
|
741
752
|
"aria-describedby": (0, import_utils14.ariaDescribedByIds)(id)
|
|
742
753
|
},
|
|
@@ -773,9 +784,9 @@ function CheckboxWidget(props) {
|
|
|
773
784
|
registry,
|
|
774
785
|
options
|
|
775
786
|
);
|
|
776
|
-
const
|
|
777
|
-
const
|
|
778
|
-
const
|
|
787
|
+
const handleChange = ({ target: { checked } }) => onChange(checked);
|
|
788
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
789
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
779
790
|
const description = options.description || schema.description;
|
|
780
791
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_Form6.default.Group, { className: disabled || readonly ? "disabled" : "", "aria-describedby": (0, import_utils15.ariaDescribedByIds)(id), children: [
|
|
781
792
|
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -798,10 +809,10 @@ function CheckboxWidget(props) {
|
|
|
798
809
|
required,
|
|
799
810
|
disabled: disabled || readonly,
|
|
800
811
|
autoFocus: autofocus,
|
|
801
|
-
onChange:
|
|
812
|
+
onChange: handleChange,
|
|
802
813
|
type: "checkbox",
|
|
803
|
-
onBlur:
|
|
804
|
-
onFocus:
|
|
814
|
+
onBlur: handleBlur,
|
|
815
|
+
onFocus: handleFocus
|
|
805
816
|
}
|
|
806
817
|
)
|
|
807
818
|
] });
|
|
@@ -825,12 +836,12 @@ function RadioWidget({
|
|
|
825
836
|
}) {
|
|
826
837
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
827
838
|
const optionValueFormat = (0, import_utils16.getOptionValueFormat)(options);
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
const
|
|
839
|
+
const handleChange = ({ target: { value: enumValue } }) => onChange((0, import_utils16.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
840
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
841
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
831
842
|
const inline = Boolean(options && options.inline);
|
|
832
843
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Form7.default.Group, { className: "mb-0", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
833
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
844
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
834
845
|
const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, value);
|
|
835
846
|
const radio = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
836
847
|
import_Form7.default.Check,
|
|
@@ -844,12 +855,12 @@ function RadioWidget({
|
|
|
844
855
|
checked,
|
|
845
856
|
required,
|
|
846
857
|
value: (0, import_utils16.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
847
|
-
onChange:
|
|
848
|
-
onBlur:
|
|
849
|
-
onFocus:
|
|
858
|
+
onChange: handleChange,
|
|
859
|
+
onBlur: handleBlur,
|
|
860
|
+
onFocus: handleFocus,
|
|
850
861
|
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
851
862
|
},
|
|
852
|
-
|
|
863
|
+
String(option.value)
|
|
853
864
|
);
|
|
854
865
|
return radio;
|
|
855
866
|
}) });
|
|
@@ -861,17 +872,17 @@ var import_FormRange = __toESM(require("react-bootstrap/FormRange"), 1);
|
|
|
861
872
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
862
873
|
function RangeWidget(props) {
|
|
863
874
|
const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
const
|
|
875
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue);
|
|
876
|
+
const handleBlur = ({ target: { value: newValue } }) => onBlur(id, newValue);
|
|
877
|
+
const handleFocus = ({ target: { value: newValue } }) => onFocus(id, newValue);
|
|
867
878
|
const rangeProps = {
|
|
868
879
|
value,
|
|
869
880
|
id,
|
|
870
881
|
name: id,
|
|
871
882
|
disabled,
|
|
872
|
-
onChange:
|
|
873
|
-
onBlur:
|
|
874
|
-
onFocus:
|
|
883
|
+
onChange: handleChange,
|
|
884
|
+
onBlur: handleBlur,
|
|
885
|
+
onFocus: handleFocus,
|
|
875
886
|
...(0, import_utils17.rangeSpec)(schema)
|
|
876
887
|
};
|
|
877
888
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
@@ -904,12 +915,11 @@ function SelectWidget({
|
|
|
904
915
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
905
916
|
const emptyValue = multiple ? [] : "";
|
|
906
917
|
const optionValueFormat = (0, import_utils18.getOptionValueFormat)(options);
|
|
907
|
-
function getValue(event,
|
|
908
|
-
if (
|
|
918
|
+
function getValue(event, isMultiple) {
|
|
919
|
+
if (isMultiple) {
|
|
909
920
|
return [].slice.call(event.target.options).filter((o) => o.selected).map((o) => o.value);
|
|
910
|
-
} else {
|
|
911
|
-
return event.target.value;
|
|
912
921
|
}
|
|
922
|
+
return event.target.value;
|
|
913
923
|
}
|
|
914
924
|
const selectValue = (0, import_utils18.enumOptionSelectedValue)(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
915
925
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
@@ -939,9 +949,18 @@ function SelectWidget({
|
|
|
939
949
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
940
950
|
children: [
|
|
941
951
|
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: placeholder }),
|
|
942
|
-
enumOptions
|
|
943
|
-
const
|
|
944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
952
|
+
enumOptions?.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
953
|
+
const isDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
955
|
+
"option",
|
|
956
|
+
{
|
|
957
|
+
id: enumLabel,
|
|
958
|
+
value: (0, import_utils18.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
959
|
+
disabled: isDisabled,
|
|
960
|
+
children: enumLabel
|
|
961
|
+
},
|
|
962
|
+
String(enumValue)
|
|
963
|
+
);
|
|
945
964
|
})
|
|
946
965
|
]
|
|
947
966
|
}
|
|
@@ -967,9 +986,9 @@ function TextareaWidget({
|
|
|
967
986
|
onChange,
|
|
968
987
|
options
|
|
969
988
|
}) {
|
|
970
|
-
const
|
|
971
|
-
const
|
|
972
|
-
const
|
|
989
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
990
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
991
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
973
992
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_InputGroup.default, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
974
993
|
import_FormControl.default,
|
|
975
994
|
{
|
|
@@ -983,9 +1002,9 @@ function TextareaWidget({
|
|
|
983
1002
|
required,
|
|
984
1003
|
autoFocus: autofocus,
|
|
985
1004
|
rows: options.rows || 5,
|
|
986
|
-
onChange:
|
|
987
|
-
onBlur:
|
|
988
|
-
onFocus:
|
|
1005
|
+
onChange: handleChange,
|
|
1006
|
+
onBlur: handleBlur,
|
|
1007
|
+
onFocus: handleFocus,
|
|
989
1008
|
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id)
|
|
990
1009
|
}
|
|
991
1010
|
) });
|