@teamix/pro 1.2.23 → 1.2.28
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 +18109 -15665
- 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/actions/dialog.js +4 -3
- package/es/actions/index.d.ts +12 -9
- package/es/actions/index.js +56 -15
- package/es/actions/index.scss +12 -1
- 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/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- 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/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- 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 +2 -2
- package/es/table/components/Pagination/index.scss +5 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +82 -104
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +16 -10
- package/es/table/utils/columnRender.js +21 -3
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +36 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +4 -3
- package/lib/actions/index.d.ts +12 -9
- package/lib/actions/index.js +56 -15
- package/lib/actions/index.scss +12 -1
- 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/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- 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/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- 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 +2 -2
- package/lib/table/components/Pagination/index.scss +5 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +78 -101
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +16 -10
- package/lib/table/utils/columnRender.js +21 -3
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +38 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +4 -4
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
4
|
|
@@ -32,28 +32,29 @@ 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';
|
43
|
-
import { emit, initActionRef, useActionType } from './utils';
|
43
|
+
import { 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';
|
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) {
|
@@ -110,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
110
121
|
};
|
111
122
|
|
112
123
|
var ProTable = function ProTable(props) {
|
113
|
-
var _rowSelection$selecte;
|
124
|
+
var _rowSelection$selecte, _dataFilterForm4;
|
114
125
|
|
115
126
|
var header = props.header,
|
116
127
|
className = props.className,
|
@@ -164,6 +175,7 @@ var ProTable = function ProTable(props) {
|
|
164
175
|
customRequest = props.customRequest,
|
165
176
|
_props$filterColumnTy = props.filterColumnType,
|
166
177
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
178
|
+
defaultFilterParams = props.defaultFilterParams,
|
167
179
|
otherProps = _objectWithoutProperties(props, _excluded);
|
168
180
|
|
169
181
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -207,10 +219,8 @@ var ProTable = function ProTable(props) {
|
|
207
219
|
var _useState13 = useState(true),
|
208
220
|
_useState14 = _slicedToArray(_useState13, 2),
|
209
221
|
customTableLoading = _useState14[0],
|
210
|
-
setCustomTableLoading = _useState14[1];
|
211
|
-
|
222
|
+
setCustomTableLoading = _useState14[1];
|
212
223
|
|
213
|
-
var searchValueRef = useRef('');
|
214
224
|
var tableRef = useRef(null);
|
215
225
|
var actionRef = useRef(); // 传给 table 的过滤后的 columns
|
216
226
|
|
@@ -260,19 +270,22 @@ var ProTable = function ProTable(props) {
|
|
260
270
|
var _useState23 = useState(false),
|
261
271
|
_useState24 = _slicedToArray(_useState23, 2),
|
262
272
|
fullscreenState = _useState24[0],
|
263
|
-
setFullscreenState = _useState24[1]; //
|
273
|
+
setFullscreenState = _useState24[1]; // 非全屏状态下的
|
274
|
+
|
264
275
|
|
276
|
+
var normalDataFilterFormRef = useRef();
|
277
|
+
var fullscreenDataFilterFormRef = useRef();
|
278
|
+
var normalDataFilterForm = normalDataFilterFormRef.current;
|
279
|
+
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
|
280
|
+
|
281
|
+
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
282
|
+
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
265
283
|
|
266
284
|
var _useState25 = useState(false),
|
267
285
|
_useState26 = _slicedToArray(_useState25, 2),
|
268
286
|
footerSuctionState = _useState26[0],
|
269
|
-
setFooterSuctionState = _useState26[1];
|
270
|
-
/** 筛选区域 form */
|
271
|
-
|
287
|
+
setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
272
288
|
|
273
|
-
var dataFilterForm = useMemo(function () {
|
274
|
-
return createForm();
|
275
|
-
}, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
276
289
|
|
277
290
|
var getFooterSuctionState = function getFooterSuctionState() {
|
278
291
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
@@ -425,26 +438,24 @@ var ProTable = function ProTable(props) {
|
|
425
438
|
return _request(params);
|
426
439
|
},
|
427
440
|
request: function request(params) {
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
}
|
433
|
-
|
434
|
-
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
435
|
-
setPageSize(params[targetPageSizeKey]);
|
436
|
-
}
|
441
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
442
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
443
|
+
setCurrentPage(params[targetPageKey]);
|
444
|
+
}
|
437
445
|
|
438
|
-
|
446
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
447
|
+
setPageSize(params[targetPageSizeKey]);
|
439
448
|
}
|
449
|
+
|
450
|
+
_request(params);
|
440
451
|
},
|
441
452
|
reset: function reset() {
|
442
|
-
var _actionRef$current3, _actionRef$current3$s;
|
453
|
+
var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
|
443
454
|
|
444
455
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
445
456
|
|
446
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, {});
|
447
|
-
dataFilterForm.reset();
|
458
|
+
(_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
|
448
459
|
setCurrentPage(1);
|
449
460
|
|
450
461
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -467,6 +478,8 @@ var ProTable = function ProTable(props) {
|
|
467
478
|
},
|
468
479
|
data: data,
|
469
480
|
dataFilterForm: dataFilterForm,
|
481
|
+
normalDataFilterForm: normalDataFilterForm,
|
482
|
+
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
470
483
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
471
484
|
getHeaderHeight().then(function (height) {
|
472
485
|
setHeaderHeight(height);
|
@@ -556,7 +569,7 @@ var ProTable = function ProTable(props) {
|
|
556
569
|
}); // 请求函数
|
557
570
|
|
558
571
|
function _request(params, noLoading) {
|
559
|
-
var _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
572
|
+
var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
560
573
|
|
561
574
|
// 如果没有传 url 且没有 customRequest,直接返回
|
562
575
|
if (!url && !customRequest) {
|
@@ -569,7 +582,7 @@ var ProTable = function ProTable(props) {
|
|
569
582
|
|
570
583
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
571
584
|
|
572
|
-
var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
|
585
|
+
var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
|
573
586
|
|
574
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 : {}; // 格式化后的请求参数
|
575
588
|
|
@@ -620,8 +633,11 @@ var ProTable = function ProTable(props) {
|
|
620
633
|
}
|
621
634
|
|
622
635
|
useEffect(function () {
|
636
|
+
var _dataFilterForm3;
|
637
|
+
|
623
638
|
// 初始化 actionRef state、callback 此时 actionRef 已初始化完成
|
624
|
-
initActionRef();
|
639
|
+
initActionRef();
|
640
|
+
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
625
641
|
|
626
642
|
if (footerSuction) {
|
627
643
|
getFooterSuctionState();
|
@@ -631,16 +647,11 @@ var ProTable = function ProTable(props) {
|
|
631
647
|
};
|
632
648
|
}
|
633
649
|
|
634
|
-
if (requestWhenMount) {
|
635
|
-
|
636
|
-
|
650
|
+
if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
|
651
|
+
// 在请求发送之前 处理漏斗默认数据
|
652
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
637
653
|
|
638
|
-
|
639
|
-
|
640
|
-
if (searchName) {
|
641
|
-
// 如果有初始值,需要赋值
|
642
|
-
var initialValues = toJS(dataFilterForm.initialValues);
|
643
|
-
searchValueRef.current = initialValues[searchName][1];
|
654
|
+
_request();
|
644
655
|
}
|
645
656
|
|
646
657
|
return function () {
|
@@ -654,7 +665,7 @@ var ProTable = function ProTable(props) {
|
|
654
665
|
|
655
666
|
actionRef.current = undefined;
|
656
667
|
};
|
657
|
-
}, []);
|
668
|
+
}, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
|
658
669
|
|
659
670
|
function onSort(dataIndex, order) {
|
660
671
|
var nextSort = _defineProperty({}, dataIndex, order);
|
@@ -662,62 +673,27 @@ var ProTable = function ProTable(props) {
|
|
662
673
|
setSort(nextSort);
|
663
674
|
|
664
675
|
_request(targetFormatSort(nextSort));
|
665
|
-
} //
|
666
|
-
|
667
|
-
|
668
|
-
var getSearchName = function getSearchName() {
|
669
|
-
var _dataFilter$schema;
|
670
|
-
|
671
|
-
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) {
|
672
|
-
var searchSchema = dataFilter.schema.find(function (item) {
|
673
|
-
return item.component === 'Search';
|
674
|
-
});
|
675
|
-
|
676
|
-
if (searchSchema) {
|
677
|
-
var searchName = searchSchema.name;
|
678
|
-
return searchName;
|
679
|
-
}
|
680
|
-
}
|
681
|
-
}; // 处理 dataFilter 中的 onFilter、onReset
|
676
|
+
} // 处理 dataFilter 中的 onFilter、onReset
|
682
677
|
|
683
678
|
|
684
679
|
var dataFilter = _objectSpread(_objectSpread({
|
685
680
|
mode: 'inline'
|
686
681
|
}, propsDataFilter), {}, {
|
687
|
-
onFilter:
|
688
|
-
|
689
|
-
|
690
|
-
if (dataFilterForm.validate()) {
|
691
|
-
var _actionRef$current5, _actionRef$current5$c;
|
692
|
-
|
693
|
-
/**
|
694
|
-
* 针对 inline 模式下的 Search 组件做特殊处理
|
695
|
-
* 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
|
696
|
-
*/
|
697
|
-
if (dataFilter.mode === 'inline') {
|
698
|
-
var searchName = getSearchName();
|
699
|
-
|
700
|
-
if (searchName) {
|
701
|
-
var searchValue = values[searchName][1];
|
682
|
+
onFilter: function onFilter(values) {
|
683
|
+
var _actionRef$current5, _actionRef$current5$c;
|
702
684
|
|
703
|
-
|
704
|
-
return;
|
705
|
-
}
|
685
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
706
686
|
|
707
|
-
|
708
|
-
|
709
|
-
} // 搜索变化时,暂时先清空选择
|
710
|
-
|
711
|
-
|
712
|
-
(_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);
|
713
|
-
setCurrentPage(1);
|
687
|
+
(_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);
|
688
|
+
setCurrentPage(1);
|
714
689
|
|
715
|
-
|
716
|
-
|
717
|
-
}, filterDebounce),
|
690
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
691
|
+
},
|
718
692
|
onReset: function onReset() {
|
693
|
+
var _dataFilterForm5;
|
694
|
+
|
719
695
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
720
|
-
dataFilterForm.reset();
|
696
|
+
(_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
|
721
697
|
setCurrentPage(1);
|
722
698
|
|
723
699
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -732,7 +708,7 @@ var ProTable = function ProTable(props) {
|
|
732
708
|
}
|
733
709
|
};
|
734
710
|
|
735
|
-
var renderTable = function renderTable() {
|
711
|
+
var renderTable = function renderTable(isFullScreen) {
|
736
712
|
if (propsColumns) {
|
737
713
|
return /*#__PURE__*/React.createElement("div", {
|
738
714
|
className: classNames('teamix-pro-table-container', className)
|
@@ -744,7 +720,7 @@ var ProTable = function ProTable(props) {
|
|
744
720
|
actionRef: actionRef,
|
745
721
|
columns: propsColumns,
|
746
722
|
dataFilter: dataFilter,
|
747
|
-
|
723
|
+
dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
|
748
724
|
rowSelection: rowSelection,
|
749
725
|
filterColumnType: filterColumnType
|
750
726
|
}), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
@@ -786,7 +762,7 @@ var ProTable = function ProTable(props) {
|
|
786
762
|
|
787
763
|
var targetActions = footerAction.actions.map(function (action) {
|
788
764
|
return _objectSpread(_objectSpread({}, action), {}, {
|
789
|
-
disabled: action.disabled || selectedCount === 0
|
765
|
+
disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
|
790
766
|
});
|
791
767
|
});
|
792
768
|
|
@@ -889,14 +865,16 @@ var ProTable = function ProTable(props) {
|
|
889
865
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
890
866
|
visible: fullscreenState,
|
891
867
|
actionRef: actionRef
|
892
|
-
},
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
868
|
+
}, function (isFullScreen) {
|
869
|
+
return /*#__PURE__*/React.createElement("div", {
|
870
|
+
className: cls({
|
871
|
+
'': true,
|
872
|
+
fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
|
873
|
+
|
874
|
+
}),
|
875
|
+
ref: tableRef
|
876
|
+
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
877
|
+
});
|
900
878
|
};
|
901
879
|
|
902
880
|
export default ProTable;
|
package/es/table/index.scss
CHANGED
@@ -40,11 +40,6 @@ $fullscreenPadding: 24px;
|
|
40
40
|
justify-content: flex-end;
|
41
41
|
width: 100%;
|
42
42
|
}
|
43
|
-
.teamix-pro-pagination-wrapper {
|
44
|
-
display: flex;
|
45
|
-
justify-content: flex-end;
|
46
|
-
width: 100%;
|
47
|
-
}
|
48
43
|
&-footer-action {
|
49
44
|
margin-left: 16px;
|
50
45
|
}
|
@@ -114,4 +109,9 @@ $fullscreenPadding: 24px;
|
|
114
109
|
|
115
110
|
.next-table-empty {
|
116
111
|
--table-empty-padding: 48px;
|
112
|
+
}
|
113
|
+
|
114
|
+
// 后面在基础组件里面覆盖
|
115
|
+
.next-table.next-table td .next-table-cell-wrapper {
|
116
|
+
text-overflow: unset;
|
117
117
|
}
|
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>;
|
@@ -125,6 +130,10 @@ export declare type ProTableProps = {
|
|
125
130
|
data: any[];
|
126
131
|
total?: number;
|
127
132
|
}>;
|
133
|
+
/** 默认漏斗过滤条件 */
|
134
|
+
defaultFilterParams?: {
|
135
|
+
[key: string]: any[] | any;
|
136
|
+
};
|
128
137
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
129
138
|
export declare type rowSelectionType = {
|
130
139
|
getProps?: (record: any, index: number) => any;
|
@@ -181,6 +190,8 @@ export declare type ProTableActionType = {
|
|
181
190
|
resetPage?: () => void;
|
182
191
|
/** 获取数据过滤区表单实例 */
|
183
192
|
dataFilterForm?: FormType;
|
193
|
+
normalDataFilterForm?: FormType;
|
194
|
+
fullscreenDataFilterForm?: FormType;
|
184
195
|
/** 表格当前的数据 */
|
185
196
|
data?: any[];
|
186
197
|
} & ProTableActionTypeMutations;
|
@@ -215,17 +226,12 @@ export declare type ProTableActionTypeState = {
|
|
215
226
|
[key: string]: any;
|
216
227
|
};
|
217
228
|
export declare type ProTableDataFilterProps = {
|
218
|
-
/** 展示形式 */
|
219
|
-
mode?: 'inline' | 'panel';
|
220
|
-
/** mode='panel' 时是否默认展开 */
|
221
|
-
expand?: boolean;
|
222
|
-
/** 搜索时是否传入值为undefined的参数,默认不传 */
|
223
229
|
searchUndefined?: boolean;
|
224
230
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
225
231
|
searchEmptyString?: boolean;
|
226
232
|
/** 自定义内容 */
|
227
233
|
content?: React.ReactNode;
|
228
|
-
} &
|
234
|
+
} & QueryFilterProps;
|
229
235
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
230
236
|
export declare type ProTableTopAreaProps = {
|
231
237
|
/** 标题区 */
|
@@ -238,8 +244,8 @@ export declare type ProTableTopAreaProps = {
|
|
238
244
|
extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
|
239
245
|
/** 数据过滤区 */
|
240
246
|
dataFilter?: ProTableDataFilterProps;
|
241
|
-
/**
|
242
|
-
|
247
|
+
/** 传给 QueryFilter 的 formRef */
|
248
|
+
dataFilterFormRef?: any;
|
243
249
|
/** 排序、筛选列展示状态 */
|
244
250
|
filterColumnType?: 'dialog' | 'dropdown' | 'auto';
|
245
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 配置项是函数的情况
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
|
+
import { ProTableProps, ProTableColumnProps } from '..';
|
3
4
|
export declare function initActionRef(): void;
|
4
5
|
/** table 组件内监听 不对外暴露 */
|
5
6
|
export declare function on(fun: any, key: string): void;
|
@@ -9,3 +10,9 @@ export declare function off(key: string): void;
|
|
9
10
|
export declare function emit(key: string, ...args: any): void;
|
10
11
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
11
12
|
export declare function cloneDeep<T>(obj: T): T;
|
13
|
+
/**
|
14
|
+
* 处理默认过滤参数
|
15
|
+
* @param columns
|
16
|
+
* @param ref
|
17
|
+
*/
|
18
|
+
export declare function processDefaultFilter(columns: ProTableColumnProps[], ref: React.MutableRefObject<ProTableActionType | undefined>, defaultFilterParams: ProTableProps['defaultFilterParams']): void;
|
package/es/table/utils/index.js
CHANGED
@@ -173,4 +173,40 @@ export function useActionType(ref, action) {
|
|
173
173
|
}
|
174
174
|
export function cloneDeep(obj) {
|
175
175
|
return cloneDeepLodash(obj);
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* 处理默认过滤参数
|
179
|
+
* @param columns
|
180
|
+
* @param ref
|
181
|
+
*/
|
182
|
+
|
183
|
+
export function processDefaultFilter(columns, ref, defaultFilterParams) {
|
184
|
+
columns.forEach(function (column) {
|
185
|
+
var _column$dataIndex$toS, _column$dataIndex;
|
186
|
+
|
187
|
+
var defaultRules = defaultFilterParams === null || defaultFilterParams === void 0 ? void 0 : defaultFilterParams[(_column$dataIndex$toS = column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()) !== null && _column$dataIndex$toS !== void 0 ? _column$dataIndex$toS : ''];
|
188
|
+
|
189
|
+
if (defaultRules) {
|
190
|
+
var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
|
191
|
+
|
192
|
+
var params = '';
|
193
|
+
var rules = [];
|
194
|
+
|
195
|
+
if (Array.isArray(defaultRules)) {
|
196
|
+
params = defaultRules.join(',');
|
197
|
+
rules = defaultRules;
|
198
|
+
} else {
|
199
|
+
params = defaultRules;
|
200
|
+
rules = [defaultRules];
|
201
|
+
} // 需要带上其他所有的信息
|
202
|
+
|
203
|
+
|
204
|
+
var otherRules = (_ref$current$getState = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$getState2 = _ref$current.getState) === null || _ref$current$getState2 === void 0 ? void 0 : (_ref$current$getState3 = _ref$current$getState2.call(_ref$current)) === null || _ref$current$getState3 === void 0 ? void 0 : _ref$current$getState3.filterRules) !== null && _ref$current$getState !== void 0 ? _ref$current$getState : {}; // 再设置所有的列筛选状态
|
205
|
+
|
206
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$setFilt = _ref$current2.setFilterRules) === null || _ref$current2$setFilt === void 0 ? void 0 : _ref$current2$setFilt.call(_ref$current2, _objectSpread(_objectSpread({}, otherRules), {}, _defineProperty({}, column.dataIndex, {
|
207
|
+
rules: rules,
|
208
|
+
params: params
|
209
|
+
})));
|
210
|
+
}
|
211
|
+
});
|
176
212
|
}
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
package/lib/actions/dialog.js
CHANGED
@@ -30,7 +30,7 @@ var _request = require("./request");
|
|
30
30
|
|
31
31
|
var _utils2 = require("./utils");
|
32
32
|
|
33
|
-
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
33
|
+
var _excluded = ["trigger", "url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
34
34
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
35
35
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -107,7 +107,8 @@ function useDialogAction(action, actionContext) {
|
|
107
107
|
var onActionStart = function onActionStart(context, e) {
|
108
108
|
var _objectSpread2;
|
109
109
|
|
110
|
-
var
|
110
|
+
var trigger = action.trigger,
|
111
|
+
url = action.url,
|
111
112
|
method = action.method,
|
112
113
|
params = action.params,
|
113
114
|
data = action.data,
|
@@ -254,7 +255,7 @@ function useDialogAction(action, actionContext) {
|
|
254
255
|
})), _objectSpread2), containerProps), containerOtherProps);
|
255
256
|
|
256
257
|
var ret = container.show(quickShowProps);
|
257
|
-
store.hide = ret.hide;
|
258
|
+
store.hide = ret ? ret.hide || ret.close : function () {};
|
258
259
|
};
|
259
260
|
|
260
261
|
return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, onActionStart));
|
package/lib/actions/index.d.ts
CHANGED
@@ -26,25 +26,28 @@ export declare type ProActionConfig = ({
|
|
26
26
|
} & LinkAction);
|
27
27
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
28
28
|
export declare function useAction(config?: ProActionConfig, context?: any): any;
|
29
|
-
export interface ProActionButtonProps extends ButtonProps {
|
30
|
-
key?: string | number;
|
29
|
+
export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
|
31
30
|
config?: ProActionConfig;
|
32
|
-
visible?: any;
|
33
31
|
disabled?: any;
|
34
32
|
icon?: string;
|
35
|
-
context?: any;
|
36
33
|
onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
|
37
34
|
}
|
38
35
|
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
|
39
|
-
export interface
|
36
|
+
export interface ProActionCommonProps {
|
40
37
|
key?: string | number;
|
41
|
-
actions: ProActionProps[];
|
42
38
|
visible?: any;
|
43
|
-
icon?: string;
|
44
39
|
context?: any;
|
45
40
|
}
|
41
|
+
export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
|
42
|
+
actions: ProActionProps[];
|
43
|
+
icon?: string;
|
44
|
+
noArrow?: boolean;
|
45
|
+
}
|
46
46
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
47
|
-
export
|
47
|
+
export interface ProActionDividerProps extends ProActionCommonProps {
|
48
|
+
type: 'divider';
|
49
|
+
}
|
50
|
+
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
|
48
51
|
export declare type ProActionGroupProps = {
|
49
52
|
/** 操作组类型:按钮、文字按钮 */
|
50
53
|
type?: 'button' | 'text';
|
@@ -59,7 +62,7 @@ export declare type ProActionGroupProps = {
|
|
59
62
|
*/
|
60
63
|
moreText?: string;
|
61
64
|
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
62
|
-
more?: string |
|
65
|
+
more?: string | Omit<ProActionMenuButtonProps, 'actions'>;
|
63
66
|
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
64
67
|
divider?: boolean;
|
65
68
|
} & React.HTMLAttributes<HTMLElement>;
|