@teamix/pro 1.2.28 → 1.2.32

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 (61) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +368 -252
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/common.scss +22 -0
  6. package/es/form/Filter/SimpleFilter.js +10 -3
  7. package/es/form/typing.d.ts +1 -1
  8. package/es/index.d.ts +1 -1
  9. package/es/index.js +1 -1
  10. package/es/info/components/InfoValueItem/index.js +38 -12
  11. package/es/info/components/InfoValueItem/index.scss +1 -0
  12. package/es/info/components/ProInfoItem/index.js +4 -2
  13. package/es/info/components/ProInfoItem/index.scss +5 -0
  14. package/es/info/components/baseInfo/index.js +4 -2
  15. package/es/info/components/headerInfo/index.js +2 -1
  16. package/es/info/components/tableInfo/index.js +2 -1
  17. package/es/info/index.scss +2 -0
  18. package/es/info/typing.d.ts +3 -0
  19. package/es/table/components/Filter/index.js +6 -6
  20. package/es/table/components/Layout/index.js +18 -3
  21. package/es/table/components/ToolBar/Fullscreen.js +7 -11
  22. package/es/table/index.js +96 -35
  23. package/es/table/index.scss +4 -0
  24. package/es/table/typing.d.ts +2 -2
  25. package/es/table/utils/columnRender.js +1 -1
  26. package/es/table/utils/index.d.ts +2 -1
  27. package/es/table/utils/index.js +62 -113
  28. package/lib/common.scss +22 -0
  29. package/lib/form/Filter/SimpleFilter.js +8 -1
  30. package/lib/form/typing.d.ts +1 -1
  31. package/lib/index.d.ts +1 -1
  32. package/lib/index.js +1 -1
  33. package/lib/info/components/InfoValueItem/index.js +38 -12
  34. package/lib/info/components/InfoValueItem/index.scss +1 -0
  35. package/lib/info/components/ProInfoItem/index.js +4 -2
  36. package/lib/info/components/ProInfoItem/index.scss +5 -0
  37. package/lib/info/components/baseInfo/index.js +4 -2
  38. package/lib/info/components/headerInfo/index.js +2 -1
  39. package/lib/info/components/tableInfo/index.js +2 -1
  40. package/lib/info/index.scss +2 -0
  41. package/lib/info/typing.d.ts +3 -0
  42. package/lib/table/components/Filter/index.js +6 -6
  43. package/lib/table/components/Layout/index.js +18 -3
  44. package/lib/table/components/ToolBar/Fullscreen.js +7 -11
  45. package/lib/table/index.js +95 -34
  46. package/lib/table/index.scss +4 -0
  47. package/lib/table/typing.d.ts +2 -2
  48. package/lib/table/utils/columnRender.js +1 -1
  49. package/lib/table/utils/index.d.ts +2 -1
  50. package/lib/table/utils/index.js +63 -112
  51. package/package.json +1 -1
  52. package/es/form/Components/SelectTable/index.d.ts +0 -24
  53. package/es/form/Components/SelectTable/index.js +0 -135
  54. package/es/form/Components/SelectTable/index.scss +0 -28
  55. package/es/form/Components/SelectTable/table.d.ts +0 -6
  56. package/es/form/Components/SelectTable/table.js +0 -64
  57. package/lib/form/Components/SelectTable/index.d.ts +0 -24
  58. package/lib/form/Components/SelectTable/index.js +0 -157
  59. package/lib/form/Components/SelectTable/index.scss +0 -28
  60. package/lib/form/Components/SelectTable/table.d.ts +0 -6
  61. package/lib/form/Components/SelectTable/table.js +0 -76
@@ -25,7 +25,7 @@ var _components = require("@alicloudfe/components");
25
25
 
26
26
  var _actions = require("../../../actions");
27
27
 
28
- var _excluded = ["type", "value", "render", "infoItem", "record", "actionRef", "dataSource", "context"];
28
+ var _excluded = ["type", "value", "render", "infoItem", "record", "actionRef", "dataSource", "context", "props"];
29
29
 
30
30
  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); }
31
31
 
@@ -41,12 +41,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
41
41
 
42
42
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
43
 
44
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
-
46
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
47
-
48
- 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; }
49
-
50
44
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
51
45
 
52
46
  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."); }
@@ -59,6 +53,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
59
53
 
60
54
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
61
55
 
56
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
+
58
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
59
+
60
+ 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; }
61
+
62
62
  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; }
63
63
 
64
64
  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; }
@@ -76,6 +76,7 @@ var InfoValueItem = function InfoValueItem(props) {
76
76
  actionRef = props.actionRef,
77
77
  dataSource = props.dataSource,
78
78
  context = props.context,
79
+ fieldProps = props.props,
79
80
  others = _objectWithoutProperties(props, _excluded);
80
81
 
81
82
  var dataIndex = infoItem.dataIndex,
@@ -89,7 +90,8 @@ var InfoValueItem = function InfoValueItem(props) {
89
90
  _infoItem$successMess = infoItem.successMessage,
90
91
  successMessage = _infoItem$successMess === void 0 ? 'success' : _infoItem$successMess,
91
92
  actions = infoItem.actions,
92
- extra = infoItem.extra; // 获取处理过的 render
93
+ extra = infoItem.extra,
94
+ valueType = infoItem.valueType; // 获取处理过的 render
93
95
 
94
96
  var getRender = function getRender() {
95
97
  var _processRenderFunctio;
@@ -101,7 +103,31 @@ var InfoValueItem = function InfoValueItem(props) {
101
103
  }
102
104
 
103
105
  var newRender = processBuriedPoint((_processRenderFunctio = processRenderFunction(render !== null && render !== void 0 ? render : {}, value, record)) !== null && _processRenderFunctio !== void 0 ? _processRenderFunctio : {}, value, record);
106
+
107
+ if (valueType === 'selectGroup') {
108
+ newRender = _objectSpread(_objectSpread({
109
+ maxShowNumber: 'auto',
110
+ foldText: 'more'
111
+ }, newRender), {}, {
112
+ ellipsis: false
113
+ });
114
+ }
115
+
104
116
  return newRender;
117
+ };
118
+
119
+ var getFieldProps = function getFieldProps() {
120
+ if (valueType === 'selectGroup') {
121
+ return _objectSpread({
122
+ valueAlias: {
123
+ value: 'TagValue',
124
+ key: 'TagKey'
125
+ },
126
+ layout: 'compact'
127
+ }, fieldProps);
128
+ }
129
+
130
+ return fieldProps;
105
131
  }; // 获取处理过的 dataSource
106
132
 
107
133
 
@@ -300,12 +326,12 @@ var InfoValueItem = function InfoValueItem(props) {
300
326
  onMouseLeave: function onMouseLeave() {
301
327
  setEditVisible(false);
302
328
  }
303
- }, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread({
329
+ }, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({
304
330
  type: type,
305
331
  value: value,
306
332
  render: getRender(),
307
333
  dataSource: getDataSource()
308
- }, others)), /*#__PURE__*/_react.default.createElement(_popConfirm.default, {
334
+ }, others), getFieldProps())), /*#__PURE__*/_react.default.createElement(_popConfirm.default, {
309
335
  visible: popConfirmVisible,
310
336
  content: renderContent(),
311
337
  triggerType: "click",
@@ -332,12 +358,12 @@ var InfoValueItem = function InfoValueItem(props) {
332
358
 
333
359
  return /*#__PURE__*/_react.default.createElement("div", {
334
360
  className: cls('item-value')
335
- }, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread({
361
+ }, /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({
336
362
  type: type,
337
363
  value: value,
338
364
  render: getRender(),
339
365
  dataSource: getDataSource()
340
- }, others)), renderAction(), extra && extra);
366
+ }, others), getFieldProps())), renderAction(), extra && extra);
341
367
  };
342
368
 
343
369
  var _default = InfoValueItem;
@@ -20,6 +20,7 @@
20
20
  &-item-value {
21
21
  display: flex;
22
22
  align-items: center;
23
+ width: 100%;
23
24
  }
24
25
 
25
26
  }
@@ -51,7 +51,7 @@ var ProInfoItem = function ProInfoItem(prop) {
51
51
  className: cls('value')
52
52
  }, loading && /*#__PURE__*/_react.default.createElement("div", {
53
53
  className: cls('base-skeleton-box')
54
- }, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && /*#__PURE__*/_react.default.createElement("div", null, value))));
54
+ }, /*#__PURE__*/_react.default.createElement(_.ProSkeletonRaw.Info.Item, null)), !loading && value)));
55
55
  }
56
56
 
57
57
  if (headerInfoLayout) {
@@ -59,7 +59,9 @@ var ProInfoItem = function ProInfoItem(prop) {
59
59
  labelGutter = _headerInfoLayout$lab === void 0 ? '16px' : _headerInfoLayout$lab;
60
60
  return /*#__PURE__*/_react.default.createElement("div", {
61
61
  className: cls()
62
- }, /*#__PURE__*/_react.default.createElement(Row, null, /*#__PURE__*/_react.default.createElement("div", {
62
+ }, /*#__PURE__*/_react.default.createElement(Row, {
63
+ className: cls('header-row')
64
+ }, /*#__PURE__*/_react.default.createElement("div", {
63
65
  className: cls('header-label')
64
66
  }, /*#__PURE__*/_react.default.createElement(_utils.LabelIconTip, {
65
67
  label: label,
@@ -17,6 +17,11 @@ $item-padding-bottom: 8px;
17
17
  .teamix-pro-field-info-form-item {
18
18
  width: 100%;
19
19
  padding-bottom: $item-padding-bottom;
20
+
21
+ &-header-row {
22
+ display: flex;
23
+ align-items: center;
24
+ }
20
25
  }
21
26
 
22
27
  .teamix-pro-field-info-form-item-label {
@@ -92,7 +92,8 @@ var ProBaseInfo = function ProBaseInfo(props) {
92
92
  infoItem: item,
93
93
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
94
94
  actionRef: actionRef,
95
- context: context
95
+ context: context,
96
+ props: item.props
96
97
  }),
97
98
  baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
98
99
  tooltip: item.tooltip,
@@ -103,7 +104,8 @@ var ProBaseInfo = function ProBaseInfo(props) {
103
104
 
104
105
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/_react.default.createElement(Row, {
105
106
  wrap: true,
106
- className: "teamix-pro-info-content-row"
107
+ className: "teamix-pro-info-content-row",
108
+ gutter: 20
107
109
  }, renderContent()));
108
110
  };
109
111
 
@@ -68,7 +68,8 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
68
68
  dataSource: item.dataSource,
69
69
  infoItem: item,
70
70
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
71
- actionRef: actionRef
71
+ actionRef: actionRef,
72
+ props: item.props
72
73
  }),
73
74
  headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
74
75
  tooltip: item.tooltip,
@@ -85,7 +85,8 @@ var ProTableInfo = function ProTableInfo(props) {
85
85
  dataSource: item.dataSource,
86
86
  infoItem: item,
87
87
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
88
- actionRef: actionRef
88
+ actionRef: actionRef,
89
+ props: item.props
89
90
  });
90
91
  };
91
92
 
@@ -1,4 +1,6 @@
1
+ @import '../common.scss';
1
2
  .teamix-pro-info {
3
+ @include hybridcloud-scrollbar;
2
4
  color: var(--color-brand1-6);
3
5
 
4
6
  .teamix-pro-info-content-row {
@@ -94,6 +94,8 @@ export interface ProInfoColumnsProps {
94
94
  actions?: ProActionButtonProps[];
95
95
  /** 追加在列后 */
96
96
  extra?: React.ReactNode;
97
+ /** 其他 ProField 配置 */
98
+ props?: any;
97
99
  }
98
100
  export declare type ProInfoActionType = {
99
101
  /** 刷新Info */
@@ -168,6 +170,7 @@ export declare type InfoValueItemProps = {
168
170
  render?: ProInfoCellRender;
169
171
  dataSource?: ProFieldDataSourceItem[] | ProInfoCellFunProp;
170
172
  context?: object;
173
+ props?: any;
171
174
  } & Omit<ProFieldProps, 'render' | 'dataSource'>;
172
175
  export declare type ProInfoHeaderProps = Omit<ProCardProps, 'loading'>;
173
176
  /** ProInfoGroupContextProps */
@@ -70,10 +70,10 @@ var Filter = function Filter(props) {
70
70
  setVisible = _useState4[1];
71
71
 
72
72
  (0, _react.useEffect)(function () {
73
- var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4;
73
+ var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
74
74
 
75
75
  // 从全局状态中读取上次存储的条件
76
- var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current).filterRules) === null || _actionRef$current$ge3 === void 0 ? void 0 : (_actionRef$current$ge4 = _actionRef$current$ge3[column.dataIndex]) === null || _actionRef$current$ge4 === void 0 ? void 0 : _actionRef$current$ge4.rules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : [];
76
+ var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)) === null || _actionRef$current$ge3 === void 0 ? void 0 : (_actionRef$current$ge4 = _actionRef$current$ge3.filterRules) === null || _actionRef$current$ge4 === void 0 ? void 0 : (_actionRef$current$ge5 = _actionRef$current$ge4[column.dataIndex]) === null || _actionRef$current$ge5 === void 0 ? void 0 : _actionRef$current$ge5.rules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : [];
77
77
  setSelected(rules);
78
78
  }, []); // 获取过滤项
79
79
 
@@ -191,7 +191,7 @@ var Filter = function Filter(props) {
191
191
  btn: true
192
192
  }),
193
193
  onClick: function onClick() {
194
- var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
194
+ var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
195
195
 
196
196
  (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
197
197
 
@@ -206,7 +206,7 @@ var Filter = function Filter(props) {
206
206
  } // 需要带上其他所有的信息
207
207
 
208
208
 
209
- var rules = (_actionRef$current$ge5 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge5 !== void 0 ? _actionRef$current$ge5 : {}; // 再设置所有的列筛选状态
209
+ var rules = (_actionRef$current$ge6 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {}; // 再设置所有的列筛选状态
210
210
 
211
211
  (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
212
212
  rules: selected,
@@ -239,10 +239,10 @@ var Filter = function Filter(props) {
239
239
  btn: true
240
240
  }),
241
241
  onClick: function onClick() {
242
- var _actionRef$current$ge6, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
242
+ var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
243
243
 
244
244
  setSelected([]);
245
- var rules = (_actionRef$current$ge6 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {};
245
+ var rules = (_actionRef$current$ge7 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
246
246
  (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
247
247
  rules: [],
248
248
  params: ''
@@ -80,8 +80,10 @@ var Layout = function Layout(props) {
80
80
 
81
81
 
82
82
  var renderQueryFilter = function renderQueryFilter() {
83
- if (dataFilter) {
84
- var _dataFilter$schema;
83
+ var _dataFilter$schema;
84
+
85
+ if (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) {
86
+ var _dataFilter$schema2;
85
87
 
86
88
  if ( /*#__PURE__*/(0, _react.isValidElement)(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
87
89
  // 自定义渲染内容
@@ -109,7 +111,7 @@ var Layout = function Layout(props) {
109
111
  actionRef: actionRef
110
112
  }, otherProps)))
111
113
  }, dataFilter));
112
- } else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) >= 0) {
114
+ } else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
113
115
  return /*#__PURE__*/_react.default.createElement(_form.QueryFilter, _objectSpread({
114
116
  formRef: dataFilterFormRef,
115
117
  onExpand: function onExpand(expand) {
@@ -135,6 +137,19 @@ var Layout = function Layout(props) {
135
137
  }, otherProps)))
136
138
  }, dataFilter));
137
139
  }
140
+ } else if (mainAction) {
141
+ // 没传 dataFilter 但是传了 mainAction
142
+ return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
143
+ className: "mb8",
144
+ addonBefore: renderMainAction(),
145
+ addonAfter: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, extra && !header && /*#__PURE__*/_react.default.createElement(_QuickAction.default, {
146
+ actionRef: actionRef,
147
+ quickAction: extra,
148
+ rowSelection: rowSelection
149
+ }), /*#__PURE__*/_react.default.createElement(_ToolBar.default, _objectSpread({
150
+ actionRef: actionRef
151
+ }, otherProps)))
152
+ });
138
153
  }
139
154
  }; // 区域组合渲染
140
155
 
@@ -27,25 +27,21 @@ var FullScreen = function FullScreen(props) {
27
27
  normalDataFilterForm = _actionRef$current.normalDataFilterForm,
28
28
  fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
29
29
 
30
- function closeByESC(e) {
30
+ var closeByESC = function closeByESC(e) {
31
31
  if (visible && e.code === 'Escape') {
32
- var _actionRef$current2, _actionRef$current2$s, _actionRef$current3, _actionRef$current3$f;
32
+ var _actionRef$current2, _actionRef$current2$f;
33
33
 
34
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setFullScreenState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, false);
35
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
34
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.fullScreen) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2);
36
35
  }
37
- } // 监听esc按钮
36
+ }; // 监听esc按钮
38
37
 
39
38
 
40
39
  (0, _react.useEffect)(function () {
41
- var _actionRef$current4, _actionRef$current4$s;
42
-
43
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFullScreenState) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, visible);
44
40
  window.addEventListener('keydown', closeByESC);
45
41
  return function () {
46
42
  window.removeEventListener('keydown', closeByESC);
47
43
  };
48
- }, [visible]);
44
+ }, [visible, actionRef]);
49
45
 
50
46
  var afterClose = function afterClose() {
51
47
  normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
@@ -84,9 +80,9 @@ var FullScreen = function FullScreen(props) {
84
80
  zIndex: 999
85
81
  },
86
82
  onRequestClose: function onRequestClose() {
87
- var _actionRef$current5, _actionRef$current5$f;
83
+ var _actionRef$current3, _actionRef$current3$f;
88
84
 
89
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$f = _actionRef$current5.fullScreen) === null || _actionRef$current5$f === void 0 ? void 0 : _actionRef$current5$f.call(_actionRef$current5);
85
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
90
86
  }
91
87
  }, /*#__PURE__*/_react.default.createElement("div", {
92
88
  className: "teamix-pro-table-full-screen"
@@ -281,7 +281,24 @@ var ProTable = function ProTable(props) {
281
281
  var _useState19 = (0, _react.useState)(true),
282
282
  _useState20 = _slicedToArray(_useState19, 2),
283
283
  showLoading = _useState20[0],
284
- setShowLoading = _useState20[1]; // 存储定时器 id
284
+ setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
285
+ // 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
286
+
287
+
288
+ var _useState21 = (0, _react.useState)({
289
+ fullScreenState: false,
290
+ filterRules: {},
291
+ filterColumns: []
292
+ }),
293
+ _useState22 = _slicedToArray(_useState21, 1),
294
+ actionRefState = _useState22[0]; // 存储 on 监听事件
295
+
296
+
297
+ var _useState23 = (0, _react.useState)({
298
+ fullScreenState: {}
299
+ }),
300
+ _useState24 = _slicedToArray(_useState23, 1),
301
+ actionRefCallback = _useState24[0]; // 存储定时器 id
285
302
 
286
303
 
287
304
  var autoRefreshTimerRef = (0, _react.useRef)(); // 获取header高度,用作全屏吸底吸底高度计算
@@ -305,16 +322,16 @@ var ProTable = function ProTable(props) {
305
322
  }; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
306
323
 
307
324
 
308
- var _useState21 = (0, _react.useState)(0),
309
- _useState22 = _slicedToArray(_useState21, 2),
310
- headerHeight = _useState22[0],
311
- setHeaderHeight = _useState22[1]; // 全屏显示 className
325
+ var _useState25 = (0, _react.useState)(0),
326
+ _useState26 = _slicedToArray(_useState25, 2),
327
+ headerHeight = _useState26[0],
328
+ setHeaderHeight = _useState26[1]; // 全屏显示 className
312
329
 
313
330
 
314
- var _useState23 = (0, _react.useState)(false),
315
- _useState24 = _slicedToArray(_useState23, 2),
316
- fullscreenState = _useState24[0],
317
- setFullscreenState = _useState24[1]; // 非全屏状态下的
331
+ var _useState27 = (0, _react.useState)(false),
332
+ _useState28 = _slicedToArray(_useState27, 2),
333
+ fullscreenState = _useState28[0],
334
+ setFullscreenState = _useState28[1]; // 非全屏状态下的
318
335
 
319
336
 
320
337
  var normalDataFilterFormRef = (0, _react.useRef)();
@@ -325,10 +342,10 @@ var ProTable = function ProTable(props) {
325
342
  var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
326
343
  var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
327
344
 
328
- var _useState25 = (0, _react.useState)(false),
329
- _useState26 = _slicedToArray(_useState25, 2),
330
- footerSuctionState = _useState26[0],
331
- setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
345
+ var _useState29 = (0, _react.useState)(false),
346
+ _useState30 = _slicedToArray(_useState29, 2),
347
+ footerSuctionState = _useState30[0],
348
+ setFooterSuctionState = _useState30[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
332
349
 
333
350
 
334
351
  var getFooterSuctionState = function getFooterSuctionState() {
@@ -451,25 +468,63 @@ var ProTable = function ProTable(props) {
451
468
  if (propsDataSource) {
452
469
  setData(propsDataSource);
453
470
  }
454
- }, [propsDataSource]); // 绑定 Actions
471
+ }, [propsDataSource]); // 初始化 ActionRef。
472
+
473
+ (0, _utils2.initActionRef)(actionRef, {
474
+ getState: function getState() {
475
+ return actionRefState;
476
+ },
477
+ getCallback: function getCallback() {
478
+ return actionRefCallback;
479
+ },
480
+ setState: function setState(key, value) {
481
+ actionRefState[key] = value;
482
+ (0, _utils2.actionRefUseStateOn)(actionRefCallback, key, value);
483
+ },
484
+ on: function on(fun, state, name) {
485
+ if (!actionRefCallback[state]) {
486
+ actionRefCallback[state] = {};
487
+ }
488
+
489
+ actionRefCallback[state][name] = fun;
490
+ },
491
+ off: function off(name) {
492
+ actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
493
+ var _ref2 = _slicedToArray(_ref, 2),
494
+ k = _ref2[0],
495
+ v = _ref2[1];
496
+
497
+ var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
498
+ var _ref4 = _slicedToArray(_ref3, 1),
499
+ k = _ref4[0];
500
+
501
+ return k !== name;
502
+ }));
503
+ return [k, filterV];
504
+ }));
505
+ }
506
+ }); // 绑定 Actions
455
507
 
456
508
  (0, _utils2.useActionType)(actionRef, {
457
509
  fullScreen: function fullScreen() {
510
+ var _actionRef$current2, _actionRef$current2$s;
511
+
458
512
  var state = !fullscreenState; // 全屏时需要重新计算header高度
459
513
 
460
514
  getHeaderHeight().then(function (height) {
461
515
  setHeaderHeight(height);
462
516
  });
463
517
  setFullscreenState(state);
518
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
464
519
  return state;
465
520
  },
466
521
  setColumn: function setColumn(newColumns) {
467
- var _actionRef$current2, _actionRef$current2$s;
522
+ var _actionRef$current3, _actionRef$current3$s;
468
523
 
469
524
  var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
470
525
  var columns = processColumns(newColumns, propsColumns);
471
526
  setFilteredColumns(columns);
472
- (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'filterColumns', columns);
527
+ (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
473
528
 
474
529
  if (update) {
475
530
  (0, _utils2.emit)('refreshFilterState', newColumns);
@@ -494,11 +549,11 @@ var ProTable = function ProTable(props) {
494
549
  _request(params);
495
550
  },
496
551
  reset: function reset() {
497
- var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
552
+ var _actionRef$current4, _actionRef$current4$s, _dataFilterForm;
498
553
 
499
554
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
500
555
 
501
- (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
556
+ (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
502
557
  (_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
503
558
  setCurrentPage(1);
504
559
 
@@ -613,7 +668,7 @@ var ProTable = function ProTable(props) {
613
668
  }); // 请求函数
614
669
 
615
670
  function _request(params, noLoading) {
616
- var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
671
+ var _dataFilterForm2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
617
672
 
618
673
  // 如果没有传 url 且没有 customRequest,直接返回
619
674
  if (!url && !customRequest) {
@@ -628,7 +683,7 @@ var ProTable = function ProTable(props) {
628
683
 
629
684
  var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
630
685
 
631
- var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
686
+ var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
632
687
 
633
688
  var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
634
689
 
@@ -677,10 +732,6 @@ var ProTable = function ProTable(props) {
677
732
  }
678
733
 
679
734
  (0, _react.useEffect)(function () {
680
- var _dataFilterForm3;
681
-
682
- // 初始化 actionRef state、callback 此时 actionRef 已初始化完成
683
- (0, _utils2.initActionRef)();
684
735
  dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
685
736
 
686
737
  if (footerSuction) {
@@ -691,11 +742,21 @@ var ProTable = function ProTable(props) {
691
742
  };
692
743
  }
693
744
 
694
- if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
695
- // 在请求发送之前 处理漏斗默认数据
696
- (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
745
+ if (propsDataFilter) {
746
+ var _dataFilterForm3;
747
+
748
+ if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
749
+ // 在请求发送之前 处理漏斗默认数据
750
+ (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
751
+
752
+ _request();
753
+ }
754
+ } else {
755
+ if (requestWhenMount) {
756
+ (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
697
757
 
698
- _request();
758
+ _request();
759
+ }
699
760
  }
700
761
 
701
762
  return function () {
@@ -724,11 +785,11 @@ var ProTable = function ProTable(props) {
724
785
  mode: 'inline'
725
786
  }, propsDataFilter), {}, {
726
787
  onFilter: function onFilter(values) {
727
- var _actionRef$current5, _actionRef$current5$c;
788
+ var _actionRef$current6, _actionRef$current6$c;
728
789
 
729
790
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
730
791
 
731
- (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
792
+ (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
732
793
  setCurrentPage(1);
733
794
 
734
795
  _request(_defineProperty({}, targetPageKey, 1));
@@ -824,21 +885,21 @@ var ProTable = function ProTable(props) {
824
885
 
825
886
  var renderFooter = function renderFooter() {
826
887
  function onChangePagination(currentPage) {
827
- var _actionRef$current6, _actionRef$current6$c;
888
+ var _actionRef$current7, _actionRef$current7$c;
828
889
 
829
890
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
830
891
  // 翻页暂时先清空选择
831
- (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
892
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
832
893
  setCurrentPage(currentPage);
833
894
 
834
895
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
835
896
  }
836
897
 
837
898
  function onChangePaginationSize(currentPageSize) {
838
- var _actionRef$current7, _actionRef$current7$c, _request5;
899
+ var _actionRef$current8, _actionRef$current8$c, _request5;
839
900
 
840
901
  // 翻页暂时先清空选择
841
- (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
902
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
842
903
  setPageSize(currentPageSize);
843
904
  setCurrentPage(1);
844
905
 
@@ -114,4 +114,8 @@ $fullscreenPadding: 24px;
114
114
  // 后面在基础组件里面覆盖
115
115
  .next-table.next-table td .next-table-cell-wrapper {
116
116
  text-overflow: unset;
117
+ }
118
+
119
+ .mb8 {
120
+ margin-bottom: 8px;
117
121
  }
@@ -201,8 +201,6 @@ export declare type ProTableActionTypeMutations = {
201
201
  getState?: () => ProTableActionTypeState;
202
202
  /** 设置state 状态 */
203
203
  setState?: (key: string, value: any) => void;
204
- /** 初始化 state 状态 */
205
- initState?: () => void;
206
204
  /** 设置全屏状态 */
207
205
  setFullScreenState?: (state: boolean) => void;
208
206
  /** 绑定state监听事件 */
@@ -217,6 +215,8 @@ export declare type ProTableActionTypeMutations = {
217
215
  resetTableMaxBodyHeight?: () => void;
218
216
  /** 列筛选规则 */
219
217
  filterColumns?: any[];
218
+ /** 获取所有 on 监听事件 */
219
+ getCallback?: () => any;
220
220
  };
221
221
  /** action Mutations 定义 */
222
222
  export declare type ProTableActionTypeState = {
@@ -157,7 +157,7 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
157
157
 
158
158
  if (valueType === 'selectGroup') {
159
159
  newRender = _objectSpread(_objectSpread({
160
- maxShowNumber: 1,
160
+ maxShowNumber: 'auto',
161
161
  foldText: 'more',
162
162
  editOnClick: function editOnClick() {},
163
163
  edit: true