vxe-table 3.12.10-beta.8 → 3.12.10

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 +4 -3
  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 +105 -69
  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 +135 -83
  29. package/es/table/src/cell.js +43 -57
  30. package/es/table/src/column.js +43 -8
  31. package/es/table/src/columnInfo.js +3 -0
  32. package/es/table/src/footer.js +50 -9
  33. package/es/table/src/header.js +70 -168
  34. package/es/table/src/methods.js +985 -502
  35. package/es/table/src/props.js +14 -4
  36. package/es/table/src/table.js +114 -33
  37. package/es/table/src/util.js +73 -57
  38. package/es/table/style.css +253 -189
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +26 -10
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +253 -189
  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 +1782 -1056
  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 +4 -3
  53. package/lib/locale/lang/en-US.min.js +1 -1
  54. package/lib/locale/lang/en-US.umd.js +4 -3
  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 +7 -2
  99. package/lib/table/module/edit/mixin.min.js +1 -1
  100. package/lib/table/module/export/mixin.js +105 -64
  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 +132 -79
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +32 -42
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +12 -0
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +3 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/footer.js +46 -7
  114. package/lib/table/src/footer.min.js +1 -1
  115. package/lib/table/src/header.js +52 -175
  116. package/lib/table/src/header.min.js +1 -1
  117. package/lib/table/src/methods.js +1096 -560
  118. package/lib/table/src/methods.min.js +1 -1
  119. package/lib/table/src/props.js +14 -4
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +113 -36
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +87 -70
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +253 -189
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +26 -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 +253 -189
  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 +4 -3
  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 +138 -80
  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 +148 -86
  158. package/packages/table/src/cell.ts +45 -67
  159. package/packages/table/src/column.ts +48 -10
  160. package/packages/table/src/columnInfo.ts +3 -0
  161. package/packages/table/src/footer.ts +53 -10
  162. package/packages/table/src/header.ts +70 -169
  163. package/packages/table/src/methods.ts +1031 -515
  164. package/packages/table/src/props.ts +16 -6
  165. package/packages/table/src/table.ts +124 -33
  166. package/packages/table/src/util.ts +82 -62
  167. package/packages/ui/index.ts +25 -9
  168. package/styles/components/table.scss +319 -271
  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.1736840896964.ttf → iconfont.1738985837413.ttf} +0 -0
  174. /package/es/{iconfont.1736840896964.woff → iconfont.1738985837413.woff} +0 -0
  175. /package/es/{iconfont.1736840896964.woff2 → iconfont.1738985837413.woff2} +0 -0
  176. /package/lib/{iconfont.1736840896964.ttf → iconfont.1738985837413.ttf} +0 -0
  177. /package/lib/{iconfont.1736840896964.woff → iconfont.1738985837413.woff} +0 -0
  178. /package/lib/{iconfont.1736840896964.woff2 → iconfont.1738985837413.woff2} +0 -0
@@ -17,7 +17,10 @@ export const columnProps = {
17
17
  // 列最大宽度
18
18
  maxWidth: [Number, String],
19
19
  // 是否允许拖动列宽调整大小
20
- resizable: { type: Boolean, default: null },
20
+ resizable: {
21
+ type: Boolean,
22
+ default: null
23
+ },
21
24
  // 将列固定在左侧或者右侧
22
25
  fixed: String,
23
26
  // 列对其方式
@@ -27,11 +30,20 @@ export const columnProps = {
27
30
  // 表尾列的对齐方式
28
31
  footerAlign: String,
29
32
  // 当内容过长时显示为省略号
30
- showOverflow: { type: [Boolean, String], default: null },
33
+ showOverflow: {
34
+ type: [Boolean, String],
35
+ default: null
36
+ },
31
37
  // 当表头内容过长时显示为省略号
32
- showHeaderOverflow: { type: [Boolean, String], default: null },
38
+ showHeaderOverflow: {
39
+ type: [Boolean, String],
40
+ default: null
41
+ },
33
42
  // 当表尾内容过长时显示为省略号
34
- showFooterOverflow: { type: [Boolean, String], default: null },
43
+ showFooterOverflow: {
44
+ type: [Boolean, String],
45
+ default: null
46
+ },
35
47
  // 给单元格附加 className
36
48
  className: [String, Function],
37
49
  // 给表头单元格附加 className
@@ -42,10 +54,23 @@ export const columnProps = {
42
54
  formatter: [Function, Array, String],
43
55
  // 格式化表尾显示内容
44
56
  footerFormatter: [Function, Array, String],
57
+ // 是否显示间距
58
+ padding: {
59
+ type: Boolean,
60
+ default: null
61
+ },
62
+ // 垂直对齐方式
63
+ verticalAlign: {
64
+ type: String,
65
+ default: null
66
+ },
45
67
  // 是否允许排序
46
68
  sortable: Boolean,
47
69
  // 在 v3 中废弃
48
- remoteSort: { type: Boolean, default: null },
70
+ remoteSort: {
71
+ type: Boolean,
72
+ default: null
73
+ },
49
74
  // 在 v3 中只支持字符串类型
50
75
  sortBy: [String, Function],
51
76
  // 排序的字段类型,比如字符串转数值等
@@ -53,9 +78,15 @@ export const columnProps = {
53
78
  // 在 v3 中废弃
54
79
  sortMethod: Function,
55
80
  // 配置筛选条件数组
56
- filters: { type: Array, default: null },
81
+ filters: {
82
+ type: Array,
83
+ default: null
84
+ },
57
85
  // 筛选是否允许多选
58
- filterMultiple: { type: Boolean, default: true },
86
+ filterMultiple: {
87
+ type: Boolean,
88
+ default: true
89
+ },
59
90
  // 自定义筛选方法
60
91
  filterMethod: Function,
61
92
  // 筛选重置方法
@@ -68,8 +99,12 @@ export const columnProps = {
68
99
  treeNode: Boolean,
69
100
  // 设置为拖拽排序
70
101
  dragSort: Boolean,
102
+ // 设置为行高拖拽
103
+ rowResize: Boolean,
71
104
  // 是否可视
72
- visible: { type: Boolean, default: null },
105
+ visible: {
106
+ type: Boolean, default: null
107
+ },
73
108
  // 表头单元格数据导出方法
74
109
  headerExportMethod: Function,
75
110
  // 单元格数据导出方法
@@ -75,6 +75,8 @@ export class ColumnInfo {
75
75
  footerClassName: _vm.footerClassName,
76
76
  formatter,
77
77
  footerFormatter: _vm.footerFormatter,
78
+ padding: _vm.padding,
79
+ verticalAlign: _vm.verticalAlign,
78
80
  sortable: _vm.sortable,
79
81
  sortBy: _vm.sortBy,
80
82
  sortType: _vm.sortType,
@@ -88,6 +90,7 @@ export class ColumnInfo {
88
90
  filterRender: _vm.filterRender,
89
91
  treeNode: _vm.treeNode,
90
92
  dragSort: _vm.dragSort,
93
+ rowResize: _vm.rowResize,
91
94
  cellType: _vm.cellType,
92
95
  cellRender: _vm.cellRender,
93
96
  editRender: _vm.editRender,
@@ -2,6 +2,7 @@ import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { getClass } from '../../ui/src/utils';
4
4
  import { updateCellTitle } from '../../ui/src/dom';
5
+ import { getCellHeight } from './util';
5
6
  const renderType = 'footer';
6
7
  const { renderer, renderEmptyElement } = VxeUI;
7
8
  function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
@@ -24,25 +25,33 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
24
25
  const tableReactData = $xeTable;
25
26
  const tableInternalData = $xeTable;
26
27
  const { fixedType } = props;
27
- const { footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps;
28
+ const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps;
28
29
  const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFooterList } = tableReactData;
29
30
  const { scrollXStore } = tableInternalData;
30
31
  const tooltipOpts = $xeTable.computeTooltipOpts;
32
+ const { isAllColumnDrag } = $xeTable.resizableOpts;
31
33
  const columnOpts = $xeTable.computeColumnOpts;
34
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
35
+ const cellOpts = $xeTable.computeCellOpts;
36
+ const footerCellOpts = $xeTable.computeFooterCellOpts;
37
+ const currCellHeight = getCellHeight(footerCellOpts.height || cellOpts.height) || defaultRowHeight;
32
38
  return tableColumn.map((column, $columnIndex) => {
33
39
  const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
40
+ const colid = column.id;
34
41
  const renderOpts = editRender || cellRender;
35
42
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
36
43
  const showAllTip = tooltipOpts.showAll;
37
44
  const isColGroup = column.children && column.children.length;
38
45
  const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
46
+ const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
39
47
  const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
40
48
  const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
41
49
  let showEllipsis = footOverflow === 'ellipsis';
42
50
  const showTitle = footOverflow === 'title';
43
51
  const showTooltip = footOverflow === true || footOverflow === 'tooltip';
44
52
  let hasEllipsis = showTitle || showTooltip || showEllipsis;
45
- const attrs = { colid: column.id };
53
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
54
+ const attrs = { colid };
46
55
  const tfOns = {};
47
56
  const columnIndex = $xeTable.getColumnIndex(column);
48
57
  const _columnIndex = $xeTable.getVTColumnIndex(column);
@@ -122,9 +131,16 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
122
131
  }
123
132
  const isLastColumn = $columnIndex === tableColumn.length - 1;
124
133
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
125
- let isPreLoadStatus = false;
126
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
127
- isPreLoadStatus = true;
134
+ let isVNPreEmptyStatus = false;
135
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
136
+ isVNPreEmptyStatus = true;
137
+ }
138
+ const tcStyle = {};
139
+ if (hasEllipsis) {
140
+ tcStyle.height = `${currCellHeight}px`;
141
+ }
142
+ else {
143
+ tcStyle.minHeight = `${currCellHeight}px`;
128
144
  }
129
145
  return h('td', {
130
146
  class: ['vxe-footer--column', column.id, {
@@ -133,6 +149,7 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
133
149
  'col--last': isLastColumn,
134
150
  'fixed--width': !isAutoCellWidth,
135
151
  'fixed--hidden': fixedHiddenColumn,
152
+ 'is--padding': isPadding,
136
153
  'col--ellipsis': hasEllipsis,
137
154
  'col--current': currentColumn === column
138
155
  }, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
@@ -146,8 +163,32 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
146
163
  'c--title': showTitle,
147
164
  'c--tooltip': showTooltip,
148
165
  'c--ellipsis': showEllipsis
149
- }]
150
- }, isPreLoadStatus ? [] : column.renderFooter(h, cellParams))
166
+ }],
167
+ style: tcStyle
168
+ }, isVNPreEmptyStatus
169
+ ? []
170
+ : [
171
+ h('div', {
172
+ attrs: {
173
+ colid
174
+ },
175
+ class: 'vxe-cell--wrapper'
176
+ }, column.renderFooter(h, cellParams))
177
+ ]),
178
+ /**
179
+ * 列宽拖动
180
+ */
181
+ !fixedHiddenColumn && showResizable && isAllColumnDrag
182
+ ? h('div', {
183
+ class: ['vxe-cell--col-resizable', {
184
+ 'is--line': !border || border === 'none'
185
+ }],
186
+ on: {
187
+ mousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
188
+ dblclick: (evnt) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
189
+ }
190
+ })
191
+ : renderEmptyElement($xeTable)
151
192
  ]);
152
193
  });
153
194
  }
@@ -158,13 +199,13 @@ function renderHeads(h, _vm, renderColumnList) {
158
199
  const tableReactData = $xeTable;
159
200
  const { fixedType, footerTableData } = props;
160
201
  const { footerRowClassName, footerRowStyle } = tableProps;
161
- const { isDragColMove } = tableReactData;
202
+ const { isColLoading, isDragColMove } = tableReactData;
162
203
  const columnOpts = $xeTable.computeColumnOpts;
163
204
  const columnDragOpts = $xeTable.computeColumnDragOpts;
164
205
  return footerTableData.map((row, $rowIndex) => {
165
206
  const _rowIndex = $rowIndex;
166
207
  const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType };
167
- if (columnOpts.drag && columnDragOpts.animation) {
208
+ if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
168
209
  return h('transition-group', {
169
210
  key: $rowIndex,
170
211
  props: {
@@ -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, getRefElem } from './util';
6
- const { getI18n, renderer, renderEmptyElement } = VxeUI;
4
+ import { getCellHeight, 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 = getCellHeight(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) {
@@ -76,9 +80,16 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
76
80
  const isLastColumn = $columnIndex === cols.length - 1;
77
81
  const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
78
82
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
79
- let isPreLoadStatus = false;
80
- if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
81
- 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`;
82
93
  }
83
94
  return h('th', {
84
95
  class: ['vxe-header--column', colid, {
@@ -90,15 +101,16 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
90
101
  'col--ellipsis': hasEllipsis,
91
102
  'fixed--width': !isAutoCellWidth,
92
103
  'fixed--hidden': fixedHiddenColumn,
104
+ 'is--padding': isPadding,
93
105
  'is--sortable': column.sortable,
94
106
  'col--filter': !!filters,
95
107
  'is--filter-active': hasFilter,
96
108
  'is--drag-active': !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
97
109
  'is--drag-disabled': isDisabledDrag,
98
110
  'col--current': currentColumn === column
99
- }, getClass(headerClassName, params), getClass(headerCellClassName, params)],
111
+ }, getClass(headerClassName, cellParams), getClass(headerCellClassName, cellParams)],
100
112
  attrs: thAttrs,
101
- style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : undefined,
113
+ style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle) : undefined,
102
114
  on: thOns,
103
115
  key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
104
116
  }, [
@@ -107,19 +119,29 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
107
119
  'c--title': showTitle,
108
120
  'c--tooltip': showTooltip,
109
121
  'c--ellipsis': showEllipsis
110
- }]
111
- }, 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
+ ]),
112
134
  /**
113
135
  * 列宽拖动
114
136
  */
115
137
  !fixedHiddenColumn && showResizable
116
138
  ? h('div', {
117
- class: ['vxe-resizable', {
139
+ class: ['vxe-cell--col-resizable', {
118
140
  'is--line': !border || border === 'none'
119
141
  }],
120
142
  on: {
121
- mousedown: (evnt) => _vm.resizeMousedownEvent(evnt, params),
122
- dblclick: (evnt) => $xeTable.handleResizeDblclickEvent(evnt, params)
143
+ mousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
144
+ dblclick: (evnt) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
123
145
  }
124
146
  })
125
147
  : renderEmptyElement($xeTable)
@@ -135,10 +157,10 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
135
157
  const columnOpts = $xeTable.computeColumnOpts;
136
158
  const columnDragOpts = $xeTable.computeColumnDragOpts;
137
159
  const { headerRowClassName, headerRowStyle } = tableProps;
138
- const { isDragColMove } = tableReactData;
160
+ const { isColLoading, isDragColMove } = tableReactData;
139
161
  return headerGroups.map((cols, $rowIndex) => {
140
162
  const params = { $table: $xeTable, $rowIndex, fixed: fixedType, type: cellType };
141
- if (columnOpts.drag && columnDragOpts.animation) {
163
+ if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
142
164
  return h('transition-group', {
143
165
  key: $rowIndex,
144
166
  props: {
@@ -227,9 +249,10 @@ export default {
227
249
  const { xID } = $xeTable;
228
250
  const { fixedType, fixedColumn, tableColumn } = props;
229
251
  const { headerColumn } = this;
230
- const { showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps;
252
+ const { mouseConfig, showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps;
231
253
  const { isGroup, scrollXLoad, scrollYLoad, dragCol } = tableReactData;
232
254
  const { visibleColumn, fullColumnIdData } = tableInternalData;
255
+ const mouseOpts = $xeTable.computeMouseOpts;
233
256
  let renderHeaderList = headerColumn;
234
257
  let renderColumnList = tableColumn;
235
258
  let isOptimizeMode = false;
@@ -332,15 +355,32 @@ export default {
332
355
  */
333
356
  h('thead', {
334
357
  ref: 'refHeaderTHead'
335
- }, renderHeads(h, this, isGroup, isOptimizeMode, renderHeaderList))
336
- ]),
337
- /**
338
- * 其他
339
- */
340
- h('div', {
341
- ref: 'refHeaderBorderRepair',
342
- class: 'vxe-table--header-border-line'
343
- })
358
+ }, renderHeads(h, this, isGroup, isOptimizeMode, renderHeaderList)),
359
+ mouseConfig && mouseOpts.area
360
+ ? h('div', {
361
+ class: 'vxe-table--cell-area'
362
+ }, [
363
+ h('span', {
364
+ class: 'vxe-table--cell-main-area'
365
+ }),
366
+ h('span', {
367
+ class: 'vxe-table--cell-copy-area'
368
+ }),
369
+ h('span', {
370
+ class: 'vxe-table--cell-extend-area'
371
+ }),
372
+ h('span', {
373
+ class: 'vxe-table--cell-multi-area'
374
+ }),
375
+ h('span', {
376
+ class: 'vxe-table--cell-active-area'
377
+ }),
378
+ h('span', {
379
+ class: 'vxe-table--cell-col-status-area'
380
+ })
381
+ ])
382
+ : renderEmptyElement($xeTable)
383
+ ])
344
384
  ])
345
385
  ]);
346
386
  },
@@ -348,144 +388,6 @@ export default {
348
388
  uploadColumn() {
349
389
  const { $parent: $xetable } = this;
350
390
  this.headerColumn = $xetable.isGroup ? convertHeaderColumnToRows(this.tableGroupColumn) : [];
351
- },
352
- resizeMousedownEvent(evnt, params) {
353
- const _vm = this;
354
- const props = _vm;
355
- const $xeTable = this.$parent;
356
- const tableReactData = $xeTable;
357
- const tableInternalData = $xeTable;
358
- const { column } = params;
359
- const { fixedType } = props;
360
- const { scrollbarHeight } = tableReactData;
361
- const { elemStore, visibleColumn } = tableInternalData;
362
- const resizableOpts = $xeTable.computeResizableOpts;
363
- const tableEl = $xeTable.$refs.refElem;
364
- const leftContainerElem = $xeTable.$refs.refLeftContainer;
365
- const rightContainerElem = $xeTable.$refs.refRightContainer;
366
- const resizeBarElem = $xeTable.$refs.refCellResizeBar;
367
- const resizeTipElem = $xeTable.$refs.refCellResizeTip;
368
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
369
- const { clientX: dragClientX } = evnt;
370
- const wrapperElem = _vm.$el;
371
- const dragBtnElem = evnt.target;
372
- let resizeColumn = column;
373
- if (column.children && column.children.length) {
374
- XEUtils.eachTree(column.children, childColumn => {
375
- resizeColumn = childColumn;
376
- });
377
- }
378
- const cell = dragBtnElem.parentNode;
379
- const cellParams = Object.assign(params, { cell });
380
- let dragLeft = 0;
381
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
382
- if (!bodyScrollElem) {
383
- return;
384
- }
385
- const pos = getOffsetPos(dragBtnElem, tableEl);
386
- const dragBtnWidth = dragBtnElem.clientWidth;
387
- const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
388
- const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
389
- let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
390
- let dragPosLeft = pos.left + dragBtnOffsetWidth;
391
- const domMousemove = document.onmousemove;
392
- const domMouseup = document.onmouseup;
393
- const isLeftFixed = fixedType === 'left';
394
- const isRightFixed = fixedType === 'right';
395
- // 计算左右侧固定列偏移量
396
- let fixedOffsetWidth = 0;
397
- if (isLeftFixed || isRightFixed) {
398
- const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
399
- let tempCellElem = cell[siblingProp];
400
- while (tempCellElem) {
401
- if (hasClass(tempCellElem, 'fixed--hidden')) {
402
- break;
403
- }
404
- else if (!hasClass(tempCellElem, 'col--group')) {
405
- fixedOffsetWidth += tempCellElem.offsetWidth;
406
- }
407
- tempCellElem = tempCellElem[siblingProp];
408
- }
409
- if (isRightFixed && rightContainerElem) {
410
- dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
411
- }
412
- }
413
- // 处理拖动事件
414
- const updateEvent = function (evnt) {
415
- evnt.stopPropagation();
416
- evnt.preventDefault();
417
- const tableHeight = tableEl.clientHeight;
418
- const offsetX = evnt.clientX - dragClientX;
419
- let left = dragPosLeft + offsetX;
420
- const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
421
- if (isLeftFixed) {
422
- // 左固定列(不允许超过右侧固定列、不允许超过右边距)
423
- left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
424
- }
425
- else if (isRightFixed) {
426
- // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
427
- dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
428
- left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
429
- }
430
- else {
431
- dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
432
- // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
433
- }
434
- dragLeft = Math.max(left, dragMinLeft);
435
- const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
436
- resizeBarElem.style.left = `${resizeBarLeft}px`;
437
- resizeBarElem.style.top = `${scrollbarXToTop ? scrollbarHeight : 0}px`;
438
- resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - scrollbarHeight : tableHeight}px`;
439
- if (resizableOpts.showDragTip && resizeTipElem) {
440
- const tableWidth = tableEl.clientWidth;
441
- const wrapperRect = wrapperElem.getBoundingClientRect();
442
- const resizeBarWidth = resizeBarElem.clientWidth;
443
- const resizeTipWidth = resizeTipElem.clientWidth;
444
- const resizeTipHeight = resizeTipElem.clientHeight;
445
- let resizeTipLeft = -resizeTipWidth;
446
- if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
447
- resizeTipLeft = 0;
448
- }
449
- else if (resizeBarLeft > tableWidth) {
450
- resizeTipLeft += tableWidth - resizeBarLeft;
451
- }
452
- resizeTipElem.style.left = `${resizeTipLeft}px`;
453
- resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
454
- resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
455
- }
456
- };
457
- tableReactData._isResize = true;
458
- addClass(tableEl, 'drag--resize');
459
- resizeBarElem.style.display = 'block';
460
- document.onmousemove = updateEvent;
461
- document.onmouseup = function (evnt) {
462
- document.onmousemove = domMousemove;
463
- document.onmouseup = domMouseup;
464
- const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
465
- resizeColumn.resizeWidth = resizeWidth;
466
- if (resizableOpts.dragMode === 'fixed') {
467
- visibleColumn.forEach((item) => {
468
- if (item.id !== resizeColumn.id) {
469
- if (!item.resizeWidth) {
470
- item.resizeWidth = item.renderWidth;
471
- }
472
- }
473
- });
474
- }
475
- resizeBarElem.style.display = 'none';
476
- tableReactData._isResize = false;
477
- tableInternalData._lastResizeTime = Date.now();
478
- $xeTable.analyColumnWidth();
479
- $xeTable.recalculate(true).then(() => {
480
- $xeTable.saveCustomStore('update:visible');
481
- $xeTable.updateCellAreas();
482
- $xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
483
- setTimeout(() => $xeTable.recalculate(true), 300);
484
- });
485
- removeClass(tableEl, 'drag--resize');
486
- };
487
- updateEvent(evnt);
488
- $xeTable.closeMenu();
489
391
  }
490
392
  }
491
393
  };