vxe-table 4.12.0-beta.9 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +45 -36
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/hook.js +1 -1
- package/es/table/module/custom/panel.js +4 -2
- package/es/table/module/edit/hook.js +29 -33
- package/es/table/module/export/export-panel.js +3 -2
- package/es/table/module/export/import-panel.js +3 -2
- package/es/table/module/filter/panel.js +12 -2
- package/es/table/module/keyboard/hook.js +105 -30
- package/es/table/module/menu/hook.js +2 -1
- package/es/table/module/validator/hook.js +4 -5
- package/es/table/render/index.js +3 -3
- package/es/table/src/body.js +45 -27
- package/es/table/src/cell.js +43 -24
- package/es/table/src/columnInfo.js +2 -2
- package/es/table/src/footer.js +12 -7
- package/es/table/src/header.js +12 -7
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +501 -512
- package/es/table/src/util.js +34 -6
- package/es/ui/index.js +4 -3
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +42 -40
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +12594 -1185
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +1 -1
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +4 -2
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/hook.js +36 -45
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/export-panel.js +3 -2
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +3 -2
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/filter/panel.js +8 -2
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +113 -31
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/menu/hook.js +2 -1
- package/lib/table/module/menu/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +6 -10
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +4 -3
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +53 -26
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +49 -25
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +2 -4
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +12 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +12 -5
- package/lib/table/src/header.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 +594 -564
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +36 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +4 -3
- 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 +49 -42
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/custom/hook.ts +1 -1
- package/packages/table/module/custom/panel.ts +6 -2
- package/packages/table/module/edit/hook.ts +30 -33
- package/packages/table/module/export/export-panel.ts +4 -2
- package/packages/table/module/export/import-panel.ts +4 -2
- package/packages/table/module/filter/panel.ts +12 -2
- package/packages/table/module/keyboard/hook.ts +106 -32
- package/packages/table/module/menu/hook.ts +3 -1
- package/packages/table/module/validator/hook.ts +5 -5
- package/packages/table/render/index.ts +3 -4
- package/packages/table/src/body.ts +46 -27
- package/packages/table/src/cell.ts +43 -24
- package/packages/table/src/columnInfo.ts +3 -2
- package/packages/table/src/footer.ts +13 -7
- package/packages/table/src/header.ts +13 -7
- package/packages/table/src/props.ts +4 -0
- package/packages/table/src/table.ts +513 -518
- package/packages/table/src/util.ts +39 -6
- package/packages/ui/index.ts +3 -2
- /package/es/{iconfont.1741337003908.ttf → iconfont.1743045589885.ttf} +0 -0
- /package/es/{iconfont.1741337003908.woff → iconfont.1743045589885.woff} +0 -0
- /package/es/{iconfont.1741337003908.woff2 → iconfont.1743045589885.woff2} +0 -0
- /package/lib/{iconfont.1741337003908.ttf → iconfont.1743045589885.ttf} +0 -0
- /package/lib/{iconfont.1741337003908.woff → iconfont.1743045589885.woff} +0 -0
- /package/lib/{iconfont.1741337003908.woff2 → iconfont.1743045589885.woff2} +0 -0
|
@@ -96,8 +96,8 @@ hooks.add('tableEditModule', {
|
|
|
96
96
|
};
|
|
97
97
|
const handleInsertRowAt = (records, targetRow, isInsertNextRow) => {
|
|
98
98
|
const { treeConfig } = props;
|
|
99
|
-
const { mergeList
|
|
100
|
-
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
99
|
+
const { mergeList } = reactData;
|
|
100
|
+
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
101
101
|
const treeOpts = computeTreeOpts.value;
|
|
102
102
|
const { transform, rowField, mapChildrenField } = treeOpts;
|
|
103
103
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -244,11 +244,11 @@ hooks.add('tableEditModule', {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
const { insertMaps } = editStore;
|
|
248
247
|
newRecords.forEach(newRow => {
|
|
249
248
|
const rowid = getRowid($xeTable, newRow);
|
|
250
|
-
|
|
249
|
+
insertRowMaps[rowid] = newRow;
|
|
251
250
|
});
|
|
251
|
+
reactData.insertRowFlag++;
|
|
252
252
|
$xeTable.cacheRowMap(false);
|
|
253
253
|
$xeTable.updateScrollYStatus();
|
|
254
254
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -320,6 +320,7 @@ hooks.add('tableEditModule', {
|
|
|
320
320
|
return nextTick().then(() => $xeTable.updateCellAreas());
|
|
321
321
|
};
|
|
322
322
|
const handleEditActive = (params, evnt, isFocus, isPos) => {
|
|
323
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
323
324
|
const { editConfig, mouseConfig } = props;
|
|
324
325
|
const { editStore, tableColumn } = reactData;
|
|
325
326
|
const editOpts = computeEditOpts.value;
|
|
@@ -336,7 +337,7 @@ hooks.add('tableEditModule', {
|
|
|
336
337
|
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
337
338
|
// 判断是否禁用编辑
|
|
338
339
|
let type = 'edit-disabled';
|
|
339
|
-
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $
|
|
340
|
+
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }))) {
|
|
340
341
|
if (mouseConfig) {
|
|
341
342
|
$xeTable.clearSelected();
|
|
342
343
|
if ($xeTable.clearCellAreas) {
|
|
@@ -365,7 +366,7 @@ hooks.add('tableEditModule', {
|
|
|
365
366
|
$xeTable.handleFocus(params, evnt);
|
|
366
367
|
}
|
|
367
368
|
if (afterEditMethod) {
|
|
368
|
-
afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $
|
|
369
|
+
afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }));
|
|
369
370
|
}
|
|
370
371
|
});
|
|
371
372
|
}
|
|
@@ -485,15 +486,13 @@ hooks.add('tableEditModule', {
|
|
|
485
486
|
*/
|
|
486
487
|
remove(rows) {
|
|
487
488
|
const { treeConfig } = props;
|
|
488
|
-
const { mergeList, editStore
|
|
489
|
-
const { tableFullTreeData, afterFullData, tableFullData } = internalData;
|
|
489
|
+
const { mergeList, editStore } = reactData;
|
|
490
|
+
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData;
|
|
490
491
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
491
492
|
const treeOpts = computeTreeOpts.value;
|
|
492
493
|
const { transform, mapChildrenField } = treeOpts;
|
|
493
494
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
494
|
-
const { actived
|
|
495
|
-
const insertDataRowMaps = Object.assign({}, editStore.insertMaps);
|
|
496
|
-
const pendingDataRowMaps = Object.assign({}, reactData.pendingRowMaps);
|
|
495
|
+
const { actived } = editStore;
|
|
497
496
|
const { checkField } = checkboxOpts;
|
|
498
497
|
let delList = [];
|
|
499
498
|
if (!rows) {
|
|
@@ -506,19 +505,18 @@ hooks.add('tableEditModule', {
|
|
|
506
505
|
rows.forEach((row) => {
|
|
507
506
|
if (!$xeTable.isInsertByRow(row)) {
|
|
508
507
|
const rowid = getRowid($xeTable, row);
|
|
509
|
-
|
|
508
|
+
removeRowMaps[rowid] = row;
|
|
510
509
|
}
|
|
511
510
|
});
|
|
512
511
|
// 如果绑定了多选属性,则更新状态
|
|
513
512
|
if (!checkField) {
|
|
514
|
-
const selectRowMaps = Object.assign({}, selectCheckboxMaps);
|
|
515
513
|
rows.forEach((row) => {
|
|
516
514
|
const rowid = getRowid($xeTable, row);
|
|
517
|
-
if (
|
|
518
|
-
delete
|
|
515
|
+
if (selectCheckboxMaps[rowid]) {
|
|
516
|
+
delete selectCheckboxMaps[rowid];
|
|
519
517
|
}
|
|
520
518
|
});
|
|
521
|
-
reactData.
|
|
519
|
+
reactData.updateCheckboxFlag++;
|
|
522
520
|
}
|
|
523
521
|
// 从数据源中移除
|
|
524
522
|
if (tableFullData === rows) {
|
|
@@ -578,15 +576,16 @@ hooks.add('tableEditModule', {
|
|
|
578
576
|
// 从新增中移除已删除的数据
|
|
579
577
|
rows.forEach((row) => {
|
|
580
578
|
const rowid = getRowid($xeTable, row);
|
|
581
|
-
if (
|
|
582
|
-
delete
|
|
579
|
+
if (insertRowMaps[rowid]) {
|
|
580
|
+
delete insertRowMaps[rowid];
|
|
583
581
|
}
|
|
584
|
-
if (
|
|
585
|
-
delete
|
|
582
|
+
if (pendingRowMaps[rowid]) {
|
|
583
|
+
delete pendingRowMaps[rowid];
|
|
586
584
|
}
|
|
587
585
|
});
|
|
588
|
-
|
|
589
|
-
reactData.
|
|
586
|
+
reactData.removeRowFlag++;
|
|
587
|
+
reactData.insertRowFlag++;
|
|
588
|
+
reactData.pendingRowFlag++;
|
|
590
589
|
$xeTable.updateFooter();
|
|
591
590
|
$xeTable.cacheRowMap(false);
|
|
592
591
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -655,11 +654,9 @@ hooks.add('tableEditModule', {
|
|
|
655
654
|
* 获取新增的临时数据
|
|
656
655
|
*/
|
|
657
656
|
getInsertRecords() {
|
|
658
|
-
const {
|
|
659
|
-
const { fullAllDataRowIdData } = internalData;
|
|
660
|
-
const { insertMaps } = editStore;
|
|
657
|
+
const { fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
661
658
|
const insertRecords = [];
|
|
662
|
-
XEUtils.each(
|
|
659
|
+
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
663
660
|
if (fullAllDataRowIdData[rowid]) {
|
|
664
661
|
insertRecords.push(row);
|
|
665
662
|
}
|
|
@@ -670,10 +667,9 @@ hooks.add('tableEditModule', {
|
|
|
670
667
|
* 获取已删除的数据
|
|
671
668
|
*/
|
|
672
669
|
getRemoveRecords() {
|
|
673
|
-
const {
|
|
674
|
-
const { removeMaps } = editStore;
|
|
670
|
+
const { removeRowMaps } = internalData;
|
|
675
671
|
const removeRecords = [];
|
|
676
|
-
XEUtils.each(
|
|
672
|
+
XEUtils.each(removeRowMaps, (row) => {
|
|
677
673
|
removeRecords.push(row);
|
|
678
674
|
});
|
|
679
675
|
return removeRecords;
|
|
@@ -700,7 +696,7 @@ hooks.add('tableEditModule', {
|
|
|
700
696
|
if (process.env.NODE_ENV === 'development') {
|
|
701
697
|
warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord']);
|
|
702
698
|
}
|
|
703
|
-
return
|
|
699
|
+
return $xeTable.getEditRecord();
|
|
704
700
|
},
|
|
705
701
|
getEditRecord() {
|
|
706
702
|
const { editStore } = reactData;
|
|
@@ -728,7 +724,7 @@ hooks.add('tableEditModule', {
|
|
|
728
724
|
if (process.env.NODE_ENV === 'development') {
|
|
729
725
|
warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit']);
|
|
730
726
|
}
|
|
731
|
-
return
|
|
727
|
+
return $xeTable.clearEdit(row);
|
|
732
728
|
},
|
|
733
729
|
/**
|
|
734
730
|
* 清除激活的编辑
|
|
@@ -752,7 +748,7 @@ hooks.add('tableEditModule', {
|
|
|
752
748
|
warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
|
|
753
749
|
}
|
|
754
750
|
// 即将废弃
|
|
755
|
-
return
|
|
751
|
+
return $xeTable.isEditByRow(row);
|
|
756
752
|
},
|
|
757
753
|
/**
|
|
758
754
|
* 判断行是否为激活编辑状态
|
|
@@ -916,7 +912,7 @@ hooks.add('tableEditModule', {
|
|
|
916
912
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
917
913
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
918
914
|
handleClearEdit(evnt);
|
|
919
|
-
|
|
915
|
+
$xeTable.clearSelected();
|
|
920
916
|
if ($xeTable.clearCellAreas) {
|
|
921
917
|
$xeTable.clearCellAreas();
|
|
922
918
|
$xeTable.clearCopyCellArea();
|
|
@@ -139,6 +139,7 @@ export default defineComponent({
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
const renderVN = () => {
|
|
142
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
142
143
|
const { defaultOptions, storeData } = props;
|
|
143
144
|
const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData;
|
|
144
145
|
const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
|
|
@@ -216,7 +217,7 @@ export default defineComponent({
|
|
|
216
217
|
default: () => {
|
|
217
218
|
const params = {
|
|
218
219
|
$table: $xeTable,
|
|
219
|
-
$grid: $
|
|
220
|
+
$grid: $xeGrid,
|
|
220
221
|
options: defaultOptions,
|
|
221
222
|
columns,
|
|
222
223
|
params: defaultOptions.params
|
|
@@ -460,7 +461,7 @@ export default defineComponent({
|
|
|
460
461
|
footer() {
|
|
461
462
|
const params = {
|
|
462
463
|
$table: $xeTable,
|
|
463
|
-
$grid: $
|
|
464
|
+
$grid: $xeGrid,
|
|
464
465
|
options: defaultOptions,
|
|
465
466
|
columns,
|
|
466
467
|
params: defaultOptions.params
|
|
@@ -76,6 +76,7 @@ export default defineComponent({
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
const renderVN = () => {
|
|
79
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
79
80
|
const { defaultOptions, storeData } = props;
|
|
80
81
|
const selectName = computeSelectName.value;
|
|
81
82
|
const hasFile = computeHasFile.value;
|
|
@@ -110,7 +111,7 @@ export default defineComponent({
|
|
|
110
111
|
default: () => {
|
|
111
112
|
const params = {
|
|
112
113
|
$table: $xeTable,
|
|
113
|
-
$grid: $
|
|
114
|
+
$grid: $xeGrid,
|
|
114
115
|
options: defaultOptions,
|
|
115
116
|
params: defaultOptions.params
|
|
116
117
|
};
|
|
@@ -186,7 +187,7 @@ export default defineComponent({
|
|
|
186
187
|
footer() {
|
|
187
188
|
const params = {
|
|
188
189
|
$table: $xeTable,
|
|
189
|
-
$grid: $
|
|
190
|
+
$grid: $xeGrid,
|
|
190
191
|
options: defaultOptions,
|
|
191
192
|
params: defaultOptions.params
|
|
192
193
|
};
|
|
@@ -84,14 +84,24 @@ export default defineComponent({
|
|
|
84
84
|
if (filterSlot) {
|
|
85
85
|
return [
|
|
86
86
|
h('div', {
|
|
87
|
-
class: 'vxe-table--filter-template'
|
|
87
|
+
class: 'vxe-table--filter-template',
|
|
88
|
+
style: maxHeight
|
|
89
|
+
? {
|
|
90
|
+
maxHeight: `${maxHeight}px`
|
|
91
|
+
}
|
|
92
|
+
: {}
|
|
88
93
|
}, $xeTable.callSlot(filterSlot, params))
|
|
89
94
|
];
|
|
90
95
|
}
|
|
91
96
|
else if (rtFilter) {
|
|
92
97
|
return [
|
|
93
98
|
h('div', {
|
|
94
|
-
class: 'vxe-table--filter-template'
|
|
99
|
+
class: 'vxe-table--filter-template',
|
|
100
|
+
style: maxHeight
|
|
101
|
+
? {
|
|
102
|
+
maxHeight: `${maxHeight}px`
|
|
103
|
+
}
|
|
104
|
+
: {}
|
|
95
105
|
}, getSlotVNs(rtFilter(filterRender, params)))
|
|
96
106
|
];
|
|
97
107
|
}
|
|
@@ -28,7 +28,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
28
28
|
setupTable($xeTable) {
|
|
29
29
|
const { props, reactData, internalData } = $xeTable;
|
|
30
30
|
const { refElem } = $xeTable.getRefMaps();
|
|
31
|
-
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
|
|
31
|
+
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeColumnOpts, computeCellOpts, computeDefaultRowHeight, computeCurrentRowOpts, computeCurrentColumnOpts } = $xeTable.getComputeMaps();
|
|
32
32
|
function getCheckboxRangeRows(evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
|
|
33
33
|
const { showOverflow } = props;
|
|
34
34
|
const { fullAllDataRowIdData, isResizeCellHeight } = internalData;
|
|
@@ -281,12 +281,48 @@ hooks.add('tableKeyboardModule', {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
|
+
const handleMoveSelected = (evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) => {
|
|
285
|
+
const { afterFullData, visibleColumn } = internalData;
|
|
286
|
+
const params = Object.assign({}, args);
|
|
287
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
288
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
289
|
+
evnt.preventDefault();
|
|
290
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
291
|
+
// 移动到上一行
|
|
292
|
+
params.rowIndex = _rowIndex - 1;
|
|
293
|
+
params.row = afterFullData[params.rowIndex];
|
|
294
|
+
}
|
|
295
|
+
else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
296
|
+
// 移动到下一行
|
|
297
|
+
params.rowIndex = _rowIndex + 1;
|
|
298
|
+
params.row = afterFullData[params.rowIndex];
|
|
299
|
+
}
|
|
300
|
+
else if (isLeftArrow && _columnIndex) {
|
|
301
|
+
// 移动到左侧单元格
|
|
302
|
+
params.columnIndex = _columnIndex - 1;
|
|
303
|
+
params.column = visibleColumn[params.columnIndex];
|
|
304
|
+
}
|
|
305
|
+
else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
306
|
+
// 移动到右侧单元格
|
|
307
|
+
params.columnIndex = _columnIndex + 1;
|
|
308
|
+
params.column = visibleColumn[params.columnIndex];
|
|
309
|
+
}
|
|
310
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
311
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
312
|
+
$xeTable.handleSelected(params, evnt);
|
|
313
|
+
});
|
|
314
|
+
return params;
|
|
315
|
+
};
|
|
284
316
|
const keyboardMethods = {
|
|
285
317
|
// 处理 Tab 键移动
|
|
286
318
|
moveTabSelected(args, isLeft, evnt) {
|
|
287
319
|
const { editConfig } = props;
|
|
288
320
|
const { afterFullData, visibleColumn } = internalData;
|
|
289
321
|
const editOpts = computeEditOpts.value;
|
|
322
|
+
const rowOpts = computeRowOpts.value;
|
|
323
|
+
const currentRowOpts = computeCurrentRowOpts.value;
|
|
324
|
+
const columnOpts = computeColumnOpts.value;
|
|
325
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
290
326
|
let targetRow;
|
|
291
327
|
let targetRowIndex;
|
|
292
328
|
let targetColumnIndex;
|
|
@@ -333,6 +369,12 @@ hooks.add('tableKeyboardModule', {
|
|
|
333
369
|
params.columnIndex = targetColumnIndex;
|
|
334
370
|
params.column = targetColumn;
|
|
335
371
|
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
372
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
373
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
374
|
+
}
|
|
375
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
376
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
377
|
+
}
|
|
336
378
|
if (editConfig) {
|
|
337
379
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
338
380
|
if (editOpts.mode === 'row') {
|
|
@@ -340,13 +382,17 @@ hooks.add('tableKeyboardModule', {
|
|
|
340
382
|
}
|
|
341
383
|
else {
|
|
342
384
|
$xeTable.scrollToRow(params.row, params.column)
|
|
343
|
-
.then(() =>
|
|
385
|
+
.then(() => {
|
|
386
|
+
$xeTable.handleSelected(params, evnt);
|
|
387
|
+
});
|
|
344
388
|
}
|
|
345
389
|
}
|
|
346
390
|
}
|
|
347
391
|
else {
|
|
348
392
|
$xeTable.scrollToRow(params.row, params.column)
|
|
349
|
-
.then(() =>
|
|
393
|
+
.then(() => {
|
|
394
|
+
$xeTable.handleSelected(params, evnt);
|
|
395
|
+
});
|
|
350
396
|
}
|
|
351
397
|
}
|
|
352
398
|
},
|
|
@@ -358,7 +404,6 @@ hooks.add('tableKeyboardModule', {
|
|
|
358
404
|
const treeOpts = computeTreeOpts.value;
|
|
359
405
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
360
406
|
let targetRow;
|
|
361
|
-
evnt.preventDefault();
|
|
362
407
|
if (currentRow) {
|
|
363
408
|
if (treeConfig) {
|
|
364
409
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
|
|
@@ -383,6 +428,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
383
428
|
targetRow = afterFullData[0];
|
|
384
429
|
}
|
|
385
430
|
if (targetRow) {
|
|
431
|
+
evnt.preventDefault();
|
|
386
432
|
const params = {
|
|
387
433
|
$table: $xeTable,
|
|
388
434
|
row: targetRow,
|
|
@@ -393,37 +439,66 @@ hooks.add('tableKeyboardModule', {
|
|
|
393
439
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
|
|
394
440
|
}
|
|
395
441
|
},
|
|
442
|
+
// 处理当前列方向键移动
|
|
443
|
+
moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
|
|
444
|
+
const { currentColumn } = reactData;
|
|
445
|
+
const { visibleColumn } = internalData;
|
|
446
|
+
let targetCol = null;
|
|
447
|
+
if (currentColumn) {
|
|
448
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
|
|
449
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
450
|
+
targetCol = visibleColumn[_columnIndex - 1];
|
|
451
|
+
}
|
|
452
|
+
else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
453
|
+
targetCol = visibleColumn[_columnIndex + 1];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
targetCol = visibleColumn[0];
|
|
458
|
+
}
|
|
459
|
+
if (targetCol) {
|
|
460
|
+
evnt.preventDefault();
|
|
461
|
+
const params = {
|
|
462
|
+
$table: $xeTable,
|
|
463
|
+
column: targetCol,
|
|
464
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
465
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
466
|
+
};
|
|
467
|
+
$xeTable.scrollToColumn(targetCol)
|
|
468
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
|
|
469
|
+
}
|
|
470
|
+
},
|
|
396
471
|
// 处理可编辑方向键移动
|
|
397
|
-
|
|
398
|
-
const {
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (isUpArrow &&
|
|
404
|
-
|
|
405
|
-
params.rowIndex = _rowIndex - 1;
|
|
406
|
-
params.row = afterFullData[params.rowIndex];
|
|
472
|
+
moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
473
|
+
const { highlightCurrentRow, highlightCurrentColumn } = props;
|
|
474
|
+
const rowOpts = computeRowOpts.value;
|
|
475
|
+
const columnOpts = computeColumnOpts.value;
|
|
476
|
+
handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
477
|
+
// 当前行按键上下移动
|
|
478
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
479
|
+
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
407
480
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
params.row = afterFullData[params.rowIndex];
|
|
481
|
+
// 当前行按键左右移动
|
|
482
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
483
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
|
|
412
484
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
485
|
+
},
|
|
486
|
+
moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
487
|
+
const rowOpts = computeRowOpts.value;
|
|
488
|
+
const currentRowOpts = computeCurrentRowOpts.value;
|
|
489
|
+
const columnOpts = computeColumnOpts.value;
|
|
490
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
491
|
+
const params = handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
492
|
+
if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
|
|
493
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
417
494
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
params.columnIndex = _columnIndex + 1;
|
|
421
|
-
params.column = visibleColumn[params.columnIndex];
|
|
495
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
496
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
422
497
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
498
|
+
},
|
|
499
|
+
// 已废弃,待删除
|
|
500
|
+
moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
501
|
+
handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
427
502
|
},
|
|
428
503
|
handleCellMousedownEvent
|
|
429
504
|
};
|
|
@@ -280,10 +280,11 @@ hooks.add('tableMenuModule', {
|
|
|
280
280
|
* 快捷菜单点击事件
|
|
281
281
|
*/
|
|
282
282
|
ctxMenuLinkEvent(evnt, menu) {
|
|
283
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
283
284
|
// 如果一级菜单有配置 code 则允许点击,否则不能点击
|
|
284
285
|
if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
|
|
285
286
|
const gMenuOpts = menus.get(menu.code);
|
|
286
|
-
const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $
|
|
287
|
+
const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeGrid, $event: evnt });
|
|
287
288
|
const tmMethod = gMenuOpts ? (gMenuOpts.tableMenuMethod || gMenuOpts.menuMethod) : null;
|
|
288
289
|
if (tmMethod) {
|
|
289
290
|
tmMethod(params, evnt);
|
|
@@ -85,9 +85,7 @@ hooks.add('tableValidatorModule', {
|
|
|
85
85
|
const beginValidate = (rows, cols, cb, isFull) => {
|
|
86
86
|
const validRest = {};
|
|
87
87
|
const { editRules, treeConfig } = props;
|
|
88
|
-
const {
|
|
89
|
-
const { afterFullData } = internalData;
|
|
90
|
-
const { removeMaps } = editStore;
|
|
88
|
+
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData;
|
|
91
89
|
const treeOpts = computeTreeOpts.value;
|
|
92
90
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
93
91
|
const validOpts = computeValidOpts.value;
|
|
@@ -121,7 +119,7 @@ hooks.add('tableValidatorModule', {
|
|
|
121
119
|
const handleVaild = (row) => {
|
|
122
120
|
const rowid = getRowid($xeTable, row);
|
|
123
121
|
// 是否删除
|
|
124
|
-
if (
|
|
122
|
+
if (removeRowMaps[rowid]) {
|
|
125
123
|
return;
|
|
126
124
|
}
|
|
127
125
|
// 是否标记删除
|
|
@@ -353,6 +351,7 @@ hooks.add('tableValidatorModule', {
|
|
|
353
351
|
* trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
|
|
354
352
|
*/
|
|
355
353
|
validCellRules(validType, row, column, val) {
|
|
354
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
356
355
|
const { editRules } = props;
|
|
357
356
|
const { field } = column;
|
|
358
357
|
const errorRules = [];
|
|
@@ -375,7 +374,7 @@ hooks.add('tableValidatorModule', {
|
|
|
375
374
|
columnIndex: $xeTable.getColumnIndex(column),
|
|
376
375
|
field: column.field,
|
|
377
376
|
$table: $xeTable,
|
|
378
|
-
$grid: $
|
|
377
|
+
$grid: $xeGrid
|
|
379
378
|
};
|
|
380
379
|
let customValid;
|
|
381
380
|
if (XEUtils.isString(validator)) {
|
package/es/table/render/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getCellValue, setCellValue } from '../../table/src/util';
|
|
|
5
5
|
import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
|
|
6
6
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
|
|
7
7
|
import { errLog } from '../../ui/src/log';
|
|
8
|
-
const { getConfig, renderer, getI18n } = VxeUI;
|
|
8
|
+
const { getConfig, renderer, getI18n, getComponent } = VxeUI;
|
|
9
9
|
const componentDefaultModelProp = 'modelValue';
|
|
10
10
|
const defaultCompProps = {};
|
|
11
11
|
function handleDefaultValue(value, defaultVal, initVal) {
|
|
@@ -29,7 +29,7 @@ function getOldComponentName(name) {
|
|
|
29
29
|
return `vxe-${name.replace('$', '')}`;
|
|
30
30
|
}
|
|
31
31
|
function getDefaultComponent({ name }) {
|
|
32
|
-
return
|
|
32
|
+
return getComponent(name);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* 已废弃
|
|
@@ -335,7 +335,7 @@ function oldEditRender(renderOpts, params) {
|
|
|
335
335
|
*/
|
|
336
336
|
function oldButtonEditRender(renderOpts, params) {
|
|
337
337
|
return [
|
|
338
|
-
h(
|
|
338
|
+
h(getComponent('vxe-button'), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, null)), getComponentOns(renderOpts, params)))
|
|
339
339
|
];
|
|
340
340
|
}
|
|
341
341
|
/**
|