@ng-doc/ui-kit
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
50 lines (46 loc) • 2.24 kB
JavaScript
import * as i0 from '@angular/core';
import { forwardRef, HostListener, Directive } from '@angular/core';
import { isPresent } from '@ng-doc/core/helpers/is-present';
import { NgDocBaseInput } from '@ng-doc/ui-kit/classes/base-input';
import { toElement } from '@ng-doc/ui-kit/helpers';
/** Directive converts any input data or model to text */
class NgDocInputStringDirective extends NgDocBaseInput {
constructor() {
super({
onIncomingUpdate: (value) => {
toElement(this.elementRef).value = isPresent(value) ? String(value) : '';
},
});
}
blurEvent() {
this.touch();
}
inputEvent() {
this.updateModel(this.elementRef.nativeElement.value);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocInputStringDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: NgDocInputStringDirective, isStandalone: true, selector: "input[ngDocInputString]", host: { listeners: { "blur": "blurEvent()", "input": "inputEvent()" } }, providers: [
{ provide: NgDocBaseInput, useExisting: forwardRef(() => NgDocInputStringDirective) },
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocInputStringDirective, decorators: [{
type: Directive,
args: [{
selector: `input[ngDocInputString]`,
providers: [
{ provide: NgDocBaseInput, useExisting: forwardRef(() => NgDocInputStringDirective) },
],
standalone: true,
}]
}], ctorParameters: () => [], propDecorators: { blurEvent: [{
type: HostListener,
args: ['blur']
}], inputEvent: [{
type: HostListener,
args: ['input']
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { NgDocInputStringDirective };
//# sourceMappingURL=ng-doc-ui-kit-directives-input-string.mjs.map