@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
|
@@ -25,10 +25,7 @@ function AddButton({
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
28
|
-
import {
|
|
29
|
-
getTemplate,
|
|
30
|
-
getUiOptions
|
|
31
|
-
} from "@rjsf/utils";
|
|
28
|
+
import { getTemplate, getUiOptions } from "@rjsf/utils";
|
|
32
29
|
import Col from "react-bootstrap/Col";
|
|
33
30
|
import Row from "react-bootstrap/Row";
|
|
34
31
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -54,11 +51,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
57
|
-
import {
|
|
58
|
-
buttonId,
|
|
59
|
-
getTemplate as getTemplate2,
|
|
60
|
-
getUiOptions as getUiOptions2
|
|
61
|
-
} from "@rjsf/utils";
|
|
54
|
+
import { buttonId, getTemplate as getTemplate2, getUiOptions as getUiOptions2 } from "@rjsf/utils";
|
|
62
55
|
import Col2 from "react-bootstrap/Col";
|
|
63
56
|
import Container from "react-bootstrap/Container";
|
|
64
57
|
import Row2 from "react-bootstrap/Row";
|
|
@@ -140,11 +133,7 @@ function ArrayFieldTemplate(props) {
|
|
|
140
133
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
141
134
|
import { useCallback } from "react";
|
|
142
135
|
import { SchemaExamples } from "@rjsf/core";
|
|
143
|
-
import {
|
|
144
|
-
ariaDescribedByIds,
|
|
145
|
-
examplesId,
|
|
146
|
-
getInputProps
|
|
147
|
-
} from "@rjsf/utils";
|
|
136
|
+
import { ariaDescribedByIds, examplesId, getInputProps } from "@rjsf/utils";
|
|
148
137
|
import Form from "react-bootstrap/Form";
|
|
149
138
|
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
150
139
|
function BaseInputTemplate({
|
|
@@ -173,10 +162,10 @@ function BaseInputTemplate({
|
|
|
173
162
|
...extraProps,
|
|
174
163
|
...getInputProps(schema, type, options)
|
|
175
164
|
};
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
165
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
166
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
167
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
168
|
+
const handleClear = useCallback(
|
|
180
169
|
(e) => {
|
|
181
170
|
e.preventDefault();
|
|
182
171
|
e.stopPropagation();
|
|
@@ -199,13 +188,13 @@ function BaseInputTemplate({
|
|
|
199
188
|
list: schema.examples ? examplesId(id) : void 0,
|
|
200
189
|
...inputProps,
|
|
201
190
|
value: value || value === 0 ? value : "",
|
|
202
|
-
onChange: onChangeOverride ||
|
|
203
|
-
onBlur:
|
|
204
|
-
onFocus:
|
|
191
|
+
onChange: onChangeOverride || handleChange,
|
|
192
|
+
onBlur: handleBlur,
|
|
193
|
+
onFocus: handleFocus,
|
|
205
194
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
206
195
|
}
|
|
207
196
|
),
|
|
208
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick:
|
|
197
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick: handleClear }),
|
|
209
198
|
children,
|
|
210
199
|
/* @__PURE__ */ jsx4(SchemaExamples, { id, schema })
|
|
211
200
|
] });
|
|
@@ -233,9 +222,10 @@ function ErrorList({
|
|
|
233
222
|
const { translateString } = registry;
|
|
234
223
|
return /* @__PURE__ */ jsxs4(Card, { border: "danger", className: "mb-4", children: [
|
|
235
224
|
/* @__PURE__ */ jsx6(Card.Header, { className: "alert-danger", children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
236
|
-
/* @__PURE__ */ jsx6(Card.Body, { className: "p-0", children: /* @__PURE__ */ jsx6(ListGroup, { children: errors.map((error, i) =>
|
|
237
|
-
|
|
238
|
-
|
|
225
|
+
/* @__PURE__ */ jsx6(Card.Body, { className: "p-0", children: /* @__PURE__ */ jsx6(ListGroup, { children: errors.map((error, i) => (
|
|
226
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
227
|
+
/* @__PURE__ */ jsx6(ListGroup.Item, { className: "border-0", children: /* @__PURE__ */ jsx6("span", { children: error.stack }) }, i)
|
|
228
|
+
)) }) })
|
|
239
229
|
] });
|
|
240
230
|
}
|
|
241
231
|
|
|
@@ -249,9 +239,10 @@ function FieldErrorTemplate(props) {
|
|
|
249
239
|
return null;
|
|
250
240
|
}
|
|
251
241
|
const id = errorId(fieldPathId);
|
|
252
|
-
return /* @__PURE__ */ jsx7(ListGroup2, { as: "ul", id, children: errors.map((error, i) =>
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
return /* @__PURE__ */ jsx7(ListGroup2, { as: "ul", id, children: errors.map((error, i) => (
|
|
243
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
244
|
+
/* @__PURE__ */ jsx7(ListGroup2.Item, { as: "li", className: "border-0 m-0 p-0", children: /* @__PURE__ */ jsx7("small", { className: "m-0 text-danger", children: error }) }, i)
|
|
245
|
+
)) });
|
|
255
246
|
}
|
|
256
247
|
|
|
257
248
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -268,10 +259,7 @@ function FieldHelpTemplate(props) {
|
|
|
268
259
|
}
|
|
269
260
|
|
|
270
261
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
271
|
-
import {
|
|
272
|
-
getTemplate as getTemplate3,
|
|
273
|
-
getUiOptions as getUiOptions3
|
|
274
|
-
} from "@rjsf/utils";
|
|
262
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions3 } from "@rjsf/utils";
|
|
275
263
|
import Form3 from "react-bootstrap/Form";
|
|
276
264
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
277
265
|
function FieldTemplate({
|
|
@@ -352,6 +340,7 @@ function GridTemplate(props) {
|
|
|
352
340
|
}
|
|
353
341
|
|
|
354
342
|
// src/IconButton/IconButton.tsx
|
|
343
|
+
import { memo } from "react";
|
|
355
344
|
import { AiOutlineArrowDown } from "@react-icons/all-files/ai/AiOutlineArrowDown";
|
|
356
345
|
import { AiOutlineArrowUp } from "@react-icons/all-files/ai/AiOutlineArrowUp";
|
|
357
346
|
import { IoIosCopy } from "@react-icons/all-files/io/IoIosCopy";
|
|
@@ -360,29 +349,34 @@ import { IoMdClose } from "@react-icons/all-files/io/IoMdClose";
|
|
|
360
349
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
361
350
|
import Button2 from "react-bootstrap/Button";
|
|
362
351
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
363
|
-
function
|
|
352
|
+
function IconButtonFn(props) {
|
|
364
353
|
const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
|
|
365
354
|
return /* @__PURE__ */ jsx11(Button2, { ...otherProps, variant: props.variant || "light", size: "sm", children: icon });
|
|
366
355
|
}
|
|
367
|
-
|
|
356
|
+
var IconButton = memo(IconButtonFn);
|
|
357
|
+
var IconButton_default = IconButton;
|
|
358
|
+
function CopyButtonFn(props) {
|
|
368
359
|
const {
|
|
369
360
|
registry: { translateString }
|
|
370
361
|
} = props;
|
|
371
362
|
return /* @__PURE__ */ jsx11(IconButton, { title: translateString(TranslatableString3.CopyButton), ...props, icon: /* @__PURE__ */ jsx11(IoIosCopy, {}) });
|
|
372
363
|
}
|
|
373
|
-
|
|
364
|
+
var CopyButton = memo(CopyButtonFn);
|
|
365
|
+
function MoveDownButtonFn(props) {
|
|
374
366
|
const {
|
|
375
367
|
registry: { translateString }
|
|
376
368
|
} = props;
|
|
377
369
|
return /* @__PURE__ */ jsx11(IconButton, { title: translateString(TranslatableString3.MoveDownButton), ...props, icon: /* @__PURE__ */ jsx11(AiOutlineArrowDown, {}) });
|
|
378
370
|
}
|
|
379
|
-
|
|
371
|
+
var MoveDownButton = memo(MoveDownButtonFn);
|
|
372
|
+
function MoveUpButtonFn(props) {
|
|
380
373
|
const {
|
|
381
374
|
registry: { translateString }
|
|
382
375
|
} = props;
|
|
383
376
|
return /* @__PURE__ */ jsx11(IconButton, { title: translateString(TranslatableString3.MoveUpButton), ...props, icon: /* @__PURE__ */ jsx11(AiOutlineArrowUp, {}) });
|
|
384
377
|
}
|
|
385
|
-
|
|
378
|
+
var MoveUpButton = memo(MoveUpButtonFn);
|
|
379
|
+
function RemoveButtonFn(props) {
|
|
386
380
|
const {
|
|
387
381
|
registry: { translateString }
|
|
388
382
|
} = props;
|
|
@@ -396,12 +390,14 @@ function RemoveButton(props) {
|
|
|
396
390
|
}
|
|
397
391
|
);
|
|
398
392
|
}
|
|
399
|
-
|
|
393
|
+
var RemoveButton = memo(RemoveButtonFn);
|
|
394
|
+
function ClearButtonFn(props) {
|
|
400
395
|
const {
|
|
401
396
|
registry: { translateString }
|
|
402
397
|
} = props;
|
|
403
398
|
return /* @__PURE__ */ jsx11(IconButton, { title: translateString(TranslatableString3.ClearButton), ...props, icon: /* @__PURE__ */ jsx11(IoMdClose, {}) });
|
|
404
399
|
}
|
|
400
|
+
var ClearButton = memo(ClearButtonFn);
|
|
405
401
|
|
|
406
402
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
407
403
|
import Card2 from "react-bootstrap/Card";
|
|
@@ -414,14 +410,7 @@ function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
|
414
410
|
}
|
|
415
411
|
|
|
416
412
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
417
|
-
import {
|
|
418
|
-
buttonId as buttonId2,
|
|
419
|
-
canExpand,
|
|
420
|
-
descriptionId,
|
|
421
|
-
getTemplate as getTemplate4,
|
|
422
|
-
getUiOptions as getUiOptions4,
|
|
423
|
-
titleId
|
|
424
|
-
} from "@rjsf/utils";
|
|
413
|
+
import { buttonId as buttonId2, canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions4, titleId } from "@rjsf/utils";
|
|
425
414
|
import Col4 from "react-bootstrap/Col";
|
|
426
415
|
import Container2 from "react-bootstrap/Container";
|
|
427
416
|
import Row4 from "react-bootstrap/Row";
|
|
@@ -477,10 +466,10 @@ function ObjectFieldTemplate({
|
|
|
477
466
|
),
|
|
478
467
|
/* @__PURE__ */ jsxs7(Container2, { fluid: true, className: "p-0", children: [
|
|
479
468
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
480
|
-
properties.map((element
|
|
469
|
+
properties.map((element) => /* @__PURE__ */ jsx13(Row4, { style: { marginBottom: "10px" }, className: element.hidden ? "d-none" : void 0, children: /* @__PURE__ */ jsxs7(Col4, { xs: 12, children: [
|
|
481
470
|
" ",
|
|
482
471
|
element.content
|
|
483
|
-
] }) },
|
|
472
|
+
] }) }, element.name)),
|
|
484
473
|
canExpand(schema, uiSchema, formData) ? /* @__PURE__ */ jsx13(Row4, { children: /* @__PURE__ */ jsx13(Col4, { xs: { offset: 11, span: 1 }, className: "py-0.5", children: /* @__PURE__ */ jsx13(
|
|
485
474
|
AddButton2,
|
|
486
475
|
{
|
|
@@ -503,7 +492,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
503
492
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
504
493
|
if (onAddClick) {
|
|
505
494
|
return /* @__PURE__ */ jsx14(
|
|
506
|
-
|
|
495
|
+
IconButton_default,
|
|
507
496
|
{
|
|
508
497
|
id,
|
|
509
498
|
registry,
|
|
@@ -515,7 +504,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
515
504
|
variant: "secondary"
|
|
516
505
|
}
|
|
517
506
|
);
|
|
518
|
-
}
|
|
507
|
+
}
|
|
508
|
+
if (onRemoveClick) {
|
|
519
509
|
return /* @__PURE__ */ jsx14(
|
|
520
510
|
RemoveButton,
|
|
521
511
|
{
|
|
@@ -571,11 +561,7 @@ function TitleField({
|
|
|
571
561
|
}
|
|
572
562
|
|
|
573
563
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
574
|
-
import {
|
|
575
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
576
|
-
buttonId as buttonId3,
|
|
577
|
-
TranslatableString as TranslatableString4
|
|
578
|
-
} from "@rjsf/utils";
|
|
564
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4 } from "@rjsf/utils";
|
|
579
565
|
import Col6 from "react-bootstrap/Col";
|
|
580
566
|
import Form4 from "react-bootstrap/Form";
|
|
581
567
|
import Row6 from "react-bootstrap/Row";
|
|
@@ -699,18 +685,18 @@ function CheckboxesWidget({
|
|
|
699
685
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
700
686
|
const optionValueFormat = getOptionValueFormat(options);
|
|
701
687
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
702
|
-
const
|
|
688
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
703
689
|
if (checked) {
|
|
704
690
|
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
705
691
|
} else {
|
|
706
692
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
707
693
|
}
|
|
708
694
|
};
|
|
709
|
-
const
|
|
710
|
-
const
|
|
695
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
696
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
711
697
|
return /* @__PURE__ */ jsx18(Form5.Group, { children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
712
698
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
713
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
699
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
714
700
|
return /* @__PURE__ */ jsx18(
|
|
715
701
|
Form5.Check,
|
|
716
702
|
{
|
|
@@ -723,9 +709,9 @@ function CheckboxesWidget({
|
|
|
723
709
|
name: htmlName || id,
|
|
724
710
|
label: option.label,
|
|
725
711
|
autoFocus: autofocus && index === 0,
|
|
726
|
-
onChange:
|
|
727
|
-
onBlur:
|
|
728
|
-
onFocus:
|
|
712
|
+
onChange: handleChange(index),
|
|
713
|
+
onBlur: handleBlur,
|
|
714
|
+
onFocus: handleFocus,
|
|
729
715
|
disabled: disabled || itemDisabled || readonly,
|
|
730
716
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
731
717
|
},
|
|
@@ -735,13 +721,7 @@ function CheckboxesWidget({
|
|
|
735
721
|
}
|
|
736
722
|
|
|
737
723
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
738
|
-
import {
|
|
739
|
-
ariaDescribedByIds as ariaDescribedByIds3,
|
|
740
|
-
descriptionId as descriptionId2,
|
|
741
|
-
getTemplate as getTemplate5,
|
|
742
|
-
labelValue,
|
|
743
|
-
schemaRequiresTrueValue
|
|
744
|
-
} from "@rjsf/utils";
|
|
724
|
+
import { ariaDescribedByIds as ariaDescribedByIds3, descriptionId as descriptionId2, getTemplate as getTemplate5, labelValue, schemaRequiresTrueValue } from "@rjsf/utils";
|
|
745
725
|
import Form6 from "react-bootstrap/Form";
|
|
746
726
|
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
747
727
|
function CheckboxWidget(props) {
|
|
@@ -768,9 +748,9 @@ function CheckboxWidget(props) {
|
|
|
768
748
|
registry,
|
|
769
749
|
options
|
|
770
750
|
);
|
|
771
|
-
const
|
|
772
|
-
const
|
|
773
|
-
const
|
|
751
|
+
const handleChange = ({ target: { checked } }) => onChange(checked);
|
|
752
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
753
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
774
754
|
const description = options.description || schema.description;
|
|
775
755
|
return /* @__PURE__ */ jsxs10(Form6.Group, { className: disabled || readonly ? "disabled" : "", "aria-describedby": ariaDescribedByIds3(id), children: [
|
|
776
756
|
!hideLabel && description && /* @__PURE__ */ jsx19(
|
|
@@ -793,10 +773,10 @@ function CheckboxWidget(props) {
|
|
|
793
773
|
required,
|
|
794
774
|
disabled: disabled || readonly,
|
|
795
775
|
autoFocus: autofocus,
|
|
796
|
-
onChange:
|
|
776
|
+
onChange: handleChange,
|
|
797
777
|
type: "checkbox",
|
|
798
|
-
onBlur:
|
|
799
|
-
onFocus:
|
|
778
|
+
onBlur: handleBlur,
|
|
779
|
+
onFocus: handleFocus
|
|
800
780
|
}
|
|
801
781
|
)
|
|
802
782
|
] });
|
|
@@ -827,12 +807,12 @@ function RadioWidget({
|
|
|
827
807
|
}) {
|
|
828
808
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
829
809
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
const
|
|
810
|
+
const handleChange = ({ target: { value: enumValue } }) => onChange(enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
811
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
812
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
833
813
|
const inline = Boolean(options && options.inline);
|
|
834
814
|
return /* @__PURE__ */ jsx20(Form7.Group, { className: "mb-0", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
835
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
815
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
836
816
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
837
817
|
const radio = /* @__PURE__ */ jsx20(
|
|
838
818
|
Form7.Check,
|
|
@@ -846,12 +826,12 @@ function RadioWidget({
|
|
|
846
826
|
checked,
|
|
847
827
|
required,
|
|
848
828
|
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
849
|
-
onChange:
|
|
850
|
-
onBlur:
|
|
851
|
-
onFocus:
|
|
829
|
+
onChange: handleChange,
|
|
830
|
+
onBlur: handleBlur,
|
|
831
|
+
onFocus: handleFocus,
|
|
852
832
|
"aria-describedby": ariaDescribedByIds4(id)
|
|
853
833
|
},
|
|
854
|
-
|
|
834
|
+
String(option.value)
|
|
855
835
|
);
|
|
856
836
|
return radio;
|
|
857
837
|
}) });
|
|
@@ -863,17 +843,17 @@ import FormRange from "react-bootstrap/FormRange";
|
|
|
863
843
|
import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
864
844
|
function RangeWidget(props) {
|
|
865
845
|
const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
|
|
866
|
-
const
|
|
867
|
-
const
|
|
868
|
-
const
|
|
846
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue);
|
|
847
|
+
const handleBlur = ({ target: { value: newValue } }) => onBlur(id, newValue);
|
|
848
|
+
const handleFocus = ({ target: { value: newValue } }) => onFocus(id, newValue);
|
|
869
849
|
const rangeProps = {
|
|
870
850
|
value,
|
|
871
851
|
id,
|
|
872
852
|
name: id,
|
|
873
853
|
disabled,
|
|
874
|
-
onChange:
|
|
875
|
-
onBlur:
|
|
876
|
-
onFocus:
|
|
854
|
+
onChange: handleChange,
|
|
855
|
+
onBlur: handleBlur,
|
|
856
|
+
onFocus: handleFocus,
|
|
877
857
|
...rangeSpec(schema)
|
|
878
858
|
};
|
|
879
859
|
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
@@ -912,12 +892,11 @@ function SelectWidget({
|
|
|
912
892
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
913
893
|
const emptyValue = multiple ? [] : "";
|
|
914
894
|
const optionValueFormat = getOptionValueFormat3(options);
|
|
915
|
-
function getValue(event,
|
|
916
|
-
if (
|
|
895
|
+
function getValue(event, isMultiple) {
|
|
896
|
+
if (isMultiple) {
|
|
917
897
|
return [].slice.call(event.target.options).filter((o) => o.selected).map((o) => o.value);
|
|
918
|
-
} else {
|
|
919
|
-
return event.target.value;
|
|
920
898
|
}
|
|
899
|
+
return event.target.value;
|
|
921
900
|
}
|
|
922
901
|
const selectValue = enumOptionSelectedValue(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
|
|
923
902
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
@@ -947,9 +926,18 @@ function SelectWidget({
|
|
|
947
926
|
"aria-describedby": ariaDescribedByIds5(id),
|
|
948
927
|
children: [
|
|
949
928
|
showPlaceholderOption && /* @__PURE__ */ jsx22("option", { value: "", children: placeholder }),
|
|
950
|
-
enumOptions
|
|
951
|
-
const
|
|
952
|
-
return /* @__PURE__ */ jsx22(
|
|
929
|
+
enumOptions?.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
930
|
+
const isDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
|
|
931
|
+
return /* @__PURE__ */ jsx22(
|
|
932
|
+
"option",
|
|
933
|
+
{
|
|
934
|
+
id: enumLabel,
|
|
935
|
+
value: enumOptionValueEncoder2(enumValue, i, optionValueFormat),
|
|
936
|
+
disabled: isDisabled,
|
|
937
|
+
children: enumLabel
|
|
938
|
+
},
|
|
939
|
+
String(enumValue)
|
|
940
|
+
);
|
|
953
941
|
})
|
|
954
942
|
]
|
|
955
943
|
}
|
|
@@ -975,9 +963,9 @@ function TextareaWidget({
|
|
|
975
963
|
onChange,
|
|
976
964
|
options
|
|
977
965
|
}) {
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
const
|
|
966
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
967
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
968
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
981
969
|
return /* @__PURE__ */ jsx23(InputGroup, { children: /* @__PURE__ */ jsx23(
|
|
982
970
|
FormControl,
|
|
983
971
|
{
|
|
@@ -991,9 +979,9 @@ function TextareaWidget({
|
|
|
991
979
|
required,
|
|
992
980
|
autoFocus: autofocus,
|
|
993
981
|
rows: options.rows || 5,
|
|
994
|
-
onChange:
|
|
995
|
-
onBlur:
|
|
996
|
-
onFocus:
|
|
982
|
+
onChange: handleChange,
|
|
983
|
+
onBlur: handleBlur,
|
|
984
|
+
onFocus: handleFocus,
|
|
997
985
|
"aria-describedby": ariaDescribedByIds6(id)
|
|
998
986
|
}
|
|
999
987
|
) });
|