@rjsf/semantic-ui 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 +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 +8 -8
- 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/semantic-ui.esm.js
CHANGED
|
@@ -29,16 +29,11 @@ function AddButton({
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
32
|
-
import {
|
|
33
|
-
getUiOptions as getUiOptions2,
|
|
34
|
-
getTemplate
|
|
35
|
-
} from "@rjsf/utils";
|
|
32
|
+
import { getUiOptions as getUiOptions2, getTemplate } from "@rjsf/utils";
|
|
36
33
|
import { Button as Button2, Grid, Segment } from "semantic-ui-react";
|
|
37
34
|
|
|
38
35
|
// src/util.tsx
|
|
39
|
-
import {
|
|
40
|
-
getUiOptions
|
|
41
|
-
} from "@rjsf/utils";
|
|
36
|
+
import { getUiOptions } from "@rjsf/utils";
|
|
42
37
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
43
38
|
function getSemanticProps({
|
|
44
39
|
formContext = {},
|
|
@@ -50,14 +45,13 @@ function getSemanticProps({
|
|
|
50
45
|
const formContextProps = formContext.semantic;
|
|
51
46
|
const schemaProps = getUiOptions(uiSchema).semantic;
|
|
52
47
|
const optionProps = options.semantic;
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
);
|
|
48
|
+
return {
|
|
49
|
+
...defaultSchemaProps,
|
|
50
|
+
...defaultContextProps,
|
|
51
|
+
...schemaProps,
|
|
52
|
+
...optionProps,
|
|
53
|
+
...formContextProps
|
|
54
|
+
};
|
|
61
55
|
}
|
|
62
56
|
function getSemanticErrorProps({
|
|
63
57
|
formContext = {},
|
|
@@ -69,7 +63,7 @@ function getSemanticErrorProps({
|
|
|
69
63
|
const semanticOptions = getUiOptions(uiSchema).semantic;
|
|
70
64
|
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
71
65
|
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
72
|
-
return
|
|
66
|
+
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
73
67
|
}
|
|
74
68
|
function cleanClassNames(classNameArr, omit = []) {
|
|
75
69
|
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
@@ -115,12 +109,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
118
|
-
import {
|
|
119
|
-
getTemplate as getTemplate2,
|
|
120
|
-
getUiOptions as getUiOptions3,
|
|
121
|
-
isFixedItems,
|
|
122
|
-
buttonId
|
|
123
|
-
} from "@rjsf/utils";
|
|
112
|
+
import { getTemplate as getTemplate2, getUiOptions as getUiOptions3, isFixedItems, buttonId } from "@rjsf/utils";
|
|
124
113
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
125
114
|
function ArrayFieldTemplate(props) {
|
|
126
115
|
const {
|
|
@@ -211,12 +200,7 @@ function ArrayFieldTemplate(props) {
|
|
|
211
200
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
212
201
|
import { useCallback } from "react";
|
|
213
202
|
import { SchemaExamples } from "@rjsf/core";
|
|
214
|
-
import {
|
|
215
|
-
ariaDescribedByIds,
|
|
216
|
-
examplesId,
|
|
217
|
-
getInputProps,
|
|
218
|
-
labelValue
|
|
219
|
-
} from "@rjsf/utils";
|
|
203
|
+
import { ariaDescribedByIds, examplesId, getInputProps, labelValue } from "@rjsf/utils";
|
|
220
204
|
import { Form } from "semantic-ui-react";
|
|
221
205
|
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
222
206
|
function BaseInputTemplate(props) {
|
|
@@ -249,10 +233,10 @@ function BaseInputTemplate(props) {
|
|
|
249
233
|
formContext: registry.formContext,
|
|
250
234
|
options
|
|
251
235
|
});
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
const
|
|
236
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
237
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
238
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
239
|
+
const handleClear = useCallback(
|
|
256
240
|
(e) => {
|
|
257
241
|
e.preventDefault();
|
|
258
242
|
e.stopPropagation();
|
|
@@ -276,14 +260,14 @@ function BaseInputTemplate(props) {
|
|
|
276
260
|
...semanticProps,
|
|
277
261
|
value: value || value === 0 ? value : "",
|
|
278
262
|
error: rawErrors.length > 0,
|
|
279
|
-
onChange: onChangeOverride ||
|
|
280
|
-
onBlur:
|
|
281
|
-
onFocus:
|
|
263
|
+
onChange: onChangeOverride || handleChange,
|
|
264
|
+
onBlur: handleBlur,
|
|
265
|
+
onFocus: handleFocus,
|
|
282
266
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
283
267
|
},
|
|
284
268
|
id
|
|
285
269
|
),
|
|
286
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx5(ClearButton2, { registry, onClick:
|
|
270
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx5(ClearButton2, { registry, onClick: handleClear }),
|
|
287
271
|
/* @__PURE__ */ jsx5(SchemaExamples, { id, schema })
|
|
288
272
|
] });
|
|
289
273
|
}
|
|
@@ -310,7 +294,10 @@ function ErrorList({
|
|
|
310
294
|
const { translateString } = registry;
|
|
311
295
|
return /* @__PURE__ */ jsxs4(Message, { negative: true, children: [
|
|
312
296
|
/* @__PURE__ */ jsx7(Message.Header, { children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
313
|
-
/* @__PURE__ */ jsx7(Message.List, { children: errors.map((error, index) =>
|
|
297
|
+
/* @__PURE__ */ jsx7(Message.List, { children: errors.map((error, index) => (
|
|
298
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
299
|
+
/* @__PURE__ */ jsx7(Message.Item, { children: error.stack }, `error-${index}`)
|
|
300
|
+
)) })
|
|
314
301
|
] });
|
|
315
302
|
}
|
|
316
303
|
|
|
@@ -354,10 +341,7 @@ function FieldHelpTemplate(props) {
|
|
|
354
341
|
}
|
|
355
342
|
|
|
356
343
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
357
|
-
import {
|
|
358
|
-
getTemplate as getTemplate3,
|
|
359
|
-
getUiOptions as getUiOptions4
|
|
360
|
-
} from "@rjsf/utils";
|
|
344
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions4 } from "@rjsf/utils";
|
|
361
345
|
import { Form as Form2 } from "semantic-ui-react";
|
|
362
346
|
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
363
347
|
function FieldTemplate(props) {
|
|
@@ -428,10 +412,11 @@ function GridTemplate(props) {
|
|
|
428
412
|
}
|
|
429
413
|
|
|
430
414
|
// src/IconButton/IconButton.tsx
|
|
415
|
+
import { memo } from "react";
|
|
431
416
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
432
417
|
import { Button as Button3 } from "semantic-ui-react";
|
|
433
418
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
434
|
-
function
|
|
419
|
+
function IconButtonFn(props) {
|
|
435
420
|
const { icon, iconType, color, className, uiSchema, registry, ...otherProps } = props;
|
|
436
421
|
return /* @__PURE__ */ jsx12(
|
|
437
422
|
Button3,
|
|
@@ -444,36 +429,42 @@ function IconButton(props) {
|
|
|
444
429
|
}
|
|
445
430
|
);
|
|
446
431
|
}
|
|
447
|
-
|
|
432
|
+
var IconButton = memo(IconButtonFn);
|
|
433
|
+
function CopyButtonFn(props) {
|
|
448
434
|
const {
|
|
449
435
|
registry: { translateString }
|
|
450
436
|
} = props;
|
|
451
437
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.CopyButton), ...props, icon: "copy" });
|
|
452
438
|
}
|
|
453
|
-
|
|
439
|
+
var CopyButton = memo(CopyButtonFn);
|
|
440
|
+
function MoveDownButtonFn(props) {
|
|
454
441
|
const {
|
|
455
442
|
registry: { translateString }
|
|
456
443
|
} = props;
|
|
457
444
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.MoveDownButton), ...props, icon: "angle down" });
|
|
458
445
|
}
|
|
459
|
-
|
|
446
|
+
var MoveDownButton = memo(MoveDownButtonFn);
|
|
447
|
+
function MoveUpButtonFn(props) {
|
|
460
448
|
const {
|
|
461
449
|
registry: { translateString }
|
|
462
450
|
} = props;
|
|
463
451
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.MoveUpButton), ...props, icon: "angle up" });
|
|
464
452
|
}
|
|
465
|
-
|
|
453
|
+
var MoveUpButton = memo(MoveUpButtonFn);
|
|
454
|
+
function RemoveButtonFn(props) {
|
|
466
455
|
const {
|
|
467
456
|
registry: { translateString }
|
|
468
457
|
} = props;
|
|
469
458
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.RemoveButton), ...props, icon: "trash" });
|
|
470
459
|
}
|
|
471
|
-
|
|
460
|
+
var RemoveButton = memo(RemoveButtonFn);
|
|
461
|
+
function ClearButtonFn(props) {
|
|
472
462
|
const {
|
|
473
463
|
registry: { translateString }
|
|
474
464
|
} = props;
|
|
475
465
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.ClearButton), ...props, icon: "close" });
|
|
476
466
|
}
|
|
467
|
+
var ClearButton = memo(ClearButtonFn);
|
|
477
468
|
|
|
478
469
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
479
470
|
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -486,14 +477,7 @@ function MultiSchemaFieldTemplate(props) {
|
|
|
486
477
|
}
|
|
487
478
|
|
|
488
479
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
489
|
-
import {
|
|
490
|
-
canExpand,
|
|
491
|
-
descriptionId,
|
|
492
|
-
getTemplate as getTemplate4,
|
|
493
|
-
getUiOptions as getUiOptions5,
|
|
494
|
-
titleId,
|
|
495
|
-
buttonId as buttonId2
|
|
496
|
-
} from "@rjsf/utils";
|
|
480
|
+
import { canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions5, titleId, buttonId as buttonId2 } from "@rjsf/utils";
|
|
497
481
|
import { Grid as Grid3 } from "semantic-ui-react";
|
|
498
482
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
499
483
|
function ObjectFieldTemplate(props) {
|
|
@@ -588,7 +572,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
588
572
|
size: "mini"
|
|
589
573
|
}
|
|
590
574
|
);
|
|
591
|
-
}
|
|
575
|
+
}
|
|
576
|
+
if (onRemoveClick) {
|
|
592
577
|
return /* @__PURE__ */ jsx15(
|
|
593
578
|
RemoveButton,
|
|
594
579
|
{
|
|
@@ -644,11 +629,7 @@ function TitleField({
|
|
|
644
629
|
}
|
|
645
630
|
|
|
646
631
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
647
|
-
import {
|
|
648
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
649
|
-
buttonId as buttonId3,
|
|
650
|
-
TranslatableString as TranslatableString4
|
|
651
|
-
} from "@rjsf/utils";
|
|
632
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4 } from "@rjsf/utils";
|
|
652
633
|
import { Form as Form3, Grid as Grid5 } from "semantic-ui-react";
|
|
653
634
|
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
654
635
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -685,13 +666,13 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
685
666
|
className: "form-group",
|
|
686
667
|
hasFeedback: true,
|
|
687
668
|
fluid: true,
|
|
688
|
-
htmlFor:
|
|
669
|
+
htmlFor: id,
|
|
689
670
|
label: displayLabel ? keyLabel : void 0,
|
|
690
671
|
required,
|
|
691
672
|
defaultValue: label,
|
|
692
673
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
693
|
-
id
|
|
694
|
-
name:
|
|
674
|
+
id,
|
|
675
|
+
name: id,
|
|
695
676
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
696
677
|
style: wrapperStyle,
|
|
697
678
|
type: "text"
|
|
@@ -786,21 +767,21 @@ function CheckboxesWidget(props) {
|
|
|
786
767
|
inverted: "false"
|
|
787
768
|
}
|
|
788
769
|
});
|
|
789
|
-
const
|
|
770
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
790
771
|
if (checked) {
|
|
791
772
|
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
792
773
|
} else {
|
|
793
774
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
794
775
|
}
|
|
795
776
|
};
|
|
796
|
-
const
|
|
797
|
-
const
|
|
777
|
+
const handleBlur = () => onBlur(id, value);
|
|
778
|
+
const handleFocus = () => onFocus(id, value);
|
|
798
779
|
const inlineOption = inline ? { inline: true } : { grouped: true };
|
|
799
780
|
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
800
781
|
!hideLabel && !!label && /* @__PURE__ */ jsx19(TitleFieldTemplate, { id: titleId2(id), title: label, schema, uiSchema, registry }),
|
|
801
782
|
/* @__PURE__ */ jsx19(Form4.Group, { id, name: htmlName || id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
802
783
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
803
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
784
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
804
785
|
return /* @__PURE__ */ jsx19(
|
|
805
786
|
Form4.Checkbox,
|
|
806
787
|
{
|
|
@@ -812,25 +793,19 @@ function CheckboxesWidget(props) {
|
|
|
812
793
|
error: rawErrors.length > 0,
|
|
813
794
|
disabled: disabled || itemDisabled || readonly,
|
|
814
795
|
autoFocus: autofocus && index === 0,
|
|
815
|
-
onChange:
|
|
816
|
-
onBlur:
|
|
817
|
-
onFocus:
|
|
796
|
+
onChange: handleChange(index),
|
|
797
|
+
onBlur: handleBlur,
|
|
798
|
+
onFocus: handleFocus,
|
|
818
799
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
819
800
|
},
|
|
820
|
-
|
|
801
|
+
String(option.value)
|
|
821
802
|
);
|
|
822
803
|
}) })
|
|
823
804
|
] });
|
|
824
805
|
}
|
|
825
806
|
|
|
826
807
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
827
|
-
import {
|
|
828
|
-
ariaDescribedByIds as ariaDescribedByIds3,
|
|
829
|
-
descriptionId as descriptionId2,
|
|
830
|
-
getTemplate as getTemplate6,
|
|
831
|
-
labelValue as labelValue2,
|
|
832
|
-
schemaRequiresTrueValue
|
|
833
|
-
} from "@rjsf/utils";
|
|
808
|
+
import { ariaDescribedByIds as ariaDescribedByIds3, descriptionId as descriptionId2, getTemplate as getTemplate6, labelValue as labelValue2, schemaRequiresTrueValue } from "@rjsf/utils";
|
|
834
809
|
import { Form as Form5 } from "semantic-ui-react";
|
|
835
810
|
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
836
811
|
function CheckboxWidget(props) {
|
|
@@ -866,10 +841,10 @@ function CheckboxWidget(props) {
|
|
|
866
841
|
options
|
|
867
842
|
);
|
|
868
843
|
const required = schemaRequiresTrueValue(schema);
|
|
869
|
-
const checked = value
|
|
870
|
-
const
|
|
871
|
-
const
|
|
872
|
-
const
|
|
844
|
+
const checked = value === "true" || value === true;
|
|
845
|
+
const handleChange = (_, data) => onChange && onChange(data.checked);
|
|
846
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
847
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
873
848
|
const description = options.description ?? schema.description;
|
|
874
849
|
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
875
850
|
!hideLabel && description && /* @__PURE__ */ jsx20(
|
|
@@ -892,9 +867,9 @@ function CheckboxWidget(props) {
|
|
|
892
867
|
...semanticProps,
|
|
893
868
|
checked: typeof value === "undefined" ? false : checked,
|
|
894
869
|
error: rawErrors.length > 0,
|
|
895
|
-
onChange:
|
|
896
|
-
onBlur:
|
|
897
|
-
onFocus:
|
|
870
|
+
onChange: handleChange,
|
|
871
|
+
onBlur: handleBlur,
|
|
872
|
+
onFocus: handleFocus,
|
|
898
873
|
required,
|
|
899
874
|
label: labelValue2(label, hideLabel, false),
|
|
900
875
|
"aria-describedby": ariaDescribedByIds3(id)
|
|
@@ -938,15 +913,13 @@ function RadioWidget(props) {
|
|
|
938
913
|
options,
|
|
939
914
|
uiSchema
|
|
940
915
|
});
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
const _onBlur = () => onBlur(id, value);
|
|
945
|
-
const _onFocus = () => onFocus(id, value);
|
|
916
|
+
const handleChange = (_, { value: eventValue }) => onChange(enumOptionValueDecoder(String(eventValue), enumOptions, optionValueFormat, emptyValue));
|
|
917
|
+
const handleBlur = () => onBlur(id, value);
|
|
918
|
+
const handleFocus = () => onFocus(id, value);
|
|
946
919
|
const inlineOption = options.inline ? { inline: true } : { grouped: true };
|
|
947
920
|
return /* @__PURE__ */ jsx21(Form6.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
948
921
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
949
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
922
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
950
923
|
return /* @__PURE__ */ createElement(
|
|
951
924
|
Form6.Field,
|
|
952
925
|
{
|
|
@@ -955,13 +928,13 @@ function RadioWidget(props) {
|
|
|
955
928
|
id: optionId2(id, index),
|
|
956
929
|
name: htmlName || id,
|
|
957
930
|
...semanticProps,
|
|
958
|
-
onFocus:
|
|
959
|
-
onBlur:
|
|
960
|
-
onChange:
|
|
931
|
+
onFocus: handleFocus,
|
|
932
|
+
onBlur: handleBlur,
|
|
933
|
+
onChange: handleChange,
|
|
961
934
|
label: option.label,
|
|
962
935
|
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
963
936
|
error: rawErrors.length > 0,
|
|
964
|
-
key:
|
|
937
|
+
key: String(option.value),
|
|
965
938
|
checked,
|
|
966
939
|
disabled: disabled || itemDisabled || readonly,
|
|
967
940
|
"aria-describedby": ariaDescribedByIds4(id)
|
|
@@ -998,9 +971,9 @@ function RangeWidget(props) {
|
|
|
998
971
|
fluid: true
|
|
999
972
|
}
|
|
1000
973
|
});
|
|
1001
|
-
const
|
|
1002
|
-
const
|
|
1003
|
-
const
|
|
974
|
+
const handleChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
975
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
976
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1004
977
|
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1005
978
|
/* @__PURE__ */ jsx22(
|
|
1006
979
|
Input,
|
|
@@ -1014,9 +987,9 @@ function RangeWidget(props) {
|
|
|
1014
987
|
...semanticProps,
|
|
1015
988
|
value: value || "",
|
|
1016
989
|
error: rawErrors.length > 0,
|
|
1017
|
-
onChange:
|
|
1018
|
-
onBlur:
|
|
1019
|
-
onFocus:
|
|
990
|
+
onChange: handleChange,
|
|
991
|
+
onBlur: handleBlur,
|
|
992
|
+
onFocus: handleFocus,
|
|
1020
993
|
"aria-describedby": ariaDescribedByIds5(id)
|
|
1021
994
|
},
|
|
1022
995
|
id
|
|
@@ -1040,7 +1013,7 @@ import { jsx as jsx23 } from "react/jsx-runtime";
|
|
|
1040
1013
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled, showPlaceholderOption, placeholder, format = "indexed") {
|
|
1041
1014
|
const disabledOptions = enumDisabled || [];
|
|
1042
1015
|
const options = map(enumOptions, ({ label, value }, index) => ({
|
|
1043
|
-
disabled: disabledOptions.
|
|
1016
|
+
disabled: disabledOptions.includes(value),
|
|
1044
1017
|
key: label,
|
|
1045
1018
|
text: label,
|
|
1046
1019
|
value: enumOptionValueEncoder2(value, index, format)
|
|
@@ -1095,9 +1068,9 @@ function SelectWidget(props) {
|
|
|
1095
1068
|
placeholder,
|
|
1096
1069
|
optionValueFormat
|
|
1097
1070
|
);
|
|
1098
|
-
const
|
|
1099
|
-
const
|
|
1100
|
-
const
|
|
1071
|
+
const handleChange = (_, { value: enumValue }) => onChange(enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
1072
|
+
const handleBlur = (_, { target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1073
|
+
const handleFocus = (_, { target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1101
1074
|
return /* @__PURE__ */ jsx23(
|
|
1102
1075
|
Form7.Dropdown,
|
|
1103
1076
|
{
|
|
@@ -1114,9 +1087,9 @@ function SelectWidget(props) {
|
|
|
1114
1087
|
autoFocus: autofocus,
|
|
1115
1088
|
readOnly: readonly,
|
|
1116
1089
|
options: dropdownOptions,
|
|
1117
|
-
onChange:
|
|
1118
|
-
onBlur:
|
|
1119
|
-
onFocus:
|
|
1090
|
+
onChange: handleChange,
|
|
1091
|
+
onBlur: handleBlur,
|
|
1092
|
+
onFocus: handleFocus,
|
|
1120
1093
|
"aria-describedby": ariaDescribedByIds6(id)
|
|
1121
1094
|
},
|
|
1122
1095
|
id
|
|
@@ -1124,10 +1097,7 @@ function SelectWidget(props) {
|
|
|
1124
1097
|
}
|
|
1125
1098
|
|
|
1126
1099
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1127
|
-
import {
|
|
1128
|
-
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1129
|
-
labelValue as labelValue4
|
|
1130
|
-
} from "@rjsf/utils";
|
|
1100
|
+
import { ariaDescribedByIds as ariaDescribedByIds7, labelValue as labelValue4 } from "@rjsf/utils";
|
|
1131
1101
|
import { Form as Form8 } from "semantic-ui-react";
|
|
1132
1102
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1133
1103
|
function TextareaWidget(props) {
|
|
@@ -1154,9 +1124,9 @@ function TextareaWidget(props) {
|
|
|
1154
1124
|
options,
|
|
1155
1125
|
defaultSchemaProps: { inverted: "false" }
|
|
1156
1126
|
});
|
|
1157
|
-
const
|
|
1158
|
-
const
|
|
1159
|
-
const
|
|
1127
|
+
const handleChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
1128
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1129
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1160
1130
|
return /* @__PURE__ */ jsx24(
|
|
1161
1131
|
Form8.TextArea,
|
|
1162
1132
|
{
|
|
@@ -1171,9 +1141,9 @@ function TextareaWidget(props) {
|
|
|
1171
1141
|
value: value || "",
|
|
1172
1142
|
error: rawErrors.length > 0,
|
|
1173
1143
|
rows: options.rows || 5,
|
|
1174
|
-
onChange:
|
|
1175
|
-
onBlur:
|
|
1176
|
-
onFocus:
|
|
1144
|
+
onChange: handleChange,
|
|
1145
|
+
onBlur: handleBlur,
|
|
1146
|
+
onFocus: handleFocus,
|
|
1177
1147
|
"aria-describedby": ariaDescribedByIds7(id)
|
|
1178
1148
|
},
|
|
1179
1149
|
id
|