@teamix/pro 1.5.12 → 1.5.15
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/dist/pro.all.min.css +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +5060 -171
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.xconsole.min.css +1 -1
- package/es/actions/dialog.js +1 -1
- package/es/actions/index.scss +1 -1
- package/es/card/index.scss +6 -2
- package/es/card/xconsole.scss +3 -0
- package/es/global.scss +3 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/next-xconsole.scss +34 -0
- package/es/nocode/configurators/ProTable.js +1 -22
- package/es/nocode/pages/index.js +1 -26
- package/es/page-header/index.scss +2 -1
- package/es/page-header/xconsole.scss +5 -0
- package/es/table/components/Filter/index.d.ts +5 -3
- package/es/table/components/Filter/index.js +84 -63
- package/es/table/components/Layout/index.js +5 -2
- package/es/table/components/Layout/index.scss +1 -0
- package/es/table/index.js +53 -14
- package/es/table/typing.d.ts +14 -0
- package/es/table/utils/columnRender.d.ts +2 -2
- package/es/table/utils/columnRender.js +4 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +3 -1
- package/es/table/utils/util.d.ts +5 -0
- package/es/table/utils/util.js +19 -0
- package/es/xconsole.scss +503 -0
- package/lib/actions/dialog.js +1 -1
- package/lib/actions/index.scss +1 -1
- package/lib/card/index.scss +6 -2
- package/lib/card/xconsole.scss +3 -0
- package/lib/global.scss +3 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/next-xconsole.scss +34 -0
- package/lib/nocode/configurators/ProTable.js +1 -22
- package/lib/nocode/pages/index.js +1 -26
- package/lib/page-header/index.scss +2 -1
- package/lib/page-header/xconsole.scss +5 -0
- package/lib/table/components/Filter/index.d.ts +5 -3
- package/lib/table/components/Filter/index.js +83 -62
- package/lib/table/components/Layout/index.js +5 -2
- package/lib/table/components/Layout/index.scss +1 -0
- package/lib/table/index.js +53 -14
- package/lib/table/typing.d.ts +14 -0
- package/lib/table/utils/columnRender.d.ts +2 -2
- package/lib/table/utils/columnRender.js +4 -2
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +3 -1
- package/lib/table/utils/util.d.ts +5 -0
- package/lib/table/utils/util.js +25 -0
- package/lib/xconsole.scss +503 -0
- package/package.json +1 -1
package/lib/global.scss
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
@import "./xconsole.scss";
|
2
|
+
@import "next-xconsole";
|
1
3
|
// transition 切换主题优化,暂时先写到 pro 里,后面加到基础组件里
|
2
4
|
|
3
5
|
// table 行背景色
|
@@ -42,4 +44,4 @@ button.next-btn.next-medium.next-btn-normal {
|
|
42
44
|
// 可关闭tag
|
43
45
|
.next-tag.next-tag.next-tag.next-tag-closable.next-tag-level-normal.next-tag-closable {
|
44
46
|
transition: color 0s;
|
45
|
-
}
|
47
|
+
}
|
package/lib/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.5.
|
31
|
+
declare const version = "1.5.15";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -280,7 +280,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
280
280
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
281
281
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
282
282
|
}
|
283
|
-
var version = '1.5.
|
283
|
+
var version = '1.5.15';
|
284
284
|
// By TeamixTest
|
285
285
|
exports.version = version;
|
286
286
|
window.postMessage({
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.theme-xconsole {
|
2
|
+
//.next-drawer-header {
|
3
|
+
// color: var(--color-text-1, #1A1A1A)
|
4
|
+
//}
|
5
|
+
//.next-message.next-message-success.next-toast .next-message-title {
|
6
|
+
// color: var(--color-text-1, #1A1A1A)
|
7
|
+
//}
|
8
|
+
|
9
|
+
--message-success-color-border-toast: var(--color-border-4, #E5E5E5);
|
10
|
+
|
11
|
+
/* --card-border-color: var(--color-text1-4, #E3E4E6); */
|
12
|
+
--card-border-color: var(--color-border-4, #E5E5E5);
|
13
|
+
/* --tab-pure-divider-border-color: var(--color-text1-4, #e5e5e5); */
|
14
|
+
--tab-pure-divider-border-color: var(--color-border-4, #E5E5E5);
|
15
|
+
--drawer-title-border-color: var(--color-border-4, #E5E5E5);
|
16
|
+
|
17
|
+
--popup-local-border-color: var(--color-border-4, #E5E5E5);
|
18
|
+
|
19
|
+
--btn-pure-normal-bg-disabled: var(--color-fill-2, #F7F7F7);
|
20
|
+
--checkbox-disabled-bg-color: var(--color-border-1, #D9D9D9);
|
21
|
+
|
22
|
+
--btn-pure-normal-border-color-disabled: var(--color-border-1, #D9D9D9);
|
23
|
+
--btn-pure-primary-border-color-disabled: var(--color-border-1, #D9D9D9);
|
24
|
+
|
25
|
+
--tab-item-margin-lr-size-m: 16px;
|
26
|
+
--tab-pure-hover-bg: transparent;
|
27
|
+
|
28
|
+
--progress-line-underlay-color: var(--color-border-4, #E5E5E5);
|
29
|
+
--range-normal-unselected-color: var(--color-border-4, #E5E5E5);
|
30
|
+
|
31
|
+
.next-formily-item-inset {
|
32
|
+
border: 1px solid var(--color-border-1, #D9D9D9);
|
33
|
+
}
|
34
|
+
}
|
@@ -6,28 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = void 0;
|
7
7
|
var _common = require("./common");
|
8
8
|
var initialValues = {
|
9
|
-
columns: [
|
10
|
-
dataIndex: 'instanceName',
|
11
|
-
title: '实例ID/实例名称'
|
12
|
-
}, {
|
13
|
-
dataIndex: 'organizationName',
|
14
|
-
title: '组织',
|
15
|
-
tooltip: '我这一列是可以被复制的~',
|
16
|
-
render: {
|
17
|
-
copy: true
|
18
|
-
}
|
19
|
-
}],
|
20
|
-
url: 'https://oneapi.alibaba-inc.com/mock/teamix-pro/api/getTableResource',
|
21
|
-
formatResult: {
|
22
|
-
data: 'data',
|
23
|
-
total: 'pageInfo.total'
|
24
|
-
},
|
25
|
-
mainAction: {
|
26
|
-
actions: [{
|
27
|
-
key: 'action',
|
28
|
-
children: '操作按钮'
|
29
|
-
}]
|
30
|
-
}
|
9
|
+
columns: []
|
31
10
|
};
|
32
11
|
var defaultValues = {
|
33
12
|
showSkeleton: true,
|
@@ -54,32 +54,7 @@ var PageMap = {
|
|
54
54
|
// 全部页面模板默认初始值
|
55
55
|
exports.PageMap = PageMap;
|
56
56
|
var PageDefaultInitialValues = {
|
57
|
-
LIST: {
|
58
|
-
header: {
|
59
|
-
title: '页面标题'
|
60
|
-
},
|
61
|
-
content: {
|
62
|
-
header: {
|
63
|
-
title: '表格标题'
|
64
|
-
},
|
65
|
-
columns: [{
|
66
|
-
dataIndex: 'instanceName',
|
67
|
-
title: '实例ID/实例名称'
|
68
|
-
}, {
|
69
|
-
dataIndex: 'organizationName',
|
70
|
-
title: '组织',
|
71
|
-
tooltip: '我这一列是可以被复制的~',
|
72
|
-
render: {
|
73
|
-
copy: true
|
74
|
-
}
|
75
|
-
}],
|
76
|
-
url: 'https://oneapi.alibaba-inc.com/mock/teamix-pro/api/getTableResource',
|
77
|
-
formatResult: {
|
78
|
-
data: 'data',
|
79
|
-
total: 'pageInfo.total'
|
80
|
-
}
|
81
|
-
}
|
82
|
-
},
|
57
|
+
LIST: {},
|
83
58
|
DETAIL: {},
|
84
59
|
FORM: {}
|
85
60
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@import "xconsole";
|
1
2
|
$prefix: 'teamix-pro-page-header';
|
2
3
|
|
3
4
|
.#{$prefix} {
|
@@ -12,7 +13,7 @@ $prefix: 'teamix-pro-page-header';
|
|
12
13
|
justify-content: space-between;
|
13
14
|
align-items: center;
|
14
15
|
min-height: 18px;
|
15
|
-
height:
|
16
|
+
height: auto;
|
16
17
|
margin-bottom: var(--s-2, 8px);
|
17
18
|
|
18
19
|
&.with-description {
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import './index.scss';
|
3
|
-
import { ProTableColumnProps, ProTableActionType } from '../../typing';
|
3
|
+
import { ProTableColumnProps, ProTableActionType, ProTableProps } from '../../typing';
|
4
4
|
declare type ProTableFilterProps = {
|
5
5
|
column: ProTableColumnProps;
|
6
6
|
actionRef: React.MutableRefObject<ProTableActionType | undefined>;
|
7
7
|
switchCardView?: 'table' | 'card';
|
8
|
+
bindUrl?: ProTableProps['bindUrl'];
|
9
|
+
bindUrlProps?: ProTableProps['bindUrlProps'];
|
8
10
|
};
|
9
|
-
declare const
|
10
|
-
export default
|
11
|
+
declare const _default: React.NamedExoticComponent<ProTableFilterProps>;
|
12
|
+
export default _default;
|
@@ -10,6 +10,7 @@ var _icon = _interopRequireDefault(require("@teamix/icon"));
|
|
10
10
|
var _components = require("@alicloudfe/components");
|
11
11
|
var _utils = require("@teamix/utils");
|
12
12
|
require("./index.scss");
|
13
|
+
var _hooks = require("@teamix/hooks");
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
15
|
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); }
|
15
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -30,13 +31,20 @@ var CheckboxItem = _components.Menu.CheckboxItem;
|
|
30
31
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-table-toolbar-filter');
|
31
32
|
var RadioItem = _components.Menu.RadioItem;
|
32
33
|
var Filter = function Filter(props) {
|
34
|
+
var _urlState$split, _urlState, _urlState$split2;
|
33
35
|
var column = props.column,
|
34
36
|
actionRef = props.actionRef,
|
35
|
-
switchCardView = props.switchCardView
|
37
|
+
switchCardView = props.switchCardView,
|
38
|
+
bindUrlProps = props.bindUrlProps,
|
39
|
+
bindUrl = props.bindUrl;
|
36
40
|
var _column$filtersWidth = column.filtersWidth,
|
37
41
|
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth;
|
42
|
+
var _useUrlState = (0, _hooks.useUrlState)(),
|
43
|
+
_useUrlState2 = _slicedToArray(_useUrlState, 2),
|
44
|
+
urlState = _useUrlState2[0],
|
45
|
+
setUrlState = _useUrlState2[1];
|
38
46
|
// 选中过滤项
|
39
|
-
var _useState = (0, _react.useState)([]),
|
47
|
+
var _useState = (0, _react.useState)((_urlState$split = urlState === null || urlState === void 0 ? void 0 : (_urlState = urlState["filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex)]) === null || _urlState === void 0 ? void 0 : (_urlState$split2 = _urlState.split) === null || _urlState$split2 === void 0 ? void 0 : _urlState$split2.call(_urlState, ',')) !== null && _urlState$split !== void 0 ? _urlState$split : []),
|
40
48
|
_useState2 = _slicedToArray(_useState, 2),
|
41
49
|
selected = _useState2[0],
|
42
50
|
setSelected = _useState2[1];
|
@@ -48,7 +56,10 @@ var Filter = function Filter(props) {
|
|
48
56
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
49
57
|
// 从全局状态中读取上次存储的条件
|
50
58
|
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 : [];
|
51
|
-
|
59
|
+
// 全局状态中需要有值才赋值。优先级:全局状态 > urlState
|
60
|
+
if (rules && rules.length > 0) {
|
61
|
+
setSelected(rules);
|
62
|
+
}
|
52
63
|
}, []);
|
53
64
|
// 获取过滤项
|
54
65
|
var filters = (0, _react.useMemo)(function () {
|
@@ -75,6 +86,72 @@ var Filter = function Filter(props) {
|
|
75
86
|
// console.log(filters);
|
76
87
|
return filters;
|
77
88
|
}, []);
|
89
|
+
// 点击确定回调
|
90
|
+
var onFilterOk = function onFilterOk() {
|
91
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$r, _actionRef$current9, _actionRef$current9$c;
|
92
|
+
(_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);
|
93
|
+
// 先获取此列的param
|
94
|
+
var param = '';
|
95
|
+
if (column.beforeFilter) {
|
96
|
+
var _column$beforeFilter;
|
97
|
+
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
98
|
+
} else {
|
99
|
+
param = selected.join(',');
|
100
|
+
}
|
101
|
+
// 需要带上其他所有的信息
|
102
|
+
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 : {};
|
103
|
+
// 再设置所有的列筛选状态
|
104
|
+
(_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, {
|
105
|
+
rules: selected,
|
106
|
+
params: param
|
107
|
+
})));
|
108
|
+
var targetPageKey = 'currentPage';
|
109
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
110
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
111
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
112
|
+
}
|
113
|
+
if (switchCardView === 'card') {
|
114
|
+
var _actionRef$current6, _actionRef$current6$s;
|
115
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$s = _actionRef$current6.setData) === null || _actionRef$current6$s === void 0 ? void 0 : _actionRef$current6$s.call(_actionRef$current6, []);
|
116
|
+
}
|
117
|
+
// 发送请求
|
118
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.request) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7, _defineProperty({}, targetPageKey, 1));
|
119
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$r = _actionRef$current8.resetPage) === null || _actionRef$current8$r === void 0 ? void 0 : _actionRef$current8$r.call(_actionRef$current8);
|
120
|
+
// 清空表格选择
|
121
|
+
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
122
|
+
setVisible(false);
|
123
|
+
// 设置 url
|
124
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && (urlState === null || urlState === void 0 ? void 0 : urlState["filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex)]) !== selected.join(',')) {
|
125
|
+
setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), selected.join(',')));
|
126
|
+
}
|
127
|
+
};
|
128
|
+
// 重置回调
|
129
|
+
var onFilterReset = function onFilterReset() {
|
130
|
+
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
131
|
+
setSelected([]);
|
132
|
+
var rules = (_actionRef$current$ge7 = (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.getState) === null || _actionRef$current10$ === void 0 ? void 0 : (_actionRef$current10$2 = _actionRef$current10$.call(_actionRef$current10)) === null || _actionRef$current10$2 === void 0 ? void 0 : _actionRef$current10$2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
133
|
+
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.setFilterRules) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
134
|
+
rules: [],
|
135
|
+
params: ''
|
136
|
+
})));
|
137
|
+
(_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : (_actionRef$current12$ = _actionRef$current12.filterDataSource) === null || _actionRef$current12$ === void 0 ? void 0 : _actionRef$current12$.call(_actionRef$current12, column.dataIndex);
|
138
|
+
if (selected.length > 0) {
|
139
|
+
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
140
|
+
var targetPageKey = 'currentPage';
|
141
|
+
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
142
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
143
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
144
|
+
}
|
145
|
+
// 发送请求
|
146
|
+
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.request) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14, _defineProperty({}, targetPageKey, 1));
|
147
|
+
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.resetPage) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
148
|
+
// 清空表格选择
|
149
|
+
(_actionRef$current16 = actionRef.current) === null || _actionRef$current16 === void 0 ? void 0 : (_actionRef$current16$ = _actionRef$current16.clearRowSelection) === null || _actionRef$current16$ === void 0 ? void 0 : _actionRef$current16$.call(_actionRef$current16);
|
150
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false) {
|
151
|
+
setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), undefined));
|
152
|
+
}
|
153
|
+
}
|
154
|
+
};
|
78
155
|
// 渲染单选
|
79
156
|
var renderSingle = function renderSingle() {
|
80
157
|
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
|
@@ -154,71 +231,15 @@ var Filter = function Filter(props) {
|
|
154
231
|
className: cls({
|
155
232
|
btn: true
|
156
233
|
}),
|
157
|
-
onClick:
|
158
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$r, _actionRef$current9, _actionRef$current9$c;
|
159
|
-
(_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);
|
160
|
-
// 先获取此列的param
|
161
|
-
var param = '';
|
162
|
-
if (column.beforeFilter) {
|
163
|
-
var _column$beforeFilter;
|
164
|
-
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
165
|
-
} else {
|
166
|
-
param = selected.join(',');
|
167
|
-
}
|
168
|
-
// 需要带上其他所有的信息
|
169
|
-
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 : {};
|
170
|
-
// 再设置所有的列筛选状态
|
171
|
-
(_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, {
|
172
|
-
rules: selected,
|
173
|
-
params: param
|
174
|
-
})));
|
175
|
-
var targetPageKey = 'currentPage';
|
176
|
-
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
177
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
178
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
179
|
-
}
|
180
|
-
if (switchCardView === 'card') {
|
181
|
-
var _actionRef$current6, _actionRef$current6$s;
|
182
|
-
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$s = _actionRef$current6.setData) === null || _actionRef$current6$s === void 0 ? void 0 : _actionRef$current6$s.call(_actionRef$current6, []);
|
183
|
-
}
|
184
|
-
// 发送请求
|
185
|
-
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.request) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7, _defineProperty({}, targetPageKey, 1));
|
186
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$r = _actionRef$current8.resetPage) === null || _actionRef$current8$r === void 0 ? void 0 : _actionRef$current8$r.call(_actionRef$current8);
|
187
|
-
// 清空表格选择
|
188
|
-
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
189
|
-
setVisible(false);
|
190
|
-
}
|
234
|
+
onClick: onFilterOk
|
191
235
|
}, (0, _utils.getMessage)('ok')), /*#__PURE__*/_react.default.createElement(_components.Button, {
|
192
236
|
type: "normal",
|
193
237
|
size: "small",
|
194
238
|
className: cls({
|
195
239
|
btn: true
|
196
240
|
}),
|
197
|
-
onClick:
|
198
|
-
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
199
|
-
setSelected([]);
|
200
|
-
var rules = (_actionRef$current$ge7 = (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.getState) === null || _actionRef$current10$ === void 0 ? void 0 : (_actionRef$current10$2 = _actionRef$current10$.call(_actionRef$current10)) === null || _actionRef$current10$2 === void 0 ? void 0 : _actionRef$current10$2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
201
|
-
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.setFilterRules) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
202
|
-
rules: [],
|
203
|
-
params: ''
|
204
|
-
})));
|
205
|
-
(_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : (_actionRef$current12$ = _actionRef$current12.filterDataSource) === null || _actionRef$current12$ === void 0 ? void 0 : _actionRef$current12$.call(_actionRef$current12, column.dataIndex);
|
206
|
-
if (selected.length > 0) {
|
207
|
-
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
208
|
-
var targetPageKey = 'currentPage';
|
209
|
-
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
210
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
211
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
212
|
-
}
|
213
|
-
// 发送请求
|
214
|
-
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.request) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14, _defineProperty({}, targetPageKey, 1));
|
215
|
-
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.resetPage) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
216
|
-
// 清空表格选择
|
217
|
-
(_actionRef$current16 = actionRef.current) === null || _actionRef$current16 === void 0 ? void 0 : (_actionRef$current16$ = _actionRef$current16.clearRowSelection) === null || _actionRef$current16$ === void 0 ? void 0 : _actionRef$current16$.call(_actionRef$current16);
|
218
|
-
}
|
219
|
-
// setVisible(!visible);
|
220
|
-
}
|
241
|
+
onClick: onFilterReset
|
221
242
|
}, (0, _utils.getMessage)('reset'))))));
|
222
243
|
};
|
223
|
-
var _default = Filter;
|
244
|
+
var _default = /*#__PURE__*/(0, _react.memo)(Filter);
|
224
245
|
exports.default = _default;
|
@@ -12,7 +12,7 @@ var _form = require("../../../form");
|
|
12
12
|
var _ToolBar = _interopRequireDefault(require("../ToolBar"));
|
13
13
|
var _QuickAction = _interopRequireDefault(require("../QuickAction"));
|
14
14
|
require("./index.scss");
|
15
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm"];
|
15
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm", "bindUrl", "bindUrlProps"];
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
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); }
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -34,6 +34,8 @@ var Layout = function Layout(props) {
|
|
34
34
|
rowSelection = props.rowSelection,
|
35
35
|
toolBar = props.toolBar,
|
36
36
|
dataTeamixSpm = props.dataTeamixSpm,
|
37
|
+
bindUrl = props.bindUrl,
|
38
|
+
bindUrlProps = props.bindUrlProps,
|
37
39
|
otherProps = _objectWithoutProperties(props, _excluded);
|
38
40
|
// 渲染主操作区
|
39
41
|
var renderMainAction = function renderMainAction() {
|
@@ -112,7 +114,8 @@ var Layout = function Layout(props) {
|
|
112
114
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
113
115
|
},
|
114
116
|
addonBefore: renderMainAction(),
|
115
|
-
addonAfter: renderAddonAfter()
|
117
|
+
addonAfter: renderAddonAfter(),
|
118
|
+
bindUrl: bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.filters) !== false
|
116
119
|
}, dataFilter)), afterDataFilter && /*#__PURE__*/_react.default.createElement("div", {
|
117
120
|
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
118
121
|
}, afterDataFilter));
|
package/lib/table/index.js
CHANGED
@@ -24,6 +24,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
24
24
|
var _pageContainer = _interopRequireDefault(require("../page-container"));
|
25
25
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
26
26
|
var _CardView = _interopRequireDefault(require("./components/CardView"));
|
27
|
+
var _hooks = require("@teamix/hooks");
|
28
|
+
var _util = require("./utils/util");
|
27
29
|
var _typing = require("./typing");
|
28
30
|
Object.keys(_typing).forEach(function (key) {
|
29
31
|
if (key === "default" || key === "__esModule") return;
|
@@ -36,7 +38,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
36
38
|
}
|
37
39
|
});
|
38
40
|
});
|
39
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps"],
|
41
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps", "bindUrlProps", "bindUrl"],
|
40
42
|
_excluded2 = ["onChange"];
|
41
43
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
42
44
|
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); }
|
@@ -104,7 +106,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
104
106
|
return {};
|
105
107
|
};
|
106
108
|
var ProTable = function ProTable(props) {
|
107
|
-
var _rowSelection$selecte;
|
109
|
+
var _urlState$currentPage, _rowSelection$selecte;
|
108
110
|
var header = props.header,
|
109
111
|
className = props.className,
|
110
112
|
tableClassName = props.tableClassName,
|
@@ -177,15 +179,21 @@ var ProTable = function ProTable(props) {
|
|
177
179
|
_props$defaultView = props.defaultView,
|
178
180
|
defaultView = _props$defaultView === void 0 ? 'table' : _props$defaultView,
|
179
181
|
emptyProps = props.emptyProps,
|
182
|
+
bindUrlProps = props.bindUrlProps,
|
183
|
+
bindUrl = props.bindUrl,
|
180
184
|
otherProps = _objectWithoutProperties(props, _excluded);
|
181
185
|
var targetPageKey = pageKey || globalPageKey;
|
182
186
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
183
187
|
var targetFormatSort = formatSort || globalFormatSort;
|
184
|
-
var
|
188
|
+
var _useUrlState = (0, _hooks.useUrlState)(),
|
189
|
+
_useUrlState2 = _slicedToArray(_useUrlState, 2),
|
190
|
+
urlState = _useUrlState2[0],
|
191
|
+
setUrlState = _useUrlState2[1];
|
192
|
+
var _useState = (0, _react.useState)((_urlState$currentPage = urlState === null || urlState === void 0 ? void 0 : urlState.currentPage) !== null && _urlState$currentPage !== void 0 ? _urlState$currentPage : 1),
|
185
193
|
_useState2 = _slicedToArray(_useState, 2),
|
186
194
|
currentPage = _useState2[0],
|
187
195
|
setCurrentPage = _useState2[1];
|
188
|
-
var _useState3 = (0, _react.useState)(props.pageSize || 10),
|
196
|
+
var _useState3 = (0, _react.useState)((urlState === null || urlState === void 0 ? void 0 : urlState.pageSize) || props.pageSize || 10),
|
189
197
|
_useState4 = _slicedToArray(_useState3, 2),
|
190
198
|
pageSize = _useState4[0],
|
191
199
|
setPageSize = _useState4[1];
|
@@ -227,6 +235,24 @@ var ProTable = function ProTable(props) {
|
|
227
235
|
_useState20 = _slicedToArray(_useState19, 2),
|
228
236
|
showLoading = _useState20[0],
|
229
237
|
setShowLoading = _useState20[1];
|
238
|
+
// 表格内部用作存储的 Ref,标识 Table 组件是否被第一次渲染。用作 useUrlState filter 第一次渲染时使用 state 数据请求
|
239
|
+
var dataRef = (0, _react.useRef)({
|
240
|
+
flag: true
|
241
|
+
});
|
242
|
+
(0, _react.useEffect)(function () {
|
243
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.pagination) !== false) {
|
244
|
+
if ((urlState === null || urlState === void 0 ? void 0 : urlState.currentPage) !== currentPage) {
|
245
|
+
setUrlState({
|
246
|
+
currentPage: currentPage
|
247
|
+
});
|
248
|
+
}
|
249
|
+
if ((urlState === null || urlState === void 0 ? void 0 : urlState.pageSize) !== pageSize) {
|
250
|
+
setUrlState({
|
251
|
+
pageSize: pageSize
|
252
|
+
});
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}, [currentPage, pageSize, urlState]);
|
230
256
|
// 存储能够被 on 监听到的 ProTable 状态
|
231
257
|
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
232
258
|
var _useState21 = (0, _react.useState)({
|
@@ -555,7 +581,7 @@ var ProTable = function ProTable(props) {
|
|
555
581
|
// card视角的刷新等于重新请求
|
556
582
|
if (switchViewState === 'card' && !propsDataSource) {
|
557
583
|
setCurrentPage(1);
|
558
|
-
_request(_objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
|
584
|
+
_request(_objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)), undefined, undefined, true);
|
559
585
|
setShowSkeleton(true);
|
560
586
|
} else {
|
561
587
|
_request(params);
|
@@ -578,7 +604,7 @@ var ProTable = function ProTable(props) {
|
|
578
604
|
(_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, {});
|
579
605
|
(_dataFilterFormRef$cu = dataFilterFormRef.current) === null || _dataFilterFormRef$cu === void 0 ? void 0 : _dataFilterFormRef$cu.reset();
|
580
606
|
setCurrentPage(1);
|
581
|
-
_request(_defineProperty({}, targetPageKey, 1));
|
607
|
+
_request(_defineProperty({}, targetPageKey, 1), undefined, undefined, true);
|
582
608
|
},
|
583
609
|
resetPage: function resetPage() {
|
584
610
|
setCurrentPage(1);
|
@@ -676,12 +702,12 @@ var ProTable = function ProTable(props) {
|
|
676
702
|
(0, _utils2.emit)('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
677
703
|
}
|
678
704
|
// 设置 dataSource、total
|
679
|
-
if (switchViewState === 'table' || currentPage === 1) {
|
705
|
+
if (switchViewState === 'table' || currentPage === 1 || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
680
706
|
var _next$data;
|
681
707
|
_setData(next.data || []);
|
682
708
|
setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
|
683
709
|
}
|
684
|
-
if (switchViewState === 'card' && currentPage !== 1) {
|
710
|
+
if (switchViewState === 'card' && currentPage !== 1 && !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
685
711
|
var _next$data2;
|
686
712
|
_setData([].concat(_toConsumableArray(data), _toConsumableArray(next.data || [])));
|
687
713
|
setTotal(total + (next.total || ((_next$data2 = next.data) === null || _next$data2 === void 0 ? void 0 : _next$data2.length)));
|
@@ -753,8 +779,13 @@ var ProTable = function ProTable(props) {
|
|
753
779
|
}
|
754
780
|
});
|
755
781
|
// 请求函数
|
756
|
-
function _request(params, noLoading, filterParams) {
|
782
|
+
function _request(params, noLoading, filterParams, isReset) {
|
757
783
|
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread3;
|
784
|
+
// 首次渲染表格,获取 urlState 上的 表头 filter 数据
|
785
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && dataRef.current.flag) {
|
786
|
+
(0, _util.getUrlStateFilter)(urlState, actionRef);
|
787
|
+
dataRef.current.flag = false;
|
788
|
+
}
|
758
789
|
// 如果没有传 url 且没有 customRequest,直接返回
|
759
790
|
if (!url && !customRequest) {
|
760
791
|
return;
|
@@ -799,18 +830,22 @@ var ProTable = function ProTable(props) {
|
|
799
830
|
}
|
800
831
|
// 如果使用自定义请求
|
801
832
|
if (customRequest && typeof customRequest === 'function') {
|
802
|
-
|
833
|
+
if (isReset) {
|
834
|
+
setShowSkeleton(true);
|
835
|
+
} else {
|
836
|
+
setCustomTableLoading(true);
|
837
|
+
}
|
803
838
|
customRequest(requestData).then(function (res) {
|
804
839
|
var dataRes = res.data,
|
805
840
|
totalRes = res.total,
|
806
841
|
success = res.success;
|
807
842
|
if (success === true) {
|
808
843
|
// 设置 dataSource、total
|
809
|
-
if (switchViewState === 'table' || params['targetPageKey'] === 1) {
|
844
|
+
if (switchViewState === 'table' || params['targetPageKey'] === 1 || isReset || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
810
845
|
_setData(dataRes || []);
|
811
846
|
setTotal(totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length));
|
812
847
|
}
|
813
|
-
if (switchViewState === 'card' && params['targetPageKey'] !== 1) {
|
848
|
+
if (switchViewState === 'card' && params['targetPageKey'] !== 1 && !isReset && !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
814
849
|
_setData([].concat(_toConsumableArray(data), _toConsumableArray(dataRes || [])));
|
815
850
|
setTotal(total + (totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length)));
|
816
851
|
}
|
@@ -839,6 +874,8 @@ var ProTable = function ProTable(props) {
|
|
839
874
|
}, Number(time));
|
840
875
|
(0, _utils2.emit)('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
841
876
|
}
|
877
|
+
}).finally(function () {
|
878
|
+
setCustomTableLoading(false);
|
842
879
|
});
|
843
880
|
} else {
|
844
881
|
getData.run(requestData);
|
@@ -921,11 +958,13 @@ var ProTable = function ProTable(props) {
|
|
921
958
|
switchCardView: switchCardView,
|
922
959
|
defaultView: defaultView,
|
923
960
|
autoRefresh: autoRefresh,
|
924
|
-
autoRefreshProps: autoRefreshProps
|
961
|
+
autoRefreshProps: autoRefreshProps,
|
962
|
+
bindUrlProps: bindUrlProps,
|
963
|
+
bindUrl: bindUrl
|
925
964
|
}), switchViewState === 'table' && /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
|
926
965
|
hasBorder: false,
|
927
966
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
928
|
-
columns: (0, _genProColumnToColumn.default)(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm),
|
967
|
+
columns: (0, _genProColumnToColumn.default)(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps),
|
929
968
|
loading: getTableLoading(),
|
930
969
|
className: (0, _classnames.default)('teamix-pro-table', tableClassName, {
|
931
970
|
'with-row-select': rowSelection,
|
package/lib/table/typing.d.ts
CHANGED
@@ -168,6 +168,10 @@ export declare type ProTableProps = {
|
|
168
168
|
defaultView?: 'table' | 'card';
|
169
169
|
/** 空状态配置 **/
|
170
170
|
emptyProps?: EmptyContentProps;
|
171
|
+
/** 是否绑定 url **/
|
172
|
+
bindUrl?: boolean;
|
173
|
+
/** 绑定 url 配置 **/
|
174
|
+
bindUrlProps?: ProTableBindUrlProps;
|
171
175
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
172
176
|
export declare type rowSelectionType = {
|
173
177
|
getProps?: (record: any, index: number) => any;
|
@@ -315,6 +319,8 @@ export declare type ProTableLayoutProps = {
|
|
315
319
|
defaultView?: 'table' | 'card';
|
316
320
|
autoRefresh?: ProTableProps['autoRefresh'];
|
317
321
|
autoRefreshProps?: ProTableProps['autoRefreshProps'];
|
322
|
+
bindUrl?: ProTableProps['bindUrl'];
|
323
|
+
bindUrlProps?: ProTableProps['bindUrlProps'];
|
318
324
|
} & ProTableTopAreaProps;
|
319
325
|
/** columns 列过滤 */
|
320
326
|
export declare type ProTableColumnsFilterItemProps = {
|
@@ -401,4 +407,12 @@ export declare type ProTableCardViewProps = {
|
|
401
407
|
/** 表格分页器参数 **/
|
402
408
|
tablePaginationProps?: PaginationProps;
|
403
409
|
};
|
410
|
+
export declare type ProTableBindUrlProps = {
|
411
|
+
/** 翻页器区域 **/
|
412
|
+
pagination?: boolean;
|
413
|
+
/** 搜索区域 **/
|
414
|
+
filters?: boolean;
|
415
|
+
/** 表格标题过滤器区域 **/
|
416
|
+
headerFilters?: boolean;
|
417
|
+
};
|
404
418
|
export {};
|
@@ -2,11 +2,11 @@
|
|
2
2
|
* 渲染列的逻辑函数
|
3
3
|
*/
|
4
4
|
import React from 'react';
|
5
|
-
import { ProTableColumnProps, ProTableActionType } from '../typing';
|
5
|
+
import { ProTableColumnProps, ProTableActionType, ProTableProps } from '../typing';
|
6
6
|
/**
|
7
7
|
* 增加了 icon 的功能 render title
|
8
8
|
*/
|
9
|
-
export declare const renderColumnsTitle: (item: ProTableColumnProps, actionRef: React.MutableRefObject<ProTableActionType | undefined
|
9
|
+
export declare const renderColumnsTitle: (item: ProTableColumnProps, actionRef: React.MutableRefObject<ProTableActionType | undefined>, bindUrl?: ProTableProps['bindUrl'], bindUrlProps?: ProTableProps['bindUrlProps']) => JSX.Element;
|
10
10
|
/**
|
11
11
|
* 负责单元格的具体渲染
|
12
12
|
*/
|