@rjsf/antd 6.0.0-alpha.0 → 6.0.0-beta.2

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 (67) hide show
  1. package/dist/antd.esm.js +116 -144
  2. package/dist/antd.esm.js.map +4 -4
  3. package/dist/antd.umd.js +32 -72
  4. package/dist/index.js +215 -249
  5. package/dist/index.js.map +4 -4
  6. package/lib/index.d.ts +2 -2
  7. package/lib/index.js +2 -2
  8. package/lib/templates/ArrayFieldItemTemplate/index.d.ts +3 -3
  9. package/lib/templates/ArrayFieldItemTemplate/index.js +7 -5
  10. package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
  11. package/lib/templates/ArrayFieldTemplate/index.d.ts +1 -1
  12. package/lib/templates/ArrayFieldTemplate/index.js +4 -6
  13. package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
  14. package/lib/templates/DescriptionField/index.js +3 -2
  15. package/lib/templates/DescriptionField/index.js.map +1 -1
  16. package/lib/templates/FieldErrorTemplate/index.js.map +1 -1
  17. package/lib/templates/FieldTemplate/index.js +1 -1
  18. package/lib/templates/FieldTemplate/index.js.map +1 -1
  19. package/lib/templates/GridTemplate/index.d.ts +7 -0
  20. package/lib/templates/GridTemplate/index.js +15 -0
  21. package/lib/templates/GridTemplate/index.js.map +1 -0
  22. package/lib/templates/IconButton/index.d.ts +1 -1
  23. package/lib/templates/ObjectFieldTemplate/index.js +6 -8
  24. package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
  25. package/lib/templates/SubmitButton/index.js.map +1 -1
  26. package/lib/templates/TitleField/index.js.map +1 -1
  27. package/lib/templates/WrapIfAdditionalTemplate/index.js +2 -2
  28. package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
  29. package/lib/templates/index.js +14 -12
  30. package/lib/templates/index.js.map +1 -1
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/lib/widgets/AltDateTimeWidget/index.js +1 -1
  33. package/lib/widgets/AltDateWidget/index.js.map +1 -1
  34. package/lib/widgets/RadioWidget/index.js +1 -1
  35. package/lib/widgets/RadioWidget/index.js.map +1 -1
  36. package/lib/widgets/SelectWidget/index.js +1 -1
  37. package/lib/widgets/SelectWidget/index.js.map +1 -1
  38. package/lib/widgets/index.js +11 -11
  39. package/package.json +46 -41
  40. package/src/index.ts +2 -2
  41. package/src/templates/ArrayFieldItemTemplate/index.tsx +22 -60
  42. package/src/templates/ArrayFieldTemplate/index.tsx +11 -9
  43. package/src/templates/BaseInputTemplate/index.tsx +1 -1
  44. package/src/templates/DescriptionField/index.tsx +8 -3
  45. package/src/templates/FieldErrorTemplate/index.tsx +1 -1
  46. package/src/templates/FieldTemplate/index.tsx +3 -3
  47. package/src/templates/GridTemplate/index.tsx +15 -0
  48. package/src/templates/IconButton/index.tsx +9 -9
  49. package/src/templates/ObjectFieldTemplate/index.tsx +6 -4
  50. package/src/templates/SubmitButton/index.tsx +1 -1
  51. package/src/templates/WrapIfAdditionalTemplate/index.tsx +4 -2
  52. package/src/templates/index.ts +3 -1
  53. package/src/tsconfig.json +3 -1
  54. package/src/widgets/AltDateTimeWidget/index.tsx +1 -1
  55. package/src/widgets/AltDateWidget/index.tsx +2 -2
  56. package/src/widgets/CheckboxWidget/index.tsx +1 -1
  57. package/src/widgets/CheckboxesWidget/index.tsx +1 -1
  58. package/src/widgets/DateTimeWidget/index.tsx +1 -1
  59. package/src/widgets/DateWidget/index.tsx +1 -1
  60. package/src/widgets/PasswordWidget/index.tsx +1 -1
  61. package/src/widgets/RadioWidget/index.tsx +1 -1
  62. package/src/widgets/RangeWidget/index.tsx +1 -1
  63. package/src/widgets/SelectWidget/index.tsx +1 -1
  64. package/src/widgets/TextareaWidget/index.tsx +1 -1
  65. package/src/widgets/index.ts +1 -1
  66. package/LICENSE.md +0 -201
  67. package/src/index.less +0 -38
package/dist/antd.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('antd'), require('react/jsx-runtime'), require('@rjsf/utils'), require('classnames'), require('react'), require('@ant-design/icons/ExclamationCircleOutlined'), require('@ant-design/icons/ArrowDownOutlined'), require('@ant-design/icons/ArrowUpOutlined'), require('@ant-design/icons/CopyOutlined'), require('@ant-design/icons/DeleteOutlined'), require('@ant-design/icons/PlusCircleOutlined'), require('lodash/isObject'), require('lodash/isNumber'), require('lodash/isString'), require('dayjs')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'antd', 'react/jsx-runtime', '@rjsf/utils', 'classnames', 'react', '@ant-design/icons/ExclamationCircleOutlined', '@ant-design/icons/ArrowDownOutlined', '@ant-design/icons/ArrowUpOutlined', '@ant-design/icons/CopyOutlined', '@ant-design/icons/DeleteOutlined', '@ant-design/icons/PlusCircleOutlined', 'lodash/isObject', 'lodash/isNumber', 'lodash/isString', 'dayjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.antd, global.jsxRuntime, global.utils, global.classNames, global.react, global.ExclamationCircleOutlined, global.ArrowDownOutlined, global.ArrowUpOutlined, global.CopyOutlined, global.DeleteOutlined, global.PlusCircleOutlined, global.isObject, global.isNumber, global.isString, global.dayjs));
5
- })(this, (function (exports, core, antd, jsxRuntime, utils, classNames, react, ExclamationCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, CopyOutlined, DeleteOutlined, PlusCircleOutlined, isObject, isNumber, isString, dayjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('antd'), require('@rjsf/utils'), require('react/jsx-runtime'), require('classnames'), require('react'), require('@ant-design/icons/ExclamationCircleOutlined'), require('@ant-design/icons/ArrowDownOutlined'), require('@ant-design/icons/ArrowUpOutlined'), require('@ant-design/icons/CopyOutlined'), require('@ant-design/icons/DeleteOutlined'), require('@ant-design/icons/PlusCircleOutlined'), require('lodash/isObject'), require('lodash/isNumber'), require('lodash/isString'), require('dayjs')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'antd', '@rjsf/utils', 'react/jsx-runtime', 'classnames', 'react', '@ant-design/icons/ExclamationCircleOutlined', '@ant-design/icons/ArrowDownOutlined', '@ant-design/icons/ArrowUpOutlined', '@ant-design/icons/CopyOutlined', '@ant-design/icons/DeleteOutlined', '@ant-design/icons/PlusCircleOutlined', 'lodash/isObject', 'lodash/isNumber', 'lodash/isString', 'dayjs'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.antd, global.utils, global.jsxRuntime, global.classNames, global.react, global.ExclamationCircleOutlined, global.ArrowDownOutlined, global.ArrowUpOutlined, global.CopyOutlined, global.DeleteOutlined, global.PlusCircleOutlined, global.isObject, global.isNumber, global.isString, global.dayjs));
5
+ })(this, (function (exports, core, antd, utils, jsxRuntime, classNames, react, ExclamationCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, CopyOutlined, DeleteOutlined, PlusCircleOutlined, isObject, isNumber, isString, dayjs) { 'use strict';
6
6
 
7
7
  // src/index.ts
8
8
  var BTN_GRP_STYLE = {
@@ -12,69 +12,18 @@
12
12
  width: "calc(100% / 4)"
13
13
  };
14
14
  function ArrayFieldItemTemplate(props) {
15
- const {
16
- children,
17
- disabled,
18
- hasCopy,
19
- hasMoveDown,
20
- hasMoveUp,
21
- hasRemove,
22
- hasToolbar,
23
- index,
24
- onCopyIndexClick,
25
- onDropIndexClick,
26
- onReorderClick,
27
- readonly,
15
+ const { children, buttonsProps, hasToolbar, index, registry, uiSchema } = props;
16
+ const uiOptions = utils.getUiOptions(uiSchema);
17
+ const ArrayFieldItemButtonsTemplate = utils.getTemplate(
18
+ "ArrayFieldItemButtonsTemplate",
28
19
  registry,
29
- uiSchema
30
- } = props;
31
- const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
20
+ uiOptions
21
+ );
32
22
  const { rowGutter = 24, toolbarAlign = "top" } = registry.formContext;
33
23
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { align: toolbarAlign, gutter: rowGutter, children: [
34
24
  /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "1", children }),
35
- hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Button.Group, { style: BTN_GRP_STYLE, children: [
36
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsxRuntime.jsx(
37
- MoveUpButton2,
38
- {
39
- disabled: disabled || readonly || !hasMoveUp,
40
- onClick: onReorderClick(index, index - 1),
41
- style: BTN_STYLE,
42
- uiSchema,
43
- registry
44
- }
45
- ),
46
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsxRuntime.jsx(
47
- MoveDownButton2,
48
- {
49
- disabled: disabled || readonly || !hasMoveDown,
50
- onClick: onReorderClick(index, index + 1),
51
- style: BTN_STYLE,
52
- uiSchema,
53
- registry
54
- }
55
- ),
56
- hasCopy && /* @__PURE__ */ jsxRuntime.jsx(
57
- CopyButton2,
58
- {
59
- disabled: disabled || readonly,
60
- onClick: onCopyIndexClick(index),
61
- style: BTN_STYLE,
62
- uiSchema,
63
- registry
64
- }
65
- ),
66
- hasRemove && /* @__PURE__ */ jsxRuntime.jsx(
67
- RemoveButton2,
68
- {
69
- disabled: disabled || readonly,
70
- onClick: onDropIndexClick(index),
71
- style: BTN_STYLE,
72
- uiSchema,
73
- registry
74
- }
75
- )
76
- ] }) })
77
- ] }, `array-item-${index}`);
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 }) }) })
26
+ ] }, `rjsf-array-item-${index}`);
78
27
  }
79
28
  var DESCRIPTION_COL_STYLE = {
80
29
  paddingBottom: "8px"
@@ -149,7 +98,8 @@
149
98
  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(
150
99
  AddButton2,
151
100
  {
152
- className: "array-item-add",
101
+ id: utils.buttonId(idSchema, "add"),
102
+ className: "rjsf-array-item-add",
153
103
  disabled: disabled || readonly,
154
104
  onClick: onAddClick,
155
105
  uiSchema,
@@ -224,11 +174,11 @@
224
174
  ] });
225
175
  }
226
176
  function DescriptionField(props) {
227
- const { id, description } = props;
177
+ const { id, description, registry, uiSchema } = props;
228
178
  if (!description) {
229
179
  return null;
230
180
  }
231
- return /* @__PURE__ */ jsxRuntime.jsx("span", { id, children: description });
181
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { id, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
232
182
  }
233
183
  function ErrorList({
234
184
  errors,
@@ -360,7 +310,7 @@
360
310
  uiOptions
361
311
  );
362
312
  if (hidden) {
363
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "field-hidden", children });
313
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rjsf-field-hidden", children });
364
314
  }
365
315
  const descriptionNode = rawDescription ? description : void 0;
366
316
  const descriptionProps = {};
@@ -408,6 +358,13 @@
408
358
  }
409
359
  );
410
360
  }
361
+ function GridTemplate(props) {
362
+ const { children, column, ...rest } = props;
363
+ if (column) {
364
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { ...rest, children });
365
+ }
366
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { ...rest, children });
367
+ }
411
368
  var DESCRIPTION_COL_STYLE2 = {
412
369
  paddingBottom: "8px"
413
370
  };
@@ -502,7 +459,8 @@
502
459
  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(
503
460
  AddButton2,
504
461
  {
505
- className: "object-property-expand",
462
+ id: utils.buttonId(idSchema, "add"),
463
+ className: "rjsf-object-property-expand",
506
464
  disabled: disabled || readonly,
507
465
  onClick: onAddClick(schema),
508
466
  uiSchema,
@@ -631,7 +589,8 @@
631
589
  /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { flex: "192px", children: /* @__PURE__ */ jsxRuntime.jsx(
632
590
  RemoveButton2,
633
591
  {
634
- className: "array-item-remove",
592
+ id: utils.buttonId(id, "remove"),
593
+ className: "rjsf-object-property-remove",
635
594
  disabled: disabled || readonly,
636
595
  onClick: onDropPropertyClick(label),
637
596
  uiSchema: buttonUiOptions,
@@ -659,6 +618,7 @@
659
618
  ErrorListTemplate: ErrorList,
660
619
  FieldErrorTemplate,
661
620
  FieldTemplate,
621
+ GridTemplate,
662
622
  ObjectFieldTemplate,
663
623
  TitleFieldTemplate: TitleField,
664
624
  WrapIfAdditionalTemplate
@@ -960,7 +920,7 @@
960
920
  id: utils.optionId(id, i),
961
921
  name: id,
962
922
  autoFocus: i === 0 ? autofocus : false,
963
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
923
+ disabled: disabled || Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
964
924
  value: String(i),
965
925
  children: option.label
966
926
  },
@@ -1154,13 +1114,13 @@
1154
1114
  return core.withTheme(generateTheme());
1155
1115
  }
1156
1116
  var Form3 = generateForm();
1157
- var src_default = Form3;
1117
+ var index_default = Form3;
1158
1118
 
1159
1119
  exports.Form = Form3;
1160
1120
  exports.Templates = templates_default;
1161
1121
  exports.Theme = Theme;
1162
1122
  exports.Widgets = widgets_default;
1163
- exports.default = src_default;
1123
+ exports.default = index_default;
1164
1124
  exports.generateForm = generateForm;
1165
1125
  exports.generateTemplates = generateTemplates;
1166
1126
  exports.generateTheme = generateTheme;