@teamix/pro 1.1.33 → 1.1.37

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 (59) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +435 -271
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +8 -1
  6. package/es/actions/dialog-form.js +32 -15
  7. package/es/actions/dialog-info.d.ts +9 -0
  8. package/es/actions/dialog-info.js +23 -0
  9. package/es/actions/dialog.d.ts +2 -0
  10. package/es/actions/dialog.js +11 -4
  11. package/es/actions/drawer-info.d.ts +6 -0
  12. package/es/actions/drawer-info.js +7 -0
  13. package/es/actions/index.d.ts +11 -5
  14. package/es/actions/index.js +28 -12
  15. package/es/actions/index.scss +8 -0
  16. package/es/actions/link.js +4 -12
  17. package/es/form/SchemaForm/reactions.js +4 -2
  18. package/es/index.d.ts +1 -1
  19. package/es/index.js +1 -1
  20. package/es/info/components/InfoValueItem/index.js +108 -26
  21. package/es/info/components/baseInfo/index.d.ts +3 -1
  22. package/es/info/components/baseInfo/index.js +6 -33
  23. package/es/info/components/headerInfo/index.d.ts +3 -1
  24. package/es/info/components/headerInfo/index.js +8 -39
  25. package/es/info/components/tableInfo/index.js +4 -21
  26. package/es/info/index.js +47 -25
  27. package/es/info/index.scss +0 -4
  28. package/es/info/typing.d.ts +14 -5
  29. package/es/page-header/index.d.ts +9 -5
  30. package/es/page-header/index.js +22 -7
  31. package/es/table/index.js +3 -1
  32. package/lib/actions/dialog-form.d.ts +8 -1
  33. package/lib/actions/dialog-form.js +32 -15
  34. package/lib/actions/dialog-info.d.ts +9 -0
  35. package/lib/actions/dialog-info.js +37 -0
  36. package/lib/actions/dialog.d.ts +2 -0
  37. package/lib/actions/dialog.js +11 -4
  38. package/lib/actions/drawer-info.d.ts +6 -0
  39. package/lib/actions/drawer-info.js +18 -0
  40. package/lib/actions/index.d.ts +11 -5
  41. package/lib/actions/index.js +30 -12
  42. package/lib/actions/index.scss +8 -0
  43. package/lib/actions/link.js +5 -12
  44. package/lib/form/SchemaForm/reactions.js +4 -2
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.js +1 -1
  47. package/lib/info/components/InfoValueItem/index.js +107 -25
  48. package/lib/info/components/baseInfo/index.d.ts +3 -1
  49. package/lib/info/components/baseInfo/index.js +5 -40
  50. package/lib/info/components/headerInfo/index.d.ts +3 -1
  51. package/lib/info/components/headerInfo/index.js +7 -46
  52. package/lib/info/components/tableInfo/index.js +4 -22
  53. package/lib/info/index.js +49 -25
  54. package/lib/info/index.scss +0 -4
  55. package/lib/info/typing.d.ts +14 -5
  56. package/lib/page-header/index.d.ts +9 -5
  57. package/lib/page-header/index.js +22 -7
  58. package/lib/table/index.js +3 -1
  59. package/package.json +1 -1
@@ -1,44 +1,24 @@
1
- var _excluded = ["header", "columns", "dataSource", "loading", "result", "actionRef", "className", "layout"];
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- 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; }
10
-
11
- 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; }
12
-
13
1
  import { Grid } from '@alicloudfe/components';
14
- import { ProCard } from '../../../';
15
- import React, { useContext, useRef } from 'react';
2
+ import React from 'react';
16
3
  import ProInfoItem from '../ProInfoItem';
17
4
  import './index.scss';
18
- import { useSize } from '@teamix/hooks';
19
5
  import { getLayout } from '../../utils/utils';
20
6
  import defaultLayoutMap from '../../utils/layout';
21
7
  import InfoValueItem from '../InfoValueItem';
22
- import { getDataIndexValue, ProInfoGroupContext } from '../../utils';
8
+ import { getDataIndexValue } from '../../utils';
23
9
  var Row = Grid.Row,
24
10
  Col = Grid.Col;
25
11
 
26
12
  var ProBaseInfo = function ProBaseInfo(props) {
27
13
  var _size$width;
28
14
 
29
- var header = props.header,
30
- columns = props.columns,
15
+ var columns = props.columns,
31
16
  dataSource = props.dataSource,
32
17
  loading = props.loading,
33
18
  result = props.result,
34
19
  actionRef = props.actionRef,
35
- className = props.className,
36
20
  layout = props.layout,
37
- others = _objectWithoutProperties(props, _excluded);
38
-
39
- var context = useContext(ProInfoGroupContext);
40
- var ref = useRef();
41
- var size = context.visible ? context.size : useSize(ref);
21
+ size = props.size;
42
22
  var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列的布局参数
43
23
 
44
24
  var getFormItemLayout = function getFormItemLayout() {
@@ -81,17 +61,10 @@ var ProBaseInfo = function ProBaseInfo(props) {
81
61
  });
82
62
  };
83
63
 
84
- return /*#__PURE__*/React.createElement("div", _objectSpread({
85
- ref: ref,
86
- className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : '')
87
- }, others), (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
88
- compacted: true,
89
- hoveredShadow: false,
90
- bordered: false
91
- }, header), /*#__PURE__*/React.createElement(Row, {
64
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
92
65
  wrap: true,
93
66
  className: "teamix-pro-info-content-row"
94
- }, renderContent())));
67
+ }, renderContent()));
95
68
  };
96
69
 
97
70
  export default ProBaseInfo;
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { IProHeaderInfo, ProInfoTransparentBase } from '../../typing';
3
3
  import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
4
4
  import './index.scss';
5
- declare type ProHeaderInfoProps = IProHeaderInfo & IUseInfoRequestResult & ProInfoTransparentBase;
5
+ declare type ProHeaderInfoProps = IProHeaderInfo & IUseInfoRequestResult & ProInfoTransparentBase & {
6
+ size?: any;
7
+ };
6
8
  declare const ProHeaderInfo: React.FC<ProHeaderInfoProps>;
7
9
  export default ProHeaderInfo;
@@ -1,44 +1,24 @@
1
- var _excluded = ["header", "columns", "dataSource", "layout", "loading", "result", "actionRef", "className"];
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- 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; }
10
-
11
- 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; }
12
-
13
1
  import { Grid } from '@alicloudfe/components';
14
- import ProCard from '../../../card';
15
- import React, { useContext, useRef } from 'react';
2
+ import React from 'react';
16
3
  import ProInfoItem from '../ProInfoItem';
17
4
  import './index.scss';
18
5
  import defaultLayoutMap from '../../utils/layout';
19
- import { useSize } from '@teamix/hooks';
20
6
  import { getLayout } from '../../utils/utils';
21
7
  import InfoValueItem from '../InfoValueItem';
22
- import { getDataIndexValue, ProInfoGroupContext } from '../../utils';
8
+ import { getDataIndexValue } from '../../utils';
23
9
  var Row = Grid.Row,
24
10
  Col = Grid.Col;
25
11
 
26
12
  var ProHeaderInfo = function ProHeaderInfo(props) {
27
13
  var _size$width;
28
14
 
29
- var header = props.header,
30
- columns = props.columns,
15
+ var columns = props.columns,
31
16
  dataSource = props.dataSource,
32
17
  layout = props.layout,
33
18
  loading = props.loading,
34
19
  result = props.result,
35
20
  actionRef = props.actionRef,
36
- className = props.className,
37
- others = _objectWithoutProperties(props, _excluded);
38
-
39
- var context = useContext(ProInfoGroupContext);
40
- var ref = useRef();
41
- var size = context.visible ? context.size : useSize(ref);
21
+ size = props.size;
42
22
  var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
43
23
 
44
24
  var renderContent = function renderContent() {
@@ -79,21 +59,10 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
79
59
  });
80
60
  };
81
61
 
82
- return (
83
- /*#__PURE__*/
84
- // TODO 优化透传方式
85
- React.createElement("div", _objectSpread({
86
- ref: ref,
87
- className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : '')
88
- }, others), (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
89
- compacted: true,
90
- hoveredShadow: false,
91
- bordered: false
92
- }, header), /*#__PURE__*/React.createElement(Row, {
93
- wrap: true,
94
- className: "teamix-pro-info-content-row"
95
- }, renderContent())))
96
- );
62
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
63
+ wrap: true,
64
+ className: "teamix-pro-info-content-row"
65
+ }, renderContent()));
97
66
  };
98
67
 
99
68
  export default ProHeaderInfo;
@@ -1,5 +1,3 @@
1
- var _excluded = ["header", "columns", "dataSource", "layout", "loading", "result", "actionRef", "className"];
2
-
3
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; }
4
2
 
5
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; }
@@ -18,32 +16,23 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
18
16
 
19
17
  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; }
20
18
 
21
- 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; }
22
-
23
- 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; }
24
-
25
19
  import React, { useMemo } from 'react';
26
20
  import './index.scss';
27
21
  import { Table } from '@alicloudfe/components';
28
22
  import './index.scss';
29
- import ProCard from '../../../card';
30
23
  import { LabelIconTip } from '@teamix/utils';
31
24
  import InfoValueItem from '../InfoValueItem';
32
25
  import { BaseSkeleton } from '../../..';
33
26
  import { getDataIndexValue } from '../../utils';
34
27
 
35
28
  var ProTableInfo = function ProTableInfo(props) {
36
- var header = props.header,
37
- columns = props.columns,
29
+ var columns = props.columns,
38
30
  dataSource = props.dataSource,
39
31
  _props$layout = props.layout,
40
32
  layout = _props$layout === void 0 ? {} : _props$layout,
41
33
  loading = props.loading,
42
34
  result = props.result,
43
- actionRef = props.actionRef,
44
- className = props.className,
45
- others = _objectWithoutProperties(props, _excluded);
46
-
35
+ actionRef = props.actionRef;
47
36
  var _layout$colNum = layout.colNum,
48
37
  colNum = _layout$colNum === void 0 ? 2 : _layout$colNum,
49
38
  _layout$labelGutter = layout.labelGutter,
@@ -173,20 +162,14 @@ var ProTableInfo = function ProTableInfo(props) {
173
162
  }
174
163
  };
175
164
 
176
- return /*#__PURE__*/React.createElement("div", _objectSpread({
177
- className: "teamix-pro-info ".concat(className)
178
- }, others), /*#__PURE__*/React.createElement(ProCard, _objectSpread({
179
- compacted: true,
180
- hoveredShadow: false,
181
- bordered: false
182
- }, header), /*#__PURE__*/React.createElement(Table.StickyLock, {
165
+ return /*#__PURE__*/React.createElement(Table.StickyLock, {
183
166
  className: "teamix-pro-info-table",
184
167
  cellProps: setCellProps,
185
168
  columns: newColumns(),
186
169
  hasHeader: false,
187
170
  hasBorder: true,
188
171
  dataSource: newDataSource
189
- })));
172
+ });
190
173
  };
191
174
 
192
175
  export default ProTableInfo;
package/es/info/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError"];
1
+ var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource"];
2
2
 
3
3
  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; }
4
4
 
@@ -30,10 +30,13 @@ import ProInfoGroup from './components/InfoGroup';
30
30
  import './index.scss';
31
31
  import { ProInfoGroupContext, useActionType } from './utils';
32
32
  import { getDeepValue, request as utilResquest, useRequest } from '@teamix/utils';
33
+ import { useSize } from '@teamix/hooks';
34
+ import { ProCard } from '..';
33
35
  export * from './typing';
34
36
 
35
37
  var ProInfo = function ProInfo(props) {
36
- var type = props.type,
38
+ var _props$type = props.type,
39
+ type = _props$type === void 0 ? 'base' : _props$type,
37
40
  url = props.url,
38
41
  _props$method = props.method,
39
42
  method = _props$method === void 0 ? 'post' : _props$method,
@@ -43,15 +46,25 @@ var ProInfo = function ProInfo(props) {
43
46
  _props$header = props.header,
44
47
  header = _props$header === void 0 ? {} : _props$header,
45
48
  _onError = props.onError,
49
+ className = props.className,
50
+ style = props.style,
51
+ columns = props.columns,
52
+ layout = props.layout,
53
+ dataSource = props.dataSource,
46
54
  others = _objectWithoutProperties(props, _excluded);
47
55
 
48
56
  var _useContext = useContext(ProInfoGroupContext),
49
57
  contextUrl = _useContext.url,
50
58
  contextMethod = _useContext.method,
51
59
  contextParams = _useContext.params,
52
- contextFormatResult = _useContext.formatResult; // 请求数据
60
+ contextFormatResult = _useContext.formatResult,
61
+ contextVisible = _useContext.visible,
62
+ contextSize = _useContext.size; // 获取容器宽度
53
63
 
54
64
 
65
+ var ref = useRef();
66
+ var size = contextVisible ? contextSize : useSize(ref); // 请求数据
67
+
55
68
  var _useState = useState(false),
56
69
  _useState2 = _slicedToArray(_useState, 2),
57
70
  loading = _useState2[0],
@@ -114,31 +127,40 @@ var ProInfo = function ProInfo(props) {
114
127
  getData.run({});
115
128
  }
116
129
  });
117
-
118
- if (type === 'table') {
119
- return /*#__PURE__*/React.createElement(ProTableInfo, _objectSpread(_objectSpread({}, others), {}, {
120
- header: header,
121
- loading: loading || getData.loading,
122
- result: getDataSource(getData.data),
123
- actionRef: actionRef
124
- }));
125
- }
126
-
127
- if (type === 'header') {
128
- return /*#__PURE__*/React.createElement(ProHeaderInfo, _objectSpread(_objectSpread({}, others), {}, {
129
- header: header,
130
- loading: loading || getData.loading,
131
- result: getDataSource(getData.data),
132
- actionRef: actionRef
133
- }));
134
- }
135
-
136
- return /*#__PURE__*/React.createElement(ProBaseInfo, _objectSpread(_objectSpread({}, others), {}, {
130
+ return /*#__PURE__*/React.createElement("div", {
131
+ ref: ref,
132
+ className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
133
+ style: style
134
+ }, /*#__PURE__*/React.createElement(ProCard, _objectSpread(_objectSpread({
135
+ compacted: true,
136
+ hoveredShadow: false,
137
+ bordered: false,
138
+ backgroundColor: "transparent"
139
+ }, header), others), type === 'table' && /*#__PURE__*/React.createElement(ProTableInfo, {
140
+ dataSource: dataSource,
141
+ columns: columns,
142
+ loading: loading || getData.loading,
143
+ result: getDataSource(getData.data),
144
+ actionRef: actionRef,
145
+ layout: layout
146
+ }), type === 'header' && /*#__PURE__*/React.createElement(ProHeaderInfo, {
147
+ dataSource: dataSource,
148
+ columns: columns,
137
149
  header: header,
138
150
  loading: loading || getData.loading,
139
151
  result: getDataSource(getData.data),
140
- actionRef: actionRef
141
- }));
152
+ actionRef: actionRef,
153
+ layout: layout,
154
+ size: size
155
+ }), type === 'base' && /*#__PURE__*/React.createElement(ProBaseInfo, {
156
+ dataSource: dataSource,
157
+ columns: columns,
158
+ loading: loading || getData.loading,
159
+ result: getDataSource(getData.data),
160
+ actionRef: actionRef,
161
+ layout: layout,
162
+ size: size
163
+ })));
142
164
  };
143
165
 
144
166
  ProInfo.Group = ProInfoGroup;
@@ -1,10 +1,6 @@
1
1
  .teamix-pro-info {
2
2
  color: var(--color-brand1-6);
3
3
 
4
- .next-card {
5
- background: none;
6
- }
7
-
8
4
  .teamix-pro-info-content-row {
9
5
  width: 100%;
10
6
  }
@@ -3,6 +3,12 @@ import { ActionGroupProps, IActionButton } from '../actions';
3
3
  import { Method } from 'axios';
4
4
  import React from 'react';
5
5
  import { CardProps } from '../card';
6
+ /** 列record函数 */
7
+ declare type ProInfoCellFunProp = (value: any, record: any) => any;
8
+ declare type FieldRenderProps = keyof IProFieldFormatterProps;
9
+ declare type ProInfoCellRender = {
10
+ [key in FieldRenderProps]?: IProFieldFormatterProps[key] | ProInfoCellFunProp;
11
+ } | ((...other: any) => React.ReactNode);
6
12
  /** ProInfoBaseProps info 基础定义 */
7
13
  export declare type ProInfoBaseProps = {
8
14
  /** ProColums 定义,取代 Table 的 columns */
@@ -27,7 +33,7 @@ export declare type ProInfoBaseProps = {
27
33
  onError?: (error: Error) => void;
28
34
  /** ProInfo action 的引用,便于手动触发一些方法 */
29
35
  actionRef?: React.MutableRefObject<ProInfoActionType | undefined>;
30
- /** 标题区 */
36
+ /** 标题区 推荐将header中的内容平铺到ProCard中。即将不支持此写法 */
31
37
  header?: ProInfoHeaderProps;
32
38
  /** info 数据源 */
33
39
  dataSource?: {
@@ -35,7 +41,7 @@ export declare type ProInfoBaseProps = {
35
41
  };
36
42
  /** 布局值 */
37
43
  layout?: BaseInfoLayoutProps;
38
- };
44
+ } & ProInfoHeaderProps;
39
45
  /** ProInfoItemProps info 单元格 定义 */
40
46
  export interface ProInfoItemProps {
41
47
  /** 标题 */
@@ -49,9 +55,9 @@ export interface ProInfoItemProps {
49
55
  /** 对应 ProField 里面的 type */
50
56
  valueType?: IProFieldType;
51
57
  /** 渲染单元格内容字段 */
52
- render?: IProFieldFormatterProps | ((...other: any) => React.ReactNode);
58
+ render?: ProInfoCellRender;
53
59
  /** 枚举值 */
54
- dataSource?: IProFieldOptionItem[];
60
+ dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
55
61
  /** 表头的筛选菜单项,当值为 true 时,自动使用 dataSource 生成 */
56
62
  filters?: boolean;
57
63
  /** 操作组配置 */
@@ -138,7 +144,9 @@ export declare type InfoValueItemProps = {
138
144
  infoItem: ProInfoItemProps;
139
145
  record: any;
140
146
  actionRef?: React.MutableRefObject<ProInfoActionType | undefined>;
141
- } & IProFieldProps;
147
+ render?: ProInfoCellRender;
148
+ dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
149
+ } & Omit<IProFieldProps, 'render' | 'dataSource'>;
142
150
  export declare type ProInfoHeaderProps = CardProps;
143
151
  /** ProInfoGroupContextProps */
144
152
  export declare type ProInfoGroupContextProps = {
@@ -173,3 +181,4 @@ export declare type ProInfoTransparentBase = {
173
181
  /** style */
174
182
  style?: React.CSSProperties;
175
183
  };
184
+ export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
3
  import { ActionGroupProps } from '../actions';
3
4
  import { ProInfoProps } from '../info';
4
5
  import './index.scss';
@@ -12,11 +13,14 @@ export interface LinkItem {
12
13
  text: string;
13
14
  onClick?: (e?: React.MouseEvent<Element, MouseEvent>) => void;
14
15
  }
15
- export interface TagItem {
16
- type?: 'normal' | 'primary';
17
- color?: string;
18
- text: string;
19
- }
16
+ export declare type TagItem = (TagProps | (CloseableProps & {
17
+ closable: true;
18
+ })) & {
19
+ /**
20
+ * @deprecated 建议使用 children 代替
21
+ */
22
+ text?: string;
23
+ };
20
24
  declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
21
25
  export interface DataItem {
22
26
  title: string;
@@ -1,4 +1,5 @@
1
- var _excluded = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
1
+ var _excluded = ["text", "children", "closable"],
2
+ _excluded2 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
2
3
 
3
4
  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; }
4
5
 
@@ -66,15 +67,29 @@ var renderTags = function renderTags(tags) {
66
67
  return /*#__PURE__*/React.createElement(Tag.Group, {
67
68
  className: cls('tags')
68
69
  }, tags.map(function (tag, i) {
69
- return /*#__PURE__*/React.createElement(Tag, {
70
+ // @ts-ignore
71
+ var text = tag.text,
72
+ children = tag.children,
73
+ closable = tag.closable,
74
+ others = _objectWithoutProperties(tag, _excluded);
75
+
76
+ if (closable) {
77
+ return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
78
+ key: i,
79
+ size: "large",
80
+ style: {
81
+ marginBottom: 0
82
+ }
83
+ }, others), text || children);
84
+ }
85
+
86
+ return /*#__PURE__*/React.createElement(Tag, _objectSpread({
70
87
  key: i,
71
88
  size: "large",
72
- type: tag.type,
73
- color: tag.color,
74
89
  style: {
75
90
  marginBottom: 0
76
91
  }
77
- }, tag.text);
92
+ }, others), text || children);
78
93
  }));
79
94
  };
80
95
 
@@ -92,7 +107,7 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
92
107
 
93
108
  var isColorPresetColor = isPresetColor(color);
94
109
  var isBgColorPresetColor = isPresetColor(backgroundColor);
95
- var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("color-bg-".concat(color))), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
110
+ var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-color-".concat(backgroundColor))), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
96
111
  var styleColor = isColorPresetColor ? undefined : color;
97
112
  var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
98
113
  var style = {
@@ -159,7 +174,7 @@ var PageHeader = function PageHeader(props) {
159
174
  children = props.children,
160
175
  className = props.className,
161
176
  style = props.style,
162
- others = _objectWithoutProperties(props, _excluded);
177
+ others = _objectWithoutProperties(props, _excluded2);
163
178
 
164
179
  var history = useHistory();
165
180
  var backgroundImage = image ? "url('".concat(image, "')") : undefined;
package/es/table/index.js CHANGED
@@ -624,10 +624,12 @@ var ProTable = function ProTable(props) {
624
624
  }
625
625
 
626
626
  function onChangePaginationSize(currentPageSize) {
627
+ var _request5;
628
+
627
629
  setPageSize(currentPageSize);
628
630
  setCurrentPage(1);
629
631
 
630
- _request(_defineProperty({}, targetPageSizeKey, currentPageSize));
632
+ _request((_request5 = {}, _defineProperty(_request5, targetPageSizeKey, currentPageSize), _defineProperty(_request5, targetPageKey, 1), _request5));
631
633
  }
632
634
 
633
635
  function renderRowSelection() {
@@ -3,11 +3,18 @@ import { IFormProps, IFormSchema } from '../form';
3
3
  import { RequestAction } from './request';
4
4
  import { DialogAction } from './dialog';
5
5
  export interface DialogFormAction extends DialogAction {
6
+ /** 表单初始值 */
6
7
  initialValues?: any;
8
+ /** 表单初始化数据请求 */
7
9
  initialRequest?: RequestAction;
10
+ /** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
8
11
  useFieldValuesForRequest?: boolean;
12
+ /**
13
+ * @deprecated 建议使用 schema 配置 IFormProps 代替
14
+ */
9
15
  formProps?: Omit<IFormProps, 'schema'>;
10
- schema: IFormSchema;
16
+ /** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 IFormProps,否则可以只配置 IFormSchema */
17
+ schema: IFormSchema | IFormProps;
11
18
  }
12
19
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
13
20
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -22,7 +22,8 @@ var _request = require("./request");
22
22
 
23
23
  var _dialog = _interopRequireDefault(require("./dialog"));
24
24
 
25
- var _excluded = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
25
+ var _excluded = ["schema"],
26
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
26
27
 
27
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
29
 
@@ -30,16 +31,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
30
31
 
31
32
  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; }
32
33
 
33
- 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; }
34
-
35
- 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; }
36
-
37
- 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; }
38
-
39
- 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; }
40
-
41
- 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; }
42
-
43
34
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
44
35
 
45
36
  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."); }
@@ -52,6 +43,16 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
52
43
 
53
44
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
54
45
 
46
+ 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; }
47
+
48
+ 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; }
49
+
50
+ 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; }
51
+
52
+ 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; }
53
+
54
+ 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; }
55
+
55
56
  function getDefaultFormPropsByDialogSize(size) {
56
57
  if (size === 'small') {
57
58
  return {
@@ -84,15 +85,31 @@ function getDefaultFormPropsByDialogSize(size) {
84
85
  };
85
86
  }
86
87
 
88
+ function getSchemaAndFormProps(schema, formProps) {
89
+ if (schema instanceof Array) {
90
+ return _objectSpread({
91
+ schema: schema
92
+ }, formProps);
93
+ }
94
+
95
+ var formSchema = schema;
96
+ return formSchema;
97
+ }
98
+
87
99
  var DialogForm = function DialogForm(props) {
88
100
  var initialValues = props.initialValues,
89
101
  initialRequest = props.initialRequest,
90
- schema = props.schema,
91
102
  _props$size = props.size,
92
103
  size = _props$size === void 0 ? 'small' : _props$size,
104
+ schema = props.schema,
93
105
  formProps = props.formProps,
94
106
  context = props.context,
95
107
  formRef = props.formRef;
108
+
109
+ var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
110
+ formSchema = _getSchemaAndFormProp.schema,
111
+ others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
112
+
96
113
  var form = (0, _form.createForm)({
97
114
  initialValues: (0, _utils.getTargetValue)(initialValues, context)
98
115
  });
@@ -123,8 +140,8 @@ var DialogForm = function DialogForm(props) {
123
140
  }
124
141
  }, /*#__PURE__*/_react.default.createElement(_form.default, _objectSpread(_objectSpread({
125
142
  form: form,
126
- schema: (0, _utils.getTargetValue)(schema, context)
127
- }, getDefaultFormPropsByDialogSize(size)), (0, _utils.getTargetValue)(formProps, context))));
143
+ schema: (0, _utils.getTargetValue)(formSchema, context)
144
+ }, getDefaultFormPropsByDialogSize(size)), (0, _utils.getTargetValue)(others, context))));
128
145
  };
129
146
 
130
147
  function useDialogFormAction(action, context) {
@@ -139,7 +156,7 @@ function useDialogFormAction(action, context) {
139
156
  size = _action$size === void 0 ? 'small' : _action$size,
140
157
  _onFinish = action.onFinish,
141
158
  _onCancel = action.onCancel,
142
- others = _objectWithoutProperties(action, _excluded);
159
+ others = _objectWithoutProperties(action, _excluded2);
143
160
 
144
161
  var formRef = (0, _react.useRef)();
145
162
  return (0, _dialog.default)(Object.assign({
@@ -0,0 +1,9 @@
1
+ import { DialogAction } from './dialog';
2
+ import { ProInfoProps } from '..';
3
+ export interface DialogInfoAction extends DialogAction {
4
+ schema: ProInfoProps;
5
+ }
6
+ export declare function useDialogInfoAction(action: DialogInfoAction, context?: any): {
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
8
+ };
9
+ export default useDialogInfoAction;