From 83188534676a403f3edd548ff2f5dec2b0344c73 Mon Sep 17 00:00:00 2001 From: Vildan Softic Date: Mon, 23 Sep 2024 20:49:13 +0200 Subject: [PATCH] fix: allowInput instead of allowEdit https://github.com/ghiscoding/slickgrid-universal/issues/1684 --- packages/common/src/editors/__tests__/dateEditor.spec.ts | 8 ++++---- packages/common/src/editors/dateEditor.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/common/src/editors/__tests__/dateEditor.spec.ts b/packages/common/src/editors/__tests__/dateEditor.spec.ts index 48a33f4ba..e0565c8f6 100644 --- a/packages/common/src/editors/__tests__/dateEditor.spec.ts +++ b/packages/common/src/editors/__tests__/dateEditor.spec.ts @@ -147,15 +147,15 @@ describe('DateEditor', () => { const event = new KeyboardEvent('keydown', { key: 'Enter' }); editor.editorDomElement.dispatchEvent(event); - expect(editor.columnEditor.editorOptions?.allowEdit).toBeFalsy(); + expect(editor.columnEditor.editorOptions?.allowInput).toBeFalsy(); expect(editor.isValueTouched()).toBeFalsy(); }); - it('should stop propagation on allowEdit when hitting left or right arrow keys', () => { + it('should stop propagation on allowInput when hitting left or right arrow and home and end keys', () => { editor = new DateEditor({ ...editorArguments, column: { ...editorArguments.column, editor: { ...editorArguments.column.editor, - editorOptions: { ...editorArguments.column?.editor?.editorOptions, allowEdit: true } + editorOptions: { ...editorArguments.column?.editor?.editorOptions, allowInput: true } }}}); let event = new KeyboardEvent('keydown', { key: 'ArrowLeft' }); @@ -300,7 +300,7 @@ describe('DateEditor', () => { editor = new DateEditor({...editorArguments, column: { ...mockColumn, editor: { ...editorArguments.column.editor, alwaysSaveOnEnterKey: true, - editorOptions: { ...editorArguments.column.editor?.editorOptions, allowEdit: true} + editorOptions: { ...editorArguments.column.editor?.editorOptions, allowInput: true} } } }); const event = new KeyboardEvent('keydown', { key: 'Enter' }); diff --git a/packages/common/src/editors/dateEditor.ts b/packages/common/src/editors/dateEditor.ts index 4749bd27e..e073d80e3 100644 --- a/packages/common/src/editors/dateEditor.ts +++ b/packages/common/src/editors/dateEditor.ts @@ -186,7 +186,7 @@ export class DateEditor implements Editor { title: this.columnEditor && this.columnEditor.title || '', className: inputCssClasses.replace(/\./g, ' '), dataset: { input: '', defaultdate: this.defaultDate }, - readOnly: this.columnEditor.editorOptions?.allowEdit === true ? true : false, + readOnly: this.columnEditor.editorOptions?.allowInput === true ? false : true, }, this._editorInputGroupElm ); @@ -204,7 +204,7 @@ export class DateEditor implements Editor { } this._bindEventService.bind(this._inputElm, 'keydown', ((event: KeyboardEvent) => { - if (this.columnEditor.editorOptions?.allowEdit !== true) { + if (this.columnEditor.editorOptions?.allowInput !== true) { return; } @@ -363,7 +363,7 @@ export class DateEditor implements Editor { const elmDateStr = this.getValue(); const lastEventKey = this._lastInputKeyEvent?.key; - if (this.columnEditor.editorOptions?.allowEdit === true && + if (this.columnEditor.editorOptions?.allowInput === true && this.columnEditor?.alwaysSaveOnEnterKey && lastEventKey === 'Enter') { return true; }