@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>
56 lines (52 loc) • 2.5 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import * as i0 from '@angular/core';
import { forwardRef, Directive, HostListener } 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';
import { UntilDestroy } from '@ngneat/until-destroy';
/** Directive converts any input data or model to text */
let NgDocInputStringDirective = 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: "19.0.3", ngImport: i0, type: NgDocInputStringDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.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 }); }
};
NgDocInputStringDirective = __decorate([
UntilDestroy(),
__metadata("design:paramtypes", [])
], NgDocInputStringDirective);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.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