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