vxe-table 3.6.10-beta.0 → 3.6.10
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/lib/grid/src/grid.js +89 -22
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/icon/style/{iconfont.1673016554584.ttf → iconfont.1676471822832.ttf} +0 -0
- package/lib/icon/style/{iconfont.1673016554584.woff → iconfont.1676471822832.woff} +0 -0
- package/lib/icon/style/{iconfont.1673016554584.woff2 → iconfont.1676471822832.woff2} +0 -0
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/{iconfont.1673016554584.ttf → iconfont.1676471822832.ttf} +0 -0
- package/lib/{iconfont.1673016554584.woff → iconfont.1676471822832.woff} +0 -0
- package/lib/{iconfont.1673016554584.woff2 → iconfont.1676471822832.woff2} +0 -0
- package/lib/index.css +1 -1
- package/lib/index.umd.js +194 -103
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +4 -4
- package/lib/input/src/input.min.js +1 -1
- package/lib/list/src/list.js +22 -16
- package/lib/list/src/list.min.js +1 -1
- package/lib/pager/src/pager.js +12 -11
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +59 -45
- package/lib/table/src/methods.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +4 -2
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/package.json +2 -1
- package/packages/grid/src/grid.js +41 -15
- package/packages/input/src/input.js +4 -4
- package/packages/list/src/list.js +3 -0
- package/packages/pager/src/pager.js +8 -7
- package/packages/table/src/methods.js +54 -41
- package/packages/toolbar/src/toolbar.js +2 -2
|
@@ -452,7 +452,9 @@ export default {
|
|
|
452
452
|
}
|
|
453
453
|
if (!proxyInited && proxyOpts.autoLoad !== false) {
|
|
454
454
|
this.proxyInited = true
|
|
455
|
-
this.$nextTick(() => this.commitProxy('_init'))
|
|
455
|
+
this.$nextTick().then(() => this.commitProxy('_init')).then((rest) => {
|
|
456
|
+
this.$emit('proxy-query', { ...rest, isInited: true, $grid: this, $event: new Event('init') })
|
|
457
|
+
})
|
|
456
458
|
}
|
|
457
459
|
}
|
|
458
460
|
},
|
|
@@ -483,11 +485,9 @@ export default {
|
|
|
483
485
|
const btnParams = button ? button.params : null
|
|
484
486
|
switch (code) {
|
|
485
487
|
case 'insert':
|
|
486
|
-
this.insert()
|
|
487
|
-
break
|
|
488
|
+
return this.insert()
|
|
488
489
|
case 'insert_actived':
|
|
489
|
-
this.insert().then(({ row }) => this.setActiveRow(row))
|
|
490
|
-
break
|
|
490
|
+
return this.insert().then(({ row }) => this.setActiveRow(row))
|
|
491
491
|
case 'mark_cancel':
|
|
492
492
|
this.triggerPendingEvent(code)
|
|
493
493
|
break
|
|
@@ -555,6 +555,8 @@ export default {
|
|
|
555
555
|
const params = {
|
|
556
556
|
code,
|
|
557
557
|
button,
|
|
558
|
+
isInited,
|
|
559
|
+
isReload,
|
|
558
560
|
$grid: this,
|
|
559
561
|
page: pageParams,
|
|
560
562
|
sort: sortList.length ? sortList[0] : {},
|
|
@@ -568,7 +570,6 @@ export default {
|
|
|
568
570
|
this.tableLoading = true
|
|
569
571
|
const applyArgs = [params].concat(args)
|
|
570
572
|
return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs))
|
|
571
|
-
.catch(e => e)
|
|
572
573
|
.then(rest => {
|
|
573
574
|
this.tableLoading = false
|
|
574
575
|
if (rest) {
|
|
@@ -590,6 +591,9 @@ export default {
|
|
|
590
591
|
if (afterQuery) {
|
|
591
592
|
afterQuery(...applyArgs)
|
|
592
593
|
}
|
|
594
|
+
return { status: true }
|
|
595
|
+
}).catch(() => {
|
|
596
|
+
return { status: false }
|
|
593
597
|
})
|
|
594
598
|
} else {
|
|
595
599
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
@@ -629,6 +633,7 @@ export default {
|
|
|
629
633
|
} else {
|
|
630
634
|
this.commitProxy('query')
|
|
631
635
|
}
|
|
636
|
+
return { status: true }
|
|
632
637
|
})
|
|
633
638
|
.catch(rest => {
|
|
634
639
|
this.tableLoading = false
|
|
@@ -641,6 +646,7 @@ export default {
|
|
|
641
646
|
}
|
|
642
647
|
VXETable.modal.message({ id: code, content: this.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
643
648
|
}
|
|
649
|
+
return { status: false }
|
|
644
650
|
})
|
|
645
651
|
})
|
|
646
652
|
} else {
|
|
@@ -705,6 +711,7 @@ export default {
|
|
|
705
711
|
} else {
|
|
706
712
|
this.commitProxy('query')
|
|
707
713
|
}
|
|
714
|
+
return { status: true }
|
|
708
715
|
})
|
|
709
716
|
.catch(rest => {
|
|
710
717
|
this.tableLoading = false
|
|
@@ -717,6 +724,7 @@ export default {
|
|
|
717
724
|
}
|
|
718
725
|
VXETable.modal.message({ id: code, content: this.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
719
726
|
}
|
|
727
|
+
return { status: false }
|
|
720
728
|
})
|
|
721
729
|
} else {
|
|
722
730
|
if (isMsg) {
|
|
@@ -760,7 +768,7 @@ export default {
|
|
|
760
768
|
if (selectRecords.length) {
|
|
761
769
|
return VXETable.modal.confirm({ id: `cfm_${code}`, content: GlobalConfig.i18n(alertKey), escClosable: true }).then(type => {
|
|
762
770
|
if (type === 'confirm') {
|
|
763
|
-
callback()
|
|
771
|
+
return callback()
|
|
764
772
|
}
|
|
765
773
|
})
|
|
766
774
|
} else {
|
|
@@ -790,12 +798,20 @@ export default {
|
|
|
790
798
|
getPendingRecords () {
|
|
791
799
|
return this.pendingRecords
|
|
792
800
|
},
|
|
801
|
+
triggerToolbarCommitEvent (params, evnt) {
|
|
802
|
+
const { code } = params
|
|
803
|
+
return this.commitProxy(params, evnt).then((rest) => {
|
|
804
|
+
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
805
|
+
this.$emit(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', { ...rest, isReload: code === 'reload', $grid: this, $event: evnt })
|
|
806
|
+
}
|
|
807
|
+
})
|
|
808
|
+
},
|
|
793
809
|
triggerToolbarBtnEvent (button, evnt) {
|
|
794
|
-
this.
|
|
795
|
-
this.$emit('toolbar-button-click', { code: button.code,
|
|
810
|
+
this.triggerToolbarCommitEvent(button, evnt)
|
|
811
|
+
this.$emit('toolbar-button-click', { code: button.code, $grid: this, $event: evnt })
|
|
796
812
|
},
|
|
797
813
|
triggerToolbarTolEvent (tool, evnt) {
|
|
798
|
-
this.
|
|
814
|
+
this.triggerToolbarCommitEvent(tool, evnt)
|
|
799
815
|
this.$emit('toolbar-tool-click', { code: tool.code, tool, $grid: this, $event: evnt })
|
|
800
816
|
},
|
|
801
817
|
triggerPendingEvent (code) {
|
|
@@ -836,7 +852,9 @@ export default {
|
|
|
836
852
|
tablePage.pageSize = pageSize
|
|
837
853
|
this.$emit('page-change', Object.assign({ $grid: this }, params))
|
|
838
854
|
if (proxyConfig) {
|
|
839
|
-
this.commitProxy('query')
|
|
855
|
+
this.commitProxy('query').then((rest) => {
|
|
856
|
+
this.$emit('proxy-query', { ...rest, $grid: this, $event: params.$event })
|
|
857
|
+
})
|
|
840
858
|
}
|
|
841
859
|
},
|
|
842
860
|
sortChangeEvent (params) {
|
|
@@ -847,7 +865,9 @@ export default {
|
|
|
847
865
|
this.sortData = sortList
|
|
848
866
|
if (this.proxyConfig) {
|
|
849
867
|
this.tablePage.currentPage = 1
|
|
850
|
-
this.commitProxy('query')
|
|
868
|
+
this.commitProxy('query').then((rest) => {
|
|
869
|
+
this.$emit('proxy-query', { ...rest, $grid: this, $event: params.$event })
|
|
870
|
+
})
|
|
851
871
|
}
|
|
852
872
|
}
|
|
853
873
|
this.$emit('sort-change', Object.assign({ $grid: this }, params))
|
|
@@ -859,7 +879,9 @@ export default {
|
|
|
859
879
|
this.filterData = filterList
|
|
860
880
|
if (this.proxyConfig) {
|
|
861
881
|
this.tablePage.currentPage = 1
|
|
862
|
-
this.commitProxy('query')
|
|
882
|
+
this.commitProxy('query').then((rest) => {
|
|
883
|
+
this.$emit('proxy-query', { ...rest, $grid: this, $event: params.$event })
|
|
884
|
+
})
|
|
863
885
|
}
|
|
864
886
|
}
|
|
865
887
|
this.$emit('filter-change', Object.assign({ $grid: this }, params))
|
|
@@ -867,14 +889,18 @@ export default {
|
|
|
867
889
|
submitEvent (params) {
|
|
868
890
|
const { proxyConfig } = this
|
|
869
891
|
if (proxyConfig) {
|
|
870
|
-
this.commitProxy('reload')
|
|
892
|
+
this.commitProxy('reload').then((rest) => {
|
|
893
|
+
this.$emit('proxy-query', { ...rest, isReload: true, $grid: this, $event: params.$event })
|
|
894
|
+
})
|
|
871
895
|
}
|
|
872
896
|
this.$emit('form-submit', Object.assign({ $grid: this }, params))
|
|
873
897
|
},
|
|
874
898
|
resetEvent (params) {
|
|
875
899
|
const { proxyConfig } = this
|
|
876
900
|
if (proxyConfig) {
|
|
877
|
-
this.commitProxy('reload')
|
|
901
|
+
this.commitProxy('reload').then((rest) => {
|
|
902
|
+
this.$emit('proxy-query', { ...rest, isReload: true, $grid: this, $event: params.$event })
|
|
903
|
+
})
|
|
878
904
|
}
|
|
879
905
|
this.$emit('form-reset', Object.assign({ $grid: this }, params))
|
|
880
906
|
},
|
|
@@ -1234,6 +1234,10 @@ export default {
|
|
|
1234
1234
|
},
|
|
1235
1235
|
focusEvent (evnt) {
|
|
1236
1236
|
this.isActivated = true
|
|
1237
|
+
const { isDatePickerType } = this
|
|
1238
|
+
if (isDatePickerType) {
|
|
1239
|
+
this.datePickerOpenEvent(evnt)
|
|
1240
|
+
}
|
|
1237
1241
|
this.triggerEvent(evnt)
|
|
1238
1242
|
},
|
|
1239
1243
|
blurEvent (evnt) {
|
|
@@ -1279,10 +1283,6 @@ export default {
|
|
|
1279
1283
|
this.triggerEvent(evnt)
|
|
1280
1284
|
},
|
|
1281
1285
|
clickEvent (evnt) {
|
|
1282
|
-
const { isDatePickerType } = this
|
|
1283
|
-
if (isDatePickerType) {
|
|
1284
|
-
this.datePickerOpenEvent(evnt)
|
|
1285
|
-
}
|
|
1286
1286
|
this.triggerEvent(evnt)
|
|
1287
1287
|
},
|
|
1288
1288
|
clickPrefixEvent (evnt) {
|
|
@@ -376,13 +376,14 @@ export default {
|
|
|
376
376
|
}
|
|
377
377
|
},
|
|
378
378
|
pageSizeEvent (pageSize) {
|
|
379
|
-
this.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
this.$emit('update:
|
|
384
|
-
this.$emit('page-change', { type: 'size', pageSize, currentPage: Math.min(this.currentPage, this.getPageCount(this.total, pageSize)) })
|
|
379
|
+
const pageCount = this.getPageCount(this.total, pageSize)
|
|
380
|
+
let currentPage = this.currentPage
|
|
381
|
+
if (currentPage > pageCount) {
|
|
382
|
+
currentPage = pageCount
|
|
383
|
+
this.$emit('update:currentPage', pageCount)
|
|
385
384
|
}
|
|
385
|
+
this.$emit('update:pageSize', pageSize)
|
|
386
|
+
this.$emit('page-change', { type: 'size', pageSize, currentPage })
|
|
386
387
|
},
|
|
387
388
|
jumpInputEvent (evnt) {
|
|
388
389
|
this.inpCurrPage = evnt.target.value
|
|
@@ -399,7 +400,7 @@ export default {
|
|
|
399
400
|
}
|
|
400
401
|
},
|
|
401
402
|
triggerJumpEvent (evnt) {
|
|
402
|
-
const value = XEUtils.
|
|
403
|
+
const value = XEUtils.toInteger(evnt.target.value)
|
|
403
404
|
const current = value <= 0 ? 1 : value >= this.pageCount ? this.pageCount : value
|
|
404
405
|
evnt.target.value = current
|
|
405
406
|
this.jumpPage(current)
|
|
@@ -2738,7 +2738,7 @@ const Methods = {
|
|
|
2738
2738
|
const { fullDataRowIdData, checkboxOpts } = this
|
|
2739
2739
|
const { checkAll, checkRowKeys } = checkboxOpts
|
|
2740
2740
|
if (checkAll) {
|
|
2741
|
-
this.
|
|
2741
|
+
this.handleCheckedAllCheckboxRow(true, true)
|
|
2742
2742
|
} else if (checkRowKeys) {
|
|
2743
2743
|
const defSelection = []
|
|
2744
2744
|
checkRowKeys.forEach(rowid => {
|
|
@@ -2746,20 +2746,23 @@ const Methods = {
|
|
|
2746
2746
|
defSelection.push(fullDataRowIdData[rowid].row)
|
|
2747
2747
|
}
|
|
2748
2748
|
})
|
|
2749
|
-
this.
|
|
2749
|
+
this.handleCheckedCheckboxRow(defSelection, true, true)
|
|
2750
2750
|
}
|
|
2751
2751
|
},
|
|
2752
|
+
handleCheckedCheckboxRow (rows, value, isForce) {
|
|
2753
|
+
if (rows && !XEUtils.isArray(rows)) {
|
|
2754
|
+
rows = [rows]
|
|
2755
|
+
}
|
|
2756
|
+
rows.forEach(row => this.handleSelectRow({ row }, !!value, isForce))
|
|
2757
|
+
return this.$nextTick()
|
|
2758
|
+
},
|
|
2752
2759
|
/**
|
|
2753
2760
|
* 用于多选行,设置行为选中状态,第二个参数为选中与否
|
|
2754
2761
|
* @param {Array/Row} rows 行数据
|
|
2755
2762
|
* @param {Boolean} value 是否选中
|
|
2756
2763
|
*/
|
|
2757
2764
|
setCheckboxRow (rows, value) {
|
|
2758
|
-
|
|
2759
|
-
rows = [rows]
|
|
2760
|
-
}
|
|
2761
|
-
rows.forEach(row => this.handleSelectRow({ row }, !!value))
|
|
2762
|
-
return this.$nextTick()
|
|
2765
|
+
return this.handleCheckedCheckboxRow(rows, value, true)
|
|
2763
2766
|
},
|
|
2764
2767
|
isCheckedByCheckboxRow (row) {
|
|
2765
2768
|
const { selection } = this
|
|
@@ -2777,7 +2780,7 @@ const Methods = {
|
|
|
2777
2780
|
* 多选,行选中事件
|
|
2778
2781
|
* value 选中true 不选false 半选-1
|
|
2779
2782
|
*/
|
|
2780
|
-
handleSelectRow ({ row }, value) {
|
|
2783
|
+
handleSelectRow ({ row }, value, isForce) {
|
|
2781
2784
|
const { selection, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
|
|
2782
2785
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
2783
2786
|
if (checkField) {
|
|
@@ -2790,7 +2793,7 @@ const Methods = {
|
|
|
2790
2793
|
} else {
|
|
2791
2794
|
// 更新子节点状态
|
|
2792
2795
|
XEUtils.eachTree([row], (item) => {
|
|
2793
|
-
if (this.eqRow(item, row) || (!checkMethod || checkMethod({ row: item }))) {
|
|
2796
|
+
if (this.eqRow(item, row) || (isForce || (!checkMethod || checkMethod({ row: item })))) {
|
|
2794
2797
|
XEUtils.set(item, checkField, value)
|
|
2795
2798
|
XEUtils.remove(treeIndeterminates, half => this.eqRow(half, item))
|
|
2796
2799
|
this.handleCheckboxReserveRow(row, value)
|
|
@@ -2801,7 +2804,7 @@ const Methods = {
|
|
|
2801
2804
|
const matchObj = XEUtils.findTree(afterFullData, item => this.eqRow(item, row), treeOpts)
|
|
2802
2805
|
if (matchObj && matchObj.parent) {
|
|
2803
2806
|
let parentStatus
|
|
2804
|
-
const vItems = checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
|
|
2807
|
+
const vItems = !isForce && checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
|
|
2805
2808
|
const indeterminatesItem = XEUtils.find(matchObj.items, item => this.findRowIndexOf(treeIndeterminates, item) > -1)
|
|
2806
2809
|
if (indeterminatesItem) {
|
|
2807
2810
|
parentStatus = -1
|
|
@@ -2809,10 +2812,10 @@ const Methods = {
|
|
|
2809
2812
|
const selectItems = matchObj.items.filter(item => XEUtils.get(item, checkField))
|
|
2810
2813
|
parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
|
|
2811
2814
|
}
|
|
2812
|
-
return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
|
|
2815
|
+
return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
|
|
2813
2816
|
}
|
|
2814
2817
|
} else {
|
|
2815
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2818
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2816
2819
|
XEUtils.set(row, checkField, value)
|
|
2817
2820
|
this.handleCheckboxReserveRow(row, value)
|
|
2818
2821
|
}
|
|
@@ -2827,7 +2830,7 @@ const Methods = {
|
|
|
2827
2830
|
} else {
|
|
2828
2831
|
// 更新子节点状态
|
|
2829
2832
|
XEUtils.eachTree([row], (item) => {
|
|
2830
|
-
if (this.eqRow(item, row) || (!checkMethod || checkMethod({ row: item }))) {
|
|
2833
|
+
if (this.eqRow(item, row) || (isForce && (!checkMethod || checkMethod({ row: item })))) {
|
|
2831
2834
|
if (value) {
|
|
2832
2835
|
selection.push(item)
|
|
2833
2836
|
} else {
|
|
@@ -2842,7 +2845,7 @@ const Methods = {
|
|
|
2842
2845
|
const matchObj = XEUtils.findTree(afterFullData, item => this.eqRow(item, row), treeOpts)
|
|
2843
2846
|
if (matchObj && matchObj.parent) {
|
|
2844
2847
|
let parentStatus
|
|
2845
|
-
const vItems = checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
|
|
2848
|
+
const vItems = !isForce && checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
|
|
2846
2849
|
const indeterminatesItem = XEUtils.find(matchObj.items, item => this.findRowIndexOf(treeIndeterminates, item) > -1)
|
|
2847
2850
|
if (indeterminatesItem) {
|
|
2848
2851
|
parentStatus = -1
|
|
@@ -2850,10 +2853,10 @@ const Methods = {
|
|
|
2850
2853
|
const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selection, item) > -1)
|
|
2851
2854
|
parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
|
|
2852
2855
|
}
|
|
2853
|
-
return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
|
|
2856
|
+
return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
|
|
2854
2857
|
}
|
|
2855
2858
|
} else {
|
|
2856
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2859
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2857
2860
|
if (value) {
|
|
2858
2861
|
if (this.findRowIndexOf(selection, row) === -1) {
|
|
2859
2862
|
selection.push(row)
|
|
@@ -2894,14 +2897,13 @@ const Methods = {
|
|
|
2894
2897
|
* 多选,切换某一行的选中状态
|
|
2895
2898
|
*/
|
|
2896
2899
|
toggleCheckboxRow (row) {
|
|
2897
|
-
|
|
2900
|
+
const { selection, checkboxOpts } = this
|
|
2901
|
+
const { checkField } = checkboxOpts
|
|
2902
|
+
const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selection, row) === -1
|
|
2903
|
+
this.handleSelectRow({ row }, value, true)
|
|
2898
2904
|
return this.$nextTick()
|
|
2899
2905
|
},
|
|
2900
|
-
|
|
2901
|
-
* 用于多选行,设置所有行的选中状态
|
|
2902
|
-
* @param {Boolean} value 是否选中
|
|
2903
|
-
*/
|
|
2904
|
-
setAllCheckboxRow (value) {
|
|
2906
|
+
handleCheckedAllCheckboxRow (value, isForce) {
|
|
2905
2907
|
const { afterFullData, treeConfig, treeOpts, selection, checkboxReserveRowMap, checkboxOpts } = this
|
|
2906
2908
|
const { checkField, reserve, checkStrictly, checkMethod } = checkboxOpts
|
|
2907
2909
|
let selectRows = []
|
|
@@ -2915,7 +2917,7 @@ const Methods = {
|
|
|
2915
2917
|
*/
|
|
2916
2918
|
if (checkField) {
|
|
2917
2919
|
const checkValFn = (row) => {
|
|
2918
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2920
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2919
2921
|
if (value) {
|
|
2920
2922
|
selectRows.push(row)
|
|
2921
2923
|
}
|
|
@@ -2941,7 +2943,7 @@ const Methods = {
|
|
|
2941
2943
|
* 如果方法成立,则添加到临时集合中
|
|
2942
2944
|
*/
|
|
2943
2945
|
XEUtils.eachTree(afterFullData, (row) => {
|
|
2944
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2946
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2945
2947
|
selectRows.push(row)
|
|
2946
2948
|
}
|
|
2947
2949
|
}, treeOpts)
|
|
@@ -2950,7 +2952,7 @@ const Methods = {
|
|
|
2950
2952
|
* 如果是树取消
|
|
2951
2953
|
* 如果方法成立,则不添加到临时集合中
|
|
2952
2954
|
*/
|
|
2953
|
-
if (checkMethod) {
|
|
2955
|
+
if (!isForce && checkMethod) {
|
|
2954
2956
|
XEUtils.eachTree(afterFullData, (row) => {
|
|
2955
2957
|
if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1) {
|
|
2956
2958
|
selectRows.push(row)
|
|
@@ -2965,7 +2967,7 @@ const Methods = {
|
|
|
2965
2967
|
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
2966
2968
|
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
2967
2969
|
*/
|
|
2968
|
-
if (checkMethod) {
|
|
2970
|
+
if (!isForce && checkMethod) {
|
|
2969
2971
|
selectRows = afterFullData.filter((row) => this.findRowIndexOf(selection, row) > -1 || checkMethod({ row }))
|
|
2970
2972
|
} else {
|
|
2971
2973
|
selectRows = afterFullData.slice(0)
|
|
@@ -2976,7 +2978,7 @@ const Methods = {
|
|
|
2976
2978
|
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
2977
2979
|
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
2978
2980
|
*/
|
|
2979
|
-
if (checkMethod) {
|
|
2981
|
+
if (!isForce && checkMethod) {
|
|
2980
2982
|
selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1)
|
|
2981
2983
|
}
|
|
2982
2984
|
}
|
|
@@ -2995,6 +2997,14 @@ const Methods = {
|
|
|
2995
2997
|
}
|
|
2996
2998
|
this.treeIndeterminates = []
|
|
2997
2999
|
this.checkSelectionStatus()
|
|
3000
|
+
return this.$nextTick()
|
|
3001
|
+
},
|
|
3002
|
+
/**
|
|
3003
|
+
* 用于多选行,设置所有行的选中状态
|
|
3004
|
+
* @param {Boolean} value 是否选中
|
|
3005
|
+
*/
|
|
3006
|
+
setAllCheckboxRow (value) {
|
|
3007
|
+
return this.handleCheckedAllCheckboxRow(value, true)
|
|
2998
3008
|
},
|
|
2999
3009
|
checkSelectionStatus () {
|
|
3000
3010
|
const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
|
|
@@ -3073,14 +3083,14 @@ const Methods = {
|
|
|
3073
3083
|
if (radioOpts.reserve && radioReserveRow) {
|
|
3074
3084
|
const rowid = getRowid(this, radioReserveRow)
|
|
3075
3085
|
if (fullDataRowIdData[rowid]) {
|
|
3076
|
-
this.
|
|
3086
|
+
this.handleCheckedRadioRow(fullDataRowIdData[rowid].row, true)
|
|
3077
3087
|
}
|
|
3078
3088
|
}
|
|
3079
3089
|
// 复选框
|
|
3080
3090
|
this.selection = getRecoverRow(this, selection) // 刷新多选行状态
|
|
3081
3091
|
// 还原保留选中状态
|
|
3082
3092
|
if (checkboxOpts.reserve) {
|
|
3083
|
-
this.
|
|
3093
|
+
this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true)
|
|
3084
3094
|
}
|
|
3085
3095
|
if (currentRow && !fullAllDataRowMap.has(currentRow)) {
|
|
3086
3096
|
this.currentRow = null // 刷新当前行状态
|
|
@@ -3186,7 +3196,7 @@ const Methods = {
|
|
|
3186
3196
|
* 多选,选中所有事件
|
|
3187
3197
|
*/
|
|
3188
3198
|
triggerCheckAllEvent (evnt, value) {
|
|
3189
|
-
this.
|
|
3199
|
+
this.handleCheckedAllCheckboxRow(value)
|
|
3190
3200
|
this.emitEvent('checkbox-all', { records: this.getCheckboxRecords(), reserves: this.getCheckboxReserveRecords(), indeterminates: this.getCheckboxIndeterminateRecords(), checked: value }, evnt)
|
|
3191
3201
|
},
|
|
3192
3202
|
/**
|
|
@@ -3227,7 +3237,7 @@ const Methods = {
|
|
|
3227
3237
|
const { checkRowKey: rowid, reserve } = radioOpts
|
|
3228
3238
|
if (rowid) {
|
|
3229
3239
|
if (fullDataRowIdData[rowid]) {
|
|
3230
|
-
this.
|
|
3240
|
+
this.handleCheckedRadioRow(fullDataRowIdData[rowid].row, true)
|
|
3231
3241
|
}
|
|
3232
3242
|
if (reserve) {
|
|
3233
3243
|
const rowkey = getRowkey(this)
|
|
@@ -3244,7 +3254,7 @@ const Methods = {
|
|
|
3244
3254
|
let newValue = row
|
|
3245
3255
|
let isChange = oldValue !== newValue
|
|
3246
3256
|
if (isChange) {
|
|
3247
|
-
this.
|
|
3257
|
+
this.handleCheckedRadioRow(newValue)
|
|
3248
3258
|
} else if (!radioOpts.strict) {
|
|
3249
3259
|
isChange = oldValue === newValue
|
|
3250
3260
|
if (isChange) {
|
|
@@ -3272,7 +3282,7 @@ const Methods = {
|
|
|
3272
3282
|
setCurrentRow (row) {
|
|
3273
3283
|
const { $el, rowOpts } = this
|
|
3274
3284
|
this.clearCurrentRow()
|
|
3275
|
-
this.clearCurrentColumn()
|
|
3285
|
+
// this.clearCurrentColumn()
|
|
3276
3286
|
this.currentRow = row
|
|
3277
3287
|
if (rowOpts.isCurrent || this.highlightCurrentRow) {
|
|
3278
3288
|
if ($el) {
|
|
@@ -3284,19 +3294,22 @@ const Methods = {
|
|
|
3284
3294
|
isCheckedByRadioRow (row) {
|
|
3285
3295
|
return this.selectRow === row
|
|
3286
3296
|
},
|
|
3287
|
-
|
|
3288
|
-
* 用于单选行,设置某一行为选中状态
|
|
3289
|
-
* @param {Row} row 行对象
|
|
3290
|
-
*/
|
|
3291
|
-
setRadioRow (row) {
|
|
3297
|
+
handleCheckedRadioRow (row, isForce) {
|
|
3292
3298
|
const { radioOpts } = this
|
|
3293
3299
|
const { checkMethod } = radioOpts
|
|
3294
|
-
if (row && (!checkMethod || checkMethod({ row }))) {
|
|
3300
|
+
if (row && (isForce || (!checkMethod || checkMethod({ row })))) {
|
|
3295
3301
|
this.selectRow = row
|
|
3296
3302
|
this.handleRadioReserveRow(row)
|
|
3297
3303
|
}
|
|
3298
3304
|
return this.$nextTick()
|
|
3299
3305
|
},
|
|
3306
|
+
/**
|
|
3307
|
+
* 用于单选行,设置某一行为选中状态
|
|
3308
|
+
* @param {Row} row 行对象
|
|
3309
|
+
*/
|
|
3310
|
+
setRadioRow (row) {
|
|
3311
|
+
return this.handleCheckedRadioRow(row, true)
|
|
3312
|
+
},
|
|
3300
3313
|
/**
|
|
3301
3314
|
* 用于当前行,手动清空当前高亮的状态
|
|
3302
3315
|
*/
|
|
@@ -3400,7 +3413,7 @@ const Methods = {
|
|
|
3400
3413
|
setCurrentColumn (fieldOrColumn) {
|
|
3401
3414
|
const column = handleFieldOrColumn(this, fieldOrColumn)
|
|
3402
3415
|
if (column) {
|
|
3403
|
-
this.clearCurrentRow()
|
|
3416
|
+
// this.clearCurrentRow()
|
|
3404
3417
|
this.clearCurrentColumn()
|
|
3405
3418
|
this.currentColumn = column
|
|
3406
3419
|
}
|
|
@@ -4005,7 +4018,7 @@ const Methods = {
|
|
|
4005
4018
|
}
|
|
4006
4019
|
// 如果当前节点已选中,则展开后子节点也被选中
|
|
4007
4020
|
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
4008
|
-
this.
|
|
4021
|
+
this.handleCheckedCheckboxRow(childRows, true, true)
|
|
4009
4022
|
}
|
|
4010
4023
|
return this.$nextTick().then(() => {
|
|
4011
4024
|
if (transform) {
|
|
@@ -572,7 +572,7 @@ export default {
|
|
|
572
572
|
}
|
|
573
573
|
}, 300)
|
|
574
574
|
},
|
|
575
|
-
refreshEvent () {
|
|
575
|
+
refreshEvent (evnt) {
|
|
576
576
|
const { $xegrid, refreshOpts, isRefresh } = this
|
|
577
577
|
if (!isRefresh) {
|
|
578
578
|
const queryMethod = refreshOpts.queryMethod || refreshOpts.query
|
|
@@ -587,7 +587,7 @@ export default {
|
|
|
587
587
|
}
|
|
588
588
|
} else if ($xegrid) {
|
|
589
589
|
this.isRefresh = true
|
|
590
|
-
$xegrid.
|
|
590
|
+
$xegrid.triggerToolbarCommitEvent({ code: refreshOpts.code || 'reload' }, evnt).catch(e => e).then(() => {
|
|
591
591
|
this.isRefresh = false
|
|
592
592
|
})
|
|
593
593
|
}
|