vxe-table 4.12.0 → 4.12.2
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/style.css +1 -1
- package/es/table/module/edit/hook.js +22 -24
- package/es/table/module/keyboard/hook.js +3 -2
- package/es/table/module/validator/hook.js +2 -4
- package/es/table/src/body.js +7 -8
- package/es/table/src/table.js +79 -100
- package/es/ui/index.js +3 -3
- package/es/ui/src/dom.js +0 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +12266 -1059
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/hook.js +26 -34
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -1
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +3 -8
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/src/body.js +7 -8
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/table.js +83 -115
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +3 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +0 -2
- package/lib/ui/src/dom.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/table/module/edit/hook.ts +23 -24
- package/packages/table/module/keyboard/hook.ts +4 -2
- package/packages/table/module/validator/hook.ts +2 -4
- package/packages/table/src/body.ts +7 -8
- package/packages/table/src/table.ts +86 -108
- package/packages/ui/index.ts +2 -2
- package/packages/ui/src/dom.ts +0 -2
- /package/es/{iconfont.1742955995631.ttf → iconfont.1743125693758.ttf} +0 -0
- /package/es/{iconfont.1742955995631.woff → iconfont.1743125693758.woff} +0 -0
- /package/es/{iconfont.1742955995631.woff2 → iconfont.1743125693758.woff2} +0 -0
- /package/lib/{iconfont.1742955995631.ttf → iconfont.1743125693758.ttf} +0 -0
- /package/lib/{iconfont.1742955995631.woff → iconfont.1743125693758.woff} +0 -0
- /package/lib/{iconfont.1742955995631.woff2 → iconfont.1743125693758.woff2} +0 -0
|
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils';
|
|
|
3
3
|
import { VxeUI } from '../../../ui';
|
|
4
4
|
import { isEnableConf } from '../../../ui/src/utils';
|
|
5
5
|
import { getCellValue, setCellValue, getRowid } from '../../src/util';
|
|
6
|
-
import {
|
|
6
|
+
import { removeClass, addClass } from '../../../ui/src/dom';
|
|
7
7
|
import { warnLog, errLog } from '../../../ui/src/log';
|
|
8
8
|
const { getConfig, renderer, hooks, getI18n } = VxeUI;
|
|
9
9
|
const tableEditMethodKeys = ['insert', 'insertAt', 'insertNextAt', 'insertChild', 'insertChildAt', 'insertChildNextAt', 'remove', 'removeCheckboxRow', 'removeRadioRow', 'removeCurrentRow', 'getRecordset', 'getInsertRecords', 'getRemoveRecords', 'getUpdateRecords', 'getEditRecord', 'getActiveRecord', 'getSelectedCell', 'clearEdit', 'clearActived', 'clearSelected', 'isEditByRow', 'isActiveByRow', 'setEditRow', 'setActiveRow', 'setEditCell', 'setActiveCell', 'setSelectCell'];
|
|
@@ -12,6 +12,7 @@ hooks.add('tableEditModule', {
|
|
|
12
12
|
const { props, reactData, internalData } = $xeTable;
|
|
13
13
|
const { refElem } = $xeTable.getRefMaps();
|
|
14
14
|
const { computeMouseOpts, computeEditOpts, computeCheckboxOpts, computeTreeOpts, computeValidOpts } = $xeTable.getComputeMaps();
|
|
15
|
+
const browseObj = XEUtils.browse();
|
|
15
16
|
let editMethods = {};
|
|
16
17
|
let editPrivateMethods = {};
|
|
17
18
|
const getEditColumnModel = (row, column) => {
|
|
@@ -96,8 +97,8 @@ hooks.add('tableEditModule', {
|
|
|
96
97
|
};
|
|
97
98
|
const handleInsertRowAt = (records, targetRow, isInsertNextRow) => {
|
|
98
99
|
const { treeConfig } = props;
|
|
99
|
-
const { mergeList
|
|
100
|
-
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
100
|
+
const { mergeList } = reactData;
|
|
101
|
+
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
101
102
|
const treeOpts = computeTreeOpts.value;
|
|
102
103
|
const { transform, rowField, mapChildrenField } = treeOpts;
|
|
103
104
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -244,11 +245,11 @@ hooks.add('tableEditModule', {
|
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
|
-
const { insertMaps } = editStore;
|
|
248
248
|
newRecords.forEach(newRow => {
|
|
249
249
|
const rowid = getRowid($xeTable, newRow);
|
|
250
|
-
|
|
250
|
+
insertRowMaps[rowid] = newRow;
|
|
251
251
|
});
|
|
252
|
+
reactData.insertRowFlag++;
|
|
252
253
|
$xeTable.cacheRowMap(false);
|
|
253
254
|
$xeTable.updateScrollYStatus();
|
|
254
255
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -487,13 +488,12 @@ hooks.add('tableEditModule', {
|
|
|
487
488
|
remove(rows) {
|
|
488
489
|
const { treeConfig } = props;
|
|
489
490
|
const { mergeList, editStore } = reactData;
|
|
490
|
-
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps } = internalData;
|
|
491
|
+
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData;
|
|
491
492
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
492
493
|
const treeOpts = computeTreeOpts.value;
|
|
493
494
|
const { transform, mapChildrenField } = treeOpts;
|
|
494
495
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
495
|
-
const { actived
|
|
496
|
-
const insertDataRowMaps = Object.assign({}, editStore.insertMaps);
|
|
496
|
+
const { actived } = editStore;
|
|
497
497
|
const { checkField } = checkboxOpts;
|
|
498
498
|
let delList = [];
|
|
499
499
|
if (!rows) {
|
|
@@ -506,7 +506,7 @@ hooks.add('tableEditModule', {
|
|
|
506
506
|
rows.forEach((row) => {
|
|
507
507
|
if (!$xeTable.isInsertByRow(row)) {
|
|
508
508
|
const rowid = getRowid($xeTable, row);
|
|
509
|
-
|
|
509
|
+
removeRowMaps[rowid] = row;
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
512
|
// 如果绑定了多选属性,则更新状态
|
|
@@ -577,14 +577,15 @@ hooks.add('tableEditModule', {
|
|
|
577
577
|
// 从新增中移除已删除的数据
|
|
578
578
|
rows.forEach((row) => {
|
|
579
579
|
const rowid = getRowid($xeTable, row);
|
|
580
|
-
if (
|
|
581
|
-
delete
|
|
580
|
+
if (insertRowMaps[rowid]) {
|
|
581
|
+
delete insertRowMaps[rowid];
|
|
582
582
|
}
|
|
583
583
|
if (pendingRowMaps[rowid]) {
|
|
584
584
|
delete pendingRowMaps[rowid];
|
|
585
585
|
}
|
|
586
586
|
});
|
|
587
|
-
|
|
587
|
+
reactData.removeRowFlag++;
|
|
588
|
+
reactData.insertRowFlag++;
|
|
588
589
|
reactData.pendingRowFlag++;
|
|
589
590
|
$xeTable.updateFooter();
|
|
590
591
|
$xeTable.cacheRowMap(false);
|
|
@@ -654,11 +655,9 @@ hooks.add('tableEditModule', {
|
|
|
654
655
|
* 获取新增的临时数据
|
|
655
656
|
*/
|
|
656
657
|
getInsertRecords() {
|
|
657
|
-
const {
|
|
658
|
-
const { fullAllDataRowIdData } = internalData;
|
|
659
|
-
const { insertMaps } = editStore;
|
|
658
|
+
const { fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
660
659
|
const insertRecords = [];
|
|
661
|
-
XEUtils.each(
|
|
660
|
+
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
662
661
|
if (fullAllDataRowIdData[rowid]) {
|
|
663
662
|
insertRecords.push(row);
|
|
664
663
|
}
|
|
@@ -669,10 +668,9 @@ hooks.add('tableEditModule', {
|
|
|
669
668
|
* 获取已删除的数据
|
|
670
669
|
*/
|
|
671
670
|
getRemoveRecords() {
|
|
672
|
-
const {
|
|
673
|
-
const { removeMaps } = editStore;
|
|
671
|
+
const { removeRowMaps } = internalData;
|
|
674
672
|
const removeRecords = [];
|
|
675
|
-
XEUtils.each(
|
|
673
|
+
XEUtils.each(removeRowMaps, (row) => {
|
|
676
674
|
removeRecords.push(row);
|
|
677
675
|
});
|
|
678
676
|
return removeRecords;
|
|
@@ -699,7 +697,7 @@ hooks.add('tableEditModule', {
|
|
|
699
697
|
if (process.env.NODE_ENV === 'development') {
|
|
700
698
|
warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord']);
|
|
701
699
|
}
|
|
702
|
-
return
|
|
700
|
+
return $xeTable.getEditRecord();
|
|
703
701
|
},
|
|
704
702
|
getEditRecord() {
|
|
705
703
|
const { editStore } = reactData;
|
|
@@ -727,7 +725,7 @@ hooks.add('tableEditModule', {
|
|
|
727
725
|
if (process.env.NODE_ENV === 'development') {
|
|
728
726
|
warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit']);
|
|
729
727
|
}
|
|
730
|
-
return
|
|
728
|
+
return $xeTable.clearEdit(row);
|
|
731
729
|
},
|
|
732
730
|
/**
|
|
733
731
|
* 清除激活的编辑
|
|
@@ -751,7 +749,7 @@ hooks.add('tableEditModule', {
|
|
|
751
749
|
warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
|
|
752
750
|
}
|
|
753
751
|
// 即将废弃
|
|
754
|
-
return
|
|
752
|
+
return $xeTable.isEditByRow(row);
|
|
755
753
|
},
|
|
756
754
|
/**
|
|
757
755
|
* 判断行是否为激活编辑状态
|
|
@@ -882,7 +880,7 @@ hooks.add('tableEditModule', {
|
|
|
882
880
|
}
|
|
883
881
|
else {
|
|
884
882
|
// 保持一致行为,光标移到末端
|
|
885
|
-
if (
|
|
883
|
+
if (browseObj.msie) {
|
|
886
884
|
const textRange = inputElem.createTextRange();
|
|
887
885
|
textRange.collapse(false);
|
|
888
886
|
textRange.select();
|
|
@@ -915,7 +913,7 @@ hooks.add('tableEditModule', {
|
|
|
915
913
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
916
914
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
917
915
|
handleClearEdit(evnt);
|
|
918
|
-
|
|
916
|
+
$xeTable.clearSelected();
|
|
919
917
|
if ($xeTable.clearCellAreas) {
|
|
920
918
|
$xeTable.clearCellAreas();
|
|
921
919
|
$xeTable.clearCopyCellArea();
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
import { VxeUI } from '../../../ui';
|
|
3
3
|
import { getRefElem } from '../../src/util';
|
|
4
|
-
import {
|
|
4
|
+
import { hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom';
|
|
5
5
|
const { hooks } = VxeUI;
|
|
6
|
+
const browseObj = XEUtils.browse();
|
|
6
7
|
function getTargetOffset(target, container) {
|
|
7
8
|
let offsetTop = 0;
|
|
8
9
|
let offsetLeft = 0;
|
|
9
|
-
const triggerCheckboxLabel = !
|
|
10
|
+
const triggerCheckboxLabel = !browseObj.firefox && hasClass(target, 'vxe-checkbox--label');
|
|
10
11
|
if (triggerCheckboxLabel) {
|
|
11
12
|
const checkboxLabelStyle = getComputedStyle(target);
|
|
12
13
|
offsetTop -= XEUtils.toNumber(checkboxLabelStyle.paddingTop);
|
|
@@ -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, pendingRowMaps } = 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
|
// 是否标记删除
|
package/es/table/src/body.js
CHANGED
|
@@ -414,10 +414,13 @@ export default defineComponent({
|
|
|
414
414
|
const rows = [];
|
|
415
415
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
416
416
|
tableData.forEach((row, $rowIndex) => {
|
|
417
|
-
const
|
|
417
|
+
const rowid = handleGetRowId(row);
|
|
418
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
418
419
|
let rowIndex = $rowIndex;
|
|
419
|
-
|
|
420
|
-
|
|
420
|
+
let rowLevel = 0;
|
|
421
|
+
let seq = -1;
|
|
422
|
+
let _rowIndex = -1;
|
|
423
|
+
const trOn = {};
|
|
421
424
|
// 当前行事件
|
|
422
425
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
423
426
|
trOn.onMouseenter = (evnt) => {
|
|
@@ -433,11 +436,6 @@ export default defineComponent({
|
|
|
433
436
|
$xeTable.clearHoverRow();
|
|
434
437
|
};
|
|
435
438
|
}
|
|
436
|
-
const rowid = handleGetRowId(row);
|
|
437
|
-
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
438
|
-
let rowLevel = 0;
|
|
439
|
-
let seq = -1;
|
|
440
|
-
let _rowIndex = 0;
|
|
441
439
|
if (rowRest) {
|
|
442
440
|
rowLevel = rowRest.level;
|
|
443
441
|
if (treeConfig && transform && seqMode === 'increasing') {
|
|
@@ -446,6 +444,7 @@ export default defineComponent({
|
|
|
446
444
|
else {
|
|
447
445
|
seq = rowRest.seq;
|
|
448
446
|
}
|
|
447
|
+
rowIndex = rowRest.index;
|
|
449
448
|
_rowIndex = rowRest._index;
|
|
450
449
|
}
|
|
451
450
|
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
|