vxe-table 4.23.17 → 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 +143 -98
- 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 +58 -7
- 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 +143 -98
- package/lib/index.umd.min.js +3 -3
- package/lib/table/module/edit/hook.js +83 -81
- package/lib/table/src/table.js +58 -7
- 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 +64 -10
- /package/dist/{iconfont.1794294436168.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/dist/{iconfont.1794294436168.woff → iconfont.1794366305845.woff} +0 -0
- /package/dist/{iconfont.1794294436168.woff2 → iconfont.1794366305845.woff2} +0 -0
- /package/es/{iconfont.1794294436168.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/es/{iconfont.1794294436168.woff → iconfont.1794366305845.woff} +0 -0
- /package/es/{iconfont.1794294436168.woff2 → iconfont.1794366305845.woff2} +0 -0
- /package/lib/{iconfont.1794294436168.ttf → iconfont.1794366305845.ttf} +0 -0
- /package/lib/{iconfont.1794294436168.woff → iconfont.1794366305845.woff} +0 -0
- /package/lib/{iconfont.1794294436168.woff2 → iconfont.1794366305845.woff2} +0 -0
|
@@ -427,76 +427,26 @@ hooks.add("tableEditModule", {
|
|
|
427
427
|
const { editRender } = column;
|
|
428
428
|
const { isFocus, isPos, isClear } = options;
|
|
429
429
|
const cell = params.cell || $xeTable.getCellElement(row, column);
|
|
430
|
-
const
|
|
430
|
+
const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
431
|
+
const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
|
|
431
432
|
const editParams = { ...params, cell };
|
|
432
|
-
if (cell
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
column.renderHeight = cell.offsetHeight;
|
|
450
|
-
actived.args = editParams;
|
|
451
|
-
actived.row = row;
|
|
452
|
-
actived.column = column;
|
|
453
|
-
$xeTable.handlePushStack();
|
|
454
|
-
if (isClear) {
|
|
455
|
-
(0, import_util.setCellValue)(row, column, null);
|
|
456
|
-
}
|
|
457
|
-
if (mode === "row") {
|
|
458
|
-
tableColumn.forEach((column2) => getEditColumnModel(row, column2));
|
|
459
|
-
} else {
|
|
460
|
-
getEditColumnModel(row, column);
|
|
461
|
-
}
|
|
462
|
-
const afterEditMethod = editOpts.afterEditMethod;
|
|
463
|
-
(0, import_vue.nextTick)(() => {
|
|
464
|
-
if (isFocus) {
|
|
465
|
-
$xeTable.handleFocus(editParams, evnt);
|
|
466
|
-
}
|
|
467
|
-
if (afterEditMethod) {
|
|
468
|
-
afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
$xeTable.dispatchEvent(
|
|
473
|
-
type,
|
|
474
|
-
{
|
|
475
|
-
row,
|
|
476
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
477
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
478
|
-
column,
|
|
479
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
480
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
481
|
-
},
|
|
482
|
-
evnt
|
|
483
|
-
);
|
|
484
|
-
if (type === "edit-activated") {
|
|
485
|
-
$xeTable.dispatchEvent(
|
|
486
|
-
"edit-actived",
|
|
487
|
-
{
|
|
488
|
-
row,
|
|
489
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
490
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
491
|
-
column,
|
|
492
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
493
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
494
|
-
},
|
|
495
|
-
evnt
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
} else {
|
|
499
|
-
const { column: oldColumn } = actived;
|
|
433
|
+
if (!cell || !(0, import_utils.isEnableConf)(editConfig) || !(0, import_utils.isEnableConf)(editRender)) {
|
|
434
|
+
return (0, import_vue.nextTick)();
|
|
435
|
+
}
|
|
436
|
+
if ($xeTable.isPendingByRow(row) || $xeTable.isAggregateRecord(row)) {
|
|
437
|
+
return (0, import_vue.nextTick)();
|
|
438
|
+
}
|
|
439
|
+
if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
|
|
440
|
+
const evntParams = {
|
|
441
|
+
row,
|
|
442
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
443
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
444
|
+
column,
|
|
445
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
446
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
447
|
+
};
|
|
448
|
+
const handleCellEdit = (status) => {
|
|
449
|
+
if (status) {
|
|
500
450
|
if ((0, import_utils.hasEnableConf)(mouseConfig, mouseOpts)) {
|
|
501
451
|
$xeTable.clearSelected();
|
|
502
452
|
if ($xeTable.clearCellAreas) {
|
|
@@ -504,29 +454,81 @@ hooks.add("tableEditModule", {
|
|
|
504
454
|
$xeTable.clearCopyCellArea();
|
|
505
455
|
}
|
|
506
456
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
(0, import_util.setCellValue)(row, oldColumn, oldModel.value);
|
|
511
|
-
}
|
|
512
|
-
if ($xeTable.clearValidate) {
|
|
513
|
-
$xeTable.clearValidate(row, column);
|
|
514
|
-
}
|
|
457
|
+
$xeTable.closeTooltip();
|
|
458
|
+
if (actived.column) {
|
|
459
|
+
handleClearEdit(evnt);
|
|
515
460
|
}
|
|
516
461
|
column.renderHeight = cell.offsetHeight;
|
|
517
462
|
actived.args = editParams;
|
|
463
|
+
actived.row = row;
|
|
518
464
|
actived.column = column;
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
});
|
|
465
|
+
$xeTable.handlePushStack();
|
|
466
|
+
if (isClear) {
|
|
467
|
+
(0, import_util.setCellValue)(row, column, null);
|
|
523
468
|
}
|
|
469
|
+
if (mode === "row") {
|
|
470
|
+
tableColumn.forEach((column2) => getEditColumnModel(row, column2));
|
|
471
|
+
} else {
|
|
472
|
+
getEditColumnModel(row, column);
|
|
473
|
+
}
|
|
474
|
+
const afterEditMethod = editOpts.afterEditMethod;
|
|
475
|
+
(0, import_vue.nextTick)(() => {
|
|
476
|
+
if (isFocus) {
|
|
477
|
+
$xeTable.handleFocus(editParams, evnt);
|
|
478
|
+
}
|
|
479
|
+
if (afterEditMethod) {
|
|
480
|
+
afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
$xeTable.dispatchEvent("edit-activated", evntParams, evnt);
|
|
484
|
+
$xeTable.dispatchEvent("edit-actived", evntParams, evnt);
|
|
485
|
+
} else {
|
|
486
|
+
$xeTable.dispatchEvent("edit-disabled", evntParams, evnt);
|
|
524
487
|
}
|
|
525
488
|
focused.column = null;
|
|
526
489
|
focused.row = null;
|
|
527
490
|
$xeTable.focus();
|
|
491
|
+
};
|
|
492
|
+
const eFnParams = { ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt };
|
|
493
|
+
if (beforeEditFn) {
|
|
494
|
+
handleCellEdit(!!beforeEditFn(eFnParams));
|
|
495
|
+
} else if (beforeEditAsyncFn) {
|
|
496
|
+
return Promise.resolve().then(() => beforeEditAsyncFn(eFnParams)).catch(() => false).then((status) => {
|
|
497
|
+
handleCellEdit(!!status);
|
|
498
|
+
});
|
|
499
|
+
} else {
|
|
500
|
+
handleCellEdit(true);
|
|
528
501
|
}
|
|
502
|
+
return (0, import_vue.nextTick)();
|
|
529
503
|
}
|
|
504
|
+
const { column: oldColumn } = actived;
|
|
505
|
+
if ((0, import_utils.hasEnableConf)(mouseConfig, mouseOpts)) {
|
|
506
|
+
$xeTable.clearSelected();
|
|
507
|
+
if ($xeTable.clearCellAreas) {
|
|
508
|
+
$xeTable.clearCellAreas();
|
|
509
|
+
$xeTable.clearCopyCellArea();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (oldColumn && oldColumn !== column) {
|
|
513
|
+
const { model: oldModel } = oldColumn;
|
|
514
|
+
if (oldModel.update) {
|
|
515
|
+
(0, import_util.setCellValue)(row, oldColumn, oldModel.value);
|
|
516
|
+
}
|
|
517
|
+
if ($xeTable.clearValidate) {
|
|
518
|
+
$xeTable.clearValidate(row, column);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
column.renderHeight = cell.offsetHeight;
|
|
522
|
+
actived.args = editParams;
|
|
523
|
+
actived.column = column;
|
|
524
|
+
if (isPos) {
|
|
525
|
+
setTimeout(() => {
|
|
526
|
+
$xeTable.handleFocus(editParams, evnt);
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
focused.column = null;
|
|
530
|
+
focused.row = null;
|
|
531
|
+
$xeTable.focus();
|
|
530
532
|
return (0, import_vue.nextTick)();
|
|
531
533
|
};
|
|
532
534
|
const handleEditCell = (row, fieldOrColumn, options) => {
|
package/lib/table/src/table.js
CHANGED
|
@@ -8251,7 +8251,8 @@ var table_default = (
|
|
|
8251
8251
|
const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
|
|
8252
8252
|
const operCtxMenu = isContentMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
|
|
8253
8253
|
const isEditStatus = (0, import_utils.isEnableConf)(editConfig) && actived.column && actived.row;
|
|
8254
|
-
const
|
|
8254
|
+
const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
8255
|
+
const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
|
|
8255
8256
|
const selectRow = selected.row;
|
|
8256
8257
|
const selectColumn = selected.column;
|
|
8257
8258
|
if (operCtxMenu) {
|
|
@@ -8479,7 +8480,7 @@ var table_default = (
|
|
|
8479
8480
|
$grid: $xeGrid,
|
|
8480
8481
|
$gantt: $xeGantt
|
|
8481
8482
|
};
|
|
8482
|
-
|
|
8483
|
+
const handleEdit = () => {
|
|
8483
8484
|
if (delMethod) {
|
|
8484
8485
|
delMethod(params);
|
|
8485
8486
|
} else {
|
|
@@ -8491,6 +8492,20 @@ var table_default = (
|
|
|
8491
8492
|
}
|
|
8492
8493
|
$xeTable.updateFooter();
|
|
8493
8494
|
dispatchEvent("cell-delete-value", params, evnt);
|
|
8495
|
+
};
|
|
8496
|
+
if (beforeEditFn) {
|
|
8497
|
+
if (beforeEditFn(params)) {
|
|
8498
|
+
handleEdit();
|
|
8499
|
+
}
|
|
8500
|
+
} else if (beforeEditAsyncFn) {
|
|
8501
|
+
Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
|
|
8502
|
+
if (status) {
|
|
8503
|
+
handleEdit();
|
|
8504
|
+
}
|
|
8505
|
+
}).catch(() => {
|
|
8506
|
+
});
|
|
8507
|
+
} else {
|
|
8508
|
+
handleEdit();
|
|
8494
8509
|
}
|
|
8495
8510
|
}
|
|
8496
8511
|
} else if (hasBackspaceKey && (0, import_utils.hasEnableConf)(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && (0, import_utils.isEnableConf)(editConfig) && (selectRow || selectColumn)) {
|
|
@@ -8510,7 +8525,7 @@ var table_default = (
|
|
|
8510
8525
|
$grid: $xeGrid,
|
|
8511
8526
|
$gantt: $xeGantt
|
|
8512
8527
|
};
|
|
8513
|
-
|
|
8528
|
+
const handleEdit = () => {
|
|
8514
8529
|
if (backMethod) {
|
|
8515
8530
|
backMethod(params);
|
|
8516
8531
|
} else {
|
|
@@ -8519,6 +8534,20 @@ var table_default = (
|
|
|
8519
8534
|
});
|
|
8520
8535
|
}
|
|
8521
8536
|
dispatchEvent("cell-backspace-value", params, evnt);
|
|
8537
|
+
};
|
|
8538
|
+
if (beforeEditFn) {
|
|
8539
|
+
if (beforeEditFn(params)) {
|
|
8540
|
+
handleEdit();
|
|
8541
|
+
}
|
|
8542
|
+
} else if (beforeEditAsyncFn) {
|
|
8543
|
+
Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
|
|
8544
|
+
if (status) {
|
|
8545
|
+
handleEdit();
|
|
8546
|
+
}
|
|
8547
|
+
}).catch(() => {
|
|
8548
|
+
});
|
|
8549
|
+
} else {
|
|
8550
|
+
handleEdit();
|
|
8522
8551
|
}
|
|
8523
8552
|
}
|
|
8524
8553
|
}
|
|
@@ -8549,7 +8578,6 @@ var table_default = (
|
|
|
8549
8578
|
} else if ((0, import_utils.hasEnableConf)(keyboardConfig, keyboardOpts) && (0, import_utils.isEnableConf)(editConfig) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || evnt.key === "Process" || keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 111 || keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222)) {
|
|
8550
8579
|
const { editMode, editMethod } = keyboardOpts;
|
|
8551
8580
|
if (selectColumn && selectRow && (0, import_utils.isEnableConf)(selectColumn.editRender)) {
|
|
8552
|
-
const beforeEditMethod2 = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
8553
8581
|
const params = {
|
|
8554
8582
|
row: selectRow,
|
|
8555
8583
|
rowIndex: $xeTable.getRowIndex(selectRow),
|
|
@@ -8563,7 +8591,7 @@ var table_default = (
|
|
|
8563
8591
|
$grid: $xeGrid,
|
|
8564
8592
|
$gantt: $xeGantt
|
|
8565
8593
|
};
|
|
8566
|
-
|
|
8594
|
+
const handleEdit = () => {
|
|
8567
8595
|
if (editMethod) {
|
|
8568
8596
|
editMethod(params);
|
|
8569
8597
|
} else {
|
|
@@ -8575,6 +8603,20 @@ var table_default = (
|
|
|
8575
8603
|
isClear: isClearValue
|
|
8576
8604
|
});
|
|
8577
8605
|
}
|
|
8606
|
+
};
|
|
8607
|
+
if (beforeEditFn) {
|
|
8608
|
+
if (beforeEditFn(params)) {
|
|
8609
|
+
handleEdit();
|
|
8610
|
+
}
|
|
8611
|
+
} else if (beforeEditAsyncFn) {
|
|
8612
|
+
Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
|
|
8613
|
+
if (status) {
|
|
8614
|
+
handleEdit();
|
|
8615
|
+
}
|
|
8616
|
+
}).catch(() => {
|
|
8617
|
+
});
|
|
8618
|
+
} else {
|
|
8619
|
+
handleEdit();
|
|
8578
8620
|
}
|
|
8579
8621
|
}
|
|
8580
8622
|
}
|
|
@@ -14340,6 +14382,7 @@ var table_default = (
|
|
|
14340
14382
|
const mouseOpts = computeMouseOpts.value;
|
|
14341
14383
|
const exportOpts = computeExportOpts.value;
|
|
14342
14384
|
const importOpts = computeImportOpts.value;
|
|
14385
|
+
const keyboardOpts = computeKeyboardOpts.value;
|
|
14343
14386
|
const rowDragOpts = computeRowDragOpts.value;
|
|
14344
14387
|
const areaOpts = computeAreaOpts.value;
|
|
14345
14388
|
const sortOpts = computeSortOpts.value;
|
|
@@ -14498,8 +14541,16 @@ var table_default = (
|
|
|
14498
14541
|
if (mouseOpts.area && props.treeConfig && !treeOpts.transform) {
|
|
14499
14542
|
errLog("vxe.error.notSupportProp", ["mouse-config.area", "tree-config.transform=false", "tree-config.transform=true"]);
|
|
14500
14543
|
}
|
|
14501
|
-
if (props.editConfig
|
|
14502
|
-
|
|
14544
|
+
if (props.editConfig) {
|
|
14545
|
+
if (editOpts.activeMethod) {
|
|
14546
|
+
warnLog("vxe.error.delProp", ["edit-config.activeMethod", "edit-config.beforeEditMethod"]);
|
|
14547
|
+
}
|
|
14548
|
+
if (editOpts.beforeEditMethod && editOpts.beforeEditAsyncMethod) {
|
|
14549
|
+
errLog("vxe.error.errConflicts", ["edit-config.beforeEditMethod", "edit-config.beforeEditAsyncMethod"]);
|
|
14550
|
+
}
|
|
14551
|
+
if (keyboardOpts.isEdit && editOpts.beforeEditAsyncMethod) {
|
|
14552
|
+
warnLog("vxe.error.errConflicts", ["keyboard-config.isEdit", "edit-config.beforeEditAsyncMethod"]);
|
|
14553
|
+
}
|
|
14503
14554
|
}
|
|
14504
14555
|
if (checkboxOpts.halfField) {
|
|
14505
14556
|
warnLog("vxe.error.delProp", ["checkbox-config.halfField", "checkbox-config.indeterminateField"]);
|
package/lib/ui/index.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(ui_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(ui_exports);
|
|
34
34
|
var import_core = require("@vxe-ui/core");
|
|
35
35
|
var import_utils = require("./src/utils");
|
|
36
|
-
const version = "4.23.
|
|
36
|
+
const version = "4.23.18";
|
|
37
37
|
import_core.VxeUI.version = version;
|
|
38
38
|
import_core.VxeUI.tableVersion = version;
|
|
39
39
|
import_core.VxeUI.setConfig({
|
package/lib/ui/src/log.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(log_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(log_exports);
|
|
26
26
|
var import_core = require("@vxe-ui/core");
|
|
27
27
|
const { log } = import_core.VxeUI;
|
|
28
|
-
const tableVersion = `table v${"4.23.
|
|
28
|
+
const tableVersion = `table v${"4.23.18"}`;
|
|
29
29
|
function createComponentLog(name) {
|
|
30
30
|
const uiVersion = import_core.VxeUI.uiVersion ? `ui v${import_core.VxeUI.uiVersion}` : "";
|
|
31
31
|
const ganttVersion = import_core.VxeUI.ganttVersion ? `gantt v${import_core.VxeUI.ganttVersion}` : "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.18",
|
|
4
4
|
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "~5.9.3",
|
|
76
76
|
"vue": "3.4.27",
|
|
77
77
|
"vue-router": "~4.5.1",
|
|
78
|
-
"vxe-pc-ui": "4.20.
|
|
78
|
+
"vxe-pc-ui": "4.20.41"
|
|
79
79
|
},
|
|
80
80
|
"allowScripts": {
|
|
81
81
|
"esbuild": true,
|
|
@@ -305,15 +305,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
305
305
|
|
|
306
306
|
const gridExtendTableMethods = extendTableMethods(tableComponentMethodKeys) as VxeTableMethods
|
|
307
307
|
|
|
308
|
-
tableComponentMethodKeys.forEach((name) => {
|
|
309
|
-
gridExtendTableMethods[name] = (...args: any[]) => {
|
|
310
|
-
const $xeTable: any = refTable.value
|
|
311
|
-
if ($xeTable && $xeTable[name]) {
|
|
312
|
-
return $xeTable && $xeTable[name](...args)
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
})
|
|
316
|
-
|
|
317
308
|
const computeProxyOpts = computed(() => {
|
|
318
309
|
return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig)
|
|
319
310
|
})
|
|
@@ -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
|
|