Skip to content

Commit

Permalink
fix: provide input type directly in constructor before init() is called
Browse files Browse the repository at this point in the history
- after testing in the UI with Input Password Editor, I found out that the init() was being called before the inputType setter and so the Editor DOM element was being created with text instead of password because the setter came afterward
  • Loading branch information
ghiscoding committed May 28, 2021
1 parent c06b512 commit e89c3bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/common/src/editors/floatEditor.ts
Expand Up @@ -8,8 +8,7 @@ const DEFAULT_DECIMAL_PLACES = 0;

export class FloatEditor extends InputEditor {
constructor(protected readonly args: EditorArguments) {
super(args);
this.inputType = 'number';
super(args, 'number');
}

/** Initialize the Editor */
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/editors/inputEditor.ts
Expand Up @@ -29,13 +29,14 @@ export class InputEditor implements Editor {
/** Grid options */
gridOptions: GridOption;

constructor(protected readonly args: EditorArguments) {
constructor(protected readonly args: EditorArguments, inputType: string) {
if (!args) {
throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.');
}
this.grid = args.grid;
this.gridOptions = args.grid && args.grid.getOptions() as GridOption;
this._bindEventService = new BindingEventService();
this.inputType = inputType || 'text';
this.init();
}

Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/editors/inputPasswordEditor.ts
Expand Up @@ -4,7 +4,6 @@ import { InputEditor } from './inputEditor';
export class InputPasswordEditor extends InputEditor {
/** Initialize the Editor */
constructor(protected readonly args: EditorArguments) {
super(args);
this.inputType = 'password';
super(args, 'password');
}
}
3 changes: 1 addition & 2 deletions packages/common/src/editors/integerEditor.ts
Expand Up @@ -6,8 +6,7 @@ import { getDescendantProperty } from '../services/utilities';

export class IntegerEditor extends InputEditor {
constructor(protected readonly args: EditorArguments) {
super(args);
this.inputType = 'number';
super(args, 'number');
}

/** Initialize the Editor */
Expand Down

0 comments on commit e89c3bd

Please sign in to comment.