@teamix/pro 1.1.4 → 1.1.8

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 (142) hide show
  1. package/README.md +97 -0
  2. package/dist/212.js +2 -2
  3. package/dist/pro.css +1 -1
  4. package/dist/pro.js +3147 -1872
  5. package/dist/pro.min.css +1 -1
  6. package/dist/pro.min.js +1 -1
  7. package/dist/pro.min.js.LICENSE.txt +1 -1
  8. package/es/actions/dialog-form.d.ts +3 -3
  9. package/es/actions/dialog-table.d.ts +6 -1
  10. package/es/actions/dialog-table.js +10 -1
  11. package/es/actions/drawer-table.d.ts +4 -0
  12. package/es/actions/drawer-table.js +7 -1
  13. package/es/actions/index.d.ts +6 -11
  14. package/es/actions/index.js +41 -21
  15. package/es/actions/index.scss +1 -1
  16. package/es/card/index.d.ts +17 -0
  17. package/es/form/Components/ProField/index.d.ts +8 -0
  18. package/es/form/ProForm/index.d.ts +2 -2
  19. package/es/form/ProForm/index.js +9 -2
  20. package/es/form/ProForm/index.scss +40 -7
  21. package/es/form/SchemaForm/adapterType.js +3 -3
  22. package/es/form/SchemaForm/index.d.ts +2 -2
  23. package/es/form/SchemaForm/index.js +9 -5
  24. package/es/form/SchemaForm/initializeArrayCards.js +10 -55
  25. package/es/form/SchemaForm/initializeArrayCollapse.js +10 -64
  26. package/es/form/SchemaForm/initializeArrayIcon.js +19 -7
  27. package/es/form/SchemaForm/initializeArrayItems.js +16 -75
  28. package/es/form/SchemaForm/initializeArrayTable.js +23 -33
  29. package/es/form/SchemaForm/initializeFormButton.js +35 -38
  30. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeFormStep.d.ts +4 -2
  32. package/es/form/SchemaForm/initializeFormStep.js +21 -7
  33. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeProField.js +3 -3
  35. package/es/form/SchemaForm/reactions.d.ts +1 -1
  36. package/es/form/SchemaForm/reactions.js +2 -2
  37. package/es/form/index.d.ts +17 -9
  38. package/es/form/index.js +21 -9
  39. package/es/form/typing.d.ts +13 -22
  40. package/es/form/warning.js +2 -6
  41. package/es/index.d.ts +4 -3
  42. package/es/index.js +4 -3
  43. package/es/info/components/FormItem/index.js +4 -4
  44. package/es/info/components/FormItem/index.scss +11 -0
  45. package/es/info/components/InfoGroup/index.js +37 -6
  46. package/es/info/components/InfoGroup/index.scss +6 -0
  47. package/es/info/components/InfoValueItem/index.js +14 -2
  48. package/es/info/components/baseInfo/index.js +10 -9
  49. package/es/info/components/headerInfo/index.js +10 -9
  50. package/es/info/components/tableInfo/index.js +7 -4
  51. package/es/info/components/tableInfo/index.scss +1 -1
  52. package/es/info/index.d.ts +1 -0
  53. package/es/info/index.js +9 -7
  54. package/es/info/index.scss +4 -0
  55. package/es/info/typing.d.ts +17 -3
  56. package/es/info/utils/index.d.ts +11 -2
  57. package/es/info/utils/index.js +21 -0
  58. package/es/nocode/configurators/PageHeader.js +49 -43
  59. package/es/nocode/configurators/ProTable.js +12 -9
  60. package/es/nocode/configurators/common.d.ts +117 -105
  61. package/es/nocode/configurators/common.js +38 -34
  62. package/es/nocode/index.scss +1 -4
  63. package/es/page-header/index.d.ts +3 -0
  64. package/es/page-header/index.js +40 -13
  65. package/es/page-header/index.scss +6 -4
  66. package/es/table/components/Filter/index.js +8 -16
  67. package/es/table/components/Layout/index.js +2 -1
  68. package/es/table/components/Layout/index.scss +1 -1
  69. package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
  70. package/es/table/components/ToolBar/index.scss +10 -0
  71. package/es/table/index.d.ts +0 -1
  72. package/es/table/index.js +75 -56
  73. package/es/table/index.scss +0 -1
  74. package/es/table/typing.d.ts +3 -1
  75. package/lib/actions/dialog-form.d.ts +3 -3
  76. package/lib/actions/dialog-table.d.ts +6 -1
  77. package/lib/actions/dialog-table.js +20 -1
  78. package/lib/actions/drawer-table.d.ts +4 -0
  79. package/lib/actions/drawer-table.js +14 -1
  80. package/lib/actions/index.d.ts +6 -11
  81. package/lib/actions/index.js +44 -20
  82. package/lib/actions/index.scss +1 -1
  83. package/lib/card/index.d.ts +17 -0
  84. package/lib/form/Components/ProField/index.d.ts +8 -0
  85. package/lib/form/ProForm/index.d.ts +2 -2
  86. package/lib/form/ProForm/index.js +10 -2
  87. package/lib/form/ProForm/index.scss +40 -7
  88. package/lib/form/SchemaForm/adapterType.js +3 -3
  89. package/lib/form/SchemaForm/index.d.ts +2 -2
  90. package/lib/form/SchemaForm/index.js +10 -5
  91. package/lib/form/SchemaForm/initializeArrayCards.js +10 -54
  92. package/lib/form/SchemaForm/initializeArrayCollapse.js +10 -63
  93. package/lib/form/SchemaForm/initializeArrayIcon.js +19 -7
  94. package/lib/form/SchemaForm/initializeArrayItems.js +16 -74
  95. package/lib/form/SchemaForm/initializeArrayTable.js +23 -33
  96. package/lib/form/SchemaForm/initializeFormButton.js +35 -38
  97. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  98. package/lib/form/SchemaForm/initializeFormStep.d.ts +4 -2
  99. package/lib/form/SchemaForm/initializeFormStep.js +21 -7
  100. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  101. package/lib/form/SchemaForm/initializeProField.js +3 -3
  102. package/lib/form/SchemaForm/reactions.d.ts +1 -1
  103. package/lib/form/SchemaForm/reactions.js +2 -2
  104. package/lib/form/index.d.ts +17 -9
  105. package/lib/form/index.js +81 -56
  106. package/lib/form/typing.d.ts +13 -22
  107. package/lib/form/warning.js +2 -6
  108. package/lib/index.d.ts +4 -3
  109. package/lib/index.js +16 -4
  110. package/lib/info/components/FormItem/index.js +4 -4
  111. package/lib/info/components/FormItem/index.scss +11 -0
  112. package/lib/info/components/InfoGroup/index.js +46 -6
  113. package/lib/info/components/InfoGroup/index.scss +6 -0
  114. package/lib/info/components/InfoValueItem/index.js +15 -3
  115. package/lib/info/components/baseInfo/index.js +10 -9
  116. package/lib/info/components/headerInfo/index.js +11 -10
  117. package/lib/info/components/tableInfo/index.js +7 -3
  118. package/lib/info/components/tableInfo/index.scss +1 -1
  119. package/lib/info/index.d.ts +1 -0
  120. package/lib/info/index.js +8 -6
  121. package/lib/info/index.scss +4 -0
  122. package/lib/info/typing.d.ts +17 -3
  123. package/lib/info/utils/index.d.ts +11 -2
  124. package/lib/info/utils/index.js +31 -0
  125. package/lib/nocode/configurators/PageHeader.js +49 -43
  126. package/lib/nocode/configurators/ProTable.js +12 -9
  127. package/lib/nocode/configurators/common.d.ts +117 -105
  128. package/lib/nocode/configurators/common.js +38 -34
  129. package/lib/nocode/index.scss +1 -4
  130. package/lib/page-header/index.d.ts +3 -0
  131. package/lib/page-header/index.js +42 -13
  132. package/lib/page-header/index.scss +6 -4
  133. package/lib/table/components/Filter/index.js +7 -15
  134. package/lib/table/components/Layout/index.js +2 -1
  135. package/lib/table/components/Layout/index.scss +1 -1
  136. package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
  137. package/lib/table/components/ToolBar/index.scss +10 -0
  138. package/lib/table/index.d.ts +0 -1
  139. package/lib/table/index.js +76 -65
  140. package/lib/table/index.scss +0 -1
  141. package/lib/table/typing.d.ts +3 -1
  142. package/package.json +5 -5
@@ -20,6 +20,10 @@ $prefix: 'teamix-pro-page-header';
20
20
  }
21
21
  }
22
22
 
23
+ .#{$prefix}-info {
24
+ padding-top: var(--s-2, 8px);
25
+ }
26
+
23
27
  .#{$prefix}-title {
24
28
  display: flex;
25
29
  font-size: var(--font-size-display-1, 24px);
@@ -130,7 +134,7 @@ $prefix: 'teamix-pro-page-header';
130
134
  color: var(--color-help-5);
131
135
  }
132
136
  }
133
-
137
+
134
138
  .#{$prefix}-bg-color {
135
139
  &-blue {
136
140
  background-color: var(--color-notice-5);
@@ -148,7 +152,7 @@ $prefix: 'teamix-pro-page-header';
148
152
  background-color: var(--color-help-5);
149
153
  }
150
154
  }
151
-
155
+
152
156
  .#{$prefix}-bg-type {
153
157
  &-circle {
154
158
  border-radius: 100%;
@@ -157,8 +161,6 @@ $prefix: 'teamix-pro-page-header';
157
161
  border-radius: 4px;
158
162
  }
159
163
  }
160
-
161
-
162
164
  }
163
165
 
164
166
  .#{$prefix}-link {
@@ -26,12 +26,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
 
27
27
  import React, { useEffect, useMemo, useState } from 'react';
28
28
  import TeamixIcon from '@teamix/icon';
29
- import { Button, Dropdown, Menu, Radio } from '@alicloudfe/components';
29
+ import { Button, Dropdown, Menu } from '@alicloudfe/components';
30
30
  import { baseClass } from '@teamix/utils';
31
31
  import './index.scss';
32
32
  var CheckboxItem = Menu.CheckboxItem;
33
33
  var cls = baseClass('teamix-pro-table-toolbar-filter');
34
- var RadioGroup = Radio.Group;
34
+ var RadioItem = Menu.RadioItem;
35
35
 
36
36
  var Filter = function Filter(props) {
37
37
  var column = props.column,
@@ -85,27 +85,19 @@ var Filter = function Filter(props) {
85
85
  }, []); // 渲染单选
86
86
 
87
87
  var renderSingle = function renderSingle() {
88
- var _selected$;
89
-
90
- return /*#__PURE__*/React.createElement(RadioGroup, {
91
- value: (_selected$ = selected === null || selected === void 0 ? void 0 : selected[0]) !== null && _selected$ !== void 0 ? _selected$ : '',
92
- onChange: function onChange(check) {
93
- setSelected([check]);
94
- }
95
- }, filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
88
+ return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
96
89
  var label = _ref3.label,
97
90
  value = _ref3.value;
98
91
  var valueStr = value.toString();
99
- return /*#__PURE__*/React.createElement(Radio, {
92
+ return /*#__PURE__*/React.createElement(RadioItem, {
100
93
  id: valueStr,
101
- value: valueStr,
94
+ checked: selected.includes(valueStr),
102
95
  key: valueStr,
103
- style: {
104
- display: 'block',
105
- marginLeft: '5px'
96
+ onChange: function onChange(check) {
97
+ setSelected([valueStr]);
106
98
  }
107
99
  }, label);
108
- }));
100
+ });
109
101
  }; // 渲染多选
110
102
 
111
103
 
@@ -29,13 +29,14 @@ import { Header, baseClass } from '@teamix/utils';
29
29
  import { Button, Badge } from '@alicloudfe/components';
30
30
  import TeamixIcon from '@teamix/icon';
31
31
  import { ActionGroup } from '../../../actions';
32
- import { SimpleFilter, AdvancedFilter, toJS } from '../../../form';
32
+ import { SimpleFilter, AdvancedFilter, formilyReactive } from '../../../form';
33
33
  import { getMessage } from '@teamix/utils';
34
34
  import ToolBar from '../ToolBar';
35
35
  import QuickAction from '../QuickAction';
36
36
  import isEmpty from 'lodash.isempty';
37
37
  import './index.scss';
38
38
  var cls = baseClass('teamix-pro-table-layout');
39
+ var toJS = formilyReactive.toJS;
39
40
 
40
41
  var Layout = function Layout(props) {
41
42
  var header = props.header,
@@ -34,6 +34,6 @@ $prefix: 'teamix-pro-table-layout';
34
34
  &-panel-filter {
35
35
  margin: 8px 0;
36
36
  padding: 16px;
37
- background: var(--panel-filter-bg, #fff);
37
+ background: var(--panel-filter-bg, var(--color-fill1-2));
38
38
  }
39
39
  }
@@ -19,14 +19,16 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
19
19
  /**
20
20
  * 筛选列
21
21
  */
22
- import { Button, Dropdown, Menu } from '@alicloudfe/components';
22
+ import { Button, Dropdown, Menu, Dialog, Grid, Checkbox } from '@alicloudfe/components';
23
23
  import TeamixIcon from '@teamix/icon';
24
24
  import { baseClass, getMessage } from '@teamix/utils';
25
25
  import React, { useState, useEffect } from 'react';
26
26
  import { cloneDeep } from '../../utils';
27
27
  import './index.scss';
28
- var CheckboxItem = Menu.CheckboxItem; // const { Tooltip } = Balloon;
29
-
28
+ import { Ellipsis } from '@teamix/utils';
29
+ var CheckboxItem = Menu.CheckboxItem;
30
+ var Row = Grid.Row,
31
+ Col = Grid.Col;
30
32
  var cls = baseClass('teamix-pro-table-toolbar-filter-column');
31
33
 
32
34
  var processColumns = function processColumns(columns) {
@@ -126,6 +128,13 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
126
128
  return item;
127
129
  });
128
130
  notifyTableRender(keyNewColumns);
131
+ }; // 修改:dialog
132
+
133
+
134
+ var onChangeColumnsForDialog = function onChangeColumnsForDialog() {
135
+ var keyNewColumns = cloneDeep(newColumns);
136
+ notifyTableRender(keyNewColumns);
137
+ setDropdownVisible(false);
129
138
  }; // 向上
130
139
 
131
140
 
@@ -265,20 +274,71 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
265
274
  })))));
266
275
  };
267
276
 
268
- return renderDropdown(); // <Tooltip
269
- // trigger={renderDropdown()}
270
- // align={fullscreen ? 'b' : 't'}
271
- // popupProps={{
272
- // offset: fullscreen ? [5, 20] : [5, -18],
273
- // animation: { in: 'fadeIn', out: 'fadeOut' },
274
- // visible: tooltipVisible && !dropdownVisible,
275
- // onVisibleChange: (state) => {
276
- // setTooltipVisible(state);
277
- // },
278
- // }}
279
- // >
280
- // {getMessage('customColumnSetting')}
281
- // </Tooltip>
277
+ var renderDialog = function renderDialog() {
278
+ // 对话框关闭
279
+ var dialogOnClose = function dialogOnClose() {
280
+ setDropdownVisible(false);
281
+ };
282
+
283
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
284
+ iconSize: "small",
285
+ className: "teamix-pro-table-toolbar-icon",
286
+ onClick: function onClick() {
287
+ setDropdownVisible(!dropdownVisible);
288
+ }
289
+ }, /*#__PURE__*/React.createElement(TeamixIcon, {
290
+ size: "small",
291
+ type: "set-line"
292
+ })), /*#__PURE__*/React.createElement(Dialog, {
293
+ title: getMessage('customColumnSetting'),
294
+ visible: dropdownVisible,
295
+ onOk: onChangeColumnsForDialog,
296
+ onCancel: dialogOnClose,
297
+ onClose: dialogOnClose,
298
+ style: {
299
+ width: '440px'
300
+ }
301
+ }, /*#__PURE__*/React.createElement(Row, {
302
+ gutter: 20,
303
+ wrap: true,
304
+ className: cls('row')
305
+ }, newColumns.map(function (item, index) {
306
+ var _newColumns$find2;
307
+
308
+ var dataIndex = item.dataIndex,
309
+ title = item.title,
310
+ columnFiltersDisabled = item.columnFiltersDisabled;
311
+ return /*#__PURE__*/React.createElement(Col, {
312
+ span: 8,
313
+ key: index,
314
+ className: cls('col')
315
+ }, /*#__PURE__*/React.createElement(Checkbox, {
316
+ checked: (_newColumns$find2 = newColumns.find(function (_ref5) {
317
+ var key = _ref5.dataIndex;
318
+ return key === dataIndex;
319
+ })) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
320
+ onChange: function onChange(check) {
321
+ var columnsList = cloneDeep(newColumns).map(function (item) {
322
+ if (item.dataIndex === dataIndex) {
323
+ item.columnFilters = check;
324
+ }
325
+
326
+ return item;
327
+ });
328
+ setNewColumns(columnsList);
329
+ },
330
+ disabled: columnFiltersDisabled
331
+ }, /*#__PURE__*/React.createElement(Ellipsis, {
332
+ tooltip: false
333
+ }, title)));
334
+ }))));
335
+ };
336
+
337
+ if (newColumns.length > 10) {
338
+ return renderDialog();
339
+ }
340
+
341
+ return renderDropdown();
282
342
  };
283
343
 
284
344
  export default FilterColumnIcon;
@@ -66,8 +66,18 @@
66
66
  }
67
67
  }
68
68
  }
69
+
70
+
71
+ }
72
+ .teamix-pro-table-toolbar-filter-column-col {
73
+ height: 28px;
74
+ .next-checkbox-wrapper {
75
+ display: flex;
76
+ align-items: center;
77
+ }
69
78
  }
70
79
 
80
+
71
81
  // fullscreen
72
82
  .teamix-pro-table-full-screen {
73
83
  width: 100vw;
@@ -2,6 +2,5 @@ import { ProTableProps } from './typing';
2
2
  import './index.scss';
3
3
  export * from './typing';
4
4
  export * from '../actions';
5
- export { default as ActionButton } from '../actions';
6
5
  declare const ProTable: (props: ProTableProps) => JSX.Element;
7
6
  export default ProTable;
package/es/table/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction"];
1
+ var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh"];
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
4
 
@@ -44,17 +44,16 @@ import getTableProps from './utils/getTableProps';
44
44
  import getTableSortIcons from './utils/getTableSortIcons';
45
45
  import useTableSelection from './utils/useTableSelection';
46
46
  import FullScreen from './components/ToolBar/Fullscreen';
47
- import { createForm, toJS } from '../form';
47
+ import { createForm, formilyReactive } from '../form';
48
48
  import { ActionGroup } from '../actions';
49
49
  import debounce from 'lodash.debounce';
50
50
  import classNames from 'classnames';
51
51
  export * from './typing'; // 导出 ProActions 组件
52
52
 
53
- export * from '../actions';
54
- export { default as ActionButton } from '../actions';
55
- import { registerActionHandler } from '../actions';
56
- import { useSize } from 'ahooks';
53
+ export * from '../actions'; // import { useSize } from 'ahooks';
54
+
57
55
  var cls = baseClass('teamix-pro-table');
56
+ var toJS = formilyReactive.toJS;
58
57
  /**
59
58
  * 处理原生传入的 columns 以便于 选择列 方便处理
60
59
  * @param columns 原生传入的 columns
@@ -103,7 +102,7 @@ var ProTable = function ProTable(props) {
103
102
  pageKey = props.pageKey,
104
103
  pageSizeKey = props.pageSizeKey,
105
104
  _props$method = props.method,
106
- method = _props$method === void 0 ? 'post' : _props$method,
105
+ method = _props$method === void 0 ? 'get' : _props$method,
107
106
  _props$params = props.params,
108
107
  propsParams = _props$params === void 0 ? {} : _props$params,
109
108
  formatSort = props.formatSort,
@@ -128,6 +127,10 @@ var ProTable = function ProTable(props) {
128
127
  filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
129
128
  _props$footerSuction = props.footerSuction,
130
129
  footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
130
+ _props$autoRefresh = props.autoRefresh,
131
+ autoRefresh = _props$autoRefresh === void 0 ? function () {
132
+ return false;
133
+ } : _props$autoRefresh,
131
134
  otherProps = _objectWithoutProperties(props, _excluded);
132
135
 
133
136
  var targetPageKey = pageKey || globalPageKey;
@@ -178,8 +181,15 @@ var ProTable = function ProTable(props) {
178
181
  var _useState15 = useState('medium'),
179
182
  _useState16 = _slicedToArray(_useState15, 2),
180
183
  size = _useState16[0],
181
- _setSize = _useState16[1]; // 获取header高度,用作全屏吸底吸顶高度计算
184
+ _setSize = _useState16[1];
185
+
186
+ var _useState17 = useState(true),
187
+ _useState18 = _slicedToArray(_useState17, 2),
188
+ showLoading = _useState18[0],
189
+ setShowLoading = _useState18[1]; // 存储定时器 id
190
+
182
191
 
192
+ var autoRefreshTimerRef = useRef(); // 获取header高度,用作全屏吸底吸顶高度计算
183
193
 
184
194
  var getHeaderHeight = function getHeaderHeight() {
185
195
  var _tableDom$getElements, _tableDom$getElements2;
@@ -200,30 +210,30 @@ var ProTable = function ProTable(props) {
200
210
  }; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
201
211
 
202
212
 
203
- var _useState17 = useState(0),
204
- _useState18 = _slicedToArray(_useState17, 2),
205
- headerHeight = _useState18[0],
206
- setHeaderHeight = _useState18[1]; // 全屏显示 className
207
-
208
-
209
- var _useState19 = useState(false),
213
+ var _useState19 = useState(0),
210
214
  _useState20 = _slicedToArray(_useState19, 2),
211
- fullscreenState = _useState20[0],
212
- setFullscreenState = _useState20[1]; // 父元素位置。用作非全屏模式下的吸底
215
+ headerHeight = _useState20[0],
216
+ setHeaderHeight = _useState20[1]; // 全屏显示 className
213
217
 
214
218
 
215
- var _useState21 = useState(),
219
+ var _useState21 = useState(false),
216
220
  _useState22 = _slicedToArray(_useState21, 2),
217
- parentPosition = _useState22[0],
218
- setParentPosition = _useState22[1];
221
+ fullscreenState = _useState22[0],
222
+ setFullscreenState = _useState22[1]; // 父元素位置。用作非全屏模式下的吸底
223
+
224
+
225
+ var _useState23 = useState(),
226
+ _useState24 = _slicedToArray(_useState23, 2),
227
+ parentPosition = _useState24[0],
228
+ setParentPosition = _useState24[1];
219
229
  /** 筛选区域 form */
220
230
 
221
231
 
222
232
  var dataFilterForm = useMemo(function () {
223
233
  return createForm();
224
234
  }, []); // 获取表格大小
225
-
226
- var tableSize = useSize(tableRef); // 获取父元素位置
235
+ // const tableSize = useSize(tableRef);
236
+ // 获取父元素位置
227
237
 
228
238
  var getParentPosition = function getParentPosition() {
229
239
  // 暂时仅支持使用全家桶
@@ -237,12 +247,12 @@ var ProTable = function ProTable(props) {
237
247
  });
238
248
  }
239
249
  }; // 监听表格大小动态改变吸底footer大小
250
+ // useEffect(() => {
251
+ // getParentPosition();
252
+ // }, [tableSize]);
253
+ // rowSelection 相关
240
254
 
241
255
 
242
- useEffect(function () {
243
- getParentPosition();
244
- }, [tableSize]); // rowSelection 相关
245
-
246
256
  var rowSelectionHook = useTableSelection(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
247
257
  onChange: onChangeRowSelection
248
258
  }), primaryKey);
@@ -354,6 +364,25 @@ var ProTable = function ProTable(props) {
354
364
 
355
365
  if (propsActionRef) {
356
366
  propsActionRef.current = actionRef.current;
367
+ }
368
+
369
+ function onFormatResult(next) {
370
+ var _next$data;
371
+
372
+ props.onFormatResult && props.onFormatResult(next);
373
+ var time = autoRefresh ? autoRefresh(next.data) : false;
374
+
375
+ if (Number.isInteger(time) && time >= 1000) {
376
+ autoRefreshTimerRef.current = setTimeout(function () {
377
+ // 自动刷新不显示 loading
378
+ _request({}, true);
379
+ }, Number(time));
380
+ } // 设置 dataSource、total
381
+
382
+
383
+ setData(next.data || []);
384
+ setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
385
+ setShowSkeleton(false);
357
386
  } // 请求表格数据工具函数
358
387
 
359
388
 
@@ -384,16 +413,6 @@ var ProTable = function ProTable(props) {
384
413
  }
385
414
  }
386
415
 
387
- function onFormatResult(next) {
388
- var _next$data;
389
-
390
- props.onFormatResult && props.onFormatResult(next); // 设置 dataSource、total
391
-
392
- setData(next.data || []);
393
- setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
394
- setShowSkeleton(false);
395
- }
396
-
397
416
  if (nextData instanceof Promise) {
398
417
  nextData.then(function (res) {
399
418
  onFormatResult(res);
@@ -415,10 +434,12 @@ var ProTable = function ProTable(props) {
415
434
  }
416
435
  }); // 请求函数
417
436
 
418
- function _request(params) {
437
+ function _request(params, noLoading) {
419
438
  var _actionRef$current, _actionRef$current$se, _objectSpread2;
420
439
 
421
- // 请求前需要优先清空列过滤条件
440
+ var nextShowLoading = !noLoading;
441
+ nextShowLoading !== showLoading && setShowLoading(nextShowLoading); // 请求前需要优先清空列过滤条件
442
+
422
443
  (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setFilterRules) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, {});
423
444
  var sortParams = targetFormatSort(sort); // 筛选区请求参数
424
445
 
@@ -427,7 +448,11 @@ var ProTable = function ProTable(props) {
427
448
  var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams) : _objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams)), params));
428
449
 
429
450
  if (requestData) {
430
- // console.log('requestData', requestData);
451
+ if (autoRefreshTimerRef.current) {
452
+ clearTimeout(autoRefreshTimerRef.current);
453
+ autoRefreshTimerRef.current = null;
454
+ }
455
+
431
456
  getData.run(requestData);
432
457
  }
433
458
  }
@@ -436,6 +461,12 @@ var ProTable = function ProTable(props) {
436
461
  if (requestWhenMount) {
437
462
  _request();
438
463
  }
464
+
465
+ return function () {
466
+ if (autoRefreshTimerRef.current) {
467
+ clearTimeout(autoRefreshTimerRef.current);
468
+ }
469
+ };
439
470
  }, []);
440
471
 
441
472
  function onSort(dataIndex, order) {
@@ -481,7 +512,7 @@ var ProTable = function ProTable(props) {
481
512
  hasBorder: false,
482
513
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
483
514
  columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef),
484
- loading: !showSkeleton && (getData.loading || props.loading),
515
+ loading: showLoading && !showSkeleton && (getData.loading || props.loading),
485
516
  className: classNames('teamix-pro-table', tableClassName, {
486
517
  'with-row-select': rowSelection
487
518
  }),
@@ -562,8 +593,8 @@ var ProTable = function ProTable(props) {
562
593
  'footer-has-rowSelection': rowSelection
563
594
  }),
564
595
  style: {
565
- left: "".concat((_parentPosition$offse = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetLeft) !== null && _parentPosition$offse !== void 0 ? _parentPosition$offse : 0, "px"),
566
- right: "".concat((_parentPosition$offse2 = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetRight) !== null && _parentPosition$offse2 !== void 0 ? _parentPosition$offse2 : 0, "px")
596
+ left: "".concat(fullscreenState ? 0 : (_parentPosition$offse = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetLeft) !== null && _parentPosition$offse !== void 0 ? _parentPosition$offse : 0, "px"),
597
+ right: "".concat(fullscreenState ? 0 : (_parentPosition$offse2 = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetRight) !== null && _parentPosition$offse2 !== void 0 ? _parentPosition$offse2 : 0, "px")
567
598
  }
568
599
  }, renderRowSelection(), /*#__PURE__*/React.createElement("div", {
569
600
  className: cls('footer-right-wrapper')
@@ -603,18 +634,6 @@ var ProTable = function ProTable(props) {
603
634
  }),
604
635
  ref: tableRef
605
636
  }, renderTable(), renderFooter()));
606
- }; // 注册 action 里面的弹层表格
607
-
608
-
609
- registerActionHandler('dialog-table', 'dialog', {
610
- component: ProTable,
611
- closeable: true,
612
- size: 'medium'
613
- });
614
- registerActionHandler('drawer-table', 'dialog', {
615
- component: ProTable,
616
- closeable: true,
617
- dialogType: 'drawer',
618
- size: 'medium'
619
- });
637
+ };
638
+
620
639
  export default ProTable;
@@ -99,6 +99,5 @@ $fullscreenPadding: 24px;
99
99
  background-color: var(--table-row-bg, #ffffff);
100
100
  margin: 0;
101
101
  z-index: 2;
102
- transition: width .3s;
103
102
  }
104
103
  }
@@ -103,8 +103,10 @@ export declare type ProTableProps = {
103
103
  skeletonSize?: number;
104
104
  /** 表格主题 className */
105
105
  tableClassName?: string;
106
- /** 非全屏模式下是否吸底 默认状态下取用 ProPageContainer 作为参照物。如果传入了Dom,则取用Dom作为参照物 */
106
+ /** 非全屏模式下是否吸底 默认状态下取用 ProPageContainer 作为参照物。如果传入了 Dom,则取用 Dom 作为参照物 */
107
107
  footerSuction?: boolean | Element;
108
+ /** 当满足条件时开启自动刷新,返回值为自动刷新间隔时间,如果返回 0 或 false 则停止自动刷新,每次触发翻页、搜索都将重置时间 */
109
+ autoRefresh?: (dataSource: any[]) => number | boolean;
108
110
  } & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
109
111
  export declare type rowSelectionType = {
110
112
  getProps?: (record: any, index: number) => any;
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- import { IProFormProps } from '../form';
2
+ 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
  initialValues?: any;
7
7
  initialRequest?: RequestAction;
8
8
  useFieldValuesForRequest?: boolean;
9
- formProps?: IProFormProps;
10
- schema: any[];
9
+ formProps?: Omit<IFormProps, 'schema'>;
10
+ schema: IFormSchema;
11
11
  }
12
12
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
13
13
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -1,4 +1,9 @@
1
1
  import { DialogAction } from './dialog';
2
+ import { ProTableProps } from '..';
2
3
  export interface DialogTableAction extends DialogAction {
3
- schema: any;
4
+ schema: ProTableProps;
4
5
  }
6
+ export declare function useDialogTableAction(action: DialogTableAction, context?: any): {
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
8
+ };
9
+ export default useDialogTableAction;
@@ -2,4 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ exports.default = void 0;
7
+ exports.useDialogTableAction = useDialogTableAction;
8
+
9
+ var _dialog = _interopRequireDefault(require("./dialog"));
10
+
11
+ var _ = require("..");
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function useDialogTableAction(action, context) {
16
+ return (0, _dialog.default)(Object.assign({
17
+ component: _.ProTable,
18
+ closeable: true,
19
+ size: 'medium'
20
+ }, action), context);
21
+ }
22
+
23
+ var _default = useDialogTableAction;
24
+ exports.default = _default;
@@ -1,2 +1,6 @@
1
1
  import { DialogTableAction } from './dialog-table';
2
2
  export declare type DrawerTableAction = DialogTableAction;
3
+ export declare function useDrawerTableAction(action: DrawerTableAction, context?: any): {
4
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
5
+ };
6
+ export default useDrawerTableAction;
@@ -2,4 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ exports.default = void 0;
7
+ exports.useDrawerTableAction = useDrawerTableAction;
8
+
9
+ var _dialogTable = require("./dialog-table");
10
+
11
+ function useDrawerTableAction(action, context) {
12
+ return (0, _dialogTable.useDialogTableAction)(Object.assign({
13
+ dialogType: 'drawer'
14
+ }, action), context);
15
+ }
16
+
17
+ var _default = useDrawerTableAction;
18
+ exports.default = _default;
@@ -51,26 +51,21 @@ export interface IActionButton extends ButtonProps {
51
51
  }
52
52
  export declare const ActionButton: (props: IActionButton) => JSX.Element;
53
53
  export interface IActionMenuButton extends MenuButtonProps {
54
- actions: IActionButton[];
54
+ actions: ICommonActionButton[];
55
55
  visible?: any;
56
56
  icon?: string;
57
57
  context?: any;
58
58
  }
59
- export interface IActionGroupMenuButton extends MenuButtonProps {
60
- actions: CommonActionButton[];
61
- icon?: string;
62
- context?: any;
63
- }
64
- export declare const ActionMenuButton: (props: IActionGroupMenuButton) => JSX.Element;
65
- export declare type CommonActionButton = IActionButton | IActionMenuButton;
66
- export declare type CommonActionGroupButton = CommonActionButton | IActionGroupMenuButton;
59
+ export declare const ActionMenuButton: (props: IActionMenuButton) => JSX.Element;
60
+ export declare type ICommonActionButton = IActionButton | IActionMenuButton;
67
61
  export declare type ActionGroupProps = {
68
62
  type?: 'button' | 'text';
69
63
  context?: any;
70
- actions: CommonActionButton[];
64
+ actions: ICommonActionButton[];
71
65
  max?: number;
72
66
  moreText?: string;
73
67
  divider?: boolean;
74
68
  } & React.HTMLAttributes<HTMLElement>;
75
69
  export declare function ActionGroup(props: ActionGroupProps): JSX.Element;
76
- export default ActionButton;
70
+ declare const _default: (props: ICommonActionButton) => JSX.Element;
71
+ export default _default;