@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.
- package/README.md +97 -0
- package/dist/212.js +2 -2
- package/dist/pro.css +1 -1
- package/dist/pro.js +3147 -1872
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +1 -1
- package/es/actions/dialog-form.d.ts +3 -3
- package/es/actions/dialog-table.d.ts +6 -1
- package/es/actions/dialog-table.js +10 -1
- package/es/actions/drawer-table.d.ts +4 -0
- package/es/actions/drawer-table.js +7 -1
- package/es/actions/index.d.ts +6 -11
- package/es/actions/index.js +41 -21
- package/es/actions/index.scss +1 -1
- package/es/card/index.d.ts +17 -0
- package/es/form/Components/ProField/index.d.ts +8 -0
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +9 -2
- package/es/form/ProForm/index.scss +40 -7
- package/es/form/SchemaForm/adapterType.js +3 -3
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +9 -5
- package/es/form/SchemaForm/initializeArrayCards.js +10 -55
- package/es/form/SchemaForm/initializeArrayCollapse.js +10 -64
- package/es/form/SchemaForm/initializeArrayIcon.js +19 -7
- package/es/form/SchemaForm/initializeArrayItems.js +16 -75
- package/es/form/SchemaForm/initializeArrayTable.js +23 -33
- package/es/form/SchemaForm/initializeFormButton.js +35 -38
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +4 -2
- package/es/form/SchemaForm/initializeFormStep.js +21 -7
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeProField.js +3 -3
- package/es/form/SchemaForm/reactions.d.ts +1 -1
- package/es/form/SchemaForm/reactions.js +2 -2
- package/es/form/index.d.ts +17 -9
- package/es/form/index.js +21 -9
- package/es/form/typing.d.ts +13 -22
- package/es/form/warning.js +2 -6
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -3
- package/es/info/components/FormItem/index.js +4 -4
- package/es/info/components/FormItem/index.scss +11 -0
- package/es/info/components/InfoGroup/index.js +37 -6
- package/es/info/components/InfoGroup/index.scss +6 -0
- package/es/info/components/InfoValueItem/index.js +14 -2
- package/es/info/components/baseInfo/index.js +10 -9
- package/es/info/components/headerInfo/index.js +10 -9
- package/es/info/components/tableInfo/index.js +7 -4
- package/es/info/components/tableInfo/index.scss +1 -1
- package/es/info/index.d.ts +1 -0
- package/es/info/index.js +9 -7
- package/es/info/index.scss +4 -0
- package/es/info/typing.d.ts +17 -3
- package/es/info/utils/index.d.ts +11 -2
- package/es/info/utils/index.js +21 -0
- package/es/nocode/configurators/PageHeader.js +49 -43
- package/es/nocode/configurators/ProTable.js +12 -9
- package/es/nocode/configurators/common.d.ts +117 -105
- package/es/nocode/configurators/common.js +38 -34
- package/es/nocode/index.scss +1 -4
- package/es/page-header/index.d.ts +3 -0
- package/es/page-header/index.js +40 -13
- package/es/page-header/index.scss +6 -4
- package/es/table/components/Filter/index.js +8 -16
- package/es/table/components/Layout/index.js +2 -1
- package/es/table/components/Layout/index.scss +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
- package/es/table/components/ToolBar/index.scss +10 -0
- package/es/table/index.d.ts +0 -1
- package/es/table/index.js +75 -56
- package/es/table/index.scss +0 -1
- package/es/table/typing.d.ts +3 -1
- package/lib/actions/dialog-form.d.ts +3 -3
- package/lib/actions/dialog-table.d.ts +6 -1
- package/lib/actions/dialog-table.js +20 -1
- package/lib/actions/drawer-table.d.ts +4 -0
- package/lib/actions/drawer-table.js +14 -1
- package/lib/actions/index.d.ts +6 -11
- package/lib/actions/index.js +44 -20
- package/lib/actions/index.scss +1 -1
- package/lib/card/index.d.ts +17 -0
- package/lib/form/Components/ProField/index.d.ts +8 -0
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +10 -2
- package/lib/form/ProForm/index.scss +40 -7
- package/lib/form/SchemaForm/adapterType.js +3 -3
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +10 -5
- package/lib/form/SchemaForm/initializeArrayCards.js +10 -54
- package/lib/form/SchemaForm/initializeArrayCollapse.js +10 -63
- package/lib/form/SchemaForm/initializeArrayIcon.js +19 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +16 -74
- package/lib/form/SchemaForm/initializeArrayTable.js +23 -33
- package/lib/form/SchemaForm/initializeFormButton.js +35 -38
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +4 -2
- package/lib/form/SchemaForm/initializeFormStep.js +21 -7
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeProField.js +3 -3
- package/lib/form/SchemaForm/reactions.d.ts +1 -1
- package/lib/form/SchemaForm/reactions.js +2 -2
- package/lib/form/index.d.ts +17 -9
- package/lib/form/index.js +81 -56
- package/lib/form/typing.d.ts +13 -22
- package/lib/form/warning.js +2 -6
- package/lib/index.d.ts +4 -3
- package/lib/index.js +16 -4
- package/lib/info/components/FormItem/index.js +4 -4
- package/lib/info/components/FormItem/index.scss +11 -0
- package/lib/info/components/InfoGroup/index.js +46 -6
- package/lib/info/components/InfoGroup/index.scss +6 -0
- package/lib/info/components/InfoValueItem/index.js +15 -3
- package/lib/info/components/baseInfo/index.js +10 -9
- package/lib/info/components/headerInfo/index.js +11 -10
- package/lib/info/components/tableInfo/index.js +7 -3
- package/lib/info/components/tableInfo/index.scss +1 -1
- package/lib/info/index.d.ts +1 -0
- package/lib/info/index.js +8 -6
- package/lib/info/index.scss +4 -0
- package/lib/info/typing.d.ts +17 -3
- package/lib/info/utils/index.d.ts +11 -2
- package/lib/info/utils/index.js +31 -0
- package/lib/nocode/configurators/PageHeader.js +49 -43
- package/lib/nocode/configurators/ProTable.js +12 -9
- package/lib/nocode/configurators/common.d.ts +117 -105
- package/lib/nocode/configurators/common.js +38 -34
- package/lib/nocode/index.scss +1 -4
- package/lib/page-header/index.d.ts +3 -0
- package/lib/page-header/index.js +42 -13
- package/lib/page-header/index.scss +6 -4
- package/lib/table/components/Filter/index.js +7 -15
- package/lib/table/components/Layout/index.js +2 -1
- package/lib/table/components/Layout/index.scss +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
- package/lib/table/components/ToolBar/index.scss +10 -0
- package/lib/table/index.d.ts +0 -1
- package/lib/table/index.js +76 -65
- package/lib/table/index.scss +0 -1
- package/lib/table/typing.d.ts +3 -1
- 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
|
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
|
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
|
-
|
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(
|
92
|
+
return /*#__PURE__*/React.createElement(RadioItem, {
|
100
93
|
id: valueStr,
|
101
|
-
|
94
|
+
checked: selected.includes(valueStr),
|
102
95
|
key: valueStr,
|
103
|
-
|
104
|
-
|
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,
|
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,
|
@@ -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
|
-
|
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
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
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;
|
package/es/table/index.d.ts
CHANGED
@@ -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,
|
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
|
-
|
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 ? '
|
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];
|
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
|
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
|
-
|
212
|
-
|
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
|
-
|
218
|
-
|
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
|
-
|
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
|
-
|
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
|
-
};
|
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;
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -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 {
|
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?:
|
10
|
-
schema:
|
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:
|
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;
|
package/lib/actions/index.d.ts
CHANGED
@@ -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:
|
54
|
+
actions: ICommonActionButton[];
|
55
55
|
visible?: any;
|
56
56
|
icon?: string;
|
57
57
|
context?: any;
|
58
58
|
}
|
59
|
-
export
|
60
|
-
|
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:
|
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
|
-
|
70
|
+
declare const _default: (props: ICommonActionButton) => JSX.Element;
|
71
|
+
export default _default;
|