@teamix/pro 1.2.22 → 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 +18718 -15882
- 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 +13 -9
- package/es/actions/index.js +63 -18
- package/es/actions/index.scss +12 -1
- package/es/form/Components/SelectTable/index.d.ts +24 -0
- package/es/form/Components/SelectTable/index.js +135 -0
- package/es/form/Components/SelectTable/index.scss +28 -0
- package/es/form/Components/SelectTable/table.d.ts +6 -0
- package/es/form/Components/SelectTable/table.js +64 -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/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 -166
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.d.ts +4 -1
- package/es/table/components/Pagination/index.js +105 -14
- package/es/table/components/Pagination/index.scss +33 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +77 -102
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +19 -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 +13 -9
- package/lib/actions/index.js +63 -18
- package/lib/actions/index.scss +12 -1
- package/lib/form/Components/SelectTable/index.d.ts +24 -0
- package/lib/form/Components/SelectTable/index.js +157 -0
- package/lib/form/Components/SelectTable/index.scss +28 -0
- package/lib/form/Components/SelectTable/table.d.ts +6 -0
- package/lib/form/Components/SelectTable/table.js +76 -0
- 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 -166
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.d.ts +4 -1
- package/lib/table/components/Pagination/index.js +104 -13
- package/lib/table/components/Pagination/index.scss +33 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +74 -98
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +19 -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", "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
|
36
|
-
import { Table, Checkbox
|
37
|
-
|
35
|
+
import React, { useState, useEffect, useRef } from 'react';
|
36
|
+
import { Table, Checkbox } from '@alicloudfe/components';
|
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
|
+
} // 处理只剩一列批量选择的情况下宽度错乱问题
|
77
|
+
|
67
78
|
|
68
|
-
if (filterColumns === null ||
|
69
|
-
var _initialColumns$;
|
79
|
+
if ((_filterColumns = filterColumns) === null || _filterColumns === void 0 ? void 0 : _filterColumns.length) {
|
80
|
+
var _filterColumns2, _initialColumns$;
|
70
81
|
|
71
|
-
if ((filterColumns === null ||
|
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) {
|
@@ -146,6 +157,7 @@ var ProTable = function ProTable(props) {
|
|
146
157
|
showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
|
147
158
|
_props$pageSizeList = props.pageSizeList,
|
148
159
|
pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
|
160
|
+
responsivePaginationType = props.responsivePaginationType,
|
149
161
|
_props$showSkeleton = props.showSkeleton,
|
150
162
|
propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
|
151
163
|
_props$skeletonSize = props.skeletonSize,
|
@@ -163,6 +175,7 @@ var ProTable = function ProTable(props) {
|
|
163
175
|
customRequest = props.customRequest,
|
164
176
|
_props$filterColumnTy = props.filterColumnType,
|
165
177
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
178
|
+
defaultFilterParams = props.defaultFilterParams,
|
166
179
|
otherProps = _objectWithoutProperties(props, _excluded);
|
167
180
|
|
168
181
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -206,10 +219,8 @@ var ProTable = function ProTable(props) {
|
|
206
219
|
var _useState13 = useState(true),
|
207
220
|
_useState14 = _slicedToArray(_useState13, 2),
|
208
221
|
customTableLoading = _useState14[0],
|
209
|
-
setCustomTableLoading = _useState14[1];
|
210
|
-
|
222
|
+
setCustomTableLoading = _useState14[1];
|
211
223
|
|
212
|
-
var searchValueRef = useRef('');
|
213
224
|
var tableRef = useRef(null);
|
214
225
|
var actionRef = useRef(); // 传给 table 的过滤后的 columns
|
215
226
|
|
@@ -259,20 +270,23 @@ var ProTable = function ProTable(props) {
|
|
259
270
|
var _useState23 = useState(false),
|
260
271
|
_useState24 = _slicedToArray(_useState23, 2),
|
261
272
|
fullscreenState = _useState24[0],
|
262
|
-
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
|
263
280
|
|
281
|
+
var dataFilterFormRef = fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
282
|
+
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
264
283
|
|
265
284
|
var _useState25 = useState(false),
|
266
285
|
_useState26 = _slicedToArray(_useState25, 2),
|
267
286
|
footerSuctionState = _useState26[0],
|
268
|
-
setFooterSuctionState = _useState26[1];
|
269
|
-
/** 筛选区域 form */
|
287
|
+
setFooterSuctionState = _useState26[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
270
288
|
|
271
289
|
|
272
|
-
var dataFilterForm = useMemo(function () {
|
273
|
-
return createForm();
|
274
|
-
}, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
275
|
-
|
276
290
|
var getFooterSuctionState = function getFooterSuctionState() {
|
277
291
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
278
292
|
|
@@ -424,18 +438,16 @@ var ProTable = function ProTable(props) {
|
|
424
438
|
return _request(params);
|
425
439
|
},
|
426
440
|
request: function request(params) {
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
}
|
432
|
-
|
433
|
-
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
434
|
-
setPageSize(params[targetPageSizeKey]);
|
435
|
-
}
|
441
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
442
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
443
|
+
setCurrentPage(params[targetPageKey]);
|
444
|
+
}
|
436
445
|
|
437
|
-
|
446
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
447
|
+
setPageSize(params[targetPageSizeKey]);
|
438
448
|
}
|
449
|
+
|
450
|
+
_request(params);
|
439
451
|
},
|
440
452
|
reset: function reset() {
|
441
453
|
var _actionRef$current3, _actionRef$current3$s;
|
@@ -443,7 +455,7 @@ var ProTable = function ProTable(props) {
|
|
443
455
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
444
456
|
|
445
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, {});
|
446
|
-
dataFilterForm.reset();
|
458
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
447
459
|
setCurrentPage(1);
|
448
460
|
|
449
461
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -466,6 +478,8 @@ var ProTable = function ProTable(props) {
|
|
466
478
|
},
|
467
479
|
data: data,
|
468
480
|
dataFilterForm: dataFilterForm,
|
481
|
+
normalDataFilterForm: normalDataFilterForm,
|
482
|
+
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
469
483
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
470
484
|
getHeaderHeight().then(function (height) {
|
471
485
|
setHeaderHeight(height);
|
@@ -568,7 +582,7 @@ var ProTable = function ProTable(props) {
|
|
568
582
|
|
569
583
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
570
584
|
|
571
|
-
var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
|
585
|
+
var dataFilterParams = toJS(dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values); // 列过滤请求参数
|
572
586
|
|
573
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 : {}; // 格式化后的请求参数
|
574
588
|
|
@@ -631,15 +645,10 @@ var ProTable = function ProTable(props) {
|
|
631
645
|
}
|
632
646
|
|
633
647
|
if (requestWhenMount) {
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
var searchName = getSearchName();
|
648
|
+
// 在请求发送之前 处理漏斗默认数据
|
649
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
638
650
|
|
639
|
-
|
640
|
-
// 如果有初始值,需要赋值
|
641
|
-
var initialValues = toJS(dataFilterForm.initialValues);
|
642
|
-
searchValueRef.current = initialValues[searchName][1];
|
651
|
+
_request();
|
643
652
|
}
|
644
653
|
|
645
654
|
return function () {
|
@@ -661,62 +670,25 @@ var ProTable = function ProTable(props) {
|
|
661
670
|
setSort(nextSort);
|
662
671
|
|
663
672
|
_request(targetFormatSort(nextSort));
|
664
|
-
} //
|
665
|
-
|
666
|
-
|
667
|
-
var getSearchName = function getSearchName() {
|
668
|
-
var _dataFilter$schema;
|
669
|
-
|
670
|
-
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) {
|
671
|
-
var searchSchema = dataFilter.schema.find(function (item) {
|
672
|
-
return item.component === 'Search';
|
673
|
-
});
|
674
|
-
|
675
|
-
if (searchSchema) {
|
676
|
-
var searchName = searchSchema.name;
|
677
|
-
return searchName;
|
678
|
-
}
|
679
|
-
}
|
680
|
-
}; // 处理 dataFilter 中的 onFilter、onReset
|
673
|
+
} // 处理 dataFilter 中的 onFilter、onReset
|
681
674
|
|
682
675
|
|
683
676
|
var dataFilter = _objectSpread(_objectSpread({
|
684
677
|
mode: 'inline'
|
685
678
|
}, propsDataFilter), {}, {
|
686
|
-
onFilter:
|
687
|
-
|
688
|
-
|
689
|
-
if (dataFilterForm.validate()) {
|
690
|
-
var _actionRef$current5, _actionRef$current5$c;
|
691
|
-
|
692
|
-
/**
|
693
|
-
* 针对 inline 模式下的 Search 组件做特殊处理
|
694
|
-
* 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
|
695
|
-
*/
|
696
|
-
if (dataFilter.mode === 'inline') {
|
697
|
-
var searchName = getSearchName();
|
679
|
+
onFilter: function onFilter(values) {
|
680
|
+
var _actionRef$current5, _actionRef$current5$c;
|
698
681
|
|
699
|
-
|
700
|
-
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)); // 搜索变化时,暂时先清空选择
|
701
683
|
|
702
|
-
|
703
|
-
|
704
|
-
}
|
705
|
-
|
706
|
-
searchValueRef.current = searchValue;
|
707
|
-
}
|
708
|
-
} // 搜索变化时,暂时先清空选择
|
709
|
-
|
710
|
-
|
711
|
-
(_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);
|
712
|
-
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);
|
713
686
|
|
714
|
-
|
715
|
-
|
716
|
-
}, filterDebounce),
|
687
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
688
|
+
},
|
717
689
|
onReset: function onReset() {
|
718
690
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
719
|
-
dataFilterForm.reset();
|
691
|
+
dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
|
720
692
|
setCurrentPage(1);
|
721
693
|
|
722
694
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -731,7 +703,7 @@ var ProTable = function ProTable(props) {
|
|
731
703
|
}
|
732
704
|
};
|
733
705
|
|
734
|
-
var renderTable = function renderTable() {
|
706
|
+
var renderTable = function renderTable(isFullScreen) {
|
735
707
|
if (propsColumns) {
|
736
708
|
return /*#__PURE__*/React.createElement("div", {
|
737
709
|
className: classNames('teamix-pro-table-container', className)
|
@@ -743,7 +715,7 @@ var ProTable = function ProTable(props) {
|
|
743
715
|
actionRef: actionRef,
|
744
716
|
columns: propsColumns,
|
745
717
|
dataFilter: dataFilter,
|
746
|
-
|
718
|
+
dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
|
747
719
|
rowSelection: rowSelection,
|
748
720
|
filterColumnType: filterColumnType
|
749
721
|
}), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
@@ -785,7 +757,7 @@ var ProTable = function ProTable(props) {
|
|
785
757
|
|
786
758
|
var targetActions = footerAction.actions.map(function (action) {
|
787
759
|
return _objectSpread(_objectSpread({}, action), {}, {
|
788
|
-
disabled: action.disabled || selectedCount === 0
|
760
|
+
disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
|
789
761
|
});
|
790
762
|
});
|
791
763
|
|
@@ -857,8 +829,9 @@ var ProTable = function ProTable(props) {
|
|
857
829
|
return onChangePagination(number);
|
858
830
|
},
|
859
831
|
total: total,
|
860
|
-
|
861
|
-
|
832
|
+
responsivePaginationType: responsivePaginationType,
|
833
|
+
// shape="arrow-only"
|
834
|
+
// pageSizePosition="end"
|
862
835
|
totalRender: function totalRender(total) {
|
863
836
|
return getMessage('total', {
|
864
837
|
total: total
|
@@ -887,14 +860,16 @@ var ProTable = function ProTable(props) {
|
|
887
860
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
888
861
|
visible: fullscreenState,
|
889
862
|
actionRef: actionRef
|
890
|
-
},
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
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
|
+
});
|
898
873
|
};
|
899
874
|
|
900
875
|
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';
|
@@ -22,6 +22,7 @@ declare type TDataService = {
|
|
22
22
|
/** 表格数据 */
|
23
23
|
data?: any;
|
24
24
|
};
|
25
|
+
export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
|
25
26
|
export declare type ProTableColumnProps = {
|
26
27
|
/**
|
27
28
|
* 会在 title 之后展示一个 icon,hover 之后提示一些信息
|
@@ -55,6 +56,8 @@ export declare type ProTableColumnProps = {
|
|
55
56
|
dataIndex?: string | string[];
|
56
57
|
/** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
|
57
58
|
format?: string;
|
59
|
+
/** ProField 其他配置项 */
|
60
|
+
props?: any;
|
58
61
|
} & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
|
59
62
|
export declare type ProColumnProps = ProTableColumnProps;
|
60
63
|
export declare type ProTableProps = {
|
@@ -92,6 +95,8 @@ export declare type ProTableProps = {
|
|
92
95
|
paginationProps?: PaginationProps;
|
93
96
|
/** 是否显示翻页器 */
|
94
97
|
showPagination?: boolean;
|
98
|
+
/** 手动指定响应式翻页器的 type */
|
99
|
+
responsivePaginationType?: responsivePaginationType;
|
95
100
|
/** 是否使用内置的 rowSelection */
|
96
101
|
useRowSelection?: boolean;
|
97
102
|
/** 内置 rowSelection 变化时的回调 */
|
@@ -102,7 +107,10 @@ export declare type ProTableProps = {
|
|
102
107
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
103
108
|
/** 表格底部(右层)配置 */
|
104
109
|
footer?: React.ReactNode;
|
105
|
-
/**
|
110
|
+
/**
|
111
|
+
* @deprecated 已废弃 建议用 dataFilter 中的 filterDebounce 代替
|
112
|
+
* 筛选区自动搜索的防抖时间(毫秒)
|
113
|
+
*/
|
106
114
|
filterDebounce?: number;
|
107
115
|
/** ProTable action 的引用,便于手动触发一些方法 */
|
108
116
|
actionRef?: React.MutableRefObject<ProTableActionType | undefined>;
|
@@ -122,6 +130,10 @@ export declare type ProTableProps = {
|
|
122
130
|
data: any[];
|
123
131
|
total?: number;
|
124
132
|
}>;
|
133
|
+
/** 默认漏斗过滤条件 */
|
134
|
+
defaultFilterParams?: {
|
135
|
+
[key: string]: any[] | any;
|
136
|
+
};
|
125
137
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
126
138
|
export declare type rowSelectionType = {
|
127
139
|
getProps?: (record: any, index: number) => any;
|
@@ -178,6 +190,8 @@ export declare type ProTableActionType = {
|
|
178
190
|
resetPage?: () => void;
|
179
191
|
/** 获取数据过滤区表单实例 */
|
180
192
|
dataFilterForm?: FormType;
|
193
|
+
normalDataFilterForm?: FormType;
|
194
|
+
fullscreenDataFilterForm?: FormType;
|
181
195
|
/** 表格当前的数据 */
|
182
196
|
data?: any[];
|
183
197
|
} & ProTableActionTypeMutations;
|
@@ -212,17 +226,12 @@ export declare type ProTableActionTypeState = {
|
|
212
226
|
[key: string]: any;
|
213
227
|
};
|
214
228
|
export declare type ProTableDataFilterProps = {
|
215
|
-
/** 展示形式 */
|
216
|
-
mode?: 'inline' | 'panel';
|
217
|
-
/** mode='panel' 时是否默认展开 */
|
218
|
-
expand?: boolean;
|
219
|
-
/** 搜索时是否传入值为undefined的参数,默认不传 */
|
220
229
|
searchUndefined?: boolean;
|
221
230
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
222
231
|
searchEmptyString?: boolean;
|
223
232
|
/** 自定义内容 */
|
224
233
|
content?: React.ReactNode;
|
225
|
-
} &
|
234
|
+
} & QueryFilterProps;
|
226
235
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
227
236
|
export declare type ProTableTopAreaProps = {
|
228
237
|
/** 标题区 */
|
@@ -235,8 +244,8 @@ export declare type ProTableTopAreaProps = {
|
|
235
244
|
extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
|
236
245
|
/** 数据过滤区 */
|
237
246
|
dataFilter?: ProTableDataFilterProps;
|
238
|
-
/**
|
239
|
-
|
247
|
+
/** 传给 QueryFilter 的 formRef */
|
248
|
+
dataFilterFormRef?: any;
|
240
249
|
/** 排序、筛选列展示状态 */
|
241
250
|
filterColumnType?: 'dialog' | 'dropdown' | 'auto';
|
242
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,27 @@ 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
|
+
}
|
46
45
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
47
|
-
export
|
46
|
+
export interface ProActionDividerProps extends ProActionCommonProps {
|
47
|
+
type: 'divider';
|
48
|
+
}
|
49
|
+
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
|
48
50
|
export declare type ProActionGroupProps = {
|
49
51
|
/** 操作组类型:按钮、文字按钮 */
|
50
52
|
type?: 'button' | 'text';
|
@@ -59,7 +61,9 @@ export declare type ProActionGroupProps = {
|
|
59
61
|
*/
|
60
62
|
moreText?: string;
|
61
63
|
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
62
|
-
more?: string | ProActionButtonProps
|
64
|
+
more?: string | (ProActionButtonProps & {
|
65
|
+
noArrow?: boolean;
|
66
|
+
});
|
63
67
|
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
64
68
|
divider?: boolean;
|
65
69
|
} & React.HTMLAttributes<HTMLElement>;
|