@teamix/pro 1.5.13 → 1.5.16
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/es/actions/dialog.js +1 -1
- package/es/actions/index.scss +1 -1
- package/es/card/index.scss +2 -0
- package/es/card/xconsole.scss +3 -0
- package/es/global.scss +1 -0
- 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 +94 -73
- package/es/table/components/Layout/index.js +5 -2
- package/es/table/components/Layout/index.scss +1 -0
- package/es/table/index.js +51 -18
- 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 +6 -1
- package/lib/actions/dialog.js +1 -1
- package/lib/actions/index.scss +1 -1
- package/lib/card/index.scss +2 -0
- package/lib/card/xconsole.scss +3 -0
- package/lib/global.scss +1 -0
- 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 +93 -72
- package/lib/table/components/Layout/index.js +5 -2
- package/lib/table/components/Layout/index.scss +1 -0
- package/lib/table/index.js +51 -18
- 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 +6 -1
- package/package.json +1 -1
- package/dist/fonts/txddinmedium.woff +0 -0
- package/dist/pro.all.min.css +0 -1
- package/dist/pro.css +0 -1
- package/dist/pro.js +0 -114283
- package/dist/pro.min.css +0 -1
- package/dist/pro.min.js +0 -2
- package/dist/pro.min.js.LICENSE.txt +0 -47
- package/dist/pro.xconsole.min.css +0 -1
package/es/actions/dialog.js
CHANGED
|
@@ -210,7 +210,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
|
210
210
|
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
|
211
211
|
}, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", classnames('teamix-pro-action-dialog', {
|
|
212
212
|
'has-footer-description': !!footerDescription
|
|
213
|
-
})), _defineProperty(_objectSpread2,
|
|
213
|
+
})), _defineProperty(_objectSpread2, isDrawer ? 'renderFooter' : 'footer', addContextForReactNode(footer, dialogContext)), _objectSpread2), containerProps), containerOtherProps);
|
|
214
214
|
// TODO Drawer 基础组件未支持此配置,日后支持,并修改onOk、onCancel写法
|
|
215
215
|
if ((!dialogType || dialogType === 'dialog') && hideFooter) {
|
|
216
216
|
quickShowProps['footer'] = !hideFooter;
|
package/es/actions/index.scss
CHANGED
package/es/card/index.scss
CHANGED
package/es/global.scss
CHANGED
package/es/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.16";
|
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
import { array, actions, actionGroup, filter } from './common';
|
|
2
2
|
var initialValues = {
|
|
3
|
-
columns: [
|
|
4
|
-
dataIndex: 'instanceName',
|
|
5
|
-
title: '实例ID/实例名称'
|
|
6
|
-
}, {
|
|
7
|
-
dataIndex: 'organizationName',
|
|
8
|
-
title: '组织',
|
|
9
|
-
tooltip: '我这一列是可以被复制的~',
|
|
10
|
-
render: {
|
|
11
|
-
copy: true
|
|
12
|
-
}
|
|
13
|
-
}],
|
|
14
|
-
url: 'https://oneapi.alibaba-inc.com/mock/teamix-pro/api/getTableResource',
|
|
15
|
-
formatResult: {
|
|
16
|
-
data: 'data',
|
|
17
|
-
total: 'pageInfo.total'
|
|
18
|
-
},
|
|
19
|
-
mainAction: {
|
|
20
|
-
actions: [{
|
|
21
|
-
key: 'action',
|
|
22
|
-
children: '操作按钮'
|
|
23
|
-
}]
|
|
24
|
-
}
|
|
3
|
+
columns: []
|
|
25
4
|
};
|
|
26
5
|
var defaultValues = {
|
|
27
6
|
showSkeleton: true,
|
package/es/nocode/pages/index.js
CHANGED
|
@@ -10,32 +10,7 @@ export var PageMap = {
|
|
|
10
10
|
};
|
|
11
11
|
// 全部页面模板默认初始值
|
|
12
12
|
export var PageDefaultInitialValues = {
|
|
13
|
-
LIST: {
|
|
14
|
-
header: {
|
|
15
|
-
title: '页面标题'
|
|
16
|
-
},
|
|
17
|
-
content: {
|
|
18
|
-
header: {
|
|
19
|
-
title: '表格标题'
|
|
20
|
-
},
|
|
21
|
-
columns: [{
|
|
22
|
-
dataIndex: 'instanceName',
|
|
23
|
-
title: '实例ID/实例名称'
|
|
24
|
-
}, {
|
|
25
|
-
dataIndex: 'organizationName',
|
|
26
|
-
title: '组织',
|
|
27
|
-
tooltip: '我这一列是可以被复制的~',
|
|
28
|
-
render: {
|
|
29
|
-
copy: true
|
|
30
|
-
}
|
|
31
|
-
}],
|
|
32
|
-
url: 'https://oneapi.alibaba-inc.com/mock/teamix-pro/api/getTableResource',
|
|
33
|
-
formatResult: {
|
|
34
|
-
data: 'data',
|
|
35
|
-
total: 'pageInfo.total'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
13
|
+
LIST: {},
|
|
39
14
|
DETAIL: {},
|
|
40
15
|
FORM: {}
|
|
41
16
|
};
|
|
@@ -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;
|
|
@@ -12,22 +12,30 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
12
12
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
// 表格项列筛选
|
|
15
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
15
|
+
import React, { useEffect, useMemo, useState, memo } from 'react';
|
|
16
16
|
import TeamixIcon from '@teamix/icon';
|
|
17
17
|
import { Button, Dropdown, Menu } from '@alicloudfe/components';
|
|
18
18
|
import { usePrefixCls, getMessage } from '@teamix/utils';
|
|
19
19
|
import './index.scss';
|
|
20
|
+
import { useUrlState } from '@teamix/hooks';
|
|
20
21
|
var CheckboxItem = Menu.CheckboxItem;
|
|
21
22
|
var cls = usePrefixCls('teamix-pro-table-toolbar-filter');
|
|
22
23
|
var RadioItem = Menu.RadioItem;
|
|
23
24
|
var Filter = function Filter(props) {
|
|
25
|
+
var _urlState$split, _urlState, _urlState$split2;
|
|
24
26
|
var column = props.column,
|
|
25
27
|
actionRef = props.actionRef,
|
|
26
|
-
switchCardView = props.switchCardView
|
|
28
|
+
switchCardView = props.switchCardView,
|
|
29
|
+
bindUrlProps = props.bindUrlProps,
|
|
30
|
+
bindUrl = props.bindUrl;
|
|
27
31
|
var _column$filtersWidth = column.filtersWidth,
|
|
28
32
|
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth;
|
|
33
|
+
var _ref = bindUrl ? useUrlState() : [],
|
|
34
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
35
|
+
urlState = _ref2[0],
|
|
36
|
+
setUrlState = _ref2[1];
|
|
29
37
|
// 选中过滤项
|
|
30
|
-
var _useState = useState([]),
|
|
38
|
+
var _useState = 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 : []),
|
|
31
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
40
|
selected = _useState2[0],
|
|
33
41
|
setSelected = _useState2[1];
|
|
@@ -39,7 +47,10 @@ var Filter = function Filter(props) {
|
|
|
39
47
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
|
40
48
|
// 从全局状态中读取上次存储的条件
|
|
41
49
|
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 : [];
|
|
42
|
-
|
|
50
|
+
// 全局状态中需要有值才赋值。优先级:全局状态 > urlState
|
|
51
|
+
if (rules && rules.length > 0) {
|
|
52
|
+
setSelected(rules);
|
|
53
|
+
}
|
|
43
54
|
}, []);
|
|
44
55
|
// 获取过滤项
|
|
45
56
|
var filters = useMemo(function () {
|
|
@@ -49,11 +60,11 @@ var Filter = function Filter(props) {
|
|
|
49
60
|
var filters = column.dataSource;
|
|
50
61
|
// 转换 valueEnum 为 options
|
|
51
62
|
if (!Array.isArray(column.dataSource)) {
|
|
52
|
-
filters = Object.entries(column.dataSource).map(function (
|
|
63
|
+
filters = Object.entries(column.dataSource).map(function (_ref3) {
|
|
53
64
|
var _nv$label, _nv$color;
|
|
54
|
-
var
|
|
55
|
-
k =
|
|
56
|
-
v =
|
|
65
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
66
|
+
k = _ref4[0],
|
|
67
|
+
v = _ref4[1];
|
|
57
68
|
var nv = v;
|
|
58
69
|
return _objectSpread(_objectSpread({
|
|
59
70
|
value: k
|
|
@@ -66,12 +77,78 @@ var Filter = function Filter(props) {
|
|
|
66
77
|
// console.log(filters);
|
|
67
78
|
return filters;
|
|
68
79
|
}, []);
|
|
80
|
+
// 点击确定回调
|
|
81
|
+
var onFilterOk = function onFilterOk() {
|
|
82
|
+
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;
|
|
83
|
+
(_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);
|
|
84
|
+
// 先获取此列的param
|
|
85
|
+
var param = '';
|
|
86
|
+
if (column.beforeFilter) {
|
|
87
|
+
var _column$beforeFilter;
|
|
88
|
+
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
|
89
|
+
} else {
|
|
90
|
+
param = selected.join(',');
|
|
91
|
+
}
|
|
92
|
+
// 需要带上其他所有的信息
|
|
93
|
+
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 : {};
|
|
94
|
+
// 再设置所有的列筛选状态
|
|
95
|
+
(_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, {
|
|
96
|
+
rules: selected,
|
|
97
|
+
params: param
|
|
98
|
+
})));
|
|
99
|
+
var targetPageKey = 'currentPage';
|
|
100
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
|
101
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
|
102
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
|
103
|
+
}
|
|
104
|
+
if (switchCardView === 'card') {
|
|
105
|
+
var _actionRef$current6, _actionRef$current6$s;
|
|
106
|
+
(_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, []);
|
|
107
|
+
}
|
|
108
|
+
// 发送请求
|
|
109
|
+
(_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));
|
|
110
|
+
(_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);
|
|
111
|
+
// 清空表格选择
|
|
112
|
+
(_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);
|
|
113
|
+
setVisible(false);
|
|
114
|
+
// 设置 url
|
|
115
|
+
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(',')) {
|
|
116
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), selected.join(',')));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
// 重置回调
|
|
120
|
+
var onFilterReset = function onFilterReset() {
|
|
121
|
+
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
|
122
|
+
setSelected([]);
|
|
123
|
+
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 : {};
|
|
124
|
+
(_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, {
|
|
125
|
+
rules: [],
|
|
126
|
+
params: ''
|
|
127
|
+
})));
|
|
128
|
+
(_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);
|
|
129
|
+
if (selected.length > 0) {
|
|
130
|
+
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
|
131
|
+
var targetPageKey = 'currentPage';
|
|
132
|
+
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
|
133
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
|
134
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
|
135
|
+
}
|
|
136
|
+
// 发送请求
|
|
137
|
+
(_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));
|
|
138
|
+
(_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);
|
|
139
|
+
// 清空表格选择
|
|
140
|
+
(_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);
|
|
141
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false) {
|
|
142
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), undefined));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
69
146
|
// 渲染单选
|
|
70
147
|
var renderSingle = function renderSingle() {
|
|
71
|
-
return filters === null || filters === void 0 ? void 0 : filters.map(function (
|
|
148
|
+
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref5) {
|
|
72
149
|
var _value$toString;
|
|
73
|
-
var label =
|
|
74
|
-
value =
|
|
150
|
+
var label = _ref5.label,
|
|
151
|
+
value = _ref5.value;
|
|
75
152
|
var valueStr = (_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '';
|
|
76
153
|
return /*#__PURE__*/React.createElement(RadioItem, {
|
|
77
154
|
id: valueStr,
|
|
@@ -85,10 +162,10 @@ var Filter = function Filter(props) {
|
|
|
85
162
|
};
|
|
86
163
|
// 渲染多选
|
|
87
164
|
var renderMultiple = function renderMultiple() {
|
|
88
|
-
return filters === null || filters === void 0 ? void 0 : filters.map(function (
|
|
165
|
+
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref6) {
|
|
89
166
|
var _value$toString2;
|
|
90
|
-
var label =
|
|
91
|
-
value =
|
|
167
|
+
var label = _ref6.label,
|
|
168
|
+
value = _ref6.value;
|
|
92
169
|
var valueStr = (_value$toString2 = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString2 !== void 0 ? _value$toString2 : '';
|
|
93
170
|
return /*#__PURE__*/React.createElement(CheckboxItem, {
|
|
94
171
|
key: valueStr,
|
|
@@ -145,70 +222,14 @@ var Filter = function Filter(props) {
|
|
|
145
222
|
className: cls({
|
|
146
223
|
btn: true
|
|
147
224
|
}),
|
|
148
|
-
onClick:
|
|
149
|
-
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;
|
|
150
|
-
(_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);
|
|
151
|
-
// 先获取此列的param
|
|
152
|
-
var param = '';
|
|
153
|
-
if (column.beforeFilter) {
|
|
154
|
-
var _column$beforeFilter;
|
|
155
|
-
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
|
156
|
-
} else {
|
|
157
|
-
param = selected.join(',');
|
|
158
|
-
}
|
|
159
|
-
// 需要带上其他所有的信息
|
|
160
|
-
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 : {};
|
|
161
|
-
// 再设置所有的列筛选状态
|
|
162
|
-
(_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, {
|
|
163
|
-
rules: selected,
|
|
164
|
-
params: param
|
|
165
|
-
})));
|
|
166
|
-
var targetPageKey = 'currentPage';
|
|
167
|
-
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
|
168
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
|
169
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
|
170
|
-
}
|
|
171
|
-
if (switchCardView === 'card') {
|
|
172
|
-
var _actionRef$current6, _actionRef$current6$s;
|
|
173
|
-
(_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, []);
|
|
174
|
-
}
|
|
175
|
-
// 发送请求
|
|
176
|
-
(_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));
|
|
177
|
-
(_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);
|
|
178
|
-
// 清空表格选择
|
|
179
|
-
(_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);
|
|
180
|
-
setVisible(false);
|
|
181
|
-
}
|
|
225
|
+
onClick: onFilterOk
|
|
182
226
|
}, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
|
|
183
227
|
type: "normal",
|
|
184
228
|
size: "small",
|
|
185
229
|
className: cls({
|
|
186
230
|
btn: true
|
|
187
231
|
}),
|
|
188
|
-
onClick:
|
|
189
|
-
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
|
190
|
-
setSelected([]);
|
|
191
|
-
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 : {};
|
|
192
|
-
(_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, {
|
|
193
|
-
rules: [],
|
|
194
|
-
params: ''
|
|
195
|
-
})));
|
|
196
|
-
(_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);
|
|
197
|
-
if (selected.length > 0) {
|
|
198
|
-
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
|
199
|
-
var targetPageKey = 'currentPage';
|
|
200
|
-
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
|
201
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
|
202
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
|
203
|
-
}
|
|
204
|
-
// 发送请求
|
|
205
|
-
(_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));
|
|
206
|
-
(_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);
|
|
207
|
-
// 清空表格选择
|
|
208
|
-
(_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);
|
|
209
|
-
}
|
|
210
|
-
// setVisible(!visible);
|
|
211
|
-
}
|
|
232
|
+
onClick: onFilterReset
|
|
212
233
|
}, getMessage('reset'))))));
|
|
213
234
|
};
|
|
214
|
-
export default Filter;
|
|
235
|
+
export default /*#__PURE__*/memo(Filter);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm"];
|
|
1
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm", "bindUrl", "bindUrlProps"];
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -25,6 +25,8 @@ var Layout = function Layout(props) {
|
|
|
25
25
|
rowSelection = props.rowSelection,
|
|
26
26
|
toolBar = props.toolBar,
|
|
27
27
|
dataTeamixSpm = props.dataTeamixSpm,
|
|
28
|
+
bindUrl = props.bindUrl,
|
|
29
|
+
bindUrlProps = props.bindUrlProps,
|
|
28
30
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
29
31
|
// 渲染主操作区
|
|
30
32
|
var renderMainAction = function renderMainAction() {
|
|
@@ -103,7 +105,8 @@ var Layout = function Layout(props) {
|
|
|
103
105
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
|
104
106
|
},
|
|
105
107
|
addonBefore: renderMainAction(),
|
|
106
|
-
addonAfter: renderAddonAfter()
|
|
108
|
+
addonAfter: renderAddonAfter(),
|
|
109
|
+
bindUrl: bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.filters) !== false
|
|
107
110
|
}, dataFilter)), afterDataFilter && /*#__PURE__*/React.createElement("div", {
|
|
108
111
|
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
|
109
112
|
}, afterDataFilter));
|
package/es/table/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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"],
|
|
1
|
+
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"],
|
|
2
2
|
_excluded2 = ["onChange"];
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -35,6 +35,8 @@ import classNames from 'classnames';
|
|
|
35
35
|
import ProPageContainer from '../page-container';
|
|
36
36
|
import debounce from 'lodash.debounce';
|
|
37
37
|
import CardView from './components/CardView';
|
|
38
|
+
import { useUrlState } from '@teamix/hooks';
|
|
39
|
+
import { getUrlStateFilter } from './utils/util';
|
|
38
40
|
export * from './typing';
|
|
39
41
|
var cls = usePrefixCls('teamix-pro-table');
|
|
40
42
|
/**
|
|
@@ -83,7 +85,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
|
83
85
|
return {};
|
|
84
86
|
};
|
|
85
87
|
var ProTable = function ProTable(props) {
|
|
86
|
-
var _rowSelection$selecte;
|
|
88
|
+
var _urlState$currentPage, _rowSelection$selecte;
|
|
87
89
|
var header = props.header,
|
|
88
90
|
className = props.className,
|
|
89
91
|
tableClassName = props.tableClassName,
|
|
@@ -156,15 +158,21 @@ var ProTable = function ProTable(props) {
|
|
|
156
158
|
_props$defaultView = props.defaultView,
|
|
157
159
|
defaultView = _props$defaultView === void 0 ? 'table' : _props$defaultView,
|
|
158
160
|
emptyProps = props.emptyProps,
|
|
161
|
+
bindUrlProps = props.bindUrlProps,
|
|
162
|
+
bindUrl = props.bindUrl,
|
|
159
163
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
160
164
|
var targetPageKey = pageKey || globalPageKey;
|
|
161
165
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
|
162
166
|
var targetFormatSort = formatSort || globalFormatSort;
|
|
163
|
-
var
|
|
167
|
+
var _ref = bindUrl ? useUrlState() : [],
|
|
168
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
169
|
+
urlState = _ref2[0],
|
|
170
|
+
setUrlState = _ref2[1];
|
|
171
|
+
var _useState = useState((_urlState$currentPage = urlState === null || urlState === void 0 ? void 0 : urlState.currentPage) !== null && _urlState$currentPage !== void 0 ? _urlState$currentPage : 1),
|
|
164
172
|
_useState2 = _slicedToArray(_useState, 2),
|
|
165
173
|
currentPage = _useState2[0],
|
|
166
174
|
setCurrentPage = _useState2[1];
|
|
167
|
-
var _useState3 = useState(props.pageSize || 10),
|
|
175
|
+
var _useState3 = useState((urlState === null || urlState === void 0 ? void 0 : urlState.pageSize) || props.pageSize || 10),
|
|
168
176
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
169
177
|
pageSize = _useState4[0],
|
|
170
178
|
setPageSize = _useState4[1];
|
|
@@ -206,6 +214,24 @@ var ProTable = function ProTable(props) {
|
|
|
206
214
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
207
215
|
showLoading = _useState20[0],
|
|
208
216
|
setShowLoading = _useState20[1];
|
|
217
|
+
// 表格内部用作存储的 Ref,标识 Table 组件是否被第一次渲染。用作 useUrlState filter 第一次渲染时使用 state 数据请求
|
|
218
|
+
var dataRef = useRef({
|
|
219
|
+
flag: true
|
|
220
|
+
});
|
|
221
|
+
useEffect(function () {
|
|
222
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.pagination) !== false) {
|
|
223
|
+
if ((urlState === null || urlState === void 0 ? void 0 : urlState.currentPage) !== currentPage) {
|
|
224
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState({
|
|
225
|
+
currentPage: currentPage
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
if ((urlState === null || urlState === void 0 ? void 0 : urlState.pageSize) !== pageSize) {
|
|
229
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState({
|
|
230
|
+
pageSize: pageSize
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}, [currentPage, pageSize, urlState]);
|
|
209
235
|
// 存储能够被 on 监听到的 ProTable 状态
|
|
210
236
|
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
|
211
237
|
var _useState21 = useState({
|
|
@@ -492,13 +518,13 @@ var ProTable = function ProTable(props) {
|
|
|
492
518
|
actionRefCallback[state][name] = fun;
|
|
493
519
|
},
|
|
494
520
|
off: function off(name) {
|
|
495
|
-
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (
|
|
496
|
-
var
|
|
497
|
-
k =
|
|
498
|
-
v =
|
|
499
|
-
var filterV = Object.fromEntries(Object.entries(v).filter(function (
|
|
500
|
-
var
|
|
501
|
-
k =
|
|
521
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref3) {
|
|
522
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
523
|
+
k = _ref4[0],
|
|
524
|
+
v = _ref4[1];
|
|
525
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref5) {
|
|
526
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
527
|
+
k = _ref6[0];
|
|
502
528
|
return k !== name;
|
|
503
529
|
}));
|
|
504
530
|
return [k, filterV];
|
|
@@ -734,6 +760,11 @@ var ProTable = function ProTable(props) {
|
|
|
734
760
|
// 请求函数
|
|
735
761
|
function _request(params, noLoading, filterParams, isReset) {
|
|
736
762
|
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread3;
|
|
763
|
+
// 首次渲染表格,获取 urlState 上的 表头 filter 数据
|
|
764
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && dataRef.current.flag) {
|
|
765
|
+
getUrlStateFilter(urlState !== null && urlState !== void 0 ? urlState : {}, actionRef);
|
|
766
|
+
dataRef.current.flag = false;
|
|
767
|
+
}
|
|
737
768
|
// 如果没有传 url 且没有 customRequest,直接返回
|
|
738
769
|
if (!url && !customRequest) {
|
|
739
770
|
return;
|
|
@@ -789,11 +820,11 @@ var ProTable = function ProTable(props) {
|
|
|
789
820
|
success = res.success;
|
|
790
821
|
if (success === true) {
|
|
791
822
|
// 设置 dataSource、total
|
|
792
|
-
if (switchViewState === 'table' || params[
|
|
823
|
+
if (switchViewState === 'table' || params[targetPageKey] === 1 || isReset || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
|
793
824
|
_setData(dataRes || []);
|
|
794
825
|
setTotal(totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length));
|
|
795
826
|
}
|
|
796
|
-
if (switchViewState === 'card' && params[
|
|
827
|
+
if (switchViewState === 'card' && params[targetPageKey] !== 1 && !isReset && !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
|
797
828
|
_setData([].concat(_toConsumableArray(data), _toConsumableArray(dataRes || [])));
|
|
798
829
|
setTotal(total + (totalRes || (dataRes === null || dataRes === void 0 ? void 0 : dataRes.length)));
|
|
799
830
|
}
|
|
@@ -906,11 +937,13 @@ var ProTable = function ProTable(props) {
|
|
|
906
937
|
switchCardView: switchCardView,
|
|
907
938
|
defaultView: defaultView,
|
|
908
939
|
autoRefresh: autoRefresh,
|
|
909
|
-
autoRefreshProps: autoRefreshProps
|
|
940
|
+
autoRefreshProps: autoRefreshProps,
|
|
941
|
+
bindUrlProps: bindUrlProps,
|
|
942
|
+
bindUrl: bindUrl
|
|
910
943
|
}), switchViewState === 'table' && /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
|
911
944
|
hasBorder: false,
|
|
912
945
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
|
913
|
-
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm),
|
|
946
|
+
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps),
|
|
914
947
|
loading: getTableLoading(),
|
|
915
948
|
className: classNames('teamix-pro-table', tableClassName, {
|
|
916
949
|
'with-row-select': rowSelection,
|
|
@@ -1022,9 +1055,9 @@ var ProTable = function ProTable(props) {
|
|
|
1022
1055
|
}
|
|
1023
1056
|
if (showPagination && switchViewState === 'table' || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && switchViewState === 'card') {
|
|
1024
1057
|
var _props$paginationProp3;
|
|
1025
|
-
var
|
|
1026
|
-
onPaginationPropsChange =
|
|
1027
|
-
othersPaginationProps = _objectWithoutProperties(
|
|
1058
|
+
var _ref8 = (_props$paginationProp3 = props === null || props === void 0 ? void 0 : props.paginationProps) !== null && _props$paginationProp3 !== void 0 ? _props$paginationProp3 : {},
|
|
1059
|
+
onPaginationPropsChange = _ref8.onChange,
|
|
1060
|
+
othersPaginationProps = _objectWithoutProperties(_ref8, _excluded2);
|
|
1028
1061
|
return /*#__PURE__*/React.createElement("div", {
|
|
1029
1062
|
className: cls('footer', {
|
|
1030
1063
|
'footer-has-rowSelection': rowSelection,
|