tomtaw-vxe-table 3.25.19 → 3.25.21

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.
Files changed (43) hide show
  1. package/es/colgroup/index.d.ts +2 -0
  2. package/es/column/index.d.ts +2 -0
  3. package/es/grid/index.d.ts +2 -0
  4. package/es/grid/src/grid.d.ts +1 -0
  5. package/es/table/src/body.js +84 -36
  6. package/es/table/src/column.d.ts +2 -0
  7. package/es/table/src/column.js +2 -0
  8. package/es/table/src/columnInfo.js +1 -0
  9. package/es/table/src/group.d.ts +1 -0
  10. package/es/table/src/header.d.ts +3 -1
  11. package/es/table/src/header.js +49 -12
  12. package/es/table/src/methods.js +142 -79
  13. package/es/table/src/table.js +6 -15
  14. package/es/table/src/util.d.ts +3 -1
  15. package/es/table/src/util.js +30 -14
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/log.js +1 -1
  18. package/lib/index.umd.js +315 -164
  19. package/lib/index.umd.min.js +3 -3
  20. package/lib/table/src/body.js +84 -36
  21. package/lib/table/src/column.js +2 -0
  22. package/lib/table/src/columnInfo.js +1 -0
  23. package/lib/table/src/header.js +48 -11
  24. package/lib/table/src/methods.js +147 -86
  25. package/lib/table/src/table.js +6 -15
  26. package/lib/table/src/util.js +30 -14
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/src/log.js +1 -1
  29. package/package.json +1 -1
  30. package/packages/table/src/body.ts +71 -35
  31. package/packages/table/src/column.ts +2 -0
  32. package/packages/table/src/columnInfo.ts +1 -0
  33. package/packages/table/src/header.ts +53 -13
  34. package/packages/table/src/methods.ts +176 -79
  35. package/packages/table/src/table.ts +10 -18
  36. package/packages/table/src/util.ts +32 -15
  37. package/types/all.d.ts +23 -1
  38. /package/es/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
  39. /package/es/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
  40. /package/es/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
  41. /package/lib/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
  42. /package/lib/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
  43. /package/lib/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
@@ -19,6 +19,7 @@ export declare const VxeColgroup: import("vue/types/vue").ExtendedVue<import("vu
19
19
  headerClassName: string | Function;
20
20
  footerClassName: string | Function;
21
21
  formatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Formatter<any>;
22
+ rowScopedSlot: boolean;
22
23
  headerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.HeaderFormatter;
23
24
  footerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.FooterFormatter<any>;
24
25
  padding: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Padding;
@@ -79,6 +80,7 @@ export declare const Colgroup: import("vue/types/vue").ExtendedVue<import("vue")
79
80
  headerClassName: string | Function;
80
81
  footerClassName: string | Function;
81
82
  formatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Formatter<any>;
83
+ rowScopedSlot: boolean;
82
84
  headerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.HeaderFormatter;
83
85
  footerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.FooterFormatter<any>;
84
86
  padding: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Padding;
@@ -19,6 +19,7 @@ export declare const VxeColumn: import("vue/types/vue").ExtendedVue<import("vue"
19
19
  headerClassName: string | Function;
20
20
  footerClassName: string | Function;
21
21
  formatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Formatter<any>;
22
+ rowScopedSlot: boolean;
22
23
  headerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.HeaderFormatter;
23
24
  footerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.FooterFormatter<any>;
24
25
  padding: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Padding;
@@ -79,6 +80,7 @@ export declare const Column: import("vue/types/vue").ExtendedVue<import("vue").d
79
80
  headerClassName: string | Function;
80
81
  footerClassName: string | Function;
81
82
  formatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Formatter<any>;
83
+ rowScopedSlot: boolean;
82
84
  headerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.HeaderFormatter;
83
85
  footerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.FooterFormatter<any>;
84
86
  padding: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Padding;
@@ -393,6 +393,7 @@ export declare const VxeGrid: import("vue/types/vue").ExtendedVue<import("vue").
393
393
  blur(): Promise<void>;
394
394
  setCustomStoreData(storeData: import("vxe-pc-ui/types/components/table").VxeTableDefines.CustomStoreData | null): Promise<void>;
395
395
  getCustomStoreData(): import("vxe-pc-ui/types/components/table").VxeTableDefines.CustomStoreData;
396
+ refreshRowContent(rows: any[]): Promise<void>;
396
397
  refreshRowExpandHeight(): Promise<void>;
397
398
  updateThumbSize(): void;
398
399
  updateThumbOffset(): void;
@@ -1024,6 +1025,7 @@ export declare const Grid: import("vue/types/vue").ExtendedVue<import("vue").def
1024
1025
  blur(): Promise<void>;
1025
1026
  setCustomStoreData(storeData: import("vxe-pc-ui/types/components/table").VxeTableDefines.CustomStoreData | null): Promise<void>;
1026
1027
  getCustomStoreData(): import("vxe-pc-ui/types/components/table").VxeTableDefines.CustomStoreData;
1028
+ refreshRowContent(rows: any[]): Promise<void>;
1027
1029
  refreshRowExpandHeight(): Promise<void>;
1028
1030
  updateThumbSize(): void;
1029
1031
  updateThumbOffset(): void;
@@ -406,6 +406,7 @@ declare const _default: import("vue/types/vue").ExtendedVue<import("vue").defaul
406
406
  blur(): Promise<void>;
407
407
  setCustomStoreData(storeData: VxeTableDefines.CustomStoreData | null): Promise<void>;
408
408
  getCustomStoreData(): VxeTableDefines.CustomStoreData;
409
+ refreshRowContent(rows: any[]): Promise<void>;
409
410
  refreshRowExpandHeight(): Promise<void>;
410
411
  updateThumbSize(): void;
411
412
  updateThumbOffset(): void;
@@ -1,5 +1,6 @@
1
1
  import XEUtils from "xe-utils";
2
2
  import { VxeUI } from "@vxe-ui/core";
3
+ import { defineVxeComponent } from "../../ui/src/comp";
3
4
  import { isEnableConf, getClass, getDefaultConfig, hasEnableConf } from "../../ui/src/utils";
4
5
  import { getRowid, createHandleGetRowId, getCellRestHeight } from "./util";
5
6
  import { getRowExpandHeight } from "./expand-height";
@@ -8,6 +9,52 @@ import { getSlotVNs } from "../../ui/src/vn";
8
9
  const { getI18n, renderer, renderEmptyElement } = VxeUI;
9
10
  const sourceType = "table";
10
11
  const renderType = "body";
12
+ const cellScopeKeys = [
13
+ "$table",
14
+ "$grid",
15
+ "$gantt",
16
+ "isEdit",
17
+ "seq",
18
+ "rowid",
19
+ "row",
20
+ "rowIndex",
21
+ "$rowIndex",
22
+ "_rowIndex",
23
+ "column",
24
+ "columnIndex",
25
+ "$columnIndex",
26
+ "_columnIndex",
27
+ "fixed",
28
+ "source",
29
+ "type",
30
+ "isHidden",
31
+ "level",
32
+ "visibleData",
33
+ "data",
34
+ "items"
35
+ ];
36
+ const RowScopedCell = defineVxeComponent({
37
+ name: "VxeRowScopedCell",
38
+ props: [...cellScopeKeys, "contentVersion", "rowOrder", "defaultSlot"],
39
+ data() {
40
+ const props = this.$props;
41
+ const scope = {};
42
+ for (const key of cellScopeKeys) {
43
+ Object.defineProperty(scope, key, { enumerable: true, get: () => props[key] });
44
+ }
45
+ return { cellScope: Object.freeze(scope) };
46
+ },
47
+ render(h) {
48
+ void this.contentVersion;
49
+ void this.rowOrder;
50
+ void this.defaultSlot;
51
+ const scope = this.cellScope;
52
+ return h("div", {
53
+ class: "vxe-cell--wrapper vxe-body-cell--wrapper",
54
+ attrs: { rowid: scope.rowid, colid: scope.column.id }
55
+ }, scope.column.renderCell(h, scope));
56
+ }
57
+ });
11
58
  const isVMScrollProcess = ($xeTable) => {
12
59
  const tableProps = $xeTable;
13
60
  const tableReactData = $xeTable;
@@ -74,7 +121,26 @@ function renderLine(h, $xeTable, rowid, params, cellHeight) {
74
121
  }
75
122
  return [];
76
123
  }
77
- function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
124
+ function getBodyCellOptions($xeTable) {
125
+ return {
126
+ cellOpts: $xeTable.computeCellOpts,
127
+ validOpts: $xeTable.computeValidOpts,
128
+ checkboxOpts: $xeTable.computeCheckboxOpts,
129
+ editOpts: $xeTable.computeEditOpts,
130
+ tooltipOpts: $xeTable.computeTooltipOpts,
131
+ virtualXOpts: $xeTable.computeVirtualXOpts,
132
+ virtualYOpts: $xeTable.computeVirtualYOpts,
133
+ rendererOpts: $xeTable.computeRendererOpts,
134
+ rowOpts: $xeTable.computeRowOpts,
135
+ rowDragOpts: $xeTable.computeRowDragOpts,
136
+ columnOpts: $xeTable.computeColumnOpts,
137
+ mouseOpts: $xeTable.computeMouseOpts,
138
+ areaOpts: $xeTable.computeAreaOpts,
139
+ defaultRowHeight: $xeTable.computeDefaultRowHeight,
140
+ cellOffsetWidth: $xeTable.computeCellOffsetWidth
141
+ };
142
+ }
143
+ function renderTdColumn(h, $xeTable, options, rowRest, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
78
144
  const tableProps = $xeTable;
79
145
  const tableReactData = $xeTable;
80
146
  const tableInternalData = $xeTable;
@@ -83,29 +149,14 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
83
149
  const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, treeConfig, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
84
150
  const { tableData, tableColumn, dragRow, overflowX, overflowY, scrollXLoad, scrollYLoad, mergeBodyFlag, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, editStore, isAllOverflow, validErrorMaps, currColFlag } = tableReactData;
85
151
  const { fullAllDataRowIdData, fullColumnIdData, mergeBodyCellMaps, visibleColumn, afterFullData, mergeBodyList, scrollXStore, scrollYStore, keepUpdateFieldMaps, currentCol } = tableInternalData;
86
- const cellOpts = $xeTable.computeCellOpts;
87
- const validOpts = $xeTable.computeValidOpts;
88
- const checkboxOpts = $xeTable.computeCheckboxOpts;
89
- const editOpts = $xeTable.computeEditOpts;
90
- const tooltipOpts = $xeTable.computeTooltipOpts;
91
- const virtualXOpts = $xeTable.computeVirtualXOpts;
92
- const virtualYOpts = $xeTable.computeVirtualYOpts;
93
- const rendererOpts = $xeTable.computeRendererOpts;
152
+ const { cellOpts, validOpts, checkboxOpts, editOpts, tooltipOpts, virtualXOpts, virtualYOpts, rendererOpts, rowOpts, rowDragOpts, columnOpts, mouseOpts, areaOpts, defaultRowHeight, cellOffsetWidth } = options;
94
153
  const { isAllColumnDrag, isAllRowDrag } = $xeTable.resizableOpts;
95
- const rowOpts = $xeTable.computeRowOpts;
96
- const rowDragOpts = $xeTable.computeRowDragOpts;
97
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
98
154
  const customCellHeight = calcCellHeightFlag ? cellOpts.height || rowOpts.height : 0;
99
155
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = rowDragOpts;
100
- const columnOpts = $xeTable.computeColumnOpts;
101
- const mouseOpts = $xeTable.computeMouseOpts;
102
- const areaOpts = $xeTable.computeAreaOpts;
103
- const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
104
156
  const { selectCellToRow } = areaOpts;
105
157
  const { field, type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column;
106
158
  const { verticalAlign: allVerticalAlign, minHeight, maxHeight } = cellOpts;
107
159
  const { actived } = editStore;
108
- const rowRest = fullAllDataRowIdData[rowid] || {};
109
160
  const colid = column.id;
110
161
  const colRest = fullColumnIdData[colid] || {};
111
162
  const renderOpts = editRender || cellRender;
@@ -326,19 +377,17 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
326
377
  }
327
378
  const clVNs = [];
328
379
  if (!isVNPreEmptyStatus) {
329
- clVNs.push(
330
- h(
331
- "div",
332
- {
333
- attrs: {
334
- colid,
335
- rowid
336
- },
337
- class: "vxe-cell--wrapper vxe-body-cell--wrapper"
338
- },
339
- column.renderCell(h, cellParams)
340
- )
341
- );
380
+ if (column.rowScopedSlot && slots && slots.default && !type && !editRender && !treeNode && !tableReactData.isRowGroupStatus) {
381
+ clVNs.push(h(RowScopedCell, {
382
+ key: rowid,
383
+ props: { ...cellParams, contentVersion: rowRest.contentVersion, rowOrder: tableInternalData.afterFullRowMaps, defaultSlot: slots.default }
384
+ }));
385
+ } else {
386
+ clVNs.push(h("div", {
387
+ class: "vxe-cell--wrapper vxe-body-cell--wrapper",
388
+ attrs: { colid, rowid }
389
+ }, column.renderCell(h, cellParams)));
390
+ }
342
391
  }
343
392
  tdVNs.push(
344
393
  h(
@@ -487,12 +536,11 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
487
536
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
488
537
  const { hasFixedColumn, treeExpandedFlag, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, rowExpandHeightFlag, isRowGroupStatus } = tableReactData;
489
538
  const { fullAllDataRowIdData, fullColumnIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps, currentRow } = tableInternalData;
490
- const checkboxOpts = $xeTable.computeCheckboxOpts;
539
+ const options = getBodyCellOptions($xeTable);
540
+ const { checkboxOpts, editOpts, rowOpts, columnOpts } = options;
491
541
  const radioOpts = $xeTable.computeRadioOpts;
492
542
  const treeOpts = $xeTable.computeTreeOpts;
493
- const editOpts = $xeTable.computeEditOpts;
494
- const rowOpts = $xeTable.computeRowOpts;
495
- const columnOpts = $xeTable.computeColumnOpts;
543
+ const currentRowId = currentRow && (rowOpts.isCurrent || tableProps.highlightCurrentRow) ? getRowid($xeTable, currentRow) : null;
496
544
  const { transform, seqMode } = treeOpts;
497
545
  const childrenField = treeOpts.children || treeOpts.childrenField;
498
546
  const rows = [];
@@ -573,12 +621,12 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
573
621
  "row--checked": checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
574
622
  "row--pending": !!pendingRowFlag && !!pendingRowMaps[rowid],
575
623
  "row--group": hasRowGroupAggregate,
576
- "row--current": currentRow && rowid === getRowid($xeTable, currentRow)
624
+ "row--current": rowid === currentRowId
577
625
  },
578
626
  rowClassName ? XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName : ""
579
627
  ];
580
628
  const tdVNs = tableColumn.map((column, $columnIndex) => {
581
- return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
629
+ return renderTdColumn(h, $xeTable, options, rowRest, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
582
630
  });
583
631
  rows.push(
584
632
  h(
@@ -32,6 +32,7 @@ export declare const columnProps: {
32
32
  headerClassName: (FunctionConstructor | StringConstructor)[];
33
33
  footerClassName: (FunctionConstructor | StringConstructor)[];
34
34
  formatter: PropType<VxeColumnPropTypes.Formatter<any>>;
35
+ rowScopedSlot: BooleanConstructor;
35
36
  headerFormatter: PropType<VxeColumnPropTypes.HeaderFormatter>;
36
37
  footerFormatter: PropType<VxeColumnPropTypes.FooterFormatter>;
37
38
  padding: {
@@ -109,6 +110,7 @@ declare const _default: import("vue/types/vue").ExtendedVue<import("vue").defaul
109
110
  headerClassName: string | Function;
110
111
  footerClassName: string | Function;
111
112
  formatter: VxeColumnPropTypes.Formatter<any>;
113
+ rowScopedSlot: boolean;
112
114
  headerFormatter: VxeColumnPropTypes.HeaderFormatter;
113
115
  footerFormatter: VxeColumnPropTypes.FooterFormatter<any>;
114
116
  padding: VxeColumnPropTypes.Padding;
@@ -51,6 +51,8 @@ const columnProps = {
51
51
  footerClassName: [String, Function],
52
52
  // 格式化显示内容
53
53
  formatter: [Function, Array, String],
54
+ // 只读插槽以独立组件订阅行内容及实际使用的窗口参数。
55
+ rowScopedSlot: Boolean,
54
56
  // 格式化表头显示内容
55
57
  headerFormatter: [Function, Array, String],
56
58
  // 格式化表尾显示内容
@@ -115,6 +115,7 @@ class ColumnInfo {
115
115
  dragSort: colConfs.dragSort,
116
116
  rowResize: colConfs.rowResize,
117
117
  cellType: colConfs.cellType,
118
+ rowScopedSlot: colConfs.rowScopedSlot,
118
119
  cellRender: colConfs.cellRender,
119
120
  editRender,
120
121
  contentRender: colConfs.contentRender,
@@ -18,6 +18,7 @@ declare const _default: import("vue/types/vue").ExtendedVue<import("vue").defaul
18
18
  headerClassName: string | Function;
19
19
  footerClassName: string | Function;
20
20
  formatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Formatter<any>;
21
+ rowScopedSlot: boolean;
21
22
  headerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.HeaderFormatter;
22
23
  footerFormatter: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.FooterFormatter<any>;
23
24
  padding: import("vxe-pc-ui/types/components/column").VxeColumnPropTypes.Padding;
@@ -1,7 +1,9 @@
1
1
  import type { VxeTableDefines } from '../../../types';
2
2
  declare const _default: import("vue/types/vue").ExtendedVue<import("vue").default, {
3
3
  headerColumn: VxeTableDefines.ColumnInfo<any>[][];
4
- }, unknown, unknown, {
4
+ }, unknown, {
5
+ groupedHeaderRows: VxeTableDefines.ColumnInfo<any>[][];
6
+ }, {
5
7
  tableData: any[];
6
8
  tableColumn: VxeTableDefines.ColumnInfo<any>[];
7
9
  tableGroupColumn: VxeTableDefines.ColumnInfo<any>[];
@@ -1,12 +1,35 @@
1
1
  import XEUtils from "xe-utils";
2
2
  import { VxeUI } from "@vxe-ui/core";
3
3
  import { isEnableConf, getClass, getDefaultConfig, hasEnableConf } from "../../ui/src/utils";
4
- import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows } from "./util";
4
+ import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows, getLastChildColumn } from "./util";
5
5
  import { getSlotVNs } from "../../ui/src/vn";
6
6
  const { renderer, renderEmptyElement } = VxeUI;
7
7
  const sourceType = "table";
8
8
  const renderType = "header";
9
- function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols) {
9
+ function projectHeaderWindow(leaves, rows, columnCache) {
10
+ var _a;
11
+ const groups = /* @__PURE__ */ new Map();
12
+ const headers = rows.map(() => []);
13
+ for (const leaf of leaves) {
14
+ let column = leaf;
15
+ while (column) {
16
+ const headerRow = headers[column.level - 1];
17
+ if (!headerRow) break;
18
+ const group = groups.get(column);
19
+ if (group) {
20
+ group.span++;
21
+ group.width += leaf.renderWidth;
22
+ group.lastLeaf = leaf;
23
+ } else {
24
+ headerRow.push(column);
25
+ groups.set(column, { span: 1, width: leaf.renderWidth, lastLeaf: leaf });
26
+ }
27
+ column = column.parentId ? (_a = columnCache[column.parentId]) == null ? void 0 : _a.column : void 0;
28
+ }
29
+ }
30
+ return { headers, groups };
31
+ }
32
+ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols, groups) {
10
33
  const props = _vm;
11
34
  const $xeTable = _vm.$parent;
12
35
  const $xeGrid = $xeTable.$xeGrid;
@@ -79,9 +102,11 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
79
102
  const thAttrs = {
80
103
  colid
81
104
  };
105
+ const group = groups == null ? void 0 : groups.get(column);
82
106
  let isMergeCell = false;
83
107
  if (!showCustomHeader) {
84
- thAttrs.colspan = column.colSpan > 1 ? column.colSpan : null;
108
+ const colSpan = group ? group.span : column.colSpan;
109
+ thAttrs.colspan = colSpan > 1 ? colSpan : null;
85
110
  thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null;
86
111
  }
87
112
  if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
@@ -139,6 +164,8 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
139
164
  tcStyle.minHeight = `${currCellHeight}px`;
140
165
  }
141
166
  if (showCustomHeader) {
167
+ } else if (isColGroup && group) {
168
+ tcStyle.width = `${group.width}px`;
142
169
  } else if (isColGroup && !isLastRow) {
143
170
  let childWidth = 0;
144
171
  XEUtils.eachTree(column.children, (childRow) => {
@@ -212,7 +239,7 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
212
239
  /**
213
240
  * 列宽拖动
214
241
  */
215
- !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) ? h("div", {
242
+ !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) && (!group || !isColGroup || group.lastLeaf === getLastChildColumn(column)) ? h("div", {
216
243
  class: "vxe-cell--col-resizable",
217
244
  on: {
218
245
  mousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
@@ -348,13 +375,14 @@ function renderFilterRows(h, _vm, isOptimizeMode, cols) {
348
375
  );
349
376
  });
350
377
  }
351
- function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumnList) {
378
+ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumnList, groups) {
352
379
  const props = _vm;
353
380
  const $xeTable = _vm.$parent;
354
381
  const tableProps = $xeTable;
355
382
  const { fixedType } = props;
356
383
  const { headerRowClassName, headerRowStyle } = tableProps;
357
384
  const floatingFilterOpts = $xeTable.computeFloatingFilterOpts;
385
+ const groupRowStyle = groups ? { height: `${getCalcHeight($xeTable.computeHeaderCellOpts.height) || $xeTable.computeDefaultRowHeight}px` } : void 0;
358
386
  const rowVNs = headerGroups.map((cols, _rowIndex) => {
359
387
  const params = { $table: $xeTable, rowIndex: _rowIndex, _rowIndex, $rowIndex: _rowIndex, fixed: fixedType, type: renderType };
360
388
  return h(
@@ -362,9 +390,9 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumn
362
390
  {
363
391
  key: _rowIndex,
364
392
  class: ["vxe-header--row", headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ""],
365
- style: headerRowStyle ? XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : void 0
393
+ style: headerRowStyle ? XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : groupRowStyle
366
394
  },
367
- renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols)
395
+ renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols, groups)
368
396
  );
369
397
  });
370
398
  if (floatingFilterOpts.enabled) {
@@ -399,6 +427,11 @@ var header_default = {
399
427
  headerColumn
400
428
  };
401
429
  },
430
+ computed: {
431
+ groupedHeaderRows() {
432
+ return convertHeaderColumnToRows(this.tableGroupColumn || []);
433
+ }
434
+ },
402
435
  watch: {
403
436
  tableColumn() {
404
437
  const _vm = this;
@@ -459,7 +492,13 @@ var header_default = {
459
492
  let renderHeaderList = headerColumn;
460
493
  let renderColumnList = tableColumn;
461
494
  const isOptimizeMode = isHeaderRenderOptimize;
462
- if (isGroup) {
495
+ let groups;
496
+ if (isGroup && isOptimizeMode) {
497
+ renderColumnList = fixedType ? fixedColumn : tableColumn;
498
+ const projection = projectHeaderWindow(renderColumnList, headerColumn, fullColumnIdData);
499
+ renderHeaderList = projection.headers;
500
+ groups = projection.groups;
501
+ } else if (isGroup) {
463
502
  renderColumnList = visibleColumn;
464
503
  } else {
465
504
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -565,7 +604,7 @@ var header_default = {
565
604
  {
566
605
  ref: "refHeaderTHead"
567
606
  },
568
- renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList)
607
+ renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList, groups)
569
608
  )
570
609
  ]
571
610
  ),
@@ -610,12 +649,10 @@ var header_default = {
610
649
  const tableProps = $xeTable;
611
650
  const tableReactData = $xeTable;
612
651
  const tableInternalData = $xeTable;
613
- const props = _vm;
614
652
  const { showCustomHeader } = tableProps;
615
653
  const { collectColumn, visibleColumn } = tableInternalData;
616
- const { tableGroupColumn } = props;
617
654
  const { isGroup } = tableReactData;
618
- let spanColumns = isGroup ? convertHeaderColumnToRows(tableGroupColumn) : [];
655
+ let spanColumns = isGroup ? _vm.groupedHeaderRows : [];
619
656
  let visibleColgroups = [];
620
657
  if (showCustomHeader && spanColumns.length > 1) {
621
658
  visibleColgroups = convertHeaderToGridRows(spanColumns);