Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Sep 27, 2019
1 parent ce6e9ba commit 3117c5c
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 195 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate"><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><link rel=icon href=/vxe-table/favicon.ico><title>vue table 表格组件</title><link href=/vxe-table/static/css/advanced.f8b994e8.css rel=prefetch><link href=/vxe-table/static/css/api.c3ac3501.css rel=prefetch><link href=/vxe-table/static/css/base.69fbe158.css rel=prefetch><link href=/vxe-table/static/css/edit.b43d88c8.css rel=prefetch><link href=/vxe-table/static/css/grid.b620cd41.css rel=prefetch><link href=/vxe-table/static/css/module.2b63bd67.css rel=prefetch><link href=/vxe-table/static/css/optimize.a8ac9108.css rel=prefetch><link href=/vxe-table/static/css/other.4f7f6e55.css rel=prefetch><link href=/vxe-table/static/js/advanced.86a7a5a6.js rel=prefetch><link href=/vxe-table/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree.5876e77c.js rel=prefetch><link href=/vxe-table/static/js/api.07ec3078.js rel=prefetch><link href=/vxe-table/static/js/base.8c383018.js rel=prefetch><link href=/vxe-table/static/js/edit.422e331c.js rel=prefetch><link href=/vxe-table/static/js/excel.dff6f647.js rel=prefetch><link href=/vxe-table/static/js/excel~other.ea9cbdaa.js rel=prefetch><link href=/vxe-table/static/js/grid.f4225081.js rel=prefetch><link href=/vxe-table/static/js/module.e565f9da.js rel=prefetch><link href=/vxe-table/static/js/optimize.1c77ebf1.js rel=prefetch><link href=/vxe-table/static/js/other.d5e76ad2.js rel=prefetch><link href=/vxe-table/static/js/plugin.e9e456ca.js rel=prefetch><link href=/vxe-table/static/js/scroll.71d9be65.js rel=prefetch><link href=/vxe-table/static/js/start.d49663a9.js rel=prefetch><link href=/vxe-table/static/js/tree.8a136908.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.cce7c562.css rel=preload as=style><link href=/vxe-table/static/css/index.f968c214.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.02a79b9b.js rel=preload as=script><link href=/vxe-table/static/js/index.348250a8.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.cce7c562.css rel=stylesheet><link href=/vxe-table/static/css/index.f968c214.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.02a79b9b.js></script><script src=/vxe-table/static/js/index.348250a8.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate"><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><link rel=icon href=/vxe-table/favicon.ico><title>vue table 表格组件</title><link href=/vxe-table/static/css/advanced.f8b994e8.css rel=prefetch><link href=/vxe-table/static/css/api.c3ac3501.css rel=prefetch><link href=/vxe-table/static/css/base.69fbe158.css rel=prefetch><link href=/vxe-table/static/css/edit.b43d88c8.css rel=prefetch><link href=/vxe-table/static/css/grid.b620cd41.css rel=prefetch><link href=/vxe-table/static/css/module.2b63bd67.css rel=prefetch><link href=/vxe-table/static/css/optimize.a8ac9108.css rel=prefetch><link href=/vxe-table/static/css/other.4f7f6e55.css rel=prefetch><link href=/vxe-table/static/js/advanced.86a7a5a6.js rel=prefetch><link href=/vxe-table/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree.5876e77c.js rel=prefetch><link href=/vxe-table/static/js/api.76bda782.js rel=prefetch><link href=/vxe-table/static/js/base.8c383018.js rel=prefetch><link href=/vxe-table/static/js/edit.422e331c.js rel=prefetch><link href=/vxe-table/static/js/excel.dff6f647.js rel=prefetch><link href=/vxe-table/static/js/excel~other.ea9cbdaa.js rel=prefetch><link href=/vxe-table/static/js/grid.f4225081.js rel=prefetch><link href=/vxe-table/static/js/module.e565f9da.js rel=prefetch><link href=/vxe-table/static/js/optimize.1c77ebf1.js rel=prefetch><link href=/vxe-table/static/js/other.d5e76ad2.js rel=prefetch><link href=/vxe-table/static/js/plugin.e9e456ca.js rel=prefetch><link href=/vxe-table/static/js/scroll.71d9be65.js rel=prefetch><link href=/vxe-table/static/js/start.d49663a9.js rel=prefetch><link href=/vxe-table/static/js/tree.8a136908.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.cce7c562.css rel=preload as=style><link href=/vxe-table/static/css/index.f968c214.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.02a79b9b.js rel=preload as=script><link href=/vxe-table/static/js/index.84b28926.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.cce7c562.css rel=stylesheet><link href=/vxe-table/static/css/index.f968c214.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.02a79b9b.js></script><script src=/vxe-table/static/js/index.84b28926.js></script></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

102 changes: 59 additions & 43 deletions lib/edit/src/methods.js
Expand Up @@ -278,8 +278,7 @@ var _default = {
var row = params.row,
column = params.column,
cell = params.cell;
var model = column.model,
editRender = column.editRender;
var editRender = column.editRender;

if (editRender && cell) {
if (actived.row !== row || (editConfig.mode === 'cell' ? actived.column !== column : false)) {
Expand All @@ -303,14 +302,10 @@ var _default = {

if (editConfig.mode === 'row') {
tableColumn.forEach(function (column) {
if (column.editRender) {
column.model.value = _tools.UtilTools.getCellValue(row, column);
column.model.update = false;
}
return _this4._getColumnModel(row, column);
});
} else {
model.value = _tools.UtilTools.getCellValue(row, column);
model.update = false;
this._getColumnModel(row, column);
}

this.$nextTick(function () {
Expand Down Expand Up @@ -343,39 +338,60 @@ var _default = {

return this.$nextTick();
},
_getColumnModel: function _getColumnModel(row, column) {
var model = column.model,
editRender = column.editRender;

if (editRender) {
model.value = _tools.UtilTools.getCellValue(row, column);
model.update = false;
}
},
_setColumnModel: function _setColumnModel(row, column) {
var model = column.model,
editRender = column.editRender;

if (editRender) {
_tools.UtilTools.setCellValue(row, column, model.value);

model.update = false;
model.value = null;
}
},

/**
* 清除激活的编辑
*/
_clearActived: function _clearActived(evnt) {
var editStore = this.editStore;
var _this5 = this;

var tableColumn = this.tableColumn,
editStore = this.editStore,
_this$editConfig = this.editConfig,
editConfig = _this$editConfig === void 0 ? {} : _this$editConfig;
var actived = editStore.actived;
var args = actived.args,
row = actived.row,
column = actived.column;

if (row || column) {
var model = column.model;

if (model.update) {
_tools.UtilTools.setCellValue(row, column, model.value);

model.update = false;
model.value = null;
this.updateFooter();
if (editConfig.mode === 'row') {
tableColumn.forEach(function (column) {
return _this5._setColumnModel(row, column);
});
} else {
this._setColumnModel(row, column);
}

this.updateFooter();

_tools.UtilTools.emitEvent(this, 'edit-closed', [args, evnt]);
}

actived.args = null;
actived.row = null;
actived.column = null;
return this.clearValidate().then(function () {
return row || column ? new Promise(function (resolve) {
return setTimeout(resolve);
}) : 0;
}).then(this.recalculate);
return this.clearValidate().then(this.recalculate);
},
_getActiveRow: function _getActiveRow() {
var $el = this.$el,
Expand Down Expand Up @@ -444,36 +460,36 @@ var _default = {
* 激活单元格编辑
*/
_setActiveCell: function _setActiveCell(row, field) {
var _this5 = this;
var _this6 = this;

return this.scrollToRow(row, true).then(function () {
if (row && field) {
var column = _this5.visibleColumn.find(function (column) {
var column = _this6.visibleColumn.find(function (column) {
return column.property === field;
});

if (column && column.editRender) {
var cell = _tools.DomTools.getCell(_this5, {
var cell = _tools.DomTools.getCell(_this6, {
row: row,
column: column
});

if (cell) {
_this5.handleActived({
_this6.handleActived({
row: row,
rowIndex: _this5.getRowIndex(row),
rowIndex: _this6.getRowIndex(row),
column: column,
columnIndex: _this5.getColumnIndex(column),
columnIndex: _this6.getColumnIndex(column),
cell: cell,
$table: _this5
$table: _this6
});

_this5.lastCallTime = Date.now();
_this6.lastCallTime = Date.now();
}
}
}

return _this5.$nextTick();
return _this6.$nextTick();
});
},

Expand Down Expand Up @@ -516,7 +532,7 @@ var _default = {
* 处理选中源
*/
handleSelected: function handleSelected(params, evnt) {
var _this6 = this;
var _this7 = this;

var _this$mouseConfig = this.mouseConfig,
mouseConfig = _this$mouseConfig === void 0 ? {} : _this$mouseConfig,
Expand All @@ -532,17 +548,17 @@ var _default = {
var selectMethod = function selectMethod() {
if (selected.row !== row || selected.column !== column) {
if (actived.row !== row || (editConfig.mode === 'cell' ? actived.column !== column : false)) {
if (_this6.keyboardConfig || _this6.mouseConfig) {
_this6.clearChecked(evnt);
if (_this7.keyboardConfig || _this7.mouseConfig) {
_this7.clearChecked(evnt);

_this6.clearIndexChecked();
_this7.clearIndexChecked();

_this6.clearHeaderChecked();
_this7.clearHeaderChecked();

_this6.clearSelected(evnt);
_this7.clearSelected(evnt);
}

_this6.clearActived(evnt);
_this7.clearActived(evnt);

selected.args = params;
selected.row = row;
Expand All @@ -551,7 +567,7 @@ var _default = {
if (mouseConfig.selected) {
var listElem = elemStore['main-body-list'];

var rowid = _tools.UtilTools.getRowid(_this6, row);
var rowid = _tools.UtilTools.getRowid(_this7, row);

var trElem = listElem.querySelector("[data-rowid=\"".concat(rowid, "\"]"));
var tdElem = trElem.querySelector(".".concat(column.id));
Expand All @@ -563,18 +579,18 @@ var _default = {
if (mouseConfig.checked) {
var headerElem = elemStore['main-header-list'];

_this6.handleChecked([[cell]]);
_this7.handleChecked([[cell]]);

if (headerElem) {
_this6.handleHeaderChecked([[headerElem.querySelector(".".concat(column.id))]]);
_this7.handleHeaderChecked([[headerElem.querySelector(".".concat(column.id))]]);
}

_this6.handleIndexChecked([[cell.parentNode.querySelector('.col--index')]]);
_this7.handleIndexChecked([[cell.parentNode.querySelector('.col--index')]]);
}
}
}

return _this6.$nextTick();
return _this7.$nextTick();
};

return selectMethod();
Expand Down

0 comments on commit 3117c5c

Please sign in to comment.