ngx-obelisco-example
Version:
Componentes funcionales y reutilizables para Angular.
61 lines (56 loc) • 6.86 kB
JavaScript
import * as i0 from '@angular/core';
import { Component, Input, ContentChild, NgModule } from '@angular/core';
import { OCustomContentDirective } from 'ngx-obelisco-example/directives';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
class OAlertComponent {
constructor() {
this.type = 'info';
this.isDismissible = false;
this.listContent = { isUnorderedList: false, listItems: [] };
this.customClasses = '';
}
checkUrls() {
if (this.listContent) {
return this.listContent.listItems.every((item) => !!item.url);
}
else {
return false;
}
}
}
OAlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
OAlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: OAlertComponent, selector: "o-alert", inputs: { type: "type", isDismissible: "isDismissible", listContent: "listContent", customClasses: "customClasses" }, queries: [{ propertyName: "oCustomContent", first: true, predicate: OCustomContentDirective, descendants: true, static: true }], ngImport: i0, template: "<div\r\n class=\"alert\"\r\n [ngClass]=\"\r\n (type && 'alert-' + type) +\r\n (isDismissible ? ' alert-dismissible show fade' : '') +\r\n (customClasses ? ' ' + customClasses : '')\r\n \"\r\n role=\"alert\"\r\n>\r\n <ng-container *ngIf=\"!oCustomContent\">\r\n <p><ng-content></ng-content></p>\r\n\r\n <ng-container *ngIf=\"listContent?.listItems?.length != 0\">\r\n <ul\r\n *ngIf=\"listContent?.isUnorderedList; else orderedList\"\r\n [class.list-links]=\"checkUrls()\"\r\n [class]=\"!checkUrls() ? '' : null\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"liItems\"></ng-container>\r\n </ul>\r\n </ng-container>\r\n\r\n <ng-template #orderedList>\r\n <ol [class.list-links]=\"checkUrls()\" [class]=\"!checkUrls() ? '' : null\">\r\n <ng-container [ngTemplateOutlet]=\"liItems\"></ng-container>\r\n </ol>\r\n </ng-template>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"oCustomContent\" [ngTemplateOutlet]=\"oCustomContent.template\"> </ng-container>\r\n\r\n <button *ngIf=\"isDismissible\" type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Cerrar\">\r\n <span class=\"material-icons-round\" aria-hidden=\"true\">close</span>\r\n </button>\r\n\r\n <ng-template #liItems>\r\n <li *ngFor=\"let item of listContent?.listItems\">\r\n <ng-container *ngIf=\"item.url; else itemList\">\r\n <a [href]=\"item.url\">{{ item.text }}</a>\r\n </ng-container>\r\n <ng-template #itemList>\r\n {{ item.text }}\r\n </ng-template>\r\n </li>\r\n </ng-template>\r\n</div>\r\n", styles: [".alert p{min-height:24px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OAlertComponent, decorators: [{
type: Component,
args: [{ selector: 'o-alert', template: "<div\r\n class=\"alert\"\r\n [ngClass]=\"\r\n (type && 'alert-' + type) +\r\n (isDismissible ? ' alert-dismissible show fade' : '') +\r\n (customClasses ? ' ' + customClasses : '')\r\n \"\r\n role=\"alert\"\r\n>\r\n <ng-container *ngIf=\"!oCustomContent\">\r\n <p><ng-content></ng-content></p>\r\n\r\n <ng-container *ngIf=\"listContent?.listItems?.length != 0\">\r\n <ul\r\n *ngIf=\"listContent?.isUnorderedList; else orderedList\"\r\n [class.list-links]=\"checkUrls()\"\r\n [class]=\"!checkUrls() ? '' : null\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"liItems\"></ng-container>\r\n </ul>\r\n </ng-container>\r\n\r\n <ng-template #orderedList>\r\n <ol [class.list-links]=\"checkUrls()\" [class]=\"!checkUrls() ? '' : null\">\r\n <ng-container [ngTemplateOutlet]=\"liItems\"></ng-container>\r\n </ol>\r\n </ng-template>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"oCustomContent\" [ngTemplateOutlet]=\"oCustomContent.template\"> </ng-container>\r\n\r\n <button *ngIf=\"isDismissible\" type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Cerrar\">\r\n <span class=\"material-icons-round\" aria-hidden=\"true\">close</span>\r\n </button>\r\n\r\n <ng-template #liItems>\r\n <li *ngFor=\"let item of listContent?.listItems\">\r\n <ng-container *ngIf=\"item.url; else itemList\">\r\n <a [href]=\"item.url\">{{ item.text }}</a>\r\n </ng-container>\r\n <ng-template #itemList>\r\n {{ item.text }}\r\n </ng-template>\r\n </li>\r\n </ng-template>\r\n</div>\r\n", styles: [".alert p{min-height:24px}\n"] }]
}], ctorParameters: function () { return []; }, propDecorators: { type: [{
type: Input
}], isDismissible: [{
type: Input
}], listContent: [{
type: Input
}], customClasses: [{
type: Input
}], oCustomContent: [{
type: ContentChild,
args: [OCustomContentDirective, { static: true }]
}] } });
class OAlertModule {
}
OAlertModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OAlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
OAlertModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: OAlertModule, declarations: [OAlertComponent], imports: [CommonModule], exports: [OAlertComponent] });
OAlertModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OAlertModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OAlertModule, decorators: [{
type: NgModule,
args: [{
declarations: [OAlertComponent],
imports: [CommonModule],
exports: [OAlertComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { OAlertComponent, OAlertModule };
//# sourceMappingURL=ngx-obelisco-example-alert.mjs.map