vxe-table 3.12.0-beta.9 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/locale/lang/de-DE.js +490 -490
- package/es/locale/lang/en-US.js +438 -438
- package/es/locale/lang/it-IT.js +692 -0
- package/es/locale/lang/ru-RU.js +36 -36
- package/es/locale/lang/th-TH.js +692 -0
- package/es/locale/lang/zh-CHT.js +19 -19
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +5 -5
- package/es/table/module/export/mixin.js +208 -140
- package/es/table/src/cell.js +88 -61
- package/es/table/src/column.js +2 -2
- package/es/table/src/group.js +2 -2
- package/es/table/src/methods.js +112 -87
- package/es/table/src/table.js +7 -11
- package/es/toolbar/src/toolbar.js +22 -4
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +3 -0
- package/lib/index.umd.js +512 -356
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/de-DE.js +490 -490
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +438 -438
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +438 -438
- package/lib/locale/lang/it-IT.js +698 -0
- package/lib/locale/lang/it-IT.min.js +1 -0
- package/lib/locale/lang/ru-RU.js +36 -36
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +36 -36
- package/lib/locale/lang/th-TH.js +698 -0
- package/lib/locale/lang/th-TH.min.js +1 -0
- package/lib/locale/lang/zh-CHT.js +19 -19
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +19 -19
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +5 -5
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +239 -167
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/cell.js +109 -83
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +112 -87
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +4 -9
- package/lib/table/src/table.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +36 -2
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +2 -2
- 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 +3 -0
- package/lib/ui/src/vn.min.js +1 -1
- package/package.json +3 -3
- package/packages/locale/lang/de-DE.ts +492 -491
- package/packages/locale/lang/en-US.ts +438 -438
- package/packages/locale/lang/it-IT.ts +692 -0
- package/packages/locale/lang/ru-RU.ts +36 -36
- package/packages/locale/lang/th-TH.ts +692 -0
- package/packages/locale/lang/zh-CHT.ts +19 -19
- package/packages/table/module/custom/panel.ts +5 -5
- package/packages/table/module/export/mixin.ts +227 -156
- package/packages/table/src/cell.ts +141 -108
- package/packages/table/src/methods.ts +136 -105
- package/packages/table/src/table.ts +8 -12
- package/packages/toolbar/src/toolbar.ts +26 -8
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/vn.ts +4 -1
- /package/es/{iconfont.1735301172726.ttf → iconfont.1735661059384.ttf} +0 -0
- /package/es/{iconfont.1735301172726.woff → iconfont.1735661059384.woff} +0 -0
- /package/es/{iconfont.1735301172726.woff2 → iconfont.1735661059384.woff2} +0 -0
- /package/lib/{iconfont.1735301172726.ttf → iconfont.1735661059384.ttf} +0 -0
- /package/lib/{iconfont.1735301172726.woff → iconfont.1735661059384.woff} +0 -0
- /package/lib/{iconfont.1735301172726.woff2 → iconfont.1735661059384.woff2} +0 -0
|
@@ -108,32 +108,28 @@ function handleVirtualXVisible ($xeTable: any) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const computeRowHeight = ($xeTable: any) => {
|
|
111
|
-
const props = $xeTable
|
|
112
|
-
|
|
113
|
-
const { showOverflow } = props
|
|
114
111
|
const tableHeader = $xeTable.$refs.tableHeader
|
|
115
112
|
const tableBody = $xeTable.$refs.tableBody
|
|
116
113
|
const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
117
114
|
const vSize = $xeTable.computeSize
|
|
118
115
|
const rowHeightMaps = $xeTable.computeRowHeightMaps
|
|
119
|
-
let rowHeight =
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
firstTrElem = tableHeaderElem.querySelector('tr')
|
|
127
|
-
}
|
|
128
|
-
if (firstTrElem) {
|
|
129
|
-
rowHeight = firstTrElem.clientHeight
|
|
130
|
-
}
|
|
131
|
-
if (!rowHeight) {
|
|
132
|
-
rowHeight = rowHeightMaps[vSize || 'default']
|
|
133
|
-
}
|
|
116
|
+
let rowHeight = 0
|
|
117
|
+
if (tableBodyElem) {
|
|
118
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
119
|
+
let firstTrElem
|
|
120
|
+
firstTrElem = tableBodyElem.querySelector('tr')
|
|
121
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
122
|
+
firstTrElem = tableHeaderElem.querySelector('tr')
|
|
134
123
|
}
|
|
124
|
+
if (firstTrElem) {
|
|
125
|
+
rowHeight = firstTrElem.clientHeight
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (!rowHeight) {
|
|
129
|
+
rowHeight = rowHeightMaps[vSize || 'default']
|
|
135
130
|
}
|
|
136
|
-
|
|
131
|
+
// 最低支持 18px 行高
|
|
132
|
+
return Math.max(18, rowHeight)
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
function handleVirtualYVisible ($xeTable: any) {
|
|
@@ -560,7 +556,10 @@ const handleScrollToRowColumn = ($xeTable: any, fieldOrColumn: string | VxeTable
|
|
|
560
556
|
}
|
|
561
557
|
|
|
562
558
|
function handleRecalculateLayout ($xeTable: any, reFull: boolean) {
|
|
559
|
+
const internalData = $xeTable
|
|
560
|
+
|
|
563
561
|
const el = $xeTable.$refs.refElem
|
|
562
|
+
internalData.reRunTime = Date.now()
|
|
564
563
|
if (!el || !el.clientWidth) {
|
|
565
564
|
return $xeTable.$nextTick()
|
|
566
565
|
}
|
|
@@ -1000,7 +999,7 @@ const Methods = {
|
|
|
1000
999
|
const isLazy = treeConfig && treeOpts.lazy
|
|
1001
1000
|
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
1002
1001
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
1003
|
-
const handleCache = (row: any, index: any, items: any, path: any,
|
|
1002
|
+
const handleCache = (row: any, index: any, items: any, path: any, parentRow: any, nodes: any) => {
|
|
1004
1003
|
let rowid = getRowid(this, row)
|
|
1005
1004
|
const seq = treeConfig && path ? toTreePathSeq(path) : index + 1
|
|
1006
1005
|
const level = nodes ? nodes.length - 1 : 0
|
|
@@ -1013,13 +1012,13 @@ const Methods = {
|
|
|
1013
1012
|
}
|
|
1014
1013
|
let cacheItem = fullAllDataRowIdData[rowid]
|
|
1015
1014
|
if (!cacheItem) {
|
|
1016
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 }
|
|
1015
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0 }
|
|
1017
1016
|
}
|
|
1018
1017
|
cacheItem.row = row
|
|
1019
1018
|
cacheItem.items = items
|
|
1020
|
-
cacheItem.parent =
|
|
1019
|
+
cacheItem.parent = parentRow
|
|
1021
1020
|
cacheItem.level = level
|
|
1022
|
-
cacheItem.index = treeConfig &&
|
|
1021
|
+
cacheItem.index = treeConfig && parentRow ? -1 : index
|
|
1023
1022
|
if (isSource) {
|
|
1024
1023
|
fullDataRowIdMaps[rowid] = cacheItem
|
|
1025
1024
|
}
|
|
@@ -1083,9 +1082,9 @@ const Methods = {
|
|
|
1083
1082
|
sourceDataRowIdData[rowid] = XEUtils.clone(childRow, true)
|
|
1084
1083
|
})
|
|
1085
1084
|
}
|
|
1086
|
-
XEUtils.eachTree(rows, (childRow, index, items, path,
|
|
1085
|
+
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
1087
1086
|
const rowid = getRowid($xeTable, childRow)
|
|
1088
|
-
const parentRow =
|
|
1087
|
+
const parentRow = parentItem || parentRest.row
|
|
1089
1088
|
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0 }
|
|
1090
1089
|
fullDataRowIdData[rowid] = rest
|
|
1091
1090
|
fullAllDataRowIdData[rowid] = rest
|
|
@@ -1124,9 +1123,9 @@ const Methods = {
|
|
|
1124
1123
|
let radioColumn: VxeTableDefines.ColumnInfo | undefined
|
|
1125
1124
|
let htmlColumn: VxeTableDefines.ColumnInfo | undefined
|
|
1126
1125
|
let hasFixed: VxeColumnPropTypes.Fixed | undefined
|
|
1127
|
-
const handleFunc = (column: VxeTableDefines.ColumnInfo, index: number, items: VxeTableDefines.ColumnInfo[], path?: string[],
|
|
1126
|
+
const handleFunc = (column: VxeTableDefines.ColumnInfo, index: number, items: VxeTableDefines.ColumnInfo[], path?: string[], parentColumn?: VxeTableDefines.ColumnInfo) => {
|
|
1128
1127
|
const { id: colid, field, fixed, type, treeNode } = column
|
|
1129
|
-
const rest = { $index: -1, _index: -1, column, colid, index, items, parent:
|
|
1128
|
+
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0 }
|
|
1130
1129
|
if (field) {
|
|
1131
1130
|
if (fullColumnFieldData[field]) {
|
|
1132
1131
|
errLog('vxe.error.colRepet', ['field', field])
|
|
@@ -1189,9 +1188,9 @@ const Methods = {
|
|
|
1189
1188
|
}
|
|
1190
1189
|
|
|
1191
1190
|
if (isGroup) {
|
|
1192
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path,
|
|
1191
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
|
|
1193
1192
|
column.level = nodes.length
|
|
1194
|
-
handleFunc(column, index, items, path,
|
|
1193
|
+
handleFunc(column, index, items, path, parentColumn)
|
|
1195
1194
|
})
|
|
1196
1195
|
} else {
|
|
1197
1196
|
tableFullColumn.forEach(handleFunc)
|
|
@@ -1779,10 +1778,10 @@ const Methods = {
|
|
|
1779
1778
|
if (treeConfig && treeOpts.transform) {
|
|
1780
1779
|
const fullData: any[] = []
|
|
1781
1780
|
const expandMaps: any = {}
|
|
1782
|
-
XEUtils.eachTree(afterTreeFullData, (row, index, items, path,
|
|
1781
|
+
XEUtils.eachTree(afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
1783
1782
|
const rowid = getRowid(this, row)
|
|
1784
|
-
const parentRowid = getRowid(this,
|
|
1785
|
-
if (!
|
|
1783
|
+
const parentRowid = getRowid(this, parentRow)
|
|
1784
|
+
if (!parentRow || (expandMaps[parentRowid] && treeExpandedMaps[parentRowid])) {
|
|
1786
1785
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
1787
1786
|
if (rowRest) {
|
|
1788
1787
|
rowRest._index = fullData.length
|
|
@@ -2316,11 +2315,11 @@ const Methods = {
|
|
|
2316
2315
|
let hasCustomSort = false
|
|
2317
2316
|
// 处理还原
|
|
2318
2317
|
if (resizableData || sortData || visibleData || fixedData) {
|
|
2319
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path,
|
|
2318
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentRow) => {
|
|
2320
2319
|
const colKey = column.getKey()
|
|
2321
2320
|
// 支持一级
|
|
2322
|
-
if (!
|
|
2323
|
-
if (fixedData && fixedData[colKey]) {
|
|
2321
|
+
if (!parentRow) {
|
|
2322
|
+
if (fixedData && fixedData[colKey] !== undefined) {
|
|
2324
2323
|
column.fixed = fixedData[colKey]
|
|
2325
2324
|
}
|
|
2326
2325
|
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
@@ -2399,9 +2398,9 @@ const Methods = {
|
|
|
2399
2398
|
let hasSort = 0
|
|
2400
2399
|
let hasFixedt = 0
|
|
2401
2400
|
let hasVisible = 0
|
|
2402
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path,
|
|
2401
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
2403
2402
|
// 只支持一级
|
|
2404
|
-
if (!
|
|
2403
|
+
if (!parentColumn) {
|
|
2405
2404
|
collectColumn.forEach((column: any) => {
|
|
2406
2405
|
const colKey = column.getKey()
|
|
2407
2406
|
if (colKey) {
|
|
@@ -2409,7 +2408,7 @@ const Methods = {
|
|
|
2409
2408
|
sortData[colKey] = column.renderSortNumber
|
|
2410
2409
|
}
|
|
2411
2410
|
})
|
|
2412
|
-
if (column.fixed
|
|
2411
|
+
if (column.fixed !== column.defaultFixed) {
|
|
2413
2412
|
const colKey = column.getKey()
|
|
2414
2413
|
if (colKey) {
|
|
2415
2414
|
hasFixedt = 1
|
|
@@ -2532,13 +2531,13 @@ const Methods = {
|
|
|
2532
2531
|
const leftGroupList: any[] = []
|
|
2533
2532
|
const centerGroupList: any[] = []
|
|
2534
2533
|
const rightGroupList: any[] = []
|
|
2535
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path,
|
|
2534
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
2536
2535
|
const isColGroup = hasChildrenList(column)
|
|
2537
2536
|
// 如果是分组,必须按组设置固定列,不允许给子列设置固定
|
|
2538
|
-
if (
|
|
2539
|
-
column.fixed =
|
|
2537
|
+
if (parentColumn && parentColumn.fixed) {
|
|
2538
|
+
column.fixed = parentColumn.fixed
|
|
2540
2539
|
}
|
|
2541
|
-
if (
|
|
2540
|
+
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
2542
2541
|
errLog('vxe.error.groupFixed')
|
|
2543
2542
|
}
|
|
2544
2543
|
if (isColGroup) {
|
|
@@ -2716,20 +2715,28 @@ const Methods = {
|
|
|
2716
2715
|
* 刷新布局
|
|
2717
2716
|
*/
|
|
2718
2717
|
recalculate (reFull?: boolean) {
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
const internalData = $xeTable
|
|
2718
|
+
const $xeTable = this
|
|
2719
|
+
const internalData = $xeTable
|
|
2722
2720
|
|
|
2723
|
-
|
|
2724
|
-
const
|
|
2721
|
+
return new Promise<void>(resolve => {
|
|
2722
|
+
const { rceTimeout, reRunTime } = internalData
|
|
2723
|
+
const resizeOpts = $xeTable.computeResizeOpts
|
|
2724
|
+
const refreshDelay = resizeOpts.refreshDelay || 20
|
|
2725
|
+
const el = $xeTable.$refs.refElem as HTMLElement
|
|
2725
2726
|
if (el && el.clientWidth) {
|
|
2726
2727
|
$xeTable.autoCellWidth()
|
|
2727
2728
|
}
|
|
2728
2729
|
if (rceTimeout) {
|
|
2729
2730
|
clearTimeout(rceTimeout)
|
|
2730
|
-
|
|
2731
|
-
resolve(
|
|
2732
|
-
|
|
2731
|
+
if (reRunTime && reRunTime + (refreshDelay - 5) < Date.now()) {
|
|
2732
|
+
resolve(
|
|
2733
|
+
handleRecalculateLayout($xeTable, !!reFull)
|
|
2734
|
+
)
|
|
2735
|
+
} else {
|
|
2736
|
+
$xeTable.$nextTick(() => {
|
|
2737
|
+
resolve()
|
|
2738
|
+
})
|
|
2739
|
+
}
|
|
2733
2740
|
} else {
|
|
2734
2741
|
resolve(
|
|
2735
2742
|
handleRecalculateLayout($xeTable, !!reFull)
|
|
@@ -2737,8 +2744,8 @@ const Methods = {
|
|
|
2737
2744
|
}
|
|
2738
2745
|
internalData.rceTimeout = setTimeout(() => {
|
|
2739
2746
|
internalData.rceTimeout = undefined
|
|
2740
|
-
|
|
2741
|
-
},
|
|
2747
|
+
handleRecalculateLayout($xeTable, !!reFull)
|
|
2748
|
+
}, refreshDelay)
|
|
2742
2749
|
})
|
|
2743
2750
|
},
|
|
2744
2751
|
calcCellWidth () {
|
|
@@ -4740,7 +4747,9 @@ const Methods = {
|
|
|
4740
4747
|
/**
|
|
4741
4748
|
* 单选,行选中事件
|
|
4742
4749
|
*/
|
|
4743
|
-
triggerRadioRowEvent (evnt:
|
|
4750
|
+
triggerRadioRowEvent (evnt: Event, params: {
|
|
4751
|
+
row: any
|
|
4752
|
+
}) {
|
|
4744
4753
|
const { selectRadioRow: oldValue, radioOpts } = this
|
|
4745
4754
|
const { row } = params
|
|
4746
4755
|
const { trigger } = radioOpts
|
|
@@ -4763,7 +4772,9 @@ const Methods = {
|
|
|
4763
4772
|
this.emitEvent('radio-change', { oldValue, newValue, ...params }, evnt)
|
|
4764
4773
|
}
|
|
4765
4774
|
},
|
|
4766
|
-
triggerCurrentColumnEvent (evnt:
|
|
4775
|
+
triggerCurrentColumnEvent (evnt: Event, params: {
|
|
4776
|
+
column: VxeTableDefines.ColumnInfo
|
|
4777
|
+
}) {
|
|
4767
4778
|
const $xeTable = this
|
|
4768
4779
|
|
|
4769
4780
|
const columnOpts = $xeTable.computeColumnOpts
|
|
@@ -4773,7 +4784,7 @@ const Methods = {
|
|
|
4773
4784
|
$xeTable.setCurrentColumn(column)
|
|
4774
4785
|
}
|
|
4775
4786
|
},
|
|
4776
|
-
triggerCurrentRowEvent (evnt:
|
|
4787
|
+
triggerCurrentRowEvent (evnt: Event, params: any) {
|
|
4777
4788
|
const $xeTable = this
|
|
4778
4789
|
const reactData = $xeTable
|
|
4779
4790
|
|
|
@@ -4825,7 +4836,7 @@ const Methods = {
|
|
|
4825
4836
|
}
|
|
4826
4837
|
return false
|
|
4827
4838
|
},
|
|
4828
|
-
handleCheckedRadioRow (row: any, isForce
|
|
4839
|
+
handleCheckedRadioRow (row: any, isForce?: boolean) {
|
|
4829
4840
|
const { radioOpts } = this
|
|
4830
4841
|
const { checkMethod } = radioOpts
|
|
4831
4842
|
if (row && (isForce || (!checkMethod || checkMethod({ row })))) {
|
|
@@ -4886,7 +4897,7 @@ const Methods = {
|
|
|
4886
4897
|
/**
|
|
4887
4898
|
* 用于单选行,获取当已选中的数据
|
|
4888
4899
|
*/
|
|
4889
|
-
getRadioRecord (isFull
|
|
4900
|
+
getRadioRecord (isFull?: boolean) {
|
|
4890
4901
|
const { selectRadioRow, fullDataRowIdData, afterFullRowMaps } = this
|
|
4891
4902
|
if (selectRadioRow) {
|
|
4892
4903
|
const rowid = getRowid(this, selectRadioRow)
|
|
@@ -4976,7 +4987,7 @@ const Methods = {
|
|
|
4976
4987
|
* 当单元格发生改变时
|
|
4977
4988
|
* 如果存在规则,则校验
|
|
4978
4989
|
*/
|
|
4979
|
-
handleChangeCell (evnt:
|
|
4990
|
+
handleChangeCell (evnt: Event, params: any) {
|
|
4980
4991
|
this.checkValidate('blur')
|
|
4981
4992
|
.catch((e: any) => e)
|
|
4982
4993
|
.then(() => {
|
|
@@ -4990,7 +5001,7 @@ const Methods = {
|
|
|
4990
5001
|
* 如果是单击模式,则激活为编辑状态
|
|
4991
5002
|
* 如果是双击模式,则单击后选中状态
|
|
4992
5003
|
*/
|
|
4993
|
-
triggerCellClickEvent (evnt:
|
|
5004
|
+
triggerCellClickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams) {
|
|
4994
5005
|
const $xeTable = this
|
|
4995
5006
|
|
|
4996
5007
|
const { highlightCurrentRow, editStore, radioOpts, expandOpts, treeOpts, keyboardOpts, editConfig, editOpts, checkboxOpts, rowOpts } = this
|
|
@@ -5000,7 +5011,7 @@ const Methods = {
|
|
|
5000
5011
|
const isRadioType = type === 'radio'
|
|
5001
5012
|
const isCheckboxType = type === 'checkbox'
|
|
5002
5013
|
const isExpandType = type === 'expand'
|
|
5003
|
-
const cell = evnt.currentTarget
|
|
5014
|
+
const cell = evnt.currentTarget as HTMLDivElement
|
|
5004
5015
|
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
5005
5016
|
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
5006
5017
|
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag
|
|
@@ -5037,7 +5048,7 @@ const Methods = {
|
|
|
5037
5048
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
5038
5049
|
if (isEnableConf(editConfig)) {
|
|
5039
5050
|
// 记录点击输入框聚焦状态
|
|
5040
|
-
if (keyboardOpts.arrowCursorLock && evnt && editOpts.mode === 'cell' && evnt.target && /^input|textarea$/i.test(evnt.target.tagName)) {
|
|
5051
|
+
if (keyboardOpts.arrowCursorLock && evnt && editOpts.mode === 'cell' && evnt.target && /^input|textarea$/i.test((evnt.target as HTMLElement).tagName)) {
|
|
5041
5052
|
focused.column = column
|
|
5042
5053
|
focused.row = row
|
|
5043
5054
|
}
|
|
@@ -5076,11 +5087,11 @@ const Methods = {
|
|
|
5076
5087
|
* 列双击点击事件
|
|
5077
5088
|
* 如果是双击模式,则激活为编辑状态
|
|
5078
5089
|
*/
|
|
5079
|
-
triggerCellDblclickEvent (evnt:
|
|
5090
|
+
triggerCellDblclickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams) {
|
|
5080
5091
|
const { editStore, editConfig, editOpts } = this
|
|
5081
5092
|
const { actived } = editStore
|
|
5082
|
-
const cell = evnt.currentTarget
|
|
5083
|
-
params.cell
|
|
5093
|
+
const cell = evnt.currentTarget as HTMLDivElement
|
|
5094
|
+
params = Object.assign({ cell }, params)
|
|
5084
5095
|
if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
|
|
5085
5096
|
if (!actived.args || evnt.currentTarget !== actived.args.cell) {
|
|
5086
5097
|
if (editOpts.mode === 'row') {
|
|
@@ -5252,7 +5263,7 @@ const Methods = {
|
|
|
5252
5263
|
const { treeConfig, dragConfig } = props
|
|
5253
5264
|
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
5254
5265
|
const { fullAllDataRowIdData, prevDragToChild } = internalData
|
|
5255
|
-
const { isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts
|
|
5266
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts
|
|
5256
5267
|
const treeOpts = $xeTable.computeTreeOpts
|
|
5257
5268
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts
|
|
5258
5269
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -5301,20 +5312,27 @@ const Methods = {
|
|
|
5301
5312
|
if (oldLevel && newLevel) {
|
|
5302
5313
|
// 子到子
|
|
5303
5314
|
|
|
5304
|
-
if (
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
VxeUI.modal.message({
|
|
5312
|
-
status: 'error',
|
|
5313
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
5314
|
-
})
|
|
5315
|
-
}
|
|
5315
|
+
if (isPeerDrag) {
|
|
5316
|
+
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
5317
|
+
// 非同级
|
|
5318
|
+
return
|
|
5319
|
+
}
|
|
5320
|
+
} else {
|
|
5321
|
+
if (!isCrossDrag) {
|
|
5316
5322
|
return
|
|
5317
5323
|
}
|
|
5324
|
+
if (oldAllMaps[newRowid]) {
|
|
5325
|
+
isSelfToChildStatus = true
|
|
5326
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
5327
|
+
if (VxeUI.modal) {
|
|
5328
|
+
VxeUI.modal.message({
|
|
5329
|
+
status: 'error',
|
|
5330
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
5331
|
+
})
|
|
5332
|
+
}
|
|
5333
|
+
return
|
|
5334
|
+
}
|
|
5335
|
+
}
|
|
5318
5336
|
}
|
|
5319
5337
|
} else if (oldLevel) {
|
|
5320
5338
|
// 子到根
|
|
@@ -5330,7 +5348,7 @@ const Methods = {
|
|
|
5330
5348
|
}
|
|
5331
5349
|
if (oldAllMaps[newRowid]) {
|
|
5332
5350
|
isSelfToChildStatus = true
|
|
5333
|
-
if (!isSelfToChildDrag) {
|
|
5351
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
5334
5352
|
if (VxeUI.modal) {
|
|
5335
5353
|
VxeUI.modal.message({
|
|
5336
5354
|
status: 'error',
|
|
@@ -5356,7 +5374,7 @@ const Methods = {
|
|
|
5356
5374
|
fullList.splice(ntfIndex, 0, dragRow)
|
|
5357
5375
|
|
|
5358
5376
|
// 改变层级
|
|
5359
|
-
if (isSelfToChildStatus && isSelfToChildDrag) {
|
|
5377
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
5360
5378
|
XEUtils.each(dragRow[childrenField], childRow => {
|
|
5361
5379
|
childRow[parentField] = dragRow[parentField]
|
|
5362
5380
|
})
|
|
@@ -5435,9 +5453,9 @@ const Methods = {
|
|
|
5435
5453
|
const { fullAllDataRowIdData } = internalData
|
|
5436
5454
|
const { dragRow } = reactData
|
|
5437
5455
|
const treeOpts = $xeTable.computeTreeOpts
|
|
5438
|
-
const { transform } = treeOpts
|
|
5456
|
+
const { transform, parentField } = treeOpts
|
|
5439
5457
|
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
5440
|
-
const { isCrossDrag, isToChildDrag } = rowDragOpts
|
|
5458
|
+
const { isPeerDrag, isCrossDrag, isToChildDrag } = rowDragOpts
|
|
5441
5459
|
if (!dragRow) {
|
|
5442
5460
|
evnt.preventDefault()
|
|
5443
5461
|
return
|
|
@@ -5452,7 +5470,9 @@ const Methods = {
|
|
|
5452
5470
|
const { dragRow } = reactData
|
|
5453
5471
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y
|
|
5454
5472
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
5455
|
-
if ($xeTable.eqRow(dragRow, row) ||
|
|
5473
|
+
if ($xeTable.eqRow(dragRow, row) ||
|
|
5474
|
+
(!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))
|
|
5475
|
+
) {
|
|
5456
5476
|
showDropTip($xeTable, evnt, trEl, null, false, dragPos)
|
|
5457
5477
|
return
|
|
5458
5478
|
}
|
|
@@ -5527,7 +5547,7 @@ const Methods = {
|
|
|
5527
5547
|
|
|
5528
5548
|
const { mouseConfig } = props
|
|
5529
5549
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
5530
|
-
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
|
|
5550
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
|
|
5531
5551
|
const { collectColumn } = internalData
|
|
5532
5552
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
5533
5553
|
if (prevDragCol && dragCol) {
|
|
@@ -5562,20 +5582,28 @@ const Methods = {
|
|
|
5562
5582
|
if (oldColumn.parentId && newColumn.parentId) {
|
|
5563
5583
|
// 子到子
|
|
5564
5584
|
|
|
5565
|
-
if (
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
if (oldAllMaps[newColumn.id]) {
|
|
5569
|
-
isSelfToChildStatus = true
|
|
5570
|
-
if (!isSelfToChildDrag) {
|
|
5571
|
-
if (VxeUI.modal) {
|
|
5572
|
-
VxeUI.modal.message({
|
|
5573
|
-
status: 'error',
|
|
5574
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
5575
|
-
})
|
|
5576
|
-
}
|
|
5585
|
+
if (isPeerDrag) {
|
|
5586
|
+
if (oldColumn.parentId !== newColumn.parentId) {
|
|
5587
|
+
// 非同级
|
|
5577
5588
|
return
|
|
5578
5589
|
}
|
|
5590
|
+
} else {
|
|
5591
|
+
if (!isCrossDrag) {
|
|
5592
|
+
return
|
|
5593
|
+
}
|
|
5594
|
+
|
|
5595
|
+
if (oldAllMaps[newColumn.id]) {
|
|
5596
|
+
isSelfToChildStatus = true
|
|
5597
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
5598
|
+
if (VxeUI.modal) {
|
|
5599
|
+
VxeUI.modal.message({
|
|
5600
|
+
status: 'error',
|
|
5601
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
5602
|
+
})
|
|
5603
|
+
}
|
|
5604
|
+
return
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5579
5607
|
}
|
|
5580
5608
|
} else if (oldColumn.parentId) {
|
|
5581
5609
|
// 子到根
|
|
@@ -5591,7 +5619,7 @@ const Methods = {
|
|
|
5591
5619
|
}
|
|
5592
5620
|
if (oldAllMaps[newColumn.id]) {
|
|
5593
5621
|
isSelfToChildStatus = true
|
|
5594
|
-
if (!isSelfToChildDrag) {
|
|
5622
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
5595
5623
|
if (VxeUI.modal) {
|
|
5596
5624
|
VxeUI.modal.message({
|
|
5597
5625
|
status: 'error',
|
|
@@ -5608,7 +5636,7 @@ const Methods = {
|
|
|
5608
5636
|
const oldewMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === oldColumn.id)
|
|
5609
5637
|
|
|
5610
5638
|
// 改变层级
|
|
5611
|
-
if (isSelfToChildStatus && isSelfToChildDrag) {
|
|
5639
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
5612
5640
|
if (oldewMatchRest) {
|
|
5613
5641
|
const { items: oCols, index: oIndex } = oldewMatchRest
|
|
5614
5642
|
const childList = oldColumn.children || []
|
|
@@ -5632,7 +5660,7 @@ const Methods = {
|
|
|
5632
5660
|
if (newMatchRest) {
|
|
5633
5661
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
|
|
5634
5662
|
// 转子级
|
|
5635
|
-
if (isToChildDrag && prevDragToChild) {
|
|
5663
|
+
if ((isCrossDrag && isToChildDrag) && prevDragToChild) {
|
|
5636
5664
|
oldColumn.parentId = newColumn.id
|
|
5637
5665
|
newColumn.children = (newColumn.children || []).concat([oldColumn])
|
|
5638
5666
|
} else {
|
|
@@ -5644,8 +5672,8 @@ const Methods = {
|
|
|
5644
5672
|
}
|
|
5645
5673
|
}
|
|
5646
5674
|
|
|
5647
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path,
|
|
5648
|
-
if (!
|
|
5675
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
5676
|
+
if (!parentColumn) {
|
|
5649
5677
|
const sortIndex = index + 1
|
|
5650
5678
|
column.renderSortNumber = sortIndex
|
|
5651
5679
|
}
|
|
@@ -5709,7 +5737,7 @@ const Methods = {
|
|
|
5709
5737
|
|
|
5710
5738
|
const { dragCol } = reactData
|
|
5711
5739
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
5712
|
-
const { isToChildDrag, isCrossDrag } = columnDragOpts
|
|
5740
|
+
const { isToChildDrag, isPeerDrag, isCrossDrag } = columnDragOpts
|
|
5713
5741
|
if (!dragCol) {
|
|
5714
5742
|
evnt.preventDefault()
|
|
5715
5743
|
return
|
|
@@ -5723,11 +5751,14 @@ const Methods = {
|
|
|
5723
5751
|
const { clientX } = evnt
|
|
5724
5752
|
const offsetX = clientX - thEl.getBoundingClientRect().x
|
|
5725
5753
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right'
|
|
5726
|
-
if (column.fixed ||
|
|
5754
|
+
if (column.fixed ||
|
|
5755
|
+
(dragCol && dragCol.id === column.id) ||
|
|
5756
|
+
(!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId))
|
|
5757
|
+
) {
|
|
5727
5758
|
showDropTip($xeTable, evnt, null, thEl, false, dragPos)
|
|
5728
5759
|
return
|
|
5729
5760
|
}
|
|
5730
|
-
internalData.prevDragToChild = !!(isToChildDrag && hasCtrlKey)
|
|
5761
|
+
internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && hasCtrlKey)
|
|
5731
5762
|
internalData.prevDragCol = column
|
|
5732
5763
|
internalData.prevDragPos = dragPos
|
|
5733
5764
|
showDropTip($xeTable, evnt, null, thEl, true, dragPos)
|
|
@@ -6584,7 +6615,7 @@ const Methods = {
|
|
|
6584
6615
|
* @param expanded
|
|
6585
6616
|
* @returns
|
|
6586
6617
|
*/
|
|
6587
|
-
handleVirtualTreeExpand (rows: any, expanded:
|
|
6618
|
+
handleVirtualTreeExpand (rows: any[], expanded: boolean) {
|
|
6588
6619
|
return this.handleBaseTreeExpand(rows, expanded).then(() => {
|
|
6589
6620
|
this.handleVirtualTreeToList()
|
|
6590
6621
|
this.handleTableData()
|
|
@@ -6604,7 +6635,7 @@ const Methods = {
|
|
|
6604
6635
|
* @param {Array/Row} rows 行数据
|
|
6605
6636
|
* @param {Boolean} expanded 是否展开
|
|
6606
6637
|
*/
|
|
6607
|
-
setTreeExpand (rows: any, expanded:
|
|
6638
|
+
setTreeExpand (rows: any | any[], expanded: boolean) {
|
|
6608
6639
|
const { treeOpts } = this
|
|
6609
6640
|
const { transform } = treeOpts
|
|
6610
6641
|
if (rows) {
|
|
@@ -498,6 +498,9 @@ export default {
|
|
|
498
498
|
return 0
|
|
499
499
|
},
|
|
500
500
|
rowHeightMaps () {
|
|
501
|
+
return this.computeRowHeightMaps
|
|
502
|
+
},
|
|
503
|
+
computeRowHeightMaps () {
|
|
501
504
|
return {
|
|
502
505
|
default: 48,
|
|
503
506
|
medium: 44,
|
|
@@ -1152,18 +1155,11 @@ export default {
|
|
|
1152
1155
|
})
|
|
1153
1156
|
}
|
|
1154
1157
|
if (this.autoResize) {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
: () => {
|
|
1163
|
-
if (this.autoResize) {
|
|
1164
|
-
this.recalculate(true)
|
|
1165
|
-
}
|
|
1166
|
-
})
|
|
1158
|
+
const resizeObserver = globalResize.create(() => {
|
|
1159
|
+
if (this.autoResize) {
|
|
1160
|
+
this.recalculate(true)
|
|
1161
|
+
}
|
|
1162
|
+
})
|
|
1167
1163
|
resizeObserver.observe(this.$el)
|
|
1168
1164
|
resizeObserver.observe(this.getParentElem())
|
|
1169
1165
|
this.$resize = resizeObserver
|