@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.
@@ -59,7 +59,7 @@ var ProTimeLineItem = function ProTimeLineItem(props) {
59
59
  };
60
60
  /** 对枚举参数进行处理 */
61
61
  var formatTime = function formatTime(time) {
62
- if (typeof time === 'string') return dateFormat(time, '', 'YYYY-MM-DD hh:mm:ss');
62
+ if (typeof time === 'string') return dateFormat(time, '', 'YYYY-MM-DD HH:mm:ss');
63
63
  return time;
64
64
  };
65
65
  var formatShape = function formatShape() {
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.10";
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/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.10';
283
+ var version = '1.5.11-beta.2';
284
284
  // By TeamixTest
285
285
  exports.version = version;
286
286
  window.postMessage({
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -7,43 +8,179 @@ exports.default = void 0;
7
8
  var _components = require("@alicloudfe/components");
8
9
  var _icon = _interopRequireDefault(require("@teamix/icon"));
9
10
  var _utils = require("@teamix/utils");
10
- var _react = _interopRequireDefault(require("react"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _utils2 = require("../../utils");
11
13
  require("./index.scss");
14
+ 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
+ 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; }
12
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- /**
14
- * 刷新
15
- */
16
-
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ 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."); }
19
+ 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); }
20
+ 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; }
21
+ 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; }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
23
  var cls = (0, _utils.usePrefixCls)('teamix-pro-table-toolbar-icon');
18
24
  var LayoutIcon = function LayoutIcon(props) {
19
- var actionRef = props.actionRef;
20
- // const [fullscreen, setFullscreen] = useState<boolean>(false);
21
- // // 销毁监听函数
22
- // useEffect(() => {
23
- // return () => {
24
- // actionRef.current?.off?.('refreshIcon');
25
- // };
26
- // }, []);
27
- // // 监听全屏变化
28
- // actionRef.current?.on?.(
29
- // (state: boolean) => {
30
- // setFullscreen(state);
31
- // },
32
- // 'fullScreenState',
33
- // 'refreshIcon',
34
- // );
25
+ var _autoRefreshProps$dat;
26
+ var actionRef = props.actionRef,
27
+ autoRefresh = props.autoRefresh,
28
+ autoRefreshProps = props.autoRefreshProps;
29
+ var autoRefreshRadio = (_autoRefreshProps$dat = autoRefreshProps === null || autoRefreshProps === void 0 ? void 0 : autoRefreshProps.dataSource) !== null && _autoRefreshProps$dat !== void 0 ? _autoRefreshProps$dat : [{
30
+ label: '每 1 分钟',
31
+ value: 60000
32
+ }, {
33
+ label: '每 3 分钟',
34
+ value: 180000
35
+ }, {
36
+ label: '每 5 分钟',
37
+ value: 300000
38
+ }];
39
+ // dropdown 开关
40
+ var _useState = (0, _react.useState)(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ dropdownVisible = _useState2[0],
43
+ setDropdownVisible = _useState2[1];
44
+ // 自动刷新状态
45
+ var _useState3 = (0, _react.useState)(!!autoRefresh),
46
+ _useState4 = _slicedToArray(_useState3, 2),
47
+ autoRefreshVisible = _useState4[0],
48
+ setAutoRefreshVisible = _useState4[1];
49
+ // 间隔时间 ms
50
+ var _useState5 = (0, _react.useState)(60000),
51
+ _useState6 = _slicedToArray(_useState5, 2),
52
+ times = _useState6[0],
53
+ setTimes = _useState6[1];
54
+ // 展示计时器时间 s
55
+ var _useState7 = (0, _react.useState)(60),
56
+ _useState8 = _slicedToArray(_useState7, 2),
57
+ remainTime = _useState8[0],
58
+ setRemainTime = _useState8[1];
59
+ // 循环计时器
60
+ var timerRef = (0, _react.useRef)({
61
+ timer: undefined,
62
+ remain: 60
63
+ });
64
+ (0, _react.useEffect)(function () {
65
+ (0, _utils2.on)(function (timer) {
66
+ setTimes(timer);
67
+ timerRef.current.remain = timer / 1000;
68
+ if (timerRef.current.timer) {
69
+ clearInterval(timerRef.current.timer);
70
+ timerRef.current.timer = undefined;
71
+ }
72
+ timerRef.current.timer = setInterval(function () {
73
+ var remainTime = timerRef.current.remain - 1;
74
+ if (remainTime >= 0) {
75
+ setRemainTime(remainTime);
76
+ timerRef.current.remain = remainTime;
77
+ }
78
+ }, 1000);
79
+ }, 'PRO_TABLE_REFRESH_TIMER_FLAG');
80
+ }, []);
81
+ // 下拉菜单显示隐藏回调
82
+ var onDropdownVisibleChange = function onDropdownVisibleChange(state) {
83
+ setDropdownVisible(state);
84
+ };
85
+ // 自动刷新开启关闭回调
86
+ var onAutoRefreshChange = function onAutoRefreshChange(visible) {
87
+ if (visible) {
88
+ var _actionRef$current, _actionRef$current$se;
89
+ (_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);
90
+ } else {
91
+ var _actionRef$current2, _actionRef$current2$c;
92
+ (_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);
93
+ if (timerRef.current.timer) {
94
+ clearInterval(timerRef.current.timer);
95
+ timerRef.current.timer = undefined;
96
+ timerRef.current.remain = times / 1000;
97
+ setRemainTime(times / 1000);
98
+ }
99
+ }
100
+ setAutoRefreshVisible(visible);
101
+ };
102
+ // 手动刷新回调
103
+ var onManualRefresh = function onManualRefresh() {
104
+ var _actionRef$current3, _actionRef$current3$r;
105
+ (_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);
106
+ onDropdownVisibleChange(false);
107
+ };
108
+ // 选择间隔时间回调
109
+ var onTimeRadioChange = function onTimeRadioChange(timer) {
110
+ var _actionRef$current4, _actionRef$current4$s;
111
+ setTimes(timer);
112
+ (_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);
113
+ };
114
+ // 渲染刷新图标
115
+ var renderRefreshIcon = function renderRefreshIcon() {
116
+ if (!!autoRefresh && autoRefreshVisible) {
117
+ return /*#__PURE__*/_react.default.createElement(_icon.default, {
118
+ size: "small",
119
+ type: "auto-refresh-on-line"
120
+ });
121
+ }
122
+ if (!!autoRefresh && !autoRefreshVisible) {
123
+ return /*#__PURE__*/_react.default.createElement(_icon.default, {
124
+ size: "small",
125
+ type: "auto-refresh-off-line"
126
+ });
127
+ }
128
+ return /*#__PURE__*/_react.default.createElement(_icon.default, {
129
+ size: "small",
130
+ type: "refresh-line"
131
+ });
132
+ };
133
+ // 渲染 Radio
134
+ var renderRadio = autoRefreshRadio.map(function (item) {
135
+ return /*#__PURE__*/_react.default.createElement(_components.Menu.RadioItem, {
136
+ className: cls('time-radio'),
137
+ key: item.value,
138
+ disabled: !autoRefreshVisible,
139
+ checked: times === item.value,
140
+ onChange: function onChange() {
141
+ var _item$value;
142
+ return onTimeRadioChange((_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : 0);
143
+ }
144
+ }, item.label);
145
+ });
146
+ if (autoRefresh) {
147
+ return /*#__PURE__*/_react.default.createElement(_components.Dropdown, {
148
+ trigger: /*#__PURE__*/_react.default.createElement(_components.Button, {
149
+ iconSize: "small",
150
+ className: cls()
151
+ }, renderRefreshIcon()),
152
+ visible: dropdownVisible,
153
+ onVisibleChange: onDropdownVisibleChange,
154
+ followTrigger: true,
155
+ cache: true,
156
+ triggerType: ['click'],
157
+ align: "tr br"
158
+ }, /*#__PURE__*/_react.default.createElement("div", {
159
+ className: cls()
160
+ }, /*#__PURE__*/_react.default.createElement(_components.Menu, {
161
+ className: cls('auto-refresh')
162
+ }, /*#__PURE__*/_react.default.createElement(_components.Menu.CheckboxItem, {
163
+ checked: autoRefreshVisible,
164
+ onChange: onAutoRefreshChange
165
+ }, (0, _utils.getMessage)('autoRefresh'), autoRefreshVisible && /*#__PURE__*/_react.default.createElement("span", null, "\uFF08", remainTime, "s\uFF09")), renderRadio, /*#__PURE__*/_react.default.createElement(_components.Menu.Divider, {
166
+ key: "divider"
167
+ }), /*#__PURE__*/_react.default.createElement("div", {
168
+ className: cls('manual-refresh')
169
+ }, /*#__PURE__*/_react.default.createElement(_components.Button, {
170
+ type: "primary",
171
+ text: true,
172
+ onClick: onManualRefresh
173
+ }, (0, _utils.getMessage)('manualRefresh'))))));
174
+ }
35
175
  return /*#__PURE__*/_react.default.createElement(_components.Balloon.Tooltip, {
36
176
  trigger: /*#__PURE__*/_react.default.createElement(_components.Button, {
37
177
  iconSize: "small",
38
178
  className: cls(),
39
179
  onClick: function onClick() {
40
- var _actionRef$current, _actionRef$current$re;
41
- return (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.refresh) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
180
+ var _actionRef$current5, _actionRef$current5$r;
181
+ 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);
42
182
  }
43
- }, /*#__PURE__*/_react.default.createElement(_icon.default, {
44
- size: "small",
45
- type: "refresh-line"
46
- })),
183
+ }, renderRefreshIcon()),
47
184
  align: "t"
48
185
  }, (0, _utils.getMessage)('refresh'));
49
186
  };
@@ -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
+ }
@@ -37,7 +37,7 @@ Object.keys(_typing).forEach(function (key) {
37
37
  }
38
38
  });
39
39
  });
40
- 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"],
40
+ 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
41
  _excluded2 = ["onChange"];
42
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
43
  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); }
@@ -154,9 +154,8 @@ var ProTable = function ProTable(props) {
154
154
  _props$footerSuction = props.footerSuction,
155
155
  footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
156
156
  _props$autoRefresh = props.autoRefresh,
157
- autoRefresh = _props$autoRefresh === void 0 ? function () {
158
- return false;
159
- } : _props$autoRefresh,
157
+ autoRefresh = _props$autoRefresh === void 0 ? false : _props$autoRefresh,
158
+ autoRefreshProps = props.autoRefreshProps,
160
159
  customRequest = props.customRequest,
161
160
  _props$filterColumnTy = props.filterColumnType,
162
161
  filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
@@ -642,6 +641,19 @@ var ProTable = function ProTable(props) {
642
641
  }
643
642
  }
644
643
  getHeaderHeight(fullscreenState);
644
+ },
645
+ setAutoRefreshTimers: function setAutoRefreshTimers(timers) {
646
+ clearTimeout(autoRefreshTimerRef.current);
647
+ autoRefreshTimerRef.current = null;
648
+ autoRefreshTimerRef.current = setTimeout(function () {
649
+ var _actionRef$current5, _actionRef$current5$r;
650
+ (_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);
651
+ }, timers);
652
+ (0, _utils2.emit)('PRO_TABLE_REFRESH_TIMER_FLAG', timers);
653
+ },
654
+ clearAutoRefreshTimers: function clearAutoRefreshTimers() {
655
+ clearTimeout(autoRefreshTimerRef.current);
656
+ autoRefreshTimerRef.current = null;
645
657
  }
646
658
  });
647
659
  // 将 Actions 绑定到传入的 propsActionRef 中
@@ -650,12 +662,19 @@ var ProTable = function ProTable(props) {
650
662
  }
651
663
  function onFormatResult(next) {
652
664
  props.onFormatResult && props.onFormatResult(next);
653
- var time = autoRefresh ? autoRefresh(next.data) : false;
665
+ var time = 0;
666
+ if (autoRefresh) {
667
+ time = 60 * 1000;
668
+ }
669
+ if (autoRefresh && typeof autoRefresh !== 'boolean') {
670
+ time = autoRefresh ? autoRefresh(next.data) : 0;
671
+ }
654
672
  if (Number.isInteger(time) && time >= 1000) {
655
673
  autoRefreshTimerRef.current = setTimeout(function () {
656
674
  // 自动刷新不显示 loading
657
675
  _request({}, true);
658
676
  }, Number(time));
677
+ (0, _utils2.emit)('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
659
678
  }
660
679
  // 设置 dataSource、total
661
680
  if (switchViewState === 'table' || currentPage === 1) {
@@ -732,7 +751,7 @@ var ProTable = function ProTable(props) {
732
751
  });
733
752
  // 请求函数
734
753
  function _request(params, noLoading, filterParams) {
735
- var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread3;
754
+ var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread3;
736
755
  // 如果没有传 url 且没有 customRequest,直接返回
737
756
  if (!url && !customRequest) {
738
757
  return;
@@ -745,7 +764,7 @@ var ProTable = function ProTable(props) {
745
764
  // 筛选区请求参数
746
765
  var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values;
747
766
  // 列过滤请求参数
748
- var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
767
+ 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 : {};
749
768
  // 格式化后的请求参数
750
769
  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));
751
770
  if (requestData) {
@@ -795,12 +814,19 @@ var ProTable = function ProTable(props) {
795
814
  getHeaderHeight(fullscreenState);
796
815
  }
797
816
  // customRequest 中支持 autoRefresh
798
- var time = autoRefresh ? autoRefresh(data) : false;
817
+ var time = 0;
818
+ if (autoRefresh) {
819
+ time = 60 * 1000;
820
+ }
821
+ if (autoRefresh && typeof autoRefresh !== 'boolean') {
822
+ time = autoRefresh ? autoRefresh(data) : 0;
823
+ }
799
824
  if (Number.isInteger(time) && time >= 1000) {
800
825
  autoRefreshTimerRef.current = setTimeout(function () {
801
826
  // 自动刷新不显示 loading
802
- _request(requestData, true);
827
+ _request({}, true);
803
828
  }, Number(time));
829
+ (0, _utils2.emit)('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
804
830
  }
805
831
  });
806
832
  } else {
@@ -826,7 +852,7 @@ var ProTable = function ProTable(props) {
826
852
  return true;
827
853
  } : undefined,
828
854
  onFilter: function onFilter(values) {
829
- var _actionRef$current6, _actionRef$current6$c;
855
+ var _actionRef$current7, _actionRef$current7$c;
830
856
  // 全屏状态,判断全屏表单onFilter是否禁用
831
857
  if (fullscreenState && !filterEnableRef.current.fullscreen) {
832
858
  filterEnableRef.current.fullscreen = true;
@@ -839,7 +865,7 @@ var ProTable = function ProTable(props) {
839
865
  }
840
866
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
841
867
  // 搜索变化时,暂时先清空选择
842
- (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
868
+ (_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);
843
869
  setCurrentPage(1);
844
870
  _request(_defineProperty({}, targetPageKey, 1), false, values);
845
871
  },
@@ -882,7 +908,9 @@ var ProTable = function ProTable(props) {
882
908
  toolBarAutoWidth: toolBarAutoWidth,
883
909
  dataTeamixSpm: dataTeamixSpm,
884
910
  switchCardView: switchCardView,
885
- defaultView: defaultView
911
+ defaultView: defaultView,
912
+ autoRefresh: autoRefresh,
913
+ autoRefreshProps: autoRefreshProps
886
914
  }), switchViewState === 'table' && /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _objectSpread({
887
915
  hasBorder: false,
888
916
  dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
@@ -950,8 +978,8 @@ var ProTable = function ProTable(props) {
950
978
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
951
979
  // 翻页默认清空选择
952
980
  if (!reserveSelectedRecords) {
953
- var _actionRef$current7, _actionRef$current7$c;
954
- (_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);
981
+ var _actionRef$current8, _actionRef$current8$c;
982
+ (_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);
955
983
  }
956
984
  setCurrentPage(currentPage);
957
985
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
@@ -960,8 +988,8 @@ var ProTable = function ProTable(props) {
960
988
  var _request8;
961
989
  // 翻页默认清空选择
962
990
  if (!reserveSelectedRecords) {
963
- var _actionRef$current8, _actionRef$current8$c;
964
- (_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);
991
+ var _actionRef$current9, _actionRef$current9$c;
992
+ (_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);
965
993
  }
966
994
  setPageSize(currentPageSize);
967
995
  setCurrentPage(1);
@@ -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;