@teamix/pro 1.1.37 → 1.2.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 (198) hide show
  1. package/README.md +14 -10
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2486 -3754
  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 +12 -0
  9. package/es/actions/dialog.js +104 -27
  10. package/es/actions/index.d.ts +54 -47
  11. package/es/actions/index.js +28 -22
  12. package/es/actions/index.scss +48 -2
  13. package/es/actions/request.d.ts +1 -1
  14. package/es/actions/request.js +2 -2
  15. package/es/card/index.d.ts +17 -5
  16. package/es/card/index.js +16 -11
  17. package/es/form/Components/ProField/index.d.ts +1 -161
  18. package/es/form/Components/ProField/index.js +34 -40
  19. package/es/form/Filter/index.js +2 -2
  20. package/es/form/ProForm/index.d.ts +2 -2
  21. package/es/form/ProForm/index.js +1 -6
  22. package/es/form/ProForm/index.scss +19 -1
  23. package/es/form/ProForm/useFieldRequest.d.ts +5 -0
  24. package/es/form/ProForm/useFieldRequest.js +26 -0
  25. package/es/form/SchemaForm/adapterDecorator.js +2 -2
  26. package/es/form/SchemaForm/index.d.ts +2 -2
  27. package/es/form/SchemaForm/index.js +12 -21
  28. package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  29. package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  30. package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  32. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  33. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  34. package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
  35. package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  36. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  37. package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
  38. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  39. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  40. package/es/form/SchemaForm/initializeRequest.js +2 -2
  41. package/es/form/SchemaForm/initializeRules.js +44 -16
  42. package/es/form/SchemaForm/reactions.d.ts +5 -5
  43. package/es/form/SchemaForm/reactions.js +20 -18
  44. package/es/form/fieldTypeMap.d.ts +4 -0
  45. package/es/form/fieldTypeMap.js +41 -0
  46. package/es/form/index.d.ts +92 -4
  47. package/es/form/index.js +18 -5
  48. package/es/form/schemaNameMap.js +3 -0
  49. package/es/form/typing.d.ts +49 -26
  50. package/es/form/utils.d.ts +3 -1
  51. package/es/form/utils.js +38 -1
  52. package/es/form/warning.d.ts +2 -2
  53. package/es/index.d.ts +1 -1
  54. package/es/index.js +1 -1
  55. package/es/info/components/InfoGroup/index.js +73 -15
  56. package/es/info/components/InfoGroup/index.scss +45 -3
  57. package/es/info/components/InfoValueItem/index.js +9 -4
  58. package/es/info/components/InfoValueItem/index.scss +5 -1
  59. package/es/info/components/ProInfoItem/index.js +3 -3
  60. package/es/info/components/ProInfoItem/index.scss +1 -0
  61. package/es/info/components/baseInfo/index.d.ts +2 -3
  62. package/es/info/components/baseInfo/index.js +29 -10
  63. package/es/info/components/headerInfo/index.d.ts +2 -3
  64. package/es/info/components/tableInfo/index.d.ts +2 -3
  65. package/es/info/components/tableInfo/index.js +2 -2
  66. package/es/info/index.js +75 -51
  67. package/es/info/typing.d.ts +54 -36
  68. package/es/info/utils/index.d.ts +2 -2
  69. package/es/info/utils/utils.d.ts +1 -1
  70. package/es/nocode/pages/renderer.js +2 -2
  71. package/es/page-header/index.d.ts +34 -21
  72. package/es/page-header/index.js +39 -30
  73. package/es/page-header/index.scss +2 -1
  74. package/es/table/components/EmptyContent/index.d.ts +2 -0
  75. package/es/table/components/EmptyContent/index.js +11 -0
  76. package/es/table/components/Filter/index.d.ts +2 -2
  77. package/es/table/components/Filter/index.js +23 -10
  78. package/es/table/components/Filter/index.scss +1 -1
  79. package/es/table/components/Layout/index.js +2 -2
  80. package/es/table/components/QuickAction/index.d.ts +2 -2
  81. package/es/table/components/QuickAction/index.js +3 -3
  82. package/es/table/components/ToolBar/Fullscreen.js +1 -0
  83. package/es/table/index.js +76 -14
  84. package/es/table/index.scss +4 -0
  85. package/es/table/typing.d.ts +29 -14
  86. package/es/table/utils/columnRender.d.ts +3 -3
  87. package/es/table/utils/columnRender.js +2 -2
  88. package/es/table/utils/genProColumnToColumn.d.ts +2 -2
  89. package/es/table/utils/genProColumnToColumn.js +1 -1
  90. package/es/table/utils/index.js +33 -11
  91. package/es/templates/List/index.d.ts +2 -2
  92. package/es/utils/message.d.ts +3 -0
  93. package/es/utils/message.js +19 -0
  94. package/lib/actions/dialog-form.d.ts +5 -5
  95. package/lib/actions/dialog-form.js +1 -5
  96. package/lib/actions/dialog.d.ts +12 -0
  97. package/lib/actions/dialog.js +108 -26
  98. package/lib/actions/index.d.ts +54 -47
  99. package/lib/actions/index.js +37 -30
  100. package/lib/actions/index.scss +48 -2
  101. package/lib/actions/request.d.ts +1 -1
  102. package/lib/actions/request.js +2 -2
  103. package/lib/card/index.d.ts +17 -5
  104. package/lib/card/index.js +18 -12
  105. package/lib/form/Components/ProField/index.d.ts +1 -161
  106. package/lib/form/Components/ProField/index.js +32 -38
  107. package/lib/form/Filter/index.js +2 -2
  108. package/lib/form/ProForm/index.d.ts +2 -2
  109. package/lib/form/ProForm/index.js +1 -7
  110. package/lib/form/ProForm/index.scss +19 -1
  111. package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
  112. package/lib/form/ProForm/useFieldRequest.js +37 -0
  113. package/lib/form/SchemaForm/adapterDecorator.js +4 -2
  114. package/lib/form/SchemaForm/index.d.ts +2 -2
  115. package/lib/form/SchemaForm/index.js +11 -22
  116. package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  117. package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  118. package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  119. package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  120. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  121. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  122. package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
  123. package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  124. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  125. package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
  126. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  127. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  128. package/lib/form/SchemaForm/initializeRequest.js +1 -1
  129. package/lib/form/SchemaForm/initializeRules.js +41 -13
  130. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  131. package/lib/form/SchemaForm/reactions.js +22 -20
  132. package/lib/form/fieldTypeMap.d.ts +4 -0
  133. package/lib/form/fieldTypeMap.js +48 -0
  134. package/lib/form/index.d.ts +92 -4
  135. package/lib/form/index.js +17 -31
  136. package/lib/form/schemaNameMap.js +3 -0
  137. package/lib/form/typing.d.ts +49 -26
  138. package/lib/form/utils.d.ts +3 -1
  139. package/lib/form/utils.js +43 -1
  140. package/lib/form/warning.d.ts +2 -2
  141. package/lib/index.d.ts +1 -1
  142. package/lib/index.js +1 -1
  143. package/lib/info/components/InfoGroup/index.js +76 -14
  144. package/lib/info/components/InfoGroup/index.scss +45 -3
  145. package/lib/info/components/InfoValueItem/index.js +8 -3
  146. package/lib/info/components/InfoValueItem/index.scss +5 -1
  147. package/lib/info/components/ProInfoItem/index.js +2 -2
  148. package/lib/info/components/ProInfoItem/index.scss +1 -0
  149. package/lib/info/components/baseInfo/index.d.ts +2 -3
  150. package/lib/info/components/baseInfo/index.js +29 -10
  151. package/lib/info/components/headerInfo/index.d.ts +2 -3
  152. package/lib/info/components/tableInfo/index.d.ts +2 -3
  153. package/lib/info/components/tableInfo/index.js +1 -1
  154. package/lib/info/index.js +73 -49
  155. package/lib/info/typing.d.ts +54 -36
  156. package/lib/info/utils/index.d.ts +2 -2
  157. package/lib/info/utils/utils.d.ts +1 -1
  158. package/lib/nocode/pages/renderer.js +1 -1
  159. package/lib/page-header/index.d.ts +34 -21
  160. package/lib/page-header/index.js +37 -28
  161. package/lib/page-header/index.scss +2 -1
  162. package/lib/table/components/EmptyContent/index.d.ts +2 -0
  163. package/lib/table/components/EmptyContent/index.js +25 -0
  164. package/lib/table/components/Filter/index.d.ts +2 -2
  165. package/lib/table/components/Filter/index.js +23 -10
  166. package/lib/table/components/Filter/index.scss +1 -1
  167. package/lib/table/components/Layout/index.js +1 -1
  168. package/lib/table/components/QuickAction/index.d.ts +2 -2
  169. package/lib/table/components/QuickAction/index.js +1 -1
  170. package/lib/table/components/ToolBar/Fullscreen.js +1 -0
  171. package/lib/table/index.js +77 -14
  172. package/lib/table/index.scss +4 -0
  173. package/lib/table/typing.d.ts +29 -14
  174. package/lib/table/utils/columnRender.d.ts +3 -3
  175. package/lib/table/utils/columnRender.js +1 -1
  176. package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
  177. package/lib/table/utils/genProColumnToColumn.js +2 -2
  178. package/lib/table/utils/index.js +33 -11
  179. package/lib/templates/List/index.d.ts +2 -2
  180. package/lib/utils/message.d.ts +3 -0
  181. package/lib/utils/message.js +32 -0
  182. package/package.json +4 -4
  183. package/es/form/Components/Search/index.d.ts +0 -11
  184. package/es/form/Components/Search/index.js +0 -89
  185. package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  186. package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
  187. package/es/form/SchemaForm/initializeProField.d.ts +0 -5
  188. package/es/form/SchemaForm/initializeProField.js +0 -70
  189. package/es/info/utils/useInfoRequest.d.ts +0 -14
  190. package/es/info/utils/useInfoRequest.js +0 -76
  191. package/lib/form/Components/Search/index.d.ts +0 -11
  192. package/lib/form/Components/Search/index.js +0 -103
  193. package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  194. package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
  195. package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
  196. package/lib/form/SchemaForm/initializeProField.js +0 -77
  197. package/lib/info/utils/useInfoRequest.d.ts +0 -14
  198. package/lib/info/utils/useInfoRequest.js +0 -85
@@ -15,37 +15,99 @@ var _hooks = require("@teamix/hooks");
15
15
 
16
16
  require("./index.scss");
17
17
 
18
+ var _classnames = _interopRequireDefault(require("classnames"));
19
+
20
+ var _ = _interopRequireDefault(require("../.."));
21
+
22
+ var _excluded = ["children", "url", "method", "params", "formatResult", "onSuccess", "onError", "formatParams", "beforeRequest", "extendParams", "className", "compacted", "divider", "style", "backgroundColor"];
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
18
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
27
 
20
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
29
 
30
+ 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; }
31
+
32
+ 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; }
33
+
34
+ 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; }
35
+
36
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
37
+
38
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
+
22
40
  var ProInfoGroup = function ProInfoGroup(props) {
23
41
  var children = props.children,
24
42
  url = props.url,
25
43
  method = props.method,
26
44
  params = props.params,
27
- formatResult = props.formatResult;
45
+ formatResult = props.formatResult,
46
+ onSuccess = props.onSuccess,
47
+ onError = props.onError,
48
+ formatParams = props.formatParams,
49
+ beforeRequest = props.beforeRequest,
50
+ extendParams = props.extendParams,
51
+ _props$className = props.className,
52
+ className = _props$className === void 0 ? '' : _props$className,
53
+ _props$compacted = props.compacted,
54
+ compacted = _props$compacted === void 0 ? true : _props$compacted,
55
+ _props$divider = props.divider,
56
+ divider = _props$divider === void 0 ? true : _props$divider,
57
+ style = props.style,
58
+ _props$backgroundColo = props.backgroundColor,
59
+ backgroundColor = _props$backgroundColo === void 0 ? '' : _props$backgroundColo,
60
+ others = _objectWithoutProperties(props, _excluded);
61
+
28
62
  var ref = (0, _react.useRef)();
29
63
  var size = (0, _hooks.useSize)(ref);
30
- return /*#__PURE__*/_react.default.createElement(_utils.ProInfoGroupContext.Provider, {
31
- value: {
32
- visible: true,
33
- size: size,
34
- url: url,
35
- method: method,
36
- params: params,
37
- formatResult: formatResult
64
+ var infoType = 'infoDom';
65
+
66
+ if (Array.isArray(children)) {
67
+ if ( /*#__PURE__*/(0, _react.isValidElement)(children === null || children === void 0 ? void 0 : children[0])) {
68
+ infoType = 'infoDomGroup';
69
+ } else {
70
+ infoType = 'infoPropsGroup';
38
71
  }
72
+ }
73
+
74
+ var providerValue = {
75
+ visible: true,
76
+ size: size,
77
+ url: url,
78
+ method: method,
79
+ params: params,
80
+ formatResult: formatResult,
81
+ onSuccess: onSuccess,
82
+ onError: onError,
83
+ formatParams: formatParams,
84
+ beforeRequest: beforeRequest,
85
+ extendParams: extendParams
86
+ };
87
+ var proInfoClassName = (0, _classnames.default)({
88
+ 'teamix-pro-info-group-item': true,
89
+ 'teamix-pro-info-group-item-divider': divider
90
+ });
91
+ return /*#__PURE__*/_react.default.createElement(_utils.ProInfoGroupContext.Provider, {
92
+ value: providerValue
39
93
  }, /*#__PURE__*/_react.default.createElement("div", {
40
- className: "teamix-pro-info-group",
94
+ className: "teamix-pro-info-group ".concat(backgroundColor, " ").concat(className),
95
+ style: style,
41
96
  ref: ref
42
- }, Array.isArray(children) && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
97
+ }, infoType === 'infoDomGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
43
98
  return /*#__PURE__*/_react.default.createElement("div", {
44
- className: "teamix-pro-info-group-item",
99
+ className: proInfoClassName,
45
100
  key: index
46
101
  }, item);
47
- })), !Array.isArray(children) && /*#__PURE__*/_react.default.createElement("div", {
48
- className: "teamix-pro-info-group-item"
102
+ })), infoType === 'infoPropsGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
103
+ return /*#__PURE__*/_react.default.createElement("div", {
104
+ className: proInfoClassName,
105
+ key: index
106
+ }, /*#__PURE__*/_react.default.createElement(_.default, _objectSpread({
107
+ compacted: compacted
108
+ }, item)));
109
+ })), infoType === 'infoDom' && /*#__PURE__*/_react.default.createElement("div", {
110
+ className: proInfoClassName
49
111
  }, children)));
50
112
  };
51
113
 
@@ -1,14 +1,32 @@
1
1
  .teamix-pro-info-group {
2
2
  &-item {
3
+
3
4
  margin-top: 16px;
4
- border-bottom: 1px solid var(--color-line1-1, #eaeaea);
5
- margin-bottom: 16px;
5
+ margin-bottom: 0;
6
6
 
7
7
  .teamix-pro-info {
8
- padding-bottom: 8px;
8
+ padding-bottom: 0;
9
+
10
+ .teamix-pro-card-content {
11
+ padding-bottom: calc(var(--card-body-padding-bottom, 16px) - 8px)
12
+ }
13
+
14
+ .compacted {
15
+ margin-bottom: -8px;
16
+ }
17
+ }
18
+
19
+ &-divider {
20
+ border-bottom: 1px solid var(--color-line1-1, #eaeaea);
21
+ margin-bottom: 16px;
22
+ .teamix-pro-info {
23
+ padding-bottom: 16px;
24
+ }
9
25
  }
10
26
 
11
27
  }
28
+
29
+
12
30
  .teamix-pro-info-group-item:last-child {
13
31
  border-bottom: 0;
14
32
  margin-bottom: 0;
@@ -19,4 +37,28 @@
19
37
  .teamix-pro-info-group-item:first-child {
20
38
  margin-top: 0;
21
39
  }
40
+
41
+ &.blue {
42
+ background-color: var(--color-notice-1);
43
+ }
44
+
45
+ &.orange {
46
+ background-color: var(--color-warning-1);
47
+ }
48
+
49
+ &.yellow {
50
+ background-color: var(--color-help-1);
51
+ }
52
+
53
+ &.red {
54
+ background-color: var(--color-error-1);
55
+ }
56
+
57
+ &.green {
58
+ background-color: var(--color-success-1);
59
+ }
60
+
61
+ &.grey {
62
+ background-color: var(--color-fill1-2);
63
+ }
22
64
  }
@@ -94,7 +94,9 @@ var InfoValueItem = function InfoValueItem(props) {
94
94
  var _processRenderFunctio;
95
95
 
96
96
  if (typeof render === 'function') {
97
- return render;
97
+ return function () {
98
+ render(value, record);
99
+ };
98
100
  }
99
101
 
100
102
  var newRender = processBuriedPoint((_processRenderFunctio = processRenderFunction(render !== null && render !== void 0 ? render : {}, value, record)) !== null && _processRenderFunctio !== void 0 ? _processRenderFunctio : {}, value, record);
@@ -150,11 +152,14 @@ var InfoValueItem = function InfoValueItem(props) {
150
152
 
151
153
  var renderAction = function renderAction() {
152
154
  if (actions) {
153
- return /*#__PURE__*/_react.default.createElement(_actions.ActionGroup, {
155
+ return /*#__PURE__*/_react.default.createElement(_actions.ProActionGroup, {
154
156
  actions: actions,
155
157
  type: "text",
156
158
  style: {
157
159
  marginLeft: '8px'
160
+ },
161
+ context: {
162
+ record: record
158
163
  }
159
164
  });
160
165
  }
@@ -328,7 +333,7 @@ var InfoValueItem = function InfoValueItem(props) {
328
333
  }
329
334
 
330
335
  return /*#__PURE__*/_react.default.createElement("div", {
331
- className: cls()
336
+ className: cls('item-value')
332
337
  }, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread({
333
338
  type: type,
334
339
  value: value,
@@ -17,5 +17,9 @@
17
17
  }
18
18
  }
19
19
  .teamix-pro-info {
20
- display: flex;
20
+ &-item-value {
21
+ display: flex;
22
+ align-items: center;
23
+ }
24
+
21
25
  }
@@ -49,7 +49,7 @@ var ProInfoItem = function ProInfoItem(prop) {
49
49
  className: cls('value')
50
50
  }, loading && /*#__PURE__*/_react.default.createElement("div", {
51
51
  className: cls('base-skeleton-box')
52
- }, /*#__PURE__*/_react.default.createElement(_.BaseSkeleton.Info, null)), !loading && /*#__PURE__*/_react.default.createElement("div", null, value))));
52
+ }, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && /*#__PURE__*/_react.default.createElement("div", null, value))));
53
53
  }
54
54
 
55
55
  if (headerInfoLayout) {
@@ -70,7 +70,7 @@ var ProInfoItem = function ProInfoItem(prop) {
70
70
  }
71
71
  }, loading && /*#__PURE__*/_react.default.createElement("div", {
72
72
  className: cls('base-skeleton-box')
73
- }, /*#__PURE__*/_react.default.createElement(_.BaseSkeleton.Info, null)), !loading && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value))));
73
+ }, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value))));
74
74
  }
75
75
 
76
76
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
@@ -47,6 +47,7 @@ $item-padding-bottom: 8px;
47
47
  font-size: $header-text-size;
48
48
  display: inline-block;
49
49
  width: 100%;
50
+ padding-right: 20px;
50
51
  }
51
52
 
52
53
  .teamix-pro-field-info-form-item-base-skeleton-box {
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import { ProInfoBaseProps, ProInfoTransparentBase } from '../../typing';
2
+ import { ProInfoBaseProps, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
3
3
  import './index.scss';
4
- import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
5
- declare type ProBaseInfoProps = ProInfoBaseProps & IUseInfoRequestResult & ProInfoTransparentBase & {
4
+ declare type ProBaseInfoProps = ProInfoBaseProps & ProInfoTransRequestResult & ProInfoTransparentBase & {
6
5
  size?: any;
7
6
  };
8
7
  declare const ProBaseInfo: React.FC<ProBaseInfoProps>;
@@ -37,29 +37,48 @@ var ProBaseInfo = function ProBaseInfo(props) {
37
37
  layout = props.layout,
38
38
  size = props.size;
39
39
 
40
- var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列的布局参数
40
+ var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列内的布局参数
41
41
 
42
42
 
43
- var getFormItemLayout = function getFormItemLayout() {
43
+ var getFormItemLayout = function getFormItemLayout(colspan) {
44
+ var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
45
+
44
46
  if (layout) {
45
47
  var _layout$labelCol, _layout$wrapperCol;
46
48
 
47
- return {
48
- labelCol: (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol,
49
- wrapperCol: (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol
50
- };
49
+ var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
50
+ var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
51
+ formItemLayout.labelCol = labelCol;
52
+ formItemLayout.wrapperCol = wrapperCol;
53
+ }
54
+
55
+ var newLabelSpan = formItemLayout.labelCol.span;
56
+ var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
57
+
58
+ if (colspan) {
59
+ newLabelSpan = newLabelSpan / colspan;
60
+ newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
51
61
  }
52
62
 
53
- return defaultLayout.formItemLayout;
63
+ var newFormItemLayout = {
64
+ labelCol: {
65
+ span: newLabelSpan
66
+ },
67
+ wrapperCol: {
68
+ span: newWrapperSpan
69
+ }
70
+ };
71
+ return Object.assign(formItemLayout, newFormItemLayout);
54
72
  };
55
73
 
56
74
  var renderContent = function renderContent() {
57
75
  return columns.map(function (item, index) {
58
- var _layout$span, _item$title, _item$valueType, _ref;
76
+ var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
59
77
 
60
78
  var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
79
+ var layoutSpan = item.colSpan ? ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span) * item.colSpan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : span;
61
80
  return /*#__PURE__*/_react.default.createElement(Col, {
62
- span: (_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span,
81
+ span: layoutSpan,
63
82
  key: index
64
83
  }, /*#__PURE__*/_react.default.createElement(_ProInfoItem.default, {
65
84
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
@@ -73,7 +92,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
73
92
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
74
93
  actionRef: actionRef
75
94
  }),
76
- baseInfoLayout: getFormItemLayout(),
95
+ baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
77
96
  tooltip: item.tooltip,
78
97
  tooltipIcon: item.tooltipIcon
79
98
  }));
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import { IProHeaderInfo, ProInfoTransparentBase } from '../../typing';
3
- import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
2
+ import { IProHeaderInfo, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
4
3
  import './index.scss';
5
- declare type ProHeaderInfoProps = IProHeaderInfo & IUseInfoRequestResult & ProInfoTransparentBase & {
4
+ declare type ProHeaderInfoProps = IProHeaderInfo & ProInfoTransRequestResult & ProInfoTransparentBase & {
6
5
  size?: any;
7
6
  };
8
7
  declare const ProHeaderInfo: React.FC<ProHeaderInfoProps>;
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import './index.scss';
3
- import { IProTableInfo, ProInfoTransparentBase } from '../../typing';
3
+ import { IProTableInfo, ProInfoTransparentBase, ProInfoTransRequestResult } from '../../typing';
4
4
  import './index.scss';
5
- import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
6
- declare type ProTableInfoProps = IProTableInfo & IUseInfoRequestResult & ProInfoTransparentBase;
5
+ declare type ProTableInfoProps = IProTableInfo & ProInfoTransRequestResult & ProInfoTransparentBase;
7
6
  declare const ProTableInfo: React.FC<ProTableInfoProps>;
8
7
  export default ProTableInfo;
@@ -128,7 +128,7 @@ var ProTableInfo = function ProTableInfo(props) {
128
128
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
129
129
  tooltip: item.tooltip,
130
130
  icon: item.tooltipIcon
131
- })), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading && /*#__PURE__*/_react.default.createElement(_2.BaseSkeleton.Info, null), !loading && getInfoValueItem(item))), _data);
131
+ })), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading && /*#__PURE__*/_react.default.createElement(_2.ProSkeletonRaw.Info.Item, null), !loading && getInfoValueItem(item))), _data);
132
132
 
133
133
  if (item.colSpan) {
134
134
  data['formatter'] = {
package/lib/info/index.js CHANGED
@@ -41,7 +41,7 @@ Object.keys(_typing).forEach(function (key) {
41
41
  }
42
42
  });
43
43
  });
44
- var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource"];
44
+ var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra"];
45
45
 
46
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
47
 
@@ -72,22 +72,30 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
72
72
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
73
73
 
74
74
  var ProInfo = function ProInfo(props) {
75
+ var _ref;
76
+
75
77
  var _props$type = props.type,
76
78
  type = _props$type === void 0 ? 'base' : _props$type,
77
79
  url = props.url,
78
80
  _props$method = props.method,
79
81
  method = _props$method === void 0 ? 'post' : _props$method,
80
82
  formatResult = props.formatResult,
83
+ formatParams = props.formatParams,
81
84
  params = props.params,
82
85
  propsActionRef = props.actionRef,
83
86
  _props$header = props.header,
84
87
  header = _props$header === void 0 ? {} : _props$header,
85
- _onError = props.onError,
88
+ onSuccess = props.onSuccess,
89
+ onError = props.onError,
90
+ beforeRequest = props.beforeRequest,
91
+ extendParams = props.extendParams,
86
92
  className = props.className,
87
93
  style = props.style,
88
94
  columns = props.columns,
89
95
  layout = props.layout,
90
96
  dataSource = props.dataSource,
97
+ userLoading = props.loading,
98
+ extra = props.extra,
91
99
  others = _objectWithoutProperties(props, _excluded);
92
100
 
93
101
  var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
@@ -96,62 +104,59 @@ var ProInfo = function ProInfo(props) {
96
104
  contextParams = _useContext.params,
97
105
  contextFormatResult = _useContext.formatResult,
98
106
  contextVisible = _useContext.visible,
99
- contextSize = _useContext.size; // 获取容器宽度
107
+ contextSize = _useContext.size,
108
+ contextOnSuccess = _useContext.onSuccess,
109
+ contextOnError = _useContext.onError,
110
+ contextFormatParams = _useContext.formatParams,
111
+ contextBeforeRequest = _useContext.beforeRequest,
112
+ contextExtendParams = _useContext.extendParams; // 获取容器宽度
100
113
 
101
114
 
102
115
  var ref = (0, _react.useRef)();
103
- var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref); // 请求数据
116
+ var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref);
104
117
 
105
118
  var _useState = (0, _react.useState)(false),
106
119
  _useState2 = _slicedToArray(_useState, 2),
107
120
  loading = _useState2[0],
108
- setLoading = _useState2[1]; // 获取数据
121
+ setLoading = _useState2[1]; // 请求数据
109
122
 
110
123
 
111
- var getDataSource = function getDataSource(result) {
112
- if (formatResult) {
113
- if (typeof formatResult === 'function') {
114
- return formatResult === null || formatResult === void 0 ? void 0 : formatResult(result);
115
- } else if (formatResult) {
116
- return (0, _utils2.getDeepValue)(formatResult.data, result);
117
- } else {
118
- return result;
119
- }
120
- }
121
-
122
- return result;
123
- };
124
+ var _useState3 = (0, _react.useState)(),
125
+ _useState4 = _slicedToArray(_useState3, 2),
126
+ data = _useState4[0],
127
+ setData = _useState4[1];
124
128
 
125
129
  var requestDataKey = (contextMethod !== null && contextMethod !== void 0 ? contextMethod : method).toLowerCase() === 'get' ? 'params' : 'data';
130
+
131
+ var requestConfig = _defineProperty({
132
+ url: (_ref = contextUrl !== null && contextUrl !== void 0 ? contextUrl : url) !== null && _ref !== void 0 ? _ref : '',
133
+ method: contextMethod !== null && contextMethod !== void 0 ? contextMethod : method,
134
+ formatResult: contextFormatResult !== null && contextFormatResult !== void 0 ? contextFormatResult : formatResult,
135
+ onSuccess: contextOnSuccess !== null && contextOnSuccess !== void 0 ? contextOnSuccess : onSuccess,
136
+ onError: contextOnError !== null && contextOnError !== void 0 ? contextOnError : onError,
137
+ formatParams: contextFormatParams !== null && contextFormatParams !== void 0 ? contextFormatParams : formatParams,
138
+ beforeRequest: contextBeforeRequest !== null && contextBeforeRequest !== void 0 ? contextBeforeRequest : beforeRequest,
139
+ extendParams: contextExtendParams !== null && contextExtendParams !== void 0 ? contextExtendParams : extendParams
140
+ }, requestDataKey, contextParams !== null && contextParams !== void 0 ? contextParams : params);
141
+
126
142
  (0, _react.useEffect)(function () {
127
143
  if (url || contextUrl) {
128
144
  setLoading(false);
129
- getData.run({});
145
+ request();
130
146
  } else {
131
147
  setLoading(false);
132
148
  }
133
- }, []);
134
- var getData = (0, _utils2.useRequest)(function (params) {
135
- var _ref;
136
-
137
- return _defineProperty({
138
- url: (_ref = contextUrl !== null && contextUrl !== void 0 ? contextUrl : url) !== null && _ref !== void 0 ? _ref : '',
139
- method: contextMethod !== null && contextMethod !== void 0 ? contextMethod : method
140
- }, requestDataKey, contextParams !== null && contextParams !== void 0 ? contextParams : params);
141
- }, {
142
- // 使用 request 方法代替 fetch
143
- requestMethod: function requestMethod(params) {
144
- return (0, _utils2.request)(params);
145
- },
146
- manual: true,
147
- onSuccess: function onSuccess(result) {
148
- props.onSuccess && props.onSuccess(result);
149
- },
150
- onError: function onError(error) {
149
+ }, []); // 获取数据
150
+
151
+ var request = function request() {
152
+ setLoading(true);
153
+ (0, _utils2.doCommonRequest)(requestConfig).then(function (resp) {
154
+ setData(resp);
155
+ }).finally(function () {
151
156
  setLoading(false);
152
- _onError === null || _onError === void 0 ? void 0 : _onError(error);
153
- }
154
- });
157
+ });
158
+ };
159
+
155
160
  var actionRef = (0, _react.useRef)(); // 将 Actions 绑定到传入的 propsActionRef 中
156
161
 
157
162
  if (propsActionRef) {
@@ -161,39 +166,58 @@ var ProInfo = function ProInfo(props) {
161
166
 
162
167
  (0, _utils.useActionType)(actionRef, {
163
168
  refresh: function refresh() {
164
- getData.run({});
169
+ request();
165
170
  }
166
171
  });
172
+
173
+ var getExtra = function getExtra() {
174
+ if (!extra) {
175
+ return undefined;
176
+ }
177
+
178
+ if ( /*#__PURE__*/(0, _react.isValidElement)(extra)) {
179
+ return extra;
180
+ }
181
+
182
+ return _objectSpread(_objectSpread({}, extra), {}, {
183
+ context: {
184
+ record: dataSource !== null && dataSource !== void 0 ? dataSource : data
185
+ }
186
+ });
187
+ };
188
+
167
189
  return /*#__PURE__*/_react.default.createElement("div", {
168
190
  ref: ref,
169
191
  className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
170
192
  style: style
171
- }, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread({
193
+ }, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread(_objectSpread({
172
194
  compacted: true,
173
195
  hoveredShadow: false,
174
196
  bordered: false,
175
197
  backgroundColor: "transparent"
176
- }, header), others), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
198
+ }, header), others), {}, {
199
+ extra: getExtra()
200
+ }), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
177
201
  dataSource: dataSource,
178
202
  columns: columns,
179
- loading: loading || getData.loading,
180
- result: getDataSource(getData.data),
203
+ loading: userLoading || loading,
204
+ result: data,
181
205
  actionRef: actionRef,
182
206
  layout: layout
183
207
  }), type === 'header' && /*#__PURE__*/_react.default.createElement(_headerInfo.default, {
184
208
  dataSource: dataSource,
185
209
  columns: columns,
186
210
  header: header,
187
- loading: loading || getData.loading,
188
- result: getDataSource(getData.data),
211
+ loading: userLoading || loading,
212
+ result: data,
189
213
  actionRef: actionRef,
190
214
  layout: layout,
191
215
  size: size
192
216
  }), type === 'base' && /*#__PURE__*/_react.default.createElement(_baseInfo.default, {
193
217
  dataSource: dataSource,
194
218
  columns: columns,
195
- loading: loading || getData.loading,
196
- result: getDataSource(getData.data),
219
+ loading: userLoading || loading,
220
+ result: data,
197
221
  actionRef: actionRef,
198
222
  layout: layout,
199
223
  size: size