vxe-table 4.21.4 → 4.21.6
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/README.md +23 -16
- package/dist/all.esm.js +274 -88
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -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/filter/hook.js +67 -56
- package/es/table/module/keyboard/hook.js +3 -4
- package/es/table/src/body.js +3 -3
- package/es/table/src/footer.js +3 -3
- package/es/table/src/header.js +6 -6
- package/es/table/src/table.js +24 -11
- package/es/table/src/util.js +6 -5
- package/es/table/style.css +1 -1
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +162 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +1 -1
- 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 +272 -96
- 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/filter/hook.js +65 -58
- package/lib/table/module/filter/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +3 -5
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +5 -4
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +5 -4
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +10 -8
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +11 -9
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +6 -5
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +1 -1
- 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/dom.js +167 -0
- 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 +1 -1
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/custom/hook.ts +1 -1
- package/packages/table/module/filter/hook.ts +67 -53
- package/packages/table/module/keyboard/hook.ts +3 -4
- package/packages/table/src/body.ts +3 -3
- package/packages/table/src/footer.ts +3 -3
- package/packages/table/src/header.ts +6 -6
- package/packages/table/src/table.ts +24 -11
- package/packages/table/src/util.ts +9 -6
- package/packages/ui/src/dom.ts +176 -0
- package/styles/components/table-module/filter.scss +1 -1
- package/styles/theme/base.scss +2 -0
- package/styles/theme/dark.scss +4 -4
- package/styles/theme/light.scss +4 -4
- package/styles/variable.scss +4 -4
- /package/es/{iconfont.1788399047071.ttf → iconfont.1788695187811.ttf} +0 -0
- /package/es/{iconfont.1788399047071.woff → iconfont.1788695187811.woff} +0 -0
- /package/es/{iconfont.1788399047071.woff2 → iconfont.1788695187811.woff2} +0 -0
- /package/lib/{iconfont.1788399047071.ttf → iconfont.1788695187811.ttf} +0 -0
- /package/lib/{iconfont.1788399047071.woff → iconfont.1788695187811.woff} +0 -0
- /package/lib/{iconfont.1788399047071.woff2 → iconfont.1788695187811.woff2} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.6",
|
|
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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"typescript": "~5.9.3",
|
|
67
67
|
"vue": "3.4.27",
|
|
68
68
|
"vue-router": "~4.5.1",
|
|
69
|
-
"vxe-pc-ui": "4.
|
|
69
|
+
"vxe-pc-ui": "4.18.2"
|
|
70
70
|
},
|
|
71
71
|
"vetur": {
|
|
72
72
|
"tags": "helper/vetur/tags.json",
|
|
@@ -482,8 +482,8 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
482
482
|
handleUpdateCustomColumn,
|
|
483
483
|
handleCustomStyle () {
|
|
484
484
|
const reactData = $xeTable.reactData
|
|
485
|
-
const { customStore } = reactData
|
|
486
485
|
|
|
486
|
+
const { customStore } = reactData
|
|
487
487
|
if (!customStore.visible) {
|
|
488
488
|
return nextTick()
|
|
489
489
|
}
|
|
@@ -2,7 +2,7 @@ import { nextTick } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../../ui'
|
|
4
4
|
import { toFilters, handleFieldOrColumn, getRefElem } from '../../src/util'
|
|
5
|
-
import { toCssUnit, triggerEvent,
|
|
5
|
+
import { toCssUnit, triggerEvent, updatePanelPlacement } from '../../../ui/src/dom'
|
|
6
6
|
import { isEnableConf } from '../../../ui/src/utils'
|
|
7
7
|
|
|
8
8
|
import type { TableFilterMethods, TableFilterPrivateMethods, VxeTableDefines } from '../../../../types'
|
|
@@ -27,15 +27,12 @@ hooks.add('tableFilterModule', {
|
|
|
27
27
|
const { filterStore } = reactData
|
|
28
28
|
const { elemStore } = internalData
|
|
29
29
|
const { column, targetEl } = filterStore
|
|
30
|
-
if (!column
|
|
30
|
+
if (!column) {
|
|
31
31
|
return nextTick()
|
|
32
32
|
}
|
|
33
33
|
const tableEl = refElem.value
|
|
34
|
-
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
|
|
35
34
|
const filterOpts = computeFilterOpts.value
|
|
36
35
|
const { maxHeight: customMaxHeight, transfer, zIndex } = filterOpts
|
|
37
|
-
const currEl = targetEl
|
|
38
|
-
const tableRect = tableEl.getBoundingClientRect()
|
|
39
36
|
const filterRender = column ? column.filterRender : null
|
|
40
37
|
const compConf = filterRender && isEnableConf(filterRender) ? renderer.get(filterRender.name) : null
|
|
41
38
|
|
|
@@ -48,63 +45,81 @@ hooks.add('tableFilterModule', {
|
|
|
48
45
|
if (!filterWrapperElem) {
|
|
49
46
|
return nextTick()
|
|
50
47
|
}
|
|
51
|
-
const btnRect = currEl.getBoundingClientRect()
|
|
52
48
|
const filterHeadElem = filterWrapperElem.querySelector<HTMLDivElement>('.vxe-table--filter-header')
|
|
53
49
|
const filterFootElem = filterWrapperElem.querySelector<HTMLDivElement>('.vxe-table--filter-footer')
|
|
54
|
-
|
|
55
|
-
const centerWidth = currEl ? filterWidth / 2 : ((filterWidth - column.renderWidth) / 2)
|
|
56
|
-
let left = 0
|
|
57
|
-
let top = 0
|
|
58
|
-
let maxHeight: number = 0
|
|
50
|
+
|
|
59
51
|
/**
|
|
60
52
|
* 是否显示筛选按钮图标
|
|
61
53
|
* 如果不存在图标,则相对单元格居中显示
|
|
62
54
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
const handleStyle = () => {
|
|
56
|
+
let currEl = targetEl
|
|
57
|
+
if (!targetEl) {
|
|
58
|
+
const headerWrapperElem = getRefElem(elemStore[`${column.fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'])
|
|
59
|
+
const colEl = headerWrapperElem ? headerWrapperElem.querySelector<HTMLDivElement>(`.vxe-header--column.${column.id}`) : null
|
|
60
|
+
if (colEl) {
|
|
61
|
+
currEl = colEl
|
|
62
|
+
}
|
|
71
63
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
top = btnRect.top - tableRect.top + currEl.clientHeight
|
|
75
|
-
maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14)
|
|
76
|
-
if (left < 1) {
|
|
77
|
-
left = 1
|
|
78
|
-
} else if (left > (tableEl.clientWidth - filterWidth - 1)) {
|
|
79
|
-
left = tableEl.clientWidth - filterWidth - 1
|
|
64
|
+
if (!currEl) {
|
|
65
|
+
return nextTick()
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
|
|
68
|
+
const btnRect = currEl.getBoundingClientRect()
|
|
69
|
+
const tableRect = tableEl.getBoundingClientRect()
|
|
70
|
+
let left = 0
|
|
71
|
+
let top = 0
|
|
72
|
+
let maxHeight = 0
|
|
73
|
+
let panelStyle: Record<string, string | number> = {}
|
|
74
|
+
if (transfer) {
|
|
75
|
+
const ppObj = updatePanelPlacement(currEl, filterWrapperElem, {
|
|
76
|
+
defaultPlacement: 'bottom',
|
|
77
|
+
isMinWidth: false,
|
|
78
|
+
teleportTo: transfer
|
|
79
|
+
})
|
|
80
|
+
panelStyle = ppObj.style
|
|
81
|
+
} else {
|
|
82
|
+
const filterWidth = filterWrapperElem.offsetWidth
|
|
83
|
+
const centerWidth = targetEl ? filterWidth / 2 : ((filterWidth - column.renderWidth) / 2)
|
|
84
|
+
left = btnRect.left - tableRect.left - centerWidth
|
|
85
|
+
top = btnRect.top - tableRect.top + currEl.clientHeight
|
|
86
|
+
maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14)
|
|
87
|
+
if (left < 1) {
|
|
88
|
+
left = 1
|
|
89
|
+
} else if (left > (tableEl.clientWidth - filterWidth - 1)) {
|
|
90
|
+
left = tableEl.clientWidth - filterWidth - 1
|
|
91
|
+
}
|
|
92
|
+
if ($xeGGWrapper) {
|
|
93
|
+
const wrapperEl = $xeGGWrapper.getRefMaps().refElem.value
|
|
94
|
+
if (wrapperEl) {
|
|
95
|
+
const wrapperRect = wrapperEl.getBoundingClientRect()
|
|
96
|
+
top += tableRect.top - wrapperRect.top
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
panelStyle = {
|
|
100
|
+
top: toCssUnit(top),
|
|
101
|
+
left: toCssUnit(left)
|
|
86
102
|
}
|
|
87
103
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
maxHeight = 0
|
|
100
|
-
} else {
|
|
101
|
-
if (customMaxHeight) {
|
|
102
|
-
maxHeight = customMaxHeight > maxHeight ? maxHeight : customMaxHeight
|
|
104
|
+
if (zIndex) {
|
|
105
|
+
panelStyle.zIndex = zIndex
|
|
106
|
+
}
|
|
107
|
+
filterStore.style = panelStyle
|
|
108
|
+
// 筛选面板是自适应表格高度
|
|
109
|
+
if (compConf ? !compConf.tableFilterAutoHeight : false) {
|
|
110
|
+
maxHeight = 0
|
|
111
|
+
} else {
|
|
112
|
+
if (customMaxHeight) {
|
|
113
|
+
maxHeight = customMaxHeight > maxHeight ? maxHeight : customMaxHeight
|
|
114
|
+
}
|
|
103
115
|
}
|
|
116
|
+
// 判断面板不能大于表格高度
|
|
117
|
+
filterStore.maxHeight = maxHeight
|
|
104
118
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
handleStyle()
|
|
120
|
+
return nextTick().then(() => {
|
|
121
|
+
handleStyle()
|
|
122
|
+
})
|
|
108
123
|
}
|
|
109
124
|
const filterPrivateMethods: TableFilterPrivateMethods = {
|
|
110
125
|
checkFilterOptions () {
|
|
@@ -121,15 +136,14 @@ hooks.add('tableFilterModule', {
|
|
|
121
136
|
if (filterStore.column === column && filterStore.visible) {
|
|
122
137
|
filterStore.visible = false
|
|
123
138
|
} else {
|
|
124
|
-
const currEl = btnEl || colEl
|
|
125
139
|
$xeTable.handleFilterOptions(column)
|
|
126
140
|
internalData._currFilterParams = params
|
|
127
|
-
filterStore.targetEl =
|
|
141
|
+
filterStore.targetEl = btnEl
|
|
128
142
|
filterStore.style = null
|
|
129
143
|
filterStore.visible = true
|
|
130
144
|
initStore.filter = true
|
|
131
145
|
}
|
|
132
|
-
nextTick(() => {
|
|
146
|
+
nextTick().then(() => {
|
|
133
147
|
updatePopupStyle()
|
|
134
148
|
})
|
|
135
149
|
$xeTable.dispatchEvent('filter-visible', { column, field: column.field, property: column.field, filterList: $xeTable.getCheckedFilters(), visible: filterStore.visible }, evnt)
|
|
@@ -414,11 +414,10 @@ hooks.add('tableKeyboardModule', {
|
|
|
414
414
|
},
|
|
415
415
|
// 处理当前列方向键移动
|
|
416
416
|
moveCurrentColumn (isLeftArrow, isRightArrow, evnt) {
|
|
417
|
-
const {
|
|
418
|
-
const { visibleColumn } = internalData
|
|
417
|
+
const { currentCol, visibleColumn } = internalData
|
|
419
418
|
let targetCol: VxeTableDefines.ColumnInfo | null = null
|
|
420
|
-
if (
|
|
421
|
-
const _columnIndex = $xeTable.getVTColumnIndex(
|
|
419
|
+
if (currentCol) {
|
|
420
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentCol)
|
|
422
421
|
if (isLeftArrow && _columnIndex > 0) {
|
|
423
422
|
targetCol = visibleColumn[_columnIndex - 1]
|
|
424
423
|
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
@@ -122,8 +122,8 @@ export default defineVxeComponent({
|
|
|
122
122
|
const $xeGantt = $xeTable.xeGantt
|
|
123
123
|
|
|
124
124
|
const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, treeConfig, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
|
|
125
|
-
const { tableData, tableColumn, dragRow, overflowX, overflowY,
|
|
126
|
-
const { fullAllDataRowIdData, fullColumnIdData, mergeBodyCellMaps, visibleColumn, afterFullData, mergeBodyList, scrollXStore, scrollYStore, keepUpdateFieldMaps } = tableInternalData
|
|
125
|
+
const { tableData, tableColumn, dragRow, overflowX, overflowY, scrollXLoad, scrollYLoad, mergeBodyFlag, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, editStore, isAllOverflow, validErrorMaps, currColFlag } = tableReactData
|
|
126
|
+
const { fullAllDataRowIdData, fullColumnIdData, mergeBodyCellMaps, visibleColumn, afterFullData, mergeBodyList, scrollXStore, scrollYStore, keepUpdateFieldMaps, currentCol } = tableInternalData
|
|
127
127
|
const cellOpts = computeCellOpts.value
|
|
128
128
|
const validOpts = computeValidOpts.value
|
|
129
129
|
const checkboxOpts = computeCheckboxOpts.value
|
|
@@ -491,7 +491,7 @@ export default defineVxeComponent({
|
|
|
491
491
|
'col--active': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
|
|
492
492
|
'col--valid-error': !!errorValidItem,
|
|
493
493
|
'show--valid-bg': errorValidItem && validOpts.showErrorBackground,
|
|
494
|
-
'col--current':
|
|
494
|
+
'col--current': currColFlag && currentCol === column
|
|
495
495
|
},
|
|
496
496
|
getPropClass(compCellClassName, cellParams),
|
|
497
497
|
getPropClass(className, cellParams),
|
|
@@ -52,8 +52,8 @@ export default defineVxeComponent({
|
|
|
52
52
|
|
|
53
53
|
const { fixedType } = props
|
|
54
54
|
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
55
|
-
const { scrollXLoad, scrollYLoad, overflowX,
|
|
56
|
-
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData
|
|
55
|
+
const { scrollXLoad, scrollYLoad, overflowX, mergeFootFlag, currColFlag } = tableReactData
|
|
56
|
+
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore, currentCol } = tableInternalData
|
|
57
57
|
const virtualXOpts = computeVirtualXOpts.value
|
|
58
58
|
const footerTooltipOpts = computeFooterTooltipOpts.value
|
|
59
59
|
const resizableOpts = computeResizableOpts.value
|
|
@@ -195,7 +195,7 @@ export default defineVxeComponent({
|
|
|
195
195
|
'is--pg-left': isCellPaddingLeft,
|
|
196
196
|
'is--pg-right': isCellPaddingRight,
|
|
197
197
|
'col--ellipsis': hasEllipsis,
|
|
198
|
-
'col--current':
|
|
198
|
+
'col--current': currColFlag && currentCol === column
|
|
199
199
|
}, getPropClass(footerClassName, cellParams), getPropClass(footerCellClassName, cellParams)],
|
|
200
200
|
...attrs,
|
|
201
201
|
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
@@ -64,8 +64,8 @@ export default defineVxeComponent({
|
|
|
64
64
|
|
|
65
65
|
const { fixedType } = props
|
|
66
66
|
const { resizable: allResizable, columnKey, showCustomHeader, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
|
|
67
|
-
const {
|
|
68
|
-
const { fullColumnIdData, scrollXStore, mergeHeaderList, mergeHeaderCellMaps } = tableInternalData
|
|
67
|
+
const { dragCol, scrollXLoad, scrollYLoad, overflowX, mergeHeadFlag, tableColumn, currColFlag } = tableReactData
|
|
68
|
+
const { fullColumnIdData, scrollXStore, mergeHeaderList, mergeHeaderCellMaps, currentCol } = tableInternalData
|
|
69
69
|
const virtualXOpts = computeVirtualXOpts.value
|
|
70
70
|
const columnOpts = computeColumnOpts.value
|
|
71
71
|
const columnDragOpts = computeColumnDragOpts.value
|
|
@@ -226,7 +226,7 @@ export default defineVxeComponent({
|
|
|
226
226
|
'is--filter-active': hasFilter,
|
|
227
227
|
'is--drag-active': columnOpts.drag && !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
|
|
228
228
|
'is--drag-disabled': columnOpts.drag && isDisabledDrag,
|
|
229
|
-
'col--current':
|
|
229
|
+
'col--current': currColFlag && currentCol === column
|
|
230
230
|
},
|
|
231
231
|
headerClassName ? (XEUtils.isFunction(headerClassName) ? headerClassName(cellParams) : headerClassName) : '',
|
|
232
232
|
headerCellClassName ? (XEUtils.isFunction(headerCellClassName) ? headerCellClassName(cellParams) : headerCellClassName) : ''
|
|
@@ -271,8 +271,8 @@ export default defineVxeComponent({
|
|
|
271
271
|
|
|
272
272
|
const { fixedType } = props
|
|
273
273
|
const { showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign } = tableProps
|
|
274
|
-
const {
|
|
275
|
-
const { fullColumnIdData } = tableInternalData
|
|
274
|
+
const { overflowX, currColFlag } = tableReactData
|
|
275
|
+
const { fullColumnIdData, currentCol } = tableInternalData
|
|
276
276
|
const headerTooltipOpts = computeHeaderTooltipOpts.value
|
|
277
277
|
const cellOpts = computeCellOpts.value
|
|
278
278
|
const defaultRowHeight = computeDefaultRowHeight.value
|
|
@@ -347,7 +347,7 @@ export default defineVxeComponent({
|
|
|
347
347
|
'fixed--width': !isAutoCellWidth,
|
|
348
348
|
'is--padding': isPadding,
|
|
349
349
|
'is--sortable': column.sortable,
|
|
350
|
-
'col--current':
|
|
350
|
+
'col--current': currColFlag && currentCol === column
|
|
351
351
|
}
|
|
352
352
|
],
|
|
353
353
|
key: colid,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTick, Teleport, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
|
-
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement,
|
|
4
|
+
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom'
|
|
5
5
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
7
|
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util'
|
|
@@ -362,11 +362,19 @@ export default defineVxeComponent({
|
|
|
362
362
|
})
|
|
363
363
|
|
|
364
364
|
const computeHeaderTooltipOpts = computed(() => {
|
|
365
|
-
|
|
365
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
366
|
+
return Object.assign({}, getConfig().tooltip, {
|
|
367
|
+
enterable: tooltipOpts.enterable,
|
|
368
|
+
defaultPlacement: tooltipOpts.defaultPlacement
|
|
369
|
+
}, getConfig().table.headerTooltipConfig, props.headerTooltipConfig)
|
|
366
370
|
})
|
|
367
371
|
|
|
368
372
|
const computeFooterTooltipOpts = computed(() => {
|
|
369
|
-
|
|
373
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
374
|
+
return Object.assign({}, getConfig().tooltip, {
|
|
375
|
+
enterable: tooltipOpts.enterable,
|
|
376
|
+
defaultPlacement: tooltipOpts.defaultPlacement
|
|
377
|
+
}, getConfig().table.footerTooltipConfig, props.footerTooltipConfig)
|
|
370
378
|
})
|
|
371
379
|
|
|
372
380
|
const computeTableTipConfig = computed(() => {
|
|
@@ -6927,7 +6935,7 @@ export default defineVxeComponent({
|
|
|
6927
6935
|
},
|
|
6928
6936
|
getCurrentColumn () {
|
|
6929
6937
|
const columnOpts = computeColumnOpts.value
|
|
6930
|
-
return columnOpts.isCurrent || props.highlightCurrentColumn ?
|
|
6938
|
+
return columnOpts.isCurrent || props.highlightCurrentColumn ? internalData.currentCol : null
|
|
6931
6939
|
},
|
|
6932
6940
|
/**
|
|
6933
6941
|
* 用于当前列,设置某列行为高亮状态
|
|
@@ -6939,7 +6947,8 @@ export default defineVxeComponent({
|
|
|
6939
6947
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
6940
6948
|
if (column) {
|
|
6941
6949
|
$xeTable.clearCurrentColumn()
|
|
6942
|
-
|
|
6950
|
+
internalData.currentCol = column
|
|
6951
|
+
reactData.currColFlag++ // 刷新当前列状态
|
|
6943
6952
|
}
|
|
6944
6953
|
return nextTick().then(() => {
|
|
6945
6954
|
// 更新状选中态
|
|
@@ -6952,7 +6961,8 @@ export default defineVxeComponent({
|
|
|
6952
6961
|
* 用于当前列,手动清空当前高亮的状态
|
|
6953
6962
|
*/
|
|
6954
6963
|
clearCurrentColumn () {
|
|
6955
|
-
|
|
6964
|
+
internalData.currentCol = null
|
|
6965
|
+
reactData.currColFlag++ // 刷新当前列状态
|
|
6956
6966
|
return nextTick()
|
|
6957
6967
|
},
|
|
6958
6968
|
setPendingRow (rows: any | any[], status: boolean) {
|
|
@@ -8597,8 +8607,7 @@ export default defineVxeComponent({
|
|
|
8597
8607
|
|
|
8598
8608
|
const handleGlobalScrollEvent = (evnt: MouseEvent) => {
|
|
8599
8609
|
const { filterStore } = reactData
|
|
8600
|
-
|
|
8601
|
-
if (filterStore.visible && filterOpts.transfer) {
|
|
8610
|
+
if (filterStore.visible) {
|
|
8602
8611
|
$xeTable.handleFilterStyle()
|
|
8603
8612
|
}
|
|
8604
8613
|
reUpdateCustomStyleEvent(evnt)
|
|
@@ -9016,7 +9025,7 @@ export default defineVxeComponent({
|
|
|
9016
9025
|
.then(() => $xeTable.scrollToRow(parentRow))
|
|
9017
9026
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
9018
9027
|
}
|
|
9019
|
-
} else if (keyboardConfig && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !
|
|
9028
|
+
} else if (keyboardConfig && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
|
|
9020
9029
|
if (evnt.target) {
|
|
9021
9030
|
if (isY || (hasShiftKey && isZ)) {
|
|
9022
9031
|
// 恢复被撤销的操作:Ctrl + Y 或 Ctrl + Shift + Z
|
|
@@ -9123,6 +9132,10 @@ export default defineVxeComponent({
|
|
|
9123
9132
|
}
|
|
9124
9133
|
|
|
9125
9134
|
const handleGlobalResizeEvent = () => {
|
|
9135
|
+
const { filterStore } = reactData
|
|
9136
|
+
if (filterStore.visible) {
|
|
9137
|
+
$xeTable.handleFilterStyle()
|
|
9138
|
+
}
|
|
9126
9139
|
if ($xeTable.closeMenu) {
|
|
9127
9140
|
$xeTable.closeMenu()
|
|
9128
9141
|
}
|
|
@@ -11310,7 +11323,7 @@ export default defineVxeComponent({
|
|
|
11310
11323
|
}
|
|
11311
11324
|
},
|
|
11312
11325
|
triggerCurrentColumnEvent (evnt, params) {
|
|
11313
|
-
const {
|
|
11326
|
+
const { currentCol: oldValue } = internalData
|
|
11314
11327
|
const columnOpts = computeColumnOpts.value
|
|
11315
11328
|
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
11316
11329
|
const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod as any
|
|
@@ -13540,9 +13553,9 @@ export default defineVxeComponent({
|
|
|
13540
13553
|
},
|
|
13541
13554
|
setHoverRow (row) {
|
|
13542
13555
|
const $xeGanttView = internalData.xeGanttView
|
|
13556
|
+
$xeTable.clearHoverRow()
|
|
13543
13557
|
const rowid = getRowid($xeTable, row)
|
|
13544
13558
|
const el = refElem.value
|
|
13545
|
-
$xeTable.clearHoverRow()
|
|
13546
13559
|
if (el) {
|
|
13547
13560
|
XEUtils.arrayEach(el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`), elem => addClass(elem, 'row--hover'))
|
|
13548
13561
|
}
|
|
@@ -39,8 +39,14 @@ export function createInternalData (): TableInternalData {
|
|
|
39
39
|
customHeight: 0,
|
|
40
40
|
customMinHeight: 0,
|
|
41
41
|
customMaxHeight: 0,
|
|
42
|
+
|
|
42
43
|
// 当前 hover 行
|
|
43
44
|
hoverRow: null,
|
|
45
|
+
hoverCol: null,
|
|
46
|
+
// 当前行
|
|
47
|
+
currentRow: null,
|
|
48
|
+
currentCol: null,
|
|
49
|
+
|
|
44
50
|
// 最后滚动位置
|
|
45
51
|
lastScrollLeft: 0,
|
|
46
52
|
lastScrollTop: 0,
|
|
@@ -94,9 +100,6 @@ export function createInternalData (): TableInternalData {
|
|
|
94
100
|
|
|
95
101
|
fullCellStoreMaps: {},
|
|
96
102
|
|
|
97
|
-
// 当前行
|
|
98
|
-
currentRow: null,
|
|
99
|
-
|
|
100
103
|
// 合并表头单元格的数据
|
|
101
104
|
mergeHeaderList: [],
|
|
102
105
|
mergeHeaderMaps: {},
|
|
@@ -207,8 +210,6 @@ export function createReactData (): TableReactData {
|
|
|
207
210
|
isAllSelected: false,
|
|
208
211
|
// 复选框属性,有选中且非全选状态
|
|
209
212
|
isIndeterminate: false,
|
|
210
|
-
// 单选框属性,选中列
|
|
211
|
-
currentColumn: null,
|
|
212
213
|
// 单选框属性,选中行
|
|
213
214
|
selectRadioRow: null,
|
|
214
215
|
// 表尾合计数据
|
|
@@ -428,7 +429,9 @@ export function createReactData (): TableReactData {
|
|
|
428
429
|
|
|
429
430
|
isDragResize: false,
|
|
430
431
|
isRowLoading: false,
|
|
431
|
-
isColLoading: false
|
|
432
|
+
isColLoading: false,
|
|
433
|
+
|
|
434
|
+
currColFlag: 1
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
|
package/packages/ui/src/dom.ts
CHANGED
|
@@ -201,6 +201,20 @@ export function hasEventInputTarget (target: EventTarget | Element | null) {
|
|
|
201
201
|
return tagName && ['input', 'textarea'].includes((tagName.toLowerCase()))
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
/**
|
|
205
|
+
* 判断是否由内部可复用控件触发,输入框带有 vxe-reusekeep-control
|
|
206
|
+
*/
|
|
207
|
+
function hasReusekeepControl (elem: EventTarget | HTMLElement | null) {
|
|
208
|
+
if (elem) {
|
|
209
|
+
return hasClass(elem as HTMLElement, 'vxe-reusekeep-control')
|
|
210
|
+
}
|
|
211
|
+
return false
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function hasAxternalInputTarget (target: EventTarget | Element | null) {
|
|
215
|
+
return hasEventInputTarget(target) ? !hasReusekeepControl(target) : false
|
|
216
|
+
}
|
|
217
|
+
|
|
204
218
|
const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
|
|
205
219
|
const scrollIntoView = 'scrollIntoView'
|
|
206
220
|
|
|
@@ -269,6 +283,168 @@ export function wheelScrollTopTo (diffNum: number, cb: (progress: number) => voi
|
|
|
269
283
|
})
|
|
270
284
|
}
|
|
271
285
|
|
|
286
|
+
interface PanelPlacementOptions {
|
|
287
|
+
defaultTop?: number
|
|
288
|
+
defaultLeft?: number
|
|
289
|
+
placement?: '' | 'top' | 'bottom' | null
|
|
290
|
+
defaultPlacement?: '' | 'top' | 'bottom' | null
|
|
291
|
+
teleportTo?: boolean
|
|
292
|
+
marginSize?: number
|
|
293
|
+
isMinWidth?: boolean
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* 通用定位计算
|
|
298
|
+
*/
|
|
299
|
+
export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: PanelPlacementOptions) {
|
|
300
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
301
|
+
teleportTo: false,
|
|
302
|
+
marginSize: 18,
|
|
303
|
+
isMinWidth: true
|
|
304
|
+
}, options)
|
|
305
|
+
let panelPlacement: 'top' | 'bottom' = 'bottom'
|
|
306
|
+
let top: number | '' = ''
|
|
307
|
+
let bottom: number | '' = ''
|
|
308
|
+
let left = 0
|
|
309
|
+
let minWidth: number | '' = ''
|
|
310
|
+
let arrowLeft: number | '' = ''
|
|
311
|
+
const stys: Record<string, string> = {}
|
|
312
|
+
if (panelElem && targetElem) {
|
|
313
|
+
const bodyEl = document.body
|
|
314
|
+
const parentWrapperEl = getPopupWrapperElement(panelElem)
|
|
315
|
+
if (parentWrapperEl) {
|
|
316
|
+
const targetWidth = targetElem.offsetWidth
|
|
317
|
+
const targetHeight = targetElem.offsetHeight
|
|
318
|
+
const panelWidth = panelElem.offsetWidth
|
|
319
|
+
const panelHeight = panelElem.offsetHeight
|
|
320
|
+
|
|
321
|
+
const parentWrapperRect = parentWrapperEl.getBoundingClientRect()
|
|
322
|
+
const panelRect = panelElem.getBoundingClientRect()
|
|
323
|
+
const targetRect = targetElem.getBoundingClientRect()
|
|
324
|
+
const visibleHeight = bodyEl.clientHeight
|
|
325
|
+
const visibleWidth = bodyEl.clientWidth
|
|
326
|
+
|
|
327
|
+
const offsetLeft = parentWrapperRect.left
|
|
328
|
+
const offsetTop = parentWrapperRect.top
|
|
329
|
+
const targetLeft = targetRect.left
|
|
330
|
+
const targetTop = targetRect.top
|
|
331
|
+
|
|
332
|
+
minWidth = targetElem.offsetWidth
|
|
333
|
+
|
|
334
|
+
if (teleportTo) {
|
|
335
|
+
left = defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)
|
|
336
|
+
top = defaultTop || (targetTop + targetHeight)
|
|
337
|
+
if (placement === 'top') {
|
|
338
|
+
panelPlacement = 'top'
|
|
339
|
+
top = targetTop - panelHeight
|
|
340
|
+
} else if (!placement) {
|
|
341
|
+
if (defaultPlacement === 'top') {
|
|
342
|
+
panelPlacement = 'top'
|
|
343
|
+
if (!defaultTop) {
|
|
344
|
+
top = targetTop - panelHeight
|
|
345
|
+
}
|
|
346
|
+
// 如果上面不够放,则向下
|
|
347
|
+
if (top < marginSize) {
|
|
348
|
+
panelPlacement = 'bottom'
|
|
349
|
+
top = targetTop + targetHeight
|
|
350
|
+
}
|
|
351
|
+
// 如果下面不够放,则向上(优先)
|
|
352
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
353
|
+
panelPlacement = 'top'
|
|
354
|
+
top = targetTop - panelHeight
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
// 如果下面不够放,则向上
|
|
358
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
359
|
+
panelPlacement = 'top'
|
|
360
|
+
top = targetTop - panelHeight
|
|
361
|
+
}
|
|
362
|
+
// 如果上面不够放,则向下(优先)
|
|
363
|
+
if (top < marginSize) {
|
|
364
|
+
panelPlacement = 'bottom'
|
|
365
|
+
top = targetTop + targetHeight
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// 如果溢出右边
|
|
370
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
371
|
+
left -= left + panelWidth + marginSize - visibleWidth
|
|
372
|
+
}
|
|
373
|
+
// 如果溢出左边
|
|
374
|
+
if (left < marginSize) {
|
|
375
|
+
left = marginSize
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// 偏移
|
|
379
|
+
top -= offsetTop
|
|
380
|
+
left -= offsetLeft
|
|
381
|
+
} else {
|
|
382
|
+
if (placement === 'top') {
|
|
383
|
+
panelPlacement = 'top'
|
|
384
|
+
bottom = targetHeight
|
|
385
|
+
} else if (!placement) {
|
|
386
|
+
// 如果下面不够放,则向上
|
|
387
|
+
top = targetHeight
|
|
388
|
+
if (targetTop + targetHeight + panelHeight + marginSize > visibleHeight) {
|
|
389
|
+
// 如果上面不够放,则向下(优先)
|
|
390
|
+
if (targetTop - targetHeight - panelHeight > marginSize) {
|
|
391
|
+
panelPlacement = 'top'
|
|
392
|
+
top = ''
|
|
393
|
+
bottom = targetHeight
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
// 是否超出右侧
|
|
398
|
+
if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
|
|
399
|
+
left = -(panelRect.left + panelRect.width + marginSize - visibleWidth)
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (XEUtils.isNumber(top)) {
|
|
403
|
+
stys.top = toCssUnit(top)
|
|
404
|
+
}
|
|
405
|
+
if (XEUtils.isNumber(bottom)) {
|
|
406
|
+
stys.bottom = toCssUnit(bottom)
|
|
407
|
+
}
|
|
408
|
+
if (XEUtils.isNumber(left)) {
|
|
409
|
+
stys.left = toCssUnit(left)
|
|
410
|
+
}
|
|
411
|
+
if (isMinWidth && XEUtils.isNumber(minWidth)) {
|
|
412
|
+
stys.minWidth = toCssUnit(minWidth)
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// 箭头
|
|
416
|
+
if (left === targetLeft) {
|
|
417
|
+
if (targetWidth <= panelWidth) {
|
|
418
|
+
arrowLeft = targetWidth / 2
|
|
419
|
+
}
|
|
420
|
+
} else if (left < targetLeft) {
|
|
421
|
+
if (left + panelWidth > targetLeft + targetWidth) {
|
|
422
|
+
arrowLeft = (targetLeft - left) + targetWidth / 2
|
|
423
|
+
} else {
|
|
424
|
+
arrowLeft = (targetLeft - left) + (panelWidth - (targetLeft - left)) / 2
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
top: top || 0,
|
|
431
|
+
bottom: bottom || 0,
|
|
432
|
+
left: left || 0,
|
|
433
|
+
arrowLeft: arrowLeft || 0,
|
|
434
|
+
style: stys,
|
|
435
|
+
placement: panelPlacement
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export function getPopupWrapperElement (panelElem: HTMLElement | null | undefined) {
|
|
440
|
+
if (!panelElem) {
|
|
441
|
+
return null
|
|
442
|
+
}
|
|
443
|
+
const bodyEl = document.body
|
|
444
|
+
const parentEl = panelElem.parentElement
|
|
445
|
+
return (parentEl === bodyEl ? document.documentElement : parentEl) || null
|
|
446
|
+
}
|
|
447
|
+
|
|
272
448
|
export function getPopupContainer (appendTo: string | HTMLElement | ((params: any) => string | HTMLElement) | undefined) {
|
|
273
449
|
const selectElem = appendTo && XEUtils.isFunction(appendTo) ? appendTo({}) : appendTo
|
|
274
450
|
return selectElem || 'body'
|
package/styles/theme/base.scss
CHANGED
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
--vxe-ui-vxe-table-custom-column-header-align-width: var(--vxe-ui-vxe-table-custom-column-align-width);
|
|
107
107
|
--vxe-ui-vxe-table-custom-column-footer-align-width: var(--vxe-ui-vxe-table-custom-column-align-width);
|
|
108
108
|
|
|
109
|
+
--vxe-ui-vxe-table-filter-default-max-height: 260px;
|
|
110
|
+
|
|
109
111
|
/*toolbar*/
|
|
110
112
|
--vxe-ui-toolbar-custom-active-background-color: #D9DADB;
|
|
111
113
|
--vxe-ui-toolbar-height-xlarge: 54px;
|