vxe-table 3.6.9 → 3.6.10-beta.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/lib/grid/src/grid.js +89 -22
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/icon/style/{iconfont.1670947519373.ttf → iconfont.1676040570288.ttf} +0 -0
- package/lib/icon/style/{iconfont.1670947519373.woff → iconfont.1676040570288.woff} +0 -0
- package/lib/icon/style/{iconfont.1670947519373.woff2 → iconfont.1676040570288.woff2} +0 -0
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/{iconfont.1670947519373.ttf → iconfont.1676040570288.ttf} +0 -0
- package/lib/{iconfont.1670947519373.woff → iconfont.1676040570288.woff} +0 -0
- package/lib/{iconfont.1670947519373.woff2 → iconfont.1676040570288.woff2} +0 -0
- package/lib/index.css +1 -1
- package/lib/index.umd.js +245 -109
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +46 -8
- 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 +67 -47
- 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 +1 -1
- package/packages/grid/src/grid.js +41 -15
- package/packages/input/src/input.js +35 -8
- package/packages/list/src/list.js +3 -0
- package/packages/pager/src/pager.js +8 -7
- package/packages/table/src/methods.js +62 -43
- 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) {
|
|
@@ -1654,8 +1654,30 @@ export default {
|
|
|
1654
1654
|
this.dateTimeChangeEvent(evnt)
|
|
1655
1655
|
},
|
|
1656
1656
|
dateConfirmEvent () {
|
|
1657
|
-
|
|
1658
|
-
|
|
1657
|
+
const { datetimePanelValue, isDateTimeType, dateValueFormat, dateMultipleValue } = this
|
|
1658
|
+
if (this.isDateTimeType) {
|
|
1659
|
+
if (this.multiple) {
|
|
1660
|
+
// 如果为多选
|
|
1661
|
+
if (isDateTimeType) {
|
|
1662
|
+
// 如果是datetime特殊类型
|
|
1663
|
+
const { dateListValue } = this
|
|
1664
|
+
const datetimeRest = []
|
|
1665
|
+
dateListValue.forEach(item => {
|
|
1666
|
+
if (item) {
|
|
1667
|
+
item.setHours(datetimePanelValue.getHours())
|
|
1668
|
+
item.setMinutes(datetimePanelValue.getMinutes())
|
|
1669
|
+
item.setSeconds(datetimePanelValue.getSeconds())
|
|
1670
|
+
datetimeRest.push(item)
|
|
1671
|
+
}
|
|
1672
|
+
})
|
|
1673
|
+
this.emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
|
|
1674
|
+
} else {
|
|
1675
|
+
// 如果是日期类型
|
|
1676
|
+
this.emitModel(dateMultipleValue.join(','), { type: 'update' })
|
|
1677
|
+
}
|
|
1678
|
+
} else {
|
|
1679
|
+
this.dateChange(this.dateValue || this.currentDate)
|
|
1680
|
+
}
|
|
1659
1681
|
}
|
|
1660
1682
|
this.hidePanel()
|
|
1661
1683
|
},
|
|
@@ -1828,15 +1850,20 @@ export default {
|
|
|
1828
1850
|
// 如果是datetime特殊类型
|
|
1829
1851
|
const { dateListValue } = this
|
|
1830
1852
|
const datetimeRest = []
|
|
1853
|
+
const eqIndex = XEUtils.findIndexOf(dateListValue, val => XEUtils.isDateSame(date, val, 'yyyyMMdd'))
|
|
1854
|
+
if (eqIndex === -1) {
|
|
1855
|
+
dateListValue.push(date)
|
|
1856
|
+
} else {
|
|
1857
|
+
dateListValue.splice(eqIndex, 1)
|
|
1858
|
+
}
|
|
1831
1859
|
dateListValue.forEach(item => {
|
|
1832
|
-
if (item
|
|
1860
|
+
if (item) {
|
|
1833
1861
|
item.setHours(datetimePanelValue.getHours())
|
|
1834
1862
|
item.setMinutes(datetimePanelValue.getMinutes())
|
|
1835
1863
|
item.setSeconds(datetimePanelValue.getSeconds())
|
|
1836
1864
|
datetimeRest.push(item)
|
|
1837
1865
|
}
|
|
1838
1866
|
})
|
|
1839
|
-
datetimeRest.push(date)
|
|
1840
1867
|
this.emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
|
|
1841
1868
|
} else {
|
|
1842
1869
|
// 如果是日期类型
|
|
@@ -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)
|
|
@@ -2605,8 +2605,14 @@ const Methods = {
|
|
|
2605
2605
|
const { row, column } = params
|
|
2606
2606
|
const cell = evnt.currentTarget
|
|
2607
2607
|
this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row)
|
|
2608
|
-
|
|
2609
|
-
|
|
2608
|
+
// 单元格处于编辑状态时不触发提示框
|
|
2609
|
+
if (column.editRender && isEnableConf(editConfig)) {
|
|
2610
|
+
// 如果是行编辑模式
|
|
2611
|
+
if (editOpts.mode === 'row' && actived.row === row) {
|
|
2612
|
+
return
|
|
2613
|
+
}
|
|
2614
|
+
// 如果是单元格编辑模式
|
|
2615
|
+
if (actived.row === row && actived.column === column) {
|
|
2610
2616
|
return
|
|
2611
2617
|
}
|
|
2612
2618
|
}
|
|
@@ -2732,7 +2738,7 @@ const Methods = {
|
|
|
2732
2738
|
const { fullDataRowIdData, checkboxOpts } = this
|
|
2733
2739
|
const { checkAll, checkRowKeys } = checkboxOpts
|
|
2734
2740
|
if (checkAll) {
|
|
2735
|
-
this.
|
|
2741
|
+
this.handleCheckedAllCheckboxRow(true, true)
|
|
2736
2742
|
} else if (checkRowKeys) {
|
|
2737
2743
|
const defSelection = []
|
|
2738
2744
|
checkRowKeys.forEach(rowid => {
|
|
@@ -2740,8 +2746,15 @@ const Methods = {
|
|
|
2740
2746
|
defSelection.push(fullDataRowIdData[rowid].row)
|
|
2741
2747
|
}
|
|
2742
2748
|
})
|
|
2743
|
-
this.
|
|
2749
|
+
this.handleCheckedCheckboxRow(defSelection, true, true)
|
|
2750
|
+
}
|
|
2751
|
+
},
|
|
2752
|
+
handleCheckedCheckboxRow (rows, value, isForce) {
|
|
2753
|
+
if (rows && !XEUtils.isArray(rows)) {
|
|
2754
|
+
rows = [rows]
|
|
2744
2755
|
}
|
|
2756
|
+
rows.forEach(row => this.handleSelectRow({ row }, !!value, isForce))
|
|
2757
|
+
return this.$nextTick()
|
|
2745
2758
|
},
|
|
2746
2759
|
/**
|
|
2747
2760
|
* 用于多选行,设置行为选中状态,第二个参数为选中与否
|
|
@@ -2749,11 +2762,7 @@ const Methods = {
|
|
|
2749
2762
|
* @param {Boolean} value 是否选中
|
|
2750
2763
|
*/
|
|
2751
2764
|
setCheckboxRow (rows, value) {
|
|
2752
|
-
|
|
2753
|
-
rows = [rows]
|
|
2754
|
-
}
|
|
2755
|
-
rows.forEach(row => this.handleSelectRow({ row }, !!value))
|
|
2756
|
-
return this.$nextTick()
|
|
2765
|
+
return this.handleCheckedCheckboxRow(rows, value, true)
|
|
2757
2766
|
},
|
|
2758
2767
|
isCheckedByCheckboxRow (row) {
|
|
2759
2768
|
const { selection } = this
|
|
@@ -2771,7 +2780,7 @@ const Methods = {
|
|
|
2771
2780
|
* 多选,行选中事件
|
|
2772
2781
|
* value 选中true 不选false 半选-1
|
|
2773
2782
|
*/
|
|
2774
|
-
handleSelectRow ({ row }, value) {
|
|
2783
|
+
handleSelectRow ({ row }, value, isForce) {
|
|
2775
2784
|
const { selection, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
|
|
2776
2785
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
2777
2786
|
if (checkField) {
|
|
@@ -2784,7 +2793,7 @@ const Methods = {
|
|
|
2784
2793
|
} else {
|
|
2785
2794
|
// 更新子节点状态
|
|
2786
2795
|
XEUtils.eachTree([row], (item) => {
|
|
2787
|
-
if (this.eqRow(item, row) || (!checkMethod || checkMethod({ row: item }))) {
|
|
2796
|
+
if (this.eqRow(item, row) || (isForce || (!checkMethod || checkMethod({ row: item })))) {
|
|
2788
2797
|
XEUtils.set(item, checkField, value)
|
|
2789
2798
|
XEUtils.remove(treeIndeterminates, half => this.eqRow(half, item))
|
|
2790
2799
|
this.handleCheckboxReserveRow(row, value)
|
|
@@ -2795,7 +2804,7 @@ const Methods = {
|
|
|
2795
2804
|
const matchObj = XEUtils.findTree(afterFullData, item => this.eqRow(item, row), treeOpts)
|
|
2796
2805
|
if (matchObj && matchObj.parent) {
|
|
2797
2806
|
let parentStatus
|
|
2798
|
-
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
|
|
2799
2808
|
const indeterminatesItem = XEUtils.find(matchObj.items, item => this.findRowIndexOf(treeIndeterminates, item) > -1)
|
|
2800
2809
|
if (indeterminatesItem) {
|
|
2801
2810
|
parentStatus = -1
|
|
@@ -2803,10 +2812,10 @@ const Methods = {
|
|
|
2803
2812
|
const selectItems = matchObj.items.filter(item => XEUtils.get(item, checkField))
|
|
2804
2813
|
parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
|
|
2805
2814
|
}
|
|
2806
|
-
return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
|
|
2815
|
+
return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
|
|
2807
2816
|
}
|
|
2808
2817
|
} else {
|
|
2809
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2818
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2810
2819
|
XEUtils.set(row, checkField, value)
|
|
2811
2820
|
this.handleCheckboxReserveRow(row, value)
|
|
2812
2821
|
}
|
|
@@ -2821,7 +2830,7 @@ const Methods = {
|
|
|
2821
2830
|
} else {
|
|
2822
2831
|
// 更新子节点状态
|
|
2823
2832
|
XEUtils.eachTree([row], (item) => {
|
|
2824
|
-
if (this.eqRow(item, row) || (!checkMethod || checkMethod({ row: item }))) {
|
|
2833
|
+
if (this.eqRow(item, row) || (isForce && (!checkMethod || checkMethod({ row: item })))) {
|
|
2825
2834
|
if (value) {
|
|
2826
2835
|
selection.push(item)
|
|
2827
2836
|
} else {
|
|
@@ -2836,7 +2845,7 @@ const Methods = {
|
|
|
2836
2845
|
const matchObj = XEUtils.findTree(afterFullData, item => this.eqRow(item, row), treeOpts)
|
|
2837
2846
|
if (matchObj && matchObj.parent) {
|
|
2838
2847
|
let parentStatus
|
|
2839
|
-
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
|
|
2840
2849
|
const indeterminatesItem = XEUtils.find(matchObj.items, item => this.findRowIndexOf(treeIndeterminates, item) > -1)
|
|
2841
2850
|
if (indeterminatesItem) {
|
|
2842
2851
|
parentStatus = -1
|
|
@@ -2844,10 +2853,10 @@ const Methods = {
|
|
|
2844
2853
|
const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selection, item) > -1)
|
|
2845
2854
|
parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
|
|
2846
2855
|
}
|
|
2847
|
-
return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
|
|
2856
|
+
return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
|
|
2848
2857
|
}
|
|
2849
2858
|
} else {
|
|
2850
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2859
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2851
2860
|
if (value) {
|
|
2852
2861
|
if (this.findRowIndexOf(selection, row) === -1) {
|
|
2853
2862
|
selection.push(row)
|
|
@@ -2888,14 +2897,13 @@ const Methods = {
|
|
|
2888
2897
|
* 多选,切换某一行的选中状态
|
|
2889
2898
|
*/
|
|
2890
2899
|
toggleCheckboxRow (row) {
|
|
2891
|
-
|
|
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)
|
|
2892
2904
|
return this.$nextTick()
|
|
2893
2905
|
},
|
|
2894
|
-
|
|
2895
|
-
* 用于多选行,设置所有行的选中状态
|
|
2896
|
-
* @param {Boolean} value 是否选中
|
|
2897
|
-
*/
|
|
2898
|
-
setAllCheckboxRow (value) {
|
|
2906
|
+
handleCheckedAllCheckboxRow (value, isForce) {
|
|
2899
2907
|
const { afterFullData, treeConfig, treeOpts, selection, checkboxReserveRowMap, checkboxOpts } = this
|
|
2900
2908
|
const { checkField, reserve, checkStrictly, checkMethod } = checkboxOpts
|
|
2901
2909
|
let selectRows = []
|
|
@@ -2909,7 +2917,7 @@ const Methods = {
|
|
|
2909
2917
|
*/
|
|
2910
2918
|
if (checkField) {
|
|
2911
2919
|
const checkValFn = (row) => {
|
|
2912
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2920
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2913
2921
|
if (value) {
|
|
2914
2922
|
selectRows.push(row)
|
|
2915
2923
|
}
|
|
@@ -2935,7 +2943,7 @@ const Methods = {
|
|
|
2935
2943
|
* 如果方法成立,则添加到临时集合中
|
|
2936
2944
|
*/
|
|
2937
2945
|
XEUtils.eachTree(afterFullData, (row) => {
|
|
2938
|
-
if (!checkMethod || checkMethod({ row })) {
|
|
2946
|
+
if (isForce || (!checkMethod || checkMethod({ row }))) {
|
|
2939
2947
|
selectRows.push(row)
|
|
2940
2948
|
}
|
|
2941
2949
|
}, treeOpts)
|
|
@@ -2944,7 +2952,7 @@ const Methods = {
|
|
|
2944
2952
|
* 如果是树取消
|
|
2945
2953
|
* 如果方法成立,则不添加到临时集合中
|
|
2946
2954
|
*/
|
|
2947
|
-
if (checkMethod) {
|
|
2955
|
+
if (!isForce && checkMethod) {
|
|
2948
2956
|
XEUtils.eachTree(afterFullData, (row) => {
|
|
2949
2957
|
if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1) {
|
|
2950
2958
|
selectRows.push(row)
|
|
@@ -2959,7 +2967,7 @@ const Methods = {
|
|
|
2959
2967
|
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
2960
2968
|
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
2961
2969
|
*/
|
|
2962
|
-
if (checkMethod) {
|
|
2970
|
+
if (!isForce && checkMethod) {
|
|
2963
2971
|
selectRows = afterFullData.filter((row) => this.findRowIndexOf(selection, row) > -1 || checkMethod({ row }))
|
|
2964
2972
|
} else {
|
|
2965
2973
|
selectRows = afterFullData.slice(0)
|
|
@@ -2970,7 +2978,7 @@ const Methods = {
|
|
|
2970
2978
|
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
2971
2979
|
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
2972
2980
|
*/
|
|
2973
|
-
if (checkMethod) {
|
|
2981
|
+
if (!isForce && checkMethod) {
|
|
2974
2982
|
selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1)
|
|
2975
2983
|
}
|
|
2976
2984
|
}
|
|
@@ -2989,6 +2997,14 @@ const Methods = {
|
|
|
2989
2997
|
}
|
|
2990
2998
|
this.treeIndeterminates = []
|
|
2991
2999
|
this.checkSelectionStatus()
|
|
3000
|
+
return this.$nextTick()
|
|
3001
|
+
},
|
|
3002
|
+
/**
|
|
3003
|
+
* 用于多选行,设置所有行的选中状态
|
|
3004
|
+
* @param {Boolean} value 是否选中
|
|
3005
|
+
*/
|
|
3006
|
+
setAllCheckboxRow (value) {
|
|
3007
|
+
return this.handleCheckedAllCheckboxRow(value, true)
|
|
2992
3008
|
},
|
|
2993
3009
|
checkSelectionStatus () {
|
|
2994
3010
|
const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
|
|
@@ -3067,14 +3083,14 @@ const Methods = {
|
|
|
3067
3083
|
if (radioOpts.reserve && radioReserveRow) {
|
|
3068
3084
|
const rowid = getRowid(this, radioReserveRow)
|
|
3069
3085
|
if (fullDataRowIdData[rowid]) {
|
|
3070
|
-
this.
|
|
3086
|
+
this.handleCheckedRadioRow(fullDataRowIdData[rowid].row, true)
|
|
3071
3087
|
}
|
|
3072
3088
|
}
|
|
3073
3089
|
// 复选框
|
|
3074
3090
|
this.selection = getRecoverRow(this, selection) // 刷新多选行状态
|
|
3075
3091
|
// 还原保留选中状态
|
|
3076
3092
|
if (checkboxOpts.reserve) {
|
|
3077
|
-
this.
|
|
3093
|
+
this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true)
|
|
3078
3094
|
}
|
|
3079
3095
|
if (currentRow && !fullAllDataRowMap.has(currentRow)) {
|
|
3080
3096
|
this.currentRow = null // 刷新当前行状态
|
|
@@ -3180,7 +3196,7 @@ const Methods = {
|
|
|
3180
3196
|
* 多选,选中所有事件
|
|
3181
3197
|
*/
|
|
3182
3198
|
triggerCheckAllEvent (evnt, value) {
|
|
3183
|
-
this.
|
|
3199
|
+
this.handleCheckedAllCheckboxRow(value)
|
|
3184
3200
|
this.emitEvent('checkbox-all', { records: this.getCheckboxRecords(), reserves: this.getCheckboxReserveRecords(), indeterminates: this.getCheckboxIndeterminateRecords(), checked: value }, evnt)
|
|
3185
3201
|
},
|
|
3186
3202
|
/**
|
|
@@ -3221,7 +3237,7 @@ const Methods = {
|
|
|
3221
3237
|
const { checkRowKey: rowid, reserve } = radioOpts
|
|
3222
3238
|
if (rowid) {
|
|
3223
3239
|
if (fullDataRowIdData[rowid]) {
|
|
3224
|
-
this.
|
|
3240
|
+
this.handleCheckedRadioRow(fullDataRowIdData[rowid].row, true)
|
|
3225
3241
|
}
|
|
3226
3242
|
if (reserve) {
|
|
3227
3243
|
const rowkey = getRowkey(this)
|
|
@@ -3238,7 +3254,7 @@ const Methods = {
|
|
|
3238
3254
|
let newValue = row
|
|
3239
3255
|
let isChange = oldValue !== newValue
|
|
3240
3256
|
if (isChange) {
|
|
3241
|
-
this.
|
|
3257
|
+
this.handleCheckedRadioRow(newValue)
|
|
3242
3258
|
} else if (!radioOpts.strict) {
|
|
3243
3259
|
isChange = oldValue === newValue
|
|
3244
3260
|
if (isChange) {
|
|
@@ -3266,7 +3282,7 @@ const Methods = {
|
|
|
3266
3282
|
setCurrentRow (row) {
|
|
3267
3283
|
const { $el, rowOpts } = this
|
|
3268
3284
|
this.clearCurrentRow()
|
|
3269
|
-
this.clearCurrentColumn()
|
|
3285
|
+
// this.clearCurrentColumn()
|
|
3270
3286
|
this.currentRow = row
|
|
3271
3287
|
if (rowOpts.isCurrent || this.highlightCurrentRow) {
|
|
3272
3288
|
if ($el) {
|
|
@@ -3278,19 +3294,22 @@ const Methods = {
|
|
|
3278
3294
|
isCheckedByRadioRow (row) {
|
|
3279
3295
|
return this.selectRow === row
|
|
3280
3296
|
},
|
|
3281
|
-
|
|
3282
|
-
* 用于单选行,设置某一行为选中状态
|
|
3283
|
-
* @param {Row} row 行对象
|
|
3284
|
-
*/
|
|
3285
|
-
setRadioRow (row) {
|
|
3297
|
+
handleCheckedRadioRow (row, isForce) {
|
|
3286
3298
|
const { radioOpts } = this
|
|
3287
3299
|
const { checkMethod } = radioOpts
|
|
3288
|
-
if (row && (!checkMethod || checkMethod({ row }))) {
|
|
3300
|
+
if (row && (isForce || (!checkMethod || checkMethod({ row })))) {
|
|
3289
3301
|
this.selectRow = row
|
|
3290
3302
|
this.handleRadioReserveRow(row)
|
|
3291
3303
|
}
|
|
3292
3304
|
return this.$nextTick()
|
|
3293
3305
|
},
|
|
3306
|
+
/**
|
|
3307
|
+
* 用于单选行,设置某一行为选中状态
|
|
3308
|
+
* @param {Row} row 行对象
|
|
3309
|
+
*/
|
|
3310
|
+
setRadioRow (row) {
|
|
3311
|
+
return this.handleCheckedRadioRow(row, true)
|
|
3312
|
+
},
|
|
3294
3313
|
/**
|
|
3295
3314
|
* 用于当前行,手动清空当前高亮的状态
|
|
3296
3315
|
*/
|
|
@@ -3394,7 +3413,7 @@ const Methods = {
|
|
|
3394
3413
|
setCurrentColumn (fieldOrColumn) {
|
|
3395
3414
|
const column = handleFieldOrColumn(this, fieldOrColumn)
|
|
3396
3415
|
if (column) {
|
|
3397
|
-
this.clearCurrentRow()
|
|
3416
|
+
// this.clearCurrentRow()
|
|
3398
3417
|
this.clearCurrentColumn()
|
|
3399
3418
|
this.currentColumn = column
|
|
3400
3419
|
}
|
|
@@ -3999,7 +4018,7 @@ const Methods = {
|
|
|
3999
4018
|
}
|
|
4000
4019
|
// 如果当前节点已选中,则展开后子节点也被选中
|
|
4001
4020
|
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
4002
|
-
this.
|
|
4021
|
+
this.handleCheckedCheckboxRow(childRows, true, true)
|
|
4003
4022
|
}
|
|
4004
4023
|
return this.$nextTick().then(() => {
|
|
4005
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
|
}
|