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,8 +5,53 @@ 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, TableInternalData, VxeTableDefines, TableReactData, VxeTablePrivateMethods } from '../../../../types'
|
|
9
|
+
|
|
8
10
|
const { getConfig, renderer, getI18n } = VxeUI
|
|
9
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
|
+
|
|
29
|
+
function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
|
|
30
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
31
|
+
if (el) {
|
|
32
|
+
const cell = el.querySelector('.col--selected')
|
|
33
|
+
if (cell) {
|
|
34
|
+
removeClass(cell, 'col--selected')
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
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
|
+
|
|
10
55
|
function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
|
|
11
56
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
|
|
12
57
|
const { rowField, parentField, mapChildrenField } = treeOpts
|
|
@@ -221,7 +266,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
|
|
|
221
266
|
})
|
|
222
267
|
}
|
|
223
268
|
|
|
224
|
-
function handleInsertChildRowAt ($xeTable:
|
|
269
|
+
function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
|
|
225
270
|
const props = $xeTable
|
|
226
271
|
|
|
227
272
|
const { treeConfig } = props
|
|
@@ -238,6 +283,183 @@ function handleInsertChildRowAt ($xeTable: any, records: any, parentRow: any, ta
|
|
|
238
283
|
return Promise.resolve({ row: null, rows: [] })
|
|
239
284
|
}
|
|
240
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
|
+
|
|
241
463
|
export default {
|
|
242
464
|
methods: {
|
|
243
465
|
/**
|
|
@@ -291,7 +513,7 @@ export default {
|
|
|
291
513
|
const treeOpts = $xeTable.computeTreeOpts
|
|
292
514
|
const { transform, mapChildrenField } = treeOpts
|
|
293
515
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
294
|
-
const { actived,
|
|
516
|
+
const { actived, removeMaps, insertMaps } = editStore
|
|
295
517
|
const { checkField } = checkboxOpts
|
|
296
518
|
let delList: any[] = []
|
|
297
519
|
if (!rows) {
|
|
@@ -302,7 +524,8 @@ export default {
|
|
|
302
524
|
// 如果是新增,则保存记录
|
|
303
525
|
rows.forEach(row => {
|
|
304
526
|
if (!$xeTable.isInsertByRow(row)) {
|
|
305
|
-
|
|
527
|
+
const rowid = getRowid($xeTable, row)
|
|
528
|
+
removeMaps[rowid] = row
|
|
306
529
|
}
|
|
307
530
|
})
|
|
308
531
|
// 如果绑定了多选属性,则更新状态
|
|
@@ -462,7 +685,16 @@ export default {
|
|
|
462
685
|
* 获取已删除的数据
|
|
463
686
|
*/
|
|
464
687
|
_getRemoveRecords () {
|
|
465
|
-
|
|
688
|
+
const $xeTable = this
|
|
689
|
+
const reactData = $xeTable
|
|
690
|
+
|
|
691
|
+
const { editStore } = reactData
|
|
692
|
+
const { removeMaps } = editStore
|
|
693
|
+
const removeRecords: any[] = []
|
|
694
|
+
XEUtils.each(removeMaps, (row) => {
|
|
695
|
+
removeRecords.push(row)
|
|
696
|
+
})
|
|
697
|
+
return removeRecords
|
|
466
698
|
},
|
|
467
699
|
/**
|
|
468
700
|
* 获取更新数据
|
|
@@ -470,12 +702,14 @@ export default {
|
|
|
470
702
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
471
703
|
*/
|
|
472
704
|
_getUpdateRecords () {
|
|
705
|
+
const $xeTable = this
|
|
706
|
+
|
|
473
707
|
const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this
|
|
474
708
|
if (keepSource) {
|
|
475
709
|
const { actived } = editStore
|
|
476
710
|
const { row, column } = actived
|
|
477
711
|
if (row || column) {
|
|
478
|
-
|
|
712
|
+
syncActivedCell($xeTable)
|
|
479
713
|
}
|
|
480
714
|
if (treeConfig) {
|
|
481
715
|
return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
|
|
@@ -488,80 +722,9 @@ export default {
|
|
|
488
722
|
* 处理激活编辑
|
|
489
723
|
*/
|
|
490
724
|
handleEdit (params: any, evnt: any) {
|
|
491
|
-
const
|
|
492
|
-
const { mode } = editOpts
|
|
493
|
-
const { actived, focused } = editStore
|
|
494
|
-
const { row, column } = params
|
|
495
|
-
const { editRender } = column
|
|
496
|
-
const cell = params.cell = (params.cell || this.getCellElement(row, column))
|
|
497
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
498
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
499
|
-
// 激活编辑
|
|
500
|
-
if (!this.hasPendingByRow(row)) {
|
|
501
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
502
|
-
// 判断是否禁用编辑
|
|
503
|
-
let type = 'edit-disabled'
|
|
504
|
-
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: this, $grid: this.$xegrid })) {
|
|
505
|
-
if (mouseConfig) {
|
|
506
|
-
this.clearSelected(evnt)
|
|
507
|
-
this.clearCellAreas(evnt)
|
|
508
|
-
this.clearCopyCellArea(evnt)
|
|
509
|
-
}
|
|
510
|
-
this.closeTooltip()
|
|
511
|
-
if (actived.column) {
|
|
512
|
-
this.handleClearEdit(evnt)
|
|
513
|
-
}
|
|
514
|
-
type = 'edit-activated'
|
|
515
|
-
column.renderHeight = cell.offsetHeight
|
|
516
|
-
actived.args = params
|
|
517
|
-
actived.row = row
|
|
518
|
-
actived.column = column
|
|
519
|
-
if (mode === 'row') {
|
|
520
|
-
tableColumn.forEach((column: any) => this._getColumnModel(row, column))
|
|
521
|
-
} else {
|
|
522
|
-
this._getColumnModel(row, column)
|
|
523
|
-
}
|
|
524
|
-
const afterEditMethod = editOpts.afterEditMethod
|
|
525
|
-
this.$nextTick(() => {
|
|
526
|
-
this.handleFocus(params, evnt)
|
|
527
|
-
if (afterEditMethod) {
|
|
528
|
-
afterEditMethod({ ...params, $table: this, $grid: this.$xegrid })
|
|
529
|
-
}
|
|
530
|
-
})
|
|
531
|
-
}
|
|
532
|
-
this.emitEvent(type, params, evnt)
|
|
725
|
+
const $xeTable = this
|
|
533
726
|
|
|
534
|
-
|
|
535
|
-
if (type === 'edit-activated') {
|
|
536
|
-
this.emitEvent('edit-actived', params, evnt)
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
const { column: oldColumn } = actived
|
|
540
|
-
if (mouseConfig) {
|
|
541
|
-
this.clearSelected(evnt)
|
|
542
|
-
this.clearCellAreas(evnt)
|
|
543
|
-
this.clearCopyCellArea(evnt)
|
|
544
|
-
}
|
|
545
|
-
if (oldColumn !== column) {
|
|
546
|
-
const { model: oldModel } = oldColumn
|
|
547
|
-
if (oldModel.update) {
|
|
548
|
-
setCellValue(row, oldColumn, oldModel.value)
|
|
549
|
-
}
|
|
550
|
-
this.clearValidate()
|
|
551
|
-
}
|
|
552
|
-
column.renderHeight = cell.offsetHeight
|
|
553
|
-
actived.args = params
|
|
554
|
-
actived.column = column
|
|
555
|
-
setTimeout(() => {
|
|
556
|
-
this.handleFocus(params, evnt)
|
|
557
|
-
})
|
|
558
|
-
}
|
|
559
|
-
focused.column = null
|
|
560
|
-
focused.row = null
|
|
561
|
-
this.focus()
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
return this.$nextTick()
|
|
727
|
+
return handleEditActive($xeTable, params, evnt, true)
|
|
565
728
|
},
|
|
566
729
|
/**
|
|
567
730
|
* @deprecated
|
|
@@ -569,32 +732,16 @@ export default {
|
|
|
569
732
|
handleActived (params: any, evnt: any) {
|
|
570
733
|
return this.handleEdit(params, evnt)
|
|
571
734
|
},
|
|
572
|
-
_getColumnModel (row: any, column:
|
|
573
|
-
|
|
574
|
-
if (editRender) {
|
|
575
|
-
model.value = getCellValue(row, column)
|
|
576
|
-
model.update = false
|
|
577
|
-
}
|
|
735
|
+
_getColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
736
|
+
getEditColumnModel(row, column)
|
|
578
737
|
},
|
|
579
|
-
_setColumnModel (row: any, column:
|
|
580
|
-
|
|
581
|
-
if (editRender && model.update) {
|
|
582
|
-
setCellValue(row, column, model.value)
|
|
583
|
-
model.update = false
|
|
584
|
-
model.value = null
|
|
585
|
-
}
|
|
738
|
+
_setColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
739
|
+
setEditColumnModel(row, column)
|
|
586
740
|
},
|
|
587
741
|
_syncActivedCell () {
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
if (row || column) {
|
|
592
|
-
if (editOpts.mode === 'row') {
|
|
593
|
-
tableColumn.forEach((column: any) => this._setColumnModel(row, column))
|
|
594
|
-
} else {
|
|
595
|
-
this._setColumnModel(row, column)
|
|
596
|
-
}
|
|
597
|
-
}
|
|
742
|
+
const $xeTable = this
|
|
743
|
+
|
|
744
|
+
syncActivedCell($xeTable)
|
|
598
745
|
},
|
|
599
746
|
_clearActived (row: any) {
|
|
600
747
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -607,54 +754,17 @@ export default {
|
|
|
607
754
|
* 清除激活的编辑
|
|
608
755
|
*/
|
|
609
756
|
_clearEdit (row: any) {
|
|
610
|
-
|
|
757
|
+
const $xeTable = this
|
|
758
|
+
|
|
759
|
+
return handleClearEdit($xeTable, null, row)
|
|
611
760
|
},
|
|
612
761
|
/**
|
|
613
762
|
* 取消编辑
|
|
614
763
|
*/
|
|
615
764
|
handleClearEdit (evnt: Event | null, targetRow?: any) {
|
|
616
765
|
const $xeTable = this
|
|
617
|
-
const props = $xeTable
|
|
618
|
-
const reactData = $xeTable
|
|
619
766
|
|
|
620
|
-
|
|
621
|
-
const { editStore } = reactData
|
|
622
|
-
const { actived, focused } = editStore
|
|
623
|
-
const { row, column } = actived
|
|
624
|
-
const validOpts = $xeTable.validOpts
|
|
625
|
-
const mouseOpts = $xeTable.computeMouseOpts
|
|
626
|
-
if (row || column) {
|
|
627
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
628
|
-
return $xeTable.$nextTick()
|
|
629
|
-
}
|
|
630
|
-
$xeTable._syncActivedCell()
|
|
631
|
-
actived.args = null
|
|
632
|
-
actived.row = null
|
|
633
|
-
actived.column = null
|
|
634
|
-
$xeTable.updateFooter()
|
|
635
|
-
$xeTable.emitEvent('edit-closed', {
|
|
636
|
-
row,
|
|
637
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
638
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
639
|
-
column,
|
|
640
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
641
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
642
|
-
}, evnt)
|
|
643
|
-
}
|
|
644
|
-
focused.row = null
|
|
645
|
-
focused.column = null
|
|
646
|
-
if (validOpts.autoClear) {
|
|
647
|
-
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
648
|
-
if ($xeTable.clearValidate) {
|
|
649
|
-
return $xeTable.clearValidate()
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
return $xeTable.$nextTick().then(() => {
|
|
654
|
-
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
655
|
-
return $xeTable.handleRecalculateCellAreas()
|
|
656
|
-
}
|
|
657
|
-
})
|
|
767
|
+
return handleClearEdit($xeTable, evnt, targetRow)
|
|
658
768
|
},
|
|
659
769
|
_getActiveRecord () {
|
|
660
770
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -754,11 +864,13 @@ export default {
|
|
|
754
864
|
* 激活行编辑
|
|
755
865
|
*/
|
|
756
866
|
_setEditRow (row: any, fieldOrColumn: any) {
|
|
867
|
+
const $xeTable = this
|
|
868
|
+
|
|
757
869
|
let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
|
|
758
870
|
if (fieldOrColumn) {
|
|
759
871
|
column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
760
872
|
}
|
|
761
|
-
return
|
|
873
|
+
return handleEditCell($xeTable, row, column, false)
|
|
762
874
|
},
|
|
763
875
|
_setActiveCell (row: any, fieldOrColumn: any) {
|
|
764
876
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -771,18 +883,9 @@ export default {
|
|
|
771
883
|
* 激活单元格编辑
|
|
772
884
|
*/
|
|
773
885
|
_setEditCell (row: any, fieldOrColumn: any) {
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
return this.scrollToRow(row, true).then(() => {
|
|
778
|
-
const cell = this.getCellElement(row, column)
|
|
779
|
-
if (cell) {
|
|
780
|
-
this.handleEdit({ row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column), cell, $table: this })
|
|
781
|
-
this.lastCallTime = Date.now()
|
|
782
|
-
}
|
|
783
|
-
})
|
|
784
|
-
}
|
|
785
|
-
return this.$nextTick()
|
|
886
|
+
const $xeTable = this
|
|
887
|
+
|
|
888
|
+
return handleEditCell($xeTable, row, fieldOrColumn, true)
|
|
786
889
|
},
|
|
787
890
|
/**
|
|
788
891
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -804,6 +907,8 @@ export default {
|
|
|
804
907
|
* 处理选中源
|
|
805
908
|
*/
|
|
806
909
|
handleSelected (params: any, evnt: any) {
|
|
910
|
+
const $xeTable = this
|
|
911
|
+
|
|
807
912
|
const { mouseConfig, mouseOpts, editOpts, editStore } = this
|
|
808
913
|
const { actived, selected } = editStore
|
|
809
914
|
const { row, column } = params
|
|
@@ -811,7 +916,7 @@ export default {
|
|
|
811
916
|
const selectMethod = () => {
|
|
812
917
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
813
918
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
814
|
-
|
|
919
|
+
handleClearEdit($xeTable, evnt)
|
|
815
920
|
this.clearSelected(evnt)
|
|
816
921
|
this.clearCellAreas(evnt)
|
|
817
922
|
this.clearCopyCellArea(evnt)
|
|
@@ -819,7 +924,7 @@ export default {
|
|
|
819
924
|
selected.row = row
|
|
820
925
|
selected.column = column
|
|
821
926
|
if (isMouseSelected) {
|
|
822
|
-
this.
|
|
927
|
+
this.addCellSelectedClass()
|
|
823
928
|
}
|
|
824
929
|
this.focus()
|
|
825
930
|
if (evnt) {
|
|
@@ -845,11 +950,13 @@ export default {
|
|
|
845
950
|
* 清除所选中源状态
|
|
846
951
|
*/
|
|
847
952
|
_clearSelected () {
|
|
953
|
+
const $xeTable = this
|
|
954
|
+
|
|
848
955
|
const { selected } = this.editStore
|
|
849
956
|
selected.row = null
|
|
850
957
|
selected.column = null
|
|
851
958
|
this.reColTitleSdCls()
|
|
852
|
-
|
|
959
|
+
removeCellSelectedClass($xeTable)
|
|
853
960
|
return this.$nextTick()
|
|
854
961
|
},
|
|
855
962
|
reColTitleSdCls () {
|
|
@@ -858,18 +965,16 @@ export default {
|
|
|
858
965
|
XEUtils.arrayEach(headerElem.querySelectorAll('.col--title-selected'), elem => removeClass(elem, 'col--title-selected'))
|
|
859
966
|
}
|
|
860
967
|
},
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
addColSdCls () {
|
|
868
|
-
const { selected } = this.editStore
|
|
968
|
+
addCellSelectedClass () {
|
|
969
|
+
const $xeTable = this
|
|
970
|
+
const reactData = $xeTable as TableReactData
|
|
971
|
+
|
|
972
|
+
const { editStore } = reactData
|
|
973
|
+
const { selected } = editStore
|
|
869
974
|
const { row, column } = selected
|
|
870
|
-
|
|
975
|
+
removeCellSelectedClass($xeTable)
|
|
871
976
|
if (row && column) {
|
|
872
|
-
const cell =
|
|
977
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
873
978
|
if (cell) {
|
|
874
979
|
addClass(cell, 'col--selected')
|
|
875
980
|
}
|
|
@@ -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
|
|
|
@@ -132,7 +133,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
132
133
|
cellValue = htmlCellElem.innerText.trim()
|
|
133
134
|
} else {
|
|
134
135
|
const cell = $xeTable.getCellElement(row, column)
|
|
135
|
-
if (cell) {
|
|
136
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
136
137
|
cellValue = cell.innerText.trim()
|
|
137
138
|
}
|
|
138
139
|
}
|
|
@@ -190,7 +191,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
190
191
|
cellValue = htmlCellElem.innerText.trim()
|
|
191
192
|
} else {
|
|
192
193
|
const cell = $xeTable.getCellElement(row, column)
|
|
193
|
-
if (cell) {
|
|
194
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
194
195
|
cellValue = cell.innerText.trim()
|
|
195
196
|
}
|
|
196
197
|
}
|
|
@@ -161,8 +161,9 @@ export default {
|
|
|
161
161
|
|
|
162
162
|
const validRest: any = {}
|
|
163
163
|
const { editRules, treeConfig } = props
|
|
164
|
-
const { pendingRowMaps } = reactData
|
|
164
|
+
const { editStore, pendingRowMaps } = reactData
|
|
165
165
|
const { afterFullData } = internalData
|
|
166
|
+
const { removeMaps } = editStore
|
|
166
167
|
const treeOpts = $xeTable.computeTreeOpts
|
|
167
168
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
168
169
|
let validList
|
|
@@ -187,6 +188,10 @@ export default {
|
|
|
187
188
|
const columns = cols && cols.length ? cols : this.getColumns()
|
|
188
189
|
const handleVaild = (row: any) => {
|
|
189
190
|
const rowid = getRowid($xeTable, row)
|
|
191
|
+
// 是否删除
|
|
192
|
+
if (removeMaps[rowid]) {
|
|
193
|
+
return
|
|
194
|
+
}
|
|
190
195
|
// 是否标记删除
|
|
191
196
|
if (pendingRowMaps[rowid]) {
|
|
192
197
|
return
|
|
@@ -403,6 +403,7 @@ function renderTdColumn (
|
|
|
403
403
|
'fixed--width': !isAutoCellWidth,
|
|
404
404
|
'fixed--hidden': fixedHiddenColumn,
|
|
405
405
|
'is--padding': isCellPadding,
|
|
406
|
+
'is--progress': (fixedHiddenColumn && isAllOverflow) || isVNPreEmptyStatus,
|
|
406
407
|
'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
|
|
407
408
|
'is--drag-disabled': isDisabledDrag,
|
|
408
409
|
'col--dirty': isDirty,
|