vxe-table 4.10.13 → 4.10.15-beta.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/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/edit/hook.js +138 -128
- package/es/table/src/body.js +57 -43
- package/es/table/src/table.js +236 -51
- package/es/table/style.css +26 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +26 -0
- 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 +531 -265
- 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/edit/hook.js +169 -154
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/src/body.js +65 -58
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/table.js +293 -49
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +26 -0
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +26 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/hook.ts +141 -129
- package/packages/table/src/body.ts +60 -50
- package/packages/table/src/table.ts +247 -51
- package/styles/components/table.scss +26 -0
- /package/es/{iconfont.1739257038865.ttf → iconfont.1739426300784.ttf} +0 -0
- /package/es/{iconfont.1739257038865.woff → iconfont.1739426300784.woff} +0 -0
- /package/es/{iconfont.1739257038865.woff2 → iconfont.1739426300784.woff2} +0 -0
- /package/lib/{iconfont.1739257038865.ttf → iconfont.1739426300784.ttf} +0 -0
- /package/lib/{iconfont.1739257038865.woff → iconfont.1739426300784.woff} +0 -0
- /package/lib/{iconfont.1739257038865.woff2 → iconfont.1739426300784.woff2} +0 -0
|
@@ -6,7 +6,7 @@ import { getCellValue, setCellValue, getRowid } from '../../src/util'
|
|
|
6
6
|
import { browse, removeClass, addClass } from '../../../ui/src/dom'
|
|
7
7
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
8
8
|
|
|
9
|
-
import type { TableEditMethods, TableEditPrivateMethods } from '../../../../types'
|
|
9
|
+
import type { TableEditMethods, TableEditPrivateMethods, VxeTableDefines } from '../../../../types'
|
|
10
10
|
|
|
11
11
|
const { getConfig, renderer, hooks, getI18n } = VxeUI
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ hooks.add('tableEditModule', {
|
|
|
21
21
|
let editMethods = {} as TableEditMethods
|
|
22
22
|
let editPrivateMethods = {} as TableEditPrivateMethods
|
|
23
23
|
|
|
24
|
-
const getEditColumnModel = (row: any, column:
|
|
24
|
+
const getEditColumnModel = (row: any, column: VxeTableDefines.ColumnInfo) => {
|
|
25
25
|
const { model, editRender } = column
|
|
26
26
|
if (editRender) {
|
|
27
27
|
model.value = getCellValue(row, column)
|
|
@@ -29,7 +29,7 @@ hooks.add('tableEditModule', {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const setEditColumnModel = (row: any, column:
|
|
32
|
+
const setEditColumnModel = (row: any, column: VxeTableDefines.ColumnInfo) => {
|
|
33
33
|
const { model, editRender } = column
|
|
34
34
|
if (editRender && model.update) {
|
|
35
35
|
setCellValue(row, column, model.value)
|
|
@@ -48,21 +48,21 @@ hooks.add('tableEditModule', {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const syncActivedCell = () => {
|
|
52
52
|
const { editStore, tableColumn } = reactData
|
|
53
53
|
const editOpts = computeEditOpts.value
|
|
54
54
|
const { actived } = editStore
|
|
55
55
|
const { row, column } = actived
|
|
56
56
|
if (row || column) {
|
|
57
57
|
if (editOpts.mode === 'row') {
|
|
58
|
-
tableColumn.forEach((column
|
|
58
|
+
tableColumn.forEach((column) => setEditColumnModel(row, column))
|
|
59
59
|
} else {
|
|
60
60
|
setEditColumnModel(row, column)
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
const insertTreeRow = (newRecords: any[], isAppend: boolean) => {
|
|
66
66
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
67
67
|
const treeOpts = computeTreeOpts.value
|
|
68
68
|
const { rowField, parentField, mapChildrenField } = treeOpts
|
|
@@ -86,7 +86,7 @@ hooks.add('tableEditModule', {
|
|
|
86
86
|
}
|
|
87
87
|
parentChilds[funcName](item)
|
|
88
88
|
mapChilds[funcName](item)
|
|
89
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
|
|
89
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
90
90
|
fullDataRowIdData[rowid] = rest
|
|
91
91
|
fullAllDataRowIdData[rowid] = rest
|
|
92
92
|
} else {
|
|
@@ -97,7 +97,7 @@ hooks.add('tableEditModule', {
|
|
|
97
97
|
}
|
|
98
98
|
afterFullData[funcName](item)
|
|
99
99
|
tableFullTreeData[funcName](item)
|
|
100
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
100
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
101
101
|
fullDataRowIdData[rowid] = rest
|
|
102
102
|
fullAllDataRowIdData[rowid] = rest
|
|
103
103
|
}
|
|
@@ -122,7 +122,7 @@ hooks.add('tableEditModule', {
|
|
|
122
122
|
} else {
|
|
123
123
|
newRecords.forEach(item => {
|
|
124
124
|
const rowid = getRowid($xeTable, item)
|
|
125
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
125
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
126
126
|
fullDataRowIdData[rowid] = rest
|
|
127
127
|
fullAllDataRowIdData[rowid] = rest
|
|
128
128
|
afterFullData.unshift(item)
|
|
@@ -144,7 +144,7 @@ hooks.add('tableEditModule', {
|
|
|
144
144
|
} else {
|
|
145
145
|
newRecords.forEach(item => {
|
|
146
146
|
const rowid = getRowid($xeTable, item)
|
|
147
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
147
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
148
148
|
fullDataRowIdData[rowid] = rest
|
|
149
149
|
fullAllDataRowIdData[rowid] = rest
|
|
150
150
|
afterFullData.push(item)
|
|
@@ -184,7 +184,7 @@ hooks.add('tableEditModule', {
|
|
|
184
184
|
targetIndex = targetIndex + 1
|
|
185
185
|
}
|
|
186
186
|
parentMapChilds.splice(targetIndex, 0, item)
|
|
187
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
|
|
187
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
188
188
|
fullDataRowIdData[rowid] = rest
|
|
189
189
|
fullAllDataRowIdData[rowid] = rest
|
|
190
190
|
})
|
|
@@ -329,6 +329,133 @@ hooks.add('tableEditModule', {
|
|
|
329
329
|
})
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
const handleEditActive = (params: any, evnt: Event | null, isFocus: boolean) => {
|
|
333
|
+
const { editConfig, mouseConfig } = props
|
|
334
|
+
const { editStore, tableColumn } = reactData
|
|
335
|
+
const editOpts = computeEditOpts.value
|
|
336
|
+
const { mode } = editOpts
|
|
337
|
+
const { actived, focused } = editStore
|
|
338
|
+
const { row, column } = params
|
|
339
|
+
const { editRender } = column
|
|
340
|
+
const cell = (params.cell || $xeTable.getCellElement(row, column))
|
|
341
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
342
|
+
params.cell = cell
|
|
343
|
+
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
344
|
+
// 激活编辑
|
|
345
|
+
if (!$xeTable.isPendingByRow(row)) {
|
|
346
|
+
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
347
|
+
// 判断是否禁用编辑
|
|
348
|
+
let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
|
|
349
|
+
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
|
|
350
|
+
if (mouseConfig) {
|
|
351
|
+
$xeTable.clearSelected()
|
|
352
|
+
if ($xeTable.clearCellAreas) {
|
|
353
|
+
$xeTable.clearCellAreas()
|
|
354
|
+
$xeTable.clearCopyCellArea()
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
$xeTable.closeTooltip()
|
|
358
|
+
if (actived.column) {
|
|
359
|
+
handleClearEdit(evnt)
|
|
360
|
+
}
|
|
361
|
+
type = 'edit-activated'
|
|
362
|
+
column.renderHeight = cell.offsetHeight
|
|
363
|
+
actived.args = params
|
|
364
|
+
actived.row = row
|
|
365
|
+
actived.column = column
|
|
366
|
+
if (mode === 'row') {
|
|
367
|
+
tableColumn.forEach((column: any) => getEditColumnModel(row, column))
|
|
368
|
+
} else {
|
|
369
|
+
getEditColumnModel(row, column)
|
|
370
|
+
}
|
|
371
|
+
const afterEditMethod = editOpts.afterEditMethod
|
|
372
|
+
nextTick(() => {
|
|
373
|
+
if (isFocus) {
|
|
374
|
+
$xeTable.handleFocus(params, evnt)
|
|
375
|
+
}
|
|
376
|
+
if (afterEditMethod) {
|
|
377
|
+
afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
|
|
378
|
+
}
|
|
379
|
+
})
|
|
380
|
+
}
|
|
381
|
+
$xeTable.dispatchEvent(type, {
|
|
382
|
+
row,
|
|
383
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
384
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
385
|
+
column,
|
|
386
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
387
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
388
|
+
}, evnt)
|
|
389
|
+
|
|
390
|
+
// v4已废弃
|
|
391
|
+
if (type === 'edit-activated') {
|
|
392
|
+
$xeTable.dispatchEvent('edit-actived', {
|
|
393
|
+
row,
|
|
394
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
395
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
396
|
+
column,
|
|
397
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
398
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
399
|
+
}, evnt)
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
const { column: oldColumn } = actived
|
|
403
|
+
if (mouseConfig) {
|
|
404
|
+
$xeTable.clearSelected()
|
|
405
|
+
if ($xeTable.clearCellAreas) {
|
|
406
|
+
$xeTable.clearCellAreas()
|
|
407
|
+
$xeTable.clearCopyCellArea()
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (oldColumn !== column) {
|
|
411
|
+
const { model: oldModel } = oldColumn
|
|
412
|
+
if (oldModel.update) {
|
|
413
|
+
setCellValue(row, oldColumn, oldModel.value)
|
|
414
|
+
}
|
|
415
|
+
if ($xeTable.clearValidate) {
|
|
416
|
+
$xeTable.clearValidate(row, column)
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
column.renderHeight = cell.offsetHeight
|
|
420
|
+
actived.args = params
|
|
421
|
+
actived.column = column
|
|
422
|
+
if (isFocus) {
|
|
423
|
+
setTimeout(() => {
|
|
424
|
+
$xeTable.handleFocus(params, evnt)
|
|
425
|
+
})
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
focused.column = null
|
|
429
|
+
focused.row = null
|
|
430
|
+
$xeTable.focus()
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return nextTick()
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const handleEditCell = (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo, isPos: boolean) => {
|
|
437
|
+
const { editConfig } = props
|
|
438
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
439
|
+
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
440
|
+
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
441
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
442
|
+
if (cell) {
|
|
443
|
+
handleEditActive({
|
|
444
|
+
row,
|
|
445
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
446
|
+
column,
|
|
447
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
448
|
+
cell,
|
|
449
|
+
$table: $xeTable
|
|
450
|
+
}, null, false)
|
|
451
|
+
internalData._lastCallTime = Date.now()
|
|
452
|
+
}
|
|
453
|
+
return nextTick()
|
|
454
|
+
})
|
|
455
|
+
}
|
|
456
|
+
return nextTick()
|
|
457
|
+
}
|
|
458
|
+
|
|
332
459
|
editMethods = {
|
|
333
460
|
/**
|
|
334
461
|
* 往表格中插入临时数据
|
|
@@ -658,7 +785,7 @@ hooks.add('tableEditModule', {
|
|
|
658
785
|
if (fieldOrColumn) {
|
|
659
786
|
column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
660
787
|
}
|
|
661
|
-
return
|
|
788
|
+
return handleEditCell(row, column, false)
|
|
662
789
|
},
|
|
663
790
|
setActiveCell (row, fieldOrColumn) {
|
|
664
791
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -671,26 +798,7 @@ hooks.add('tableEditModule', {
|
|
|
671
798
|
* 激活单元格编辑
|
|
672
799
|
*/
|
|
673
800
|
setEditCell (row, fieldOrColumn) {
|
|
674
|
-
|
|
675
|
-
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
676
|
-
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
677
|
-
return $xeTable.scrollToRow(row, column).then(() => {
|
|
678
|
-
const cell = $xeTable.getCellElement(row, column)
|
|
679
|
-
if (cell) {
|
|
680
|
-
editPrivateMethods.handleEdit({
|
|
681
|
-
row,
|
|
682
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
683
|
-
column,
|
|
684
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
685
|
-
cell,
|
|
686
|
-
$table: $xeTable
|
|
687
|
-
})
|
|
688
|
-
internalData._lastCallTime = Date.now()
|
|
689
|
-
}
|
|
690
|
-
return nextTick()
|
|
691
|
-
})
|
|
692
|
-
}
|
|
693
|
-
return nextTick()
|
|
801
|
+
return handleEditCell(row, fieldOrColumn, true)
|
|
694
802
|
},
|
|
695
803
|
/**
|
|
696
804
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -722,103 +830,7 @@ hooks.add('tableEditModule', {
|
|
|
722
830
|
* 处理激活编辑
|
|
723
831
|
*/
|
|
724
832
|
handleEdit (params, evnt) {
|
|
725
|
-
|
|
726
|
-
const { editStore, tableColumn } = reactData
|
|
727
|
-
const editOpts = computeEditOpts.value
|
|
728
|
-
const { mode } = editOpts
|
|
729
|
-
const { actived, focused } = editStore
|
|
730
|
-
const { row, column } = params
|
|
731
|
-
const { editRender } = column
|
|
732
|
-
const cell = (params.cell || $xeTable.getCellElement(row, column))
|
|
733
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
734
|
-
params.cell = cell
|
|
735
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
736
|
-
// 激活编辑
|
|
737
|
-
if (!$xeTable.isPendingByRow(row)) {
|
|
738
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
739
|
-
// 判断是否禁用编辑
|
|
740
|
-
let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
|
|
741
|
-
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
|
|
742
|
-
if (mouseConfig) {
|
|
743
|
-
editMethods.clearSelected()
|
|
744
|
-
if ($xeTable.clearCellAreas) {
|
|
745
|
-
$xeTable.clearCellAreas()
|
|
746
|
-
$xeTable.clearCopyCellArea()
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
$xeTable.closeTooltip()
|
|
750
|
-
if (actived.column) {
|
|
751
|
-
handleClearEdit(evnt)
|
|
752
|
-
}
|
|
753
|
-
type = 'edit-activated'
|
|
754
|
-
column.renderHeight = cell.offsetHeight
|
|
755
|
-
actived.args = params
|
|
756
|
-
actived.row = row
|
|
757
|
-
actived.column = column
|
|
758
|
-
if (mode === 'row') {
|
|
759
|
-
tableColumn.forEach((column: any) => getEditColumnModel(row, column))
|
|
760
|
-
} else {
|
|
761
|
-
getEditColumnModel(row, column)
|
|
762
|
-
}
|
|
763
|
-
const afterEditMethod = editOpts.afterEditMethod
|
|
764
|
-
nextTick(() => {
|
|
765
|
-
editPrivateMethods.handleFocus(params, evnt)
|
|
766
|
-
if (afterEditMethod) {
|
|
767
|
-
afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
|
|
768
|
-
}
|
|
769
|
-
})
|
|
770
|
-
}
|
|
771
|
-
$xeTable.dispatchEvent(type, {
|
|
772
|
-
row,
|
|
773
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
774
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
775
|
-
column,
|
|
776
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
777
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
778
|
-
}, evnt)
|
|
779
|
-
|
|
780
|
-
// v4已废弃
|
|
781
|
-
if (type === 'edit-activated') {
|
|
782
|
-
$xeTable.dispatchEvent('edit-actived', {
|
|
783
|
-
row,
|
|
784
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
785
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
786
|
-
column,
|
|
787
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
788
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
789
|
-
}, evnt)
|
|
790
|
-
}
|
|
791
|
-
} else {
|
|
792
|
-
const { column: oldColumn } = actived
|
|
793
|
-
if (mouseConfig) {
|
|
794
|
-
editMethods.clearSelected()
|
|
795
|
-
if ($xeTable.clearCellAreas) {
|
|
796
|
-
$xeTable.clearCellAreas()
|
|
797
|
-
$xeTable.clearCopyCellArea()
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
if (oldColumn !== column) {
|
|
801
|
-
const { model: oldModel } = oldColumn
|
|
802
|
-
if (oldModel.update) {
|
|
803
|
-
setCellValue(row, oldColumn, oldModel.value)
|
|
804
|
-
}
|
|
805
|
-
if ($xeTable.clearValidate) {
|
|
806
|
-
$xeTable.clearValidate(row, column)
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
column.renderHeight = cell.offsetHeight
|
|
810
|
-
actived.args = params
|
|
811
|
-
actived.column = column
|
|
812
|
-
setTimeout(() => {
|
|
813
|
-
editPrivateMethods.handleFocus(params, evnt)
|
|
814
|
-
})
|
|
815
|
-
}
|
|
816
|
-
focused.column = null
|
|
817
|
-
focused.row = null
|
|
818
|
-
$xeTable.focus()
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
return nextTick()
|
|
833
|
+
return handleEditActive(params, evnt, true)
|
|
822
834
|
},
|
|
823
835
|
/**
|
|
824
836
|
* @deprecated
|
|
@@ -27,7 +27,7 @@ export default defineComponent({
|
|
|
27
27
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTablePrivateMethods)
|
|
28
28
|
|
|
29
29
|
const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
30
|
-
const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts,
|
|
30
|
+
const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps()
|
|
31
31
|
|
|
32
32
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
33
33
|
const refBodyScroll = ref() as Ref<HTMLDivElement>
|
|
@@ -429,7 +429,7 @@ export default defineComponent({
|
|
|
429
429
|
|
|
430
430
|
const renderRows = (fixedType: 'left' | 'right' | '', isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
|
|
431
431
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
|
|
432
|
-
const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
|
|
432
|
+
const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData
|
|
433
433
|
const { fullAllDataRowIdData } = tableInternalData
|
|
434
434
|
const checkboxOpts = computeCheckboxOpts.value
|
|
435
435
|
const radioOpts = computeRadioOpts.value
|
|
@@ -462,18 +462,18 @@ export default defineComponent({
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
const rowid = getRowid($xeTable, row)
|
|
465
|
-
const
|
|
465
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
466
466
|
let rowLevel = 0
|
|
467
467
|
let seq: string | number = -1
|
|
468
468
|
let _rowIndex = 0
|
|
469
|
-
if (
|
|
470
|
-
rowLevel =
|
|
469
|
+
if (rowRest) {
|
|
470
|
+
rowLevel = rowRest.level
|
|
471
471
|
if (treeConfig && transform && seqMode === 'increasing') {
|
|
472
|
-
seq =
|
|
472
|
+
seq = rowRest._index + 1
|
|
473
473
|
} else {
|
|
474
|
-
seq =
|
|
474
|
+
seq = rowRest.seq
|
|
475
475
|
}
|
|
476
|
-
_rowIndex =
|
|
476
|
+
_rowIndex = rowRest._index
|
|
477
477
|
}
|
|
478
478
|
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
479
479
|
// 行是否被展开
|
|
@@ -537,46 +537,60 @@ export default defineComponent({
|
|
|
537
537
|
// 如果行被展开了
|
|
538
538
|
if (isExpandRow) {
|
|
539
539
|
const expandOpts = computeExpandOpts.value
|
|
540
|
-
const { height: expandHeight, padding } = expandOpts
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
const { showOverflow } = expandColumn
|
|
549
|
-
const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
|
|
550
|
-
const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
551
|
-
rows.push(
|
|
552
|
-
h('tr', {
|
|
553
|
-
class: ['vxe-body--expanded-row', {
|
|
554
|
-
'is--padding': padding
|
|
555
|
-
}],
|
|
556
|
-
key: `expand_${rowid}`,
|
|
557
|
-
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(expandParams) : rowStyle) : null,
|
|
558
|
-
...trOn
|
|
559
|
-
}, [
|
|
560
|
-
h('td', {
|
|
561
|
-
class: {
|
|
562
|
-
'vxe-body--expanded-column': 1,
|
|
563
|
-
'fixed--hidden': fixedType && !hasFixedColumn,
|
|
564
|
-
'col--ellipsis': hasEllipsis
|
|
565
|
-
},
|
|
566
|
-
colspan: tableColumn.length
|
|
540
|
+
const { height: expandHeight, padding, mode: expandMode } = expandOpts
|
|
541
|
+
if (expandMode === 'fixed') {
|
|
542
|
+
rows.push(
|
|
543
|
+
h('tr', {
|
|
544
|
+
class: 'vxe-body--row-expanded-place',
|
|
545
|
+
key: `expand_${rowid}`,
|
|
546
|
+
rowid
|
|
567
547
|
}, [
|
|
568
|
-
h('
|
|
569
|
-
class:
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
548
|
+
h('td', {
|
|
549
|
+
class: 'vxe-body--row-expanded-place-column',
|
|
550
|
+
colspan: tableColumn.length,
|
|
551
|
+
style: {
|
|
552
|
+
height: `${rowExpandHeightFlag ? (rowRest.expandHeight || expandHeight) : 0}px`
|
|
553
|
+
}
|
|
554
|
+
})
|
|
555
|
+
])
|
|
556
|
+
)
|
|
557
|
+
} else {
|
|
558
|
+
const cellStyle: any = {}
|
|
559
|
+
if (expandHeight) {
|
|
560
|
+
cellStyle.height = `${expandHeight}px`
|
|
561
|
+
}
|
|
562
|
+
if (treeConfig) {
|
|
563
|
+
cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
|
|
564
|
+
}
|
|
565
|
+
const { showOverflow } = expandColumn
|
|
566
|
+
const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
|
|
567
|
+
const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
568
|
+
rows.push(
|
|
569
|
+
h('tr', {
|
|
570
|
+
class: ['vxe-body--expanded-row', {
|
|
571
|
+
'is--padding': padding
|
|
572
|
+
}],
|
|
573
|
+
key: `expand_${rowid}`
|
|
574
|
+
}, [
|
|
575
|
+
h('td', {
|
|
576
|
+
class: ['vxe-body--expanded-column', {
|
|
577
|
+
'fixed--hidden': fixedType && !hasFixedColumn,
|
|
578
|
+
'col--ellipsis': hasEllipsis
|
|
579
|
+
}],
|
|
580
|
+
colspan: tableColumn.length
|
|
574
581
|
}, [
|
|
575
|
-
|
|
582
|
+
h('div', {
|
|
583
|
+
class: ['vxe-body--expanded-cell', {
|
|
584
|
+
'is--ellipsis': expandHeight
|
|
585
|
+
}],
|
|
586
|
+
style: cellStyle
|
|
587
|
+
}, [
|
|
588
|
+
expandColumn.renderData(expandParams)
|
|
589
|
+
])
|
|
576
590
|
])
|
|
577
591
|
])
|
|
578
|
-
|
|
579
|
-
|
|
592
|
+
)
|
|
593
|
+
}
|
|
580
594
|
}
|
|
581
595
|
// 如果是树形表格
|
|
582
596
|
if (isExpandTree) {
|
|
@@ -627,15 +641,14 @@ export default defineComponent({
|
|
|
627
641
|
const emptyOpts = computeEmptyOpts.value
|
|
628
642
|
const mouseOpts = computeMouseOpts.value
|
|
629
643
|
const rowDragOpts = computeRowDragOpts.value
|
|
630
|
-
const
|
|
631
|
-
const rightFixedWidth = computeRightFixedWidth.value
|
|
644
|
+
const expandOpts = computeExpandOpts.value
|
|
632
645
|
|
|
633
646
|
let renderDataList = tableData
|
|
634
647
|
let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
|
|
635
648
|
let isOptimizeMode = false
|
|
636
649
|
// 如果是使用优化模式
|
|
637
650
|
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
638
|
-
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
651
|
+
if ((expandColumn && expandOpts.mode !== 'fixed') || spanMethod || footerSpanMethod) {
|
|
639
652
|
// 如果不支持优化模式
|
|
640
653
|
} else {
|
|
641
654
|
isOptimizeMode = true
|
|
@@ -716,9 +729,6 @@ export default defineComponent({
|
|
|
716
729
|
$xeTable.triggerBodyScrollEvent(evnt, fixedType)
|
|
717
730
|
}
|
|
718
731
|
}
|
|
719
|
-
if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
|
|
720
|
-
ons.onWheel = $xeTable.triggerBodyWheelEvent
|
|
721
|
-
}
|
|
722
732
|
|
|
723
733
|
return h('div', {
|
|
724
734
|
ref: refElem,
|