UNPKG

@cauca-911/material

Version:

Run `npm install @cauca-911/material --save` to add this library to your project

802 lines (792 loc) 103 kB
import * as i0 from '@angular/core'; import { Injectable, Component, Inject, EventEmitter, ViewChild, Output, Input, HostListener, model, input, output, NgModule, signal, inject, Injector, forwardRef } from '@angular/core'; import * as i3 from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core'; import * as i2 from '@angular/common'; import { CommonModule, DatePipe } from '@angular/common'; import * as i3$1 from '@angular/forms'; import { UntypedFormControl, Validators, FormsModule, ReactiveFormsModule, NgControl, FormControlName, ControlContainer, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; import * as i4 from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button'; import * as i7 from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field'; import * as i5 from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon'; import * as i5$1 from '@angular/material/input'; import { MatInputModule } from '@angular/material/input'; import * as i6 from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs'; import * as i3$2 from '@fortawesome/angular-fontawesome'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import * as i1$1 from '@cauca-911/core'; import { CaucaCoreForChildModule } from '@cauca-911/core'; import * as i1 from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; import * as i1$2 from '@angular/router'; import { NavigationEnd } from '@angular/router'; import { trigger, state, style, transition, animate } from '@angular/animations'; import { provideNativeDateAdapter } from '@angular/material/core'; import * as i5$2 from '@angular/material/datepicker'; import { MatDatepickerModule } from '@angular/material/datepicker'; import * as i1$3 from '@angular/material/list'; import { MatListModule } from '@angular/material/list'; class CaucaMaterialService { static { this.ɵfac = function CaucaMaterialService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaMaterialService)(); }; } static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CaucaMaterialService, factory: CaucaMaterialService.ɵfac, providedIn: 'root' }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaMaterialService, [{ type: Injectable, args: [{ providedIn: 'root' }] }], null, null); })(); class CaucaMaterialComponent { static { this.ɵfac = function CaucaMaterialComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaMaterialComponent)(); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaMaterialComponent, selectors: [["cauca-material"]], standalone: false, decls: 3, vars: 3, template: function CaucaMaterialComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div"); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "core.noGenericComponentOnThisLibrary")); } }, dependencies: [i3.TranslatePipe], encapsulation: 2 }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaMaterialComponent, [{ type: Component, args: [{ selector: 'cauca-material', standalone: false, template: "<div>{{'core.noGenericComponentOnThisLibrary' | translate}}</div>" }] }], null, null); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaMaterialComponent, { className: "CaucaMaterialComponent", filePath: "lib/cauca-material.component.ts", lineNumber: 9 }); })(); class SimpleDialogData { constructor() { this.buttons = []; } } function CaucaSimpleDialogComponent_div_4_button_1_Template(rf, ctx) { if (rf & 1) { const _r1 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "button", 6); i0.ɵɵlistener("click", function CaucaSimpleDialogComponent_div_4_button_1_Template_button_click_0_listener() { const i_r2 = i0.ɵɵrestoreView(_r1).index; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.onClick(i_r2)); }); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const label_r4 = ctx.$implicit; i0.ɵɵadvance(); i0.ɵɵtextInterpolate(label_r4); } } function CaucaSimpleDialogComponent_div_4_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 4); i0.ɵɵtemplate(1, CaucaSimpleDialogComponent_div_4_button_1_Template, 2, 1, "button", 5); i0.ɵɵelementEnd(); } if (rf & 2) { const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("ngForOf", ctx_r2.data.buttons); } } class CaucaSimpleDialogComponent { constructor(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; } onClick(buttonIndex) { this.dialogRef.close(buttonIndex); } static { this.ɵfac = function CaucaSimpleDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaSimpleDialogComponent)(i0.ɵɵdirectiveInject(i1.MatDialogRef), i0.ɵɵdirectiveInject(MAT_DIALOG_DATA)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaSimpleDialogComponent, selectors: [["cauca-simple-dialog"]], standalone: false, decls: 5, vars: 3, consts: [["mat-dialog-title", ""], ["mat-dialog-content", ""], [3, "innerHTML"], ["mat-dialog-actions", "", 4, "ngIf"], ["mat-dialog-actions", ""], ["mat-raised-button", "", 3, "click", 4, "ngFor", "ngForOf"], ["mat-raised-button", "", 3, "click"]], template: function CaucaSimpleDialogComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "h1", 0); i0.ɵɵtext(1); i0.ɵɵelementEnd(); i0.ɵɵelementStart(2, "div", 1); i0.ɵɵelement(3, "div", 2); i0.ɵɵelementEnd(); i0.ɵɵtemplate(4, CaucaSimpleDialogComponent_div_4_Template, 2, 1, "div", 3); } if (rf & 2) { i0.ɵɵadvance(); i0.ɵɵtextInterpolate(ctx.data.title); i0.ɵɵadvance(2); i0.ɵɵproperty("innerHTML", ctx.data.message, i0.ɵɵsanitizeHtml); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx.data.buttons); } }, dependencies: [i2.NgForOf, i2.NgIf, i4.MatButton, i1.MatDialogTitle, i1.MatDialogActions, i1.MatDialogContent], styles: ["div[mat-dialog-actions][_ngcontent-%COMP%]{margin-top:20px;text-align:center}"] }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaSimpleDialogComponent, [{ type: Component, args: [{ selector: 'cauca-simple-dialog', standalone: false, template: "<h1 mat-dialog-title>{{data.title}}</h1>\n<div mat-dialog-content>\n <div [innerHTML]=\"data.message\"></div>\n</div>\n<div mat-dialog-actions *ngIf=\"data.buttons\">\n <button *ngFor=\"let label of data.buttons; let i = index\" mat-raised-button (click)=\"onClick(i)\">{{label}}</button>\n</div>", styles: ["div[mat-dialog-actions]{margin-top:20px;text-align:center}\n"] }] }], () => [{ type: i1.MatDialogRef }, { type: SimpleDialogData, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA] }] }], null); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaSimpleDialogComponent, { className: "CaucaSimpleDialogComponent", filePath: "lib/cauca-simple-dialog/cauca-simple-dialog.component.ts", lineNumber: 11 }); })(); const _c0$3 = ["file"]; function CaucaInputFileComponent_mat_icon_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "mat-icon"); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵtextInterpolate(ctx_r1.icon); } } function CaucaInputFileComponent_span_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span"); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵtextInterpolate(ctx_r1.text); } } function CaucaInputFileComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) { const _r3 = i0.ɵɵgetCurrentView(); i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "input", 5, 1); i0.ɵɵlistener("change", function CaucaInputFileComponent_ng_container_3_Template_input_change_1_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onSelectFile($event)); }); i0.ɵɵelementEnd(); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("accept", ctx_r1.accept); } } function CaucaInputFileComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) { const _r4 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "input", 6, 1); i0.ɵɵlistener("change", function CaucaInputFileComponent_ng_template_4_Template_input_change_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onSelectFile($event)); }); i0.ɵɵelementEnd(); } if (rf & 2) { const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵproperty("accept", ctx_r1.accept); } } class CaucaInputFileComponent { constructor(translateService, dialog) { this.translateService = translateService; this.dialog = dialog; this.readend = new EventEmitter(); this.accept = ''; this.multiple = false; this.icon = ''; this.text = ''; this.labels = {}; } ngOnInit() { if (!this.icon && !this.text) { this.translateService.get(['material.select', 'material.dialogTitle', 'material.dialogMessage']).subscribe((labels) => { this.labels = labels; this.text = labels['material.select']; }); } } onSelectFile(e) { for (let i = 0, j = e.target.files.length; i < j; i++) { const file = e.target.files[i]; const reader = new FileReader(); reader.onerror = ((error) => this.onError(error)); reader.onload = ((event) => this.onReadEnd(file, event)); reader.readAsDataURL(file); } if (e.target.files.length) { this.dialog.open(CaucaSimpleDialogComponent, { width: '250px', disableClose: true, data: { title: this.labels['material.dialogTitle'], message: this.labels['material.dialogMessage'] } }); } } openDialog(event) { if (this.file) { this.file.nativeElement.click(); } event.stopPropagation(); } onError(error) { throw error; } onReadEnd(file, e) { this.dialog.closeAll(); this.readend.emit({ name: file.name, size: file.size, type: file.type, lastModifiedDate: file.lastModifiedDate, content: e.target['result'], file, }); } static { this.ɵfac = function CaucaInputFileComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaInputFileComponent)(i0.ɵɵdirectiveInject(i1$1.TranslateService), i0.ɵɵdirectiveInject(i1.MatDialog)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaInputFileComponent, selectors: [["cauca-input-file"]], viewQuery: function CaucaInputFileComponent_Query(rf, ctx) { if (rf & 1) { i0.ɵɵviewQuery(_c0$3, 5); } if (rf & 2) { let _t; i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.file = _t.first); } }, inputs: { accept: "accept", multiple: "multiple", icon: "icon", text: "text" }, outputs: { readend: "readend" }, standalone: false, decls: 6, vars: 4, consts: [["notMultipleInput", ""], ["file", ""], ["mat-raised-button", "", 3, "click"], [4, "ngIf"], [4, "ngIf", "ngIfElse"], ["type", "file", "multiple", "multiple", 3, "change", "accept"], ["type", "file", 3, "change", "accept"]], template: function CaucaInputFileComponent_Template(rf, ctx) { if (rf & 1) { const _r1 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "button", 2); i0.ɵɵlistener("click", function CaucaInputFileComponent_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.openDialog($event)); }); i0.ɵɵtemplate(1, CaucaInputFileComponent_mat_icon_1_Template, 2, 1, "mat-icon", 3)(2, CaucaInputFileComponent_span_2_Template, 2, 1, "span", 3); i0.ɵɵelementEnd(); i0.ɵɵtemplate(3, CaucaInputFileComponent_ng_container_3_Template, 3, 1, "ng-container", 4)(4, CaucaInputFileComponent_ng_template_4_Template, 2, 1, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor); } if (rf & 2) { const notMultipleInput_r5 = i0.ɵɵreference(5); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx.icon); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx.text); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx.multiple)("ngIfElse", notMultipleInput_r5); } }, dependencies: [i2.NgIf, i4.MatButton, i5.MatIcon], styles: ["[_nghost-%COMP%] input[_ngcontent-%COMP%]{display:none}"] }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaInputFileComponent, [{ type: Component, args: [{ selector: 'cauca-input-file', standalone: false, template: "<button mat-raised-button (click)=\"openDialog($event)\">\n <mat-icon *ngIf=\"icon\">{{icon}}</mat-icon>\n <span *ngIf=\"text\">{{text}}</span>\n</button>\n<ng-container *ngIf=\"multiple; else notMultipleInput\">\n <input #file type=\"file\" (change)=\"onSelectFile($event)\" [accept]=\"accept\" multiple=\"multiple\" />\n</ng-container>\n\n<ng-template #notMultipleInput>\n <input #file type=\"file\" (change)=\"onSelectFile($event)\" [accept]=\"accept\" />\n</ng-template>", styles: [":host input{display:none}\n"] }] }], () => [{ type: i1$1.TranslateService }, { type: i1.MatDialog }], { file: [{ type: ViewChild, args: ['file', { static: false }] }], readend: [{ type: Output }], accept: [{ type: Input }], multiple: [{ type: Input }], icon: [{ type: Input }], text: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaInputFileComponent, { className: "CaucaInputFileComponent", filePath: "lib/cauca-input-file/cauca-input-file.component.ts", lineNumber: 12 }); })(); function CaucaInputMultipleLangueComponent_mat_tab_1_mat_error_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "mat-error"); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵelementEnd(); } if (rf & 2) { const i_r1 = i0.ɵɵnextContext().index; const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r1.getErrorMessage(i_r1))); } } function CaucaInputMultipleLangueComponent_mat_tab_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "mat-tab", 2)(1, "mat-form-field", 3); i0.ɵɵelement(2, "input", 4); i0.ɵɵtemplate(3, CaucaInputMultipleLangueComponent_mat_tab_1_mat_error_3_Template, 3, 3, "mat-error", 5); i0.ɵɵelementEnd()(); } if (rf & 2) { const lang_r3 = ctx.$implicit; const i_r1 = ctx.index; const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵproperty("label", lang_r3); i0.ɵɵadvance(2); i0.ɵɵproperty("placeholder", lang_r3)("formControl", ctx_r1.forms[i_r1]); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx_r1.forms[i_r1].invalid); } } class CaucaInputMultipleLangueComponent { constructor(coreService, translate) { this.translate = translate; this.value = []; this.forms = []; this.labels = []; this.selectedIndex = 0; this.config = coreService.getConfig(); } ngOnInit() { this.translate.get(this.config.languages).subscribe((labels) => { for (const i in labels) { if (labels[i]) { this.labels.push(labels[i]); } } this.initializeForms(); }); } onTagChanged(tabIndex) { console.log('cauca-material, onTabChanged', tabIndex); } getErrorMessage(index) { return this.forms[index].hasError('required') ? 'error.required' : ''; } initializeForms() { this.labels.forEach((item, index) => { this.forms[index] = new UntypedFormControl('', [Validators.required]); this.forms[index].setValue(this.value[index] || ''); }); } static { this.ɵfac = function CaucaInputMultipleLangueComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaInputMultipleLangueComponent)(i0.ɵɵdirectiveInject(i1$1.CaucaCoreService), i0.ɵɵdirectiveInject(i1$1.TranslateService)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaInputMultipleLangueComponent, selectors: [["cauca-input-multiple-langue"]], inputs: { value: "value" }, standalone: false, decls: 2, vars: 2, consts: [[3, "selectedIndexChange", "selectedIndex"], [3, "label", 4, "ngFor", "ngForOf"], [3, "label"], ["hideRequiredMarker", "never"], ["matInput", "", "required", "required", 3, "placeholder", "formControl"], [4, "ngIf"]], template: function CaucaInputMultipleLangueComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "mat-tab-group", 0); i0.ɵɵlistener("selectedIndexChange", function CaucaInputMultipleLangueComponent_Template_mat_tab_group_selectedIndexChange_0_listener($event) { return ctx.onTagChanged($event); }); i0.ɵɵtemplate(1, CaucaInputMultipleLangueComponent_mat_tab_1_Template, 4, 4, "mat-tab", 1); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵproperty("selectedIndex", ctx.selectedIndex); i0.ɵɵadvance(); i0.ɵɵproperty("ngForOf", ctx.labels); } }, dependencies: [i2.NgForOf, i2.NgIf, i3$1.DefaultValueAccessor, i3$1.NgControlStatus, i3$1.RequiredValidator, i3$1.FormControlDirective, i7.MatFormField, i7.MatError, i5$1.MatInput, i6.MatTab, i6.MatTabGroup, i3.TranslatePipe], styles: [".mat-mdc-form-field[_ngcontent-%COMP%]{width:100%}"] }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaInputMultipleLangueComponent, [{ type: Component, args: [{ selector: 'cauca-input-multiple-langue', standalone: false, template: "<mat-tab-group [selectedIndex]=\"selectedIndex\" (selectedIndexChange)=\"onTagChanged($event)\">\n <mat-tab *ngFor=\"let lang of labels; let i = index\" [label]=\"lang\">\n <mat-form-field hideRequiredMarker=\"never\">\n <input matInput [placeholder]=\"lang\" [formControl]=\"forms[i]\" required=\"required\">\n <mat-error *ngIf=\"forms[i].invalid\">{{getErrorMessage(i) | translate}}</mat-error>\n </mat-form-field>\n </mat-tab>\n</mat-tab-group>", styles: [".mat-mdc-form-field{width:100%}\n"] }] }], () => [{ type: i1$1.CaucaCoreService }, { type: i1$1.TranslateService }], { value: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaInputMultipleLangueComponent, { className: "CaucaInputMultipleLangueComponent", filePath: "lib/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts", lineNumber: 11 }); })(); function CaucaMenuVerticalComponent_h4_0_div_2_fa_icon_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "fa-icon", 8); } if (rf & 2) { const menu_r2 = i0.ɵɵnextContext(2).$implicit; i0.ɵɵproperty("icon", menu_r2.icon); } } function CaucaMenuVerticalComponent_h4_0_div_2_img_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "img", 9); } if (rf & 2) { const menu_r2 = i0.ɵɵnextContext(2).$implicit; i0.ɵɵproperty("src", menu_r2.icon, i0.ɵɵsanitizeUrl); } } function CaucaMenuVerticalComponent_h4_0_div_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 5); i0.ɵɵtemplate(1, CaucaMenuVerticalComponent_h4_0_div_2_fa_icon_1_Template, 1, 1, "fa-icon", 6)(2, CaucaMenuVerticalComponent_h4_0_div_2_img_2_Template, 1, 1, "img", 7); i0.ɵɵelementEnd(); } if (rf & 2) { const menu_r2 = i0.ɵɵnextContext().$implicit; i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", menu_r2.icon.filter !== undefined); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", menu_r2.icon.filter === undefined); } } function CaucaMenuVerticalComponent_h4_0_div_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 10)(1, "span"); i0.ɵɵtext(2); i0.ɵɵpipe(3, "translate"); i0.ɵɵelementEnd()(); } if (rf & 2) { const menu_r2 = i0.ɵɵnextContext().$implicit; i0.ɵɵadvance(2); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 1, menu_r2.label)); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 15); i0.ɵɵtext(1, "\u2022"); i0.ɵɵelementEnd(); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_fa_icon_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "fa-icon", 8); } if (rf & 2) { const submenu_r5 = i0.ɵɵnextContext(2).$implicit; i0.ɵɵproperty("icon", submenu_r5.icon); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_img_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "img", 9); } if (rf & 2) { const submenu_r5 = i0.ɵɵnextContext(2).$implicit; i0.ɵɵproperty("src", submenu_r5.icon, i0.ɵɵsanitizeUrl); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 5); i0.ɵɵtemplate(1, CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_fa_icon_1_Template, 1, 1, "fa-icon", 6)(2, CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_img_2_Template, 1, 1, "img", 7); i0.ɵɵelementEnd(); } if (rf & 2) { const submenu_r5 = i0.ɵɵnextContext().$implicit; i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", submenu_r5.icon.filter !== undefined); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", submenu_r5.icon.filter === undefined); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 10)(1, "span"); i0.ɵɵtext(2); i0.ɵɵpipe(3, "translate"); i0.ɵɵelementEnd()(); } if (rf & 2) { const submenu_r5 = i0.ɵɵnextContext().$implicit; i0.ɵɵadvance(2); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 1, submenu_r5.label)); } } function CaucaMenuVerticalComponent_h4_0_div_4_div_1_Template(rf, ctx) { if (rf & 1) { const _r4 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "div", 13); i0.ɵɵlistener("click", function CaucaMenuVerticalComponent_h4_0_div_4_div_1_Template_div_click_0_listener($event) { const submenu_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.goTo(submenu_r5.path, $event)); }); i0.ɵɵtemplate(1, CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_1_Template, 2, 0, "div", 14)(2, CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_2_Template, 3, 2, "div", 2)(3, CaucaMenuVerticalComponent_h4_0_div_4_div_1_div_3_Template, 4, 3, "div", 3); i0.ɵɵelementEnd(); } if (rf & 2) { const submenu_r5 = ctx.$implicit; i0.ɵɵclassMap(submenu_r5.activated ? "menu selected" : "menu"); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", !submenu_r5.icon); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", submenu_r5.icon); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", submenu_r5.label); } } function CaucaMenuVerticalComponent_h4_0_div_4_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 11); i0.ɵɵtemplate(1, CaucaMenuVerticalComponent_h4_0_div_4_div_1_Template, 4, 5, "div", 12); i0.ɵɵelementEnd(); } if (rf & 2) { const menu_r2 = i0.ɵɵnextContext().$implicit; i0.ɵɵadvance(); i0.ɵɵproperty("ngForOf", menu_r2.childs); } } function CaucaMenuVerticalComponent_h4_0_Template(rf, ctx) { if (rf & 1) { const _r1 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "h4")(1, "div", 1); i0.ɵɵlistener("click", function CaucaMenuVerticalComponent_h4_0_Template_div_click_1_listener($event) { const menu_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.goTo(menu_r2.path, $event)); }); i0.ɵɵtemplate(2, CaucaMenuVerticalComponent_h4_0_div_2_Template, 3, 2, "div", 2)(3, CaucaMenuVerticalComponent_h4_0_div_3_Template, 4, 3, "div", 3); i0.ɵɵelementEnd(); i0.ɵɵtemplate(4, CaucaMenuVerticalComponent_h4_0_div_4_Template, 2, 1, "div", 4); i0.ɵɵelementEnd(); } if (rf & 2) { const menu_r2 = ctx.$implicit; i0.ɵɵclassMap(menu_r2.activated ? "selected" : ""); i0.ɵɵadvance(2); i0.ɵɵproperty("ngIf", menu_r2.icon); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", menu_r2.label); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", menu_r2.childs.length && menu_r2.activated); } } class CaucaMenuVerticalComponent { constructor(router) { this.router = router; this.itemClick = new EventEmitter(); this.menuItems = []; this.router.events.subscribe((route) => { if (route instanceof NavigationEnd) { this.selectActiveRoute(route); } }); } goTo(path, e) { this.router.navigate([path]); this.itemClick.emit(); e.stopPropagation(); } selectActiveRoute(route) { this.menuItems.forEach((menu) => { if (route.url) { menu.activated = (route.url === menu.path || (menu.childs.length && route.url.indexOf(menu.path) > -1)); } menu.childs.forEach((subMenu) => { if (route.url) { subMenu.activated = (route.url === subMenu.path || route.urlAfterRedirects === subMenu.path); } }); }); } static { this.ɵfac = function CaucaMenuVerticalComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaMenuVerticalComponent)(i0.ɵɵdirectiveInject(i1$2.Router)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaMenuVerticalComponent, selectors: [["cauca-menu-vertical"]], inputs: { menuItems: "menuItems" }, outputs: { itemClick: "itemClick" }, standalone: false, decls: 1, vars: 1, consts: [[3, "class", 4, "ngFor", "ngForOf"], [1, "menu", 3, "click"], ["class", "menu-icon", 4, "ngIf"], ["class", "menu-caption", 4, "ngIf"], ["class", "submenu", 4, "ngIf"], [1, "menu-icon"], [3, "icon", 4, "ngIf"], [3, "src", 4, "ngIf"], [3, "icon"], [3, "src"], [1, "menu-caption"], [1, "submenu"], [3, "class", "click", 4, "ngFor", "ngForOf"], [3, "click"], ["class", "menu-dot", 4, "ngIf"], [1, "menu-dot"]], template: function CaucaMenuVerticalComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, CaucaMenuVerticalComponent_h4_0_Template, 5, 5, "h4", 0); } if (rf & 2) { i0.ɵɵproperty("ngForOf", ctx.menuItems); } }, dependencies: [i2.NgForOf, i2.NgIf, i3$2.FaIconComponent, i3.TranslatePipe], styles: [".menu[_ngcontent-%COMP%], .submenu[_ngcontent-%COMP%]{cursor:pointer}h4[_ngcontent-%COMP%]{margin:0;padding:0}h4[_ngcontent-%COMP%] .menu[_ngcontent-%COMP%]{padding:1em 0;display:flex;flex-direction:row}h4[_ngcontent-%COMP%] .menu[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{flex:1 1 auto;align-self:center}.menu-dot[_ngcontent-%COMP%]{max-width:1.1em;text-align:center;margin-right:.5em;font-size:2em}.menu-icon[_ngcontent-%COMP%]{max-width:60px;text-align:center;margin-right:.5em}.submenu[_ngcontent-%COMP%]{margin-left:1em}.submenu[_ngcontent-%COMP%] .menu[_ngcontent-%COMP%]{padding:0;font-size:.9em;line-height:2.2em}.submenu[_ngcontent-%COMP%] .menu[_ngcontent-%COMP%]:before{content:\"\";margin-left:1.1em;width:.1em;height:2.5em;position:relative;background:#fff;margin-right:-1.17em}"] }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaMenuVerticalComponent, [{ type: Component, args: [{ selector: 'cauca-menu-vertical', standalone: false, template: "<h4 *ngFor=\"let menu of menuItems\" [class]=\"menu.activated ? 'selected' : ''\">\n <div (click)=\"goTo(menu.path, $event)\" class=\"menu\">\n <div *ngIf=\"menu.icon\" class=\"menu-icon\">\n <fa-icon *ngIf=\"menu.icon.filter !== undefined\" [icon]=\"menu.icon\"></fa-icon>\n <img *ngIf=\"menu.icon.filter === undefined\" [src]=\"menu.icon\" />\n </div>\n <div *ngIf=\"menu.label\" class=\"menu-caption\">\n <span>{{menu.label | translate}}</span>\n </div>\n </div>\n <div *ngIf=\"menu.childs.length && menu.activated\" class=\"submenu\">\n <div\n *ngFor=\"let submenu of menu.childs\"\n [class]=\"submenu.activated ? 'menu selected' : 'menu'\"\n (click)=\"goTo(submenu.path, $event)\">\n <div *ngIf=\"!submenu.icon\" class=\"menu-dot\">&bull;</div>\n <div *ngIf=\"submenu.icon\" class=\"menu-icon\">\n <fa-icon *ngIf=\"submenu.icon.filter !== undefined\" [icon]=\"submenu.icon\"></fa-icon>\n <img *ngIf=\"submenu.icon.filter === undefined\" [src]=\"submenu.icon\" />\n </div>\n <div *ngIf=\"submenu.label\" class=\"menu-caption\">\n <span>{{submenu.label | translate}}</span>\n </div>\n </div>\n </div>\n</h4>\n", styles: [".menu,.submenu{cursor:pointer}h4{margin:0;padding:0}h4 .menu{padding:1em 0;display:flex;flex-direction:row}h4 .menu>div{flex:1 1 auto;align-self:center}.menu-dot{max-width:1.1em;text-align:center;margin-right:.5em;font-size:2em}.menu-icon{max-width:60px;text-align:center;margin-right:.5em}.submenu{margin-left:1em}.submenu .menu{padding:0;font-size:.9em;line-height:2.2em}.submenu .menu:before{content:\"\";margin-left:1.1em;width:.1em;height:2.5em;position:relative;background:#fff;margin-right:-1.17em}\n"] }] }], () => [{ type: i1$2.Router }], { itemClick: [{ type: Output }], menuItems: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaMenuVerticalComponent, { className: "CaucaMenuVerticalComponent", filePath: "lib/cauca-menu-vertical/cauca-menu-vertical.component.ts", lineNumber: 11 }); })(); const _c0$2 = [[["", "header", ""]], [["", "beforeMenu", ""]], [["", "afterMenu", ""]], [["", "footer", ""]]]; const _c1 = ["[header]", "[beforeMenu]", "[afterMenu]", "[footer]"]; function CaucaMenuSidebarComponent_div_12_Template(rf, ctx) { if (rf & 1) { const _r2 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "div", 7)(1, "div", 8); i0.ɵɵlistener("click", function CaucaMenuSidebarComponent_div_12_Template_div_click_1_listener() { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onToggleCollapse()); }); i0.ɵɵelementEnd(); i0.ɵɵelementStart(2, "span", 9); i0.ɵɵtext(3); i0.ɵɵpipe(4, "translate"); i0.ɵɵelementEnd(); i0.ɵɵelementStart(5, "span", 10); i0.ɵɵtext(6); i0.ɵɵelementEnd()(); } if (rf & 2) { const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(3); i0.ɵɵtextInterpolate2("", i0.ɵɵpipeBind1(4, 3, "material.version"), " ", ctx_r2.version, ""); i0.ɵɵadvance(3); i0.ɵɵtextInterpolate(ctx_r2.version); } } class CaucaMenuSidebarComponent { constructor(element) { this.menuItems = []; this.version = ''; this.keepMenuExpanded = false; this.hostElement = element.nativeElement; this.hostElement.addEventListener('mouseover', (e) => this.onMouseOver(e)); this.hostElement.addEventListener('mouseout', (e) => this.onMouseOut(e)); this.setDisplayMenu(); } onResize(_e) { this.setDisplayMenu(); } onMenuItemClick() { if (window.innerWidth < 1000) { this.hideOnMobile(); } } hideOnMobile() { this.hostElement.classList.remove('mobile'); this.hostElement.classList.add('hidden'); } showOnMobile() { this.hostElement.classList.remove('hidden'); this.hostElement.classList.add('mobile'); } onToggleCollapse() { if (this.keepMenuExpanded) { this.onCollapseMenu(); this.hostElement.classList.remove('keepExpanded'); } else { this.onExpandedMenu(); this.hostElement.classList.add('keepExpanded'); } this.keepMenuExpanded = !this.keepMenuExpanded; localStorage.setItem('cauca-menu-status', this.keepMenuExpanded ? 'expanded' : 'collapsed'); } setDisplayMenu() { this.hostElement.className = ''; if (window.innerWidth < 1000) { this.hostElement.classList.add('hidden'); } else { if (localStorage.getItem('cauca-menu-status') === 'expanded') { this.keepMenuExpanded = true; this.hostElement.classList.add('keepExpanded'); } this.hostElement.classList.add(this.keepMenuExpanded ? 'expanded' : 'collapsed'); } } onMouseOver(e) { if (!this.keepMenuExpanded) { this.onExpandedMenu(); } e.stopPropagation(); } onMouseOut(e) { if (!this.keepMenuExpanded) { this.onCollapseMenu(); } e.stopPropagation(); } onExpandedMenu() { if (window.innerWidth >= 1000) { this.hostElement.classList.remove('collapsed'); this.hostElement.classList.add('expanded'); } } onCollapseMenu() { if (window.innerWidth >= 1000) { this.hostElement.classList.remove('expanded'); this.hostElement.classList.add('collapsed'); } } static { this.ɵfac = function CaucaMenuSidebarComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaMenuSidebarComponent)(i0.ɵɵdirectiveInject(i0.ElementRef)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaMenuSidebarComponent, selectors: [["cauca-menu-sidebar"]], hostBindings: function CaucaMenuSidebarComponent_HostBindings(rf, ctx) { if (rf & 1) { i0.ɵɵlistener("resize", function CaucaMenuSidebarComponent_resize_HostBindingHandler($event) { return ctx.onResize($event); }, false, i0.ɵɵresolveWindow); } }, inputs: { menuItems: "menuItems", version: "version" }, standalone: false, ngContentSelectors: _c1, decls: 13, vars: 2, consts: [["menu", ""], [1, "header"], ["mat-icon-button", "", 1, "close", 3, "click"], [1, "content"], [3, "itemClick", "menuItems"], [1, "footer"], ["class", "version", 4, "ngIf"], [1, "version"], [1, "double-arrow", 3, "click"], [1, "full"], [1, "abbr"]], template: function CaucaMenuSidebarComponent_Template(rf, ctx) { if (rf & 1) { const _r1 = i0.ɵɵgetCurrentView(); i0.ɵɵprojectionDef(_c0$2); i0.ɵɵelementStart(0, "div", 1)(1, "button", 2); i0.ɵɵlistener("click", function CaucaMenuSidebarComponent_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.hideOnMobile()); }); i0.ɵɵelementStart(2, "mat-icon"); i0.ɵɵtext(3, "clear"); i0.ɵɵelementEnd()(); i0.ɵɵprojection(4); i0.ɵɵelementEnd(); i0.ɵɵelementStart(5, "div", 3); i0.ɵɵprojection(6, 1); i0.ɵɵelementStart(7, "cauca-menu-vertical", 4, 0); i0.ɵɵlistener("itemClick", function CaucaMenuSidebarComponent_Template_cauca_menu_vertical_itemClick_7_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onMenuItemClick()); }); i0.ɵɵelementEnd(); i0.ɵɵprojection(9, 2); i0.ɵɵelementEnd(); i0.ɵɵelementStart(10, "div", 5); i0.ɵɵprojection(11, 3); i0.ɵɵelementEnd(); i0.ɵɵtemplate(12, CaucaMenuSidebarComponent_div_12_Template, 7, 5, "div", 6); } if (rf & 2) { i0.ɵɵadvance(7); i0.ɵɵproperty("menuItems", ctx.menuItems); i0.ɵɵadvance(5); i0.ɵɵproperty("ngIf", ctx.version); } }, dependencies: [i2.NgIf, i4.MatIconButton, i5.MatIcon, CaucaMenuVerticalComponent, i3.TranslatePipe], styles: ["[_nghost-%COMP%]{height:100%;flex-direction:column;display:flex;transition:all .1s ease-out;overflow:hidden;scrollbar-width:5px;scrollbar-color:rgba(0,0,0,.1) rgba(0,0,0,.2)}[_ngcontent-%COMP%]::-webkit-scrollbar{width:5px}[_ngcontent-%COMP%]::-webkit-scrollbar-track{border-radius:5px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.1)}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{border-radius:5px;background-color:#0003;outline:1px solid slategrey}[_nghost-%COMP%] > div[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] > .header[_ngcontent-%COMP%], [_nghost-%COMP%] > .footer[_ngcontent-%COMP%]{flex:0 0 auto}[_nghost-%COMP%] > .content[_ngcontent-%COMP%]{flex-grow:1;overflow:hidden auto}[_nghost-%COMP%] > .version[_ngcontent-%COMP%]{max-height:1em}.hidden[_nghost-%COMP%]{width:0;min-width:0;max-width:0}.mobile[_nghost-%COMP%]{width:275px;min-width:275px;max-width:275px;position:absolute;z-index:10}.collapsed[_nghost-%COMP%]{width:75px;min-width:75px;max-width:75px}.expanded[_nghost-%COMP%]{width:275px;min-width:275px;max-width:275px}[_nghost-%COMP%] .close[_ngcontent-%COMP%]{display:none}.mobile[_nghost-%COMP%] .close[_ngcontent-%COMP%]{right:0;display:inline-block;position:absolute}.double-arrow[_ngcontent-%COMP%]{height:3em;line-height:3em;cursor:pointer;position:fixed;opacity:.25;margin-top:-1em}.double-arrow[_ngcontent-%COMP%]:hover{opacity:1}.expanded[_nghost-%COMP%] .double-arrow[_ngcontent-%COMP%]:before, .collapsed[_nghost-%COMP%] .double-arrow[_ngcontent-%COMP%]:before{font-family:Material Icons;content:\"double_arrow\";font-size:3em;text-align:right}.collapsed[_nghost-%COMP%] .double-arrow[_ngcontent-%COMP%]{margin-left:10px}.expanded[_nghost-%COMP%] .double-arrow[_ngcontent-%COMP%]{margin-left:200px}.collapsed[_nghost-%COMP%] .menu-caption, .collapsed[_nghost-%COMP%] .submenu{display:none}.keepExpanded[_nghost-%COMP%] .double-arrow[_ngcontent-%COMP%]{transform:rotate(180deg);opacity:1}.version[_ngcontent-%COMP%]{bottom:0;padding:1em}.full[_ngcontent-%COMP%], .abbr[_ngcontent-%COMP%]{display:none}.collapsed[_nghost-%COMP%] .abbr[_ngcontent-%COMP%]{display:inline}.mobile[_nghost-%COMP%] .full[_ngcontent-%COMP%], .expanded[_nghost-%COMP%] .full[_ngcontent-%COMP%]{display:inline}@media only screen and (max-width: 1000px){.double-arrow[_ngcontent-%COMP%]{display:none}}"] }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaMenuSidebarComponent, [{ type: Component, args: [{ selector: 'cauca-menu-sidebar', standalone: false, template: "<div class=\"header\">\n <button mat-icon-button class=\"close\" (click)=\"hideOnMobile()\">\n <mat-icon>clear</mat-icon>\n </button>\n <ng-content select=\"[header]\"></ng-content>\n</div>\n<div class=\"content\">\n <ng-content select=\"[beforeMenu]\"></ng-content>\n <cauca-menu-vertical #menu [menuItems]=\"menuItems\" (itemClick)=\"onMenuItemClick()\"></cauca-menu-vertical>\n <ng-content select=\"[afterMenu]\"></ng-content>\n</div>\n<div class=\"footer\">\n <ng-content select=\"[footer]\"></ng-content>\n</div>\n<div *ngIf=\"version\" class=\"version\">\n <div class=\"double-arrow\" (click)=\"onToggleCollapse()\"></div>\n <span class=\"full\">{{'material.version' | translate}} {{version}}</span>\n <span class=\"abbr\">{{version}}</span>\n</div>\n", styles: [":host{height:100%;flex-direction:column;display:flex;transition:all .1s ease-out;overflow:hidden;scrollbar-width:5px;scrollbar-color:rgba(0,0,0,.1) rgba(0,0,0,.2)}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{border-radius:5px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.1)}::-webkit-scrollbar-thumb{border-radius:5px;background-color:#0003;outline:1px solid slategrey}:host>div{flex:1}:host>.header,:host>.footer{flex:0 0 auto}:host>.content{flex-grow:1;overflow:hidden auto}:host>.version{max-height:1em}:host.hidden{width:0;min-width:0;max-width:0}:host.mobile{width:275px;min-width:275px;max-width:275px;position:absolute;z-index:10}:host.collapsed{width:75px;min-width:75px;max-width:75px}:host.expanded{width:275px;min-width:275px;max-width:275px}:host .close{display:none}:host.mobile .close{right:0;display:inline-block;position:absolute}.double-arrow{height:3em;line-height:3em;cursor:pointer;position:fixed;opacity:.25;margin-top:-1em}.double-arrow:hover{opacity:1}:host.expanded .double-arrow:before,:host.collapsed .double-arrow:before{font-family:Material Icons;content:\"double_arrow\";font-size:3em;text-align:right}:host.collapsed .double-arrow{margin-left:10px}:host.expanded .double-arrow{margin-left:200px}:host.collapsed ::ng-deep .menu-caption,:host.collapsed ::ng-deep .submenu{display:none}:host.keepExpanded .double-arrow{transform:rotate(180deg);opacity:1}.version{bottom:0;padding:1em}.full,.abbr{display:none}:host.collapsed .abbr{display:inline}:host.mobile .full,:host.expanded .full{display:inline}@media only screen and (max-width: 1000px){.double-arrow{display:none}}\n"] }] }], () => [{ type: i0.ElementRef }], { menuItems: [{ type: Input }], version: [{ type: Input }], onResize: [{ type: HostListener, args: ['window:resize', ['$event']] }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaMenuSidebarComponent, { className: "CaucaMenuSidebarComponent", filePath: "lib/cauca-menu-sidebar/cauca-menu-sidebar.component.ts", lineNumber: 10 }); })(); const _c0$1 = ["container"]; function CaucaSlideshowComponent_div_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div"); i0.ɵɵelement(1, "img", 3); i0.ɵɵelementEnd(); } if (rf & 2) { const url_r1 = ctx.$implicit; const index_r2 = ctx.index; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵproperty("@slideLeftRight", ctx_r2.getState(index_r2)); i0.ɵɵadvance(); i0.ɵɵproperty("src", url_r1, i0.ɵɵsanitizeUrl); } } class CaucaSlideshowComponent { constructor() { this.height = '150px'; this.autoPlay = true; this.timer = null; this.items = []; this.states = []; this.selectedIndex = 0; } set images(list) { this.items = list; this.restart(); } get images() { return this.items; } ngOnInit() { this.container.nativeElement.style.height = this.height; this.container.nativeElement.style.width = '100%'; } getState(index) { if (this.states[index]) { return this.states[index]; } return (this.selectedIndex === index ? 'in' : 'out'); } restart() { if (this.timer) { window.clearInterval(this.timer); } if (this.images && this.images.length) { this.timer = window.setInterval(() => this.changed('next'), 5000); } } next() { if (this.selectedIndex < this.items.length - 1) { this.selectedIndex++; } else { this.selectedIndex = 0; } } changed(action) { this.states[this.selectedIndex] = 'out'; this[action](); this.states[this.selectedIndex] = 'in'; } static { this.ɵfac = function CaucaSlideshowComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaSlideshowComponent)(); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaSlideshowComponent, selectors: [["cauca-slideshow"]], viewQuery: function CaucaSlideshowComponent_Query(rf, ctx) { if (rf & 1) { i0.ɵɵviewQuery(_c0$1, 7); } if (rf & 2) { let _t; i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.container = _t.first); } }, inputs: { height: "height", autoPlay: "autoPlay", images: "images" }, standalone: false, decls: 3, vars: 1, consts: [["container", ""], [1, "slideshow"], [4, "ngFor", "ngForOf"], [3, "src"]], template: function CaucaSlideshowComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 1, 0); i0.ɵɵtemplate(2, CaucaSlideshowComponent_div_2_Template, 2, 2, "div", 2); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(2); i0.ɵɵproperty("ngForOf", ctx.images); } }, dependencies: [i2.NgForOf], styles: [".slideshow[_ngcontent-%COMP%]{margin:0 auto;position:relative;overflow:hidden}.slideshow[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%;height:100%;position:absolute}img[_ngcontent-%COMP%]{max-height:100%;max-width:100%;margin:0 auto;display:block}"], data: { animation: [ trigger('slideUpDown', [ state('in', style({ transform: 'translateY(0%)' })), state('out', style({ transform: 'translateY(-100%)' })), transition('in => out', [ animate('500ms ease-in') ]), transition('out => in', [ style({ transform: 'translateY(100%)' }), animate('500ms ease-in') ]), ]), trigger('slideLeftRight', [ state('in', style({ transform: 'translateX(0%)' })), state('out', style({ transform: 'translateX(-100%)' })), transition('in => out', [ animate('500ms ease-in') ]), transition('out => in', [ style({ transform: 'translateX(100%)' }), animate('500ms ease-in') ]), ]), ] } }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaucaSlideshowComponent, [{ type: Component, args: [{ selector: 'cauca-slideshow', animations: [ trigger('slideUpDown', [ state('in', style({ transform: 'translateY(0%)' })), state('out', style({ transform: 'translateY(-100%)' })), transition('in => out', [ animate('500ms ease-in') ]), transition('out => in', [ style({ transform: 'translateY(100%)' }), animate('500ms ease-in') ]), ]), trigger('slideLeftRight', [ state('in', style({ transform: 'translateX(0%)' })), state('out', style({ transform: 'translateX(-100%)' })), transition('in => out', [ animate('500ms ease-in') ]), transition('out => in', [ style({ transform: 'translateX(100%)' }), animate('500ms ease-in') ]), ]), ], standalone: false, template: "<div #container class=\"slideshow\">\n <div *ngFor=\"let url of images; let index = index;\" [@slideLeftRight]=\"getState(index)\">\n <img [src]=\"url\" />\n </div>\n</div>", styles: [".slideshow{margin:0 auto;position:relative;overflow:hidden}.slideshow>div{width:100%;height:100%;position:absolute}img{max-height:100%;max-width:100%;margin:0 auto;display:block}\n"] }] }], null, { container: [{ type: ViewChild, args: ['container', { static: true }] }], height: [{ type: Input }], autoPlay: [{ type: Input }], images: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaSlideshowComponent, { className: "CaucaSlideshowComponent", filePath: "lib/cauca-slideshow/cauca-slideshow.component.ts", lineNumber: 34 }); })(); class TestComponentWithClassicInputComponent { constructor() { this.valueChange = new EventEmitter(); } changeValue(value) { this.value = value; this.valueChange.emit(value); } static { this.ɵfac = function TestComponentWithClassicInputComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TestComponentWithClassicInputComponent)(); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TestComponentWithClassicInputComponent, selectors: [["cauca-test-component-with-classic-input"]], inputs: { value: "value" }, outputs: { valueChange: "valueChange" }, decls: 2, vars: 1, template: function TestComponentWithClassicInputComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "p"); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(); i0.ɵɵtextInterpolate(ctx.value); } }, encapsulation: 2 }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TestComponentWithClassicInputComponent, [{ type: Component, args: [{ selector: 'cauca-test-component-with-classic-input', imports: [], template: "<p>{{value}}</p>\r\n" }] }], null, { value: [{ type: Input }], valueChange: [{ type: Output }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TestComponentWithClassicInputCo