truly-ui
Version:
Web Components for Desktop Applications.
1,098 lines (1,071 loc) • 10.4 MB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, Component, Input, TemplateRef, ViewChild, ContentChildren, NgModule, InjectionToken, Directive, HostBinding, EventEmitter, Optional, Inject, Self, Output, Pipe, ViewChildren, HostListener, forwardRef, ContentChild, ViewContainerRef, ChangeDetectionStrategy, ElementRef, ViewEncapsulation, APP_INITIALIZER, SkipSelf, LOCALE_ID, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule, DatePipe, DOCUMENT } from '@angular/common';
import * as i1$1 from '@angular/forms';
import { FormsModule, NG_VALIDATORS, NgModel, ReactiveFormsModule, UntypedFormControl, Validators as Validators$2, NG_VALUE_ACCESSOR, NG_ASYNC_VALIDATORS, FormControlName, UntypedFormGroup, NgForm } from '@angular/forms';
import { ActiveDescendantKeyManager, A11yModule, FocusKeyManager } from '@angular/cdk/a11y';
import * as i6 from '@angular/cdk/scrolling';
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
import { DataSource } from '@angular/cdk/collections';
import { Subject, Subscription, BehaviorSubject, of, fromEvent, throwError } from 'rxjs';
import * as objectPath from 'object-path';
import * as i1$2 from '@angular/cdk/overlay';
import { CdkOverlayOrigin, OverlayModule, CdkConnectedOverlay } from '@angular/cdk/overlay';
import { debounceTime, distinctUntilChanged, filter, map as map$1 } from 'rxjs/operators';
import * as i1$3 from '@angular/platform-browser';
import { Md5 } from 'ts-md5/dist/md5';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { map, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, filter as filter$1 } from 'rxjs/internal/operators';
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
import { __awaiter, __decorate, __param } from 'tslib';
import 'reflect-metadata';
import * as i1$4 from '@angular/router';
import * as stringFormat from 'string-format';
import * as i3 from 'ngx-virtual-scroller';
import { VirtualScrollerModule } from 'ngx-virtual-scroller';
import { HttpClientModule } from '@angular/common/http';
/*
MIT License
Copyright (c) 2019 Temainfo Sistemas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
class AccordionService {
constructor() {
this.accordionItems = [];
}
getColor() {
return this.color;
}
setAccordionList(list, singleOpened, color) {
this.accordionItems = list;
this.singleOpened = singleOpened;
this.color = color;
}
closeAll(accordion) {
if (this.singleOpened) {
this.accordionItems.forEach((item) => {
if (accordion !== item) {
item.close();
}
});
}
}
}
/** @nocollapse */ AccordionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
/** @nocollapse */ AccordionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionService, decorators: [{
type: Injectable
}], ctorParameters: function () { return []; } });
class TlDxIconComponent {
constructor() {
this.size = '12px';
this.PREFIX = 'dx-icon dx-icon-';
}
ngOnInit() {
this.formatClass();
}
formatClass() {
this.format = this.PREFIX + this.icon;
this.format += (this.animation) ? ' anim-' + this.animation + ' animated' : '';
this.format += (this.align) ? ' pull-' + this.align : '';
}
ngOnChanges() {
this.formatClass();
}
}
/** @nocollapse */ TlDxIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlDxIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlDxIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlDxIconComponent, selector: "tl-dx-icon", inputs: { icon: "icon", size: "size", animation: "animation", color: "color", align: "align" }, usesOnChanges: true, ngImport: i0, template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlDxIconComponent, decorators: [{
type: Component,
args: [{ selector: 'tl-dx-icon', template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n" }]
}], ctorParameters: function () { return []; }, propDecorators: { icon: [{
type: Input
}], size: [{
type: Input
}], animation: [{
type: Input
}], color: [{
type: Input
}], align: [{
type: Input
}] } });
class TlFaIconComponent {
constructor() {
this.size = '12px';
this.PREFIX = 'fa-';
}
ngOnInit() {
this.formatClass();
}
formatClass() {
if (this.style === undefined) {
this.style = 'fas';
}
this.format = this.style + ' ';
this.format += this.PREFIX + this.icon;
this.format += (this.animation) ? ' anim-' + this.animation + ' animated' : '';
this.format += (this.align) ? ' pull-' + this.align : '';
}
ngOnChanges() {
this.formatClass();
}
}
/** @nocollapse */ TlFaIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlFaIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlFaIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlFaIconComponent, selector: "tl-fa-icon", inputs: { icon: "icon", style: "style", size: "size", animation: "animation", color: "color", align: "align" }, usesOnChanges: true, ngImport: i0, template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlFaIconComponent, decorators: [{
type: Component,
args: [{ selector: 'tl-fa-icon', template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n" }]
}], ctorParameters: function () { return []; }, propDecorators: { icon: [{
type: Input
}], style: [{
type: Input
}], size: [{
type: Input
}], animation: [{
type: Input
}], color: [{
type: Input
}], align: [{
type: Input
}] } });
class TlIonIconComponent {
constructor() {
this.size = '12px';
this.PREFIX = 'ion ion';
}
ngOnInit() {
this.formatClass();
}
formatClass() {
if (this.style === undefined) {
this.style = 'md';
}
this.format = this.PREFIX + '-' + this.style + '-' + this.icon;
this.format += (this.animation) ? ' anim-' + this.animation + ' animated' : '';
this.format += (this.align) ? ' pull-' + this.align : '';
}
ngOnChanges() {
this.formatClass();
}
}
/** @nocollapse */ TlIonIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlIonIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlIonIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlIonIconComponent, selector: "tl-ion-icon", inputs: { icon: "icon", style: "style", size: "size", animation: "animation", color: "color", align: "align" }, usesOnChanges: true, ngImport: i0, template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlIonIconComponent, decorators: [{
type: Component,
args: [{ selector: 'tl-ion-icon', template: "<i class=\"{{ format }}\" [ngStyle]=\"{'font-size': size, 'color': color}\"></i>\n" }]
}], ctorParameters: function () { return []; }, propDecorators: { icon: [{
type: Input
}], style: [{
type: Input
}], size: [{
type: Input
}], animation: [{
type: Input
}], color: [{
type: Input
}], align: [{
type: Input
}] } });
/*
MIT License
Copyright (c) 2019 Temainfo Software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
class TlIcons {
constructor(change) {
this.change = change;
}
ngAfterViewInit() {
this.contentIconCode();
}
contentIconCode() {
if (this.content.nativeElement.innerText) {
this.icon = this.content.nativeElement.innerText;
if (this.isFullCode()) {
this.lib = this.icon.substr(0, 2);
this.lib = (this.lib === 'io') ? 'ion' : this.lib;
this.getStyle();
}
this.change.detectChanges();
}
}
isFullCode() {
const space = this.icon.indexOf(' ');
return space !== -1;
}
getStyle() {
let fistSplit, secondSplit;
if (this.lib === 'fa') {
fistSplit = 0;
secondSplit = this.icon.indexOf(' ');
}
if (this.lib === 'ion') {
fistSplit = this.icon.indexOf('-') + 1;
secondSplit = this.icon.indexOf('-', fistSplit) - fistSplit;
}
this.setStyle(fistSplit, secondSplit);
}
setStyle(start, length) {
this.style = this.icon.substr(start, length);
switch (this.lib) {
case 'dx':
this.setIcon(16);
break;
case 'fa':
const fistSplit = this.icon.indexOf('-') + 1;
this.setIcon(fistSplit);
break;
case 'ion':
this.setIcon((start + length) + 1);
break;
}
}
setIcon(start) {
this.icon = this.icon.substr(start);
}
}
/** @nocollapse */ TlIcons.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlIcons, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlIcons.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlIcons, selector: "tl-icon", inputs: { icon: "icon", lib: "lib", style: "style", size: "size", animation: "animation", color: "color", align: "align" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }, { propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: "<tl-dx-icon [icon]=\"icon\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'dx'\"></tl-dx-icon>\n<tl-fa-icon [icon]=\"icon\" [style]=\"style\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'fa'\"></tl-fa-icon>\n<tl-ion-icon [icon]=\"icon\" [style]=\"style\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'ion'\"></tl-ion-icon>\n<div hidden #content>\n <ng-content></ng-content>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TlDxIconComponent, selector: "tl-dx-icon", inputs: ["icon", "size", "animation", "color", "align"] }, { kind: "component", type: TlFaIconComponent, selector: "tl-fa-icon", inputs: ["icon", "style", "size", "animation", "color", "align"] }, { kind: "component", type: TlIonIconComponent, selector: "tl-ion-icon", inputs: ["icon", "style", "size", "animation", "color", "align"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlIcons, decorators: [{
type: Component,
args: [{ selector: 'tl-icon', template: "<tl-dx-icon [icon]=\"icon\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'dx'\"></tl-dx-icon>\n<tl-fa-icon [icon]=\"icon\" [style]=\"style\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'fa'\"></tl-fa-icon>\n<tl-ion-icon [icon]=\"icon\" [style]=\"style\" [size]=\"size\" [animation]=\"animation\" [color]=\"color\" [align]=\"align\" *ngIf=\"lib === 'ion'\"></tl-ion-icon>\n<div hidden #content>\n <ng-content></ng-content>\n</div>\n" }]
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { icon: [{
type: Input
}], lib: [{
type: Input
}], style: [{
type: Input
}], size: [{
type: Input
}], animation: [{
type: Input
}], color: [{
type: Input
}], align: [{
type: Input
}], content: [{
type: ViewChild,
args: ['content', { static: true }]
}], template: [{
type: ViewChild,
args: [TemplateRef, { static: true }]
}] } });
class TlAccordionItem {
constructor(accordionService) {
this.accordionService = accordionService;
this.title = 'Title 1';
this.heightHeader = '45px';
this.disabled = false;
this.opened = false;
}
toggle() {
if (this.disabled) {
return;
}
this.accordionService.closeAll(this);
this.opened = !this.opened;
}
getColor() {
return this.accordionService.getColor();
}
close() {
this.opened = false;
}
}
/** @nocollapse */ TlAccordionItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlAccordionItem, deps: [{ token: AccordionService }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlAccordionItem.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlAccordionItem, selector: "tl-accordion-item", inputs: { title: "title", heightHeader: "heightHeader", disabled: "disabled", opened: "opened" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, static: true }], ngImport: i0, template: "<div [class]=\"'ui-wrapper-accordion-item ' + getColor()\">\n <div class=\"ui-accordion-item-header\"\n [ngClass]=\"{'opened': opened, 'disabled': disabled}\"\n [style.height]=\"heightHeader\"\n [style.line-height]=\"heightHeader\"\n [style.border-bottom]=\"opened ? '1px solid #DCDCDC' : 0\"\n (click)=\"toggle()\">\n <div class=\"ui-accordion-arrow\">\n <tl-icon [lib]=\"'ion'\" [style]=\"'ios'\" [icon]=\"(!opened) ? 'arrow-forward' : 'arrow-down'\"></tl-icon>\n </div>\n <span>{{title}}</span>\n </div>\n\n <div #panel\n [style.max-height.px]=\"opened ? panel.scrollHeight : 0\"\n [style.display]=\"'block' ? opened : 'none'\"\n class=\"ui-accordion-item-content\">\n <ng-content></ng-content>\n </div>\n\n</div>\n", styles: ["*{-webkit-user-select:none;user-select:none}.ui-accordion-item-header{display:grid;font-family:Segoe UI,Lato,\"sans-serif\",Arial;font-size:1.2em;box-sizing:border-box;grid-template-columns:40px 1fr}.ui-accordion-item-header>.ui-accordion-arrow{text-align:center;font-size:.9em}.ui-accordion-item-header:hover{cursor:pointer}.ui-accordion-item-content{padding:0 5px;max-height:0;overflow:hidden;transition:all .3s linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: TlIcons, selector: "tl-icon", inputs: ["icon", "lib", "style", "size", "animation", "color", "align"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlAccordionItem, decorators: [{
type: Component,
args: [{ selector: 'tl-accordion-item', template: "<div [class]=\"'ui-wrapper-accordion-item ' + getColor()\">\n <div class=\"ui-accordion-item-header\"\n [ngClass]=\"{'opened': opened, 'disabled': disabled}\"\n [style.height]=\"heightHeader\"\n [style.line-height]=\"heightHeader\"\n [style.border-bottom]=\"opened ? '1px solid #DCDCDC' : 0\"\n (click)=\"toggle()\">\n <div class=\"ui-accordion-arrow\">\n <tl-icon [lib]=\"'ion'\" [style]=\"'ios'\" [icon]=\"(!opened) ? 'arrow-forward' : 'arrow-down'\"></tl-icon>\n </div>\n <span>{{title}}</span>\n </div>\n\n <div #panel\n [style.max-height.px]=\"opened ? panel.scrollHeight : 0\"\n [style.display]=\"'block' ? opened : 'none'\"\n class=\"ui-accordion-item-content\">\n <ng-content></ng-content>\n </div>\n\n</div>\n", styles: ["*{-webkit-user-select:none;user-select:none}.ui-accordion-item-header{display:grid;font-family:Segoe UI,Lato,\"sans-serif\",Arial;font-size:1.2em;box-sizing:border-box;grid-template-columns:40px 1fr}.ui-accordion-item-header>.ui-accordion-arrow{text-align:center;font-size:.9em}.ui-accordion-item-header:hover{cursor:pointer}.ui-accordion-item-content{padding:0 5px;max-height:0;overflow:hidden;transition:all .3s linear}\n"] }]
}], ctorParameters: function () { return [{ type: AccordionService }]; }, propDecorators: { title: [{
type: Input
}], heightHeader: [{
type: Input
}], disabled: [{
type: Input
}], opened: [{
type: Input
}], panel: [{
type: ViewChild,
args: ['panel', { static: true }]
}] } });
class TlAccordion {
constructor(accordionService) {
this.accordionService = accordionService;
this.singleOpened = false;
this.color = 'primary';
}
ngAfterContentInit() {
this.accordionService.setAccordionList(this.listAccordion.toArray(), this.singleOpened, this.color);
}
}
/** @nocollapse */ TlAccordion.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlAccordion, deps: [{ token: AccordionService }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TlAccordion.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TlAccordion, selector: "tl-accordion", inputs: { singleOpened: "singleOpened", color: "color" }, providers: [AccordionService], queries: [{ propertyName: "listAccordion", predicate: TlAccordionItem }], ngImport: i0, template: "<div class=\"ui-wrapper-accordion\">\n <div class=\"ui-wrapper-accordion-items\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".ui-wrapper-accordion{cursor:pointer;width:100%;text-align:left;border:none;outline:none}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlAccordion, decorators: [{
type: Component,
args: [{ selector: 'tl-accordion', providers: [AccordionService], template: "<div class=\"ui-wrapper-accordion\">\n <div class=\"ui-wrapper-accordion-items\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".ui-wrapper-accordion{cursor:pointer;width:100%;text-align:left;border:none;outline:none}\n"] }]
}], ctorParameters: function () { return [{ type: AccordionService }]; }, propDecorators: { singleOpened: [{
type: Input
}], color: [{
type: Input
}], listAccordion: [{
type: ContentChildren,
args: [TlAccordionItem]
}] } });
class IconsModule {
}
/** @nocollapse */ IconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IconsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ IconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: IconsModule, declarations: [TlIcons,
TlDxIconComponent,
TlFaIconComponent,
TlIonIconComponent], imports: [CommonModule], exports: [TlIcons,
TlDxIconComponent,
TlFaIconComponent,
TlIonIconComponent] });
/** @nocollapse */ IconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IconsModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IconsModule, decorators: [{
type: NgModule,
args: [{
imports: [
CommonModule
],
declarations: [
TlIcons,
TlDxIconComponent,
TlFaIconComponent,
TlIonIconComponent
],
exports: [
TlIcons,
TlDxIconComponent,
TlFaIconComponent,
TlIonIconComponent
]
}]
}] });
class AccordionModule {
}
/** @nocollapse */ AccordionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ AccordionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: AccordionModule, declarations: [TlAccordion,
TlAccordionItem], imports: [CommonModule,
FormsModule,
IconsModule], exports: [TlAccordion,
TlAccordionItem] });
/** @nocollapse */ AccordionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionModule, imports: [CommonModule,
FormsModule,
IconsModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AccordionModule, decorators: [{
type: NgModule,
args: [{
imports: [
CommonModule,
FormsModule,
IconsModule
],
declarations: [
TlAccordion,
TlAccordionItem
],
exports: [
TlAccordion,
TlAccordionItem
],
}]
}] });
let AUTOCOMPLETE_CONFIG = new InjectionToken('autocomplete.preview.js');
/*
MIT License
Copyright (c) 2019 Temainfo Sistemas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
class DataSourceList extends DataSource {
constructor(config) {
super();
this.config = config;
this.loadMoreData = new Subject();
this.totalLength = 0;
this.pageSize = 0;
this.lazyMode = false;
this.fetchedPages = new Set();
this.cachedData = [];
this.subscription = new Subscription();
this.arrayTotal = [];
this.currentPage = 0;
this.setProprieties(config);
this.cachedData = this.config.dataSource;
this.dataStream = new BehaviorSubject(this.arrayTotal);
this.resetData();
}
connect(collectionViewer) {
this.subscription.add(collectionViewer.viewChange.subscribe(range => {
const startPage = this.getPageForIndex(range.start);
const endPage = this.getPageForIndex(range.end - 1);
for (let i = startPage; i <= endPage; i++) {
this.fetchPage(i);
}
}));
return this.dataStream;
}
disconnect() {
// this.subscription.unsubscribe();
}
unsubscribe() {
this.subscription.unsubscribe();
}
addPage(page) {
this.fetchedPages.add(page);
}
setArray(value) {
this.arrayTotal.length = value;
this.dataStream.next(this.arrayTotal);
}
resetData() {
this.arrayTotal = Array.from({ length: this.totalLength });
this.dataStream.next(this.arrayTotal);
}
resetPages() {
this.fetchedPages.clear();
}
setProprieties(config) {
Object.keys(config).forEach((value) => {
this[value] = config[value];
});
}
getCachedData() {
return this.cachedData;
}
setData(data) {
this.cachedData = data;
this.arrayTotal.splice(this.currentPage * this.pageSize, this.pageSize, ...data);
this.dataStream.next(this.arrayTotal);
if (data.length === this.pageSize) {
if (!this.fetchedPages.has(0)) {
this.fetchedPages.add(0);
}
}
}
getPageForIndex(index) {
return Math.floor(index / this.pageSize);
}
emitCachedData(skip) {
this.cachedData.slice(skip, this.pageSize);
this.dataStream.next(this.cachedData);
}
emitLoadData(skip) {
this.loadMoreData.next({ skip: skip, limit: this.pageSize + skip });
}
fetchPage(page) {
this.currentPage = page;
if (this.fetchedPages.has(page)) {
return;
}
this.addPage(page);
const skip = page * this.pageSize;
!this.lazyMode ? this.emitCachedData(skip) : this.emitLoadData(skip);
}
}
/*
MIT License
Copyright (c) 2019 Temainfo Sistemas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
class TlItemSelectedDirective {
get isSelected() {
return this.selected;
}
constructor(element) {
this.element = element;
this.selected = false;
this.indexSelected = 0;
}
setActiveStyles() {
this.selected = true;
}
setInactiveStyles() {
this.selected = false;
}
}
/** @nocollapse */ TlItemSelectedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlItemSelectedDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
/** @nocollapse */ TlItemSelectedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TlItemSelectedDirective, selector: "[itemSelected]", inputs: { indexSelected: "indexSelected", itemSelected: "itemSelected" }, host: { properties: { "class.selected": "this.isSelected" } }, exportAs: ["selectItem"], ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TlItemSelectedDirective, decorators: [{
type: Directive,
args: [{
selector: '[itemSelected]',
exportAs: 'selectItem'
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { indexSelected: [{
type: Input
}], itemSelected: [{
type: Input
}], isSelected: [{
type: HostBinding,
args: ['class.selected']
}] } });
function scrollIntoView(node) {
// Non-standard
/* tslint:disable-next-line:no-string-literal */
if (node['scrollIntoViewIfNeeded']) {
/* tslint:disable-next-line:no-string-literal */
node['scrollIntoViewIfNeeded'](false);
return;
}
if (node.scrollIntoView) {
node.scrollIntoView(false);
return;
}
}
class SelectedItemService {
constructor() {
}
set itemSelected(item) {
this._itemSelected = item;
}
get itemSelected() {
return this._itemSelected;
}
}
/** @nocollapse */ SelectedItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectedItemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
/** @nocollapse */ SelectedItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectedItemService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectedItemService, decorators: [{
type: Injectable
}], ctorParameters: function () { return []; } });
class ValueAccessorBase {
constructor() {
this.propagateChange = () => { };
this.propagateTouched = () => { };
}
get value() {
return this.innerValue;
}
set value(value) {
if ((value instanceof Date) && this.innerValue) {
const innerDate = new Date(this.innerValue);
if (innerDate.getTime() === value.getTime()) {
return;
}
}
if (this.innerValue !== value) {
this.innerValue = value;
this.propagateChange(value);
}
}
writeValue(value) {
this.innerValue = value;
}
registerOnChange(fn) {
this.propagateChange = fn;
}
registerOnTouched(fn) {
this.propagateTouched = fn;
}
setDisabledState(isDisabled) {
this.isDisabled = isDisabled;
}
}
/*
MIT License
Copyright (c) 2019 Temainfo Software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var KeyEvent;
(function (KeyEvent) {
KeyEvent["ARROWUP"] = "ArrowUp";
KeyEvent["ARROWDOWN"] = "ArrowDown";
KeyEvent["ARROWLEFT"] = "ArrowLeft";
KeyEvent["ARROWRIGHT"] = "ArrowRight";
KeyEvent["END"] = "End";
KeyEvent["HOME"] = "Home";
KeyEvent["ENTER"] = "Enter";
KeyEvent["NUMPADENTER"] = "NumpadEnter";
KeyEvent["ESCAPE"] = "Escape";
KeyEvent["TAB"] = "Tab";
KeyEvent["SPACE"] = "Space";
KeyEvent["DELETE"] = "Delete";
KeyEvent["BACKSPACE"] = "Backspace";
})(KeyEvent || (KeyEvent = {}));
class InputMask {
constructor(element, renderer, maskValue) {
this.renderer = renderer;
// Desativa a mascara dos Input preenchendo com Underline ( _ )
this.maskGuides = false;
this.addNinthDigit = false;
this.shiftStart = '';
this.maskSpecialCharacters = ['/', '(', ')', '.', ':', '-', ' ', '+'];
this.maskAwaliablePatterns = {
'0': /\d/,
'9': /\d/,
'H': /[0-1-2]/,
'h': /[0-9]/,
'M': /[0-5]/,
'm': /[0-9]/,
'A': /[a-zA-Z]/,
};
this.tlInput = element;
this.input = element.input;
this.setMaskExpression(maskValue);
this.initializeMask();
this.complete = new Subject();
}
setMaskExpression(value) {
if (!value) {
return;
}
if (typeof value === 'string') {
this.maskExpression = value;
return;
}
if (value['guides'] === false) {
this.maskGuides = value['guides'];
}
if (value['addNinthDigit']) {
this.addNinthDigit = value['addNinthDigit'];
}
this.literalChar = value['withLiteralChar'];
this.valueUppercase = value['uppercase'];
this.maskExpression = value['mask'];
}
get value() {
return this.input.nativeElement.value;
}
set value(value) {
this.input.nativeElement.value = value;
}
initializeMask() {
this.initializeOnFocus();
this.generateMaskGuideExpression();
this.applyMaskOnInit();
this.setPlaceholder();
this.setValidation();
this.onKeyPressInputListener();
this.onMouseUpInputListener();
this.onKeyDownInputListener();
this.onPastListener();
}
onPastListener() {
this.renderer.listen(this.input.nativeElement, 'paste', ($event) => {
const clipboardData = $event.clipboardData || window['clipboardData'];
let value = clipboardData
.getData('text')
.replace(/ /g, '')
.replace(/[^\w\s]/gi, '');
value = this.handleAddNinthDigit(value);
this.applyMask(value, false);
});
}
handleAddNinthDigit(value) {
if (this.addNinthDigit) {
if (value.length <= 10) {
value = value.slice(0, 2) + '9' + value.slice(2);
}
}
return value;
}
onKeyPressInputListener() {
this.renderer.listen(this.input.nativeElement, 'keypress', $event => {
this.handleKeypress($event);
this.updateModel();
this.onComplete();
});
}
onMouseUpInputListener() {
this.renderer.listen(this.input.nativeElement, 'mouseup', $event => {
$event.stopPropagation();
this.getPosition();
});
}
onKeyDownInputListener() {
this.renderer.listen(this.input.nativeElement, 'keydown', $event => {
switch ($event.code) {
case KeyEvent.BACKSPACE:
this.handleBackspace($event);
break;
case KeyEvent.DELETE:
this.handleDelete($event);
break;
case KeyEvent.ARROWRIGHT:
this.handleArrowRight($event);
break;
case KeyEvent.ARROWLEFT:
this.handleArrowLeft($event);
break;
case KeyEvent.HOME:
this.handleHome($event);
break;
case KeyEvent.END:
this.handleEnd($event);
break;
case 'KeyA':
this.handleSelectAll($event);
break;
}
});
}
isDateString(x) {
return !isNaN(Date.parse(x));
}
applyMaskOnInit() {
setTimeout(() => {
if (this.value !== this.maskGuideExpression) {
if (this.value.length > 0) {
if (this.isDateString(this.value)) {
return;
}
this.value = this.cleanValue(this.value);
this.setValueOnInitialize();
this.applyGuides();
this.applyMask();
}
}
}, 10);
}
getPosition() {
this.startPosition = this.input.nativeElement.selectionStart;
this.endPosition = this.input.nativeElement.selectionEnd;
}
initializeOnFocus() {
this.renderer.listen(this.input.nativeElement, 'focus', () => {
this.onFocus();
});
this.renderer.listen(this.input.nativeElement, 'focusout', () => {
this.handleNotMath();
});
}
onFocus() {
this.applyGuides();
setTimeout(() => {
if (!this.isTextLengthMatchWithExpressionLength()) {
this.setPosition(0);
}
else {
this.setPosition(0, this.value.length);
}
}, 0);
}
handleNotMath() {
if (!this.isTextLengthMatchWithExpressionLength()) {
this.value = '';
this.updateModel();
this.tlInput.value = '';
}
}
handleBackspace(event) {
const value = this.value;
const start = this.input.nativeElement.selectionStart;
const endPosition = this.input.nativeElement.selectionEnd;
const valueArray = value.split('');
this.getPosition();
if (this.hasTextSelected(this.startPosition, this.endPosition)) {
event.preventDefault();
this.deleteTextOnKeyPress(valueArray, this.startPosition, this.endPosition);
return;
}
if (this.maskGuides) {
event.preventDefault();
if (this.isCharBeforeEqualMaskGuide(value, endPosition)) {
this.jumpCharMask(start, endPosition);
}
else {
this.deleteTextOnKeyPress(valueArray, start, endPosition);
}
}
this.updateModel();
this.onComplete();
}
handleDelete(event) {
const valueArray = this.value.split('');
const self = this;
this.getPosition();
event.preventDefault();
if (this.maskGuides) {
if (this.hasTextSelected(this.startPosition, this.endPosition)) {
this.deleteTextOnKeyPress(valueArray, this.startPosition, this.endPosition);
}
else {
this.value = this.deleteCharOnDeleteKey(valueArray);
this.setPosition(self.endPosition);
}
}
this.updateModel();
this.onComplete();
}
handleKeypress(event) {
const charInputted = event.key;
let inputArray = this.value.split('');
if (event.key === 'Enter') {
return;
}
if (this.hasTextSelected(this.startPosition, this.endPosition)) {
this.deleteTextOnKeyPress(inputArray, this.startPosition, this.endPosition);
this.setPosition(this.startPosition);
inputArray = this.value.split('');
}
if (this.maskGuides) {
this.getPosition();
this.replaceValidChar(charInputted, this.getCursorPosition(this.endPosition), inputArray);
event.preventDefault();
}
else {
this.applyMask(charInputted);
event.preventDefault();
}
}
handleArrowRight(event) {
this.getPosition();
if (event.shiftKey) {
this.setShiftKey('Right');
event.preventDefault();
if (this.shiftStart === 'Left') {
this.setPosition(this.startPosition + 1, this.endPosition);
}
else {
this.setPosition(this.startPosition, this.endPosition + 1);
}
}
}
handleArrowLeft(event) {
this.getPosition();
if (event.shiftKey) {
this.setShiftKey('Left');
event.preventDefault();
if (this.shiftStart === 'Right') {
this.setPosition(this.startPosition, this.endPosition - 1);
}
else {
if (this.startPosition !== 0) {
this.setPosition(this.startPosition - 1, this.endPosition);
}
}
}
}
handleHome(event) {
event.preventDefault();
this.getPosition();
if (event.shiftKey) {
this.setShiftKey('Left');
this.setPosition(0, this.endPosition);
}
else {
this.setPosition(0);
}
}
handleEnd(event) {
event.preventDefault();
this.getPosition();
if (event.shiftKey) {
this.setShiftKey('Right');
this.setPosition(this.startPosition, this.value.length);
}
else {
this.setPosition(this.value.length);
}
}
handleSelectAll(event) {
if (event.ctrlKey) {
this.setPosition(0, this.value.length);
}
}
setShiftKey(value) {
if (this.startPosition === this.endPosition) {
this.shiftStart = '';
}
if (this.shiftStart === '') {
this.shiftStart = value;
}
}
applyMask(charInputted, utilizeOriginal = true) {
let cursor = 0;
let result = '';
if (charInputted !== undefined) {
this.value += charInputted;
}
const inputArray = utilizeOriginal ? this.value.split('') : charInputted.split('');
for (let i = 0, inputSymbol = inputArray[0]; i < inputArray.length; i++, inputSymbol = inputArray[i]) {
if (result.length === this.maskExpression.length) {
break;
}
if (this.isValidSymbolMask(inputSymbol, this.maskExpression[cursor])) {
result += inputSymbol;
cursor++;
}
else if (this.maskSpecialCharacters.indexOf(this.maskExpression[cursor]) !== -1) {
result += this.maskExpression[cursor];
cursor++;
i--;
}
else if (this.maskExpression[cursor] === '9') {
cursor++;
i--;
}
}
this.value = result;
this.updateModel();
this.onComplete();
}
deleteTextOnKeyPress(valueArray, startPosition, endPosition) {
if (this.hasTextSelected(startPosition, endPosition)) {
this.value = this.deleteTextSelected(valueArray, startPosition, endPosition);
this.setPosition(startPosition, startPosition);
}
else {
this.value = this.deleteCharOnBackspaceKey(valueArray, endPosition);
this.setPosition(startPosition - 1, endPosition - 1);
}
}
deleteTextSelected(valueArray, startPosition, endPosition) {
const self = this;
let valueResult = '';
valueArray.forEach(function (myValue, index) {
if (index >= startPosition && index < endPosition && self.maskGuides
&& self.maskSpecialCharacters.indexOf(index) < 0) {
valueResult = valueResult + self.maskGuideExpression[index];
}
else if (index >= startPosition && index < endPosition && self.maskSpecialCharacters.indexOf(index) < 0) {
valueResult = valueResult + '';
}
else {
valueResult = valueResult + myValue;
}
});
return valueResult;
}
deleteCharOnBackspaceKey(valueArray, endPosition) {
const self = this;
let valueResult = '';
valueArray.forEach(function (myValue, index) {
if (index === endPosition - 1) {
valueResult = valueResult + self.maskGuideExpression[endPosition - 1];
}
else {
valueResult = valueResult + myValue;
}
});
return valueResult;
}
deleteCharOnDeleteKey(valueArray) {
const self = this;
valueArray.forEach(function (value, index, array) {
if (index === self.endPosition) {
array[index] = self.maskGuideExpression[self.endPosition];
}
});
return String(valueArray).replace(/,/gi, '');
}
replaceUnderscoreForChar(valueArray, charInputted, cursorEnd) {
if (valueArray.length === 0) {
valueArray = [...this.maskGuideExpression];
}
if (this.maskSpecialCharacters.indexOf(this.maskExpression[cursorEnd]) >= 0) {
cursorEnd++;
}
valueArray.forEach(function (value, index, array) {
if (index === cursorEnd) {
array[index] = charInputted;
}
});
return valueArray.toString().replace(/,/gi, '');
}
getCursorPosition(endPosition) {
let cursor = endPosition;
while (this.maskExpression.length - 1 > cursor) {
if (this.maskSpecialCharacters.indexOf(this.maskExpression[cursor]) >= 0) {
cursor++;
this.setPosition(cursor);
}
else {
break;
}
}
return cursor;
}
replaceValidChar(charInputted, cursor, inputArray) {
if (this.isValidSymbolMask(charInputted, this.maskExpression[cursor]) &&
this.validateHourMatch(charInputted, this.maskExpression[cursor])) {
this.value = this.replaceUnderscoreForChar(inputArray, charInputted, cursor);
this.setPosition(cursor + 1);
}
}
onComplete() {
if (this.isTextLengthMatchWithExpressionLength()) {
this.tlInput.value = this.value;
this.complete.next(true);
}
}
isTextLengthMatchWithExpressionLength() {
return (this.removeUnderscore(this.maskExpression).length === this.removeUnderscore(this.value).length);
}
isValidSymbolMask(inputSymbol, maskSymbolChar) {
if (this.maskSpecialCharacters.indexOf(inputSymbol) >= 0) {
return false;
}
return (inputSymbol === maskSymbolCha