vxe-table 3.10.16 → 3.11.0

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 (68) hide show
  1. package/README.md +1 -1
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/module/custom/mixin.js +5 -1
  5. package/es/table/module/edit/mixin.js +24 -15
  6. package/es/table/src/body.js +40 -24
  7. package/es/table/src/cell.js +75 -32
  8. package/es/table/src/footer.js +159 -131
  9. package/es/table/src/header.js +128 -90
  10. package/es/table/src/methods.js +284 -65
  11. package/es/table/src/props.js +5 -1
  12. package/es/table/src/table.js +64 -20
  13. package/es/table/style.css +33 -20
  14. package/es/table/style.min.css +1 -1
  15. package/es/ui/index.js +9 -4
  16. package/es/ui/src/log.js +1 -1
  17. package/es/vxe-table/style.css +33 -20
  18. package/es/vxe-table/style.min.css +1 -1
  19. package/helper/vetur/attributes.json +1 -1
  20. package/helper/vetur/tags.json +1 -1
  21. package/lib/index.umd.js +906 -449
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/style.css +1 -1
  24. package/lib/style.min.css +1 -1
  25. package/lib/table/module/custom/mixin.js +5 -1
  26. package/lib/table/module/custom/mixin.min.js +1 -1
  27. package/lib/table/module/edit/mixin.js +24 -15
  28. package/lib/table/module/edit/mixin.min.js +1 -1
  29. package/lib/table/src/body.js +31 -15
  30. package/lib/table/src/body.min.js +1 -1
  31. package/lib/table/src/cell.js +82 -35
  32. package/lib/table/src/cell.min.js +1 -1
  33. package/lib/table/src/footer.js +198 -161
  34. package/lib/table/src/footer.min.js +1 -1
  35. package/lib/table/src/header.js +169 -128
  36. package/lib/table/src/header.min.js +1 -1
  37. package/lib/table/src/methods.js +313 -68
  38. package/lib/table/src/methods.min.js +1 -1
  39. package/lib/table/src/props.js +5 -1
  40. package/lib/table/src/props.min.js +1 -1
  41. package/lib/table/src/table.js +70 -20
  42. package/lib/table/src/table.min.js +1 -1
  43. package/lib/table/style/style.css +33 -20
  44. package/lib/table/style/style.min.css +1 -1
  45. package/lib/ui/index.js +9 -4
  46. package/lib/ui/index.min.js +1 -1
  47. package/lib/ui/src/log.js +1 -1
  48. package/lib/ui/src/log.min.js +1 -1
  49. package/lib/vxe-table/style/style.css +33 -20
  50. package/lib/vxe-table/style/style.min.css +1 -1
  51. package/package.json +3 -3
  52. package/packages/table/module/custom/mixin.ts +5 -1
  53. package/packages/table/module/edit/mixin.ts +24 -15
  54. package/packages/table/src/body.ts +43 -25
  55. package/packages/table/src/cell.ts +120 -67
  56. package/packages/table/src/footer.ts +164 -150
  57. package/packages/table/src/header.ts +136 -90
  58. package/packages/table/src/methods.ts +296 -67
  59. package/packages/table/src/props.ts +5 -1
  60. package/packages/table/src/table.ts +71 -19
  61. package/packages/ui/index.ts +8 -3
  62. package/styles/components/table.scss +42 -35
  63. /package/es/{iconfont.1731633464058.ttf → iconfont.1731890707082.ttf} +0 -0
  64. /package/es/{iconfont.1731633464058.woff → iconfont.1731890707082.woff} +0 -0
  65. /package/es/{iconfont.1731633464058.woff2 → iconfont.1731890707082.woff2} +0 -0
  66. /package/lib/{iconfont.1731633464058.ttf → iconfont.1731890707082.ttf} +0 -0
  67. /package/lib/{iconfont.1731633464058.woff → iconfont.1731890707082.woff} +0 -0
  68. /package/lib/{iconfont.1731633464058.woff2 → iconfont.1731890707082.woff2} +0 -0
@@ -5,6 +5,132 @@ import { getOffsetPos, hasClass, addClass, removeClass } from '../../ui/src/dom'
5
5
  import { convertHeaderColumnToRows, getColReMinWidth } from './util';
6
6
  const { renderer } = VxeUI;
7
7
  const cellType = 'header';
8
+ const renderRows = (h, _vm, cols, $rowIndex) => {
9
+ const { $parent: $xetable, fixedType } = _vm;
10
+ const { $listeners: tableListeners, resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, highlightCurrentColumn, currentColumn, scrollXLoad, overflowX, scrollbarWidth, sortOpts, mouseConfig, columnOpts } = $xetable;
11
+ return cols.map((column, $columnIndex) => {
12
+ const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column;
13
+ // const { enabled } = tooltipOpts
14
+ const colid = column.id;
15
+ const renderOpts = editRender || cellRender;
16
+ const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
17
+ const isColGroup = column.children && column.children.length;
18
+ const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
19
+ const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
20
+ const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
21
+ let showEllipsis = headOverflow === 'ellipsis';
22
+ const showTitle = headOverflow === 'title';
23
+ const showTooltip = headOverflow === true || headOverflow === 'tooltip';
24
+ let hasEllipsis = showTitle || showTooltip || showEllipsis;
25
+ const thOns = {};
26
+ const hasFilter = column.filters && column.filters.some((item) => item.checked);
27
+ const columnIndex = $xetable.getColumnIndex(column);
28
+ const _columnIndex = $xetable.getVTColumnIndex(column);
29
+ const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
30
+ // 虚拟滚动不支持动态高度
31
+ if (scrollXLoad && !hasEllipsis) {
32
+ showEllipsis = hasEllipsis = true;
33
+ }
34
+ if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
35
+ thOns.click = (evnt) => $xetable.triggerHeaderCellClickEvent(evnt, params);
36
+ }
37
+ if (tableListeners['header-cell-dblclick']) {
38
+ thOns.dblclick = (evnt) => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
39
+ }
40
+ // 按下事件处理
41
+ if (mouseConfig) {
42
+ thOns.mousedown = (evnt) => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
43
+ }
44
+ // 拖拽行事件
45
+ if (columnOpts.drag && !column.parentId) {
46
+ thOns.dragstart = $xetable.handleHeaderCellDragDragstartEvent;
47
+ thOns.dragend = $xetable.handleHeaderCellDragDragendEvent;
48
+ thOns.dragover = $xetable.handleHeaderCellDragDragoverEvent;
49
+ }
50
+ return h('th', {
51
+ class: ['vxe-header--column', colid, {
52
+ [`col--${headAlign}`]: headAlign,
53
+ [`col--${type}`]: type,
54
+ 'col--last': $columnIndex === cols.length - 1,
55
+ 'col--fixed': column.fixed,
56
+ 'col--group': isColGroup,
57
+ 'col--ellipsis': hasEllipsis,
58
+ 'fixed--hidden': fixedHiddenColumn,
59
+ 'is--sortable': column.sortable,
60
+ 'col--filter': !!column.filters,
61
+ 'is--filter-active': hasFilter,
62
+ 'col--current': currentColumn === column
63
+ }, getClass(headerClassName, params), getClass(headerCellClassName, params)],
64
+ attrs: {
65
+ colid,
66
+ colspan: column.colSpan > 1 ? column.colSpan : null,
67
+ rowspan: column.rowSpan > 1 ? column.rowSpan : null
68
+ },
69
+ style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
70
+ on: thOns,
71
+ key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
72
+ }, [
73
+ h('div', {
74
+ class: ['vxe-cell', {
75
+ 'c--title': showTitle,
76
+ 'c--tooltip': showTooltip,
77
+ 'c--ellipsis': showEllipsis
78
+ }]
79
+ }, column.renderHeader(h, params)),
80
+ /**
81
+ * 列宽拖动
82
+ */
83
+ !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
84
+ ? h('div', {
85
+ class: ['vxe-resizable', {
86
+ 'is--line': !border || border === 'none'
87
+ }],
88
+ on: {
89
+ mousedown: (evnt) => _vm.resizeMousedown(evnt, params)
90
+ }
91
+ })
92
+ : null
93
+ ]);
94
+ }).concat(scrollbarWidth
95
+ ? [
96
+ h('th', {
97
+ key: `gr${$rowIndex}`,
98
+ class: 'vxe-header--gutter col--gutter'
99
+ })
100
+ ]
101
+ : []);
102
+ };
103
+ function renderHeads(h, _vm, headerGroups) {
104
+ const { $parent: $xetable } = _vm;
105
+ const tableProps = $xetable;
106
+ const { fixedType } = _vm;
107
+ const { headerRowClassName, headerRowStyle } = tableProps;
108
+ const { isDragColMove } = $xetable;
109
+ const columnOpts = $xetable.columnOpts;
110
+ return headerGroups.map((cols, $rowIndex) => {
111
+ const params = { $table: $xetable, $rowIndex, fixed: fixedType, type: cellType };
112
+ if (columnOpts.drag) {
113
+ return h('transition-group', {
114
+ props: {
115
+ tag: 'tr',
116
+ name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
117
+ class: [
118
+ 'vxe-header--row',
119
+ headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
120
+ ],
121
+ style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
122
+ }
123
+ }, renderRows(h, _vm, cols, $rowIndex));
124
+ }
125
+ return h('tr', {
126
+ class: [
127
+ 'vxe-header--row',
128
+ headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
129
+ ],
130
+ style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
131
+ }, renderRows(h, _vm, cols, $rowIndex));
132
+ });
133
+ }
8
134
  export default {
9
135
  name: 'VxeTableHeader',
10
136
  props: {
@@ -52,7 +178,7 @@ export default {
52
178
  },
53
179
  render(h) {
54
180
  const { _e, $parent: $xetable, fixedType, headerColumn, tableColumn, fixedColumn } = this;
55
- const { $listeners: tableListeners, tId, isGroup, visibleColumn, resizable: allResizable, border, columnKey, headerRowClassName, headerCellClassName, headerRowStyle, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, highlightCurrentColumn, currentColumn, scrollXLoad, overflowX, scrollbarWidth, sortOpts, mouseConfig, columnOpts } = $xetable;
181
+ const { tId, isGroup, visibleColumn, showHeaderOverflow: allColumnHeaderOverflow, scrollXLoad, scrollbarWidth } = $xetable;
56
182
  let headerGroups = headerColumn;
57
183
  let renderColumnList = tableColumn;
58
184
  if (isGroup) {
@@ -115,95 +241,7 @@ export default {
115
241
  */
116
242
  h('thead', {
117
243
  ref: 'thead'
118
- }, headerGroups.map((cols, $rowIndex) => {
119
- return h('tr', {
120
- class: ['vxe-header--row', headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowClassName : ''],
121
- style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowStyle) : null
122
- }, cols.map((column, $columnIndex) => {
123
- const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column;
124
- // const { enabled } = tooltipOpts
125
- const colid = column.id;
126
- const renderOpts = editRender || cellRender;
127
- const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
128
- const isColGroup = column.children && column.children.length;
129
- const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
130
- const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
131
- const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
132
- let showEllipsis = headOverflow === 'ellipsis';
133
- const showTitle = headOverflow === 'title';
134
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
135
- let hasEllipsis = showTitle || showTooltip || showEllipsis;
136
- const thOns = {};
137
- const hasFilter = column.filters && column.filters.some((item) => item.checked);
138
- const columnIndex = $xetable.getColumnIndex(column);
139
- const _columnIndex = $xetable.getVTColumnIndex(column);
140
- const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
141
- // 虚拟滚动不支持动态高度
142
- if (scrollXLoad && !hasEllipsis) {
143
- showEllipsis = hasEllipsis = true;
144
- }
145
- if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
146
- thOns.click = (evnt) => $xetable.triggerHeaderCellClickEvent(evnt, params);
147
- }
148
- if (tableListeners['header-cell-dblclick']) {
149
- thOns.dblclick = (evnt) => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
150
- }
151
- // 按下事件处理
152
- if (mouseConfig) {
153
- thOns.mousedown = (evnt) => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
154
- }
155
- return h('th', {
156
- class: ['vxe-header--column', colid, {
157
- [`col--${headAlign}`]: headAlign,
158
- [`col--${type}`]: type,
159
- 'col--last': $columnIndex === cols.length - 1,
160
- 'col--fixed': column.fixed,
161
- 'col--group': isColGroup,
162
- 'col--ellipsis': hasEllipsis,
163
- 'fixed--hidden': fixedHiddenColumn,
164
- 'is--sortable': column.sortable,
165
- 'col--filter': !!column.filters,
166
- 'is--filter-active': hasFilter,
167
- 'col--current': currentColumn === column
168
- }, getClass(headerClassName, params), getClass(headerCellClassName, params)],
169
- attrs: {
170
- colid,
171
- colspan: column.colSpan > 1 ? column.colSpan : null,
172
- rowspan: column.rowSpan > 1 ? column.rowSpan : null
173
- },
174
- style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
175
- on: thOns,
176
- key: columnKey || columnOpts.useKey || isColGroup ? colid : $columnIndex
177
- }, [
178
- h('div', {
179
- class: ['vxe-cell', {
180
- 'c--title': showTitle,
181
- 'c--tooltip': showTooltip,
182
- 'c--ellipsis': showEllipsis
183
- }]
184
- }, column.renderHeader(h, params)),
185
- /**
186
- * 列宽拖动
187
- */
188
- !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
189
- ? h('div', {
190
- class: ['vxe-resizable', {
191
- 'is--line': !border || border === 'none'
192
- }],
193
- on: {
194
- mousedown: (evnt) => this.resizeMousedown(evnt, params)
195
- }
196
- })
197
- : null
198
- ]);
199
- }).concat(scrollbarWidth
200
- ? [
201
- h('th', {
202
- class: 'vxe-header--gutter col--gutter'
203
- })
204
- ]
205
- : []));
206
- }))
244
+ }, renderHeads(h, this, headerGroups))
207
245
  ]),
208
246
  /**
209
247
  * 其他