@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/primereact.umd.js
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
className,
|
|
46
46
|
disabled,
|
|
47
47
|
items,
|
|
48
|
+
optionalDataControl,
|
|
48
49
|
onAddClick,
|
|
49
50
|
readonly,
|
|
50
51
|
schema,
|
|
@@ -59,16 +60,12 @@
|
|
|
59
60
|
registry,
|
|
60
61
|
uiOptions
|
|
61
62
|
);
|
|
62
|
-
const ArrayFieldItemTemplate2 = utils.getTemplate(
|
|
63
|
-
"ArrayFieldItemTemplate",
|
|
64
|
-
registry,
|
|
65
|
-
uiOptions
|
|
66
|
-
);
|
|
67
63
|
const ArrayFieldTitleTemplate2 = utils.getTemplate(
|
|
68
64
|
"ArrayFieldTitleTemplate",
|
|
69
65
|
registry,
|
|
70
66
|
uiOptions
|
|
71
67
|
);
|
|
68
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
72
69
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
73
70
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
74
71
|
ArrayFieldTitleTemplate2,
|
|
@@ -78,7 +75,8 @@
|
|
|
78
75
|
schema,
|
|
79
76
|
uiSchema,
|
|
80
77
|
required,
|
|
81
|
-
registry
|
|
78
|
+
registry,
|
|
79
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
82
80
|
}
|
|
83
81
|
),
|
|
84
82
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -99,15 +97,10 @@
|
|
|
99
97
|
}
|
|
100
98
|
),
|
|
101
99
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
102
|
-
/* @__PURE__ */ jsxRuntime.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
...itemUiSchema[utils.UI_OPTIONS_KEY]
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...props2, uiSchema: mergedUiSchema }, key);
|
|
110
|
-
}) }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
101
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
102
|
+
items
|
|
103
|
+
] }),
|
|
111
104
|
canAdd && /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
105
|
"div",
|
|
113
106
|
{
|
|
@@ -138,6 +131,7 @@
|
|
|
138
131
|
function BaseInputTemplate(props) {
|
|
139
132
|
const {
|
|
140
133
|
id,
|
|
134
|
+
htmlName,
|
|
141
135
|
placeholder,
|
|
142
136
|
value,
|
|
143
137
|
required,
|
|
@@ -167,7 +161,7 @@
|
|
|
167
161
|
inputtext.InputText,
|
|
168
162
|
{
|
|
169
163
|
id,
|
|
170
|
-
name: id,
|
|
164
|
+
name: htmlName || id,
|
|
171
165
|
placeholder,
|
|
172
166
|
...primeProps,
|
|
173
167
|
...inputProps,
|
|
@@ -314,7 +308,8 @@
|
|
|
314
308
|
function ObjectFieldTemplate(props) {
|
|
315
309
|
const {
|
|
316
310
|
description,
|
|
317
|
-
|
|
311
|
+
optionalDataControl,
|
|
312
|
+
onAddProperty,
|
|
318
313
|
title,
|
|
319
314
|
properties,
|
|
320
315
|
disabled,
|
|
@@ -333,6 +328,7 @@
|
|
|
333
328
|
registry,
|
|
334
329
|
uiOptions
|
|
335
330
|
);
|
|
331
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
336
332
|
const {
|
|
337
333
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
338
334
|
} = registry.templates;
|
|
@@ -345,7 +341,8 @@
|
|
|
345
341
|
required,
|
|
346
342
|
schema,
|
|
347
343
|
uiSchema,
|
|
348
|
-
registry
|
|
344
|
+
registry,
|
|
345
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
349
346
|
}
|
|
350
347
|
),
|
|
351
348
|
description && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -358,6 +355,7 @@
|
|
|
358
355
|
registry
|
|
359
356
|
}
|
|
360
357
|
) }),
|
|
358
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
361
359
|
properties.map((prop) => prop.content),
|
|
362
360
|
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "1rem", textAlign: "right" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
363
361
|
AddButton2,
|
|
@@ -365,13 +363,43 @@
|
|
|
365
363
|
id: utils.buttonId(fieldPathId, "add"),
|
|
366
364
|
className: "rjsf-object-property-expand",
|
|
367
365
|
icon: "pi pi-plus",
|
|
368
|
-
onClick:
|
|
366
|
+
onClick: onAddProperty,
|
|
369
367
|
disabled: disabled || readonly,
|
|
370
368
|
registry
|
|
371
369
|
}
|
|
372
370
|
) })
|
|
373
371
|
] });
|
|
374
372
|
}
|
|
373
|
+
function OptionalDataControlsTemplate(props) {
|
|
374
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
375
|
+
if (onAddClick) {
|
|
376
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
377
|
+
IconButton,
|
|
378
|
+
{
|
|
379
|
+
id,
|
|
380
|
+
registry,
|
|
381
|
+
className: "rjsf-add-optional-data",
|
|
382
|
+
onClick: onAddClick,
|
|
383
|
+
title: label,
|
|
384
|
+
icon: "pi pi-plus",
|
|
385
|
+
style: { height: "1.5rem", width: "1.5rem" }
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
} else if (onRemoveClick) {
|
|
389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
390
|
+
RemoveButton,
|
|
391
|
+
{
|
|
392
|
+
id,
|
|
393
|
+
registry,
|
|
394
|
+
className: "rjsf-remove-optional-data",
|
|
395
|
+
onClick: onRemoveClick,
|
|
396
|
+
title: label,
|
|
397
|
+
style: { height: "1.5rem", width: "1.5rem" }
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
return /* @__PURE__ */ jsxRuntime.jsx("em", { id, children: label });
|
|
402
|
+
}
|
|
375
403
|
function SubmitButton({ uiSchema }) {
|
|
376
404
|
const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
|
|
377
405
|
if (norender) {
|
|
@@ -383,15 +411,23 @@
|
|
|
383
411
|
id,
|
|
384
412
|
title,
|
|
385
413
|
uiSchema,
|
|
386
|
-
required
|
|
414
|
+
required,
|
|
415
|
+
optionalDataControl
|
|
387
416
|
}) {
|
|
388
417
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
418
|
+
let heading = /* @__PURE__ */ jsxRuntime.jsxs("h5", { style: { margin: 0, fontSize: id === utils.titleId("root") ? "1.5rem" : "1.2rem" }, children: [
|
|
419
|
+
uiOptions.title || title,
|
|
420
|
+
" ",
|
|
421
|
+
required ? "*" : ""
|
|
422
|
+
] });
|
|
423
|
+
if (optionalDataControl) {
|
|
424
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex" }, children: [
|
|
425
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 }, children: heading }),
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginLeft: "-5px" }, children: optionalDataControl })
|
|
427
|
+
] });
|
|
428
|
+
}
|
|
389
429
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { id, children: [
|
|
390
|
-
|
|
391
|
-
uiOptions.title || title,
|
|
392
|
-
" ",
|
|
393
|
-
required ? "*" : ""
|
|
394
|
-
] }),
|
|
430
|
+
heading,
|
|
395
431
|
/* @__PURE__ */ jsxRuntime.jsx(divider.Divider, { pt: { root: { style: { marginTop: "0.5rem" } } } })
|
|
396
432
|
] });
|
|
397
433
|
}
|
|
@@ -402,8 +438,8 @@
|
|
|
402
438
|
disabled,
|
|
403
439
|
id,
|
|
404
440
|
label,
|
|
405
|
-
|
|
406
|
-
|
|
441
|
+
onRemoveProperty,
|
|
442
|
+
onKeyRenameBlur,
|
|
407
443
|
readonly,
|
|
408
444
|
required,
|
|
409
445
|
schema,
|
|
@@ -416,7 +452,6 @@
|
|
|
416
452
|
if (!additional) {
|
|
417
453
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
|
|
418
454
|
}
|
|
419
|
-
const handleBlur = ({ target }) => onKeyChange(target.value);
|
|
420
455
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
421
456
|
"div",
|
|
422
457
|
{
|
|
@@ -432,7 +467,7 @@
|
|
|
432
467
|
name: `${id}-key`,
|
|
433
468
|
defaultValue: label,
|
|
434
469
|
disabled: disabled || readonly,
|
|
435
|
-
onBlur: !readonly ?
|
|
470
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
436
471
|
required,
|
|
437
472
|
style: { width: "100%" }
|
|
438
473
|
}
|
|
@@ -445,7 +480,7 @@
|
|
|
445
480
|
id: utils.buttonId(id, "remove"),
|
|
446
481
|
className: "rjsf-object-property-remove",
|
|
447
482
|
disabled: disabled || readonly,
|
|
448
|
-
onClick:
|
|
483
|
+
onClick: onRemoveProperty,
|
|
449
484
|
registry
|
|
450
485
|
}
|
|
451
486
|
) })
|
|
@@ -454,13 +489,20 @@
|
|
|
454
489
|
`${id}-key`
|
|
455
490
|
);
|
|
456
491
|
}
|
|
457
|
-
function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId }) {
|
|
492
|
+
function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId, optionalDataControl }) {
|
|
458
493
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
459
|
-
|
|
494
|
+
let heading = /* @__PURE__ */ jsxRuntime.jsxs("h5", { id: utils.titleId(fieldPathId), style: { margin: 0, fontSize: "1.5rem", marginBottom: "0.2rem" }, children: [
|
|
460
495
|
uiOptions.title || title,
|
|
461
496
|
" ",
|
|
462
497
|
required ? "*" : ""
|
|
463
498
|
] });
|
|
499
|
+
if (optionalDataControl) {
|
|
500
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex" }, children: [
|
|
501
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 }, children: heading }),
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: optionalDataControl })
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
return heading;
|
|
464
506
|
}
|
|
465
507
|
var breakpoints = {
|
|
466
508
|
xs: 0,
|
|
@@ -550,6 +592,7 @@
|
|
|
550
592
|
FieldTemplate,
|
|
551
593
|
MultiSchemaFieldTemplate,
|
|
552
594
|
ObjectFieldTemplate,
|
|
595
|
+
OptionalDataControlsTemplate,
|
|
553
596
|
TitleFieldTemplate: TitleField,
|
|
554
597
|
WrapIfAdditionalTemplate,
|
|
555
598
|
GridTemplate
|
|
@@ -628,6 +671,7 @@
|
|
|
628
671
|
function CheckboxWidget(props) {
|
|
629
672
|
const {
|
|
630
673
|
id,
|
|
674
|
+
htmlName,
|
|
631
675
|
value,
|
|
632
676
|
disabled,
|
|
633
677
|
readonly,
|
|
@@ -670,7 +714,7 @@
|
|
|
670
714
|
checkbox.Checkbox,
|
|
671
715
|
{
|
|
672
716
|
inputId: id,
|
|
673
|
-
name: id,
|
|
717
|
+
name: htmlName || id,
|
|
674
718
|
...primeProps,
|
|
675
719
|
disabled: disabled || readonly,
|
|
676
720
|
autoFocus: autofocus,
|
|
@@ -689,6 +733,7 @@
|
|
|
689
733
|
function CheckboxesWidget(props) {
|
|
690
734
|
const {
|
|
691
735
|
id,
|
|
736
|
+
htmlName,
|
|
692
737
|
disabled,
|
|
693
738
|
options,
|
|
694
739
|
value,
|
|
@@ -744,7 +789,7 @@
|
|
|
744
789
|
checkbox.Checkbox,
|
|
745
790
|
{
|
|
746
791
|
inputId: utils.optionId(id, index),
|
|
747
|
-
name: id,
|
|
792
|
+
name: htmlName || id,
|
|
748
793
|
...primeProps,
|
|
749
794
|
value: option.value,
|
|
750
795
|
checked,
|
|
@@ -851,7 +896,7 @@
|
|
|
851
896
|
);
|
|
852
897
|
}
|
|
853
898
|
function RadioWidget(props) {
|
|
854
|
-
const { id, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
899
|
+
const { id, htmlName, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
|
|
855
900
|
const primeProps = options.prime || {};
|
|
856
901
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
857
902
|
const _onChange = (e) => {
|
|
@@ -867,7 +912,7 @@
|
|
|
867
912
|
radiobutton.RadioButton,
|
|
868
913
|
{
|
|
869
914
|
inputId: utils.optionId(id, index),
|
|
870
|
-
name: id,
|
|
915
|
+
name: htmlName || id,
|
|
871
916
|
...primeProps,
|
|
872
917
|
onFocus: _onFocus,
|
|
873
918
|
onBlur: _onBlur,
|
|
@@ -912,6 +957,7 @@
|
|
|
912
957
|
function SingleSelectWidget({
|
|
913
958
|
schema,
|
|
914
959
|
id,
|
|
960
|
+
htmlName,
|
|
915
961
|
name,
|
|
916
962
|
// remove this from dropdownProps
|
|
917
963
|
options,
|
|
@@ -932,7 +978,6 @@
|
|
|
932
978
|
registry,
|
|
933
979
|
uiSchema,
|
|
934
980
|
hideError,
|
|
935
|
-
formContext,
|
|
936
981
|
...dropdownProps
|
|
937
982
|
}) {
|
|
938
983
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -949,7 +994,7 @@
|
|
|
949
994
|
dropdown.Dropdown,
|
|
950
995
|
{
|
|
951
996
|
id,
|
|
952
|
-
name: id,
|
|
997
|
+
name: htmlName || id,
|
|
953
998
|
...primeProps,
|
|
954
999
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
955
1000
|
options: (enumOptions ?? []).map(({ value: value2, label: label2 }, i) => ({
|
|
@@ -970,6 +1015,7 @@
|
|
|
970
1015
|
}
|
|
971
1016
|
function MultiSelectWidget({
|
|
972
1017
|
id,
|
|
1018
|
+
htmlName,
|
|
973
1019
|
options,
|
|
974
1020
|
disabled,
|
|
975
1021
|
placeholder,
|
|
@@ -993,7 +1039,7 @@
|
|
|
993
1039
|
multiselect.MultiSelect,
|
|
994
1040
|
{
|
|
995
1041
|
id,
|
|
996
|
-
name: id,
|
|
1042
|
+
name: htmlName || id,
|
|
997
1043
|
...primeProps,
|
|
998
1044
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
999
1045
|
options: (enumOptions ?? []).map(({ value: value2, label }, i) => ({
|
|
@@ -1014,7 +1060,7 @@
|
|
|
1014
1060
|
);
|
|
1015
1061
|
}
|
|
1016
1062
|
function TextareaWidget(props) {
|
|
1017
|
-
const { id, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
1063
|
+
const { id, htmlName, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
|
|
1018
1064
|
const primeProps = options.prime || {};
|
|
1019
1065
|
let rows = 5;
|
|
1020
1066
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
@@ -1027,6 +1073,7 @@
|
|
|
1027
1073
|
inputtextarea.InputTextarea,
|
|
1028
1074
|
{
|
|
1029
1075
|
id,
|
|
1076
|
+
name: htmlName || id,
|
|
1030
1077
|
...primeProps,
|
|
1031
1078
|
value: value || "",
|
|
1032
1079
|
required,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
|
-
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
6
|
+
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { getTemplate, getUiOptions, } from '@rjsf/utils';
|
|
3
3
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
4
4
|
*
|
|
5
|
-
* @param props - The `
|
|
5
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
6
6
|
*/
|
|
7
7
|
export default function ArrayFieldItemTemplate(props) {
|
|
8
8
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aACjC,UAAU,IAAI,CACb,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,YACzD,UAAU,IAAI,CACb,cAAK,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,YAClC,KAAC,6BAA6B,OAAK,YAAY,GAAI,GAC/C,CACP,GACG,CACP,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
6
|
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { getTemplate, getUiOptions, isFixedItems,
|
|
2
|
+
import { getTemplate, getUiOptions, isFixedItems, buttonId, } from '@rjsf/utils';
|
|
3
3
|
import { Fieldset } from 'primereact/fieldset';
|
|
4
4
|
import AddButton from '../AddButton/index.js';
|
|
5
5
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
6
6
|
*
|
|
7
|
-
* @param props - The `
|
|
7
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
8
8
|
*/
|
|
9
9
|
export default function ArrayFieldTemplate(props) {
|
|
10
|
-
const { uiSchema, fieldPathId, canAdd, className, disabled, items, onAddClick, readonly, schema, title, registry, required, ...rest } = props;
|
|
10
|
+
const { uiSchema, fieldPathId, canAdd, className, disabled, items, optionalDataControl, onAddClick, readonly, schema, title, registry, required, ...rest } = props;
|
|
11
11
|
const uiOptions = getUiOptions(uiSchema);
|
|
12
12
|
const ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
13
|
-
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
14
13
|
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const mergedUiSchema = {
|
|
18
|
-
...itemUiSchema,
|
|
19
|
-
[UI_OPTIONS_KEY]: {
|
|
20
|
-
...itemUiSchema[UI_OPTIONS_KEY],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
return _jsx(ArrayFieldItemTemplate, { ...props, uiSchema: mergedUiSchema }, key);
|
|
24
|
-
}) }), canAdd && (_jsx("div", { style: {
|
|
14
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }), _jsxs(Fieldset, { ...rest, id: fieldPathId.$id, className: `${className}${isFixedItems(schema) ? '' : ' sortable-form-fields'}`, children: [_jsx(ArrayFieldDescriptionTemplate, { fieldPathId: fieldPathId, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), _jsxs("div", { children: [_jsxs("div", { children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, items] }), canAdd && (_jsx("div", { style: {
|
|
25
16
|
marginTop: '1rem',
|
|
26
17
|
position: 'relative',
|
|
27
18
|
textAlign: 'right',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EAKZ,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAAuC;IACvC,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,uBAAuB,GAAG,WAAW,CACzC,yBAAyB,EACzB,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,8BAA8B,GAAG,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;IAE9D,OAAO,CACL,8BACE,KAAC,uBAAuB,IACtB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,KAAK,EAC/B,MAAM,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
6
|
-
export default function ArrayFieldTitleTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ title, uiSchema, required, fieldPathId }: ArrayFieldTitleProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function ArrayFieldTitleTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ title, uiSchema, required, fieldPathId, optionalDataControl }: ArrayFieldTitleProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getUiOptions, titleId, } from '@rjsf/utils';
|
|
3
3
|
/** The `ArrayFieldTitleTemplate` component renders a header for the array.
|
|
4
4
|
*
|
|
5
5
|
* @param props - The `ArrayFieldTitleProps` for the component
|
|
6
6
|
*/
|
|
7
|
-
export default function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId }) {
|
|
7
|
+
export default function ArrayFieldTitleTemplate({ title, uiSchema, required, fieldPathId, optionalDataControl }) {
|
|
8
8
|
const uiOptions = getUiOptions(uiSchema);
|
|
9
|
-
|
|
9
|
+
let heading = (_jsxs("h5", { id: titleId(fieldPathId), style: { margin: 0, fontSize: '1.5rem', marginBottom: '0.2rem' }, children: [uiOptions.title || title, " ", required ? '*' : ''] }));
|
|
10
|
+
if (optionalDataControl) {
|
|
11
|
+
heading = (_jsxs("div", { style: { display: 'flex' }, children: [_jsx("div", { style: { flexGrow: 1 }, children: heading }), _jsx("div", { children: optionalDataControl })] }));
|
|
12
|
+
}
|
|
13
|
+
return heading;
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=ArrayFieldTitleTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTitleTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,YAAY,EAGZ,OAAO,GACR,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAI7C,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAiC;
|
|
1
|
+
{"version":3,"file":"ArrayFieldTitleTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,YAAY,EAGZ,OAAO,GACR,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAI7C,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAiC;IAC9F,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,IAAI,OAAO,GAAG,CACZ,cAAI,EAAE,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,aAC3F,SAAS,CAAC,KAAK,IAAI,KAAK,OAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAC5C,CACN,CAAC;IACF,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,GAAG,CACR,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAC7B,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAG,OAAO,GAAO,EAC5C,wBAAM,mBAAmB,GAAO,IAC5B,CACP,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { InputText } from 'primereact/inputtext';
|
|
|
4
4
|
/** The `BaseInputTemplate` is the template the fallback if no widget is specified.
|
|
5
5
|
*/
|
|
6
6
|
export default function BaseInputTemplate(props) {
|
|
7
|
-
const { id, placeholder, value, required, readonly, disabled, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, type, registry, rawErrors = [], } = props;
|
|
7
|
+
const { id, htmlName, placeholder, value, required, readonly, disabled, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, type, registry, rawErrors = [], } = props;
|
|
8
8
|
const { AutoCompleteWidget } = registry.widgets;
|
|
9
9
|
if (Array.isArray(schema.examples)) {
|
|
10
10
|
return _jsx(AutoCompleteWidget, { ...props });
|
|
@@ -14,6 +14,6 @@ export default function BaseInputTemplate(props) {
|
|
|
14
14
|
const _onChange = ({ target: { value } }) => onChange(value === '' ? options.emptyValue : value);
|
|
15
15
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
16
16
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
17
|
-
return (_jsx(InputText, { id: id, name: id, placeholder: placeholder, ...primeProps, ...inputProps, required: required, autoFocus: autofocus, disabled: disabled || readonly, list: schema.examples ? examplesId(id) : undefined, value: value || value === 0 ? value : '', invalid: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }));
|
|
17
|
+
return (_jsx(InputText, { id: id, name: htmlName || id, placeholder: placeholder, ...primeProps, ...inputProps, required: required, autoFocus: autofocus, disabled: disabled || readonly, list: schema.examples ? examplesId(id) : undefined, value: value || value === 0 ? value : '', invalid: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }));
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=BaseInputTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";AACA,O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,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAErD,OAAO,CACL,KAAC,SAAS,IACR,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,QAAQ,IAAI,EAAE,EACpB,WAAW,EAAE,WAAW,KACpB,UAAU,KACV,UAAU,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EACxC,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,EAC7B,QAAQ,EAAE,gBAAgB,IAAI,SAAS,EACvC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,sBACC,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAC3D,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { Label } from '../util.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export default function CheckboxWidget(props) {
|
|
11
11
|
var _a;
|
|
12
|
-
const { id, value, disabled, readonly, label = '', hideLabel, autofocus, onChange, onBlur, options, onFocus, schema, uiSchema, registry, } = props;
|
|
12
|
+
const { id, htmlName, value, disabled, readonly, label = '', hideLabel, autofocus, onChange, onBlur, options, onFocus, schema, uiSchema, registry, } = props;
|
|
13
13
|
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
14
14
|
const required = schemaRequiresTrueValue(schema);
|
|
15
15
|
const checked = value === 'true' || value === true;
|
|
@@ -18,6 +18,6 @@ export default function CheckboxWidget(props) {
|
|
|
18
18
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
19
19
|
const description = (_a = options.description) !== null && _a !== void 0 ? _a : schema.description;
|
|
20
20
|
const primeProps = (options.prime || {});
|
|
21
|
-
return (_jsxs(_Fragment, { children: [!hideLabel && !!description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }, children: [_jsx(Checkbox, { inputId: id, name: id, ...primeProps, disabled: disabled || readonly, autoFocus: autofocus, checked: typeof value === 'undefined' ? false : checked, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, required: required, "aria-describedby": ariaDescribedByIds(id) }), labelValue(_jsx(Label, { id: id, text: label }), hideLabel, false)] })] }));
|
|
21
|
+
return (_jsxs(_Fragment, { children: [!hideLabel && !!description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }, children: [_jsx(Checkbox, { inputId: id, name: htmlName || id, ...primeProps, disabled: disabled || readonly, autoFocus: autofocus, checked: typeof value === 'undefined' ? false : checked, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, required: required, "aria-describedby": ariaDescribedByIds(id) }), labelValue(_jsx(Label, { id: id, text: label }), hideLabel, false)] })] }));
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=CheckboxWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UAAU,EACV,uBAAuB,GAKxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAuB,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAA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IAChG,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,MAAM,CAAC,WAAW,CAAC;IAC9D,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAW,CAAC;IAEnD,OAAO,CACL,8BACG,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IAAI,CAC9B,KAAC,wBAAwB,IACvB,EAAE,EAAE,aAAa,CAAC,EAAE,CAAC,EACrB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,EACD,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,aACxF,KAAC,QAAQ,IACP,OAAO,EAAE,EAAE,EACX,IAAI,EAAE,QAAQ,IAAI,EAAE,KAChB,UAAU,EACd,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EACvD,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,QAAQ,sBACA,kBAAkB,CAAC,EAAE,CAAC,GACxC,EACD,UAAU,CAAC,KAAC,KAAK,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,GAAI,EAAE,SAAS,EAAE,KAAK,CAAC,IACzD,IACL,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { Label } from '../util.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export default function CheckboxesWidget(props) {
|
|
11
11
|
var _a;
|
|
12
|
-
const { id, disabled, options, value, autofocus, readonly, onChange, onBlur, onFocus, schema, uiSchema, registry, hideLabel, } = props;
|
|
12
|
+
const { id, htmlName, disabled, options, value, autofocus, readonly, onChange, onBlur, onFocus, schema, uiSchema, registry, hideLabel, } = props;
|
|
13
13
|
const { enumOptions, enumDisabled } = options;
|
|
14
14
|
const primeProps = (options.prime || {});
|
|
15
15
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
@@ -29,7 +29,7 @@ export default function CheckboxesWidget(props) {
|
|
|
29
29
|
enumOptions.map((option, index) => {
|
|
30
30
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
31
31
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
32
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }, children: [_jsx(Checkbox, { inputId: optionId(id, index), name: id, ...primeProps, value: option.value, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }), _jsx(Label, { id: optionId(id, index), text: option.label })] }, index));
|
|
32
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }, children: [_jsx(Checkbox, { inputId: optionId(id, index), name: htmlName || id, ...primeProps, value: option.value, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }), _jsx(Label, { id: optionId(id, index), text: option.label })] }, index));
|
|
33
33
|
})] }));
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=CheckboxesWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxesWidget.js","sourceRoot":"","sources":["../../src/CheckboxesWidget/CheckboxesWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAuB,MAAM,qBAAqB,CAAC;AACpE,OAAO,E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ACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,YAAY,IAAI,QAAQ,EAC9C,SAAS,EAAE,SAAS,IAAI,KAAK,KAAK,CAAC,EACnC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,EAC1B,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,sBACC,kBAAkB,CAAC,EAAE,CAAC,GACxC,EACF,KAAC,KAAK,IAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,GAAI,KAd9C,KAAK,CAeT,CACP,CAAC;gBACJ,CAAC,CAAC,IACA,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ButtonProps } from 'primereact/button';
|
|
1
2
|
import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
-
|
|
3
|
-
export default IconButton;
|
|
4
|
-
export declare function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
5
|
-
export declare function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
6
|
-
export declare function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
7
|
-
export declare function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
3
|
+
export type PrimeIconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = IconButtonProps<T, S, F> & Omit<ButtonProps, 'onClick'>;
|
|
4
|
+
export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: PrimeIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: PrimeIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: PrimeIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: PrimeIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: PrimeIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from 'primereact/button';
|
|
3
3
|
import { TranslatableString } from '@rjsf/utils';
|
|
4
|
-
function IconButton(props) {
|
|
4
|
+
export default function IconButton(props) {
|
|
5
5
|
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
6
6
|
return _jsx(Button, { icon: `pi pi-${icon}`, rounded: true, text: true, severity: 'secondary', ...otherProps });
|
|
7
7
|
}
|
|
8
|
-
export default IconButton;
|
|
9
8
|
export function CopyButton(props) {
|
|
10
9
|
const { registry: { translateString }, } = props;
|
|
11
10
|
return _jsx(IconButton, { title: translateString(TranslatableString.CopyButton), ...props, icon: 'copy' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAkE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAQjH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,KAAoC;I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,OAAO,GAAG,CAAC;AACzG,CAAC"}
|
|
@@ -7,12 +7,13 @@ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId,
|
|
|
7
7
|
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
8
8
|
*/
|
|
9
9
|
export default function ObjectFieldTemplate(props) {
|
|
10
|
-
const { description,
|
|
10
|
+
const { description, optionalDataControl, onAddProperty, title, properties, disabled, readonly, required, uiSchema, schema, formData, fieldPathId, registry, } = props;
|
|
11
11
|
const uiOptions = getUiOptions(uiSchema);
|
|
12
12
|
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
13
13
|
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
14
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
14
15
|
// Button templates are not overridden in the uiSchema
|
|
15
16
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
16
|
-
return (_jsxs(_Fragment, { children: [title && (_jsx(TitleFieldTemplate, { id: titleId(fieldPathId), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx("div", { style: { marginBottom: '1rem' }, children: _jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry }) })), properties.map((prop) => prop.content), canExpand(schema, uiSchema, formData) && (_jsx("div", { style: { marginTop: '1rem', textAlign: 'right' }, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', icon: 'pi pi-plus', onClick:
|
|
17
|
+
return (_jsxs(_Fragment, { children: [title && (_jsx(TitleFieldTemplate, { id: titleId(fieldPathId), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined })), description && (_jsx("div", { style: { marginBottom: '1rem' }, children: _jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry }) })), !showOptionalDataControlInTitle ? optionalDataControl : undefined, properties.map((prop) => prop.content), canExpand(schema, uiSchema, formData) && (_jsx("div", { style: { marginTop: '1rem', textAlign: 'right' }, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', icon: 'pi pi-plus', onClick: onAddProperty, disabled: disabled || readonly, registry: registry }) }))] }));
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=ObjectFieldTemplate.js.map
|