diff --git a/packages/common/src/editors/autoCompleteEditor.ts b/packages/common/src/editors/autoCompleteEditor.ts index 2d88bf229..1d88ab335 100644 --- a/packages/common/src/editors/autoCompleteEditor.ts +++ b/packages/common/src/editors/autoCompleteEditor.ts @@ -36,14 +36,14 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class AutoCompleteEditor implements Editor { - private _autoCompleteOptions: AutocompleteOption; - private _currentValue: any; - private _defaultTextValue: string; - private _elementCollection: any[] | null; - private _lastInputKeyEvent: JQuery.Event; + protected _autoCompleteOptions: AutocompleteOption; + protected _currentValue: any; + protected _defaultTextValue: string; + protected _elementCollection: any[] | null; + protected _lastInputKeyEvent: JQuery.Event; /** The JQuery DOM element */ - private _$editorElm: any; + protected _$editorElm: any; /** is the Editor disabled? */ disabled = false; @@ -68,7 +68,7 @@ export class AutoCompleteEditor implements Editor { /** Final collection displayed in the UI, that is after processing filter/sort/override */ finalCollection: any[] = []; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -365,7 +365,7 @@ export class AutoCompleteEditor implements Editor { } // - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ @@ -399,7 +399,7 @@ export class AutoCompleteEditor implements Editor { ); } - // this function should be PRIVATE but for unit tests purposes we'll make it public until a better solution is found + // this function should be protected but for unit tests purposes we'll make it public until a better solution is found // a better solution would be to get the autocomplete DOM element to work with selection but I couldn't find how to do that in Jest onSelect(event: Event, ui: { item: any; }) { if (ui && ui.item) { diff --git a/packages/common/src/editors/checkboxEditor.ts b/packages/common/src/editors/checkboxEditor.ts index 92222a0f3..52c93ff44 100644 --- a/packages/common/src/editors/checkboxEditor.ts +++ b/packages/common/src/editors/checkboxEditor.ts @@ -11,10 +11,10 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class CheckboxEditor implements Editor { - private _bindEventService: BindingEventService; - private _input: HTMLInputElement | null; - private _checkboxContainerElm: HTMLDivElement; - private _originalValue?: boolean | string; + protected _bindEventService: BindingEventService; + protected _input: HTMLInputElement | null; + protected _checkboxContainerElm: HTMLDivElement; + protected _originalValue?: boolean | string; /** is the Editor disabled? */ disabled = false; @@ -25,7 +25,7 @@ export class CheckboxEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -246,17 +246,17 @@ export class CheckboxEditor implements Editor { } // -- - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; diff --git a/packages/common/src/editors/dateEditor.ts b/packages/common/src/editors/dateEditor.ts index 615bd252d..0809056c5 100644 --- a/packages/common/src/editors/dateEditor.ts +++ b/packages/common/src/editors/dateEditor.ts @@ -31,13 +31,13 @@ declare const Slick: SlickNamespace; * https://chmln.github.io/flatpickr */ export class DateEditor implements Editor { - private _$inputWithData: any; - private _$input: any; - private _$editorInputElm: any; - private _$closeButtonGroupElm: any; - private _lastTriggeredByClearDate = false; - private _originalDate: string; - private _pickerMergedOptions: FlatpickrOption; + protected _$inputWithData: any; + protected _$input: any; + protected _$editorInputElm: any; + protected _$closeButtonGroupElm: any; + protected _lastTriggeredByClearDate = false; + protected _originalDate: string; + protected _pickerMergedOptions: FlatpickrOption; flatInstance: FlatpickrInstance; defaultDate: string; @@ -54,7 +54,7 @@ export class DateEditor implements Editor { /** The translate library */ protected _translaterService: TranslaterService; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -378,17 +378,17 @@ export class DateEditor implements Editor { } // - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleOnDateChange() { + protected handleOnDateChange() { if (this.args) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { @@ -400,7 +400,7 @@ export class DateEditor implements Editor { setTimeout(() => this._lastTriggeredByClearDate = false); // reset flag after a cycle } - private handleChangeOnCompositeEditor(compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; diff --git a/packages/common/src/editors/dualInputEditor.ts b/packages/common/src/editors/dualInputEditor.ts index 629f53fc8..8ab301243 100644 --- a/packages/common/src/editors/dualInputEditor.ts +++ b/packages/common/src/editors/dualInputEditor.ts @@ -27,17 +27,17 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class DualInputEditor implements Editor { - private _bindEventService: BindingEventService; - private _eventHandler: SlickEventHandler; - private _isValueSaveCalled = false; - private _lastEventType: string | undefined; - private _lastInputKeyEvent: KeyboardEvent; - private _leftInput: HTMLInputElement; - private _rightInput: HTMLInputElement; - private _leftFieldName: string; - private _rightFieldName: string; - private _originalLeftValue: string | number; - private _originalRightValue: string | number; + protected _bindEventService: BindingEventService; + protected _eventHandler: SlickEventHandler; + protected _isValueSaveCalled = false; + protected _lastEventType: string | undefined; + protected _lastInputKeyEvent: KeyboardEvent; + protected _leftInput: HTMLInputElement; + protected _rightInput: HTMLInputElement; + protected _leftFieldName: string; + protected _rightFieldName: string; + protected _originalLeftValue: string | number; + protected _originalRightValue: string | number; /** is the Editor disabled? */ disabled = false; @@ -48,7 +48,7 @@ export class DualInputEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -463,13 +463,13 @@ export class DualInputEditor implements Editor { } /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const leftInputId = this.columnEditor.params?.leftInput?.field ?? ''; @@ -499,7 +499,7 @@ export class DualInputEditor implements Editor { ); } - private handleChangeOnCompositeEditorDebounce(event: KeyboardEvent) { + protected handleChangeOnCompositeEditorDebounce(event: KeyboardEvent) { const compositeEditorOptions = this.args?.compositeEditorOptions; if (compositeEditorOptions) { const typingDelay = this.gridOptions?.editorTypingDebounce ?? 500; diff --git a/packages/common/src/editors/floatEditor.ts b/packages/common/src/editors/floatEditor.ts index c848b08ea..d01055971 100644 --- a/packages/common/src/editors/floatEditor.ts +++ b/packages/common/src/editors/floatEditor.ts @@ -14,10 +14,10 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class FloatEditor implements Editor { - private _bindEventService: BindingEventService; - private _input: HTMLInputElement | null; - private _lastInputKeyEvent: KeyboardEvent; - private _originalValue: number | string; + protected _bindEventService: BindingEventService; + protected _input: HTMLInputElement | null; + protected _lastInputKeyEvent: KeyboardEvent; + protected _originalValue: number | string; /** is the Editor disabled? */ disabled = false; @@ -28,7 +28,7 @@ export class FloatEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -295,17 +295,17 @@ export class FloatEditor implements Editor { } // -- - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; @@ -330,14 +330,14 @@ export class FloatEditor implements Editor { } /** When the input value changes (this will cover the input spinner arrows on the right) */ - private handleOnMouseWheel(event: KeyboardEvent) { + protected handleOnMouseWheel(event: KeyboardEvent) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { this.handleChangeOnCompositeEditor(event, compositeEditorOptions); } } - private handleOnInputChange(event: KeyboardEvent) { + protected handleOnInputChange(event: KeyboardEvent) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { const typingDelay = this.gridOptions?.editorTypingDebounce ?? 500; diff --git a/packages/common/src/editors/integerEditor.ts b/packages/common/src/editors/integerEditor.ts index 9f67a38a0..be2a4a5b2 100644 --- a/packages/common/src/editors/integerEditor.ts +++ b/packages/common/src/editors/integerEditor.ts @@ -12,10 +12,10 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class IntegerEditor implements Editor { - private _bindEventService: BindingEventService; - private _lastInputKeyEvent: KeyboardEvent; - private _input: HTMLInputElement | null; - private _originalValue: number | string; + protected _bindEventService: BindingEventService; + protected _lastInputKeyEvent: KeyboardEvent; + protected _input: HTMLInputElement | null; + protected _originalValue: number | string; /** is the Editor disabled? */ disabled = false; @@ -26,7 +26,7 @@ export class IntegerEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -257,17 +257,17 @@ export class IntegerEditor implements Editor { } // -- - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; @@ -292,14 +292,14 @@ export class IntegerEditor implements Editor { } /** When the input value changes (this will cover the input spinner arrows on the right) */ - private handleOnMouseWheel(event: KeyboardEvent) { + protected handleOnMouseWheel(event: KeyboardEvent) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { this.handleChangeOnCompositeEditor(event, compositeEditorOptions); } } - private handleOnInputChange(event: KeyboardEvent) { + protected handleOnInputChange(event: KeyboardEvent) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { const typingDelay = this.gridOptions?.editorTypingDebounce ?? 500; diff --git a/packages/common/src/editors/longTextEditor.ts b/packages/common/src/editors/longTextEditor.ts index 8976cb790..bbe696556 100644 --- a/packages/common/src/editors/longTextEditor.ts +++ b/packages/common/src/editors/longTextEditor.ts @@ -28,11 +28,11 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class LongTextEditor implements Editor { - private _locales: Locale; - private _$textarea: any; - private _$currentLengthElm: any; - private _$wrapper: any; - private _defaultTextValue: any; + protected _locales: Locale; + protected _$textarea: any; + protected _$currentLengthElm: any; + protected _$wrapper: any; + protected _defaultTextValue: any; /** is the Editor disabled? */ disabled = false; @@ -44,9 +44,9 @@ export class LongTextEditor implements Editor { gridOptions: GridOption; /** The translate library */ - private _translater: TranslaterService; + protected _translater: TranslaterService; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -353,17 +353,17 @@ export class LongTextEditor implements Editor { } // -- - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleKeyDown(event: KeyboardEvent) { + protected handleKeyDown(event: KeyboardEvent) { const keyCode = event.keyCode || event.code; if (!this.args.compositeEditorOptions) { @@ -387,7 +387,7 @@ export class LongTextEditor implements Editor { } /** On every input change event, we'll update the current text length counter */ - private handleOnInputChange(event: JQuery.Event & { originalEvent: any, target: HTMLTextAreaElement }) { + protected handleOnInputChange(event: JQuery.Event & { originalEvent: any, target: HTMLTextAreaElement }) { const compositeEditorOptions = this.args.compositeEditorOptions; const maxLength = this.columnEditor?.maxLength; @@ -412,7 +412,7 @@ export class LongTextEditor implements Editor { } } - private handleChangeOnCompositeEditor(event: JQuery.Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: JQuery.Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; @@ -442,7 +442,7 @@ export class LongTextEditor implements Editor { * @param maxLength - max acceptable length * @returns truncated - returns True if it truncated or False otherwise */ - private truncateText($inputElm: JQuery, maxLength: number): boolean { + protected truncateText($inputElm: JQuery, maxLength: number): boolean { const text = $inputElm.val() + ''; if (text.length > maxLength) { $inputElm.val(text.substring(0, maxLength)); diff --git a/packages/common/src/editors/multipleSelectEditor.ts b/packages/common/src/editors/multipleSelectEditor.ts index 81219cb77..841b11b42 100644 --- a/packages/common/src/editors/multipleSelectEditor.ts +++ b/packages/common/src/editors/multipleSelectEditor.ts @@ -1,10 +1,11 @@ +import { EditorArguments } from '../interfaces/editorArguments.interface'; import { SelectEditor } from './selectEditor'; export class MultipleSelectEditor extends SelectEditor { /** * Initialize the Editor */ - constructor(protected args: any) { + constructor(protected readonly args: EditorArguments) { super(args, true); } } diff --git a/packages/common/src/editors/selectEditor.ts b/packages/common/src/editors/selectEditor.ts index 1c8e111d1..904895dae 100644 --- a/packages/common/src/editors/selectEditor.ts +++ b/packages/common/src/editors/selectEditor.ts @@ -86,7 +86,7 @@ export class SelectEditor implements Editor { /** Final collection displayed in the UI, that is after processing filter/sort/override */ finalCollection: any[] = []; - constructor(protected args: EditorArguments, protected isMultipleSelect: boolean) { + constructor(protected readonly args: EditorArguments, protected readonly isMultipleSelect: boolean) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } diff --git a/packages/common/src/editors/singleSelectEditor.ts b/packages/common/src/editors/singleSelectEditor.ts index d9abcae7f..47fa62166 100644 --- a/packages/common/src/editors/singleSelectEditor.ts +++ b/packages/common/src/editors/singleSelectEditor.ts @@ -1,10 +1,11 @@ +import { EditorArguments } from '../interfaces/editorArguments.interface'; import { SelectEditor } from './selectEditor'; export class SingleSelectEditor extends SelectEditor { /** * Initialize the Editor */ - constructor(protected args: any) { + constructor(protected readonly args: EditorArguments) { super(args, false); } } diff --git a/packages/common/src/editors/sliderEditor.ts b/packages/common/src/editors/sliderEditor.ts index af30548d6..0700f9bf7 100644 --- a/packages/common/src/editors/sliderEditor.ts +++ b/packages/common/src/editors/sliderEditor.ts @@ -14,11 +14,11 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class SliderEditor implements Editor { - private _defaultValue = 0; - private _elementRangeInputId = ''; - private _elementRangeOutputId = ''; - private _$editorElm: any; - private _$input: any; + protected _defaultValue = 0; + protected _elementRangeInputId = ''; + protected _elementRangeOutputId = ''; + protected _$editorElm: any; + protected _$input: any; $sliderNumber: any; originalValue: any; @@ -31,7 +31,7 @@ export class SliderEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -65,7 +65,7 @@ export class SliderEditor implements Editor { } /** Getter for the Editor Generic Params */ - private get editorParams(): any { + protected get editorParams(): any { return this.columnEditor.params || {}; } @@ -270,13 +270,13 @@ export class SliderEditor implements Editor { } // - // private functions + // protected functions // ------------------ /** * Create the HTML template as a string */ - private buildTemplateHtmlString() { + protected buildTemplateHtmlString() { const columnId = this.columnDef?.id ?? ''; const title = this.columnEditor && this.columnEditor.title || ''; const minValue = this.columnEditor.hasOwnProperty('minValue') ? this.columnEditor.minValue : DEFAULT_MIN_VALUE; @@ -306,13 +306,13 @@ export class SliderEditor implements Editor { } /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; diff --git a/packages/common/src/editors/textEditor.ts b/packages/common/src/editors/textEditor.ts index f9a3c6f22..30078ec41 100644 --- a/packages/common/src/editors/textEditor.ts +++ b/packages/common/src/editors/textEditor.ts @@ -12,10 +12,10 @@ declare const Slick: SlickNamespace; * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter. */ export class TextEditor implements Editor { - private _bindEventService: BindingEventService; - private _lastInputKeyEvent: KeyboardEvent; - private _input: HTMLInputElement | null; - private _originalValue: string; + protected _bindEventService: BindingEventService; + protected _lastInputKeyEvent: KeyboardEvent; + protected _input: HTMLInputElement | null; + protected _originalValue: string; /** is the Editor disabled? */ disabled = false; @@ -26,7 +26,7 @@ export class TextEditor implements Editor { /** Grid options */ gridOptions: GridOption; - constructor(private args: EditorArguments) { + constructor(protected readonly args: EditorArguments) { if (!args) { throw new Error('[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.'); } @@ -246,17 +246,17 @@ export class TextEditor implements Editor { } // -- - // private functions + // protected functions // ------------------ /** when it's a Composite Editor, we'll check if the Editor is editable (by checking onBeforeEditCell) and if not Editable we'll disable the Editor */ - private applyInputUsabilityState() { + protected applyInputUsabilityState() { const activeCell = this.grid.getActiveCell(); const isCellEditable = this.grid.onBeforeEditCell.notify({ ...activeCell, item: this.args.item, column: this.args.column, grid: this.grid }); this.disable(isCellEditable === false); } - private handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { + protected handleChangeOnCompositeEditor(event: Event | null, compositeEditorOptions: CompositeEditorOption, triggeredBy: 'user' | 'system' = 'user') { const activeCell = this.grid.getActiveCell(); const column = this.args.column; const columnId = this.columnDef?.id ?? ''; @@ -280,7 +280,7 @@ export class TextEditor implements Editor { ); } - private handleOnInputChange(event: KeyboardEvent) { + protected handleOnInputChange(event: KeyboardEvent) { const compositeEditorOptions = this.args.compositeEditorOptions; if (compositeEditorOptions) { const typingDelay = this.gridOptions?.editorTypingDebounce ?? 500;