|
@@ -170,10 +170,42 @@ let repositoryGljObj = {
|
|
cacheSection = null;
|
|
cacheSection = null;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ bindEnterKey: function () {
|
|
|
|
+ let me = this;
|
|
|
|
+ let sheet = me.workBook.getActiveSheet();
|
|
|
|
+ me.workBook.commandManager().register("myEnter", function(){
|
|
|
|
+ let orgRow = sheet.getActiveRowIndex();
|
|
|
|
+ let orgCol = sheet.getActiveColumnIndex();
|
|
|
|
+ if(sheet.isEditing()){
|
|
|
|
+ sheet.endEdit();
|
|
|
|
+ }
|
|
|
|
+ let code = sheet.getValue(orgRow, 0);
|
|
|
|
+ let newRow, newCol;
|
|
|
|
+ if(!me.currentCache[orgRow] && code !== undefined && code !== null && orgCol !== me.setting.header.length - 1){
|
|
|
|
+ newRow = orgRow;
|
|
|
|
+ newCol = orgCol + 1;
|
|
|
|
+ sheet.setActiveCell(newRow, newCol);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ newRow = orgRow + 1;
|
|
|
|
+ newCol = me.currentCache[orgRow + 1] ? orgCol : 0;
|
|
|
|
+ sheet.setActiveCell(newRow, newCol);
|
|
|
|
+ }
|
|
|
|
+ //触发事件
|
|
|
|
+ //me.onLeaveCell({type: 'LeaveCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: orgRow, col: orgCol});
|
|
|
|
+ me.onEnterCell({type: 'EnterCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: newRow, col: newCol});
|
|
|
|
+ let newSels = [{row: newRow, rowCount: 1, col: newCol, colCount: 1}];
|
|
|
|
+ let oldSels = [{row: orgRow, rowCount: 1, col: orgRow, colCount: 1}];
|
|
|
|
+ me.onSelectionChanged({type: 'SelectionChanged'}, {sheet: sheet, sheetName: sheet.name(), newSelections: newSels, oldSelections: oldSels});
|
|
|
|
+ });
|
|
|
|
+ me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.enter, false, false, false, false);
|
|
|
|
+ me.workBook.commandManager().setShortcutKey("myEnter", GC.Spread.Commands.Key.enter, false, false, false, false);
|
|
|
|
+ },
|
|
buildSheet: function(container) {
|
|
buildSheet: function(container) {
|
|
let me = repositoryGljObj;
|
|
let me = repositoryGljObj;
|
|
me.workBook = sheetOpr.buildSheet(container, me.setting, 30);
|
|
me.workBook = sheetOpr.buildSheet(container, me.setting, 30);
|
|
me.repositoryGljDelOpr();
|
|
me.repositoryGljDelOpr();
|
|
|
|
+ me.bindEnterKey();
|
|
me.setUnitCombo(me.workBook.getActiveSheet(), me.setting.header);
|
|
me.setUnitCombo(me.workBook.getActiveSheet(), me.setting.header);
|
|
me.workBook.getActiveSheet().bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
|
|
me.workBook.getActiveSheet().bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
|
|
me.workBook.getActiveSheet().bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
|
|
me.workBook.getActiveSheet().bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
|