@rjsf/react-bootstrap 6.0.0-beta.9 → 6.0.0
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/README.md +2 -0
- package/dist/{index.js → index.cjs} +178 -86
- package/dist/index.cjs.map +7 -0
- package/dist/react-bootstrap.esm.js +177 -85
- package/dist/react-bootstrap.esm.js.map +4 -4
- package/dist/react-bootstrap.umd.js +125 -44
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -4
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +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.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -2
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +2 -2
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/IconButton/IconButton.d.ts +6 -5
- package/lib/IconButton/IconButton.js +1 -1
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
- package/lib/MultiSchemaFieldTemplate/index.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/index.js +3 -0
- package/lib/MultiSchemaFieldTemplate/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +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 +22 -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.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +2 -2
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +2 -2
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/Templates/Templates.js +4 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +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 +9 -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 +16 -16
- package/src/AddButton/AddButton.tsx +1 -1
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -2
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +22 -16
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +5 -4
- package/src/CheckboxWidget/CheckboxWidget.tsx +4 -3
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +15 -3
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -2
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -2
- package/src/FieldTemplate/FieldTemplate.tsx +6 -4
- package/src/IconButton/IconButton.tsx +12 -6
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +15 -0
- package/src/MultiSchemaFieldTemplate/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +10 -6
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +47 -0
- package/src/OptionalDataControlsTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +3 -2
- package/src/SelectWidget/SelectWidget.tsx +3 -2
- package/src/Templates/Templates.ts +4 -0
- package/src/TextareaWidget/TextareaWidget.tsx +3 -2
- package/src/TitleField/TitleField.tsx +19 -2
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +5 -7
- package/dist/index.js.map +0 -7
package/README.md
CHANGED
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
|
|
42
42
|
Exports `react-bootstrap` theme, fields and widgets for `react-jsonschema-form`.
|
|
43
43
|
|
|
44
|
+
[<img src="./screenshot.png" alt="product-screenshot" width="800" />](https://rjsf-team.github.io/@rjsf/react-bootstrap)
|
|
45
|
+
|
|
44
46
|
### Built With
|
|
45
47
|
|
|
46
48
|
- [react-jsonschema-form](https://github.com/mozilla-services/react-jsonschema-form/)
|
|
@@ -59,10 +59,10 @@ function AddButton({
|
|
|
59
59
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
60
|
import_Button.default,
|
|
61
61
|
{
|
|
62
|
+
title: translateString(import_utils.TranslatableString.AddItemButton),
|
|
62
63
|
...props,
|
|
63
64
|
style: { width: "100%" },
|
|
64
65
|
className: `ml-1 ${props.className}`,
|
|
65
|
-
title: translateString(import_utils.TranslatableString.AddItemButton),
|
|
66
66
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BsPlus.BsPlus, {})
|
|
67
67
|
}
|
|
68
68
|
);
|
|
@@ -100,23 +100,32 @@ var import_Container = __toESM(require("react-bootstrap/Container"), 1);
|
|
|
100
100
|
var import_utils3 = require("@rjsf/utils");
|
|
101
101
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
102
102
|
function ArrayFieldTemplate(props) {
|
|
103
|
-
const {
|
|
103
|
+
const {
|
|
104
|
+
canAdd,
|
|
105
|
+
disabled,
|
|
106
|
+
fieldPathId,
|
|
107
|
+
uiSchema,
|
|
108
|
+
items,
|
|
109
|
+
optionalDataControl,
|
|
110
|
+
onAddClick,
|
|
111
|
+
readonly,
|
|
112
|
+
registry,
|
|
113
|
+
required,
|
|
114
|
+
schema,
|
|
115
|
+
title
|
|
116
|
+
} = props;
|
|
104
117
|
const uiOptions = (0, import_utils3.getUiOptions)(uiSchema);
|
|
105
118
|
const ArrayFieldDescriptionTemplate = (0, import_utils3.getTemplate)(
|
|
106
119
|
"ArrayFieldDescriptionTemplate",
|
|
107
120
|
registry,
|
|
108
121
|
uiOptions
|
|
109
122
|
);
|
|
110
|
-
const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
|
|
111
|
-
"ArrayFieldItemTemplate",
|
|
112
|
-
registry,
|
|
113
|
-
uiOptions
|
|
114
|
-
);
|
|
115
123
|
const ArrayFieldTitleTemplate = (0, import_utils3.getTemplate)(
|
|
116
124
|
"ArrayFieldTitleTemplate",
|
|
117
125
|
registry,
|
|
118
126
|
uiOptions
|
|
119
127
|
);
|
|
128
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
120
129
|
const {
|
|
121
130
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
122
131
|
} = registry.templates;
|
|
@@ -124,18 +133,19 @@ function ArrayFieldTemplate(props) {
|
|
|
124
133
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
125
134
|
ArrayFieldTitleTemplate,
|
|
126
135
|
{
|
|
127
|
-
|
|
136
|
+
fieldPathId,
|
|
128
137
|
title: uiOptions.title || title,
|
|
129
138
|
schema,
|
|
130
139
|
uiSchema,
|
|
131
140
|
required,
|
|
132
|
-
registry
|
|
141
|
+
registry,
|
|
142
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
133
143
|
}
|
|
134
144
|
),
|
|
135
145
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
136
146
|
ArrayFieldDescriptionTemplate,
|
|
137
147
|
{
|
|
138
|
-
|
|
148
|
+
fieldPathId,
|
|
139
149
|
description: uiOptions.description || schema.description,
|
|
140
150
|
schema,
|
|
141
151
|
uiSchema,
|
|
@@ -143,13 +153,14 @@ function ArrayFieldTemplate(props) {
|
|
|
143
153
|
}
|
|
144
154
|
),
|
|
145
155
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_Container.default, { fluid: true, className: "p-0 m-0", children: [
|
|
146
|
-
|
|
156
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
157
|
+
items,
|
|
147
158
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Container.default, { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_Row2.default, { className: "mt-2", children: [
|
|
148
159
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Col2.default, { xs: 9 }),
|
|
149
160
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Col2.default, { xs: 3, className: "py-4 col-lg-3 col-3", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
150
161
|
AddButton2,
|
|
151
162
|
{
|
|
152
|
-
id: (0, import_utils3.buttonId)(
|
|
163
|
+
id: (0, import_utils3.buttonId)(fieldPathId, "add"),
|
|
153
164
|
className: "rjsf-array-item-add",
|
|
154
165
|
onClick: onAddClick,
|
|
155
166
|
disabled: disabled || readonly,
|
|
@@ -158,7 +169,7 @@ function ArrayFieldTemplate(props) {
|
|
|
158
169
|
}
|
|
159
170
|
) })
|
|
160
171
|
] }) })
|
|
161
|
-
] }, `array-item-list-${
|
|
172
|
+
] }, `array-item-list-${fieldPathId.$id}`)
|
|
162
173
|
] }) }) });
|
|
163
174
|
}
|
|
164
175
|
|
|
@@ -168,6 +179,7 @@ var import_utils4 = require("@rjsf/utils");
|
|
|
168
179
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
169
180
|
function BaseInputTemplate({
|
|
170
181
|
id,
|
|
182
|
+
htmlName,
|
|
171
183
|
placeholder,
|
|
172
184
|
required,
|
|
173
185
|
readonly,
|
|
@@ -197,7 +209,7 @@ function BaseInputTemplate({
|
|
|
197
209
|
import_Form.default.Control,
|
|
198
210
|
{
|
|
199
211
|
id,
|
|
200
|
-
name: id,
|
|
212
|
+
name: htmlName || id,
|
|
201
213
|
placeholder,
|
|
202
214
|
autoFocus: autofocus,
|
|
203
215
|
required,
|
|
@@ -286,8 +298,8 @@ function RemoveButton(props) {
|
|
|
286
298
|
IconButton,
|
|
287
299
|
{
|
|
288
300
|
title: translateString(import_utils6.TranslatableString.RemoveButton),
|
|
289
|
-
...props,
|
|
290
301
|
variant: "danger",
|
|
302
|
+
...props,
|
|
291
303
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_IoIosRemove.IoIosRemove, {})
|
|
292
304
|
}
|
|
293
305
|
);
|
|
@@ -298,11 +310,11 @@ var import_utils7 = require("@rjsf/utils");
|
|
|
298
310
|
var import_ListGroup2 = __toESM(require("react-bootstrap/ListGroup"), 1);
|
|
299
311
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
300
312
|
function FieldErrorTemplate(props) {
|
|
301
|
-
const { errors = [],
|
|
313
|
+
const { errors = [], fieldPathId } = props;
|
|
302
314
|
if (errors.length === 0) {
|
|
303
315
|
return null;
|
|
304
316
|
}
|
|
305
|
-
const id = (0, import_utils7.errorId)(
|
|
317
|
+
const id = (0, import_utils7.errorId)(fieldPathId);
|
|
306
318
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ListGroup2.default, { as: "ul", id, children: errors.map((error, i) => {
|
|
307
319
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ListGroup2.default.Item, { as: "li", className: "border-0 m-0 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { className: "m-0 text-danger", children: error }) }, i);
|
|
308
320
|
}) });
|
|
@@ -313,11 +325,11 @@ var import_utils8 = require("@rjsf/utils");
|
|
|
313
325
|
var import_Form2 = __toESM(require("react-bootstrap/Form"), 1);
|
|
314
326
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
315
327
|
function FieldHelpTemplate(props) {
|
|
316
|
-
const {
|
|
328
|
+
const { fieldPathId, help, hasErrors } = props;
|
|
317
329
|
if (!help) {
|
|
318
330
|
return null;
|
|
319
331
|
}
|
|
320
|
-
const id = (0, import_utils8.helpId)(
|
|
332
|
+
const id = (0, import_utils8.helpId)(fieldPathId);
|
|
321
333
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Form2.default.Text, { className: hasErrors ? "text-danger" : "text-muted", id, children: help });
|
|
322
334
|
}
|
|
323
335
|
|
|
@@ -339,8 +351,9 @@ function FieldTemplate({
|
|
|
339
351
|
disabled,
|
|
340
352
|
label,
|
|
341
353
|
hidden,
|
|
342
|
-
|
|
343
|
-
|
|
354
|
+
onKeyRename,
|
|
355
|
+
onKeyRenameBlur,
|
|
356
|
+
onRemoveProperty,
|
|
344
357
|
readonly,
|
|
345
358
|
required,
|
|
346
359
|
schema,
|
|
@@ -364,8 +377,9 @@ function FieldTemplate({
|
|
|
364
377
|
disabled,
|
|
365
378
|
id,
|
|
366
379
|
label,
|
|
367
|
-
|
|
368
|
-
|
|
380
|
+
onKeyRename,
|
|
381
|
+
onKeyRenameBlur,
|
|
382
|
+
onRemoveProperty,
|
|
369
383
|
readonly,
|
|
370
384
|
required,
|
|
371
385
|
schema,
|
|
@@ -397,22 +411,33 @@ function GridTemplate(props) {
|
|
|
397
411
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Row3.default, { ...rest, children });
|
|
398
412
|
}
|
|
399
413
|
|
|
414
|
+
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
415
|
+
var import_Card2 = __toESM(require("react-bootstrap/Card"), 1);
|
|
416
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
417
|
+
function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_Card2.default, { style: { marginBottom: "1rem" }, children: [
|
|
419
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Card2.default.Body, { children: selector }),
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Card2.default.Body, { children: optionSchemaField })
|
|
421
|
+
] });
|
|
422
|
+
}
|
|
423
|
+
|
|
400
424
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
401
425
|
var import_Row4 = __toESM(require("react-bootstrap/Row"), 1);
|
|
402
426
|
var import_Col4 = __toESM(require("react-bootstrap/Col"), 1);
|
|
403
427
|
var import_Container2 = __toESM(require("react-bootstrap/Container"), 1);
|
|
404
428
|
var import_utils10 = require("@rjsf/utils");
|
|
405
|
-
var
|
|
429
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
406
430
|
function ObjectFieldTemplate({
|
|
407
431
|
description,
|
|
408
432
|
title,
|
|
409
433
|
properties,
|
|
410
434
|
required,
|
|
411
435
|
uiSchema,
|
|
412
|
-
|
|
436
|
+
fieldPathId,
|
|
413
437
|
schema,
|
|
414
438
|
formData,
|
|
415
|
-
|
|
439
|
+
optionalDataControl,
|
|
440
|
+
onAddProperty,
|
|
416
441
|
disabled,
|
|
417
442
|
readonly,
|
|
418
443
|
registry
|
|
@@ -424,41 +449,44 @@ function ObjectFieldTemplate({
|
|
|
424
449
|
registry,
|
|
425
450
|
uiOptions
|
|
426
451
|
);
|
|
452
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
427
453
|
const {
|
|
428
454
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
429
455
|
} = registry.templates;
|
|
430
|
-
return /* @__PURE__ */ (0,
|
|
431
|
-
title && /* @__PURE__ */ (0,
|
|
456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
457
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
432
458
|
TitleFieldTemplate,
|
|
433
459
|
{
|
|
434
|
-
id: (0, import_utils10.titleId)(
|
|
460
|
+
id: (0, import_utils10.titleId)(fieldPathId),
|
|
435
461
|
title,
|
|
436
462
|
required,
|
|
437
463
|
schema,
|
|
438
464
|
uiSchema,
|
|
439
|
-
registry
|
|
465
|
+
registry,
|
|
466
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
440
467
|
}
|
|
441
468
|
),
|
|
442
|
-
description && /* @__PURE__ */ (0,
|
|
469
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
443
470
|
DescriptionFieldTemplate,
|
|
444
471
|
{
|
|
445
|
-
id: (0, import_utils10.descriptionId)(
|
|
472
|
+
id: (0, import_utils10.descriptionId)(fieldPathId),
|
|
446
473
|
description,
|
|
447
474
|
schema,
|
|
448
475
|
uiSchema,
|
|
449
476
|
registry
|
|
450
477
|
}
|
|
451
478
|
),
|
|
452
|
-
/* @__PURE__ */ (0,
|
|
453
|
-
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Container2.default, { fluid: true, className: "p-0", children: [
|
|
480
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
481
|
+
properties.map((element, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Row4.default, { style: { marginBottom: "10px" }, className: element.hidden ? "d-none" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Col4.default, { xs: 12, children: [
|
|
454
482
|
" ",
|
|
455
483
|
element.content
|
|
456
484
|
] }) }, index)),
|
|
457
|
-
(0, import_utils10.canExpand)(schema, uiSchema, formData) ? /* @__PURE__ */ (0,
|
|
485
|
+
(0, import_utils10.canExpand)(schema, uiSchema, formData) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Row4.default, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Col4.default, { xs: { offset: 9, span: 3 }, className: "py-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
458
486
|
AddButton2,
|
|
459
487
|
{
|
|
460
|
-
id: (0, import_utils10.buttonId)(
|
|
461
|
-
onClick:
|
|
488
|
+
id: (0, import_utils10.buttonId)(fieldPathId, "add"),
|
|
489
|
+
onClick: onAddProperty,
|
|
462
490
|
disabled: disabled || readonly,
|
|
463
491
|
className: "rjsf-object-property-expand",
|
|
464
492
|
uiSchema,
|
|
@@ -469,39 +497,86 @@ function ObjectFieldTemplate({
|
|
|
469
497
|
] });
|
|
470
498
|
}
|
|
471
499
|
|
|
500
|
+
// src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
|
|
501
|
+
var import_BsPlus2 = require("@react-icons/all-files/bs/BsPlus");
|
|
502
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
503
|
+
function OptionalDataControlsTemplate(props) {
|
|
504
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
505
|
+
if (onAddClick) {
|
|
506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
507
|
+
IconButton,
|
|
508
|
+
{
|
|
509
|
+
id,
|
|
510
|
+
registry,
|
|
511
|
+
className: "rjsf-add-optional-data",
|
|
512
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_BsPlus2.BsPlus, {}),
|
|
513
|
+
onClick: onAddClick,
|
|
514
|
+
title: label,
|
|
515
|
+
size: "sm",
|
|
516
|
+
variant: "secondary"
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
} else if (onRemoveClick) {
|
|
520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
521
|
+
RemoveButton,
|
|
522
|
+
{
|
|
523
|
+
id,
|
|
524
|
+
registry,
|
|
525
|
+
className: "rjsf-remove-optional-data",
|
|
526
|
+
onClick: onRemoveClick,
|
|
527
|
+
title: label,
|
|
528
|
+
size: "sm",
|
|
529
|
+
variant: "secondary"
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("em", { id, children: label });
|
|
534
|
+
}
|
|
535
|
+
|
|
472
536
|
// src/SubmitButton/SubmitButton.tsx
|
|
473
537
|
var import_Button3 = __toESM(require("react-bootstrap/Button"), 1);
|
|
474
538
|
var import_utils11 = require("@rjsf/utils");
|
|
475
|
-
var
|
|
539
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
476
540
|
function SubmitButton(props) {
|
|
477
541
|
const { submitText, norender, props: submitButtonProps } = (0, import_utils11.getSubmitButtonOptions)(props.uiSchema);
|
|
478
542
|
if (norender) {
|
|
479
543
|
return null;
|
|
480
544
|
}
|
|
481
|
-
return /* @__PURE__ */ (0,
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Button3.default, { variant: "primary", type: "submit", ...submitButtonProps, children: submitText }) });
|
|
482
546
|
}
|
|
483
547
|
|
|
484
548
|
// src/TitleField/TitleField.tsx
|
|
485
549
|
var import_utils12 = require("@rjsf/utils");
|
|
486
|
-
var
|
|
550
|
+
var import_Row5 = __toESM(require("react-bootstrap/Row"), 1);
|
|
551
|
+
var import_Col5 = __toESM(require("react-bootstrap/Col"), 1);
|
|
552
|
+
var import_Container3 = __toESM(require("react-bootstrap/Container"), 1);
|
|
553
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
487
554
|
function TitleField({
|
|
488
555
|
id,
|
|
489
556
|
title,
|
|
490
|
-
uiSchema
|
|
557
|
+
uiSchema,
|
|
558
|
+
optionalDataControl
|
|
491
559
|
}) {
|
|
492
560
|
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
/* @__PURE__ */ (0,
|
|
561
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h5", { children: uiOptions.title || title });
|
|
562
|
+
if (optionalDataControl) {
|
|
563
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Container3.default, { fluid: true, className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Row5.default, { children: [
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Col5.default, { xs: "11", children: heading }),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Col5.default, { xs: "1", style: { marginLeft: "-5px" }, children: optionalDataControl })
|
|
566
|
+
] }) });
|
|
567
|
+
}
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id, className: "my-1", children: [
|
|
569
|
+
heading,
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("hr", { className: "border-0 bg-secondary mt-0", style: { height: "1px" } })
|
|
496
571
|
] });
|
|
497
572
|
}
|
|
498
573
|
|
|
499
574
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
500
575
|
var import_utils13 = require("@rjsf/utils");
|
|
501
|
-
var
|
|
502
|
-
var
|
|
576
|
+
var import_Row6 = __toESM(require("react-bootstrap/Row"), 1);
|
|
577
|
+
var import_Col6 = __toESM(require("react-bootstrap/Col"), 1);
|
|
503
578
|
var import_Form4 = __toESM(require("react-bootstrap/Form"), 1);
|
|
504
|
-
var
|
|
579
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
505
580
|
function WrapIfAdditionalTemplate({
|
|
506
581
|
classNames,
|
|
507
582
|
style,
|
|
@@ -509,8 +584,8 @@ function WrapIfAdditionalTemplate({
|
|
|
509
584
|
disabled,
|
|
510
585
|
id,
|
|
511
586
|
label,
|
|
512
|
-
|
|
513
|
-
|
|
587
|
+
onRemoveProperty,
|
|
588
|
+
onKeyRenameBlur,
|
|
514
589
|
readonly,
|
|
515
590
|
required,
|
|
516
591
|
schema,
|
|
@@ -522,14 +597,13 @@ function WrapIfAdditionalTemplate({
|
|
|
522
597
|
const keyLabel = translateString(import_utils13.TranslatableString.KeyLabel, [label]);
|
|
523
598
|
const additional = import_utils13.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
524
599
|
if (!additional) {
|
|
525
|
-
return /* @__PURE__ */ (0,
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
|
|
526
601
|
}
|
|
527
|
-
const handleBlur = ({ target }) => onKeyChange(target.value);
|
|
528
602
|
const keyId = `${id}-key`;
|
|
529
|
-
return /* @__PURE__ */ (0,
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
531
|
-
/* @__PURE__ */ (0,
|
|
532
|
-
/* @__PURE__ */ (0,
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Row6.default, { className: classNames, style, children: [
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Col6.default, { xs: 5, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Form4.default.Group, { children: [
|
|
605
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Form4.default.Label, { htmlFor: keyId, children: keyLabel }),
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
533
607
|
import_Form4.default.Control,
|
|
534
608
|
{
|
|
535
609
|
required,
|
|
@@ -537,19 +611,19 @@ function WrapIfAdditionalTemplate({
|
|
|
537
611
|
disabled: disabled || readonly,
|
|
538
612
|
id: keyId,
|
|
539
613
|
name: keyId,
|
|
540
|
-
onBlur: !readonly ?
|
|
614
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
541
615
|
type: "text"
|
|
542
616
|
}
|
|
543
617
|
)
|
|
544
618
|
] }) }),
|
|
545
|
-
/* @__PURE__ */ (0,
|
|
546
|
-
/* @__PURE__ */ (0,
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Col6.default, { xs: 5, children }),
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Col6.default, { xs: 2, className: "py-4 d-grid gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
547
621
|
RemoveButton2,
|
|
548
622
|
{
|
|
549
623
|
id: (0, import_utils13.buttonId)(id, "remove"),
|
|
550
624
|
className: "rjsf-object-property-remove w-100",
|
|
551
625
|
disabled: disabled || readonly,
|
|
552
|
-
onClick:
|
|
626
|
+
onClick: onRemoveProperty,
|
|
553
627
|
uiSchema,
|
|
554
628
|
registry
|
|
555
629
|
}
|
|
@@ -577,7 +651,9 @@ function generateTemplates() {
|
|
|
577
651
|
FieldHelpTemplate,
|
|
578
652
|
FieldTemplate,
|
|
579
653
|
GridTemplate,
|
|
654
|
+
MultiSchemaFieldTemplate,
|
|
580
655
|
ObjectFieldTemplate,
|
|
656
|
+
OptionalDataControlsTemplate,
|
|
581
657
|
TitleFieldTemplate: TitleField,
|
|
582
658
|
WrapIfAdditionalTemplate
|
|
583
659
|
};
|
|
@@ -587,10 +663,11 @@ var Templates_default = generateTemplates();
|
|
|
587
663
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
588
664
|
var import_utils14 = require("@rjsf/utils");
|
|
589
665
|
var import_Form5 = __toESM(require("react-bootstrap/Form"), 1);
|
|
590
|
-
var
|
|
666
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
591
667
|
function CheckboxWidget(props) {
|
|
592
668
|
const {
|
|
593
669
|
id,
|
|
670
|
+
htmlName,
|
|
594
671
|
value,
|
|
595
672
|
disabled,
|
|
596
673
|
readonly,
|
|
@@ -615,8 +692,8 @@ function CheckboxWidget(props) {
|
|
|
615
692
|
const _onBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
616
693
|
const _onFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
617
694
|
const description = options.description || schema.description;
|
|
618
|
-
return /* @__PURE__ */ (0,
|
|
619
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Form5.default.Group, { className: disabled || readonly ? "disabled" : "", "aria-describedby": (0, import_utils14.ariaDescribedByIds)(id), children: [
|
|
696
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
620
697
|
DescriptionFieldTemplate,
|
|
621
698
|
{
|
|
622
699
|
id: (0, import_utils14.descriptionId)(id),
|
|
@@ -626,11 +703,11 @@ function CheckboxWidget(props) {
|
|
|
626
703
|
registry
|
|
627
704
|
}
|
|
628
705
|
),
|
|
629
|
-
/* @__PURE__ */ (0,
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
630
707
|
import_Form5.default.Check,
|
|
631
708
|
{
|
|
632
709
|
id,
|
|
633
|
-
name: id,
|
|
710
|
+
name: htmlName || id,
|
|
634
711
|
label: (0, import_utils14.labelValue)(label, hideLabel || !label),
|
|
635
712
|
checked: typeof value === "undefined" ? false : value,
|
|
636
713
|
required,
|
|
@@ -648,8 +725,20 @@ function CheckboxWidget(props) {
|
|
|
648
725
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
649
726
|
var import_Form6 = __toESM(require("react-bootstrap/Form"), 1);
|
|
650
727
|
var import_utils15 = require("@rjsf/utils");
|
|
651
|
-
var
|
|
652
|
-
function CheckboxesWidget({
|
|
728
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
729
|
+
function CheckboxesWidget({
|
|
730
|
+
id,
|
|
731
|
+
htmlName,
|
|
732
|
+
disabled,
|
|
733
|
+
options,
|
|
734
|
+
value,
|
|
735
|
+
autofocus,
|
|
736
|
+
readonly,
|
|
737
|
+
required,
|
|
738
|
+
onChange,
|
|
739
|
+
onBlur,
|
|
740
|
+
onFocus
|
|
741
|
+
}) {
|
|
653
742
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
654
743
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
655
744
|
const _onChange = (index) => ({ target: { checked } }) => {
|
|
@@ -661,10 +750,10 @@ function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, r
|
|
|
661
750
|
};
|
|
662
751
|
const _onBlur = ({ target }) => onBlur(id, (0, import_utils15.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
663
752
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils15.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
664
|
-
return /* @__PURE__ */ (0,
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_Form6.default.Group, { children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
665
754
|
const checked = (0, import_utils15.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
666
755
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
667
|
-
return /* @__PURE__ */ (0,
|
|
756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
668
757
|
import_Form6.default.Check,
|
|
669
758
|
{
|
|
670
759
|
inline,
|
|
@@ -673,7 +762,7 @@ function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, r
|
|
|
673
762
|
className: "bg-transparent border-0",
|
|
674
763
|
type: "checkbox",
|
|
675
764
|
id: (0, import_utils15.optionId)(id, index),
|
|
676
|
-
name: id,
|
|
765
|
+
name: htmlName || id,
|
|
677
766
|
label: option.label,
|
|
678
767
|
autoFocus: autofocus && index === 0,
|
|
679
768
|
onChange: _onChange(index),
|
|
@@ -690,9 +779,10 @@ function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, r
|
|
|
690
779
|
// src/RadioWidget/RadioWidget.tsx
|
|
691
780
|
var import_Form7 = __toESM(require("react-bootstrap/Form"), 1);
|
|
692
781
|
var import_utils16 = require("@rjsf/utils");
|
|
693
|
-
var
|
|
782
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
694
783
|
function RadioWidget({
|
|
695
784
|
id,
|
|
785
|
+
htmlName,
|
|
696
786
|
options,
|
|
697
787
|
value,
|
|
698
788
|
required,
|
|
@@ -707,16 +797,16 @@ function RadioWidget({
|
|
|
707
797
|
const _onBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
708
798
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
709
799
|
const inline = Boolean(options && options.inline);
|
|
710
|
-
return /* @__PURE__ */ (0,
|
|
800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Form7.default.Group, { className: "mb-0", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
711
801
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
712
802
|
const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, value);
|
|
713
|
-
const radio = /* @__PURE__ */ (0,
|
|
803
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
714
804
|
import_Form7.default.Check,
|
|
715
805
|
{
|
|
716
806
|
inline,
|
|
717
807
|
label: option.label,
|
|
718
808
|
id: (0, import_utils16.optionId)(id, index),
|
|
719
|
-
name: id,
|
|
809
|
+
name: htmlName || id,
|
|
720
810
|
type: "radio",
|
|
721
811
|
disabled: disabled || itemDisabled || readonly,
|
|
722
812
|
checked,
|
|
@@ -736,7 +826,7 @@ function RadioWidget({
|
|
|
736
826
|
// src/RangeWidget/RangeWidget.tsx
|
|
737
827
|
var import_utils17 = require("@rjsf/utils");
|
|
738
828
|
var import_FormRange = __toESM(require("react-bootstrap/FormRange"), 1);
|
|
739
|
-
var
|
|
829
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
740
830
|
function RangeWidget(props) {
|
|
741
831
|
const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
|
|
742
832
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2);
|
|
@@ -752,19 +842,20 @@ function RangeWidget(props) {
|
|
|
752
842
|
onFocus: _onFocus,
|
|
753
843
|
...(0, import_utils17.rangeSpec)(schema)
|
|
754
844
|
};
|
|
755
|
-
return /* @__PURE__ */ (0,
|
|
756
|
-
/* @__PURE__ */ (0,
|
|
757
|
-
/* @__PURE__ */ (0,
|
|
845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_FormRange.default, { ...rangeProps }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "range-view", children: value })
|
|
758
848
|
] });
|
|
759
849
|
}
|
|
760
850
|
|
|
761
851
|
// src/SelectWidget/SelectWidget.tsx
|
|
762
852
|
var import_FormSelect = __toESM(require("react-bootstrap/FormSelect"), 1);
|
|
763
853
|
var import_utils18 = require("@rjsf/utils");
|
|
764
|
-
var
|
|
854
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
765
855
|
function SelectWidget({
|
|
766
856
|
schema,
|
|
767
857
|
id,
|
|
858
|
+
htmlName,
|
|
768
859
|
options,
|
|
769
860
|
required,
|
|
770
861
|
disabled,
|
|
@@ -789,11 +880,11 @@ function SelectWidget({
|
|
|
789
880
|
}
|
|
790
881
|
const selectedIndexes = (0, import_utils18.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
791
882
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
792
|
-
return /* @__PURE__ */ (0,
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
793
884
|
import_FormSelect.default,
|
|
794
885
|
{
|
|
795
886
|
id,
|
|
796
|
-
name: id,
|
|
887
|
+
name: htmlName || id,
|
|
797
888
|
value: typeof selectedIndexes === "undefined" ? emptyValue : selectedIndexes,
|
|
798
889
|
required,
|
|
799
890
|
multiple,
|
|
@@ -814,10 +905,10 @@ function SelectWidget({
|
|
|
814
905
|
},
|
|
815
906
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
816
907
|
children: [
|
|
817
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
908
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: placeholder }),
|
|
818
909
|
enumOptions.map(({ value: value2, label }, i) => {
|
|
819
910
|
const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) != -1;
|
|
820
|
-
return /* @__PURE__ */ (0,
|
|
911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { id: label, value: String(i), disabled: disabled2, children: label }, i);
|
|
821
912
|
})
|
|
822
913
|
]
|
|
823
914
|
}
|
|
@@ -828,9 +919,10 @@ function SelectWidget({
|
|
|
828
919
|
var import_utils19 = require("@rjsf/utils");
|
|
829
920
|
var import_FormControl = __toESM(require("react-bootstrap/FormControl"), 1);
|
|
830
921
|
var import_InputGroup = __toESM(require("react-bootstrap/InputGroup"), 1);
|
|
831
|
-
var
|
|
922
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
832
923
|
function TextareaWidget({
|
|
833
924
|
id,
|
|
925
|
+
htmlName,
|
|
834
926
|
placeholder,
|
|
835
927
|
value,
|
|
836
928
|
required,
|
|
@@ -845,11 +937,11 @@ function TextareaWidget({
|
|
|
845
937
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
846
938
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
847
939
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
848
|
-
return /* @__PURE__ */ (0,
|
|
940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_InputGroup.default, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
849
941
|
import_FormControl.default,
|
|
850
942
|
{
|
|
851
943
|
id,
|
|
852
|
-
name: id,
|
|
944
|
+
name: htmlName || id,
|
|
853
945
|
as: "textarea",
|
|
854
946
|
placeholder,
|
|
855
947
|
disabled,
|
|
@@ -896,4 +988,4 @@ var Form_default = generateForm();
|
|
|
896
988
|
|
|
897
989
|
// src/index.ts
|
|
898
990
|
var index_default = Form_default;
|
|
899
|
-
//# sourceMappingURL=index.
|
|
991
|
+
//# sourceMappingURL=index.cjs.map
|