@teamix/pro 1.5.10 → 1.5.11-beta.2
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.css +1 -1
- package/dist/pro.js +410 -53
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/ToolBar/RefreshIcon.js +162 -24
- package/es/table/components/ToolBar/index.scss +17 -0
- package/es/table/index.js +44 -16
- package/es/table/typing.d.ts +15 -1
- package/es/table/utils/cloneDeep.d.ts +28 -0
- package/es/table/utils/cloneDeep.js +1578 -0
- package/es/timeline/ProTimeLineItem/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/ToolBar/RefreshIcon.js +164 -27
- package/lib/table/components/ToolBar/index.scss +17 -0
- package/lib/table/index.js +44 -16
- package/lib/table/typing.d.ts +15 -1
- package/lib/table/utils/cloneDeep.d.ts +28 -0
- package/lib/table/utils/cloneDeep.js +1585 -0
- package/lib/timeline/ProTimeLineItem/index.js +1 -1
- package/package.json +1 -1
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.11-beta.2";
|
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
@@ -1,41 +1,179 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
5
|
+
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; }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
1
7
|
/**
|
2
8
|
* 刷新
|
3
9
|
*/
|
4
|
-
import { Button, Balloon } from '@alicloudfe/components';
|
10
|
+
import { Button, Balloon, Menu, Dropdown } from '@alicloudfe/components';
|
5
11
|
import TeamixIcon from '@teamix/icon';
|
6
12
|
import { usePrefixCls, getMessage } from '@teamix/utils';
|
7
|
-
import React from 'react';
|
13
|
+
import React, { useEffect, useRef, useState } from 'react';
|
14
|
+
import { on } from '../../utils';
|
8
15
|
import './index.scss';
|
9
16
|
var cls = usePrefixCls('teamix-pro-table-toolbar-icon');
|
10
17
|
var LayoutIcon = function LayoutIcon(props) {
|
11
|
-
var
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
//
|
26
|
-
|
18
|
+
var _autoRefreshProps$dat;
|
19
|
+
var actionRef = props.actionRef,
|
20
|
+
autoRefresh = props.autoRefresh,
|
21
|
+
autoRefreshProps = props.autoRefreshProps;
|
22
|
+
var autoRefreshRadio = (_autoRefreshProps$dat = autoRefreshProps === null || autoRefreshProps === void 0 ? void 0 : autoRefreshProps.dataSource) !== null && _autoRefreshProps$dat !== void 0 ? _autoRefreshProps$dat : [{
|
23
|
+
label: '每 1 分钟',
|
24
|
+
value: 60000
|
25
|
+
}, {
|
26
|
+
label: '每 3 分钟',
|
27
|
+
value: 180000
|
28
|
+
}, {
|
29
|
+
label: '每 5 分钟',
|
30
|
+
value: 300000
|
31
|
+
}];
|
32
|
+
// dropdown 开关
|
33
|
+
var _useState = useState(false),
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
35
|
+
dropdownVisible = _useState2[0],
|
36
|
+
setDropdownVisible = _useState2[1];
|
37
|
+
// 自动刷新状态
|
38
|
+
var _useState3 = useState(!!autoRefresh),
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
40
|
+
autoRefreshVisible = _useState4[0],
|
41
|
+
setAutoRefreshVisible = _useState4[1];
|
42
|
+
// 间隔时间 ms
|
43
|
+
var _useState5 = useState(60000),
|
44
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
45
|
+
times = _useState6[0],
|
46
|
+
setTimes = _useState6[1];
|
47
|
+
// 展示计时器时间 s
|
48
|
+
var _useState7 = useState(60),
|
49
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
50
|
+
remainTime = _useState8[0],
|
51
|
+
setRemainTime = _useState8[1];
|
52
|
+
// 循环计时器
|
53
|
+
var timerRef = useRef({
|
54
|
+
timer: undefined,
|
55
|
+
remain: 60
|
56
|
+
});
|
57
|
+
useEffect(function () {
|
58
|
+
on(function (timer) {
|
59
|
+
setTimes(timer);
|
60
|
+
timerRef.current.remain = timer / 1000;
|
61
|
+
if (timerRef.current.timer) {
|
62
|
+
clearInterval(timerRef.current.timer);
|
63
|
+
timerRef.current.timer = undefined;
|
64
|
+
}
|
65
|
+
timerRef.current.timer = setInterval(function () {
|
66
|
+
var remainTime = timerRef.current.remain - 1;
|
67
|
+
if (remainTime >= 0) {
|
68
|
+
setRemainTime(remainTime);
|
69
|
+
timerRef.current.remain = remainTime;
|
70
|
+
}
|
71
|
+
}, 1000);
|
72
|
+
}, 'PRO_TABLE_REFRESH_TIMER_FLAG');
|
73
|
+
}, []);
|
74
|
+
// 下拉菜单显示隐藏回调
|
75
|
+
var onDropdownVisibleChange = function onDropdownVisibleChange(state) {
|
76
|
+
setDropdownVisible(state);
|
77
|
+
};
|
78
|
+
// 自动刷新开启关闭回调
|
79
|
+
var onAutoRefreshChange = function onAutoRefreshChange(visible) {
|
80
|
+
if (visible) {
|
81
|
+
var _actionRef$current, _actionRef$current$se;
|
82
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setAutoRefreshTimers) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, times);
|
83
|
+
} else {
|
84
|
+
var _actionRef$current2, _actionRef$current2$c;
|
85
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$c = _actionRef$current2.clearAutoRefreshTimers) === null || _actionRef$current2$c === void 0 ? void 0 : _actionRef$current2$c.call(_actionRef$current2);
|
86
|
+
if (timerRef.current.timer) {
|
87
|
+
clearInterval(timerRef.current.timer);
|
88
|
+
timerRef.current.timer = undefined;
|
89
|
+
timerRef.current.remain = times / 1000;
|
90
|
+
setRemainTime(times / 1000);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
setAutoRefreshVisible(visible);
|
94
|
+
};
|
95
|
+
// 手动刷新回调
|
96
|
+
var onManualRefresh = function onManualRefresh() {
|
97
|
+
var _actionRef$current3, _actionRef$current3$r;
|
98
|
+
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.refresh) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
99
|
+
onDropdownVisibleChange(false);
|
100
|
+
};
|
101
|
+
// 选择间隔时间回调
|
102
|
+
var onTimeRadioChange = function onTimeRadioChange(timer) {
|
103
|
+
var _actionRef$current4, _actionRef$current4$s;
|
104
|
+
setTimes(timer);
|
105
|
+
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setAutoRefreshTimers) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, timer);
|
106
|
+
};
|
107
|
+
// 渲染刷新图标
|
108
|
+
var renderRefreshIcon = function renderRefreshIcon() {
|
109
|
+
if (!!autoRefresh && autoRefreshVisible) {
|
110
|
+
return /*#__PURE__*/React.createElement(TeamixIcon, {
|
111
|
+
size: "small",
|
112
|
+
type: "auto-refresh-on-line"
|
113
|
+
});
|
114
|
+
}
|
115
|
+
if (!!autoRefresh && !autoRefreshVisible) {
|
116
|
+
return /*#__PURE__*/React.createElement(TeamixIcon, {
|
117
|
+
size: "small",
|
118
|
+
type: "auto-refresh-off-line"
|
119
|
+
});
|
120
|
+
}
|
121
|
+
return /*#__PURE__*/React.createElement(TeamixIcon, {
|
122
|
+
size: "small",
|
123
|
+
type: "refresh-line"
|
124
|
+
});
|
125
|
+
};
|
126
|
+
// 渲染 Radio
|
127
|
+
var renderRadio = autoRefreshRadio.map(function (item) {
|
128
|
+
return /*#__PURE__*/React.createElement(Menu.RadioItem, {
|
129
|
+
className: cls('time-radio'),
|
130
|
+
key: item.value,
|
131
|
+
disabled: !autoRefreshVisible,
|
132
|
+
checked: times === item.value,
|
133
|
+
onChange: function onChange() {
|
134
|
+
var _item$value;
|
135
|
+
return onTimeRadioChange((_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : 0);
|
136
|
+
}
|
137
|
+
}, item.label);
|
138
|
+
});
|
139
|
+
if (autoRefresh) {
|
140
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
141
|
+
trigger: /*#__PURE__*/React.createElement(Button, {
|
142
|
+
iconSize: "small",
|
143
|
+
className: cls()
|
144
|
+
}, renderRefreshIcon()),
|
145
|
+
visible: dropdownVisible,
|
146
|
+
onVisibleChange: onDropdownVisibleChange,
|
147
|
+
followTrigger: true,
|
148
|
+
cache: true,
|
149
|
+
triggerType: ['click'],
|
150
|
+
align: "tr br"
|
151
|
+
}, /*#__PURE__*/React.createElement("div", {
|
152
|
+
className: cls()
|
153
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
154
|
+
className: cls('auto-refresh')
|
155
|
+
}, /*#__PURE__*/React.createElement(Menu.CheckboxItem, {
|
156
|
+
checked: autoRefreshVisible,
|
157
|
+
onChange: onAutoRefreshChange
|
158
|
+
}, getMessage('autoRefresh'), autoRefreshVisible && /*#__PURE__*/React.createElement("span", null, "\uFF08", remainTime, "s\uFF09")), renderRadio, /*#__PURE__*/React.createElement(Menu.Divider, {
|
159
|
+
key: "divider"
|
160
|
+
}), /*#__PURE__*/React.createElement("div", {
|
161
|
+
className: cls('manual-refresh')
|
162
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
163
|
+
type: "primary",
|
164
|
+
text: true,
|
165
|
+
onClick: onManualRefresh
|
166
|
+
}, getMessage('manualRefresh'))))));
|
167
|
+
}
|
27
168
|
return /*#__PURE__*/React.createElement(Balloon.Tooltip, {
|
28
169
|
trigger: /*#__PURE__*/React.createElement(Button, {
|
29
170
|
iconSize: "small",
|
30
171
|
className: cls(),
|
31
172
|
onClick: function onClick() {
|
32
|
-
var _actionRef$
|
33
|
-
return (_actionRef$
|
173
|
+
var _actionRef$current5, _actionRef$current5$r;
|
174
|
+
return (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$r = _actionRef$current5.refresh) === null || _actionRef$current5$r === void 0 ? void 0 : _actionRef$current5$r.call(_actionRef$current5);
|
34
175
|
}
|
35
|
-
},
|
36
|
-
size: "small",
|
37
|
-
type: "refresh-line"
|
38
|
-
})),
|
176
|
+
}, renderRefreshIcon()),
|
39
177
|
align: "t"
|
40
178
|
}, getMessage('refresh'));
|
41
179
|
};
|
@@ -158,3 +158,20 @@
|
|
158
158
|
padding-right: 8px;
|
159
159
|
}
|
160
160
|
}
|
161
|
+
|
162
|
+
// refresh
|
163
|
+
.teamix-pro-table-toolbar-icon {
|
164
|
+
&-auto-refresh {
|
165
|
+
width: 145px;
|
166
|
+
}
|
167
|
+
|
168
|
+
&-manual-refresh {
|
169
|
+
text-align: center;
|
170
|
+
line-height: 1;
|
171
|
+
margin-bottom: 2px;
|
172
|
+
}
|
173
|
+
|
174
|
+
.teamix-pro-table-toolbar-icon-time-radio.teamix-pro-table-toolbar-icon-time-radio.teamix-pro-table-toolbar-icon-time-radio {
|
175
|
+
padding-left: 32px;
|
176
|
+
}
|
177
|
+
}
|
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", "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"],
|
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(); }
|
@@ -133,9 +133,8 @@ var ProTable = function ProTable(props) {
|
|
133
133
|
_props$footerSuction = props.footerSuction,
|
134
134
|
footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
|
135
135
|
_props$autoRefresh = props.autoRefresh,
|
136
|
-
autoRefresh = _props$autoRefresh === void 0 ?
|
137
|
-
|
138
|
-
} : _props$autoRefresh,
|
136
|
+
autoRefresh = _props$autoRefresh === void 0 ? false : _props$autoRefresh,
|
137
|
+
autoRefreshProps = props.autoRefreshProps,
|
139
138
|
customRequest = props.customRequest,
|
140
139
|
_props$filterColumnTy = props.filterColumnType,
|
141
140
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
@@ -621,6 +620,19 @@ var ProTable = function ProTable(props) {
|
|
621
620
|
}
|
622
621
|
}
|
623
622
|
getHeaderHeight(fullscreenState);
|
623
|
+
},
|
624
|
+
setAutoRefreshTimers: function setAutoRefreshTimers(timers) {
|
625
|
+
clearTimeout(autoRefreshTimerRef.current);
|
626
|
+
autoRefreshTimerRef.current = null;
|
627
|
+
autoRefreshTimerRef.current = setTimeout(function () {
|
628
|
+
var _actionRef$current5, _actionRef$current5$r;
|
629
|
+
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$r = _actionRef$current5.refresh) === null || _actionRef$current5$r === void 0 ? void 0 : _actionRef$current5$r.call(_actionRef$current5);
|
630
|
+
}, timers);
|
631
|
+
emit('PRO_TABLE_REFRESH_TIMER_FLAG', timers);
|
632
|
+
},
|
633
|
+
clearAutoRefreshTimers: function clearAutoRefreshTimers() {
|
634
|
+
clearTimeout(autoRefreshTimerRef.current);
|
635
|
+
autoRefreshTimerRef.current = null;
|
624
636
|
}
|
625
637
|
});
|
626
638
|
// 将 Actions 绑定到传入的 propsActionRef 中
|
@@ -629,12 +641,19 @@ var ProTable = function ProTable(props) {
|
|
629
641
|
}
|
630
642
|
function onFormatResult(next) {
|
631
643
|
props.onFormatResult && props.onFormatResult(next);
|
632
|
-
var time =
|
644
|
+
var time = 0;
|
645
|
+
if (autoRefresh) {
|
646
|
+
time = 60 * 1000;
|
647
|
+
}
|
648
|
+
if (autoRefresh && typeof autoRefresh !== 'boolean') {
|
649
|
+
time = autoRefresh ? autoRefresh(next.data) : 0;
|
650
|
+
}
|
633
651
|
if (Number.isInteger(time) && time >= 1000) {
|
634
652
|
autoRefreshTimerRef.current = setTimeout(function () {
|
635
653
|
// 自动刷新不显示 loading
|
636
654
|
_request({}, true);
|
637
655
|
}, Number(time));
|
656
|
+
emit('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
638
657
|
}
|
639
658
|
// 设置 dataSource、total
|
640
659
|
if (switchViewState === 'table' || currentPage === 1) {
|
@@ -711,7 +730,7 @@ var ProTable = function ProTable(props) {
|
|
711
730
|
});
|
712
731
|
// 请求函数
|
713
732
|
function _request(params, noLoading, filterParams) {
|
714
|
-
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$
|
733
|
+
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread3;
|
715
734
|
// 如果没有传 url 且没有 customRequest,直接返回
|
716
735
|
if (!url && !customRequest) {
|
717
736
|
return;
|
@@ -724,7 +743,7 @@ var ProTable = function ProTable(props) {
|
|
724
743
|
// 筛选区请求参数
|
725
744
|
var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values;
|
726
745
|
// 列过滤请求参数
|
727
|
-
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$
|
746
|
+
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$g = _actionRef$current6.getFilterRules) === null || _actionRef$current6$g === void 0 ? void 0 : _actionRef$current6$g.call(_actionRef$current6)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
728
747
|
// 格式化后的请求参数
|
729
748
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
|
730
749
|
if (requestData) {
|
@@ -774,12 +793,19 @@ var ProTable = function ProTable(props) {
|
|
774
793
|
getHeaderHeight(fullscreenState);
|
775
794
|
}
|
776
795
|
// customRequest 中支持 autoRefresh
|
777
|
-
var time =
|
796
|
+
var time = 0;
|
797
|
+
if (autoRefresh) {
|
798
|
+
time = 60 * 1000;
|
799
|
+
}
|
800
|
+
if (autoRefresh && typeof autoRefresh !== 'boolean') {
|
801
|
+
time = autoRefresh ? autoRefresh(data) : 0;
|
802
|
+
}
|
778
803
|
if (Number.isInteger(time) && time >= 1000) {
|
779
804
|
autoRefreshTimerRef.current = setTimeout(function () {
|
780
805
|
// 自动刷新不显示 loading
|
781
|
-
_request(
|
806
|
+
_request({}, true);
|
782
807
|
}, Number(time));
|
808
|
+
emit('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
783
809
|
}
|
784
810
|
});
|
785
811
|
} else {
|
@@ -805,7 +831,7 @@ var ProTable = function ProTable(props) {
|
|
805
831
|
return true;
|
806
832
|
} : undefined,
|
807
833
|
onFilter: function onFilter(values) {
|
808
|
-
var _actionRef$
|
834
|
+
var _actionRef$current7, _actionRef$current7$c;
|
809
835
|
// 全屏状态,判断全屏表单onFilter是否禁用
|
810
836
|
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
811
837
|
filterEnableRef.current.fullscreen = true;
|
@@ -818,7 +844,7 @@ var ProTable = function ProTable(props) {
|
|
818
844
|
}
|
819
845
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
|
820
846
|
// 搜索变化时,暂时先清空选择
|
821
|
-
(_actionRef$
|
847
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
822
848
|
setCurrentPage(1);
|
823
849
|
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
824
850
|
},
|
@@ -861,7 +887,9 @@ var ProTable = function ProTable(props) {
|
|
861
887
|
toolBarAutoWidth: toolBarAutoWidth,
|
862
888
|
dataTeamixSpm: dataTeamixSpm,
|
863
889
|
switchCardView: switchCardView,
|
864
|
-
defaultView: defaultView
|
890
|
+
defaultView: defaultView,
|
891
|
+
autoRefresh: autoRefresh,
|
892
|
+
autoRefreshProps: autoRefreshProps
|
865
893
|
}), switchViewState === 'table' && /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
866
894
|
hasBorder: false,
|
867
895
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
@@ -929,8 +957,8 @@ var ProTable = function ProTable(props) {
|
|
929
957
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
930
958
|
// 翻页默认清空选择
|
931
959
|
if (!reserveSelectedRecords) {
|
932
|
-
var _actionRef$
|
933
|
-
(_actionRef$
|
960
|
+
var _actionRef$current8, _actionRef$current8$c;
|
961
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
934
962
|
}
|
935
963
|
setCurrentPage(currentPage);
|
936
964
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
@@ -939,8 +967,8 @@ var ProTable = function ProTable(props) {
|
|
939
967
|
var _request8;
|
940
968
|
// 翻页默认清空选择
|
941
969
|
if (!reserveSelectedRecords) {
|
942
|
-
var _actionRef$
|
943
|
-
(_actionRef$
|
970
|
+
var _actionRef$current9, _actionRef$current9$c;
|
971
|
+
(_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);
|
944
972
|
}
|
945
973
|
setPageSize(currentPageSize);
|
946
974
|
setCurrentPage(1);
|
package/es/table/typing.d.ts
CHANGED
@@ -131,7 +131,15 @@ export declare type ProTableProps = {
|
|
131
131
|
/** 非全屏模式下是否吸底 默认状态下取用 ProPageContainer 作为参照物。如果传入了 Dom,则取用 Dom 作为参照物 */
|
132
132
|
footerSuction?: boolean | Element;
|
133
133
|
/** 当满足条件时开启自动刷新,返回值为自动刷新间隔时间,如果返回 0 或 false 则停止自动刷新,每次触发翻页、搜索都将重置时间 */
|
134
|
-
autoRefresh?: (dataSource: any[]) => number | boolean;
|
134
|
+
autoRefresh?: ((dataSource: any[]) => number | boolean) | boolean;
|
135
|
+
/** 自动刷新配置 */
|
136
|
+
autoRefreshProps?: {
|
137
|
+
/** 可选间隔列表 **/
|
138
|
+
dataSource?: {
|
139
|
+
label?: React.ReactNode;
|
140
|
+
value?: number;
|
141
|
+
}[];
|
142
|
+
};
|
135
143
|
/** 自定义请求方法,必需返回 success,data 字段,如果需要手动分页 total 也是必需的 */
|
136
144
|
customRequest?: (params: any) => Promise<{
|
137
145
|
success: boolean;
|
@@ -231,6 +239,10 @@ export declare type ProTableActionType = {
|
|
231
239
|
/** 设置数据源 **/
|
232
240
|
setData?: (data: any[]) => void;
|
233
241
|
setCardViewScrollPosition?: (scrollTop: number) => void;
|
242
|
+
/** 刷新定时器间隔时间 */
|
243
|
+
setAutoRefreshTimers?: (timers: number) => void;
|
244
|
+
/** 清除刷新定时器 */
|
245
|
+
clearAutoRefreshTimers?: () => void;
|
234
246
|
} & ProTableActionTypeMutations;
|
235
247
|
/** action State 定义 */
|
236
248
|
export declare type ProTableActionTypeMutations = {
|
@@ -301,6 +313,8 @@ export declare type ProTableLayoutProps = {
|
|
301
313
|
dataTeamixSpm?: string;
|
302
314
|
switchCardView?: boolean;
|
303
315
|
defaultView?: 'table' | 'card';
|
316
|
+
autoRefresh?: ProTableProps['autoRefresh'];
|
317
|
+
autoRefreshProps?: ProTableProps['autoRefreshProps'];
|
304
318
|
} & ProTableTopAreaProps;
|
305
319
|
/** columns 列过滤 */
|
306
320
|
export declare type ProTableColumnsFilterItemProps = {
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
* lodash (Custom Build) <https://lodash.com/>
|
3
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
4
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
5
|
+
* Released under MIT license <https://lodash.com/license>
|
6
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
7
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* This method is like `_.clone` except that it recursively clones `value`.
|
11
|
+
*
|
12
|
+
* @static
|
13
|
+
* @memberOf _
|
14
|
+
* @since 1.0.0
|
15
|
+
* @category Lang
|
16
|
+
* @param {*} value The value to recursively clone.
|
17
|
+
* @returns {*} Returns the deep cloned value.
|
18
|
+
* @see _.clone
|
19
|
+
* @example
|
20
|
+
*
|
21
|
+
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
22
|
+
*
|
23
|
+
* var deep = _.cloneDeep(objects);
|
24
|
+
* console.log(deep[0] === objects[0]);
|
25
|
+
* // => false
|
26
|
+
*/
|
27
|
+
declare function cloneDeep(value: any): any;
|
28
|
+
export default cloneDeep;
|