zmdms-webui 1.4.8 → 1.4.9

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.
@@ -1,6 +1,6 @@
1
1
  import { __rest, __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { memo, useRef, useMemo, useCallback, useImperativeHandle } from 'react';
3
+ import { memo, useMemo, useRef, useCallback, useImperativeHandle } from 'react';
4
4
  import { Table as Table$1 } from 'antd';
5
5
  import { BasicBodyRow, MoveBodyRow } from './components/EnhanceBodyRow.js';
6
6
  import EnhanceCell from './components/EnhanceBodyCell.js';
@@ -38,7 +38,7 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
38
38
  // completed: 实现从execl复制到表格中的功能
39
39
  var Table = function (props) {
40
40
  // console.log("表格渲染");
41
- var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom"]);
41
+ var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll"]);
42
42
  var classes = classNames("ztxk-table", className, {
43
43
  "ztxk-table--flex": isFlex,
44
44
  });
@@ -65,6 +65,21 @@ var Table = function (props) {
65
65
  var dataSourceRef = useLatest(currentTableDataSource);
66
66
  var hiddenDelBtnHandleRef = useLatest(hiddenDelBtnHandle);
67
67
  var hiddenAddBtnHandleRef = useLatest(hiddenAddBtnHandle);
68
+ var proxyScroll = useMemo(function () {
69
+ if (scroll) {
70
+ // 如果没数据时,肯定不需要y轴滚动条
71
+ if (!currentTableDataSource ||
72
+ (currentTableDataSource && (currentTableDataSource === null || currentTableDataSource === void 0 ? void 0 : currentTableDataSource.length) === 0)) {
73
+ return __assign(__assign({}, scroll), { y: undefined });
74
+ }
75
+ // 假设每行高度固定,如果没超过一页,则不出现滚动条
76
+ // if (currentTableDataSource && currentTableDataSource?.length <= 10) {
77
+ // return { ...scroll, y: undefined };
78
+ // }
79
+ return scroll;
80
+ }
81
+ return {};
82
+ }, [scroll, currentTableDataSource]);
68
83
  // 内部分页相关配置
69
84
  var _r = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
70
85
  innerPaginationPosition: innerPaginationPosition,
@@ -143,12 +158,11 @@ var Table = function (props) {
143
158
  var _s = useTableValidate(), tableRef = _s.tableRef, getCurrentTable = _s.getCurrentTable, clearErrorClass = _s.clearErrorClass;
144
159
  // 虚拟滚动选项
145
160
  var vComponents = useMemo(function () {
146
- var _a;
147
161
  if (virtualKey) {
148
162
  // 使用VList 即可有虚拟列表的效果
149
163
  return VList({
150
164
  vid: virtualKey,
151
- height: ((_a = props.scroll) === null || _a === void 0 ? void 0 : _a.y) ? props.scroll.y : 200,
165
+ height: (proxyScroll === null || proxyScroll === void 0 ? void 0 : proxyScroll.y) ? proxyScroll.y : 200,
152
166
  resetTopWhenDataChange: false,
153
167
  });
154
168
  }
@@ -271,7 +285,7 @@ var Table = function (props) {
271
285
  ? pagination
272
286
  ? pagination
273
287
  : paginationConfig
274
- : pagination, rowClassName: rowClassName }, resetProps)));
288
+ : pagination, rowClassName: rowClassName, scroll: proxyScroll }, resetProps)));
275
289
  return (jsxs("div", __assign({ style: isFlex
276
290
  ? {
277
291
  position: "relative",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",