vxe-table 4.12.0-beta.0 → 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 -76
- 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/edit/hook.js +1 -1
- 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 +49 -6
- package/es/table/module/validator/hook.js +1 -3
- package/es/table/render/index.js +90 -61
- package/es/table/src/body.js +13 -8
- 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 +374 -191
- 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 -82
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1276 -12214
- 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/edit/hook.js +1 -1
- package/lib/table/module/edit/hook.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 +53 -6
- 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 +12 -6
- 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 +409 -189
- 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 -82
- 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/edit/hook.ts +1 -1
- 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 +49 -8
- package/packages/table/module/validator/hook.ts +1 -3
- package/packages/table/render/index.ts +89 -59
- package/packages/table/src/body.ts +12 -7
- 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 +380 -189
- package/packages/table/src/util.ts +34 -3
- package/packages/toolbar/src/toolbar.ts +16 -24
- /package/es/{iconfont.1740732137800.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/es/{iconfont.1740732137800.woff → iconfont.1741664494856.woff} +0 -0
- /package/es/{iconfont.1740732137800.woff2 → iconfont.1741664494856.woff2} +0 -0
- /package/lib/{iconfont.1740732137800.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/lib/{iconfont.1740732137800.woff → iconfont.1741664494856.woff} +0 -0
- /package/lib/{iconfont.1740732137800.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
|
|
@@ -7460,8 +7619,8 @@ export default defineComponent({
|
|
|
7460
7619
|
const { treeConfig } = props
|
|
7461
7620
|
const { selectCheckboxMaps, treeIndeterminateMaps } = reactData
|
|
7462
7621
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7463
|
-
const { checkField, checkMethod } = checkboxOpts
|
|
7464
|
-
const { afterFullData, afterTreeFullData } = internalData
|
|
7622
|
+
const { checkField, checkMethod, showReserveStatus } = checkboxOpts
|
|
7623
|
+
const { afterFullData, afterTreeFullData, checkboxReserveRowMap } = internalData
|
|
7465
7624
|
|
|
7466
7625
|
let sLen = 0 // 已选
|
|
7467
7626
|
let hLen = 0 // 半选
|
|
@@ -7499,7 +7658,12 @@ export default defineComponent({
|
|
|
7499
7658
|
})
|
|
7500
7659
|
|
|
7501
7660
|
const isSelected = rootList.length > 0 ? (vLen > 0 ? (sLen >= vLen) : (sLen >= rootList.length)) : false
|
|
7502
|
-
|
|
7661
|
+
let halfSelect = !isSelected && (sLen >= 1 || hLen >= 1)
|
|
7662
|
+
|
|
7663
|
+
// 如果复选框启用保留记录,当保留数据存在时显示半选
|
|
7664
|
+
if (!isSelected && !halfSelect && showReserveStatus) {
|
|
7665
|
+
halfSelect = !XEUtils.isEmpty(checkboxReserveRowMap)
|
|
7666
|
+
}
|
|
7503
7667
|
|
|
7504
7668
|
reactData.isAllSelected = isSelected
|
|
7505
7669
|
reactData.isIndeterminate = halfSelect
|
|
@@ -7521,6 +7685,7 @@ export default defineComponent({
|
|
|
7521
7685
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
7522
7686
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7523
7687
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts
|
|
7688
|
+
// indeterminateField 仅支持读取
|
|
7524
7689
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
7525
7690
|
if (checkField) {
|
|
7526
7691
|
// 树结构
|
|
@@ -7697,17 +7862,18 @@ export default defineComponent({
|
|
|
7697
7862
|
const { _lastResizeTime } = internalData
|
|
7698
7863
|
const sortOpts = computeSortOpts.value
|
|
7699
7864
|
const columnOpts = computeColumnOpts.value
|
|
7865
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
7700
7866
|
const { column } = params
|
|
7701
7867
|
const cell = evnt.currentTarget
|
|
7702
7868
|
const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300
|
|
7703
7869
|
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag
|
|
7704
7870
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag
|
|
7705
7871
|
if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
|
|
7706
|
-
|
|
7872
|
+
$xeTable.triggerSortEvent(evnt, column, getNextSortOrder(column))
|
|
7707
7873
|
}
|
|
7708
7874
|
dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt)
|
|
7709
|
-
if (columnOpts.isCurrent || props.highlightCurrentColumn) {
|
|
7710
|
-
|
|
7875
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7876
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
7711
7877
|
}
|
|
7712
7878
|
},
|
|
7713
7879
|
triggerHeaderCellDblclickEvent (evnt, params) {
|
|
@@ -7719,7 +7885,7 @@ export default defineComponent({
|
|
|
7719
7885
|
* 如果是双击模式,则单击后选中状态
|
|
7720
7886
|
*/
|
|
7721
7887
|
triggerCellClickEvent (evnt, params) {
|
|
7722
|
-
const { highlightCurrentRow, editConfig } = props
|
|
7888
|
+
const { highlightCurrentRow, highlightCurrentColumn, editConfig } = props
|
|
7723
7889
|
const { editStore, isDragResize } = reactData
|
|
7724
7890
|
if (isDragResize) {
|
|
7725
7891
|
return
|
|
@@ -7731,6 +7897,8 @@ export default defineComponent({
|
|
|
7731
7897
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7732
7898
|
const keyboardOpts = computeKeyboardOpts.value
|
|
7733
7899
|
const rowOpts = computeRowOpts.value
|
|
7900
|
+
const columnOpts = computeColumnOpts.value
|
|
7901
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
7734
7902
|
const { actived, focused } = editStore
|
|
7735
7903
|
const { row, column } = params
|
|
7736
7904
|
const { type, treeNode } = column
|
|
@@ -7746,29 +7914,35 @@ export default defineComponent({
|
|
|
7746
7914
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7747
7915
|
// 如果是展开行
|
|
7748
7916
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
|
|
7749
|
-
|
|
7917
|
+
$xeTable.triggerRowExpandEvent(evnt, params)
|
|
7750
7918
|
}
|
|
7751
7919
|
// 如果是树形表格
|
|
7752
7920
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7753
|
-
|
|
7921
|
+
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
7754
7922
|
}
|
|
7755
7923
|
}
|
|
7756
7924
|
// 如果点击了树节点
|
|
7757
7925
|
if (!triggerTreeNode) {
|
|
7758
7926
|
if (!triggerExpandNode) {
|
|
7759
|
-
//
|
|
7927
|
+
// 如果是当前行
|
|
7760
7928
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7761
7929
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7762
|
-
|
|
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)
|
|
7763
7937
|
}
|
|
7764
7938
|
}
|
|
7765
7939
|
// 如果是单选框
|
|
7766
7940
|
if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
|
|
7767
|
-
|
|
7941
|
+
$xeTable.triggerRadioRowEvent(evnt, params)
|
|
7768
7942
|
}
|
|
7769
7943
|
// 如果是复选框
|
|
7770
7944
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
|
|
7771
|
-
|
|
7945
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params)
|
|
7772
7946
|
}
|
|
7773
7947
|
}
|
|
7774
7948
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -8158,6 +8332,9 @@ export default defineComponent({
|
|
|
8158
8332
|
const { afterFullData, tableFullData } = internalData
|
|
8159
8333
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
8160
8334
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
8335
|
+
const errRest = {
|
|
8336
|
+
status: false
|
|
8337
|
+
}
|
|
8161
8338
|
if (prevDragRow && dragRow) {
|
|
8162
8339
|
// 判断是否有拖动
|
|
8163
8340
|
if (prevDragRow !== dragRow) {
|
|
@@ -8172,7 +8349,7 @@ export default defineComponent({
|
|
|
8172
8349
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8173
8350
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8174
8351
|
if (!status) {
|
|
8175
|
-
return
|
|
8352
|
+
return errRest
|
|
8176
8353
|
}
|
|
8177
8354
|
|
|
8178
8355
|
let oafIndex = -1
|
|
@@ -8203,11 +8380,11 @@ export default defineComponent({
|
|
|
8203
8380
|
if (isPeerDrag && !isCrossDrag) {
|
|
8204
8381
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8205
8382
|
// 非同级
|
|
8206
|
-
return
|
|
8383
|
+
return errRest
|
|
8207
8384
|
}
|
|
8208
8385
|
} else {
|
|
8209
8386
|
if (!isCrossDrag) {
|
|
8210
|
-
return
|
|
8387
|
+
return errRest
|
|
8211
8388
|
}
|
|
8212
8389
|
if (oldAllMaps[newRowid]) {
|
|
8213
8390
|
isSelfToChildStatus = true
|
|
@@ -8218,7 +8395,7 @@ export default defineComponent({
|
|
|
8218
8395
|
content: getI18n('vxe.error.treeDragChild')
|
|
8219
8396
|
})
|
|
8220
8397
|
}
|
|
8221
|
-
return
|
|
8398
|
+
return errRest
|
|
8222
8399
|
}
|
|
8223
8400
|
}
|
|
8224
8401
|
}
|
|
@@ -8226,13 +8403,13 @@ export default defineComponent({
|
|
|
8226
8403
|
// 子到根
|
|
8227
8404
|
|
|
8228
8405
|
if (!isCrossDrag) {
|
|
8229
|
-
return
|
|
8406
|
+
return errRest
|
|
8230
8407
|
}
|
|
8231
8408
|
} else if (newLevel) {
|
|
8232
8409
|
// 根到子
|
|
8233
8410
|
|
|
8234
8411
|
if (!isCrossDrag) {
|
|
8235
|
-
return
|
|
8412
|
+
return errRest
|
|
8236
8413
|
}
|
|
8237
8414
|
if (oldAllMaps[newRowid]) {
|
|
8238
8415
|
isSelfToChildStatus = true
|
|
@@ -8243,7 +8420,7 @@ export default defineComponent({
|
|
|
8243
8420
|
content: getI18n('vxe.error.treeDragChild')
|
|
8244
8421
|
})
|
|
8245
8422
|
}
|
|
8246
|
-
return
|
|
8423
|
+
return errRest
|
|
8247
8424
|
}
|
|
8248
8425
|
}
|
|
8249
8426
|
} else {
|
|
@@ -8307,28 +8484,36 @@ export default defineComponent({
|
|
|
8307
8484
|
if (reactData.scrollYLoad) {
|
|
8308
8485
|
$xeTable.updateScrollYSpace()
|
|
8309
8486
|
}
|
|
8310
|
-
|
|
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(() => {
|
|
8311
8504
|
$xeTable.updateCellAreas()
|
|
8312
8505
|
$xeTable.recalculate()
|
|
8313
|
-
})
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
oldRow: dragRow,
|
|
8317
|
-
newRow: prevDragRow,
|
|
8318
|
-
dragRow,
|
|
8319
|
-
dragPos: prevDragPos as any,
|
|
8320
|
-
dragToChild: isDragToChildFlag,
|
|
8321
|
-
offsetIndex: dragOffsetIndex,
|
|
8322
|
-
_index: {
|
|
8323
|
-
newIndex: nafIndex,
|
|
8324
|
-
oldIndex: oafIndex
|
|
8506
|
+
}).then(() => {
|
|
8507
|
+
return {
|
|
8508
|
+
status: true
|
|
8325
8509
|
}
|
|
8326
|
-
}
|
|
8510
|
+
})
|
|
8327
8511
|
}).catch(() => {
|
|
8512
|
+
return errRest
|
|
8328
8513
|
})
|
|
8329
8514
|
}
|
|
8330
8515
|
}
|
|
8331
|
-
return Promise.resolve()
|
|
8516
|
+
return Promise.resolve(errRest)
|
|
8332
8517
|
},
|
|
8333
8518
|
handleRowDragDragendEvent (evnt) {
|
|
8334
8519
|
const { treeConfig } = props
|
|
@@ -8453,6 +8638,9 @@ export default defineComponent({
|
|
|
8453
8638
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8454
8639
|
const { collectColumn } = internalData
|
|
8455
8640
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
8641
|
+
const errRest = {
|
|
8642
|
+
status: false
|
|
8643
|
+
}
|
|
8456
8644
|
if (prevDragCol && dragCol) {
|
|
8457
8645
|
// 判断是否有拖动
|
|
8458
8646
|
if (prevDragCol !== dragCol) {
|
|
@@ -8469,7 +8657,7 @@ export default defineComponent({
|
|
|
8469
8657
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8470
8658
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8471
8659
|
if (!status) {
|
|
8472
|
-
return
|
|
8660
|
+
return errRest
|
|
8473
8661
|
}
|
|
8474
8662
|
|
|
8475
8663
|
let oafIndex = -1
|
|
@@ -8488,11 +8676,11 @@ export default defineComponent({
|
|
|
8488
8676
|
if (isPeerDrag && !isCrossDrag) {
|
|
8489
8677
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8490
8678
|
// 非同级
|
|
8491
|
-
return
|
|
8679
|
+
return errRest
|
|
8492
8680
|
}
|
|
8493
8681
|
} else {
|
|
8494
8682
|
if (!isCrossDrag) {
|
|
8495
|
-
return
|
|
8683
|
+
return errRest
|
|
8496
8684
|
}
|
|
8497
8685
|
|
|
8498
8686
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -8504,7 +8692,7 @@ export default defineComponent({
|
|
|
8504
8692
|
content: getI18n('vxe.error.treeDragChild')
|
|
8505
8693
|
})
|
|
8506
8694
|
}
|
|
8507
|
-
return
|
|
8695
|
+
return errRest
|
|
8508
8696
|
}
|
|
8509
8697
|
}
|
|
8510
8698
|
}
|
|
@@ -8512,13 +8700,13 @@ export default defineComponent({
|
|
|
8512
8700
|
// 子到根
|
|
8513
8701
|
|
|
8514
8702
|
if (!isCrossDrag) {
|
|
8515
|
-
return
|
|
8703
|
+
return errRest
|
|
8516
8704
|
}
|
|
8517
8705
|
} else if (newColumn.parentId) {
|
|
8518
8706
|
// 根到子
|
|
8519
8707
|
|
|
8520
8708
|
if (!isCrossDrag) {
|
|
8521
|
-
return
|
|
8709
|
+
return errRest
|
|
8522
8710
|
}
|
|
8523
8711
|
if (oldAllMaps[newColumn.id]) {
|
|
8524
8712
|
isSelfToChildStatus = true
|
|
@@ -8529,7 +8717,7 @@ export default defineComponent({
|
|
|
8529
8717
|
content: getI18n('vxe.error.treeDragChild')
|
|
8530
8718
|
})
|
|
8531
8719
|
}
|
|
8532
|
-
return
|
|
8720
|
+
return errRest
|
|
8533
8721
|
}
|
|
8534
8722
|
}
|
|
8535
8723
|
} else {
|
|
@@ -8593,27 +8781,34 @@ export default defineComponent({
|
|
|
8593
8781
|
}
|
|
8594
8782
|
}
|
|
8595
8783
|
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
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
|
+
}
|
|
8608
8798
|
|
|
8609
8799
|
if (isSyncColumn) {
|
|
8610
8800
|
$xeTable.handleColDragSwapColumn()
|
|
8611
8801
|
}
|
|
8802
|
+
|
|
8803
|
+
return {
|
|
8804
|
+
status: true
|
|
8805
|
+
}
|
|
8612
8806
|
}).catch(() => {
|
|
8807
|
+
return errRest
|
|
8613
8808
|
})
|
|
8614
8809
|
}
|
|
8615
8810
|
}
|
|
8616
|
-
return Promise.resolve()
|
|
8811
|
+
return Promise.resolve(errRest)
|
|
8617
8812
|
},
|
|
8618
8813
|
handleHeaderCellDragDragendEvent (evnt) {
|
|
8619
8814
|
const { dragCol } = reactData
|
|
@@ -9449,18 +9644,16 @@ export default defineComponent({
|
|
|
9449
9644
|
}
|
|
9450
9645
|
|
|
9451
9646
|
// 检测对应模块是否安装
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
(
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
(
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
})
|
|
9463
|
-
}
|
|
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
|
+
})
|
|
9464
9657
|
|
|
9465
9658
|
Object.assign($xeTable, tableMethods, tablePrivateMethods)
|
|
9466
9659
|
|
|
@@ -10327,7 +10520,7 @@ export default defineComponent({
|
|
|
10327
10520
|
if (rowOpts.height && !props.showOverflow) {
|
|
10328
10521
|
warnLog('vxe.error.notProp', ['table.show-overflow'])
|
|
10329
10522
|
}
|
|
10330
|
-
if (!$xeTable.
|
|
10523
|
+
if (!$xeTable.handleCellAreaMousedownEvent) {
|
|
10331
10524
|
if (props.areaConfig) {
|
|
10332
10525
|
warnLog('vxe.error.notProp', ['area-config'])
|
|
10333
10526
|
}
|
|
@@ -10468,23 +10661,21 @@ export default defineComponent({
|
|
|
10468
10661
|
tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable })
|
|
10469
10662
|
})
|
|
10470
10663
|
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
if (
|
|
10474
|
-
|
|
10475
|
-
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10476
|
-
}
|
|
10664
|
+
nextTick(() => {
|
|
10665
|
+
if (props.loading) {
|
|
10666
|
+
if (!VxeUILoadingComponent && !slots.loading) {
|
|
10667
|
+
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10477
10668
|
}
|
|
10478
|
-
|
|
10669
|
+
}
|
|
10670
|
+
if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
|
|
10479
10671
|
(props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
|
|
10480
10672
|
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
10481
10673
|
props.tooltipConfig || props.editRules) {
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
}
|
|
10674
|
+
if (!VxeUITooltipComponent) {
|
|
10675
|
+
errLog('vxe.error.reqComp', ['vxe-tooltip'])
|
|
10485
10676
|
}
|
|
10486
|
-
}
|
|
10487
|
-
}
|
|
10677
|
+
}
|
|
10678
|
+
})
|
|
10488
10679
|
|
|
10489
10680
|
provide('$xeColgroup', null)
|
|
10490
10681
|
provide('$xeTable', $xeTable)
|