Skip to content

Commit

Permalink
fix: allowInput instead of allowEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
zewa666 committed Sep 23, 2024
1 parent 265a04f commit 8318853
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/common/src/editors/__tests__/dateEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down Expand Up @@ -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' });
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/editors/dateEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8318853

Please sign in to comment.