zmdms-webui 1.7.1 → 1.7.2

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.
@@ -30,7 +30,7 @@ function useEditChange(dataSourceRef, onTableChange) {
30
30
  * @returns 排序相关方法
31
31
  */
32
32
  function useMoveRowChange(dataSourceRef, onTableChange, options) {
33
- var isMove = options.isMove, refreshScuCell = options.refreshScuCell, currentPage = options.currentPage;
33
+ var isMove = options.isMove, refreshScuCell = options.refreshScuCell, currentPage = options.currentPage, extraOnRow = options.extraOnRow, fixedRowsCount = options.fixedRowsCount, fixedRowsConfig = options.fixedRowsConfig;
34
34
  var moveRow = useCallback(function (dI, hI) {
35
35
  var _a;
36
36
  // 内部分页时,获取数据真正的行数
@@ -56,13 +56,30 @@ function useMoveRowChange(dataSourceRef, onTableChange, options) {
56
56
  });
57
57
  }, [dataSourceRef, onTableChange, refreshScuCell, currentPage]);
58
58
  var onRow = useCallback(function (_, index) {
59
- return {
59
+ var baseProps = {
60
60
  index: index,
61
61
  moveRow: moveRow,
62
62
  };
63
- }, [moveRow]);
63
+ // 确定固定行数量和行高
64
+ var fixedCount = (fixedRowsConfig === null || fixedRowsConfig === void 0 ? void 0 : fixedRowsConfig.count) || fixedRowsCount;
65
+ var rowHeight = (fixedRowsConfig === null || fixedRowsConfig === void 0 ? void 0 : fixedRowsConfig.rowHeight) || 36; // 默认行高36px
66
+ var customStyle = fixedRowsConfig === null || fixedRowsConfig === void 0 ? void 0 : fixedRowsConfig.style;
67
+ // 在这里处理固定行样式
68
+ if (fixedCount && index !== undefined && index < fixedCount) {
69
+ var defaultStyle = {
70
+ position: "sticky",
71
+ top: rowHeight * index,
72
+ background: "#fff",
73
+ borderBottom: "1px solid #f0f0f0",
74
+ zIndex: 10,
75
+ };
76
+ return __assign(__assign({}, baseProps), { style: customStyle
77
+ ? __assign(__assign({}, defaultStyle), customStyle) : defaultStyle });
78
+ }
79
+ return baseProps;
80
+ }, [moveRow, fixedRowsCount, fixedRowsConfig]);
64
81
  return {
65
- onRow: isMove ? onRow : undefined,
82
+ onRow: isMove || fixedRowsCount || fixedRowsConfig ? onRow : extraOnRow,
66
83
  };
67
84
  }
68
85
  /**
@@ -416,6 +416,28 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
416
416
  * 表格id
417
417
  */
418
418
  tableId?: string;
419
+ /**
420
+ * 固定前几行,后面的行使用虚拟滚动
421
+ * 当开启虚拟滚动时,可以设置固定前几行不参与虚拟滚动
422
+ */
423
+ fixedRowsCount?: number;
424
+ /**
425
+ * 固定行配置
426
+ */
427
+ fixedRowsConfig?: {
428
+ /**
429
+ * 固定行数量
430
+ */
431
+ count: number;
432
+ /**
433
+ * 行高,用于计算固定行的top位置
434
+ */
435
+ rowHeight?: number;
436
+ /**
437
+ * 固定行的样式
438
+ */
439
+ style?: React.CSSProperties;
440
+ };
419
441
  }
420
442
  interface IFields {
421
443
  /**
@@ -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, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 65 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, tableId = props.tableId, 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", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId"]);
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, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 65 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, 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", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig"]);
42
42
  var classes = classNames("ztxk-table", className, {
43
43
  "ztxk-table--flex": isFlex,
44
44
  });
@@ -99,6 +99,10 @@ var Table = function (props) {
99
99
  refreshScuCell: refreshScuCell,
100
100
  currentPage: currentPage,
101
101
  filterConfigRef: filterConfigRef,
102
+ extraOnRow: extraOnRow,
103
+ fixedRowsCount: fixedRowsCount,
104
+ fixedRowsConfig: fixedRowsConfig,
105
+ virtualKey: virtualKey,
102
106
  }).onRow;
103
107
  // 内部表格新增删除事件
104
108
  var onAddAndDel = useAddAndDelChange(dataSourceRef, onTableChange, {
@@ -208,9 +212,9 @@ var Table = function (props) {
208
212
  }
209
213
  // 需要支持拖拽
210
214
  if (((_b = components === null || components === void 0 ? void 0 : components.body) === null || _b === void 0 ? void 0 : _b.row) && isMove) {
211
- var row_1 = vComponents.body.row;
215
+ var originalRow_1 = vComponents.body.row;
212
216
  vComponents.body.row = function (props) {
213
- return jsx(MoveBodyRow, __assign({}, props, { vRow: row_1 }));
217
+ return jsx(MoveBodyRow, __assign({}, props, { vRow: originalRow_1 }));
214
218
  };
215
219
  }
216
220
  components = __assign(__assign({}, components), vComponents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",