vxe-table 3.12.15 → 3.12.17

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.
Files changed (48) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/edit/mixin.js +224 -158
  6. package/es/table/src/body.js +60 -47
  7. package/es/table/src/methods.js +166 -36
  8. package/es/table/src/table.js +101 -23
  9. package/es/table/style.css +26 -0
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +26 -0
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.min.css +1 -1
  17. package/lib/index.umd.js +730 -391
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/module/edit/mixin.js +278 -215
  22. package/lib/table/module/edit/mixin.min.js +1 -1
  23. package/lib/table/src/body.js +71 -59
  24. package/lib/table/src/body.min.js +1 -1
  25. package/lib/table/src/methods.js +199 -37
  26. package/lib/table/src/methods.min.js +1 -1
  27. package/lib/table/src/table.js +126 -24
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +26 -0
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +26 -0
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/module/edit/mixin.ts +242 -159
  39. package/packages/table/src/body.ts +62 -48
  40. package/packages/table/src/methods.ts +170 -36
  41. package/packages/table/src/table.ts +108 -24
  42. package/styles/components/table.scss +26 -0
  43. /package/es/{iconfont.1739257460253.ttf → iconfont.1739428244406.ttf} +0 -0
  44. /package/es/{iconfont.1739257460253.woff → iconfont.1739428244406.woff} +0 -0
  45. /package/es/{iconfont.1739257460253.woff2 → iconfont.1739428244406.woff2} +0 -0
  46. /package/lib/{iconfont.1739257460253.ttf → iconfont.1739428244406.ttf} +0 -0
  47. /package/lib/{iconfont.1739257460253.woff → iconfont.1739428244406.woff} +0 -0
  48. /package/lib/{iconfont.1739257460253.woff2 → iconfont.1739428244406.woff2} +0 -0
@@ -5,10 +5,27 @@ 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
 
8
- import type { VxeTableConstructor, TableReactData } from '../../../../types'
8
+ import type { VxeTableConstructor, TableInternalData, VxeTableDefines, TableReactData, VxeTablePrivateMethods } from '../../../../types'
9
9
 
10
10
  const { getConfig, renderer, getI18n } = VxeUI
11
11
 
12
+ function getEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
13
+ const { model, editRender } = column
14
+ if (editRender) {
15
+ model.value = getCellValue(row, column)
16
+ model.update = false
17
+ }
18
+ }
19
+
20
+ function setEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
21
+ const { model, editRender } = column
22
+ if (editRender && model.update) {
23
+ setCellValue(row, column, model.value)
24
+ model.update = false
25
+ model.value = null
26
+ }
27
+ }
28
+
12
29
  function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
13
30
  const el = $xeTable.$refs.refElem as HTMLDivElement
14
31
  if (el) {
@@ -19,6 +36,22 @@ function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
19
36
  }
20
37
  }
21
38
 
39
+ function syncActivedCell ($xeTable: VxeTableConstructor) {
40
+ const reactData = $xeTable as unknown as TableReactData
41
+
42
+ const { editStore, tableColumn } = reactData
43
+ const editOpts = $xeTable.computeEditOpts
44
+ const { actived } = editStore
45
+ const { row, column } = actived
46
+ if (row || column) {
47
+ if (editOpts.mode === 'row') {
48
+ tableColumn.forEach((column) => setEditColumnModel(row, column))
49
+ } else {
50
+ setEditColumnModel(row, column)
51
+ }
52
+ }
53
+ }
54
+
22
55
  function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
23
56
  const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
24
57
  const { rowField, parentField, mapChildrenField } = treeOpts
@@ -42,7 +75,7 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
42
75
  }
43
76
  parentChilds[funcName](item)
44
77
  mapChilds[funcName](item)
45
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
78
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
46
79
  fullDataRowIdData[rowid] = rest
47
80
  fullAllDataRowIdData[rowid] = rest
48
81
  } else {
@@ -53,7 +86,7 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
53
86
  }
54
87
  afterFullData[funcName](item)
55
88
  tableFullTreeData[funcName](item)
56
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
89
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
57
90
  fullDataRowIdData[rowid] = rest
58
91
  fullAllDataRowIdData[rowid] = rest
59
92
  }
@@ -82,7 +115,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
82
115
  } else {
83
116
  newRecords.forEach(item => {
84
117
  const rowid = getRowid($xeTable, item)
85
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
118
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
86
119
  fullDataRowIdData[rowid] = rest
87
120
  fullAllDataRowIdData[rowid] = rest
88
121
  afterFullData.unshift(item)
@@ -104,7 +137,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
104
137
  } else {
105
138
  newRecords.forEach(item => {
106
139
  const rowid = getRowid($xeTable, item)
107
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
140
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
108
141
  fullDataRowIdData[rowid] = rest
109
142
  fullAllDataRowIdData[rowid] = rest
110
143
  afterFullData.push(item)
@@ -144,7 +177,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
144
177
  targetIndex = targetIndex + 1
145
178
  }
146
179
  parentMapChilds.splice(targetIndex, 0, item)
147
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
180
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
148
181
  fullDataRowIdData[rowid] = rest
149
182
  fullAllDataRowIdData[rowid] = rest
150
183
  })
@@ -233,7 +266,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
233
266
  })
234
267
  }
235
268
 
236
- function handleInsertChildRowAt ($xeTable: any, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
269
+ function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
237
270
  const props = $xeTable
238
271
 
239
272
  const { treeConfig } = props
@@ -250,6 +283,183 @@ function handleInsertChildRowAt ($xeTable: any, records: any, parentRow: any, ta
250
283
  return Promise.resolve({ row: null, rows: [] })
251
284
  }
252
285
 
286
+ function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: Event | null, targetRow?: any) {
287
+ const props = $xeTable
288
+ const reactData = $xeTable as unknown as TableReactData
289
+
290
+ const { mouseConfig } = props
291
+ const { editStore } = reactData
292
+ const { actived, focused } = editStore
293
+ const { row, column } = actived
294
+ const validOpts = $xeTable.computeValidOpts
295
+ const mouseOpts = $xeTable.computeMouseOpts
296
+ if (row || column) {
297
+ if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
298
+ return $xeTable.$nextTick()
299
+ }
300
+ syncActivedCell($xeTable)
301
+ actived.args = null
302
+ actived.row = null
303
+ actived.column = null
304
+ $xeTable.updateFooter()
305
+ $xeTable.dispatchEvent('edit-closed', {
306
+ row,
307
+ rowIndex: $xeTable.getRowIndex(row),
308
+ $rowIndex: $xeTable.getVMRowIndex(row),
309
+ column,
310
+ columnIndex: $xeTable.getColumnIndex(column),
311
+ $columnIndex: $xeTable.getVMColumnIndex(column)
312
+ }, evnt || null)
313
+ }
314
+ focused.row = null
315
+ focused.column = null
316
+ if (validOpts.autoClear) {
317
+ if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
318
+ if ($xeTable.clearValidate) {
319
+ return $xeTable.clearValidate()
320
+ }
321
+ }
322
+ }
323
+ return $xeTable.$nextTick().then(() => {
324
+ if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
325
+ return $xeTable.handleRecalculateCellAreas()
326
+ }
327
+ })
328
+ }
329
+
330
+ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null, isFocus: boolean) {
331
+ const props = $xeTable
332
+ const reactData = $xeTable as unknown as TableReactData
333
+
334
+ const { editConfig, mouseConfig } = props
335
+ const { editStore, tableColumn } = reactData
336
+ const editOpts = $xeTable.computeEditOpts
337
+ const { mode } = editOpts
338
+ const { actived, focused } = editStore
339
+ const { row, column } = params
340
+ const { editRender } = column
341
+ const cell = (params.cell || $xeTable.getCellElement(row, column))
342
+ const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
343
+ params.cell = cell
344
+ if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
345
+ // 激活编辑
346
+ if (!$xeTable.isPendingByRow(row)) {
347
+ if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
348
+ // 判断是否禁用编辑
349
+ let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
350
+ if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
351
+ if (mouseConfig) {
352
+ $xeTable.clearSelected()
353
+ if ($xeTable.clearCellAreas) {
354
+ $xeTable.clearCellAreas()
355
+ $xeTable.clearCopyCellArea()
356
+ }
357
+ }
358
+ $xeTable.closeTooltip()
359
+ if (actived.column) {
360
+ handleClearEdit($xeTable, evnt)
361
+ }
362
+ type = 'edit-activated'
363
+ column.renderHeight = cell.offsetHeight
364
+ actived.args = params
365
+ actived.row = row
366
+ actived.column = column
367
+ if (mode === 'row') {
368
+ tableColumn.forEach((column: any) => getEditColumnModel(row, column))
369
+ } else {
370
+ getEditColumnModel(row, column)
371
+ }
372
+ const afterEditMethod = editOpts.afterEditMethod
373
+ $xeTable.$nextTick(() => {
374
+ if (isFocus) {
375
+ $xeTable.handleFocus(params, evnt)
376
+ }
377
+ if (afterEditMethod) {
378
+ afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
379
+ }
380
+ })
381
+ }
382
+ $xeTable.dispatchEvent(type, {
383
+ row,
384
+ rowIndex: $xeTable.getRowIndex(row),
385
+ $rowIndex: $xeTable.getVMRowIndex(row),
386
+ column,
387
+ columnIndex: $xeTable.getColumnIndex(column),
388
+ $columnIndex: $xeTable.getVMColumnIndex(column)
389
+ }, evnt)
390
+
391
+ // v4已废弃
392
+ if (type === 'edit-activated') {
393
+ $xeTable.dispatchEvent('edit-actived', {
394
+ row,
395
+ rowIndex: $xeTable.getRowIndex(row),
396
+ $rowIndex: $xeTable.getVMRowIndex(row),
397
+ column,
398
+ columnIndex: $xeTable.getColumnIndex(column),
399
+ $columnIndex: $xeTable.getVMColumnIndex(column)
400
+ }, evnt)
401
+ }
402
+ } else {
403
+ const { column: oldColumn } = actived
404
+ if (mouseConfig) {
405
+ $xeTable.clearSelected()
406
+ if ($xeTable.clearCellAreas) {
407
+ $xeTable.clearCellAreas()
408
+ $xeTable.clearCopyCellArea()
409
+ }
410
+ }
411
+ if (oldColumn !== column) {
412
+ const { model: oldModel } = oldColumn
413
+ if (oldModel.update) {
414
+ setCellValue(row, oldColumn, oldModel.value)
415
+ }
416
+ if ($xeTable.clearValidate) {
417
+ $xeTable.clearValidate(row, column)
418
+ }
419
+ }
420
+ column.renderHeight = cell.offsetHeight
421
+ actived.args = params
422
+ actived.column = column
423
+ if (isFocus) {
424
+ setTimeout(() => {
425
+ $xeTable.handleFocus(params, evnt)
426
+ })
427
+ }
428
+ }
429
+ focused.column = null
430
+ focused.row = null
431
+ $xeTable.focus()
432
+ }
433
+ }
434
+ return $xeTable.$nextTick()
435
+ }
436
+
437
+ function handleEditCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo, isPos: boolean) {
438
+ const props = $xeTable
439
+ const internalData = $xeTable as unknown as TableInternalData
440
+
441
+ const { editConfig } = props
442
+ const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
443
+ if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
444
+ return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
445
+ const cell = $xeTable.getCellElement(row, column)
446
+ if (cell) {
447
+ handleEditActive($xeTable, {
448
+ row,
449
+ rowIndex: $xeTable.getRowIndex(row),
450
+ column,
451
+ columnIndex: $xeTable.getColumnIndex(column),
452
+ cell,
453
+ $table: $xeTable
454
+ }, null, false)
455
+ internalData._lastCallTime = Date.now()
456
+ }
457
+ return $xeTable.$nextTick()
458
+ })
459
+ }
460
+ return $xeTable.$nextTick()
461
+ }
462
+
253
463
  export default {
254
464
  methods: {
255
465
  /**
@@ -492,12 +702,14 @@ export default {
492
702
  * 如果是树表格,子节点更改状态不会影响父节点的更新状态
493
703
  */
494
704
  _getUpdateRecords () {
705
+ const $xeTable = this
706
+
495
707
  const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this
496
708
  if (keepSource) {
497
709
  const { actived } = editStore
498
710
  const { row, column } = actived
499
711
  if (row || column) {
500
- this._syncActivedCell()
712
+ syncActivedCell($xeTable)
501
713
  }
502
714
  if (treeConfig) {
503
715
  return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
@@ -510,80 +722,9 @@ export default {
510
722
  * 处理激活编辑
511
723
  */
512
724
  handleEdit (params: any, evnt: any) {
513
- const { editStore, editOpts, tableColumn, editConfig, mouseConfig } = this
514
- const { mode } = editOpts
515
- const { actived, focused } = editStore
516
- const { row, column } = params
517
- const { editRender } = column
518
- const cell = params.cell = (params.cell || this.getCellElement(row, column))
519
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
520
- if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
521
- // 激活编辑
522
- if (!this.hasPendingByRow(row)) {
523
- if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
524
- // 判断是否禁用编辑
525
- let type = 'edit-disabled'
526
- if (!beforeEditMethod || beforeEditMethod({ ...params, $table: this, $grid: this.$xegrid })) {
527
- if (mouseConfig) {
528
- this.clearSelected(evnt)
529
- this.clearCellAreas(evnt)
530
- this.clearCopyCellArea(evnt)
531
- }
532
- this.closeTooltip()
533
- if (actived.column) {
534
- this.handleClearEdit(evnt)
535
- }
536
- type = 'edit-activated'
537
- column.renderHeight = cell.offsetHeight
538
- actived.args = params
539
- actived.row = row
540
- actived.column = column
541
- if (mode === 'row') {
542
- tableColumn.forEach((column: any) => this._getColumnModel(row, column))
543
- } else {
544
- this._getColumnModel(row, column)
545
- }
546
- const afterEditMethod = editOpts.afterEditMethod
547
- this.$nextTick(() => {
548
- this.handleFocus(params, evnt)
549
- if (afterEditMethod) {
550
- afterEditMethod({ ...params, $table: this, $grid: this.$xegrid })
551
- }
552
- })
553
- }
554
- this.emitEvent(type, params, evnt)
725
+ const $xeTable = this
555
726
 
556
- // v4已废弃
557
- if (type === 'edit-activated') {
558
- this.emitEvent('edit-actived', params, evnt)
559
- }
560
- } else {
561
- const { column: oldColumn } = actived
562
- if (mouseConfig) {
563
- this.clearSelected(evnt)
564
- this.clearCellAreas(evnt)
565
- this.clearCopyCellArea(evnt)
566
- }
567
- if (oldColumn !== column) {
568
- const { model: oldModel } = oldColumn
569
- if (oldModel.update) {
570
- setCellValue(row, oldColumn, oldModel.value)
571
- }
572
- this.clearValidate()
573
- }
574
- column.renderHeight = cell.offsetHeight
575
- actived.args = params
576
- actived.column = column
577
- setTimeout(() => {
578
- this.handleFocus(params, evnt)
579
- })
580
- }
581
- focused.column = null
582
- focused.row = null
583
- this.focus()
584
- }
585
- }
586
- return this.$nextTick()
727
+ return handleEditActive($xeTable, params, evnt, true)
587
728
  },
588
729
  /**
589
730
  * @deprecated
@@ -591,32 +732,16 @@ export default {
591
732
  handleActived (params: any, evnt: any) {
592
733
  return this.handleEdit(params, evnt)
593
734
  },
594
- _getColumnModel (row: any, column: any) {
595
- const { model, editRender } = column
596
- if (editRender) {
597
- model.value = getCellValue(row, column)
598
- model.update = false
599
- }
735
+ _getColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
736
+ getEditColumnModel(row, column)
600
737
  },
601
- _setColumnModel (row: any, column: any) {
602
- const { model, editRender } = column
603
- if (editRender && model.update) {
604
- setCellValue(row, column, model.value)
605
- model.update = false
606
- model.value = null
607
- }
738
+ _setColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
739
+ setEditColumnModel(row, column)
608
740
  },
609
741
  _syncActivedCell () {
610
- const { tableColumn, editStore, editOpts } = this
611
- const { actived } = editStore
612
- const { row, column } = actived
613
- if (row || column) {
614
- if (editOpts.mode === 'row') {
615
- tableColumn.forEach((column: any) => this._setColumnModel(row, column))
616
- } else {
617
- this._setColumnModel(row, column)
618
- }
619
- }
742
+ const $xeTable = this
743
+
744
+ syncActivedCell($xeTable)
620
745
  },
621
746
  _clearActived (row: any) {
622
747
  if (process.env.VUE_APP_VXE_ENV === 'development') {
@@ -629,54 +754,17 @@ export default {
629
754
  * 清除激活的编辑
630
755
  */
631
756
  _clearEdit (row: any) {
632
- return this.handleClearEdit(null, row)
757
+ const $xeTable = this
758
+
759
+ return handleClearEdit($xeTable, null, row)
633
760
  },
634
761
  /**
635
762
  * 取消编辑
636
763
  */
637
764
  handleClearEdit (evnt: Event | null, targetRow?: any) {
638
765
  const $xeTable = this
639
- const props = $xeTable
640
- const reactData = $xeTable
641
766
 
642
- const { mouseConfig } = props
643
- const { editStore } = reactData
644
- const { actived, focused } = editStore
645
- const { row, column } = actived
646
- const validOpts = $xeTable.validOpts
647
- const mouseOpts = $xeTable.computeMouseOpts
648
- if (row || column) {
649
- if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
650
- return $xeTable.$nextTick()
651
- }
652
- $xeTable._syncActivedCell()
653
- actived.args = null
654
- actived.row = null
655
- actived.column = null
656
- $xeTable.updateFooter()
657
- $xeTable.emitEvent('edit-closed', {
658
- row,
659
- rowIndex: $xeTable.getRowIndex(row),
660
- $rowIndex: $xeTable.getVMRowIndex(row),
661
- column,
662
- columnIndex: $xeTable.getColumnIndex(column),
663
- $columnIndex: $xeTable.getVMColumnIndex(column)
664
- }, evnt)
665
- }
666
- focused.row = null
667
- focused.column = null
668
- if (validOpts.autoClear) {
669
- if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
670
- if ($xeTable.clearValidate) {
671
- return $xeTable.clearValidate()
672
- }
673
- }
674
- }
675
- return $xeTable.$nextTick().then(() => {
676
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
677
- return $xeTable.handleRecalculateCellAreas()
678
- }
679
- })
767
+ return handleClearEdit($xeTable, evnt, targetRow)
680
768
  },
681
769
  _getActiveRecord () {
682
770
  if (process.env.VUE_APP_VXE_ENV === 'development') {
@@ -776,11 +864,13 @@ export default {
776
864
  * 激活行编辑
777
865
  */
778
866
  _setEditRow (row: any, fieldOrColumn: any) {
867
+ const $xeTable = this
868
+
779
869
  let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
780
870
  if (fieldOrColumn) {
781
871
  column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
782
872
  }
783
- return this.setEditCell(row, column)
873
+ return handleEditCell($xeTable, row, column, false)
784
874
  },
785
875
  _setActiveCell (row: any, fieldOrColumn: any) {
786
876
  if (process.env.VUE_APP_VXE_ENV === 'development') {
@@ -793,18 +883,9 @@ export default {
793
883
  * 激活单元格编辑
794
884
  */
795
885
  _setEditCell (row: any, fieldOrColumn: any) {
796
- const { editConfig } = this
797
- const column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
798
- if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
799
- return this.scrollToRow(row, true).then(() => {
800
- const cell = this.getCellElement(row, column)
801
- if (cell) {
802
- this.handleEdit({ row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column), cell, $table: this })
803
- this.lastCallTime = Date.now()
804
- }
805
- })
806
- }
807
- return this.$nextTick()
886
+ const $xeTable = this
887
+
888
+ return handleEditCell($xeTable, row, fieldOrColumn, true)
808
889
  },
809
890
  /**
810
891
  * 只对 trigger=dblclick 有效,选中单元格
@@ -826,6 +907,8 @@ export default {
826
907
  * 处理选中源
827
908
  */
828
909
  handleSelected (params: any, evnt: any) {
910
+ const $xeTable = this
911
+
829
912
  const { mouseConfig, mouseOpts, editOpts, editStore } = this
830
913
  const { actived, selected } = editStore
831
914
  const { row, column } = params
@@ -833,7 +916,7 @@ export default {
833
916
  const selectMethod = () => {
834
917
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
835
918
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
836
- this.handleClearEdit(evnt)
919
+ handleClearEdit($xeTable, evnt)
837
920
  this.clearSelected(evnt)
838
921
  this.clearCellAreas(evnt)
839
922
  this.clearCopyCellArea(evnt)