vxe-table 3.14.0 → 3.14.1
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/style.css +1 -1
- package/es/table/module/edit/mixin.js +92 -63
- package/es/table/module/validator/mixin.js +2 -5
- package/es/table/src/body.js +6 -7
- package/es/table/src/methods.js +291 -278
- package/es/table/src/table.js +15 -15
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +478 -484
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +106 -98
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +3 -9
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +6 -7
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +343 -348
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +15 -15
- package/lib/table/src/table.min.js +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/package.json +2 -2
- package/packages/table/module/edit/mixin.ts +125 -87
- package/packages/table/module/validator/mixin.ts +3 -6
- package/packages/table/src/body.ts +6 -7
- package/packages/table/src/methods.ts +334 -293
- package/packages/table/src/table.ts +18 -18
- package/packages/table/src/util.ts +2 -2
- /package/es/{iconfont.1742955973002.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/es/{iconfont.1742955973002.woff → iconfont.1743045564244.woff} +0 -0
- /package/es/{iconfont.1742955973002.woff2 → iconfont.1743045564244.woff2} +0 -0
- /package/lib/{iconfont.1742955973002.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/lib/{iconfont.1742955973002.woff → iconfont.1743045564244.woff} +0 -0
- /package/lib/{iconfont.1742955973002.woff2 → iconfont.1743045564244.woff2} +0 -0
|
@@ -26,7 +26,7 @@ function setEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
|
|
29
|
+
function removeCellSelectedClass ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
30
30
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
31
31
|
if (el) {
|
|
32
32
|
const cell = el.querySelector('.col--selected')
|
|
@@ -36,7 +36,7 @@ function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function syncActivedCell ($xeTable: VxeTableConstructor) {
|
|
39
|
+
function syncActivedCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
40
40
|
const reactData = $xeTable as unknown as TableReactData
|
|
41
41
|
|
|
42
42
|
const { editStore, tableColumn } = reactData
|
|
@@ -52,18 +52,21 @@ function syncActivedCell ($xeTable: VxeTableConstructor) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function insertTreeRow (
|
|
56
|
-
const
|
|
55
|
+
function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
|
|
56
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
57
|
+
|
|
58
|
+
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
59
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
57
60
|
const { rowField, parentField, mapChildrenField } = treeOpts
|
|
58
|
-
const childrenField
|
|
61
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
59
62
|
const funcName = isAppend ? 'push' : 'unshift'
|
|
60
|
-
newRecords.forEach((item
|
|
61
|
-
const parentRowId
|
|
62
|
-
const rowid = getRowid(
|
|
63
|
-
const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item
|
|
63
|
+
newRecords.forEach((item) => {
|
|
64
|
+
const parentRowId = item[parentField]
|
|
65
|
+
const rowid = getRowid($xeTable, item)
|
|
66
|
+
const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item) => parentRowId === item[rowField], { children: mapChildrenField }) : null
|
|
64
67
|
if (matchObj) {
|
|
65
|
-
const { item: parentRow } = matchObj
|
|
66
|
-
const parentRest = fullAllDataRowIdData[getRowid(
|
|
68
|
+
const { item: parentRow } = matchObj
|
|
69
|
+
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)]
|
|
67
70
|
const parentLevel = parentRest ? parentRest.level : 0
|
|
68
71
|
let parentChilds = parentRow[childrenField]
|
|
69
72
|
let mapChilds = parentRow[mapChildrenField]
|
|
@@ -93,14 +96,14 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
|
|
|
93
96
|
})
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
function handleInsertRowAt ($xeTable:
|
|
99
|
+
function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any[], targetRow: any, isInsertNextRow?: any) {
|
|
97
100
|
const props = $xeTable
|
|
98
|
-
const reactData = $xeTable
|
|
99
|
-
const internalData = $xeTable
|
|
101
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
102
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
100
103
|
|
|
101
104
|
const { treeConfig } = props
|
|
102
|
-
const { mergeList
|
|
103
|
-
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
105
|
+
const { mergeList } = reactData
|
|
106
|
+
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData
|
|
104
107
|
const treeOpts = $xeTable.computeTreeOpts
|
|
105
108
|
const { transform, rowField, mapChildrenField } = treeOpts
|
|
106
109
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -239,11 +242,11 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
|
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
}
|
|
242
|
-
const { insertMaps } = editStore
|
|
243
245
|
newRecords.forEach(newRow => {
|
|
244
246
|
const rowid = getRowid($xeTable, newRow)
|
|
245
|
-
|
|
247
|
+
insertRowMaps[rowid] = newRow
|
|
246
248
|
})
|
|
249
|
+
reactData.insertRowFlag++
|
|
247
250
|
$xeTable.cacheRowMap(false)
|
|
248
251
|
$xeTable.updateScrollYStatus()
|
|
249
252
|
$xeTable.handleTableData(treeConfig && transform)
|
|
@@ -252,7 +255,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
|
|
|
252
255
|
}
|
|
253
256
|
$xeTable.updateFooter()
|
|
254
257
|
$xeTable.checkSelectionStatus()
|
|
255
|
-
if (
|
|
258
|
+
if (reactData.scrollYLoad) {
|
|
256
259
|
$xeTable.updateScrollYSpace()
|
|
257
260
|
}
|
|
258
261
|
return $xeTable.$nextTick().then(() => {
|
|
@@ -266,7 +269,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
|
|
|
266
269
|
})
|
|
267
270
|
}
|
|
268
271
|
|
|
269
|
-
function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
|
|
272
|
+
function handleInsertChildRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
|
|
270
273
|
const props = $xeTable
|
|
271
274
|
|
|
272
275
|
const { treeConfig } = props
|
|
@@ -502,13 +505,12 @@ export default {
|
|
|
502
505
|
|
|
503
506
|
const { treeConfig } = props
|
|
504
507
|
const { mergeList, editStore } = reactData
|
|
505
|
-
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps } = internalData
|
|
508
|
+
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData
|
|
506
509
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
507
510
|
const treeOpts = $xeTable.computeTreeOpts
|
|
508
511
|
const { transform, mapChildrenField } = treeOpts
|
|
509
512
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
510
|
-
const { actived
|
|
511
|
-
const insertDataRowMaps = Object.assign({}, editStore.insertMaps)
|
|
513
|
+
const { actived } = editStore
|
|
512
514
|
const { checkField } = checkboxOpts
|
|
513
515
|
let delList: any[] = []
|
|
514
516
|
if (!rows) {
|
|
@@ -520,7 +522,7 @@ export default {
|
|
|
520
522
|
rows.forEach(row => {
|
|
521
523
|
if (!$xeTable.isInsertByRow(row)) {
|
|
522
524
|
const rowid = getRowid($xeTable, row)
|
|
523
|
-
|
|
525
|
+
removeRowMaps[rowid] = row
|
|
524
526
|
}
|
|
525
527
|
})
|
|
526
528
|
// 如果绑定了多选属性,则更新状态
|
|
@@ -588,14 +590,15 @@ export default {
|
|
|
588
590
|
// 从新增中移除已删除的数据
|
|
589
591
|
rows.forEach((row: any) => {
|
|
590
592
|
const rowid = getRowid($xeTable, row)
|
|
591
|
-
if (
|
|
592
|
-
delete
|
|
593
|
+
if (insertRowMaps[rowid]) {
|
|
594
|
+
delete insertRowMaps[rowid]
|
|
593
595
|
}
|
|
594
596
|
if (pendingRowMaps[rowid]) {
|
|
595
597
|
delete pendingRowMaps[rowid]
|
|
596
598
|
}
|
|
597
599
|
})
|
|
598
|
-
|
|
600
|
+
reactData.removeRowFlag++
|
|
601
|
+
reactData.insertRowFlag++
|
|
599
602
|
reactData.pendingRowFlag++
|
|
600
603
|
$xeTable.updateFooter()
|
|
601
604
|
$xeTable.cacheRowMap(false)
|
|
@@ -665,15 +668,12 @@ export default {
|
|
|
665
668
|
* 获取新增的临时数据
|
|
666
669
|
*/
|
|
667
670
|
_getInsertRecords () {
|
|
668
|
-
const $xeTable = this
|
|
669
|
-
const
|
|
670
|
-
const internalData = $xeTable
|
|
671
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
672
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
671
673
|
|
|
672
|
-
const {
|
|
673
|
-
const { fullAllDataRowIdData } = internalData
|
|
674
|
-
const { insertMaps } = editStore
|
|
674
|
+
const { fullAllDataRowIdData, insertRowMaps } = internalData
|
|
675
675
|
const insertRecords: any[] = []
|
|
676
|
-
XEUtils.each(
|
|
676
|
+
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
677
677
|
if (fullAllDataRowIdData[rowid]) {
|
|
678
678
|
insertRecords.push(row)
|
|
679
679
|
}
|
|
@@ -684,13 +684,12 @@ export default {
|
|
|
684
684
|
* 获取已删除的数据
|
|
685
685
|
*/
|
|
686
686
|
_getRemoveRecords () {
|
|
687
|
-
const $xeTable = this
|
|
688
|
-
const
|
|
687
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
688
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
689
689
|
|
|
690
|
-
const {
|
|
691
|
-
const { removeMaps } = editStore
|
|
690
|
+
const { removeRowMaps } = internalData
|
|
692
691
|
const removeRecords: any[] = []
|
|
693
|
-
XEUtils.each(
|
|
692
|
+
XEUtils.each(removeRowMaps, (row) => {
|
|
694
693
|
removeRecords.push(row)
|
|
695
694
|
})
|
|
696
695
|
return removeRecords
|
|
@@ -701,19 +700,19 @@ export default {
|
|
|
701
700
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
702
701
|
*/
|
|
703
702
|
_getUpdateRecords () {
|
|
704
|
-
const $xeTable = this
|
|
703
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
704
|
+
const props = $xeTable
|
|
705
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
705
706
|
|
|
706
|
-
const { keepSource,
|
|
707
|
+
const { keepSource, treeConfig } = props
|
|
708
|
+
const { tableFullData } = internalData
|
|
709
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
707
710
|
if (keepSource) {
|
|
708
|
-
|
|
709
|
-
const { row, column } = actived
|
|
710
|
-
if (row || column) {
|
|
711
|
-
syncActivedCell($xeTable)
|
|
712
|
-
}
|
|
711
|
+
syncActivedCell($xeTable)
|
|
713
712
|
if (treeConfig) {
|
|
714
|
-
return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
|
|
713
|
+
return XEUtils.filterTree(tableFullData, row => $xeTable.isUpdateByRow(row), treeOpts)
|
|
715
714
|
}
|
|
716
|
-
return tableFullData.filter((row
|
|
715
|
+
return tableFullData.filter((row) => $xeTable.isUpdateByRow(row))
|
|
717
716
|
}
|
|
718
717
|
return []
|
|
719
718
|
},
|
|
@@ -721,7 +720,7 @@ export default {
|
|
|
721
720
|
* 处理激活编辑
|
|
722
721
|
*/
|
|
723
722
|
handleEdit (params: any, evnt: any) {
|
|
724
|
-
const $xeTable = this
|
|
723
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
725
724
|
|
|
726
725
|
return handleEditActive($xeTable, params, evnt, true, true)
|
|
727
726
|
},
|
|
@@ -753,7 +752,7 @@ export default {
|
|
|
753
752
|
* 清除激活的编辑
|
|
754
753
|
*/
|
|
755
754
|
_clearEdit (row: any) {
|
|
756
|
-
const $xeTable = this
|
|
755
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
757
756
|
|
|
758
757
|
return handleClearEdit($xeTable, null, row)
|
|
759
758
|
},
|
|
@@ -766,42 +765,57 @@ export default {
|
|
|
766
765
|
return handleClearEdit($xeTable, evnt, targetRow)
|
|
767
766
|
},
|
|
768
767
|
_getActiveRecord () {
|
|
768
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
769
|
+
|
|
769
770
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
770
771
|
warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
|
|
771
772
|
}
|
|
772
773
|
// 即将废弃
|
|
773
|
-
return
|
|
774
|
+
return $xeTable.getEditRecord()
|
|
774
775
|
},
|
|
775
776
|
_getEditRecord () {
|
|
776
|
-
const
|
|
777
|
-
const
|
|
778
|
-
const
|
|
779
|
-
|
|
777
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
778
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
779
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
780
|
+
|
|
781
|
+
const { editStore } = reactData
|
|
782
|
+
const { afterFullData } = internalData
|
|
783
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
784
|
+
const { args, row } = editStore.actived
|
|
785
|
+
if (args && $xeTable.findRowIndexOf(afterFullData, row) > -1 && el.querySelectorAll('.vxe-body--column.col--active').length) {
|
|
780
786
|
return Object.assign({}, args)
|
|
781
787
|
}
|
|
782
788
|
return null
|
|
783
789
|
},
|
|
784
790
|
_isActiveByRow (row: any) {
|
|
791
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
792
|
+
|
|
785
793
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
786
794
|
warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
|
|
787
795
|
}
|
|
788
796
|
// 即将废弃
|
|
789
|
-
return
|
|
797
|
+
return $xeTable.isEditByRow(row)
|
|
790
798
|
},
|
|
791
799
|
/**
|
|
792
800
|
* 判断行是否为激活编辑状态
|
|
793
801
|
* @param {Row} row 行对象
|
|
794
802
|
*/
|
|
795
803
|
_isEditByRow (row: any) {
|
|
796
|
-
|
|
804
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
805
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
806
|
+
|
|
807
|
+
const { editStore } = reactData
|
|
808
|
+
return editStore.actived.row === row
|
|
797
809
|
},
|
|
798
810
|
/**
|
|
799
811
|
* 处理聚焦
|
|
800
812
|
*/
|
|
801
813
|
handleFocus (params: any) {
|
|
802
|
-
const
|
|
814
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
815
|
+
|
|
803
816
|
const { row, column, cell } = params
|
|
804
817
|
const { editRender } = column
|
|
818
|
+
const editOpts = $xeTable.computeEditOpts
|
|
805
819
|
if (isEnableConf(editRender)) {
|
|
806
820
|
const compRender = renderer.get(editRender.name)
|
|
807
821
|
let autoFocus = editRender.autofocus || editRender.autoFocus
|
|
@@ -817,7 +831,7 @@ export default {
|
|
|
817
831
|
}
|
|
818
832
|
// 如果指定了聚焦 class
|
|
819
833
|
if (XEUtils.isFunction(autoFocus)) {
|
|
820
|
-
inputElem = autoFocus.call(
|
|
834
|
+
inputElem = autoFocus.call($xeTable, params)
|
|
821
835
|
} else if (autoFocus) {
|
|
822
836
|
if (autoFocus === true) {
|
|
823
837
|
// 自动匹配模式,会自动匹配第一个可输入元素
|
|
@@ -846,31 +860,33 @@ export default {
|
|
|
846
860
|
if (editOpts.autoPos) {
|
|
847
861
|
if (!column.fixed) {
|
|
848
862
|
// 显示到可视区中
|
|
849
|
-
|
|
863
|
+
$xeTable.scrollToRow(row, column)
|
|
850
864
|
}
|
|
851
865
|
}
|
|
852
866
|
}
|
|
853
867
|
}
|
|
854
868
|
},
|
|
855
869
|
_setActiveRow (row: any) {
|
|
870
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
871
|
+
|
|
856
872
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
857
873
|
warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
|
|
858
874
|
}
|
|
859
875
|
// 即将废弃
|
|
860
|
-
return
|
|
876
|
+
return $xeTable.setEditRow(row)
|
|
861
877
|
},
|
|
862
878
|
/**
|
|
863
879
|
* 激活行编辑
|
|
864
880
|
*/
|
|
865
881
|
_setEditRow (row: any, fieldOrColumn: any) {
|
|
866
|
-
const $xeTable = this
|
|
882
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
867
883
|
|
|
868
884
|
let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
|
|
869
885
|
let isPos = false
|
|
870
886
|
if (fieldOrColumn) {
|
|
871
887
|
isPos = true
|
|
872
888
|
if (fieldOrColumn !== true) {
|
|
873
|
-
column = XEUtils.isString(fieldOrColumn) ?
|
|
889
|
+
column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
874
890
|
}
|
|
875
891
|
}
|
|
876
892
|
return handleEditCell($xeTable, row, column, isPos)
|
|
@@ -886,33 +902,48 @@ export default {
|
|
|
886
902
|
* 激活单元格编辑
|
|
887
903
|
*/
|
|
888
904
|
_setEditCell (row: any, fieldOrColumn: any) {
|
|
889
|
-
const $xeTable = this
|
|
905
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
890
906
|
|
|
891
907
|
return handleEditCell($xeTable, row, fieldOrColumn, true)
|
|
892
908
|
},
|
|
893
909
|
/**
|
|
894
910
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
895
911
|
*/
|
|
896
|
-
_setSelectCell (row: any, fieldOrColumn:
|
|
897
|
-
const
|
|
898
|
-
const
|
|
912
|
+
_setSelectCell (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
913
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
914
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
915
|
+
|
|
916
|
+
const { tableData } = reactData
|
|
917
|
+
const editOpts = $xeTable.computeEditOpts
|
|
918
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
899
919
|
if (row && column && editOpts.trigger !== 'manual') {
|
|
900
|
-
const rowIndex =
|
|
920
|
+
const rowIndex = $xeTable.findRowIndexOf(tableData, row)
|
|
901
921
|
if (rowIndex > -1) {
|
|
902
|
-
const cell =
|
|
903
|
-
const params = {
|
|
904
|
-
|
|
922
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
923
|
+
const params = {
|
|
924
|
+
row,
|
|
925
|
+
rowIndex,
|
|
926
|
+
column,
|
|
927
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
928
|
+
cell
|
|
929
|
+
}
|
|
930
|
+
$xeTable.handleSelected(params, {})
|
|
905
931
|
}
|
|
906
932
|
}
|
|
907
|
-
return
|
|
933
|
+
return $xeTable.$nextTick()
|
|
908
934
|
},
|
|
909
935
|
/**
|
|
910
936
|
* 处理选中源
|
|
911
937
|
*/
|
|
912
938
|
handleSelected (params: any, evnt: any) {
|
|
913
|
-
const $xeTable = this
|
|
939
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
940
|
+
const props = $xeTable
|
|
941
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
914
942
|
|
|
915
|
-
const { mouseConfig
|
|
943
|
+
const { mouseConfig } = props
|
|
944
|
+
const { editStore } = reactData
|
|
945
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
946
|
+
const editOpts = $xeTable.computeEditOpts
|
|
916
947
|
const { actived, selected } = editStore
|
|
917
948
|
const { row, column } = params
|
|
918
949
|
const isMouseSelected = mouseConfig && mouseOpts.selected
|
|
@@ -920,22 +951,24 @@ export default {
|
|
|
920
951
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
921
952
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
922
953
|
handleClearEdit($xeTable, evnt)
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
954
|
+
$xeTable.clearSelected()
|
|
955
|
+
if ($xeTable.clearCellAreas) {
|
|
956
|
+
$xeTable.clearCellAreas()
|
|
957
|
+
$xeTable.clearCopyCellArea()
|
|
958
|
+
}
|
|
926
959
|
selected.args = params
|
|
927
960
|
selected.row = row
|
|
928
961
|
selected.column = column
|
|
929
962
|
if (isMouseSelected) {
|
|
930
963
|
this.addCellSelectedClass()
|
|
931
964
|
}
|
|
932
|
-
|
|
965
|
+
$xeTable.focus()
|
|
933
966
|
if (evnt) {
|
|
934
|
-
|
|
967
|
+
$xeTable.dispatchEvent('cell-selected', params, evnt)
|
|
935
968
|
}
|
|
936
969
|
}
|
|
937
970
|
}
|
|
938
|
-
return
|
|
971
|
+
return $xeTable.$nextTick()
|
|
939
972
|
}
|
|
940
973
|
return selectMethod()
|
|
941
974
|
},
|
|
@@ -943,7 +976,11 @@ export default {
|
|
|
943
976
|
* 获取选中的单元格
|
|
944
977
|
*/
|
|
945
978
|
_getSelectedCell () {
|
|
946
|
-
const
|
|
979
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
980
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
981
|
+
|
|
982
|
+
const { editStore } = reactData
|
|
983
|
+
const { args, column } = editStore.selected
|
|
947
984
|
if (args && column) {
|
|
948
985
|
return Object.assign({}, args)
|
|
949
986
|
}
|
|
@@ -953,14 +990,15 @@ export default {
|
|
|
953
990
|
* 清除所选中源状态
|
|
954
991
|
*/
|
|
955
992
|
_clearSelected () {
|
|
956
|
-
const $xeTable = this
|
|
993
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
994
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
957
995
|
|
|
958
|
-
const {
|
|
996
|
+
const { editStore } = reactData
|
|
997
|
+
const { selected } = editStore
|
|
959
998
|
selected.row = null
|
|
960
999
|
selected.column = null
|
|
961
|
-
this.reColTitleSdCls()
|
|
962
1000
|
removeCellSelectedClass($xeTable)
|
|
963
|
-
return
|
|
1001
|
+
return $xeTable.$nextTick()
|
|
964
1002
|
},
|
|
965
1003
|
reColTitleSdCls () {
|
|
966
1004
|
const headerElem = this.elemStore['main-header-list']
|
|
@@ -969,8 +1007,8 @@ export default {
|
|
|
969
1007
|
}
|
|
970
1008
|
},
|
|
971
1009
|
addCellSelectedClass () {
|
|
972
|
-
const $xeTable = this
|
|
973
|
-
const reactData = $xeTable as TableReactData
|
|
1010
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1011
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
974
1012
|
|
|
975
1013
|
const { editStore } = reactData
|
|
976
1014
|
const { selected } = editStore
|
|
@@ -5,7 +5,7 @@ import { scrollToView } from '../../../ui/src/dom'
|
|
|
5
5
|
import { handleFieldOrColumn, getRowid } from '../../src/util'
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
7
7
|
|
|
8
|
-
import type { VxeTableDefines,
|
|
8
|
+
import type { VxeTableDefines, TableInternalData } from '../../../../types'
|
|
9
9
|
|
|
10
10
|
const { getConfig, validators } = VxeUI
|
|
11
11
|
|
|
@@ -156,14 +156,11 @@ export default {
|
|
|
156
156
|
beginValidate (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull: any) {
|
|
157
157
|
const $xeTable = this
|
|
158
158
|
const props = $xeTable
|
|
159
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
160
159
|
const internalData = $xeTable as unknown as TableInternalData
|
|
161
160
|
|
|
162
161
|
const validRest: any = {}
|
|
163
162
|
const { editRules, treeConfig } = props
|
|
164
|
-
const {
|
|
165
|
-
const { afterFullData, pendingRowMaps } = internalData
|
|
166
|
-
const { removeMaps } = editStore
|
|
163
|
+
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData
|
|
167
164
|
const treeOpts = $xeTable.computeTreeOpts
|
|
168
165
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
169
166
|
let validList
|
|
@@ -189,7 +186,7 @@ export default {
|
|
|
189
186
|
const handleVaild = (row: any) => {
|
|
190
187
|
const rowid = getRowid($xeTable, row)
|
|
191
188
|
// 是否删除
|
|
192
|
-
if (
|
|
189
|
+
if (removeRowMaps[rowid]) {
|
|
193
190
|
return
|
|
194
191
|
}
|
|
195
192
|
// 是否标记删除
|
|
@@ -465,9 +465,12 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
|
|
|
465
465
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
466
466
|
tableData.forEach((row, $rowIndex) => {
|
|
467
467
|
const trOn: Record<string, any> = {}
|
|
468
|
+
const rowid = handleGetRowId(row)
|
|
469
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
468
470
|
let rowIndex = $rowIndex
|
|
469
|
-
|
|
470
|
-
|
|
471
|
+
let rowLevel = 0
|
|
472
|
+
let seq: string | number = -1
|
|
473
|
+
let _rowIndex = -1
|
|
471
474
|
// 当前行事件
|
|
472
475
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
473
476
|
trOn.mouseenter = (evnt: MouseEvent) => {
|
|
@@ -483,11 +486,6 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
|
|
|
483
486
|
$xeTable.clearHoverRow()
|
|
484
487
|
}
|
|
485
488
|
}
|
|
486
|
-
const rowid = handleGetRowId(row)
|
|
487
|
-
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
488
|
-
let rowLevel = 0
|
|
489
|
-
let seq: string | number = -1
|
|
490
|
-
let _rowIndex = 0
|
|
491
489
|
if (rowRest) {
|
|
492
490
|
rowLevel = rowRest.level
|
|
493
491
|
if (treeConfig && transform && seqMode === 'increasing') {
|
|
@@ -495,6 +493,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
|
|
|
495
493
|
} else {
|
|
496
494
|
seq = rowRest.seq
|
|
497
495
|
}
|
|
496
|
+
rowIndex = rowRest.index
|
|
498
497
|
_rowIndex = rowRest._index
|
|
499
498
|
}
|
|
500
499
|
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|