UNPKG

@fivethree/core

Version:
1,222 lines (1,211 loc) 333 kB
import { EventEmitter, Component, ChangeDetectionStrategy, Input, HostBinding, Output, NgModule, Directive, ContentChild, Host, ElementRef, Injectable, ɵɵdefineInjectable, ViewChild, ViewEncapsulation, Optional, Inject, ChangeDetectorRef, Renderer2, ɵɵinject, HostListener, TemplateRef, ComponentFactoryResolver, RendererFactory2, ApplicationRef, Injector, INJECTOR, ViewContainerRef, forwardRef, ViewChildren, ContentChildren, Self } from '@angular/core'; import { trigger, transition, animate, state, style, AnimationBuilder, keyframes, animation, useAnimation } from '@angular/animations'; import { CommonModule, DOCUMENT } from '@angular/common'; import { IonicModule, IonTabs, Platform, IonContent, IonLabel, NavController, DomController, IonMenu, IonSplitPane, IonIcon } from '@ionic/angular'; import { Router, NavigationEnd, NavigationStart } from '@angular/router'; import { BehaviorSubject, timer, interval, Subject, fromEvent, merge, from, zip, of } from 'rxjs'; import { DomSanitizer } from '@angular/platform-browser'; import { __read, __spread, __awaiter, __generator } from 'tslib'; import { takeUntil, map, pairwise, distinctUntilChanged, repeat, filter, tap, take, flatMap, first, repeatWhen, withLatestFrom, skipWhile, takeLast, mergeMap, throttleTime } from 'rxjs/operators'; import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms'; import { getPosition, tween, easeOutSine, fromToPixels, setPosition, fromTo, reverse, transform, scale, fadeIn, beforeStyle, fadeOut, easeInSine, after, AnimationsModule } from '@fivethree/ngx-rxjs-animations'; /** * @fileoverview added by tsickle * Generated from: lib/icon/icon.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivIcon = /** @class */ (function () { function FivIcon() { this._badge = 0; this.state = 'normal'; this.off = false; this.animationDisabled = false; this.transitionDone = new EventEmitter(); this.indicatorState = 'scale'; this.badgeState = 'scale'; } Object.defineProperty(FivIcon.prototype, "name", { get: /** * @return {?} */ function () { return this._name; }, set: /** * @param {?} name * @return {?} */ function (name) { if (this._name) { this.transform(name); } else { this._name = name; } }, enumerable: true, configurable: true }); Object.defineProperty(FivIcon.prototype, "badge", { get: /** * @return {?} */ function () { return this._badge; }, set: /** * @param {?} value * @return {?} */ function (value) { this.transformIndicator(value); }, enumerable: true, configurable: true }); Object.defineProperty(FivIcon.prototype, "dot", { get: /** * @return {?} */ function () { return this._dot; }, set: /** * @param {?} dot * @return {?} */ function (dot) { this._dot = dot; if (dot) { this.indicatorState = 'normal'; } }, enumerable: true, configurable: true }); /** * @return {?} */ FivIcon.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @param {?} name * @return {?} */ FivIcon.prototype.transform = /** * @param {?} name * @return {?} */ function (name) { this.temp = name; this.state = 'rotate'; }; /** * @param {?} value * @return {?} */ FivIcon.prototype.transformIndicator = /** * @param {?} value * @return {?} */ function (value) { if (this.dot) { this._badge = value; return; } if (value === 0) { this._badge = value; this.badgeState = 'scale'; } else { if (this.badgeState === 'scale') { this.badgeState = 'normal'; this._badge = value; } else { this.tempValue = value; this.badgeState = 'scale'; } } }; /** * @param {?} event * @return {?} */ FivIcon.prototype.rotateAnimDone = /** * @param {?} event * @return {?} */ function (event) { if (event.fromState === 'normal' && event.toState === 'rotate') { this._name = this.temp; this.state = 'normal'; } if (event.fromState === 'rotate' && event.toState === 'normal') { this.transitionDone.emit(this._name); } }; /** * @param {?} event * @return {?} */ FivIcon.prototype.incrementDone = /** * @param {?} event * @return {?} */ function (event) { if (event.fromState === 'normal' && event.toState === 'scale') { if (this.tempValue > 0) { this.badgeState = 'normal'; this._badge = this.tempValue; } else { this._badge = this.tempValue; } } }; FivIcon.decorators = [ { type: Component, args: [{ selector: 'fiv-icon', template: "<ion-icon [slot]=\"slot\" class=\"icon\" [@rotateAnim]=\"state\" (@rotateAnim.done)=\"rotateAnimDone($event)\" [name]=\"_name\"\n [color]=\"color\"></ion-icon>\n<span [@scaleAnim]=\"indicatorState\" *ngIf=\"dot\" class=\"indicator-dot\"></span>\n<span class=\"off-background\" *ngIf=\"off\"></span>\n<span class=\"off\" *ngIf=\"off\"></span>\n<span *ngIf=\"smallIcon && badge == 0 && !dot\" class=\"indicator-small-icon\">\n <ion-icon [color]=\"color\" slot=\"icon-only\" [name]=\"smallIcon\"></ion-icon>\n</span>\n<span *ngIf=\"badge > 0 && !dot\" [@scaleAnim]=\"badgeState\" (@scaleAnim.done)=\"incrementDone($event)\"\n class=\"indicator-badge\">\n <span *ngIf=\"badge <= 9\">{{badge}}</span>\n <span *ngIf=\"badge > 9\">9+</span>\n</span>", changeDetection: ChangeDetectionStrategy.OnPush, animations: [ trigger('rotateAnim', [ transition('normal => rotate', [animate('125ms ease-out')]), transition('rotate => normal', [animate('125ms ease-in')]), state('rotate', style({ opacity: '0', transform: 'scale(0) rotateZ(45deg)' })), state('normal', style({ opacity: '1', transform: 'scale(1) rotateZ(0deg)' })) ]), trigger('scaleAnim', [ transition('void => normal', [ style({ opacity: '0', transform: 'scale(0)' }), animate('125ms ease-out', style({ opacity: '1', transform: 'scale(1)' })) ]), transition('normal => scale', [animate('125ms ease-out')]), transition('scale => normal', [animate('125ms ease-in')]), state('scale', style({ opacity: '0', transform: 'scale(0)' })), state('normal', style({ opacity: '1', transform: 'scale(1)' })) ]) ], styles: [":host{--fiv-padding-end:0;--fiv-padding-start:0;--fiv-position-top:-2px;--fiv-position-right:-6px;--fiv-icon-height:28px;--fiv-icon-width:28px;--fiv-small-icon-height:18px;--fiv-small-icon-width:18px;--fiv-small-icon-font-size:0.8em;--fiv-badge-height:18px;--fiv-badge-width:18px;--fiv-badge-font-size:0.6em;--fiv-dot-height:18px;--fiv-dot-width:18px;position:relative;display:inline-block}.icon{margin:0;font-size:1.8em;color:var(--fiv-icon-color,var(--ion-color-dark));padding-right:var(--fiv-padding-end);padding-left:var(--fiv-padding-start);height:var(--fiv-icon-height);width:var(--fiv-icon-width)}.indicator-badge{position:absolute;top:var(--fiv-position-top);right:var(--fiv-position-right);height:var(--fiv-badge-height);width:var(--fiv-badge-width);background-color:var(--fiv-badge-background-color,var(--ion-color-primary));color:var(--fiv-badge-color,var(--ion-color-light));border-radius:14px;z-index:13}.indicator-badge *{position:absolute;transform:translateX(-50%) translateY(-50%);left:50%;top:50%;font-size:var(--fiv-badge-font-size)}.indicator-dot{position:absolute;top:var(--fiv-position-top);right:var(--fiv-position-right);height:var(--fiv-dot-height);width:var(--fiv-dot-width);background-color:var(--fiv-dot-background-color,var(--ion-color-primary));border-radius:100%;z-index:11}.indicator-small-icon{position:absolute;top:var(--fiv-position-top);right:var(--fiv-position-right);height:var(--fiv-small-icon-height);width:var(--fiv-small-icon-width);background-color:var(--fiv-small-icon-background-color,var(--ion-color-primary));color:var(--fiv-small-icon-color,var(--ion-color-light));border-radius:14px;z-index:13}.indicator-small-icon *{position:absolute;transform:translateX(-50%) translateY(-50%);left:50%;top:50%;font-size:var(--fiv-small-icon-font-size)}.off{width:120%;height:2px;background:var(--fiv-off-color,var(--fiv-icon-color,var(--ion-color-dark)));position:absolute;left:0;transform:rotateZ(45deg) translateY(10px) translateX(6px)}.off-background{width:120%;height:2px;background:#000;position:absolute;background-color:var(--fiv-off-background-color,var(--ion-color-light));left:2px;transform:rotateZ(45deg) translateY(10px) translateX(6px)}"] }] } ]; /** @nocollapse */ FivIcon.ctorParameters = function () { return []; }; FivIcon.propDecorators = { color: [{ type: Input }], slot: [{ type: Input }], smallIcon: [{ type: Input }], off: [{ type: Input }], animationDisabled: [{ type: Input }, { type: HostBinding, args: ['@.disabled',] }], transitionDone: [{ type: Output }], name: [{ type: Input }], badge: [{ type: Input }], dot: [{ type: Input }] }; return FivIcon; }()); if (false) { /** @type {?} */ FivIcon.prototype._name; /** @type {?} */ FivIcon.prototype._badge; /** @type {?} */ FivIcon.prototype._dot; /** @type {?} */ FivIcon.prototype.tempValue; /** @type {?} */ FivIcon.prototype.state; /** @type {?} */ FivIcon.prototype.temp; /** @type {?} */ FivIcon.prototype.color; /** @type {?} */ FivIcon.prototype.slot; /** @type {?} */ FivIcon.prototype.smallIcon; /** @type {?} */ FivIcon.prototype.off; /** @type {?} */ FivIcon.prototype.animationDisabled; /** @type {?} */ FivIcon.prototype.transitionDone; /** @type {?} */ FivIcon.prototype.indicatorState; /** @type {?} */ FivIcon.prototype.badgeState; } /** * @fileoverview added by tsickle * Generated from: lib/icon/icon.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivIconModule = /** @class */ (function () { function FivIconModule() { } FivIconModule.decorators = [ { type: NgModule, args: [{ declarations: [FivIcon], imports: [CommonModule, IonicModule], exports: [FivIcon] },] } ]; return FivIconModule; }()); /** * @fileoverview added by tsickle * Generated from: lib/app-bar/app-bar-fab.directive.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivAppBarFabDirective = /** @class */ (function () { function FivAppBarFabDirective() { } FivAppBarFabDirective.decorators = [ { type: Directive, args: [{ selector: '[fivAppBarFab]', exportAs: 'fivAppBarFab' },] } ]; FivAppBarFabDirective.propDecorators = { fivAppBarFab: [{ type: Input }] }; return FivAppBarFabDirective; }()); if (false) { /** @type {?} */ FivAppBarFabDirective.prototype.fivAppBarFab; } /** * @fileoverview added by tsickle * Generated from: lib/app-bar/app-bar.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivAppBar = /** @class */ (function () { function FivAppBar() { this.cutoutVisible = true; } FivAppBar.decorators = [ { type: Component, args: [{ selector: 'fiv-app-bar', template: "<div class=\"appbar\"\n [ngClass]=\"{'cutout': cutoutVisible, 'left': fivFab.fivAppBarFab === 'left', 'right': fivFab.fivAppBarFab === 'right'}\">\n <div class=\"appbar-rect left\">\n <div class=\"tabs\">\n <ng-content select=\"[left]\"></ng-content>\n </div>\n </div>\n <ng-content select=\"fiv-fab\"></ng-content>\n <svg viewBox=\"0 0 100 50\" width=\"100\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M100 0v50H0V0c.543 27.153 22.72 49 50 49S99.457 27.153 99.99 0h.01z\" fill=\"red\" fill-rule=\"evenodd\"/></svg>\n <div class=\"rect-filler\"></div>\n <div class=\"appbar-rect right\">\n <div class=\"tabs\">\n <ng-content select=\"[right]\"></ng-content>\n </div>\n </div>\n</div>", styles: [":host{display:block;position:relative;--fiv-radius:72px;--fiv-appbar-fab-size:56px;--fiv-appbar-height:56px;width:100%;--fiv-border-radius:6px;--fiv-appbar-background-color:var(--ion-color-light);--fiv-side-width:12px;--fiv-fab-icon-color:var(--ion-color-light)}svg{height:calc(var(--fiv-radius)/ 2);width:var(--fiv-radius);left:calc(50% - (var(--fiv-radius)/ 2));position:absolute;bottom:calc(env(safe-area-inset-bottom) + var(--fiv-appbar-height) - var(--fiv-radius)/ 2 - var(--fiv-border-radius))}svg path{fill:var(--fiv-appbar-background-color)}.appbar{width:100%;position:absolute;bottom:0;left:0;height:calc(var(--fiv-appbar-height) + env(safe-area-inset-bottom));background:rgba(0,0,0,0);z-index:5000}.appbar .appbar-rect{overflow:hidden;position:absolute;width:calc(50% - (var(--fiv-radius)/ 2));height:calc(var(--fiv-appbar-height) + env(safe-area-inset-bottom));bottom:0;box-shadow:3px -4px 5px 0 rgba(0,0,0,.1)}.appbar .appbar-rect.left{left:0;background:var(--fiv-appbar-background-color);border-top-right-radius:var(--fiv-border-radius)}.appbar .appbar-rect.right{right:0;background:var(--fiv-appbar-background-color);border-top-left-radius:var(--fiv-border-radius)}.appbar ::ng-deep fiv-fab{position:absolute;left:calc(50% - .5 * var(--fiv-fab-size));top:calc(-.5 * var(--fiv-appbar-fab-size) + var(--fiv-border-radius));display:block;--fiv-fab-size:var(--fiv-appbar-fab-size);z-index:14}.appbar ::ng-deep fiv-fab fiv-icon{--fiv-icon-color:var(--fiv-fab-icon-color)}.appbar .rect-filler{width:var(--fiv-radius);height:calc(env(safe-area-inset-bottom) + var(--fiv-appbar-height) - var(--fiv-radius)/ 2 - var(--fiv-border-radius));position:absolute;overflow:hidden;bottom:0;left:calc(50% - (var(--fiv-radius)/ 2));background:var(--fiv-appbar-background-color)}.appbar:not(.cutout) .appbar-rect.left{border-top-right-radius:0}.appbar:not(.cutout) .appbar-rect.right{border-top-left-radius:0}.appbar.left .appbar-rect.left{width:var(--fiv-side-width)}.appbar.left .appbar-rect.right{width:calc(100% - var(--fiv-radius) - var(--fiv-side-width))}.appbar.left .rect-filler,.appbar.left svg{left:var(--fiv-side-width)}.appbar.left ::ng-deep fiv-fab{transform:translateX(0);left:calc(var(--fiv-side-width) + var(--fiv-radius)/ 2 - var(--fiv-appbar-fab-size)/ 2);position:absolute}.appbar.right .appbar-rect.left{width:calc(100% - var(--fiv-radius) - var(--fiv-side-width))}.appbar.right .appbar-rect.right{width:var(--fiv-side-width)}.appbar.right .rect-filler,.appbar.right svg{left:calc(100% - var(--fiv-radius) - var(--fiv-side-width))}.appbar.right ::ng-deep fiv-fab{transform:translateX(0);left:calc(100% - var(--fiv-side-width) - var(--fiv-radius)/ 2 - var(--fiv-appbar-fab-size)/ 2)}.tabs{display:flex;width:100%;height:100%;position:relative}"] }] } ]; /** @nocollapse */ FivAppBar.ctorParameters = function () { return []; }; FivAppBar.propDecorators = { titleMode: [{ type: Input }], fivFab: [{ type: ContentChild, args: [FivAppBarFabDirective, { static: false },] }] }; return FivAppBar; }()); if (false) { /** @type {?} */ FivAppBar.prototype.cutoutVisible; /** @type {?} */ FivAppBar.prototype.titleMode; /** @type {?} */ FivAppBar.prototype.fivFab; } /** * @fileoverview added by tsickle * Generated from: lib/app-bar/app-bar-tab/app-bar-tab.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivAppBarTab = /** @class */ (function () { function FivAppBarTab(appBar, ionTabs, router, el) { this.appBar = appBar; this.ionTabs = ionTabs; this.router = router; this.el = el; this.type = 'unbounded'; } Object.defineProperty(FivAppBarTab.prototype, "active", { get: /** * @return {?} */ function () { return this.router.url.endsWith(this.href); }, enumerable: true, configurable: true }); Object.defineProperty(FivAppBarTab.prototype, "classes", { get: /** * @return {?} */ function () { return "label-" + this.appBar.titleMode; }, enumerable: true, configurable: true }); /** * @return {?} */ FivAppBarTab.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @return {?} */ FivAppBarTab.prototype.onClick = /** * @return {?} */ function () { this.ionTabs.select(this.tab); }; FivAppBarTab.decorators = [ { type: Component, args: [{ selector: 'fiv-app-bar-tab', template: "<ng-template>\n <ng-content></ng-content>\n</ng-template>\n\n<div (click)=\"onClick()\" class=\"tab ion-activatable\" [ngClass]=\"{'active': active}\">\n <ng-content select=\"fiv-icon\"></ng-content>\n <ng-content *ngIf=\"appBar.titleMode === 'show' || (active && appBar.titleMode === 'active-only')\" select=\"ion-label\">\n </ng-content>\n <ion-ripple-effect [type]=\"type\"></ion-ripple-effect>\n</div>", styles: [":host{width:50%;height:100%;display:inline-block;position:relative}:host .tab{width:100%;height:100%;display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;overflow:visible}:host .tab.active{--fiv-icon-color:var(--fiv-icon-activ-color, var(--ion-color-primary))}:host .tab.active ::ng-deep ion-label{color:var(--ion-color-primary)}:host(.label-hide) ::ng-deep ion-label{display:none}:host(.label-active-only) .tab:not(.active) ::ng-deep ion-label{display:none}"] }] } ]; /** @nocollapse */ FivAppBarTab.ctorParameters = function () { return [ { type: FivAppBar, decorators: [{ type: Host }] }, { type: IonTabs, decorators: [{ type: Host }] }, { type: Router }, { type: ElementRef } ]; }; FivAppBarTab.propDecorators = { tab: [{ type: Input }], href: [{ type: Input }], type: [{ type: Input }], classes: [{ type: HostBinding, args: ['class',] }] }; return FivAppBarTab; }()); if (false) { /** @type {?} */ FivAppBarTab.prototype.tab; /** @type {?} */ FivAppBarTab.prototype.href; /** @type {?} */ FivAppBarTab.prototype.type; /** @type {?} */ FivAppBarTab.prototype.appBar; /** @type {?} */ FivAppBarTab.prototype.ionTabs; /** @type {?} */ FivAppBarTab.prototype.router; /** @type {?} */ FivAppBarTab.prototype.el; } /** * @fileoverview added by tsickle * Generated from: lib/loading-progress-bar/loading.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivLoadingService = /** @class */ (function () { function FivLoadingService() { this.loading = false; this.isComplete = false; this.loadChange = new BehaviorSubject(this.loading); this.completeChange = new BehaviorSubject(this.isComplete); } /** * @return {?} */ FivLoadingService.prototype.load = /** * @return {?} */ function () { this.loading = true; this.loadChange.next(this.loading); }; /** * @return {?} */ FivLoadingService.prototype.unload = /** * @return {?} */ function () { this.loading = false; this.loadChange.next(this.loading); this.isComplete = false; }; /** * @return {?} */ FivLoadingService.prototype.toggleSpinner = /** * @return {?} */ function () { this.loading = !this.loading; }; /** * @return {?} */ FivLoadingService.prototype.complete = /** * @return {?} */ function () { this.isComplete = true; this.completeChange.next(this.isComplete); }; FivLoadingService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ FivLoadingService.ctorParameters = function () { return []; }; /** @nocollapse */ FivLoadingService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FivLoadingService_Factory() { return new FivLoadingService(); }, token: FivLoadingService, providedIn: "root" }); return FivLoadingService; }()); if (false) { /** @type {?} */ FivLoadingService.prototype.loading; /** @type {?} */ FivLoadingService.prototype.isComplete; /** @type {?} */ FivLoadingService.prototype.loadChange; /** @type {?} */ FivLoadingService.prototype.completeChange; } /** * @fileoverview added by tsickle * Generated from: lib/loading-progress-bar/loading-progress-bar.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivLoadingProgressBar = /** @class */ (function () { function FivLoadingProgressBar(loadingService, builder) { this.loadingService = loadingService; this.builder = builder; this.loading = false; this.global = false; this.isComplete = false; this.progress = 0; this.verticalAlign = 'top'; this.fivComplete = new EventEmitter(); this.fivDoneShrinking = new EventEmitter(); this.fivRefresh = new EventEmitter(); this.animating = false; } /** * @return {?} */ FivLoadingProgressBar.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; if (this.global) { this.loadingService.completeChange.subscribe((/** * @param {?} isComplete * @return {?} */ function (isComplete) { if (isComplete) { _this.complete(null); } })); } }; /** * @return {?} */ FivLoadingProgressBar.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.global) { this.loadingService.completeChange.unsubscribe(); } }; /** * @return {?} */ FivLoadingProgressBar.prototype.toggleSpinner = /** * @return {?} */ function () { this.loading = !this.loading; }; /** * @return {?} */ FivLoadingProgressBar.prototype.load = /** * @return {?} */ function () { this.loading = true; this.fivRefresh.emit(this); }; /** * @return {?} */ FivLoadingProgressBar.prototype.unload = /** * @return {?} */ function () { this.loading = false; if (this.isComplete) { this.isComplete = false; } }; /** * @param {?=} param * @return {?} */ FivLoadingProgressBar.prototype.complete = /** * @param {?=} param * @return {?} */ function (param) { this.param = param; this.isComplete = true; this.fillIn(850); }; /** * @param {?} isComplete * @return {?} */ FivLoadingProgressBar.prototype.fillAnimationComplete = /** * @param {?} isComplete * @return {?} */ function (isComplete) { if (isComplete) { this.fivComplete.emit(this.param); this.isComplete = false; this.param = null; if (this.global) { this.loadingService.unload(); } else { this.unload(); } } }; /** * @param {?} progress * @return {?} */ FivLoadingProgressBar.prototype.setProgress = /** * @param {?} progress * @return {?} */ function (progress) { if (progress < 0) { this.progress = 0; return; } if (progress > 100) { this.progress = 100; return; } this.progress = progress; }; /** * @param {?} ms * @return {?} */ FivLoadingProgressBar.prototype.fillIn = /** * @param {?} ms * @return {?} */ function (ms) { var _this = this; // first define a reusable animation this.progress = 0; /** @type {?} */ var myAnimation = this.builder.build([ style({ width: this.progress + "%" }), animate(ms, style({ width: '100%' })) ]); // use the returned factory object to create a player /** @type {?} */ var player = myAnimation.create(this.linear.nativeElement); /** @type {?} */ var t = timer(0, ms / 100).subscribe((/** * @return {?} */ function () { if (_this.progress <= 0) { return t.unsubscribe(); } _this.progress++; })); player.play(); player.onDone((/** * @return {?} */ function () { if (_this.animating) { _this.fillAnimationComplete(true); _this.stopProgressAnimation(); } })); this.stopProgressAnimation(); this.animating = true; this._progressPlayer = player; }; /** * @param {?} ms * @return {?} */ FivLoadingProgressBar.prototype.shrinkIn = /** * @param {?} ms * @return {?} */ function (ms) { var _this = this; // first define a reusable animation this.progress = 100; /** @type {?} */ var myAnimation = this.builder.build([ style({ width: this.progress + "%" }), animate(ms, style({ width: 0 })) ]); // use the returned factory object to create a player /** @type {?} */ var player = myAnimation.create(this.linear.nativeElement); /** @type {?} */ var t = timer(0, ms / 100).subscribe((/** * @return {?} */ function () { if (_this.progress <= 0) { return t.unsubscribe(); } _this.progress--; })); player.play(); player.onDone((/** * @return {?} */ function () { if (_this.animating) { _this.fivDoneShrinking.emit(true); _this.stopProgressAnimation(); } })); this.stopProgressAnimation(); this.animating = true; this._progressPlayer = player; }; /** * @return {?} */ FivLoadingProgressBar.prototype.stopProgressAnimation = /** * @return {?} */ function () { if (this._progressPlayer) { this._progressPlayer.destroy(); this._progressPlayer = null; this.animating = false; } }; FivLoadingProgressBar.decorators = [ { type: Component, args: [{ selector: 'fiv-loading-progress-bar', template: "<div [@progressAnim] *ngIf=\"(!global && loading) || (global && loadingService.loading)\" class=\"slider\" [ngClass]=\"{'top':verticalAlign == 'top','bottom': verticalAlign == 'bottom'}\" >\n <div class=\"line\"></div>\n <div *ngIf=\"!isComplete\" class=\"subline inc\"></div>\n <!-- <div *ngIf=\"isComplete\" [@fillAnim] (@fillAnim.done)=\"fillAnimationComplete(isComplete)\" class=\"subline fill\"></div> -->\n <div *ngIf=\"!isComplete\" class=\"subline dec\"></div>\n</div>\n<div #linear [@progressAnimLinear] class=\"progress\" [ngClass]=\"{'top':verticalAlign == 'top','bottom': verticalAlign == 'bottom'}\" ></div>\n", animations: [ trigger('progressAnim', [ transition('void => *', [ style({ height: '0px' }), animate('250ms ease-out') ]), transition('* => void', [ animate('299ms ease-in', style({ height: '0px' })) ]) ]), trigger('progressAnimLinear', [ transition('void => *', [ style({ height: '0px' }), animate('65ms ease-out') ]), transition('* => void', [ animate('299ms ease-in', style({ height: '0px' })) ]) ]), trigger('fillAnim', [ transition('void => *', [ style({ width: '0px' }), animate('850ms ease-out', style({ width: '100%' })) ]) ]) ], styles: [":host{--background-progress-bar:var(--ion-color-primary);--background-progress:var(--ion-color-primary-shade);--color-spin-0:var(--background-progress);--color-spin-25:var(--background-progress);--color-spin-50:var(--background-progress);--color-spin-75:var(--background-progress);--color-spin-100:var(--background-progress)}.slider{position:absolute;width:100%;height:5px;overflow-x:hidden;z-index:5000}.progress{position:absolute;height:5px;width:0;overflow-x:hidden;z-index:5000;background:var(--background-progress-bar);transition:240ms}.line{position:absolute;opacity:.4;width:240%;height:5px;-webkit-animation:5.6s ease-in-out infinite colorspin;animation:5.6s ease-in-out infinite colorspin}.subline{position:absolute;height:5px;background:inherit}.inc{-webkit-animation:1.6s infinite increase,5.6s ease-in-out infinite colorspin;animation:1.6s infinite increase,5.6s ease-in-out infinite colorspin}.dec{-webkit-animation:1.6s .4s infinite decrease,5.6s ease-in-out infinite colorspin;animation:1.6s .4s infinite decrease,5.6s ease-in-out infinite colorspin}.fill{left:0;width:100%;-webkit-animation:5.6s ease-in-out infinite colorspin;animation:5.6s ease-in-out infinite colorspin}@-webkit-keyframes increase{from{left:-5%;width:5%}to{left:130%;width:100%}}@keyframes increase{from{left:-5%;width:5%}to{left:130%;width:100%}}@-webkit-keyframes decrease{from{left:-80%;width:80%}to{left:110%;width:10%}}@keyframes decrease{from{left:-80%;width:80%}to{left:110%;width:10%}}@-webkit-keyframes colorspin{0%{background-color:var(--color-spin-0)}25%{background-color:var(--color-spin-25)}50%{background-color:var(--color-spin-50)}75%{background-color:var(--color-spin-75)}100%{background-color:var(--color-spin-100)}}@keyframes colorspin{0%{background-color:var(--color-spin-0)}25%{background-color:var(--color-spin-25)}50%{background-color:var(--color-spin-50)}75%{background-color:var(--color-spin-75)}100%{background-color:var(--color-spin-100)}}.top{top:0;left:0}.bottom{bottom:0;left:0}"] }] } ]; /** @nocollapse */ FivLoadingProgressBar.ctorParameters = function () { return [ { type: FivLoadingService }, { type: AnimationBuilder } ]; }; FivLoadingProgressBar.propDecorators = { loading: [{ type: Input }], global: [{ type: Input }], isComplete: [{ type: Input }], verticalAlign: [{ type: Input }], fivComplete: [{ type: Output }], fivDoneShrinking: [{ type: Output }], fivRefresh: [{ type: Output }], bar: [{ type: ViewChild, args: ['bar', { static: false },] }], linear: [{ type: ViewChild, args: ['linear', { static: false },] }] }; return FivLoadingProgressBar; }()); if (false) { /** @type {?} */ FivLoadingProgressBar.prototype.loading; /** @type {?} */ FivLoadingProgressBar.prototype.global; /** @type {?} */ FivLoadingProgressBar.prototype.isComplete; /** @type {?} */ FivLoadingProgressBar.prototype.progress; /** @type {?} */ FivLoadingProgressBar.prototype.verticalAlign; /** @type {?} */ FivLoadingProgressBar.prototype.fivComplete; /** @type {?} */ FivLoadingProgressBar.prototype.fivDoneShrinking; /** @type {?} */ FivLoadingProgressBar.prototype.fivRefresh; /** @type {?} */ FivLoadingProgressBar.prototype.bar; /** @type {?} */ FivLoadingProgressBar.prototype.linear; /** @type {?} */ FivLoadingProgressBar.prototype.param; /** @type {?} */ FivLoadingProgressBar.prototype._progressPlayer; /** * @type {?} * @private */ FivLoadingProgressBar.prototype.animating; /** @type {?} */ FivLoadingProgressBar.prototype.loadingService; /** * @type {?} * @private */ FivLoadingProgressBar.prototype.builder; } /** * @fileoverview added by tsickle * Generated from: lib/loading-progress-bar/loading-progress-bar.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivLoadingProgressBarModule = /** @class */ (function () { function FivLoadingProgressBarModule() { } FivLoadingProgressBarModule.decorators = [ { type: NgModule, args: [{ declarations: [FivLoadingProgressBar], imports: [CommonModule], exports: [FivLoadingProgressBar], providers: [FivLoadingService] },] } ]; return FivLoadingProgressBarModule; }()); /** * @fileoverview added by tsickle * Generated from: lib/center/center.directive.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivCenter = /** @class */ (function () { function FivCenter(sanitizer) { this.sanitizer = sanitizer; this.vertical = true; this.horizontal = true; } Object.defineProperty(FivCenter.prototype, "myStyle", { get: /** * @return {?} */ function () { // tslint:disable-next-line:max-line-length /** @type {?} */ var style = "position: absolute; " + (this.vertical && this.horizontal ? 'top: 50%; left: 50%; transform: translateY(-50%) translateX(-50%);' : this.vertical ? 'top: 50%; transform: translateY(-50%);' : 'left: 50%; transform: translateX(-50%);'); return this.sanitizer.bypassSecurityTrustStyle(style); }, enumerable: true, configurable: true }); Object.defineProperty(FivCenter.prototype, "fivCenter", { set: /** * @param {?} center * @return {?} */ function (center) { if (center) { this.vertical = center.vertical; this.horizontal = center.horizontal; } }, enumerable: true, configurable: true }); /** * @return {?} */ FivCenter.prototype.ngOnInit = /** * @return {?} */ function () { }; FivCenter.decorators = [ { type: Directive, args: [{ selector: '[fivCenter]' },] } ]; /** @nocollapse */ FivCenter.ctorParameters = function () { return [ { type: DomSanitizer } ]; }; FivCenter.propDecorators = { myStyle: [{ type: HostBinding, args: ['style',] }], fivCenter: [{ type: Input }] }; return FivCenter; }()); if (false) { /** @type {?} */ FivCenter.prototype.vertical; /** @type {?} */ FivCenter.prototype.horizontal; /** * @type {?} * @private */ FivCenter.prototype.sanitizer; } /** * @fileoverview added by tsickle * Generated from: lib/center/center.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FivCenterModule = /** @class */ (function () { function FivCenterModule() { } FivCenterModule.decorators = [ { type: NgModule, args: [{ declarations: [FivCenter], imports: [CommonModule], exports: [FivCenter] },] } ]; return FivCenterModule; }()); /** * @fileoverview added by tsickle * Generated from: lib/spinner/spinner.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var BASE_SIZE = 100; var FivSpinner = /** @class */ (function () { function FivSpinner(_document, _elementRef, change, builder, sanitizer) { this._document = _document; this._elementRef = _elementRef; this.change = change; this.builder = builder; this.sanitizer = sanitizer; this._diameter = BASE_SIZE; this._strokeWidth = 10; this._value = 0; this.fivProgress = new EventEmitter(); this.fivComplete = new EventEmitter(); this.mode = 'indeterminate'; this.circleRadius = 45; this._color = 'var(--fiv-spin-color)'; } Object.defineProperty(FivSpinner.prototype, "class", { get: /** * @return {?} */ function () { return (this.mode + ' fiv-spinner fiv-progress-spinner fiv-progress-spinner-indeterminate-animation'); }, enumerable: true, configurable: true }); /** * @return {?} */ FivSpinner.prototype.ngOnInit = /** * @return {?} */ function () { }; Object.defineProperty(FivSpinner.prototype, "viewBox", { get: /** * @return {?} */ function () { /** @type {?} */ var viewBox = this.circleRadius * 2 + this.strokeWidth; return "0 0 " + viewBox + " " + viewBox; }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "strokeCircumference", { /** The stroke circumference of the svg circle. */ get: /** * The stroke circumference of the svg circle. * @return {?} */ function () { return 2 * Math.PI * this.circleRadius; }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "strokeDashOffset", { /** The dash offset of the svg circle. */ get: /** * The dash offset of the svg circle. * @return {?} */ function () { if (this.mode === 'determinate') { return (this.strokeCircumference * (100 - this._value)) / 100; } return null; }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "circleStrokeWidth", { /** Stroke width of the circle in percent. */ get: /** * Stroke width of the circle in percent. * @return {?} */ function () { return (this.strokeWidth / this.diameter) * 100; }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "value", { /** Value of the progress circle. */ get: /** * Value of the progress circle. * @return {?} */ function () { return this.mode === 'determinate' ? this._value : 0; }, set: /** * @param {?} newValue * @return {?} */ function (newValue) { this._value = Math.max(0, Math.min(100, newValue)); }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "diameter", { get: /** * @return {?} */ function () { return this._diameter; }, set: /** * @param {?} size * @return {?} */ function (size) { this._diameter = size; if (!FivSpinner.diameters.has(this._diameter)) { this._attachStyleNode(); } }, enumerable: true, configurable: true }); Object.defineProperty(FivSpinner.prototype, "strokeWidth", { /** Stroke width of the progress spinner. */ get: /** * Stroke width of the progress spinner. * @return {?} */ function () { return this._strokeWidth || this.diameter / 10; }, set: /** * @param {?} value * @return {?} */ function (value) { this._strokeWidth = value; }, enumerable: true, configurable: true }); /** Dynamically generates a style tag containing the correct animation for this diameter. */ /** * Dynamically generates a style tag containing the correct animation for this diameter. * @private * @return {?} */ FivSpinner.prototype._attachStyleNode = /** * Dynamically generates a style tag containing the correct animation for this diameter. * @private * @return {?} */ function () { /** @type {?} */ var styleTag = FivSpinner.styleTag; if (!styleTag) { styleTag = this._document.createElement('style'); this._document.head.appendChild(styleTag); FivSpinner.styleTag = styleTag; } if (styleTag && styleTag.sheet) { ((/** @type {?} */ (styleTag.sheet))).insertRule(this._getAnimationText(), 0); } FivSpinner.diameters.add(this.diameter); }; /** Generates animation styles adjusted for the spinner's diameter. */ /** * Generates animation styles adjusted for the spinner's diameter. * @private * @return {?} */ FivSpinner.prototype._getAnimationText = /** * Generates animation styles adjusted for the spinner's diameter. * @private * @return {?} */ function () { /** @type {?} */ var INDETERMINATE_ANIMATION_TEMPLATE = "\n @keyframes fiv-progress-spinner-stroke-rotate-DIAMETER {\n 0% { stroke-dashoffset: START_VALUE; transform: rotate(0); }\n 12.5% { stroke-dashoffset: END_VALUE; transform: rotate(0); }\n 12.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n 25% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n 25.0001% { stroke-dashoffset: START_VALUE; transform: rotate(270deg); }\n 37.5% { stroke-dashoffset: END_VALUE; transform: rotate(270deg); }\n 37.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n 50% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n 50.0001% { stroke-dashoffset: START_VALUE; transform: rotate(180deg); }\n 62.5% { stroke-dashoffset: END_VALUE; transform: rotate(180deg); }\n 62.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n 75% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n 75.0001% { stroke-dashoffset: START_VALUE; transform: rotate(90deg); }\n 87.5% { stroke-dashoffset: END_VALUE; transform: rotate(90deg); }\n 87.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n 100% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n }\n "; return (INDETERMINATE_ANIMATION_TEMPLATE // Animation should begin at 5% and end at 80% .replace(/START_VALUE/g, "" + 0.95 * this.strokeCircumference) .replace(/END_VALUE/g, "" + 0.2 * this.strokeCircumference) .replace(/DIAMETER/g, "" + this.diameter)); }; /** * @param {?} duration * @return {?} */ FivSpinner.prototype.completeIn = /** * @param {?} duration * @return {?} */ function (duration) { var _this = this; this.mode = 'determinate'; this.change.detectChanges(); /** @type {?} */ var animation = this.builder.build([ style({ 'stroke-dasharray': 180, 'stroke-dashoffset': 90, transformOrigin: 'center', stroke: 'var(--fiv-spin-color)' }), animate(duration + "ms ease-out", style({ 'stroke-dasharray': 315, 'stroke-dashoffset': 0, transformOrigin: 'center', stroke: 'var(--fiv-spin-color)', opacity: 0 })) ]); /** @type {?} */ var player = animation.create(this.determinateCircle.nativeElement); player.play(); player.onDone((/** * @return {?} */ function () { _this.fivComplete.emit(_this); _this._value = 0; })); /** @type {?} */ var i = interval(duration / 100); /** @type {?} */ var t = timer(duration + duration / 50); /** @type {?} */ var progress = i.pipe(takeUntil(t)); progress.subscribe((/** * @param {?} p * @return {?} */ function (p) { _this.fivProgress.emit(p); })); }; /** * @param {?} progress * @return {?} */ FivSpinner.prototype.setValue = /** * @param {?} progress * @return {?} */ function (progress) { this.mode = 'determinate'; this._value = progress; this.change.detectChanges(); }; /** * @return {?} */ FivSpinner.prototype.spin = /** * @return {?} */ function () { this.mode = 'indeterminate'; this.change.detectChanges(); }; /** * @return {?} */ FivSpinner.prototype.stop = /** * @return {?} */ function () { this._value = 0; this.change.detectChanges(); }; /** * @param {?} mode * @return {?} */ FivSpinner.prototype.setMode = /** * @param {?} mode * @return {?} */ function (mode) { this.mode = mode; this.change.detectChanges(); }; FivSpinner.diameters = new Set([BASE_SIZE]); FivSpinner.styleTag = null; FivSpinner.decorators = [ { type: Component, args: [{ selector: 'fiv-spinner', template: "<svg [style.width.px]=\"diameter\" [style.height.px]=\"diameter\" [attr.viewBox]=\"viewBox\"\n preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\" [ngSwitch]=\"mode == 'indeterminate'\">\n <circle [attr.stroke]=\"_color\" *ngSwitchCase=\"true\" cx=\"50%\" cy=\"50%\" [attr.r]=\"circleRadius\"\n [style.animation-name]=\"'fiv-progress-spinner-stroke-rotate-' + diameter\"\n [style.stroke-dashoffset.px]=\"strokeDashOffset\" [style.stroke-dasharray.px]=\"strokeCircumference\"\n [style.stroke-width.%]=\"circleStrokeWidth\"></circle>\n\n <circle [attr.stroke]=\"_color\" class=\"determinate-circle\" #determinateCircle *ngSwitchCase=\"false\" cx=\"50%\" cy=\"50%\"\n [attr.r]=\"circleRadius\" [style.stroke-dashoffset.px]=\"strokeDashOffset\"\n [style.stroke-dasharray.px]=\"strokeCircumference\" [style.stroke-width.%]=\"circleStrokeWidth\"></circle>\n</svg>", // tslint:disable-next-line:use-host-property-decorator host: { '[style.width.px]': 'diameter', '[style.height.px]': 'diameter' }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: ["fiv-spinner{display:block;position:relative}fiv-spinner svg{position:absolute;transform:rotate(-90deg);top:0;left:0;transform-origin:center;overflow:visible}fiv-spinner circle{fill:transparent;transform-origin:ce