|
@@ -27,7 +27,7 @@ let contentOprObj = {
|
|
|
const EVENTS = GC.Spread.Sheets.Events;
|
|
|
workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
|
|
|
sheet.bind(EVENTS.EditStarting, me.onEditStart);
|
|
|
- sheet.bind(EVENTS.EditEnded, me.onEditEnded);
|
|
|
+ sheet.bind(EVENTS.ValueChanged, me.onValueChanged);
|
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
|
sheet.bind(EVENTS.SelectionChanged, me.onSelectionChanged);
|
|
@@ -145,10 +145,12 @@ let contentOprObj = {
|
|
|
me.workBook.focus();
|
|
|
},
|
|
|
//更新
|
|
|
- updateContent: function (job, newContent) {
|
|
|
+ updateContent: function (job, newContent, save = true) {
|
|
|
let me = contentOprObj;
|
|
|
job.content = newContent;
|
|
|
- me.save();
|
|
|
+ if(save){
|
|
|
+ me.save();
|
|
|
+ }
|
|
|
},
|
|
|
//新增
|
|
|
insertContent: function (sheet, idx, content) {
|
|
@@ -172,15 +174,16 @@ let contentOprObj = {
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
- onEditEnded: function (sender, args) {
|
|
|
+ onValueChanged: function (sender, args) {
|
|
|
let me = contentOprObj;
|
|
|
if(me.setting.header[args.col].dataCode === 'isChecked'){
|
|
|
return;
|
|
|
}
|
|
|
- args.editingText = args.editingText ? args.editingText : '';
|
|
|
+ args.newValue = args.newValue ? args.newValue : '';
|
|
|
//更新
|
|
|
- if(args.row < me.currentCache.length ){
|
|
|
- me.updateContent(me.currentCache[args.row], args.editingText);
|
|
|
+ if(args.row < me.currentCache.length){
|
|
|
+ let job = me.currentCache[args.row];
|
|
|
+ me.updateContent(job, args.newValue);
|
|
|
}
|
|
|
|
|
|
},
|
|
@@ -236,13 +239,18 @@ let contentOprObj = {
|
|
|
onClipboardPasted: function (sender, args) {
|
|
|
let me = contentOprObj;
|
|
|
let items = sheetCommonObj.analyzePasteData(me.setting, args);
|
|
|
+ let toSave = false;
|
|
|
for(let i = 0, len = items.length; i < len; i++){
|
|
|
let rowIdx = args.cellRange.row + i;
|
|
|
//更新
|
|
|
if(rowIdx < me.currentCache.length){
|
|
|
- me.updateContent(me.currentCache[rowIdx], items[i].content);
|
|
|
+ toSave = true;
|
|
|
+ me.updateContent(me.currentCache[rowIdx], items[i].content, false);
|
|
|
}
|
|
|
}
|
|
|
+ if(toSave){
|
|
|
+ me.save();
|
|
|
+ }
|
|
|
},
|
|
|
onSelectionChanged: function (sender, args) {
|
|
|
let me = contentOprObj;
|
|
@@ -411,7 +419,7 @@ let characterOprObj = {
|
|
|
const EVENTS = GC.Spread.Sheets.Events;
|
|
|
workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
|
|
|
sheet.bind(EVENTS.EnterCell, me.onEnterCell);
|
|
|
- sheet.bind(EVENTS.EditEnded, me.onEditEnded);
|
|
|
+ sheet.bind(EVENTS.ValueChanged, me.onValueChanged);
|
|
|
sheet.bind(EVENTS.EditStarting, me.onEditStart);
|
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
@@ -604,7 +612,7 @@ let characterOprObj = {
|
|
|
let newValue = {value: value, isSelected: true};
|
|
|
item.eigenvalue.push(newValue);
|
|
|
},
|
|
|
- updateCharacter: function (item, character, value) {
|
|
|
+ updateCharacter: function (item, character, value, save = true) {
|
|
|
let me = characterOprObj;
|
|
|
if(character !== undefined && character !== null){
|
|
|
item.character = character;
|
|
@@ -634,7 +642,9 @@ let characterOprObj = {
|
|
|
me.unsetSelected(item);
|
|
|
}
|
|
|
}
|
|
|
- me.save();
|
|
|
+ if(save){
|
|
|
+ me.save();
|
|
|
+ }
|
|
|
},
|
|
|
insertCharacter: function (sheet, idx, character) {
|
|
|
let me = characterOprObj;
|
|
@@ -663,18 +673,17 @@ let characterOprObj = {
|
|
|
onEnterCell: function (sender, args) {
|
|
|
args.sheet.repaint();
|
|
|
},
|
|
|
- onEditEnded: function (sender, args) {
|
|
|
- let me = characterOprObj, characterTxt;
|
|
|
- let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
- args.editingText = args.editingText ? args.editingText : '';
|
|
|
+ onValueChanged: function (sender, args) {
|
|
|
+ let me = characterOprObj;
|
|
|
+ args.newValue = args.newValue ? args.newValue : '';
|
|
|
//更新
|
|
|
if(args.row < me.currentCache.length){
|
|
|
let thisCha = me.currentCache[args.row];
|
|
|
if(args.col === 0){//特征
|
|
|
- me.updateCharacter(thisCha, args.editingText, null);
|
|
|
+ me.updateCharacter(thisCha, args.newValue, null);
|
|
|
}
|
|
|
else if(args.col === 1){//特征值
|
|
|
- me.updateCharacter(thisCha, null, args.editingText);
|
|
|
+ me.updateCharacter(thisCha, null, args.newValue);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -689,13 +698,18 @@ let characterOprObj = {
|
|
|
onClipboardPasted: function (sender, args) {
|
|
|
let me = characterOprObj;
|
|
|
let items = sheetCommonObj.analyzePasteData(me.setting, args);
|
|
|
+ let toSave = false;
|
|
|
for(let i = 0, len = items.length; i < len; i++){
|
|
|
//更新
|
|
|
let rowIdx = args.cellRange.row + i;
|
|
|
if(me.currentCache.length > rowIdx){
|
|
|
- me.updateCharacter(me.currentCache[rowIdx], items[i].character, items[i].eigenvalue);
|
|
|
+ toSave = true;
|
|
|
+ me.updateCharacter(me.currentCache[rowIdx], items[i].character, items[i].eigenvalue, false);
|
|
|
}
|
|
|
}
|
|
|
+ if(toSave){
|
|
|
+ me.save();
|
|
|
+ }
|
|
|
},
|
|
|
onRangeChanged: function (sender, args) {
|
|
|
let me = characterOprObj;
|