@teamix/pro 1.2.26 → 1.2.27
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/212.js +129 -129
- package/dist/pro.css +1 -1
- package/dist/pro.js +18371 -16873
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -0
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/Layout.d.ts +5 -0
- package/es/form/Filter/Layout.js +82 -0
- package/es/form/Filter/SimpleFilter.js +30 -6
- package/es/form/Filter/index2.d.ts +2 -1
- package/es/form/Filter/index2.js +97 -116
- package/es/form/Filter/index2.scss +16 -45
- package/es/form/Filter/layout.scss +36 -0
- package/es/form/Filter/useSpecialProps.d.ts +6 -0
- package/es/form/Filter/useSpecialProps.js +37 -0
- package/es/form/ProForm/customComponent.d.ts +3 -0
- package/es/form/ProForm/customComponent.js +20 -0
- package/es/form/ProForm/index.scss +5 -6
- package/es/form/ProForm/useFormDisplayValues.js +14 -24
- package/es/form/SchemaForm/adapterType.js +1 -0
- package/es/form/fieldTypeMap.js +2 -1
- package/es/form/index.d.ts +4 -2
- package/es/form/index.js +4 -2
- package/es/form/typing.d.ts +25 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/table/components/Layout/index.js +63 -167
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.js +1 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +64 -95
- package/es/table/typing.d.ts +12 -10
- package/es/table/utils/columnRender.js +21 -3
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/Layout.d.ts +5 -0
- package/lib/form/Filter/Layout.js +102 -0
- package/lib/form/Filter/SimpleFilter.js +29 -4
- package/lib/form/Filter/index2.d.ts +2 -1
- package/lib/form/Filter/index2.js +101 -114
- package/lib/form/Filter/index2.scss +16 -45
- package/lib/form/Filter/layout.scss +36 -0
- package/lib/form/Filter/useSpecialProps.d.ts +6 -0
- package/lib/form/Filter/useSpecialProps.js +46 -0
- package/lib/form/ProForm/customComponent.d.ts +3 -0
- package/lib/form/ProForm/customComponent.js +28 -0
- package/lib/form/ProForm/index.scss +5 -6
- package/lib/form/ProForm/useFormDisplayValues.js +17 -24
- package/lib/form/SchemaForm/adapterType.js +1 -0
- package/lib/form/fieldTypeMap.js +2 -1
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +19 -1
- package/lib/form/typing.d.ts +25 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/table/components/Layout/index.js +61 -167
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.js +1 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +61 -93
- package/lib/table/typing.d.ts +12 -10
- package/lib/table/utils/columnRender.js +21 -3
- package/package.json +4 -4
@@ -27,17 +27,11 @@ var FullScreenIcon = function FullScreenIcon(props) {
|
|
27
27
|
|
28
28
|
var _useState = useState(false),
|
29
29
|
_useState2 = _slicedToArray(_useState, 2),
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
var _useState3 = useState(false),
|
34
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
35
|
-
fullscreen = _useState4[0],
|
36
|
-
setFullscreen = _useState4[1]; // 点击全屏
|
30
|
+
fullscreen = _useState2[0],
|
31
|
+
setFullscreen = _useState2[1]; // 点击全屏
|
37
32
|
|
38
33
|
|
39
34
|
var allScreenHandle = function allScreenHandle() {
|
40
|
-
setVisible(false);
|
41
35
|
setTimeout(function () {
|
42
36
|
var _actionRef$current, _actionRef$current$fu;
|
43
37
|
|
@@ -55,7 +49,8 @@ var FullScreenIcon = function FullScreenIcon(props) {
|
|
55
49
|
}, []); // 监听全屏变化
|
56
50
|
|
57
51
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$o = _actionRef$current3.on) === null || _actionRef$current3$o === void 0 ? void 0 : _actionRef$current3$o.call(_actionRef$current3, function (state) {
|
58
|
-
|
52
|
+
// console.log('dataFilterForm', actionRef.current?.dataFilterForm);
|
53
|
+
setFullscreen(state); // actionRef.current?.dataFilterForm?.setValues(formValues);
|
59
54
|
}, 'fullScreenState', 'fullscreenIcon');
|
60
55
|
return /*#__PURE__*/React.createElement(Button, {
|
61
56
|
iconSize: "small",
|
@@ -7,28 +7,37 @@ var FullScreen = function FullScreen(props) {
|
|
7
7
|
var children = props.children,
|
8
8
|
visible = props.visible,
|
9
9
|
actionRef = props.actionRef;
|
10
|
+
var _actionRef$current = actionRef.current,
|
11
|
+
normalDataFilterForm = _actionRef$current.normalDataFilterForm,
|
12
|
+
fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
|
10
13
|
|
11
14
|
function closeByESC(e) {
|
12
15
|
if (visible && e.code === 'Escape') {
|
13
|
-
var _actionRef$
|
16
|
+
var _actionRef$current2, _actionRef$current2$s, _actionRef$current3, _actionRef$current3$f;
|
14
17
|
|
15
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
16
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
18
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setFullScreenState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, false);
|
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);
|
17
20
|
}
|
18
21
|
} // 监听esc按钮
|
19
22
|
|
20
23
|
|
21
24
|
useEffect(function () {
|
22
|
-
var _actionRef$
|
25
|
+
var _actionRef$current4, _actionRef$current4$s;
|
23
26
|
|
24
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
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);
|
25
28
|
window.addEventListener('keydown', closeByESC);
|
26
29
|
return function () {
|
27
30
|
window.removeEventListener('keydown', closeByESC);
|
28
31
|
};
|
29
|
-
}, [visible]);
|
32
|
+
}, [visible]);
|
33
|
+
|
34
|
+
var afterClose = function afterClose() {
|
35
|
+
normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
|
36
|
+
}; // 全屏开启之后
|
37
|
+
|
30
38
|
|
31
39
|
var afterOpen = function afterOpen() {
|
40
|
+
fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
|
32
41
|
Message.show({
|
33
42
|
type: 'notice',
|
34
43
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, getMessage('press')), /*#__PURE__*/React.createElement("span", {
|
@@ -40,13 +49,15 @@ var FullScreen = function FullScreen(props) {
|
|
40
49
|
});
|
41
50
|
};
|
42
51
|
|
43
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(Overlay, {
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children(false), /*#__PURE__*/React.createElement(Overlay, {
|
44
53
|
canCloseByOutSideClick: false,
|
45
54
|
align: "cc cc",
|
46
55
|
cache: true,
|
47
56
|
v2: false,
|
48
57
|
disableScroll: true,
|
49
58
|
shouldUpdatePosition: true,
|
59
|
+
afterClose: afterClose,
|
60
|
+
afterOpen: afterOpen,
|
50
61
|
animation: {
|
51
62
|
in: 'fadeIn',
|
52
63
|
out: 'fadeOut'
|
@@ -55,15 +66,14 @@ var FullScreen = function FullScreen(props) {
|
|
55
66
|
wrapperStyle: {
|
56
67
|
zIndex: 999
|
57
68
|
},
|
58
|
-
afterOpen: afterOpen,
|
59
69
|
onRequestClose: function onRequestClose() {
|
60
|
-
var _actionRef$
|
70
|
+
var _actionRef$current5, _actionRef$current5$f;
|
61
71
|
|
62
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
72
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$f = _actionRef$current5.fullScreen) === null || _actionRef$current5$f === void 0 ? void 0 : _actionRef$current5$f.call(_actionRef$current5);
|
63
73
|
}
|
64
74
|
}, /*#__PURE__*/React.createElement("div", {
|
65
75
|
className: "teamix-pro-table-full-screen"
|
66
|
-
}, children)));
|
76
|
+
}, children(true))));
|
67
77
|
};
|
68
78
|
|
69
79
|
export default FullScreen;
|
package/es/table/index.js
CHANGED
@@ -32,11 +32,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
32
32
|
|
33
33
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
34
34
|
|
35
|
-
import React, { useState, useEffect, useRef
|
35
|
+
import React, { useState, useEffect, useRef } from 'react';
|
36
36
|
import { Table, Checkbox } from '@alicloudfe/components';
|
37
37
|
import Pagination from './components/Pagination';
|
38
38
|
import genProColumnToColumn from './utils/genProColumnToColumn';
|
39
|
-
import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps } from '@teamix/utils';
|
39
|
+
import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, getCookie } from '@teamix/utils';
|
40
40
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
41
41
|
import './index.scss';
|
42
42
|
import Layout from './components/Layout';
|
@@ -46,14 +46,15 @@ import getTableSortIcons from './utils/getTableSortIcons';
|
|
46
46
|
import useTableSelection from './utils/useTableSelection';
|
47
47
|
import FullScreen from './components/ToolBar/Fullscreen';
|
48
48
|
import EmptyContent from './components/EmptyContent';
|
49
|
-
import {
|
49
|
+
import { formilyReactive } from '../form';
|
50
50
|
import { ProActionGroup } from '../actions';
|
51
|
-
import debounce from 'lodash.debounce';
|
52
51
|
import classNames from 'classnames';
|
53
52
|
import ProPageContainer from '../page-container';
|
54
53
|
export * from './typing';
|
55
54
|
var cls = baseClass('teamix-pro-table');
|
56
|
-
var toJS = formilyReactive.toJS;
|
55
|
+
var toJS = formilyReactive.toJS; // 判断是否是 root 组织
|
56
|
+
|
57
|
+
var isRoot = getCookie('organizationId') === '1';
|
57
58
|
/**
|
58
59
|
* 处理原生传入的 columns 以便于 选择列 方便处理
|
59
60
|
* @param columns 原生传入的 columns
|
@@ -61,14 +62,24 @@ var toJS = formilyReactive.toJS;
|
|
61
62
|
*/
|
62
63
|
|
63
64
|
var processColumns = function processColumns(columns, initialColumns) {
|
65
|
+
var _filterColumns;
|
66
|
+
|
64
67
|
var filterColumns = columns.filter(function (item) {
|
65
68
|
return item.columnFilters !== false;
|
66
|
-
});
|
69
|
+
});
|
70
|
+
|
71
|
+
if (isRoot) {
|
72
|
+
// root 组织下不显示标签管理
|
73
|
+
filterColumns = filterColumns.filter(function (item) {
|
74
|
+
return item.valueType !== 'selectGroup';
|
75
|
+
});
|
76
|
+
} // 处理只剩一列批量选择的情况下宽度错乱问题
|
67
77
|
|
68
|
-
if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
|
69
|
-
var _initialColumns$;
|
70
78
|
|
71
|
-
|
79
|
+
if ((_filterColumns = filterColumns) === null || _filterColumns === void 0 ? void 0 : _filterColumns.length) {
|
80
|
+
var _filterColumns2, _initialColumns$;
|
81
|
+
|
82
|
+
if (((_filterColumns2 = filterColumns) === null || _filterColumns2 === void 0 ? void 0 : _filterColumns2.length) === 1) {
|
72
83
|
var _filterColumns$, _filterColumns$2;
|
73
84
|
|
74
85
|
if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
|
@@ -208,10 +219,8 @@ var ProTable = function ProTable(props) {
|
|
208
219
|
var _useState13 = useState(true),
|
209
220
|
_useState14 = _slicedToArray(_useState13, 2),
|
210
221
|
customTableLoading = _useState14[0],
|
211
|
-
setCustomTableLoading = _useState14[1];
|
212
|
-
|
222
|
+
setCustomTableLoading = _useState14[1];
|
213
223
|
|
214
|
-
var searchValueRef = useRef('');
|
215
224
|
var tableRef = useRef(null);
|
216
225
|
var actionRef = useRef(); // 传给 table 的过滤后的 columns
|
217
226
|
|
@@ -261,20 +270,23 @@ var ProTable = function ProTable(props) {
|
|
261
270
|
var _useState23 = useState(false),
|
262
271
|
_useState24 = _slicedToArray(_useState23, 2),
|
263
272
|
fullscreenState = _useState24[0],
|
264
|
-
setFullscreenState = _useState24[1]; //
|
273
|
+
setFullscreenState = _useState24[1]; // 非全屏状态下的
|
274
|
+
|
275
|
+
|
276
|
+
var normalDataFilterFormRef = useRef();
|
277
|
+
var fullscreenDataFilterFormRef = useRef();
|
278
|
+
var normalDataFilterForm = normalDataFilterFormRef.current;
|
279
|
+
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
|
265
280
|
|
281
|
+
var dataFilterFormRef = fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
282
|
+
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
266
283
|
|
267
284
|
var _useState25 = useState(false),
|
268
285
|
_useState26 = _slicedToArray(_useState25, 2),
|
269
286
|
footerSuctionState = _useState26[0],
|
270
|
-
setFooterSuctionState = _useState26[1];
|
271
|
-
/** 筛选区域 form */
|
287
|
+
setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
272
288
|
|
273
289
|
|
274
|
-
var dataFilterForm = useMemo(function () {
|
275
|
-
return createForm();
|
276
|
-
}, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
277
|
-
|
278
290
|
var getFooterSuctionState = function getFooterSuctionState() {
|
279
291
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
280
292
|
|
@@ -426,18 +438,16 @@ var ProTable = function ProTable(props) {
|
|
426
438
|
return _request(params);
|
427
439
|
},
|
428
440
|
request: function request(params) {
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
436
|
-
setPageSize(params[targetPageSizeKey]);
|
437
|
-
}
|
441
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
442
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
443
|
+
setCurrentPage(params[targetPageKey]);
|
444
|
+
}
|
438
445
|
|
439
|
-
|
446
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
447
|
+
setPageSize(params[targetPageSizeKey]);
|
440
448
|
}
|
449
|
+
|
450
|
+
_request(params);
|
441
451
|
},
|
442
452
|
reset: function reset() {
|
443
453
|
var _actionRef$current3, _actionRef$current3$s;
|
@@ -445,7 +455,7 @@ var ProTable = function ProTable(props) {
|
|
445
455
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
446
456
|
|
447
457
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
|
448
|
-
dataFilterForm.reset();
|
458
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
449
459
|
setCurrentPage(1);
|
450
460
|
|
451
461
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -468,6 +478,8 @@ var ProTable = function ProTable(props) {
|
|
468
478
|
},
|
469
479
|
data: data,
|
470
480
|
dataFilterForm: dataFilterForm,
|
481
|
+
normalDataFilterForm: normalDataFilterForm,
|
482
|
+
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
471
483
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
472
484
|
getHeaderHeight().then(function (height) {
|
473
485
|
setHeaderHeight(height);
|
@@ -570,7 +582,7 @@ var ProTable = function ProTable(props) {
|
|
570
582
|
|
571
583
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
572
584
|
|
573
|
-
var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
|
585
|
+
var dataFilterParams = toJS(dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values); // 列过滤请求参数
|
574
586
|
|
575
587
|
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
576
588
|
|
@@ -639,14 +651,6 @@ var ProTable = function ProTable(props) {
|
|
639
651
|
_request();
|
640
652
|
}
|
641
653
|
|
642
|
-
var searchName = getSearchName();
|
643
|
-
|
644
|
-
if (searchName) {
|
645
|
-
// 如果有初始值,需要赋值
|
646
|
-
var initialValues = toJS(dataFilterForm.initialValues);
|
647
|
-
searchValueRef.current = initialValues[searchName][1];
|
648
|
-
}
|
649
|
-
|
650
654
|
return function () {
|
651
655
|
if (autoRefreshTimerRef.current) {
|
652
656
|
clearTimeout(autoRefreshTimerRef.current);
|
@@ -666,62 +670,25 @@ var ProTable = function ProTable(props) {
|
|
666
670
|
setSort(nextSort);
|
667
671
|
|
668
672
|
_request(targetFormatSort(nextSort));
|
669
|
-
} //
|
670
|
-
|
671
|
-
|
672
|
-
var getSearchName = function getSearchName() {
|
673
|
-
var _dataFilter$schema;
|
674
|
-
|
675
|
-
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) && ((_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) > 0) {
|
676
|
-
var searchSchema = dataFilter.schema.find(function (item) {
|
677
|
-
return item.component === 'Search';
|
678
|
-
});
|
679
|
-
|
680
|
-
if (searchSchema) {
|
681
|
-
var searchName = searchSchema.name;
|
682
|
-
return searchName;
|
683
|
-
}
|
684
|
-
}
|
685
|
-
}; // 处理 dataFilter 中的 onFilter、onReset
|
673
|
+
} // 处理 dataFilter 中的 onFilter、onReset
|
686
674
|
|
687
675
|
|
688
676
|
var dataFilter = _objectSpread(_objectSpread({
|
689
677
|
mode: 'inline'
|
690
678
|
}, propsDataFilter), {}, {
|
691
|
-
onFilter:
|
692
|
-
|
693
|
-
|
694
|
-
if (dataFilterForm.validate()) {
|
695
|
-
var _actionRef$current5, _actionRef$current5$c;
|
696
|
-
|
697
|
-
/**
|
698
|
-
* 针对 inline 模式下的 Search 组件做特殊处理
|
699
|
-
* 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
|
700
|
-
*/
|
701
|
-
if (dataFilter.mode === 'inline') {
|
702
|
-
var searchName = getSearchName();
|
679
|
+
onFilter: function onFilter(values) {
|
680
|
+
var _actionRef$current5, _actionRef$current5$c;
|
703
681
|
|
704
|
-
|
705
|
-
var searchValue = values[searchName][1];
|
682
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
706
683
|
|
707
|
-
|
708
|
-
|
709
|
-
}
|
710
|
-
|
711
|
-
searchValueRef.current = searchValue;
|
712
|
-
}
|
713
|
-
} // 搜索变化时,暂时先清空选择
|
714
|
-
|
715
|
-
|
716
|
-
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
|
717
|
-
setCurrentPage(1);
|
684
|
+
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
|
685
|
+
setCurrentPage(1);
|
718
686
|
|
719
|
-
|
720
|
-
|
721
|
-
}, filterDebounce),
|
687
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
688
|
+
},
|
722
689
|
onReset: function onReset() {
|
723
690
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
724
|
-
dataFilterForm.reset();
|
691
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
725
692
|
setCurrentPage(1);
|
726
693
|
|
727
694
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -736,7 +703,7 @@ var ProTable = function ProTable(props) {
|
|
736
703
|
}
|
737
704
|
};
|
738
705
|
|
739
|
-
var renderTable = function renderTable() {
|
706
|
+
var renderTable = function renderTable(isFullScreen) {
|
740
707
|
if (propsColumns) {
|
741
708
|
return /*#__PURE__*/React.createElement("div", {
|
742
709
|
className: classNames('teamix-pro-table-container', className)
|
@@ -748,7 +715,7 @@ var ProTable = function ProTable(props) {
|
|
748
715
|
actionRef: actionRef,
|
749
716
|
columns: propsColumns,
|
750
717
|
dataFilter: dataFilter,
|
751
|
-
|
718
|
+
dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
|
752
719
|
rowSelection: rowSelection,
|
753
720
|
filterColumnType: filterColumnType
|
754
721
|
}), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
@@ -893,14 +860,16 @@ var ProTable = function ProTable(props) {
|
|
893
860
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
894
861
|
visible: fullscreenState,
|
895
862
|
actionRef: actionRef
|
896
|
-
},
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
863
|
+
}, function (isFullScreen) {
|
864
|
+
return /*#__PURE__*/React.createElement("div", {
|
865
|
+
className: cls({
|
866
|
+
'': true,
|
867
|
+
fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
|
868
|
+
|
869
|
+
}),
|
870
|
+
ref: tableRef
|
871
|
+
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
872
|
+
});
|
904
873
|
};
|
905
874
|
|
906
875
|
export default ProTable;
|
package/es/table/typing.d.ts
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
|
-
import {
|
6
|
+
import { QueryFilterProps } from '../form';
|
7
7
|
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
@@ -56,6 +56,8 @@ export declare type ProTableColumnProps = {
|
|
56
56
|
dataIndex?: string | string[];
|
57
57
|
/** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
|
58
58
|
format?: string;
|
59
|
+
/** ProField 其他配置项 */
|
60
|
+
props?: any;
|
59
61
|
} & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
|
60
62
|
export declare type ProColumnProps = ProTableColumnProps;
|
61
63
|
export declare type ProTableProps = {
|
@@ -105,7 +107,10 @@ export declare type ProTableProps = {
|
|
105
107
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
106
108
|
/** 表格底部(右层)配置 */
|
107
109
|
footer?: React.ReactNode;
|
108
|
-
/**
|
110
|
+
/**
|
111
|
+
* @deprecated 已废弃 建议用 dataFilter 中的 filterDebounce 代替
|
112
|
+
* 筛选区自动搜索的防抖时间(毫秒)
|
113
|
+
*/
|
109
114
|
filterDebounce?: number;
|
110
115
|
/** ProTable action 的引用,便于手动触发一些方法 */
|
111
116
|
actionRef?: React.MutableRefObject<ProTableActionType | undefined>;
|
@@ -185,6 +190,8 @@ export declare type ProTableActionType = {
|
|
185
190
|
resetPage?: () => void;
|
186
191
|
/** 获取数据过滤区表单实例 */
|
187
192
|
dataFilterForm?: FormType;
|
193
|
+
normalDataFilterForm?: FormType;
|
194
|
+
fullscreenDataFilterForm?: FormType;
|
188
195
|
/** 表格当前的数据 */
|
189
196
|
data?: any[];
|
190
197
|
} & ProTableActionTypeMutations;
|
@@ -219,17 +226,12 @@ export declare type ProTableActionTypeState = {
|
|
219
226
|
[key: string]: any;
|
220
227
|
};
|
221
228
|
export declare type ProTableDataFilterProps = {
|
222
|
-
/** 展示形式 */
|
223
|
-
mode?: 'inline' | 'panel';
|
224
|
-
/** mode='panel' 时是否默认展开 */
|
225
|
-
expand?: boolean;
|
226
|
-
/** 搜索时是否传入值为undefined的参数,默认不传 */
|
227
229
|
searchUndefined?: boolean;
|
228
230
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
229
231
|
searchEmptyString?: boolean;
|
230
232
|
/** 自定义内容 */
|
231
233
|
content?: React.ReactNode;
|
232
|
-
} &
|
234
|
+
} & QueryFilterProps;
|
233
235
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
234
236
|
export declare type ProTableTopAreaProps = {
|
235
237
|
/** 标题区 */
|
@@ -242,8 +244,8 @@ export declare type ProTableTopAreaProps = {
|
|
242
244
|
extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
|
243
245
|
/** 数据过滤区 */
|
244
246
|
dataFilter?: ProTableDataFilterProps;
|
245
|
-
/**
|
246
|
-
|
247
|
+
/** 传给 QueryFilter 的 formRef */
|
248
|
+
dataFilterFormRef?: any;
|
247
249
|
/** 排序、筛选列展示状态 */
|
248
250
|
filterColumnType?: 'dialog' | 'dropdown' | 'auto';
|
249
251
|
};
|
@@ -132,7 +132,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
132
132
|
}
|
133
133
|
|
134
134
|
var newRender = null;
|
135
|
-
var newDataSource = null;
|
135
|
+
var newDataSource = null;
|
136
|
+
var props = item.props; // 如果 render 直接传函数
|
136
137
|
|
137
138
|
if (typeof render === 'function') {
|
138
139
|
newRender = function newRender() {
|
@@ -140,6 +141,23 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
140
141
|
};
|
141
142
|
} else {
|
142
143
|
newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
|
144
|
+
|
145
|
+
if (valueType === 'selectGroup') {
|
146
|
+
newRender = _objectSpread(_objectSpread({
|
147
|
+
maxShowNumber: 1,
|
148
|
+
foldText: 'more',
|
149
|
+
editOnClick: function editOnClick() {},
|
150
|
+
edit: true
|
151
|
+
}, newRender), {}, {
|
152
|
+
ellipsis: false
|
153
|
+
});
|
154
|
+
props = _objectSpread({
|
155
|
+
valueAlias: {
|
156
|
+
value: 'TagValue',
|
157
|
+
key: 'TagKey'
|
158
|
+
}
|
159
|
+
}, props);
|
160
|
+
}
|
143
161
|
} // 渲染操作组
|
144
162
|
|
145
163
|
|
@@ -182,13 +200,13 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
182
200
|
} // 渲染 ProField
|
183
201
|
|
184
202
|
|
185
|
-
return /*#__PURE__*/React.createElement(ProField, {
|
203
|
+
return /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
186
204
|
type: valueType || 'text',
|
187
205
|
value: value,
|
188
206
|
render: newRender,
|
189
207
|
dataSource: newDataSource,
|
190
208
|
format: format
|
191
|
-
});
|
209
|
+
}, props));
|
192
210
|
};
|
193
211
|
/**
|
194
212
|
* 处理 render 配置项是函数的情况
|
@@ -72,7 +72,7 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
72
72
|
props: {
|
73
73
|
breakpoints: [480, 720, 990, 1200, Infinity],
|
74
74
|
maxColumns: [1, 2, 3, 3, 4],
|
75
|
-
maxWidth: [480, 360, 330,
|
75
|
+
maxWidth: [480, 360, 330, 400],
|
76
76
|
columnGap: 16,
|
77
77
|
rowGap: 12
|
78
78
|
},
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
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); }
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.QueryFilterLayout = void 0;
|
9
|
+
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
|
14
|
+
var _components = require("@alicloudfe/components");
|
15
|
+
|
16
|
+
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
17
|
+
|
18
|
+
var _utils = require("@teamix/utils");
|
19
|
+
|
20
|
+
require("./layout.scss");
|
21
|
+
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
+
|
24
|
+
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); }
|
25
|
+
|
26
|
+
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; }
|
27
|
+
|
28
|
+
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; }
|
29
|
+
|
30
|
+
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; }
|
31
|
+
|
32
|
+
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; }
|
33
|
+
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
35
|
+
|
36
|
+
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."); }
|
37
|
+
|
38
|
+
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); }
|
39
|
+
|
40
|
+
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; }
|
41
|
+
|
42
|
+
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; }
|
43
|
+
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
45
|
+
|
46
|
+
var QueryFilterLayout = function QueryFilterLayout(_ref) {
|
47
|
+
var className = _ref.className,
|
48
|
+
addonBefore = _ref.addonBefore,
|
49
|
+
addonAfter = _ref.addonAfter,
|
50
|
+
inlineContent = _ref.inlineContent,
|
51
|
+
panelContent = _ref.panelContent,
|
52
|
+
count = _ref.count,
|
53
|
+
expand = _ref.expand,
|
54
|
+
onExpand = _ref.onExpand,
|
55
|
+
children = _ref.children;
|
56
|
+
var prefixCls = (0, _utils.usePrefixCls)('', {
|
57
|
+
prefix: 'teamix-pro-form-query-filter-layout'
|
58
|
+
});
|
59
|
+
|
60
|
+
var _useState = (0, _react.useState)(!!expand),
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
62
|
+
visible = _useState2[0],
|
63
|
+
setVisible = _useState2[1];
|
64
|
+
|
65
|
+
var onClick = (0, _react.useCallback)(function () {
|
66
|
+
setVisible(!visible);
|
67
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand(!visible);
|
68
|
+
}, [visible]);
|
69
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
70
|
+
className: (0, _classnames.default)(prefixCls, className)
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
72
|
+
className: "".concat(prefixCls, "-inline")
|
73
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
74
|
+
className: "".concat(prefixCls, "-left")
|
75
|
+
}, addonBefore ? /*#__PURE__*/_react.default.createElement("div", {
|
76
|
+
className: "".concat(prefixCls, "-addonBefore")
|
77
|
+
}, addonBefore) : null, inlineContent, (0, _utils.isValid)(panelContent) ? /*#__PURE__*/_react.default.createElement("div", {
|
78
|
+
className: "".concat(prefixCls, "-toggle")
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Badge, {
|
80
|
+
count: count,
|
81
|
+
style: _objectSpread({
|
82
|
+
backgroundColor: 'var(--color-brand1-6, #0064c8)',
|
83
|
+
color: 'var(--color-white, #fff)'
|
84
|
+
}, visible ? {
|
85
|
+
display: 'none'
|
86
|
+
} : {})
|
87
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Button, {
|
88
|
+
onClick: onClick
|
89
|
+
}, visible ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
90
|
+
type: "up-line"
|
91
|
+
}) : /*#__PURE__*/_react.default.createElement(_icon.default, {
|
92
|
+
type: "filter-line"
|
93
|
+
}), (0, _utils.getMessage)('advancedFilter')))) : null), addonAfter ? /*#__PURE__*/_react.default.createElement("div", {
|
94
|
+
className: "".concat(prefixCls, "-addonAfter")
|
95
|
+
}, addonAfter) : null), /*#__PURE__*/_react.default.createElement("div", {
|
96
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-panel"), visible && (0, _utils.isValid)(panelContent) ? '' : "".concat(prefixCls, "-panel-hidden"))
|
97
|
+
}, panelContent), /*#__PURE__*/_react.default.createElement("div", {
|
98
|
+
className: "".concat(prefixCls, "-children")
|
99
|
+
}, children));
|
100
|
+
};
|
101
|
+
|
102
|
+
exports.QueryFilterLayout = QueryFilterLayout;
|