@teamix/pro 1.5.32 → 1.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.js +568 -950
- package/dist/pro.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/Layout/index.js +7 -9
- package/es/table/components/Pagination/index.d.ts +4 -5
- package/es/table/components/Pagination/index.js +3 -5
- package/es/table/index.js +115 -89
- package/es/table/index.scss +1 -1
- package/es/table/typing.d.ts +0 -2
- package/es/table/utils/genAutoWidthColumns.js +6 -42
- package/es/table/utils/genProColumnToColumn.js +2 -20
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Layout/index.js +6 -8
- package/lib/table/components/Pagination/index.d.ts +4 -5
- package/lib/table/components/Pagination/index.js +2 -4
- package/lib/table/index.js +117 -91
- package/lib/table/index.scss +1 -1
- package/lib/table/typing.d.ts +0 -2
- package/lib/table/utils/genAutoWidthColumns.js +6 -42
- package/lib/table/utils/genProColumnToColumn.js +1 -19
- package/package.json +1 -1
- package/es/table/components/Cell/index.d.ts +0 -17
- package/es/table/components/Cell/index.js +0 -209
- package/es/table/components/TableContent/index.d.ts +0 -7
- package/es/table/components/TableContent/index.js +0 -23
- package/es/table/utils/processColumns.d.ts +0 -8
- package/es/table/utils/processColumns.js +0 -39
- package/lib/table/components/Cell/index.d.ts +0 -17
- package/lib/table/components/Cell/index.js +0 -214
- package/lib/table/components/TableContent/index.d.ts +0 -7
- package/lib/table/components/TableContent/index.js +0 -34
- package/lib/table/utils/processColumns.d.ts +0 -8
- package/lib/table/utils/processColumns.js +0 -46
package/es/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.33";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
5
5
|
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); }
|
6
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
7
7
|
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; }
|
8
|
-
import React, { isValidElement
|
8
|
+
import React, { isValidElement } from 'react';
|
9
9
|
import { usePrefixCls } from '@teamix/utils';
|
10
10
|
import { Header } from '../../../field';
|
11
11
|
import { ProActionGroup } from '../../../actions';
|
@@ -66,7 +66,7 @@ var Layout = function Layout(props) {
|
|
66
66
|
}, otherProps)));
|
67
67
|
};
|
68
68
|
// 渲染新版 QueryFilter
|
69
|
-
var renderQueryFilter =
|
69
|
+
var renderQueryFilter = function renderQueryFilter() {
|
70
70
|
var _dataFilter$schema;
|
71
71
|
if (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) {
|
72
72
|
var _dataFilter$schema2;
|
@@ -128,9 +128,7 @@ var Layout = function Layout(props) {
|
|
128
128
|
}, afterDataFilter) : null
|
129
129
|
}));
|
130
130
|
}
|
131
|
-
}
|
132
|
-
//todo: 重复render 问题都在这里
|
133
|
-
dataFilter, mainAction, dataFilterFormRef, afterDataFilter]);
|
131
|
+
};
|
134
132
|
// 区域组合渲染
|
135
133
|
var renderLayout = function renderLayout() {
|
136
134
|
if (header && mainAction) {
|
@@ -144,7 +142,7 @@ var Layout = function Layout(props) {
|
|
144
142
|
actionRef: actionRef,
|
145
143
|
quickAction: extra,
|
146
144
|
rowSelection: rowSelection
|
147
|
-
}))), renderQueryFilter);
|
145
|
+
}))), renderQueryFilter());
|
148
146
|
} else if (header && !mainAction) {
|
149
147
|
var _dataFilter$schema3, _dataFilter$schema4;
|
150
148
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
@@ -157,14 +155,14 @@ var Layout = function Layout(props) {
|
|
157
155
|
actionRef: actionRef,
|
158
156
|
quickAction: extra,
|
159
157
|
rowSelection: rowSelection
|
160
|
-
}), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter)), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter);
|
158
|
+
}), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter())), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter());
|
161
159
|
} else if (!header && mainAction) {
|
162
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter);
|
160
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
163
161
|
} else if (!header && !mainAction) {
|
164
162
|
if (!dataFilterFormRef && !extra) {
|
165
163
|
return null;
|
166
164
|
}
|
167
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter);
|
165
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
168
166
|
}
|
169
167
|
};
|
170
168
|
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import React from 'react';
|
2
1
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
3
2
|
import { responsivePaginationType } from '../../typing';
|
4
3
|
import './index.scss';
|
5
|
-
declare const _default:
|
6
|
-
responsivePaginationType?: responsivePaginationType
|
7
|
-
useMaxData?: boolean
|
8
|
-
}) => JSX.Element
|
4
|
+
declare const _default: (props: PaginationProps & {
|
5
|
+
responsivePaginationType?: responsivePaginationType;
|
6
|
+
useMaxData?: boolean;
|
7
|
+
}) => JSX.Element;
|
9
8
|
export default _default;
|
@@ -16,14 +16,13 @@ import { Pagination, Balloon, Select, Button, Input, Icon } from '@alicloudfe/co
|
|
16
16
|
import { getMessage, cls, usePrefixCls } from '@teamix/utils';
|
17
17
|
import { useResponsiveProps } from '@teamix/hooks';
|
18
18
|
import './index.scss';
|
19
|
-
|
19
|
+
export default (function (props) {
|
20
20
|
var className = props.className,
|
21
21
|
propsOnChange = props.onChange,
|
22
22
|
total = props.total,
|
23
23
|
pageSize = props.pageSize,
|
24
24
|
current = props.current,
|
25
|
-
|
26
|
-
pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
|
25
|
+
pageSizeList = props.pageSizeList,
|
27
26
|
pageSizeSelector = props.pageSizeSelector,
|
28
27
|
onPageSizeChange = props.onPageSizeChange,
|
29
28
|
responsivePaginationType = props.responsivePaginationType,
|
@@ -242,5 +241,4 @@ var ProPagination = function ProPagination(props) {
|
|
242
241
|
className: prefixCls('wrapper')
|
243
242
|
}, renderPagination())
|
244
243
|
);
|
245
|
-
};
|
246
|
-
export default /*#__PURE__*/React.memo(ProPagination);
|
244
|
+
});
|
package/es/table/index.js
CHANGED
@@ -5,9 +5,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
5
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
6
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
7
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
-
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; }
|
9
|
-
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; }
|
10
|
-
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; }
|
11
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
12
9
|
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."); }
|
13
10
|
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); }
|
@@ -16,10 +13,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
16
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
17
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
18
15
|
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; }
|
19
|
-
|
16
|
+
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; }
|
17
|
+
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; }
|
18
|
+
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; }
|
19
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
20
20
|
import { Table, Checkbox } from '@alicloudfe/components';
|
21
21
|
import Pagination from './components/Pagination';
|
22
|
-
import TableContent from './components/TableContent';
|
23
22
|
import genProColumnToColumn from './utils/genProColumnToColumn';
|
24
23
|
import { getGlobalConfig, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, usePrefixCls, getTargetValue } from '@teamix/utils';
|
25
24
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
@@ -27,8 +26,10 @@ import './index.scss';
|
|
27
26
|
import Layout from './components/Layout';
|
28
27
|
import { actionRefUseStateOn, emit, initActionRef, processDefaultFilter, useActionType } from './utils';
|
29
28
|
import getTableProps from './utils/getTableProps';
|
29
|
+
import getTableSortIcons from './utils/getTableSortIcons';
|
30
30
|
import useTableSelection from './utils/useTableSelection';
|
31
31
|
import FullScreen from './components/ToolBar/Fullscreen';
|
32
|
+
import { EmptyContent } from '@teamix/pro-field';
|
32
33
|
import { ProActionGroup } from '../actions';
|
33
34
|
import classNames from 'classnames';
|
34
35
|
import ProPageContainer from '../page-container';
|
@@ -37,9 +38,42 @@ import debounce from 'lodash.debounce';
|
|
37
38
|
import CardView from './components/CardView';
|
38
39
|
import { useUrlState } from '@teamix/hooks';
|
39
40
|
import { getUrlStateFilter } from './utils/util';
|
40
|
-
import processColumns from './utils/processColumns';
|
41
41
|
export * from './typing';
|
42
42
|
var cls = usePrefixCls('teamix-pro-table');
|
43
|
+
/**
|
44
|
+
* 处理原生传入的 columns 以便于 选择列 方便处理
|
45
|
+
* @param columns 原生传入的 columns
|
46
|
+
* @returns
|
47
|
+
*/
|
48
|
+
var processColumns = function processColumns(columns, initialColumns) {
|
49
|
+
var _getGlobalConfig;
|
50
|
+
var globalFilterColumns = (_getGlobalConfig = getGlobalConfig('ProTable')) === null || _getGlobalConfig === void 0 ? void 0 : _getGlobalConfig.filterColumns;
|
51
|
+
var filterColumns = columns.filter(function (item) {
|
52
|
+
return item.columnFilters !== false && (item === null || item === void 0 ? void 0 : item.hidden) !== true && (!globalFilterColumns || globalFilterColumns(_objectSpread({}, item)));
|
53
|
+
});
|
54
|
+
// 处理只剩一列批量选择的情况下宽度错乱问题
|
55
|
+
if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
|
56
|
+
var _initialColumns$;
|
57
|
+
if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
|
58
|
+
var _filterColumns$, _filterColumns$2;
|
59
|
+
if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
|
60
|
+
delete filterColumns[0].width;
|
61
|
+
}
|
62
|
+
if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
|
63
|
+
filterColumns[0].lock = false;
|
64
|
+
}
|
65
|
+
} else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
|
66
|
+
var _initialColumns$2, _initialColumns$3;
|
67
|
+
if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
|
68
|
+
filterColumns[0].width = initialColumns[0].width;
|
69
|
+
}
|
70
|
+
if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
|
71
|
+
filterColumns[0].lock = initialColumns[0].lock;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return filterColumns;
|
76
|
+
};
|
43
77
|
/** 默认请求翻页参数 */
|
44
78
|
var globalPageKey = 'currentPage';
|
45
79
|
var globalPageSizeKey = 'pageSize';
|
@@ -164,9 +198,7 @@ var ProTable = function ProTable(props) {
|
|
164
198
|
_useState12 = _slicedToArray(_useState11, 2),
|
165
199
|
showSkeleton = _useState12[0],
|
166
200
|
setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
|
167
|
-
var skeletonDataSource =
|
168
|
-
return new Array(skeletonSize).fill({});
|
169
|
-
}, [skeletonSize]);
|
201
|
+
var skeletonDataSource = new Array(skeletonSize).fill({});
|
170
202
|
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
171
203
|
// 如果使用 customRequest 的话,内置 loading
|
172
204
|
var _useState13 = useState(requestWhenMount),
|
@@ -182,8 +214,8 @@ var ProTable = function ProTable(props) {
|
|
182
214
|
setFilteredColumns = _useState16[1];
|
183
215
|
// 全局状态 : 自适应表格
|
184
216
|
var autoWidth = useMemo(function () {
|
185
|
-
var
|
186
|
-
return ((
|
217
|
+
var _getGlobalConfig2;
|
218
|
+
return ((_getGlobalConfig2 = getGlobalConfig('ProTable')) === null || _getGlobalConfig2 === void 0 ? void 0 : _getGlobalConfig2.autoWidth) || autoWidthProp;
|
187
219
|
}, [autoWidthProp]);
|
188
220
|
// 判断是否有操作列,有的话则渲染一个 shadow dom
|
189
221
|
var hasActionColumn = false;
|
@@ -373,8 +405,8 @@ var ProTable = function ProTable(props) {
|
|
373
405
|
});
|
374
406
|
// 全局状态 : 大数据截断
|
375
407
|
var globalUseMaxData = useMemo(function () {
|
376
|
-
var
|
377
|
-
return (
|
408
|
+
var _getGlobalConfig3;
|
409
|
+
return (_getGlobalConfig3 = getGlobalConfig('ProTable')) === null || _getGlobalConfig3 === void 0 ? void 0 : _getGlobalConfig3.useMaxData;
|
378
410
|
}, []);
|
379
411
|
// 非全屏状态下的
|
380
412
|
var normalDataFilterFormRef = useRef();
|
@@ -713,9 +745,7 @@ var ProTable = function ProTable(props) {
|
|
713
745
|
if (Number.isInteger(time) && time >= 1000) {
|
714
746
|
autoRefreshTimerRef.current = setTimeout(function () {
|
715
747
|
// 自动刷新不显示 loading
|
716
|
-
|
717
|
-
// setShowLoading(true)
|
718
|
-
_request({}, !autoWidth);
|
748
|
+
_request({}, true);
|
719
749
|
}, Number(time));
|
720
750
|
emit('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
721
751
|
}
|
@@ -800,7 +830,7 @@ var ProTable = function ProTable(props) {
|
|
800
830
|
}
|
801
831
|
});
|
802
832
|
// 请求函数
|
803
|
-
|
833
|
+
function _request(params, noLoading, filterParams, isReset) {
|
804
834
|
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current6, _actionRef$current6$g, _objectSpread3;
|
805
835
|
// 首次渲染表格,获取 urlState 上的 表头 filter 数据
|
806
836
|
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && dataRef.current.flag) {
|
@@ -904,7 +934,7 @@ var ProTable = function ProTable(props) {
|
|
904
934
|
if (Number.isInteger(time) && time >= 1000) {
|
905
935
|
autoRefreshTimerRef.current = setTimeout(function () {
|
906
936
|
// 自动刷新不显示 loading
|
907
|
-
_request(params,
|
937
|
+
_request(params, true);
|
908
938
|
}, Number(time));
|
909
939
|
emit('PRO_TABLE_REFRESH_TIMER_FLAG', Number(time));
|
910
940
|
}
|
@@ -915,63 +945,57 @@ var ProTable = function ProTable(props) {
|
|
915
945
|
getData.run(requestData);
|
916
946
|
}
|
917
947
|
}
|
918
|
-
}
|
919
|
-
|
948
|
+
}
|
949
|
+
function onSort(dataIndex, order) {
|
920
950
|
var nextSort = _defineProperty({}, dataIndex, order);
|
921
951
|
setSort(nextSort);
|
922
952
|
_request(targetFormatSort(nextSort));
|
923
|
-
}
|
953
|
+
}
|
924
954
|
// 处理 dataFilter 中的 onFilter、onReset
|
925
|
-
var dataFilter =
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
return;
|
943
|
-
}
|
944
|
-
// 非全屏状态,判断普通表单onFiler是否禁用
|
945
|
-
if (!fullscreenState && !filterEnableRef.current.normal) {
|
946
|
-
filterEnableRef.current.normal = true;
|
947
|
-
return;
|
948
|
-
}
|
949
|
-
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
|
950
|
-
// 搜索变化时,暂时先清空选择
|
951
|
-
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
952
|
-
setCurrentPage(1);
|
953
|
-
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
954
|
-
},
|
955
|
-
onReset: function onReset(values) {
|
956
|
-
var _dataFilterFormRef$cu3;
|
957
|
-
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
958
|
-
(_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
|
959
|
-
setCurrentPage(1);
|
960
|
-
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
955
|
+
var dataFilter = _objectSpread(_objectSpread({
|
956
|
+
mode: 'inline',
|
957
|
+
forceClear: true
|
958
|
+
}, propsDataFilter), {}, {
|
959
|
+
onInit: (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) || requestWhenMount ? function (values) {
|
960
|
+
var _propsDataFilter$onIn;
|
961
|
+
// 表单初始化请求处理
|
962
|
+
propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$onIn = propsDataFilter.onInit) === null || _propsDataFilter$onIn === void 0 ? void 0 : _propsDataFilter$onIn.call(propsDataFilter, values);
|
963
|
+
!fullscreenState && requestWhenMount && _request({}, false, values);
|
964
|
+
return true;
|
965
|
+
} : undefined,
|
966
|
+
onFilter: function onFilter(values) {
|
967
|
+
var _actionRef$current7, _actionRef$current7$c;
|
968
|
+
// 全屏状态,判断全屏表单onFilter是否禁用
|
969
|
+
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
970
|
+
filterEnableRef.current.fullscreen = true;
|
971
|
+
return;
|
961
972
|
}
|
962
|
-
|
963
|
-
|
964
|
-
|
973
|
+
// 非全屏状态,判断普通表单onFiler是否禁用
|
974
|
+
if (!fullscreenState && !filterEnableRef.current.normal) {
|
975
|
+
filterEnableRef.current.normal = true;
|
976
|
+
return;
|
977
|
+
}
|
978
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
|
979
|
+
// 搜索变化时,暂时先清空选择
|
980
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
981
|
+
setCurrentPage(1);
|
982
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
983
|
+
},
|
984
|
+
onReset: function onReset(values) {
|
985
|
+
var _dataFilterFormRef$cu3;
|
986
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
987
|
+
(_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
|
988
|
+
setCurrentPage(1);
|
989
|
+
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
990
|
+
}
|
991
|
+
});
|
992
|
+
var getTableLoading = function getTableLoading() {
|
965
993
|
if (!customRequest) {
|
966
994
|
return showLoading && !showSkeleton && (getData.loading || props.loading);
|
967
995
|
} else {
|
968
996
|
return showLoading && !showSkeleton && (customTableLoading || props.loading);
|
969
997
|
}
|
970
|
-
}
|
971
|
-
var memorizedGenProColumnToColumn = useMemo(function () {
|
972
|
-
var result = genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps);
|
973
|
-
return result;
|
974
|
-
}, [filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps]);
|
998
|
+
};
|
975
999
|
var renderTable = function renderTable(isFullScreen) {
|
976
1000
|
if (propsColumns) {
|
977
1001
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -998,11 +1022,11 @@ var ProTable = function ProTable(props) {
|
|
998
1022
|
autoRefreshProps: autoRefreshProps,
|
999
1023
|
bindUrlProps: bindUrlProps,
|
1000
1024
|
bindUrl: bindUrl
|
1001
|
-
}), switchViewState === 'table' && /*#__PURE__*/React.createElement(
|
1025
|
+
}), switchViewState === 'table' && /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
1002
1026
|
hasBorder: false,
|
1003
1027
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
1004
|
-
columns:
|
1005
|
-
loading:
|
1028
|
+
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps),
|
1029
|
+
loading: getTableLoading(),
|
1006
1030
|
className: classNames('teamix-pro-table', tableClassName, {
|
1007
1031
|
'with-row-select': rowSelection,
|
1008
1032
|
'teamix-pro-tree-table': isTree
|
@@ -1013,12 +1037,14 @@ var ProTable = function ProTable(props) {
|
|
1013
1037
|
sort: sort,
|
1014
1038
|
primaryKey: primaryKey,
|
1015
1039
|
rowSelection: rowSelection,
|
1040
|
+
emptyContent: /*#__PURE__*/React.createElement(EmptyContent, _objectSpread({}, emptyProps)),
|
1041
|
+
sortIcons: getTableSortIcons(),
|
1016
1042
|
fixedHeader: fullscreenState || fixedTableBody,
|
1017
1043
|
maxBodyHeight: "calc(100vh - ".concat(headerHeight, "px)")
|
1018
1044
|
}, pickProps(getTableProps(), otherProps))), switchViewState === 'card' && /*#__PURE__*/React.createElement(CardView, {
|
1019
1045
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
1020
1046
|
showSkeleton: showSkeleton,
|
1021
|
-
loading:
|
1047
|
+
loading: getTableLoading(),
|
1022
1048
|
originColumns: propsColumns,
|
1023
1049
|
cardViewProps: cardViewProps,
|
1024
1050
|
scrollHeight: fullscreenState || fixedTableBody ? "calc(100vh - ".concat(headerHeight, "px)") : undefined,
|
@@ -1060,28 +1086,28 @@ var ProTable = function ProTable(props) {
|
|
1060
1086
|
})));
|
1061
1087
|
} else return footerAction;
|
1062
1088
|
};
|
1063
|
-
var
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1089
|
+
var renderFooter = function renderFooter() {
|
1090
|
+
function onChangePagination(currentPage) {
|
1091
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1092
|
+
// 翻页默认清空选择
|
1093
|
+
if (!reserveSelectedRecords) {
|
1094
|
+
var _actionRef$current8, _actionRef$current8$c;
|
1095
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
1096
|
+
}
|
1097
|
+
setCurrentPage(currentPage);
|
1098
|
+
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
1069
1099
|
}
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
(
|
1100
|
+
function onChangePaginationSize(currentPageSize) {
|
1101
|
+
var _request10;
|
1102
|
+
// 翻页默认清空选择
|
1103
|
+
if (!reserveSelectedRecords) {
|
1104
|
+
var _actionRef$current9, _actionRef$current9$c;
|
1105
|
+
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
1106
|
+
}
|
1107
|
+
setPageSize(currentPageSize);
|
1108
|
+
setCurrentPage(1);
|
1109
|
+
_request((_request10 = {}, _defineProperty(_request10, targetPageSizeKey, currentPageSize), _defineProperty(_request10, targetPageKey, 1), _request10));
|
1079
1110
|
}
|
1080
|
-
setPageSize(currentPageSize);
|
1081
|
-
setCurrentPage(1);
|
1082
|
-
_request((_request10 = {}, _defineProperty(_request10, targetPageSizeKey, currentPageSize), _defineProperty(_request10, targetPageKey, 1), _request10));
|
1083
|
-
}, [reserveSelectedRecords, actionRef, targetPageSizeKey, targetPageKey]);
|
1084
|
-
var renderFooter = function renderFooter() {
|
1085
1111
|
function renderRowSelection() {
|
1086
1112
|
if (rowSelection) {
|
1087
1113
|
if (showSkeleton) {
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -24,8 +24,6 @@ declare type TDataService = {
|
|
24
24
|
};
|
25
25
|
export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
|
26
26
|
export declare type ProTableColumnProps = {
|
27
|
-
/** 是否开启了自动计算宽度 */
|
28
|
-
isAutoWidth?: boolean;
|
29
27
|
/** 自动计算宽度时的被挤占的情况 */
|
30
28
|
shrink?: number;
|
31
29
|
/** 是否自动适应该列宽度 */
|
@@ -36,12 +36,11 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
36
36
|
var childNodes = dom.children;
|
37
37
|
var finalColumns = [];
|
38
38
|
fileteredColumns.forEach(function (column, index) {
|
39
|
-
var _childNodes$index;
|
40
39
|
var render = column.render,
|
41
40
|
_column$valueType = column.valueType,
|
42
41
|
valueType = _column$valueType === void 0 ? 'text' : _column$valueType,
|
43
|
-
_column$
|
44
|
-
|
42
|
+
_column$autoWidth = column.autoWidth,
|
43
|
+
autoWidth = _column$autoWidth === void 0 ? true : _column$autoWidth,
|
45
44
|
actionSchema = column.actionSchema,
|
46
45
|
sortable = column.sortable,
|
47
46
|
lock = column.lock;
|
@@ -53,17 +52,6 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
53
52
|
var finalType = type || valueType || '';
|
54
53
|
var shrink = fieldTypeShrink[finalType];
|
55
54
|
column.shrink = column.shrink || (shrink !== undefined ? shrink : 1);
|
56
|
-
if ((column === null || column === void 0 ? void 0 : column.isAutoWidth) === false) {
|
57
|
-
// console.log(column.title, 'isAutoWidth')
|
58
|
-
finalColumns.push(column);
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
;
|
62
|
-
if ((column === null || column === void 0 ? void 0 : column.columnFilters) === false) {
|
63
|
-
finalColumns.push(column);
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
// column.isAutoWidth = true
|
67
55
|
//@ts-ignore
|
68
56
|
// if (!autoWidth) {
|
69
57
|
// finalColumns.push(column);
|
@@ -84,20 +72,13 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
84
72
|
if (width >= 280) {
|
85
73
|
width = 280;
|
86
74
|
}
|
87
|
-
column.isAutoWidth = false;
|
88
75
|
column.width = defaultPaddingFixer(width, size, false);
|
89
76
|
}
|
90
77
|
finalColumns.push(column);
|
91
78
|
return;
|
92
79
|
}
|
93
|
-
// 当列没出来的时候不比较
|
94
80
|
// @ts-ignore
|
95
|
-
|
96
|
-
finalColumns.push(column);
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
// @ts-ignore
|
100
|
-
var titleWidth = (_childNodes$index = childNodes[index]) === null || _childNodes$index === void 0 ? void 0 : _childNodes$index.children[0].scrollWidth;
|
81
|
+
var titleWidth = childNodes[index].children[0].scrollWidth;
|
101
82
|
// @ts-ignore
|
102
83
|
if (fixedWidthTypeList[finalType]) {
|
103
84
|
// console.log(
|
@@ -105,32 +86,20 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
105
86
|
// fixedWidthTypeList[finalType],
|
106
87
|
// );
|
107
88
|
// 固定宽度
|
108
|
-
// console.log(column.title, '固定宽度')
|
109
|
-
column.isAutoWidth = false;
|
110
89
|
column.width = defaultPaddingFixer(
|
111
90
|
// @ts-ignore
|
112
91
|
Math.max(titleWidth, fixedWidthTypeList[finalType]), size, index === 0 && useRowSelection);
|
113
92
|
// @ts-ignore
|
114
93
|
} else if (computeableWidthTypeList[finalType]) {
|
115
94
|
// 可计算宽度
|
116
|
-
// console.log(column.title, '可计算宽度')
|
117
|
-
column.isAutoWidth = false;
|
118
95
|
column.width = defaultPaddingFixer(
|
119
96
|
// @ts-ignore
|
120
97
|
Math.max(titleWidth, computeableWidthTypeList[finalType](data, render)), size, index === 0 && useRowSelection);
|
121
98
|
} else {
|
122
99
|
// 直接根据 dom 计算
|
123
|
-
// console.log(column.title, '可计算 dom')
|
124
|
-
column.isAutoWidth = false;
|
125
100
|
column.width = defaultPaddingFixer(Math.max(titleWidth,
|
126
101
|
// @ts-ignore
|
127
102
|
calcWidthWithParentDOM(childNodes[index], column.shrink)), size, index === 0 && useRowSelection);
|
128
|
-
if ((column === null || column === void 0 ? void 0 : column.sortable) && ((column === null || column === void 0 ? void 0 : column.tooltip) || (column === null || column === void 0 ? void 0 : column.filters))) {
|
129
|
-
// 检测有 sortable 和 tooltip 的时候增加宽度
|
130
|
-
column.width = column.width + 40;
|
131
|
-
} else if (column === null || column === void 0 ? void 0 : column.sortable) {
|
132
|
-
column.width = column.width + 24;
|
133
|
-
}
|
134
103
|
}
|
135
104
|
if (index === 0) {
|
136
105
|
// 首列不会被挤占
|
@@ -167,12 +136,8 @@ export var shadowContainer = function shadowContainer(props) {
|
|
167
136
|
//@ts-ignore
|
168
137
|
!fixedWidthTypeList[valueType] && data.map(function (item, index) {
|
169
138
|
// @ts-ignore
|
170
|
-
|
171
|
-
|
172
|
-
newColumn.render = _objectSpread(_objectSpread({}, column.render), {}, {
|
173
|
-
description: ''
|
174
|
-
});
|
175
|
-
return renderCell(getValueFromRecord(dataIndex, item), newColumn, index, item);
|
139
|
+
column.smartWidth = renderCellSmartWidth(getValueFromRecord(dataIndex, item), column, index, item);
|
140
|
+
return renderCell(getValueFromRecord(dataIndex, item), column, index, item);
|
176
141
|
}));
|
177
142
|
}
|
178
143
|
}));
|
@@ -335,8 +300,7 @@ function defaultPaddingFixer(width) {
|
|
335
300
|
}
|
336
301
|
function sum() {
|
337
302
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
338
|
-
|
339
|
-
return list === null || list === void 0 ? void 0 : list.reduce(function (a, b) {
|
303
|
+
return list.reduce(function (a, b) {
|
340
304
|
return a + b;
|
341
305
|
});
|
342
306
|
}
|
@@ -5,10 +5,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
5
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
6
6
|
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; }
|
7
7
|
import React from 'react';
|
8
|
-
import { renderColumnsTitle } from './columnRender';
|
8
|
+
import { renderColumnsTitle, renderCell } from './columnRender';
|
9
9
|
import { ProSkeletonRaw as Skeleton } from '../../skeleton';
|
10
10
|
import { getLanguage } from '@teamix/utils';
|
11
|
-
import Cell from '../components/Cell';
|
12
11
|
/**
|
13
12
|
* ProColumn => Column
|
14
13
|
*/
|
@@ -45,24 +44,7 @@ showSkeleton, actionRef) {
|
|
45
44
|
dataIndex: dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.toString(),
|
46
45
|
title: renderColumnsTitle(columnProps, actionRef, bindUrl, bindUrlProps),
|
47
46
|
cell: function cell(value, index, record) {
|
48
|
-
return
|
49
|
-
value: value,
|
50
|
-
item: columnProps,
|
51
|
-
index: index,
|
52
|
-
record: record,
|
53
|
-
actionRef: actionRef,
|
54
|
-
context: context,
|
55
|
-
dataTeamixSpm: dataTeamixSpm
|
56
|
-
});
|
57
|
-
// return renderCell(
|
58
|
-
// value,
|
59
|
-
// columnProps,
|
60
|
-
// index,
|
61
|
-
// record,
|
62
|
-
// actionRef,
|
63
|
-
// context,
|
64
|
-
// dataTeamixSpm
|
65
|
-
// )
|
47
|
+
return renderCell(value, columnProps, index, record, actionRef, context, dataTeamixSpm);
|
66
48
|
}
|
67
49
|
});
|
68
50
|
});
|
package/lib/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.33";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -299,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
299
299
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
300
300
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
301
301
|
}
|
302
|
-
var version = '1.5.
|
302
|
+
var version = '1.5.33';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|