@rjsf/semantic-ui 6.6.1 → 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 +82 -74
- package/dist/index.cjs.map +3 -3
- package/dist/semantic-ui.esm.js +89 -119
- package/dist/semantic-ui.esm.js.map +3 -3
- package/dist/semantic-ui.umd.js +79 -72
- package/lib/AddButton/AddButton.d.ts +2 -2
- 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 +6 -6
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- 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.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- 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/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 +1 -1
- 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 -7
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +5 -6
- 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 +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 +6 -6
- 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/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- 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 +9 -3
- package/lib/util.js.map +1 -1
- package/package.json +6 -6
- 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 +12 -20
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
- 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 +10 -9
- package/src/SelectWidget/SelectWidget.tsx +20 -18
- package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -16
- 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 +17 -18
package/dist/index.cjs
CHANGED
|
@@ -89,14 +89,13 @@ function getSemanticProps({
|
|
|
89
89
|
const formContextProps = formContext.semantic;
|
|
90
90
|
const schemaProps = (0, import_utils2.getUiOptions)(uiSchema).semantic;
|
|
91
91
|
const optionProps = options.semantic;
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
92
|
+
return {
|
|
93
|
+
...defaultSchemaProps,
|
|
94
|
+
...defaultContextProps,
|
|
95
|
+
...schemaProps,
|
|
96
|
+
...optionProps,
|
|
97
|
+
...formContextProps
|
|
98
|
+
};
|
|
100
99
|
}
|
|
101
100
|
function getSemanticErrorProps({
|
|
102
101
|
formContext = {},
|
|
@@ -108,7 +107,7 @@ function getSemanticErrorProps({
|
|
|
108
107
|
const semanticOptions = (0, import_utils2.getUiOptions)(uiSchema).semantic;
|
|
109
108
|
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
110
109
|
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
111
|
-
return
|
|
110
|
+
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
112
111
|
}
|
|
113
112
|
function cleanClassNames(classNameArr, omit = []) {
|
|
114
113
|
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
@@ -278,10 +277,10 @@ function BaseInputTemplate(props) {
|
|
|
278
277
|
formContext: registry.formContext,
|
|
279
278
|
options
|
|
280
279
|
});
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
const
|
|
280
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
281
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
282
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
283
|
+
const handleClear = (0, import_react.useCallback)(
|
|
285
284
|
(e) => {
|
|
286
285
|
e.preventDefault();
|
|
287
286
|
e.stopPropagation();
|
|
@@ -305,14 +304,14 @@ function BaseInputTemplate(props) {
|
|
|
305
304
|
...semanticProps,
|
|
306
305
|
value: value || value === 0 ? value : "",
|
|
307
306
|
error: rawErrors.length > 0,
|
|
308
|
-
onChange: onChangeOverride ||
|
|
309
|
-
onBlur:
|
|
310
|
-
onFocus:
|
|
307
|
+
onChange: onChangeOverride || handleChange,
|
|
308
|
+
onBlur: handleBlur,
|
|
309
|
+
onFocus: handleFocus,
|
|
311
310
|
"aria-describedby": (0, import_utils5.ariaDescribedByIds)(id, !!schema.examples)
|
|
312
311
|
},
|
|
313
312
|
id
|
|
314
313
|
),
|
|
315
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick:
|
|
314
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
316
315
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core.SchemaExamples, { id, schema })
|
|
317
316
|
] });
|
|
318
317
|
}
|
|
@@ -339,7 +338,10 @@ function ErrorList({
|
|
|
339
338
|
const { translateString } = registry;
|
|
340
339
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_semantic_ui_react4.Message, { negative: true, children: [
|
|
341
340
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_semantic_ui_react4.Message.Header, { children: translateString(import_utils6.TranslatableString.ErrorsLabel) }),
|
|
342
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_semantic_ui_react4.Message.List, { children: errors.map((error, index) =>
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_semantic_ui_react4.Message.List, { children: errors.map((error, index) => (
|
|
342
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_semantic_ui_react4.Message.Item, { children: error.stack }, `error-${index}`)
|
|
344
|
+
)) })
|
|
343
345
|
] });
|
|
344
346
|
}
|
|
345
347
|
|
|
@@ -454,10 +456,11 @@ function GridTemplate(props) {
|
|
|
454
456
|
}
|
|
455
457
|
|
|
456
458
|
// src/IconButton/IconButton.tsx
|
|
459
|
+
var import_react2 = require("react");
|
|
457
460
|
var import_utils10 = require("@rjsf/utils");
|
|
458
461
|
var import_semantic_ui_react9 = require("semantic-ui-react");
|
|
459
462
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
460
|
-
function
|
|
463
|
+
function IconButtonFn(props) {
|
|
461
464
|
const { icon, iconType, color, className, uiSchema, registry, ...otherProps } = props;
|
|
462
465
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
463
466
|
import_semantic_ui_react9.Button,
|
|
@@ -470,36 +473,42 @@ function IconButton(props) {
|
|
|
470
473
|
}
|
|
471
474
|
);
|
|
472
475
|
}
|
|
473
|
-
|
|
476
|
+
var IconButton = (0, import_react2.memo)(IconButtonFn);
|
|
477
|
+
function CopyButtonFn(props) {
|
|
474
478
|
const {
|
|
475
479
|
registry: { translateString }
|
|
476
480
|
} = props;
|
|
477
481
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
478
482
|
}
|
|
479
|
-
|
|
483
|
+
var CopyButton = (0, import_react2.memo)(CopyButtonFn);
|
|
484
|
+
function MoveDownButtonFn(props) {
|
|
480
485
|
const {
|
|
481
486
|
registry: { translateString }
|
|
482
487
|
} = props;
|
|
483
488
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.MoveDownButton), ...props, icon: "angle down" });
|
|
484
489
|
}
|
|
485
|
-
|
|
490
|
+
var MoveDownButton = (0, import_react2.memo)(MoveDownButtonFn);
|
|
491
|
+
function MoveUpButtonFn(props) {
|
|
486
492
|
const {
|
|
487
493
|
registry: { translateString }
|
|
488
494
|
} = props;
|
|
489
495
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.MoveUpButton), ...props, icon: "angle up" });
|
|
490
496
|
}
|
|
491
|
-
|
|
497
|
+
var MoveUpButton = (0, import_react2.memo)(MoveUpButtonFn);
|
|
498
|
+
function RemoveButtonFn(props) {
|
|
492
499
|
const {
|
|
493
500
|
registry: { translateString }
|
|
494
501
|
} = props;
|
|
495
502
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.RemoveButton), ...props, icon: "trash" });
|
|
496
503
|
}
|
|
497
|
-
|
|
504
|
+
var RemoveButton = (0, import_react2.memo)(RemoveButtonFn);
|
|
505
|
+
function ClearButtonFn(props) {
|
|
498
506
|
const {
|
|
499
507
|
registry: { translateString }
|
|
500
508
|
} = props;
|
|
501
509
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.ClearButton), ...props, icon: "close" });
|
|
502
510
|
}
|
|
511
|
+
var ClearButton = (0, import_react2.memo)(ClearButtonFn);
|
|
503
512
|
|
|
504
513
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
505
514
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
@@ -607,7 +616,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
607
616
|
size: "mini"
|
|
608
617
|
}
|
|
609
618
|
);
|
|
610
|
-
}
|
|
619
|
+
}
|
|
620
|
+
if (onRemoveClick) {
|
|
611
621
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
612
622
|
RemoveButton,
|
|
613
623
|
{
|
|
@@ -700,13 +710,13 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
700
710
|
className: "form-group",
|
|
701
711
|
hasFeedback: true,
|
|
702
712
|
fluid: true,
|
|
703
|
-
htmlFor:
|
|
713
|
+
htmlFor: id,
|
|
704
714
|
label: displayLabel ? keyLabel : void 0,
|
|
705
715
|
required,
|
|
706
716
|
defaultValue: label,
|
|
707
717
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
708
|
-
id
|
|
709
|
-
name:
|
|
718
|
+
id,
|
|
719
|
+
name: id,
|
|
710
720
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
711
721
|
style: wrapperStyle,
|
|
712
722
|
type: "text"
|
|
@@ -793,21 +803,21 @@ function CheckboxesWidget(props) {
|
|
|
793
803
|
inverted: "false"
|
|
794
804
|
}
|
|
795
805
|
});
|
|
796
|
-
const
|
|
806
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
797
807
|
if (checked) {
|
|
798
808
|
onChange((0, import_utils14.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
799
809
|
} else {
|
|
800
810
|
onChange((0, import_utils14.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
801
811
|
}
|
|
802
812
|
};
|
|
803
|
-
const
|
|
804
|
-
const
|
|
813
|
+
const handleBlur = () => onBlur(id, value);
|
|
814
|
+
const handleFocus = () => onFocus(id, value);
|
|
805
815
|
const inlineOption = inline ? { inline: true } : { grouped: true };
|
|
806
816
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
807
817
|
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TitleFieldTemplate, { id: (0, import_utils14.titleId)(id), title: label, schema, uiSchema, registry }),
|
|
808
818
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Form.Group, { id, name: htmlName || id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
809
819
|
const checked = (0, import_utils14.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
810
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
820
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
811
821
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
812
822
|
import_semantic_ui_react14.Form.Checkbox,
|
|
813
823
|
{
|
|
@@ -819,12 +829,12 @@ function CheckboxesWidget(props) {
|
|
|
819
829
|
error: rawErrors.length > 0,
|
|
820
830
|
disabled: disabled || itemDisabled || readonly,
|
|
821
831
|
autoFocus: autofocus && index === 0,
|
|
822
|
-
onChange:
|
|
823
|
-
onBlur:
|
|
824
|
-
onFocus:
|
|
832
|
+
onChange: handleChange(index),
|
|
833
|
+
onBlur: handleBlur,
|
|
834
|
+
onFocus: handleFocus,
|
|
825
835
|
"aria-describedby": (0, import_utils14.ariaDescribedByIds)(id)
|
|
826
836
|
},
|
|
827
|
-
|
|
837
|
+
String(option.value)
|
|
828
838
|
);
|
|
829
839
|
}) })
|
|
830
840
|
] });
|
|
@@ -867,10 +877,10 @@ function CheckboxWidget(props) {
|
|
|
867
877
|
options
|
|
868
878
|
);
|
|
869
879
|
const required = (0, import_utils15.schemaRequiresTrueValue)(schema);
|
|
870
|
-
const checked = value
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
const
|
|
880
|
+
const checked = value === "true" || value === true;
|
|
881
|
+
const handleChange = (_, data) => onChange && onChange(data.checked);
|
|
882
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
883
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
874
884
|
const description = options.description ?? schema.description;
|
|
875
885
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
876
886
|
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -893,9 +903,9 @@ function CheckboxWidget(props) {
|
|
|
893
903
|
...semanticProps,
|
|
894
904
|
checked: typeof value === "undefined" ? false : checked,
|
|
895
905
|
error: rawErrors.length > 0,
|
|
896
|
-
onChange:
|
|
897
|
-
onBlur:
|
|
898
|
-
onFocus:
|
|
906
|
+
onChange: handleChange,
|
|
907
|
+
onBlur: handleBlur,
|
|
908
|
+
onFocus: handleFocus,
|
|
899
909
|
required,
|
|
900
910
|
label: (0, import_utils15.labelValue)(label, hideLabel, false),
|
|
901
911
|
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id)
|
|
@@ -908,7 +918,7 @@ function CheckboxWidget(props) {
|
|
|
908
918
|
var import_utils16 = require("@rjsf/utils");
|
|
909
919
|
var import_semantic_ui_react16 = require("semantic-ui-react");
|
|
910
920
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
911
|
-
var
|
|
921
|
+
var import_react3 = require("react");
|
|
912
922
|
function RadioWidget(props) {
|
|
913
923
|
const {
|
|
914
924
|
id,
|
|
@@ -932,16 +942,14 @@ function RadioWidget(props) {
|
|
|
932
942
|
options,
|
|
933
943
|
uiSchema
|
|
934
944
|
});
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const _onBlur = () => onBlur(id, value);
|
|
939
|
-
const _onFocus = () => onFocus(id, value);
|
|
945
|
+
const handleChange = (_, { value: eventValue }) => onChange((0, import_utils16.enumOptionValueDecoder)(String(eventValue), enumOptions, optionValueFormat, emptyValue));
|
|
946
|
+
const handleBlur = () => onBlur(id, value);
|
|
947
|
+
const handleFocus = () => onFocus(id, value);
|
|
940
948
|
const inlineOption = options.inline ? { inline: true } : { grouped: true };
|
|
941
949
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_semantic_ui_react16.Form.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
942
950
|
const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, value);
|
|
943
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
944
|
-
return /* @__PURE__ */ (0,
|
|
951
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
952
|
+
return /* @__PURE__ */ (0, import_react3.createElement)(
|
|
945
953
|
import_semantic_ui_react16.Form.Field,
|
|
946
954
|
{
|
|
947
955
|
required,
|
|
@@ -949,13 +957,13 @@ function RadioWidget(props) {
|
|
|
949
957
|
id: (0, import_utils16.optionId)(id, index),
|
|
950
958
|
name: htmlName || id,
|
|
951
959
|
...semanticProps,
|
|
952
|
-
onFocus:
|
|
953
|
-
onBlur:
|
|
954
|
-
onChange:
|
|
960
|
+
onFocus: handleFocus,
|
|
961
|
+
onBlur: handleBlur,
|
|
962
|
+
onChange: handleChange,
|
|
955
963
|
label: option.label,
|
|
956
964
|
value: (0, import_utils16.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
957
965
|
error: rawErrors.length > 0,
|
|
958
|
-
key:
|
|
966
|
+
key: String(option.value),
|
|
959
967
|
checked,
|
|
960
968
|
disabled: disabled || itemDisabled || readonly,
|
|
961
969
|
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
@@ -992,9 +1000,9 @@ function RangeWidget(props) {
|
|
|
992
1000
|
fluid: true
|
|
993
1001
|
}
|
|
994
1002
|
});
|
|
995
|
-
const
|
|
996
|
-
const
|
|
997
|
-
const
|
|
1003
|
+
const handleChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
1004
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1005
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
998
1006
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
999
1007
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1000
1008
|
import_semantic_ui_react17.Input,
|
|
@@ -1008,9 +1016,9 @@ function RangeWidget(props) {
|
|
|
1008
1016
|
...semanticProps,
|
|
1009
1017
|
value: value || "",
|
|
1010
1018
|
error: rawErrors.length > 0,
|
|
1011
|
-
onChange:
|
|
1012
|
-
onBlur:
|
|
1013
|
-
onFocus:
|
|
1019
|
+
onChange: handleChange,
|
|
1020
|
+
onBlur: handleBlur,
|
|
1021
|
+
onFocus: handleFocus,
|
|
1014
1022
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
1015
1023
|
},
|
|
1016
1024
|
id
|
|
@@ -1027,7 +1035,7 @@ var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
|
1027
1035
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled, showPlaceholderOption, placeholder, format = "indexed") {
|
|
1028
1036
|
const disabledOptions = enumDisabled || [];
|
|
1029
1037
|
const options = (0, import_map.default)(enumOptions, ({ label, value }, index) => ({
|
|
1030
|
-
disabled: disabledOptions.
|
|
1038
|
+
disabled: disabledOptions.includes(value),
|
|
1031
1039
|
key: label,
|
|
1032
1040
|
text: label,
|
|
1033
1041
|
value: (0, import_utils18.enumOptionValueEncoder)(value, index, format)
|
|
@@ -1082,9 +1090,9 @@ function SelectWidget(props) {
|
|
|
1082
1090
|
placeholder,
|
|
1083
1091
|
optionValueFormat
|
|
1084
1092
|
);
|
|
1085
|
-
const
|
|
1086
|
-
const
|
|
1087
|
-
const
|
|
1093
|
+
const handleChange = (_, { value: enumValue }) => onChange((0, import_utils18.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
1094
|
+
const handleBlur = (_, { target }) => onBlur(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1095
|
+
const handleFocus = (_, { target }) => onFocus(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1088
1096
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1089
1097
|
import_semantic_ui_react18.Form.Dropdown,
|
|
1090
1098
|
{
|
|
@@ -1101,9 +1109,9 @@ function SelectWidget(props) {
|
|
|
1101
1109
|
autoFocus: autofocus,
|
|
1102
1110
|
readOnly: readonly,
|
|
1103
1111
|
options: dropdownOptions,
|
|
1104
|
-
onChange:
|
|
1105
|
-
onBlur:
|
|
1106
|
-
onFocus:
|
|
1112
|
+
onChange: handleChange,
|
|
1113
|
+
onBlur: handleBlur,
|
|
1114
|
+
onFocus: handleFocus,
|
|
1107
1115
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id)
|
|
1108
1116
|
},
|
|
1109
1117
|
id
|
|
@@ -1138,9 +1146,9 @@ function TextareaWidget(props) {
|
|
|
1138
1146
|
options,
|
|
1139
1147
|
defaultSchemaProps: { inverted: "false" }
|
|
1140
1148
|
});
|
|
1141
|
-
const
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1149
|
+
const handleChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
1150
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1151
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1144
1152
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1145
1153
|
import_semantic_ui_react19.Form.TextArea,
|
|
1146
1154
|
{
|
|
@@ -1155,9 +1163,9 @@ function TextareaWidget(props) {
|
|
|
1155
1163
|
value: value || "",
|
|
1156
1164
|
error: rawErrors.length > 0,
|
|
1157
1165
|
rows: options.rows || 5,
|
|
1158
|
-
onChange:
|
|
1159
|
-
onBlur:
|
|
1160
|
-
onFocus:
|
|
1166
|
+
onChange: handleChange,
|
|
1167
|
+
onBlur: handleBlur,
|
|
1168
|
+
onFocus: handleFocus,
|
|
1161
1169
|
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id)
|
|
1162
1170
|
},
|
|
1163
1171
|
id
|