vxe-table 4.1.13 → 4.1.15-beta.2
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/input/src/input.js +13 -0
- package/es/table/src/body.js +26 -12
- package/es/table/src/table.js +4 -1
- package/es/validator/src/hook.js +9 -2
- package/lib/index.umd.js +58 -19
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +15 -0
- package/lib/input/src/input.min.js +1 -1
- package/lib/table/src/body.js +31 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/table.js +4 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/validator/src/hook.js +9 -2
- package/lib/validator/src/hook.min.js +1 -1
- package/package.json +1 -1
- package/packages/input/src/input.ts +14 -0
- package/packages/table/src/body.ts +26 -12
- package/packages/table/src/table.ts +4 -1
- package/packages/validator/src/hook.ts +8 -2
|
@@ -52,9 +52,12 @@ export default defineComponent({
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const countTreeExpand = (prevRow: any, params: any) => {
|
|
55
|
+
let count = 1
|
|
56
|
+
if (!prevRow) {
|
|
57
|
+
return count
|
|
58
|
+
}
|
|
55
59
|
const treeOpts = computeTreeOpts.value
|
|
56
60
|
const rowChildren = prevRow[treeOpts.children]
|
|
57
|
-
let count = 1
|
|
58
61
|
if ($xetable.isTreeExpandByRow(prevRow)) {
|
|
59
62
|
for (let index = 0; index < rowChildren.length; index++) {
|
|
60
63
|
count += countTreeExpand(rowChildren[index], params)
|
|
@@ -63,13 +66,12 @@ export default defineComponent({
|
|
|
63
66
|
return count
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
const calcTreeLine = (params: any, items: any[]) => {
|
|
67
|
-
const { $rowIndex } = params
|
|
69
|
+
const calcTreeLine = (params: any, items: any[], rIndex: number) => {
|
|
68
70
|
let expandSize = 1
|
|
69
|
-
if (
|
|
70
|
-
expandSize = countTreeExpand(items[
|
|
71
|
+
if (rIndex) {
|
|
72
|
+
expandSize = countTreeExpand(items[rIndex - 1], params)
|
|
71
73
|
}
|
|
72
|
-
return tableReactData.rowHeight * expandSize - (
|
|
74
|
+
return tableReactData.rowHeight * expandSize - (rIndex ? 1 : (12 - getOffsetSize()))
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
// 滚动、拖动过程中不需要触发
|
|
@@ -79,11 +81,22 @@ export default defineComponent({
|
|
|
79
81
|
return _isResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number))
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
const renderLine = (
|
|
83
|
-
const { column } = params
|
|
84
|
+
const renderLine = (params: any) => {
|
|
85
|
+
const { row, column } = params
|
|
84
86
|
const { treeConfig } = tableProps
|
|
85
87
|
const treeOpts = computeTreeOpts.value
|
|
86
88
|
const { slots, treeNode } = column
|
|
89
|
+
const { fullAllDataRowIdData } = tableInternalData
|
|
90
|
+
const rowid = getRowid($xetable, row)
|
|
91
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
92
|
+
let rLevel = 0
|
|
93
|
+
let rIndex = 0
|
|
94
|
+
let items = []
|
|
95
|
+
if (rest) {
|
|
96
|
+
rLevel = rest.level
|
|
97
|
+
rIndex = rest._index
|
|
98
|
+
items = rest.items
|
|
99
|
+
}
|
|
87
100
|
if (slots && slots.line) {
|
|
88
101
|
return $xetable.callSlot(slots.line, params)
|
|
89
102
|
}
|
|
@@ -95,8 +108,8 @@ export default defineComponent({
|
|
|
95
108
|
h('div', {
|
|
96
109
|
class: 'vxe-tree--line',
|
|
97
110
|
style: {
|
|
98
|
-
height: `${calcTreeLine(params, items)}px`,
|
|
99
|
-
left: `${(
|
|
111
|
+
height: `${calcTreeLine(params, items, rIndex)}px`,
|
|
112
|
+
left: `${(rLevel * treeOpts.indent) + (rLevel ? 2 - getOffsetSize() : 0) + 16}px`
|
|
100
113
|
}
|
|
101
114
|
})
|
|
102
115
|
])
|
|
@@ -239,7 +252,7 @@ export default defineComponent({
|
|
|
239
252
|
} else {
|
|
240
253
|
// 渲染单元格
|
|
241
254
|
tdVNs.push(
|
|
242
|
-
...renderLine(
|
|
255
|
+
...renderLine(params),
|
|
243
256
|
h('div', {
|
|
244
257
|
class: ['vxe-cell', {
|
|
245
258
|
'c--title': showTitle,
|
|
@@ -305,7 +318,6 @@ export default defineComponent({
|
|
|
305
318
|
tableData.forEach((row: any, $rowIndex: any) => {
|
|
306
319
|
const trOn: any = {}
|
|
307
320
|
let rowIndex = $rowIndex
|
|
308
|
-
const _rowIndex = $xetable.getVTRowIndex(row)
|
|
309
321
|
// 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
|
310
322
|
rowIndex = $xetable.getRowIndex(row)
|
|
311
323
|
// 事件绑定
|
|
@@ -327,9 +339,11 @@ export default defineComponent({
|
|
|
327
339
|
const rest = fullAllDataRowIdData[rowid]
|
|
328
340
|
let rowLevel = 0
|
|
329
341
|
let seq: string | number = -1
|
|
342
|
+
let _rowIndex = 0
|
|
330
343
|
if (rest) {
|
|
331
344
|
rowLevel = rest.level
|
|
332
345
|
seq = rest.seq
|
|
346
|
+
_rowIndex = rest._index
|
|
333
347
|
}
|
|
334
348
|
const params = { $table: $xetable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
335
349
|
// 处理新增状态
|
|
@@ -3622,6 +3622,7 @@ export default defineComponent({
|
|
|
3622
3622
|
return handleAsyncTreeExpandChilds(row)
|
|
3623
3623
|
}).then(() => {
|
|
3624
3624
|
if (transform) {
|
|
3625
|
+
handleVirtualTreeToList()
|
|
3625
3626
|
return tablePrivateMethods.handleTableData()
|
|
3626
3627
|
}
|
|
3627
3628
|
}).then(() => {
|
|
@@ -3714,9 +3715,11 @@ export default defineComponent({
|
|
|
3714
3715
|
return tablePrivateMethods.handleTableData().then(() => {
|
|
3715
3716
|
if (transform) {
|
|
3716
3717
|
handleVirtualTreeToList()
|
|
3718
|
+
return tablePrivateMethods.handleTableData()
|
|
3717
3719
|
}
|
|
3720
|
+
}).then(() => {
|
|
3718
3721
|
if (isExists) {
|
|
3719
|
-
tableMethods.recalculate()
|
|
3722
|
+
return tableMethods.recalculate()
|
|
3720
3723
|
}
|
|
3721
3724
|
})
|
|
3722
3725
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nextTick } from 'vue'
|
|
2
|
+
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
2
3
|
import XEUtils from 'xe-utils'
|
|
3
4
|
import { getFuncText, eqEmptyValue } from '../../tools/utils'
|
|
4
5
|
import { scrollToView } from '../../tools/dom'
|
|
@@ -156,14 +157,19 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
156
157
|
}
|
|
157
158
|
})
|
|
158
159
|
}).catch(firstErrParams => {
|
|
159
|
-
return new Promise<void>((resolve) => {
|
|
160
|
+
return new Promise<void>((resolve, reject) => {
|
|
160
161
|
const finish = () => {
|
|
161
162
|
nextTick(() => {
|
|
162
163
|
if (cb) {
|
|
163
164
|
cb(validRest)
|
|
164
165
|
resolve()
|
|
165
166
|
} else {
|
|
166
|
-
|
|
167
|
+
if (GlobalConfig.validToReject === 'obsolete') {
|
|
168
|
+
// 已废弃,校验失败将不会执行catch
|
|
169
|
+
reject(validRest)
|
|
170
|
+
} else {
|
|
171
|
+
resolve(validRest)
|
|
172
|
+
}
|
|
167
173
|
}
|
|
168
174
|
})
|
|
169
175
|
}
|