@rjsf/antd 6.0.2 → 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.
Files changed (32) hide show
  1. package/dist/antd.esm.js +27 -49
  2. package/dist/antd.esm.js.map +4 -4
  3. package/dist/antd.umd.js +26 -48
  4. package/dist/index.cjs +27 -49
  5. package/dist/index.cjs.map +4 -4
  6. package/lib/templates/ArrayFieldItemTemplate/index.js +5 -3
  7. package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
  8. package/lib/templates/ArrayFieldTemplate/index.js +1 -1
  9. package/lib/templates/FieldDescriptionTemplate/index.js.map +1 -0
  10. package/lib/templates/FieldHelpTemplate/index.d.ts +6 -0
  11. package/lib/templates/FieldHelpTemplate/index.js +15 -0
  12. package/lib/templates/FieldHelpTemplate/index.js.map +1 -0
  13. package/lib/templates/FieldTemplate/index.js +2 -2
  14. package/lib/templates/FieldTemplate/index.js.map +1 -1
  15. package/lib/templates/ObjectFieldTemplate/index.js +1 -1
  16. package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -2
  17. package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
  18. package/lib/templates/index.js +1 -1
  19. package/lib/templates/index.js.map +1 -1
  20. package/lib/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +1 -1
  22. package/src/templates/ArrayFieldItemTemplate/index.tsx +5 -4
  23. package/src/templates/ArrayFieldTemplate/index.tsx +1 -1
  24. package/src/templates/FieldHelpTemplate/index.tsx +23 -0
  25. package/src/templates/FieldTemplate/index.tsx +2 -23
  26. package/src/templates/ObjectFieldTemplate/index.tsx +1 -1
  27. package/src/templates/WrapIfAdditionalTemplate/index.tsx +3 -2
  28. package/src/templates/index.ts +1 -1
  29. package/lib/templates/DescriptionField/index.js.map +0 -1
  30. /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.d.ts +0 -0
  31. /package/lib/templates/{DescriptionField → FieldDescriptionTemplate}/index.js +0 -0
  32. /package/src/templates/{DescriptionField → FieldDescriptionTemplate}/index.tsx +0 -0
package/dist/antd.umd.js CHANGED
@@ -6,23 +6,25 @@
6
6
 
7
7
  // src/index.ts
8
8
  var BTN_GRP_STYLE = {
9
- width: "100%"
9
+ width: "100%",
10
+ justifyContent: "flex-end"
10
11
  };
11
12
  var BTN_STYLE = {
12
13
  width: "calc(100% / 4)"
13
14
  };
14
15
  function ArrayFieldItemTemplate(props) {
15
- const { children, buttonsProps, hasToolbar, index, registry, uiSchema } = props;
16
+ const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, index, registry, uiSchema } = props;
16
17
  const uiOptions = utils.getUiOptions(uiSchema);
17
18
  const ArrayFieldItemButtonsTemplate = utils.getTemplate(
18
19
  "ArrayFieldItemButtonsTemplate",
19
20
  registry,
20
21
  uiOptions
21
22
  );
22
- const { rowGutter = 24, toolbarAlign = "top" } = registry.formContext;
23
+ const { rowGutter = 24, toolbarAlign = displayLabel ? "middle" : "top" } = registry.formContext;
24
+ const margin = hasDescription ? -8 : 16;
23
25
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { align: toolbarAlign, gutter: rowGutter, children: [
24
26
  /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "1", children }),
25
- hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { style: BTN_GRP_STYLE, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: BTN_STYLE }) }) })
27
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "120px", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { style: BTN_GRP_STYLE, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: BTN_STYLE }) }) })
26
28
  ] }, `rjsf-array-item-${index}`);
27
29
  }
28
30
  function ArrayFieldTemplate(props) {
@@ -78,7 +80,7 @@
78
80
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
79
81
  items
80
82
  ] }),
81
- canAdd && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(
83
+ canAdd && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "120px", children: /* @__PURE__ */ jsxRuntime.jsx(
82
84
  AddButton2,
83
85
  {
84
86
  id: utils.buttonId(fieldPathId, "add"),
@@ -264,23 +266,16 @@
264
266
  function FieldTemplate(props) {
265
267
  const {
266
268
  children,
267
- classNames: classNames4,
268
- style,
269
269
  description,
270
- disabled,
271
270
  displayLabel,
272
271
  errors,
273
272
  help,
273
+ rawHelp,
274
274
  hidden,
275
275
  id,
276
276
  label,
277
- onKeyRename,
278
- onKeyRenameBlur,
279
- onRemoveProperty,
280
277
  rawErrors,
281
278
  rawDescription,
282
- rawHelp,
283
- readonly,
284
279
  registry,
285
280
  required,
286
281
  schema,
@@ -315,41 +310,23 @@
315
310
  break;
316
311
  }
317
312
  const isCheckbox = uiOptions.widget === "checkbox";
318
- return /* @__PURE__ */ jsxRuntime.jsx(
319
- WrapIfAdditionalTemplate2,
313
+ return /* @__PURE__ */ jsxRuntime.jsx(WrapIfAdditionalTemplate2, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
314
+ antd.Form.Item,
320
315
  {
321
- classNames: classNames4,
322
- style,
323
- disabled,
324
- id,
325
- label,
326
- onKeyRename,
327
- onKeyRenameBlur,
328
- onRemoveProperty,
329
- readonly,
316
+ colon,
317
+ hasFeedback: schema.type !== "array" && schema.type !== "object",
318
+ help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
319
+ htmlFor: id,
320
+ label: displayLabel && !isCheckbox && label,
321
+ labelCol,
330
322
  required,
331
- schema,
332
- uiSchema,
333
- registry,
334
- children: /* @__PURE__ */ jsxRuntime.jsx(
335
- antd.Form.Item,
336
- {
337
- colon,
338
- hasFeedback: schema.type !== "array" && schema.type !== "object",
339
- help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
340
- htmlFor: id,
341
- label: displayLabel && !isCheckbox && label,
342
- labelCol,
343
- required,
344
- style: wrapperStyle,
345
- validateStatus: rawErrors?.length ? "error" : void 0,
346
- wrapperCol,
347
- ...descriptionProps,
348
- children
349
- }
350
- )
323
+ style: wrapperStyle,
324
+ validateStatus: rawErrors?.length ? "error" : void 0,
325
+ wrapperCol,
326
+ ...descriptionProps,
327
+ children
351
328
  }
352
- );
329
+ ) });
353
330
  }
354
331
  function GridTemplate(props) {
355
332
  const { children, column, ...rest } = props;
@@ -441,7 +418,7 @@
441
418
  !showOptionalDataControlInTitle ? /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: optionalDataControl }) : void 0,
442
419
  properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: calculateColSpan(element), children: element.content }, element.name))
443
420
  ] }),
444
- utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(
421
+ utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "120px", children: /* @__PURE__ */ jsxRuntime.jsx(
445
422
  AddButton2,
446
423
  {
447
424
  id: utils.buttonId(fieldPathId, "add"),
@@ -557,6 +534,7 @@
557
534
  classNames: classNames4,
558
535
  style,
559
536
  disabled,
537
+ displayLabel,
560
538
  id,
561
539
  label,
562
540
  onRemoveProperty,
@@ -596,7 +574,7 @@
596
574
  className: "form-group",
597
575
  hasFeedback: true,
598
576
  htmlFor: `${id}-key`,
599
- label: keyLabel,
577
+ label: displayLabel ? keyLabel : void 0,
600
578
  labelCol,
601
579
  required,
602
580
  style: wrapperStyle,
@@ -617,7 +595,7 @@
617
595
  }
618
596
  ) }) }),
619
597
  /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { className: "form-additional", flex: "1", children }),
620
- /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(
598
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "120px", style: { marginTop: displayLabel ? "40px" : void 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
621
599
  RemoveButton2,
622
600
  {
623
601
  id: utils.buttonId(id, "remove"),
package/dist/index.cjs CHANGED
@@ -48,23 +48,25 @@ var import_antd = require("antd");
48
48
  var import_utils = require("@rjsf/utils");
49
49
  var import_jsx_runtime = require("react/jsx-runtime");
50
50
  var BTN_GRP_STYLE = {
51
- width: "100%"
51
+ width: "100%",
52
+ justifyContent: "flex-end"
52
53
  };
53
54
  var BTN_STYLE = {
54
55
  width: "calc(100% / 4)"
55
56
  };
56
57
  function ArrayFieldItemTemplate(props) {
57
- const { children, buttonsProps, hasToolbar, index, registry, uiSchema } = props;
58
+ const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, index, registry, uiSchema } = props;
58
59
  const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
59
60
  const ArrayFieldItemButtonsTemplate = (0, import_utils.getTemplate)(
60
61
  "ArrayFieldItemButtonsTemplate",
61
62
  registry,
62
63
  uiOptions
63
64
  );
64
- const { rowGutter = 24, toolbarAlign = "top" } = registry.formContext;
65
+ const { rowGutter = 24, toolbarAlign = displayLabel ? "middle" : "top" } = registry.formContext;
66
+ const margin = hasDescription ? -8 : 16;
65
67
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Row, { align: toolbarAlign, gutter: rowGutter, children: [
66
68
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { flex: "1", children }),
67
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { flex: "192px", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Space.Compact, { style: BTN_GRP_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: BTN_STYLE }) }) })
69
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { flex: "120px", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Space.Compact, { style: BTN_GRP_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: BTN_STYLE }) }) })
68
70
  ] }, `rjsf-array-item-${index}`);
69
71
  }
70
72
 
@@ -127,7 +129,7 @@ function ArrayFieldTemplate(props) {
127
129
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
128
130
  items
129
131
  ] }),
130
- canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { span: 24, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { flex: "192px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
132
+ canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { span: 24, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Col, { flex: "120px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
131
133
  AddButton2,
132
134
  {
133
135
  id: (0, import_utils2.buttonId)(fieldPathId, "add"),
@@ -213,7 +215,7 @@ function BaseInputTemplate(props) {
213
215
  ] });
214
216
  }
215
217
 
216
- // src/templates/DescriptionField/index.tsx
218
+ // src/templates/FieldDescriptionTemplate/index.tsx
217
219
  var import_core = require("@rjsf/core");
218
220
  var import_jsx_runtime4 = require("react/jsx-runtime");
219
221
  function DescriptionField(props) {
@@ -347,23 +349,16 @@ var VERTICAL_WRAPPER_COL = { span: 24 };
347
349
  function FieldTemplate(props) {
348
350
  const {
349
351
  children,
350
- classNames: classNames4,
351
- style,
352
352
  description,
353
- disabled,
354
353
  displayLabel,
355
354
  errors,
356
355
  help,
356
+ rawHelp,
357
357
  hidden,
358
358
  id,
359
359
  label,
360
- onKeyRename,
361
- onKeyRenameBlur,
362
- onRemoveProperty,
363
360
  rawErrors,
364
361
  rawDescription,
365
- rawHelp,
366
- readonly,
367
362
  registry,
368
363
  required,
369
364
  schema,
@@ -398,41 +393,23 @@ function FieldTemplate(props) {
398
393
  break;
399
394
  }
400
395
  const isCheckbox = uiOptions.widget === "checkbox";
401
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
402
- WrapIfAdditionalTemplate2,
396
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WrapIfAdditionalTemplate2, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
397
+ import_antd6.Form.Item,
403
398
  {
404
- classNames: classNames4,
405
- style,
406
- disabled,
407
- id,
408
- label,
409
- onKeyRename,
410
- onKeyRenameBlur,
411
- onRemoveProperty,
412
- readonly,
399
+ colon,
400
+ hasFeedback: schema.type !== "array" && schema.type !== "object",
401
+ help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
402
+ htmlFor: id,
403
+ label: displayLabel && !isCheckbox && label,
404
+ labelCol,
413
405
  required,
414
- schema,
415
- uiSchema,
416
- registry,
417
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
418
- import_antd6.Form.Item,
419
- {
420
- colon,
421
- hasFeedback: schema.type !== "array" && schema.type !== "object",
422
- help: !!rawHelp && help || (rawErrors?.length ? errors : void 0),
423
- htmlFor: id,
424
- label: displayLabel && !isCheckbox && label,
425
- labelCol,
426
- required,
427
- style: wrapperStyle,
428
- validateStatus: rawErrors?.length ? "error" : void 0,
429
- wrapperCol,
430
- ...descriptionProps,
431
- children
432
- }
433
- )
406
+ style: wrapperStyle,
407
+ validateStatus: rawErrors?.length ? "error" : void 0,
408
+ wrapperCol,
409
+ ...descriptionProps,
410
+ children
434
411
  }
435
- );
412
+ ) });
436
413
  }
437
414
 
438
415
  // src/templates/GridTemplate/index.tsx
@@ -541,7 +518,7 @@ function ObjectFieldTemplate(props) {
541
518
  !showOptionalDataControlInTitle ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { span: 24, children: optionalDataControl }) : void 0,
542
519
  properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { span: calculateColSpan(element), children: element.content }, element.name))
543
520
  ] }),
544
- (0, import_utils8.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { span: 24, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { flex: "192px", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
521
+ (0, import_utils8.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { span: 24, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Row, { gutter: rowGutter, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { flex: "120px", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
545
522
  AddButton2,
546
523
  {
547
524
  id: (0, import_utils8.buttonId)(fieldPathId, "add"),
@@ -676,6 +653,7 @@ function WrapIfAdditionalTemplate(props) {
676
653
  classNames: classNames4,
677
654
  style,
678
655
  disabled,
656
+ displayLabel,
679
657
  id,
680
658
  label,
681
659
  onRemoveProperty,
@@ -715,7 +693,7 @@ function WrapIfAdditionalTemplate(props) {
715
693
  className: "form-group",
716
694
  hasFeedback: true,
717
695
  htmlFor: `${id}-key`,
718
- label: keyLabel,
696
+ label: displayLabel ? keyLabel : void 0,
719
697
  labelCol,
720
698
  required,
721
699
  style: wrapperStyle,
@@ -736,7 +714,7 @@ function WrapIfAdditionalTemplate(props) {
736
714
  }
737
715
  ) }) }),
738
716
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_antd11.Col, { className: "form-additional", flex: "1", children }),
739
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_antd11.Col, { flex: "192px", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_antd11.Col, { flex: "120px", style: { marginTop: displayLabel ? "40px" : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
740
718
  RemoveButton2,
741
719
  {
742
720
  id: (0, import_utils10.buttonId)(id, "remove"),