@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>
53 lines (49 loc) • 8.22 kB
JavaScript
import { NgTemplateOutlet } from '@angular/common';
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 { NgDocKindIconComponent } from '@ng-doc/app/components/kind-icon';
import { NgDocExtractValuePipe } from '@ng-doc/app/pipes/extract-value';
import { NgDocComboboxComponent, NgDocDataDirective, NgDocListComponent, NgDocOptionComponent, NgDocTextComponent, NgDocTextLeftDirective, NgDocTooltipDirective, NgDocTextRightDirective, NgDocButtonIconComponent, NgDocFocusableDirective, NgDocIconComponent } from '@ng-doc/ui-kit';
import { DIControl } from 'di-controls';
class NgDocTypeAliasControlComponent extends DIControl {
constructor() {
super();
}
typeOf(value) {
return typeof value;
}
changeModel(value) {
this.updateModel(value === null && this.default ? this.default : value);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocTypeAliasControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.3", type: NgDocTypeAliasControlComponent, isStandalone: true, selector: "ng-doc-type-alias-control", inputs: { default: "default" }, usesInheritance: true, ngImport: i0, template: "<ng-doc-combobox\n [ngModel]=\"model()\"\n [readonly]=\"true\"\n [valueContent]=\"valueTemplate\"\n [clearButton]=\"false\"\n [rightContent]=\"rightContent\"\n (ngModelChange)=\"changeModel($event)\">\n <ng-doc-list *ngDocData>\n @for (option of options; track option) {\n @if (isManual ? option : (option | ngDocExtractValue); as value) {\n <ng-doc-option [value]=\"value\">\n <ng-container\n *ngTemplateOutlet=\"valueTemplate; context: { $implicit: value }\"></ng-container>\n </ng-doc-option>\n }\n }\n </ng-doc-list>\n <ng-template let-value #valueTemplate>\n <div ng-doc-text>\n <ng-doc-kind-icon\n [kind]=\"typeOf(value)\"\n [type]=\"'type'\"\n [ngDocTooltip]=\"typeOf(value)\"\n positions=\"left-center\"\n ngDocTextLeft>\n </ng-doc-kind-icon>\n <div>{{ value }}</div>\n @if (value === default) {\n <span ng-doc-text color=\"muted\" size=\"small\" ngDocTextRight>[default]</span>\n }\n </div>\n </ng-template>\n <ng-template #rightContent>\n @if (model() && model() !== default) {\n <button\n ng-doc-button-icon-transparent\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-template>\n</ng-doc-combobox>\n", styles: [":host{display:block;width:100%}\n"], dependencies: [{ kind: "component", type: NgDocComboboxComponent, selector: "ng-doc-combobox", inputs: ["readonly", "placeholder", "clearButton", "rightContent", "valueContent"] }, { kind: "ngmodule", type: FormsModule }, { 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: "directive", type: NgDocDataDirective, selector: "[ngDocData]" }, { kind: "component", type: NgDocListComponent, selector: "ng-doc-list" }, { kind: "component", type: NgDocOptionComponent, selector: "ng-doc-option" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgDocTextComponent, selector: "[ng-doc-text]", inputs: ["size", "color", "align", "absoluteContent"] }, { kind: "component", type: NgDocKindIconComponent, selector: "ng-doc-kind-icon", inputs: ["kind", "type", "size"] }, { kind: "directive", type: NgDocTextLeftDirective, selector: "[ngDocTextLeft]" }, { kind: "directive", type: NgDocTooltipDirective, selector: "[ngDocTooltip]", inputs: ["ngDocTooltip", "delay", "displayOrigin", "pointerOrigin", "positions", "canOpen", "panelClass", "minHeight", "maxHeight", "height", "minWidth", "maxWidth", "width"], outputs: ["beforeOpen", "afterOpen", "beforeClose", "afterClose"], exportAs: ["ngDocTooltip"] }, { kind: "directive", type: NgDocTextRightDirective, selector: "[ngDocTextRight]" }, { 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: "pipe", type: NgDocExtractValuePipe, name: "ngDocExtractValue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgDocTypeAliasControlComponent, decorators: [{
type: Component,
args: [{ selector: 'ng-doc-type-alias-control', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
NgDocComboboxComponent,
FormsModule,
NgDocDataDirective,
NgDocListComponent,
NgDocOptionComponent,
NgTemplateOutlet,
NgDocTextComponent,
NgDocKindIconComponent,
NgDocTextLeftDirective,
NgDocTooltipDirective,
NgDocTextRightDirective,
NgDocButtonIconComponent,
NgDocFocusableDirective,
NgDocIconComponent,
NgDocExtractValuePipe,
], template: "<ng-doc-combobox\n [ngModel]=\"model()\"\n [readonly]=\"true\"\n [valueContent]=\"valueTemplate\"\n [clearButton]=\"false\"\n [rightContent]=\"rightContent\"\n (ngModelChange)=\"changeModel($event)\">\n <ng-doc-list *ngDocData>\n @for (option of options; track option) {\n @if (isManual ? option : (option | ngDocExtractValue); as value) {\n <ng-doc-option [value]=\"value\">\n <ng-container\n *ngTemplateOutlet=\"valueTemplate; context: { $implicit: value }\"></ng-container>\n </ng-doc-option>\n }\n }\n </ng-doc-list>\n <ng-template let-value #valueTemplate>\n <div ng-doc-text>\n <ng-doc-kind-icon\n [kind]=\"typeOf(value)\"\n [type]=\"'type'\"\n [ngDocTooltip]=\"typeOf(value)\"\n positions=\"left-center\"\n ngDocTextLeft>\n </ng-doc-kind-icon>\n <div>{{ value }}</div>\n @if (value === default) {\n <span ng-doc-text color=\"muted\" size=\"small\" ngDocTextRight>[default]</span>\n }\n </div>\n </ng-template>\n <ng-template #rightContent>\n @if (model() && model() !== default) {\n <button\n ng-doc-button-icon-transparent\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-template>\n</ng-doc-combobox>\n", styles: [":host{display:block;width:100%}\n"] }]
}], ctorParameters: () => [], propDecorators: { default: [{
type: Input
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { NgDocTypeAliasControlComponent };
//# sourceMappingURL=ng-doc-app-type-controls-type-alias-control.mjs.map