vxe-table 4.23.16 → 4.23.18
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/dist/all.esm.js +199 -124
- package/dist/all.esm.min.js +3 -3
- package/es/grid/src/grid.js +0 -8
- package/es/table/module/edit/hook.js +83 -81
- package/es/table/src/table.js +114 -33
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +0 -8
- package/lib/index.umd.js +199 -124
- package/lib/index.umd.min.js +3 -3
- package/lib/table/module/edit/hook.js +83 -81
- package/lib/table/src/table.js +114 -33
- package/lib/ui/index.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +0 -9
- package/packages/table/module/edit/hook.ts +95 -84
- package/packages/table/src/table.ts +16127 -16028
- /package/dist/{iconfont.1794189355036.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/dist/{iconfont.1794189355036.woff → iconfont.1794366305845.woff} +0 -0
- /package/dist/{iconfont.1794189355036.woff2 → iconfont.1794366305845.woff2} +0 -0
- /package/es/{iconfont.1794189355036.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/es/{iconfont.1794189355036.woff → iconfont.1794366305845.woff} +0 -0
- /package/es/{iconfont.1794189355036.woff2 → iconfont.1794366305845.woff2} +0 -0
- /package/lib/{iconfont.1794189355036.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/lib/{iconfont.1794189355036.woff → iconfont.1794366305845.woff} +0 -0
- /package/lib/{iconfont.1794189355036.woff2 → iconfont.1794366305845.woff2} +0 -0
|
@@ -464,80 +464,30 @@ hooks.add('tableEditModule', {
|
|
|
464
464
|
const { editRender } = column
|
|
465
465
|
const { isFocus, isPos, isClear } = options
|
|
466
466
|
const cell = (params.cell || $xeTable.getCellElement(row, column)) as HTMLElement
|
|
467
|
-
const
|
|
467
|
+
const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
468
|
+
const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod
|
|
468
469
|
const editParams = { ...params, cell }
|
|
469
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
470
|
-
// 激活编辑
|
|
471
|
-
if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
|
|
472
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
473
|
-
// 判断是否禁用编辑
|
|
474
|
-
let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
|
|
475
|
-
if (!beforeEditMethod || beforeEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })) {
|
|
476
|
-
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
477
|
-
$xeTable.clearSelected()
|
|
478
|
-
if ($xeTable.clearCellAreas) {
|
|
479
|
-
$xeTable.clearCellAreas()
|
|
480
|
-
$xeTable.clearCopyCellArea()
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
$xeTable.closeTooltip()
|
|
484
|
-
if (actived.column) {
|
|
485
|
-
handleClearEdit(evnt)
|
|
486
|
-
}
|
|
487
|
-
type = 'edit-activated'
|
|
488
|
-
column.renderHeight = cell.offsetHeight
|
|
489
|
-
actived.args = editParams
|
|
490
|
-
actived.row = row
|
|
491
|
-
actived.column = column
|
|
492
|
-
$xeTable.handlePushStack()
|
|
493
|
-
if (isClear) {
|
|
494
|
-
setCellValue(row, column, null)
|
|
495
|
-
}
|
|
496
|
-
if (mode === 'row') {
|
|
497
|
-
tableColumn.forEach((column: any) => getEditColumnModel(row, column))
|
|
498
|
-
} else {
|
|
499
|
-
getEditColumnModel(row, column)
|
|
500
|
-
}
|
|
501
|
-
const afterEditMethod = editOpts.afterEditMethod
|
|
502
|
-
nextTick(() => {
|
|
503
|
-
if (isFocus) {
|
|
504
|
-
$xeTable.handleFocus(editParams, evnt)
|
|
505
|
-
}
|
|
506
|
-
if (afterEditMethod) {
|
|
507
|
-
afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })
|
|
508
|
-
}
|
|
509
|
-
})
|
|
510
|
-
}
|
|
511
|
-
$xeTable.dispatchEvent(
|
|
512
|
-
type,
|
|
513
|
-
{
|
|
514
|
-
row,
|
|
515
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
516
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
517
|
-
column,
|
|
518
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
519
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
520
|
-
},
|
|
521
|
-
evnt
|
|
522
|
-
)
|
|
523
470
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
471
|
+
if (!cell || !isEnableConf(editConfig) || !isEnableConf(editRender)) {
|
|
472
|
+
return nextTick()
|
|
473
|
+
}
|
|
474
|
+
if ($xeTable.isPendingByRow(row) || $xeTable.isAggregateRecord(row)) {
|
|
475
|
+
return nextTick()
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// 激活编辑
|
|
479
|
+
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
480
|
+
const evntParams = {
|
|
481
|
+
row,
|
|
482
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
483
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
484
|
+
column,
|
|
485
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
486
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const handleCellEdit = (status: boolean) => {
|
|
490
|
+
if (status) {
|
|
541
491
|
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
542
492
|
$xeTable.clearSelected()
|
|
543
493
|
if ($xeTable.clearCellAreas) {
|
|
@@ -545,29 +495,90 @@ hooks.add('tableEditModule', {
|
|
|
545
495
|
$xeTable.clearCopyCellArea()
|
|
546
496
|
}
|
|
547
497
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
setCellValue(row, oldColumn, oldModel.value)
|
|
552
|
-
}
|
|
553
|
-
if ($xeTable.clearValidate) {
|
|
554
|
-
$xeTable.clearValidate(row, column)
|
|
555
|
-
}
|
|
498
|
+
$xeTable.closeTooltip()
|
|
499
|
+
if (actived.column) {
|
|
500
|
+
handleClearEdit(evnt)
|
|
556
501
|
}
|
|
557
502
|
column.renderHeight = cell.offsetHeight
|
|
558
503
|
actived.args = editParams
|
|
504
|
+
actived.row = row
|
|
559
505
|
actived.column = column
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
506
|
+
$xeTable.handlePushStack()
|
|
507
|
+
if (isClear) {
|
|
508
|
+
setCellValue(row, column, null)
|
|
509
|
+
}
|
|
510
|
+
if (mode === 'row') {
|
|
511
|
+
tableColumn.forEach((column) => getEditColumnModel(row, column))
|
|
512
|
+
} else {
|
|
513
|
+
getEditColumnModel(row, column)
|
|
564
514
|
}
|
|
515
|
+
const afterEditMethod = editOpts.afterEditMethod
|
|
516
|
+
nextTick(() => {
|
|
517
|
+
if (isFocus) {
|
|
518
|
+
$xeTable.handleFocus(editParams, evnt)
|
|
519
|
+
}
|
|
520
|
+
if (afterEditMethod) {
|
|
521
|
+
afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })
|
|
522
|
+
}
|
|
523
|
+
})
|
|
524
|
+
|
|
525
|
+
$xeTable.dispatchEvent('edit-activated', evntParams, evnt)
|
|
526
|
+
// v4已废弃
|
|
527
|
+
$xeTable.dispatchEvent('edit-actived', evntParams, evnt)
|
|
528
|
+
} else {
|
|
529
|
+
$xeTable.dispatchEvent('edit-disabled', evntParams, evnt)
|
|
565
530
|
}
|
|
566
531
|
focused.column = null
|
|
567
532
|
focused.row = null
|
|
568
533
|
$xeTable.focus()
|
|
569
534
|
}
|
|
535
|
+
|
|
536
|
+
const eFnParams = { ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }
|
|
537
|
+
|
|
538
|
+
// 是否被禁用
|
|
539
|
+
if (beforeEditFn) {
|
|
540
|
+
handleCellEdit(!!beforeEditFn(eFnParams))
|
|
541
|
+
} else if (beforeEditAsyncFn) {
|
|
542
|
+
return Promise.resolve()
|
|
543
|
+
.then(() => beforeEditAsyncFn(eFnParams))
|
|
544
|
+
.catch(() => false)
|
|
545
|
+
.then((status) => {
|
|
546
|
+
handleCellEdit(!!status)
|
|
547
|
+
})
|
|
548
|
+
} else {
|
|
549
|
+
handleCellEdit(true)
|
|
550
|
+
}
|
|
551
|
+
return nextTick()
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
const { column: oldColumn } = actived
|
|
555
|
+
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
556
|
+
$xeTable.clearSelected()
|
|
557
|
+
if ($xeTable.clearCellAreas) {
|
|
558
|
+
$xeTable.clearCellAreas()
|
|
559
|
+
$xeTable.clearCopyCellArea()
|
|
560
|
+
}
|
|
570
561
|
}
|
|
562
|
+
if (oldColumn && oldColumn !== column) {
|
|
563
|
+
const { model: oldModel } = oldColumn
|
|
564
|
+
if (oldModel.update) {
|
|
565
|
+
setCellValue(row, oldColumn, oldModel.value)
|
|
566
|
+
}
|
|
567
|
+
if ($xeTable.clearValidate) {
|
|
568
|
+
$xeTable.clearValidate(row, column)
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
column.renderHeight = cell.offsetHeight
|
|
572
|
+
actived.args = editParams
|
|
573
|
+
actived.column = column
|
|
574
|
+
if (isPos) {
|
|
575
|
+
setTimeout(() => {
|
|
576
|
+
$xeTable.handleFocus(editParams, evnt)
|
|
577
|
+
})
|
|
578
|
+
}
|
|
579
|
+
focused.column = null
|
|
580
|
+
focused.row = null
|
|
581
|
+
$xeTable.focus()
|
|
571
582
|
return nextTick()
|
|
572
583
|
}
|
|
573
584
|
|