ztxkui 4.2.18-115 → 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.
- package/dist/UI/Table/index.js +1 -1
- package/dist/components/Table/table-menu.js +5 -1
- package/dist/components/Table/table.d.ts +1 -1
- package/dist/components/Table/table.js +61 -9
- package/dist/components/utils/ZtxkContext.d.ts +6 -1
- package/dist/components/utils/ZtxkContext.js +2 -1
- package/dist/components/utils/useBaseContext.d.ts +1 -0
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/UI/Table/index.js
CHANGED
|
@@ -132,6 +132,10 @@ var TableMenu = forwardRef(function (_a, ref) {
|
|
|
132
132
|
var callback_1 = function () {
|
|
133
133
|
var isFull = realScreenFull_1.isFullscreen;
|
|
134
134
|
setIsFull(isFull);
|
|
135
|
+
// 进入全屏时关闭已打开的明细弹框(弹框挂在body下,全屏层级下不可见,避免退出全屏后突然弹出)
|
|
136
|
+
if (isFull) {
|
|
137
|
+
setVisible(false);
|
|
138
|
+
}
|
|
135
139
|
// 如果是全屏状态,那么修改表格背景
|
|
136
140
|
if (tableRef.current) {
|
|
137
141
|
if (isFull) {
|
|
@@ -326,7 +330,7 @@ var TableMenu = forwardRef(function (_a, ref) {
|
|
|
326
330
|
}
|
|
327
331
|
return (React.createElement(React.Fragment, null,
|
|
328
332
|
React.createElement(Menu, { id: menuId },
|
|
329
|
-
React.createElement(Item, { data: "detail", onClick: onMenuItemClick }, i18next.t('查看明细')),
|
|
333
|
+
!isFull && (React.createElement(Item, { data: "detail", onClick: onMenuItemClick }, i18next.t('查看明细'))),
|
|
330
334
|
onEditableSave || !isContextMenuFullscreen ? null : (React.createElement(Item, { data: "fullscreen", onClick: onMenuItemClick }, isFull ? i18next.t('退出全屏') : i18next.t('全屏')))),
|
|
331
335
|
React.createElement(Modal, { width: "80%", title: i18next.t('详情'), visible: visible, onCancel: onCancel,
|
|
332
336
|
// stick
|
|
@@ -84,7 +84,7 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
|
|
|
84
84
|
isNumberInputAlignRight?: boolean;
|
|
85
85
|
/** 右键是否显示全屏功能 */
|
|
86
86
|
isContextMenuFullscreen?: boolean;
|
|
87
|
-
/**
|
|
87
|
+
/** 是否显示右键菜单(查看明细)。不传时:列表表格取全局 isTableShowContextMenu(默认开启),编辑表格取全局 isTableEditShowContextMenu(默认关闭) */
|
|
88
88
|
isContextMenu?: boolean;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
@@ -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,
|
|
@@ -176,9 +176,13 @@ function Table(props) {
|
|
|
176
176
|
var preDataSource = usePrevious(dataSource);
|
|
177
177
|
var _o = useState(), sortDataSource = _o[0], setSortDataSource = _o[1];
|
|
178
178
|
// 右键菜单(查看明细/全屏):
|
|
179
|
-
// - 表格级 isContextMenu
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
// - 表格级 isContextMenu 优先;不传时按表格类型取对应全局配置:
|
|
180
|
+
// 列表表格取 isTableShowContextMenu(默认开启),编辑表格取 isTableEditShowContextMenu(默认关闭)
|
|
181
|
+
// - 注意:Provider的value是整体替换,业务侧配置对象未写的字段为undefined,这里需兜底默认值
|
|
182
|
+
var _p = useBaseContext(), isTableShowContextMenu = _p.isTableShowContextMenu, isTableEditShowContextMenu = _p.isTableEditShowContextMenu;
|
|
183
|
+
var showContextMenu = isContextMenu !== null && isContextMenu !== void 0 ? isContextMenu : (onEditableSave
|
|
184
|
+
? isTableEditShowContextMenu !== null && isTableEditShowContextMenu !== void 0 ? isTableEditShowContextMenu : false
|
|
185
|
+
: isTableShowContextMenu !== null && isTableShowContextMenu !== void 0 ? isTableShowContextMenu : true);
|
|
182
186
|
var menuId = useState(showContextMenu
|
|
183
187
|
? 'menuId-' + Math.floor(Math.random() * 100000000)
|
|
184
188
|
: undefined)[0];
|
|
@@ -186,8 +190,45 @@ function Table(props) {
|
|
|
186
190
|
var menuShow = useContextMenu({
|
|
187
191
|
id: menuId,
|
|
188
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
|
+
}, []);
|
|
189
230
|
// 内部分页相关配置
|
|
190
|
-
var
|
|
231
|
+
var _q = useInnerPagination(showInnerPagination, defaultInnerPageSize), paginationConfig = _q.paginationConfig, currentPage = _q.currentPage, setCurrent = _q.setCurrent, pageSize = _q.pageSize;
|
|
191
232
|
var rowSelectionDataSource = useRef({});
|
|
192
233
|
var myScroll = useMemo(function () {
|
|
193
234
|
if (scroll) {
|
|
@@ -314,7 +355,7 @@ function Table(props) {
|
|
|
314
355
|
onTableChange && onTableChange(resultTextList, startIndex);
|
|
315
356
|
}, [clearErrorClass, onTableChange]);
|
|
316
357
|
// 2023-05-04 自定义表格排序方法
|
|
317
|
-
var
|
|
358
|
+
var _r = useState(), customOrder = _r[0], setCustomOrder = _r[1];
|
|
318
359
|
var customSortHandle = useCallback(function (info, options) {
|
|
319
360
|
if (Array.isArray(expandableDataSource) &&
|
|
320
361
|
expandableDataSource.length > 1) {
|
|
@@ -398,7 +439,7 @@ function Table(props) {
|
|
|
398
439
|
* 以及一个需要动态列配置的columns
|
|
399
440
|
*/
|
|
400
441
|
var onFillDownChangeRef = useLastest(onFillDownChange);
|
|
401
|
-
var
|
|
442
|
+
var _s = useColumns({
|
|
402
443
|
columns: _columns,
|
|
403
444
|
hiddenColumnDynamicIcon: hiddenColumnDynamicIcon,
|
|
404
445
|
showColumnDynamic: showColumnDynamic,
|
|
@@ -431,7 +472,7 @@ function Table(props) {
|
|
|
431
472
|
isNumberInputThousandth: isNumberInputThousandth,
|
|
432
473
|
isNumberInputAlignRight: isNumberInputAlignRight,
|
|
433
474
|
autoDecimalFieldsRef: autoDecimalFieldsRef,
|
|
434
|
-
}), newColumns =
|
|
475
|
+
}), newColumns = _s.newColumns, dynamicColumns = _s.dynamicColumns, refreshColumnsHandle = _s.refreshColumnsHandle;
|
|
435
476
|
/**
|
|
436
477
|
* @description 保存列配置
|
|
437
478
|
*/
|
|
@@ -916,7 +957,18 @@ function Table(props) {
|
|
|
916
957
|
: paginationConfig
|
|
917
958
|
: pagination, scroll: myScroll, columns: mergeColumns, dataSource: sortDataSource ? sortDataSource : expandableDataSource, components: tableComponents, onRow: onInnerRowHandle,
|
|
918
959
|
// onRow={onMoveRow ? onRowHandle : onRowFn}
|
|
919
|
-
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
|
+
} })),
|
|
920
972
|
showColumnDynamic && dynamicVisible && (React.createElement(TableDynamic, { visible: dynamicVisible, onClose: hideDynamicHandle, onSave: saveDynamicHandle, onReset: resetDynamicHandle, columns: dynamicColumns, dynamicStorageKey: showColumnDynamicKey }))),
|
|
921
973
|
React.createElement("div", { ref: tipRef, className: "table-subtotal--tip" }),
|
|
922
974
|
menuId && (React.createElement(TableMenu, { ref: tableMenuRef, menuId: menuId, columns: newColumns, originColumns: _columns, tableRef: tableRef, virtualTableKey: virtualTableKey, onEditableSave: onEditableSave, isContextMenuFullscreen: isContextMenuFullscreen, className: className }))));
|
|
@@ -48,7 +48,12 @@ export interface IZtxkConfig {
|
|
|
48
48
|
*/
|
|
49
49
|
isUIWeeklyReview?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 列表表格(非编辑表格)是否显示右键菜单(查看明细/全屏),全局默认开关;
|
|
52
|
+
* 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
53
|
+
*/
|
|
54
|
+
isTableShowContextMenu?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 编辑表格是否显示右键菜单(查看明细),全局默认开关;
|
|
52
57
|
* 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
53
58
|
*/
|
|
54
59
|
isTableEditShowContextMenu?: boolean;
|
|
@@ -12,7 +12,8 @@ var ztxkConfig = {
|
|
|
12
12
|
filterColumnExtraWidth: 0,
|
|
13
13
|
isRecordCommonSearch: false,
|
|
14
14
|
isUIWeeklyReview: false,
|
|
15
|
-
|
|
15
|
+
isTableShowContextMenu: true,
|
|
16
|
+
isTableEditShowContextMenu: false,
|
|
16
17
|
};
|
|
17
18
|
var ZtxkContext = React.createContext(ztxkConfig);
|
|
18
19
|
export default ZtxkContext;
|
|
@@ -16,6 +16,7 @@ export default function useBaseContext(): {
|
|
|
16
16
|
filterColumnExtraWidth?: number;
|
|
17
17
|
isRecordCommonSearch?: boolean;
|
|
18
18
|
isUIWeeklyReview?: boolean;
|
|
19
|
+
isTableShowContextMenu?: boolean;
|
|
19
20
|
isTableEditShowContextMenu?: boolean;
|
|
20
21
|
};
|
|
21
22
|
export declare function useAntdContext(): import("antd/lib/config-provider").ConfigConsumerProps;
|
package/dist/index.js
CHANGED
|
@@ -151,9 +151,15 @@
|
|
|
151
151
|
// */
|
|
152
152
|
// isUIWeeklyReview: true,
|
|
153
153
|
// /**
|
|
154
|
-
// *
|
|
154
|
+
// * 编辑表格是否显示右键菜单(查看明细),全局默认开关;
|
|
155
|
+
// * 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
155
156
|
// */
|
|
156
157
|
// isTableEditShowContextMenu: true,
|
|
158
|
+
// /**
|
|
159
|
+
// * 列表表格(非编辑表格)是否显示右键菜单(查看明细/全屏),全局默认开关;
|
|
160
|
+
// * 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
161
|
+
// */
|
|
162
|
+
// isTableShowContextMenu: true,
|
|
157
163
|
// };
|
|
158
164
|
// ReactDOM.render(
|
|
159
165
|
// // <React.StrictMode>
|