vxe-table 4.12.0-beta.1 → 4.12.0-beta.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/es/grid/src/grid.js +70 -75
- package/es/locale/lang/ar-EG.js +3 -0
- package/es/locale/lang/de-DE.js +3 -0
- package/es/locale/lang/en-US.js +3 -0
- package/es/locale/lang/es-ES.js +3 -0
- package/es/locale/lang/fr-FR.js +3 -0
- package/es/locale/lang/hu-HU.js +3 -0
- package/es/locale/lang/hy-AM.js +3 -0
- package/es/locale/lang/id-ID.js +3 -0
- package/es/locale/lang/it-IT.js +3 -0
- package/es/locale/lang/ja-JP.js +3 -0
- package/es/locale/lang/ko-KR.js +3 -0
- package/es/locale/lang/nb-NO.js +3 -0
- package/es/locale/lang/pt-BR.js +3 -0
- package/es/locale/lang/ru-RU.js +3 -0
- package/es/locale/lang/th-TH.js +3 -0
- package/es/locale/lang/ug-CN.js +3 -0
- package/es/locale/lang/uk-UA.js +3 -0
- package/es/locale/lang/vi-VN.js +3 -0
- package/es/locale/lang/zh-CHT.js +3 -0
- package/es/locale/lang/zh-CN.js +3 -0
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +19 -21
- package/es/table/module/export/export-panel.js +17 -19
- package/es/table/module/export/hook.js +5 -11
- package/es/table/module/export/import-panel.js +11 -13
- package/es/table/module/keyboard/hook.js +47 -4
- package/es/table/module/validator/hook.js +1 -3
- package/es/table/render/index.js +90 -61
- package/es/table/src/body.js +11 -6
- package/es/table/src/columnInfo.js +26 -28
- package/es/table/src/footer.js +7 -2
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +366 -187
- package/es/table/src/util.js +30 -3
- package/es/toolbar/src/toolbar.js +16 -24
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +67 -79
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1274 -12216
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +3 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +3 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -0
- package/lib/locale/lang/es-ES.js +3 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -0
- package/lib/locale/lang/fr-FR.js +3 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +3 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +3 -0
- package/lib/locale/lang/hy-AM.js +3 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +3 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +3 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +3 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +3 -0
- package/lib/locale/lang/ko-KR.js +3 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +3 -0
- package/lib/locale/lang/nb-NO.js +3 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +3 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +3 -0
- package/lib/locale/lang/ru-RU.js +3 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +3 -0
- package/lib/locale/lang/th-TH.js +3 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +3 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +3 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +3 -0
- package/lib/locale/lang/vi-VN.js +3 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +3 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +3 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +3 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +21 -23
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/export-panel.js +17 -19
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/hook.js +5 -11
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/export/import-panel.js +11 -13
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +51 -4
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +1 -3
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +98 -66
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +10 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +30 -32
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +7 -2
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +399 -185
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +35 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +16 -24
- package/lib/toolbar/src/toolbar.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/grid/src/grid.ts +75 -81
- package/packages/locale/lang/ar-EG.ts +3 -0
- package/packages/locale/lang/de-DE.ts +3 -0
- package/packages/locale/lang/en-US.ts +3 -0
- package/packages/locale/lang/es-ES.ts +3 -0
- package/packages/locale/lang/fr-FR.ts +3 -0
- package/packages/locale/lang/hu-HU.ts +3 -0
- package/packages/locale/lang/hy-AM.ts +3 -0
- package/packages/locale/lang/id-ID.ts +3 -0
- package/packages/locale/lang/it-IT.ts +3 -0
- package/packages/locale/lang/ja-JP.ts +3 -0
- package/packages/locale/lang/ko-KR.ts +3 -0
- package/packages/locale/lang/nb-NO.ts +3 -0
- package/packages/locale/lang/pt-BR.ts +3 -0
- package/packages/locale/lang/ru-RU.ts +3 -0
- package/packages/locale/lang/th-TH.ts +3 -0
- package/packages/locale/lang/ug-CN.ts +3 -0
- package/packages/locale/lang/uk-UA.ts +3 -0
- package/packages/locale/lang/vi-VN.ts +3 -0
- package/packages/locale/lang/zh-CHT.ts +3 -0
- package/packages/locale/lang/zh-CN.ts +3 -0
- package/packages/table/module/custom/panel.ts +19 -21
- package/packages/table/module/export/export-panel.ts +17 -19
- package/packages/table/module/export/hook.ts +5 -11
- package/packages/table/module/export/import-panel.ts +11 -13
- package/packages/table/module/keyboard/hook.ts +47 -6
- package/packages/table/module/validator/hook.ts +1 -3
- package/packages/table/render/index.ts +89 -59
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/columnInfo.ts +26 -28
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/props.ts +4 -0
- package/packages/table/src/table.ts +371 -185
- package/packages/table/src/util.ts +34 -3
- package/packages/toolbar/src/toolbar.ts +16 -24
- /package/es/{iconfont.1741051902838.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/es/{iconfont.1741051902838.woff → iconfont.1741664494856.woff} +0 -0
- /package/es/{iconfont.1741051902838.woff2 → iconfont.1741664494856.woff2} +0 -0
- /package/lib/{iconfont.1741051902838.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/lib/{iconfont.1741051902838.woff → iconfont.1741664494856.woff} +0 -0
- /package/lib/{iconfont.1741051902838.woff2 → iconfont.1741664494856.woff2} +0 -0
|
@@ -9,7 +9,7 @@ import TableHeaderComponent from './header'
|
|
|
9
9
|
import TableFooterComponent from './footer'
|
|
10
10
|
import tableProps from './props'
|
|
11
11
|
import tableEmits from './emits'
|
|
12
|
-
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth } from './util'
|
|
12
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, updateDeepRowKey, updateFastRowKey } from './util'
|
|
13
13
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
14
14
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
15
15
|
import TableCustomPanelComponent from '../module/custom/panel'
|
|
@@ -506,6 +506,10 @@ export default defineComponent({
|
|
|
506
506
|
return Object.assign({}, getConfig().table.columnConfig, props.columnConfig) as VxeTablePropTypes.ColumnOpts
|
|
507
507
|
})
|
|
508
508
|
|
|
509
|
+
const computeCurrentColumnOpts = computed(() => {
|
|
510
|
+
return Object.assign({}, getConfig().table.currentColumnConfig, props.currentColumnConfig)
|
|
511
|
+
})
|
|
512
|
+
|
|
509
513
|
const computeCellOpts = computed(() => {
|
|
510
514
|
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
|
|
511
515
|
})
|
|
@@ -519,7 +523,11 @@ export default defineComponent({
|
|
|
519
523
|
})
|
|
520
524
|
|
|
521
525
|
const computeRowOpts = computed(() => {
|
|
522
|
-
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
|
|
526
|
+
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
|
|
527
|
+
})
|
|
528
|
+
|
|
529
|
+
const computeCurrentRowOpts = computed(() => {
|
|
530
|
+
return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig)
|
|
523
531
|
})
|
|
524
532
|
|
|
525
533
|
const computeRowDragOpts = computed(() => {
|
|
@@ -823,6 +831,7 @@ export default defineComponent({
|
|
|
823
831
|
computeScrollbarXToTop,
|
|
824
832
|
computeScrollbarYToLeft,
|
|
825
833
|
computeColumnOpts,
|
|
834
|
+
computeCurrentColumnOpts,
|
|
826
835
|
computeScrollXThreshold,
|
|
827
836
|
computeScrollYThreshold,
|
|
828
837
|
computeDefaultRowHeight,
|
|
@@ -830,6 +839,7 @@ export default defineComponent({
|
|
|
830
839
|
computeHeaderCellOpts,
|
|
831
840
|
computeFooterCellOpts,
|
|
832
841
|
computeRowOpts,
|
|
842
|
+
computeCurrentRowOpts,
|
|
833
843
|
computeRowDragOpts,
|
|
834
844
|
computeColumnDragOpts,
|
|
835
845
|
computeResizeOpts,
|
|
@@ -1366,14 +1376,12 @@ export default defineComponent({
|
|
|
1366
1376
|
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand'])
|
|
1367
1377
|
}
|
|
1368
1378
|
|
|
1369
|
-
if (
|
|
1370
|
-
if (
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html'])
|
|
1376
|
-
}
|
|
1379
|
+
if (htmlColumn) {
|
|
1380
|
+
if (!columnOpts.useKey) {
|
|
1381
|
+
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html'])
|
|
1382
|
+
}
|
|
1383
|
+
if (!rowOpts.useKey) {
|
|
1384
|
+
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html'])
|
|
1377
1385
|
}
|
|
1378
1386
|
}
|
|
1379
1387
|
|
|
@@ -2369,6 +2377,7 @@ export default defineComponent({
|
|
|
2369
2377
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2370
2378
|
const checkboxOpts = computeCheckboxOpts.value
|
|
2371
2379
|
const { checkField, reserve, checkMethod } = checkboxOpts
|
|
2380
|
+
// indeterminateField 仅支持读取
|
|
2372
2381
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
2373
2382
|
const selectRowMaps: Record<string, any> = {}
|
|
2374
2383
|
/**
|
|
@@ -2632,12 +2641,12 @@ export default defineComponent({
|
|
|
2632
2641
|
rExpandLazyLoadedMaps[rowid] = row
|
|
2633
2642
|
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps
|
|
2634
2643
|
loadMethod({ $table: $xeTable, row, rowIndex: tableMethods.getRowIndex(row), $rowIndex: tableMethods.getVMRowIndex(row) }).then(() => {
|
|
2635
|
-
const
|
|
2644
|
+
const rowTempExpandedMaps = { ...reactData.rowExpandedMaps }
|
|
2636
2645
|
if (rowRest) {
|
|
2637
2646
|
rowRest.expandLoaded = true
|
|
2638
2647
|
}
|
|
2639
|
-
|
|
2640
|
-
reactData.rowExpandedMaps =
|
|
2648
|
+
rowTempExpandedMaps[rowid] = row
|
|
2649
|
+
reactData.rowExpandedMaps = rowTempExpandedMaps
|
|
2641
2650
|
}).catch(() => {
|
|
2642
2651
|
if (rowRest) {
|
|
2643
2652
|
rowRest.expandLoaded = false
|
|
@@ -2782,32 +2791,30 @@ export default defineComponent({
|
|
|
2782
2791
|
const { transform } = treeOpts
|
|
2783
2792
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2784
2793
|
let treeData = []
|
|
2785
|
-
let fullData = reactive(datas ? datas.slice(0) : []) //
|
|
2794
|
+
let fullData = reactive(datas ? datas.slice(0) : []) // 转为响应式数据
|
|
2786
2795
|
if (treeConfig) {
|
|
2787
2796
|
if (transform) {
|
|
2788
2797
|
// 树结构自动转换
|
|
2789
|
-
if (
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
2798
|
-
}
|
|
2799
|
-
if (!treeOpts.mapChildrenField) {
|
|
2800
|
-
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
2801
|
-
}
|
|
2802
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
2803
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
2804
|
-
}
|
|
2805
|
-
// fullData.forEach(row => {
|
|
2806
|
-
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2807
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2808
|
-
// }
|
|
2809
|
-
// })
|
|
2798
|
+
if (!treeOpts.rowField) {
|
|
2799
|
+
errLog('vxe.error.reqProp', ['tree-config.rowField'])
|
|
2800
|
+
}
|
|
2801
|
+
if (!treeOpts.parentField) {
|
|
2802
|
+
errLog('vxe.error.reqProp', ['tree-config.parentField'])
|
|
2803
|
+
}
|
|
2804
|
+
if (!childrenField) {
|
|
2805
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
2810
2806
|
}
|
|
2807
|
+
if (!treeOpts.mapChildrenField) {
|
|
2808
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
2809
|
+
}
|
|
2810
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2811
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
2812
|
+
}
|
|
2813
|
+
// fullData.forEach(row => {
|
|
2814
|
+
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2815
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2816
|
+
// }
|
|
2817
|
+
// })
|
|
2811
2818
|
treeData = XEUtils.toArrayTree(fullData, {
|
|
2812
2819
|
key: treeOpts.rowField,
|
|
2813
2820
|
parentKey: treeOpts.parentField,
|
|
@@ -2873,16 +2880,14 @@ export default defineComponent({
|
|
|
2873
2880
|
// }
|
|
2874
2881
|
// }
|
|
2875
2882
|
|
|
2876
|
-
if (
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2885
|
-
}
|
|
2883
|
+
if (!(props.height || props.maxHeight)) {
|
|
2884
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2885
|
+
}
|
|
2886
|
+
// if (!props.showOverflow) {
|
|
2887
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2888
|
+
// }
|
|
2889
|
+
if (props.spanMethod) {
|
|
2890
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2886
2891
|
}
|
|
2887
2892
|
}
|
|
2888
2893
|
|
|
@@ -3595,6 +3600,9 @@ export default defineComponent({
|
|
|
3595
3600
|
|
|
3596
3601
|
tableMethods = {
|
|
3597
3602
|
dispatchEvent,
|
|
3603
|
+
getEl () {
|
|
3604
|
+
return refElem.value
|
|
3605
|
+
},
|
|
3598
3606
|
/**
|
|
3599
3607
|
* 重置表格的一切数据状态
|
|
3600
3608
|
*/
|
|
@@ -3886,23 +3894,6 @@ export default defineComponent({
|
|
|
3886
3894
|
}
|
|
3887
3895
|
return tableMethods.createData(records).then((rows) => isArr ? rows : rows[0])
|
|
3888
3896
|
},
|
|
3889
|
-
// toOriginalRecords (rows: any[]) {
|
|
3890
|
-
// const { treeConfig } = props
|
|
3891
|
-
// const treeOpts = computeTreeOpts.value
|
|
3892
|
-
// const { transform, mapChildrenField } = treeOpts
|
|
3893
|
-
// const rowkey = getRowkey($xeTable)
|
|
3894
|
-
// if (treeConfig) {
|
|
3895
|
-
// if (transform) {
|
|
3896
|
-
// return []
|
|
3897
|
-
// }
|
|
3898
|
-
// return []
|
|
3899
|
-
// }
|
|
3900
|
-
// return rows.map(item => {
|
|
3901
|
-
// const obj = Object.assign({}, item)
|
|
3902
|
-
// delete obj.rowkey
|
|
3903
|
-
// return obj
|
|
3904
|
-
// })
|
|
3905
|
-
// },
|
|
3906
3897
|
/**
|
|
3907
3898
|
* 还原数据
|
|
3908
3899
|
* 如果不传任何参数,则还原整个表格
|
|
@@ -3911,11 +3902,15 @@ export default defineComponent({
|
|
|
3911
3902
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
3912
3903
|
*/
|
|
3913
3904
|
revertData (rows: any, field) {
|
|
3914
|
-
const { keepSource } = props
|
|
3915
|
-
const {
|
|
3905
|
+
const { keepSource, treeConfig } = props
|
|
3906
|
+
const { editStore } = reactData
|
|
3907
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3908
|
+
const removeTempMaps = { ...editStore.removeMaps }
|
|
3909
|
+
const treeOpts = computeTreeOpts.value
|
|
3910
|
+
const { transform } = treeOpts
|
|
3916
3911
|
if (!keepSource) {
|
|
3917
3912
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
3918
|
-
|
|
3913
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
3919
3914
|
}
|
|
3920
3915
|
return nextTick()
|
|
3921
3916
|
}
|
|
@@ -3927,25 +3922,52 @@ export default defineComponent({
|
|
|
3927
3922
|
} else {
|
|
3928
3923
|
targetRows = XEUtils.toArray($xeTable.getUpdateRecords())
|
|
3929
3924
|
}
|
|
3925
|
+
let reDelFlag = false
|
|
3930
3926
|
if (targetRows.length) {
|
|
3931
|
-
targetRows.forEach((
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3927
|
+
targetRows.forEach((item: any) => {
|
|
3928
|
+
const rowid = getRowid($xeTable, item)
|
|
3929
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3930
|
+
if (rowRest) {
|
|
3931
|
+
const row = rowRest.row
|
|
3932
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3933
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3934
|
+
if (oRow && row) {
|
|
3935
|
+
if (field) {
|
|
3936
|
+
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true))
|
|
3937
|
+
} else {
|
|
3938
|
+
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3939
|
+
}
|
|
3940
|
+
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3941
|
+
delete removeTempMaps[rowid]
|
|
3942
|
+
tableFullData.unshift(row)
|
|
3943
|
+
afterFullData.unshift(row)
|
|
3944
|
+
reDelFlag = true
|
|
3945
|
+
}
|
|
3940
3946
|
}
|
|
3941
3947
|
}
|
|
3942
3948
|
}
|
|
3943
3949
|
})
|
|
3944
3950
|
}
|
|
3945
3951
|
if (rows) {
|
|
3946
|
-
|
|
3952
|
+
if (reDelFlag) {
|
|
3953
|
+
editStore.removeMaps = removeTempMaps
|
|
3954
|
+
$xeTable.updateFooter()
|
|
3955
|
+
$xeTable.cacheRowMap(false)
|
|
3956
|
+
$xeTable.handleTableData(treeConfig && transform)
|
|
3957
|
+
if (!(treeConfig && transform)) {
|
|
3958
|
+
$xeTable.updateAfterDataIndex()
|
|
3959
|
+
}
|
|
3960
|
+
$xeTable.checkSelectionStatus()
|
|
3961
|
+
if (reactData.scrollYLoad) {
|
|
3962
|
+
$xeTable.updateScrollYSpace()
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
return nextTick().then(() => {
|
|
3966
|
+
$xeTable.updateCellAreas()
|
|
3967
|
+
return $xeTable.recalculate()
|
|
3968
|
+
})
|
|
3947
3969
|
}
|
|
3948
|
-
return
|
|
3970
|
+
return $xeTable.reloadData(tableSourceData)
|
|
3949
3971
|
},
|
|
3950
3972
|
/**
|
|
3951
3973
|
* 清空单元格内容
|
|
@@ -4060,6 +4082,11 @@ export default defineComponent({
|
|
|
4060
4082
|
const rowid = getRowid($xeTable, row)
|
|
4061
4083
|
return !!editStore.insertMaps[rowid]
|
|
4062
4084
|
},
|
|
4085
|
+
isRemoveByRow (row) {
|
|
4086
|
+
const { editStore } = reactData
|
|
4087
|
+
const rowid = getRowid($xeTable, row)
|
|
4088
|
+
return !!editStore.removeMaps[rowid]
|
|
4089
|
+
},
|
|
4063
4090
|
/**
|
|
4064
4091
|
* 删除所有新增的临时数据
|
|
4065
4092
|
* @returns
|
|
@@ -4071,18 +4098,20 @@ export default defineComponent({
|
|
|
4071
4098
|
},
|
|
4072
4099
|
/**
|
|
4073
4100
|
* 检查行或列数据是否发生改变
|
|
4074
|
-
* @param {Row}
|
|
4101
|
+
* @param {Row} rowidOrRow 行对象、行主键
|
|
4075
4102
|
* @param {String} field 字段名
|
|
4076
4103
|
*/
|
|
4077
|
-
isUpdateByRow (
|
|
4104
|
+
isUpdateByRow (rowidOrRow, field) {
|
|
4078
4105
|
const { keepSource } = props
|
|
4079
4106
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData
|
|
4080
4107
|
if (keepSource) {
|
|
4081
|
-
const rowid = getRowid($xeTable,
|
|
4108
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow)
|
|
4109
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
4082
4110
|
// 新增的数据不需要检测
|
|
4083
|
-
if (!
|
|
4111
|
+
if (!rowRest) {
|
|
4084
4112
|
return false
|
|
4085
4113
|
}
|
|
4114
|
+
const row = rowRest.row
|
|
4086
4115
|
const oRow = sourceDataRowIdData[rowid]
|
|
4087
4116
|
if (oRow) {
|
|
4088
4117
|
if (arguments.length > 1) {
|
|
@@ -4146,6 +4175,92 @@ export default defineComponent({
|
|
|
4146
4175
|
tableColumn: reactData.tableColumn.slice(0)
|
|
4147
4176
|
}
|
|
4148
4177
|
},
|
|
4178
|
+
/**
|
|
4179
|
+
* 移动列到指定列的位置
|
|
4180
|
+
* @param fieldOrColumn
|
|
4181
|
+
* @param targetFieldOrColumn
|
|
4182
|
+
* @param options
|
|
4183
|
+
*/
|
|
4184
|
+
moveColumnTo (fieldOrColumn, targetFieldOrColumn, options) {
|
|
4185
|
+
const { fullColumnIdData, visibleColumn } = internalData
|
|
4186
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4187
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
4188
|
+
let prevDragCol: VxeTableDefines.ColumnInfo | null = null
|
|
4189
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null
|
|
4190
|
+
let defPos: 'left' | 'right' = 'left'
|
|
4191
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
4192
|
+
if (colRest && targetFieldOrColumn) {
|
|
4193
|
+
let currList = colRest.items
|
|
4194
|
+
let offsetIndex = colRest._index + targetFieldOrColumn
|
|
4195
|
+
if (isCrossDrag) {
|
|
4196
|
+
currList = visibleColumn
|
|
4197
|
+
offsetIndex = colRest._index + targetFieldOrColumn
|
|
4198
|
+
}
|
|
4199
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4200
|
+
prevDragCol = currList[offsetIndex]
|
|
4201
|
+
}
|
|
4202
|
+
if (targetFieldOrColumn > 0) {
|
|
4203
|
+
defPos = 'right'
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
} else {
|
|
4207
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn)
|
|
4208
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null
|
|
4209
|
+
if (colRest && targetColRest) {
|
|
4210
|
+
if (targetColRest._index > colRest._index) {
|
|
4211
|
+
defPos = 'right'
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true)
|
|
4216
|
+
},
|
|
4217
|
+
/**
|
|
4218
|
+
* 移动行到指定行的位置
|
|
4219
|
+
* @param rowidOrRow
|
|
4220
|
+
* @param targetRowidOrRow
|
|
4221
|
+
* @param options
|
|
4222
|
+
*/
|
|
4223
|
+
moveRowTo (rowidOrRow, targetRowidOrRow, options) {
|
|
4224
|
+
const { treeConfig } = props
|
|
4225
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4226
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4227
|
+
const treeOpts = computeTreeOpts.value
|
|
4228
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow)
|
|
4229
|
+
let prevDragRow: any = null
|
|
4230
|
+
let defPos: 'top' | 'bottom' = 'top'
|
|
4231
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null
|
|
4232
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4233
|
+
if (rowRest && targetRowidOrRow) {
|
|
4234
|
+
let currList = afterFullData
|
|
4235
|
+
let offsetIndex = rowRest._index + targetRowidOrRow
|
|
4236
|
+
if (treeConfig) {
|
|
4237
|
+
currList = rowRest.items
|
|
4238
|
+
if (treeOpts.transform) {
|
|
4239
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow
|
|
4240
|
+
if (isCrossDrag) {
|
|
4241
|
+
currList = afterFullData
|
|
4242
|
+
offsetIndex = rowRest._index + targetRowidOrRow
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4247
|
+
prevDragRow = currList[offsetIndex]
|
|
4248
|
+
}
|
|
4249
|
+
if (targetRowidOrRow > 0) {
|
|
4250
|
+
defPos = 'bottom'
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
} else {
|
|
4254
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow)
|
|
4255
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null
|
|
4256
|
+
if (rowRest && targetRowRest) {
|
|
4257
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4258
|
+
defPos = 'bottom'
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true)
|
|
4263
|
+
},
|
|
4149
4264
|
/**
|
|
4150
4265
|
* 获取表格的全量列
|
|
4151
4266
|
*/
|
|
@@ -4165,6 +4280,7 @@ export default defineComponent({
|
|
|
4165
4280
|
*/
|
|
4166
4281
|
getCheckboxRecords (isFull) {
|
|
4167
4282
|
const { treeConfig } = props
|
|
4283
|
+
const { selectCheckboxMaps } = reactData
|
|
4168
4284
|
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData
|
|
4169
4285
|
const treeOpts = computeTreeOpts.value
|
|
4170
4286
|
const checkboxOpts = computeCheckboxOpts.value
|
|
@@ -4172,15 +4288,15 @@ export default defineComponent({
|
|
|
4172
4288
|
const { checkField } = checkboxOpts
|
|
4173
4289
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
4174
4290
|
let rowList: any[] = []
|
|
4175
|
-
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
|
|
4176
4291
|
if (checkField) {
|
|
4177
4292
|
if (treeConfig) {
|
|
4293
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
|
|
4178
4294
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField })
|
|
4179
4295
|
} else {
|
|
4296
|
+
const currTableData = isFull ? tableFullData : afterFullData
|
|
4180
4297
|
rowList = currTableData.filter((row) => XEUtils.get(row, checkField))
|
|
4181
4298
|
}
|
|
4182
4299
|
} else {
|
|
4183
|
-
const { selectCheckboxMaps } = reactData
|
|
4184
4300
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
4185
4301
|
if (isFull) {
|
|
4186
4302
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -4864,6 +4980,7 @@ export default defineComponent({
|
|
|
4864
4980
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
4865
4981
|
const checkboxOpts = computeCheckboxOpts.value
|
|
4866
4982
|
const { checkField, reserve } = checkboxOpts
|
|
4983
|
+
// indeterminateField 仅支持读取
|
|
4867
4984
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
4868
4985
|
if (checkField) {
|
|
4869
4986
|
const handleClearChecked = (item: any) => {
|
|
@@ -4991,13 +5108,20 @@ export default defineComponent({
|
|
|
4991
5108
|
* 用于当前列,设置某列行为高亮状态
|
|
4992
5109
|
*/
|
|
4993
5110
|
setCurrentColumn (fieldOrColumn) {
|
|
5111
|
+
const { mouseConfig } = props
|
|
5112
|
+
const mouseOpts = computeMouseOpts.value
|
|
5113
|
+
const isMouseSelected = mouseConfig && mouseOpts.selected
|
|
4994
5114
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
4995
5115
|
if (column) {
|
|
4996
|
-
|
|
4997
|
-
tableMethods.clearCurrentColumn()
|
|
5116
|
+
$xeTable.clearCurrentColumn()
|
|
4998
5117
|
reactData.currentColumn = column
|
|
4999
5118
|
}
|
|
5000
|
-
return nextTick()
|
|
5119
|
+
return nextTick().then(() => {
|
|
5120
|
+
// 更新状选中态
|
|
5121
|
+
if (isMouseSelected) {
|
|
5122
|
+
$xeTable.addCellSelectedClass()
|
|
5123
|
+
}
|
|
5124
|
+
})
|
|
5001
5125
|
},
|
|
5002
5126
|
/**
|
|
5003
5127
|
* 用于当前列,手动清空当前高亮的状态
|
|
@@ -6137,7 +6261,7 @@ export default defineComponent({
|
|
|
6137
6261
|
// 该行为只对当前激活的表格有效
|
|
6138
6262
|
if (internalData.isActivated) {
|
|
6139
6263
|
tablePrivateMethods.preventEvent(evnt, 'event.keydown', null, () => {
|
|
6140
|
-
const { mouseConfig, keyboardConfig, treeConfig, editConfig, highlightCurrentRow } = props
|
|
6264
|
+
const { mouseConfig, keyboardConfig, treeConfig, editConfig, highlightCurrentRow, highlightCurrentColumn } = props
|
|
6141
6265
|
const { ctxMenuStore, editStore, currentRow } = reactData
|
|
6142
6266
|
const { afterFullData } = internalData
|
|
6143
6267
|
const isMenu = computeIsMenu.value
|
|
@@ -6148,6 +6272,7 @@ export default defineComponent({
|
|
|
6148
6272
|
const treeOpts = computeTreeOpts.value
|
|
6149
6273
|
const menuList = computeMenuList.value
|
|
6150
6274
|
const rowOpts = computeRowOpts.value
|
|
6275
|
+
const columnOpts = computeColumnOpts.value
|
|
6151
6276
|
const { selected, actived } = editStore
|
|
6152
6277
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6153
6278
|
const keyCode = evnt.keyCode
|
|
@@ -6306,10 +6431,15 @@ export default defineComponent({
|
|
|
6306
6431
|
// 如果按下了方向键
|
|
6307
6432
|
if (selected.row && selected.column) {
|
|
6308
6433
|
$xeTable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt)
|
|
6309
|
-
}
|
|
6310
|
-
|
|
6434
|
+
}
|
|
6435
|
+
// 当前行按键上下移动
|
|
6436
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
6311
6437
|
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt)
|
|
6312
6438
|
}
|
|
6439
|
+
// 当前行按键左右移动
|
|
6440
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
6441
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt)
|
|
6442
|
+
}
|
|
6313
6443
|
}
|
|
6314
6444
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
6315
6445
|
// 如果按下了 Tab 键切换
|
|
@@ -6757,7 +6887,15 @@ export default defineComponent({
|
|
|
6757
6887
|
if (el) {
|
|
6758
6888
|
const parentElem = el.parentNode as HTMLElement
|
|
6759
6889
|
const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
|
|
6760
|
-
|
|
6890
|
+
let parentWrapperHeight = 0
|
|
6891
|
+
if (parentElem) {
|
|
6892
|
+
if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
|
|
6893
|
+
parentWrapperHeight = $xeGrid.getParentHeight()
|
|
6894
|
+
} else {
|
|
6895
|
+
parentWrapperHeight = parentElem.clientHeight
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6898
|
+
return Math.floor(parentWrapperHeight - parentPaddingSize)
|
|
6761
6899
|
}
|
|
6762
6900
|
return 0
|
|
6763
6901
|
},
|
|
@@ -6843,44 +6981,65 @@ export default defineComponent({
|
|
|
6843
6981
|
*/
|
|
6844
6982
|
cacheRowMap () {
|
|
6845
6983
|
const { treeConfig } = props
|
|
6846
|
-
const
|
|
6984
|
+
const { treeExpandedMaps } = reactData
|
|
6847
6985
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData
|
|
6986
|
+
const treeOpts = computeTreeOpts.value
|
|
6848
6987
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6849
6988
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
6989
|
+
const { lazy } = treeOpts
|
|
6850
6990
|
const rowkey = getRowkey($xeTable)
|
|
6851
|
-
const
|
|
6852
|
-
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
6991
|
+
const isDeepKey = rowkey.indexOf('.') > -1
|
|
6992
|
+
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = { ...fullAllDataRowIdData } // 存在已删除数据
|
|
6853
6993
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
6854
|
-
const
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
rowid = getRowUniqueId()
|
|
6860
|
-
XEUtils.set(row, rowkey, rowid)
|
|
6861
|
-
}
|
|
6862
|
-
if (isLazy && row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
6863
|
-
row[childrenField] = null
|
|
6864
|
-
}
|
|
6865
|
-
let rowRest = fullAllDataRowIdData[rowid]
|
|
6994
|
+
const treeTempExpandedMaps = { ...treeExpandedMaps }
|
|
6995
|
+
|
|
6996
|
+
const handleRowId = isDeepKey ? updateDeepRowKey : updateFastRowKey
|
|
6997
|
+
const handleRowCache = (row: any, index: number, items: any, currIndex: number, parentRow: any, rowid: string, level: number, seq: string | number) => {
|
|
6998
|
+
let rowRest = fullAllDataRowIdMaps[rowid]
|
|
6866
6999
|
if (!rowRest) {
|
|
6867
7000
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
7001
|
+
fullDataRowIdMaps[rowid] = rowRest
|
|
7002
|
+
fullAllDataRowIdMaps[rowid] = rowRest
|
|
6868
7003
|
}
|
|
7004
|
+
rowRest.treeLoaded = false
|
|
7005
|
+
rowRest.expandLoaded = false
|
|
7006
|
+
|
|
6869
7007
|
rowRest.row = row
|
|
6870
7008
|
rowRest.items = items
|
|
6871
7009
|
rowRest.parent = parentRow
|
|
6872
7010
|
rowRest.level = level
|
|
6873
|
-
rowRest.index =
|
|
7011
|
+
rowRest.index = currIndex
|
|
7012
|
+
rowRest.treeIndex = index
|
|
7013
|
+
|
|
6874
7014
|
fullDataRowIdMaps[rowid] = rowRest
|
|
6875
7015
|
fullAllDataRowIdMaps[rowid] = rowRest
|
|
6876
7016
|
}
|
|
6877
|
-
|
|
6878
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps
|
|
7017
|
+
|
|
6879
7018
|
if (treeConfig) {
|
|
6880
|
-
XEUtils.eachTree(tableFullTreeData,
|
|
7019
|
+
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
7020
|
+
const rowid = handleRowId(row, rowkey)
|
|
7021
|
+
if (treeConfig && lazy) {
|
|
7022
|
+
const treeExpRest = treeTempExpandedMaps[rowid]
|
|
7023
|
+
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
7024
|
+
row[childrenField] = null
|
|
7025
|
+
}
|
|
7026
|
+
if (treeExpRest) {
|
|
7027
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
7028
|
+
delete treeTempExpandedMaps[rowid]
|
|
7029
|
+
}
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
7033
|
+
}, { children: childrenField })
|
|
6881
7034
|
} else {
|
|
6882
|
-
tableFullData.forEach(
|
|
7035
|
+
tableFullData.forEach((row, index, items) => {
|
|
7036
|
+
handleRowCache(row, index, items, index, null, handleRowId(row, rowkey), 0, index + 1)
|
|
7037
|
+
})
|
|
6883
7038
|
}
|
|
7039
|
+
|
|
7040
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps
|
|
7041
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps
|
|
7042
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps
|
|
6884
7043
|
},
|
|
6885
7044
|
cacheSourceMap (fullData) {
|
|
6886
7045
|
const { treeConfig } = props
|
|
@@ -7526,6 +7685,7 @@ export default defineComponent({
|
|
|
7526
7685
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
7527
7686
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7528
7687
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
7688
|
+
// indeterminateField 仅支持读取
|
|
7529
7689
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
7530
7690
|
if (checkField) {
|
|
7531
7691
|
// 树结构
|
|
@@ -7702,17 +7862,18 @@ export default defineComponent({
|
|
|
7702
7862
|
const { _lastResizeTime } = internalData
|
|
7703
7863
|
const sortOpts = computeSortOpts.value
|
|
7704
7864
|
const columnOpts = computeColumnOpts.value
|
|
7865
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
7705
7866
|
const { column } = params
|
|
7706
7867
|
const cell = evnt.currentTarget
|
|
7707
7868
|
const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300
|
|
7708
7869
|
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag
|
|
7709
7870
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag
|
|
7710
7871
|
if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
|
|
7711
|
-
|
|
7872
|
+
$xeTable.triggerSortEvent(evnt, column, getNextSortOrder(column))
|
|
7712
7873
|
}
|
|
7713
7874
|
dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt)
|
|
7714
|
-
if (columnOpts.isCurrent || props.highlightCurrentColumn) {
|
|
7715
|
-
|
|
7875
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7876
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
7716
7877
|
}
|
|
7717
7878
|
},
|
|
7718
7879
|
triggerHeaderCellDblclickEvent (evnt, params) {
|
|
@@ -7724,7 +7885,7 @@ export default defineComponent({
|
|
|
7724
7885
|
* 如果是双击模式,则单击后选中状态
|
|
7725
7886
|
*/
|
|
7726
7887
|
triggerCellClickEvent (evnt, params) {
|
|
7727
|
-
const { highlightCurrentRow, editConfig } = props
|
|
7888
|
+
const { highlightCurrentRow, highlightCurrentColumn, editConfig } = props
|
|
7728
7889
|
const { editStore, isDragResize } = reactData
|
|
7729
7890
|
if (isDragResize) {
|
|
7730
7891
|
return
|
|
@@ -7736,6 +7897,8 @@ export default defineComponent({
|
|
|
7736
7897
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7737
7898
|
const keyboardOpts = computeKeyboardOpts.value
|
|
7738
7899
|
const rowOpts = computeRowOpts.value
|
|
7900
|
+
const columnOpts = computeColumnOpts.value
|
|
7901
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
7739
7902
|
const { actived, focused } = editStore
|
|
7740
7903
|
const { row, column } = params
|
|
7741
7904
|
const { type, treeNode } = column
|
|
@@ -7751,29 +7914,35 @@ export default defineComponent({
|
|
|
7751
7914
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7752
7915
|
// 如果是展开行
|
|
7753
7916
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
|
|
7754
|
-
|
|
7917
|
+
$xeTable.triggerRowExpandEvent(evnt, params)
|
|
7755
7918
|
}
|
|
7756
7919
|
// 如果是树形表格
|
|
7757
7920
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7758
|
-
|
|
7921
|
+
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
7759
7922
|
}
|
|
7760
7923
|
}
|
|
7761
7924
|
// 如果点击了树节点
|
|
7762
7925
|
if (!triggerTreeNode) {
|
|
7763
7926
|
if (!triggerExpandNode) {
|
|
7764
|
-
//
|
|
7927
|
+
// 如果是当前行
|
|
7765
7928
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7766
7929
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7767
|
-
|
|
7930
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
// 如果是当前列
|
|
7934
|
+
if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7935
|
+
if (!triggerCheckbox && !triggerRadio) {
|
|
7936
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
7768
7937
|
}
|
|
7769
7938
|
}
|
|
7770
7939
|
// 如果是单选框
|
|
7771
7940
|
if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
|
|
7772
|
-
|
|
7941
|
+
$xeTable.triggerRadioRowEvent(evnt, params)
|
|
7773
7942
|
}
|
|
7774
7943
|
// 如果是复选框
|
|
7775
7944
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
|
|
7776
|
-
|
|
7945
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params)
|
|
7777
7946
|
}
|
|
7778
7947
|
}
|
|
7779
7948
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -8163,6 +8332,9 @@ export default defineComponent({
|
|
|
8163
8332
|
const { afterFullData, tableFullData } = internalData
|
|
8164
8333
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
8165
8334
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
8335
|
+
const errRest = {
|
|
8336
|
+
status: false
|
|
8337
|
+
}
|
|
8166
8338
|
if (prevDragRow && dragRow) {
|
|
8167
8339
|
// 判断是否有拖动
|
|
8168
8340
|
if (prevDragRow !== dragRow) {
|
|
@@ -8177,7 +8349,7 @@ export default defineComponent({
|
|
|
8177
8349
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8178
8350
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8179
8351
|
if (!status) {
|
|
8180
|
-
return
|
|
8352
|
+
return errRest
|
|
8181
8353
|
}
|
|
8182
8354
|
|
|
8183
8355
|
let oafIndex = -1
|
|
@@ -8208,11 +8380,11 @@ export default defineComponent({
|
|
|
8208
8380
|
if (isPeerDrag && !isCrossDrag) {
|
|
8209
8381
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8210
8382
|
// 非同级
|
|
8211
|
-
return
|
|
8383
|
+
return errRest
|
|
8212
8384
|
}
|
|
8213
8385
|
} else {
|
|
8214
8386
|
if (!isCrossDrag) {
|
|
8215
|
-
return
|
|
8387
|
+
return errRest
|
|
8216
8388
|
}
|
|
8217
8389
|
if (oldAllMaps[newRowid]) {
|
|
8218
8390
|
isSelfToChildStatus = true
|
|
@@ -8223,7 +8395,7 @@ export default defineComponent({
|
|
|
8223
8395
|
content: getI18n('vxe.error.treeDragChild')
|
|
8224
8396
|
})
|
|
8225
8397
|
}
|
|
8226
|
-
return
|
|
8398
|
+
return errRest
|
|
8227
8399
|
}
|
|
8228
8400
|
}
|
|
8229
8401
|
}
|
|
@@ -8231,13 +8403,13 @@ export default defineComponent({
|
|
|
8231
8403
|
// 子到根
|
|
8232
8404
|
|
|
8233
8405
|
if (!isCrossDrag) {
|
|
8234
|
-
return
|
|
8406
|
+
return errRest
|
|
8235
8407
|
}
|
|
8236
8408
|
} else if (newLevel) {
|
|
8237
8409
|
// 根到子
|
|
8238
8410
|
|
|
8239
8411
|
if (!isCrossDrag) {
|
|
8240
|
-
return
|
|
8412
|
+
return errRest
|
|
8241
8413
|
}
|
|
8242
8414
|
if (oldAllMaps[newRowid]) {
|
|
8243
8415
|
isSelfToChildStatus = true
|
|
@@ -8248,7 +8420,7 @@ export default defineComponent({
|
|
|
8248
8420
|
content: getI18n('vxe.error.treeDragChild')
|
|
8249
8421
|
})
|
|
8250
8422
|
}
|
|
8251
|
-
return
|
|
8423
|
+
return errRest
|
|
8252
8424
|
}
|
|
8253
8425
|
}
|
|
8254
8426
|
} else {
|
|
@@ -8312,28 +8484,36 @@ export default defineComponent({
|
|
|
8312
8484
|
if (reactData.scrollYLoad) {
|
|
8313
8485
|
$xeTable.updateScrollYSpace()
|
|
8314
8486
|
}
|
|
8315
|
-
|
|
8487
|
+
|
|
8488
|
+
if (evnt) {
|
|
8489
|
+
dispatchEvent('row-dragend', {
|
|
8490
|
+
oldRow: dragRow,
|
|
8491
|
+
newRow: prevDragRow,
|
|
8492
|
+
dragRow,
|
|
8493
|
+
dragPos: prevDragPos as any,
|
|
8494
|
+
dragToChild: isDragToChildFlag,
|
|
8495
|
+
offsetIndex: dragOffsetIndex,
|
|
8496
|
+
_index: {
|
|
8497
|
+
newIndex: nafIndex,
|
|
8498
|
+
oldIndex: oafIndex
|
|
8499
|
+
}
|
|
8500
|
+
}, evnt)
|
|
8501
|
+
}
|
|
8502
|
+
|
|
8503
|
+
return nextTick().then(() => {
|
|
8316
8504
|
$xeTable.updateCellAreas()
|
|
8317
8505
|
$xeTable.recalculate()
|
|
8318
|
-
})
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
oldRow: dragRow,
|
|
8322
|
-
newRow: prevDragRow,
|
|
8323
|
-
dragRow,
|
|
8324
|
-
dragPos: prevDragPos as any,
|
|
8325
|
-
dragToChild: isDragToChildFlag,
|
|
8326
|
-
offsetIndex: dragOffsetIndex,
|
|
8327
|
-
_index: {
|
|
8328
|
-
newIndex: nafIndex,
|
|
8329
|
-
oldIndex: oafIndex
|
|
8506
|
+
}).then(() => {
|
|
8507
|
+
return {
|
|
8508
|
+
status: true
|
|
8330
8509
|
}
|
|
8331
|
-
}
|
|
8510
|
+
})
|
|
8332
8511
|
}).catch(() => {
|
|
8512
|
+
return errRest
|
|
8333
8513
|
})
|
|
8334
8514
|
}
|
|
8335
8515
|
}
|
|
8336
|
-
return Promise.resolve()
|
|
8516
|
+
return Promise.resolve(errRest)
|
|
8337
8517
|
},
|
|
8338
8518
|
handleRowDragDragendEvent (evnt) {
|
|
8339
8519
|
const { treeConfig } = props
|
|
@@ -8458,6 +8638,9 @@ export default defineComponent({
|
|
|
8458
8638
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8459
8639
|
const { collectColumn } = internalData
|
|
8460
8640
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
8641
|
+
const errRest = {
|
|
8642
|
+
status: false
|
|
8643
|
+
}
|
|
8461
8644
|
if (prevDragCol && dragCol) {
|
|
8462
8645
|
// 判断是否有拖动
|
|
8463
8646
|
if (prevDragCol !== dragCol) {
|
|
@@ -8474,7 +8657,7 @@ export default defineComponent({
|
|
|
8474
8657
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8475
8658
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8476
8659
|
if (!status) {
|
|
8477
|
-
return
|
|
8660
|
+
return errRest
|
|
8478
8661
|
}
|
|
8479
8662
|
|
|
8480
8663
|
let oafIndex = -1
|
|
@@ -8493,11 +8676,11 @@ export default defineComponent({
|
|
|
8493
8676
|
if (isPeerDrag && !isCrossDrag) {
|
|
8494
8677
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8495
8678
|
// 非同级
|
|
8496
|
-
return
|
|
8679
|
+
return errRest
|
|
8497
8680
|
}
|
|
8498
8681
|
} else {
|
|
8499
8682
|
if (!isCrossDrag) {
|
|
8500
|
-
return
|
|
8683
|
+
return errRest
|
|
8501
8684
|
}
|
|
8502
8685
|
|
|
8503
8686
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -8509,7 +8692,7 @@ export default defineComponent({
|
|
|
8509
8692
|
content: getI18n('vxe.error.treeDragChild')
|
|
8510
8693
|
})
|
|
8511
8694
|
}
|
|
8512
|
-
return
|
|
8695
|
+
return errRest
|
|
8513
8696
|
}
|
|
8514
8697
|
}
|
|
8515
8698
|
}
|
|
@@ -8517,13 +8700,13 @@ export default defineComponent({
|
|
|
8517
8700
|
// 子到根
|
|
8518
8701
|
|
|
8519
8702
|
if (!isCrossDrag) {
|
|
8520
|
-
return
|
|
8703
|
+
return errRest
|
|
8521
8704
|
}
|
|
8522
8705
|
} else if (newColumn.parentId) {
|
|
8523
8706
|
// 根到子
|
|
8524
8707
|
|
|
8525
8708
|
if (!isCrossDrag) {
|
|
8526
|
-
return
|
|
8709
|
+
return errRest
|
|
8527
8710
|
}
|
|
8528
8711
|
if (oldAllMaps[newColumn.id]) {
|
|
8529
8712
|
isSelfToChildStatus = true
|
|
@@ -8534,7 +8717,7 @@ export default defineComponent({
|
|
|
8534
8717
|
content: getI18n('vxe.error.treeDragChild')
|
|
8535
8718
|
})
|
|
8536
8719
|
}
|
|
8537
|
-
return
|
|
8720
|
+
return errRest
|
|
8538
8721
|
}
|
|
8539
8722
|
}
|
|
8540
8723
|
} else {
|
|
@@ -8598,27 +8781,34 @@ export default defineComponent({
|
|
|
8598
8781
|
}
|
|
8599
8782
|
}
|
|
8600
8783
|
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8784
|
+
if (evnt) {
|
|
8785
|
+
dispatchEvent('column-dragend', {
|
|
8786
|
+
oldColumn: dragColumn,
|
|
8787
|
+
newColumn,
|
|
8788
|
+
dragColumn,
|
|
8789
|
+
dragPos: prevDragPos,
|
|
8790
|
+
dragToChild: isDragToChildFlag,
|
|
8791
|
+
offsetIndex: dragOffsetIndex,
|
|
8792
|
+
_index: {
|
|
8793
|
+
newIndex: nafIndex,
|
|
8794
|
+
oldIndex: oafIndex
|
|
8795
|
+
}
|
|
8796
|
+
}, evnt)
|
|
8797
|
+
}
|
|
8613
8798
|
|
|
8614
8799
|
if (isSyncColumn) {
|
|
8615
8800
|
$xeTable.handleColDragSwapColumn()
|
|
8616
8801
|
}
|
|
8802
|
+
|
|
8803
|
+
return {
|
|
8804
|
+
status: true
|
|
8805
|
+
}
|
|
8617
8806
|
}).catch(() => {
|
|
8807
|
+
return errRest
|
|
8618
8808
|
})
|
|
8619
8809
|
}
|
|
8620
8810
|
}
|
|
8621
|
-
return Promise.resolve()
|
|
8811
|
+
return Promise.resolve(errRest)
|
|
8622
8812
|
},
|
|
8623
8813
|
handleHeaderCellDragDragendEvent (evnt) {
|
|
8624
8814
|
const { dragCol } = reactData
|
|
@@ -9454,18 +9644,16 @@ export default defineComponent({
|
|
|
9454
9644
|
}
|
|
9455
9645
|
|
|
9456
9646
|
// 检测对应模块是否安装
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
(
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
(
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
})
|
|
9468
|
-
}
|
|
9647
|
+
'openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').forEach(name => {
|
|
9648
|
+
($xeTable as any)[name] = function () {
|
|
9649
|
+
errLog('vxe.error.reqModule', ['VxeTableExportModule'])
|
|
9650
|
+
}
|
|
9651
|
+
})
|
|
9652
|
+
'clearValidate,fullValidate,validate'.split(',').forEach(name => {
|
|
9653
|
+
($xeTable as any)[name] = function () {
|
|
9654
|
+
errLog('vxe.error.reqModule', ['VxeTableValidatorModule'])
|
|
9655
|
+
}
|
|
9656
|
+
})
|
|
9469
9657
|
|
|
9470
9658
|
Object.assign($xeTable, tableMethods, tablePrivateMethods)
|
|
9471
9659
|
|
|
@@ -10473,23 +10661,21 @@ export default defineComponent({
|
|
|
10473
10661
|
tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable })
|
|
10474
10662
|
})
|
|
10475
10663
|
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
if (
|
|
10479
|
-
|
|
10480
|
-
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10481
|
-
}
|
|
10664
|
+
nextTick(() => {
|
|
10665
|
+
if (props.loading) {
|
|
10666
|
+
if (!VxeUILoadingComponent && !slots.loading) {
|
|
10667
|
+
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10482
10668
|
}
|
|
10483
|
-
|
|
10669
|
+
}
|
|
10670
|
+
if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
|
|
10484
10671
|
(props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
|
|
10485
10672
|
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
10486
10673
|
props.tooltipConfig || props.editRules) {
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
}
|
|
10674
|
+
if (!VxeUITooltipComponent) {
|
|
10675
|
+
errLog('vxe.error.reqComp', ['vxe-tooltip'])
|
|
10490
10676
|
}
|
|
10491
|
-
}
|
|
10492
|
-
}
|
|
10677
|
+
}
|
|
10678
|
+
})
|
|
10493
10679
|
|
|
10494
10680
|
provide('$xeColgroup', null)
|
|
10495
10681
|
provide('$xeTable', $xeTable)
|