@teamix/pro 1.1.39 → 1.1.40

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 (190) hide show
  1. package/README.md +14 -10
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2214 -4073
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/dialog-form.d.ts +5 -5
  7. package/es/actions/dialog-form.js +1 -5
  8. package/es/actions/dialog.d.ts +6 -3
  9. package/es/actions/dialog.js +12 -5
  10. package/es/actions/index.d.ts +54 -47
  11. package/es/actions/index.js +28 -22
  12. package/es/actions/index.scss +17 -2
  13. package/es/card/index.d.ts +17 -5
  14. package/es/card/index.js +16 -11
  15. package/es/form/Components/ProField/index.d.ts +1 -78
  16. package/es/form/Components/ProField/index.js +34 -40
  17. package/es/form/Filter/index.js +2 -2
  18. package/es/form/ProForm/index.d.ts +2 -2
  19. package/es/form/ProForm/index.js +1 -6
  20. package/es/form/ProForm/index.scss +19 -1
  21. package/es/form/ProForm/useFieldRequest.d.ts +5 -0
  22. package/es/form/ProForm/useFieldRequest.js +26 -0
  23. package/es/form/SchemaForm/adapterDecorator.js +2 -2
  24. package/es/form/SchemaForm/index.d.ts +2 -2
  25. package/es/form/SchemaForm/index.js +12 -21
  26. package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  27. package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  28. package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  29. package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  30. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  32. package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
  33. package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  35. package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
  36. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  37. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  38. package/es/form/SchemaForm/initializeRequest.js +2 -2
  39. package/es/form/SchemaForm/initializeRules.js +44 -16
  40. package/es/form/SchemaForm/reactions.d.ts +5 -5
  41. package/es/form/SchemaForm/reactions.js +20 -18
  42. package/es/form/fieldTypeMap.d.ts +4 -0
  43. package/es/form/fieldTypeMap.js +41 -0
  44. package/es/form/index.d.ts +92 -4
  45. package/es/form/index.js +18 -5
  46. package/es/form/schemaNameMap.js +3 -0
  47. package/es/form/typing.d.ts +44 -21
  48. package/es/form/utils.d.ts +3 -1
  49. package/es/form/utils.js +38 -1
  50. package/es/form/warning.d.ts +2 -2
  51. package/es/index.d.ts +1 -1
  52. package/es/index.js +1 -1
  53. package/es/info/components/InfoGroup/index.js +73 -15
  54. package/es/info/components/InfoGroup/index.scss +45 -3
  55. package/es/info/components/InfoValueItem/index.js +6 -4
  56. package/es/info/components/InfoValueItem/index.scss +5 -1
  57. package/es/info/components/ProInfoItem/index.js +3 -3
  58. package/es/info/components/ProInfoItem/index.scss +1 -0
  59. package/es/info/components/baseInfo/index.d.ts +2 -3
  60. package/es/info/components/headerInfo/index.d.ts +2 -3
  61. package/es/info/components/tableInfo/index.d.ts +2 -3
  62. package/es/info/components/tableInfo/index.js +2 -2
  63. package/es/info/index.js +52 -49
  64. package/es/info/typing.d.ts +52 -36
  65. package/es/info/utils/index.d.ts +2 -2
  66. package/es/info/utils/utils.d.ts +1 -1
  67. package/es/nocode/pages/renderer.js +2 -2
  68. package/es/page-header/index.d.ts +34 -21
  69. package/es/page-header/index.js +39 -30
  70. package/es/page-header/index.scss +2 -1
  71. package/es/table/components/EmptyContent/index.d.ts +2 -0
  72. package/es/table/components/EmptyContent/index.js +11 -0
  73. package/es/table/components/Filter/index.d.ts +2 -2
  74. package/es/table/components/Filter/index.js +16 -8
  75. package/es/table/components/Layout/index.js +2 -2
  76. package/es/table/components/QuickAction/index.d.ts +2 -2
  77. package/es/table/components/QuickAction/index.js +3 -3
  78. package/es/table/components/ToolBar/Fullscreen.js +1 -0
  79. package/es/table/index.js +76 -14
  80. package/es/table/index.scss +4 -0
  81. package/es/table/typing.d.ts +27 -14
  82. package/es/table/utils/columnRender.d.ts +3 -3
  83. package/es/table/utils/columnRender.js +2 -2
  84. package/es/table/utils/genProColumnToColumn.d.ts +2 -2
  85. package/es/table/utils/genProColumnToColumn.js +1 -1
  86. package/es/table/utils/index.js +33 -11
  87. package/es/templates/List/index.d.ts +2 -2
  88. package/es/utils/message.d.ts +3 -0
  89. package/es/utils/message.js +19 -0
  90. package/lib/actions/dialog-form.d.ts +5 -5
  91. package/lib/actions/dialog-form.js +1 -5
  92. package/lib/actions/dialog.d.ts +6 -3
  93. package/lib/actions/dialog.js +13 -5
  94. package/lib/actions/index.d.ts +54 -47
  95. package/lib/actions/index.js +37 -30
  96. package/lib/actions/index.scss +17 -2
  97. package/lib/card/index.d.ts +17 -5
  98. package/lib/card/index.js +18 -12
  99. package/lib/form/Components/ProField/index.d.ts +1 -78
  100. package/lib/form/Components/ProField/index.js +32 -38
  101. package/lib/form/Filter/index.js +2 -2
  102. package/lib/form/ProForm/index.d.ts +2 -2
  103. package/lib/form/ProForm/index.js +1 -7
  104. package/lib/form/ProForm/index.scss +19 -1
  105. package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
  106. package/lib/form/ProForm/useFieldRequest.js +37 -0
  107. package/lib/form/SchemaForm/adapterDecorator.js +4 -2
  108. package/lib/form/SchemaForm/index.d.ts +2 -2
  109. package/lib/form/SchemaForm/index.js +11 -22
  110. package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  111. package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  112. package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  113. package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  114. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  115. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  116. package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
  117. package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  118. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  119. package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
  120. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  121. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  122. package/lib/form/SchemaForm/initializeRequest.js +1 -1
  123. package/lib/form/SchemaForm/initializeRules.js +41 -13
  124. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  125. package/lib/form/SchemaForm/reactions.js +22 -20
  126. package/lib/form/fieldTypeMap.d.ts +4 -0
  127. package/lib/form/fieldTypeMap.js +48 -0
  128. package/lib/form/index.d.ts +92 -4
  129. package/lib/form/index.js +17 -31
  130. package/lib/form/schemaNameMap.js +3 -0
  131. package/lib/form/typing.d.ts +44 -21
  132. package/lib/form/utils.d.ts +3 -1
  133. package/lib/form/utils.js +43 -1
  134. package/lib/form/warning.d.ts +2 -2
  135. package/lib/index.d.ts +1 -1
  136. package/lib/index.js +1 -1
  137. package/lib/info/components/InfoGroup/index.js +76 -14
  138. package/lib/info/components/InfoGroup/index.scss +45 -3
  139. package/lib/info/components/InfoValueItem/index.js +5 -3
  140. package/lib/info/components/InfoValueItem/index.scss +5 -1
  141. package/lib/info/components/ProInfoItem/index.js +2 -2
  142. package/lib/info/components/ProInfoItem/index.scss +1 -0
  143. package/lib/info/components/baseInfo/index.d.ts +2 -3
  144. package/lib/info/components/headerInfo/index.d.ts +2 -3
  145. package/lib/info/components/tableInfo/index.d.ts +2 -3
  146. package/lib/info/components/tableInfo/index.js +1 -1
  147. package/lib/info/index.js +51 -48
  148. package/lib/info/typing.d.ts +52 -36
  149. package/lib/info/utils/index.d.ts +2 -2
  150. package/lib/info/utils/utils.d.ts +1 -1
  151. package/lib/nocode/pages/renderer.js +1 -1
  152. package/lib/page-header/index.d.ts +34 -21
  153. package/lib/page-header/index.js +37 -28
  154. package/lib/page-header/index.scss +2 -1
  155. package/lib/table/components/EmptyContent/index.d.ts +2 -0
  156. package/lib/table/components/EmptyContent/index.js +25 -0
  157. package/lib/table/components/Filter/index.d.ts +2 -2
  158. package/lib/table/components/Filter/index.js +16 -8
  159. package/lib/table/components/Layout/index.js +1 -1
  160. package/lib/table/components/QuickAction/index.d.ts +2 -2
  161. package/lib/table/components/QuickAction/index.js +1 -1
  162. package/lib/table/components/ToolBar/Fullscreen.js +1 -0
  163. package/lib/table/index.js +77 -14
  164. package/lib/table/index.scss +4 -0
  165. package/lib/table/typing.d.ts +27 -14
  166. package/lib/table/utils/columnRender.d.ts +3 -3
  167. package/lib/table/utils/columnRender.js +1 -1
  168. package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
  169. package/lib/table/utils/genProColumnToColumn.js +2 -2
  170. package/lib/table/utils/index.js +33 -11
  171. package/lib/templates/List/index.d.ts +2 -2
  172. package/lib/utils/message.d.ts +3 -0
  173. package/lib/utils/message.js +32 -0
  174. package/package.json +4 -4
  175. package/es/form/Components/Search/index.d.ts +0 -11
  176. package/es/form/Components/Search/index.js +0 -89
  177. package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  178. package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
  179. package/es/form/SchemaForm/initializeProField.d.ts +0 -5
  180. package/es/form/SchemaForm/initializeProField.js +0 -70
  181. package/es/info/utils/useInfoRequest.d.ts +0 -14
  182. package/es/info/utils/useInfoRequest.js +0 -76
  183. package/lib/form/Components/Search/index.d.ts +0 -11
  184. package/lib/form/Components/Search/index.js +0 -103
  185. package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  186. package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
  187. package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
  188. package/lib/form/SchemaForm/initializeProField.js +0 -77
  189. package/lib/info/utils/useInfoRequest.d.ts +0 -14
  190. package/lib/info/utils/useInfoRequest.js +0 -85
@@ -1,3 +1,15 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
1
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
14
 
3
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -5,49 +17,31 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
17
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
18
 
7
19
  import React from 'react';
8
- import { isVoidField } from '@formily/core';
9
20
  import { connect, mapProps, mapReadPretty } from '@formily/react';
21
+ import { mapSize, mapStatus, mapDataSource, mapMode } from '../../utils';
10
22
  import ProField from '../../../field';
11
- import { mapSize, mapStatus } from '../../utils';
12
-
13
- var patchDataSource = function patchDataSource() {
14
- var dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15
-
16
- var removeEmptyChildren = function removeEmptyChildren(data) {
17
- var result = _objectSpread({}, data);
18
-
19
- if (!result.children || result.children.length === 0) {
20
- delete result.children;
21
- } else {
22
- result.children = result.children.map(removeEmptyChildren);
23
- }
24
-
25
- return result;
26
- };
27
-
28
- return dataSource.map(removeEmptyChildren);
23
+ import fieldTypeMap from '../../fieldTypeMap';
24
+
25
+ var componentBuilder = function componentBuilder(type) {
26
+ return connect(function (props) {
27
+ return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
28
+ type: type
29
+ }));
30
+ }, mapProps(mapSize, mapStatus, mapDataSource, mapMode), mapReadPretty(function (props) {
31
+ return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
32
+ mode: "read"
33
+ }));
34
+ }));
29
35
  };
30
36
 
31
- var mapDataSource = function mapDataSource(props, field) {
32
- var _props$dataSource;
33
-
34
- if (isVoidField(field)) {
35
- return props;
36
- }
37
+ export default (function () {
38
+ var components = {};
39
+ Object.entries(fieldTypeMap).forEach(function (_ref) {
40
+ var _ref2 = _slicedToArray(_ref, 2),
41
+ name = _ref2[0],
42
+ type = _ref2[1];
37
43
 
38
- return _objectSpread(_objectSpread({}, props), {}, {
39
- dataSource: patchDataSource((_props$dataSource = props.dataSource) !== null && _props$dataSource !== void 0 ? _props$dataSource : field === null || field === void 0 ? void 0 : field.dataSource)
44
+ components[name] = componentBuilder(type);
40
45
  });
41
- };
42
-
43
- var mapMode = function mapMode(props, field) {
44
- return _objectSpread(_objectSpread({}, props), {}, {
45
- mode: (field === null || field === void 0 ? void 0 : field.readPretty) ? 'read' : 'edit'
46
- });
47
- };
48
-
49
- export default connect(ProField, mapProps(mapSize, mapStatus, mapDataSource, mapMode), mapReadPretty(function (props) {
50
- return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
51
- mode: "read"
52
- }));
53
- }));
46
+ return components;
47
+ })();
@@ -79,7 +79,7 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
79
79
  }, []);
80
80
  var eventProps = getEventProps(triggerType, onFilter);
81
81
  return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
82
- feedbackLayout: "none",
82
+ feedbackLayout: "popover",
83
83
  breakpoints: [],
84
84
  inset: true
85
85
  }, otherProps), eventProps), {}, {
@@ -206,7 +206,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
206
206
  }, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
207
207
  var eventProps = getEventProps(triggerType, onFilter);
208
208
  return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
209
- feedbackLayout: "none"
209
+ feedbackLayout: "popover"
210
210
  }, props), eventProps), getTeamixLayout), {}, {
211
211
  form: form,
212
212
  className: cls(prefixCls, props.className),
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { IFormProps } from '../typing';
2
+ import type { ProFormProps } from '../typing';
3
3
  import './index.scss';
4
- declare const ProForm: React.FC<IFormProps>;
4
+ declare const ProForm: React.FC<ProFormProps>;
5
5
  export default ProForm;
@@ -15,7 +15,6 @@ import cls from 'classnames';
15
15
  import { createForm, onFormValuesChange } from '@formily/core';
16
16
  import { toJS } from '@formily/reactive';
17
17
  import { Form, FormLayout } from '@teamix/formily';
18
- import TeamixIcon from '@teamix/icon';
19
18
  import { usePrefixCls } from '@teamix/utils';
20
19
  import SchemaForm from '../SchemaForm';
21
20
  import { mergeArrayValue } from '../utils';
@@ -109,10 +108,6 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
109
108
  });
110
109
  ProForm.defaultProps = {
111
110
  colon: false,
112
- labelAlign: 'left',
113
- tooltipIcon: /*#__PURE__*/React.createElement(TeamixIcon, {
114
- type: "info-circle-line",
115
- size: "small"
116
- })
111
+ labelAlign: 'left'
117
112
  };
118
113
  export default ProForm;
@@ -109,6 +109,11 @@
109
109
  }
110
110
  }
111
111
 
112
+ // Icon
113
+ .#{$css-prefix}formily-icon {
114
+ transform: translate(0, -1px);
115
+ }
116
+
112
117
  // 撑满模式
113
118
  .#{$form-item-cls}-fullness {
114
119
  > .#{$form-item-cls}-control {
@@ -179,10 +184,20 @@
179
184
 
180
185
  // 数组类组件添加按钮
181
186
  .#{$css-prefix}formily-array-base-addition {
182
- .teamix-icon {
187
+ .#{$css-prefix}formily-icon {
183
188
  margin-right: 4px;
184
189
  }
185
190
  }
191
+ // 数组类ArrayItem Icon 居中
192
+ .#{$css-prefix}formily-array-items-item-inner {
193
+ > .#{$css-prefix}box {
194
+ > .#{$css-prefix}space-item {
195
+ > .#{$css-prefix}formily-icon {
196
+ margin-top: 9px;
197
+ }
198
+ }
199
+ }
200
+ }
186
201
 
187
202
  // Editable预览态行高
188
203
  .#{$css-prefix}formily-editable-content {
@@ -248,6 +263,9 @@
248
263
  // 高级筛选
249
264
  .#{$teamix-pro-form}-filter-advanced,
250
265
  .#{$teamix-pro-form}-filter-simple {
266
+ .#{$form-item-cls}-feedback-layout-popover {
267
+ margin-bottom: 0;
268
+ }
251
269
  .#{$css-prefix}date-picker2-input {
252
270
  .#{$css-prefix}input {
253
271
  width: inherit;
@@ -0,0 +1,5 @@
1
+ declare const _default: () => {
2
+ refresh: () => void;
3
+ field: any;
4
+ };
5
+ export default _default;
@@ -0,0 +1,26 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
+
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import { useField } from '@formily/react';
8
+ import { isPlainObj } from '@teamix/utils';
9
+ export default (function () {
10
+ var field = useField();
11
+
12
+ var refresh = function refresh() {
13
+ if (!isPlainObj(field.data)) {
14
+ field.data = {
15
+ refresh: {}
16
+ };
17
+ } else {
18
+ field.data.refresh = _objectSpread({}, field.data.refresh);
19
+ }
20
+ };
21
+
22
+ return {
23
+ refresh: refresh,
24
+ field: field
25
+ };
26
+ });
@@ -14,13 +14,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
14
14
  * 优先使用配置,即非 undefined
15
15
  * 未配置则按默认规则为基础组件和某些聚合组件添加FormItem
16
16
  */
17
- import { proFieldTypeMap } from './initializeProField';
17
+ import fieldTypeMap from '../fieldTypeMap';
18
18
  export default (function (decorator, component) {
19
19
  if (decorator !== undefined) {
20
20
  return decorator;
21
21
  }
22
22
 
23
- if ([].concat(_toConsumableArray(Object.keys(proFieldTypeMap)), ['Upload', 'ArrayCards', 'ArrayCollapse', 'ArrayTable', 'ArrayItems']).includes(component)) {
23
+ if ([].concat(_toConsumableArray(Object.keys(fieldTypeMap)), ['Upload', 'ArrayCards', 'ArrayCollapse', 'ArrayTable', 'ArrayItems']).includes(component)) {
24
24
  return 'FormItem';
25
25
  }
26
26
 
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { IFormProps } from '../typing';
3
- declare const _default: React.MemoExoticComponent<({ schema, scope, components }: IFormProps) => JSX.Element>;
2
+ import type { ProFormProps } from '../typing';
3
+ declare const _default: React.MemoExoticComponent<({ schema, scope, components }: ProFormProps) => JSX.Element>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request"];
1
+ var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
2
2
 
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
 
@@ -34,9 +34,8 @@ import React, { memo, useCallback, useMemo } from 'react';
34
34
  import { createSchemaField } from '@formily/react';
35
35
  import { Affix } from '@alicloudfe/components';
36
36
  import { Upload, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
37
- import ProField from '../Components/ProField';
37
+ import ProFieldComponents from '../Components/ProField';
38
38
  import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
39
- import Search from '../Components/Search';
40
39
  import FormGroup from '../Components/FormGroup';
41
40
  import QueryFilter from '../Components/QueryFilter';
42
41
  import Text from '../Components/Text/index';
@@ -47,7 +46,6 @@ import initializeRequest from './initializeRequest';
47
46
  import initializeReactions from './initializeReactions';
48
47
  import initializeDataSource from './initializeDataSource';
49
48
  import initializeRules from './initializeRules';
50
- import initializeProField, { proFieldTypeMap } from './initializeProField';
51
49
  import initializeArrayCards from './initializeArrayCards';
52
50
  import initializeArrayCollapse from './initializeArrayCollapse';
53
51
  import initializeArrayTable from './initializeArrayTable';
@@ -57,7 +55,7 @@ import initializeFormGroup from './initializeFormGroup';
57
55
  import initializeFormStep from './initializeFormStep';
58
56
  import initializeFormTab from './initializeFormTab';
59
57
  import initializeFormCollapse from './initializeFormCollapse';
60
- import initializeArrayIcon from './initializeArrayIcon';
58
+ import fieldTypeMap from '../fieldTypeMap';
61
59
  import { getRandomName, mapSchemaName } from '../utils';
62
60
  import warning from '../warning';
63
61
  export default /*#__PURE__*/memo(function (_ref) {
@@ -66,8 +64,7 @@ export default /*#__PURE__*/memo(function (_ref) {
66
64
  components = _ref.components;
67
65
  var SchemaField = useMemo(function () {
68
66
  return createSchemaField({
69
- components: {
70
- ProField: ProField,
67
+ components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
71
68
  FormLayout: FormLayout,
72
69
  FormItem: FormItem,
73
70
  ArrayCollapse: ArrayCollapse,
@@ -89,12 +86,11 @@ export default /*#__PURE__*/memo(function (_ref) {
89
86
  EditableDrawer: EditableDrawer,
90
87
  EditablePopover: EditablePopover,
91
88
  FormGroup: FormGroup,
92
- Search: Search,
93
89
  QueryFilter: QueryFilter,
94
90
  Upload: Upload,
95
91
  Affix: Affix,
96
92
  Text: Text
97
- }
93
+ })
98
94
  });
99
95
  }, []); // 合并schema中request的scope
100
96
 
@@ -110,9 +106,7 @@ export default /*#__PURE__*/memo(function (_ref) {
110
106
  originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
111
107
 
112
108
  if (originalComponent) {
113
- if (Object.keys(proFieldTypeMap).includes(originalComponent)) {
114
- // ProField接管组件
115
- newItem = initializeProField(newItem);
109
+ if (Object.keys(fieldTypeMap).includes(originalComponent)) {// ProField接管组件
116
110
  } else {
117
111
  // 未接管组件,判断是否为Formily组件别名
118
112
  newItem = _objectSpread(_objectSpread({}, newItem), {}, {
@@ -163,11 +157,6 @@ export default /*#__PURE__*/memo(function (_ref) {
163
157
 
164
158
  if (['FormCollapse'].includes(originalComponent)) {
165
159
  newItem = initializeFormCollapse(newItem);
166
- } // Array组件的Icon替换
167
-
168
-
169
- if (/\.(Addition|Remove|MoveUp|MoveDown|SortHandle){1}$/g.test(originalComponent)) {
170
- newItem = initializeArrayIcon(newItem);
171
160
  }
172
161
  }
173
162
 
@@ -185,6 +174,7 @@ export default /*#__PURE__*/memo(function (_ref) {
185
174
  items = _newItem2.items,
186
175
  tooltip = _newItem2.tooltip,
187
176
  request = _newItem2.request,
177
+ data = _newItem2.data,
188
178
  otherProps = _objectWithoutProperties(_newItem2, _excluded); // 默认类型
189
179
 
190
180
 
@@ -231,7 +221,8 @@ export default /*#__PURE__*/memo(function (_ref) {
231
221
  decoratorProps: defaultDecoratorProps,
232
222
  rules: defaultRules,
233
223
  reactions: defaultReactions,
234
- dataSource: defaultDataSource
224
+ dataSource: defaultDataSource,
225
+ data: data
235
226
  })); // 递归子组件
236
227
 
237
228
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
@@ -250,11 +241,11 @@ export default /*#__PURE__*/memo(function (_ref) {
250
241
  type: 'object',
251
242
  properties: formatSchema(schema)
252
243
  };
253
- }, [formatSchema, schema]); // console.log(schemaPro);
244
+ }, []); // console.log(schemaPro);
254
245
 
255
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SchemaField, {
246
+ return /*#__PURE__*/React.createElement(SchemaField, {
256
247
  schema: schemaPro,
257
248
  components: components,
258
249
  scope: mergedScope
259
- }));
250
+ });
260
251
  });
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,6 +1,6 @@
1
- import type { IRequestConfig } from '../';
1
+ import type { ProFormRequestConfig } from '../';
2
2
  interface IInitializeDataSource {
3
- (requestConfig?: any[] | IRequestConfig): {
3
+ (requestConfig?: ProFormRequestConfig | any): {
4
4
  dataSource?: any[];
5
5
  reactions: any[];
6
6
  scope: {
@@ -1,7 +1,7 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
3
  import { isPlainObj } from '@teamix/utils';
4
- import { useRequest, useAsyncDataSource } from '../SchemaForm/reactions';
4
+ import { $request, $dataSource } from './reactions';
5
5
  import { getRandomName } from '../utils';
6
6
 
7
7
  var initializeDataSource = function initializeDataSource(dataSource) {
@@ -13,7 +13,7 @@ var initializeDataSource = function initializeDataSource(dataSource) {
13
13
  var dataSourceScopeName = getRandomName('$dataSource');
14
14
  return {
15
15
  reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ")}}")],
16
- scope: (_scope = {}, _defineProperty(_scope, requestScopeName, useRequest(requestConfig)), _defineProperty(_scope, dataSourceScopeName, useAsyncDataSource), _scope)
16
+ scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(requestConfig)), _defineProperty(_scope, dataSourceScopeName, $dataSource), _scope)
17
17
  };
18
18
  }
19
19
 
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IInitializeItem } from '../typing';
2
- declare const initialize: IInitializeItem;
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
3
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IFormSchemaItem } from '../typing';
2
- declare const initialize: (item: IFormSchemaItem) => IFormSchemaItem;
1
+ import type { ProFormSchemaItem } from '../typing';
2
+ declare const initialize: (item: ProFormSchemaItem) => ProFormSchemaItem;
3
3
  export default initialize;
@@ -1,5 +1,5 @@
1
- import type { IFormSchemaItem } from '../typing';
2
- declare const initialize: (item: IFormSchemaItem & {
1
+ import type { ProFormSchemaItem } from '../typing';
2
+ declare const initialize: (item: ProFormSchemaItem & {
3
3
  col?: number;
4
- }) => IFormSchemaItem;
4
+ }) => ProFormSchemaItem;
5
5
  export default initialize;
@@ -1,3 +1,3 @@
1
- import type { IFormSchemaItem } from '../typing';
2
- declare const initialize: (item: IFormSchemaItem) => IFormSchemaItem;
1
+ import type { ProFormSchemaItem } from '../typing';
2
+ declare const initialize: (item: ProFormSchemaItem) => ProFormSchemaItem;
3
3
  export default initialize;
@@ -1,6 +1,6 @@
1
- import type { IRequestConfig } from '../';
1
+ import type { ProFormRequestConfig } from '../';
2
2
  interface IInitializeRequest {
3
- (requestConfig?: IRequestConfig): {
3
+ (requestConfig?: ProFormRequestConfig): {
4
4
  reactions: any[];
5
5
  scope: {
6
6
  [x: string]: any;
@@ -1,6 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- import { useRequest } from '../SchemaForm/reactions';
3
+ import { $request } from '../SchemaForm/reactions';
4
4
  import { getRandomName } from '../utils';
5
5
 
6
6
  var initializeRequest = function initializeRequest(requestConfig) {
@@ -8,7 +8,7 @@ var initializeRequest = function initializeRequest(requestConfig) {
8
8
  var requestScopeName = getRandomName('$request');
9
9
  return {
10
10
  reactions: ["{{".concat(requestScopeName, "}}")],
11
- scope: _defineProperty({}, requestScopeName, useRequest(requestConfig))
11
+ scope: _defineProperty({}, requestScopeName, $request(requestConfig))
12
12
  };
13
13
  }
14
14
 
@@ -1,33 +1,61 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
1
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
14
 
3
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
16
 
5
17
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
18
 
7
- import { isPlainObj } from '@teamix/utils';
8
- import { useRequest } from '../SchemaForm/reactions';
19
+ import { isArr, isPlainObj } from '@teamix/utils';
20
+ import { $request } from '../SchemaForm/reactions';
9
21
  import { getRandomName } from '../utils';
10
- import { useValidator } from './reactions';
22
+ import { $validator } from './reactions';
11
23
 
12
24
  var initializeRules = function initializeRules(rules) {
13
- if (isPlainObj(rules === null || rules === void 0 ? void 0 : rules.validator)) {
14
- var _scope;
25
+ var initializeValidator = function initializeValidator(rule) {
26
+ if (isPlainObj(rule === null || rule === void 0 ? void 0 : rule.validator)) {
27
+ var _scope;
28
+
29
+ var validator = rule.validator;
30
+ var requestScopeName = getRandomName('$request');
31
+ var validatorScopeName = getRandomName('$validator');
32
+ return {
33
+ rules: _objectSpread(_objectSpread({}, rule), {}, {
34
+ validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ")}}")
35
+ }),
36
+ scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(validator)), _defineProperty(_scope, validatorScopeName, $validator), _scope)
37
+ };
38
+ }
15
39
 
16
- var validator = rules.validator;
17
- var requestScopeName = getRandomName('$request');
18
- var validatorScopeName = getRandomName('$validator');
19
40
  return {
20
- rules: _objectSpread(_objectSpread({}, rules), {}, {
21
- validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ")}}")
22
- }),
23
- scope: (_scope = {}, _defineProperty(_scope, requestScopeName, useRequest(validator)), _defineProperty(_scope, validatorScopeName, useValidator), _scope)
41
+ rules: rule,
42
+ scope: {}
24
43
  };
44
+ };
45
+
46
+ if (isArr(rules)) {
47
+ return rules.reduce(function (prev, current) {
48
+ var result = initializeValidator(current);
49
+ prev.rules = [].concat(_toConsumableArray(prev.rules), [result.rules]);
50
+ prev.scope = _objectSpread(_objectSpread({}, prev.scope), result.scope);
51
+ return prev;
52
+ }, {
53
+ rules: [],
54
+ scope: {}
55
+ });
25
56
  }
26
57
 
27
- return {
28
- rules: rules,
29
- scope: []
30
- };
58
+ return initializeValidator(rules);
31
59
  };
32
60
 
33
61
  export default initializeRules;
@@ -1,5 +1,5 @@
1
- import type { IRequestConfig } from '../typing';
2
- declare const useRequest: (requestConfig: IRequestConfig) => (field: any) => Promise<unknown>;
3
- declare const useValidator: (services: any, onComplete?: any) => (value: any) => any;
4
- declare const useAsyncDataSource: (services: any, onComplete?: any) => (field: any) => any;
5
- export { useRequest, useAsyncDataSource, useValidator };
1
+ import type { ProFormRequestConfig } from '../typing';
2
+ declare const $request: (requestConfig: ProFormRequestConfig) => (field: any) => Promise<unknown>;
3
+ declare const $validator: (services: any, onComplete?: any) => (value: any, rules: any, { field }: any) => any;
4
+ declare const $dataSource: (services: any, onComplete?: any) => (field: any) => any;
5
+ export { $request, $dataSource, $validator };