UNPKG

@ng-doc/app

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>

42 lines (38 loc) 4.84 kB
import * as i0 from '@angular/core'; import { Input, ChangeDetectionStrategy, Component } from '@angular/core'; import * as i1 from '@angular/forms'; import { FormsModule } from '@angular/forms'; import { NgDocInputWrapperComponent, NgDocInputStringDirective, NgDocButtonIconComponent, NgDocFocusableDirective, NgDocIconComponent } from '@ng-doc/ui-kit'; import { DIControl, DIControlSilencerDirective } from 'di-controls'; class NgDocStringControlComponent extends DIControl { constructor() { super(); } changeModel(value) { this.updateModel(value === null && this.default ? this.default : value); } writeValue(value) { super.writeValue(value); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocStringControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.3", type: NgDocStringControlComponent, isStandalone: true, selector: "ng-doc-string-control", inputs: { default: "default" }, usesInheritance: true, ngImport: i0, template: "<ng-doc-input-wrapper diControlSilencer>\n <input ngDocInputString [ngModel]=\"model()\" (ngModelChange)=\"changeModel($event)\" />\n @if (model() && model() !== default) {\n <button\n ng-doc-button-icon-transparent\n ngDocInputWrapperRight\n size=\"large\"\n [ngDocFocusable]=\"false\"\n [disabled]=\"disabled\"\n [rounded]=\"false\"\n (click)=\"updateModel(default ?? null)\"\n (focusout)=\"touch()\">\n <ng-doc-icon icon=\"x\"></ng-doc-icon>\n </button>\n }\n</ng-doc-input-wrapper>\n", styles: [":host{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgDocInputWrapperComponent, selector: "ng-doc-input-wrapper", inputs: ["blurContent", "blurContext", "align"] }, { kind: "directive", type: NgDocInputStringDirective, selector: "input[ngDocInputString]" }, { kind: "component", type: NgDocButtonIconComponent, selector: "button[ng-doc-button-icon], a[ng-doc-button-icon], button[ng-doc-button-icon-raised], a[ng-doc-button-icon-raised], button[ng-doc-button-icon-transparent], a[ng-doc-button-icon-transparent]", inputs: ["size", "rounded"] }, { kind: "directive", type: NgDocFocusableDirective, selector: "[ngDocFocusable]", inputs: ["ngDocFocusable"], exportAs: ["ngDocFocusable"] }, { kind: "component", type: NgDocIconComponent, selector: "ng-doc-icon", inputs: ["icon", "customIcon", "size"] }, { kind: "directive", type: DIControlSilencerDirective, selector: "[diControlSilencer]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocStringControlComponent, decorators: [{ type: Component, args: [{ selector: 'ng-doc-string-control', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ FormsModule, NgDocInputWrapperComponent, NgDocInputStringDirective, NgDocButtonIconComponent, NgDocFocusableDirective, NgDocIconComponent, DIControlSilencerDirective, ], template: "<ng-doc-input-wrapper diControlSilencer>\n <input ngDocInputString [ngModel]=\"model()\" (ngModelChange)=\"changeModel($event)\" />\n @if (model() && model() !== default) {\n <button\n ng-doc-button-icon-transparent\n ngDocInputWrapperRight\n size=\"large\"\n [ngDocFocusable]=\"false\"\n [disabled]=\"disabled\"\n [rounded]=\"false\"\n (click)=\"updateModel(default ?? null)\"\n (focusout)=\"touch()\">\n <ng-doc-icon icon=\"x\"></ng-doc-icon>\n </button>\n }\n</ng-doc-input-wrapper>\n", styles: [":host{display:block;width:100%}\n"] }] }], ctorParameters: () => [], propDecorators: { default: [{ type: Input }] } }); /** * Generated bundle index. Do not edit. */ export { NgDocStringControlComponent }; //# sourceMappingURL=ng-doc-app-type-controls-string-control.mjs.map