@rjsf/antd 6.0.1 → 6.1.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/dist/antd.esm.js +28 -87
- package/dist/antd.esm.js.map +4 -4
- package/dist/antd.umd.js +27 -85
- package/dist/index.cjs +28 -86
- package/dist/index.cjs.map +4 -4
- package/lib/templates/ArrayFieldItemTemplate/index.js +5 -3
- package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/index.js +1 -5
- package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
- package/lib/templates/FieldDescriptionTemplate/index.js.map +1 -0
- package/lib/templates/FieldHelpTemplate/index.d.ts +6 -0
- package/lib/templates/FieldHelpTemplate/index.js +15 -0
- package/lib/templates/FieldHelpTemplate/index.js.map +1 -0
- package/lib/templates/FieldTemplate/index.js +3 -2
- package/lib/templates/FieldTemplate/index.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate/index.js +4 -8
- package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -2
- package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
- package/lib/templates/index.js +1 -1
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/templates/ArrayFieldItemTemplate/index.tsx +5 -4
- package/src/templates/ArrayFieldTemplate/index.tsx +1 -21
- package/src/templates/FieldHelpTemplate/index.tsx +23 -0
- package/src/templates/FieldTemplate/index.tsx +5 -25
- package/src/templates/ObjectFieldTemplate/index.tsx +1 -23
- package/src/templates/WrapIfAdditionalTemplate/index.tsx +3 -2
- package/src/templates/index.ts +1 -1
- package/lib/templates/DescriptionField/index.js.map +0 -1
- /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.d.ts +0 -0
- /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.js +0 -0
- /package/src/templates/{DescriptionField → FieldDescriptionTemplate}/index.tsx +0 -0
package/dist/antd.esm.js
CHANGED
|
@@ -9,23 +9,25 @@ import {
|
|
|
9
9
|
} from "@rjsf/utils";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
var BTN_GRP_STYLE = {
|
|
12
|
-
width: "100%"
|
|
12
|
+
width: "100%",
|
|
13
|
+
justifyContent: "flex-end"
|
|
13
14
|
};
|
|
14
15
|
var BTN_STYLE = {
|
|
15
16
|
width: "calc(100% / 4)"
|
|
16
17
|
};
|
|
17
18
|
function ArrayFieldItemTemplate(props) {
|
|
18
|
-
const { children, buttonsProps, hasToolbar, index, registry, uiSchema } = props;
|
|
19
|
+
const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, index, registry, uiSchema } = props;
|
|
19
20
|
const uiOptions = getUiOptions(uiSchema);
|
|
20
21
|
const ArrayFieldItemButtonsTemplate = getTemplate(
|
|
21
22
|
"ArrayFieldItemButtonsTemplate",
|
|
22
23
|
registry,
|
|
23
24
|
uiOptions
|
|
24
25
|
);
|
|
25
|
-
const { rowGutter = 24, toolbarAlign = "top" } = registry.formContext;
|
|
26
|
+
const { rowGutter = 24, toolbarAlign = displayLabel ? "middle" : "top" } = registry.formContext;
|
|
27
|
+
const margin = hasDescription ? -8 : 16;
|
|
26
28
|
return /* @__PURE__ */ jsxs(Row, { align: toolbarAlign, gutter: rowGutter, children: [
|
|
27
29
|
/* @__PURE__ */ jsx(Col, { flex: "1", children }),
|
|
28
|
-
hasToolbar && /* @__PURE__ */ jsx(Col, { flex: "
|
|
30
|
+
hasToolbar && /* @__PURE__ */ jsx(Col, { flex: "120px", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsx(Space.Compact, { style: BTN_GRP_STYLE, children: /* @__PURE__ */ jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: BTN_STYLE }) }) })
|
|
29
31
|
] }, `rjsf-array-item-${index}`);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -39,9 +41,6 @@ import classNames from "classnames";
|
|
|
39
41
|
import { Col as Col2, Row as Row2, ConfigProvider } from "antd";
|
|
40
42
|
import { useContext } from "react";
|
|
41
43
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
42
|
-
var DESCRIPTION_COL_STYLE = {
|
|
43
|
-
paddingBottom: "8px"
|
|
44
|
-
};
|
|
45
44
|
function ArrayFieldTemplate(props) {
|
|
46
45
|
const {
|
|
47
46
|
canAdd,
|
|
@@ -59,11 +58,6 @@ function ArrayFieldTemplate(props) {
|
|
|
59
58
|
uiSchema
|
|
60
59
|
} = props;
|
|
61
60
|
const uiOptions = getUiOptions2(uiSchema);
|
|
62
|
-
const ArrayFieldDescriptionTemplate = getTemplate2(
|
|
63
|
-
"ArrayFieldDescriptionTemplate",
|
|
64
|
-
registry,
|
|
65
|
-
uiOptions
|
|
66
|
-
);
|
|
67
61
|
const ArrayFieldTitleTemplate = getTemplate2(
|
|
68
62
|
"ArrayFieldTitleTemplate",
|
|
69
63
|
registry,
|
|
@@ -96,21 +90,11 @@ function ArrayFieldTemplate(props) {
|
|
|
96
90
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
97
91
|
}
|
|
98
92
|
) }),
|
|
99
|
-
(uiOptions.description || schema.description) && /* @__PURE__ */ jsx2(Col2, { span: 24, style: DESCRIPTION_COL_STYLE, children: /* @__PURE__ */ jsx2(
|
|
100
|
-
ArrayFieldDescriptionTemplate,
|
|
101
|
-
{
|
|
102
|
-
description: uiOptions.description || schema.description,
|
|
103
|
-
fieldPathId,
|
|
104
|
-
schema,
|
|
105
|
-
uiSchema,
|
|
106
|
-
registry
|
|
107
|
-
}
|
|
108
|
-
) }),
|
|
109
93
|
/* @__PURE__ */ jsxs2(Col2, { className: "row array-item-list", span: 24, children: [
|
|
110
94
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
111
95
|
items
|
|
112
96
|
] }),
|
|
113
|
-
canAdd && /* @__PURE__ */ jsx2(Col2, { span: 24, children: /* @__PURE__ */ jsx2(Row2, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx2(Col2, { flex: "
|
|
97
|
+
canAdd && /* @__PURE__ */ jsx2(Col2, { span: 24, children: /* @__PURE__ */ jsx2(Row2, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx2(Col2, { flex: "120px", children: /* @__PURE__ */ jsx2(
|
|
114
98
|
AddButton2,
|
|
115
99
|
{
|
|
116
100
|
id: buttonId(fieldPathId, "add"),
|
|
@@ -200,7 +184,7 @@ function BaseInputTemplate(props) {
|
|
|
200
184
|
] });
|
|
201
185
|
}
|
|
202
186
|
|
|
203
|
-
// src/templates/
|
|
187
|
+
// src/templates/FieldDescriptionTemplate/index.tsx
|
|
204
188
|
import { RichDescription } from "@rjsf/core";
|
|
205
189
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
206
190
|
function DescriptionField(props) {
|
|
@@ -340,23 +324,16 @@ var VERTICAL_WRAPPER_COL = { span: 24 };
|
|
|
340
324
|
function FieldTemplate(props) {
|
|
341
325
|
const {
|
|
342
326
|
children,
|
|
343
|
-
classNames: classNames4,
|
|
344
|
-
style,
|
|
345
327
|
description,
|
|
346
|
-
disabled,
|
|
347
328
|
displayLabel,
|
|
348
329
|
errors,
|
|
349
330
|
help,
|
|
331
|
+
rawHelp,
|
|
350
332
|
hidden,
|
|
351
333
|
id,
|
|
352
334
|
label,
|
|
353
|
-
onKeyRename,
|
|
354
|
-
onKeyRenameBlur,
|
|
355
|
-
onRemoveProperty,
|
|
356
335
|
rawErrors,
|
|
357
336
|
rawDescription,
|
|
358
|
-
rawHelp,
|
|
359
|
-
readonly,
|
|
360
337
|
registry,
|
|
361
338
|
required,
|
|
362
339
|
schema,
|
|
@@ -390,41 +367,24 @@ function FieldTemplate(props) {
|
|
|
390
367
|
descriptionProps.extra = descriptionNode;
|
|
391
368
|
break;
|
|
392
369
|
}
|
|
393
|
-
|
|
394
|
-
|
|
370
|
+
const isCheckbox = uiOptions.widget === "checkbox";
|
|
371
|
+
return /* @__PURE__ */ jsx8(WrapIfAdditionalTemplate2, { ...props, children: /* @__PURE__ */ jsx8(
|
|
372
|
+
Form.Item,
|
|
395
373
|
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
id,
|
|
400
|
-
label,
|
|
401
|
-
|
|
402
|
-
onKeyRenameBlur,
|
|
403
|
-
onRemoveProperty,
|
|
404
|
-
readonly,
|
|
374
|
+
colon,
|
|
375
|
+
hasFeedback: schema.type !== "array" && schema.type !== "object",
|
|
376
|
+
help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
|
|
377
|
+
htmlFor: id,
|
|
378
|
+
label: displayLabel && !isCheckbox && label,
|
|
379
|
+
labelCol,
|
|
405
380
|
required,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
{
|
|
412
|
-
colon,
|
|
413
|
-
hasFeedback: schema.type !== "array" && schema.type !== "object",
|
|
414
|
-
help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
|
|
415
|
-
htmlFor: id,
|
|
416
|
-
label: displayLabel && label,
|
|
417
|
-
labelCol,
|
|
418
|
-
required,
|
|
419
|
-
style: wrapperStyle,
|
|
420
|
-
validateStatus: rawErrors?.length ? "error" : void 0,
|
|
421
|
-
wrapperCol,
|
|
422
|
-
...descriptionProps,
|
|
423
|
-
children
|
|
424
|
-
}
|
|
425
|
-
)
|
|
381
|
+
style: wrapperStyle,
|
|
382
|
+
validateStatus: rawErrors?.length ? "error" : void 0,
|
|
383
|
+
wrapperCol,
|
|
384
|
+
...descriptionProps,
|
|
385
|
+
children
|
|
426
386
|
}
|
|
427
|
-
);
|
|
387
|
+
) });
|
|
428
388
|
}
|
|
429
389
|
|
|
430
390
|
// src/templates/GridTemplate/index.tsx
|
|
@@ -455,7 +415,6 @@ import isNumber from "lodash/isNumber";
|
|
|
455
415
|
import isString from "lodash/isString";
|
|
456
416
|
import {
|
|
457
417
|
canExpand,
|
|
458
|
-
descriptionId,
|
|
459
418
|
getTemplate as getTemplate4,
|
|
460
419
|
getUiOptions as getUiOptions5,
|
|
461
420
|
titleId,
|
|
@@ -464,12 +423,8 @@ import {
|
|
|
464
423
|
import { Col as Col4, Row as Row4, ConfigProvider as ConfigProvider2 } from "antd";
|
|
465
424
|
import { useContext as useContext2 } from "react";
|
|
466
425
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
467
|
-
var DESCRIPTION_COL_STYLE2 = {
|
|
468
|
-
paddingBottom: "8px"
|
|
469
|
-
};
|
|
470
426
|
function ObjectFieldTemplate(props) {
|
|
471
427
|
const {
|
|
472
|
-
description,
|
|
473
428
|
disabled,
|
|
474
429
|
formData,
|
|
475
430
|
fieldPathId,
|
|
@@ -485,11 +440,6 @@ function ObjectFieldTemplate(props) {
|
|
|
485
440
|
} = props;
|
|
486
441
|
const uiOptions = getUiOptions5(uiSchema);
|
|
487
442
|
const TitleFieldTemplate = getTemplate4("TitleFieldTemplate", registry, uiOptions);
|
|
488
|
-
const DescriptionFieldTemplate = getTemplate4(
|
|
489
|
-
"DescriptionFieldTemplate",
|
|
490
|
-
registry,
|
|
491
|
-
uiOptions
|
|
492
|
-
);
|
|
493
443
|
const { formContext } = registry;
|
|
494
444
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
495
445
|
const {
|
|
@@ -546,20 +496,10 @@ function ObjectFieldTemplate(props) {
|
|
|
546
496
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
547
497
|
}
|
|
548
498
|
) }),
|
|
549
|
-
description && /* @__PURE__ */ jsx11(Col4, { span: 24, style: DESCRIPTION_COL_STYLE2, children: /* @__PURE__ */ jsx11(
|
|
550
|
-
DescriptionFieldTemplate,
|
|
551
|
-
{
|
|
552
|
-
id: descriptionId(fieldPathId),
|
|
553
|
-
description,
|
|
554
|
-
schema,
|
|
555
|
-
uiSchema,
|
|
556
|
-
registry
|
|
557
|
-
}
|
|
558
|
-
) }),
|
|
559
499
|
!showOptionalDataControlInTitle ? /* @__PURE__ */ jsx11(Col4, { span: 24, children: optionalDataControl }) : void 0,
|
|
560
500
|
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsx11(Col4, { span: calculateColSpan(element), children: element.content }, element.name))
|
|
561
501
|
] }),
|
|
562
|
-
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx11(Col4, { span: 24, children: /* @__PURE__ */ jsx11(Row4, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx11(Col4, { flex: "
|
|
502
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx11(Col4, { span: 24, children: /* @__PURE__ */ jsx11(Row4, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsx11(Col4, { flex: "120px", children: /* @__PURE__ */ jsx11(
|
|
563
503
|
AddButton2,
|
|
564
504
|
{
|
|
565
505
|
id: buttonId2(fieldPathId, "add"),
|
|
@@ -699,6 +639,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
699
639
|
classNames: classNames4,
|
|
700
640
|
style,
|
|
701
641
|
disabled,
|
|
642
|
+
displayLabel,
|
|
702
643
|
id,
|
|
703
644
|
label,
|
|
704
645
|
onRemoveProperty,
|
|
@@ -738,7 +679,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
738
679
|
className: "form-group",
|
|
739
680
|
hasFeedback: true,
|
|
740
681
|
htmlFor: `${id}-key`,
|
|
741
|
-
label: keyLabel,
|
|
682
|
+
label: displayLabel ? keyLabel : void 0,
|
|
742
683
|
labelCol,
|
|
743
684
|
required,
|
|
744
685
|
style: wrapperStyle,
|
|
@@ -759,7 +700,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
759
700
|
}
|
|
760
701
|
) }) }),
|
|
761
702
|
/* @__PURE__ */ jsx15(Col6, { className: "form-additional", flex: "1", children }),
|
|
762
|
-
/* @__PURE__ */ jsx15(Col6, { flex: "
|
|
703
|
+
/* @__PURE__ */ jsx15(Col6, { flex: "120px", style: { marginTop: displayLabel ? "40px" : void 0 }, children: /* @__PURE__ */ jsx15(
|
|
763
704
|
RemoveButton2,
|
|
764
705
|
{
|
|
765
706
|
id: buttonId3(id, "remove"),
|