@rjsf/semantic-ui 6.6.1 → 6.7.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/LICENSE.md +201 -0
- package/dist/index.cjs +268 -241
- package/dist/index.cjs.map +4 -4
- package/dist/semantic-ui.esm.js +209 -218
- package/dist/semantic-ui.esm.js.map +4 -4
- package/dist/semantic-ui.umd.js +117 -96
- package/lib/AddButton/AddButton.d.ts +3 -3
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +2 -2
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js +7 -7
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.d.ts +6 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js +14 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js.map +1 -0
- package/lib/CyclicSchemaExpandTemplate/index.d.ts +2 -0
- package/lib/CyclicSchemaExpandTemplate/index.js +3 -0
- package/lib/CyclicSchemaExpandTemplate/index.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +2 -2
- package/lib/ErrorList/ErrorList.d.ts +2 -2
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +2 -2
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +2 -2
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +2 -2
- 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 +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +2 -2
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +2 -2
- package/lib/RadioWidget/RadioWidget.js +5 -7
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +2 -2
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +2 -2
- package/lib/SelectWidget/SelectWidget.js +8 -8
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SemanticUIForm/SemanticUIForm.d.ts +3 -3
- package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +2 -2
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +2 -2
- package/lib/TextareaWidget/TextareaWidget.js +6 -6
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +2 -2
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +7 -7
- package/lib/util.js +13 -6
- package/lib/util.js.map +1 -1
- package/package.json +25 -23
- package/src/AddButton/AddButton.tsx +5 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -20
- package/src/CheckboxWidget/CheckboxWidget.tsx +13 -21
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
- package/src/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.tsx +25 -0
- package/src/CyclicSchemaExpandTemplate/index.ts +2 -0
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +3 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -1
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- 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 +2 -12
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +13 -16
- package/src/RangeWidget/RangeWidget.tsx +11 -10
- package/src/SelectWidget/SelectWidget.tsx +45 -37
- package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +3 -1
- package/src/TextareaWidget/TextareaWidget.tsx +11 -17
- package/src/Theme/Theme.ts +2 -2
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/Widgets/Widgets.tsx +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -13
- package/src/util.tsx +20 -21
package/dist/semantic-ui.umd.js
CHANGED
|
@@ -34,14 +34,13 @@
|
|
|
34
34
|
const formContextProps = formContext.semantic;
|
|
35
35
|
const schemaProps = utils.getUiOptions(uiSchema).semantic;
|
|
36
36
|
const optionProps = options.semantic;
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
37
|
+
return {
|
|
38
|
+
...defaultSchemaProps,
|
|
39
|
+
...defaultContextProps,
|
|
40
|
+
...schemaProps,
|
|
41
|
+
...optionProps,
|
|
42
|
+
...formContextProps
|
|
43
|
+
};
|
|
45
44
|
}
|
|
46
45
|
function getSemanticErrorProps({
|
|
47
46
|
formContext = {},
|
|
@@ -49,11 +48,11 @@
|
|
|
49
48
|
options = {},
|
|
50
49
|
defaultProps = { size: "small", pointing: "above" }
|
|
51
50
|
}) {
|
|
52
|
-
const formContextProps = formContext.semantic
|
|
51
|
+
const formContextProps = formContext.semantic?.errorOptions;
|
|
53
52
|
const semanticOptions = utils.getUiOptions(uiSchema).semantic;
|
|
54
|
-
const schemaProps = semanticOptions
|
|
55
|
-
const optionProps = options.semantic
|
|
56
|
-
return
|
|
53
|
+
const schemaProps = semanticOptions?.errorOptions;
|
|
54
|
+
const optionProps = options.semantic?.errorOptions;
|
|
55
|
+
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
57
56
|
}
|
|
58
57
|
function cleanClassNames(classNameArr, omit = []) {
|
|
59
58
|
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
@@ -209,10 +208,10 @@
|
|
|
209
208
|
formContext: registry.formContext,
|
|
210
209
|
options
|
|
211
210
|
});
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
211
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
212
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
213
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
214
|
+
const handleClear = react.useCallback(
|
|
216
215
|
(e) => {
|
|
217
216
|
e.preventDefault();
|
|
218
217
|
e.stopPropagation();
|
|
@@ -236,17 +235,26 @@
|
|
|
236
235
|
...semanticProps,
|
|
237
236
|
value: value || value === 0 ? value : "",
|
|
238
237
|
error: rawErrors.length > 0,
|
|
239
|
-
onChange: onChangeOverride ||
|
|
240
|
-
onBlur:
|
|
241
|
-
onFocus:
|
|
238
|
+
onChange: onChangeOverride || handleChange,
|
|
239
|
+
onBlur: handleBlur,
|
|
240
|
+
onFocus: handleFocus,
|
|
242
241
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
243
242
|
},
|
|
244
243
|
id
|
|
245
244
|
),
|
|
246
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick:
|
|
245
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: handleClear }),
|
|
247
246
|
/* @__PURE__ */ jsxRuntime.jsx(core.SchemaExamples, { id, schema })
|
|
248
247
|
] });
|
|
249
248
|
}
|
|
249
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
250
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
251
|
+
const { translateString } = registry;
|
|
252
|
+
const buttonId4 = `${fieldPathId[utils.ID_KEY]}-button`;
|
|
253
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: "1rem", marginBottom: "1rem" }, children: [
|
|
254
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "red" }, children: translateString(utils.TranslatableString.CycleDetected, [name]) }),
|
|
255
|
+
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Button, { id: buttonId4, type: "button", size: "mini", onClick: () => onExpand(fieldPathId[utils.ID_KEY]), children: translateString(utils.TranslatableString.ExpandButton) })
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
250
258
|
function DescriptionField(props) {
|
|
251
259
|
const { id, description, registry, uiSchema } = props;
|
|
252
260
|
if (!description) {
|
|
@@ -261,7 +269,10 @@
|
|
|
261
269
|
const { translateString } = registry;
|
|
262
270
|
return /* @__PURE__ */ jsxRuntime.jsxs(semanticUiReact.Message, { negative: true, children: [
|
|
263
271
|
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Message.Header, { children: translateString(utils.TranslatableString.ErrorsLabel) }),
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Message.List, { children: errors.map((error, index) =>
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Message.List, { children: errors.map((error, index) => (
|
|
273
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
274
|
+
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Message.Item, { children: error.stack }, `error-${index}`)
|
|
275
|
+
)) })
|
|
265
276
|
] });
|
|
266
277
|
}
|
|
267
278
|
var DEFAULT_OPTIONS = {
|
|
@@ -353,7 +364,7 @@
|
|
|
353
364
|
}
|
|
354
365
|
return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid, { ...rest, children });
|
|
355
366
|
}
|
|
356
|
-
function
|
|
367
|
+
function IconButtonFn(props) {
|
|
357
368
|
const { icon, iconType, color, className, uiSchema, registry, ...otherProps } = props;
|
|
358
369
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
359
370
|
semanticUiReact.Button,
|
|
@@ -366,36 +377,42 @@
|
|
|
366
377
|
}
|
|
367
378
|
);
|
|
368
379
|
}
|
|
369
|
-
|
|
380
|
+
var IconButton = react.memo(IconButtonFn);
|
|
381
|
+
function CopyButtonFn(props) {
|
|
370
382
|
const {
|
|
371
383
|
registry: { translateString }
|
|
372
384
|
} = props;
|
|
373
385
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
374
386
|
}
|
|
375
|
-
|
|
387
|
+
var CopyButton = react.memo(CopyButtonFn);
|
|
388
|
+
function MoveDownButtonFn(props) {
|
|
376
389
|
const {
|
|
377
390
|
registry: { translateString }
|
|
378
391
|
} = props;
|
|
379
392
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveDownButton), ...props, icon: "angle down" });
|
|
380
393
|
}
|
|
381
|
-
|
|
394
|
+
var MoveDownButton = react.memo(MoveDownButtonFn);
|
|
395
|
+
function MoveUpButtonFn(props) {
|
|
382
396
|
const {
|
|
383
397
|
registry: { translateString }
|
|
384
398
|
} = props;
|
|
385
399
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveUpButton), ...props, icon: "angle up" });
|
|
386
400
|
}
|
|
387
|
-
|
|
401
|
+
var MoveUpButton = react.memo(MoveUpButtonFn);
|
|
402
|
+
function RemoveButtonFn(props) {
|
|
388
403
|
const {
|
|
389
404
|
registry: { translateString }
|
|
390
405
|
} = props;
|
|
391
406
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.RemoveButton), ...props, icon: "trash" });
|
|
392
407
|
}
|
|
393
|
-
|
|
408
|
+
var RemoveButton = react.memo(RemoveButtonFn);
|
|
409
|
+
function ClearButtonFn(props) {
|
|
394
410
|
const {
|
|
395
411
|
registry: { translateString }
|
|
396
412
|
} = props;
|
|
397
413
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.ClearButton), ...props, icon: "close" });
|
|
398
414
|
}
|
|
415
|
+
var ClearButton = react.memo(ClearButtonFn);
|
|
399
416
|
function MultiSchemaFieldTemplate(props) {
|
|
400
417
|
const { selector, optionSchemaField } = props;
|
|
401
418
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -492,7 +509,8 @@
|
|
|
492
509
|
size: "mini"
|
|
493
510
|
}
|
|
494
511
|
);
|
|
495
|
-
}
|
|
512
|
+
}
|
|
513
|
+
if (onRemoveClick) {
|
|
496
514
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
497
515
|
RemoveButton,
|
|
498
516
|
{
|
|
@@ -571,13 +589,13 @@
|
|
|
571
589
|
className: "form-group",
|
|
572
590
|
hasFeedback: true,
|
|
573
591
|
fluid: true,
|
|
574
|
-
htmlFor:
|
|
592
|
+
htmlFor: id,
|
|
575
593
|
label: displayLabel ? keyLabel : void 0,
|
|
576
594
|
required,
|
|
577
595
|
defaultValue: label,
|
|
578
596
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
579
|
-
id
|
|
580
|
-
name:
|
|
597
|
+
id,
|
|
598
|
+
name: id,
|
|
581
599
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
582
600
|
style: wrapperStyle,
|
|
583
601
|
type: "text"
|
|
@@ -606,6 +624,7 @@
|
|
|
606
624
|
ArrayFieldItemTemplate,
|
|
607
625
|
ArrayFieldTemplate,
|
|
608
626
|
BaseInputTemplate,
|
|
627
|
+
CyclicSchemaExpandTemplate,
|
|
609
628
|
ButtonTemplates: {
|
|
610
629
|
AddButton,
|
|
611
630
|
CopyButton,
|
|
@@ -659,21 +678,21 @@
|
|
|
659
678
|
inverted: "false"
|
|
660
679
|
}
|
|
661
680
|
});
|
|
662
|
-
const
|
|
681
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
663
682
|
if (checked) {
|
|
664
683
|
onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
665
684
|
} else {
|
|
666
685
|
onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
667
686
|
}
|
|
668
687
|
};
|
|
669
|
-
const
|
|
670
|
-
const
|
|
688
|
+
const handleBlur = () => onBlur(id, value);
|
|
689
|
+
const handleFocus = () => onFocus(id, value);
|
|
671
690
|
const inlineOption = inline ? { inline: true } : { grouped: true };
|
|
672
691
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
673
692
|
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(TitleFieldTemplate, { id: utils.titleId(id), title: label, schema, uiSchema, registry }),
|
|
674
693
|
/* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Form.Group, { id, name: htmlName || id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
675
694
|
const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
676
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
695
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
677
696
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
678
697
|
semanticUiReact.Form.Checkbox,
|
|
679
698
|
{
|
|
@@ -685,12 +704,12 @@
|
|
|
685
704
|
error: rawErrors.length > 0,
|
|
686
705
|
disabled: disabled || itemDisabled || readonly,
|
|
687
706
|
autoFocus: autofocus && index === 0,
|
|
688
|
-
onChange:
|
|
689
|
-
onBlur:
|
|
690
|
-
onFocus:
|
|
707
|
+
onChange: handleChange(index),
|
|
708
|
+
onBlur: handleBlur,
|
|
709
|
+
onFocus: handleFocus,
|
|
691
710
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
692
711
|
},
|
|
693
|
-
|
|
712
|
+
String(option.value)
|
|
694
713
|
);
|
|
695
714
|
}) })
|
|
696
715
|
] });
|
|
@@ -702,7 +721,7 @@
|
|
|
702
721
|
value,
|
|
703
722
|
disabled,
|
|
704
723
|
readonly,
|
|
705
|
-
label
|
|
724
|
+
label,
|
|
706
725
|
hideLabel,
|
|
707
726
|
autofocus,
|
|
708
727
|
onChange,
|
|
@@ -728,10 +747,10 @@
|
|
|
728
747
|
options
|
|
729
748
|
);
|
|
730
749
|
const required = utils.schemaRequiresTrueValue(schema);
|
|
731
|
-
const checked = value
|
|
732
|
-
const
|
|
733
|
-
const
|
|
734
|
-
const
|
|
750
|
+
const checked = value === "true" || value === true;
|
|
751
|
+
const handleChange = (_, data) => onChange?.(data.checked);
|
|
752
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
753
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
735
754
|
const description = options.description ?? schema.description;
|
|
736
755
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
737
756
|
!hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -754,9 +773,9 @@
|
|
|
754
773
|
...semanticProps,
|
|
755
774
|
checked: typeof value === "undefined" ? false : checked,
|
|
756
775
|
error: rawErrors.length > 0,
|
|
757
|
-
onChange:
|
|
758
|
-
onBlur:
|
|
759
|
-
onFocus:
|
|
776
|
+
onChange: handleChange,
|
|
777
|
+
onBlur: handleBlur,
|
|
778
|
+
onFocus: handleFocus,
|
|
760
779
|
required,
|
|
761
780
|
label: utils.labelValue(label, hideLabel, false),
|
|
762
781
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
@@ -787,15 +806,13 @@
|
|
|
787
806
|
options,
|
|
788
807
|
uiSchema
|
|
789
808
|
});
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const _onBlur = () => onBlur(id, value);
|
|
794
|
-
const _onFocus = () => onFocus(id, value);
|
|
809
|
+
const handleChange = (_, { value: eventValue }) => onChange(utils.enumOptionValueDecoder(String(eventValue), enumOptions, optionValueFormat, emptyValue));
|
|
810
|
+
const handleBlur = () => onBlur(id, value);
|
|
811
|
+
const handleFocus = () => onFocus(id, value);
|
|
795
812
|
const inlineOption = options.inline ? { inline: true } : { grouped: true };
|
|
796
813
|
return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Form.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
797
814
|
const checked = utils.enumOptionsIsSelected(option.value, value);
|
|
798
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
815
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
799
816
|
return /* @__PURE__ */ react.createElement(
|
|
800
817
|
semanticUiReact.Form.Field,
|
|
801
818
|
{
|
|
@@ -804,13 +821,13 @@
|
|
|
804
821
|
id: utils.optionId(id, index),
|
|
805
822
|
name: htmlName || id,
|
|
806
823
|
...semanticProps,
|
|
807
|
-
onFocus:
|
|
808
|
-
onBlur:
|
|
809
|
-
onChange:
|
|
824
|
+
onFocus: handleFocus,
|
|
825
|
+
onBlur: handleBlur,
|
|
826
|
+
onChange: handleChange,
|
|
810
827
|
label: option.label,
|
|
811
828
|
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
812
829
|
error: rawErrors.length > 0,
|
|
813
|
-
key:
|
|
830
|
+
key: String(option.value),
|
|
814
831
|
checked,
|
|
815
832
|
disabled: disabled || itemDisabled || readonly,
|
|
816
833
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
@@ -842,9 +859,9 @@
|
|
|
842
859
|
fluid: true
|
|
843
860
|
}
|
|
844
861
|
});
|
|
845
|
-
const
|
|
846
|
-
const
|
|
847
|
-
const
|
|
862
|
+
const handleChange = ({ target: { value: value2 } }) => onChange?.(value2 === "" ? options.emptyValue : value2);
|
|
863
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
864
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
848
865
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
849
866
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
850
867
|
semanticUiReact.Input,
|
|
@@ -858,9 +875,9 @@
|
|
|
858
875
|
...semanticProps,
|
|
859
876
|
value: value || "",
|
|
860
877
|
error: rawErrors.length > 0,
|
|
861
|
-
onChange:
|
|
862
|
-
onBlur:
|
|
863
|
-
onFocus:
|
|
878
|
+
onChange: handleChange,
|
|
879
|
+
onBlur: handleBlur,
|
|
880
|
+
onFocus: handleFocus,
|
|
864
881
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
865
882
|
},
|
|
866
883
|
id
|
|
@@ -871,7 +888,7 @@
|
|
|
871
888
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled, showPlaceholderOption, placeholder, format = "indexed") {
|
|
872
889
|
const disabledOptions = enumDisabled || [];
|
|
873
890
|
const options = map(enumOptions, ({ label, value }, index) => ({
|
|
874
|
-
disabled: disabledOptions.
|
|
891
|
+
disabled: disabledOptions.includes(value),
|
|
875
892
|
key: label,
|
|
876
893
|
text: label,
|
|
877
894
|
value: utils.enumOptionValueEncoder(value, index, format)
|
|
@@ -919,6 +936,7 @@
|
|
|
919
936
|
const emptyValue = multiple ? [] : "";
|
|
920
937
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
921
938
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
939
|
+
utils.logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
|
|
922
940
|
const dropdownOptions = createDefaultValueOptionsForDropDown(
|
|
923
941
|
enumOptions,
|
|
924
942
|
enumDisabled,
|
|
@@ -926,32 +944,35 @@
|
|
|
926
944
|
placeholder,
|
|
927
945
|
optionValueFormat
|
|
928
946
|
);
|
|
929
|
-
const
|
|
930
|
-
const
|
|
931
|
-
const
|
|
932
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
947
|
+
const handleChange = (_, { value: enumValue }) => onChange(utils.enumOptionValueDecoder(enumValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
948
|
+
const handleBlur = (_, { target }) => onBlur(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
949
|
+
const handleFocus = (_, { target }) => onFocus(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
950
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
951
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
952
|
+
semanticUiReact.Form.Dropdown,
|
|
953
|
+
{
|
|
954
|
+
id,
|
|
955
|
+
name: htmlName || id,
|
|
956
|
+
label: utils.labelValue(label || void 0, hideLabel, false),
|
|
957
|
+
multiple: typeof multiple === "undefined" ? false : multiple,
|
|
958
|
+
value: utils.enumOptionSelectedValue(value, enumOptions, !!multiple, optionValueFormat, emptyValue),
|
|
959
|
+
error: rawErrors.length > 0,
|
|
960
|
+
disabled,
|
|
961
|
+
placeholder,
|
|
962
|
+
...semanticProps,
|
|
963
|
+
required,
|
|
964
|
+
autoFocus: autofocus,
|
|
965
|
+
readOnly: readonly,
|
|
966
|
+
options: dropdownOptions,
|
|
967
|
+
onChange: handleChange,
|
|
968
|
+
onBlur: handleBlur,
|
|
969
|
+
onFocus: handleFocus,
|
|
970
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
971
|
+
},
|
|
972
|
+
id
|
|
973
|
+
),
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(utils.SelectedOptionDescription, { ...props })
|
|
975
|
+
] });
|
|
955
976
|
}
|
|
956
977
|
function TextareaWidget(props) {
|
|
957
978
|
const {
|
|
@@ -977,9 +998,9 @@
|
|
|
977
998
|
options,
|
|
978
999
|
defaultSchemaProps: { inverted: "false" }
|
|
979
1000
|
});
|
|
980
|
-
const
|
|
981
|
-
const
|
|
982
|
-
const
|
|
1001
|
+
const handleChange = ({ target: { value: value2 } }) => onChange?.(value2 === "" ? options.emptyValue : value2);
|
|
1002
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
1003
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
983
1004
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
984
1005
|
semanticUiReact.Form.TextArea,
|
|
985
1006
|
{
|
|
@@ -994,9 +1015,9 @@
|
|
|
994
1015
|
value: value || "",
|
|
995
1016
|
error: rawErrors.length > 0,
|
|
996
1017
|
rows: options.rows || 5,
|
|
997
|
-
onChange:
|
|
998
|
-
onBlur:
|
|
999
|
-
onFocus:
|
|
1018
|
+
onChange: handleChange,
|
|
1019
|
+
onBlur: handleBlur,
|
|
1020
|
+
onFocus: handleFocus,
|
|
1000
1021
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1001
1022
|
},
|
|
1002
1023
|
id
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
-
import { SemanticIconButtonProps } from '../IconButton/index.js';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
import type { SemanticIconButtonProps } from '../IconButton/index.js';
|
|
3
3
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
4
4
|
*/
|
|
5
|
-
export default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema, registry, color, ...props }: SemanticIconButtonProps<T, S, F>): import("react
|
|
5
|
+
export default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema, registry, color, ...props }: SemanticIconButtonProps<T, S, F>): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIjD;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACyB;IACjC,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,EACxD,KAAK,EAAE,KAA6B,EACpC,IAAI,EAAC,MAAM,KACP,KAAK,EACT,IAAI,kBAEJ,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
3
3
|
*
|
|
4
4
|
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
|
-
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react
|
|
6
|
+
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getUiOptions, getTemplate
|
|
2
|
+
import { getUiOptions, getTemplate } from '@rjsf/utils';
|
|
3
3
|
import { Button, Grid, Segment } from 'semantic-ui-react';
|
|
4
4
|
import { getSemanticProps, MaybeWrap } from '../util.js';
|
|
5
5
|
const gridStyle = (vertical) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,SAAS,GAAG,CAAC,QAAiB,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM;IACf,mBAAmB,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IA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AC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,YAE9D,KAAC,6BAA6B,OAAK,YAAY,GAAI,GACtC,GACH,CACf,IACI,GACG,GACR,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
3
3
|
*
|
|
4
4
|
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
|
-
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react
|
|
6
|
+
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getTemplate, getUiOptions, isFixedItems, buttonId
|
|
2
|
+
import { getTemplate, getUiOptions, isFixedItems, buttonId } from '@rjsf/utils';
|
|
3
3
|
import { cleanClassNames } from '../util.js';
|
|
4
4
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,E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AC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,EACxD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,EACF,0BACE,eAAK,SAAS,EAAC,qBAAqB,aACjC,CAAC,8BAA8B,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EACjE,KAAK,IACF,EACL,MAAM,IAAI,CACT,cACE,KAAK,EAAE;4BACL,SAAS,EAAE,MAAM;4BACjB,QAAQ,EAAE,UAAU;4BACpB,SAAS,EAAE,OAAO;yBACnB,YAED,KAAC,SAAS,IACR,EAAE,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,EAChC,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACE,CACP,KAtBO,mBAAmB,WAAW,CAAC,GAAG,EAAE,CAuBxC,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
3
3
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
4
4
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
5
5
|
*
|
|
6
6
|
* @param props - The `WidgetProps` for this template
|
|
7
7
|
*/
|
|
8
|
-
export default function BaseInputTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: BaseInputTemplateProps<T, S, F>): import("react
|
|
8
|
+
export default function BaseInputTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: BaseInputTemplateProps<T, S, F>): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { SchemaExamples } from '@rjsf/core';
|
|
4
|
-
import { ariaDescribedByIds, examplesId, getInputProps, labelValue
|
|
4
|
+
import { ariaDescribedByIds, examplesId, getInputProps, labelValue } from '@rjsf/utils';
|
|
5
5
|
import { Form } from 'semantic-ui-react';
|
|
6
6
|
import { getSemanticProps } from '../util.js';
|
|
7
7
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -19,15 +19,15 @@ export default function BaseInputTemplate(props) {
|
|
|
19
19
|
formContext: registry.formContext,
|
|
20
20
|
options,
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
22
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue);
|
|
23
|
+
const handleBlur = () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(id, value);
|
|
24
|
+
const handleFocus = () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(id, value);
|
|
25
|
+
const handleClear = useCallback((e) => {
|
|
26
26
|
var _a;
|
|
27
27
|
e.preventDefault();
|
|
28
28
|
e.stopPropagation();
|
|
29
29
|
onChange((_a = options.emptyValue) !== null && _a !== void 0 ? _a : '');
|
|
30
30
|
}, [onChange, options.emptyValue]);
|
|
31
|
-
return (_jsxs(_Fragment, { children: [_jsx(Form.Input, { id: id, name: htmlName || id, placeholder: placeholder, ...inputProps, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, list: schema.examples ? examplesId(id) : undefined, ...semanticProps, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride ||
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsx(Form.Input, { id: id, name: htmlName || id, placeholder: placeholder, ...inputProps, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, list: schema.examples ? examplesId(id) : undefined, ...semanticProps, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }, id), options.allowClearTextInputs && !readonly && !disabled && value && (_jsx(ClearButton, { registry: registry, onClick: handleClear })), _jsx(SchemaExamples, { id: id, schema: schema })] }));
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=BaseInputTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAIvC,KAAsC;IACtC,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,WAAW,EACX,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,SA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KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,EACvD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,KAC9C,aAAa,EACjB,KAAK,EAAE,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EACxC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,EAC3B,QAAQ,EAAE,gBAAgB,IAAI,YAAY,EAC1C,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,sBACF,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAhBtD,EAAE,CAiBP,EACD,OAAO,CAAC,oBAAoB,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,KAAK,IAAI,CAClE,KAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAI,CAC1D,EACD,KAAC,cAAc,IAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAI,IACzC,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
2
2
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
3
3
|
* It is typically used to represent a boolean.
|
|
4
4
|
*
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
|
-
export default function CheckboxWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react
|
|
7
|
+
export default function CheckboxWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ariaDescribedByIds, descriptionId, getTemplate, labelValue, schemaRequiresTrueValue
|
|
2
|
+
import { ariaDescribedByIds, descriptionId, getTemplate, labelValue, schemaRequiresTrueValue } from '@rjsf/utils';
|
|
3
3
|
import { Form } from 'semantic-ui-react';
|
|
4
4
|
import { getSemanticProps } from '../util.js';
|
|
5
5
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
@@ -9,7 +9,7 @@ import { getSemanticProps } from '../util.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export default function CheckboxWidget(props) {
|
|
11
11
|
var _a;
|
|
12
|
-
const { id, htmlName, value, disabled, readonly, label
|
|
12
|
+
const { id, htmlName, value, disabled, readonly, label, hideLabel, autofocus, onChange, onBlur, options, onFocus, schema, uiSchema, rawErrors = [], registry, } = props;
|
|
13
13
|
const semanticProps = getSemanticProps({
|
|
14
14
|
options,
|
|
15
15
|
formContext: registry.formContext,
|
|
@@ -23,11 +23,11 @@ export default function CheckboxWidget(props) {
|
|
|
23
23
|
// the "required" attribute if the field value must be "true", due to the
|
|
24
24
|
// "const" or "enum" keywords
|
|
25
25
|
const required = schemaRequiresTrueValue(schema);
|
|
26
|
-
const checked = value
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
26
|
+
const checked = value === 'true' || value === true;
|
|
27
|
+
const handleChange = (_, data) => onChange === null || onChange === void 0 ? void 0 : onChange(data.checked);
|
|
28
|
+
const handleBlur = () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(id, value);
|
|
29
|
+
const handleFocus = () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(id, value);
|
|
30
30
|
const description = (_a = options.description) !== null && _a !== void 0 ? _a : schema.description;
|
|
31
|
-
return (_jsxs(_Fragment, { children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsx(Form.Checkbox, { id: id, name: htmlName || id, disabled: disabled || readonly, autoFocus: autofocus, ...semanticProps, checked: typeof value === 'undefined' ? false : checked, error: rawErrors.length > 0, onChange:
|
|
31
|
+
return (_jsxs(_Fragment, { children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsx(Form.Checkbox, { id: id, name: htmlName || id, disabled: disabled || readonly, autoFocus: autofocus, ...semanticProps, checked: typeof value === 'undefined' ? false : checked, error: rawErrors.length > 0, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, required: required, label: labelValue(label, hideLabel, false), "aria-describedby": ariaDescribedByIds(id) })] }));
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=CheckboxWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAElH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAIpC,KAA2B;;IAC3B,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,KAAK,EACL,QAAQ,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