@progress/kendo-angular-inputs
Version:
Kendo UI for Angular Inputs Package - Everything you need to build professional form functionality (Checkbox, ColorGradient, ColorPalette, ColorPicker, FlatColorPicker, FormField, MaskedTextBox, NumericTextBox, RadioButton, RangeSlider, Slider, Switch, Te
151 lines (150 loc) • 6.29 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Subscription } from 'rxjs';
import { HostBinding, Input, Output, ViewChild, ElementRef, EventEmitter, NgZone, Renderer2, ChangeDetectorRef, Injector, Component } from '@angular/core';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { requiresZoneOnBlur } from '../common/utils';
import { hasObservers } from '@progress/kendo-angular-common';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
/**
* @hidden
*/
export class TextFieldsBase {
localizationService;
ngZone;
changeDetector;
renderer;
injector;
hostElement;
/**
* Sets the `title` attribute of the internal textarea input element of the component.
*/
title = '';
/**
* Sets the disabled state of the TextArea component. To learn how to disable the component in reactive forms, refer to the article on [Forms Support](slug:formssupport_textarea#toc-managing-the-textarea-disabled-state-in-reactive-forms).
*
* @default false
*/
disabled = false;
/**
* Sets the read-only state of the TextArea component.
*
* @default false
*/
readonly = false;
/**
* Provides a value for the TextArea component.
*/
value = null;
/**
* Determines whether the whole value will be selected when the TextArea is clicked. Defaults to `false`.
*
* @default false
*/
selectOnFocus = false;
/**
* The hint, which is displayed when the Textarea is empty.
*/
placeholder;
/**
* Fires each time the user focuses the internal textarea element of the component.
* This event is useful when you need to distinguish between focusing the textarea element and focusing one of its adornments.
*/
inputFocus = new EventEmitter();
/**
* Fires each time the internal textarea element gets blurred.
* This event is useful when adornments are used, in order to distinguish between blurring the textarea element and blurring the whole TextArea component.
*/
inputBlur = new EventEmitter();
/**
* Represents the visible textarea element of the component.
*/
input;
get disabledClass() {
return this.disabled;
}
direction;
/**
* @hidden
*/
control;
subscriptions = new Subscription();
_isFocused = false;
focusChangedProgrammatically = false;
constructor(localizationService, ngZone, changeDetector, renderer, injector, hostElement) {
this.localizationService = localizationService;
this.ngZone = ngZone;
this.changeDetector = changeDetector;
this.renderer = renderer;
this.injector = injector;
this.hostElement = hostElement;
}
ngOnDestroy() {
this.subscriptions.unsubscribe();
}
/**
* @hidden
*/
handleInputBlur = () => {
this.changeDetector.markForCheck();
if (hasObservers(this.inputBlur) || requiresZoneOnBlur(this.control)) {
this.ngZone.run(() => {
this.ngTouched();
this.inputBlur.emit();
});
}
};
/**
* @hidden
* Called when the status of the component changes to or from `disabled`.
* Depending on the value, it enables or disables the appropriate DOM element.
*
* @param isDisabled
*/
setDisabledState(isDisabled) {
this.changeDetector.markForCheck();
this.disabled = isDisabled;
}
ngChange = (_) => { };
ngTouched = () => { };
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextFieldsBase, deps: [{ token: i1.LocalizationService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextFieldsBase, selector: "kendo-textfield-base", inputs: { title: "title", disabled: "disabled", readonly: "readonly", value: "value", selectOnFocus: "selectOnFocus", placeholder: "placeholder" }, outputs: { inputFocus: "inputFocus", inputBlur: "inputBlur" }, host: { properties: { "class.k-readonly": "this.readonly", "class.k-disabled": "this.disabledClass", "attr.dir": "this.direction" } }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextFieldsBase, decorators: [{
type: Component,
args: [{
selector: 'kendo-textfield-base',
template: ``
}]
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i0.ElementRef }]; }, propDecorators: { title: [{
type: Input
}], disabled: [{
type: Input
}], readonly: [{
type: Input
}, {
type: HostBinding,
args: ['class.k-readonly']
}], value: [{
type: Input
}], selectOnFocus: [{
type: Input
}], placeholder: [{
type: Input
}], inputFocus: [{
type: Output
}], inputBlur: [{
type: Output
}], input: [{
type: ViewChild,
args: ['input', { static: true }]
}], disabledClass: [{
type: HostBinding,
args: ['class.k-disabled']
}], direction: [{
type: HostBinding,
args: ['attr.dir']
}] } });