@teamix/pro 1.4.11 → 1.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.css +1 -1
- package/dist/pro.js +332 -113
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.scss +1 -1
- package/es/form/ProForm/index.scss +5 -0
- package/es/form/SchemaForm/index.js +12 -4
- package/es/form/SchemaForm/initializeDataSource.d.ts +3 -0
- package/es/form/SchemaForm/initializeDataSource.js +7 -0
- package/es/form/SchemaForm/initializeFormButton.js +4 -5
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/ProInfoItem/index.js +33 -4
- package/es/info/components/ProInfoItem/index.scss +18 -11
- package/es/info/components/baseInfo/index.js +4 -1
- package/es/info/components/baseInfo/index.scss +4 -1
- package/es/info/components/headerInfo/index.js +4 -1
- package/es/info/components/headerInfo/index.scss +3 -0
- package/es/info/components/tableInfo/index.js +2 -1
- package/es/info/index.js +6 -3
- package/es/info/typing.d.ts +3 -1
- package/es/table/index.js +95 -50
- package/es/table/index.scss +5 -0
- package/es/table/typing.d.ts +3 -1
- package/es/table/utils/columnRender.js +2 -1
- package/lib/actions/index.scss +1 -1
- package/lib/form/ProForm/index.scss +5 -0
- package/lib/form/SchemaForm/index.js +11 -3
- package/lib/form/SchemaForm/initializeDataSource.d.ts +3 -0
- package/lib/form/SchemaForm/initializeDataSource.js +10 -2
- package/lib/form/SchemaForm/initializeFormButton.js +3 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/ProInfoItem/index.js +33 -4
- package/lib/info/components/ProInfoItem/index.scss +18 -11
- package/lib/info/components/baseInfo/index.js +4 -1
- package/lib/info/components/baseInfo/index.scss +4 -1
- package/lib/info/components/headerInfo/index.js +4 -1
- package/lib/info/components/headerInfo/index.scss +3 -0
- package/lib/info/components/tableInfo/index.js +3 -1
- package/lib/info/index.js +5 -2
- package/lib/info/typing.d.ts +3 -1
- package/lib/table/index.js +95 -49
- package/lib/table/index.scss +5 -0
- package/lib/table/typing.d.ts +3 -1
- package/lib/table/utils/columnRender.js +2 -1
- package/package.json +1 -1
package/es/table/typing.d.ts
CHANGED
@@ -69,7 +69,9 @@ export declare type ProTableProps = {
|
|
69
69
|
/** 请求方法 */
|
70
70
|
method?: Method;
|
71
71
|
/** 请求参数 */
|
72
|
-
params?:
|
72
|
+
params?: {
|
73
|
+
[propName: string]: any;
|
74
|
+
};
|
73
75
|
/** sort 排序请求参数处理函数 */
|
74
76
|
formatSort?: (sort: object) => object;
|
75
77
|
/** 如需自定义调用参数格式,则可以设定此值在请求前对 params 进行自定义,如果返回false则可以阻止请求 */
|
@@ -39,8 +39,9 @@ import Filter from '../components/Filter';
|
|
39
39
|
export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
40
40
|
var filterMode = item.filterMode,
|
41
41
|
filters = item.filters,
|
42
|
+
dataSource = item.dataSource,
|
42
43
|
dataIndex = item.dataIndex,
|
43
|
-
|
44
|
+
valueType = item.valueType; // 为列过滤添加状态标题
|
44
45
|
|
45
46
|
var getItemLabel = function getItemLabel() {
|
46
47
|
if (filters && filterMode !== 'multiple') {
|
package/lib/actions/index.scss
CHANGED
@@ -236,6 +236,11 @@
|
|
236
236
|
}
|
237
237
|
|
238
238
|
// 按钮样式
|
239
|
+
.teamix-button-group-item.#{$form-item-cls}-layout-vertical {
|
240
|
+
> .#{$css-prefix}formily-item-label {
|
241
|
+
display: none;
|
242
|
+
}
|
243
|
+
}
|
239
244
|
.#{$css-prefix}formily-button-group {
|
240
245
|
margin-top: var(--form-element-medium-height, 32px);
|
241
246
|
}
|
@@ -55,7 +55,7 @@ var _utils2 = require("../utils");
|
|
55
55
|
|
56
56
|
var _warning = _interopRequireDefault(require("../warning"));
|
57
57
|
|
58
|
-
var _excluded = ["
|
58
|
+
var _excluded = ["type", "name", "component", "props", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
|
59
59
|
|
60
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
61
61
|
|
@@ -173,9 +173,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
173
173
|
}
|
174
174
|
|
175
175
|
var _newItem2 = newItem,
|
176
|
-
component = _newItem2.component,
|
177
176
|
type = _newItem2.type,
|
178
177
|
name = _newItem2.name,
|
178
|
+
component = _newItem2.component,
|
179
|
+
props = _newItem2.props,
|
179
180
|
decorator = _newItem2.decorator,
|
180
181
|
decoratorProps = _newItem2.decoratorProps,
|
181
182
|
dataSource = _newItem2.dataSource,
|
@@ -211,7 +212,8 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
211
212
|
defaultDataSource = _initializeDataSource.dataSource,
|
212
213
|
dataSourceReactions = _initializeDataSource.reactions,
|
213
214
|
dataSourceScope = _initializeDataSource.scope,
|
214
|
-
dataSourceData = _initializeDataSource.data
|
215
|
+
dataSourceData = _initializeDataSource.data,
|
216
|
+
dataSourceProps = _initializeDataSource.props; // 初始化rules validator
|
215
217
|
|
216
218
|
|
217
219
|
var _initializeRules = (0, _initializeRules2.default)(rules, "".concat(suffix, "v")),
|
@@ -227,10 +229,16 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
227
229
|
v = _ref3[1];
|
228
230
|
|
229
231
|
schemaScopeRef.current[k] = v;
|
232
|
+
}); // 合并字段属性
|
233
|
+
|
234
|
+
var defaultProps = _objectSpread(_objectSpread(_objectSpread({}, props), dataSourceProps), {}, {
|
235
|
+
className: (0, _utils.cls)(props === null || props === void 0 ? void 0 : props.className, dataSourceProps === null || dataSourceProps === void 0 ? void 0 : dataSourceProps.className)
|
230
236
|
});
|
237
|
+
|
231
238
|
var formatParam = (0, _utils2.mapSchemaName)(_objectSpread(_objectSpread({}, otherProps), {}, {
|
232
239
|
type: defaultType,
|
233
240
|
component: component,
|
241
|
+
props: defaultProps,
|
234
242
|
decorator: defaultDecorator,
|
235
243
|
decoratorProps: defaultDecoratorProps,
|
236
244
|
rules: defaultRules,
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
var _utils = require("
|
8
|
+
var _utils = require("@teamix/utils");
|
9
|
+
|
10
|
+
var _utils2 = require("../utils");
|
9
11
|
|
10
12
|
var initializeDataSource = function initializeDataSource(dataSource, suffix) {
|
11
13
|
var _dataSource$extraConf;
|
12
14
|
|
13
|
-
var _initializeRequestExp = (0,
|
15
|
+
var _initializeRequestExp = (0, _utils2.initializeRequestExpression)(dataSource, '$dataSource', suffix),
|
14
16
|
expression = _initializeRequestExp.expression,
|
15
17
|
scope = _initializeRequestExp.scope;
|
16
18
|
|
@@ -19,6 +21,12 @@ var initializeDataSource = function initializeDataSource(dataSource, suffix) {
|
|
19
21
|
scope: scope,
|
20
22
|
data: {
|
21
23
|
readOnlyOnLoading: (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$extraConf = dataSource.extraConfig) === null || _dataSource$extraConf === void 0 ? void 0 : _dataSource$extraConf.readOnly) !== false
|
24
|
+
},
|
25
|
+
props: {
|
26
|
+
className: 'teamix-test-request',
|
27
|
+
'data-teamix-test-request': "url=".concat(dataSource === null || dataSource === void 0 ? void 0 : dataSource.url, "&formatResult=").concat(!!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.formatResult)),
|
28
|
+
'data-teamix-test-params': (0, _utils.getTestRequestParams)(dataSource === null || dataSource === void 0 ? void 0 : dataSource.params),
|
29
|
+
'data-teamix-test-data': (0, _utils.getTestRequestData)('dataSource')
|
22
30
|
}
|
23
31
|
} : {
|
24
32
|
reactions: [],
|
@@ -52,15 +52,14 @@ var initialize = function initialize(item) {
|
|
52
52
|
return initializeButton(item);
|
53
53
|
}
|
54
54
|
|
55
|
-
var commonMode = _objectSpread(_objectSpread({
|
56
|
-
title: ' '
|
57
|
-
}, item), {}, {
|
55
|
+
var commonMode = _objectSpread(_objectSpread({}, item), {}, {
|
58
56
|
component: component,
|
59
57
|
props: otherProps,
|
60
58
|
decorator: 'FormButtonGroup.FormItem',
|
61
59
|
decoratorProps: _objectSpread({
|
62
60
|
inset: false,
|
63
|
-
fullness: true
|
61
|
+
fullness: true,
|
62
|
+
className: (0, _utils.cls)('teamix-button-group-item', decoratorProps === null || decoratorProps === void 0 ? void 0 : decoratorProps.className)
|
64
63
|
}, decoratorProps)
|
65
64
|
}); // 吸底模式
|
66
65
|
|
package/lib/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.4.
|
31
|
+
declare const version = "1.4.14";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -19,7 +19,7 @@ require("./index.scss");
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
var cls = (0, _utils.usePrefixCls)('teamix-pro-
|
22
|
+
var cls = (0, _utils.usePrefixCls)('teamix-pro-info-item');
|
23
23
|
var Row = _components.Grid.Row,
|
24
24
|
Col = _components.Grid.Col;
|
25
25
|
|
@@ -30,7 +30,26 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
30
30
|
headerInfoLayout = prop.headerInfoLayout,
|
31
31
|
loading = prop.loading,
|
32
32
|
tooltip = prop.tooltip,
|
33
|
-
tooltipIcon = prop.tooltipIcon
|
33
|
+
tooltipIcon = prop.tooltipIcon,
|
34
|
+
valueType = prop.valueType,
|
35
|
+
render = prop.render,
|
36
|
+
alignItems = prop.alignItems; // 判断是否需要居中
|
37
|
+
|
38
|
+
var isAlignItemsCenter = function isAlignItemsCenter() {
|
39
|
+
if (typeof render !== 'function') {
|
40
|
+
var type = render === null || render === void 0 ? void 0 : render.type;
|
41
|
+
|
42
|
+
if (valueType === 'selectGroup') {
|
43
|
+
return true;
|
44
|
+
}
|
45
|
+
|
46
|
+
if (type === 'tag' || type === 'statusIconTag' || type === 'eventLevelTag' || type === 'warningLevelTag') {
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
return false;
|
52
|
+
};
|
34
53
|
|
35
54
|
if (baseInfoLayout) {
|
36
55
|
var labelCol = baseInfoLayout.labelCol,
|
@@ -39,7 +58,13 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
39
58
|
className: cls('')
|
40
59
|
}, /*#__PURE__*/_react.default.createElement(Row, {
|
41
60
|
gutter: 10,
|
42
|
-
className: cls(
|
61
|
+
className: cls({
|
62
|
+
'base-row': true,
|
63
|
+
'base-row-center': isAlignItemsCenter()
|
64
|
+
}),
|
65
|
+
style: alignItems ? {
|
66
|
+
alignItems: alignItems
|
67
|
+
} : {}
|
43
68
|
}, /*#__PURE__*/_react.default.createElement(Col, {
|
44
69
|
span: labelCol === null || labelCol === void 0 ? void 0 : labelCol.span,
|
45
70
|
className: cls('label')
|
@@ -63,7 +88,11 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
63
88
|
return /*#__PURE__*/_react.default.createElement("div", {
|
64
89
|
className: cls()
|
65
90
|
}, /*#__PURE__*/_react.default.createElement(Row, {
|
66
|
-
className: cls(
|
91
|
+
className: cls({
|
92
|
+
'header-row': true,
|
93
|
+
'header-row-center': isAlignItemsCenter()
|
94
|
+
}),
|
95
|
+
style: {}
|
67
96
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
68
97
|
className: cls('header-label')
|
69
98
|
}, /*#__PURE__*/_react.default.createElement(_field.LabelIconTip, {
|
@@ -14,43 +14,50 @@ $header-text-size: var(--font-size-body-1, 12px);
|
|
14
14
|
|
15
15
|
$item-padding-bottom: 8px;
|
16
16
|
|
17
|
-
.teamix-pro-
|
17
|
+
.teamix-pro-info-item {
|
18
18
|
width: 100%;
|
19
19
|
padding-bottom: $item-padding-bottom;
|
20
20
|
&-header-row {
|
21
21
|
display: flex;
|
22
|
-
align-items:
|
22
|
+
align-items: flex-start;
|
23
|
+
|
24
|
+
&-center {
|
25
|
+
align-items: center;
|
26
|
+
}
|
23
27
|
}
|
24
28
|
&-base-row {
|
25
29
|
display: flex;
|
26
|
-
align-items:
|
30
|
+
align-items: flex-start;
|
31
|
+
&-center {
|
32
|
+
align-items: center;
|
33
|
+
}
|
27
34
|
}
|
28
35
|
}
|
29
36
|
|
30
|
-
.teamix-pro-
|
37
|
+
.teamix-pro-info-item-label {
|
31
38
|
color: $label-color;
|
32
39
|
font-size: $label-size;
|
33
40
|
// font-weight: $label-weight;
|
34
41
|
display: unset;
|
35
42
|
}
|
36
43
|
|
37
|
-
.teamix-pro-
|
44
|
+
.teamix-pro-info-item-value {
|
38
45
|
color: $text-color;
|
39
46
|
font-size: $text-size;
|
40
|
-
display: unset;
|
47
|
+
//display: unset;
|
41
48
|
width: 100%;
|
42
49
|
padding-right: 20px;
|
43
50
|
}
|
44
51
|
|
45
|
-
.teamix-pro-
|
52
|
+
.teamix-pro-info-item-header-label {
|
46
53
|
color: $header-label-color;
|
47
54
|
font-size: $header-label-size;
|
48
55
|
// font-weight: $header-label-weight;
|
49
56
|
display: inline-block;
|
50
|
-
white-space:nowrap;
|
57
|
+
white-space: nowrap;
|
51
58
|
}
|
52
59
|
|
53
|
-
.teamix-pro-
|
60
|
+
.teamix-pro-info-item-header-value {
|
54
61
|
color: $header-text-color;
|
55
62
|
font-size: $header-text-size;
|
56
63
|
display: inline-block;
|
@@ -58,9 +65,9 @@ $item-padding-bottom: 8px;
|
|
58
65
|
padding-right: 20px;
|
59
66
|
}
|
60
67
|
|
61
|
-
.teamix-pro-
|
68
|
+
.teamix-pro-info-item-base-skeleton-box {
|
62
69
|
width: 100%;
|
63
|
-
height:
|
70
|
+
height: 18px;
|
64
71
|
display: flex;
|
65
72
|
align-items: center;
|
66
73
|
span {
|
@@ -97,7 +97,10 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
97
97
|
}),
|
98
98
|
baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
|
99
99
|
tooltip: item.tooltip,
|
100
|
-
tooltipIcon: item.tooltipIcon
|
100
|
+
tooltipIcon: item.tooltipIcon,
|
101
|
+
render: item.render,
|
102
|
+
valueType: item.valueType,
|
103
|
+
alignItems: item.alignItems
|
101
104
|
}));
|
102
105
|
});
|
103
106
|
};
|
@@ -73,7 +73,10 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
|
|
73
73
|
}),
|
74
74
|
headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
|
75
75
|
tooltip: item.tooltip,
|
76
|
-
tooltipIcon: item.tooltipIcon
|
76
|
+
tooltipIcon: item.tooltipIcon,
|
77
|
+
render: item.render,
|
78
|
+
valueType: item.valueType,
|
79
|
+
alignItems: item.alignItems
|
77
80
|
}));
|
78
81
|
});
|
79
82
|
};
|
@@ -21,6 +21,8 @@ var _2 = require("../../..");
|
|
21
21
|
|
22
22
|
var _utils = require("../../utils");
|
23
23
|
|
24
|
+
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
25
|
+
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
27
|
|
26
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -92,7 +94,7 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
92
94
|
|
93
95
|
var newDataSource = (0, _react.useMemo)(function () {
|
94
96
|
var nResult = [];
|
95
|
-
var columnsCopy =
|
97
|
+
var columnsCopy = (0, _lodash.default)(columns); // 取当前行的数据。直到取完
|
96
98
|
|
97
99
|
while (columnsCopy.length > 0) {
|
98
100
|
var filterColumns = [];
|
package/lib/info/index.js
CHANGED
@@ -199,8 +199,11 @@ var ProInfo = function ProInfo(props) {
|
|
199
199
|
|
200
200
|
return /*#__PURE__*/_react.default.createElement("div", {
|
201
201
|
ref: ref,
|
202
|
-
|
203
|
-
|
202
|
+
style: style,
|
203
|
+
className: (0, _utils2.cls)('teamix-pro-info', className, 'teamix-test-request'),
|
204
|
+
"data-teamix-test-request": "url=".concat(url, "&formatResult=").concat(!!formatResult),
|
205
|
+
"data-teamix-test-params": (0, _utils2.getTestRequestParams)(params),
|
206
|
+
"data-teamix-test-data": (0, _utils2.getTestRequestData)(columns)
|
204
207
|
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread(_objectSpread({
|
205
208
|
compacted: true,
|
206
209
|
hoveredShadow: false,
|
package/lib/info/typing.d.ts
CHANGED
@@ -96,6 +96,8 @@ export interface ProInfoColumnsProps {
|
|
96
96
|
extra?: React.ReactNode;
|
97
97
|
/** 其他 ProField 配置 */
|
98
98
|
props?: any;
|
99
|
+
/** 对齐方式 **/
|
100
|
+
alignItems?: 'center' | 'flex-start' | 'flex-end' | string;
|
99
101
|
}
|
100
102
|
export declare type ProInfoActionType = {
|
101
103
|
/** 刷新Info */
|
@@ -113,7 +115,7 @@ export declare type IProProInfoItem = {
|
|
113
115
|
headerInfoLayout?: ProHeaderInfoLayoutProps;
|
114
116
|
/** loading 状态 */
|
115
117
|
loading?: boolean;
|
116
|
-
} & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon'>;
|
118
|
+
} & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon' | 'render' | 'valueType' | 'alignItems'>;
|
117
119
|
/** header info 定义 */
|
118
120
|
export declare type IProHeaderInfo = {
|
119
121
|
/** 布局值 */
|
package/lib/table/index.js
CHANGED
@@ -40,6 +40,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
40
40
|
|
41
41
|
var _pageContainer = _interopRequireDefault(require("../page-container"));
|
42
42
|
|
43
|
+
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
44
|
+
|
43
45
|
var _typing = require("./typing");
|
44
46
|
|
45
47
|
Object.keys(_typing).forEach(function (key) {
|
@@ -257,7 +259,7 @@ var ProTable = function ProTable(props) {
|
|
257
259
|
var skeletonDataSource = new Array(skeletonSize).fill({});
|
258
260
|
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data'; // 如果使用 customRequest 的话,内置 loading
|
259
261
|
|
260
|
-
var _useState13 = (0, _react.useState)(
|
262
|
+
var _useState13 = (0, _react.useState)(requestWhenMount),
|
261
263
|
_useState14 = _slicedToArray(_useState13, 2),
|
262
264
|
customTableLoading = _useState14[0],
|
263
265
|
setCustomTableLoading = _useState14[1];
|
@@ -301,21 +303,45 @@ var ProTable = function ProTable(props) {
|
|
301
303
|
var autoRefreshTimerRef = (0, _react.useRef)();
|
302
304
|
var onResize = null;
|
303
305
|
(0, _react.useEffect)(function () {
|
306
|
+
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
307
|
+
|
304
308
|
getHeaderHeight(fullscreenState);
|
309
|
+
getFooterSuctionState();
|
305
310
|
|
306
311
|
if (window.onresize) {
|
307
312
|
onResize = window.onresize;
|
308
|
-
|
309
|
-
window.onresize = function () {
|
313
|
+
window.onresize = (0, _lodash.default)(function () {
|
310
314
|
var _onResize;
|
311
315
|
|
312
316
|
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
313
|
-
|
314
|
-
|
317
|
+
|
318
|
+
if (footerSuction) {
|
319
|
+
getFooterSuctionState();
|
320
|
+
}
|
321
|
+
|
322
|
+
if (fixedTableBody) {
|
323
|
+
getHeaderHeight(fullscreenState);
|
324
|
+
}
|
325
|
+
}, 500);
|
315
326
|
} else {
|
316
|
-
window.onresize = function () {
|
317
|
-
|
318
|
-
|
327
|
+
window.onresize = (0, _lodash.default)(function () {
|
328
|
+
if (footerSuction) {
|
329
|
+
getFooterSuctionState();
|
330
|
+
}
|
331
|
+
|
332
|
+
if (fixedTableBody) {
|
333
|
+
getHeaderHeight(fullscreenState);
|
334
|
+
}
|
335
|
+
}, 500);
|
336
|
+
} // 如果不传 dataFilter,则在这里初始化请求
|
337
|
+
|
338
|
+
|
339
|
+
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
340
|
+
|
341
|
+
if (requestWhenMount && !hasDataFilter) {
|
342
|
+
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
343
|
+
|
344
|
+
_request();
|
319
345
|
}
|
320
346
|
|
321
347
|
return function () {
|
@@ -324,6 +350,12 @@ var ProTable = function ProTable(props) {
|
|
324
350
|
} else {
|
325
351
|
window.onresize = null;
|
326
352
|
}
|
353
|
+
|
354
|
+
if (autoRefreshTimerRef.current) {
|
355
|
+
clearTimeout(autoRefreshTimerRef.current);
|
356
|
+
}
|
357
|
+
|
358
|
+
actionRef.current = undefined;
|
327
359
|
};
|
328
360
|
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
329
361
|
|
@@ -339,6 +371,8 @@ var ProTable = function ProTable(props) {
|
|
339
371
|
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
340
372
|
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
341
373
|
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
374
|
+
var tableBodyDom = document.querySelector('.next-table-body');
|
375
|
+
var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
|
342
376
|
setTimeout(function () {
|
343
377
|
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
344
378
|
|
@@ -352,11 +386,32 @@ var ProTable = function ProTable(props) {
|
|
352
386
|
|
353
387
|
// 16px 为 padding
|
354
388
|
var pageHeaderHeight = ((_pageContainerDom$off = pageContainerDom === null || pageContainerDom === void 0 ? void 0 : pageContainerDom.offsetHeight) !== null && _pageContainerDom$off !== void 0 ? _pageContainerDom$off : 0) + 16;
|
355
|
-
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
|
356
|
-
|
389
|
+
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0; // 1 为预留值,js无法取出精确高度,会被四舍五入
|
390
|
+
|
391
|
+
var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
|
392
|
+
var clientTableBodyHeight = document.body.clientHeight - offsetHeaderHeight;
|
393
|
+
|
394
|
+
if (tableBodyDom.clientHeight < clientTableBodyHeight) {
|
395
|
+
setFooterSuctionState(true);
|
396
|
+
} else {
|
397
|
+
setFooterSuctionState(false);
|
398
|
+
} // 如果有切换区tab,那么重新计算
|
399
|
+
|
400
|
+
|
401
|
+
if (headerFixedTopSectionDom.clientHeight) {
|
402
|
+
var _headerFixedTopSectio;
|
403
|
+
|
404
|
+
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0; // const clientTableBodyHeight =
|
405
|
+
// document.body.clientHeight - offsetHeaderHeight;
|
406
|
+
|
407
|
+
setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
|
408
|
+
return;
|
409
|
+
}
|
410
|
+
|
411
|
+
setHeaderHeight(offsetHeaderHeight);
|
357
412
|
} else {
|
358
413
|
// 24px 为 padding
|
359
|
-
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0));
|
414
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0) + 1);
|
360
415
|
}
|
361
416
|
}, 50);
|
362
417
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
@@ -695,6 +750,10 @@ var ProTable = function ProTable(props) {
|
|
695
750
|
if (footerSuction) {
|
696
751
|
getFooterSuctionState();
|
697
752
|
}
|
753
|
+
|
754
|
+
if (fixedTableBody) {
|
755
|
+
getHeaderHeight(fullscreenState);
|
756
|
+
}
|
698
757
|
},
|
699
758
|
onError: function onError(error) {
|
700
759
|
setShowSkeleton(false);
|
@@ -708,6 +767,10 @@ var ProTable = function ProTable(props) {
|
|
708
767
|
if (footerSuction) {
|
709
768
|
getFooterSuctionState();
|
710
769
|
}
|
770
|
+
|
771
|
+
if (fixedTableBody) {
|
772
|
+
getHeaderHeight(fullscreenState);
|
773
|
+
}
|
711
774
|
}
|
712
775
|
}); // 请求函数
|
713
776
|
|
@@ -773,6 +836,20 @@ var ProTable = function ProTable(props) {
|
|
773
836
|
if (footerSuction) {
|
774
837
|
getFooterSuctionState();
|
775
838
|
}
|
839
|
+
|
840
|
+
if (fixedTableBody) {
|
841
|
+
getHeaderHeight(fullscreenState);
|
842
|
+
} // customRequest 中支持 autoRefresh
|
843
|
+
|
844
|
+
|
845
|
+
var time = autoRefresh ? autoRefresh(data) : false;
|
846
|
+
|
847
|
+
if (Number.isInteger(time) && time >= 1000) {
|
848
|
+
autoRefreshTimerRef.current = setTimeout(function () {
|
849
|
+
// 自动刷新不显示 loading
|
850
|
+
_request({}, true);
|
851
|
+
}, Number(time));
|
852
|
+
}
|
776
853
|
});
|
777
854
|
} else {
|
778
855
|
getData.run(requestData);
|
@@ -780,40 +857,6 @@ var ProTable = function ProTable(props) {
|
|
780
857
|
}
|
781
858
|
}
|
782
859
|
|
783
|
-
(0, _react.useEffect)(function () {
|
784
|
-
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
785
|
-
|
786
|
-
// 监听 浏览器变化 更吸底状态
|
787
|
-
if (footerSuction) {
|
788
|
-
getFooterSuctionState();
|
789
|
-
|
790
|
-
window.onresize = function () {
|
791
|
-
getFooterSuctionState();
|
792
|
-
};
|
793
|
-
} // 如果不传 dataFilter,则在这里初始化请求
|
794
|
-
|
795
|
-
|
796
|
-
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
797
|
-
|
798
|
-
if (requestWhenMount && !hasDataFilter) {
|
799
|
-
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
800
|
-
|
801
|
-
_request();
|
802
|
-
}
|
803
|
-
|
804
|
-
return function () {
|
805
|
-
if (autoRefreshTimerRef.current) {
|
806
|
-
clearTimeout(autoRefreshTimerRef.current);
|
807
|
-
}
|
808
|
-
|
809
|
-
if (window.onresize) {
|
810
|
-
window.onresize = null;
|
811
|
-
}
|
812
|
-
|
813
|
-
actionRef.current = undefined;
|
814
|
-
};
|
815
|
-
}, []);
|
816
|
-
|
817
860
|
function onSort(dataIndex, order) {
|
818
861
|
var nextSort = _defineProperty({}, dataIndex, order);
|
819
862
|
|
@@ -879,7 +922,10 @@ var ProTable = function ProTable(props) {
|
|
879
922
|
var renderTable = function renderTable(isFullScreen) {
|
880
923
|
if (propsColumns) {
|
881
924
|
return /*#__PURE__*/_react.default.createElement("div", {
|
882
|
-
className: (0, _classnames.default)('teamix-pro-table-container', className)
|
925
|
+
className: (0, _classnames.default)('teamix-pro-table-container', className, 'teamix-test-request'),
|
926
|
+
"data-teamix-test-request": "url=".concat(url, "&formatResult=").concat(!!formatResult),
|
927
|
+
"data-teamix-test-params": (0, _utils.getTestRequestParams)(propsParams),
|
928
|
+
"data-teamix-test-data": (0, _utils.getTestRequestData)(propsColumns)
|
883
929
|
}, /*#__PURE__*/_react.default.createElement(_Layout.default, {
|
884
930
|
header: header,
|
885
931
|
mainAction: mainAction,
|
@@ -1005,7 +1051,7 @@ var ProTable = function ProTable(props) {
|
|
1005
1051
|
})
|
1006
1052
|
}, renderRowSelection(), /*#__PURE__*/_react.default.createElement("div", {
|
1007
1053
|
className: cls('footer-right-wrapper')
|
1008
|
-
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_Pagination.default, _objectSpread({
|
1054
|
+
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, data.length > 0 && /*#__PURE__*/_react.default.createElement(_Pagination.default, _objectSpread({
|
1009
1055
|
className: cls('pagination'),
|
1010
1056
|
onChange: function onChange(number) {
|
1011
1057
|
return onChangePagination(number);
|
@@ -1027,7 +1073,7 @@ var ProTable = function ProTable(props) {
|
|
1027
1073
|
onPageSizeChange: function onPageSizeChange(number) {
|
1028
1074
|
return onChangePaginationSize(number);
|
1029
1075
|
}
|
1030
|
-
}, props.paginationProps))));
|
1076
|
+
}, props.paginationProps)))));
|
1031
1077
|
} else if (!showPagination) {
|
1032
1078
|
return /*#__PURE__*/_react.default.createElement("div", {
|
1033
1079
|
className: cls('footer', {
|
@@ -1050,7 +1096,7 @@ var ProTable = function ProTable(props) {
|
|
1050
1096
|
|
1051
1097
|
}),
|
1052
1098
|
ref: tableRef
|
1053
|
-
}, renderTable(isFullScreen),
|
1099
|
+
}, renderTable(isFullScreen), footerSuctionState && !fullscreenState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && !fullscreenState) && renderFooter(), fullscreenState && renderFooter());
|
1054
1100
|
});
|
1055
1101
|
};
|
1056
1102
|
|
package/lib/table/index.scss
CHANGED