@teamix/pro 1.2.30 → 1.2.34
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 +16740 -17360
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.js +58 -9
- package/es/common.scss +22 -0
- package/es/form/Filter/SimpleFilter.js +10 -3
- package/es/form/Filter/index.d.ts +5 -9
- package/es/form/Filter/index.js +427 -154
- package/es/form/Filter/index.scss +33 -11
- package/es/form/Filter/index2.d.ts +9 -5
- package/es/form/Filter/index2.js +154 -370
- package/es/form/Filter/index2.scss +11 -33
- package/es/form/ProForm/index.js +4 -4
- package/es/form/ProForm/index.scss +5 -0
- package/es/form/SchemaForm/index.js +4 -4
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +41 -5
- package/es/form/SchemaForm/reactions.d.ts +2 -2
- package/es/form/SchemaForm/reactions.js +13 -6
- package/es/form/index.d.ts +3 -3
- package/es/form/index.js +3 -3
- package/es/form/typing.d.ts +8 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoValueItem/index.js +38 -12
- package/es/info/components/InfoValueItem/index.scss +1 -0
- package/es/info/components/ProInfoItem/index.js +6 -3
- package/es/info/components/ProInfoItem/index.scss +9 -0
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/components/headerInfo/index.js +2 -1
- package/es/info/components/tableInfo/index.js +2 -1
- package/es/info/index.scss +2 -0
- package/es/info/typing.d.ts +3 -0
- package/es/table/components/Filter/index.js +6 -6
- package/es/table/components/Layout/index.js +29 -23
- package/es/table/components/Layout/index.scss +7 -0
- package/es/table/components/ToolBar/Fullscreen.js +39 -15
- package/es/table/components/ToolBar/index.scss +1 -0
- package/es/table/index.js +122 -54
- package/es/table/typing.d.ts +3 -2
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/index.d.ts +2 -1
- package/es/table/utils/index.js +62 -113
- package/lib/actions/dialog-form.js +57 -10
- package/lib/common.scss +22 -0
- package/lib/form/Filter/SimpleFilter.js +8 -1
- package/lib/form/Filter/index.d.ts +5 -9
- package/lib/form/Filter/index.js +440 -154
- package/lib/form/Filter/index.scss +33 -11
- package/lib/form/Filter/index2.d.ts +9 -5
- package/lib/form/Filter/index2.js +154 -383
- package/lib/form/Filter/index2.scss +11 -33
- package/lib/form/ProForm/index.js +4 -4
- package/lib/form/ProForm/index.scss +5 -0
- package/lib/form/SchemaForm/index.js +4 -4
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +41 -5
- package/lib/form/SchemaForm/reactions.d.ts +2 -2
- package/lib/form/SchemaForm/reactions.js +13 -6
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +8 -8
- package/lib/form/typing.d.ts +8 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoValueItem/index.js +38 -12
- package/lib/info/components/InfoValueItem/index.scss +1 -0
- package/lib/info/components/ProInfoItem/index.js +6 -3
- package/lib/info/components/ProInfoItem/index.scss +9 -0
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/components/headerInfo/index.js +2 -1
- package/lib/info/components/tableInfo/index.js +2 -1
- package/lib/info/index.scss +2 -0
- package/lib/info/typing.d.ts +3 -0
- package/lib/table/components/Filter/index.js +6 -6
- package/lib/table/components/Layout/index.js +29 -23
- package/lib/table/components/Layout/index.scss +7 -0
- package/lib/table/components/ToolBar/Fullscreen.js +37 -14
- package/lib/table/components/ToolBar/index.scss +1 -0
- package/lib/table/index.js +121 -53
- package/lib/table/typing.d.ts +3 -2
- package/lib/table/utils/columnRender.js +2 -2
- package/lib/table/utils/index.d.ts +2 -1
- package/lib/table/utils/index.js +63 -112
- package/package.json +1 -1
- package/dist/212.js +0 -155705
- package/dist/fonts/codicon.ttf +0 -0
- package/es/form/Components/SelectTable/index.d.ts +0 -24
- package/es/form/Components/SelectTable/index.js +0 -135
- package/es/form/Components/SelectTable/index.scss +0 -28
- package/es/form/Components/SelectTable/table.d.ts +0 -6
- package/es/form/Components/SelectTable/table.js +0 -64
- package/lib/form/Components/SelectTable/index.d.ts +0 -24
- package/lib/form/Components/SelectTable/index.js +0 -157
- package/lib/form/Components/SelectTable/index.scss +0 -28
- package/lib/form/Components/SelectTable/table.d.ts +0 -6
- package/lib/form/Components/SelectTable/table.js +0 -76
@@ -56,6 +56,19 @@ var Layout = function Layout(props) {
|
|
56
56
|
context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
|
57
57
|
})));
|
58
58
|
} else return mainAction;
|
59
|
+
}; // 渲染 addonAfter
|
60
|
+
|
61
|
+
|
62
|
+
var renderAddonAfter = function renderAddonAfter() {
|
63
|
+
return /*#__PURE__*/React.createElement("div", {
|
64
|
+
className: cls('addon-after-wrapper')
|
65
|
+
}, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
|
66
|
+
actionRef: actionRef,
|
67
|
+
quickAction: extra,
|
68
|
+
rowSelection: rowSelection
|
69
|
+
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
70
|
+
actionRef: actionRef
|
71
|
+
}, otherProps)));
|
59
72
|
}; // 渲染新版 QueryFilter
|
60
73
|
|
61
74
|
|
@@ -83,13 +96,7 @@ var Layout = function Layout(props) {
|
|
83
96
|
},
|
84
97
|
panelContent: dataFilter.content,
|
85
98
|
addonBefore: renderMainAction(),
|
86
|
-
addonAfter:
|
87
|
-
actionRef: actionRef,
|
88
|
-
quickAction: extra,
|
89
|
-
rowSelection: rowSelection
|
90
|
-
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
91
|
-
actionRef: actionRef
|
92
|
-
}, otherProps)))
|
99
|
+
addonAfter: renderAddonAfter()
|
93
100
|
}, dataFilter));
|
94
101
|
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
|
95
102
|
return /*#__PURE__*/React.createElement(QueryFilter, _objectSpread({
|
@@ -108,27 +115,18 @@ var Layout = function Layout(props) {
|
|
108
115
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
109
116
|
},
|
110
117
|
addonBefore: renderMainAction(),
|
111
|
-
addonAfter:
|
112
|
-
actionRef: actionRef,
|
113
|
-
quickAction: extra,
|
114
|
-
rowSelection: rowSelection
|
115
|
-
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
116
|
-
actionRef: actionRef
|
117
|
-
}, otherProps)))
|
118
|
+
addonAfter: renderAddonAfter()
|
118
119
|
}, dataFilter));
|
119
120
|
}
|
120
121
|
} else if (mainAction) {
|
121
122
|
// 没传 dataFilter 但是传了 mainAction
|
122
123
|
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
123
|
-
className: "mb8",
|
124
124
|
addonBefore: renderMainAction(),
|
125
|
-
addonAfter:
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
actionRef: actionRef
|
131
|
-
}, otherProps)))
|
125
|
+
addonAfter: renderAddonAfter()
|
126
|
+
});
|
127
|
+
} else {
|
128
|
+
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
129
|
+
addonAfter: renderAddonAfter()
|
132
130
|
});
|
133
131
|
}
|
134
132
|
}; // 区域组合渲染
|
@@ -148,11 +146,19 @@ var Layout = function Layout(props) {
|
|
148
146
|
rowSelection: rowSelection
|
149
147
|
}))), renderQueryFilter());
|
150
148
|
} else if (header && !mainAction) {
|
149
|
+
var _dataFilter$schema3, _dataFilter$schema4;
|
150
|
+
|
151
151
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
152
152
|
className: cls('wrapper')
|
153
153
|
}, /*#__PURE__*/React.createElement("div", {
|
154
154
|
className: cls('left')
|
155
|
-
}, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)),
|
155
|
+
}, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter()), /*#__PURE__*/React.createElement("div", {
|
156
|
+
className: cls('right')
|
157
|
+
}, extra && /*#__PURE__*/React.createElement(QuickAction, {
|
158
|
+
actionRef: actionRef,
|
159
|
+
quickAction: extra,
|
160
|
+
rowSelection: rowSelection
|
161
|
+
}), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter())));
|
156
162
|
} else if (!header && mainAction) {
|
157
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
158
164
|
} else if (!header && !mainAction) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useEffect } from 'react';
|
2
2
|
import { Message, Overlay } from '@alicloudfe/components';
|
3
3
|
import './index.scss';
|
4
|
-
import { getMessage } from '@teamix/utils';
|
4
|
+
import { getMessage, getValidValues } from '@teamix/utils';
|
5
5
|
|
6
6
|
var FullScreen = function FullScreen(props) {
|
7
7
|
var children = props.children,
|
@@ -9,35 +9,59 @@ var FullScreen = function FullScreen(props) {
|
|
9
9
|
actionRef = props.actionRef;
|
10
10
|
var _actionRef$current = actionRef.current,
|
11
11
|
normalDataFilterForm = _actionRef$current.normalDataFilterForm,
|
12
|
-
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm
|
12
|
+
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm,
|
13
|
+
filterEnableRef = _actionRef$current.filterEnableRef;
|
13
14
|
|
14
|
-
function closeByESC(e) {
|
15
|
+
var closeByESC = function closeByESC(e) {
|
15
16
|
if (visible && e.code === 'Escape') {
|
16
|
-
var _actionRef$current2, _actionRef$current2$
|
17
|
+
var _actionRef$current2, _actionRef$current2$f;
|
17
18
|
|
18
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$
|
19
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
|
19
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.fullScreen) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2);
|
20
20
|
}
|
21
|
-
} // 监听esc按钮
|
21
|
+
}; // 监听esc按钮
|
22
22
|
|
23
23
|
|
24
24
|
useEffect(function () {
|
25
|
-
var _actionRef$current4, _actionRef$current4$s;
|
26
|
-
|
27
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFullScreenState) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, visible);
|
28
25
|
window.addEventListener('keydown', closeByESC);
|
29
26
|
return function () {
|
30
27
|
window.removeEventListener('keydown', closeByESC);
|
31
28
|
};
|
32
|
-
}, [visible]);
|
29
|
+
}, [visible, actionRef]);
|
33
30
|
|
34
31
|
var afterClose = function afterClose() {
|
35
|
-
|
32
|
+
// 判断全屏前后筛选表单值是否有改变
|
33
|
+
var n = JSON.stringify(getValidValues(normalDataFilterForm.values));
|
34
|
+
var f = JSON.stringify(getValidValues(fullscreenDataFilterForm.values));
|
35
|
+
|
36
|
+
if (n === f) {
|
37
|
+
// 关闭全屏后,表单值未变化,开启普通表单onFilter
|
38
|
+
filterEnableRef.current.normal = true;
|
39
|
+
} else {
|
40
|
+
// 关闭全屏后,表单值有变化,修改表单值
|
41
|
+
normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
|
42
|
+
} // 关闭全屏后,关闭全屏表单onFilter
|
43
|
+
|
44
|
+
|
45
|
+
filterEnableRef.current.fullscreen = false;
|
36
46
|
}; // 全屏开启之后
|
37
47
|
|
38
48
|
|
39
49
|
var afterOpen = function afterOpen() {
|
40
|
-
|
50
|
+
// 判断全屏前后筛选表单值是否有改变
|
51
|
+
var n = JSON.stringify(getValidValues(normalDataFilterForm.values));
|
52
|
+
var f = JSON.stringify(getValidValues(fullscreenDataFilterForm.values));
|
53
|
+
|
54
|
+
if (n === f) {
|
55
|
+
// 全屏后,表单值未变化,开启全屏表单onFilter
|
56
|
+
filterEnableRef.current.fullscreen = true;
|
57
|
+
} else {
|
58
|
+
// 全屏后,表单值变化,修改表单值
|
59
|
+
fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
|
60
|
+
} // 全屏后,关闭普通表单onFilter
|
61
|
+
|
62
|
+
|
63
|
+
filterEnableRef.current.normal = false; // 消息提示
|
64
|
+
|
41
65
|
Message.show({
|
42
66
|
type: 'notice',
|
43
67
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, getMessage('press')), /*#__PURE__*/React.createElement("span", {
|
@@ -67,9 +91,9 @@ var FullScreen = function FullScreen(props) {
|
|
67
91
|
zIndex: 999
|
68
92
|
},
|
69
93
|
onRequestClose: function onRequestClose() {
|
70
|
-
var _actionRef$
|
94
|
+
var _actionRef$current3, _actionRef$current3$f;
|
71
95
|
|
72
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
96
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$f = _actionRef$current3.fullScreen) === null || _actionRef$current3$f === void 0 ? void 0 : _actionRef$current3$f.call(_actionRef$current3);
|
73
97
|
}
|
74
98
|
}, /*#__PURE__*/React.createElement("div", {
|
75
99
|
className: "teamix-pro-table-full-screen"
|
package/es/table/index.js
CHANGED
@@ -40,7 +40,7 @@ import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessag
|
|
40
40
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
41
41
|
import './index.scss';
|
42
42
|
import Layout from './components/Layout';
|
43
|
-
import { emit, initActionRef, processDefaultFilter, useActionType } from './utils';
|
43
|
+
import { actionRefUseStateOn, emit, initActionRef, processDefaultFilter, useActionType } from './utils';
|
44
44
|
import getTableProps from './utils/getTableProps';
|
45
45
|
import getTableSortIcons from './utils/getTableSortIcons';
|
46
46
|
import useTableSelection from './utils/useTableSelection';
|
@@ -121,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
121
121
|
};
|
122
122
|
|
123
123
|
var ProTable = function ProTable(props) {
|
124
|
-
var _rowSelection$selecte
|
124
|
+
var _rowSelection$selecte;
|
125
125
|
|
126
126
|
var header = props.header,
|
127
127
|
className = props.className,
|
@@ -237,7 +237,24 @@ var ProTable = function ProTable(props) {
|
|
237
237
|
var _useState19 = useState(true),
|
238
238
|
_useState20 = _slicedToArray(_useState19, 2),
|
239
239
|
showLoading = _useState20[0],
|
240
|
-
setShowLoading = _useState20[1]; //
|
240
|
+
setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
|
241
|
+
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
242
|
+
|
243
|
+
|
244
|
+
var _useState21 = useState({
|
245
|
+
fullScreenState: false,
|
246
|
+
filterRules: {},
|
247
|
+
filterColumns: []
|
248
|
+
}),
|
249
|
+
_useState22 = _slicedToArray(_useState21, 1),
|
250
|
+
actionRefState = _useState22[0]; // 存储 on 监听事件
|
251
|
+
|
252
|
+
|
253
|
+
var _useState23 = useState({
|
254
|
+
fullScreenState: {}
|
255
|
+
}),
|
256
|
+
_useState24 = _slicedToArray(_useState23, 1),
|
257
|
+
actionRefCallback = _useState24[0]; // 存储定时器 id
|
241
258
|
|
242
259
|
|
243
260
|
var autoRefreshTimerRef = useRef(); // 获取header高度,用作全屏吸底吸底高度计算
|
@@ -261,18 +278,23 @@ var ProTable = function ProTable(props) {
|
|
261
278
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
262
279
|
|
263
280
|
|
264
|
-
var
|
265
|
-
|
266
|
-
headerHeight =
|
267
|
-
setHeaderHeight =
|
281
|
+
var _useState25 = useState(0),
|
282
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
283
|
+
headerHeight = _useState26[0],
|
284
|
+
setHeaderHeight = _useState26[1]; // 全屏显示 className
|
268
285
|
|
269
286
|
|
270
|
-
var
|
271
|
-
|
272
|
-
fullscreenState =
|
273
|
-
setFullscreenState =
|
287
|
+
var _useState27 = useState(false),
|
288
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
289
|
+
fullscreenState = _useState28[0],
|
290
|
+
setFullscreenState = _useState28[1]; // 切换全屏搜索开关
|
274
291
|
|
275
292
|
|
293
|
+
var filterEnableRef = useRef({
|
294
|
+
fullscreen: false,
|
295
|
+
normal: true
|
296
|
+
}); // 非全屏状态下的
|
297
|
+
|
276
298
|
var normalDataFilterFormRef = useRef();
|
277
299
|
var fullscreenDataFilterFormRef = useRef();
|
278
300
|
var normalDataFilterForm = normalDataFilterFormRef.current;
|
@@ -281,10 +303,10 @@ var ProTable = function ProTable(props) {
|
|
281
303
|
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
282
304
|
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
283
305
|
|
284
|
-
var
|
285
|
-
|
286
|
-
footerSuctionState =
|
287
|
-
setFooterSuctionState =
|
306
|
+
var _useState29 = useState(false),
|
307
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
308
|
+
footerSuctionState = _useState30[0],
|
309
|
+
setFooterSuctionState = _useState30[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
288
310
|
|
289
311
|
|
290
312
|
var getFooterSuctionState = function getFooterSuctionState() {
|
@@ -407,25 +429,63 @@ var ProTable = function ProTable(props) {
|
|
407
429
|
if (propsDataSource) {
|
408
430
|
setData(propsDataSource);
|
409
431
|
}
|
410
|
-
}, [propsDataSource]); //
|
432
|
+
}, [propsDataSource]); // 初始化 ActionRef。
|
433
|
+
|
434
|
+
initActionRef(actionRef, {
|
435
|
+
getState: function getState() {
|
436
|
+
return actionRefState;
|
437
|
+
},
|
438
|
+
getCallback: function getCallback() {
|
439
|
+
return actionRefCallback;
|
440
|
+
},
|
441
|
+
setState: function setState(key, value) {
|
442
|
+
actionRefState[key] = value;
|
443
|
+
actionRefUseStateOn(actionRefCallback, key, value);
|
444
|
+
},
|
445
|
+
on: function on(fun, state, name) {
|
446
|
+
if (!actionRefCallback[state]) {
|
447
|
+
actionRefCallback[state] = {};
|
448
|
+
}
|
449
|
+
|
450
|
+
actionRefCallback[state][name] = fun;
|
451
|
+
},
|
452
|
+
off: function off(name) {
|
453
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
|
454
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
455
|
+
k = _ref2[0],
|
456
|
+
v = _ref2[1];
|
457
|
+
|
458
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
|
459
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
460
|
+
k = _ref4[0];
|
461
|
+
|
462
|
+
return k !== name;
|
463
|
+
}));
|
464
|
+
return [k, filterV];
|
465
|
+
}));
|
466
|
+
}
|
467
|
+
}); // 绑定 Actions
|
411
468
|
|
412
469
|
useActionType(actionRef, {
|
413
470
|
fullScreen: function fullScreen() {
|
471
|
+
var _actionRef$current2, _actionRef$current2$s;
|
472
|
+
|
414
473
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
415
474
|
|
416
475
|
getHeaderHeight().then(function (height) {
|
417
476
|
setHeaderHeight(height);
|
418
477
|
});
|
419
478
|
setFullscreenState(state);
|
479
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
|
420
480
|
return state;
|
421
481
|
},
|
422
482
|
setColumn: function setColumn(newColumns) {
|
423
|
-
var _actionRef$
|
483
|
+
var _actionRef$current3, _actionRef$current3$s;
|
424
484
|
|
425
485
|
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
426
486
|
var columns = processColumns(newColumns, propsColumns);
|
427
487
|
setFilteredColumns(columns);
|
428
|
-
(_actionRef$
|
488
|
+
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
|
429
489
|
|
430
490
|
if (update) {
|
431
491
|
emit('refreshFilterState', newColumns);
|
@@ -450,12 +510,12 @@ var ProTable = function ProTable(props) {
|
|
450
510
|
_request(params);
|
451
511
|
},
|
452
512
|
reset: function reset() {
|
453
|
-
var _actionRef$
|
513
|
+
var _actionRef$current4, _actionRef$current4$s;
|
454
514
|
|
455
515
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
456
516
|
|
457
|
-
(_actionRef$
|
458
|
-
|
517
|
+
(_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, {});
|
518
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
459
519
|
setCurrentPage(1);
|
460
520
|
|
461
521
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -480,6 +540,7 @@ var ProTable = function ProTable(props) {
|
|
480
540
|
dataFilterForm: dataFilterForm,
|
481
541
|
normalDataFilterForm: normalDataFilterForm,
|
482
542
|
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
543
|
+
filterEnableRef: filterEnableRef,
|
483
544
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
484
545
|
getHeaderHeight().then(function (height) {
|
485
546
|
setHeaderHeight(height);
|
@@ -568,8 +629,8 @@ var ProTable = function ProTable(props) {
|
|
568
629
|
}
|
569
630
|
}); // 请求函数
|
570
631
|
|
571
|
-
function _request(params, noLoading) {
|
572
|
-
var
|
632
|
+
function _request(params, noLoading, filterParams) {
|
633
|
+
var _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
|
573
634
|
|
574
635
|
// 如果没有传 url 且没有 customRequest,直接返回
|
575
636
|
if (!url && !customRequest) {
|
@@ -582,9 +643,9 @@ var ProTable = function ProTable(props) {
|
|
582
643
|
|
583
644
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
584
645
|
|
585
|
-
var dataFilterParams =
|
646
|
+
var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values; // 列过滤请求参数
|
586
647
|
|
587
|
-
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$
|
648
|
+
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 : {}; // 格式化后的请求参数
|
588
649
|
|
589
650
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
|
590
651
|
|
@@ -633,33 +694,24 @@ var ProTable = function ProTable(props) {
|
|
633
694
|
}
|
634
695
|
|
635
696
|
useEffect(function () {
|
636
|
-
|
637
|
-
initActionRef();
|
638
|
-
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
697
|
+
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
639
698
|
|
699
|
+
// 监听 浏览器变化 更吸底状态
|
640
700
|
if (footerSuction) {
|
641
701
|
getFooterSuctionState();
|
642
702
|
|
643
703
|
window.onresize = function () {
|
644
704
|
getFooterSuctionState();
|
645
705
|
};
|
646
|
-
}
|
706
|
+
} // 如果不传 dataFilter,则在这里初始化请求
|
647
707
|
|
648
|
-
if (propsDataFilter) {
|
649
|
-
var _dataFilterForm3;
|
650
708
|
|
651
|
-
|
652
|
-
// 在请求发送之前 处理漏斗默认数据
|
653
|
-
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
709
|
+
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
654
710
|
|
655
|
-
|
656
|
-
|
657
|
-
} else {
|
658
|
-
if (requestWhenMount) {
|
659
|
-
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
711
|
+
if (requestWhenMount && !hasDataFilter) {
|
712
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
660
713
|
|
661
|
-
|
662
|
-
}
|
714
|
+
_request();
|
663
715
|
}
|
664
716
|
|
665
717
|
return function () {
|
@@ -673,7 +725,7 @@ var ProTable = function ProTable(props) {
|
|
673
725
|
|
674
726
|
actionRef.current = undefined;
|
675
727
|
};
|
676
|
-
}, [
|
728
|
+
}, []);
|
677
729
|
|
678
730
|
function onSort(dataIndex, order) {
|
679
731
|
var nextSort = _defineProperty({}, dataIndex, order);
|
@@ -687,24 +739,40 @@ var ProTable = function ProTable(props) {
|
|
687
739
|
var dataFilter = _objectSpread(_objectSpread({
|
688
740
|
mode: 'inline'
|
689
741
|
}, propsDataFilter), {}, {
|
742
|
+
onInit: function onInit(values) {
|
743
|
+
// 表单初始化请求处理
|
744
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
|
745
|
+
!fullscreenState && _request({}, false, values);
|
746
|
+
return true;
|
747
|
+
},
|
690
748
|
onFilter: function onFilter(values) {
|
691
|
-
var _actionRef$
|
749
|
+
var _actionRef$current6, _actionRef$current6$c;
|
750
|
+
|
751
|
+
// 全屏状态,判断全屏表单onFilter是否禁用
|
752
|
+
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
753
|
+
filterEnableRef.current.fullscreen = true;
|
754
|
+
return;
|
755
|
+
} // 非全屏状态,判断普通表单onFiler是否禁用
|
756
|
+
|
757
|
+
|
758
|
+
if (!fullscreenState && !filterEnableRef.current.normal) {
|
759
|
+
filterEnableRef.current.normal = true;
|
760
|
+
return;
|
761
|
+
}
|
692
762
|
|
693
763
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
694
764
|
|
695
|
-
(_actionRef$
|
765
|
+
(_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);
|
696
766
|
setCurrentPage(1);
|
697
767
|
|
698
|
-
_request(_defineProperty({}, targetPageKey, 1));
|
768
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
699
769
|
},
|
700
|
-
onReset: function onReset() {
|
701
|
-
var _dataFilterForm5;
|
702
|
-
|
770
|
+
onReset: function onReset(values) {
|
703
771
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
704
|
-
|
772
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
705
773
|
setCurrentPage(1);
|
706
774
|
|
707
|
-
_request(_defineProperty({}, targetPageKey, 1));
|
775
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
708
776
|
}
|
709
777
|
});
|
710
778
|
|
@@ -788,21 +856,21 @@ var ProTable = function ProTable(props) {
|
|
788
856
|
|
789
857
|
var renderFooter = function renderFooter() {
|
790
858
|
function onChangePagination(currentPage) {
|
791
|
-
var _actionRef$
|
859
|
+
var _actionRef$current7, _actionRef$current7$c;
|
792
860
|
|
793
861
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
794
862
|
// 翻页暂时先清空选择
|
795
|
-
(_actionRef$
|
863
|
+
(_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);
|
796
864
|
setCurrentPage(currentPage);
|
797
865
|
|
798
866
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
799
867
|
}
|
800
868
|
|
801
869
|
function onChangePaginationSize(currentPageSize) {
|
802
|
-
var _actionRef$
|
870
|
+
var _actionRef$current8, _actionRef$current8$c, _request5;
|
803
871
|
|
804
872
|
// 翻页暂时先清空选择
|
805
|
-
(_actionRef$
|
873
|
+
(_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);
|
806
874
|
setPageSize(currentPageSize);
|
807
875
|
setCurrentPage(1);
|
808
876
|
|
package/es/table/typing.d.ts
CHANGED
@@ -192,6 +192,7 @@ export declare type ProTableActionType = {
|
|
192
192
|
dataFilterForm?: FormType;
|
193
193
|
normalDataFilterForm?: FormType;
|
194
194
|
fullscreenDataFilterForm?: FormType;
|
195
|
+
filterEnableRef?: any;
|
195
196
|
/** 表格当前的数据 */
|
196
197
|
data?: any[];
|
197
198
|
} & ProTableActionTypeMutations;
|
@@ -201,8 +202,6 @@ export declare type ProTableActionTypeMutations = {
|
|
201
202
|
getState?: () => ProTableActionTypeState;
|
202
203
|
/** 设置state 状态 */
|
203
204
|
setState?: (key: string, value: any) => void;
|
204
|
-
/** 初始化 state 状态 */
|
205
|
-
initState?: () => void;
|
206
205
|
/** 设置全屏状态 */
|
207
206
|
setFullScreenState?: (state: boolean) => void;
|
208
207
|
/** 绑定state监听事件 */
|
@@ -217,6 +216,8 @@ export declare type ProTableActionTypeMutations = {
|
|
217
216
|
resetTableMaxBodyHeight?: () => void;
|
218
217
|
/** 列筛选规则 */
|
219
218
|
filterColumns?: any[];
|
219
|
+
/** 获取所有 on 监听事件 */
|
220
|
+
getCallback?: () => any;
|
220
221
|
};
|
221
222
|
/** action Mutations 定义 */
|
222
223
|
export declare type ProTableActionTypeState = {
|
@@ -144,7 +144,7 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
144
144
|
|
145
145
|
if (valueType === 'selectGroup') {
|
146
146
|
newRender = _objectSpread(_objectSpread({
|
147
|
-
maxShowNumber:
|
147
|
+
maxShowNumber: 'auto',
|
148
148
|
foldText: 'more',
|
149
149
|
editOnClick: function editOnClick() {},
|
150
150
|
edit: true
|
@@ -223,7 +223,7 @@ var processRenderFunction = function processRenderFunction() {
|
|
223
223
|
var index = arguments.length > 2 ? arguments[2] : undefined;
|
224
224
|
var record = arguments.length > 3 ? arguments[3] : undefined;
|
225
225
|
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
226
|
-
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
|
226
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
|
227
227
|
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
228
228
|
var _ref4 = _slicedToArray(_ref3, 2),
|
229
229
|
k = _ref4[0],
|
@@ -1,13 +1,14 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
3
|
import { ProTableProps, ProTableColumnProps } from '..';
|
4
|
-
export declare function
|
4
|
+
export declare function actionRefUseStateOn(callback: any, state: string, ...args: any): void;
|
5
5
|
/** table 组件内监听 不对外暴露 */
|
6
6
|
export declare function on(fun: any, key: string): void;
|
7
7
|
/** table 组件内销毁监听 不对外暴露 */
|
8
8
|
export declare function off(key: string): void;
|
9
9
|
/** table 组件内触发事件 不对外暴露 */
|
10
10
|
export declare function emit(key: string, ...args: any): void;
|
11
|
+
export declare function initActionRef(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
11
12
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
12
13
|
export declare function cloneDeep<T>(obj: T): T;
|
13
14
|
/**
|