Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ describe('AutoCompleteEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_A, bubbles: true, cancelable: true });

editor = new AutoCompleteEditor(editorArguments);
editor.setValue('z');
const editorElm = divContainer.querySelector<HTMLInputElement>('input.editor-gender');

editorElm.focus();
Expand Down Expand Up @@ -362,6 +363,7 @@ describe('AutoCompleteEditor', () => {
const spy = jest.spyOn(gridStub.getEditorLock(), 'commitCurrentEdit');

editor = new AutoCompleteEditor(editorArguments);
editor.setValue('a');
editor.save();

expect(spy).toHaveBeenCalled();
Expand All @@ -372,6 +374,7 @@ describe('AutoCompleteEditor', () => {
const spy = jest.spyOn(editorArguments, 'commitChanges');

editor = new AutoCompleteEditor(editorArguments);
editor.setValue('a');
editor.save();

expect(spy).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ describe('DualInputEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_0, bubbles: true, cancelable: true });

editor = new DualInputEditor(editorArguments);
editor.setValues(['9', '9']);
const editorElm = divContainer.querySelector<HTMLInputElement>('input.editor-range');

editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ describe('FloatEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_0, bubbles: true, cancelable: true });

editor = new FloatEditor(editorArguments);
editor.setValue(9);
const editorElm = divContainer.querySelector<HTMLInputElement>('input.editor-price');

editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ describe('IntegerEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_0, bubbles: true, cancelable: true });

editor = new IntegerEditor(editorArguments);
editor.setValue(9);
const editorElm = divContainer.querySelector<HTMLInputElement>('input.editor-price');

editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ describe('LongTextEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_A, bubbles: true, cancelable: true });

editor = new LongTextEditor(editorArguments);
editor.setValue('z');
const editorElm = document.body.querySelector<HTMLTextAreaElement>('.editor-title textarea');

editor.focus();
Expand All @@ -237,6 +238,7 @@ describe('LongTextEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KeyCode.ENTER, bubbles: true, cancelable: true });

editor = new LongTextEditor(editorArguments);
editor.setValue('a');
const editorElm = document.body.querySelector<HTMLTextAreaElement>('.editor-title textarea');

editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ describe('TextEditor', () => {
const event = new (window.window as any).KeyboardEvent('keydown', { keyCode: KEY_CHAR_A, bubbles: true, cancelable: true });

editor = new TextEditor(editorArguments);
editor.setValue('z');
const editorElm = divContainer.querySelector<HTMLInputElement>('input.editor-title');

editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@ export class AutoCompleteEditor implements Editor {
}

isValueChanged(): boolean {
const lastEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastEvent === KeyCode.ENTER) {
const elmValue = this._$editorElm.val();
const lastKeyEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastKeyEvent === KeyCode.ENTER) {
return true;
}
return (!(this._$editorElm.val() === '' && this._defaultTextValue === null)) && (this._$editorElm.val() !== this._defaultTextValue);
return (!(elmValue === '' && (this._defaultTextValue === null || this._defaultTextValue === undefined))) && (elmValue !== this._defaultTextValue);
}

loadValue(item: any) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/angular-slickgrid/editors/dualInputEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ export class DualInputEditor implements Editor {
if ((leftEditorParams && leftEditorParams.alwaysSaveOnEnterKey || rightEditorParams && rightEditorParams.alwaysSaveOnEnterKey) && lastKeyEvent === KeyCode.ENTER) {
return true;
}
const leftResult = (!(leftElmValue === '' && this.originalLeftValue === null)) && (leftElmValue !== this.originalLeftValue);
const rightResult = (!(rightElmValue === '' && this.originalRightValue === null)) && (rightElmValue !== this.originalRightValue);
const leftResult = (!(leftElmValue === '' && (this.originalLeftValue === null || this.originalLeftValue === undefined))) && (leftElmValue !== this.originalLeftValue);
const rightResult = (!(rightElmValue === '' && (this.originalRightValue === null || this.originalRightValue === undefined))) && (rightElmValue !== this.originalRightValue);
return leftResult || rightResult;
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/modules/angular-slickgrid/editors/floatEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ export class FloatEditor implements Editor {
}
}

isValueChanged() {
isValueChanged(): boolean {
const elmValue = this._$input.val();
const lastEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastEvent === KeyCode.ENTER) {
const lastKeyEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastKeyEvent === KeyCode.ENTER) {
return true;
}
return (!(elmValue === '' && this.originalValue === null)) && (elmValue !== this.originalValue);
return (!(elmValue === '' && (this.originalValue === null || this.originalValue === undefined))) && (elmValue !== this.originalValue);
}

loadValue(item: any) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/modules/angular-slickgrid/editors/integerEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ export class IntegerEditor implements Editor {
}
}

isValueChanged() {
isValueChanged(): boolean {
const elmValue = this._$input.val();
const lastEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastEvent === KeyCode.ENTER) {
const lastKeyEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastKeyEvent === KeyCode.ENTER) {
return true;
}
return (!(elmValue === '' && this.originalValue === null)) && (elmValue !== this.originalValue);
return (!(elmValue === '' && (this.originalValue === null || this.originalValue === undefined))) && (elmValue !== this.originalValue);
}

loadValue(item: any) {
Expand Down
5 changes: 3 additions & 2 deletions src/app/modules/angular-slickgrid/editors/longTextEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ export class LongTextEditor implements Editor {
}
}

isValueChanged() {
return (!(this._$textarea.val() === '' && this.defaultValue === null)) && (this._$textarea.val() !== this.defaultValue);
isValueChanged(): boolean {
const elmValue = this._$textarea.val();
return (!(elmValue === '' && (this.defaultValue === null || this.defaultValue === undefined))) && (elmValue !== this.defaultValue);
}

loadValue(item: any) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/modules/angular-slickgrid/editors/textEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ export class TextEditor implements Editor {
}
}

isValueChanged() {
isValueChanged(): boolean {
const elmValue = this._$input.val();
const lastEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastEvent === KeyCode.ENTER) {
const lastKeyEvent = this._lastInputEvent && this._lastInputEvent.keyCode;
if (this.columnEditor && this.columnEditor.alwaysSaveOnEnterKey && lastKeyEvent === KeyCode.ENTER) {
return true;
}
return (!(elmValue === '' && this.originalValue === null)) && (elmValue !== this.originalValue);
return (!(elmValue === '' && (this.originalValue === null || this.originalValue === undefined))) && (elmValue !== this.originalValue);
}

loadValue(item: any) {
Expand Down