vxe-table 3.18.2 → 3.18.4

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 (64) hide show
  1. package/es/grid/src/grid.js +5 -1
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/menu/mixin.js +67 -43
  7. package/es/table/module/menu/panel.js +10 -8
  8. package/es/table/render/index.js +4 -3
  9. package/es/table/src/body.js +12 -14
  10. package/es/table/src/methods.js +17 -5
  11. package/es/table/src/table.js +6 -7
  12. package/es/table/style.css +0 -4
  13. package/es/table/style.min.css +1 -1
  14. package/es/ui/index.js +1 -1
  15. package/es/ui/src/log.js +1 -1
  16. package/es/ui/src/vn.js +17 -7
  17. package/es/vxe-table/style.css +0 -4
  18. package/es/vxe-table/style.min.css +1 -1
  19. package/lib/grid/src/grid.js +6 -0
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/index.css +1 -1
  22. package/lib/index.min.css +1 -1
  23. package/lib/index.umd.js +161 -104
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/table/module/menu/mixin.js +84 -58
  28. package/lib/table/module/menu/mixin.min.js +1 -1
  29. package/lib/table/module/menu/panel.js +11 -10
  30. package/lib/table/module/menu/panel.min.js +1 -1
  31. package/lib/table/render/index.js +6 -3
  32. package/lib/table/render/index.min.js +1 -1
  33. package/lib/table/src/body.js +11 -13
  34. package/lib/table/src/body.min.js +1 -1
  35. package/lib/table/src/methods.js +18 -5
  36. package/lib/table/src/methods.min.js +1 -1
  37. package/lib/table/src/table.js +6 -7
  38. package/lib/table/src/table.min.js +1 -1
  39. package/lib/table/style/style.css +0 -4
  40. package/lib/table/style/style.min.css +1 -1
  41. package/lib/ui/index.js +1 -1
  42. package/lib/ui/index.min.js +1 -1
  43. package/lib/ui/src/log.js +1 -1
  44. package/lib/ui/src/log.min.js +1 -1
  45. package/lib/ui/src/vn.js +17 -6
  46. package/lib/ui/src/vn.min.js +1 -1
  47. package/lib/vxe-table/style/style.css +0 -4
  48. package/lib/vxe-table/style/style.min.css +1 -1
  49. package/package.json +1 -1
  50. package/packages/grid/src/grid.ts +5 -1
  51. package/packages/table/module/menu/mixin.ts +79 -50
  52. package/packages/table/module/menu/panel.ts +11 -9
  53. package/packages/table/render/index.ts +27 -26
  54. package/packages/table/src/body.ts +11 -13
  55. package/packages/table/src/methods.ts +17 -5
  56. package/packages/table/src/table.ts +9 -7
  57. package/packages/ui/src/vn.ts +20 -9
  58. package/styles/components/table.scss +0 -1
  59. /package/es/{iconfont.1756452257212.ttf → iconfont.1756734865034.ttf} +0 -0
  60. /package/es/{iconfont.1756452257212.woff → iconfont.1756734865034.woff} +0 -0
  61. /package/es/{iconfont.1756452257212.woff2 → iconfont.1756734865034.woff2} +0 -0
  62. /package/lib/{iconfont.1756452257212.ttf → iconfont.1756734865034.ttf} +0 -0
  63. /package/lib/{iconfont.1756452257212.woff → iconfont.1756734865034.woff} +0 -0
  64. /package/lib/{iconfont.1756452257212.woff2 → iconfont.1756734865034.woff2} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.18.2",
3
+ "version": "3.18.4",
4
4
  "description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -487,12 +487,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
487
487
  if (field) {
488
488
  let itemValue: any = null
489
489
  if (itemRender) {
490
- const { defaultValue } = itemRender
490
+ const { startField, endField, defaultValue } = itemRender
491
491
  if (XEUtils.isFunction(defaultValue)) {
492
492
  itemValue = defaultValue({ item })
493
493
  } else if (!XEUtils.isUndefined(defaultValue)) {
494
494
  itemValue = defaultValue
495
495
  }
496
+ if (startField && endField) {
497
+ XEUtils.set(fData, startField, null)
498
+ XEUtils.set(fData, endField, null)
499
+ }
496
500
  }
497
501
  fData[field] = itemValue
498
502
  }
@@ -4,7 +4,7 @@ import { getDomNode, getAbsolutePos, getEventTargetNode } from '../../../ui/src/
4
4
  import { isEnableConf, hasChildrenList } from '../../../ui/src/utils'
5
5
  import { warnLog } from '../../../ui/src/log'
6
6
 
7
- import type { VxeTableConstructor, VxeTablePrivateMethods, TableInternalData } from '../../../../types'
7
+ import type { VxeTableConstructor, VxeTablePrivateMethods, TableInternalData, TableReactData } from '../../../../types'
8
8
 
9
9
  const { menus, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
10
10
 
@@ -14,17 +14,20 @@ export default {
14
14
  * 关闭快捷菜单
15
15
  */
16
16
  _closeMenu () {
17
- Object.assign(this.ctxMenuStore, {
17
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
18
+ const reactData = $xeTable as unknown as TableReactData
19
+
20
+ Object.assign(reactData.ctxMenuStore, {
18
21
  visible: false,
19
22
  selected: null,
20
23
  selectChild: null,
21
24
  showChild: false
22
25
  })
23
- return this.$nextTick()
26
+ return $xeTable.$nextTick()
24
27
  },
25
28
  // 处理菜单的移动
26
29
  moveCtxMenu (evnt: KeyboardEvent, ctxMenuStore: any, property: 'selectChild' | 'selected', hasOper: boolean, operRest: any, menuList: any[]) {
27
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
30
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
28
31
 
29
32
  let selectItem
30
33
  const selectIndex = XEUtils.findIndexOf(menuList, item => ctxMenuStore[property] === item)
@@ -59,30 +62,40 @@ export default {
59
62
  * 快捷菜单事件处理
60
63
  */
61
64
  handleGlobalContextmenuEvent (evnt: any) {
62
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
65
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
63
66
  const $xeGrid = $xeTable.$xeGrid
64
67
  const $xeGantt = $xeTable.$xeGantt
68
+ const props = $xeTable
69
+ const reactData = $xeTable as unknown as TableReactData
65
70
  const internalData = $xeTable as unknown as TableInternalData
66
71
 
67
- const { $refs, tId, editStore, menuConfig, contextMenu, ctxMenuStore, ctxMenuOpts, mouseConfig, mouseOpts } = this
68
- const { selected } = editStore
72
+ const { xID } = $xeTable
73
+
74
+ const { mouseConfig, menuConfig } = props
75
+ const { editStore, ctxMenuStore } = reactData
76
+ const { visibleColumn } = internalData
69
77
  const tableFilter = $xeTable.$refs.refTableFilter
78
+ const tableMenu = $xeTable.$refs.refTableMenu
79
+ const mouseOpts = $xeTable.computeMouseOpts
80
+ const menuOpts = $xeTable.computeMenuOpts
81
+ const el = $xeTable.$refs.refElem as HTMLDivElement
82
+ const { selected } = editStore
70
83
  const layoutList = ['header', 'body', 'footer']
71
- if (isEnableConf(menuConfig) || contextMenu) {
72
- if (ctxMenuStore.visible && $refs.refTableMenu && getEventTargetNode(evnt, $refs.refTableMenu.$el).flag) {
84
+ if (isEnableConf(menuConfig)) {
85
+ if (ctxMenuStore.visible && tableMenu && getEventTargetNode(evnt, (tableMenu as any).$el).flag) {
73
86
  evnt.preventDefault()
74
87
  return
75
88
  }
76
89
  if (internalData._keyCtx) {
77
90
  const type = 'body'
78
- const params: any = { type, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, keyboard: true, columns: this.visibleColumn.slice(0), $event: evnt }
91
+ const params: any = { type, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, keyboard: true, columns: visibleColumn.slice(0), $event: evnt }
79
92
  // 如果开启单元格区域
80
93
  if (mouseConfig && mouseOpts.area) {
81
- const activeArea = this.getActiveCellArea()
94
+ const activeArea = $xeTable.getActiveCellArea()
82
95
  if (activeArea && activeArea.row && activeArea.column) {
83
96
  params.row = activeArea.row
84
97
  params.column = activeArea.column
85
- this.handleOpenMenuEvent(evnt, type, params)
98
+ $xeTable.handleOpenMenuEvent(evnt, type, params)
86
99
  return
87
100
  }
88
101
  } else if (mouseConfig && mouseOpts.selected) {
@@ -90,19 +103,19 @@ export default {
90
103
  if (selected.row && selected.column) {
91
104
  params.row = selected.row
92
105
  params.column = selected.column
93
- this.handleOpenMenuEvent(evnt, type, params)
106
+ $xeTable.handleOpenMenuEvent(evnt, type, params)
94
107
  return
95
108
  }
96
109
  }
97
110
  }
98
111
  // 分别匹配表尾、内容、表尾的快捷菜单
99
112
  for (let index = 0; index < layoutList.length; index++) {
100
- const layout = layoutList[index]
101
- const columnTargetNode = getEventTargetNode(evnt, this.$el, `vxe-${layout}--column`, (target: any) => {
113
+ const layout = layoutList[index] as 'header' | 'body' | 'footer'
114
+ const columnTargetNode = getEventTargetNode(evnt, el, `vxe-${layout}--column`, (target: any) => {
102
115
  // target=td|th,直接向上找 table 去匹配即可
103
- return target.parentNode.parentNode.parentNode.getAttribute('xid') === tId
116
+ return target.parentNode.parentNode.parentNode.getAttribute('xid') === xID
104
117
  })
105
- const params: any = { type: layout, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, columns: this.visibleColumn.slice(0), $event: evnt }
118
+ const params: any = { type: layout, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, columns: visibleColumn.slice(0), $event: evnt }
106
119
  if (columnTargetNode.flag) {
107
120
  const cell = columnTargetNode.targetElem
108
121
  const columnNodeRest = $xeTable.getColumnNode(cell)
@@ -121,66 +134,73 @@ export default {
121
134
  }
122
135
  }
123
136
  const eventType = `${typePrefix}cell-menu` as 'cell-menu' | 'header-cell-menu' | 'footer-cell-menu'
124
- this.handleOpenMenuEvent(evnt, layout, params)
137
+ $xeTable.handleOpenMenuEvent(evnt, layout, params)
125
138
  // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
126
- if (this.$listeners[`${typePrefix}cell-context-menu`]) {
139
+ if ($xeTable.$listeners[`${typePrefix}cell-context-menu`]) {
127
140
  warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
128
141
  $xeTable.dispatchEvent(`${typePrefix}cell-context-menu` as any, params, evnt)
129
142
  } else {
130
143
  $xeTable.dispatchEvent(eventType, params, evnt)
131
144
  }
132
145
  return
133
- } else if (getEventTargetNode(evnt, this.$el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === tId).flag) {
134
- if (ctxMenuOpts.trigger === 'cell') {
146
+ } else if (getEventTargetNode(evnt, $xeTable.$el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === xID).flag) {
147
+ if (menuOpts.trigger === 'cell') {
135
148
  evnt.preventDefault()
136
149
  } else {
137
- this.handleOpenMenuEvent(evnt, layout, params)
150
+ $xeTable.handleOpenMenuEvent(evnt, layout, params)
138
151
  }
139
152
  return
140
153
  }
141
154
  }
142
155
  }
143
156
  if (tableFilter && !getEventTargetNode(evnt, (tableFilter as any).$el).flag) {
144
- this.closeFilter()
157
+ $xeTable.closeFilter()
145
158
  }
146
- this.closeMenu()
159
+ $xeTable.closeMenu()
147
160
  },
148
161
  /**
149
162
  * 显示快捷菜单
150
163
  */
151
- handleOpenMenuEvent (evnt: any, type: any, params: any) {
152
- const { isCtxMenu, ctxMenuStore, ctxMenuOpts } = this
153
- const config = ctxMenuOpts[type]
154
- const visibleMethod = ctxMenuOpts.visibleMethod
164
+ handleOpenMenuEvent (evnt: any, type: 'header' | 'body' | 'footer', params: any) {
165
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
166
+ const reactData = $xeTable as unknown as TableReactData
167
+ const internalData = $xeTable as unknown as TableInternalData
168
+
169
+ const { ctxMenuStore } = reactData
170
+ const isMenu = $xeTable.computeIsMenu
171
+ const menuOpts = $xeTable.computeMenuOpts
172
+ const config = menuOpts[type]
173
+ const visibleMethod = menuOpts.visibleMethod
155
174
  if (config) {
156
175
  const { options, disabled } = config
157
176
  if (disabled) {
158
177
  evnt.preventDefault()
159
- } else if (isCtxMenu && options && options.length) {
178
+ } else if (isMenu && options && options.length) {
160
179
  params.options = options
161
- this.preventEvent(evnt, 'event.showMenu', params, () => {
180
+ $xeTable.preventEvent(evnt, 'event.showMenu', params, () => {
162
181
  if (!visibleMethod || visibleMethod(params)) {
163
182
  evnt.preventDefault()
164
- this.updateZindex()
183
+ $xeTable.updateZindex()
165
184
  const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
166
185
  let top = evnt.clientY + scrollTop
167
186
  let left = evnt.clientX + scrollLeft
168
187
  const handleVisible = () => {
188
+ internalData._currMenuParams = params
169
189
  Object.assign(ctxMenuStore, {
170
- args: params,
171
190
  visible: true,
172
191
  list: options,
173
192
  selected: null,
174
193
  selectChild: null,
175
194
  showChild: false,
176
195
  style: {
177
- zIndex: this.tZindex,
196
+ zIndex: internalData.tZindex,
178
197
  top: `${top}px`,
179
198
  left: `${left}px`
180
199
  }
181
200
  })
182
- this.$nextTick(() => {
183
- const ctxElem = this.$refs.refTableMenu.$el
201
+ $xeTable.$nextTick(() => {
202
+ const tableMenu = $xeTable.$refs.refTableMenu
203
+ const ctxElem = (tableMenu as any).$el
184
204
  const clientHeight = ctxElem.clientHeight
185
205
  const clientWidth = ctxElem.clientWidth
186
206
  const { boundingTop, boundingLeft } = getAbsolutePos(ctxElem)
@@ -196,27 +216,32 @@ export default {
196
216
  }
197
217
  const { keyboard, row, column } = params
198
218
  if (keyboard && row && column) {
199
- this.scrollToRow(row, column).then(() => {
200
- const cell = this.getCellElement(row, column)
201
- const { boundingTop, boundingLeft } = getAbsolutePos(cell)
202
- top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2)
203
- left = boundingLeft + scrollLeft + Math.floor(cell.offsetWidth / 2)
219
+ $xeTable.scrollToRow(row, column).then(() => {
220
+ const cell = $xeTable.getCellElement(row, column)
221
+ if (cell) {
222
+ const { boundingTop, boundingLeft } = getAbsolutePos(cell)
223
+ top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2)
224
+ left = boundingLeft + scrollLeft + Math.floor(cell.offsetWidth / 2)
225
+ }
204
226
  handleVisible()
205
227
  })
206
228
  } else {
207
229
  handleVisible()
208
230
  }
209
231
  } else {
210
- this.closeMenu()
232
+ $xeTable.closeMenu()
211
233
  }
212
234
  })
213
235
  }
214
236
  }
215
- this.closeFilter()
237
+ $xeTable.closeFilter()
216
238
  },
217
239
  ctxMenuMouseoverEvent (evnt: any, item: any, child: any) {
240
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
241
+ const reactData = $xeTable as unknown as TableReactData
242
+
218
243
  const menuElem = evnt.currentTarget
219
- const ctxMenuStore = this.ctxMenuStore
244
+ const { ctxMenuStore } = reactData
220
245
  evnt.preventDefault()
221
246
  evnt.stopPropagation()
222
247
  ctxMenuStore.selected = item
@@ -224,7 +249,7 @@ export default {
224
249
  if (!child) {
225
250
  ctxMenuStore.showChild = hasChildrenList(item)
226
251
  if (ctxMenuStore.showChild) {
227
- this.$nextTick(() => {
252
+ $xeTable.$nextTick(() => {
228
253
  const childWrapperElem = menuElem.nextElementSibling
229
254
  if (childWrapperElem) {
230
255
  const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(menuElem)
@@ -254,7 +279,10 @@ export default {
254
279
  }
255
280
  },
256
281
  ctxMenuMouseoutEvent (evnt: any, item: any) {
257
- const ctxMenuStore = this.ctxMenuStore
282
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
283
+ const reactData = $xeTable as unknown as TableReactData
284
+
285
+ const { ctxMenuStore } = reactData
258
286
  if (!item.children) {
259
287
  ctxMenuStore.selected = null
260
288
  }
@@ -264,26 +292,27 @@ export default {
264
292
  * 快捷菜单点击事件
265
293
  */
266
294
  ctxMenuLinkEvent (evnt: any, menu: any) {
267
- const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
295
+ const $xeTable = this as unknown as VxeTableConstructor & VxeTablePrivateMethods
268
296
  const $xeGrid = $xeTable.$xeGrid
269
297
  const $xeGantt = $xeTable.$xeGantt
298
+ const internalData = $xeTable as unknown as TableInternalData
270
299
 
271
300
  // 如果一级菜单有配置 code 则允许点击,否则不能点击
272
301
  if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
273
302
  const gMenuOpts = menus.get(menu.code)
274
- const params = Object.assign({ menu, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, $event: evnt }, this.ctxMenuStore.args)
303
+ const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, $event: evnt })
275
304
  if (gMenuOpts && gMenuOpts.menuMethod) {
276
305
  gMenuOpts.menuMethod(params, evnt)
277
306
  }
278
307
  // 在 v4 中废弃事件 context-menu-click
279
- if (this.$listeners['context-menu-click']) {
308
+ if ($xeTable.$listeners['context-menu-click']) {
280
309
  warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
281
310
  $xeTable.dispatchEvent('context-menu-click' as any, params, evnt)
282
311
  } else {
283
312
  $xeTable.dispatchEvent('menu-click', params, evnt)
284
313
  }
285
- this.closeMenu()
314
+ $xeTable.closeMenu()
286
315
  }
287
316
  }
288
- } as any
317
+ }
289
318
  }
@@ -2,9 +2,9 @@ import { CreateElement } from 'vue'
2
2
  import { VxeUI } from '../../../ui'
3
3
  import { getFuncText } from '../../../ui/src/utils'
4
4
 
5
- import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
5
+ import type { VxeTableConstructor, VxeTablePrivateMethods, TableReactData } from '../../../../types'
6
6
 
7
- const { getIcon } = VxeUI
7
+ const { getIcon, renderEmptyElement } = VxeUI
8
8
 
9
9
  export default {
10
10
  name: 'VxeTableMenuPanel',
@@ -23,16 +23,18 @@ export default {
23
23
  },
24
24
  render (this: any, h: CreateElement) {
25
25
  const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
26
+ const tableReactData = $xeTable as unknown as TableReactData
26
27
 
27
- const { _e, ctxMenuOpts, ctxMenuStore } = this
28
+ const { ctxMenuStore } = tableReactData
29
+ const menuOpts = $xeTable.computeMenuOpts
28
30
  return h('div', {
29
- class: ['vxe-table--context-menu-wrapper', ctxMenuOpts.className, {
31
+ class: ['vxe-table--context-menu-wrapper', menuOpts.className, {
30
32
  'is--visible': ctxMenuStore.visible
31
33
  }],
32
34
  style: ctxMenuStore.style
33
35
  }, ctxMenuStore.list.map((options: any, gIndex: any) => {
34
36
  return options.every((item: any) => item.visible === false)
35
- ? _e()
37
+ ? renderEmptyElement($xeTable)
36
38
  : h('ul', {
37
39
  class: 'vxe-context-menu--option-wrapper',
38
40
  key: gIndex
@@ -70,7 +72,7 @@ export default {
70
72
  h('i', {
71
73
  class: prefixOpts.icon || item.prefixIcon
72
74
  }),
73
- prefixOpts.content ? h('span', {}, `${prefixOpts.content}`) : _e()
75
+ prefixOpts.content ? h('span', {}, `${prefixOpts.content}`) : renderEmptyElement($xeTable)
74
76
  ]),
75
77
  h('span', {
76
78
  class: 'vxe-context-menu--link-content',
@@ -84,7 +86,7 @@ export default {
84
86
  h('i', {
85
87
  class: (suffixOpts.icon || item.suffixIcon) || (hasChildMenus ? getIcon().TABLE_MENU_OPTIONS : '')
86
88
  }),
87
- suffixOpts.content ? h('span', `${suffixOpts.content}`) : _e()
89
+ suffixOpts.content ? h('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)
88
90
  ])
89
91
  ]),
90
92
  hasChildMenus
@@ -125,7 +127,7 @@ export default {
125
127
  h('i', {
126
128
  class: childPrefixOpts.icon || child.prefixIcon
127
129
  }),
128
- childPrefixOpts.content ? h('span', `${childPrefixOpts.content}`) : _e()
130
+ childPrefixOpts.content ? h('span', `${childPrefixOpts.content}`) : renderEmptyElement($xeTable)
129
131
  ]),
130
132
  h('span', {
131
133
  class: 'vxe-context-menu--link-content',
@@ -139,7 +141,7 @@ export default {
139
141
  h('i', {
140
142
  class: childSuffixOpts.icon
141
143
  }),
142
- childSuffixOpts.content ? h('span', `${childSuffixOpts.content}`) : _e()
144
+ childSuffixOpts.content ? h('span', `${childSuffixOpts.content}`) : renderEmptyElement($xeTable)
143
145
  ])
144
146
  ])
145
147
  ])
@@ -56,7 +56,7 @@ function handleConfirmFilter (params: any, checked: any, option: any) {
56
56
  $panel.changeOption({}, checked, option)
57
57
  }
58
58
 
59
- function getNativeAttrs (renderOpts: any) {
59
+ function getNativeAttrs (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions) {
60
60
  let { name, attrs } = renderOpts
61
61
  if (name === 'input') {
62
62
  attrs = Object.assign({ type: 'text' }, attrs)
@@ -83,7 +83,7 @@ function getCellEditProps (renderOpts: VxeColumnPropTypes.EditRender, params: Vx
83
83
  return XEUtils.assign({ immediate: getInputImmediateModel(renderOpts) }, defaultCompProps, defaultProps, renderOpts.props, { [componentDefaultModelProp]: value })
84
84
  }
85
85
 
86
- function getCellEditFilterProps (renderOpts: any, params: any, value: any, defaultProps?: any) {
86
+ function getCellEditFilterProps (renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any, value: any, defaultProps?: any) {
87
87
  return XEUtils.assign({}, defaultCompProps, defaultProps, renderOpts.props, { [componentDefaultModelProp]: value })
88
88
  }
89
89
 
@@ -91,7 +91,7 @@ function isImmediateCell (renderOpts: VxeColumnPropTypes.EditRender, params: any
91
91
  return params.$type === 'cell' || getInputImmediateModel(renderOpts)
92
92
  }
93
93
 
94
- function getCellLabelVNs (h: CreateElement, renderOpts: any, params: any, cellLabel: any, opts?: {
94
+ function getCellLabelVNs (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any, cellLabel: any, opts?: {
95
95
  class?: string
96
96
  }) {
97
97
  const { placeholder } = renderOpts
@@ -115,7 +115,7 @@ function getCellLabelVNs (h: CreateElement, renderOpts: any, params: any, cellLa
115
115
  * @param modelFunc
116
116
  * @param changeFunc
117
117
  */
118
- function getNativeElementOns (renderOpts: any, params: any, eFns?: {
118
+ function getNativeElementOns (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions | VxeGlobalRendererHandles.RenderTableFilterOptions, params: any, eFns?: {
119
119
  model: (evnt: Event) => void
120
120
  change?: (evnt: Event) => void
121
121
  blur?: (evnt: Event) => void
@@ -172,7 +172,7 @@ const blurEvent = 'blur'
172
172
  * @param modelFunc
173
173
  * @param changeFunc
174
174
  */
175
- function getComponentOns (renderOpts: any, params: any, eFns?: {
175
+ function getComponentOns (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions | VxeGlobalRendererHandles.RenderTableFilterOptions, params: any, eFns?: {
176
176
  model: (cellValue: any) => void
177
177
  change?: (...args: any[]) => void
178
178
  blur?: (...args: any[]) => void
@@ -252,7 +252,7 @@ function getEditOns (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions
252
252
  })
253
253
  }
254
254
 
255
- function getFilterOns (renderOpts: any, params: any, option: any) {
255
+ function getFilterOns (renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any, option: any) {
256
256
  return getComponentOns(renderOpts, params, {
257
257
  model (value) {
258
258
  // 处理 model 值双向绑定
@@ -267,7 +267,7 @@ function getFilterOns (renderOpts: any, params: any, option: any) {
267
267
  })
268
268
  }
269
269
 
270
- function getNativeEditOns (renderOpts: any, params: any) {
270
+ function getNativeEditOns (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
271
271
  const { $table, row, column } = params
272
272
  const { model } = column
273
273
  return getNativeElementOns(renderOpts, params, {
@@ -302,7 +302,7 @@ function getNativeEditOns (renderOpts: any, params: any) {
302
302
  })
303
303
  }
304
304
 
305
- function getNativeFilterOns (renderOpts: any, params: any, option: any) {
305
+ function getNativeFilterOns (renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any, option: any) {
306
306
  return getNativeElementOns(renderOpts, params, {
307
307
  model (evnt) {
308
308
  // 处理 model 值双向绑定
@@ -324,12 +324,12 @@ function getNativeFilterOns (renderOpts: any, params: any, option: any) {
324
324
  * 单元格可编辑渲染-原生的标签
325
325
  * input、textarea、select
326
326
  */
327
- function nativeEditRender (h: CreateElement, renderOpts: any, params: any) {
327
+ function nativeEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
328
328
  const { row, column } = params
329
329
  const { name } = renderOpts
330
330
  const cellValue = isImmediateCell(renderOpts, params) ? getCellValue(row, column) : column.model.value
331
331
  return [
332
- h(name, {
332
+ h(`${name}`, {
333
333
  class: `vxe-default-${name}`,
334
334
  attrs: getNativeAttrs(renderOpts),
335
335
  domProps: {
@@ -340,7 +340,7 @@ function nativeEditRender (h: CreateElement, renderOpts: any, params: any) {
340
340
  ]
341
341
  }
342
342
 
343
- function buttonCellRender (h: CreateElement, renderOpts: any, params: any) {
343
+ function buttonCellRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions, params: any) {
344
344
  return [
345
345
  h(getDefaultComponent(renderOpts), {
346
346
  props: getCellEditProps(renderOpts, params, null),
@@ -405,7 +405,7 @@ function oldEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.R
405
405
  * 已废弃
406
406
  * @deprecated
407
407
  */
408
- function oldButtonEditRender (h: CreateElement, renderOpts: any, params: any) {
408
+ function oldButtonEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
409
409
  return [
410
410
  h('vxe-button', {
411
411
  props: getCellEditProps(renderOpts, params, null),
@@ -418,11 +418,12 @@ function oldButtonEditRender (h: CreateElement, renderOpts: any, params: any) {
418
418
  * 已废弃
419
419
  * @deprecated
420
420
  */
421
- function oldButtonsEditRender (h: CreateElement, renderOpts: any, params: any) {
422
- return renderOpts.children.map((childRenderOpts: any) => oldButtonEditRender(h, childRenderOpts, params)[0])
421
+ function oldButtonsEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: any) {
422
+ const { children } = renderOpts
423
+ return children ? children.map((childRenderOpts: any) => oldButtonEditRender(h, childRenderOpts, params)[0]) : []
423
424
  }
424
425
 
425
- function renderNativeOptgroups (h: CreateElement, renderOpts: any, params: any, renderOptionsMethods: any) {
426
+ function renderNativeOptgroups (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions, params: any, renderOptionsMethods: any) {
426
427
  const { optionGroups, optionGroupProps = {} } = renderOpts
427
428
  const groupOptions = optionGroupProps.options || 'options'
428
429
  const groupLabel = optionGroupProps.label || 'label'
@@ -442,7 +443,7 @@ function renderNativeOptgroups (h: CreateElement, renderOpts: any, params: any,
442
443
  /**
443
444
  * 渲染原生的 option 标签
444
445
  */
445
- function renderNativeOptions (h: CreateElement, options: any, renderOpts: any, params: any) {
446
+ function renderNativeOptions (h: CreateElement, options: any, renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: any) {
446
447
  const { optionProps = {} } = renderOpts
447
448
  const { row, column } = params
448
449
  const labelProp = optionProps.label || 'label'
@@ -467,12 +468,12 @@ function renderNativeOptions (h: CreateElement, options: any, renderOpts: any, p
467
468
  return []
468
469
  }
469
470
 
470
- function nativeFilterRender (h: CreateElement, renderOpts: any, params: any) {
471
+ function nativeFilterRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any) {
471
472
  const { column } = params
472
473
  const { name } = renderOpts
473
474
  const attrs = getNativeAttrs(renderOpts)
474
475
  return column.filters.map((option: any, oIndex: any) => {
475
- return h(name, {
476
+ return h(`${name}`, {
476
477
  key: oIndex,
477
478
  class: `vxe-default-${name}`,
478
479
  attrs,
@@ -484,7 +485,7 @@ function nativeFilterRender (h: CreateElement, renderOpts: any, params: any) {
484
485
  })
485
486
  }
486
487
 
487
- function defaultFilterRender (h: CreateElement, renderOpts: any, params: any) {
488
+ function defaultFilterRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any) {
488
489
  const { column } = params
489
490
  return column.filters.map((option: any, oIndex: any) => {
490
491
  const optionValue = option.data
@@ -500,7 +501,7 @@ function defaultFilterRender (h: CreateElement, renderOpts: any, params: any) {
500
501
  * 已废弃
501
502
  * @deprecated
502
503
  */
503
- function oldFilterRender (h: CreateElement, renderOpts: any, params: any) {
504
+ function oldFilterRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableFilterOptions, params: any) {
504
505
  const { column } = params
505
506
  return column.filters.map((option: any, oIndex: any) => {
506
507
  const optionValue = option.data
@@ -526,7 +527,7 @@ function handleInputFilterMethod ({ option, row, column }: any) {
526
527
  return XEUtils.toValueString(cellValue).indexOf(data) > -1
527
528
  }
528
529
 
529
- function nativeSelectEditRender (h: CreateElement, renderOpts: any, params: any) {
530
+ function nativeSelectEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
530
531
  return [
531
532
  h('select', {
532
533
  class: 'vxe-default-select',
@@ -537,7 +538,7 @@ function nativeSelectEditRender (h: CreateElement, renderOpts: any, params: any)
537
538
  ]
538
539
  }
539
540
 
540
- function defaultSelectEditRender (h: CreateElement, renderOpts: any, params: any) {
541
+ function defaultSelectEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
541
542
  const { row, column } = params
542
543
  const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
543
544
  const cellValue = getCellValue(row, column)
@@ -549,7 +550,7 @@ function defaultSelectEditRender (h: CreateElement, renderOpts: any, params: any
549
550
  ]
550
551
  }
551
552
 
552
- function defaultTableOrTreeSelectEditRender (h: CreateElement, renderOpts: any, params: any) {
553
+ function defaultTableOrTreeSelectEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
553
554
  const { row, column } = params
554
555
  const { options, optionProps } = renderOpts
555
556
  const cellValue = getCellValue(row, column)
@@ -565,7 +566,7 @@ function defaultTableOrTreeSelectEditRender (h: CreateElement, renderOpts: any,
565
566
  * 已废弃
566
567
  * @deprecated
567
568
  */
568
- function oldSelectEditRender (h: CreateElement, renderOpts: any, params: any) {
569
+ function oldSelectEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: any) {
569
570
  const { row, column } = params
570
571
  const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
571
572
  const cellValue = getCellValue(row, column)
@@ -577,7 +578,7 @@ function oldSelectEditRender (h: CreateElement, renderOpts: any, params: any) {
577
578
  ]
578
579
  }
579
580
 
580
- function getSelectCellValue (renderOpts: any, { row, column }: any) {
581
+ function getSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions, { row, column }: any) {
581
582
  const { options, optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts
582
583
  const cellValue = XEUtils.get(row, column.field)
583
584
  let selectItem: any
@@ -612,7 +613,7 @@ function handleExportSelectMethod (params: any) {
612
613
  return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params)
613
614
  }
614
615
 
615
- function getTreeSelectCellValue (renderOpts: any, { row, column }: any) {
616
+ function getTreeSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions, { row, column }: any) {
616
617
  const { options, optionProps = {} } = renderOpts
617
618
  const cellValue = XEUtils.get(row, column.field)
618
619
  const labelProp = optionProps.label || 'label'
@@ -177,14 +177,13 @@ function renderTdColumn (
177
177
  // hover 进入事件
178
178
  if (showTitle || showTooltip || showAllTip || tooltipConfig) {
179
179
  tdOns.mouseenter = (evnt: MouseEvent) => {
180
- if (isVMScrollProcess($xeTable)) {
181
- return
182
- }
183
- if (showTitle) {
184
- updateCellTitle(evnt.currentTarget, column)
185
- } else if (showTooltip || showAllTip) {
186
- // 如果配置了显示 tooltip
187
- $xeTable.triggerBodyTooltipEvent(evnt, cellParams)
180
+ if (!isVMScrollProcess($xeTable)) {
181
+ if (showTitle) {
182
+ updateCellTitle(evnt.currentTarget, column)
183
+ } else if (showTooltip || showAllTip) {
184
+ // 如果配置了显示 tooltip
185
+ $xeTable.triggerBodyTooltipEvent(evnt, cellParams)
186
+ }
188
187
  }
189
188
  $xeTable.dispatchEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
190
189
  }
@@ -192,11 +191,10 @@ function renderTdColumn (
192
191
  // hover 退出事件
193
192
  if (showTooltip || showAllTip || tooltipConfig) {
194
193
  tdOns.mouseleave = (evnt: MouseEvent) => {
195
- if (isVMScrollProcess($xeTable)) {
196
- return
197
- }
198
- if (showTooltip || showAllTip) {
199
- $xeTable.handleTargetLeaveEvent(evnt)
194
+ if (!isVMScrollProcess($xeTable)) {
195
+ if (showTooltip || showAllTip) {
196
+ $xeTable.handleTargetLeaveEvent(evnt)
197
+ }
200
198
  }
201
199
  $xeTable.dispatchEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
202
200
  }