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
package/es/table/src/table.js
CHANGED
|
@@ -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';
|
|
@@ -464,6 +464,9 @@ export default defineComponent({
|
|
|
464
464
|
const computeColumnOpts = computed(() => {
|
|
465
465
|
return Object.assign({}, getConfig().table.columnConfig, props.columnConfig);
|
|
466
466
|
});
|
|
467
|
+
const computeCurrentColumnOpts = computed(() => {
|
|
468
|
+
return Object.assign({}, getConfig().table.currentColumnConfig, props.currentColumnConfig);
|
|
469
|
+
});
|
|
467
470
|
const computeCellOpts = computed(() => {
|
|
468
471
|
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig);
|
|
469
472
|
});
|
|
@@ -476,6 +479,9 @@ export default defineComponent({
|
|
|
476
479
|
const computeRowOpts = computed(() => {
|
|
477
480
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
478
481
|
});
|
|
482
|
+
const computeCurrentRowOpts = computed(() => {
|
|
483
|
+
return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig);
|
|
484
|
+
});
|
|
479
485
|
const computeRowDragOpts = computed(() => {
|
|
480
486
|
return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig);
|
|
481
487
|
});
|
|
@@ -734,6 +740,7 @@ export default defineComponent({
|
|
|
734
740
|
computeScrollbarXToTop,
|
|
735
741
|
computeScrollbarYToLeft,
|
|
736
742
|
computeColumnOpts,
|
|
743
|
+
computeCurrentColumnOpts,
|
|
737
744
|
computeScrollXThreshold,
|
|
738
745
|
computeScrollYThreshold,
|
|
739
746
|
computeDefaultRowHeight,
|
|
@@ -741,6 +748,7 @@ export default defineComponent({
|
|
|
741
748
|
computeHeaderCellOpts,
|
|
742
749
|
computeFooterCellOpts,
|
|
743
750
|
computeRowOpts,
|
|
751
|
+
computeCurrentRowOpts,
|
|
744
752
|
computeRowDragOpts,
|
|
745
753
|
computeColumnDragOpts,
|
|
746
754
|
computeResizeOpts,
|
|
@@ -1265,14 +1273,12 @@ export default defineComponent({
|
|
|
1265
1273
|
if ((expandColumn && expandOpts.mode !== 'fixed') && mouseOpts.area) {
|
|
1266
1274
|
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
|
|
1267
1275
|
}
|
|
1268
|
-
if (
|
|
1269
|
-
if (
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
1275
|
-
}
|
|
1276
|
+
if (htmlColumn) {
|
|
1277
|
+
if (!columnOpts.useKey) {
|
|
1278
|
+
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
|
|
1279
|
+
}
|
|
1280
|
+
if (!rowOpts.useKey) {
|
|
1281
|
+
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
1276
1282
|
}
|
|
1277
1283
|
}
|
|
1278
1284
|
reactData.isGroup = isGroup;
|
|
@@ -2240,6 +2246,7 @@ export default defineComponent({
|
|
|
2240
2246
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2241
2247
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
2242
2248
|
const { checkField, reserve, checkMethod } = checkboxOpts;
|
|
2249
|
+
// indeterminateField 仅支持读取
|
|
2243
2250
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
2244
2251
|
const selectRowMaps = {};
|
|
2245
2252
|
/**
|
|
@@ -2505,12 +2512,12 @@ export default defineComponent({
|
|
|
2505
2512
|
rExpandLazyLoadedMaps[rowid] = row;
|
|
2506
2513
|
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
2507
2514
|
loadMethod({ $table: $xeTable, row, rowIndex: tableMethods.getRowIndex(row), $rowIndex: tableMethods.getVMRowIndex(row) }).then(() => {
|
|
2508
|
-
const
|
|
2515
|
+
const rowTempExpandedMaps = Object.assign({}, reactData.rowExpandedMaps);
|
|
2509
2516
|
if (rowRest) {
|
|
2510
2517
|
rowRest.expandLoaded = true;
|
|
2511
2518
|
}
|
|
2512
|
-
|
|
2513
|
-
reactData.rowExpandedMaps =
|
|
2519
|
+
rowTempExpandedMaps[rowid] = row;
|
|
2520
|
+
reactData.rowExpandedMaps = rowTempExpandedMaps;
|
|
2514
2521
|
}).catch(() => {
|
|
2515
2522
|
if (rowRest) {
|
|
2516
2523
|
rowRest.expandLoaded = false;
|
|
@@ -2653,32 +2660,30 @@ export default defineComponent({
|
|
|
2653
2660
|
const { transform } = treeOpts;
|
|
2654
2661
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2655
2662
|
let treeData = [];
|
|
2656
|
-
let fullData = reactive(datas ? datas.slice(0) : []); //
|
|
2663
|
+
let fullData = reactive(datas ? datas.slice(0) : []); // 转为响应式数据
|
|
2657
2664
|
if (treeConfig) {
|
|
2658
2665
|
if (transform) {
|
|
2659
2666
|
// 树结构自动转换
|
|
2660
|
-
if (
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2675
|
-
}
|
|
2676
|
-
// fullData.forEach(row => {
|
|
2677
|
-
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2678
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2679
|
-
// }
|
|
2680
|
-
// })
|
|
2667
|
+
if (!treeOpts.rowField) {
|
|
2668
|
+
errLog('vxe.error.reqProp', ['tree-config.rowField']);
|
|
2669
|
+
}
|
|
2670
|
+
if (!treeOpts.parentField) {
|
|
2671
|
+
errLog('vxe.error.reqProp', ['tree-config.parentField']);
|
|
2672
|
+
}
|
|
2673
|
+
if (!childrenField) {
|
|
2674
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2675
|
+
}
|
|
2676
|
+
if (!treeOpts.mapChildrenField) {
|
|
2677
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2678
|
+
}
|
|
2679
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2680
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2681
2681
|
}
|
|
2682
|
+
// fullData.forEach(row => {
|
|
2683
|
+
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2684
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2685
|
+
// }
|
|
2686
|
+
// })
|
|
2682
2687
|
treeData = XEUtils.toArrayTree(fullData, {
|
|
2683
2688
|
key: treeOpts.rowField,
|
|
2684
2689
|
parentKey: treeOpts.parentField,
|
|
@@ -2743,16 +2748,14 @@ export default defineComponent({
|
|
|
2743
2748
|
// }
|
|
2744
2749
|
// }
|
|
2745
2750
|
// }
|
|
2746
|
-
if (
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2755
|
-
}
|
|
2751
|
+
if (!(props.height || props.maxHeight)) {
|
|
2752
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2753
|
+
}
|
|
2754
|
+
// if (!props.showOverflow) {
|
|
2755
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2756
|
+
// }
|
|
2757
|
+
if (props.spanMethod) {
|
|
2758
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2756
2759
|
}
|
|
2757
2760
|
}
|
|
2758
2761
|
handleReserveStatus();
|
|
@@ -3444,6 +3447,9 @@ export default defineComponent({
|
|
|
3444
3447
|
};
|
|
3445
3448
|
tableMethods = {
|
|
3446
3449
|
dispatchEvent,
|
|
3450
|
+
getEl() {
|
|
3451
|
+
return refElem.value;
|
|
3452
|
+
},
|
|
3447
3453
|
/**
|
|
3448
3454
|
* 重置表格的一切数据状态
|
|
3449
3455
|
*/
|
|
@@ -3737,23 +3743,6 @@ export default defineComponent({
|
|
|
3737
3743
|
}
|
|
3738
3744
|
return tableMethods.createData(records).then((rows) => isArr ? rows : rows[0]);
|
|
3739
3745
|
},
|
|
3740
|
-
// toOriginalRecords (rows: any[]) {
|
|
3741
|
-
// const { treeConfig } = props
|
|
3742
|
-
// const treeOpts = computeTreeOpts.value
|
|
3743
|
-
// const { transform, mapChildrenField } = treeOpts
|
|
3744
|
-
// const rowkey = getRowkey($xeTable)
|
|
3745
|
-
// if (treeConfig) {
|
|
3746
|
-
// if (transform) {
|
|
3747
|
-
// return []
|
|
3748
|
-
// }
|
|
3749
|
-
// return []
|
|
3750
|
-
// }
|
|
3751
|
-
// return rows.map(item => {
|
|
3752
|
-
// const obj = Object.assign({}, item)
|
|
3753
|
-
// delete obj.rowkey
|
|
3754
|
-
// return obj
|
|
3755
|
-
// })
|
|
3756
|
-
// },
|
|
3757
3746
|
/**
|
|
3758
3747
|
* 还原数据
|
|
3759
3748
|
* 如果不传任何参数,则还原整个表格
|
|
@@ -3762,11 +3751,15 @@ export default defineComponent({
|
|
|
3762
3751
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
3763
3752
|
*/
|
|
3764
3753
|
revertData(rows, field) {
|
|
3765
|
-
const { keepSource } = props;
|
|
3766
|
-
const {
|
|
3754
|
+
const { keepSource, treeConfig } = props;
|
|
3755
|
+
const { editStore } = reactData;
|
|
3756
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
3757
|
+
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3758
|
+
const treeOpts = computeTreeOpts.value;
|
|
3759
|
+
const { transform } = treeOpts;
|
|
3767
3760
|
if (!keepSource) {
|
|
3768
3761
|
if (process.env.NODE_ENV === 'development') {
|
|
3769
|
-
|
|
3762
|
+
errLog('vxe.error.reqProp', ['keep-source']);
|
|
3770
3763
|
}
|
|
3771
3764
|
return nextTick();
|
|
3772
3765
|
}
|
|
@@ -3779,26 +3772,53 @@ export default defineComponent({
|
|
|
3779
3772
|
else {
|
|
3780
3773
|
targetRows = XEUtils.toArray($xeTable.getUpdateRecords());
|
|
3781
3774
|
}
|
|
3775
|
+
let reDelFlag = false;
|
|
3782
3776
|
if (targetRows.length) {
|
|
3783
|
-
targetRows.forEach((
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3777
|
+
targetRows.forEach((item) => {
|
|
3778
|
+
const rowid = getRowid($xeTable, item);
|
|
3779
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3780
|
+
if (rowRest) {
|
|
3781
|
+
const row = rowRest.row;
|
|
3782
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3783
|
+
const oRow = sourceDataRowIdData[rowid];
|
|
3784
|
+
if (oRow && row) {
|
|
3785
|
+
if (field) {
|
|
3786
|
+
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true));
|
|
3787
|
+
}
|
|
3788
|
+
else {
|
|
3789
|
+
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
3790
|
+
}
|
|
3791
|
+
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3792
|
+
delete removeTempMaps[rowid];
|
|
3793
|
+
tableFullData.unshift(row);
|
|
3794
|
+
afterFullData.unshift(row);
|
|
3795
|
+
reDelFlag = true;
|
|
3796
|
+
}
|
|
3793
3797
|
}
|
|
3794
3798
|
}
|
|
3795
3799
|
}
|
|
3796
3800
|
});
|
|
3797
3801
|
}
|
|
3798
3802
|
if (rows) {
|
|
3799
|
-
|
|
3803
|
+
if (reDelFlag) {
|
|
3804
|
+
editStore.removeMaps = removeTempMaps;
|
|
3805
|
+
$xeTable.updateFooter();
|
|
3806
|
+
$xeTable.cacheRowMap(false);
|
|
3807
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
3808
|
+
if (!(treeConfig && transform)) {
|
|
3809
|
+
$xeTable.updateAfterDataIndex();
|
|
3810
|
+
}
|
|
3811
|
+
$xeTable.checkSelectionStatus();
|
|
3812
|
+
if (reactData.scrollYLoad) {
|
|
3813
|
+
$xeTable.updateScrollYSpace();
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
return nextTick().then(() => {
|
|
3817
|
+
$xeTable.updateCellAreas();
|
|
3818
|
+
return $xeTable.recalculate();
|
|
3819
|
+
});
|
|
3800
3820
|
}
|
|
3801
|
-
return
|
|
3821
|
+
return $xeTable.reloadData(tableSourceData);
|
|
3802
3822
|
},
|
|
3803
3823
|
/**
|
|
3804
3824
|
* 清空单元格内容
|
|
@@ -3918,6 +3938,11 @@ export default defineComponent({
|
|
|
3918
3938
|
const rowid = getRowid($xeTable, row);
|
|
3919
3939
|
return !!editStore.insertMaps[rowid];
|
|
3920
3940
|
},
|
|
3941
|
+
isRemoveByRow(row) {
|
|
3942
|
+
const { editStore } = reactData;
|
|
3943
|
+
const rowid = getRowid($xeTable, row);
|
|
3944
|
+
return !!editStore.removeMaps[rowid];
|
|
3945
|
+
},
|
|
3921
3946
|
/**
|
|
3922
3947
|
* 删除所有新增的临时数据
|
|
3923
3948
|
* @returns
|
|
@@ -3929,18 +3954,20 @@ export default defineComponent({
|
|
|
3929
3954
|
},
|
|
3930
3955
|
/**
|
|
3931
3956
|
* 检查行或列数据是否发生改变
|
|
3932
|
-
* @param {Row}
|
|
3957
|
+
* @param {Row} rowidOrRow 行对象、行主键
|
|
3933
3958
|
* @param {String} field 字段名
|
|
3934
3959
|
*/
|
|
3935
|
-
isUpdateByRow(
|
|
3960
|
+
isUpdateByRow(rowidOrRow, field) {
|
|
3936
3961
|
const { keepSource } = props;
|
|
3937
3962
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData;
|
|
3938
3963
|
if (keepSource) {
|
|
3939
|
-
const rowid = getRowid($xeTable,
|
|
3964
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
3965
|
+
const rowRest = fullDataRowIdData[rowid];
|
|
3940
3966
|
// 新增的数据不需要检测
|
|
3941
|
-
if (!
|
|
3967
|
+
if (!rowRest) {
|
|
3942
3968
|
return false;
|
|
3943
3969
|
}
|
|
3970
|
+
const row = rowRest.row;
|
|
3944
3971
|
const oRow = sourceDataRowIdData[rowid];
|
|
3945
3972
|
if (oRow) {
|
|
3946
3973
|
if (arguments.length > 1) {
|
|
@@ -4004,6 +4031,94 @@ export default defineComponent({
|
|
|
4004
4031
|
tableColumn: reactData.tableColumn.slice(0)
|
|
4005
4032
|
};
|
|
4006
4033
|
},
|
|
4034
|
+
/**
|
|
4035
|
+
* 移动列到指定列的位置
|
|
4036
|
+
* @param fieldOrColumn
|
|
4037
|
+
* @param targetFieldOrColumn
|
|
4038
|
+
* @param options
|
|
4039
|
+
*/
|
|
4040
|
+
moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
|
|
4041
|
+
const { fullColumnIdData, visibleColumn } = internalData;
|
|
4042
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
4043
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
4044
|
+
let prevDragCol = null;
|
|
4045
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
|
|
4046
|
+
let defPos = 'left';
|
|
4047
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
4048
|
+
if (colRest && targetFieldOrColumn) {
|
|
4049
|
+
let currList = colRest.items;
|
|
4050
|
+
let offsetIndex = colRest._index + targetFieldOrColumn;
|
|
4051
|
+
if (isCrossDrag) {
|
|
4052
|
+
currList = visibleColumn;
|
|
4053
|
+
offsetIndex = colRest._index + targetFieldOrColumn;
|
|
4054
|
+
}
|
|
4055
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4056
|
+
prevDragCol = currList[offsetIndex];
|
|
4057
|
+
}
|
|
4058
|
+
if (targetFieldOrColumn > 0) {
|
|
4059
|
+
defPos = 'right';
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
else {
|
|
4064
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
|
|
4065
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
|
|
4066
|
+
if (colRest && targetColRest) {
|
|
4067
|
+
if (targetColRest._index > colRest._index) {
|
|
4068
|
+
defPos = 'right';
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
|
|
4073
|
+
},
|
|
4074
|
+
/**
|
|
4075
|
+
* 移动行到指定行的位置
|
|
4076
|
+
* @param rowidOrRow
|
|
4077
|
+
* @param targetRowidOrRow
|
|
4078
|
+
* @param options
|
|
4079
|
+
*/
|
|
4080
|
+
moveRowTo(rowidOrRow, targetRowidOrRow, options) {
|
|
4081
|
+
const { treeConfig } = props;
|
|
4082
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
4083
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
4084
|
+
const treeOpts = computeTreeOpts.value;
|
|
4085
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
|
|
4086
|
+
let prevDragRow = null;
|
|
4087
|
+
let defPos = 'top';
|
|
4088
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
|
|
4089
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4090
|
+
if (rowRest && targetRowidOrRow) {
|
|
4091
|
+
let currList = afterFullData;
|
|
4092
|
+
let offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4093
|
+
if (treeConfig) {
|
|
4094
|
+
currList = rowRest.items;
|
|
4095
|
+
if (treeOpts.transform) {
|
|
4096
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow;
|
|
4097
|
+
if (isCrossDrag) {
|
|
4098
|
+
currList = afterFullData;
|
|
4099
|
+
offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4104
|
+
prevDragRow = currList[offsetIndex];
|
|
4105
|
+
}
|
|
4106
|
+
if (targetRowidOrRow > 0) {
|
|
4107
|
+
defPos = 'bottom';
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
else {
|
|
4112
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
|
|
4113
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
|
|
4114
|
+
if (rowRest && targetRowRest) {
|
|
4115
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4116
|
+
defPos = 'bottom';
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
|
|
4121
|
+
},
|
|
4007
4122
|
/**
|
|
4008
4123
|
* 获取表格的全量列
|
|
4009
4124
|
*/
|
|
@@ -4023,6 +4138,7 @@ export default defineComponent({
|
|
|
4023
4138
|
*/
|
|
4024
4139
|
getCheckboxRecords(isFull) {
|
|
4025
4140
|
const { treeConfig } = props;
|
|
4141
|
+
const { selectCheckboxMaps } = reactData;
|
|
4026
4142
|
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData;
|
|
4027
4143
|
const treeOpts = computeTreeOpts.value;
|
|
4028
4144
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
@@ -4030,17 +4146,17 @@ export default defineComponent({
|
|
|
4030
4146
|
const { checkField } = checkboxOpts;
|
|
4031
4147
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
4032
4148
|
let rowList = [];
|
|
4033
|
-
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
4034
4149
|
if (checkField) {
|
|
4035
4150
|
if (treeConfig) {
|
|
4151
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
4036
4152
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField });
|
|
4037
4153
|
}
|
|
4038
4154
|
else {
|
|
4155
|
+
const currTableData = isFull ? tableFullData : afterFullData;
|
|
4039
4156
|
rowList = currTableData.filter((row) => XEUtils.get(row, checkField));
|
|
4040
4157
|
}
|
|
4041
4158
|
}
|
|
4042
4159
|
else {
|
|
4043
|
-
const { selectCheckboxMaps } = reactData;
|
|
4044
4160
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
4045
4161
|
if (isFull) {
|
|
4046
4162
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -4725,6 +4841,7 @@ export default defineComponent({
|
|
|
4725
4841
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
4726
4842
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
4727
4843
|
const { checkField, reserve } = checkboxOpts;
|
|
4844
|
+
// indeterminateField 仅支持读取
|
|
4728
4845
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
4729
4846
|
if (checkField) {
|
|
4730
4847
|
const handleClearChecked = (item) => {
|
|
@@ -4854,13 +4971,20 @@ export default defineComponent({
|
|
|
4854
4971
|
* 用于当前列,设置某列行为高亮状态
|
|
4855
4972
|
*/
|
|
4856
4973
|
setCurrentColumn(fieldOrColumn) {
|
|
4974
|
+
const { mouseConfig } = props;
|
|
4975
|
+
const mouseOpts = computeMouseOpts.value;
|
|
4976
|
+
const isMouseSelected = mouseConfig && mouseOpts.selected;
|
|
4857
4977
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
4858
4978
|
if (column) {
|
|
4859
|
-
|
|
4860
|
-
tableMethods.clearCurrentColumn();
|
|
4979
|
+
$xeTable.clearCurrentColumn();
|
|
4861
4980
|
reactData.currentColumn = column;
|
|
4862
4981
|
}
|
|
4863
|
-
return nextTick()
|
|
4982
|
+
return nextTick().then(() => {
|
|
4983
|
+
// 更新状选中态
|
|
4984
|
+
if (isMouseSelected) {
|
|
4985
|
+
$xeTable.addCellSelectedClass();
|
|
4986
|
+
}
|
|
4987
|
+
});
|
|
4864
4988
|
},
|
|
4865
4989
|
/**
|
|
4866
4990
|
* 用于当前列,手动清空当前高亮的状态
|
|
@@ -6006,7 +6130,7 @@ export default defineComponent({
|
|
|
6006
6130
|
// 该行为只对当前激活的表格有效
|
|
6007
6131
|
if (internalData.isActivated) {
|
|
6008
6132
|
tablePrivateMethods.preventEvent(evnt, 'event.keydown', null, () => {
|
|
6009
|
-
const { mouseConfig, keyboardConfig, treeConfig, editConfig, highlightCurrentRow } = props;
|
|
6133
|
+
const { mouseConfig, keyboardConfig, treeConfig, editConfig, highlightCurrentRow, highlightCurrentColumn } = props;
|
|
6010
6134
|
const { ctxMenuStore, editStore, currentRow } = reactData;
|
|
6011
6135
|
const { afterFullData } = internalData;
|
|
6012
6136
|
const isMenu = computeIsMenu.value;
|
|
@@ -6017,6 +6141,7 @@ export default defineComponent({
|
|
|
6017
6141
|
const treeOpts = computeTreeOpts.value;
|
|
6018
6142
|
const menuList = computeMenuList.value;
|
|
6019
6143
|
const rowOpts = computeRowOpts.value;
|
|
6144
|
+
const columnOpts = computeColumnOpts.value;
|
|
6020
6145
|
const { selected, actived } = editStore;
|
|
6021
6146
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6022
6147
|
const keyCode = evnt.keyCode;
|
|
@@ -6190,10 +6315,14 @@ export default defineComponent({
|
|
|
6190
6315
|
if (selected.row && selected.column) {
|
|
6191
6316
|
$xeTable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
6192
6317
|
}
|
|
6193
|
-
|
|
6194
|
-
|
|
6318
|
+
// 当前行按键上下移动
|
|
6319
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
6195
6320
|
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
6196
6321
|
}
|
|
6322
|
+
// 当前行按键左右移动
|
|
6323
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
6324
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
|
|
6325
|
+
}
|
|
6197
6326
|
}
|
|
6198
6327
|
}
|
|
6199
6328
|
else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
@@ -6640,7 +6769,16 @@ export default defineComponent({
|
|
|
6640
6769
|
if (el) {
|
|
6641
6770
|
const parentElem = el.parentNode;
|
|
6642
6771
|
const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
|
|
6643
|
-
|
|
6772
|
+
let parentWrapperHeight = 0;
|
|
6773
|
+
if (parentElem) {
|
|
6774
|
+
if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
|
|
6775
|
+
parentWrapperHeight = $xeGrid.getParentHeight();
|
|
6776
|
+
}
|
|
6777
|
+
else {
|
|
6778
|
+
parentWrapperHeight = parentElem.clientHeight;
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
return Math.floor(parentWrapperHeight - parentPaddingSize);
|
|
6644
6782
|
}
|
|
6645
6783
|
return 0;
|
|
6646
6784
|
},
|
|
@@ -6727,45 +6865,61 @@ export default defineComponent({
|
|
|
6727
6865
|
*/
|
|
6728
6866
|
cacheRowMap() {
|
|
6729
6867
|
const { treeConfig } = props;
|
|
6730
|
-
const
|
|
6868
|
+
const { treeExpandedMaps } = reactData;
|
|
6731
6869
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData;
|
|
6870
|
+
const treeOpts = computeTreeOpts.value;
|
|
6732
6871
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6733
6872
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6873
|
+
const { lazy } = treeOpts;
|
|
6734
6874
|
const rowkey = getRowkey($xeTable);
|
|
6735
|
-
const
|
|
6736
|
-
const fullAllDataRowIdMaps = {};
|
|
6875
|
+
const isDeepKey = rowkey.indexOf('.') > -1;
|
|
6876
|
+
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
6737
6877
|
const fullDataRowIdMaps = {};
|
|
6738
|
-
const
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
if (eqEmptyValue(rowid)) {
|
|
6743
|
-
rowid = getRowUniqueId();
|
|
6744
|
-
XEUtils.set(row, rowkey, rowid);
|
|
6745
|
-
}
|
|
6746
|
-
if (isLazy && row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
6747
|
-
row[childrenField] = null;
|
|
6748
|
-
}
|
|
6749
|
-
let rowRest = fullAllDataRowIdData[rowid];
|
|
6878
|
+
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
6879
|
+
const handleRowId = isDeepKey ? updateDeepRowKey : updateFastRowKey;
|
|
6880
|
+
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
6881
|
+
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
6750
6882
|
if (!rowRest) {
|
|
6751
6883
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
6884
|
+
fullDataRowIdMaps[rowid] = rowRest;
|
|
6885
|
+
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
6752
6886
|
}
|
|
6887
|
+
rowRest.treeLoaded = false;
|
|
6888
|
+
rowRest.expandLoaded = false;
|
|
6753
6889
|
rowRest.row = row;
|
|
6754
6890
|
rowRest.items = items;
|
|
6755
6891
|
rowRest.parent = parentRow;
|
|
6756
6892
|
rowRest.level = level;
|
|
6757
|
-
rowRest.index =
|
|
6893
|
+
rowRest.index = currIndex;
|
|
6894
|
+
rowRest.treeIndex = index;
|
|
6758
6895
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
6759
6896
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
6760
6897
|
};
|
|
6761
|
-
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
6762
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
6763
6898
|
if (treeConfig) {
|
|
6764
|
-
XEUtils.eachTree(tableFullTreeData,
|
|
6899
|
+
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
6900
|
+
const rowid = handleRowId(row, rowkey);
|
|
6901
|
+
if (treeConfig && lazy) {
|
|
6902
|
+
const treeExpRest = treeTempExpandedMaps[rowid];
|
|
6903
|
+
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
6904
|
+
row[childrenField] = null;
|
|
6905
|
+
}
|
|
6906
|
+
if (treeExpRest) {
|
|
6907
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
6908
|
+
delete treeTempExpandedMaps[rowid];
|
|
6909
|
+
}
|
|
6910
|
+
}
|
|
6911
|
+
}
|
|
6912
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
|
|
6913
|
+
}, { children: childrenField });
|
|
6765
6914
|
}
|
|
6766
6915
|
else {
|
|
6767
|
-
tableFullData.forEach(
|
|
6916
|
+
tableFullData.forEach((row, index, items) => {
|
|
6917
|
+
handleRowCache(row, index, items, index, null, handleRowId(row, rowkey), 0, index + 1);
|
|
6918
|
+
});
|
|
6768
6919
|
}
|
|
6920
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
6921
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
6922
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps;
|
|
6769
6923
|
},
|
|
6770
6924
|
cacheSourceMap(fullData) {
|
|
6771
6925
|
const { treeConfig } = props;
|
|
@@ -7420,6 +7574,7 @@ export default defineComponent({
|
|
|
7420
7574
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7421
7575
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7422
7576
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts;
|
|
7577
|
+
// indeterminateField 仅支持读取
|
|
7423
7578
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
7424
7579
|
if (checkField) {
|
|
7425
7580
|
// 树结构
|
|
@@ -7598,17 +7753,18 @@ export default defineComponent({
|
|
|
7598
7753
|
const { _lastResizeTime } = internalData;
|
|
7599
7754
|
const sortOpts = computeSortOpts.value;
|
|
7600
7755
|
const columnOpts = computeColumnOpts.value;
|
|
7756
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
7601
7757
|
const { column } = params;
|
|
7602
7758
|
const cell = evnt.currentTarget;
|
|
7603
7759
|
const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300;
|
|
7604
7760
|
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
|
|
7605
7761
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
|
|
7606
7762
|
if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
|
|
7607
|
-
|
|
7763
|
+
$xeTable.triggerSortEvent(evnt, column, getNextSortOrder(column));
|
|
7608
7764
|
}
|
|
7609
7765
|
dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt);
|
|
7610
|
-
if (columnOpts.isCurrent || props.highlightCurrentColumn) {
|
|
7611
|
-
|
|
7766
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7767
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7612
7768
|
}
|
|
7613
7769
|
},
|
|
7614
7770
|
triggerHeaderCellDblclickEvent(evnt, params) {
|
|
@@ -7620,7 +7776,7 @@ export default defineComponent({
|
|
|
7620
7776
|
* 如果是双击模式,则单击后选中状态
|
|
7621
7777
|
*/
|
|
7622
7778
|
triggerCellClickEvent(evnt, params) {
|
|
7623
|
-
const { highlightCurrentRow, editConfig } = props;
|
|
7779
|
+
const { highlightCurrentRow, highlightCurrentColumn, editConfig } = props;
|
|
7624
7780
|
const { editStore, isDragResize } = reactData;
|
|
7625
7781
|
if (isDragResize) {
|
|
7626
7782
|
return;
|
|
@@ -7632,6 +7788,8 @@ export default defineComponent({
|
|
|
7632
7788
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7633
7789
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
7634
7790
|
const rowOpts = computeRowOpts.value;
|
|
7791
|
+
const columnOpts = computeColumnOpts.value;
|
|
7792
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
7635
7793
|
const { actived, focused } = editStore;
|
|
7636
7794
|
const { row, column } = params;
|
|
7637
7795
|
const { type, treeNode } = column;
|
|
@@ -7647,29 +7805,35 @@ export default defineComponent({
|
|
|
7647
7805
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7648
7806
|
// 如果是展开行
|
|
7649
7807
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
|
|
7650
|
-
|
|
7808
|
+
$xeTable.triggerRowExpandEvent(evnt, params);
|
|
7651
7809
|
}
|
|
7652
7810
|
// 如果是树形表格
|
|
7653
7811
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7654
|
-
|
|
7812
|
+
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
7655
7813
|
}
|
|
7656
7814
|
}
|
|
7657
7815
|
// 如果点击了树节点
|
|
7658
7816
|
if (!triggerTreeNode) {
|
|
7659
7817
|
if (!triggerExpandNode) {
|
|
7660
|
-
//
|
|
7818
|
+
// 如果是当前行
|
|
7661
7819
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7662
7820
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7663
|
-
|
|
7821
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
7822
|
+
}
|
|
7823
|
+
}
|
|
7824
|
+
// 如果是当前列
|
|
7825
|
+
if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7826
|
+
if (!triggerCheckbox && !triggerRadio) {
|
|
7827
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7664
7828
|
}
|
|
7665
7829
|
}
|
|
7666
7830
|
// 如果是单选框
|
|
7667
7831
|
if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
|
|
7668
|
-
|
|
7832
|
+
$xeTable.triggerRadioRowEvent(evnt, params);
|
|
7669
7833
|
}
|
|
7670
7834
|
// 如果是复选框
|
|
7671
7835
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
|
|
7672
|
-
|
|
7836
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params);
|
|
7673
7837
|
}
|
|
7674
7838
|
}
|
|
7675
7839
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -8067,6 +8231,9 @@ export default defineComponent({
|
|
|
8067
8231
|
const { afterFullData, tableFullData } = internalData;
|
|
8068
8232
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
8069
8233
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
8234
|
+
const errRest = {
|
|
8235
|
+
status: false
|
|
8236
|
+
};
|
|
8070
8237
|
if (prevDragRow && dragRow) {
|
|
8071
8238
|
// 判断是否有拖动
|
|
8072
8239
|
if (prevDragRow !== dragRow) {
|
|
@@ -8081,7 +8248,7 @@ export default defineComponent({
|
|
|
8081
8248
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8082
8249
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8083
8250
|
if (!status) {
|
|
8084
|
-
return;
|
|
8251
|
+
return errRest;
|
|
8085
8252
|
}
|
|
8086
8253
|
let oafIndex = -1;
|
|
8087
8254
|
let nafIndex = -1;
|
|
@@ -8106,12 +8273,12 @@ export default defineComponent({
|
|
|
8106
8273
|
if (isPeerDrag && !isCrossDrag) {
|
|
8107
8274
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8108
8275
|
// 非同级
|
|
8109
|
-
return;
|
|
8276
|
+
return errRest;
|
|
8110
8277
|
}
|
|
8111
8278
|
}
|
|
8112
8279
|
else {
|
|
8113
8280
|
if (!isCrossDrag) {
|
|
8114
|
-
return;
|
|
8281
|
+
return errRest;
|
|
8115
8282
|
}
|
|
8116
8283
|
if (oldAllMaps[newRowid]) {
|
|
8117
8284
|
isSelfToChildStatus = true;
|
|
@@ -8122,7 +8289,7 @@ export default defineComponent({
|
|
|
8122
8289
|
content: getI18n('vxe.error.treeDragChild')
|
|
8123
8290
|
});
|
|
8124
8291
|
}
|
|
8125
|
-
return;
|
|
8292
|
+
return errRest;
|
|
8126
8293
|
}
|
|
8127
8294
|
}
|
|
8128
8295
|
}
|
|
@@ -8130,13 +8297,13 @@ export default defineComponent({
|
|
|
8130
8297
|
else if (oldLevel) {
|
|
8131
8298
|
// 子到根
|
|
8132
8299
|
if (!isCrossDrag) {
|
|
8133
|
-
return;
|
|
8300
|
+
return errRest;
|
|
8134
8301
|
}
|
|
8135
8302
|
}
|
|
8136
8303
|
else if (newLevel) {
|
|
8137
8304
|
// 根到子
|
|
8138
8305
|
if (!isCrossDrag) {
|
|
8139
|
-
return;
|
|
8306
|
+
return errRest;
|
|
8140
8307
|
}
|
|
8141
8308
|
if (oldAllMaps[newRowid]) {
|
|
8142
8309
|
isSelfToChildStatus = true;
|
|
@@ -8147,7 +8314,7 @@ export default defineComponent({
|
|
|
8147
8314
|
content: getI18n('vxe.error.treeDragChild')
|
|
8148
8315
|
});
|
|
8149
8316
|
}
|
|
8150
|
-
return;
|
|
8317
|
+
return errRest;
|
|
8151
8318
|
}
|
|
8152
8319
|
}
|
|
8153
8320
|
}
|
|
@@ -8207,27 +8374,34 @@ export default defineComponent({
|
|
|
8207
8374
|
if (reactData.scrollYLoad) {
|
|
8208
8375
|
$xeTable.updateScrollYSpace();
|
|
8209
8376
|
}
|
|
8210
|
-
|
|
8377
|
+
if (evnt) {
|
|
8378
|
+
dispatchEvent('row-dragend', {
|
|
8379
|
+
oldRow: dragRow,
|
|
8380
|
+
newRow: prevDragRow,
|
|
8381
|
+
dragRow,
|
|
8382
|
+
dragPos: prevDragPos,
|
|
8383
|
+
dragToChild: isDragToChildFlag,
|
|
8384
|
+
offsetIndex: dragOffsetIndex,
|
|
8385
|
+
_index: {
|
|
8386
|
+
newIndex: nafIndex,
|
|
8387
|
+
oldIndex: oafIndex
|
|
8388
|
+
}
|
|
8389
|
+
}, evnt);
|
|
8390
|
+
}
|
|
8391
|
+
return nextTick().then(() => {
|
|
8211
8392
|
$xeTable.updateCellAreas();
|
|
8212
8393
|
$xeTable.recalculate();
|
|
8394
|
+
}).then(() => {
|
|
8395
|
+
return {
|
|
8396
|
+
status: true
|
|
8397
|
+
};
|
|
8213
8398
|
});
|
|
8214
|
-
dispatchEvent('row-dragend', {
|
|
8215
|
-
oldRow: dragRow,
|
|
8216
|
-
newRow: prevDragRow,
|
|
8217
|
-
dragRow,
|
|
8218
|
-
dragPos: prevDragPos,
|
|
8219
|
-
dragToChild: isDragToChildFlag,
|
|
8220
|
-
offsetIndex: dragOffsetIndex,
|
|
8221
|
-
_index: {
|
|
8222
|
-
newIndex: nafIndex,
|
|
8223
|
-
oldIndex: oafIndex
|
|
8224
|
-
}
|
|
8225
|
-
}, evnt);
|
|
8226
8399
|
}).catch(() => {
|
|
8400
|
+
return errRest;
|
|
8227
8401
|
});
|
|
8228
8402
|
}
|
|
8229
8403
|
}
|
|
8230
|
-
return Promise.resolve();
|
|
8404
|
+
return Promise.resolve(errRest);
|
|
8231
8405
|
},
|
|
8232
8406
|
handleRowDragDragendEvent(evnt) {
|
|
8233
8407
|
const { treeConfig } = props;
|
|
@@ -8354,6 +8528,9 @@ export default defineComponent({
|
|
|
8354
8528
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8355
8529
|
const { collectColumn } = internalData;
|
|
8356
8530
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8531
|
+
const errRest = {
|
|
8532
|
+
status: false
|
|
8533
|
+
};
|
|
8357
8534
|
if (prevDragCol && dragCol) {
|
|
8358
8535
|
// 判断是否有拖动
|
|
8359
8536
|
if (prevDragCol !== dragCol) {
|
|
@@ -8370,7 +8547,7 @@ export default defineComponent({
|
|
|
8370
8547
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8371
8548
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8372
8549
|
if (!status) {
|
|
8373
|
-
return;
|
|
8550
|
+
return errRest;
|
|
8374
8551
|
}
|
|
8375
8552
|
let oafIndex = -1;
|
|
8376
8553
|
let nafIndex = -1;
|
|
@@ -8384,12 +8561,12 @@ export default defineComponent({
|
|
|
8384
8561
|
if (isPeerDrag && !isCrossDrag) {
|
|
8385
8562
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8386
8563
|
// 非同级
|
|
8387
|
-
return;
|
|
8564
|
+
return errRest;
|
|
8388
8565
|
}
|
|
8389
8566
|
}
|
|
8390
8567
|
else {
|
|
8391
8568
|
if (!isCrossDrag) {
|
|
8392
|
-
return;
|
|
8569
|
+
return errRest;
|
|
8393
8570
|
}
|
|
8394
8571
|
if (oldAllMaps[newColumn.id]) {
|
|
8395
8572
|
isSelfToChildStatus = true;
|
|
@@ -8400,7 +8577,7 @@ export default defineComponent({
|
|
|
8400
8577
|
content: getI18n('vxe.error.treeDragChild')
|
|
8401
8578
|
});
|
|
8402
8579
|
}
|
|
8403
|
-
return;
|
|
8580
|
+
return errRest;
|
|
8404
8581
|
}
|
|
8405
8582
|
}
|
|
8406
8583
|
}
|
|
@@ -8408,13 +8585,13 @@ export default defineComponent({
|
|
|
8408
8585
|
else if (dragColumn.parentId) {
|
|
8409
8586
|
// 子到根
|
|
8410
8587
|
if (!isCrossDrag) {
|
|
8411
|
-
return;
|
|
8588
|
+
return errRest;
|
|
8412
8589
|
}
|
|
8413
8590
|
}
|
|
8414
8591
|
else if (newColumn.parentId) {
|
|
8415
8592
|
// 根到子
|
|
8416
8593
|
if (!isCrossDrag) {
|
|
8417
|
-
return;
|
|
8594
|
+
return errRest;
|
|
8418
8595
|
}
|
|
8419
8596
|
if (oldAllMaps[newColumn.id]) {
|
|
8420
8597
|
isSelfToChildStatus = true;
|
|
@@ -8425,7 +8602,7 @@ export default defineComponent({
|
|
|
8425
8602
|
content: getI18n('vxe.error.treeDragChild')
|
|
8426
8603
|
});
|
|
8427
8604
|
}
|
|
8428
|
-
return;
|
|
8605
|
+
return errRest;
|
|
8429
8606
|
}
|
|
8430
8607
|
}
|
|
8431
8608
|
}
|
|
@@ -8486,26 +8663,32 @@ export default defineComponent({
|
|
|
8486
8663
|
$xeTable.clearCopyCellArea();
|
|
8487
8664
|
}
|
|
8488
8665
|
}
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8666
|
+
if (evnt) {
|
|
8667
|
+
dispatchEvent('column-dragend', {
|
|
8668
|
+
oldColumn: dragColumn,
|
|
8669
|
+
newColumn,
|
|
8670
|
+
dragColumn,
|
|
8671
|
+
dragPos: prevDragPos,
|
|
8672
|
+
dragToChild: isDragToChildFlag,
|
|
8673
|
+
offsetIndex: dragOffsetIndex,
|
|
8674
|
+
_index: {
|
|
8675
|
+
newIndex: nafIndex,
|
|
8676
|
+
oldIndex: oafIndex
|
|
8677
|
+
}
|
|
8678
|
+
}, evnt);
|
|
8679
|
+
}
|
|
8501
8680
|
if (isSyncColumn) {
|
|
8502
8681
|
$xeTable.handleColDragSwapColumn();
|
|
8503
8682
|
}
|
|
8683
|
+
return {
|
|
8684
|
+
status: true
|
|
8685
|
+
};
|
|
8504
8686
|
}).catch(() => {
|
|
8687
|
+
return errRest;
|
|
8505
8688
|
});
|
|
8506
8689
|
}
|
|
8507
8690
|
}
|
|
8508
|
-
return Promise.resolve();
|
|
8691
|
+
return Promise.resolve(errRest);
|
|
8509
8692
|
},
|
|
8510
8693
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
8511
8694
|
const { dragCol } = reactData;
|
|
@@ -9335,18 +9518,16 @@ export default defineComponent({
|
|
|
9335
9518
|
}
|
|
9336
9519
|
};
|
|
9337
9520
|
// 检测对应模块是否安装
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
});
|
|
9349
|
-
}
|
|
9521
|
+
'openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').forEach(name => {
|
|
9522
|
+
$xeTable[name] = function () {
|
|
9523
|
+
errLog('vxe.error.reqModule', ['VxeTableExportModule']);
|
|
9524
|
+
};
|
|
9525
|
+
});
|
|
9526
|
+
'clearValidate,fullValidate,validate'.split(',').forEach(name => {
|
|
9527
|
+
$xeTable[name] = function () {
|
|
9528
|
+
errLog('vxe.error.reqModule', ['VxeTableValidatorModule']);
|
|
9529
|
+
};
|
|
9530
|
+
});
|
|
9350
9531
|
Object.assign($xeTable, tableMethods, tablePrivateMethods);
|
|
9351
9532
|
/**
|
|
9352
9533
|
* 渲染浮固定列
|
|
@@ -10307,23 +10488,21 @@ export default defineComponent({
|
|
|
10307
10488
|
globalEvents.off($xeTable, 'contextmenu');
|
|
10308
10489
|
tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable });
|
|
10309
10490
|
});
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
if (
|
|
10313
|
-
|
|
10314
|
-
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
10315
|
-
}
|
|
10491
|
+
nextTick(() => {
|
|
10492
|
+
if (props.loading) {
|
|
10493
|
+
if (!VxeUILoadingComponent && !slots.loading) {
|
|
10494
|
+
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
10316
10495
|
}
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10496
|
+
}
|
|
10497
|
+
if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
|
|
10498
|
+
(props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
|
|
10499
|
+
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
10500
|
+
props.tooltipConfig || props.editRules) {
|
|
10501
|
+
if (!VxeUITooltipComponent) {
|
|
10502
|
+
errLog('vxe.error.reqComp', ['vxe-tooltip']);
|
|
10324
10503
|
}
|
|
10325
|
-
}
|
|
10326
|
-
}
|
|
10504
|
+
}
|
|
10505
|
+
});
|
|
10327
10506
|
provide('$xeColgroup', null);
|
|
10328
10507
|
provide('$xeTable', $xeTable);
|
|
10329
10508
|
$xeTable.renderVN = renderVN;
|