vxe-table 4.1.6 → 4.1.9
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/button/src/button.js +14 -14
- package/es/edit/src/hook.js +3 -3
- package/es/export/src/hook.js +17 -6
- package/es/filter/src/hook.js +20 -1
- package/es/grid/src/grid.js +6 -2
- package/es/table/src/body.js +11 -14
- package/es/table/src/cell.js +16 -14
- package/es/table/src/props.js +6 -6
- package/es/table/src/table.js +102 -89
- package/es/table/src/util.js +3 -0
- package/es/tools/dom.js +2 -8
- package/es/v-x-e-table/src/conf.js +3 -0
- package/lib/button/src/button.js +15 -14
- package/lib/button/src/button.min.js +1 -1
- package/lib/edit/src/hook.js +3 -0
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/export/src/hook.js +25 -10
- package/lib/export/src/hook.min.js +1 -1
- package/lib/filter/src/hook.js +23 -0
- package/lib/filter/src/hook.min.js +1 -1
- package/lib/grid/src/grid.js +6 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +307 -208
- package/lib/index.umd.min.js +1 -1
- package/lib/table/src/body.js +8 -16
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +16 -16
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/props.js +6 -6
- package/lib/table/src/table.js +158 -114
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +7 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/tools/dom.js +2 -9
- package/lib/tools/dom.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +3 -0
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/button/src/button.ts +14 -14
- package/packages/edit/src/hook.ts +3 -3
- package/packages/export/src/hook.ts +17 -6
- package/packages/filter/src/hook.ts +20 -1
- package/packages/grid/src/grid.ts +6 -2
- package/packages/table/src/body.ts +11 -14
- package/packages/table/src/cell.ts +16 -14
- package/packages/table/src/props.ts +6 -6
- package/packages/table/src/table.ts +102 -89
- package/packages/table/src/util.ts +4 -0
- package/packages/tools/dom.ts +2 -7
- package/packages/v-x-e-table/src/conf.ts +3 -0
- package/types/filter.d.ts +5 -0
- package/types/plugins/pro.d.ts +5 -0
- package/types/table.d.ts +12 -2
package/lib/table/src/table.js
CHANGED
|
@@ -311,8 +311,9 @@ var _default = (0, _vue.defineComponent)({
|
|
|
311
311
|
tableFullColumn: [],
|
|
312
312
|
// 渲染所有列
|
|
313
313
|
visibleColumn: [],
|
|
314
|
-
//
|
|
314
|
+
// 总的缓存数据集
|
|
315
315
|
fullAllDataRowIdData: {},
|
|
316
|
+
// 渲染中缓存数据
|
|
316
317
|
fullDataRowIdData: {},
|
|
317
318
|
fullColumnIdData: {},
|
|
318
319
|
fullColumnFieldData: {},
|
|
@@ -1300,29 +1301,100 @@ var _default = (0, _vue.defineComponent)({
|
|
|
1300
1301
|
return cellValue;
|
|
1301
1302
|
};
|
|
1302
1303
|
};
|
|
1304
|
+
/**
|
|
1305
|
+
* 预编译
|
|
1306
|
+
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1307
|
+
*/
|
|
1308
|
+
|
|
1303
1309
|
|
|
1304
1310
|
var updateAfterDataIndex = function updateAfterDataIndex() {
|
|
1311
|
+
var treeConfig = props.treeConfig;
|
|
1305
1312
|
var afterFullData = internalData.afterFullData,
|
|
1306
|
-
fullDataRowIdData = internalData.fullDataRowIdData
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1313
|
+
fullDataRowIdData = internalData.fullDataRowIdData,
|
|
1314
|
+
fullAllDataRowIdData = internalData.fullAllDataRowIdData;
|
|
1315
|
+
var treeFullData = internalData.treeFullData;
|
|
1316
|
+
var treeOpts = computeTreeOpts.value;
|
|
1310
1317
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1318
|
+
if (treeConfig) {
|
|
1319
|
+
_xeUtils.default.eachTree(treeFullData, function (row, index, items, path) {
|
|
1320
|
+
var rowid = (0, _util.getRowid)($xetable, row);
|
|
1321
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1322
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1323
|
+
var seq = path.map(function (num, i) {
|
|
1324
|
+
return i % 2 === 0 ? Number(num) + 1 : '.';
|
|
1325
|
+
}).join('');
|
|
1326
|
+
|
|
1327
|
+
if (allrest) {
|
|
1328
|
+
allrest.seq = seq;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
if (fullrest) {
|
|
1332
|
+
fullrest.seq = seq;
|
|
1333
|
+
} else {
|
|
1334
|
+
fullAllDataRowIdData[rowid] = {
|
|
1335
|
+
row: row,
|
|
1336
|
+
rowid: rowid,
|
|
1337
|
+
seq: seq,
|
|
1338
|
+
index: -1,
|
|
1339
|
+
$index: -1,
|
|
1340
|
+
_index: index,
|
|
1341
|
+
items: [],
|
|
1342
|
+
parent: null,
|
|
1343
|
+
level: 0
|
|
1344
|
+
};
|
|
1345
|
+
fullDataRowIdData[rowid] = {
|
|
1346
|
+
row: row,
|
|
1347
|
+
rowid: rowid,
|
|
1348
|
+
seq: seq,
|
|
1349
|
+
index: -1,
|
|
1350
|
+
$index: -1,
|
|
1351
|
+
_index: index,
|
|
1352
|
+
items: [],
|
|
1353
|
+
parent: null,
|
|
1354
|
+
level: 0
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
}, treeOpts);
|
|
1358
|
+
} else {
|
|
1359
|
+
afterFullData.forEach(function (row, index) {
|
|
1360
|
+
var rowid = (0, _util.getRowid)($xetable, row);
|
|
1361
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1362
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1363
|
+
var seq = index + 1;
|
|
1364
|
+
|
|
1365
|
+
if (allrest) {
|
|
1366
|
+
allrest.seq = seq;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (fullrest) {
|
|
1370
|
+
fullrest.seq = seq;
|
|
1371
|
+
fullrest._index = index;
|
|
1372
|
+
} else {
|
|
1373
|
+
fullAllDataRowIdData[rowid] = {
|
|
1374
|
+
row: row,
|
|
1375
|
+
rowid: rowid,
|
|
1376
|
+
seq: seq,
|
|
1377
|
+
index: -1,
|
|
1378
|
+
$index: -1,
|
|
1379
|
+
_index: index,
|
|
1380
|
+
items: [],
|
|
1381
|
+
parent: null,
|
|
1382
|
+
level: 0
|
|
1383
|
+
};
|
|
1384
|
+
fullDataRowIdData[rowid] = {
|
|
1385
|
+
row: row,
|
|
1386
|
+
rowid: rowid,
|
|
1387
|
+
seq: seq,
|
|
1388
|
+
index: -1,
|
|
1389
|
+
$index: -1,
|
|
1390
|
+
_index: index,
|
|
1391
|
+
items: [],
|
|
1392
|
+
parent: null,
|
|
1393
|
+
level: 0
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1326
1398
|
};
|
|
1327
1399
|
/**
|
|
1328
1400
|
* 获取处理后全量的表格数据
|
|
@@ -2543,12 +2615,12 @@ var _default = (0, _vue.defineComponent)({
|
|
|
2543
2615
|
}
|
|
2544
2616
|
|
|
2545
2617
|
reactData.scrollXLoad = scrollXLoad;
|
|
2546
|
-
visibleColumn.forEach(function (column,
|
|
2618
|
+
visibleColumn.forEach(function (column, index) {
|
|
2547
2619
|
var colid = column.id;
|
|
2548
2620
|
var rest = fullColumnIdData[colid];
|
|
2549
2621
|
|
|
2550
2622
|
if (rest) {
|
|
2551
|
-
rest._index =
|
|
2623
|
+
rest._index = index;
|
|
2552
2624
|
}
|
|
2553
2625
|
});
|
|
2554
2626
|
internalData.visibleColumn = visibleColumn;
|
|
@@ -2758,6 +2830,39 @@ var _default = (0, _vue.defineComponent)({
|
|
|
2758
2830
|
}
|
|
2759
2831
|
};
|
|
2760
2832
|
|
|
2833
|
+
var createGetRowCacheProp = function createGetRowCacheProp(prop) {
|
|
2834
|
+
return function (row) {
|
|
2835
|
+
var fullDataRowIdData = internalData.fullDataRowIdData;
|
|
2836
|
+
|
|
2837
|
+
if (row) {
|
|
2838
|
+
var rowid = (0, _util.getRowid)($xetable, row);
|
|
2839
|
+
var rest = fullDataRowIdData[rowid];
|
|
2840
|
+
|
|
2841
|
+
if (rest) {
|
|
2842
|
+
return rest[prop];
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
return -1;
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
var createGetColumnCacheProp = function createGetColumnCacheProp(prop) {
|
|
2851
|
+
return function (column) {
|
|
2852
|
+
var fullColumnIdData = internalData.fullColumnIdData;
|
|
2853
|
+
|
|
2854
|
+
if (column) {
|
|
2855
|
+
var rest = fullColumnIdData[column.id];
|
|
2856
|
+
|
|
2857
|
+
if (rest) {
|
|
2858
|
+
return rest[prop];
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
return -1;
|
|
2863
|
+
};
|
|
2864
|
+
};
|
|
2865
|
+
|
|
2761
2866
|
var debounceScrollY = _xeUtils.default.debounce(function (evnt) {
|
|
2762
2867
|
loadScrollYData(evnt);
|
|
2763
2868
|
}, 20, {
|
|
@@ -2918,6 +3023,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
2918
3023
|
var rest = {
|
|
2919
3024
|
row: childRow,
|
|
2920
3025
|
rowid: rowid,
|
|
3026
|
+
seq: -1,
|
|
2921
3027
|
index: -1,
|
|
2922
3028
|
_index: -1,
|
|
2923
3029
|
$index: -1,
|
|
@@ -3013,115 +3119,46 @@ var _default = (0, _vue.defineComponent)({
|
|
|
3013
3119
|
},
|
|
3014
3120
|
|
|
3015
3121
|
/**
|
|
3016
|
-
* 根据 row
|
|
3122
|
+
* 根据 row 获取序号
|
|
3017
3123
|
* @param {Row} row 行对象
|
|
3018
3124
|
*/
|
|
3019
|
-
|
|
3020
|
-
var fullDataRowIdData = internalData.fullDataRowIdData;
|
|
3125
|
+
getRowSeq: createGetRowCacheProp('seq'),
|
|
3021
3126
|
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
return rest.index;
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
return -1;
|
|
3032
|
-
},
|
|
3127
|
+
/**
|
|
3128
|
+
* 根据 row 获取相对于 data 中的索引
|
|
3129
|
+
* @param {Row} row 行对象
|
|
3130
|
+
*/
|
|
3131
|
+
getRowIndex: createGetRowCacheProp('index'),
|
|
3033
3132
|
|
|
3034
3133
|
/**
|
|
3035
3134
|
* 根据 row 获取相对于当前数据中的索引
|
|
3036
3135
|
* @param {Row} row 行对象
|
|
3037
3136
|
*/
|
|
3038
|
-
getVTRowIndex:
|
|
3039
|
-
var fullDataRowIdData = internalData.fullDataRowIdData;
|
|
3040
|
-
|
|
3041
|
-
if (row) {
|
|
3042
|
-
var rowid = (0, _util.getRowid)($xetable, row);
|
|
3043
|
-
var rest = fullDataRowIdData[rowid];
|
|
3044
|
-
|
|
3045
|
-
if (rest) {
|
|
3046
|
-
return rest._index;
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
|
-
return -1;
|
|
3051
|
-
},
|
|
3137
|
+
getVTRowIndex: createGetRowCacheProp('_index'),
|
|
3052
3138
|
|
|
3053
3139
|
/**
|
|
3054
3140
|
* 根据 row 获取渲染中的虚拟索引
|
|
3055
3141
|
* @param {Row} row 行对象
|
|
3056
3142
|
*/
|
|
3057
|
-
getVMRowIndex:
|
|
3058
|
-
var fullDataRowIdData = internalData.fullDataRowIdData;
|
|
3059
|
-
|
|
3060
|
-
if (row) {
|
|
3061
|
-
var rowid = (0, _util.getRowid)($xetable, row);
|
|
3062
|
-
var rest = fullDataRowIdData[rowid];
|
|
3063
|
-
|
|
3064
|
-
if (rest) {
|
|
3065
|
-
return rest.$index;
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
|
|
3069
|
-
return -1;
|
|
3070
|
-
},
|
|
3143
|
+
getVMRowIndex: createGetRowCacheProp('$index'),
|
|
3071
3144
|
|
|
3072
3145
|
/**
|
|
3073
3146
|
* 根据 column 获取相对于 columns 中的索引
|
|
3074
3147
|
* @param {ColumnInfo} column 列配置
|
|
3075
3148
|
*/
|
|
3076
|
-
getColumnIndex:
|
|
3077
|
-
var fullColumnIdData = internalData.fullColumnIdData;
|
|
3078
|
-
|
|
3079
|
-
if (column) {
|
|
3080
|
-
var rest = fullColumnIdData[column.id];
|
|
3081
|
-
|
|
3082
|
-
if (rest) {
|
|
3083
|
-
return rest.index;
|
|
3084
|
-
}
|
|
3085
|
-
}
|
|
3086
|
-
|
|
3087
|
-
return -1;
|
|
3088
|
-
},
|
|
3149
|
+
getColumnIndex: createGetColumnCacheProp('index'),
|
|
3089
3150
|
|
|
3090
3151
|
/**
|
|
3091
3152
|
* 根据 column 获取相对于当前表格列中的索引
|
|
3092
3153
|
* @param {ColumnInfo} column 列配置
|
|
3093
3154
|
*/
|
|
3094
|
-
getVTColumnIndex:
|
|
3095
|
-
var fullColumnIdData = internalData.fullColumnIdData;
|
|
3096
|
-
|
|
3097
|
-
if (column) {
|
|
3098
|
-
var rest = fullColumnIdData[column.id];
|
|
3099
|
-
|
|
3100
|
-
if (rest) {
|
|
3101
|
-
return rest._index;
|
|
3102
|
-
}
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
return -1;
|
|
3106
|
-
},
|
|
3155
|
+
getVTColumnIndex: createGetColumnCacheProp('_index'),
|
|
3107
3156
|
|
|
3108
3157
|
/**
|
|
3109
3158
|
* 根据 column 获取渲染中的虚拟索引
|
|
3110
3159
|
* @param {ColumnInfo} column 列配置
|
|
3111
3160
|
*/
|
|
3112
|
-
getVMColumnIndex:
|
|
3113
|
-
var fullColumnIdData = internalData.fullColumnIdData;
|
|
3114
|
-
|
|
3115
|
-
if (column) {
|
|
3116
|
-
var rest = fullColumnIdData[column.id];
|
|
3117
|
-
|
|
3118
|
-
if (rest) {
|
|
3119
|
-
return rest.$index;
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
|
|
3123
|
-
return -1;
|
|
3124
|
-
},
|
|
3161
|
+
getVMColumnIndex: createGetColumnCacheProp('$index'),
|
|
3125
3162
|
|
|
3126
3163
|
/**
|
|
3127
3164
|
* 创建 data 对象
|
|
@@ -4062,7 +4099,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
4062
4099
|
return selectRow;
|
|
4063
4100
|
}
|
|
4064
4101
|
} else {
|
|
4065
|
-
if (
|
|
4102
|
+
if ($xetable.findRowIndexOf(afterFullData, selectRow) > -1) {
|
|
4066
4103
|
return selectRow;
|
|
4067
4104
|
}
|
|
4068
4105
|
}
|
|
@@ -5029,6 +5066,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
5029
5066
|
ctxMenuStore = reactData.ctxMenuStore,
|
|
5030
5067
|
editStore = reactData.editStore;
|
|
5031
5068
|
var mouseOpts = computeMouseOpts.value;
|
|
5069
|
+
var keyboardOpts = computeKeyboardOpts.value;
|
|
5032
5070
|
var actived = editStore.actived;
|
|
5033
5071
|
var isEsc = (0, _event.hasEventKey)(evnt, _event.EVENT_KEYS.ESCAPE);
|
|
5034
5072
|
|
|
@@ -5043,16 +5081,19 @@ var _default = (0, _vue.defineComponent)({
|
|
|
5043
5081
|
$xetable.closeMenu();
|
|
5044
5082
|
}
|
|
5045
5083
|
|
|
5046
|
-
tableMethods.closeFilter();
|
|
5084
|
+
tableMethods.closeFilter();
|
|
5047
5085
|
|
|
5048
|
-
if (
|
|
5049
|
-
|
|
5050
|
-
|
|
5086
|
+
if (keyboardConfig && keyboardOpts.isEsc) {
|
|
5087
|
+
// 如果是激活编辑状态,则取消编辑
|
|
5088
|
+
if (actived.row) {
|
|
5089
|
+
var params_1 = actived.args;
|
|
5090
|
+
$xetable.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
5051
5091
|
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5092
|
+
if (mouseOpts.selected) {
|
|
5093
|
+
(0, _vue.nextTick)(function () {
|
|
5094
|
+
return $xetable.handleSelected(params_1, evnt);
|
|
5095
|
+
});
|
|
5096
|
+
}
|
|
5056
5097
|
}
|
|
5057
5098
|
}
|
|
5058
5099
|
}
|
|
@@ -5129,7 +5170,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
5129
5170
|
|
|
5130
5171
|
tableMethods.closeFilter();
|
|
5131
5172
|
|
|
5132
|
-
if (
|
|
5173
|
+
if (keyboardConfig && keyboardOpts.isEsc) {
|
|
5133
5174
|
// 如果是激活编辑状态,则取消编辑
|
|
5134
5175
|
if (actived.row) {
|
|
5135
5176
|
var params_2 = actived.args;
|
|
@@ -5580,6 +5621,8 @@ var _default = (0, _vue.defineComponent)({
|
|
|
5580
5621
|
|
|
5581
5622
|
var handleCache = function handleCache(row, index, items, path, parent, nodes) {
|
|
5582
5623
|
var rowid = (0, _util.getRowid)($xetable, row);
|
|
5624
|
+
var seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
|
|
5625
|
+
var level = nodes ? nodes.length - 1 : 0;
|
|
5583
5626
|
|
|
5584
5627
|
if ((0, _utils.eqEmptyValue)(rowid)) {
|
|
5585
5628
|
rowid = (0, _util.getRowUniqueId)();
|
|
@@ -5594,12 +5637,13 @@ var _default = (0, _vue.defineComponent)({
|
|
|
5594
5637
|
var rest = {
|
|
5595
5638
|
row: row,
|
|
5596
5639
|
rowid: rowid,
|
|
5640
|
+
seq: seq,
|
|
5597
5641
|
index: treeConfig && parent ? -1 : index,
|
|
5598
5642
|
_index: -1,
|
|
5599
5643
|
$index: -1,
|
|
5600
5644
|
items: items,
|
|
5601
5645
|
parent: parent,
|
|
5602
|
-
level:
|
|
5646
|
+
level: level
|
|
5603
5647
|
};
|
|
5604
5648
|
|
|
5605
5649
|
if (isSource) {
|