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.
- package/es/grid/src/grid.js +5 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/menu/mixin.js +67 -43
- package/es/table/module/menu/panel.js +10 -8
- package/es/table/render/index.js +4 -3
- package/es/table/src/body.js +12 -14
- package/es/table/src/methods.js +17 -5
- package/es/table/src/table.js +6 -7
- package/es/table/style.css +0 -4
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +17 -7
- package/es/vxe-table/style.css +0 -4
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +6 -0
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +161 -104
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/menu/mixin.js +84 -58
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +11 -10
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/render/index.js +6 -3
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +11 -13
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +18 -5
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +6 -7
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +0 -4
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/vn.js +17 -6
- package/lib/ui/src/vn.min.js +1 -1
- package/lib/vxe-table/style/style.css +0 -4
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/grid/src/grid.ts +5 -1
- package/packages/table/module/menu/mixin.ts +79 -50
- package/packages/table/module/menu/panel.ts +11 -9
- package/packages/table/render/index.ts +27 -26
- package/packages/table/src/body.ts +11 -13
- package/packages/table/src/methods.ts +17 -5
- package/packages/table/src/table.ts +9 -7
- package/packages/ui/src/vn.ts +20 -9
- package/styles/components/table.scss +0 -1
- /package/es/{iconfont.1756452257212.ttf → iconfont.1756734865034.ttf} +0 -0
- /package/es/{iconfont.1756452257212.woff → iconfont.1756734865034.woff} +0 -0
- /package/es/{iconfont.1756452257212.woff2 → iconfont.1756734865034.woff2} +0 -0
- /package/lib/{iconfont.1756452257212.ttf → iconfont.1756734865034.ttf} +0 -0
- /package/lib/{iconfont.1756452257212.woff → iconfont.1756734865034.woff} +0 -0
- /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.
|
|
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
|
-
|
|
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
|
|
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 {
|
|
68
|
-
|
|
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)
|
|
72
|
-
if (ctxMenuStore.visible &&
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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') ===
|
|
116
|
+
return target.parentNode.parentNode.parentNode.getAttribute('xid') === xID
|
|
104
117
|
})
|
|
105
|
-
const params: any = { type: layout, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, columns:
|
|
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
|
-
|
|
137
|
+
$xeTable.handleOpenMenuEvent(evnt, layout, params)
|
|
125
138
|
// 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
|
|
126
|
-
if (
|
|
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,
|
|
134
|
-
if (
|
|
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
|
-
|
|
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
|
-
|
|
157
|
+
$xeTable.closeFilter()
|
|
145
158
|
}
|
|
146
|
-
|
|
159
|
+
$xeTable.closeMenu()
|
|
147
160
|
},
|
|
148
161
|
/**
|
|
149
162
|
* 显示快捷菜单
|
|
150
163
|
*/
|
|
151
|
-
handleOpenMenuEvent (evnt: any, type:
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
const
|
|
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 (
|
|
178
|
+
} else if (isMenu && options && options.length) {
|
|
160
179
|
params.options = options
|
|
161
|
-
|
|
180
|
+
$xeTable.preventEvent(evnt, 'event.showMenu', params, () => {
|
|
162
181
|
if (!visibleMethod || visibleMethod(params)) {
|
|
163
182
|
evnt.preventDefault()
|
|
164
|
-
|
|
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:
|
|
196
|
+
zIndex: internalData.tZindex,
|
|
178
197
|
top: `${top}px`,
|
|
179
198
|
left: `${left}px`
|
|
180
199
|
}
|
|
181
200
|
})
|
|
182
|
-
|
|
183
|
-
const
|
|
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
|
-
|
|
200
|
-
const cell =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
232
|
+
$xeTable.closeMenu()
|
|
211
233
|
}
|
|
212
234
|
})
|
|
213
235
|
}
|
|
214
236
|
}
|
|
215
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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 }
|
|
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 (
|
|
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
|
-
|
|
314
|
+
$xeTable.closeMenu()
|
|
286
315
|
}
|
|
287
316
|
}
|
|
288
|
-
}
|
|
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 {
|
|
28
|
+
const { ctxMenuStore } = tableReactData
|
|
29
|
+
const menuOpts = $xeTable.computeMenuOpts
|
|
28
30
|
return h('div', {
|
|
29
|
-
class: ['vxe-table--context-menu-wrapper',
|
|
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
|
-
?
|
|
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}`) :
|
|
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}`) :
|
|
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}`) :
|
|
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}`) :
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
422
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
}
|