ztxkui 4.2.18-116 → 4.2.18-117
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.
|
@@ -164,7 +164,7 @@ function Table(props) {
|
|
|
164
164
|
var _this = this;
|
|
165
165
|
var _a, _b, _c, _d;
|
|
166
166
|
var className = props.className, scroll = props.scroll, _e = props.pagination, pagination = _e === void 0 ? false : _e, _f = props.bordered, bordered = _f === void 0 ? true : _f, _columns = props.columns, initColumns = props.initColumns, dataSource = props.dataSource, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, showDelAllBtn = props.showDelAllBtn, delAllChange = props.delAllChange, delIconText = props.delIconText, hiddenColumnDynamicIcon = props.hiddenColumnDynamicIcon, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, summaryConfig = props.summaryConfig, summaryFixed = props.summaryFixed, summary = props.summary, onMoveRow = props.onMoveRow, onEditableSave = props.onEditableSave, onDynamicChange = props.onDynamicChange, _g = props.isResizableColumn, isResizableColumn = _g === void 0 ? true : _g, configInfo = props.configInfo, tableHandleRef = props.tableHandleRef, tableName = props.tableName, isFlex = props.isFlex, onTableChange = props.onTableChange, rowSelection = props.rowSelection, showInnerPagination = props.showInnerPagination, defaultInnerPageSize = props.defaultInnerPageSize, virtualTableKey = props.virtualTableKey, isSort = props.isSort, isFilter = props.isFilter, onSortChange = props.onSortChange, onFillDownChange = props.onFillDownChange, _h = props.isModalInput, isModalInput = _h === void 0 ? false : _h, // 默认关闭这个功能
|
|
167
|
-
onRow = props.onRow, isOpenVirtualScrollBar = props.isOpenVirtualScrollBar, _j = props.isNumberInputThousandth, isNumberInputThousandth = _j === void 0 ? true : _j, _k = props.isNumberInputAlignRight, isNumberInputAlignRight = _k === void 0 ? true : _k, _l = props.isContextMenuFullscreen, isContextMenuFullscreen = _l === void 0 ? true : _l, isContextMenu = props.isContextMenu, restProps = __rest(props, ["className", "scroll", "pagination", "bordered", "columns", "initColumns", "dataSource", "onAddAndDelHandle", "hideAddIcon", "addIconText", "hideDelIcon", "showDelAllBtn", "delAllChange", "delIconText", "hiddenColumnDynamicIcon", "showColumnDynamic", "showColumnDynamicKey", "summaryConfig", "summaryFixed", "summary", "onMoveRow", "onEditableSave", "onDynamicChange", "isResizableColumn", "configInfo", "tableHandleRef", "tableName", "isFlex", "onTableChange", "rowSelection", "showInnerPagination", "defaultInnerPageSize", "virtualTableKey", "isSort", "isFilter", "onSortChange", "onFillDownChange", "isModalInput", "onRow", "isOpenVirtualScrollBar", "isNumberInputThousandth", "isNumberInputAlignRight", "isContextMenuFullscreen", "isContextMenu"]);
|
|
167
|
+
onRow = props.onRow, isOpenVirtualScrollBar = props.isOpenVirtualScrollBar, _j = props.isNumberInputThousandth, isNumberInputThousandth = _j === void 0 ? true : _j, _k = props.isNumberInputAlignRight, isNumberInputAlignRight = _k === void 0 ? true : _k, _l = props.isContextMenuFullscreen, isContextMenuFullscreen = _l === void 0 ? true : _l, isContextMenu = props.isContextMenu, originGetPopupContainer = props.getPopupContainer, restProps = __rest(props, ["className", "scroll", "pagination", "bordered", "columns", "initColumns", "dataSource", "onAddAndDelHandle", "hideAddIcon", "addIconText", "hideDelIcon", "showDelAllBtn", "delAllChange", "delIconText", "hiddenColumnDynamicIcon", "showColumnDynamic", "showColumnDynamicKey", "summaryConfig", "summaryFixed", "summary", "onMoveRow", "onEditableSave", "onDynamicChange", "isResizableColumn", "configInfo", "tableHandleRef", "tableName", "isFlex", "onTableChange", "rowSelection", "showInnerPagination", "defaultInnerPageSize", "virtualTableKey", "isSort", "isFilter", "onSortChange", "onFillDownChange", "isModalInput", "onRow", "isOpenVirtualScrollBar", "isNumberInputThousandth", "isNumberInputAlignRight", "isContextMenuFullscreen", "isContextMenu", "getPopupContainer"]);
|
|
168
168
|
var onChange = restProps.onChange;
|
|
169
169
|
var classes = classNames('zt-table', className, {
|
|
170
170
|
'zt-table--flex': isFlex,
|
|
@@ -190,6 +190,43 @@ function Table(props) {
|
|
|
190
190
|
var menuShow = useContextMenu({
|
|
191
191
|
id: menuId,
|
|
192
192
|
}).show;
|
|
193
|
+
/**
|
|
194
|
+
* 浏览器全屏时,全屏元素位于 top layer,挂在 body 上的浮层(过滤下拉等)会被遮挡。
|
|
195
|
+
* 1. getPopupContainer:全屏时把表格浮层挂到表格容器内(实时读取 fullscreenElement,不依赖状态);
|
|
196
|
+
* 2. fullscreenchange:rc-util 的弹层容器只在首次打开时确定挂载点,
|
|
197
|
+
* 非全屏时打开过的过滤弹层仍留在 body,进入全屏后需迁移到全屏元素内,退出时迁回。
|
|
198
|
+
*/
|
|
199
|
+
useEffect(function () {
|
|
200
|
+
var onFullscreenChange = function () {
|
|
201
|
+
var fullscreenEl = document.fullscreenElement;
|
|
202
|
+
if (fullscreenEl) {
|
|
203
|
+
// 仅当前表格在全屏元素内时才迁移(全屏的可能是别的容器)
|
|
204
|
+
if (!tableRef.current || !fullscreenEl.contains(tableRef.current)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
Array.from(document.body.children).forEach(function (node) {
|
|
208
|
+
var el = node;
|
|
209
|
+
if (el.tagName === 'DIV' &&
|
|
210
|
+
el.querySelector('.ant-table-filter-dropdown')) {
|
|
211
|
+
el.dataset.ztPopupMoved = 'fullscreen';
|
|
212
|
+
fullscreenEl.appendChild(el);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
document
|
|
218
|
+
.querySelectorAll('[data-zt-popup-moved]')
|
|
219
|
+
.forEach(function (el) {
|
|
220
|
+
delete el.dataset.ztPopupMoved;
|
|
221
|
+
document.body.appendChild(el);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
document.addEventListener('fullscreenchange', onFullscreenChange);
|
|
226
|
+
return function () {
|
|
227
|
+
document.removeEventListener('fullscreenchange', onFullscreenChange);
|
|
228
|
+
};
|
|
229
|
+
}, []);
|
|
193
230
|
// 内部分页相关配置
|
|
194
231
|
var _q = useInnerPagination(showInnerPagination, defaultInnerPageSize), paginationConfig = _q.paginationConfig, currentPage = _q.currentPage, setCurrent = _q.setCurrent, pageSize = _q.pageSize;
|
|
195
232
|
var rowSelectionDataSource = useRef({});
|
|
@@ -920,7 +957,18 @@ function Table(props) {
|
|
|
920
957
|
: paginationConfig
|
|
921
958
|
: pagination, scroll: myScroll, columns: mergeColumns, dataSource: sortDataSource ? sortDataSource : expandableDataSource, components: tableComponents, onRow: onInnerRowHandle,
|
|
922
959
|
// onRow={onMoveRow ? onRowHandle : onRowFn}
|
|
923
|
-
summary: summaryConfig ? onSummaryHandle : summary, rowSelection: rowSelection ? rowSelectionObj : rowSelection, locale: tableLocal }, restProps)
|
|
960
|
+
summary: summaryConfig ? onSummaryHandle : summary, rowSelection: rowSelection ? rowSelectionObj : rowSelection, locale: tableLocal }, restProps, { getPopupContainer: function (triggerNode) {
|
|
961
|
+
// 全屏时浮层必须挂到全屏元素内部,否则会被全屏元素遮挡(浏览器 top layer 机制)。
|
|
962
|
+
// 实时读取 fullscreenElement,不依赖 isFull 状态。
|
|
963
|
+
var fullscreenEl = document.fullscreenElement;
|
|
964
|
+
if (fullscreenEl &&
|
|
965
|
+
tableRef.current &&
|
|
966
|
+
fullscreenEl.contains(tableRef.current)) {
|
|
967
|
+
return tableRef.current;
|
|
968
|
+
}
|
|
969
|
+
// 不能返回 undefined:rc-trigger 拿不到挂载点会无限重试,弹层永不显示
|
|
970
|
+
return (originGetPopupContainer === null || originGetPopupContainer === void 0 ? void 0 : originGetPopupContainer(triggerNode)) || document.body;
|
|
971
|
+
} })),
|
|
924
972
|
showColumnDynamic && dynamicVisible && (React.createElement(TableDynamic, { visible: dynamicVisible, onClose: hideDynamicHandle, onSave: saveDynamicHandle, onReset: resetDynamicHandle, columns: dynamicColumns, dynamicStorageKey: showColumnDynamicKey }))),
|
|
925
973
|
React.createElement("div", { ref: tipRef, className: "table-subtotal--tip" }),
|
|
926
974
|
menuId && (React.createElement(TableMenu, { ref: tableMenuRef, menuId: menuId, columns: newColumns, originColumns: _columns, tableRef: tableRef, virtualTableKey: virtualTableKey, onEditableSave: onEditableSave, isContextMenuFullscreen: isContextMenuFullscreen, className: className }))));
|