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
package/lib/index.umd.js
CHANGED
|
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
|
|
|
2220
2220
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
2221
2221
|
|
|
2222
2222
|
|
|
2223
|
-
const version = "3.12.
|
|
2223
|
+
const version = "3.12.16";
|
|
2224
2224
|
core_.VxeUI.version = version;
|
|
2225
2225
|
core_.VxeUI.tableVersion = version;
|
|
2226
2226
|
core_.VxeUI.setConfig({
|
|
@@ -2842,7 +2842,7 @@ function isNodeElement(elem) {
|
|
|
2842
2842
|
const {
|
|
2843
2843
|
log: log_log
|
|
2844
2844
|
} = core_.VxeUI;
|
|
2845
|
-
const log_version = `table v${"3.12.
|
|
2845
|
+
const log_version = `table v${"3.12.16"}`;
|
|
2846
2846
|
const warnLog = log_log.create('warn', log_version);
|
|
2847
2847
|
const errLog = log_log.create('error', log_version);
|
|
2848
2848
|
;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
|
|
@@ -13053,6 +13053,19 @@ const Methods = {
|
|
|
13053
13053
|
reactData.pendingRowMaps = pendingMaps;
|
|
13054
13054
|
return $xeTable.$nextTick();
|
|
13055
13055
|
},
|
|
13056
|
+
hasPendingByRow(row) {
|
|
13057
|
+
const $xeTable = this;
|
|
13058
|
+
return $xeTable.isPendingByRow(row);
|
|
13059
|
+
},
|
|
13060
|
+
isPendingByRow(row) {
|
|
13061
|
+
const $xeTable = this;
|
|
13062
|
+
const reactData = $xeTable;
|
|
13063
|
+
const {
|
|
13064
|
+
pendingRowMaps
|
|
13065
|
+
} = reactData;
|
|
13066
|
+
const rowid = getRowid($xeTable, row);
|
|
13067
|
+
return !!pendingRowMaps[rowid];
|
|
13068
|
+
},
|
|
13056
13069
|
getPendingRecords() {
|
|
13057
13070
|
const $xeTable = this;
|
|
13058
13071
|
const reactData = $xeTable;
|
|
@@ -13071,13 +13084,6 @@ const Methods = {
|
|
|
13071
13084
|
});
|
|
13072
13085
|
return insertRecords;
|
|
13073
13086
|
},
|
|
13074
|
-
hasPendingByRow(row) {
|
|
13075
|
-
const {
|
|
13076
|
-
pendingRowMaps
|
|
13077
|
-
} = this;
|
|
13078
|
-
const rowid = getRowid(this, row);
|
|
13079
|
-
return !!pendingRowMaps[rowid];
|
|
13080
|
-
},
|
|
13081
13087
|
clearPendingRow() {
|
|
13082
13088
|
this.pendingRowMaps = {};
|
|
13083
13089
|
return this.$nextTick();
|
|
@@ -14271,7 +14277,12 @@ const Methods = {
|
|
|
14271
14277
|
},
|
|
14272
14278
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
14273
14279
|
const $xeTable = this;
|
|
14280
|
+
const reactData = $xeTable;
|
|
14274
14281
|
const internalData = $xeTable;
|
|
14282
|
+
const {
|
|
14283
|
+
scrollYLoad,
|
|
14284
|
+
scrollXLoad
|
|
14285
|
+
} = reactData;
|
|
14275
14286
|
const {
|
|
14276
14287
|
elemStore,
|
|
14277
14288
|
intoRunScroll,
|
|
@@ -14337,13 +14348,17 @@ const Methods = {
|
|
|
14337
14348
|
setScrollTop(rightScrollElem, scrollTop);
|
|
14338
14349
|
}
|
|
14339
14350
|
setScrollTop(yHandleEl, scrollTop);
|
|
14340
|
-
|
|
14351
|
+
if (scrollYLoad) {
|
|
14352
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
14353
|
+
}
|
|
14341
14354
|
}
|
|
14342
14355
|
if (isRollX) {
|
|
14343
14356
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
14344
14357
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
14345
14358
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
14346
|
-
|
|
14359
|
+
if (scrollXLoad) {
|
|
14360
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
14361
|
+
}
|
|
14347
14362
|
}
|
|
14348
14363
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
14349
14364
|
type: 'body',
|
|
@@ -14352,7 +14367,11 @@ const Methods = {
|
|
|
14352
14367
|
},
|
|
14353
14368
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
14354
14369
|
const $xeTable = this;
|
|
14370
|
+
const reactData = $xeTable;
|
|
14355
14371
|
const internalData = $xeTable;
|
|
14372
|
+
const {
|
|
14373
|
+
scrollXLoad
|
|
14374
|
+
} = reactData;
|
|
14356
14375
|
const {
|
|
14357
14376
|
elemStore,
|
|
14358
14377
|
intoRunScroll,
|
|
@@ -14389,7 +14408,9 @@ const Methods = {
|
|
|
14389
14408
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
14390
14409
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
14391
14410
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
14392
|
-
|
|
14411
|
+
if (scrollXLoad) {
|
|
14412
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
14413
|
+
}
|
|
14393
14414
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
14394
14415
|
type: 'header',
|
|
14395
14416
|
fixed: fixedType
|
|
@@ -14397,7 +14418,11 @@ const Methods = {
|
|
|
14397
14418
|
},
|
|
14398
14419
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
14399
14420
|
const $xeTable = this;
|
|
14421
|
+
const reactData = $xeTable;
|
|
14400
14422
|
const internalData = $xeTable;
|
|
14423
|
+
const {
|
|
14424
|
+
scrollXLoad
|
|
14425
|
+
} = reactData;
|
|
14401
14426
|
const {
|
|
14402
14427
|
elemStore,
|
|
14403
14428
|
intoRunScroll,
|
|
@@ -14434,7 +14459,9 @@ const Methods = {
|
|
|
14434
14459
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
14435
14460
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
14436
14461
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
14437
|
-
|
|
14462
|
+
if (scrollXLoad) {
|
|
14463
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
14464
|
+
}
|
|
14438
14465
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
14439
14466
|
type: 'footer',
|
|
14440
14467
|
fixed: fixedType
|
|
@@ -14456,6 +14483,9 @@ const Methods = {
|
|
|
14456
14483
|
const {
|
|
14457
14484
|
highlightHoverRow
|
|
14458
14485
|
} = tableProps;
|
|
14486
|
+
const {
|
|
14487
|
+
scrollYLoad
|
|
14488
|
+
} = reactData;
|
|
14459
14489
|
const {
|
|
14460
14490
|
elemStore,
|
|
14461
14491
|
lastScrollTop,
|
|
@@ -14502,7 +14532,9 @@ const Methods = {
|
|
|
14502
14532
|
setScrollTop(bodyScrollElem, currTopNum);
|
|
14503
14533
|
setScrollTop(leftScrollElem, currTopNum);
|
|
14504
14534
|
setScrollTop(rightScrollElem, currTopNum);
|
|
14505
|
-
|
|
14535
|
+
if (scrollYLoad) {
|
|
14536
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
14537
|
+
}
|
|
14506
14538
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
14507
14539
|
type: 'table',
|
|
14508
14540
|
fixed: ''
|
|
@@ -14522,7 +14554,11 @@ const Methods = {
|
|
|
14522
14554
|
},
|
|
14523
14555
|
triggerVirtualScrollXEvent(evnt) {
|
|
14524
14556
|
const $xeTable = this;
|
|
14557
|
+
const reactData = $xeTable;
|
|
14525
14558
|
const internalData = $xeTable;
|
|
14559
|
+
const {
|
|
14560
|
+
scrollXLoad
|
|
14561
|
+
} = reactData;
|
|
14526
14562
|
const {
|
|
14527
14563
|
elemStore,
|
|
14528
14564
|
inWheelScroll,
|
|
@@ -14556,7 +14592,9 @@ const Methods = {
|
|
|
14556
14592
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
14557
14593
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
14558
14594
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
14559
|
-
|
|
14595
|
+
if (scrollXLoad) {
|
|
14596
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
14597
|
+
}
|
|
14560
14598
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
14561
14599
|
type: 'table',
|
|
14562
14600
|
fixed: ''
|
|
@@ -14564,7 +14602,11 @@ const Methods = {
|
|
|
14564
14602
|
},
|
|
14565
14603
|
triggerVirtualScrollYEvent(evnt) {
|
|
14566
14604
|
const $xeTable = this;
|
|
14605
|
+
const reactData = $xeTable;
|
|
14567
14606
|
const internalData = $xeTable;
|
|
14607
|
+
const {
|
|
14608
|
+
scrollYLoad
|
|
14609
|
+
} = reactData;
|
|
14568
14610
|
const {
|
|
14569
14611
|
elemStore,
|
|
14570
14612
|
inWheelScroll,
|
|
@@ -14598,7 +14640,9 @@ const Methods = {
|
|
|
14598
14640
|
setScrollTop(bodyScrollElem, scrollTop);
|
|
14599
14641
|
setScrollTop(leftScrollElem, scrollTop);
|
|
14600
14642
|
setScrollTop(rightScrollElem, scrollTop);
|
|
14601
|
-
|
|
14643
|
+
if (scrollYLoad) {
|
|
14644
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
14645
|
+
}
|
|
14602
14646
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
14603
14647
|
type: 'table',
|
|
14604
14648
|
fixed: ''
|
|
@@ -20263,6 +20307,27 @@ const {
|
|
|
20263
20307
|
renderer: edit_mixin_renderer,
|
|
20264
20308
|
getI18n: mixin_getI18n
|
|
20265
20309
|
} = core_.VxeUI;
|
|
20310
|
+
function getEditColumnModel(row, column) {
|
|
20311
|
+
const {
|
|
20312
|
+
model,
|
|
20313
|
+
editRender
|
|
20314
|
+
} = column;
|
|
20315
|
+
if (editRender) {
|
|
20316
|
+
model.value = getCellValue(row, column);
|
|
20317
|
+
model.update = false;
|
|
20318
|
+
}
|
|
20319
|
+
}
|
|
20320
|
+
function setEditColumnModel(row, column) {
|
|
20321
|
+
const {
|
|
20322
|
+
model,
|
|
20323
|
+
editRender
|
|
20324
|
+
} = column;
|
|
20325
|
+
if (editRender && model.update) {
|
|
20326
|
+
setCellValue(row, column, model.value);
|
|
20327
|
+
model.update = false;
|
|
20328
|
+
model.value = null;
|
|
20329
|
+
}
|
|
20330
|
+
}
|
|
20266
20331
|
function removeCellSelectedClass($xeTable) {
|
|
20267
20332
|
const el = $xeTable.$refs.refElem;
|
|
20268
20333
|
if (el) {
|
|
@@ -20272,6 +20337,28 @@ function removeCellSelectedClass($xeTable) {
|
|
|
20272
20337
|
}
|
|
20273
20338
|
}
|
|
20274
20339
|
}
|
|
20340
|
+
function syncActivedCell($xeTable) {
|
|
20341
|
+
const reactData = $xeTable;
|
|
20342
|
+
const {
|
|
20343
|
+
editStore,
|
|
20344
|
+
tableColumn
|
|
20345
|
+
} = reactData;
|
|
20346
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
20347
|
+
const {
|
|
20348
|
+
actived
|
|
20349
|
+
} = editStore;
|
|
20350
|
+
const {
|
|
20351
|
+
row,
|
|
20352
|
+
column
|
|
20353
|
+
} = actived;
|
|
20354
|
+
if (row || column) {
|
|
20355
|
+
if (editOpts.mode === 'row') {
|
|
20356
|
+
tableColumn.forEach(column => setEditColumnModel(row, column));
|
|
20357
|
+
} else {
|
|
20358
|
+
setEditColumnModel(row, column);
|
|
20359
|
+
}
|
|
20360
|
+
}
|
|
20361
|
+
}
|
|
20275
20362
|
function insertTreeRow(_vm, newRecords, isAppend) {
|
|
20276
20363
|
const {
|
|
20277
20364
|
tableFullTreeData,
|
|
@@ -20626,6 +20713,216 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
20626
20713
|
rows: []
|
|
20627
20714
|
});
|
|
20628
20715
|
}
|
|
20716
|
+
function handleClearEdit($xeTable, evnt, targetRow) {
|
|
20717
|
+
const props = $xeTable;
|
|
20718
|
+
const reactData = $xeTable;
|
|
20719
|
+
const {
|
|
20720
|
+
mouseConfig
|
|
20721
|
+
} = props;
|
|
20722
|
+
const {
|
|
20723
|
+
editStore
|
|
20724
|
+
} = reactData;
|
|
20725
|
+
const {
|
|
20726
|
+
actived,
|
|
20727
|
+
focused
|
|
20728
|
+
} = editStore;
|
|
20729
|
+
const {
|
|
20730
|
+
row,
|
|
20731
|
+
column
|
|
20732
|
+
} = actived;
|
|
20733
|
+
const validOpts = $xeTable.computeValidOpts;
|
|
20734
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
20735
|
+
if (row || column) {
|
|
20736
|
+
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
20737
|
+
return $xeTable.$nextTick();
|
|
20738
|
+
}
|
|
20739
|
+
syncActivedCell($xeTable);
|
|
20740
|
+
actived.args = null;
|
|
20741
|
+
actived.row = null;
|
|
20742
|
+
actived.column = null;
|
|
20743
|
+
$xeTable.updateFooter();
|
|
20744
|
+
$xeTable.dispatchEvent('edit-closed', {
|
|
20745
|
+
row,
|
|
20746
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
20747
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
20748
|
+
column,
|
|
20749
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
20750
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
20751
|
+
}, evnt || null);
|
|
20752
|
+
}
|
|
20753
|
+
focused.row = null;
|
|
20754
|
+
focused.column = null;
|
|
20755
|
+
if (validOpts.autoClear) {
|
|
20756
|
+
if (validOpts.msgMode !== 'full' || mixin_getConfig().cellVaildMode === 'obsolete') {
|
|
20757
|
+
if ($xeTable.clearValidate) {
|
|
20758
|
+
return $xeTable.clearValidate();
|
|
20759
|
+
}
|
|
20760
|
+
}
|
|
20761
|
+
}
|
|
20762
|
+
return $xeTable.$nextTick().then(() => {
|
|
20763
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
20764
|
+
return $xeTable.handleRecalculateCellAreas();
|
|
20765
|
+
}
|
|
20766
|
+
});
|
|
20767
|
+
}
|
|
20768
|
+
function handleEditActive($xeTable, params, evnt, isFocus) {
|
|
20769
|
+
const props = $xeTable;
|
|
20770
|
+
const reactData = $xeTable;
|
|
20771
|
+
const {
|
|
20772
|
+
editConfig,
|
|
20773
|
+
mouseConfig
|
|
20774
|
+
} = props;
|
|
20775
|
+
const {
|
|
20776
|
+
editStore,
|
|
20777
|
+
tableColumn
|
|
20778
|
+
} = reactData;
|
|
20779
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
20780
|
+
const {
|
|
20781
|
+
mode
|
|
20782
|
+
} = editOpts;
|
|
20783
|
+
const {
|
|
20784
|
+
actived,
|
|
20785
|
+
focused
|
|
20786
|
+
} = editStore;
|
|
20787
|
+
const {
|
|
20788
|
+
row,
|
|
20789
|
+
column
|
|
20790
|
+
} = params;
|
|
20791
|
+
const {
|
|
20792
|
+
editRender
|
|
20793
|
+
} = column;
|
|
20794
|
+
const cell = params.cell || $xeTable.getCellElement(row, column);
|
|
20795
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
20796
|
+
params.cell = cell;
|
|
20797
|
+
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
20798
|
+
// 激活编辑
|
|
20799
|
+
if (!$xeTable.isPendingByRow(row)) {
|
|
20800
|
+
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
20801
|
+
// 判断是否禁用编辑
|
|
20802
|
+
let type = 'edit-disabled';
|
|
20803
|
+
if (!beforeEditMethod || beforeEditMethod({
|
|
20804
|
+
...params,
|
|
20805
|
+
$table: $xeTable,
|
|
20806
|
+
$grid: $xeTable.xegrid
|
|
20807
|
+
})) {
|
|
20808
|
+
if (mouseConfig) {
|
|
20809
|
+
$xeTable.clearSelected();
|
|
20810
|
+
if ($xeTable.clearCellAreas) {
|
|
20811
|
+
$xeTable.clearCellAreas();
|
|
20812
|
+
$xeTable.clearCopyCellArea();
|
|
20813
|
+
}
|
|
20814
|
+
}
|
|
20815
|
+
$xeTable.closeTooltip();
|
|
20816
|
+
if (actived.column) {
|
|
20817
|
+
handleClearEdit($xeTable, evnt);
|
|
20818
|
+
}
|
|
20819
|
+
type = 'edit-activated';
|
|
20820
|
+
column.renderHeight = cell.offsetHeight;
|
|
20821
|
+
actived.args = params;
|
|
20822
|
+
actived.row = row;
|
|
20823
|
+
actived.column = column;
|
|
20824
|
+
if (mode === 'row') {
|
|
20825
|
+
tableColumn.forEach(column => getEditColumnModel(row, column));
|
|
20826
|
+
} else {
|
|
20827
|
+
getEditColumnModel(row, column);
|
|
20828
|
+
}
|
|
20829
|
+
const afterEditMethod = editOpts.afterEditMethod;
|
|
20830
|
+
$xeTable.$nextTick(() => {
|
|
20831
|
+
if (isFocus) {
|
|
20832
|
+
$xeTable.handleFocus(params, evnt);
|
|
20833
|
+
}
|
|
20834
|
+
if (afterEditMethod) {
|
|
20835
|
+
afterEditMethod({
|
|
20836
|
+
...params,
|
|
20837
|
+
$table: $xeTable,
|
|
20838
|
+
$grid: $xeTable.xegrid
|
|
20839
|
+
});
|
|
20840
|
+
}
|
|
20841
|
+
});
|
|
20842
|
+
}
|
|
20843
|
+
$xeTable.dispatchEvent(type, {
|
|
20844
|
+
row,
|
|
20845
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
20846
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
20847
|
+
column,
|
|
20848
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
20849
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
20850
|
+
}, evnt);
|
|
20851
|
+
// v4已废弃
|
|
20852
|
+
if (type === 'edit-activated') {
|
|
20853
|
+
$xeTable.dispatchEvent('edit-actived', {
|
|
20854
|
+
row,
|
|
20855
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
20856
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
20857
|
+
column,
|
|
20858
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
20859
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
20860
|
+
}, evnt);
|
|
20861
|
+
}
|
|
20862
|
+
} else {
|
|
20863
|
+
const {
|
|
20864
|
+
column: oldColumn
|
|
20865
|
+
} = actived;
|
|
20866
|
+
if (mouseConfig) {
|
|
20867
|
+
$xeTable.clearSelected();
|
|
20868
|
+
if ($xeTable.clearCellAreas) {
|
|
20869
|
+
$xeTable.clearCellAreas();
|
|
20870
|
+
$xeTable.clearCopyCellArea();
|
|
20871
|
+
}
|
|
20872
|
+
}
|
|
20873
|
+
if (oldColumn !== column) {
|
|
20874
|
+
const {
|
|
20875
|
+
model: oldModel
|
|
20876
|
+
} = oldColumn;
|
|
20877
|
+
if (oldModel.update) {
|
|
20878
|
+
setCellValue(row, oldColumn, oldModel.value);
|
|
20879
|
+
}
|
|
20880
|
+
if ($xeTable.clearValidate) {
|
|
20881
|
+
$xeTable.clearValidate(row, column);
|
|
20882
|
+
}
|
|
20883
|
+
}
|
|
20884
|
+
column.renderHeight = cell.offsetHeight;
|
|
20885
|
+
actived.args = params;
|
|
20886
|
+
actived.column = column;
|
|
20887
|
+
if (isFocus) {
|
|
20888
|
+
setTimeout(() => {
|
|
20889
|
+
$xeTable.handleFocus(params, evnt);
|
|
20890
|
+
});
|
|
20891
|
+
}
|
|
20892
|
+
}
|
|
20893
|
+
focused.column = null;
|
|
20894
|
+
focused.row = null;
|
|
20895
|
+
$xeTable.focus();
|
|
20896
|
+
}
|
|
20897
|
+
}
|
|
20898
|
+
return $xeTable.$nextTick();
|
|
20899
|
+
}
|
|
20900
|
+
function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
|
|
20901
|
+
const props = $xeTable;
|
|
20902
|
+
const internalData = $xeTable;
|
|
20903
|
+
const {
|
|
20904
|
+
editConfig
|
|
20905
|
+
} = props;
|
|
20906
|
+
const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
20907
|
+
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
20908
|
+
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
20909
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
20910
|
+
if (cell) {
|
|
20911
|
+
handleEditActive($xeTable, {
|
|
20912
|
+
row,
|
|
20913
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
20914
|
+
column,
|
|
20915
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
20916
|
+
cell,
|
|
20917
|
+
$table: $xeTable
|
|
20918
|
+
}, null, false);
|
|
20919
|
+
internalData._lastCallTime = Date.now();
|
|
20920
|
+
}
|
|
20921
|
+
return $xeTable.$nextTick();
|
|
20922
|
+
});
|
|
20923
|
+
}
|
|
20924
|
+
return $xeTable.$nextTick();
|
|
20925
|
+
}
|
|
20629
20926
|
/* harmony default export */ var edit_mixin = ({
|
|
20630
20927
|
methods: {
|
|
20631
20928
|
/**
|
|
@@ -20906,6 +21203,7 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
20906
21203
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
20907
21204
|
*/
|
|
20908
21205
|
_getUpdateRecords() {
|
|
21206
|
+
const $xeTable = this;
|
|
20909
21207
|
const {
|
|
20910
21208
|
keepSource,
|
|
20911
21209
|
tableFullData,
|
|
@@ -20923,7 +21221,7 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
20923
21221
|
column
|
|
20924
21222
|
} = actived;
|
|
20925
21223
|
if (row || column) {
|
|
20926
|
-
|
|
21224
|
+
syncActivedCell($xeTable);
|
|
20927
21225
|
}
|
|
20928
21226
|
if (treeConfig) {
|
|
20929
21227
|
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(tableFullData, row => isUpdateByRow(row), treeOpts);
|
|
@@ -20936,107 +21234,8 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
20936
21234
|
* 处理激活编辑
|
|
20937
21235
|
*/
|
|
20938
21236
|
handleEdit(params, evnt) {
|
|
20939
|
-
const
|
|
20940
|
-
|
|
20941
|
-
editOpts,
|
|
20942
|
-
tableColumn,
|
|
20943
|
-
editConfig,
|
|
20944
|
-
mouseConfig
|
|
20945
|
-
} = this;
|
|
20946
|
-
const {
|
|
20947
|
-
mode
|
|
20948
|
-
} = editOpts;
|
|
20949
|
-
const {
|
|
20950
|
-
actived,
|
|
20951
|
-
focused
|
|
20952
|
-
} = editStore;
|
|
20953
|
-
const {
|
|
20954
|
-
row,
|
|
20955
|
-
column
|
|
20956
|
-
} = params;
|
|
20957
|
-
const {
|
|
20958
|
-
editRender
|
|
20959
|
-
} = column;
|
|
20960
|
-
const cell = params.cell = params.cell || this.getCellElement(row, column);
|
|
20961
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
20962
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
20963
|
-
// 激活编辑
|
|
20964
|
-
if (!this.hasPendingByRow(row)) {
|
|
20965
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
20966
|
-
// 判断是否禁用编辑
|
|
20967
|
-
let type = 'edit-disabled';
|
|
20968
|
-
if (!beforeEditMethod || beforeEditMethod({
|
|
20969
|
-
...params,
|
|
20970
|
-
$table: this,
|
|
20971
|
-
$grid: this.$xegrid
|
|
20972
|
-
})) {
|
|
20973
|
-
if (mouseConfig) {
|
|
20974
|
-
this.clearSelected(evnt);
|
|
20975
|
-
this.clearCellAreas(evnt);
|
|
20976
|
-
this.clearCopyCellArea(evnt);
|
|
20977
|
-
}
|
|
20978
|
-
this.closeTooltip();
|
|
20979
|
-
if (actived.column) {
|
|
20980
|
-
this.handleClearEdit(evnt);
|
|
20981
|
-
}
|
|
20982
|
-
type = 'edit-activated';
|
|
20983
|
-
column.renderHeight = cell.offsetHeight;
|
|
20984
|
-
actived.args = params;
|
|
20985
|
-
actived.row = row;
|
|
20986
|
-
actived.column = column;
|
|
20987
|
-
if (mode === 'row') {
|
|
20988
|
-
tableColumn.forEach(column => this._getColumnModel(row, column));
|
|
20989
|
-
} else {
|
|
20990
|
-
this._getColumnModel(row, column);
|
|
20991
|
-
}
|
|
20992
|
-
const afterEditMethod = editOpts.afterEditMethod;
|
|
20993
|
-
this.$nextTick(() => {
|
|
20994
|
-
this.handleFocus(params, evnt);
|
|
20995
|
-
if (afterEditMethod) {
|
|
20996
|
-
afterEditMethod({
|
|
20997
|
-
...params,
|
|
20998
|
-
$table: this,
|
|
20999
|
-
$grid: this.$xegrid
|
|
21000
|
-
});
|
|
21001
|
-
}
|
|
21002
|
-
});
|
|
21003
|
-
}
|
|
21004
|
-
this.emitEvent(type, params, evnt);
|
|
21005
|
-
// v4已废弃
|
|
21006
|
-
if (type === 'edit-activated') {
|
|
21007
|
-
this.emitEvent('edit-actived', params, evnt);
|
|
21008
|
-
}
|
|
21009
|
-
} else {
|
|
21010
|
-
const {
|
|
21011
|
-
column: oldColumn
|
|
21012
|
-
} = actived;
|
|
21013
|
-
if (mouseConfig) {
|
|
21014
|
-
this.clearSelected(evnt);
|
|
21015
|
-
this.clearCellAreas(evnt);
|
|
21016
|
-
this.clearCopyCellArea(evnt);
|
|
21017
|
-
}
|
|
21018
|
-
if (oldColumn !== column) {
|
|
21019
|
-
const {
|
|
21020
|
-
model: oldModel
|
|
21021
|
-
} = oldColumn;
|
|
21022
|
-
if (oldModel.update) {
|
|
21023
|
-
setCellValue(row, oldColumn, oldModel.value);
|
|
21024
|
-
}
|
|
21025
|
-
this.clearValidate();
|
|
21026
|
-
}
|
|
21027
|
-
column.renderHeight = cell.offsetHeight;
|
|
21028
|
-
actived.args = params;
|
|
21029
|
-
actived.column = column;
|
|
21030
|
-
setTimeout(() => {
|
|
21031
|
-
this.handleFocus(params, evnt);
|
|
21032
|
-
});
|
|
21033
|
-
}
|
|
21034
|
-
focused.column = null;
|
|
21035
|
-
focused.row = null;
|
|
21036
|
-
this.focus();
|
|
21037
|
-
}
|
|
21038
|
-
}
|
|
21039
|
-
return this.$nextTick();
|
|
21237
|
+
const $xeTable = this;
|
|
21238
|
+
return handleEditActive($xeTable, params, evnt, true);
|
|
21040
21239
|
},
|
|
21041
21240
|
/**
|
|
21042
21241
|
* @deprecated
|
|
@@ -21045,46 +21244,14 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21045
21244
|
return this.handleEdit(params, evnt);
|
|
21046
21245
|
},
|
|
21047
21246
|
_getColumnModel(row, column) {
|
|
21048
|
-
|
|
21049
|
-
model,
|
|
21050
|
-
editRender
|
|
21051
|
-
} = column;
|
|
21052
|
-
if (editRender) {
|
|
21053
|
-
model.value = getCellValue(row, column);
|
|
21054
|
-
model.update = false;
|
|
21055
|
-
}
|
|
21247
|
+
getEditColumnModel(row, column);
|
|
21056
21248
|
},
|
|
21057
21249
|
_setColumnModel(row, column) {
|
|
21058
|
-
|
|
21059
|
-
model,
|
|
21060
|
-
editRender
|
|
21061
|
-
} = column;
|
|
21062
|
-
if (editRender && model.update) {
|
|
21063
|
-
setCellValue(row, column, model.value);
|
|
21064
|
-
model.update = false;
|
|
21065
|
-
model.value = null;
|
|
21066
|
-
}
|
|
21250
|
+
setEditColumnModel(row, column);
|
|
21067
21251
|
},
|
|
21068
21252
|
_syncActivedCell() {
|
|
21069
|
-
const
|
|
21070
|
-
|
|
21071
|
-
editStore,
|
|
21072
|
-
editOpts
|
|
21073
|
-
} = this;
|
|
21074
|
-
const {
|
|
21075
|
-
actived
|
|
21076
|
-
} = editStore;
|
|
21077
|
-
const {
|
|
21078
|
-
row,
|
|
21079
|
-
column
|
|
21080
|
-
} = actived;
|
|
21081
|
-
if (row || column) {
|
|
21082
|
-
if (editOpts.mode === 'row') {
|
|
21083
|
-
tableColumn.forEach(column => this._setColumnModel(row, column));
|
|
21084
|
-
} else {
|
|
21085
|
-
this._setColumnModel(row, column);
|
|
21086
|
-
}
|
|
21087
|
-
}
|
|
21253
|
+
const $xeTable = this;
|
|
21254
|
+
syncActivedCell($xeTable);
|
|
21088
21255
|
},
|
|
21089
21256
|
_clearActived(row) {
|
|
21090
21257
|
if (true) {
|
|
@@ -21097,63 +21264,15 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21097
21264
|
* 清除激活的编辑
|
|
21098
21265
|
*/
|
|
21099
21266
|
_clearEdit(row) {
|
|
21100
|
-
|
|
21267
|
+
const $xeTable = this;
|
|
21268
|
+
return handleClearEdit($xeTable, null, row);
|
|
21101
21269
|
},
|
|
21102
21270
|
/**
|
|
21103
21271
|
* 取消编辑
|
|
21104
21272
|
*/
|
|
21105
21273
|
handleClearEdit(evnt, targetRow) {
|
|
21106
21274
|
const $xeTable = this;
|
|
21107
|
-
|
|
21108
|
-
const reactData = $xeTable;
|
|
21109
|
-
const {
|
|
21110
|
-
mouseConfig
|
|
21111
|
-
} = props;
|
|
21112
|
-
const {
|
|
21113
|
-
editStore
|
|
21114
|
-
} = reactData;
|
|
21115
|
-
const {
|
|
21116
|
-
actived,
|
|
21117
|
-
focused
|
|
21118
|
-
} = editStore;
|
|
21119
|
-
const {
|
|
21120
|
-
row,
|
|
21121
|
-
column
|
|
21122
|
-
} = actived;
|
|
21123
|
-
const validOpts = $xeTable.validOpts;
|
|
21124
|
-
const mouseOpts = $xeTable.computeMouseOpts;
|
|
21125
|
-
if (row || column) {
|
|
21126
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
21127
|
-
return $xeTable.$nextTick();
|
|
21128
|
-
}
|
|
21129
|
-
$xeTable._syncActivedCell();
|
|
21130
|
-
actived.args = null;
|
|
21131
|
-
actived.row = null;
|
|
21132
|
-
actived.column = null;
|
|
21133
|
-
$xeTable.updateFooter();
|
|
21134
|
-
$xeTable.emitEvent('edit-closed', {
|
|
21135
|
-
row,
|
|
21136
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
21137
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
21138
|
-
column,
|
|
21139
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
21140
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
21141
|
-
}, evnt);
|
|
21142
|
-
}
|
|
21143
|
-
focused.row = null;
|
|
21144
|
-
focused.column = null;
|
|
21145
|
-
if (validOpts.autoClear) {
|
|
21146
|
-
if (validOpts.msgMode !== 'full' || mixin_getConfig().cellVaildMode === 'obsolete') {
|
|
21147
|
-
if ($xeTable.clearValidate) {
|
|
21148
|
-
return $xeTable.clearValidate();
|
|
21149
|
-
}
|
|
21150
|
-
}
|
|
21151
|
-
}
|
|
21152
|
-
return $xeTable.$nextTick().then(() => {
|
|
21153
|
-
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
21154
|
-
return $xeTable.handleRecalculateCellAreas();
|
|
21155
|
-
}
|
|
21156
|
-
});
|
|
21275
|
+
return handleClearEdit($xeTable, evnt, targetRow);
|
|
21157
21276
|
},
|
|
21158
21277
|
_getActiveRecord() {
|
|
21159
21278
|
if (true) {
|
|
@@ -21270,11 +21389,12 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21270
21389
|
* 激活行编辑
|
|
21271
21390
|
*/
|
|
21272
21391
|
_setEditRow(row, fieldOrColumn) {
|
|
21392
|
+
const $xeTable = this;
|
|
21273
21393
|
let column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(this.visibleColumn, column => isEnableConf(column.editRender));
|
|
21274
21394
|
if (fieldOrColumn) {
|
|
21275
21395
|
column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
21276
21396
|
}
|
|
21277
|
-
return
|
|
21397
|
+
return handleEditCell($xeTable, row, column, false);
|
|
21278
21398
|
},
|
|
21279
21399
|
_setActiveCell(row, fieldOrColumn) {
|
|
21280
21400
|
if (true) {
|
|
@@ -21287,27 +21407,8 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21287
21407
|
* 激活单元格编辑
|
|
21288
21408
|
*/
|
|
21289
21409
|
_setEditCell(row, fieldOrColumn) {
|
|
21290
|
-
const
|
|
21291
|
-
|
|
21292
|
-
} = this;
|
|
21293
|
-
const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
21294
|
-
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
21295
|
-
return this.scrollToRow(row, true).then(() => {
|
|
21296
|
-
const cell = this.getCellElement(row, column);
|
|
21297
|
-
if (cell) {
|
|
21298
|
-
this.handleEdit({
|
|
21299
|
-
row,
|
|
21300
|
-
rowIndex: this.getRowIndex(row),
|
|
21301
|
-
column,
|
|
21302
|
-
columnIndex: this.getColumnIndex(column),
|
|
21303
|
-
cell,
|
|
21304
|
-
$table: this
|
|
21305
|
-
});
|
|
21306
|
-
this.lastCallTime = Date.now();
|
|
21307
|
-
}
|
|
21308
|
-
});
|
|
21309
|
-
}
|
|
21310
|
-
return this.$nextTick();
|
|
21410
|
+
const $xeTable = this;
|
|
21411
|
+
return handleEditCell($xeTable, row, fieldOrColumn, true);
|
|
21311
21412
|
},
|
|
21312
21413
|
/**
|
|
21313
21414
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -21339,6 +21440,7 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21339
21440
|
* 处理选中源
|
|
21340
21441
|
*/
|
|
21341
21442
|
handleSelected(params, evnt) {
|
|
21443
|
+
const $xeTable = this;
|
|
21342
21444
|
const {
|
|
21343
21445
|
mouseConfig,
|
|
21344
21446
|
mouseOpts,
|
|
@@ -21357,7 +21459,7 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
|
|
|
21357
21459
|
const selectMethod = () => {
|
|
21358
21460
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
21359
21461
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
21360
|
-
|
|
21462
|
+
handleClearEdit($xeTable, evnt);
|
|
21361
21463
|
this.clearSelected(evnt);
|
|
21362
21464
|
this.clearCellAreas(evnt);
|
|
21363
21465
|
this.clearCopyCellArea(evnt);
|