vxe-table 3.12.14 → 3.12.16
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/mixin.js +250 -168
- package/es/table/module/export/mixin.js +3 -2
- package/es/table/module/validator/mixin.js +6 -1
- package/es/table/src/body.js +1 -0
- package/es/table/src/methods.js +166 -100
- package/es/table/src/table.js +0 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +540 -375
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +305 -225
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +3 -2
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +8 -0
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +1 -0
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +219 -143
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +0 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/module/edit/mixin.ts +273 -168
- package/packages/table/module/export/mixin.ts +3 -2
- package/packages/table/module/validator/mixin.ts +6 -1
- package/packages/table/src/body.ts +1 -0
- package/packages/table/src/methods.ts +172 -96
- package/packages/table/src/table.ts +0 -1
- /package/es/{iconfont.1739181382716.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/es/{iconfont.1739181382716.woff → iconfont.1739333092714.woff} +0 -0
- /package/es/{iconfont.1739181382716.woff2 → iconfont.1739333092714.woff2} +0 -0
- /package/lib/{iconfont.1739181382716.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/lib/{iconfont.1739181382716.woff → iconfont.1739333092714.woff} +0 -0
- /package/lib/{iconfont.1739181382716.woff2 → iconfont.1739333092714.woff2} +0 -0
|
@@ -5,6 +5,45 @@ import { getCellValue, setCellValue, getRowid } from '../../src/util';
|
|
|
5
5
|
import { browse, removeClass, addClass } from '../../../ui/src/dom';
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log';
|
|
7
7
|
const { getConfig, renderer, getI18n } = VxeUI;
|
|
8
|
+
function getEditColumnModel(row, column) {
|
|
9
|
+
const { model, editRender } = column;
|
|
10
|
+
if (editRender) {
|
|
11
|
+
model.value = getCellValue(row, column);
|
|
12
|
+
model.update = false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function setEditColumnModel(row, column) {
|
|
16
|
+
const { model, editRender } = column;
|
|
17
|
+
if (editRender && model.update) {
|
|
18
|
+
setCellValue(row, column, model.value);
|
|
19
|
+
model.update = false;
|
|
20
|
+
model.value = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function removeCellSelectedClass($xeTable) {
|
|
24
|
+
const el = $xeTable.$refs.refElem;
|
|
25
|
+
if (el) {
|
|
26
|
+
const cell = el.querySelector('.col--selected');
|
|
27
|
+
if (cell) {
|
|
28
|
+
removeClass(cell, 'col--selected');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function syncActivedCell($xeTable) {
|
|
33
|
+
const reactData = $xeTable;
|
|
34
|
+
const { editStore, tableColumn } = reactData;
|
|
35
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
36
|
+
const { actived } = editStore;
|
|
37
|
+
const { row, column } = actived;
|
|
38
|
+
if (row || column) {
|
|
39
|
+
if (editOpts.mode === 'row') {
|
|
40
|
+
tableColumn.forEach((column) => setEditColumnModel(row, column));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setEditColumnModel(row, column);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
8
47
|
function insertTreeRow(_vm, newRecords, isAppend) {
|
|
9
48
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm;
|
|
10
49
|
const { rowField, parentField, mapChildrenField } = treeOpts;
|
|
@@ -241,6 +280,178 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
241
280
|
}
|
|
242
281
|
return Promise.resolve({ row: null, rows: [] });
|
|
243
282
|
}
|
|
283
|
+
function handleClearEdit($xeTable, evnt, targetRow) {
|
|
284
|
+
const props = $xeTable;
|
|
285
|
+
const reactData = $xeTable;
|
|
286
|
+
const { mouseConfig } = props;
|
|
287
|
+
const { editStore } = reactData;
|
|
288
|
+
const { actived, focused } = editStore;
|
|
289
|
+
const { row, column } = actived;
|
|
290
|
+
const validOpts = $xeTable.computeValidOpts;
|
|
291
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
292
|
+
if (row || column) {
|
|
293
|
+
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
294
|
+
return $xeTable.$nextTick();
|
|
295
|
+
}
|
|
296
|
+
syncActivedCell($xeTable);
|
|
297
|
+
actived.args = null;
|
|
298
|
+
actived.row = null;
|
|
299
|
+
actived.column = null;
|
|
300
|
+
$xeTable.updateFooter();
|
|
301
|
+
$xeTable.dispatchEvent('edit-closed', {
|
|
302
|
+
row,
|
|
303
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
304
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
305
|
+
column,
|
|
306
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
307
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
308
|
+
}, evnt || null);
|
|
309
|
+
}
|
|
310
|
+
focused.row = null;
|
|
311
|
+
focused.column = null;
|
|
312
|
+
if (validOpts.autoClear) {
|
|
313
|
+
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
314
|
+
if ($xeTable.clearValidate) {
|
|
315
|
+
return $xeTable.clearValidate();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return $xeTable.$nextTick().then(() => {
|
|
320
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
321
|
+
return $xeTable.handleRecalculateCellAreas();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function handleEditActive($xeTable, params, evnt, isFocus) {
|
|
326
|
+
const props = $xeTable;
|
|
327
|
+
const reactData = $xeTable;
|
|
328
|
+
const { editConfig, mouseConfig } = props;
|
|
329
|
+
const { editStore, tableColumn } = reactData;
|
|
330
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
331
|
+
const { mode } = editOpts;
|
|
332
|
+
const { actived, focused } = editStore;
|
|
333
|
+
const { row, column } = params;
|
|
334
|
+
const { editRender } = column;
|
|
335
|
+
const cell = (params.cell || $xeTable.getCellElement(row, column));
|
|
336
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
337
|
+
params.cell = cell;
|
|
338
|
+
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
339
|
+
// 激活编辑
|
|
340
|
+
if (!$xeTable.isPendingByRow(row)) {
|
|
341
|
+
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
342
|
+
// 判断是否禁用编辑
|
|
343
|
+
let type = 'edit-disabled';
|
|
344
|
+
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeTable.xegrid }))) {
|
|
345
|
+
if (mouseConfig) {
|
|
346
|
+
$xeTable.clearSelected();
|
|
347
|
+
if ($xeTable.clearCellAreas) {
|
|
348
|
+
$xeTable.clearCellAreas();
|
|
349
|
+
$xeTable.clearCopyCellArea();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
$xeTable.closeTooltip();
|
|
353
|
+
if (actived.column) {
|
|
354
|
+
handleClearEdit($xeTable, evnt);
|
|
355
|
+
}
|
|
356
|
+
type = 'edit-activated';
|
|
357
|
+
column.renderHeight = cell.offsetHeight;
|
|
358
|
+
actived.args = params;
|
|
359
|
+
actived.row = row;
|
|
360
|
+
actived.column = column;
|
|
361
|
+
if (mode === 'row') {
|
|
362
|
+
tableColumn.forEach((column) => getEditColumnModel(row, column));
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
getEditColumnModel(row, column);
|
|
366
|
+
}
|
|
367
|
+
const afterEditMethod = editOpts.afterEditMethod;
|
|
368
|
+
$xeTable.$nextTick(() => {
|
|
369
|
+
if (isFocus) {
|
|
370
|
+
$xeTable.handleFocus(params, evnt);
|
|
371
|
+
}
|
|
372
|
+
if (afterEditMethod) {
|
|
373
|
+
afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeTable.xegrid }));
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
$xeTable.dispatchEvent(type, {
|
|
378
|
+
row,
|
|
379
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
380
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
381
|
+
column,
|
|
382
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
383
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
384
|
+
}, evnt);
|
|
385
|
+
// v4已废弃
|
|
386
|
+
if (type === 'edit-activated') {
|
|
387
|
+
$xeTable.dispatchEvent('edit-actived', {
|
|
388
|
+
row,
|
|
389
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
390
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
391
|
+
column,
|
|
392
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
393
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
394
|
+
}, evnt);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
const { column: oldColumn } = actived;
|
|
399
|
+
if (mouseConfig) {
|
|
400
|
+
$xeTable.clearSelected();
|
|
401
|
+
if ($xeTable.clearCellAreas) {
|
|
402
|
+
$xeTable.clearCellAreas();
|
|
403
|
+
$xeTable.clearCopyCellArea();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (oldColumn !== column) {
|
|
407
|
+
const { model: oldModel } = oldColumn;
|
|
408
|
+
if (oldModel.update) {
|
|
409
|
+
setCellValue(row, oldColumn, oldModel.value);
|
|
410
|
+
}
|
|
411
|
+
if ($xeTable.clearValidate) {
|
|
412
|
+
$xeTable.clearValidate(row, column);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
column.renderHeight = cell.offsetHeight;
|
|
416
|
+
actived.args = params;
|
|
417
|
+
actived.column = column;
|
|
418
|
+
if (isFocus) {
|
|
419
|
+
setTimeout(() => {
|
|
420
|
+
$xeTable.handleFocus(params, evnt);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
focused.column = null;
|
|
425
|
+
focused.row = null;
|
|
426
|
+
$xeTable.focus();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return $xeTable.$nextTick();
|
|
430
|
+
}
|
|
431
|
+
function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
|
|
432
|
+
const props = $xeTable;
|
|
433
|
+
const internalData = $xeTable;
|
|
434
|
+
const { editConfig } = props;
|
|
435
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
436
|
+
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
437
|
+
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
438
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
439
|
+
if (cell) {
|
|
440
|
+
handleEditActive($xeTable, {
|
|
441
|
+
row,
|
|
442
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
443
|
+
column,
|
|
444
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
445
|
+
cell,
|
|
446
|
+
$table: $xeTable
|
|
447
|
+
}, null, false);
|
|
448
|
+
internalData._lastCallTime = Date.now();
|
|
449
|
+
}
|
|
450
|
+
return $xeTable.$nextTick();
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
return $xeTable.$nextTick();
|
|
454
|
+
}
|
|
244
455
|
export default {
|
|
245
456
|
methods: {
|
|
246
457
|
/**
|
|
@@ -293,7 +504,7 @@ export default {
|
|
|
293
504
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
294
505
|
const { transform, mapChildrenField } = treeOpts;
|
|
295
506
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
296
|
-
const { actived,
|
|
507
|
+
const { actived, removeMaps, insertMaps } = editStore;
|
|
297
508
|
const { checkField } = checkboxOpts;
|
|
298
509
|
let delList = [];
|
|
299
510
|
if (!rows) {
|
|
@@ -305,7 +516,8 @@ export default {
|
|
|
305
516
|
// 如果是新增,则保存记录
|
|
306
517
|
rows.forEach(row => {
|
|
307
518
|
if (!$xeTable.isInsertByRow(row)) {
|
|
308
|
-
|
|
519
|
+
const rowid = getRowid($xeTable, row);
|
|
520
|
+
removeMaps[rowid] = row;
|
|
309
521
|
}
|
|
310
522
|
});
|
|
311
523
|
// 如果绑定了多选属性,则更新状态
|
|
@@ -467,7 +679,15 @@ export default {
|
|
|
467
679
|
* 获取已删除的数据
|
|
468
680
|
*/
|
|
469
681
|
_getRemoveRecords() {
|
|
470
|
-
|
|
682
|
+
const $xeTable = this;
|
|
683
|
+
const reactData = $xeTable;
|
|
684
|
+
const { editStore } = reactData;
|
|
685
|
+
const { removeMaps } = editStore;
|
|
686
|
+
const removeRecords = [];
|
|
687
|
+
XEUtils.each(removeMaps, (row) => {
|
|
688
|
+
removeRecords.push(row);
|
|
689
|
+
});
|
|
690
|
+
return removeRecords;
|
|
471
691
|
},
|
|
472
692
|
/**
|
|
473
693
|
* 获取更新数据
|
|
@@ -475,12 +695,13 @@ export default {
|
|
|
475
695
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
476
696
|
*/
|
|
477
697
|
_getUpdateRecords() {
|
|
698
|
+
const $xeTable = this;
|
|
478
699
|
const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this;
|
|
479
700
|
if (keepSource) {
|
|
480
701
|
const { actived } = editStore;
|
|
481
702
|
const { row, column } = actived;
|
|
482
703
|
if (row || column) {
|
|
483
|
-
|
|
704
|
+
syncActivedCell($xeTable);
|
|
484
705
|
}
|
|
485
706
|
if (treeConfig) {
|
|
486
707
|
return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts);
|
|
@@ -493,81 +714,8 @@ export default {
|
|
|
493
714
|
* 处理激活编辑
|
|
494
715
|
*/
|
|
495
716
|
handleEdit(params, evnt) {
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
const { actived, focused } = editStore;
|
|
499
|
-
const { row, column } = params;
|
|
500
|
-
const { editRender } = column;
|
|
501
|
-
const cell = params.cell = (params.cell || this.getCellElement(row, column));
|
|
502
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
503
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
504
|
-
// 激活编辑
|
|
505
|
-
if (!this.hasPendingByRow(row)) {
|
|
506
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
507
|
-
// 判断是否禁用编辑
|
|
508
|
-
let type = 'edit-disabled';
|
|
509
|
-
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: this, $grid: this.$xegrid }))) {
|
|
510
|
-
if (mouseConfig) {
|
|
511
|
-
this.clearSelected(evnt);
|
|
512
|
-
this.clearCellAreas(evnt);
|
|
513
|
-
this.clearCopyCellArea(evnt);
|
|
514
|
-
}
|
|
515
|
-
this.closeTooltip();
|
|
516
|
-
if (actived.column) {
|
|
517
|
-
this.handleClearEdit(evnt);
|
|
518
|
-
}
|
|
519
|
-
type = 'edit-activated';
|
|
520
|
-
column.renderHeight = cell.offsetHeight;
|
|
521
|
-
actived.args = params;
|
|
522
|
-
actived.row = row;
|
|
523
|
-
actived.column = column;
|
|
524
|
-
if (mode === 'row') {
|
|
525
|
-
tableColumn.forEach((column) => this._getColumnModel(row, column));
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
this._getColumnModel(row, column);
|
|
529
|
-
}
|
|
530
|
-
const afterEditMethod = editOpts.afterEditMethod;
|
|
531
|
-
this.$nextTick(() => {
|
|
532
|
-
this.handleFocus(params, evnt);
|
|
533
|
-
if (afterEditMethod) {
|
|
534
|
-
afterEditMethod(Object.assign(Object.assign({}, params), { $table: this, $grid: this.$xegrid }));
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
this.emitEvent(type, params, evnt);
|
|
539
|
-
// v4已废弃
|
|
540
|
-
if (type === 'edit-activated') {
|
|
541
|
-
this.emitEvent('edit-actived', params, evnt);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
const { column: oldColumn } = actived;
|
|
546
|
-
if (mouseConfig) {
|
|
547
|
-
this.clearSelected(evnt);
|
|
548
|
-
this.clearCellAreas(evnt);
|
|
549
|
-
this.clearCopyCellArea(evnt);
|
|
550
|
-
}
|
|
551
|
-
if (oldColumn !== column) {
|
|
552
|
-
const { model: oldModel } = oldColumn;
|
|
553
|
-
if (oldModel.update) {
|
|
554
|
-
setCellValue(row, oldColumn, oldModel.value);
|
|
555
|
-
}
|
|
556
|
-
this.clearValidate();
|
|
557
|
-
}
|
|
558
|
-
column.renderHeight = cell.offsetHeight;
|
|
559
|
-
actived.args = params;
|
|
560
|
-
actived.column = column;
|
|
561
|
-
setTimeout(() => {
|
|
562
|
-
this.handleFocus(params, evnt);
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
focused.column = null;
|
|
566
|
-
focused.row = null;
|
|
567
|
-
this.focus();
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
return this.$nextTick();
|
|
717
|
+
const $xeTable = this;
|
|
718
|
+
return handleEditActive($xeTable, params, evnt, true);
|
|
571
719
|
},
|
|
572
720
|
/**
|
|
573
721
|
* @deprecated
|
|
@@ -576,32 +724,14 @@ export default {
|
|
|
576
724
|
return this.handleEdit(params, evnt);
|
|
577
725
|
},
|
|
578
726
|
_getColumnModel(row, column) {
|
|
579
|
-
|
|
580
|
-
if (editRender) {
|
|
581
|
-
model.value = getCellValue(row, column);
|
|
582
|
-
model.update = false;
|
|
583
|
-
}
|
|
727
|
+
getEditColumnModel(row, column);
|
|
584
728
|
},
|
|
585
729
|
_setColumnModel(row, column) {
|
|
586
|
-
|
|
587
|
-
if (editRender && model.update) {
|
|
588
|
-
setCellValue(row, column, model.value);
|
|
589
|
-
model.update = false;
|
|
590
|
-
model.value = null;
|
|
591
|
-
}
|
|
730
|
+
setEditColumnModel(row, column);
|
|
592
731
|
},
|
|
593
732
|
_syncActivedCell() {
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
const { row, column } = actived;
|
|
597
|
-
if (row || column) {
|
|
598
|
-
if (editOpts.mode === 'row') {
|
|
599
|
-
tableColumn.forEach((column) => this._setColumnModel(row, column));
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
this._setColumnModel(row, column);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
733
|
+
const $xeTable = this;
|
|
734
|
+
syncActivedCell($xeTable);
|
|
605
735
|
},
|
|
606
736
|
_clearActived(row) {
|
|
607
737
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -614,53 +744,15 @@ export default {
|
|
|
614
744
|
* 清除激活的编辑
|
|
615
745
|
*/
|
|
616
746
|
_clearEdit(row) {
|
|
617
|
-
|
|
747
|
+
const $xeTable = this;
|
|
748
|
+
return handleClearEdit($xeTable, null, row);
|
|
618
749
|
},
|
|
619
750
|
/**
|
|
620
751
|
* 取消编辑
|
|
621
752
|
*/
|
|
622
753
|
handleClearEdit(evnt, targetRow) {
|
|
623
754
|
const $xeTable = this;
|
|
624
|
-
|
|
625
|
-
const reactData = $xeTable;
|
|
626
|
-
const { mouseConfig } = props;
|
|
627
|
-
const { editStore } = reactData;
|
|
628
|
-
const { actived, focused } = editStore;
|
|
629
|
-
const { row, column } = actived;
|
|
630
|
-
const validOpts = $xeTable.validOpts;
|
|
631
|
-
const mouseOpts = $xeTable.computeMouseOpts;
|
|
632
|
-
if (row || column) {
|
|
633
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
634
|
-
return $xeTable.$nextTick();
|
|
635
|
-
}
|
|
636
|
-
$xeTable._syncActivedCell();
|
|
637
|
-
actived.args = null;
|
|
638
|
-
actived.row = null;
|
|
639
|
-
actived.column = null;
|
|
640
|
-
$xeTable.updateFooter();
|
|
641
|
-
$xeTable.emitEvent('edit-closed', {
|
|
642
|
-
row,
|
|
643
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
644
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
645
|
-
column,
|
|
646
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
647
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
648
|
-
}, evnt);
|
|
649
|
-
}
|
|
650
|
-
focused.row = null;
|
|
651
|
-
focused.column = null;
|
|
652
|
-
if (validOpts.autoClear) {
|
|
653
|
-
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
654
|
-
if ($xeTable.clearValidate) {
|
|
655
|
-
return $xeTable.clearValidate();
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
return $xeTable.$nextTick().then(() => {
|
|
660
|
-
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
661
|
-
return $xeTable.handleRecalculateCellAreas();
|
|
662
|
-
}
|
|
663
|
-
});
|
|
755
|
+
return handleClearEdit($xeTable, evnt, targetRow);
|
|
664
756
|
},
|
|
665
757
|
_getActiveRecord() {
|
|
666
758
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -764,11 +856,12 @@ export default {
|
|
|
764
856
|
* 激活行编辑
|
|
765
857
|
*/
|
|
766
858
|
_setEditRow(row, fieldOrColumn) {
|
|
859
|
+
const $xeTable = this;
|
|
767
860
|
let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender));
|
|
768
861
|
if (fieldOrColumn) {
|
|
769
862
|
column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
770
863
|
}
|
|
771
|
-
return
|
|
864
|
+
return handleEditCell($xeTable, row, column, false);
|
|
772
865
|
},
|
|
773
866
|
_setActiveCell(row, fieldOrColumn) {
|
|
774
867
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -781,18 +874,8 @@ export default {
|
|
|
781
874
|
* 激活单元格编辑
|
|
782
875
|
*/
|
|
783
876
|
_setEditCell(row, fieldOrColumn) {
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
787
|
-
return this.scrollToRow(row, true).then(() => {
|
|
788
|
-
const cell = this.getCellElement(row, column);
|
|
789
|
-
if (cell) {
|
|
790
|
-
this.handleEdit({ row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column), cell, $table: this });
|
|
791
|
-
this.lastCallTime = Date.now();
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
return this.$nextTick();
|
|
877
|
+
const $xeTable = this;
|
|
878
|
+
return handleEditCell($xeTable, row, fieldOrColumn, true);
|
|
796
879
|
},
|
|
797
880
|
/**
|
|
798
881
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -814,6 +897,7 @@ export default {
|
|
|
814
897
|
* 处理选中源
|
|
815
898
|
*/
|
|
816
899
|
handleSelected(params, evnt) {
|
|
900
|
+
const $xeTable = this;
|
|
817
901
|
const { mouseConfig, mouseOpts, editOpts, editStore } = this;
|
|
818
902
|
const { actived, selected } = editStore;
|
|
819
903
|
const { row, column } = params;
|
|
@@ -821,7 +905,7 @@ export default {
|
|
|
821
905
|
const selectMethod = () => {
|
|
822
906
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
823
907
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
824
|
-
|
|
908
|
+
handleClearEdit($xeTable, evnt);
|
|
825
909
|
this.clearSelected(evnt);
|
|
826
910
|
this.clearCellAreas(evnt);
|
|
827
911
|
this.clearCopyCellArea(evnt);
|
|
@@ -829,7 +913,7 @@ export default {
|
|
|
829
913
|
selected.row = row;
|
|
830
914
|
selected.column = column;
|
|
831
915
|
if (isMouseSelected) {
|
|
832
|
-
this.
|
|
916
|
+
this.addCellSelectedClass();
|
|
833
917
|
}
|
|
834
918
|
this.focus();
|
|
835
919
|
if (evnt) {
|
|
@@ -855,11 +939,12 @@ export default {
|
|
|
855
939
|
* 清除所选中源状态
|
|
856
940
|
*/
|
|
857
941
|
_clearSelected() {
|
|
942
|
+
const $xeTable = this;
|
|
858
943
|
const { selected } = this.editStore;
|
|
859
944
|
selected.row = null;
|
|
860
945
|
selected.column = null;
|
|
861
946
|
this.reColTitleSdCls();
|
|
862
|
-
|
|
947
|
+
removeCellSelectedClass($xeTable);
|
|
863
948
|
return this.$nextTick();
|
|
864
949
|
},
|
|
865
950
|
reColTitleSdCls() {
|
|
@@ -868,18 +953,15 @@ export default {
|
|
|
868
953
|
XEUtils.arrayEach(headerElem.querySelectorAll('.col--title-selected'), elem => removeClass(elem, 'col--title-selected'));
|
|
869
954
|
}
|
|
870
955
|
},
|
|
871
|
-
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
},
|
|
877
|
-
addColSdCls() {
|
|
878
|
-
const { selected } = this.editStore;
|
|
956
|
+
addCellSelectedClass() {
|
|
957
|
+
const $xeTable = this;
|
|
958
|
+
const reactData = $xeTable;
|
|
959
|
+
const { editStore } = reactData;
|
|
960
|
+
const { selected } = editStore;
|
|
879
961
|
const { row, column } = selected;
|
|
880
|
-
|
|
962
|
+
removeCellSelectedClass($xeTable);
|
|
881
963
|
if (row && column) {
|
|
882
|
-
const cell =
|
|
964
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
883
965
|
if (cell) {
|
|
884
966
|
addClass(cell, 'col--selected');
|
|
885
967
|
}
|
|
@@ -2,6 +2,7 @@ import XEUtils from 'xe-utils';
|
|
|
2
2
|
import { VxeUI } from '../../../ui';
|
|
3
3
|
import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../src/util';
|
|
4
4
|
import { parseFile, formatText, eqEmptyValue } from '../../../ui/src/utils';
|
|
5
|
+
import { hasClass } from '../../../ui/src/dom';
|
|
5
6
|
import { createHtmlPage, getExportBlobByContent } from './util';
|
|
6
7
|
import { warnLog, errLog } from '../../../ui/src/log';
|
|
7
8
|
const { getI18n, renderer } = VxeUI;
|
|
@@ -121,7 +122,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
|
|
|
121
122
|
}
|
|
122
123
|
else {
|
|
123
124
|
const cell = $xeTable.getCellElement(row, column);
|
|
124
|
-
if (cell) {
|
|
125
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
125
126
|
cellValue = cell.innerText.trim();
|
|
126
127
|
}
|
|
127
128
|
}
|
|
@@ -182,7 +183,7 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
|
|
|
182
183
|
}
|
|
183
184
|
else {
|
|
184
185
|
const cell = $xeTable.getCellElement(row, column);
|
|
185
|
-
if (cell) {
|
|
186
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
186
187
|
cellValue = cell.innerText.trim();
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -153,8 +153,9 @@ export default {
|
|
|
153
153
|
const internalData = $xeTable;
|
|
154
154
|
const validRest = {};
|
|
155
155
|
const { editRules, treeConfig } = props;
|
|
156
|
-
const { pendingRowMaps } = reactData;
|
|
156
|
+
const { editStore, pendingRowMaps } = reactData;
|
|
157
157
|
const { afterFullData } = internalData;
|
|
158
|
+
const { removeMaps } = editStore;
|
|
158
159
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
159
160
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
160
161
|
let validList;
|
|
@@ -181,6 +182,10 @@ export default {
|
|
|
181
182
|
const columns = cols && cols.length ? cols : this.getColumns();
|
|
182
183
|
const handleVaild = (row) => {
|
|
183
184
|
const rowid = getRowid($xeTable, row);
|
|
185
|
+
// 是否删除
|
|
186
|
+
if (removeMaps[rowid]) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
184
189
|
// 是否标记删除
|
|
185
190
|
if (pendingRowMaps[rowid]) {
|
|
186
191
|
return;
|
package/es/table/src/body.js
CHANGED
|
@@ -357,6 +357,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
357
357
|
'fixed--width': !isAutoCellWidth,
|
|
358
358
|
'fixed--hidden': fixedHiddenColumn,
|
|
359
359
|
'is--padding': isCellPadding,
|
|
360
|
+
'is--progress': (fixedHiddenColumn && isAllOverflow) || isVNPreEmptyStatus,
|
|
360
361
|
'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
|
|
361
362
|
'is--drag-disabled': isDisabledDrag,
|
|
362
363
|
'col--dirty': isDirty,
|