vxe-table 3.12.10-beta.2 → 3.12.10-beta.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 (178) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +2 -1
  4. package/es/locale/lang/de-DE.js +2 -1
  5. package/es/locale/lang/en-US.js +2 -1
  6. package/es/locale/lang/es-ES.js +2 -1
  7. package/es/locale/lang/fr-FR.js +2 -1
  8. package/es/locale/lang/hu-HU.js +2 -1
  9. package/es/locale/lang/hy-AM.js +2 -1
  10. package/es/locale/lang/it-IT.js +2 -1
  11. package/es/locale/lang/ja-JP.js +2 -1
  12. package/es/locale/lang/ko-KR.js +2 -1
  13. package/es/locale/lang/nb-NO.js +2 -1
  14. package/es/locale/lang/pt-BR.js +2 -1
  15. package/es/locale/lang/ru-RU.js +4 -3
  16. package/es/locale/lang/th-TH.js +2 -1
  17. package/es/locale/lang/ug-CN.js +2 -1
  18. package/es/locale/lang/uk-UA.js +518 -517
  19. package/es/locale/lang/vi-VN.js +2 -1
  20. package/es/locale/lang/zh-CHT.js +2 -1
  21. package/es/locale/lang/zh-CN.js +2 -1
  22. package/es/style.css +1 -1
  23. package/es/style.min.css +1 -1
  24. package/es/table/module/edit/mixin.js +7 -7
  25. package/es/table/module/export/mixin.js +55 -32
  26. package/es/table/module/keyboard/mixin.js +68 -25
  27. package/es/table/module/menu/mixin.js +3 -1
  28. package/es/table/src/body.js +96 -64
  29. package/es/table/src/cell.js +3 -7
  30. package/es/table/src/column.js +2 -0
  31. package/es/table/src/columnInfo.js +1 -0
  32. package/es/table/src/footer.js +31 -6
  33. package/es/table/src/header.js +45 -141
  34. package/es/table/src/methods.js +918 -456
  35. package/es/table/src/props.js +6 -2
  36. package/es/table/src/table.js +299 -149
  37. package/es/table/src/util.js +67 -57
  38. package/es/table/style.css +299 -191
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +20 -10
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +299 -191
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.min.css +1 -1
  46. package/lib/index.umd.js +1735 -1025
  47. package/lib/index.umd.min.js +1 -1
  48. package/lib/locale/lang/ar-EG.js +2 -1
  49. package/lib/locale/lang/ar-EG.min.js +1 -1
  50. package/lib/locale/lang/de-DE.js +2 -1
  51. package/lib/locale/lang/de-DE.min.js +1 -1
  52. package/lib/locale/lang/en-US.js +2 -1
  53. package/lib/locale/lang/en-US.min.js +1 -1
  54. package/lib/locale/lang/en-US.umd.js +2 -1
  55. package/lib/locale/lang/es-ES.js +2 -1
  56. package/lib/locale/lang/es-ES.min.js +1 -1
  57. package/lib/locale/lang/es-ES.umd.js +2 -1
  58. package/lib/locale/lang/fr-FR.js +2 -1
  59. package/lib/locale/lang/fr-FR.min.js +1 -1
  60. package/lib/locale/lang/hu-HU.js +2 -1
  61. package/lib/locale/lang/hu-HU.min.js +1 -1
  62. package/lib/locale/lang/hu-HU.umd.js +2 -1
  63. package/lib/locale/lang/hy-AM.js +2 -1
  64. package/lib/locale/lang/hy-AM.min.js +1 -1
  65. package/lib/locale/lang/it-IT.js +2 -1
  66. package/lib/locale/lang/it-IT.min.js +1 -1
  67. package/lib/locale/lang/ja-JP.js +2 -1
  68. package/lib/locale/lang/ja-JP.min.js +1 -1
  69. package/lib/locale/lang/ja-JP.umd.js +2 -1
  70. package/lib/locale/lang/ko-KR.js +2 -1
  71. package/lib/locale/lang/ko-KR.min.js +1 -1
  72. package/lib/locale/lang/ko-KR.umd.js +2 -1
  73. package/lib/locale/lang/nb-NO.js +2 -1
  74. package/lib/locale/lang/nb-NO.min.js +1 -1
  75. package/lib/locale/lang/pt-BR.js +2 -1
  76. package/lib/locale/lang/pt-BR.min.js +1 -1
  77. package/lib/locale/lang/pt-BR.umd.js +2 -1
  78. package/lib/locale/lang/ru-RU.js +4 -3
  79. package/lib/locale/lang/ru-RU.min.js +1 -1
  80. package/lib/locale/lang/ru-RU.umd.js +4 -3
  81. package/lib/locale/lang/th-TH.js +2 -1
  82. package/lib/locale/lang/th-TH.min.js +1 -1
  83. package/lib/locale/lang/ug-CN.js +2 -1
  84. package/lib/locale/lang/ug-CN.min.js +1 -1
  85. package/lib/locale/lang/uk-UA.js +518 -517
  86. package/lib/locale/lang/uk-UA.min.js +1 -1
  87. package/lib/locale/lang/uk-UA.umd.js +518 -517
  88. package/lib/locale/lang/vi-VN.js +2 -1
  89. package/lib/locale/lang/vi-VN.min.js +1 -1
  90. package/lib/locale/lang/zh-CHT.js +2 -1
  91. package/lib/locale/lang/zh-CHT.min.js +1 -1
  92. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  93. package/lib/locale/lang/zh-CN.js +2 -1
  94. package/lib/locale/lang/zh-CN.min.js +1 -1
  95. package/lib/locale/lang/zh-CN.umd.js +2 -1
  96. package/lib/style.css +1 -1
  97. package/lib/style.min.css +1 -1
  98. package/lib/table/module/edit/mixin.js +12 -2
  99. package/lib/table/module/edit/mixin.min.js +1 -1
  100. package/lib/table/module/export/mixin.js +52 -27
  101. package/lib/table/module/export/mixin.min.js +1 -1
  102. package/lib/table/module/keyboard/mixin.js +73 -27
  103. package/lib/table/module/keyboard/mixin.min.js +1 -1
  104. package/lib/table/module/menu/mixin.js +3 -1
  105. package/lib/table/src/body.js +89 -60
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +3 -5
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +2 -0
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +1 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/footer.js +26 -6
  114. package/lib/table/src/footer.min.js +1 -1
  115. package/lib/table/src/header.js +38 -153
  116. package/lib/table/src/header.min.js +1 -1
  117. package/lib/table/src/methods.js +1076 -551
  118. package/lib/table/src/methods.min.js +1 -1
  119. package/lib/table/src/props.js +6 -2
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +269 -129
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +80 -70
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +299 -191
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +20 -10
  128. package/lib/ui/index.min.js +1 -1
  129. package/lib/ui/src/log.js +1 -1
  130. package/lib/ui/src/log.min.js +1 -1
  131. package/lib/vxe-table/style/style.css +299 -191
  132. package/lib/vxe-table/style/style.min.css +1 -1
  133. package/package.json +2 -2
  134. package/packages/locale/lang/ar-EG.ts +2 -1
  135. package/packages/locale/lang/de-DE.ts +2 -1
  136. package/packages/locale/lang/en-US.ts +2 -1
  137. package/packages/locale/lang/es-ES.ts +2 -1
  138. package/packages/locale/lang/fr-FR.ts +2 -1
  139. package/packages/locale/lang/hu-HU.ts +2 -1
  140. package/packages/locale/lang/hy-AM.ts +2 -1
  141. package/packages/locale/lang/it-IT.ts +2 -1
  142. package/packages/locale/lang/ja-JP.ts +2 -1
  143. package/packages/locale/lang/ko-KR.ts +2 -1
  144. package/packages/locale/lang/nb-NO.ts +2 -1
  145. package/packages/locale/lang/pt-BR.ts +2 -1
  146. package/packages/locale/lang/ru-RU.ts +4 -3
  147. package/packages/locale/lang/th-TH.ts +2 -1
  148. package/packages/locale/lang/ug-CN.ts +2 -1
  149. package/packages/locale/lang/uk-UA.ts +518 -517
  150. package/packages/locale/lang/vi-VN.ts +2 -1
  151. package/packages/locale/lang/zh-CHT.ts +2 -1
  152. package/packages/locale/lang/zh-CN.ts +2 -1
  153. package/packages/table/module/edit/mixin.ts +7 -7
  154. package/packages/table/module/export/mixin.ts +50 -27
  155. package/packages/table/module/keyboard/mixin.ts +65 -24
  156. package/packages/table/module/menu/mixin.ts +4 -1
  157. package/packages/table/src/body.ts +102 -61
  158. package/packages/table/src/cell.ts +3 -7
  159. package/packages/table/src/column.ts +7 -2
  160. package/packages/table/src/columnInfo.ts +1 -0
  161. package/packages/table/src/footer.ts +31 -6
  162. package/packages/table/src/header.ts +45 -141
  163. package/packages/table/src/methods.ts +957 -461
  164. package/packages/table/src/props.ts +6 -2
  165. package/packages/table/src/table.ts +325 -149
  166. package/packages/table/src/util.ts +75 -62
  167. package/packages/ui/index.ts +21 -9
  168. package/styles/components/table.scss +352 -260
  169. package/styles/theme/base.scss +4 -6
  170. package/styles/theme/dark.scss +1 -0
  171. package/styles/theme/light.scss +1 -0
  172. package/styles/variable.scss +1 -0
  173. /package/es/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  174. /package/es/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  175. /package/es/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
  176. /package/lib/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  177. /package/lib/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  178. /package/lib/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
@@ -88,6 +88,7 @@ export class ColumnInfo {
88
88
  filterRender: _vm.filterRender,
89
89
  treeNode: _vm.treeNode,
90
90
  dragSort: _vm.dragSort,
91
+ rowResize: _vm.rowResize,
91
92
  cellType: _vm.cellType,
92
93
  cellRender: _vm.cellRender,
93
94
  editRender: _vm.editRender,
@@ -29,13 +29,19 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
29
29
  const { scrollXStore } = tableInternalData;
30
30
  const tooltipOpts = $xeTable.computeTooltipOpts;
31
31
  const columnOpts = $xeTable.computeColumnOpts;
32
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
33
+ const cellOpts = $xeTable.computeCellOpts;
34
+ const footerCellOpts = $xeTable.computeFooterCellOpts;
35
+ const currCellHeight = footerCellOpts.height || cellOpts.height || defaultRowHeight;
32
36
  return tableColumn.map((column, $columnIndex) => {
33
37
  const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
38
+ const colid = column.id;
34
39
  const renderOpts = editRender || cellRender;
35
40
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
36
41
  const showAllTip = tooltipOpts.showAll;
37
42
  const isColGroup = column.children && column.children.length;
38
43
  const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
44
+ const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
39
45
  const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
40
46
  const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
41
47
  let showEllipsis = footOverflow === 'ellipsis';
@@ -120,18 +126,27 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
120
126
  attrs.colspan = colspan;
121
127
  }
122
128
  }
129
+ const isLastColumn = $columnIndex === tableColumn.length - 1;
123
130
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
124
- let isPreLoadStatus = false;
125
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
126
- isPreLoadStatus = true;
131
+ let isVNPreEmptyStatus = false;
132
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
133
+ isVNPreEmptyStatus = true;
134
+ }
135
+ const tcStyle = {};
136
+ if (hasEllipsis) {
137
+ tcStyle.height = `${currCellHeight}px`;
138
+ }
139
+ else {
140
+ tcStyle.minHeight = `${currCellHeight}px`;
127
141
  }
128
142
  return h('td', {
129
143
  class: ['vxe-footer--column', column.id, {
130
144
  [`col--${footAlign}`]: footAlign,
131
145
  [`col--${type}`]: type,
132
- 'col--last': $columnIndex === tableColumn.length - 1,
146
+ 'col--last': isLastColumn,
133
147
  'fixed--width': !isAutoCellWidth,
134
148
  'fixed--hidden': fixedHiddenColumn,
149
+ 'is--padding': isPadding,
135
150
  'col--ellipsis': hasEllipsis,
136
151
  'col--current': currentColumn === column
137
152
  }, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
@@ -145,8 +160,18 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
145
160
  'c--title': showTitle,
146
161
  'c--tooltip': showTooltip,
147
162
  'c--ellipsis': showEllipsis
148
- }]
149
- }, isPreLoadStatus ? [] : column.renderFooter(h, cellParams))
163
+ }],
164
+ style: tcStyle
165
+ }, isVNPreEmptyStatus
166
+ ? []
167
+ : [
168
+ h('div', {
169
+ attrs: {
170
+ colid
171
+ },
172
+ class: 'vxe-cell--wrapper'
173
+ }, column.renderFooter(h, cellParams))
174
+ ])
150
175
  ]);
151
176
  });
152
177
  }
@@ -1,9 +1,8 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { getClass } from '../../ui/src/utils';
4
- import { getOffsetPos, hasClass, addClass, removeClass } from '../../ui/src/dom';
5
- import { convertHeaderColumnToRows, getColReMinWidth } from './util';
6
- const { getI18n, renderer, renderEmptyElement } = VxeUI;
4
+ import { convertHeaderColumnToRows } from './util';
5
+ const { renderer, renderEmptyElement } = VxeUI;
7
6
  const cellType = 'header';
8
7
  const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
9
8
  const props = _vm;
@@ -18,6 +17,10 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
18
17
  const { scrollXStore } = tableInternalData;
19
18
  const columnOpts = $xeTable.computeColumnOpts;
20
19
  const columnDragOpts = $xeTable.computeColumnDragOpts;
20
+ const cellOpts = $xeTable.computeCellOpts;
21
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
22
+ const headerCellOpts = $xeTable.computeHeaderCellOpts;
23
+ const currCellHeight = headerCellOpts.height || cellOpts.height || defaultRowHeight;
21
24
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts;
22
25
  return cols.map((column, $columnIndex) => {
23
26
  const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column;
@@ -27,6 +30,7 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
27
30
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
28
31
  const isColGroup = column.children && column.children.length;
29
32
  const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
33
+ const isPadding = XEUtils.isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
30
34
  const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
31
35
  const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
32
36
  let showEllipsis = headOverflow === 'ellipsis';
@@ -41,15 +45,15 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
41
45
  }
42
46
  const columnIndex = $xeTable.getColumnIndex(column);
43
47
  const _columnIndex = $xeTable.getVTColumnIndex(column);
44
- const params = { $table: $xeTable, $grid: $xeGrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, firstFilterOption, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
48
+ const cellParams = { $table: $xeTable, $grid: $xeGrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, firstFilterOption, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
45
49
  const thAttrs = {
46
50
  colid,
47
51
  colspan: column.colSpan > 1 ? column.colSpan : null,
48
52
  rowspan: column.rowSpan > 1 ? column.rowSpan : null
49
53
  };
50
54
  const thOns = {
51
- click: (evnt) => $xeTable.triggerHeaderCellClickEvent(evnt, params),
52
- dblclick: (evnt) => $xeTable.triggerHeaderCellDblclickEvent(evnt, params)
55
+ click: (evnt) => $xeTable.triggerHeaderCellClickEvent(evnt, cellParams),
56
+ dblclick: (evnt) => $xeTable.triggerHeaderCellDblclickEvent(evnt, cellParams)
53
57
  };
54
58
  // 虚拟滚动不支持动态高度
55
59
  if (scrollXLoad && !hasEllipsis) {
@@ -58,11 +62,11 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
58
62
  const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell';
59
63
  let isDisabledDrag = false;
60
64
  if (isColDragCell) {
61
- isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params));
65
+ isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
62
66
  }
63
67
  // 按下事件处理
64
68
  if (mouseConfig || isColDragCell) {
65
- thOns.mousedown = (evnt) => $xeTable.triggerHeaderCellMousedownEvent(evnt, params);
69
+ thOns.mousedown = (evnt) => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams);
66
70
  }
67
71
  // 拖拽列事件
68
72
  if (columnOpts.drag) {
@@ -73,30 +77,40 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
73
77
  thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent;
74
78
  }
75
79
  }
80
+ const isLastColumn = $columnIndex === cols.length - 1;
81
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
76
82
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
77
- let isPreLoadStatus = false;
78
- if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
79
- isPreLoadStatus = true;
83
+ let isVNPreEmptyStatus = false;
84
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
85
+ isVNPreEmptyStatus = true;
86
+ }
87
+ const tcStyle = {};
88
+ if (hasEllipsis) {
89
+ tcStyle.height = `${currCellHeight}px`;
90
+ }
91
+ else {
92
+ tcStyle.minHeight = `${currCellHeight}px`;
80
93
  }
81
94
  return h('th', {
82
95
  class: ['vxe-header--column', colid, {
83
96
  [`col--${headAlign}`]: headAlign,
84
97
  [`col--${type}`]: type,
85
- 'col--last': $columnIndex === cols.length - 1,
98
+ 'col--last': isLastColumn,
86
99
  'col--fixed': column.fixed,
87
100
  'col--group': isColGroup,
88
101
  'col--ellipsis': hasEllipsis,
89
102
  'fixed--width': !isAutoCellWidth,
90
103
  'fixed--hidden': fixedHiddenColumn,
104
+ 'is--padding': isPadding,
91
105
  'is--sortable': column.sortable,
92
106
  'col--filter': !!filters,
93
107
  'is--filter-active': hasFilter,
94
108
  'is--drag-active': !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
95
109
  'is--drag-disabled': isDisabledDrag,
96
110
  'col--current': currentColumn === column
97
- }, getClass(headerClassName, params), getClass(headerCellClassName, params)],
111
+ }, getClass(headerClassName, cellParams), getClass(headerCellClassName, cellParams)],
98
112
  attrs: thAttrs,
99
- style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : undefined,
113
+ style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle) : undefined,
100
114
  on: thOns,
101
115
  key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
102
116
  }, [
@@ -105,22 +119,32 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
105
119
  'c--title': showTitle,
106
120
  'c--tooltip': showTooltip,
107
121
  'c--ellipsis': showEllipsis
108
- }]
109
- }, isPreLoadStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : column.renderHeader(h, params)),
122
+ }],
123
+ style: tcStyle
124
+ }, isVNPreEmptyStatus || (isOptimizeMode && fixedHiddenColumn)
125
+ ? []
126
+ : [
127
+ h('div', {
128
+ attrs: {
129
+ colid
130
+ },
131
+ class: 'vxe-cell--wrapper'
132
+ }, column.renderHeader(h, cellParams))
133
+ ]),
110
134
  /**
111
135
  * 列宽拖动
112
136
  */
113
- !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
137
+ !fixedHiddenColumn && showResizable
114
138
  ? h('div', {
115
- class: ['vxe-resizable', {
139
+ class: ['vxe-cell--col-resizable', {
116
140
  'is--line': !border || border === 'none'
117
141
  }],
118
142
  on: {
119
- mousedown: (evnt) => _vm.resizeMousedownEvent(evnt, params),
120
- dblclick: (evnt) => $xeTable.handleResizeDblclickEvent(evnt, params)
143
+ mousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
144
+ dblclick: (evnt) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
121
145
  }
122
146
  })
123
- : null
147
+ : renderEmptyElement($xeTable)
124
148
  ]);
125
149
  });
126
150
  };
@@ -346,126 +370,6 @@ export default {
346
370
  uploadColumn() {
347
371
  const { $parent: $xetable } = this;
348
372
  this.headerColumn = $xetable.isGroup ? convertHeaderColumnToRows(this.tableGroupColumn) : [];
349
- },
350
- resizeMousedownEvent(evnt, params) {
351
- const $xeTable = this.$parent;
352
- const tableInternalData = $xeTable;
353
- const { column } = params;
354
- const { $parent: $xetable, fixedType } = this;
355
- const { visibleColumn } = tableInternalData;
356
- const { refTableBody, refLeftContainer, refRightContainer } = $xetable.$refs;
357
- const tableEl = $xeTable.$el;
358
- const resizeBarElem = $xetable.$refs.refCellResizeBar;
359
- const resizeTipElem = $xetable.$refs.refCellResizeTip;
360
- const wrapperElem = this.$el;
361
- const { clientX: dragClientX } = evnt;
362
- const dragBtnElem = evnt.target;
363
- const cell = dragBtnElem.parentNode;
364
- const cellParams = Object.assign(params, { cell });
365
- const resizableOpts = $xeTable.computeResizableOpts;
366
- let dragLeft = 0;
367
- const tableBodyElem = refTableBody.$el;
368
- const pos = getOffsetPos(dragBtnElem, tableEl);
369
- const dragBtnWidth = dragBtnElem.clientWidth;
370
- const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
371
- const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
372
- let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
373
- let dragPosLeft = pos.left + dragBtnOffsetWidth;
374
- const domMousemove = document.onmousemove;
375
- const domMouseup = document.onmouseup;
376
- const isLeftFixed = fixedType === 'left';
377
- const isRightFixed = fixedType === 'right';
378
- // 计算左右侧固定列偏移量
379
- let fixedOffsetWidth = 0;
380
- if (isLeftFixed || isRightFixed) {
381
- const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
382
- let tempCellElem = cell[siblingProp];
383
- while (tempCellElem) {
384
- if (hasClass(tempCellElem, 'fixed--hidden')) {
385
- break;
386
- }
387
- else if (!hasClass(tempCellElem, 'col--group')) {
388
- fixedOffsetWidth += tempCellElem.offsetWidth;
389
- }
390
- tempCellElem = tempCellElem[siblingProp];
391
- }
392
- if (isRightFixed && refRightContainer) {
393
- dragPosLeft = refRightContainer.offsetLeft + fixedOffsetWidth;
394
- }
395
- }
396
- // 处理拖动事件
397
- const updateEvent = function (evnt) {
398
- evnt.stopPropagation();
399
- evnt.preventDefault();
400
- const offsetX = evnt.clientX - dragClientX;
401
- let left = dragPosLeft + offsetX;
402
- const scrollLeft = fixedType ? 0 : tableBodyElem.scrollLeft;
403
- if (isLeftFixed) {
404
- // 左固定列(不允许超过右侧固定列、不允许超过右边距)
405
- left = Math.min(left, (refRightContainer ? refRightContainer.offsetLeft : tableBodyElem.clientWidth) - fixedOffsetWidth - minInterval);
406
- }
407
- else if (isRightFixed) {
408
- // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
409
- dragMinLeft = (refLeftContainer ? refLeftContainer.clientWidth : 0) + fixedOffsetWidth + minInterval;
410
- left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
411
- }
412
- else {
413
- dragMinLeft = Math.max(tableBodyElem.scrollLeft, dragMinLeft);
414
- // left = Math.min(left, tableBodyElem.clientWidth + tableBodyElem.scrollLeft - 40)
415
- }
416
- dragLeft = Math.max(left, dragMinLeft);
417
- const resizeBarLeft = dragLeft - scrollLeft;
418
- resizeBarElem.style.left = `${resizeBarLeft}px`;
419
- if (resizableOpts.showDragTip && resizeTipElem) {
420
- const tableWidth = tableEl.clientWidth;
421
- const wrapperRect = wrapperElem.getBoundingClientRect();
422
- const resizeBarWidth = resizeBarElem.clientWidth;
423
- const resizeTipWidth = resizeTipElem.clientWidth;
424
- const resizeTipHeight = resizeTipElem.clientHeight;
425
- let resizeTipLeft = -resizeTipWidth;
426
- if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
427
- resizeTipLeft = resizeTipWidth + resizeBarWidth - resizeBarLeft;
428
- }
429
- else if (resizeBarLeft > tableWidth) {
430
- resizeTipLeft += tableWidth - resizeBarLeft;
431
- }
432
- resizeTipElem.style.left = `${resizeTipLeft}px`;
433
- resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
434
- resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
435
- }
436
- };
437
- $xetable._isResize = true;
438
- addClass($xetable.$el, 'drag--resize');
439
- resizeBarElem.style.display = 'block';
440
- document.onmousemove = updateEvent;
441
- document.onmouseup = function (evnt) {
442
- document.onmousemove = domMousemove;
443
- document.onmouseup = domMouseup;
444
- const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
445
- column.resizeWidth = resizeWidth;
446
- if (resizableOpts.dragMode === 'fixed') {
447
- visibleColumn.forEach((item) => {
448
- if (item.id !== column.id) {
449
- if (!item.resizeWidth) {
450
- item.resizeWidth = item.renderWidth;
451
- }
452
- }
453
- });
454
- }
455
- resizeBarElem.style.display = 'none';
456
- $xetable._isResize = false;
457
- $xetable._lastResizeTime = Date.now();
458
- $xetable.analyColumnWidth();
459
- $xetable.recalculate(true).then(() => {
460
- $xetable.saveCustomStore('update:visible');
461
- $xetable.updateCellAreas();
462
- $xetable.emitEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
463
- setTimeout(() => $xetable.recalculate(true), 300);
464
- });
465
- removeClass($xetable.$el, 'drag--resize');
466
- };
467
- updateEvent(evnt);
468
- $xetable.closeMenu();
469
373
  }
470
374
  }
471
375
  };