blob: e8f763415135c94199d7bf4da82c22963426ea86 [file] [log] [blame]
{"version":3,"sources":["../../../../node_modules/tslib/tslib.es6.js","../../../../src/platform/core/loading/loading.component.ts","../../../src/platform/core/loading/services/loading.factory.ts","../../../src/platform/core/loading/services/loading.service.ts","../../../src/platform/core/loading/directives/loading.directive.ts","../../../../src/platform/core/loading/loading.module.ts"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","create","LoadingType","Circular","Linear","LoadingMode","Determinate","Indeterminate","LoadingStrategy","Overlay","Replace","LoadingStyle","FullScreen","None","TD_CIRCLE_DIAMETER","TdLoadingComponent","_elementRef","_changeDetectorRef","this","_mode","_defaultMode","_value","_circleDiameter","animation","style","type","color","defineProperty","mode","value","markForCheck","ngDoCheck","isOverlay","_hostHeight","_setCircleDiameter","getHeight","isFullScreen","height","getCircleDiameter","getCircleStrokeWidth","strokeWidth","Math","abs","isCircular","isLinear","show","hide","diameter","undefined","floor","getBoundingClientRect","Component","args","selector","template","animations","tdFadeInOutAnimation","ElementRef","ChangeDetectorRef","TdLoadingFactory","_componentFactoryResolver","_overlay","_injector","createFullScreenComponent","options","_this","overlayRef","loadingRef","_initializeContext","loading","observable","pipe","distinctUntilChanged","subscribe","registered","_createOverlay","componentRef","attach","ComponentPortal","_mapOptions","instance","changeDetectorRef","detectChanges","destroy","detach","dispose","createOverlayComponent","viewContainerRef","templateRef","_createComponent","content","TemplatePortal","clear","insert","hostView","createReplaceComponent","context","nativeElement","elementRef","nextElementSibling","scrollHeight","contentRef","createEmbeddedView","indexOf","state","OverlayConfig","hasBackdrop","positionStrategy","position","global","centerHorizontally","centerVertically","compRef","resolveComponentFactory","subject","Subject","asObservable","times","LOADING_FACTORY_PROVIDER_FACTORY","parent","componentFactoryResolver","overlay","injector","Injectable","ComponentFactoryResolver","Injector","LOADING_FACTORY_PROVIDER","provide","deps","Optional","SkipSelf","useFactory","config","name","Error","TdLoadingDirectiveConfig","_super","strategy","__","constructor","__extends","TdLoadingConfig","TdLoadingService","_loadingFactory","_context","_timeouts","createComponent","directiveConfig","fullscreenConfig","removeComponent","unsubscribe","register","registers","next","_clearTimeout","setTimeout","resolve","resolves","resolveAll","setValue","clearTimeout","LOADING_PROVIDER_FACTORY","loadingFactory","LOADING_PROVIDER","$implicit","tdLoading","TD_LOADING_NEXT_ID","TdLoadingDirective","_viewContainerRef","_templateRef","_loadingService","TdLoadingContext","_name","until","_type","_strategy","ngOnInit","_registerComponent","ngOnDestroy","_loadingRef","Directive","ViewContainerRef","TemplateRef","Input","TD_LOADING","NgModule","imports","CommonModule","MatProgressBarModule","MatProgressSpinnerModule","OverlayModule","PortalModule","declarations","exports","providers"],"mappings":";;;;;;;;;;;;;;oFAgBA,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,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,MAC3EN,EAAGC,IAqFCC,OAAOQ,OA0FXR,OAAOQ,WChMpBC,EAAW,CACrBC,SAAQ,WACRC,OAAM,UAGIC,EAAW,CACrBC,YAAW,cACXC,cAAa,iBAGHC,EAAe,CACzBC,QAAO,UACPC,QAAO,WAGGC,EAAY,CACtBC,WAAU,aACVH,QAAO,UACPI,KAAI,QAKOC,EAA6B,iBAkExC,SAAAC,EAAoBC,EAAiCC,GAAjCC,KAAAF,YAAAA,EAAiCE,KAAAD,mBAAAA,EAzD7CC,KAAAC,MAAqBd,EAAYE,cACjCW,KAAAE,aAA4Bf,EAAYE,cACxCW,KAAAG,OAAiB,EACjBH,KAAAI,gBAA0BR,EAKlCI,KAAAK,WAAqB,EA6BrBL,KAAAM,MAAsBb,EAAaE,KAYnCK,KAAAO,KAAoBvB,EAAYC,SAMhCe,KA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CANCkB,EAAAA,SAAQrI,KAAA,CAAC,CACRsI,QAAS,CAACC,EAAAA,aAAcC,EAAAA,qBAAsBC,EAAAA,yBAA0BC,EAAAA,cAAeC,EAAAA,cACvFC,aAAc,CAACR,GACfS,QAAS,CAACT,GACVU,UAAW,CAACpE,EAA0BqC","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\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 (Object.prototype.hasOwnProperty.call(b, 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++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\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 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\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) : adopt(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 var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") 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 throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\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 __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\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\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\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 (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, 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\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Component, ChangeDetectorRef, ElementRef, DoCheck } from '@angular/core';\nimport { TemplatePortal } from '@angular/cdk/portal';\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: [tdFadeInOutAnimation],\n})\nexport class TdLoadingComponent implements DoCheck {\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, 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 && this.animation) {\n this._setCircleDiameter();\n this._changeDetectorRef.markForCheck();\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 const 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 /**\n * Starts in animation and returns an observable for completition event.\n */\n show(): void {\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 }\n\n /**\n * Starts out animation and returns an observable for completition event.\n */\n hide(): void {\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 /* 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 }\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 {\n Injectable,\n ComponentFactoryResolver,\n ChangeDetectorRef,\n Provider,\n SkipSelf,\n Optional,\n EmbeddedViewRef,\n} 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 } 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 constructor(\n 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 const loadingRef: ILoadingRef = this._initializeContext();\n let loading: boolean = false;\n let overlayRef: OverlayRef;\n loadingRef.observable.pipe(distinctUntilChanged()).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.show();\n loadingRef.componentRef.changeDetectorRef.detectChanges();\n } else if (registered <= 0 && loading) {\n loading = false;\n loadingRef.componentRef.instance.hide();\n loadingRef.componentRef.destroy();\n overlayRef.detach();\n overlayRef.dispose();\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(\n options: ITdLoadingConfig,\n viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<object>,\n ): ILoadingRef {\n (<IInternalLoadingOptions>options).height = undefined;\n (<IInternalLoadingOptions>options).style = LoadingStyle.Overlay;\n const 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(distinctUntilChanged()).subscribe((registered: number) => {\n if (registered > 0 && !loading) {\n loading = true;\n loadingRef.componentRef.instance.show();\n } else if (registered <= 0 && loading) {\n loading = false;\n loadingRef.componentRef.instance.hide();\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(\n options: ITdLoadingConfig,\n viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<object>,\n context: TdLoadingContext,\n ): ILoadingRef {\n const nativeElement: HTMLElement = <HTMLElement>templateRef.elementRef.nativeElement;\n (<IInternalLoadingOptions>options).height = nativeElement.nextElementSibling\n ? nativeElement.nextElementSibling.scrollHeight\n : undefined;\n (<IInternalLoadingOptions>options).style = LoadingStyle.None;\n const 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 const contentRef: EmbeddedViewRef<object> = viewContainerRef.createEmbeddedView(templateRef, context);\n loadingRef.observable.pipe(distinctUntilChanged()).subscribe((registered: number) => {\n if (registered > 0 && !loading) {\n loading = true;\n // detach the content and attach the loader if loader is there\n const 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.show();\n } else if (registered <= 0 && loading) {\n loading = false;\n loadingRef.componentRef.instance.hide();\n // detach loader and attach the content if content is there\n const 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 return loadingRef;\n }\n\n /**\n * Creates a fullscreen overlay for the loading usage.\n */\n private _createOverlay(): OverlayRef {\n const 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 const compRef: ILoadingRef = this._initializeContext();\n compRef.componentRef = this._componentFactoryResolver\n .resolveComponentFactory(TdLoadingComponent)\n .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 const subject: Subject<any> = new Subject<any>();\n return {\n observable: subject.asObservable(),\n 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,\n componentFactoryResolver: ComponentFactoryResolver,\n overlay: Overlay,\n injector: Injector,\n): 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 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(\n config: ITdLoadingDirectiveConfig,\n viewContainerRef: ViewContainerRef,\n templateRef: TemplateRef<object>,\n context: TdLoadingContext,\n ): ILoadingRef {\n const 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(\n directiveConfig,\n viewContainerRef,\n templateRef,\n );\n } else {\n this._context[directiveConfig.name] = this._loadingFactory.createReplaceComponent(\n directiveConfig,\n viewContainerRef,\n templateRef,\n context,\n );\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 const 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 const 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(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 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 && name) {\n this._name = name;\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 if (type === LoadingType.Linear) {\n this._type = LoadingType.Linear;\n } else {\n this._type = LoadingType.Circular;\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 if (mode === LoadingMode.Determinate) {\n this._mode = LoadingMode.Determinate;\n } else {\n this._mode = LoadingMode.Indeterminate;\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(strategy: LoadingStrategy) {\n if (strategy === LoadingStrategy.Overlay) {\n this._strategy = LoadingStrategy.Overlay;\n } else {\n this._strategy = LoadingStrategy.Replace;\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(\n private _viewContainerRef: ViewContainerRef,\n private _templateRef: TemplateRef<TdLoadingContext>,\n private _loadingService: TdLoadingService,\n ) {}\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 {\n name: this._name,\n type: this._type,\n mode: this._mode,\n color: this.color,\n strategy: this._strategy,\n },\n this._viewContainerRef,\n this._templateRef,\n this._context,\n );\n }\n }\n}\n","import { Type } from '@angular/core';\nimport { NgModule } 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>[] = [TdLoadingComponent, TdLoadingDirective];\n\nconst TD_LOADING_ENTRY_COMPONENTS: Type<any>[] = [TdLoadingComponent];\n\n@NgModule({\n imports: [CommonModule, MatProgressBarModule, MatProgressSpinnerModule, OverlayModule, PortalModule],\n declarations: [TD_LOADING],\n exports: [TD_LOADING],\n providers: [LOADING_FACTORY_PROVIDER, LOADING_PROVIDER],\n})\nexport class CovalentLoadingModule {}\n"]}