blob: a8f10d7caeddfe8849341f15e0b32e6aa75868e6 [file] [log] [blame]
{"version":3,"sources":["node_modules/tslib/tslib.es6.js","ng://@covalent/core/loading/loading.component.ts","ng://@covalent/core/loading/services/loading.factory.ts","ng://@covalent/core/loading/services/loading.service.ts","ng://@covalent/core/loading/directives/loading.directive.ts","ng://@covalent/core/loading/loading.module.ts"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","Circular","Linear","Determinate","Indeterminate","Overlay","Replace","FullScreen","None","TD_CIRCLE_DIAMETER","TdLoadingComponent","defineProperty","prototype","this","_mode","mode","_defaultMode","_value","value","_changeDetectorRef","markForCheck","ngDoCheck","isOverlay","_hostHeight","animation","_setCircleDiameter","getHeight","isFullScreen","undefined","height","getCircleDiameter","_circleDiameter","getCircleStrokeWidth","strokeWidth","Math","abs","isCircular","type","LoadingType","isLinear","style","LoadingStyle","animationComplete","event","fromState","outAnimationCompleted","inAnimationCompleted","_animationIn","next","_animationOut","startInAnimation","asObservable","startOutAnimation","LoadingMode","diameter","floor","_elementRef","getBoundingClientRect","Component","args","selector","template","animations","tdFadeInOutAnimation","ElementRef","ChangeDetectorRef","Subject","color","TdLoadingFactory","createFullScreenComponent","options","_this","overlayRef","loadingRef","_initializeContext","loading","observable","pipe","distinctUntilChanged","subscribe","registered","_createOverlay","componentRef","attach","ComponentPortal","_mapOptions","instance","changeDetectorRef","detectChanges","subs_1","unsubscribe","destroy","detach","dispose","createOverlayComponent","viewContainerRef","templateRef","_createComponent","content","TemplatePortal","clear","insert","hostView","createReplaceComponent","context","nativeElement","elementRef","nextElementSibling","scrollHeight","contentRef","createEmbeddedView","indexOf","subs_2","state","OverlayConfig","hasBackdrop","positionStrategy","_overlay","position","global","centerHorizontally","centerVertically","create","compRef","_componentFactoryResolver","resolveComponentFactory","_injector","subject","times","Injectable","ComponentFactoryResolver","Injector","LOADING_FACTORY_PROVIDER_FACTORY","parent","componentFactoryResolver","overlay","injector","LOADING_FACTORY_PROVIDER","provide","deps","Optional","SkipSelf","useFactory","TdLoadingConfig","config","name","Error","__extends","__","constructor","tslib_1.__extends","TdLoadingDirectiveConfig","_super","call","strategy","LoadingStrategy","TdLoadingService","createComponent","directiveConfig","_context","_loadingFactory","fullscreenConfig","removeComponent","register","registers","_timeouts","_clearTimeout","setTimeout","resolve","resolves","resolveAll","setValue","clearTimeout","LOADING_PROVIDER_FACTORY","loadingFactory","LOADING_PROVIDER","TdLoadingContext","$implicit","tdLoading","TD_LOADING_NEXT_ID","TdLoadingDirective","_name","until","_loadingService","_type","stategy","_strategy","ngOnInit","_registerComponent","ngOnDestroy","_loadingRef","_viewContainerRef","_templateRef","Directive","ViewContainerRef","TemplateRef","Input","TD_LOADING","TD_LOADING_ENTRY_COMPONENTS","CovalentLoadingModule","NgModule","imports","CommonModule","MatProgressBarModule","MatProgressSpinnerModule","OverlayModule","PortalModule","declarations","exports","providers","entryComponents"],"mappings":"o7BAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,WCd1BO,SAAW,WACXC,OAAS,aAITC,YAAc,cACdC,cAAgB,oBAIhBC,QAAU,UACVC,QAAU,cAIVC,WAAa,aACbF,QAAU,UACVG,KAAO,QAKIC,EAA6B,IAE1CC,GA8BEf,OAAAgB,eAAID,EAAAE,UAAA,OAAI,KAGR,WACE,OAAOC,KAAKC,WAJd,SAASC,GACPF,KAAKG,aAAeD,mCAStBpB,OAAAgB,eAAID,EAAAE,UAAA,QAAK,KAKT,WACE,OAAOC,KAAKI,YANd,SAAUC,GACRL,KAAKI,OAASC,EAEdL,KAAKM,mBAAmBC,gDA6B1BV,EAAAE,UAAAS,UAAA,WAGMR,K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L,mBAAR,WACE,IAAK/K,KAAKwK,MACR,MAAM,IAAInC,MAAM,gDAIbrI,KAAKiL,cACRjL,KAAKiL,YAAcjL,KAAK0K,gBAAgB1B,gBAAgB,CACtDZ,KAAMpI,KAAKwK,MACXhJ,KAAMxB,KAAK2K,MACXzK,KAAMF,KAAKC,MACXqD,MAAOtD,KAAKsD,MACZuF,SAAU7I,KAAK6K,WACd7K,KAAKkL,kBAAmBlL,KAAKmL,aAAcnL,KAAKkJ,gCAzIxDkC,EAAAA,UAAStI,KAAA,CAAC,CACTC,SAAU,2DAlBHsI,EAAAA,wBAAkBC,EAAAA,mBAGlBvC,mCA8BNwC,EAAAA,MAAKzI,KAAA,CAAC,4BAeNyI,EAAAA,MAAKzI,KAAA,CAAC,gCAkBNyI,EAAAA,MAAKzI,KAAA,CAAC,+BAiBNyI,EAAAA,MAAKzI,KAAA,CAAC,mCAiBNyI,EAAAA,MAAKzI,KAAA,CAAC,oCAgBNyI,EAAAA,MAAKzI,KAAA,CAAC,qBAyCTyH,GAvCE,SAAAA,EAAoBW,EACAC,EACAT,GAFA1K,KAAAkL,kBAAAA,EACAlL,KAAAmL,aAAAA,EACAnL,KAAA0K,gBAAAA,EAlGZ1K,KAAAkJ,SAA6B,IAAIiB,EA8FhBnK,KAAAsD,MAAuC,cCvG5DkI,EAA0B,CAC9B3L,EACA0K,GAGIkB,EAA2C,CAC/C5L,GAGF6L,uBAACC,EAAAA,SAAQ7I,KAAA,CAAC,CACR8I,QAAS,CACPC,EAAAA,aACAC,EAAAA,qBACAC,EAAAA,yBACAC,EAAAA,cACAC,EAAAA,cAEFC,aAAc,CACZV,GAEFW,QAAS,CACPX,GAEFY,UAAW,CACTxE,EACAsC,GAEFmC,gBAAiB,CACfZ,OAKJC,GAxBA,SAAAA","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { Component, ViewChild, TemplateRef, ChangeDetectorRef, ChangeDetectionStrategy, ElementRef, DoCheck } from '@angular/core';\nimport { AnimationEvent } from '@angular/animations';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { Observable, Subject } from 'rxjs';\n\nexport enum LoadingType {\n Circular = 'circular',\n Linear = 'linear',\n}\n\nexport enum LoadingMode {\n Determinate = 'determinate',\n Indeterminate = 'indeterminate',\n}\n\nexport enum LoadingStrategy {\n Overlay = 'overlay',\n Replace = 'replace',\n}\n\nexport enum LoadingStyle {\n FullScreen = 'fullscreen',\n Overlay = 'overlay',\n None = 'none',\n}\n\nimport { tdFadeInOutAnimation } from '@covalent/core/common';\n\nexport const TD_CIRCLE_DIAMETER: number = 100;\n\n@Component({\n selector: 'td-loading',\n styleUrls: ['./loading.component.scss' ],\n templateUrl: './loading.component.html',\n animations: [\n tdFadeInOutAnimation,\n ],\n})\nexport class TdLoadingComponent implements DoCheck {\n\n private _animationIn: Subject<any> = new Subject<any>();\n private _animationOut: Subject<any> = new Subject<any>();\n private _mode: LoadingMode = LoadingMode.Indeterminate;\n private _defaultMode: LoadingMode = LoadingMode.Indeterminate;\n private _value: number = 0;\n private _circleDiameter: number = TD_CIRCLE_DIAMETER;\n\n /**\n * Flag for animation\n */\n animation: boolean = false;\n\n /**\n * Content injected into loading component.\n */\n content: TemplatePortal<any>;\n\n /**\n * Sets mode of [TdLoadingComponent] to LoadingMode.Determinate or LoadingMode.Indeterminate\n */\n set mode(mode: LoadingMode) {\n this._defaultMode = mode;\n }\n get mode(): LoadingMode {\n return this._mode;\n }\n\n /**\n * Sets value of [TdLoadingComponent] if mode is 'LoadingMode.Determinate'\n */\n set value(value: number) {\n this._value = value;\n // Check for changes for `OnPush` change detection\n this._changeDetectorRef.markForCheck();\n }\n get value(): number {\n return this._value;\n }\n\n style: LoadingStyle = LoadingStyle.None;\n\n /**\n * height: number\n * Sets height of [TdLoadingComponent].\n */\n height: number;\n\n /**\n * type: LoadingType\n * Sets type of [TdLoadingComponent] rendered.\n */\n type: LoadingType = LoadingType.Circular;\n\n /**\n * color: primary' | 'accent' | 'warn'\n * Sets theme color of [TdLoadingComponent] rendered.\n */\n color: 'primary' | 'accent' | 'warn' = 'primary';\n\n constructor(private _elementRef: ElementRef,\n private _changeDetectorRef: ChangeDetectorRef) {}\n\n ngDoCheck(): void {\n // When overlay is used and the host width has a value greater than 1px\n // set the circle diameter when possible incase the loading component was rendered in a hidden state\n if (this.isOverlay() && this._hostHeight() > 1) {\n if (this.animation) {\n this._setCircleDiameter();\n this._changeDetectorRef.markForCheck();\n }\n }\n }\n\n getHeight(): string {\n // Ignore height if style is `overlay` or `fullscreen`.\n // Add height if child elements have a height and style is `none`, else return default height.\n if (this.isOverlay() || this.isFullScreen()) {\n return undefined;\n } else {\n return this.height ? `${this.height}px` : '150px';\n }\n }\n\n getCircleDiameter(): number {\n return this._circleDiameter;\n }\n\n getCircleStrokeWidth(): number {\n // we calculate the stroke width by setting it as 10% of its diameter\n let strokeWidth: number = this.getCircleDiameter() / 10;\n return Math.abs(strokeWidth);\n }\n\n isCircular(): boolean {\n return this.type === LoadingType.Circular;\n }\n\n isLinear(): boolean {\n return this.type === LoadingType.Linear;\n }\n\n isFullScreen(): boolean {\n return this.style === LoadingStyle.FullScreen;\n }\n\n isOverlay(): boolean {\n return this.style === LoadingStyle.Overlay;\n }\n\n animationComplete(event: AnimationEvent): void {\n // Check to see if its \"in\" or \"out\" animation to execute the proper callback\n if (!event.fromState) {\n this.inAnimationCompleted();\n } else {\n this.outAnimationCompleted();\n }\n }\n\n inAnimationCompleted(): void {\n this._animationIn.next(undefined);\n }\n\n outAnimationCompleted(): void {\n /* little hack to reset the loader value and animation before removing it from DOM\n * else, the loader will appear with prev value when its registered again\n * and will do an animation going prev value to 0.\n */\n this.value = 0;\n // Check for changes for `OnPush` change detection\n this._changeDetectorRef.markForCheck();\n this._animationOut.next(undefined);\n }\n\n /**\n * Starts in animation and returns an observable for completition event.\n */\n startInAnimation(): Observable<any> {\n /* need to switch back to the selected mode, so we have saved it in another variable\n * and then recover it. (issue with protractor)\n */\n this._mode = this._defaultMode;\n // Set values before the animations starts\n this._setCircleDiameter();\n // Check for changes for `OnPush` change detection\n this.animation = true;\n this._changeDetectorRef.markForCheck();\n return this._animationIn.asObservable();\n }\n\n /**\n * Starts out animation and returns an observable for completition event.\n */\n startOutAnimation(): Observable<any> {\n this.animation = false;\n /* need to switch back and forth from determinate/indeterminate so the setInterval()\n * inside mat-progress-spinner stops and protractor doesnt timeout waiting to sync.\n */\n this._mode = LoadingMode.Determinate;\n // Check for changes for `OnPush` change detection\n this._changeDetectorRef.markForCheck();\n return this._animationOut.asObservable();\n }\n\n /**\n * Calculate the proper diameter for the circle and set it\n */\n private _setCircleDiameter(): void {\n // we set a default diameter of 100 since this is the default in material\n let diameter: number = TD_CIRCLE_DIAMETER;\n // if height is provided, then we take that as diameter\n if (this.height) {\n diameter = this.height;\n // else if its not provided, then we take the host height\n } else if (this.height === undefined) {\n diameter = this._hostHeight();\n }\n // if the diameter is over TD_CIRCLE_DIAMETER, we set TD_CIRCLE_DIAMETER\n if (!!diameter && diameter <= TD_CIRCLE_DIAMETER) {\n this._circleDiameter = Math.floor(diameter);\n } else {\n this._circleDiameter = TD_CIRCLE_DIAMETER;\n }\n }\n\n /**\n * Returns the host height of the loading component\n */\n private _hostHeight(): number {\n if (<HTMLElement>this._elementRef.nativeElement) {\n return (<HTMLElement>this._elementRef.nativeElement).getBoundingClientRect().height;\n }\n return 0;\n }\n}\n","import { Injectable, ComponentFactoryResolver, ChangeDetectorRef, Provider, SkipSelf, Optional, EmbeddedViewRef } from '@angular/core';\nimport { Injector, ComponentRef, ViewContainerRef, TemplateRef } from '@angular/core';\nimport { TemplatePortal, ComponentPortal } from '@angular/cdk/portal';\nimport { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';\n\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { distinctUntilChanged } from 'rxjs/operators';\n\nimport { TdLoadingContext } from '../directives/loading.directive';\nimport { TdLoadingComponent, LoadingStyle } from '../loading.component';\nimport { ITdLoadingConfig } from './loading.service';\n\nexport interface IInternalLoadingOptions extends ITdLoadingConfig {\n height?: number;\n style?: LoadingStyle;\n}\n\nexport interface ILoadingRef {\n observable: Observable<any>;\n componentRef: ComponentRef<any>;\n subject?: Subject<any>;\n times?: number;\n}\n\n/**\n * NOTE: @internal usage only.\n */\n@Injectable()\nexport class TdLoadingFactory {\n\n constructor(private _componentFactoryResolver: ComponentFactoryResolver,\n private _overlay: Overlay,\n private _injector: Injector) {\n }\n\n /**\n * Uses material `Overlay` services to create a DOM element and attach the loading component\n * into it. Leveraging the state and configuration from it.\n *\n * Saves a reference in context to be called when registering/resolving the loading element.\n */\n public createFullScreenComponent(options: ITdLoadingConfig): ILoadingRef {\n (<IInternalLoadingOptions>options).height = undefined;\n (<IInternalLoadingOptions>options).style = LoadingStyle.FullScreen;\n let loadingRef: ILoadingRef = this._initializeContext();\n let loading: boolean = false;\n let overlayRef: OverlayRef;\n loadingRef.observable.pipe(\n distinctUntilChanged(),\n ).subscribe((registered: number) => {\n if (registered > 0 && !loading) {\n loading = true;\n overlayRef = this._createOverlay();\n loadingRef.componentRef = overlayRef.attach(new ComponentPortal(TdLoadingComponent));\n this._mapOptions(options, loadingRef.componentRef.instance);\n loadingRef.componentRef.instance.startInAnimation();\n loadingRef.componentRef.changeDetectorRef.detectChanges();\n } else if (registered <= 0 && loading) {\n loading = false;\n let subs: Subscription = loadingRef.componentRef.instance.startOutAnimation().subscribe(() => {\n subs.unsubscribe();\n loadingRef.componentRef.destroy();\n overlayRef.detach();\n overlayRef.dispose();\n });\n }\n });\n return loadingRef;\n }\n\n /**\n * Creates a loading component dynamically and attaches it into the given viewContainerRef.\n * Leverages TemplatePortals from material to inject the template inside of it so it fits\n * perfectly when overlaying it.\n *\n * Saves a reference in context to be called when registering/resolving the loading element.\n */\n public createOverlayComponent(options: ITdLoadingConfig, viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<Object>): ILoadingRef {\n (<IInternalLoadingOptions>options).height = undefined;\n (<IInternalLoadingOptions>options).style = LoadingStyle.Overlay;\n let loadingRef: ILoadingRef = this._createComponent(options);\n let loading: boolean = false;\n loadingRef.componentRef.instance.content = new TemplatePortal(templateRef, viewContainerRef);\n viewContainerRef.clear();\n viewContainerRef.insert(loadingRef.componentRef.hostView, 0);\n loadingRef.observable.pipe(\n distinctUntilChanged(),\n ).subscribe((registered: number) => {\n if (registered > 0 && !loading) {\n loading = true;\n loadingRef.componentRef.instance.startInAnimation();\n } else if (registered <= 0 && loading) {\n loading = false;\n loadingRef.componentRef.instance.startOutAnimation();\n }\n });\n return loadingRef;\n }\n\n /**\n * Creates a loading component dynamically and attaches it into the given viewContainerRef.\n * Replaces the template with the loading component depending if it was registered or resolved.\n *\n * Saves a reference in context to be called when registering/resolving the loading element.\n */\n public createReplaceComponent(options: ITdLoadingConfig, viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<Object>, context: TdLoadingContext): ILoadingRef {\n let nativeElement: HTMLElement = <HTMLElement>templateRef.elementRef.nativeElement;\n (<IInternalLoadingOptions>options).height = nativeElement.nextElementSibling ?\n nativeElement.nextElementSibling.scrollHeight : undefined;\n (<IInternalLoadingOptions>options).style = LoadingStyle.None;\n let loadingRef: ILoadingRef = this._createComponent(options);\n let loading: boolean = false;\n // passing context so when the template is attached, we can keep the reference of the variables\n let contentRef: EmbeddedViewRef<Object> = viewContainerRef.createEmbeddedView(templateRef, context);\n loadingRef.observable.pipe(\n distinctUntilChanged(),\n ).subscribe((registered: number) => {\n if (registered > 0 && !loading) {\n loading = true;\n // detach the content and attach the loader if loader is there\n let index: number = viewContainerRef.indexOf(loadingRef.componentRef.hostView);\n if (index < 0) {\n viewContainerRef.detach(viewContainerRef.indexOf(contentRef));\n viewContainerRef.insert(loadingRef.componentRef.hostView, 0);\n }\n loadingRef.componentRef.instance.startInAnimation();\n } else if (registered <= 0 && loading) {\n loading = false;\n let subs: Subscription = loadingRef.componentRef.instance.startOutAnimation().subscribe(() => {\n subs.unsubscribe();\n // detach loader and attach the content if content is there\n let index: number = viewContainerRef.indexOf(contentRef);\n if (index < 0) {\n viewContainerRef.detach(viewContainerRef.indexOf(loadingRef.componentRef.hostView));\n viewContainerRef.insert(contentRef, 0);\n }\n /**\n * Need to call \"markForCheck\" and \"detectChanges\" on attached template, so its detected by parent component when attached\n * with \"OnPush\" change detection\n */\n contentRef.detectChanges();\n contentRef.markForCheck();\n });\n }\n });\n return loadingRef;\n }\n\n /**\n * Creates a fullscreen overlay for the loading usage.\n */\n private _createOverlay(): OverlayRef {\n let state: OverlayConfig = new OverlayConfig();\n state.hasBackdrop = false;\n state.positionStrategy = this._overlay.position().global().centerHorizontally().centerVertically();\n return this._overlay.create(state);\n }\n\n /**\n * Creates a generic component dynamically waiting to be attached to a viewContainerRef.\n */\n private _createComponent(options: IInternalLoadingOptions): ILoadingRef {\n let compRef: ILoadingRef = this._initializeContext();\n compRef.componentRef = this._componentFactoryResolver\n .resolveComponentFactory(TdLoadingComponent).create(this._injector);\n this._mapOptions(options, compRef.componentRef.instance);\n return compRef;\n }\n\n /**\n * Initialize context for loading component.\n */\n private _initializeContext(): ILoadingRef {\n let subject: Subject<any> = new Subject<any>();\n return {\n observable: subject.asObservable(),\n subject: subject,\n componentRef: undefined,\n times: 0,\n };\n }\n\n /**\n * Maps configuration to the loading component instance.\n */\n private _mapOptions(options: IInternalLoadingOptions, instance: TdLoadingComponent): void {\n instance.style = options.style;\n if (options.type !== undefined) {\n instance.type = options.type;\n }\n if (options.height !== undefined) {\n instance.height = options.height;\n }\n if (options.mode !== undefined) {\n instance.mode = options.mode;\n }\n if (options.color !== undefined) {\n instance.color = options.color;\n }\n }\n}\n\nexport function LOADING_FACTORY_PROVIDER_FACTORY(\n parent: TdLoadingFactory, componentFactoryResolver: ComponentFactoryResolver, overlay: Overlay, injector: Injector): TdLoadingFactory {\n return parent || new TdLoadingFactory(componentFactoryResolver, overlay, injector);\n}\n\nexport const LOADING_FACTORY_PROVIDER: Provider = {\n // If there is already a service available, use that. Otherwise, provide a new one.\n provide: TdLoadingFactory,\n deps: [[new Optional(), new SkipSelf(), TdLoadingFactory], ComponentFactoryResolver, Overlay, Injector],\n useFactory: LOADING_FACTORY_PROVIDER_FACTORY,\n};\n","import { Injectable, Provider, SkipSelf, Optional } from '@angular/core';\nimport { ViewContainerRef, TemplateRef } from '@angular/core';\nimport { Observable, Subject, Subscription } from 'rxjs';\n\nimport { TdLoadingContext } from '../directives/loading.directive';\nimport { TdLoadingComponent, LoadingMode, LoadingStrategy, LoadingType } from '../loading.component';\nimport { TdLoadingFactory, ILoadingRef } from './loading.factory';\n\nexport interface ITdLoadingConfig {\n name: string;\n type?: LoadingType;\n mode?: LoadingMode;\n color?: 'primary' | 'accent' | 'warn';\n}\n\nexport class TdLoadingConfig implements ITdLoadingConfig {\n name: string;\n type?: LoadingType;\n mode?: LoadingMode;\n color?: 'primary' | 'accent' | 'warn';\n\n constructor(config: ITdLoadingConfig) {\n this.name = config.name;\n if (!this.name) {\n throw Error('Name is required for [TdLoading] configuration.');\n }\n this.mode = config.mode ? config.mode : LoadingMode.Indeterminate;\n this.type = config.type ? config.type : LoadingType.Circular;\n this.color = config.color ? config.color : 'primary';\n }\n}\n\nexport interface ITdLoadingDirectiveConfig extends ITdLoadingConfig {\n strategy?: LoadingStrategy;\n}\n\nexport class TdLoadingDirectiveConfig extends TdLoadingConfig implements ITdLoadingDirectiveConfig {\n name: string;\n type: LoadingType;\n mode: LoadingMode;\n strategy: LoadingStrategy;\n\n constructor(config: ITdLoadingDirectiveConfig) {\n super(config);\n this.strategy = config.strategy ? config.strategy : LoadingStrategy.Replace;\n }\n}\n\n@Injectable()\nexport class TdLoadingService {\n\n private _context: {[key: string]: ILoadingRef} = {};\n private _timeouts: {[key: string]: any} = {};\n\n constructor(private _loadingFactory: TdLoadingFactory) {\n this.create({\n name: 'td-loading-main',\n });\n }\n\n /**\n * params:\n * - config: ILoadingDirectiveConfig\n * - viewContainerRef: ViewContainerRef\n * - templateRef: TemplateRef<Object>\n *\n * Creates an replace loading mask and attaches it to the viewContainerRef.\n * Replaces the templateRef with the mask when a request is registered on it.\n *\n * NOTE: @internal usage only.\n */\n createComponent(config: ITdLoadingDirectiveConfig, viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<Object>, context: TdLoadingContext): ILoadingRef {\n let directiveConfig: TdLoadingDirectiveConfig = new TdLoadingDirectiveConfig(config);\n if (this._context[directiveConfig.name]) {\n throw Error(`Name duplication: [TdLoading] directive has a name conflict with ${directiveConfig.name}.`);\n }\n if (directiveConfig.strategy === LoadingStrategy.Overlay) {\n this._context[directiveConfig.name] = this._loadingFactory.createOverlayComponent(directiveConfig, viewContainerRef, templateRef);\n } else {\n this._context[directiveConfig.name] = this._loadingFactory.createReplaceComponent(directiveConfig, viewContainerRef, templateRef, context);\n }\n return this._context[directiveConfig.name];\n }\n\n /**\n * params:\n * - config: ITdLoadingConfig\n *\n * Creates a fullscreen loading mask and attaches it to the DOM with the given configuration.\n * Only displayed when the mask has a request registered on it.\n */\n public create(config: ITdLoadingConfig): void {\n let fullscreenConfig: TdLoadingConfig = new TdLoadingConfig(config);\n this.removeComponent(fullscreenConfig.name);\n this._context[fullscreenConfig.name] = this._loadingFactory.createFullScreenComponent(fullscreenConfig);\n }\n\n /**\n * params:\n * - name: string\n *\n * Removes `loading` component from service context.\n */\n public removeComponent(name: string): void {\n if (this._context[name]) {\n this._context[name].subject.unsubscribe();\n if (this._context[name].componentRef) {\n this._context[name].componentRef.destroy();\n }\n this._context[name] = undefined;\n delete this._context[name];\n }\n }\n\n /**\n * params:\n * - name: string\n * - registers?: number\n * returns: true if successful\n *\n * Resolves a request for the loading mask referenced by the name parameter.\n * Can optionally pass registers argument to set a number of register calls.\n *\n * If no paramemeters are used, then default main mask will be used.\n *\n * e.g. loadingService.register()\n */\n public register(name: string = 'td-loading-main', registers: number = 1): boolean {\n // try registering into the service if the loading component has been instanciated or if it exists.\n if (this._context[name]) {\n registers = registers < 1 ? 1 : registers;\n this._context[name].times += registers;\n this._context[name].subject.next(this._context[name].times);\n return true;\n } else {\n // if it doesnt exist, set a timeout so its registered after change detection happens\n // this in case \"register\" occured on the `ngOnInit` lifehook cycle.\n if (!this._timeouts[name]) {\n this._timeouts[name] = setTimeout(() => {\n this.register(name, registers);\n });\n } else {\n // if it timeout occured and still doesnt exist, it means the tiemout wasnt needed so we clear it.\n this._clearTimeout(name);\n }\n }\n return false;\n }\n\n /**\n * params:\n * - name: string\n * - resolves?: number\n * returns: true if successful\n *\n * Resolves a request for the loading mask referenced by the name parameter.\n * Can optionally pass resolves argument to set a number of resolve calls.\n *\n * If no paramemeters are used, then default main mask will be used.\n *\n * e.g. loadingService.resolve()\n */\n public resolve(name: string = 'td-loading-main', resolves: number = 1): boolean {\n // clear timeout if the loading component is \"resolved\" before its \"registered\"\n this._clearTimeout(name);\n if (this._context[name]) {\n resolves = resolves < 1 ? 1 : resolves;\n if (this._context[name].times > 0) {\n let times: number = this._context[name].times;\n times -= resolves;\n this._context[name].times = times < 0 ? 0 : times;\n }\n this._context[name].subject.next(this._context[name].times);\n return true;\n }\n return false;\n }\n\n /**\n * params:\n * - name: string\n * returns: true if successful\n *\n * Resolves all request for the loading mask referenced by the name parameter.\n *\n * If no paramemeters are used, then default main mask will be used.\n *\n * e.g. loadingService.resolveAll()\n */\n public resolveAll(name: string = 'td-loading-main'): boolean {\n // clear timeout if the loading component is \"resolved\" before its \"registered\"\n this._clearTimeout(name);\n if (this._context[name]) {\n this._context[name].times = 0;\n this._context[name].subject.next(this._context[name].times);\n return true;\n }\n return false;\n }\n\n /**\n * params:\n * - name: string\n * - value: number\n * returns: true if successful\n *\n * Set value on a loading mask referenced by the name parameter.\n * Usage only available if its mode is 'determinate' and if loading is showing.\n */\n public setValue(name: string, value: number): boolean {\n if (this._context[name]) {\n let instance: TdLoadingComponent = this._context[name].componentRef.instance;\n if (instance.mode === LoadingMode.Determinate && instance.animation) {\n instance.value = value;\n return true;\n }\n }\n return false;\n }\n\n /**\n * Clears timeout linked to the name.\n * @param name Name of the loading component to be cleared\n */\n private _clearTimeout(name: string): void {\n clearTimeout(this._timeouts[name]);\n delete this._timeouts[name];\n }\n}\n\nexport function LOADING_PROVIDER_FACTORY(\n parent: TdLoadingService, loadingFactory: TdLoadingFactory): TdLoadingService {\n return parent || new TdLoadingService(loadingFactory);\n}\n\nexport const LOADING_PROVIDER: Provider = {\n // If there is already a service available, use that. Otherwise, provide a new one.\n provide: TdLoadingService,\n deps: [[new Optional(), new SkipSelf(), TdLoadingService], TdLoadingFactory],\n useFactory: LOADING_PROVIDER_FACTORY,\n};\n","import { Directive, Input, OnInit, OnDestroy } from '@angular/core';\nimport { ViewContainerRef, TemplateRef } from '@angular/core';\n\nimport { LoadingType, LoadingMode, LoadingStrategy, TdLoadingComponent } from '../loading.component';\nimport { TdLoadingService } from '../services/loading.service';\nimport { ILoadingRef } from '../services/loading.factory';\n\n/**\n * Context class for variable reference\n */\nexport class TdLoadingContext {\n public $implicit: any = undefined;\n public tdLoading: any = undefined;\n}\n\n// Constant for generation of the id for the next component\nlet TD_LOADING_NEXT_ID: number = 0;\n\n@Directive({\n selector: '[tdLoading]',\n})\nexport class TdLoadingDirective implements OnInit, OnDestroy {\n\n private _context: TdLoadingContext = new TdLoadingContext();\n private _type: LoadingType;\n private _mode: LoadingMode;\n private _strategy: LoadingStrategy;\n private _name: string;\n private _loadingRef: ILoadingRef;\n\n /**\n * tdLoading: string\n * Name reference of the loading mask, used to register/resolve requests to the mask.\n */\n @Input('tdLoading')\n set name(name: string) {\n if (!this._name) {\n if (name) {\n this._name = name;\n }\n }\n }\n\n /**\n * tdLoadingUntil?: any\n * If its null, undefined or false it will be used to register requests to the mask.\n * Else if its any value that can be resolved as true, it will resolve the mask.\n * [name] is optional when using [until], but can still be used to register/resolve it manually.\n */\n @Input('tdLoadingUntil')\n set until(until: any) {\n if (!this._name) {\n this._name = 'td-loading-until-' + TD_LOADING_NEXT_ID++;\n }\n this._context.$implicit = this._context.tdLoading = until;\n if (!until) {\n this._loadingService.register(this._name);\n } else {\n this._loadingService.resolveAll(this._name);\n }\n }\n\n /**\n * tdLoadingType?: LoadingType or ['linear' | 'circular']\n * Sets the type of loading mask depending on value.\n * Defaults to [LoadingType.Circular | 'circular'].\n */\n @Input('tdLoadingType')\n set type(type: LoadingType) {\n switch (type) {\n case LoadingType.Linear:\n this._type = LoadingType.Linear;\n break;\n default:\n this._type = LoadingType.Circular;\n break;\n }\n }\n\n /**\n * tdLoadingMode?: LoadingMode or ['determinate' | 'indeterminate']\n * Sets the mode of loading mask depending on value.\n * Defaults to [LoadingMode.Indeterminate | 'indeterminate'].\n */\n @Input('tdLoadingMode')\n set mode(mode: LoadingMode) {\n switch (mode) {\n case LoadingMode.Determinate:\n this._mode = LoadingMode.Determinate;\n break;\n default:\n this._mode = LoadingMode.Indeterminate;\n break;\n }\n }\n\n /**\n * tdLoadingStrategy?: LoadingStrategy or ['replace' | 'overlay']\n * Sets the strategy of loading mask depending on value.\n * Defaults to [LoadingMode.Replace | 'replace'].\n */\n @Input('tdLoadingStrategy')\n set strategy(stategy: LoadingStrategy) {\n switch (stategy) {\n case LoadingStrategy.Overlay:\n this._strategy = LoadingStrategy.Overlay;\n break;\n default:\n this._strategy = LoadingStrategy.Replace;\n break;\n }\n }\n\n /**\n * tdLoadingColor?: \"primary\" | \"accent\" | \"warn\"\n * Sets the theme color of the loading component. Defaults to \"primary\"\n */\n @Input('tdLoadingColor') color: 'primary' | 'accent' | 'warn' = 'primary';\n\n constructor(private _viewContainerRef: ViewContainerRef,\n private _templateRef: TemplateRef<TdLoadingContext>,\n private _loadingService: TdLoadingService) {}\n\n /**\n * Registers component in the DOM, so it will be available when calling resolve/register.\n */\n ngOnInit(): void {\n this._registerComponent();\n }\n\n /**\n * Remove component when directive is destroyed.\n */\n ngOnDestroy(): void {\n this._loadingService.removeComponent(this._name);\n this._loadingRef = undefined;\n }\n\n /**\n * Creates [TdLoadingComponent] and attaches it to this directive's [ViewContainerRef].\n * Passes this directive's [TemplateRef] to modify DOM depending on loading `strategy`.\n */\n private _registerComponent(): void {\n if (!this._name) {\n throw new Error('Name is needed to register loading directive');\n }\n // Check if `TdLoadingComponent` has been created before trying to add one again.\n // There is a weird edge case when using `[routerLinkActive]` that calls the `ngOnInit` twice in a row\n if (!this._loadingRef) {\n this._loadingRef = this._loadingService.createComponent({\n name: this._name,\n type: this._type,\n mode: this._mode,\n color: this.color,\n strategy: this._strategy,\n }, this._viewContainerRef, this._templateRef, this._context);\n }\n }\n}\n","import { Type } from '@angular/core';\nimport { NgModule, ModuleWithProviders } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { TdLoadingService, LOADING_PROVIDER } from './services/loading.service';\nimport { TdLoadingFactory, LOADING_FACTORY_PROVIDER } from './services/loading.factory';\nimport { TdLoadingDirective } from './directives/loading.directive';\nimport { TdLoadingComponent } from './loading.component';\n\nconst TD_LOADING: Type<any>[] = [\n TdLoadingComponent,\n TdLoadingDirective,\n];\n\nconst TD_LOADING_ENTRY_COMPONENTS: Type<any>[] = [\n TdLoadingComponent,\n];\n\n@NgModule({\n imports: [\n CommonModule,\n MatProgressBarModule,\n MatProgressSpinnerModule,\n OverlayModule,\n PortalModule,\n ],\n declarations: [\n TD_LOADING,\n ],\n exports: [\n TD_LOADING,\n ],\n providers: [\n LOADING_FACTORY_PROVIDER,\n LOADING_PROVIDER,\n ],\n entryComponents: [\n TD_LOADING_ENTRY_COMPONENTS,\n ],\n})\nexport class CovalentLoadingModule {\n\n}\n"]}