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
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;
|
|
@@ -7355,8 +7509,8 @@ export default defineComponent({
|
|
|
7355
7509
|
const { treeConfig } = props;
|
|
7356
7510
|
const { selectCheckboxMaps, treeIndeterminateMaps } = reactData;
|
|
7357
7511
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7358
|
-
const { checkField, checkMethod } = checkboxOpts;
|
|
7359
|
-
const { afterFullData, afterTreeFullData } = internalData;
|
|
7512
|
+
const { checkField, checkMethod, showReserveStatus } = checkboxOpts;
|
|
7513
|
+
const { afterFullData, afterTreeFullData, checkboxReserveRowMap } = internalData;
|
|
7360
7514
|
let sLen = 0; // 已选
|
|
7361
7515
|
let hLen = 0; // 半选
|
|
7362
7516
|
let vLen = 0; // 有效行
|
|
@@ -7395,7 +7549,11 @@ export default defineComponent({
|
|
|
7395
7549
|
vLen++;
|
|
7396
7550
|
});
|
|
7397
7551
|
const isSelected = rootList.length > 0 ? (vLen > 0 ? (sLen >= vLen) : (sLen >= rootList.length)) : false;
|
|
7398
|
-
|
|
7552
|
+
let halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
|
|
7553
|
+
// 如果复选框启用保留记录,当保留数据存在时显示半选
|
|
7554
|
+
if (!isSelected && !halfSelect && showReserveStatus) {
|
|
7555
|
+
halfSelect = !XEUtils.isEmpty(checkboxReserveRowMap);
|
|
7556
|
+
}
|
|
7399
7557
|
reactData.isAllSelected = isSelected;
|
|
7400
7558
|
reactData.isIndeterminate = halfSelect;
|
|
7401
7559
|
},
|
|
@@ -7416,6 +7574,7 @@ export default defineComponent({
|
|
|
7416
7574
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7417
7575
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7418
7576
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts;
|
|
7577
|
+
// indeterminateField 仅支持读取
|
|
7419
7578
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
7420
7579
|
if (checkField) {
|
|
7421
7580
|
// 树结构
|
|
@@ -7594,17 +7753,18 @@ export default defineComponent({
|
|
|
7594
7753
|
const { _lastResizeTime } = internalData;
|
|
7595
7754
|
const sortOpts = computeSortOpts.value;
|
|
7596
7755
|
const columnOpts = computeColumnOpts.value;
|
|
7756
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
7597
7757
|
const { column } = params;
|
|
7598
7758
|
const cell = evnt.currentTarget;
|
|
7599
7759
|
const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300;
|
|
7600
7760
|
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
|
|
7601
7761
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
|
|
7602
7762
|
if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
|
|
7603
|
-
|
|
7763
|
+
$xeTable.triggerSortEvent(evnt, column, getNextSortOrder(column));
|
|
7604
7764
|
}
|
|
7605
7765
|
dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt);
|
|
7606
|
-
if (columnOpts.isCurrent || props.highlightCurrentColumn) {
|
|
7607
|
-
|
|
7766
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7767
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7608
7768
|
}
|
|
7609
7769
|
},
|
|
7610
7770
|
triggerHeaderCellDblclickEvent(evnt, params) {
|
|
@@ -7616,7 +7776,7 @@ export default defineComponent({
|
|
|
7616
7776
|
* 如果是双击模式,则单击后选中状态
|
|
7617
7777
|
*/
|
|
7618
7778
|
triggerCellClickEvent(evnt, params) {
|
|
7619
|
-
const { highlightCurrentRow, editConfig } = props;
|
|
7779
|
+
const { highlightCurrentRow, highlightCurrentColumn, editConfig } = props;
|
|
7620
7780
|
const { editStore, isDragResize } = reactData;
|
|
7621
7781
|
if (isDragResize) {
|
|
7622
7782
|
return;
|
|
@@ -7628,6 +7788,8 @@ export default defineComponent({
|
|
|
7628
7788
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7629
7789
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
7630
7790
|
const rowOpts = computeRowOpts.value;
|
|
7791
|
+
const columnOpts = computeColumnOpts.value;
|
|
7792
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
7631
7793
|
const { actived, focused } = editStore;
|
|
7632
7794
|
const { row, column } = params;
|
|
7633
7795
|
const { type, treeNode } = column;
|
|
@@ -7643,29 +7805,35 @@ export default defineComponent({
|
|
|
7643
7805
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7644
7806
|
// 如果是展开行
|
|
7645
7807
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
|
|
7646
|
-
|
|
7808
|
+
$xeTable.triggerRowExpandEvent(evnt, params);
|
|
7647
7809
|
}
|
|
7648
7810
|
// 如果是树形表格
|
|
7649
7811
|
if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
|
|
7650
|
-
|
|
7812
|
+
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
7651
7813
|
}
|
|
7652
7814
|
}
|
|
7653
7815
|
// 如果点击了树节点
|
|
7654
7816
|
if (!triggerTreeNode) {
|
|
7655
7817
|
if (!triggerExpandNode) {
|
|
7656
|
-
//
|
|
7818
|
+
// 如果是当前行
|
|
7657
7819
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7658
7820
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7659
|
-
|
|
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);
|
|
7660
7828
|
}
|
|
7661
7829
|
}
|
|
7662
7830
|
// 如果是单选框
|
|
7663
7831
|
if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
|
|
7664
|
-
|
|
7832
|
+
$xeTable.triggerRadioRowEvent(evnt, params);
|
|
7665
7833
|
}
|
|
7666
7834
|
// 如果是复选框
|
|
7667
7835
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
|
|
7668
|
-
|
|
7836
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params);
|
|
7669
7837
|
}
|
|
7670
7838
|
}
|
|
7671
7839
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -8063,6 +8231,9 @@ export default defineComponent({
|
|
|
8063
8231
|
const { afterFullData, tableFullData } = internalData;
|
|
8064
8232
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
8065
8233
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
8234
|
+
const errRest = {
|
|
8235
|
+
status: false
|
|
8236
|
+
};
|
|
8066
8237
|
if (prevDragRow && dragRow) {
|
|
8067
8238
|
// 判断是否有拖动
|
|
8068
8239
|
if (prevDragRow !== dragRow) {
|
|
@@ -8077,7 +8248,7 @@ export default defineComponent({
|
|
|
8077
8248
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8078
8249
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8079
8250
|
if (!status) {
|
|
8080
|
-
return;
|
|
8251
|
+
return errRest;
|
|
8081
8252
|
}
|
|
8082
8253
|
let oafIndex = -1;
|
|
8083
8254
|
let nafIndex = -1;
|
|
@@ -8102,12 +8273,12 @@ export default defineComponent({
|
|
|
8102
8273
|
if (isPeerDrag && !isCrossDrag) {
|
|
8103
8274
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8104
8275
|
// 非同级
|
|
8105
|
-
return;
|
|
8276
|
+
return errRest;
|
|
8106
8277
|
}
|
|
8107
8278
|
}
|
|
8108
8279
|
else {
|
|
8109
8280
|
if (!isCrossDrag) {
|
|
8110
|
-
return;
|
|
8281
|
+
return errRest;
|
|
8111
8282
|
}
|
|
8112
8283
|
if (oldAllMaps[newRowid]) {
|
|
8113
8284
|
isSelfToChildStatus = true;
|
|
@@ -8118,7 +8289,7 @@ export default defineComponent({
|
|
|
8118
8289
|
content: getI18n('vxe.error.treeDragChild')
|
|
8119
8290
|
});
|
|
8120
8291
|
}
|
|
8121
|
-
return;
|
|
8292
|
+
return errRest;
|
|
8122
8293
|
}
|
|
8123
8294
|
}
|
|
8124
8295
|
}
|
|
@@ -8126,13 +8297,13 @@ export default defineComponent({
|
|
|
8126
8297
|
else if (oldLevel) {
|
|
8127
8298
|
// 子到根
|
|
8128
8299
|
if (!isCrossDrag) {
|
|
8129
|
-
return;
|
|
8300
|
+
return errRest;
|
|
8130
8301
|
}
|
|
8131
8302
|
}
|
|
8132
8303
|
else if (newLevel) {
|
|
8133
8304
|
// 根到子
|
|
8134
8305
|
if (!isCrossDrag) {
|
|
8135
|
-
return;
|
|
8306
|
+
return errRest;
|
|
8136
8307
|
}
|
|
8137
8308
|
if (oldAllMaps[newRowid]) {
|
|
8138
8309
|
isSelfToChildStatus = true;
|
|
@@ -8143,7 +8314,7 @@ export default defineComponent({
|
|
|
8143
8314
|
content: getI18n('vxe.error.treeDragChild')
|
|
8144
8315
|
});
|
|
8145
8316
|
}
|
|
8146
|
-
return;
|
|
8317
|
+
return errRest;
|
|
8147
8318
|
}
|
|
8148
8319
|
}
|
|
8149
8320
|
}
|
|
@@ -8203,27 +8374,34 @@ export default defineComponent({
|
|
|
8203
8374
|
if (reactData.scrollYLoad) {
|
|
8204
8375
|
$xeTable.updateScrollYSpace();
|
|
8205
8376
|
}
|
|
8206
|
-
|
|
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(() => {
|
|
8207
8392
|
$xeTable.updateCellAreas();
|
|
8208
8393
|
$xeTable.recalculate();
|
|
8394
|
+
}).then(() => {
|
|
8395
|
+
return {
|
|
8396
|
+
status: true
|
|
8397
|
+
};
|
|
8209
8398
|
});
|
|
8210
|
-
dispatchEvent('row-dragend', {
|
|
8211
|
-
oldRow: dragRow,
|
|
8212
|
-
newRow: prevDragRow,
|
|
8213
|
-
dragRow,
|
|
8214
|
-
dragPos: prevDragPos,
|
|
8215
|
-
dragToChild: isDragToChildFlag,
|
|
8216
|
-
offsetIndex: dragOffsetIndex,
|
|
8217
|
-
_index: {
|
|
8218
|
-
newIndex: nafIndex,
|
|
8219
|
-
oldIndex: oafIndex
|
|
8220
|
-
}
|
|
8221
|
-
}, evnt);
|
|
8222
8399
|
}).catch(() => {
|
|
8400
|
+
return errRest;
|
|
8223
8401
|
});
|
|
8224
8402
|
}
|
|
8225
8403
|
}
|
|
8226
|
-
return Promise.resolve();
|
|
8404
|
+
return Promise.resolve(errRest);
|
|
8227
8405
|
},
|
|
8228
8406
|
handleRowDragDragendEvent(evnt) {
|
|
8229
8407
|
const { treeConfig } = props;
|
|
@@ -8350,6 +8528,9 @@ export default defineComponent({
|
|
|
8350
8528
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8351
8529
|
const { collectColumn } = internalData;
|
|
8352
8530
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8531
|
+
const errRest = {
|
|
8532
|
+
status: false
|
|
8533
|
+
};
|
|
8353
8534
|
if (prevDragCol && dragCol) {
|
|
8354
8535
|
// 判断是否有拖动
|
|
8355
8536
|
if (prevDragCol !== dragCol) {
|
|
@@ -8366,7 +8547,7 @@ export default defineComponent({
|
|
|
8366
8547
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8367
8548
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8368
8549
|
if (!status) {
|
|
8369
|
-
return;
|
|
8550
|
+
return errRest;
|
|
8370
8551
|
}
|
|
8371
8552
|
let oafIndex = -1;
|
|
8372
8553
|
let nafIndex = -1;
|
|
@@ -8380,12 +8561,12 @@ export default defineComponent({
|
|
|
8380
8561
|
if (isPeerDrag && !isCrossDrag) {
|
|
8381
8562
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8382
8563
|
// 非同级
|
|
8383
|
-
return;
|
|
8564
|
+
return errRest;
|
|
8384
8565
|
}
|
|
8385
8566
|
}
|
|
8386
8567
|
else {
|
|
8387
8568
|
if (!isCrossDrag) {
|
|
8388
|
-
return;
|
|
8569
|
+
return errRest;
|
|
8389
8570
|
}
|
|
8390
8571
|
if (oldAllMaps[newColumn.id]) {
|
|
8391
8572
|
isSelfToChildStatus = true;
|
|
@@ -8396,7 +8577,7 @@ export default defineComponent({
|
|
|
8396
8577
|
content: getI18n('vxe.error.treeDragChild')
|
|
8397
8578
|
});
|
|
8398
8579
|
}
|
|
8399
|
-
return;
|
|
8580
|
+
return errRest;
|
|
8400
8581
|
}
|
|
8401
8582
|
}
|
|
8402
8583
|
}
|
|
@@ -8404,13 +8585,13 @@ export default defineComponent({
|
|
|
8404
8585
|
else if (dragColumn.parentId) {
|
|
8405
8586
|
// 子到根
|
|
8406
8587
|
if (!isCrossDrag) {
|
|
8407
|
-
return;
|
|
8588
|
+
return errRest;
|
|
8408
8589
|
}
|
|
8409
8590
|
}
|
|
8410
8591
|
else if (newColumn.parentId) {
|
|
8411
8592
|
// 根到子
|
|
8412
8593
|
if (!isCrossDrag) {
|
|
8413
|
-
return;
|
|
8594
|
+
return errRest;
|
|
8414
8595
|
}
|
|
8415
8596
|
if (oldAllMaps[newColumn.id]) {
|
|
8416
8597
|
isSelfToChildStatus = true;
|
|
@@ -8421,7 +8602,7 @@ export default defineComponent({
|
|
|
8421
8602
|
content: getI18n('vxe.error.treeDragChild')
|
|
8422
8603
|
});
|
|
8423
8604
|
}
|
|
8424
|
-
return;
|
|
8605
|
+
return errRest;
|
|
8425
8606
|
}
|
|
8426
8607
|
}
|
|
8427
8608
|
}
|
|
@@ -8482,26 +8663,32 @@ export default defineComponent({
|
|
|
8482
8663
|
$xeTable.clearCopyCellArea();
|
|
8483
8664
|
}
|
|
8484
8665
|
}
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
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
|
+
}
|
|
8497
8680
|
if (isSyncColumn) {
|
|
8498
8681
|
$xeTable.handleColDragSwapColumn();
|
|
8499
8682
|
}
|
|
8683
|
+
return {
|
|
8684
|
+
status: true
|
|
8685
|
+
};
|
|
8500
8686
|
}).catch(() => {
|
|
8687
|
+
return errRest;
|
|
8501
8688
|
});
|
|
8502
8689
|
}
|
|
8503
8690
|
}
|
|
8504
|
-
return Promise.resolve();
|
|
8691
|
+
return Promise.resolve(errRest);
|
|
8505
8692
|
},
|
|
8506
8693
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
8507
8694
|
const { dragCol } = reactData;
|
|
@@ -9331,18 +9518,16 @@ export default defineComponent({
|
|
|
9331
9518
|
}
|
|
9332
9519
|
};
|
|
9333
9520
|
// 检测对应模块是否安装
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
});
|
|
9345
|
-
}
|
|
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
|
+
});
|
|
9346
9531
|
Object.assign($xeTable, tableMethods, tablePrivateMethods);
|
|
9347
9532
|
/**
|
|
9348
9533
|
* 渲染浮固定列
|
|
@@ -10171,7 +10356,7 @@ export default defineComponent({
|
|
|
10171
10356
|
if (rowOpts.height && !props.showOverflow) {
|
|
10172
10357
|
warnLog('vxe.error.notProp', ['table.show-overflow']);
|
|
10173
10358
|
}
|
|
10174
|
-
if (!$xeTable.
|
|
10359
|
+
if (!$xeTable.handleCellAreaMousedownEvent) {
|
|
10175
10360
|
if (props.areaConfig) {
|
|
10176
10361
|
warnLog('vxe.error.notProp', ['area-config']);
|
|
10177
10362
|
}
|
|
@@ -10303,23 +10488,21 @@ export default defineComponent({
|
|
|
10303
10488
|
globalEvents.off($xeTable, 'contextmenu');
|
|
10304
10489
|
tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable });
|
|
10305
10490
|
});
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
if (
|
|
10309
|
-
|
|
10310
|
-
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
10311
|
-
}
|
|
10491
|
+
nextTick(() => {
|
|
10492
|
+
if (props.loading) {
|
|
10493
|
+
if (!VxeUILoadingComponent && !slots.loading) {
|
|
10494
|
+
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
10312
10495
|
}
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
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']);
|
|
10320
10503
|
}
|
|
10321
|
-
}
|
|
10322
|
-
}
|
|
10504
|
+
}
|
|
10505
|
+
});
|
|
10323
10506
|
provide('$xeColgroup', null);
|
|
10324
10507
|
provide('$xeTable', $xeTable);
|
|
10325
10508
|
$xeTable.renderVN = renderVN;
|