@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/primereact.esm.js
CHANGED
|
@@ -26,10 +26,7 @@ function AddButton({
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
29
|
-
import {
|
|
30
|
-
getTemplate,
|
|
31
|
-
getUiOptions
|
|
32
|
-
} from "@rjsf/utils";
|
|
29
|
+
import { getTemplate, getUiOptions } from "@rjsf/utils";
|
|
33
30
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
34
31
|
function ArrayFieldItemTemplate(props) {
|
|
35
32
|
const { children, buttonsProps, displayLabel, hasToolbar, uiSchema, registry } = props;
|
|
@@ -46,12 +43,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
49
|
-
import {
|
|
50
|
-
getTemplate as getTemplate2,
|
|
51
|
-
getUiOptions as getUiOptions2,
|
|
52
|
-
isFixedItems,
|
|
53
|
-
buttonId
|
|
54
|
-
} from "@rjsf/utils";
|
|
46
|
+
import { getTemplate as getTemplate2, getUiOptions as getUiOptions2, isFixedItems, buttonId } from "@rjsf/utils";
|
|
55
47
|
import { Fieldset } from "primereact/fieldset";
|
|
56
48
|
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
57
49
|
function ArrayFieldTemplate(props) {
|
|
@@ -150,10 +142,7 @@ function ArrayFieldTemplate(props) {
|
|
|
150
142
|
}
|
|
151
143
|
|
|
152
144
|
// src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx
|
|
153
|
-
import {
|
|
154
|
-
getUiOptions as getUiOptions3,
|
|
155
|
-
titleId
|
|
156
|
-
} from "@rjsf/utils";
|
|
145
|
+
import { getUiOptions as getUiOptions3, titleId } from "@rjsf/utils";
|
|
157
146
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
158
147
|
function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId, optionalDataControl }) {
|
|
159
148
|
const uiOptions = getUiOptions3(uiSchema);
|
|
@@ -173,11 +162,7 @@ function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId, optio
|
|
|
173
162
|
|
|
174
163
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
175
164
|
import { useCallback } from "react";
|
|
176
|
-
import {
|
|
177
|
-
ariaDescribedByIds,
|
|
178
|
-
examplesId,
|
|
179
|
-
getInputProps
|
|
180
|
-
} from "@rjsf/utils";
|
|
165
|
+
import { ariaDescribedByIds, examplesId, getInputProps } from "@rjsf/utils";
|
|
181
166
|
import { InputText } from "primereact/inputtext";
|
|
182
167
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
183
168
|
function BaseInputTemplate(props) {
|
|
@@ -204,10 +189,10 @@ function BaseInputTemplate(props) {
|
|
|
204
189
|
const { AutoCompleteWidget: AutoCompleteWidget2 } = registry.widgets;
|
|
205
190
|
const inputProps = getInputProps(schema, type, options);
|
|
206
191
|
const primeProps = options.prime || {};
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
const
|
|
192
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
193
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
194
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
195
|
+
const handleClear = useCallback(
|
|
211
196
|
(e) => {
|
|
212
197
|
e.preventDefault();
|
|
213
198
|
e.stopPropagation();
|
|
@@ -233,13 +218,13 @@ function BaseInputTemplate(props) {
|
|
|
233
218
|
list: schema.examples ? examplesId(id) : void 0,
|
|
234
219
|
value: value || value === 0 ? value : "",
|
|
235
220
|
invalid: rawErrors.length > 0,
|
|
236
|
-
onChange: onChangeOverride ||
|
|
237
|
-
onBlur:
|
|
238
|
-
onFocus:
|
|
221
|
+
onChange: onChangeOverride || handleChange,
|
|
222
|
+
onBlur: handleBlur,
|
|
223
|
+
onFocus: handleFocus,
|
|
239
224
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
240
225
|
}
|
|
241
226
|
),
|
|
242
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx5(ClearButton2, { registry, onClick:
|
|
227
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx5(ClearButton2, { registry, onClick: handleClear })
|
|
243
228
|
] });
|
|
244
229
|
}
|
|
245
230
|
|
|
@@ -269,7 +254,7 @@ function ErrorList({
|
|
|
269
254
|
/* @__PURE__ */ jsx7(TimesCircleIcon, { style: { width: "1.5rem", height: "1.5rem" } }),
|
|
270
255
|
/* @__PURE__ */ jsx7("div", { className: "p-message-summary", children: translateString(TranslatableString2.ErrorsLabel) })
|
|
271
256
|
] }),
|
|
272
|
-
/* @__PURE__ */ jsx7("ul", { className: "p-message-list", children: errors.map((error
|
|
257
|
+
/* @__PURE__ */ jsx7("ul", { className: "p-message-list", children: errors.map((error) => /* @__PURE__ */ jsx7("li", { children: error.stack }, error.stack)) })
|
|
273
258
|
] });
|
|
274
259
|
return /* @__PURE__ */ jsx7(
|
|
275
260
|
Message,
|
|
@@ -296,9 +281,7 @@ import { jsx as jsx8 } from "react/jsx-runtime";
|
|
|
296
281
|
function FieldErrorTemplate({ errors, fieldPathId }) {
|
|
297
282
|
if (errors && errors.length > 0) {
|
|
298
283
|
const id = errorId(fieldPathId);
|
|
299
|
-
const content = errors.map((error, i) => {
|
|
300
|
-
return /* @__PURE__ */ jsx8("div", { children: error }, i);
|
|
301
|
-
});
|
|
284
|
+
const content = errors.map((error, i) => /* @__PURE__ */ jsx8("div", { children: error }, i));
|
|
302
285
|
return /* @__PURE__ */ jsx8(
|
|
303
286
|
Message2,
|
|
304
287
|
{
|
|
@@ -326,10 +309,7 @@ function FieldHelpTemplate(props) {
|
|
|
326
309
|
}
|
|
327
310
|
|
|
328
311
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
329
|
-
import {
|
|
330
|
-
getTemplate as getTemplate3,
|
|
331
|
-
getUiOptions as getUiOptions4
|
|
332
|
-
} from "@rjsf/utils";
|
|
312
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions4 } from "@rjsf/utils";
|
|
333
313
|
|
|
334
314
|
// src/util.tsx
|
|
335
315
|
import { jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -426,7 +406,8 @@ function GridTemplateColumn(props) {
|
|
|
426
406
|
const [breakpoint, setBreakpoint] = useState(() => getBreakpoint(getInitialWidth()));
|
|
427
407
|
useEffect(() => {
|
|
428
408
|
if (typeof window === "undefined") {
|
|
429
|
-
return
|
|
409
|
+
return () => {
|
|
410
|
+
};
|
|
430
411
|
}
|
|
431
412
|
const handleResize = () => setBreakpoint(getBreakpoint(window.innerWidth));
|
|
432
413
|
window.addEventListener("resize", handleResize);
|
|
@@ -437,43 +418,51 @@ function GridTemplateColumn(props) {
|
|
|
437
418
|
}
|
|
438
419
|
|
|
439
420
|
// src/IconButton/IconButton.tsx
|
|
421
|
+
import { memo } from "react";
|
|
440
422
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
441
423
|
import { Button as Button2 } from "primereact/button";
|
|
442
424
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
443
|
-
function
|
|
425
|
+
function IconButtonFn(props) {
|
|
444
426
|
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
445
427
|
return /* @__PURE__ */ jsx12(Button2, { icon: `pi pi-${icon}`, rounded: true, text: true, severity: "secondary", ...otherProps });
|
|
446
428
|
}
|
|
447
|
-
|
|
429
|
+
var IconButton = memo(IconButtonFn);
|
|
430
|
+
var IconButton_default = IconButton;
|
|
431
|
+
function CopyButtonFn(props) {
|
|
448
432
|
const {
|
|
449
433
|
registry: { translateString }
|
|
450
434
|
} = props;
|
|
451
435
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.CopyButton), ...props, icon: "copy" });
|
|
452
436
|
}
|
|
453
|
-
|
|
437
|
+
var CopyButton = memo(CopyButtonFn);
|
|
438
|
+
function MoveDownButtonFn(props) {
|
|
454
439
|
const {
|
|
455
440
|
registry: { translateString }
|
|
456
441
|
} = props;
|
|
457
442
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.MoveDownButton), ...props, icon: "angle-down" });
|
|
458
443
|
}
|
|
459
|
-
|
|
444
|
+
var MoveDownButton = memo(MoveDownButtonFn);
|
|
445
|
+
function MoveUpButtonFn(props) {
|
|
460
446
|
const {
|
|
461
447
|
registry: { translateString }
|
|
462
448
|
} = props;
|
|
463
449
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.MoveUpButton), ...props, icon: "angle-up" });
|
|
464
450
|
}
|
|
465
|
-
|
|
451
|
+
var MoveUpButton = memo(MoveUpButtonFn);
|
|
452
|
+
function RemoveButtonFn(props) {
|
|
466
453
|
const {
|
|
467
454
|
registry: { translateString }
|
|
468
455
|
} = props;
|
|
469
456
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.RemoveButton), ...props, icon: "trash" });
|
|
470
457
|
}
|
|
471
|
-
|
|
458
|
+
var RemoveButton = memo(RemoveButtonFn);
|
|
459
|
+
function ClearButtonFn(props) {
|
|
472
460
|
const {
|
|
473
461
|
registry: { translateString }
|
|
474
462
|
} = props;
|
|
475
463
|
return /* @__PURE__ */ jsx12(IconButton, { title: translateString(TranslatableString3.ClearButton), ...props, icon: "times" });
|
|
476
464
|
}
|
|
465
|
+
var ClearButton = memo(ClearButtonFn);
|
|
477
466
|
|
|
478
467
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
479
468
|
import { Fieldset as Fieldset2 } from "primereact/fieldset";
|
|
@@ -487,14 +476,7 @@ function MultiSchemaFieldTemplate(props) {
|
|
|
487
476
|
}
|
|
488
477
|
|
|
489
478
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
490
|
-
import {
|
|
491
|
-
canExpand,
|
|
492
|
-
descriptionId,
|
|
493
|
-
getTemplate as getTemplate4,
|
|
494
|
-
getUiOptions as getUiOptions5,
|
|
495
|
-
titleId as titleId2,
|
|
496
|
-
buttonId as buttonId2
|
|
497
|
-
} from "@rjsf/utils";
|
|
479
|
+
import { canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions5, titleId as titleId2, buttonId as buttonId2 } from "@rjsf/utils";
|
|
498
480
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
499
481
|
function ObjectFieldTemplate(props) {
|
|
500
482
|
const {
|
|
@@ -568,7 +550,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
568
550
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
569
551
|
if (onAddClick) {
|
|
570
552
|
return /* @__PURE__ */ jsx15(
|
|
571
|
-
|
|
553
|
+
IconButton_default,
|
|
572
554
|
{
|
|
573
555
|
id,
|
|
574
556
|
registry,
|
|
@@ -579,7 +561,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
579
561
|
style: { height: "1.5rem", width: "1.5rem" }
|
|
580
562
|
}
|
|
581
563
|
);
|
|
582
|
-
}
|
|
564
|
+
}
|
|
565
|
+
if (onRemoveClick) {
|
|
583
566
|
return /* @__PURE__ */ jsx15(
|
|
584
567
|
RemoveButton,
|
|
585
568
|
{
|
|
@@ -637,11 +620,7 @@ function TitleField({
|
|
|
637
620
|
}
|
|
638
621
|
|
|
639
622
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
640
|
-
import {
|
|
641
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
642
|
-
buttonId as buttonId3,
|
|
643
|
-
TranslatableString as TranslatableString4
|
|
644
|
-
} from "@rjsf/utils";
|
|
623
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4 } from "@rjsf/utils";
|
|
645
624
|
import { InputText as InputText2 } from "primereact/inputtext";
|
|
646
625
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
647
626
|
function WrapIfAdditionalTemplate({
|
|
@@ -741,12 +720,9 @@ var Templates_default = generateTemplates();
|
|
|
741
720
|
|
|
742
721
|
// src/AutoCompleteWidget/AutoCompleteWidget.tsx
|
|
743
722
|
import { useState as useState2 } from "react";
|
|
744
|
-
import {
|
|
745
|
-
ariaDescribedByIds as ariaDescribedByIds2,
|
|
746
|
-
getInputProps as getInputProps2
|
|
747
|
-
} from "@rjsf/utils";
|
|
723
|
+
import { ariaDescribedByIds as ariaDescribedByIds2, getInputProps as getInputProps2 } from "@rjsf/utils";
|
|
748
724
|
import { AutoComplete } from "primereact/autocomplete";
|
|
749
|
-
import {
|
|
725
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
750
726
|
function AutoCompleteWidget(props) {
|
|
751
727
|
const {
|
|
752
728
|
id,
|
|
@@ -767,9 +743,9 @@ function AutoCompleteWidget(props) {
|
|
|
767
743
|
} = props;
|
|
768
744
|
const inputProps = getInputProps2(schema, type, options);
|
|
769
745
|
const primeProps = options.prime || {};
|
|
770
|
-
const
|
|
771
|
-
const
|
|
772
|
-
const
|
|
746
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
747
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
748
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
773
749
|
const examples = schema.examples.concat(
|
|
774
750
|
schema.default && !schema.examples.includes(schema.default.toString()) ? [schema.default.toString()] : []
|
|
775
751
|
);
|
|
@@ -785,7 +761,7 @@ function AutoCompleteWidget(props) {
|
|
|
785
761
|
placeholder,
|
|
786
762
|
...primeProps,
|
|
787
763
|
...inputProps,
|
|
788
|
-
loadingIcon:
|
|
764
|
+
loadingIcon: null,
|
|
789
765
|
required,
|
|
790
766
|
autoFocus: autofocus,
|
|
791
767
|
disabled: disabled || readonly,
|
|
@@ -794,9 +770,9 @@ function AutoCompleteWidget(props) {
|
|
|
794
770
|
value: value || value === 0 ? value : "",
|
|
795
771
|
dropdown: true,
|
|
796
772
|
invalid: rawErrors.length > 0,
|
|
797
|
-
onChange: onChangeOverride ||
|
|
798
|
-
onBlur:
|
|
799
|
-
onFocus:
|
|
773
|
+
onChange: onChangeOverride || handleChange,
|
|
774
|
+
onBlur: handleBlur,
|
|
775
|
+
onFocus: handleFocus,
|
|
800
776
|
"aria-describedby": ariaDescribedByIds2(id, !!schema.examples),
|
|
801
777
|
pt: {
|
|
802
778
|
root: {
|
|
@@ -849,7 +825,7 @@ function CheckboxesWidget(props) {
|
|
|
849
825
|
const { enumOptions, enumDisabled } = options;
|
|
850
826
|
const primeProps = options.prime || {};
|
|
851
827
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
852
|
-
const
|
|
828
|
+
const handleChange = (index) => (e) => {
|
|
853
829
|
if (e.checked) {
|
|
854
830
|
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
855
831
|
} else {
|
|
@@ -861,8 +837,8 @@ function CheckboxesWidget(props) {
|
|
|
861
837
|
registry,
|
|
862
838
|
options
|
|
863
839
|
);
|
|
864
|
-
const
|
|
865
|
-
const
|
|
840
|
+
const handleBlur = () => onBlur(id, value);
|
|
841
|
+
const handleFocus = () => onFocus(id, value);
|
|
866
842
|
const description = options.description ?? schema.description;
|
|
867
843
|
return /* @__PURE__ */ jsxs12(
|
|
868
844
|
"div",
|
|
@@ -882,26 +858,33 @@ function CheckboxesWidget(props) {
|
|
|
882
858
|
),
|
|
883
859
|
Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
884
860
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
885
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
886
|
-
return /* @__PURE__ */ jsxs12(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
{
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
861
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
862
|
+
return /* @__PURE__ */ jsxs12(
|
|
863
|
+
"div",
|
|
864
|
+
{
|
|
865
|
+
style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" },
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ jsx20(
|
|
868
|
+
Checkbox,
|
|
869
|
+
{
|
|
870
|
+
inputId: optionId(id, index),
|
|
871
|
+
name: htmlName || id,
|
|
872
|
+
...primeProps,
|
|
873
|
+
value: option.value,
|
|
874
|
+
checked,
|
|
875
|
+
disabled: disabled || itemDisabled || readonly,
|
|
876
|
+
autoFocus: autofocus && index === 0,
|
|
877
|
+
onChange: handleChange(index),
|
|
878
|
+
onBlur: handleBlur,
|
|
879
|
+
onFocus: handleFocus,
|
|
880
|
+
"aria-describedby": ariaDescribedByIds3(id)
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ jsx20(Label, { id: optionId(id, index), text: option.label })
|
|
884
|
+
]
|
|
885
|
+
},
|
|
886
|
+
String(option.value)
|
|
887
|
+
);
|
|
905
888
|
})
|
|
906
889
|
]
|
|
907
890
|
}
|
|
@@ -909,15 +892,9 @@ function CheckboxesWidget(props) {
|
|
|
909
892
|
}
|
|
910
893
|
|
|
911
894
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
912
|
-
import {
|
|
913
|
-
ariaDescribedByIds as ariaDescribedByIds4,
|
|
914
|
-
descriptionId as descriptionId3,
|
|
915
|
-
getTemplate as getTemplate6,
|
|
916
|
-
labelValue,
|
|
917
|
-
schemaRequiresTrueValue
|
|
918
|
-
} from "@rjsf/utils";
|
|
895
|
+
import { ariaDescribedByIds as ariaDescribedByIds4, descriptionId as descriptionId3, getTemplate as getTemplate6, labelValue, schemaRequiresTrueValue } from "@rjsf/utils";
|
|
919
896
|
import { Checkbox as Checkbox2 } from "primereact/checkbox";
|
|
920
|
-
import { Fragment as
|
|
897
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
921
898
|
function CheckboxWidget(props) {
|
|
922
899
|
const {
|
|
923
900
|
id,
|
|
@@ -943,12 +920,12 @@ function CheckboxWidget(props) {
|
|
|
943
920
|
);
|
|
944
921
|
const required = schemaRequiresTrueValue(schema);
|
|
945
922
|
const checked = value === "true" || value === true;
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
const
|
|
923
|
+
const handleChange = (e) => onChange && onChange(e.checked);
|
|
924
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
925
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
949
926
|
const description = options.description ?? schema.description;
|
|
950
927
|
const primeProps = options.prime || {};
|
|
951
|
-
return /* @__PURE__ */ jsxs13(
|
|
928
|
+
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
952
929
|
!hideLabel && !!description && /* @__PURE__ */ jsx21(
|
|
953
930
|
DescriptionFieldTemplate,
|
|
954
931
|
{
|
|
@@ -969,9 +946,9 @@ function CheckboxWidget(props) {
|
|
|
969
946
|
disabled: disabled || readonly,
|
|
970
947
|
autoFocus: autofocus,
|
|
971
948
|
checked: typeof value === "undefined" ? false : checked,
|
|
972
|
-
onChange:
|
|
973
|
-
onBlur:
|
|
974
|
-
onFocus:
|
|
949
|
+
onChange: handleChange,
|
|
950
|
+
onBlur: handleBlur,
|
|
951
|
+
onFocus: handleFocus,
|
|
975
952
|
required,
|
|
976
953
|
"aria-describedby": ariaDescribedByIds4(id)
|
|
977
954
|
}
|
|
@@ -982,10 +959,7 @@ function CheckboxWidget(props) {
|
|
|
982
959
|
}
|
|
983
960
|
|
|
984
961
|
// src/ColorWidget/ColorWidget.tsx
|
|
985
|
-
import {
|
|
986
|
-
ariaDescribedByIds as ariaDescribedByIds5,
|
|
987
|
-
getInputProps as getInputProps3
|
|
988
|
-
} from "@rjsf/utils";
|
|
962
|
+
import { ariaDescribedByIds as ariaDescribedByIds5, getInputProps as getInputProps3 } from "@rjsf/utils";
|
|
989
963
|
import { ColorPicker } from "primereact/colorpicker";
|
|
990
964
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
991
965
|
function ColorWidget(props) {
|
|
@@ -1008,9 +982,9 @@ function ColorWidget(props) {
|
|
|
1008
982
|
const inputProps = getInputProps3(schema, type, options);
|
|
1009
983
|
const { inline } = options;
|
|
1010
984
|
const primeProps = options.prime || {};
|
|
1011
|
-
const
|
|
1012
|
-
const
|
|
1013
|
-
const
|
|
985
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
986
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
987
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1014
988
|
return /* @__PURE__ */ jsx22(
|
|
1015
989
|
ColorPicker,
|
|
1016
990
|
{
|
|
@@ -1024,19 +998,16 @@ function ColorWidget(props) {
|
|
|
1024
998
|
autoFocus: autofocus,
|
|
1025
999
|
disabled: disabled || readonly,
|
|
1026
1000
|
value: value || "",
|
|
1027
|
-
onChange: onChangeOverride ||
|
|
1028
|
-
onBlur:
|
|
1029
|
-
onFocus:
|
|
1001
|
+
onChange: onChangeOverride || handleChange,
|
|
1002
|
+
onBlur: handleBlur,
|
|
1003
|
+
onFocus: handleFocus,
|
|
1030
1004
|
"aria-describedby": ariaDescribedByIds5(id, !!schema.examples)
|
|
1031
1005
|
}
|
|
1032
1006
|
);
|
|
1033
1007
|
}
|
|
1034
1008
|
|
|
1035
1009
|
// src/PasswordWidget/PasswordWidget.tsx
|
|
1036
|
-
import {
|
|
1037
|
-
ariaDescribedByIds as ariaDescribedByIds6,
|
|
1038
|
-
getInputProps as getInputProps4
|
|
1039
|
-
} from "@rjsf/utils";
|
|
1010
|
+
import { ariaDescribedByIds as ariaDescribedByIds6, getInputProps as getInputProps4 } from "@rjsf/utils";
|
|
1040
1011
|
import { Password } from "primereact/password";
|
|
1041
1012
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1042
1013
|
function PasswordWidget(props) {
|
|
@@ -1059,9 +1030,9 @@ function PasswordWidget(props) {
|
|
|
1059
1030
|
} = props;
|
|
1060
1031
|
const inputProps = getInputProps4(schema, type, options);
|
|
1061
1032
|
const primeProps = options.prime || {};
|
|
1062
|
-
const
|
|
1063
|
-
const
|
|
1064
|
-
const
|
|
1033
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1034
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1035
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1065
1036
|
return /* @__PURE__ */ jsx23(
|
|
1066
1037
|
Password,
|
|
1067
1038
|
{
|
|
@@ -1075,9 +1046,9 @@ function PasswordWidget(props) {
|
|
|
1075
1046
|
disabled: disabled || readonly,
|
|
1076
1047
|
value: value || "",
|
|
1077
1048
|
invalid: rawErrors.length > 0,
|
|
1078
|
-
onChange: onChangeOverride ||
|
|
1079
|
-
onBlur:
|
|
1080
|
-
onFocus:
|
|
1049
|
+
onChange: onChangeOverride || handleChange,
|
|
1050
|
+
onBlur: handleBlur,
|
|
1051
|
+
onFocus: handleFocus,
|
|
1081
1052
|
"aria-describedby": ariaDescribedByIds6(id, !!schema.examples),
|
|
1082
1053
|
pt: { root: { style: { display: "flex", flexDirection: "column" } } }
|
|
1083
1054
|
}
|
|
@@ -1100,14 +1071,14 @@ function RadioWidget(props) {
|
|
|
1100
1071
|
const primeProps = options.prime || {};
|
|
1101
1072
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1102
1073
|
const optionValueFormat = getOptionValueFormat(options);
|
|
1103
|
-
const
|
|
1074
|
+
const handleChange = (e) => {
|
|
1104
1075
|
onChange(enumOptionValueDecoder(e.value, enumOptions, optionValueFormat, emptyValue));
|
|
1105
1076
|
};
|
|
1106
|
-
const
|
|
1107
|
-
const
|
|
1077
|
+
const handleBlur = () => onBlur(id, value);
|
|
1078
|
+
const handleFocus = () => onFocus(id, value);
|
|
1108
1079
|
return /* @__PURE__ */ jsx24("div", { style: { display: "flex", flexDirection: "row", gap: "1rem" }, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1109
1080
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
1110
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1081
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1111
1082
|
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
1112
1083
|
/* @__PURE__ */ jsx24(
|
|
1113
1084
|
RadioButton,
|
|
@@ -1115,9 +1086,9 @@ function RadioWidget(props) {
|
|
|
1115
1086
|
inputId: optionId2(id, index),
|
|
1116
1087
|
name: htmlName || id,
|
|
1117
1088
|
...primeProps,
|
|
1118
|
-
onFocus:
|
|
1119
|
-
onBlur:
|
|
1120
|
-
onChange:
|
|
1089
|
+
onFocus: handleFocus,
|
|
1090
|
+
onBlur: handleBlur,
|
|
1091
|
+
onChange: handleChange,
|
|
1121
1092
|
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
1122
1093
|
checked,
|
|
1123
1094
|
disabled: disabled || itemDisabled || readonly,
|
|
@@ -1125,36 +1096,36 @@ function RadioWidget(props) {
|
|
|
1125
1096
|
}
|
|
1126
1097
|
),
|
|
1127
1098
|
/* @__PURE__ */ jsx24("label", { htmlFor: optionId2(id, index), style: { marginLeft: "8px" }, children: option.label })
|
|
1128
|
-
] },
|
|
1099
|
+
] }, String(option.value));
|
|
1129
1100
|
}) });
|
|
1130
1101
|
}
|
|
1131
1102
|
|
|
1132
1103
|
// src/RangeWidget/RangeWidget.tsx
|
|
1133
1104
|
import { ariaDescribedByIds as ariaDescribedByIds8, rangeSpec } from "@rjsf/utils";
|
|
1134
1105
|
import { Slider } from "primereact/slider";
|
|
1135
|
-
import {
|
|
1106
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1136
1107
|
function RangeWidget(props) {
|
|
1137
1108
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, id } = props;
|
|
1138
1109
|
const primeProps = options.prime || {};
|
|
1139
1110
|
const sliderProps = { value, id, ...rangeSpec(schema) };
|
|
1140
|
-
const
|
|
1111
|
+
const handleChange = (e) => {
|
|
1141
1112
|
onChange(e.value ?? options.emptyValue);
|
|
1142
1113
|
};
|
|
1143
|
-
const
|
|
1144
|
-
const
|
|
1145
|
-
return /* @__PURE__ */ jsx25(
|
|
1114
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1115
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1116
|
+
return /* @__PURE__ */ jsx25(
|
|
1146
1117
|
Slider,
|
|
1147
1118
|
{
|
|
1148
1119
|
...primeProps,
|
|
1149
1120
|
disabled: disabled || readonly,
|
|
1150
1121
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1151
|
-
onChange:
|
|
1152
|
-
onBlur:
|
|
1153
|
-
onFocus:
|
|
1122
|
+
onChange: handleChange,
|
|
1123
|
+
onBlur: handleBlur,
|
|
1124
|
+
onFocus: handleFocus,
|
|
1154
1125
|
...sliderProps,
|
|
1155
1126
|
"aria-describedby": ariaDescribedByIds8(id)
|
|
1156
1127
|
}
|
|
1157
|
-
)
|
|
1128
|
+
);
|
|
1158
1129
|
}
|
|
1159
1130
|
|
|
1160
1131
|
// src/SelectWidget/SelectWidget.tsx
|
|
@@ -1201,11 +1172,11 @@ function SingleSelectWidget({
|
|
|
1201
1172
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
1202
1173
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
1203
1174
|
const primeProps = options.prime || {};
|
|
1204
|
-
|
|
1205
|
-
const emptyValue =
|
|
1206
|
-
const
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1175
|
+
const isMultiple = typeof multiple === "undefined" ? false : multiple;
|
|
1176
|
+
const emptyValue = isMultiple ? [] : "";
|
|
1177
|
+
const handleChange = (e) => onChange(enumOptionValueDecoder2(e.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1178
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1179
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1209
1180
|
const { ...dropdownRemainingProps } = dropdownProps;
|
|
1210
1181
|
return /* @__PURE__ */ jsx26(
|
|
1211
1182
|
Dropdown,
|
|
@@ -1213,15 +1184,15 @@ function SingleSelectWidget({
|
|
|
1213
1184
|
id,
|
|
1214
1185
|
name: htmlName || id,
|
|
1215
1186
|
...primeProps,
|
|
1216
|
-
value: enumOptionSelectedValue(value, enumOptions,
|
|
1217
|
-
options: (enumOptions ?? []).map(({ value:
|
|
1218
|
-
label:
|
|
1219
|
-
value: enumOptionValueEncoder2(
|
|
1220
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1187
|
+
value: enumOptionSelectedValue(value, enumOptions, isMultiple, optionValueFormat, emptyValue),
|
|
1188
|
+
options: (enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i) => ({
|
|
1189
|
+
label: enumLabel,
|
|
1190
|
+
value: enumOptionValueEncoder2(enumValue, i, optionValueFormat),
|
|
1191
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1221
1192
|
})),
|
|
1222
|
-
onChange:
|
|
1223
|
-
onBlur:
|
|
1224
|
-
onFocus:
|
|
1193
|
+
onChange: handleChange,
|
|
1194
|
+
onBlur: handleBlur,
|
|
1195
|
+
onFocus: handleFocus,
|
|
1225
1196
|
placeholder,
|
|
1226
1197
|
disabled: disabled || readonly,
|
|
1227
1198
|
autoFocus: autofocus,
|
|
@@ -1248,9 +1219,9 @@ function MultiSelectWidget({
|
|
|
1248
1219
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
1249
1220
|
const primeProps = options.prime || {};
|
|
1250
1221
|
const emptyValue = multiple ? [] : "";
|
|
1251
|
-
const
|
|
1252
|
-
const
|
|
1253
|
-
const
|
|
1222
|
+
const handleChange = (e) => onChange(enumOptionValueDecoder2(e.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1223
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1224
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1254
1225
|
return /* @__PURE__ */ jsx26(
|
|
1255
1226
|
MultiSelect,
|
|
1256
1227
|
{
|
|
@@ -1258,14 +1229,14 @@ function MultiSelectWidget({
|
|
|
1258
1229
|
name: htmlName || id,
|
|
1259
1230
|
...primeProps,
|
|
1260
1231
|
value: enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue),
|
|
1261
|
-
options: (enumOptions ?? []).map(({ value:
|
|
1262
|
-
label,
|
|
1263
|
-
value: enumOptionValueEncoder2(
|
|
1264
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1232
|
+
options: (enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i) => ({
|
|
1233
|
+
label: enumLabel,
|
|
1234
|
+
value: enumOptionValueEncoder2(enumValue, i, optionValueFormat),
|
|
1235
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1265
1236
|
})),
|
|
1266
|
-
onChange:
|
|
1267
|
-
onBlur:
|
|
1268
|
-
onFocus:
|
|
1237
|
+
onChange: handleChange,
|
|
1238
|
+
onBlur: handleBlur,
|
|
1239
|
+
onFocus: handleFocus,
|
|
1269
1240
|
placeholder,
|
|
1270
1241
|
disabled: disabled || readonly,
|
|
1271
1242
|
autoFocus: autofocus,
|
|
@@ -1308,10 +1279,7 @@ function TextareaWidget(props) {
|
|
|
1308
1279
|
}
|
|
1309
1280
|
|
|
1310
1281
|
// src/UpDownWidget/UpDownWidget.tsx
|
|
1311
|
-
import {
|
|
1312
|
-
ariaDescribedByIds as ariaDescribedByIds10,
|
|
1313
|
-
getInputProps as getInputProps5
|
|
1314
|
-
} from "@rjsf/utils";
|
|
1282
|
+
import { ariaDescribedByIds as ariaDescribedByIds10, getInputProps as getInputProps5 } from "@rjsf/utils";
|
|
1315
1283
|
import { InputNumber } from "primereact/inputnumber";
|
|
1316
1284
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1317
1285
|
function UpDownWidget(props) {
|
|
@@ -1335,9 +1303,9 @@ function UpDownWidget(props) {
|
|
|
1335
1303
|
const inputProps = getInputProps5(schema, type, options);
|
|
1336
1304
|
const { showButtons, buttonLayout, useGrouping, minFractionDigits, maxFractionDigits, locale, currency } = options;
|
|
1337
1305
|
const primeProps = options.prime || {};
|
|
1338
|
-
const
|
|
1339
|
-
const
|
|
1340
|
-
const
|
|
1306
|
+
const handleChange = (event) => onChange(event.value === null ? options.emptyValue : value);
|
|
1307
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
1308
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
1341
1309
|
return /* @__PURE__ */ jsx28(
|
|
1342
1310
|
InputNumber,
|
|
1343
1311
|
{
|
|
@@ -1345,7 +1313,7 @@ function UpDownWidget(props) {
|
|
|
1345
1313
|
name: id,
|
|
1346
1314
|
...primeProps,
|
|
1347
1315
|
placeholder,
|
|
1348
|
-
step: isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step),
|
|
1316
|
+
step: Number.isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step),
|
|
1349
1317
|
required,
|
|
1350
1318
|
autoFocus: autofocus,
|
|
1351
1319
|
disabled: disabled || readonly,
|
|
@@ -1358,11 +1326,11 @@ function UpDownWidget(props) {
|
|
|
1358
1326
|
locale,
|
|
1359
1327
|
mode: currency ? "currency" : "decimal",
|
|
1360
1328
|
currency,
|
|
1361
|
-
value: isNaN(Number(value)) ? null : Number(value),
|
|
1329
|
+
value: Number.isNaN(Number(value)) ? null : Number(value),
|
|
1362
1330
|
invalid: rawErrors.length > 0,
|
|
1363
|
-
onChange: onChangeOverride ||
|
|
1364
|
-
onBlur:
|
|
1365
|
-
onFocus:
|
|
1331
|
+
onChange: onChangeOverride || handleChange,
|
|
1332
|
+
onBlur: handleBlur,
|
|
1333
|
+
onFocus: handleFocus,
|
|
1366
1334
|
"aria-describedby": ariaDescribedByIds10(id, !!schema.examples)
|
|
1367
1335
|
}
|
|
1368
1336
|
);
|