@rjsf/primereact 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 +133 -118
- package/dist/index.cjs.map +3 -3
- package/dist/primereact.esm.js +147 -179
- package/dist/primereact.esm.js.map +3 -3
- package/dist/primereact.umd.js +130 -116
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.d.ts +1 -1
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js +1 -1
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js.map +1 -1
- package/lib/AutoCompleteWidget/AutoCompleteWidget.d.ts +1 -1
- package/lib/AutoCompleteWidget/AutoCompleteWidget.js +6 -6
- package/lib/AutoCompleteWidget/AutoCompleteWidget.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +5 -5
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/ColorWidget/ColorWidget.d.ts +1 -1
- package/lib/ColorWidget/ColorWidget.js +5 -5
- package/lib/ColorWidget/ColorWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/ErrorList/ErrorList.js +1 -1
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -3
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/GridTemplate/GridTemplate.js +1 -1
- package/lib/GridTemplate/GridTemplate.js.map +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/PasswordWidget/PasswordWidget.d.ts +1 -1
- package/lib/PasswordWidget/PasswordWidget.js +5 -5
- package/lib/PasswordWidget/PasswordWidget.js.map +1 -1
- package/lib/PrimeForm/PrimeForm.d.ts +3 -3
- package/lib/PrimeForm/PrimeForm.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +5 -5
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +18 -18
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/UpDownWidget/UpDownWidget.d.ts +1 -1
- package/lib/UpDownWidget/UpDownWidget.js +5 -6
- package/lib/UpDownWidget/UpDownWidget.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/AddButton/AddButton.tsx +2 -1
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
- package/src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx +2 -8
- package/src/AutoCompleteWidget/AutoCompleteWidget.tsx +14 -18
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -19
- package/src/CheckboxWidget/CheckboxWidget.tsx +10 -18
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +14 -13
- package/src/ColorWidget/ColorWidget.tsx +10 -16
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +4 -3
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +4 -4
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/GridTemplate/GridTemplate.tsx +2 -2
- 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/PasswordWidget/PasswordWidget.tsx +10 -16
- package/src/PrimeForm/PrimeForm.ts +4 -3
- package/src/RadioWidget/RadioWidget.tsx +11 -13
- package/src/RangeWidget/RangeWidget.tsx +18 -18
- package/src/SelectWidget/SelectWidget.tsx +25 -28
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +2 -2
- package/src/Theme/Theme.ts +2 -2
- package/src/TitleField/TitleField.tsx +2 -1
- package/src/UpDownWidget/UpDownWidget.tsx +13 -18
- package/src/Widgets/Widgets.tsx +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
package/dist/index.cjs
CHANGED
|
@@ -223,10 +223,10 @@ function BaseInputTemplate(props) {
|
|
|
223
223
|
const { AutoCompleteWidget: AutoCompleteWidget2 } = registry.widgets;
|
|
224
224
|
const inputProps = (0, import_utils5.getInputProps)(schema, type, options);
|
|
225
225
|
const primeProps = options.prime || {};
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
const
|
|
226
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
227
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
228
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
229
|
+
const handleClear = (0, import_react.useCallback)(
|
|
230
230
|
(e) => {
|
|
231
231
|
e.preventDefault();
|
|
232
232
|
e.stopPropagation();
|
|
@@ -252,13 +252,13 @@ function BaseInputTemplate(props) {
|
|
|
252
252
|
list: schema.examples ? (0, import_utils5.examplesId)(id) : void 0,
|
|
253
253
|
value: value || value === 0 ? value : "",
|
|
254
254
|
invalid: rawErrors.length > 0,
|
|
255
|
-
onChange: onChangeOverride ||
|
|
256
|
-
onBlur:
|
|
257
|
-
onFocus:
|
|
255
|
+
onChange: onChangeOverride || handleChange,
|
|
256
|
+
onBlur: handleBlur,
|
|
257
|
+
onFocus: handleFocus,
|
|
258
258
|
"aria-describedby": (0, import_utils5.ariaDescribedByIds)(id, !!schema.examples)
|
|
259
259
|
}
|
|
260
260
|
),
|
|
261
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick:
|
|
261
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick: handleClear })
|
|
262
262
|
] });
|
|
263
263
|
}
|
|
264
264
|
|
|
@@ -288,7 +288,7 @@ function ErrorList({
|
|
|
288
288
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_timescircle.TimesCircleIcon, { style: { width: "1.5rem", height: "1.5rem" } }),
|
|
289
289
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-message-summary", children: translateString(import_utils6.TranslatableString.ErrorsLabel) })
|
|
290
290
|
] }),
|
|
291
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "p-message-list", children: errors.map((error
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "p-message-list", children: errors.map((error) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: error.stack }, error.stack)) })
|
|
292
292
|
] });
|
|
293
293
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
294
294
|
import_message.Message,
|
|
@@ -315,9 +315,7 @@ var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
|
315
315
|
function FieldErrorTemplate({ errors, fieldPathId }) {
|
|
316
316
|
if (errors && errors.length > 0) {
|
|
317
317
|
const id = (0, import_utils7.errorId)(fieldPathId);
|
|
318
|
-
const content = errors.map((error, i) => {
|
|
319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: error }, i);
|
|
320
|
-
});
|
|
318
|
+
const content = errors.map((error, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: error }, i));
|
|
321
319
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
322
320
|
import_message2.Message,
|
|
323
321
|
{
|
|
@@ -442,7 +440,8 @@ function GridTemplateColumn(props) {
|
|
|
442
440
|
const [breakpoint, setBreakpoint] = (0, import_react2.useState)(() => getBreakpoint(getInitialWidth()));
|
|
443
441
|
(0, import_react2.useEffect)(() => {
|
|
444
442
|
if (typeof window === "undefined") {
|
|
445
|
-
return
|
|
443
|
+
return () => {
|
|
444
|
+
};
|
|
446
445
|
}
|
|
447
446
|
const handleResize = () => setBreakpoint(getBreakpoint(window.innerWidth));
|
|
448
447
|
window.addEventListener("resize", handleResize);
|
|
@@ -453,43 +452,51 @@ function GridTemplateColumn(props) {
|
|
|
453
452
|
}
|
|
454
453
|
|
|
455
454
|
// src/IconButton/IconButton.tsx
|
|
455
|
+
var import_react3 = require("react");
|
|
456
456
|
var import_utils10 = require("@rjsf/utils");
|
|
457
457
|
var import_button2 = require("primereact/button");
|
|
458
458
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
459
|
-
function
|
|
459
|
+
function IconButtonFn(props) {
|
|
460
460
|
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
461
461
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_button2.Button, { icon: `pi pi-${icon}`, rounded: true, text: true, severity: "secondary", ...otherProps });
|
|
462
462
|
}
|
|
463
|
-
|
|
463
|
+
var IconButton = (0, import_react3.memo)(IconButtonFn);
|
|
464
|
+
var IconButton_default = IconButton;
|
|
465
|
+
function CopyButtonFn(props) {
|
|
464
466
|
const {
|
|
465
467
|
registry: { translateString }
|
|
466
468
|
} = props;
|
|
467
469
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
468
470
|
}
|
|
469
|
-
|
|
471
|
+
var CopyButton = (0, import_react3.memo)(CopyButtonFn);
|
|
472
|
+
function MoveDownButtonFn(props) {
|
|
470
473
|
const {
|
|
471
474
|
registry: { translateString }
|
|
472
475
|
} = props;
|
|
473
476
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.MoveDownButton), ...props, icon: "angle-down" });
|
|
474
477
|
}
|
|
475
|
-
|
|
478
|
+
var MoveDownButton = (0, import_react3.memo)(MoveDownButtonFn);
|
|
479
|
+
function MoveUpButtonFn(props) {
|
|
476
480
|
const {
|
|
477
481
|
registry: { translateString }
|
|
478
482
|
} = props;
|
|
479
483
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.MoveUpButton), ...props, icon: "angle-up" });
|
|
480
484
|
}
|
|
481
|
-
|
|
485
|
+
var MoveUpButton = (0, import_react3.memo)(MoveUpButtonFn);
|
|
486
|
+
function RemoveButtonFn(props) {
|
|
482
487
|
const {
|
|
483
488
|
registry: { translateString }
|
|
484
489
|
} = props;
|
|
485
490
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.RemoveButton), ...props, icon: "trash" });
|
|
486
491
|
}
|
|
487
|
-
|
|
492
|
+
var RemoveButton = (0, import_react3.memo)(RemoveButtonFn);
|
|
493
|
+
function ClearButtonFn(props) {
|
|
488
494
|
const {
|
|
489
495
|
registry: { translateString }
|
|
490
496
|
} = props;
|
|
491
497
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils10.TranslatableString.ClearButton), ...props, icon: "times" });
|
|
492
498
|
}
|
|
499
|
+
var ClearButton = (0, import_react3.memo)(ClearButtonFn);
|
|
493
500
|
|
|
494
501
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
495
502
|
var import_fieldset2 = require("primereact/fieldset");
|
|
@@ -577,7 +584,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
577
584
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
578
585
|
if (onAddClick) {
|
|
579
586
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
580
|
-
|
|
587
|
+
IconButton_default,
|
|
581
588
|
{
|
|
582
589
|
id,
|
|
583
590
|
registry,
|
|
@@ -588,7 +595,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
588
595
|
style: { height: "1.5rem", width: "1.5rem" }
|
|
589
596
|
}
|
|
590
597
|
);
|
|
591
|
-
}
|
|
598
|
+
}
|
|
599
|
+
if (onRemoveClick) {
|
|
592
600
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
593
601
|
RemoveButton,
|
|
594
602
|
{
|
|
@@ -745,7 +753,7 @@ function generateTemplates() {
|
|
|
745
753
|
var Templates_default = generateTemplates();
|
|
746
754
|
|
|
747
755
|
// src/AutoCompleteWidget/AutoCompleteWidget.tsx
|
|
748
|
-
var
|
|
756
|
+
var import_react4 = require("react");
|
|
749
757
|
var import_utils15 = require("@rjsf/utils");
|
|
750
758
|
var import_autocomplete = require("primereact/autocomplete");
|
|
751
759
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -769,13 +777,13 @@ function AutoCompleteWidget(props) {
|
|
|
769
777
|
} = props;
|
|
770
778
|
const inputProps = (0, import_utils15.getInputProps)(schema, type, options);
|
|
771
779
|
const primeProps = options.prime || {};
|
|
772
|
-
const
|
|
773
|
-
const
|
|
774
|
-
const
|
|
780
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
781
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
782
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
775
783
|
const examples = schema.examples.concat(
|
|
776
784
|
schema.default && !schema.examples.includes(schema.default.toString()) ? [schema.default.toString()] : []
|
|
777
785
|
);
|
|
778
|
-
const [items, setItems] = (0,
|
|
786
|
+
const [items, setItems] = (0, import_react4.useState)([]);
|
|
779
787
|
const search = (event) => {
|
|
780
788
|
setItems(examples.filter((example) => example.toString().toLowerCase().includes(event.query.toLowerCase())));
|
|
781
789
|
};
|
|
@@ -787,7 +795,7 @@ function AutoCompleteWidget(props) {
|
|
|
787
795
|
placeholder,
|
|
788
796
|
...primeProps,
|
|
789
797
|
...inputProps,
|
|
790
|
-
loadingIcon:
|
|
798
|
+
loadingIcon: null,
|
|
791
799
|
required,
|
|
792
800
|
autoFocus: autofocus,
|
|
793
801
|
disabled: disabled || readonly,
|
|
@@ -796,9 +804,9 @@ function AutoCompleteWidget(props) {
|
|
|
796
804
|
value: value || value === 0 ? value : "",
|
|
797
805
|
dropdown: true,
|
|
798
806
|
invalid: rawErrors.length > 0,
|
|
799
|
-
onChange: onChangeOverride ||
|
|
800
|
-
onBlur:
|
|
801
|
-
onFocus:
|
|
807
|
+
onChange: onChangeOverride || handleChange,
|
|
808
|
+
onBlur: handleBlur,
|
|
809
|
+
onFocus: handleFocus,
|
|
802
810
|
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id, !!schema.examples),
|
|
803
811
|
pt: {
|
|
804
812
|
root: {
|
|
@@ -843,7 +851,7 @@ function CheckboxesWidget(props) {
|
|
|
843
851
|
const { enumOptions, enumDisabled } = options;
|
|
844
852
|
const primeProps = options.prime || {};
|
|
845
853
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
846
|
-
const
|
|
854
|
+
const handleChange = (index) => (e) => {
|
|
847
855
|
if (e.checked) {
|
|
848
856
|
onChange((0, import_utils16.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
849
857
|
} else {
|
|
@@ -855,8 +863,8 @@ function CheckboxesWidget(props) {
|
|
|
855
863
|
registry,
|
|
856
864
|
options
|
|
857
865
|
);
|
|
858
|
-
const
|
|
859
|
-
const
|
|
866
|
+
const handleBlur = () => onBlur(id, value);
|
|
867
|
+
const handleFocus = () => onFocus(id, value);
|
|
860
868
|
const description = options.description ?? schema.description;
|
|
861
869
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
862
870
|
"div",
|
|
@@ -876,26 +884,33 @@ function CheckboxesWidget(props) {
|
|
|
876
884
|
),
|
|
877
885
|
Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
878
886
|
const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
879
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
880
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
{
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
887
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
889
|
+
"div",
|
|
890
|
+
{
|
|
891
|
+
style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" },
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
894
|
+
import_checkbox.Checkbox,
|
|
895
|
+
{
|
|
896
|
+
inputId: (0, import_utils16.optionId)(id, index),
|
|
897
|
+
name: htmlName || id,
|
|
898
|
+
...primeProps,
|
|
899
|
+
value: option.value,
|
|
900
|
+
checked,
|
|
901
|
+
disabled: disabled || itemDisabled || readonly,
|
|
902
|
+
autoFocus: autofocus && index === 0,
|
|
903
|
+
onChange: handleChange(index),
|
|
904
|
+
onBlur: handleBlur,
|
|
905
|
+
onFocus: handleFocus,
|
|
906
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label, { id: (0, import_utils16.optionId)(id, index), text: option.label })
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
String(option.value)
|
|
913
|
+
);
|
|
899
914
|
})
|
|
900
915
|
]
|
|
901
916
|
}
|
|
@@ -931,9 +946,9 @@ function CheckboxWidget(props) {
|
|
|
931
946
|
);
|
|
932
947
|
const required = (0, import_utils17.schemaRequiresTrueValue)(schema);
|
|
933
948
|
const checked = value === "true" || value === true;
|
|
934
|
-
const
|
|
935
|
-
const
|
|
936
|
-
const
|
|
949
|
+
const handleChange = (e) => onChange && onChange(e.checked);
|
|
950
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
951
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
937
952
|
const description = options.description ?? schema.description;
|
|
938
953
|
const primeProps = options.prime || {};
|
|
939
954
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
@@ -957,9 +972,9 @@ function CheckboxWidget(props) {
|
|
|
957
972
|
disabled: disabled || readonly,
|
|
958
973
|
autoFocus: autofocus,
|
|
959
974
|
checked: typeof value === "undefined" ? false : checked,
|
|
960
|
-
onChange:
|
|
961
|
-
onBlur:
|
|
962
|
-
onFocus:
|
|
975
|
+
onChange: handleChange,
|
|
976
|
+
onBlur: handleBlur,
|
|
977
|
+
onFocus: handleFocus,
|
|
963
978
|
required,
|
|
964
979
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
965
980
|
}
|
|
@@ -993,9 +1008,9 @@ function ColorWidget(props) {
|
|
|
993
1008
|
const inputProps = (0, import_utils18.getInputProps)(schema, type, options);
|
|
994
1009
|
const { inline } = options;
|
|
995
1010
|
const primeProps = options.prime || {};
|
|
996
|
-
const
|
|
997
|
-
const
|
|
998
|
-
const
|
|
1011
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1012
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1013
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
999
1014
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1000
1015
|
import_colorpicker.ColorPicker,
|
|
1001
1016
|
{
|
|
@@ -1009,9 +1024,9 @@ function ColorWidget(props) {
|
|
|
1009
1024
|
autoFocus: autofocus,
|
|
1010
1025
|
disabled: disabled || readonly,
|
|
1011
1026
|
value: value || "",
|
|
1012
|
-
onChange: onChangeOverride ||
|
|
1013
|
-
onBlur:
|
|
1014
|
-
onFocus:
|
|
1027
|
+
onChange: onChangeOverride || handleChange,
|
|
1028
|
+
onBlur: handleBlur,
|
|
1029
|
+
onFocus: handleFocus,
|
|
1015
1030
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id, !!schema.examples)
|
|
1016
1031
|
}
|
|
1017
1032
|
);
|
|
@@ -1041,9 +1056,9 @@ function PasswordWidget(props) {
|
|
|
1041
1056
|
} = props;
|
|
1042
1057
|
const inputProps = (0, import_utils19.getInputProps)(schema, type, options);
|
|
1043
1058
|
const primeProps = options.prime || {};
|
|
1044
|
-
const
|
|
1045
|
-
const
|
|
1046
|
-
const
|
|
1059
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1060
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1061
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1047
1062
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1048
1063
|
import_password.Password,
|
|
1049
1064
|
{
|
|
@@ -1057,9 +1072,9 @@ function PasswordWidget(props) {
|
|
|
1057
1072
|
disabled: disabled || readonly,
|
|
1058
1073
|
value: value || "",
|
|
1059
1074
|
invalid: rawErrors.length > 0,
|
|
1060
|
-
onChange: onChangeOverride ||
|
|
1061
|
-
onBlur:
|
|
1062
|
-
onFocus:
|
|
1075
|
+
onChange: onChangeOverride || handleChange,
|
|
1076
|
+
onBlur: handleBlur,
|
|
1077
|
+
onFocus: handleFocus,
|
|
1063
1078
|
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id, !!schema.examples),
|
|
1064
1079
|
pt: { root: { style: { display: "flex", flexDirection: "column" } } }
|
|
1065
1080
|
}
|
|
@@ -1075,14 +1090,14 @@ function RadioWidget(props) {
|
|
|
1075
1090
|
const primeProps = options.prime || {};
|
|
1076
1091
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1077
1092
|
const optionValueFormat = (0, import_utils20.getOptionValueFormat)(options);
|
|
1078
|
-
const
|
|
1093
|
+
const handleChange = (e) => {
|
|
1079
1094
|
onChange((0, import_utils20.enumOptionValueDecoder)(e.value, enumOptions, optionValueFormat, emptyValue));
|
|
1080
1095
|
};
|
|
1081
|
-
const
|
|
1082
|
-
const
|
|
1096
|
+
const handleBlur = () => onBlur(id, value);
|
|
1097
|
+
const handleFocus = () => onFocus(id, value);
|
|
1083
1098
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexDirection: "row", gap: "1rem" }, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1084
1099
|
const checked = (0, import_utils20.enumOptionsIsSelected)(option.value, value);
|
|
1085
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1100
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1086
1101
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
1087
1102
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1088
1103
|
import_radiobutton.RadioButton,
|
|
@@ -1090,9 +1105,9 @@ function RadioWidget(props) {
|
|
|
1090
1105
|
inputId: (0, import_utils20.optionId)(id, index),
|
|
1091
1106
|
name: htmlName || id,
|
|
1092
1107
|
...primeProps,
|
|
1093
|
-
onFocus:
|
|
1094
|
-
onBlur:
|
|
1095
|
-
onChange:
|
|
1108
|
+
onFocus: handleFocus,
|
|
1109
|
+
onBlur: handleBlur,
|
|
1110
|
+
onChange: handleChange,
|
|
1096
1111
|
value: (0, import_utils20.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
1097
1112
|
checked,
|
|
1098
1113
|
disabled: disabled || itemDisabled || readonly,
|
|
@@ -1100,7 +1115,7 @@ function RadioWidget(props) {
|
|
|
1100
1115
|
}
|
|
1101
1116
|
),
|
|
1102
1117
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: (0, import_utils20.optionId)(id, index), style: { marginLeft: "8px" }, children: option.label })
|
|
1103
|
-
] },
|
|
1118
|
+
] }, String(option.value));
|
|
1104
1119
|
}) });
|
|
1105
1120
|
}
|
|
1106
1121
|
|
|
@@ -1112,24 +1127,24 @@ function RangeWidget(props) {
|
|
|
1112
1127
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, id } = props;
|
|
1113
1128
|
const primeProps = options.prime || {};
|
|
1114
1129
|
const sliderProps = { value, id, ...(0, import_utils21.rangeSpec)(schema) };
|
|
1115
|
-
const
|
|
1130
|
+
const handleChange = (e) => {
|
|
1116
1131
|
onChange(e.value ?? options.emptyValue);
|
|
1117
1132
|
};
|
|
1118
|
-
const
|
|
1119
|
-
const
|
|
1120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1133
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1134
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1121
1136
|
import_slider.Slider,
|
|
1122
1137
|
{
|
|
1123
1138
|
...primeProps,
|
|
1124
1139
|
disabled: disabled || readonly,
|
|
1125
1140
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1126
|
-
onChange:
|
|
1127
|
-
onBlur:
|
|
1128
|
-
onFocus:
|
|
1141
|
+
onChange: handleChange,
|
|
1142
|
+
onBlur: handleBlur,
|
|
1143
|
+
onFocus: handleFocus,
|
|
1129
1144
|
...sliderProps,
|
|
1130
1145
|
"aria-describedby": (0, import_utils21.ariaDescribedByIds)(id)
|
|
1131
1146
|
}
|
|
1132
|
-
)
|
|
1147
|
+
);
|
|
1133
1148
|
}
|
|
1134
1149
|
|
|
1135
1150
|
// src/SelectWidget/SelectWidget.tsx
|
|
@@ -1170,11 +1185,11 @@ function SingleSelectWidget({
|
|
|
1170
1185
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
1171
1186
|
const optionValueFormat = (0, import_utils22.getOptionValueFormat)(options);
|
|
1172
1187
|
const primeProps = options.prime || {};
|
|
1173
|
-
|
|
1174
|
-
const emptyValue =
|
|
1175
|
-
const
|
|
1176
|
-
const
|
|
1177
|
-
const
|
|
1188
|
+
const isMultiple = typeof multiple === "undefined" ? false : multiple;
|
|
1189
|
+
const emptyValue = isMultiple ? [] : "";
|
|
1190
|
+
const handleChange = (e) => onChange((0, import_utils22.enumOptionValueDecoder)(e.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1191
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils22.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1192
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils22.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1178
1193
|
const { ...dropdownRemainingProps } = dropdownProps;
|
|
1179
1194
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1180
1195
|
import_dropdown.Dropdown,
|
|
@@ -1182,15 +1197,15 @@ function SingleSelectWidget({
|
|
|
1182
1197
|
id,
|
|
1183
1198
|
name: htmlName || id,
|
|
1184
1199
|
...primeProps,
|
|
1185
|
-
value: (0, import_utils22.enumOptionSelectedValue)(value, enumOptions,
|
|
1186
|
-
options: (enumOptions ?? []).map(({ value:
|
|
1187
|
-
label:
|
|
1188
|
-
value: (0, import_utils22.enumOptionValueEncoder)(
|
|
1189
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1200
|
+
value: (0, import_utils22.enumOptionSelectedValue)(value, enumOptions, isMultiple, optionValueFormat, emptyValue),
|
|
1201
|
+
options: (enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i) => ({
|
|
1202
|
+
label: enumLabel,
|
|
1203
|
+
value: (0, import_utils22.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
1204
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1190
1205
|
})),
|
|
1191
|
-
onChange:
|
|
1192
|
-
onBlur:
|
|
1193
|
-
onFocus:
|
|
1206
|
+
onChange: handleChange,
|
|
1207
|
+
onBlur: handleBlur,
|
|
1208
|
+
onFocus: handleFocus,
|
|
1194
1209
|
placeholder,
|
|
1195
1210
|
disabled: disabled || readonly,
|
|
1196
1211
|
autoFocus: autofocus,
|
|
@@ -1217,9 +1232,9 @@ function MultiSelectWidget({
|
|
|
1217
1232
|
const optionValueFormat = (0, import_utils22.getOptionValueFormat)(options);
|
|
1218
1233
|
const primeProps = options.prime || {};
|
|
1219
1234
|
const emptyValue = multiple ? [] : "";
|
|
1220
|
-
const
|
|
1221
|
-
const
|
|
1222
|
-
const
|
|
1235
|
+
const handleChange = (e) => onChange((0, import_utils22.enumOptionValueDecoder)(e.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1236
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils22.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1237
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils22.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1223
1238
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1224
1239
|
import_multiselect.MultiSelect,
|
|
1225
1240
|
{
|
|
@@ -1227,14 +1242,14 @@ function MultiSelectWidget({
|
|
|
1227
1242
|
name: htmlName || id,
|
|
1228
1243
|
...primeProps,
|
|
1229
1244
|
value: (0, import_utils22.enumOptionSelectedValue)(value, enumOptions, multiple, optionValueFormat, emptyValue),
|
|
1230
|
-
options: (enumOptions ?? []).map(({ value:
|
|
1231
|
-
label,
|
|
1232
|
-
value: (0, import_utils22.enumOptionValueEncoder)(
|
|
1233
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1245
|
+
options: (enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i) => ({
|
|
1246
|
+
label: enumLabel,
|
|
1247
|
+
value: (0, import_utils22.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
1248
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1234
1249
|
})),
|
|
1235
|
-
onChange:
|
|
1236
|
-
onBlur:
|
|
1237
|
-
onFocus:
|
|
1250
|
+
onChange: handleChange,
|
|
1251
|
+
onBlur: handleBlur,
|
|
1252
|
+
onFocus: handleFocus,
|
|
1238
1253
|
placeholder,
|
|
1239
1254
|
disabled: disabled || readonly,
|
|
1240
1255
|
autoFocus: autofocus,
|
|
@@ -1301,9 +1316,9 @@ function UpDownWidget(props) {
|
|
|
1301
1316
|
const inputProps = (0, import_utils23.getInputProps)(schema, type, options);
|
|
1302
1317
|
const { showButtons, buttonLayout, useGrouping, minFractionDigits, maxFractionDigits, locale, currency } = options;
|
|
1303
1318
|
const primeProps = options.prime || {};
|
|
1304
|
-
const
|
|
1305
|
-
const
|
|
1306
|
-
const
|
|
1319
|
+
const handleChange = (event) => onChange(event.value === null ? options.emptyValue : value);
|
|
1320
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1321
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1307
1322
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1308
1323
|
import_inputnumber.InputNumber,
|
|
1309
1324
|
{
|
|
@@ -1311,7 +1326,7 @@ function UpDownWidget(props) {
|
|
|
1311
1326
|
name: id,
|
|
1312
1327
|
...primeProps,
|
|
1313
1328
|
placeholder,
|
|
1314
|
-
step: isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step),
|
|
1329
|
+
step: Number.isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step),
|
|
1315
1330
|
required,
|
|
1316
1331
|
autoFocus: autofocus,
|
|
1317
1332
|
disabled: disabled || readonly,
|
|
@@ -1324,11 +1339,11 @@ function UpDownWidget(props) {
|
|
|
1324
1339
|
locale,
|
|
1325
1340
|
mode: currency ? "currency" : "decimal",
|
|
1326
1341
|
currency,
|
|
1327
|
-
value: isNaN(Number(value)) ? null : Number(value),
|
|
1342
|
+
value: Number.isNaN(Number(value)) ? null : Number(value),
|
|
1328
1343
|
invalid: rawErrors.length > 0,
|
|
1329
|
-
onChange: onChangeOverride ||
|
|
1330
|
-
onBlur:
|
|
1331
|
-
onFocus:
|
|
1344
|
+
onChange: onChangeOverride || handleChange,
|
|
1345
|
+
onBlur: handleBlur,
|
|
1346
|
+
onFocus: handleFocus,
|
|
1332
1347
|
"aria-describedby": (0, import_utils23.ariaDescribedByIds)(id, !!schema.examples)
|
|
1333
1348
|
}
|
|
1334
1349
|
);
|