@rjsf/primereact 6.0.0-beta.20 → 6.0.0-beta.22
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 +141 -91
- package/dist/index.cjs.map +4 -4
- package/dist/primereact.esm.js +133 -84
- package/dist/primereact.esm.js.map +4 -4
- package/dist/primereact.umd.js +87 -40
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- 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 +5 -14
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.d.ts +1 -1
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js +7 -3
- package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/IconButton/IconButton.d.ts +7 -6
- package/lib/IconButton/IconButton.js +1 -2
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +3 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +10 -0
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +21 -0
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -0
- package/lib/OptionalDataControlsTemplate/index.d.ts +2 -0
- package/lib/OptionalDataControlsTemplate/index.js +3 -0
- package/lib/OptionalDataControlsTemplate/index.js.map +1 -0
- package/lib/RadioWidget/RadioWidget.js +2 -2
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js +5 -5
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +2 -2
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/TitleField/TitleField.js +6 -2
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -3
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +6 -18
- package/src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx +11 -2
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +2 -1
- package/src/CheckboxWidget/CheckboxWidget.tsx +2 -1
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +2 -1
- package/src/IconButton/IconButton.tsx +13 -9
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +6 -2
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +44 -0
- package/src/OptionalDataControlsTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +2 -2
- package/src/SelectWidget/SelectWidget.tsx +4 -3
- package/src/Templates/Templates.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +2 -1
- package/src/TitleField/TitleField.tsx +15 -3
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +4 -7
package/dist/index.cjs
CHANGED
|
@@ -88,6 +88,7 @@ function ArrayFieldTemplate(props) {
|
|
|
88
88
|
className,
|
|
89
89
|
disabled,
|
|
90
90
|
items,
|
|
91
|
+
optionalDataControl,
|
|
91
92
|
onAddClick,
|
|
92
93
|
readonly,
|
|
93
94
|
schema,
|
|
@@ -102,16 +103,12 @@ function ArrayFieldTemplate(props) {
|
|
|
102
103
|
registry,
|
|
103
104
|
uiOptions
|
|
104
105
|
);
|
|
105
|
-
const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
|
|
106
|
-
"ArrayFieldItemTemplate",
|
|
107
|
-
registry,
|
|
108
|
-
uiOptions
|
|
109
|
-
);
|
|
110
106
|
const ArrayFieldTitleTemplate2 = (0, import_utils3.getTemplate)(
|
|
111
107
|
"ArrayFieldTitleTemplate",
|
|
112
108
|
registry,
|
|
113
109
|
uiOptions
|
|
114
110
|
);
|
|
111
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
115
112
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
116
113
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
117
114
|
ArrayFieldTitleTemplate2,
|
|
@@ -121,7 +118,8 @@ function ArrayFieldTemplate(props) {
|
|
|
121
118
|
schema,
|
|
122
119
|
uiSchema,
|
|
123
120
|
required,
|
|
124
|
-
registry
|
|
121
|
+
registry,
|
|
122
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
125
123
|
}
|
|
126
124
|
),
|
|
127
125
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -142,15 +140,10 @@ function ArrayFieldTemplate(props) {
|
|
|
142
140
|
}
|
|
143
141
|
),
|
|
144
142
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
145
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
...itemUiSchema[import_utils3.UI_OPTIONS_KEY]
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrayFieldItemTemplate2, { ...props2, uiSchema: mergedUiSchema }, key);
|
|
153
|
-
}) }),
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
144
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
145
|
+
items
|
|
146
|
+
] }),
|
|
154
147
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
155
148
|
"div",
|
|
156
149
|
{
|
|
@@ -186,6 +179,7 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
186
179
|
function BaseInputTemplate(props) {
|
|
187
180
|
const {
|
|
188
181
|
id,
|
|
182
|
+
htmlName,
|
|
189
183
|
placeholder,
|
|
190
184
|
value,
|
|
191
185
|
required,
|
|
@@ -215,7 +209,7 @@ function BaseInputTemplate(props) {
|
|
|
215
209
|
import_inputtext.InputText,
|
|
216
210
|
{
|
|
217
211
|
id,
|
|
218
|
-
name: id,
|
|
212
|
+
name: htmlName || id,
|
|
219
213
|
placeholder,
|
|
220
214
|
...primeProps,
|
|
221
215
|
...inputProps,
|
|
@@ -403,7 +397,8 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
|
403
397
|
function ObjectFieldTemplate(props) {
|
|
404
398
|
const {
|
|
405
399
|
description,
|
|
406
|
-
|
|
400
|
+
optionalDataControl,
|
|
401
|
+
onAddProperty,
|
|
407
402
|
title,
|
|
408
403
|
properties,
|
|
409
404
|
disabled,
|
|
@@ -422,6 +417,7 @@ function ObjectFieldTemplate(props) {
|
|
|
422
417
|
registry,
|
|
423
418
|
uiOptions
|
|
424
419
|
);
|
|
420
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
425
421
|
const {
|
|
426
422
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
427
423
|
} = registry.templates;
|
|
@@ -434,7 +430,8 @@ function ObjectFieldTemplate(props) {
|
|
|
434
430
|
required,
|
|
435
431
|
schema,
|
|
436
432
|
uiSchema,
|
|
437
|
-
registry
|
|
433
|
+
registry,
|
|
434
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
438
435
|
}
|
|
439
436
|
),
|
|
440
437
|
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -447,6 +444,7 @@ function ObjectFieldTemplate(props) {
|
|
|
447
444
|
registry
|
|
448
445
|
}
|
|
449
446
|
) }),
|
|
447
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
450
448
|
properties.map((prop) => prop.content),
|
|
451
449
|
(0, import_utils10.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginTop: "1rem", textAlign: "right" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
452
450
|
AddButton2,
|
|
@@ -454,7 +452,7 @@ function ObjectFieldTemplate(props) {
|
|
|
454
452
|
id: (0, import_utils10.buttonId)(fieldPathId, "add"),
|
|
455
453
|
className: "rjsf-object-property-expand",
|
|
456
454
|
icon: "pi pi-plus",
|
|
457
|
-
onClick:
|
|
455
|
+
onClick: onAddProperty,
|
|
458
456
|
disabled: disabled || readonly,
|
|
459
457
|
registry
|
|
460
458
|
}
|
|
@@ -462,43 +460,84 @@ function ObjectFieldTemplate(props) {
|
|
|
462
460
|
] });
|
|
463
461
|
}
|
|
464
462
|
|
|
463
|
+
// src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
|
|
464
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
465
|
+
function OptionalDataControlsTemplate(props) {
|
|
466
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
467
|
+
if (onAddClick) {
|
|
468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
469
|
+
IconButton,
|
|
470
|
+
{
|
|
471
|
+
id,
|
|
472
|
+
registry,
|
|
473
|
+
className: "rjsf-add-optional-data",
|
|
474
|
+
onClick: onAddClick,
|
|
475
|
+
title: label,
|
|
476
|
+
icon: "pi pi-plus",
|
|
477
|
+
style: { height: "1.5rem", width: "1.5rem" }
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
} else if (onRemoveClick) {
|
|
481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
482
|
+
RemoveButton,
|
|
483
|
+
{
|
|
484
|
+
id,
|
|
485
|
+
registry,
|
|
486
|
+
className: "rjsf-remove-optional-data",
|
|
487
|
+
onClick: onRemoveClick,
|
|
488
|
+
title: label,
|
|
489
|
+
style: { height: "1.5rem", width: "1.5rem" }
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("em", { id, children: label });
|
|
494
|
+
}
|
|
495
|
+
|
|
465
496
|
// src/SubmitButton/SubmitButton.tsx
|
|
466
497
|
var import_button3 = require("primereact/button");
|
|
467
498
|
var import_utils11 = require("@rjsf/utils");
|
|
468
|
-
var
|
|
499
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
469
500
|
function SubmitButton({ uiSchema }) {
|
|
470
501
|
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils11.getSubmitButtonOptions)(uiSchema);
|
|
471
502
|
if (norender) {
|
|
472
503
|
return null;
|
|
473
504
|
}
|
|
474
|
-
return /* @__PURE__ */ (0,
|
|
505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_button3.Button, { type: "submit", label: submitText, ...submitButtonProps });
|
|
475
506
|
}
|
|
476
507
|
|
|
477
508
|
// src/TitleField/TitleField.tsx
|
|
478
509
|
var import_divider = require("primereact/divider");
|
|
479
510
|
var import_utils12 = require("@rjsf/utils");
|
|
480
|
-
var
|
|
511
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
481
512
|
function TitleField({
|
|
482
513
|
id,
|
|
483
514
|
title,
|
|
484
515
|
uiSchema,
|
|
485
|
-
required
|
|
516
|
+
required,
|
|
517
|
+
optionalDataControl
|
|
486
518
|
}) {
|
|
487
519
|
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema);
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
/* @__PURE__ */ (0,
|
|
520
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h5", { style: { margin: 0, fontSize: id === (0, import_utils12.titleId)("root") ? "1.5rem" : "1.2rem" }, children: [
|
|
521
|
+
uiOptions.title || title,
|
|
522
|
+
" ",
|
|
523
|
+
required ? "*" : ""
|
|
524
|
+
] });
|
|
525
|
+
if (optionalDataControl) {
|
|
526
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex" }, children: [
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { flexGrow: 1 }, children: heading }),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { marginLeft: "-5px" }, children: optionalDataControl })
|
|
529
|
+
] });
|
|
530
|
+
}
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id, children: [
|
|
532
|
+
heading,
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_divider.Divider, { pt: { root: { style: { marginTop: "0.5rem" } } } })
|
|
495
534
|
] });
|
|
496
535
|
}
|
|
497
536
|
|
|
498
537
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
499
538
|
var import_utils13 = require("@rjsf/utils");
|
|
500
539
|
var import_inputtext2 = require("primereact/inputtext");
|
|
501
|
-
var
|
|
540
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
502
541
|
function WrapIfAdditionalTemplate({
|
|
503
542
|
classNames,
|
|
504
543
|
style,
|
|
@@ -506,8 +545,8 @@ function WrapIfAdditionalTemplate({
|
|
|
506
545
|
disabled,
|
|
507
546
|
id,
|
|
508
547
|
label,
|
|
509
|
-
|
|
510
|
-
|
|
548
|
+
onRemoveProperty,
|
|
549
|
+
onKeyRenameBlur,
|
|
511
550
|
readonly,
|
|
512
551
|
required,
|
|
513
552
|
schema,
|
|
@@ -518,38 +557,37 @@ function WrapIfAdditionalTemplate({
|
|
|
518
557
|
const keyLabel = translateString(import_utils13.TranslatableString.KeyLabel, [label]);
|
|
519
558
|
const additional = import_utils13.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
520
559
|
if (!additional) {
|
|
521
|
-
return /* @__PURE__ */ (0,
|
|
560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
|
|
522
561
|
}
|
|
523
|
-
|
|
524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
525
563
|
"div",
|
|
526
564
|
{
|
|
527
565
|
className: classNames,
|
|
528
566
|
style: { ...style, display: "flex", alignItems: "center", gap: "1rem" },
|
|
529
567
|
children: [
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
531
|
-
/* @__PURE__ */ (0,
|
|
532
|
-
/* @__PURE__ */ (0,
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { flex: 1 }, children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: `${id}-key`, style: { display: "block", marginBottom: "0.5rem" }, children: keyLabel }),
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
533
571
|
import_inputtext2.InputText,
|
|
534
572
|
{
|
|
535
573
|
id: `${id}-key`,
|
|
536
574
|
name: `${id}-key`,
|
|
537
575
|
defaultValue: label,
|
|
538
576
|
disabled: disabled || readonly,
|
|
539
|
-
onBlur: !readonly ?
|
|
577
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
540
578
|
required,
|
|
541
579
|
style: { width: "100%" }
|
|
542
580
|
}
|
|
543
581
|
)
|
|
544
582
|
] }),
|
|
545
|
-
/* @__PURE__ */ (0,
|
|
546
|
-
/* @__PURE__ */ (0,
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { flex: 1 }, children }),
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
547
585
|
RemoveButton2,
|
|
548
586
|
{
|
|
549
587
|
id: (0, import_utils13.buttonId)(id, "remove"),
|
|
550
588
|
className: "rjsf-object-property-remove",
|
|
551
589
|
disabled: disabled || readonly,
|
|
552
|
-
onClick:
|
|
590
|
+
onClick: onRemoveProperty,
|
|
553
591
|
registry
|
|
554
592
|
}
|
|
555
593
|
) })
|
|
@@ -561,19 +599,26 @@ function WrapIfAdditionalTemplate({
|
|
|
561
599
|
|
|
562
600
|
// src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx
|
|
563
601
|
var import_utils14 = require("@rjsf/utils");
|
|
564
|
-
var
|
|
565
|
-
function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId }) {
|
|
602
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
603
|
+
function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId, optionalDataControl }) {
|
|
566
604
|
const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
|
|
567
|
-
|
|
605
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h5", { id: (0, import_utils14.titleId)(fieldPathId), style: { margin: 0, fontSize: "1.5rem", marginBottom: "0.2rem" }, children: [
|
|
568
606
|
uiOptions.title || title,
|
|
569
607
|
" ",
|
|
570
608
|
required ? "*" : ""
|
|
571
609
|
] });
|
|
610
|
+
if (optionalDataControl) {
|
|
611
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex" }, children: [
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { flexGrow: 1 }, children: heading }),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: optionalDataControl })
|
|
614
|
+
] });
|
|
615
|
+
}
|
|
616
|
+
return heading;
|
|
572
617
|
}
|
|
573
618
|
|
|
574
619
|
// src/GridTemplate/GridTemplate.tsx
|
|
575
620
|
var import_react = require("react");
|
|
576
|
-
var
|
|
621
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
577
622
|
var breakpoints = {
|
|
578
623
|
xs: 0,
|
|
579
624
|
sm: 576,
|
|
@@ -610,7 +655,7 @@ function GridTemplateRow(props) {
|
|
|
610
655
|
const layoutGrid = uiSchema?.["ui:layoutGrid"] ?? {};
|
|
611
656
|
const totalColumns = layoutGrid.columns ?? 12;
|
|
612
657
|
const gap = layoutGrid.gap ?? "16px";
|
|
613
|
-
return /* @__PURE__ */ (0,
|
|
658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
614
659
|
"div",
|
|
615
660
|
{
|
|
616
661
|
style: {
|
|
@@ -637,7 +682,7 @@ function GridTemplateColumn(props) {
|
|
|
637
682
|
return () => window.removeEventListener("resize", handleResize);
|
|
638
683
|
}, []);
|
|
639
684
|
const span = getResponsiveSpan(props, breakpoint);
|
|
640
|
-
return /* @__PURE__ */ (0,
|
|
685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { gridColumn: `span ${span} / span ${span}`, ...style ?? {} }, ...rest, children });
|
|
641
686
|
}
|
|
642
687
|
|
|
643
688
|
// src/Templates/Templates.ts
|
|
@@ -662,6 +707,7 @@ function generateTemplates() {
|
|
|
662
707
|
FieldTemplate,
|
|
663
708
|
MultiSchemaFieldTemplate,
|
|
664
709
|
ObjectFieldTemplate,
|
|
710
|
+
OptionalDataControlsTemplate,
|
|
665
711
|
TitleFieldTemplate: TitleField,
|
|
666
712
|
WrapIfAdditionalTemplate,
|
|
667
713
|
GridTemplate
|
|
@@ -673,7 +719,7 @@ var Templates_default = generateTemplates();
|
|
|
673
719
|
var import_react2 = require("react");
|
|
674
720
|
var import_utils15 = require("@rjsf/utils");
|
|
675
721
|
var import_autocomplete = require("primereact/autocomplete");
|
|
676
|
-
var
|
|
722
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
677
723
|
function AutoCompleteWidget(props) {
|
|
678
724
|
const {
|
|
679
725
|
id,
|
|
@@ -704,7 +750,7 @@ function AutoCompleteWidget(props) {
|
|
|
704
750
|
const search = (event) => {
|
|
705
751
|
setItems(examples.filter((example) => example.toString().toLowerCase().includes(event.query.toLowerCase())));
|
|
706
752
|
};
|
|
707
|
-
return /* @__PURE__ */ (0,
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
708
754
|
import_autocomplete.AutoComplete,
|
|
709
755
|
{
|
|
710
756
|
id,
|
|
@@ -712,7 +758,7 @@ function AutoCompleteWidget(props) {
|
|
|
712
758
|
placeholder,
|
|
713
759
|
...primeProps,
|
|
714
760
|
...inputProps,
|
|
715
|
-
loadingIcon: /* @__PURE__ */ (0,
|
|
761
|
+
loadingIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
|
|
716
762
|
required,
|
|
717
763
|
autoFocus: autofocus,
|
|
718
764
|
disabled: disabled || readonly,
|
|
@@ -747,10 +793,11 @@ function AutoCompleteWidget(props) {
|
|
|
747
793
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
748
794
|
var import_utils16 = require("@rjsf/utils");
|
|
749
795
|
var import_checkbox = require("primereact/checkbox");
|
|
750
|
-
var
|
|
796
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
751
797
|
function CheckboxWidget(props) {
|
|
752
798
|
const {
|
|
753
799
|
id,
|
|
800
|
+
htmlName,
|
|
754
801
|
value,
|
|
755
802
|
disabled,
|
|
756
803
|
readonly,
|
|
@@ -777,8 +824,8 @@ function CheckboxWidget(props) {
|
|
|
777
824
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
778
825
|
const description = options.description ?? schema.description;
|
|
779
826
|
const primeProps = options.prime || {};
|
|
780
|
-
return /* @__PURE__ */ (0,
|
|
781
|
-
!hideLabel && !!description && /* @__PURE__ */ (0,
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
828
|
+
!hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
782
829
|
DescriptionFieldTemplate,
|
|
783
830
|
{
|
|
784
831
|
id: (0, import_utils16.descriptionId)(id),
|
|
@@ -788,12 +835,12 @@ function CheckboxWidget(props) {
|
|
|
788
835
|
registry
|
|
789
836
|
}
|
|
790
837
|
),
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" }, children: [
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
793
840
|
import_checkbox.Checkbox,
|
|
794
841
|
{
|
|
795
842
|
inputId: id,
|
|
796
|
-
name: id,
|
|
843
|
+
name: htmlName || id,
|
|
797
844
|
...primeProps,
|
|
798
845
|
disabled: disabled || readonly,
|
|
799
846
|
autoFocus: autofocus,
|
|
@@ -805,7 +852,7 @@ function CheckboxWidget(props) {
|
|
|
805
852
|
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
806
853
|
}
|
|
807
854
|
),
|
|
808
|
-
(0, import_utils16.labelValue)(/* @__PURE__ */ (0,
|
|
855
|
+
(0, import_utils16.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label, { id, text: label }), hideLabel, false)
|
|
809
856
|
] })
|
|
810
857
|
] });
|
|
811
858
|
}
|
|
@@ -813,10 +860,11 @@ function CheckboxWidget(props) {
|
|
|
813
860
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
814
861
|
var import_checkbox2 = require("primereact/checkbox");
|
|
815
862
|
var import_utils17 = require("@rjsf/utils");
|
|
816
|
-
var
|
|
863
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
817
864
|
function CheckboxesWidget(props) {
|
|
818
865
|
const {
|
|
819
866
|
id,
|
|
867
|
+
htmlName,
|
|
820
868
|
disabled,
|
|
821
869
|
options,
|
|
822
870
|
value,
|
|
@@ -848,13 +896,13 @@ function CheckboxesWidget(props) {
|
|
|
848
896
|
const _onBlur = () => onBlur(id, value);
|
|
849
897
|
const _onFocus = () => onFocus(id, value);
|
|
850
898
|
const description = options.description ?? schema.description;
|
|
851
|
-
return /* @__PURE__ */ (0,
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
852
900
|
"div",
|
|
853
901
|
{
|
|
854
902
|
id,
|
|
855
903
|
style: { display: "flex", flexDirection: "column", gap: "1rem", marginTop: "0.5rem", marginBottom: "0.5rem" },
|
|
856
904
|
children: [
|
|
857
|
-
!hideLabel && !!description && /* @__PURE__ */ (0,
|
|
905
|
+
!hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
858
906
|
DescriptionFieldTemplate,
|
|
859
907
|
{
|
|
860
908
|
id: (0, import_utils17.descriptionId)(id),
|
|
@@ -867,12 +915,12 @@ function CheckboxesWidget(props) {
|
|
|
867
915
|
Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
868
916
|
const checked = (0, import_utils17.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
869
917
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
870
|
-
return /* @__PURE__ */ (0,
|
|
871
|
-
/* @__PURE__ */ (0,
|
|
918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" }, children: [
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
872
920
|
import_checkbox2.Checkbox,
|
|
873
921
|
{
|
|
874
922
|
inputId: (0, import_utils17.optionId)(id, index),
|
|
875
|
-
name: id,
|
|
923
|
+
name: htmlName || id,
|
|
876
924
|
...primeProps,
|
|
877
925
|
value: option.value,
|
|
878
926
|
checked,
|
|
@@ -884,7 +932,7 @@ function CheckboxesWidget(props) {
|
|
|
884
932
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
885
933
|
}
|
|
886
934
|
),
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label, { id: (0, import_utils17.optionId)(id, index), text: option.label })
|
|
888
936
|
] }, index);
|
|
889
937
|
})
|
|
890
938
|
]
|
|
@@ -895,7 +943,7 @@ function CheckboxesWidget(props) {
|
|
|
895
943
|
// src/ColorWidget/ColorWidget.tsx
|
|
896
944
|
var import_utils18 = require("@rjsf/utils");
|
|
897
945
|
var import_colorpicker = require("primereact/colorpicker");
|
|
898
|
-
var
|
|
946
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
899
947
|
function ColorWidget(props) {
|
|
900
948
|
const {
|
|
901
949
|
id,
|
|
@@ -919,7 +967,7 @@ function ColorWidget(props) {
|
|
|
919
967
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
920
968
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
921
969
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
922
|
-
return /* @__PURE__ */ (0,
|
|
970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
923
971
|
import_colorpicker.ColorPicker,
|
|
924
972
|
{
|
|
925
973
|
id,
|
|
@@ -943,7 +991,7 @@ function ColorWidget(props) {
|
|
|
943
991
|
// src/PasswordWidget/PasswordWidget.tsx
|
|
944
992
|
var import_utils19 = require("@rjsf/utils");
|
|
945
993
|
var import_password = require("primereact/password");
|
|
946
|
-
var
|
|
994
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
947
995
|
function PasswordWidget(props) {
|
|
948
996
|
const {
|
|
949
997
|
id,
|
|
@@ -967,7 +1015,7 @@ function PasswordWidget(props) {
|
|
|
967
1015
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
968
1016
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
969
1017
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
970
|
-
return /* @__PURE__ */ (0,
|
|
1018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
971
1019
|
import_password.Password,
|
|
972
1020
|
{
|
|
973
1021
|
id,
|
|
@@ -992,9 +1040,9 @@ function PasswordWidget(props) {
|
|
|
992
1040
|
// src/RadioWidget/RadioWidget.tsx
|
|
993
1041
|
var import_utils20 = require("@rjsf/utils");
|
|
994
1042
|
var import_radiobutton = require("primereact/radiobutton");
|
|
995
|
-
var
|
|
1043
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
996
1044
|
function RadioWidget(props) {
|
|
997
|
-
const { id, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
1045
|
+
const { id, htmlName, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
998
1046
|
const primeProps = options.prime || {};
|
|
999
1047
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1000
1048
|
const _onChange = (e) => {
|
|
@@ -1002,15 +1050,15 @@ function RadioWidget(props) {
|
|
|
1002
1050
|
};
|
|
1003
1051
|
const _onBlur = () => onBlur(id, value);
|
|
1004
1052
|
const _onFocus = () => onFocus(id, value);
|
|
1005
|
-
return /* @__PURE__ */ (0,
|
|
1053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexDirection: "row", gap: "1rem" }, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1006
1054
|
const checked = (0, import_utils20.enumOptionsIsSelected)(option.value, value);
|
|
1007
1055
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1008
|
-
return /* @__PURE__ */ (0,
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1010
1058
|
import_radiobutton.RadioButton,
|
|
1011
1059
|
{
|
|
1012
1060
|
inputId: (0, import_utils20.optionId)(id, index),
|
|
1013
|
-
name: id,
|
|
1061
|
+
name: htmlName || id,
|
|
1014
1062
|
...primeProps,
|
|
1015
1063
|
onFocus: _onFocus,
|
|
1016
1064
|
onBlur: _onBlur,
|
|
@@ -1021,7 +1069,7 @@ function RadioWidget(props) {
|
|
|
1021
1069
|
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id)
|
|
1022
1070
|
}
|
|
1023
1071
|
),
|
|
1024
|
-
/* @__PURE__ */ (0,
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: (0, import_utils20.optionId)(id, index), style: { marginLeft: "8px" }, children: option.label })
|
|
1025
1073
|
] }, index);
|
|
1026
1074
|
}) });
|
|
1027
1075
|
}
|
|
@@ -1029,7 +1077,7 @@ function RadioWidget(props) {
|
|
|
1029
1077
|
// src/RangeWidget/RangeWidget.tsx
|
|
1030
1078
|
var import_slider = require("primereact/slider");
|
|
1031
1079
|
var import_utils21 = require("@rjsf/utils");
|
|
1032
|
-
var
|
|
1080
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1033
1081
|
function RangeWidget(props) {
|
|
1034
1082
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, id } = props;
|
|
1035
1083
|
const primeProps = options.prime || {};
|
|
@@ -1039,7 +1087,7 @@ function RangeWidget(props) {
|
|
|
1039
1087
|
};
|
|
1040
1088
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1041
1089
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1042
|
-
return /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1043
1091
|
import_slider.Slider,
|
|
1044
1092
|
{
|
|
1045
1093
|
...primeProps,
|
|
@@ -1058,14 +1106,15 @@ function RangeWidget(props) {
|
|
|
1058
1106
|
var import_dropdown = require("primereact/dropdown");
|
|
1059
1107
|
var import_utils22 = require("@rjsf/utils");
|
|
1060
1108
|
var import_multiselect = require("primereact/multiselect");
|
|
1061
|
-
var
|
|
1109
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1062
1110
|
function SelectWidget(props) {
|
|
1063
1111
|
const { multiple = false } = props;
|
|
1064
|
-
return multiple ? /* @__PURE__ */ (0,
|
|
1112
|
+
return multiple ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MultiSelectWidget, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SingleSelectWidget, { ...props });
|
|
1065
1113
|
}
|
|
1066
1114
|
function SingleSelectWidget({
|
|
1067
1115
|
schema,
|
|
1068
1116
|
id,
|
|
1117
|
+
htmlName,
|
|
1069
1118
|
name,
|
|
1070
1119
|
// remove this from dropdownProps
|
|
1071
1120
|
options,
|
|
@@ -1086,7 +1135,6 @@ function SingleSelectWidget({
|
|
|
1086
1135
|
registry,
|
|
1087
1136
|
uiSchema,
|
|
1088
1137
|
hideError,
|
|
1089
|
-
formContext,
|
|
1090
1138
|
...dropdownProps
|
|
1091
1139
|
}) {
|
|
1092
1140
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -1099,11 +1147,11 @@ function SingleSelectWidget({
|
|
|
1099
1147
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils22.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
|
|
1100
1148
|
const selectedIndexes = (0, import_utils22.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1101
1149
|
const { ...dropdownRemainingProps } = dropdownProps;
|
|
1102
|
-
return /* @__PURE__ */ (0,
|
|
1150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1103
1151
|
import_dropdown.Dropdown,
|
|
1104
1152
|
{
|
|
1105
1153
|
id,
|
|
1106
|
-
name: id,
|
|
1154
|
+
name: htmlName || id,
|
|
1107
1155
|
...primeProps,
|
|
1108
1156
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
1109
1157
|
options: (enumOptions ?? []).map(({ value: value2, label: label2 }, i) => ({
|
|
@@ -1124,6 +1172,7 @@ function SingleSelectWidget({
|
|
|
1124
1172
|
}
|
|
1125
1173
|
function MultiSelectWidget({
|
|
1126
1174
|
id,
|
|
1175
|
+
htmlName,
|
|
1127
1176
|
options,
|
|
1128
1177
|
disabled,
|
|
1129
1178
|
placeholder,
|
|
@@ -1143,11 +1192,11 @@ function MultiSelectWidget({
|
|
|
1143
1192
|
const _onBlur = ({ target }) => onBlur(id, (0, import_utils22.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
|
|
1144
1193
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils22.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
|
|
1145
1194
|
const selectedIndexes = (0, import_utils22.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1146
|
-
return /* @__PURE__ */ (0,
|
|
1195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1147
1196
|
import_multiselect.MultiSelect,
|
|
1148
1197
|
{
|
|
1149
1198
|
id,
|
|
1150
|
-
name: id,
|
|
1199
|
+
name: htmlName || id,
|
|
1151
1200
|
...primeProps,
|
|
1152
1201
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
1153
1202
|
options: (enumOptions ?? []).map(({ value: value2, label }, i) => ({
|
|
@@ -1170,9 +1219,9 @@ function MultiSelectWidget({
|
|
|
1170
1219
|
|
|
1171
1220
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1172
1221
|
var import_inputtextarea = require("primereact/inputtextarea");
|
|
1173
|
-
var
|
|
1222
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1174
1223
|
function TextareaWidget(props) {
|
|
1175
|
-
const { id, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
1224
|
+
const { id, htmlName, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
1176
1225
|
const primeProps = options.prime || {};
|
|
1177
1226
|
let rows = 5;
|
|
1178
1227
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
@@ -1181,10 +1230,11 @@ function TextareaWidget(props) {
|
|
|
1181
1230
|
const handleChange = (event) => {
|
|
1182
1231
|
onChange(event.target.value === "" ? options.emptyValue : event.target.value);
|
|
1183
1232
|
};
|
|
1184
|
-
return /* @__PURE__ */ (0,
|
|
1233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1185
1234
|
import_inputtextarea.InputTextarea,
|
|
1186
1235
|
{
|
|
1187
1236
|
id,
|
|
1237
|
+
name: htmlName || id,
|
|
1188
1238
|
...primeProps,
|
|
1189
1239
|
value: value || "",
|
|
1190
1240
|
required,
|
|
@@ -1201,7 +1251,7 @@ function TextareaWidget(props) {
|
|
|
1201
1251
|
// src/UpDownWidget/UpDownWidget.tsx
|
|
1202
1252
|
var import_utils23 = require("@rjsf/utils");
|
|
1203
1253
|
var import_inputnumber = require("primereact/inputnumber");
|
|
1204
|
-
var
|
|
1254
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1205
1255
|
function UpDownWidget(props) {
|
|
1206
1256
|
const {
|
|
1207
1257
|
id,
|
|
@@ -1226,7 +1276,7 @@ function UpDownWidget(props) {
|
|
|
1226
1276
|
const _onChange = (event) => onChange(event.value === null ? options.emptyValue : value);
|
|
1227
1277
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1228
1278
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1229
|
-
return /* @__PURE__ */ (0,
|
|
1279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1230
1280
|
import_inputnumber.InputNumber,
|
|
1231
1281
|
{
|
|
1232
1282
|
id,
|