@teamix/pro 1.1.31 → 1.1.35

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 (89) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1357 -771
  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 +40 -19
  15. package/es/actions/index.scss +8 -0
  16. package/es/actions/link.d.ts +2 -2
  17. package/es/actions/link.js +2 -12
  18. package/es/form/Components/ProField/index.d.ts +4 -0
  19. package/es/form/ProForm/index.js +2 -2
  20. package/es/form/ProForm/useFormDisplayValues.d.ts +6 -0
  21. package/es/form/ProForm/useFormDisplayValues.js +65 -0
  22. package/es/form/SchemaForm/adapterType.js +2 -1
  23. package/es/form/SchemaForm/initializeProField.js +1 -0
  24. package/es/form/SchemaForm/initializeReactions.js +82 -6
  25. package/es/form/SchemaForm/reactions.js +4 -2
  26. package/es/form/index.d.ts +3 -3
  27. package/es/form/index.js +3 -3
  28. package/es/form/typing.d.ts +2 -2
  29. package/es/form/utils.d.ts +31 -8
  30. package/es/form/utils.js +27 -44
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/info/components/InfoValueItem/index.js +108 -26
  34. package/es/info/components/baseInfo/index.d.ts +3 -1
  35. package/es/info/components/baseInfo/index.js +6 -33
  36. package/es/info/components/headerInfo/index.d.ts +3 -1
  37. package/es/info/components/headerInfo/index.js +8 -39
  38. package/es/info/components/tableInfo/index.js +4 -21
  39. package/es/info/index.js +50 -28
  40. package/es/info/index.scss +0 -4
  41. package/es/info/typing.d.ts +14 -5
  42. package/es/page-header/index.js +1 -1
  43. package/es/table/components/Filter/index.js +6 -2
  44. package/es/table/index.js +3 -1
  45. package/es/table/typing.d.ts +8 -4
  46. package/es/table/utils/columnRender.js +38 -11
  47. package/lib/actions/dialog-form.d.ts +8 -1
  48. package/lib/actions/dialog-form.js +32 -15
  49. package/lib/actions/dialog-info.d.ts +9 -0
  50. package/lib/actions/dialog-info.js +37 -0
  51. package/lib/actions/dialog.d.ts +2 -0
  52. package/lib/actions/dialog.js +11 -4
  53. package/lib/actions/drawer-info.d.ts +6 -0
  54. package/lib/actions/drawer-info.js +18 -0
  55. package/lib/actions/index.d.ts +11 -5
  56. package/lib/actions/index.js +41 -18
  57. package/lib/actions/index.scss +8 -0
  58. package/lib/actions/link.d.ts +2 -2
  59. package/lib/actions/link.js +2 -12
  60. package/lib/form/Components/ProField/index.d.ts +4 -0
  61. package/lib/form/ProForm/index.js +1 -1
  62. package/lib/form/ProForm/useFormDisplayValues.d.ts +6 -0
  63. package/lib/form/ProForm/useFormDisplayValues.js +74 -0
  64. package/lib/form/SchemaForm/adapterType.js +2 -1
  65. package/lib/form/SchemaForm/initializeProField.js +1 -0
  66. package/lib/form/SchemaForm/initializeReactions.js +87 -7
  67. package/lib/form/SchemaForm/reactions.js +4 -2
  68. package/lib/form/index.d.ts +3 -3
  69. package/lib/form/index.js +15 -8
  70. package/lib/form/typing.d.ts +2 -2
  71. package/lib/form/utils.d.ts +31 -8
  72. package/lib/form/utils.js +28 -54
  73. package/lib/index.d.ts +1 -1
  74. package/lib/index.js +1 -1
  75. package/lib/info/components/InfoValueItem/index.js +107 -25
  76. package/lib/info/components/baseInfo/index.d.ts +3 -1
  77. package/lib/info/components/baseInfo/index.js +5 -40
  78. package/lib/info/components/headerInfo/index.d.ts +3 -1
  79. package/lib/info/components/headerInfo/index.js +7 -46
  80. package/lib/info/components/tableInfo/index.js +4 -22
  81. package/lib/info/index.js +52 -28
  82. package/lib/info/index.scss +0 -4
  83. package/lib/info/typing.d.ts +14 -5
  84. package/lib/page-header/index.js +1 -1
  85. package/lib/table/components/Filter/index.js +6 -2
  86. package/lib/table/index.js +3 -1
  87. package/lib/table/typing.d.ts +8 -4
  88. package/lib/table/utils/columnRender.js +38 -11
  89. package/package.json +1 -1
@@ -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
 
@@ -23,17 +23,20 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
23
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
24
 
25
25
  import React, { useContext, useEffect, useRef, useState } from 'react';
26
- import ProTableInfo from './components/tableInfo';
27
- import ProHeaderInfo from './components/headerInfo';
28
- import ProBaseInfo from './components/baseInfo';
26
+ import ProTableInfo from './components/TableInfo';
27
+ import ProHeaderInfo from './components/HeaderInfo';
28
+ import ProBaseInfo from './components/BaseInfo';
29
29
  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 {};
@@ -92,7 +92,7 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
92
92
 
93
93
  var isColorPresetColor = isPresetColor(color);
94
94
  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));
95
+ 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
96
  var styleColor = isColorPresetColor ? undefined : color;
97
97
  var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
98
98
  var style = {
@@ -86,9 +86,11 @@ var Filter = function Filter(props) {
86
86
 
87
87
  var renderSingle = function renderSingle() {
88
88
  return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
89
+ var _value$toString;
90
+
89
91
  var label = _ref3.label,
90
92
  value = _ref3.value;
91
- var valueStr = value.toString();
93
+ var valueStr = (_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '';
92
94
  return /*#__PURE__*/React.createElement(RadioItem, {
93
95
  id: valueStr,
94
96
  checked: selected.includes(valueStr),
@@ -103,9 +105,11 @@ var Filter = function Filter(props) {
103
105
 
104
106
  var renderMultiple = function renderMultiple() {
105
107
  return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref4) {
108
+ var _value$toString2;
109
+
106
110
  var label = _ref4.label,
107
111
  value = _ref4.value;
108
- var valueStr = value.toString();
112
+ var valueStr = (_value$toString2 = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString2 !== void 0 ? _value$toString2 : '';
109
113
  return /*#__PURE__*/React.createElement(CheckboxItem, {
110
114
  key: valueStr,
111
115
  checked: selected.includes(valueStr),
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() {
@@ -11,8 +11,10 @@ import { Method } from 'axios';
11
11
  import React from 'react';
12
12
  import type { Form as FormType } from '@formily/core';
13
13
  declare type IFieldRenderProps = keyof IProFieldFormatterProps;
14
+ /** 列record函数 */
15
+ declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
14
16
  declare type ITableCellRender = {
15
- [key in IFieldRenderProps]?: IProFieldFormatterProps[key] | ((...props: any) => void);
17
+ [key in IFieldRenderProps]?: IProFieldFormatterProps[key] | ProTableCellFunProp;
16
18
  } | ((...other: any) => React.ReactNode);
17
19
  declare type TDataService = {
18
20
  /** 翻页器总数 */
@@ -31,14 +33,14 @@ export declare type ProColumnProps = {
31
33
  tooltipIcon?: React.ReactNode;
32
34
  /** 对应 ProField 里面的 type */
33
35
  valueType?: IProFieldType;
34
- /** 是否默认隐藏列 */
36
+ /** 【列配置】是否默认隐藏列 */
35
37
  columnFilters?: boolean;
36
- /** 是否禁用隐藏列 */
38
+ /** 【列配置】是否禁用隐藏列 */
37
39
  columnFiltersDisabled?: boolean;
38
40
  /** 渲染单元格内容字段 */
39
41
  render?: ITableCellRender;
40
42
  /** 枚举值 */
41
- dataSource?: IProFieldOptionItem[];
43
+ dataSource?: IProFieldOptionItem[] | ProTableCellFunProp;
42
44
  /** 表头的过滤菜单项,当值为 true 时,自动使用 dataSource 生成 */
43
45
  filters?: boolean | ProTableColumnsFilterItemProps[];
44
46
  /** 表头的过滤菜单项过滤方式 single 单选 multiple 多选 */
@@ -49,6 +51,8 @@ export declare type ProColumnProps = {
49
51
  actionSchema?: ActionGroupProps;
50
52
  /** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
51
53
  dataIndex?: string | string[];
54
+ /** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
55
+ format?: string;
52
56
  } & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
53
57
  export declare type ProTableProps = {
54
58
  /** ProColums 定义,取代 Table 的 columns */
@@ -57,7 +57,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
57
57
  valueType = _item$valueType === void 0 ? 'text' : _item$valueType,
58
58
  render = item.render,
59
59
  actionSchema = item.actionSchema,
60
- dataIndex = item.dataIndex; // 如果没传 dataIndex,返回 null
60
+ dataIndex = item.dataIndex,
61
+ format = item.format; // 如果没传 dataIndex,返回 null
61
62
 
62
63
  if (!dataIndex) {
63
64
  value = null;
@@ -72,7 +73,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
72
73
  });
73
74
  }
74
75
 
75
- var newRender = null; // 如果 render 直接传函数
76
+ var newRender = null;
77
+ var newDataSource = null; // 如果 render 直接传函数
76
78
 
77
79
  if (typeof render === 'function') {
78
80
  newRender = function newRender() {
@@ -96,6 +98,29 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
96
98
  }, actionSchema), {}, {
97
99
  context: _objectSpread(_objectSpread({}, defaultContext), actionSchema.context)
98
100
  }));
101
+ } // dataSource可传函数
102
+
103
+
104
+ if (typeof item.dataSource === 'function') {
105
+ var _item$dataSource;
106
+
107
+ newDataSource = (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.call(item, value, index, record);
108
+ } else {
109
+ var _item$dataSource2;
110
+
111
+ newDataSource = ((_item$dataSource2 = item.dataSource) !== null && _item$dataSource2 !== void 0 ? _item$dataSource2 : []).map(function (item) {
112
+ return Object.fromEntries(Object.entries(item).map(function (_ref) {
113
+ var _ref2 = _slicedToArray(_ref, 2),
114
+ k = _ref2[0],
115
+ v = _ref2[1];
116
+
117
+ return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
118
+ record: record,
119
+ value: value,
120
+ index: index
121
+ }))];
122
+ }));
123
+ });
99
124
  } // 渲染 ProField
100
125
 
101
126
 
@@ -103,7 +128,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
103
128
  type: valueType || 'text',
104
129
  value: value,
105
130
  render: newRender,
106
- dataSource: item.dataSource
131
+ dataSource: newDataSource,
132
+ format: format
107
133
  });
108
134
  };
109
135
  /**
@@ -121,10 +147,10 @@ var processRenderFunction = function processRenderFunction() {
121
147
  var index = arguments.length > 2 ? arguments[2] : undefined;
122
148
  var record = arguments.length > 3 ? arguments[3] : undefined;
123
149
  var external = ['linkOnClick', 'link', 'value'];
124
- return Object.fromEntries(Object.entries(render).map(function (_ref) {
125
- var _ref2 = _slicedToArray(_ref, 2),
126
- k = _ref2[0],
127
- v = _ref2[1];
150
+ return Object.fromEntries(Object.entries(render).map(function (_ref3) {
151
+ var _ref4 = _slicedToArray(_ref3, 2),
152
+ k = _ref4[0],
153
+ v = _ref4[1];
128
154
 
129
155
  if (typeof v === 'function') {
130
156
  var _v;
@@ -159,10 +185,11 @@ var processBuriedPoint = function processBuriedPoint() {
159
185
  var value = arguments.length > 2 ? arguments[2] : undefined;
160
186
  var index = arguments.length > 3 ? arguments[3] : undefined;
161
187
  return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
162
- ['ellipsis', true], ['descriptionEllipsis', true]].concat(_toConsumableArray(Object.entries(render).map(function (_ref3) {
163
- var _ref4 = _slicedToArray(_ref3, 2),
164
- k = _ref4[0],
165
- v = _ref4[1];
188
+ // emptyText 默认为 '-'
189
+ ['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
190
+ var _ref6 = _slicedToArray(_ref5, 2),
191
+ k = _ref6[0],
192
+ v = _ref6[1];
166
193
 
167
194
  return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
168
195
  record: record,
@@ -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;