vxe-table 3.12.15 → 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 +219 -153
- package/es/table/src/methods.js +43 -12
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +330 -228
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +268 -210
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/methods.js +58 -14
- package/lib/table/src/methods.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 +237 -154
- package/packages/table/src/methods.ts +45 -12
- /package/es/{iconfont.1739257460253.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/es/{iconfont.1739257460253.woff → iconfont.1739333092714.woff} +0 -0
- /package/es/{iconfont.1739257460253.woff2 → iconfont.1739333092714.woff2} +0 -0
- /package/lib/{iconfont.1739257460253.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/lib/{iconfont.1739257460253.woff → iconfont.1739333092714.woff} +0 -0
- /package/lib/{iconfont.1739257460253.woff2 → iconfont.1739333092714.woff2} +0 -0
|
@@ -5,6 +5,21 @@ 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
|
+
}
|
|
8
23
|
function removeCellSelectedClass($xeTable) {
|
|
9
24
|
const el = $xeTable.$refs.refElem;
|
|
10
25
|
if (el) {
|
|
@@ -14,6 +29,21 @@ function removeCellSelectedClass($xeTable) {
|
|
|
14
29
|
}
|
|
15
30
|
}
|
|
16
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
|
+
}
|
|
17
47
|
function insertTreeRow(_vm, newRecords, isAppend) {
|
|
18
48
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm;
|
|
19
49
|
const { rowField, parentField, mapChildrenField } = treeOpts;
|
|
@@ -250,6 +280,178 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
250
280
|
}
|
|
251
281
|
return Promise.resolve({ row: null, rows: [] });
|
|
252
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
|
+
}
|
|
253
455
|
export default {
|
|
254
456
|
methods: {
|
|
255
457
|
/**
|
|
@@ -493,12 +695,13 @@ export default {
|
|
|
493
695
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
494
696
|
*/
|
|
495
697
|
_getUpdateRecords() {
|
|
698
|
+
const $xeTable = this;
|
|
496
699
|
const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this;
|
|
497
700
|
if (keepSource) {
|
|
498
701
|
const { actived } = editStore;
|
|
499
702
|
const { row, column } = actived;
|
|
500
703
|
if (row || column) {
|
|
501
|
-
|
|
704
|
+
syncActivedCell($xeTable);
|
|
502
705
|
}
|
|
503
706
|
if (treeConfig) {
|
|
504
707
|
return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts);
|
|
@@ -511,81 +714,8 @@ export default {
|
|
|
511
714
|
* 处理激活编辑
|
|
512
715
|
*/
|
|
513
716
|
handleEdit(params, evnt) {
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const { actived, focused } = editStore;
|
|
517
|
-
const { row, column } = params;
|
|
518
|
-
const { editRender } = column;
|
|
519
|
-
const cell = params.cell = (params.cell || this.getCellElement(row, column));
|
|
520
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
521
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
522
|
-
// 激活编辑
|
|
523
|
-
if (!this.hasPendingByRow(row)) {
|
|
524
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
525
|
-
// 判断是否禁用编辑
|
|
526
|
-
let type = 'edit-disabled';
|
|
527
|
-
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: this, $grid: this.$xegrid }))) {
|
|
528
|
-
if (mouseConfig) {
|
|
529
|
-
this.clearSelected(evnt);
|
|
530
|
-
this.clearCellAreas(evnt);
|
|
531
|
-
this.clearCopyCellArea(evnt);
|
|
532
|
-
}
|
|
533
|
-
this.closeTooltip();
|
|
534
|
-
if (actived.column) {
|
|
535
|
-
this.handleClearEdit(evnt);
|
|
536
|
-
}
|
|
537
|
-
type = 'edit-activated';
|
|
538
|
-
column.renderHeight = cell.offsetHeight;
|
|
539
|
-
actived.args = params;
|
|
540
|
-
actived.row = row;
|
|
541
|
-
actived.column = column;
|
|
542
|
-
if (mode === 'row') {
|
|
543
|
-
tableColumn.forEach((column) => this._getColumnModel(row, column));
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
this._getColumnModel(row, column);
|
|
547
|
-
}
|
|
548
|
-
const afterEditMethod = editOpts.afterEditMethod;
|
|
549
|
-
this.$nextTick(() => {
|
|
550
|
-
this.handleFocus(params, evnt);
|
|
551
|
-
if (afterEditMethod) {
|
|
552
|
-
afterEditMethod(Object.assign(Object.assign({}, params), { $table: this, $grid: this.$xegrid }));
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
this.emitEvent(type, params, evnt);
|
|
557
|
-
// v4已废弃
|
|
558
|
-
if (type === 'edit-activated') {
|
|
559
|
-
this.emitEvent('edit-actived', params, evnt);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
const { column: oldColumn } = actived;
|
|
564
|
-
if (mouseConfig) {
|
|
565
|
-
this.clearSelected(evnt);
|
|
566
|
-
this.clearCellAreas(evnt);
|
|
567
|
-
this.clearCopyCellArea(evnt);
|
|
568
|
-
}
|
|
569
|
-
if (oldColumn !== column) {
|
|
570
|
-
const { model: oldModel } = oldColumn;
|
|
571
|
-
if (oldModel.update) {
|
|
572
|
-
setCellValue(row, oldColumn, oldModel.value);
|
|
573
|
-
}
|
|
574
|
-
this.clearValidate();
|
|
575
|
-
}
|
|
576
|
-
column.renderHeight = cell.offsetHeight;
|
|
577
|
-
actived.args = params;
|
|
578
|
-
actived.column = column;
|
|
579
|
-
setTimeout(() => {
|
|
580
|
-
this.handleFocus(params, evnt);
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
focused.column = null;
|
|
584
|
-
focused.row = null;
|
|
585
|
-
this.focus();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
return this.$nextTick();
|
|
717
|
+
const $xeTable = this;
|
|
718
|
+
return handleEditActive($xeTable, params, evnt, true);
|
|
589
719
|
},
|
|
590
720
|
/**
|
|
591
721
|
* @deprecated
|
|
@@ -594,32 +724,14 @@ export default {
|
|
|
594
724
|
return this.handleEdit(params, evnt);
|
|
595
725
|
},
|
|
596
726
|
_getColumnModel(row, column) {
|
|
597
|
-
|
|
598
|
-
if (editRender) {
|
|
599
|
-
model.value = getCellValue(row, column);
|
|
600
|
-
model.update = false;
|
|
601
|
-
}
|
|
727
|
+
getEditColumnModel(row, column);
|
|
602
728
|
},
|
|
603
729
|
_setColumnModel(row, column) {
|
|
604
|
-
|
|
605
|
-
if (editRender && model.update) {
|
|
606
|
-
setCellValue(row, column, model.value);
|
|
607
|
-
model.update = false;
|
|
608
|
-
model.value = null;
|
|
609
|
-
}
|
|
730
|
+
setEditColumnModel(row, column);
|
|
610
731
|
},
|
|
611
732
|
_syncActivedCell() {
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
const { row, column } = actived;
|
|
615
|
-
if (row || column) {
|
|
616
|
-
if (editOpts.mode === 'row') {
|
|
617
|
-
tableColumn.forEach((column) => this._setColumnModel(row, column));
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this._setColumnModel(row, column);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
733
|
+
const $xeTable = this;
|
|
734
|
+
syncActivedCell($xeTable);
|
|
623
735
|
},
|
|
624
736
|
_clearActived(row) {
|
|
625
737
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -632,53 +744,15 @@ export default {
|
|
|
632
744
|
* 清除激活的编辑
|
|
633
745
|
*/
|
|
634
746
|
_clearEdit(row) {
|
|
635
|
-
|
|
747
|
+
const $xeTable = this;
|
|
748
|
+
return handleClearEdit($xeTable, null, row);
|
|
636
749
|
},
|
|
637
750
|
/**
|
|
638
751
|
* 取消编辑
|
|
639
752
|
*/
|
|
640
753
|
handleClearEdit(evnt, targetRow) {
|
|
641
754
|
const $xeTable = this;
|
|
642
|
-
|
|
643
|
-
const reactData = $xeTable;
|
|
644
|
-
const { mouseConfig } = props;
|
|
645
|
-
const { editStore } = reactData;
|
|
646
|
-
const { actived, focused } = editStore;
|
|
647
|
-
const { row, column } = actived;
|
|
648
|
-
const validOpts = $xeTable.validOpts;
|
|
649
|
-
const mouseOpts = $xeTable.computeMouseOpts;
|
|
650
|
-
if (row || column) {
|
|
651
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
652
|
-
return $xeTable.$nextTick();
|
|
653
|
-
}
|
|
654
|
-
$xeTable._syncActivedCell();
|
|
655
|
-
actived.args = null;
|
|
656
|
-
actived.row = null;
|
|
657
|
-
actived.column = null;
|
|
658
|
-
$xeTable.updateFooter();
|
|
659
|
-
$xeTable.emitEvent('edit-closed', {
|
|
660
|
-
row,
|
|
661
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
662
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
663
|
-
column,
|
|
664
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
665
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
666
|
-
}, evnt);
|
|
667
|
-
}
|
|
668
|
-
focused.row = null;
|
|
669
|
-
focused.column = null;
|
|
670
|
-
if (validOpts.autoClear) {
|
|
671
|
-
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
672
|
-
if ($xeTable.clearValidate) {
|
|
673
|
-
return $xeTable.clearValidate();
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
return $xeTable.$nextTick().then(() => {
|
|
678
|
-
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
679
|
-
return $xeTable.handleRecalculateCellAreas();
|
|
680
|
-
}
|
|
681
|
-
});
|
|
755
|
+
return handleClearEdit($xeTable, evnt, targetRow);
|
|
682
756
|
},
|
|
683
757
|
_getActiveRecord() {
|
|
684
758
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -782,11 +856,12 @@ export default {
|
|
|
782
856
|
* 激活行编辑
|
|
783
857
|
*/
|
|
784
858
|
_setEditRow(row, fieldOrColumn) {
|
|
859
|
+
const $xeTable = this;
|
|
785
860
|
let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender));
|
|
786
861
|
if (fieldOrColumn) {
|
|
787
862
|
column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
788
863
|
}
|
|
789
|
-
return
|
|
864
|
+
return handleEditCell($xeTable, row, column, false);
|
|
790
865
|
},
|
|
791
866
|
_setActiveCell(row, fieldOrColumn) {
|
|
792
867
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -799,18 +874,8 @@ export default {
|
|
|
799
874
|
* 激活单元格编辑
|
|
800
875
|
*/
|
|
801
876
|
_setEditCell(row, fieldOrColumn) {
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
805
|
-
return this.scrollToRow(row, true).then(() => {
|
|
806
|
-
const cell = this.getCellElement(row, column);
|
|
807
|
-
if (cell) {
|
|
808
|
-
this.handleEdit({ row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column), cell, $table: this });
|
|
809
|
-
this.lastCallTime = Date.now();
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
return this.$nextTick();
|
|
877
|
+
const $xeTable = this;
|
|
878
|
+
return handleEditCell($xeTable, row, fieldOrColumn, true);
|
|
814
879
|
},
|
|
815
880
|
/**
|
|
816
881
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -832,6 +897,7 @@ export default {
|
|
|
832
897
|
* 处理选中源
|
|
833
898
|
*/
|
|
834
899
|
handleSelected(params, evnt) {
|
|
900
|
+
const $xeTable = this;
|
|
835
901
|
const { mouseConfig, mouseOpts, editOpts, editStore } = this;
|
|
836
902
|
const { actived, selected } = editStore;
|
|
837
903
|
const { row, column } = params;
|
|
@@ -839,7 +905,7 @@ export default {
|
|
|
839
905
|
const selectMethod = () => {
|
|
840
906
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
841
907
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
842
|
-
|
|
908
|
+
handleClearEdit($xeTable, evnt);
|
|
843
909
|
this.clearSelected(evnt);
|
|
844
910
|
this.clearCellAreas(evnt);
|
|
845
911
|
this.clearCopyCellArea(evnt);
|
package/es/table/src/methods.js
CHANGED
|
@@ -6839,6 +6839,17 @@ const Methods = {
|
|
|
6839
6839
|
reactData.pendingRowMaps = pendingMaps;
|
|
6840
6840
|
return $xeTable.$nextTick();
|
|
6841
6841
|
},
|
|
6842
|
+
hasPendingByRow(row) {
|
|
6843
|
+
const $xeTable = this;
|
|
6844
|
+
return $xeTable.isPendingByRow(row);
|
|
6845
|
+
},
|
|
6846
|
+
isPendingByRow(row) {
|
|
6847
|
+
const $xeTable = this;
|
|
6848
|
+
const reactData = $xeTable;
|
|
6849
|
+
const { pendingRowMaps } = reactData;
|
|
6850
|
+
const rowid = getRowid($xeTable, row);
|
|
6851
|
+
return !!pendingRowMaps[rowid];
|
|
6852
|
+
},
|
|
6842
6853
|
getPendingRecords() {
|
|
6843
6854
|
const $xeTable = this;
|
|
6844
6855
|
const reactData = $xeTable;
|
|
@@ -6853,11 +6864,6 @@ const Methods = {
|
|
|
6853
6864
|
});
|
|
6854
6865
|
return insertRecords;
|
|
6855
6866
|
},
|
|
6856
|
-
hasPendingByRow(row) {
|
|
6857
|
-
const { pendingRowMaps } = this;
|
|
6858
|
-
const rowid = getRowid(this, row);
|
|
6859
|
-
return !!pendingRowMaps[rowid];
|
|
6860
|
-
},
|
|
6861
6867
|
clearPendingRow() {
|
|
6862
6868
|
this.pendingRowMaps = {};
|
|
6863
6869
|
return this.$nextTick();
|
|
@@ -7818,7 +7824,9 @@ const Methods = {
|
|
|
7818
7824
|
},
|
|
7819
7825
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
7820
7826
|
const $xeTable = this;
|
|
7827
|
+
const reactData = $xeTable;
|
|
7821
7828
|
const internalData = $xeTable;
|
|
7829
|
+
const { scrollYLoad, scrollXLoad } = reactData;
|
|
7822
7830
|
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
7823
7831
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7824
7832
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
@@ -7877,13 +7885,17 @@ const Methods = {
|
|
|
7877
7885
|
setScrollTop(rightScrollElem, scrollTop);
|
|
7878
7886
|
}
|
|
7879
7887
|
setScrollTop(yHandleEl, scrollTop);
|
|
7880
|
-
|
|
7888
|
+
if (scrollYLoad) {
|
|
7889
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
7890
|
+
}
|
|
7881
7891
|
}
|
|
7882
7892
|
if (isRollX) {
|
|
7883
7893
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
7884
7894
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
7885
7895
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
7886
|
-
|
|
7896
|
+
if (scrollXLoad) {
|
|
7897
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
7898
|
+
}
|
|
7887
7899
|
}
|
|
7888
7900
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
7889
7901
|
type: 'body',
|
|
@@ -7892,7 +7904,9 @@ const Methods = {
|
|
|
7892
7904
|
},
|
|
7893
7905
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
7894
7906
|
const $xeTable = this;
|
|
7907
|
+
const reactData = $xeTable;
|
|
7895
7908
|
const internalData = $xeTable;
|
|
7909
|
+
const { scrollXLoad } = reactData;
|
|
7896
7910
|
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
7897
7911
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7898
7912
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
@@ -7922,7 +7936,9 @@ const Methods = {
|
|
|
7922
7936
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
7923
7937
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
7924
7938
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
7925
|
-
|
|
7939
|
+
if (scrollXLoad) {
|
|
7940
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
7941
|
+
}
|
|
7926
7942
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
7927
7943
|
type: 'header',
|
|
7928
7944
|
fixed: fixedType
|
|
@@ -7930,7 +7946,9 @@ const Methods = {
|
|
|
7930
7946
|
},
|
|
7931
7947
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
7932
7948
|
const $xeTable = this;
|
|
7949
|
+
const reactData = $xeTable;
|
|
7933
7950
|
const internalData = $xeTable;
|
|
7951
|
+
const { scrollXLoad } = reactData;
|
|
7934
7952
|
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
7935
7953
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7936
7954
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
@@ -7960,7 +7978,9 @@ const Methods = {
|
|
|
7960
7978
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
7961
7979
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
7962
7980
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
7963
|
-
|
|
7981
|
+
if (scrollXLoad) {
|
|
7982
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
7983
|
+
}
|
|
7964
7984
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
7965
7985
|
type: 'footer',
|
|
7966
7986
|
fixed: fixedType
|
|
@@ -7976,6 +7996,7 @@ const Methods = {
|
|
|
7976
7996
|
return;
|
|
7977
7997
|
}
|
|
7978
7998
|
const { highlightHoverRow } = tableProps;
|
|
7999
|
+
const { scrollYLoad } = reactData;
|
|
7979
8000
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
7980
8001
|
const rowOpts = $xeTable.computeRowOpts;
|
|
7981
8002
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
@@ -8018,7 +8039,9 @@ const Methods = {
|
|
|
8018
8039
|
setScrollTop(bodyScrollElem, currTopNum);
|
|
8019
8040
|
setScrollTop(leftScrollElem, currTopNum);
|
|
8020
8041
|
setScrollTop(rightScrollElem, currTopNum);
|
|
8021
|
-
|
|
8042
|
+
if (scrollYLoad) {
|
|
8043
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8044
|
+
}
|
|
8022
8045
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8023
8046
|
type: 'table',
|
|
8024
8047
|
fixed: ''
|
|
@@ -8038,7 +8061,9 @@ const Methods = {
|
|
|
8038
8061
|
},
|
|
8039
8062
|
triggerVirtualScrollXEvent(evnt) {
|
|
8040
8063
|
const $xeTable = this;
|
|
8064
|
+
const reactData = $xeTable;
|
|
8041
8065
|
const internalData = $xeTable;
|
|
8066
|
+
const { scrollXLoad } = reactData;
|
|
8042
8067
|
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8043
8068
|
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8044
8069
|
return;
|
|
@@ -8063,7 +8088,9 @@ const Methods = {
|
|
|
8063
8088
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8064
8089
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8065
8090
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8066
|
-
|
|
8091
|
+
if (scrollXLoad) {
|
|
8092
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8093
|
+
}
|
|
8067
8094
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8068
8095
|
type: 'table',
|
|
8069
8096
|
fixed: ''
|
|
@@ -8071,7 +8098,9 @@ const Methods = {
|
|
|
8071
8098
|
},
|
|
8072
8099
|
triggerVirtualScrollYEvent(evnt) {
|
|
8073
8100
|
const $xeTable = this;
|
|
8101
|
+
const reactData = $xeTable;
|
|
8074
8102
|
const internalData = $xeTable;
|
|
8103
|
+
const { scrollYLoad } = reactData;
|
|
8075
8104
|
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8076
8105
|
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8077
8106
|
return;
|
|
@@ -8096,7 +8125,9 @@ const Methods = {
|
|
|
8096
8125
|
setScrollTop(bodyScrollElem, scrollTop);
|
|
8097
8126
|
setScrollTop(leftScrollElem, scrollTop);
|
|
8098
8127
|
setScrollTop(rightScrollElem, scrollTop);
|
|
8099
|
-
|
|
8128
|
+
if (scrollYLoad) {
|
|
8129
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8130
|
+
}
|
|
8100
8131
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8101
8132
|
type: 'table',
|
|
8102
8133
|
fixed: ''
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED