vxe-table 3.17.0-beta.9 → 3.17.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 +88 -23
- package/es/style.css +1 -1
- package/es/table/module/custom/mixin.js +32 -14
- package/es/table/module/custom/panel.js +1 -1
- package/es/table/module/edit/mixin.js +5 -5
- package/es/table/src/body.js +7 -6
- package/es/table/src/columnInfo.js +5 -0
- package/es/table/src/methods.js +223 -85
- package/es/table/src/table.js +17 -8
- package/es/table/src/util.js +9 -0
- package/es/ui/index.js +3 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +104 -29
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +465 -139
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +37 -13
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +1 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +5 -0
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/body.js +7 -6
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +5 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +273 -82
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +21 -8
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +3 -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 +101 -25
- package/packages/table/module/custom/mixin.ts +32 -13
- package/packages/table/module/custom/panel.ts +1 -1
- package/packages/table/module/edit/mixin.ts +5 -5
- package/packages/table/src/body.ts +7 -6
- package/packages/table/src/columnInfo.ts +7 -0
- package/packages/table/src/methods.ts +237 -85
- package/packages/table/src/props.ts +1 -1
- package/packages/table/src/table.ts +18 -9
- package/packages/table/src/util.ts +10 -0
- package/packages/ui/index.ts +2 -0
- /package/es/{iconfont.1753497303145.ttf → iconfont.1754358049869.ttf} +0 -0
- /package/es/{iconfont.1753497303145.woff → iconfont.1754358049869.woff} +0 -0
- /package/es/{iconfont.1753497303145.woff2 → iconfont.1754358049869.woff2} +0 -0
- /package/lib/{iconfont.1753497303145.ttf → iconfont.1754358049869.ttf} +0 -0
- /package/lib/{iconfont.1753497303145.woff → iconfont.1754358049869.woff} +0 -0
- /package/lib/{iconfont.1753497303145.woff2 → iconfont.1754358049869.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -149,44 +149,122 @@ function handleVirtualXVisible($xeTable) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
function handleCustomRestore($xeTable, storeData) {
|
|
152
|
+
const props = $xeTable;
|
|
152
153
|
const reactData = $xeTable;
|
|
153
154
|
const internalData = $xeTable;
|
|
154
|
-
|
|
155
|
+
const {
|
|
156
|
+
aggregateConfig,
|
|
157
|
+
rowGroupConfig
|
|
158
|
+
} = props;
|
|
159
|
+
const {
|
|
155
160
|
collectColumn
|
|
156
161
|
} = internalData;
|
|
162
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
157
163
|
const {
|
|
164
|
+
storage,
|
|
165
|
+
storeOptions
|
|
166
|
+
} = customOpts;
|
|
167
|
+
const isAllCustom = storage === true;
|
|
168
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions);
|
|
169
|
+
const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
|
|
170
|
+
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
171
|
+
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
172
|
+
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
173
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
174
|
+
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
175
|
+
let {
|
|
158
176
|
resizableData,
|
|
159
177
|
sortData,
|
|
160
178
|
visibleData,
|
|
161
|
-
fixedData
|
|
179
|
+
fixedData,
|
|
180
|
+
aggGroupData,
|
|
181
|
+
aggFuncData
|
|
162
182
|
} = storeData;
|
|
163
|
-
let hasCustomSort = false;
|
|
164
183
|
// 处理还原
|
|
165
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
184
|
+
if (isCustomResizable && resizableData || isCustomSort && sortData || isCustomVisible && visibleData || isCustomFixed && fixedData || isCustomAggGroup && aggGroupData || isCustomAggFunc && aggFuncData) {
|
|
185
|
+
const sortColMaps = {};
|
|
186
|
+
if (isCustomSort && sortData) {
|
|
187
|
+
// 转换兼容老版本数据,即将废弃兼容
|
|
188
|
+
if (!_xeUtils.default.isArray(sortData)) {
|
|
189
|
+
const sortRests = [];
|
|
190
|
+
_xeUtils.default.each(sortData, (index, colKey) => {
|
|
191
|
+
sortRests.push({
|
|
192
|
+
key: colKey,
|
|
193
|
+
index
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
sortData = _xeUtils.default.orderBy(sortRests, {
|
|
197
|
+
field: 'index',
|
|
198
|
+
order: 'asc'
|
|
199
|
+
}).map(item => ({
|
|
200
|
+
k: item.key
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
let colNum = 1;
|
|
204
|
+
_xeUtils.default.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
|
|
205
|
+
sortColMaps[sObj.k] = {
|
|
206
|
+
key: sObj.k,
|
|
207
|
+
sNum: colNum++,
|
|
208
|
+
pKey: pSObj ? pSObj.k : null
|
|
209
|
+
};
|
|
210
|
+
}, {
|
|
211
|
+
children: 'c'
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
const colKeyMaps = {};
|
|
215
|
+
const allCols = [];
|
|
216
|
+
const aggGroupConfs = [];
|
|
166
217
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
167
218
|
const colKey = column.getKey();
|
|
168
219
|
// 支持一级
|
|
169
220
|
if (!parentColumn) {
|
|
170
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
221
|
+
if (isCustomFixed && fixedData && fixedData[colKey] !== undefined) {
|
|
171
222
|
column.fixed = fixedData[colKey];
|
|
172
223
|
}
|
|
173
|
-
if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
|
|
174
|
-
hasCustomSort = true;
|
|
175
|
-
column.renderSortNumber = sortData[colKey];
|
|
176
|
-
}
|
|
177
224
|
}
|
|
178
|
-
if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
225
|
+
if (isCustomResizable && resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
179
226
|
column.resizeWidth = resizableData[colKey];
|
|
180
227
|
}
|
|
181
|
-
if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
228
|
+
if (isCustomVisible && visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
182
229
|
column.visible = visibleData[colKey];
|
|
183
230
|
}
|
|
231
|
+
if (isCustomAggFunc && aggFuncData && (aggregateConfig || rowGroupConfig) && aggFuncData[colKey]) {
|
|
232
|
+
column.aggFunc = aggFuncData[colKey];
|
|
233
|
+
}
|
|
234
|
+
if (isCustomAggGroup && aggGroupData && aggGroupData[colKey]) {
|
|
235
|
+
aggGroupConfs.push({
|
|
236
|
+
field: column.field
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
colKeyMaps[colKey] = column;
|
|
240
|
+
allCols.push(column);
|
|
184
241
|
});
|
|
242
|
+
if ((aggregateConfig || rowGroupConfig) && aggGroupConfs.length) {
|
|
243
|
+
const groupRest = handleGroupData($xeTable, internalData.tableFullData, aggGroupConfs);
|
|
244
|
+
internalData.tableFullTreeData = [];
|
|
245
|
+
internalData.tableFullGroupData = groupRest.treeData;
|
|
246
|
+
reactData.isRowGroupStatus = true;
|
|
247
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
248
|
+
$xeTable.cacheRowMap(false);
|
|
249
|
+
}
|
|
185
250
|
// 如果自定义了顺序
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
251
|
+
if (isCustomSort && sortData) {
|
|
252
|
+
allCols.forEach(column => {
|
|
253
|
+
const colKey = column.getKey();
|
|
254
|
+
const scItem = sortColMaps[colKey];
|
|
255
|
+
if (scItem) {
|
|
256
|
+
const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
|
|
257
|
+
column.parentId = parentColumn ? parentColumn.id : null;
|
|
258
|
+
column.renderSortNumber = scItem.sNum;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
const newCollectCols = _xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols, 'renderSortNumber'), {
|
|
262
|
+
key: 'id',
|
|
263
|
+
parentKey: 'parentId',
|
|
264
|
+
children: 'children'
|
|
265
|
+
});
|
|
266
|
+
internalData.collectColumn = newCollectCols;
|
|
267
|
+
internalData.tableFullColumn = (0, _util.getColumnList)(newCollectCols);
|
|
190
268
|
}
|
|
191
269
|
reactData.isCustomStatus = true;
|
|
192
270
|
} else {
|
|
@@ -250,8 +328,8 @@ function cacheColumnMap($xeTable) {
|
|
|
250
328
|
tableFullColumn,
|
|
251
329
|
collectColumn
|
|
252
330
|
} = internalData;
|
|
253
|
-
const
|
|
254
|
-
const
|
|
331
|
+
const fullColIdData = internalData.fullColumnIdData = {};
|
|
332
|
+
const fullColFieldData = internalData.fullColumnFieldData = {};
|
|
255
333
|
const mouseOpts = $xeTable.computeMouseOpts;
|
|
256
334
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
257
335
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
@@ -295,10 +373,10 @@ function cacheColumnMap($xeTable) {
|
|
|
295
373
|
oLeft: 0
|
|
296
374
|
};
|
|
297
375
|
if (field) {
|
|
298
|
-
if (
|
|
376
|
+
if (fullColFieldData[field]) {
|
|
299
377
|
(0, _log.errLog)('vxe.error.colRepet', ['field', field]);
|
|
300
378
|
}
|
|
301
|
-
|
|
379
|
+
fullColFieldData[field] = rest;
|
|
302
380
|
} else {
|
|
303
381
|
if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
|
|
304
382
|
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field=?`]);
|
|
@@ -352,10 +430,10 @@ function cacheColumnMap($xeTable) {
|
|
|
352
430
|
if (isAllOverflow && column.showOverflow === false) {
|
|
353
431
|
isAllOverflow = false;
|
|
354
432
|
}
|
|
355
|
-
if (
|
|
433
|
+
if (fullColIdData[colid]) {
|
|
356
434
|
(0, _log.errLog)('vxe.error.colRepet', ['colId', colid]);
|
|
357
435
|
}
|
|
358
|
-
|
|
436
|
+
fullColIdData[colid] = rest;
|
|
359
437
|
};
|
|
360
438
|
if (isGroup) {
|
|
361
439
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
|
|
@@ -370,10 +448,10 @@ function cacheColumnMap($xeTable) {
|
|
|
370
448
|
}
|
|
371
449
|
if (htmlColumn) {
|
|
372
450
|
if (!columnOpts.useKey) {
|
|
373
|
-
(0, _log.errLog)('vxe.error.
|
|
451
|
+
(0, _log.errLog)('vxe.error.notSupportProp', ['column.type=html', 'column-config.useKey=false', 'column-config.useKey=true']);
|
|
374
452
|
}
|
|
375
453
|
if (!rowOpts.useKey) {
|
|
376
|
-
(0, _log.errLog)('vxe.error.
|
|
454
|
+
(0, _log.errLog)('vxe.error.notSupportProp', ['column.type=html', 'row-config.useKey=false', 'row-config.useKey=true']);
|
|
377
455
|
}
|
|
378
456
|
}
|
|
379
457
|
reactData.isGroup = isGroup;
|
|
@@ -661,6 +739,7 @@ function updateAfterListIndex($xeTable) {
|
|
|
661
739
|
$index: -1,
|
|
662
740
|
_index: index,
|
|
663
741
|
treeIndex: -1,
|
|
742
|
+
_tIndex: -1,
|
|
664
743
|
items: [],
|
|
665
744
|
parent: null,
|
|
666
745
|
level: 0,
|
|
@@ -699,6 +778,7 @@ function updateAfterDataIndex($xeTable) {
|
|
|
699
778
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
700
779
|
const fullMaps = {};
|
|
701
780
|
if (treeConfig) {
|
|
781
|
+
let _treeIndex = 0;
|
|
702
782
|
const {
|
|
703
783
|
handleGetRowId
|
|
704
784
|
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
@@ -709,6 +789,7 @@ function updateAfterDataIndex($xeTable) {
|
|
|
709
789
|
if (rowRest) {
|
|
710
790
|
rowRest.seq = seq;
|
|
711
791
|
rowRest.treeIndex = index;
|
|
792
|
+
rowRest._tIndex = _treeIndex;
|
|
712
793
|
} else {
|
|
713
794
|
const rest = {
|
|
714
795
|
row,
|
|
@@ -718,6 +799,7 @@ function updateAfterDataIndex($xeTable) {
|
|
|
718
799
|
$index: -1,
|
|
719
800
|
_index: -1,
|
|
720
801
|
treeIndex: -1,
|
|
802
|
+
_tIndex: _treeIndex,
|
|
721
803
|
items: [],
|
|
722
804
|
parent: null,
|
|
723
805
|
level: 0,
|
|
@@ -729,6 +811,7 @@ function updateAfterDataIndex($xeTable) {
|
|
|
729
811
|
fullAllDataRowIdData[rowid] = rest;
|
|
730
812
|
fullDataRowIdData[rowid] = rest;
|
|
731
813
|
}
|
|
814
|
+
_treeIndex++;
|
|
732
815
|
fullMaps[rowid] = row;
|
|
733
816
|
}, {
|
|
734
817
|
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
@@ -2432,6 +2515,10 @@ function removeFooterMerges($xeTable, merges) {
|
|
|
2432
2515
|
return rest;
|
|
2433
2516
|
}
|
|
2434
2517
|
function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
|
|
2518
|
+
const internalData = $xeTable;
|
|
2519
|
+
const {
|
|
2520
|
+
tableFullColumn
|
|
2521
|
+
} = internalData;
|
|
2435
2522
|
const sortOpts = $xeTable.computeSortOpts;
|
|
2436
2523
|
const {
|
|
2437
2524
|
multiple,
|
|
@@ -2442,10 +2529,16 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
|
|
|
2442
2529
|
sortConfs = [sortConfs];
|
|
2443
2530
|
}
|
|
2444
2531
|
if (sortConfs && sortConfs.length) {
|
|
2532
|
+
const orderActiveMaps = {};
|
|
2445
2533
|
if (!multiple) {
|
|
2446
2534
|
sortConfs = [sortConfs[0]];
|
|
2447
|
-
|
|
2535
|
+
tableFullColumn.forEach(column => {
|
|
2536
|
+
if (column.order) {
|
|
2537
|
+
orderActiveMaps[column.id] = column;
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2448
2540
|
}
|
|
2541
|
+
const sortColMpps = {};
|
|
2449
2542
|
let firstColumn = null;
|
|
2450
2543
|
sortConfs.forEach((confs, index) => {
|
|
2451
2544
|
let {
|
|
@@ -2467,8 +2560,16 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
|
|
|
2467
2560
|
column.order = order;
|
|
2468
2561
|
}
|
|
2469
2562
|
column.sortTime = Date.now() + index;
|
|
2563
|
+
sortColMpps[column.id] = column;
|
|
2470
2564
|
}
|
|
2471
2565
|
});
|
|
2566
|
+
if (!multiple) {
|
|
2567
|
+
_xeUtils.default.each(orderActiveMaps, (oaCol, oaId) => {
|
|
2568
|
+
if (!sortColMpps[oaId]) {
|
|
2569
|
+
oaCol.order = null;
|
|
2570
|
+
}
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2472
2573
|
if (isUpdate) {
|
|
2473
2574
|
if (!remote) {
|
|
2474
2575
|
$xeTable.handleTableData(true);
|
|
@@ -2673,7 +2774,7 @@ const calcCellHeight = $xeTable => {
|
|
|
2673
2774
|
} = internalData;
|
|
2674
2775
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
2675
2776
|
const el = $xeTable.$refs.refElem;
|
|
2676
|
-
if (!isAllOverflow && scrollYLoad && el) {
|
|
2777
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad) && el) {
|
|
2677
2778
|
const {
|
|
2678
2779
|
handleGetRowId
|
|
2679
2780
|
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
@@ -3212,18 +3313,18 @@ function handleUpdateAggValues($xeTable) {
|
|
|
3212
3313
|
}
|
|
3213
3314
|
function handleUpdateRowGroup($xeTable, groupFields) {
|
|
3214
3315
|
const reactData = $xeTable;
|
|
3215
|
-
const
|
|
3216
|
-
const
|
|
3316
|
+
const aggGroupFields = [];
|
|
3317
|
+
const aggGroupConfs = [];
|
|
3217
3318
|
if (groupFields) {
|
|
3218
3319
|
(_xeUtils.default.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
|
|
3219
|
-
|
|
3220
|
-
|
|
3320
|
+
aggGroupFields.push(field);
|
|
3321
|
+
aggGroupConfs.push({
|
|
3221
3322
|
field
|
|
3222
3323
|
});
|
|
3223
3324
|
});
|
|
3224
3325
|
}
|
|
3225
|
-
reactData.rowGroupList =
|
|
3226
|
-
reactData.aggHandleFields =
|
|
3326
|
+
reactData.rowGroupList = aggGroupConfs;
|
|
3327
|
+
reactData.aggHandleFields = aggGroupFields;
|
|
3227
3328
|
handleUpdateAggValues($xeTable);
|
|
3228
3329
|
}
|
|
3229
3330
|
function handleeGroupSummary($xeTable, aggList) {
|
|
@@ -3604,7 +3705,7 @@ function handleUpdateColumn($xeTable) {
|
|
|
3604
3705
|
const internalData = $xeTable;
|
|
3605
3706
|
const columnList = _xeUtils.default.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
3606
3707
|
internalData.collectColumn = columnList;
|
|
3607
|
-
const tableFullColumn = getColumnList(columnList);
|
|
3708
|
+
const tableFullColumn = (0, _util.getColumnList)(columnList);
|
|
3608
3709
|
internalData.tableFullColumn = tableFullColumn;
|
|
3609
3710
|
cacheColumnMap($xeTable);
|
|
3610
3711
|
}
|
|
@@ -3649,14 +3750,6 @@ function loadScrollXData($xeTable) {
|
|
|
3649
3750
|
}
|
|
3650
3751
|
$xeTable.closeTooltip();
|
|
3651
3752
|
}
|
|
3652
|
-
// 获取所有的列,排除分组
|
|
3653
|
-
function getColumnList(columns) {
|
|
3654
|
-
const result = [];
|
|
3655
|
-
columns.forEach(column => {
|
|
3656
|
-
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
3657
|
-
});
|
|
3658
|
-
return result;
|
|
3659
|
-
}
|
|
3660
3753
|
function parseColumns($xeTable, isReset) {
|
|
3661
3754
|
const props = $xeTable;
|
|
3662
3755
|
const reactData = $xeTable;
|
|
@@ -3687,7 +3780,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
3687
3780
|
if (parentColumn && parentColumn.fixed) {
|
|
3688
3781
|
column.fixed = parentColumn.fixed;
|
|
3689
3782
|
}
|
|
3690
|
-
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
3783
|
+
if (parentColumn && (column.fixed || '') !== (parentColumn.fixed || '')) {
|
|
3691
3784
|
(0, _log.errLog)('vxe.error.groupFixed');
|
|
3692
3785
|
}
|
|
3693
3786
|
if (isColGroup) {
|
|
@@ -3795,27 +3888,57 @@ function parseColumns($xeTable, isReset) {
|
|
|
3795
3888
|
}
|
|
3796
3889
|
return $xeTable.updateFooter();
|
|
3797
3890
|
}
|
|
3798
|
-
function
|
|
3891
|
+
function initColumnHierarchy($xeTable) {
|
|
3799
3892
|
const internalData = $xeTable;
|
|
3800
3893
|
const {
|
|
3801
3894
|
collectColumn
|
|
3802
3895
|
} = internalData;
|
|
3803
|
-
|
|
3804
|
-
|
|
3896
|
+
const fullColIdData = {};
|
|
3897
|
+
const fullColFieldData = {};
|
|
3898
|
+
let sortIndex = 1;
|
|
3899
|
+
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
3900
|
+
const {
|
|
3901
|
+
id: colid,
|
|
3902
|
+
field
|
|
3903
|
+
} = column;
|
|
3904
|
+
const parentId = parentColumn ? parentColumn.id : null;
|
|
3905
|
+
const rest = {
|
|
3906
|
+
$index: -1,
|
|
3907
|
+
_index: -1,
|
|
3908
|
+
column,
|
|
3909
|
+
colid,
|
|
3910
|
+
index,
|
|
3911
|
+
items,
|
|
3912
|
+
parent: parentColumn || null,
|
|
3913
|
+
width: 0,
|
|
3914
|
+
oLeft: 0
|
|
3915
|
+
};
|
|
3916
|
+
column.parentId = parentId;
|
|
3917
|
+
column.defaultParentId = parentId;
|
|
3805
3918
|
column.sortNumber = sortIndex;
|
|
3806
3919
|
column.renderSortNumber = sortIndex;
|
|
3920
|
+
sortIndex++;
|
|
3921
|
+
if (field) {
|
|
3922
|
+
if (fullColFieldData[field]) {
|
|
3923
|
+
(0, _log.errLog)('vxe.error.colRepet', ['field', field]);
|
|
3924
|
+
}
|
|
3925
|
+
fullColFieldData[field] = rest;
|
|
3926
|
+
}
|
|
3927
|
+
fullColIdData[colid] = rest;
|
|
3807
3928
|
});
|
|
3929
|
+
internalData.fullColumnIdData = fullColIdData;
|
|
3930
|
+
internalData.fullColumnFieldData = fullColFieldData;
|
|
3808
3931
|
}
|
|
3809
|
-
function
|
|
3932
|
+
function handleInitColumn($xeTable, collectColumn) {
|
|
3810
3933
|
const $xeToolbar = $xeTable.$refs.$xeToolbar;
|
|
3811
3934
|
const reactData = $xeTable;
|
|
3812
3935
|
const internalData = $xeTable;
|
|
3813
3936
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
3814
3937
|
internalData.collectColumn = collectColumn;
|
|
3815
|
-
const tableFullColumn = getColumnList(collectColumn);
|
|
3938
|
+
const tableFullColumn = (0, _util.getColumnList)(collectColumn);
|
|
3816
3939
|
internalData.tableFullColumn = tableFullColumn;
|
|
3817
3940
|
reactData.isColLoading = true;
|
|
3818
|
-
|
|
3941
|
+
initColumnHierarchy($xeTable);
|
|
3819
3942
|
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
3820
3943
|
const {
|
|
3821
3944
|
scrollXLoad,
|
|
@@ -4542,7 +4665,7 @@ const Methods = {
|
|
|
4542
4665
|
const collectColumn = _xeUtils.default.mapTree(columns, column => _cell.default.createColumn($xeTable, column), {
|
|
4543
4666
|
children: 'children'
|
|
4544
4667
|
});
|
|
4545
|
-
return
|
|
4668
|
+
return handleInitColumn($xeTable, collectColumn).then(() => {
|
|
4546
4669
|
let targetScrollLeft = lastScrollLeft;
|
|
4547
4670
|
let targetScrollTop = lastScrollTop;
|
|
4548
4671
|
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
@@ -4567,9 +4690,9 @@ const Methods = {
|
|
|
4567
4690
|
return this.loadColumn(columns);
|
|
4568
4691
|
});
|
|
4569
4692
|
},
|
|
4570
|
-
|
|
4693
|
+
handleInitColumn(collectColumn) {
|
|
4571
4694
|
const $xeTable = this;
|
|
4572
|
-
return
|
|
4695
|
+
return handleInitColumn($xeTable, collectColumn);
|
|
4573
4696
|
},
|
|
4574
4697
|
/**
|
|
4575
4698
|
* 更新数据行的 Map
|
|
@@ -4608,6 +4731,7 @@ const Methods = {
|
|
|
4608
4731
|
_index: -1,
|
|
4609
4732
|
$index: -1,
|
|
4610
4733
|
treeIndex: index,
|
|
4734
|
+
_tIndex: -1,
|
|
4611
4735
|
items,
|
|
4612
4736
|
parent: parentRow,
|
|
4613
4737
|
level,
|
|
@@ -4751,6 +4875,7 @@ const Methods = {
|
|
|
4751
4875
|
_index: -1,
|
|
4752
4876
|
$index: -1,
|
|
4753
4877
|
treeIndex: -1,
|
|
4878
|
+
_tIndex: -1,
|
|
4754
4879
|
items,
|
|
4755
4880
|
parent: parentRow,
|
|
4756
4881
|
level: parentLevel + nodes.length,
|
|
@@ -5876,8 +6001,9 @@ const Methods = {
|
|
|
5876
6001
|
const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom);
|
|
5877
6002
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
5878
6003
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
6004
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
5879
6005
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
5880
|
-
if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
|
|
6006
|
+
if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomAggGroup || isCustomSort)) {
|
|
5881
6007
|
if (!tableId) {
|
|
5882
6008
|
(0, _log.errLog)('vxe.error.reqProp', ['id']);
|
|
5883
6009
|
return;
|
|
@@ -5903,12 +6029,18 @@ const Methods = {
|
|
|
5903
6029
|
getCustomStoreData() {
|
|
5904
6030
|
const $xeTable = this;
|
|
5905
6031
|
const props = $xeTable;
|
|
6032
|
+
const reactData = $xeTable;
|
|
5906
6033
|
const internalData = $xeTable;
|
|
5907
6034
|
const {
|
|
5908
6035
|
id
|
|
5909
6036
|
} = props;
|
|
5910
6037
|
const customOpts = $xeTable.computeCustomOpts;
|
|
5911
6038
|
const {
|
|
6039
|
+
isRowGroupStatus,
|
|
6040
|
+
rowGroupList
|
|
6041
|
+
} = reactData;
|
|
6042
|
+
const {
|
|
6043
|
+
fullColumnFieldData,
|
|
5912
6044
|
collectColumn
|
|
5913
6045
|
} = internalData;
|
|
5914
6046
|
const {
|
|
@@ -5922,17 +6054,20 @@ const Methods = {
|
|
|
5922
6054
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
5923
6055
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
5924
6056
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
6057
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
5925
6058
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
5926
6059
|
const resizableData = {};
|
|
5927
|
-
const sortData =
|
|
6060
|
+
const sortData = [];
|
|
5928
6061
|
const visibleData = {};
|
|
5929
6062
|
const fixedData = {};
|
|
6063
|
+
const aggGroupData = {};
|
|
5930
6064
|
const aggFuncData = {};
|
|
5931
6065
|
const storeData = {
|
|
5932
6066
|
resizableData: undefined,
|
|
5933
6067
|
sortData: undefined,
|
|
5934
6068
|
visibleData: undefined,
|
|
5935
6069
|
fixedData: undefined,
|
|
6070
|
+
aggGroupData: undefined,
|
|
5936
6071
|
aggFuncData: undefined
|
|
5937
6072
|
};
|
|
5938
6073
|
if (!id) {
|
|
@@ -5946,19 +6081,40 @@ const Methods = {
|
|
|
5946
6081
|
let hasFixed = 0;
|
|
5947
6082
|
let hasVisible = 0;
|
|
5948
6083
|
let hasAggFunc = 0;
|
|
6084
|
+
const sortMaps = {};
|
|
5949
6085
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
5950
6086
|
const colKey = column.getKey();
|
|
5951
6087
|
if (!colKey) {
|
|
5952
6088
|
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
5953
6089
|
return;
|
|
5954
6090
|
}
|
|
5955
|
-
|
|
5956
|
-
if (!parentColumn) {
|
|
6091
|
+
if (parentColumn) {
|
|
5957
6092
|
if (isCustomSort) {
|
|
6093
|
+
const pColKey = parentColumn.getKey();
|
|
6094
|
+
const psObj = sortMaps[pColKey];
|
|
5958
6095
|
hasSort = 1;
|
|
5959
|
-
|
|
6096
|
+
if (psObj) {
|
|
6097
|
+
const sObj = {
|
|
6098
|
+
k: colKey
|
|
6099
|
+
};
|
|
6100
|
+
sortMaps[colKey] = sObj;
|
|
6101
|
+
if (!psObj.c) {
|
|
6102
|
+
psObj.c = [];
|
|
6103
|
+
}
|
|
6104
|
+
psObj.c.push(sObj);
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
} else {
|
|
6108
|
+
if (isCustomSort) {
|
|
6109
|
+
hasSort = 1;
|
|
6110
|
+
const sObj = {
|
|
6111
|
+
k: colKey
|
|
6112
|
+
};
|
|
6113
|
+
sortMaps[colKey] = sObj;
|
|
6114
|
+
sortData.push(sObj);
|
|
5960
6115
|
}
|
|
5961
|
-
|
|
6116
|
+
// 只支持一级
|
|
6117
|
+
if (isCustomFixed && (column.fixed || '') !== (column.defaultFixed || '')) {
|
|
5962
6118
|
hasFixed = 1;
|
|
5963
6119
|
fixedData[colKey] = column.fixed;
|
|
5964
6120
|
}
|
|
@@ -5979,7 +6135,7 @@ const Methods = {
|
|
|
5979
6135
|
visibleData[colKey] = true;
|
|
5980
6136
|
}
|
|
5981
6137
|
}
|
|
5982
|
-
if (isCustomAggFunc && column.aggFunc !== column.defaultAggFunc) {
|
|
6138
|
+
if (isCustomAggFunc && (column.aggFunc || '') !== (column.defaultAggFunc || '')) {
|
|
5983
6139
|
hasAggFunc = 1;
|
|
5984
6140
|
aggFuncData[colKey] = column.aggFunc;
|
|
5985
6141
|
}
|
|
@@ -5996,6 +6152,15 @@ const Methods = {
|
|
|
5996
6152
|
if (hasVisible) {
|
|
5997
6153
|
storeData.visibleData = visibleData;
|
|
5998
6154
|
}
|
|
6155
|
+
if (isCustomAggGroup && isRowGroupStatus) {
|
|
6156
|
+
rowGroupList.forEach(aggConf => {
|
|
6157
|
+
const colRest = fullColumnFieldData[aggConf.field];
|
|
6158
|
+
if (colRest) {
|
|
6159
|
+
aggGroupData[colRest.column.getKey()] = true;
|
|
6160
|
+
}
|
|
6161
|
+
});
|
|
6162
|
+
storeData.aggGroupData = aggGroupData;
|
|
6163
|
+
}
|
|
5999
6164
|
if (hasAggFunc) {
|
|
6000
6165
|
storeData.aggFuncData = aggFuncData;
|
|
6001
6166
|
}
|
|
@@ -6021,11 +6186,12 @@ const Methods = {
|
|
|
6021
6186
|
const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom);
|
|
6022
6187
|
const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom);
|
|
6023
6188
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
6189
|
+
const isCustomAggGroup = hangleStorageDefaultValue(storageOpts.aggGroup, isAllCustom);
|
|
6024
6190
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
6025
6191
|
if (type !== 'reset') {
|
|
6026
6192
|
reactData.isCustomStatus = true;
|
|
6027
6193
|
}
|
|
6028
|
-
if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggFunc)) {
|
|
6194
|
+
if (storage && (customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort || isCustomAggGroup || isCustomAggFunc)) {
|
|
6029
6195
|
if (!tableId) {
|
|
6030
6196
|
(0, _log.errLog)('vxe.error.reqProp', ['id']);
|
|
6031
6197
|
return this.$nextTick();
|
|
@@ -6034,7 +6200,9 @@ const Methods = {
|
|
|
6034
6200
|
resizableData: {},
|
|
6035
6201
|
sortData: {},
|
|
6036
6202
|
visibleData: {},
|
|
6037
|
-
fixedData: {}
|
|
6203
|
+
fixedData: {},
|
|
6204
|
+
aggGroupData: {},
|
|
6205
|
+
aggFuncData: {}
|
|
6038
6206
|
} : this.getCustomStoreData();
|
|
6039
6207
|
if (updateStore) {
|
|
6040
6208
|
return updateStore({
|
|
@@ -10181,9 +10349,9 @@ const Methods = {
|
|
|
10181
10349
|
const $xeTable = this;
|
|
10182
10350
|
return handleSortEvent($xeTable, null, sortConfs, isUpdate);
|
|
10183
10351
|
},
|
|
10184
|
-
setSortByEvent(evnt, sortConfs
|
|
10352
|
+
setSortByEvent(evnt, sortConfs) {
|
|
10185
10353
|
const $xeTable = this;
|
|
10186
|
-
return handleSortEvent($xeTable, evnt, sortConfs,
|
|
10354
|
+
return handleSortEvent($xeTable, evnt, sortConfs, true);
|
|
10187
10355
|
},
|
|
10188
10356
|
/**
|
|
10189
10357
|
* 清空指定列的排序条件
|
|
@@ -10216,6 +10384,9 @@ const Methods = {
|
|
|
10216
10384
|
tableFullColumn
|
|
10217
10385
|
} = internalData;
|
|
10218
10386
|
const sortOpts = $xeTable.computeSortOpts;
|
|
10387
|
+
const {
|
|
10388
|
+
multiple
|
|
10389
|
+
} = sortOpts;
|
|
10219
10390
|
const sortCols = [];
|
|
10220
10391
|
let column = null;
|
|
10221
10392
|
if (evnt) {
|
|
@@ -10235,7 +10406,13 @@ const Methods = {
|
|
|
10235
10406
|
if (!sortOpts.remote) {
|
|
10236
10407
|
$xeTable.handleTableData(true);
|
|
10237
10408
|
}
|
|
10238
|
-
if (
|
|
10409
|
+
if (!multiple) {
|
|
10410
|
+
column = sortCols[0];
|
|
10411
|
+
}
|
|
10412
|
+
if (column) {
|
|
10413
|
+
$xeTable.handleColumnSortEvent(evnt, column);
|
|
10414
|
+
}
|
|
10415
|
+
if (multiple && sortCols.length) {
|
|
10239
10416
|
const params = {
|
|
10240
10417
|
$table: $xeTable,
|
|
10241
10418
|
$event: evnt,
|
|
@@ -10243,8 +10420,6 @@ const Methods = {
|
|
|
10243
10420
|
sortList: []
|
|
10244
10421
|
};
|
|
10245
10422
|
$xeTable.dispatchEvent('clear-all-sort', params, evnt);
|
|
10246
|
-
} else if (column) {
|
|
10247
|
-
$xeTable.handleColumnSortEvent(evnt, column);
|
|
10248
10423
|
}
|
|
10249
10424
|
}
|
|
10250
10425
|
return $xeTable.$nextTick().then(() => {
|
|
@@ -10290,22 +10465,12 @@ const Methods = {
|
|
|
10290
10465
|
}
|
|
10291
10466
|
return sortList;
|
|
10292
10467
|
},
|
|
10293
|
-
setFilterByEvent(evnt, fieldOrColumn, options
|
|
10468
|
+
setFilterByEvent(evnt, fieldOrColumn, options) {
|
|
10294
10469
|
const $xeTable = this;
|
|
10295
|
-
const reactData = $xeTable;
|
|
10296
|
-
const {
|
|
10297
|
-
filterStore
|
|
10298
|
-
} = reactData;
|
|
10299
10470
|
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
10300
10471
|
if (column && column.filters) {
|
|
10301
10472
|
column.filters = (0, _util.toFilters)(options || []);
|
|
10302
|
-
|
|
10303
|
-
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
10304
|
-
} else {
|
|
10305
|
-
if (filterStore.visible) {
|
|
10306
|
-
$xeTable.handleFilterOptions(column);
|
|
10307
|
-
}
|
|
10308
|
-
}
|
|
10473
|
+
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
10309
10474
|
}
|
|
10310
10475
|
return $xeTable.$nextTick();
|
|
10311
10476
|
},
|
|
@@ -10364,6 +10529,9 @@ const Methods = {
|
|
|
10364
10529
|
tableFullColumn
|
|
10365
10530
|
} = internalData;
|
|
10366
10531
|
const filterOpts = $xeTable.computeFilterOpts;
|
|
10532
|
+
const {
|
|
10533
|
+
multiple
|
|
10534
|
+
} = filterOpts;
|
|
10367
10535
|
const filterCols = [];
|
|
10368
10536
|
let column = null;
|
|
10369
10537
|
if (fieldOrColumn) {
|
|
@@ -10393,7 +10561,34 @@ const Methods = {
|
|
|
10393
10561
|
if (!filterOpts.remote) {
|
|
10394
10562
|
$xeTable.updateData();
|
|
10395
10563
|
}
|
|
10396
|
-
if (
|
|
10564
|
+
if (!multiple) {
|
|
10565
|
+
column = filterCols[0];
|
|
10566
|
+
}
|
|
10567
|
+
if (column) {
|
|
10568
|
+
const filterList = () => $xeTable.getCheckedFilters();
|
|
10569
|
+
const values = [];
|
|
10570
|
+
const datas = [];
|
|
10571
|
+
column.filters.forEach(item => {
|
|
10572
|
+
if (item.checked) {
|
|
10573
|
+
values.push(item.value);
|
|
10574
|
+
datas.push(item.data);
|
|
10575
|
+
}
|
|
10576
|
+
});
|
|
10577
|
+
const params = {
|
|
10578
|
+
$table: $xeTable,
|
|
10579
|
+
$event: evnt,
|
|
10580
|
+
column,
|
|
10581
|
+
field: column.field,
|
|
10582
|
+
property: column.field,
|
|
10583
|
+
values,
|
|
10584
|
+
datas,
|
|
10585
|
+
filters: filterList,
|
|
10586
|
+
filterList
|
|
10587
|
+
};
|
|
10588
|
+
$xeTable.dispatchEvent('filter-change', params, evnt);
|
|
10589
|
+
$xeTable.dispatchEvent('clear-filter', params, evnt);
|
|
10590
|
+
}
|
|
10591
|
+
if (multiple && filterCols.length) {
|
|
10397
10592
|
const params = {
|
|
10398
10593
|
$table: $xeTable,
|
|
10399
10594
|
$event: evnt,
|
|
@@ -10401,10 +10596,6 @@ const Methods = {
|
|
|
10401
10596
|
filterList: []
|
|
10402
10597
|
};
|
|
10403
10598
|
$xeTable.dispatchEvent('clear-all-filter', params, evnt);
|
|
10404
|
-
} else if (column) {
|
|
10405
|
-
$xeTable.dispatchEvent('clear-filter', {
|
|
10406
|
-
filterList: () => $xeTable.getCheckedFilters()
|
|
10407
|
-
}, evnt);
|
|
10408
10599
|
}
|
|
10409
10600
|
return $xeTable.$nextTick();
|
|
10410
10601
|
},
|
|
@@ -12445,7 +12636,7 @@ const Methods = {
|
|
|
12445
12636
|
}
|
|
12446
12637
|
};
|
|
12447
12638
|
// Module methods
|
|
12448
|
-
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
12639
|
+
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getEditCell,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
12449
12640
|
funcs.forEach(name => {
|
|
12450
12641
|
Methods[name] = function (...args) {
|
|
12451
12642
|
if (!this[`_${name}`]) {
|