@teamix/pro 1.4.9 → 1.4.10
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 +141 -67
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/form/Components/ProField/mapDateFormat.js +0 -1
- package/es/form/Filter/AdvancedFilter.js +22 -12
- package/es/form/ProForm/index.js +12 -11
- package/es/form/typing.d.ts +3 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.scss +4 -0
- package/es/table/components/Layout/index.js +15 -15
- package/es/table/index.js +59 -22
- package/es/table/typing.d.ts +3 -1
- package/lib/form/Components/ProField/mapDateFormat.js +0 -1
- package/lib/form/Filter/AdvancedFilter.js +21 -11
- package/lib/form/ProForm/index.js +11 -10
- package/lib/form/typing.d.ts +3 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.scss +4 -0
- package/lib/table/components/Layout/index.js +15 -15
- package/lib/table/index.js +59 -22
- package/lib/table/typing.d.ts +3 -1
- package/package.json +1 -1
@@ -107,13 +107,11 @@ var Layout = function Layout(props) {
|
|
107
107
|
onExpand: function onExpand(expand) {
|
108
108
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
109
109
|
setTimeout(function () {
|
110
|
-
var _actionRef$current, _actionRef$current$
|
110
|
+
var _actionRef$current, _actionRef$current$re;
|
111
111
|
|
112
|
-
if (
|
113
|
-
|
114
|
-
|
115
|
-
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
116
|
-
}
|
112
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
113
|
+
// 偏移量8像素为面板展开后的下margin
|
114
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.resetTableMaxBodyHeight) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current, expand ? 8 : 0); // }
|
117
115
|
});
|
118
116
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
119
117
|
},
|
@@ -127,13 +125,11 @@ var Layout = function Layout(props) {
|
|
127
125
|
onExpand: function onExpand(expand) {
|
128
126
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
129
127
|
setTimeout(function () {
|
130
|
-
var _actionRef$
|
131
|
-
|
132
|
-
if ((_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : _actionRef$current3$g.call(_actionRef$current3).fullScreenState) {
|
133
|
-
var _actionRef$current4, _actionRef$current4$r;
|
128
|
+
var _actionRef$current2, _actionRef$current2$r;
|
134
129
|
|
135
|
-
|
136
|
-
|
130
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
131
|
+
// 偏移量8像素为面板展开后的下margin
|
132
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2, expand ? 8 : 0); // }
|
137
133
|
});
|
138
134
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
139
135
|
},
|
@@ -195,9 +191,13 @@ var Layout = function Layout(props) {
|
|
195
191
|
}
|
196
192
|
};
|
197
193
|
|
198
|
-
|
199
|
-
|
200
|
-
|
194
|
+
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra) {
|
195
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
196
|
+
className: cls()
|
197
|
+
}, renderLayout());
|
198
|
+
}
|
199
|
+
|
200
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
201
201
|
};
|
202
202
|
|
203
203
|
var _default = /*#__PURE__*/_react.default.memo(Layout);
|
package/lib/table/index.js
CHANGED
@@ -53,7 +53,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
53
53
|
}
|
54
54
|
});
|
55
55
|
});
|
56
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "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", "reserveSelectedRecords", "size", "disableSelectAll", "context"];
|
56
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "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", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody"];
|
57
57
|
|
58
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
59
59
|
|
@@ -215,6 +215,8 @@ var ProTable = function ProTable(props) {
|
|
215
215
|
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
216
216
|
disableSelectAll = props.disableSelectAll,
|
217
217
|
context = props.context,
|
218
|
+
_props$fixedTableBody = props.fixedTableBody,
|
219
|
+
fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
|
218
220
|
otherProps = _objectWithoutProperties(props, _excluded);
|
219
221
|
|
220
222
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -296,9 +298,36 @@ var ProTable = function ProTable(props) {
|
|
296
298
|
actionRefCallback = _useState24[0]; // 存储定时器 id
|
297
299
|
|
298
300
|
|
299
|
-
var autoRefreshTimerRef = (0, _react.useRef)();
|
301
|
+
var autoRefreshTimerRef = (0, _react.useRef)();
|
302
|
+
var onResize = null;
|
303
|
+
(0, _react.useEffect)(function () {
|
304
|
+
getHeaderHeight(fullscreenState);
|
305
|
+
|
306
|
+
if (window.onresize) {
|
307
|
+
onResize = window.onresize;
|
308
|
+
|
309
|
+
window.onresize = function () {
|
310
|
+
var _onResize;
|
311
|
+
|
312
|
+
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
313
|
+
getHeaderHeight(fullscreenState);
|
314
|
+
};
|
315
|
+
} else {
|
316
|
+
window.onresize = function () {
|
317
|
+
getHeaderHeight(fullscreenState);
|
318
|
+
};
|
319
|
+
}
|
300
320
|
|
301
|
-
|
321
|
+
return function () {
|
322
|
+
if (onResize) {
|
323
|
+
window.onresize = onResize;
|
324
|
+
} else {
|
325
|
+
window.onresize = null;
|
326
|
+
}
|
327
|
+
};
|
328
|
+
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
329
|
+
|
330
|
+
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
302
331
|
var _tableDom$getElements, _tableDom$getElements2;
|
303
332
|
|
304
333
|
var tableDom = tableRef.current;
|
@@ -307,16 +336,29 @@ var ProTable = function ProTable(props) {
|
|
307
336
|
base: true
|
308
337
|
});
|
309
338
|
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
310
|
-
|
311
|
-
|
312
|
-
|
339
|
+
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
340
|
+
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
341
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
342
|
+
setTimeout(function () {
|
343
|
+
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
313
344
|
|
314
|
-
|
345
|
+
var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
|
315
346
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
347
|
+
var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
|
348
|
+
var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50; // 固定表格主体高度
|
349
|
+
|
350
|
+
if (fixedTableBody && !isFullscreen) {
|
351
|
+
var _pageContainerDom$off, _teamixNavDom$offsetH;
|
352
|
+
|
353
|
+
// 16px 为 padding
|
354
|
+
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
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0));
|
357
|
+
} else {
|
358
|
+
// 24px 为 padding
|
359
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0));
|
360
|
+
}
|
361
|
+
}, 50);
|
320
362
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
321
363
|
|
322
364
|
|
@@ -514,10 +556,8 @@ var ProTable = function ProTable(props) {
|
|
514
556
|
|
515
557
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
516
558
|
|
517
|
-
getHeaderHeight().then(function (height) {
|
518
|
-
setHeaderHeight(height);
|
519
|
-
});
|
520
559
|
setFullscreenState(state);
|
560
|
+
getHeaderHeight(state);
|
521
561
|
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
|
522
562
|
return state;
|
523
563
|
},
|
@@ -585,10 +625,8 @@ var ProTable = function ProTable(props) {
|
|
585
625
|
normalDataFilterForm: normalDataFilterForm,
|
586
626
|
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
587
627
|
filterEnableRef: filterEnableRef,
|
588
|
-
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
589
|
-
getHeaderHeight(
|
590
|
-
setHeaderHeight(height);
|
591
|
-
});
|
628
|
+
resetTableMaxBodyHeight: function resetTableMaxBodyHeight(offset) {
|
629
|
+
getHeaderHeight(fullscreenState, offset);
|
592
630
|
}
|
593
631
|
}); // 将 Actions 绑定到传入的 propsActionRef 中
|
594
632
|
|
@@ -869,9 +907,8 @@ var ProTable = function ProTable(props) {
|
|
869
907
|
rowSelection: rowSelection,
|
870
908
|
emptyContent: /*#__PURE__*/_react.default.createElement(_EmptyContent.default, null),
|
871
909
|
sortIcons: (0, _getTableSortIcons.default)(),
|
872
|
-
fixedHeader: fullscreenState,
|
873
|
-
|
874
|
-
maxBodyHeight: "calc(100vh - 84px - ".concat(headerHeight, "px)")
|
910
|
+
fixedHeader: fullscreenState || fixedTableBody,
|
911
|
+
maxBodyHeight: "calc(100vh - ".concat(headerHeight, "px)")
|
875
912
|
}, (0, _utils.pickProps)((0, _getTableProps.default)(), otherProps))));
|
876
913
|
} else {
|
877
914
|
// 不传 columns 直接返回原始 Table
|
@@ -1013,7 +1050,7 @@ var ProTable = function ProTable(props) {
|
|
1013
1050
|
|
1014
1051
|
}),
|
1015
1052
|
ref: tableRef
|
1016
|
-
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
1053
|
+
}, renderTable(isFullScreen), (footerSuctionState && footerSuction && !fullscreenState || fixedTableBody) && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && !fixedTableBody && renderFooter(), fullscreenState && renderFooter());
|
1017
1054
|
});
|
1018
1055
|
};
|
1019
1056
|
|
package/lib/table/typing.d.ts
CHANGED
@@ -141,6 +141,8 @@ export declare type ProTableProps = {
|
|
141
141
|
disableSelectAll?: boolean;
|
142
142
|
/** 接收外部传来的 context,eg: dialog-table */
|
143
143
|
context?: any;
|
144
|
+
/** 是否固定表格主体(开启后横向滚动条会固定在底部) */
|
145
|
+
fixedTableBody?: boolean;
|
144
146
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
145
147
|
export declare type rowSelectionType = {
|
146
148
|
getProps?: (record: any, index: number) => any;
|
@@ -224,7 +226,7 @@ export declare type ProTableActionTypeMutations = {
|
|
224
226
|
/** 获取 列 过滤规则 */
|
225
227
|
getFilterRules?: () => object;
|
226
228
|
/** 重新计算表格maxHeight高度 */
|
227
|
-
resetTableMaxBodyHeight?: () => void;
|
229
|
+
resetTableMaxBodyHeight?: (offset: number) => void;
|
228
230
|
/** 列筛选规则 */
|
229
231
|
filterColumns?: any[];
|
230
232
|
/** 获取所有 on 监听事件 */
|