vxe-table 3.25.0-beta.2 → 3.25.0-beta.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/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/custom/panel.js +2 -2
- package/es/table/module/filter/mixin.js +5 -7
- package/es/table/module/filter/panel.js +47 -48
- package/es/table/src/methods.js +13 -7
- package/es/table/src/table.js +52 -27
- package/es/table/src/util.js +1 -2
- package/es/table/style.css +31 -12
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/dom.js +11 -8
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +31 -12
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +126 -149
- 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/custom/panel.js +2 -2
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/filter/mixin.js +6 -7
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +41 -37
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/src/methods.js +9 -9
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +56 -29
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +1 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +31 -12
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +11 -7
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +31 -12
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +2 -1
- package/packages/table/module/custom/panel.ts +2 -2
- package/packages/table/module/filter/mixin.ts +5 -7
- package/packages/table/module/filter/panel.ts +50 -48
- package/packages/table/src/methods.ts +15 -7
- package/packages/table/src/table.ts +55 -27
- package/packages/table/src/util.ts +1 -2
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +12 -8
- package/styles/components/table-module/filter.scss +25 -14
- package/es/table/src/scrollbar.js +0 -54
- package/lib/table/src/scrollbar.js +0 -63
- package/lib/table/src/scrollbar.min.js +0 -1
- package/packages/table/src/scrollbar.ts +0 -57
- /package/es/{iconfont.1792035018941.ttf → iconfont.1792139868734.ttf} +0 -0
- /package/es/{iconfont.1792035018941.woff → iconfont.1792139868734.woff} +0 -0
- /package/es/{iconfont.1792035018941.woff2 → iconfont.1792139868734.woff2} +0 -0
- /package/lib/{iconfont.1792035018941.ttf → iconfont.1792139868734.ttf} +0 -0
- /package/lib/{iconfont.1792035018941.woff → iconfont.1792139868734.woff} +0 -0
- /package/lib/{iconfont.1792035018941.woff2 → iconfont.1792139868734.woff2} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "3.25.0-beta.
|
|
3
|
+
"version": "3.25.0-beta.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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vue-i18n": "^8.15.1",
|
|
66
66
|
"vue-router": "^3.5.1",
|
|
67
67
|
"vue-template-compiler": "2.6.14",
|
|
68
|
-
"vxe-pc-ui": "3.20.
|
|
68
|
+
"vxe-pc-ui": "3.20.9"
|
|
69
69
|
},
|
|
70
70
|
"vetur": {
|
|
71
71
|
"tags": "helper/vetur/tags.json",
|
|
@@ -10,7 +10,7 @@ import { tableProps } from '../../table/src/props'
|
|
|
10
10
|
import VxeTableComponent from '../../table'
|
|
11
11
|
import VxeToolbarComponent from '../../toolbar'
|
|
12
12
|
|
|
13
|
-
import type { VxeFormItemProps, VxeFormDefines, VxeComponentStyleType, VxeComponentSizeType, ValueOf, VxeFormInstance, VxeFormItemPropTypes, VxePagerInstance } from 'vxe-pc-ui'
|
|
13
|
+
import type { VxeFormItemProps, VxeFormDefines, VxeComponentStyleType, VxeComponentSizeType, VxeComponentIsVScrollbar, ValueOf, VxeFormInstance, VxeFormItemPropTypes, VxePagerInstance } from 'vxe-pc-ui'
|
|
14
14
|
import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, GridInternalData, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData, VxeTableProps, VxeGridDefines } from '../../../types'
|
|
15
15
|
|
|
16
16
|
const { warnLog, errLog } = createComponentLog('grid')
|
|
@@ -139,6 +139,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
139
139
|
computed: {
|
|
140
140
|
...({} as {
|
|
141
141
|
computeSize(): VxeComponentSizeType
|
|
142
|
+
computeIsVScrollbar(): VxeComponentIsVScrollbar
|
|
142
143
|
}),
|
|
143
144
|
isRespMsg () {
|
|
144
145
|
const $xeGrid = this
|
|
@@ -453,8 +453,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
453
453
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
454
454
|
|
|
455
455
|
if (prevDragGroupField || prevDragAggFnColid) {
|
|
456
|
-
if ($xeTable.
|
|
457
|
-
$xeTable.
|
|
456
|
+
if ($xeTable.handlePivotTableAggPanelDragendEvent) {
|
|
457
|
+
$xeTable.handlePivotTableAggPanelDragendEvent(evnt)
|
|
458
458
|
}
|
|
459
459
|
} else if (prevDragCol && dragCol) {
|
|
460
460
|
// 判断是否有拖动
|
|
@@ -17,7 +17,7 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
17
17
|
const internalData = $xeTable as unknown as TableInternalData
|
|
18
18
|
const $xeGGWrapper = $xeGrid || $xeGantt
|
|
19
19
|
|
|
20
|
-
const { filterStore } = reactData
|
|
20
|
+
const { filterStore, scrollbarHeight } = reactData
|
|
21
21
|
const { elemStore } = internalData
|
|
22
22
|
const { column, targetEl } = filterStore
|
|
23
23
|
if (!column) {
|
|
@@ -39,8 +39,6 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
39
39
|
if (!filterWrapperElem) {
|
|
40
40
|
return $xeTable.$nextTick()
|
|
41
41
|
}
|
|
42
|
-
const filterHeadElem = filterWrapperElem.querySelector<HTMLDivElement>('.vxe-table--filter-header')
|
|
43
|
-
const filterFootElem = filterWrapperElem.querySelector<HTMLDivElement>('.vxe-table--filter-footer')
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
44
|
* 是否显示筛选按钮图标
|
|
@@ -72,6 +70,7 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
72
70
|
if (transfer) {
|
|
73
71
|
const ppObj = updatePanelPlacement(currEl, filterWrapperElem, {
|
|
74
72
|
defaultPlacement: 'bottom',
|
|
73
|
+
appendTo: '',
|
|
75
74
|
isMinWidth: false,
|
|
76
75
|
teleportTo: transfer
|
|
77
76
|
})
|
|
@@ -79,9 +78,9 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
79
78
|
} else {
|
|
80
79
|
const filterWidth = filterWrapperElem.offsetWidth
|
|
81
80
|
const centerWidth = targetEl ? filterWidth / 2 : ((filterWidth - column.renderWidth) / 2)
|
|
82
|
-
maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14)
|
|
83
81
|
left = btnRect.left - tableRect.left - centerWidth
|
|
84
82
|
top = btnRect.top - tableRect.top + currEl.clientHeight
|
|
83
|
+
maxHeight = Math.max(40, tableEl.clientHeight - top - scrollbarHeight)
|
|
85
84
|
if (left < 1) {
|
|
86
85
|
left = 1
|
|
87
86
|
} else if (left > (tableEl.clientWidth - filterWidth - 1)) {
|
|
@@ -103,7 +102,6 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
103
102
|
if (zIndex) {
|
|
104
103
|
panelStyle.zIndex = zIndex
|
|
105
104
|
}
|
|
106
|
-
filterStore.style = panelStyle
|
|
107
105
|
// 筛选面板是自适应表格高度
|
|
108
106
|
if (compConf ? !compConf.tableFilterAutoHeight : false) {
|
|
109
107
|
maxHeight = 0
|
|
@@ -112,8 +110,8 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
112
110
|
maxHeight = customMaxHeight > maxHeight ? maxHeight : customMaxHeight
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
filterStore.
|
|
113
|
+
panelStyle['--vxe-ui-vxe-table-filter-default-max-height'] = maxHeight ? toCssUnit(maxHeight) : 'none'
|
|
114
|
+
filterStore.style = panelStyle
|
|
117
115
|
}
|
|
118
116
|
handleStyle()
|
|
119
117
|
return $xeTable.$nextTick().then(() => {
|
|
@@ -2,7 +2,7 @@ import { CreateElement, PropType } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '../../../ui'
|
|
4
4
|
import { formatText, isEnableConf } from '../../../ui/src/utils'
|
|
5
|
-
import { getPropClass
|
|
5
|
+
import { getPropClass } from '../../../ui/src/dom'
|
|
6
6
|
import { getSlotVNs } from '../../../ui/src/vn'
|
|
7
7
|
import { createComponentLog } from '../../../ui/src/log'
|
|
8
8
|
|
|
@@ -142,16 +142,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
142
142
|
*************************/
|
|
143
143
|
|
|
144
144
|
renderOptions (h: CreateElement, filterRender: VxeColumnPropTypes.FilterRender | null, compConf: VxeGlobalRendererOptions | null) {
|
|
145
|
+
const VxeUIScrollbarComponent = VxeUI.getComponent('VxeScrollbar')
|
|
146
|
+
|
|
145
147
|
const $xeFilterPanel = this
|
|
146
148
|
const props = $xeFilterPanel
|
|
147
149
|
const $xeTable = $xeFilterPanel.$xeTable
|
|
148
150
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
149
151
|
|
|
150
152
|
const { filterStore } = props
|
|
151
|
-
const { column
|
|
153
|
+
const { column } = filterStore
|
|
152
154
|
if (!column) {
|
|
153
155
|
return []
|
|
154
156
|
}
|
|
157
|
+
const filterOpts = $xeTable.computeFilterOpts
|
|
158
|
+
const { useScrollbar } = filterOpts
|
|
155
159
|
const { filterMultiple, filters, slots } = column
|
|
156
160
|
const filterOptions = (filters || []) as VxeTableDefines.FilterOption[]
|
|
157
161
|
const filterSlot = slots ? slots.filter : null
|
|
@@ -160,33 +164,52 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
160
164
|
if (filterSlot) {
|
|
161
165
|
return [
|
|
162
166
|
h('div', {
|
|
163
|
-
class: 'vxe-table--filter-template'
|
|
164
|
-
style: maxHeight
|
|
165
|
-
? {
|
|
166
|
-
maxHeight: toCssUnit(maxHeight)
|
|
167
|
-
}
|
|
168
|
-
: {}
|
|
167
|
+
class: 'vxe-table--filter-template'
|
|
169
168
|
}, $xeTable.callSlot(filterSlot, params, h))
|
|
170
169
|
]
|
|
171
170
|
} else if (filterRender && rtFilter) {
|
|
172
171
|
return [
|
|
173
172
|
h('div', {
|
|
174
|
-
class: 'vxe-table--filter-template'
|
|
175
|
-
style: maxHeight
|
|
176
|
-
? {
|
|
177
|
-
maxHeight: toCssUnit(maxHeight)
|
|
178
|
-
}
|
|
179
|
-
: {}
|
|
173
|
+
class: 'vxe-table--filter-template'
|
|
180
174
|
}, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))
|
|
181
175
|
]
|
|
182
176
|
}
|
|
183
177
|
const isAllChecked = filterMultiple ? filterStore.isAllSelected : !filterOptions.some((item) => item._checked)
|
|
184
178
|
const isAllIndeterminate = filterMultiple && filterStore.isIndeterminate
|
|
179
|
+
|
|
180
|
+
const optVNs = filterOptions.map((item: any) => {
|
|
181
|
+
const isChecked = item._checked
|
|
182
|
+
const isIndeterminate = false
|
|
183
|
+
return h('div', {
|
|
184
|
+
class: ['vxe-table--filter-option', {
|
|
185
|
+
'is--checked': isChecked
|
|
186
|
+
}],
|
|
187
|
+
attrs: {
|
|
188
|
+
title: item.label
|
|
189
|
+
},
|
|
190
|
+
on: {
|
|
191
|
+
click: (evnt: MouseEvent) => {
|
|
192
|
+
($xeFilterPanel as any).changeOption(evnt, !item._checked, item)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}, (filterMultiple
|
|
196
|
+
? [
|
|
197
|
+
h('span', {
|
|
198
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
: []).concat([
|
|
202
|
+
h('span', {
|
|
203
|
+
class: 'vxe-checkbox--label'
|
|
204
|
+
}, formatText(item.label, 1))
|
|
205
|
+
]))
|
|
206
|
+
})
|
|
207
|
+
|
|
185
208
|
return [
|
|
186
|
-
h('
|
|
209
|
+
h('div', {
|
|
187
210
|
class: 'vxe-table--filter-header'
|
|
188
211
|
}, [
|
|
189
|
-
h('
|
|
212
|
+
h('div', {
|
|
190
213
|
class: ['vxe-table--filter-option', {
|
|
191
214
|
'is--checked': isAllChecked,
|
|
192
215
|
'is--indeterminate': isAllIndeterminate
|
|
@@ -211,40 +234,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
211
234
|
}, getI18n('vxe.table.allFilter'))
|
|
212
235
|
]))
|
|
213
236
|
]),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
: {}
|
|
221
|
-
}, filterOptions.map((item: any) => {
|
|
222
|
-
const isChecked = item._checked
|
|
223
|
-
const isIndeterminate = false
|
|
224
|
-
return h('li', {
|
|
225
|
-
class: ['vxe-table--filter-option', {
|
|
226
|
-
'is--checked': isChecked
|
|
227
|
-
}],
|
|
228
|
-
attrs: {
|
|
229
|
-
title: item.label
|
|
237
|
+
useScrollbar
|
|
238
|
+
? h(VxeUIScrollbarComponent, {
|
|
239
|
+
class: 'vxe-table--scrollbar-filter-body',
|
|
240
|
+
props: {
|
|
241
|
+
viewClassName: 'vxe-table--scrollbar-filter-body-view'
|
|
230
242
|
},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
($xeFilterPanel as any).changeOption(evnt, !item._checked, item)
|
|
234
|
-
}
|
|
243
|
+
scopedSlots: {
|
|
244
|
+
default: () => optVNs
|
|
235
245
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
})
|
|
241
|
-
]
|
|
242
|
-
: []).concat([
|
|
243
|
-
h('span', {
|
|
244
|
-
class: 'vxe-checkbox--label'
|
|
245
|
-
}, formatText(item.label, 1))
|
|
246
|
-
]))
|
|
247
|
-
}))
|
|
246
|
+
})
|
|
247
|
+
: h('div', {
|
|
248
|
+
class: 'vxe-table--filter-body'
|
|
249
|
+
}, optVNs)
|
|
248
250
|
]
|
|
249
251
|
},
|
|
250
252
|
renderFooter (h: CreateElement) {
|
|
@@ -6,7 +6,6 @@ import Cell from './cell'
|
|
|
6
6
|
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime'
|
|
9
|
-
import { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } from './scrollbar'
|
|
10
9
|
import { createComponentLog } from '../../ui/src/log'
|
|
11
10
|
import { getCrossTableDragRowInfo } from './store'
|
|
12
11
|
|
|
@@ -15,7 +14,9 @@ import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, TableReactData
|
|
|
15
14
|
|
|
16
15
|
const { warnLog, errLog } = createComponentLog('table')
|
|
17
16
|
|
|
18
|
-
const { getConfig, getI18n, renderer, formats, interceptor, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
|
|
17
|
+
const { getConfig, getI18n, renderer, scrollbarUtils, formats, interceptor, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
|
|
18
|
+
|
|
19
|
+
const { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } = scrollbarUtils || {}
|
|
19
20
|
|
|
20
21
|
const supportMaxRow = 5e6
|
|
21
22
|
const customStorageKey = 'VXE_CUSTOM_STORE'
|
|
@@ -3241,6 +3242,7 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3241
3242
|
if (reFull) {
|
|
3242
3243
|
updateTreeLineStyle($xeTable)
|
|
3243
3244
|
}
|
|
3245
|
+
$xeTable.updateScrollbar()
|
|
3244
3246
|
internalData.rceRunTime = Date.now()
|
|
3245
3247
|
if (reFull) {
|
|
3246
3248
|
return computeScrollLoad($xeTable)
|
|
@@ -10274,8 +10276,15 @@ const tableMethods: any = {
|
|
|
10274
10276
|
*/
|
|
10275
10277
|
updateScrollbar () {
|
|
10276
10278
|
const $xeTable = this
|
|
10277
|
-
|
|
10278
|
-
$xeTable.
|
|
10279
|
+
|
|
10280
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
10281
|
+
if (isVScrollbar) {
|
|
10282
|
+
return $xeTable.$nextTick().then(() => {
|
|
10283
|
+
$xeTable.updateThumbSize()
|
|
10284
|
+
$xeTable.updateThumbOffset()
|
|
10285
|
+
})
|
|
10286
|
+
}
|
|
10287
|
+
return Promise.resolve()
|
|
10279
10288
|
},
|
|
10280
10289
|
/**
|
|
10281
10290
|
* 表头单元格按下事件
|
|
@@ -12819,12 +12828,11 @@ const tableMethods: any = {
|
|
|
12819
12828
|
},
|
|
12820
12829
|
triggerBodyScrollEvent (evnt: Event, fixedType: '' | 'left' | 'right') {
|
|
12821
12830
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
12822
|
-
const props = $xeTable
|
|
12823
12831
|
const reactData = $xeTable as unknown as TableReactData
|
|
12824
12832
|
const internalData = $xeTable as unknown as TableInternalData
|
|
12825
12833
|
|
|
12826
|
-
const { useScrollbar } = props
|
|
12827
12834
|
const { scrollYLoad, scrollXLoad } = reactData
|
|
12835
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
12828
12836
|
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
12829
12837
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
12830
12838
|
return
|
|
@@ -12843,7 +12851,7 @@ const tableMethods: any = {
|
|
|
12843
12851
|
if (!bodyScrollElem) {
|
|
12844
12852
|
return
|
|
12845
12853
|
}
|
|
12846
|
-
if (!
|
|
12854
|
+
if (!isVScrollbar) {
|
|
12847
12855
|
if (!xHandleEl) {
|
|
12848
12856
|
return
|
|
12849
12857
|
}
|
|
@@ -33,6 +33,27 @@ const { warnLog, errLog } = createComponentLog('table')
|
|
|
33
33
|
|
|
34
34
|
const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, domUtils, globalMixins, renderEmptyElement } = VxeUI
|
|
35
35
|
|
|
36
|
+
function bindScrollbarResize ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
37
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
38
|
+
|
|
39
|
+
const { elemStore } = internalData
|
|
40
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
41
|
+
if (isVScrollbar) {
|
|
42
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
43
|
+
const viewInnerEl = getRefElem(elemStore['main-body-table'])
|
|
44
|
+
const scrollObserver = globalResize.create(() => {
|
|
45
|
+
($xeTable as any).reScrollFlag++
|
|
46
|
+
})
|
|
47
|
+
if (el) {
|
|
48
|
+
scrollObserver.observe(el)
|
|
49
|
+
}
|
|
50
|
+
if (viewInnerEl) {
|
|
51
|
+
scrollObserver.observe(viewInnerEl)
|
|
52
|
+
}
|
|
53
|
+
internalData.scrollObserver = scrollObserver
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
function handleUpdateMergeBodyCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
|
|
37
58
|
const internalData = $xeTable as unknown as TableInternalData
|
|
38
59
|
|
|
@@ -564,14 +585,13 @@ function renderNativeBody (h: CreateElement, $xeTable: VxeTableConstructor & Vxe
|
|
|
564
585
|
}
|
|
565
586
|
|
|
566
587
|
function renderVirtualBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
567
|
-
const props = $xeTable
|
|
568
588
|
const reactData = $xeTable as unknown as TableReactData
|
|
569
589
|
const internalData = $xeTable as unknown as TableInternalData
|
|
570
590
|
const $xeGantt = $xeTable.$xeGantt
|
|
571
591
|
const $xeGanttView = internalData.xeGanttView
|
|
572
592
|
|
|
573
|
-
const { useScrollbar } = props
|
|
574
593
|
const { xThumbWidth, yThumbHeight } = reactData
|
|
594
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
575
595
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
576
596
|
const scrollXAutoHide = $xeTable.computeScrollXAutoHide
|
|
577
597
|
const scrollYAutoHide = $xeTable.computeScrollYAutoHide
|
|
@@ -586,10 +606,10 @@ function renderVirtualBody (h: CreateElement, $xeTable: VxeTableConstructor & Vx
|
|
|
586
606
|
return h('div', {
|
|
587
607
|
key: 'lvb',
|
|
588
608
|
class: ['vxe-table--layout-wrapper', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
589
|
-
'is--virtual-scrollbar':
|
|
590
|
-
'ov-padding':
|
|
591
|
-
'ov-x--auto-hide':
|
|
592
|
-
'ov-y--auto-hide':
|
|
609
|
+
'is--virtual-scrollbar': isVScrollbar,
|
|
610
|
+
'ov-padding': isVScrollbar && scrollbarOpts.padding,
|
|
611
|
+
'ov-x--auto-hide': isVScrollbar && scrollXAutoHide,
|
|
612
|
+
'ov-y--auto-hide': isVScrollbar && scrollYAutoHide,
|
|
593
613
|
'overflow-y': yThumbHeight,
|
|
594
614
|
'overflow-x': xThumbWidth
|
|
595
615
|
}]
|
|
@@ -1091,7 +1111,8 @@ export default {
|
|
|
1091
1111
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1092
1112
|
const props = $xeTable
|
|
1093
1113
|
|
|
1094
|
-
|
|
1114
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
1115
|
+
return Object.assign({ useScrollbar: isVScrollbar }, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
|
|
1095
1116
|
},
|
|
1096
1117
|
tipConfig () {
|
|
1097
1118
|
return { ...this.tooltipOpts }
|
|
@@ -1161,7 +1182,8 @@ export default {
|
|
|
1161
1182
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1162
1183
|
const props = $xeTable
|
|
1163
1184
|
|
|
1164
|
-
|
|
1185
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
1186
|
+
return Object.assign({ useScrollbar: isVScrollbar }, getConfig().table.filterConfig, props.filterConfig)
|
|
1165
1187
|
},
|
|
1166
1188
|
computeFloatingFilterOpts () {
|
|
1167
1189
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -1782,40 +1804,44 @@ export default {
|
|
|
1782
1804
|
|
|
1783
1805
|
$xeTable.reLayoutFlag++
|
|
1784
1806
|
},
|
|
1807
|
+
computeIsVScrollbar () {
|
|
1808
|
+
const $xeTable = this
|
|
1809
|
+
|
|
1810
|
+
$xeTable.$nextTick(() => {
|
|
1811
|
+
bindScrollbarResize($xeTable)
|
|
1812
|
+
$xeTable.$nextTick(() => {
|
|
1813
|
+
$xeTable.reLayoutFlag++
|
|
1814
|
+
})
|
|
1815
|
+
})
|
|
1816
|
+
},
|
|
1785
1817
|
computeScrollbarXToTop () {
|
|
1786
1818
|
const $xeTable = this
|
|
1787
1819
|
|
|
1788
|
-
$xeTable.reScrollFlag++
|
|
1789
1820
|
$xeTable.reLayoutFlag++
|
|
1790
1821
|
},
|
|
1791
1822
|
computeScrollbarYToLeft () {
|
|
1792
1823
|
const $xeTable = this
|
|
1793
1824
|
|
|
1794
|
-
$xeTable.reScrollFlag++
|
|
1795
1825
|
$xeTable.reLayoutFlag++
|
|
1796
1826
|
},
|
|
1797
1827
|
computeScrollXVisible () {
|
|
1798
1828
|
const $xeTable = this
|
|
1799
1829
|
|
|
1800
|
-
$xeTable.reScrollFlag++
|
|
1801
1830
|
$xeTable.reLayoutFlag++
|
|
1802
1831
|
},
|
|
1803
1832
|
computeScrollYVisible () {
|
|
1804
1833
|
const $xeTable = this
|
|
1805
1834
|
|
|
1806
|
-
$xeTable.reScrollFlag++
|
|
1807
1835
|
$xeTable.reLayoutFlag++
|
|
1808
1836
|
},
|
|
1809
1837
|
computeScrollXHeight () {
|
|
1810
1838
|
const $xeTable = this
|
|
1811
1839
|
|
|
1812
|
-
$xeTable.reScrollFlag++
|
|
1813
1840
|
$xeTable.reLayoutFlag++
|
|
1814
1841
|
},
|
|
1815
1842
|
computeScrollYWidth () {
|
|
1816
1843
|
const $xeTable = this
|
|
1817
1844
|
|
|
1818
|
-
$xeTable.reScrollFlag++
|
|
1819
1845
|
$xeTable.reLayoutFlag++
|
|
1820
1846
|
},
|
|
1821
1847
|
computeCellHeitht () {
|
|
@@ -1826,18 +1852,15 @@ export default {
|
|
|
1826
1852
|
reLayoutFlag () {
|
|
1827
1853
|
const $xeTable = this
|
|
1828
1854
|
|
|
1829
|
-
$xeTable.$nextTick(() => {
|
|
1855
|
+
$xeTable.$nextTick().then(() => {
|
|
1830
1856
|
$xeTable.recalculate(true)
|
|
1831
1857
|
})
|
|
1832
1858
|
},
|
|
1833
1859
|
reScrollFlag () {
|
|
1834
1860
|
const $xeTable = this
|
|
1835
1861
|
|
|
1836
|
-
$xeTable
|
|
1862
|
+
$xeTable.updateScrollbar().then(() => {
|
|
1837
1863
|
$xeTable.updateScrollbar()
|
|
1838
|
-
$xeTable.$nextTick(() => {
|
|
1839
|
-
$xeTable.updateScrollbar()
|
|
1840
|
-
})
|
|
1841
1864
|
})
|
|
1842
1865
|
},
|
|
1843
1866
|
|
|
@@ -2318,7 +2341,7 @@ export default {
|
|
|
2318
2341
|
}
|
|
2319
2342
|
|
|
2320
2343
|
$xeTable.$nextTick(() => {
|
|
2321
|
-
const {
|
|
2344
|
+
const { autoResize } = props
|
|
2322
2345
|
const { elemStore } = internalData
|
|
2323
2346
|
|
|
2324
2347
|
// 使用已安装的组件,如果未安装则不渲染
|
|
@@ -2326,6 +2349,7 @@ export default {
|
|
|
2326
2349
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
2327
2350
|
|
|
2328
2351
|
const { showOverflow, showHeaderOverflow, showFooterOverflow } = props
|
|
2352
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
2329
2353
|
const tooltipOpts = $xeTable.computeTooltipOpts
|
|
2330
2354
|
const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts
|
|
2331
2355
|
const footerTooltipOpts = $xeTable.computeFooterTooltipOpts
|
|
@@ -2367,7 +2391,7 @@ export default {
|
|
|
2367
2391
|
}
|
|
2368
2392
|
|
|
2369
2393
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
2370
|
-
if (
|
|
2394
|
+
if (isVScrollbar) {
|
|
2371
2395
|
const viewInnerEl = getRefElem(elemStore['main-body-table'])
|
|
2372
2396
|
const scrollObserver = globalResize.create(() => {
|
|
2373
2397
|
$xeTable.reScrollFlag++
|
|
@@ -2497,9 +2521,10 @@ export default {
|
|
|
2497
2521
|
|
|
2498
2522
|
const { xID } = $xeTable
|
|
2499
2523
|
|
|
2500
|
-
const { loading, stripe,
|
|
2524
|
+
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props
|
|
2501
2525
|
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
|
|
2502
2526
|
const { leftList, rightList } = columnStore
|
|
2527
|
+
const isVScrollbar = $xeTable.computeIsVScrollbar
|
|
2503
2528
|
const loadingSlot = slots.loading
|
|
2504
2529
|
const tipSlots = {
|
|
2505
2530
|
header: slots.headerTooltip || slots['header-tooltip'],
|
|
@@ -2545,7 +2570,7 @@ export default {
|
|
|
2545
2570
|
}
|
|
2546
2571
|
return h('div', {
|
|
2547
2572
|
ref: 'refElem',
|
|
2548
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`,
|
|
2573
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, isVScrollbar ? 'is--virtual-scrollbar' : 'is--native-scrollbar', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
2549
2574
|
[`size--${vSize}`]: vSize,
|
|
2550
2575
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
2551
2576
|
'vxe-editable': !!editConfig,
|
|
@@ -2613,7 +2638,7 @@ export default {
|
|
|
2613
2638
|
h('div', {
|
|
2614
2639
|
key: 'tw',
|
|
2615
2640
|
class: 'vxe-table--render-wrapper'
|
|
2616
|
-
},
|
|
2641
|
+
}, isVScrollbar
|
|
2617
2642
|
? [renderVirtualBody(h, $xeTable)]
|
|
2618
2643
|
: (
|
|
2619
2644
|
scrollbarXToTop
|
|
@@ -2803,7 +2828,8 @@ export default {
|
|
|
2803
2828
|
ref: 'refCommTooltip',
|
|
2804
2829
|
props: {
|
|
2805
2830
|
isArrow: false,
|
|
2806
|
-
enterable: false
|
|
2831
|
+
enterable: false,
|
|
2832
|
+
useScrollbar: isVScrollbar
|
|
2807
2833
|
}
|
|
2808
2834
|
})
|
|
2809
2835
|
: renderEmptyElement($xeTable),
|
|
@@ -2830,7 +2856,8 @@ export default {
|
|
|
2830
2856
|
maxHeight: tableTipConfig.maxHeight,
|
|
2831
2857
|
placement: tableTipConfig.placement,
|
|
2832
2858
|
defaultPlacement: tableTipConfig.defaultPlacement,
|
|
2833
|
-
popupClassName: tableTipConfig.popupClassName
|
|
2859
|
+
popupClassName: tableTipConfig.popupClassName,
|
|
2860
|
+
useScrollbar: tableTipConfig.useScrollbar
|
|
2834
2861
|
},
|
|
2835
2862
|
scopedSlots: currTooltipSlot
|
|
2836
2863
|
? {
|
|
@@ -2873,7 +2900,8 @@ export default {
|
|
|
2873
2900
|
theme: validTipConfig.theme,
|
|
2874
2901
|
enterable: validTipConfig.enterable,
|
|
2875
2902
|
enterDelay: validTipConfig.enterDelay,
|
|
2876
|
-
leaveDelay: validTipConfig.leaveDelay
|
|
2903
|
+
leaveDelay: validTipConfig.leaveDelay,
|
|
2904
|
+
useScrollbar: validTipConfig.useScrollbar
|
|
2877
2905
|
}
|
|
2878
2906
|
})
|
|
2879
2907
|
: renderEmptyElement($xeTable)
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/dom.ts
CHANGED
|
@@ -266,6 +266,7 @@ interface PanelPlacementOptions {
|
|
|
266
266
|
defaultLeft?: number
|
|
267
267
|
placement?: '' | 'top' | 'bottom' | null
|
|
268
268
|
defaultPlacement?: '' | 'top' | 'bottom' | null
|
|
269
|
+
appendTo?: string | HTMLElement | ((params: any) => string | HTMLElement)
|
|
269
270
|
teleportTo?: boolean
|
|
270
271
|
marginSize?: number
|
|
271
272
|
isMinWidth?: boolean
|
|
@@ -275,7 +276,8 @@ interface PanelPlacementOptions {
|
|
|
275
276
|
* 通用定位计算
|
|
276
277
|
*/
|
|
277
278
|
export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: PanelPlacementOptions) {
|
|
278
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
279
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
280
|
+
appendTo: '',
|
|
279
281
|
teleportTo: false,
|
|
280
282
|
marginSize: 18,
|
|
281
283
|
isMinWidth: true
|
|
@@ -289,7 +291,7 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
|
|
|
289
291
|
const stys: Record<string, string> = {}
|
|
290
292
|
if (panelElem && targetElem) {
|
|
291
293
|
const bodyEl = document.body
|
|
292
|
-
const parentWrapperEl = getPopupWrapperElement(panelElem)
|
|
294
|
+
const parentWrapperEl = getPopupWrapperElement(teleportTo ? getPopupAppendElement(appendTo) : panelElem)
|
|
293
295
|
if (parentWrapperEl) {
|
|
294
296
|
const targetWidth = targetElem.offsetWidth
|
|
295
297
|
const targetHeight = targetElem.offsetHeight
|
|
@@ -302,16 +304,18 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
|
|
|
302
304
|
const visibleHeight = bodyEl.clientHeight
|
|
303
305
|
const visibleWidth = bodyEl.clientWidth
|
|
304
306
|
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
+
const parentWrapperScrollLeft = parentWrapperEl.scrollLeft
|
|
308
|
+
const parentWrapperScrollTop = parentWrapperEl.scrollTop
|
|
309
|
+
const parentWrapperOffsetLeft = parentWrapperRect.left
|
|
310
|
+
const parentWrapperOffsetTop = parentWrapperRect.top
|
|
307
311
|
const targetLeft = targetRect.left
|
|
308
312
|
const targetTop = targetRect.top
|
|
309
313
|
|
|
310
314
|
minWidth = targetElem.offsetWidth
|
|
311
315
|
|
|
312
316
|
if (teleportTo) {
|
|
313
|
-
left = defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)
|
|
314
|
-
top = defaultTop || (targetTop + targetHeight)
|
|
317
|
+
left = (defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)) - parentWrapperScrollLeft
|
|
318
|
+
top = (defaultTop || (targetTop + targetHeight)) - parentWrapperScrollTop
|
|
315
319
|
if (placement === 'top') {
|
|
316
320
|
panelPlacement = 'top'
|
|
317
321
|
top = targetTop - panelHeight
|
|
@@ -354,8 +358,8 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
|
|
|
354
358
|
}
|
|
355
359
|
|
|
356
360
|
// 偏移
|
|
357
|
-
top -=
|
|
358
|
-
left -=
|
|
361
|
+
top -= parentWrapperOffsetTop
|
|
362
|
+
left -= parentWrapperOffsetLeft
|
|
359
363
|
} else {
|
|
360
364
|
if (placement === 'top') {
|
|
361
365
|
panelPlacement = 'top'
|