@ngageoint/mage.web-core-lib 6.2.8 → 6.2.10-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/bundles/ngageoint-mage.web-core-lib-common.umd.js +3 -3
  2. package/bundles/ngageoint-mage.web-core-lib-common.umd.js.map +1 -1
  3. package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js +1 -1
  4. package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js.map +1 -1
  5. package/bundles/ngageoint-mage.web-core-lib-feed.umd.js +19 -19
  6. package/bundles/ngageoint-mage.web-core-lib-feed.umd.js.map +1 -1
  7. package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js +1 -1
  8. package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js.map +1 -1
  9. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js +4 -4
  10. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js.map +1 -1
  11. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js +1 -1
  12. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js.map +1 -1
  13. package/bundles/ngageoint-mage.web-core-lib-user.umd.js +3 -9
  14. package/bundles/ngageoint-mage.web-core-lib-user.umd.js.map +1 -1
  15. package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js +2 -2
  16. package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js.map +1 -1
  17. package/common/xhr-img.component.d.ts +2 -2
  18. package/esm2015/common/xhr-img.component.js +4 -4
  19. package/esm2015/feed/feed.service.js +20 -20
  20. package/esm2015/static-icon/static-icon.service.js +5 -5
  21. package/esm2015/user/user-read.service.js +4 -10
  22. package/esm5/common/xhr-img.component.js +4 -4
  23. package/esm5/feed/feed.service.js +20 -20
  24. package/esm5/static-icon/static-icon.service.js +5 -5
  25. package/esm5/user/user-read.service.js +4 -10
  26. package/feed/feed.service.d.ts +2 -2
  27. package/fesm2015/ngageoint-mage.web-core-lib-common.js +3 -3
  28. package/fesm2015/ngageoint-mage.web-core-lib-common.js.map +1 -1
  29. package/fesm2015/ngageoint-mage.web-core-lib-feed.js +19 -19
  30. package/fesm2015/ngageoint-mage.web-core-lib-feed.js.map +1 -1
  31. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js +4 -4
  32. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js.map +1 -1
  33. package/fesm2015/ngageoint-mage.web-core-lib-user.js +3 -9
  34. package/fesm2015/ngageoint-mage.web-core-lib-user.js.map +1 -1
  35. package/fesm5/ngageoint-mage.web-core-lib-common.js +3 -3
  36. package/fesm5/ngageoint-mage.web-core-lib-common.js.map +1 -1
  37. package/fesm5/ngageoint-mage.web-core-lib-feed.js +19 -19
  38. package/fesm5/ngageoint-mage.web-core-lib-feed.js.map +1 -1
  39. package/fesm5/ngageoint-mage.web-core-lib-static-icon.js +4 -4
  40. package/fesm5/ngageoint-mage.web-core-lib-static-icon.js.map +1 -1
  41. package/fesm5/ngageoint-mage.web-core-lib-user.js +3 -9
  42. package/fesm5/ngageoint-mage.web-core-lib-user.js.map +1 -1
  43. package/package.json +1 -1
  44. package/static-icon/static-icon.service.d.ts +2 -2
  45. package/user/user-read.service.d.ts +2 -2
@@ -34,9 +34,9 @@
34
34
  * URLs for the image data, preventing memory leaks.
35
35
  */
36
36
  var XhrImgComponent = /** @class */ (function () {
37
- function XhrImgComponent(objectUrlService, http, sanitizer) {
37
+ function XhrImgComponent(objectUrlService, webClient, sanitizer) {
38
38
  this.objectUrlService = objectUrlService;
39
- this.http = http;
39
+ this.webClient = webClient;
40
40
  this.sanitizer = sanitizer;
41
41
  this.sourceUrl = null;
42
42
  this.safeBlobUrl = null;
@@ -53,7 +53,7 @@
53
53
  if (!this.sourceUrl) {
54
54
  return;
55
55
  }
56
- this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })
56
+ this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })
57
57
  .subscribe(function (x) {
58
58
  _this.objectUrlService.revokeObjectURL(_this.blobUrl);
59
59
  _this.blobUrl = _this.objectUrlService.createObjectURL(x);
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-common.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts"],"sourcesContent":["import { Component, ElementRef, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private http: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy() {\n this.disposeCurrent()\n }\n\n onImgLoad() {\n this.disposeCurrent()\n }\n\n private disposeCurrent() {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}"],"names":["InjectionToken","i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute","Component","Inject","Input","BrowserModule","NgModule"],"mappings":";;;;;;IAKA,IAAM,QAAQ,GAAG,cAAc,CAAA;QAYlB,kBAAkB,GAAG,IAAIA,mBAAc,CAAsB,QAAQ,sBAAmB,EAAC;IAEtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+CE,yBAAgD,gBAAkC,EAAU,IAAgB,EAAU,SAAuB;YAA7F,qBAAgB,GAAhB,gBAAgB,CAAkB;YAAU,SAAI,GAAJ,IAAI,CAAY;YAAU,cAAS,GAAT,SAAS,CAAc;YAN7I,cAAS,GAAkB,IAAI,CAAA;YAC/B,gBAAW,GAAmB,IAAI,CAAA;SAK+G;QAEjJ,qCAAW,GAAX,UAAY,OAAsB;YAAlC,iBAiBC;YAhBC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;gBACtB,OAAM;aACP;YACD,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACxD,OAAM;aACP;YACD,IAAI,CAAC,cAAc,EAAE,CAAA;YACrB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,OAAM;aACP;YACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;iBACxE,SAAS,CAAC,UAAA,CAAC;gBACV,KAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAI,CAAC,OAAO,CAAC,CAAA;gBACnD,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;gBACvD,KAAI,CAAC,WAAW,GAAG,KAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAI,CAAC,OAAO,CAAC,CAAA;aACvE,CA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P,eAAe;qBAChB;iBACF;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-common.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts"],"sourcesContent":["import { Component, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private webClient: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy(): void {\n this.disposeCurrent()\n }\n\n onImgLoad(): void {\n this.disposeCurrent()\n }\n\n private disposeCurrent(): void {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}"],"names":["InjectionToken","i0.ɵɵelementStart","i0.ɵɵlistener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@@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common/http"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/common",["exports","@angular/core","@angular/common/http","@angular/platform-browser"],t):t(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"].common={}),e.ng.core,e.ng.common.http,e.ng.platformBrowser)}(this,(function(e,t,r,o){"use strict";var n=new t.InjectionToken("mage-xhr-img.objectUrlService"),i=function(){function e(e,t,r){this.objectUrlService=e,this.http=t,this.sanitizer=r,this.sourceUrl=null,this.safeBlobUrl=null}return e.prototype.ngOnChanges=function(e){var t=this;e.sourceUrl&&(e.sourceUrl.isFirstChange()&&!this.sourceUrl||(this.disposeCurrent(),this.sourceUrl&&(this.subscription=this.http.get(this.sourceUrl,{responseType:"blob"}).subscribe((function(e){t.objectUrlService.revokeObjectURL(t.blobUrl),t.blobUrl=t.objectUrlService.createObjectURL(e),t.safeBlobUrl=t.sanitizer.bypassSecurityTrustUrl(t.blobUrl)})))))},e.prototype.ngOnDestroy=function(){this.disposeCurrent()},e.prototype.onImgLoad=function(){this.disposeCurrent()},e.prototype.disposeCurrent=function(){this.blobUrl&&this.objectUrlService.revokeObjectURL(this.blobUrl),this.subscription&&this.subscription.unsubscribe(),this.blobUrl=null},e.ɵfac=function(i){return new(i||e)(t.ɵɵdirectiveInject(n),t.ɵɵdirectiveInject(r.HttpClient),t.ɵɵdirectiveInject(o.DomSanitizer))},e.ɵcmp=t.ɵɵdefineComponent({type:e,selectors:[["mage-xhr-img"]],inputs:{sourceUrl:["src","sourceUrl"]},features:[t.ɵɵProvidersFeature([{provide:n,useValue:URL}]),t.ɵɵNgOnChangesFeature],decls:1,vars:1,consts:[[3,"load"]],template:function(e,r){1&e&&(t.ɵɵelementStart(0,"img",0),t.ɵɵlistener("load",(function(){return r.onImgLoad()})),t.ɵɵelementEnd()),2&e&&t.ɵɵattribute("src",r.safeBlobUrl,t.ɵɵsanitizeUrl)},styles:["img[_ngcontent-%COMP%] { height: 100%; width: 100% }"]}),e}(),s=function(){function e(){}return e.ɵmod=t.ɵɵdefineNgModule({type:e}),e.ɵinj=t.ɵɵdefineInjector({factory:function(t){return new(t||e)},imports:[[o.BrowserModule]]}),e}();("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(s,{declarations:[i],imports:[o.BrowserModule],exports:[i]}),e.MageCommonModule=s,e.OBJECT_URL_SERVICE=n,e.XhrImgComponent=i,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common/http"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/common",["exports","@angular/core","@angular/common/http","@angular/platform-browser"],t):t(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"].common={}),e.ng.core,e.ng.common.http,e.ng.platformBrowser)}(this,(function(e,t,r,o){"use strict";var n=new t.InjectionToken("mage-xhr-img.objectUrlService"),i=function(){function e(e,t,r){this.objectUrlService=e,this.webClient=t,this.sanitizer=r,this.sourceUrl=null,this.safeBlobUrl=null}return e.prototype.ngOnChanges=function(e){var t=this;e.sourceUrl&&(e.sourceUrl.isFirstChange()&&!this.sourceUrl||(this.disposeCurrent(),this.sourceUrl&&(this.subscription=this.webClient.get(this.sourceUrl,{responseType:"blob"}).subscribe((function(e){t.objectUrlService.revokeObjectURL(t.blobUrl),t.blobUrl=t.objectUrlService.createObjectURL(e),t.safeBlobUrl=t.sanitizer.bypassSecurityTrustUrl(t.blobUrl)})))))},e.prototype.ngOnDestroy=function(){this.disposeCurrent()},e.prototype.onImgLoad=function(){this.disposeCurrent()},e.prototype.disposeCurrent=function(){this.blobUrl&&this.objectUrlService.revokeObjectURL(this.blobUrl),this.subscription&&this.subscription.unsubscribe(),this.blobUrl=null},e.ɵfac=function(i){return new(i||e)(t.ɵɵdirectiveInject(n),t.ɵɵdirectiveInject(r.HttpClient),t.ɵɵdirectiveInject(o.DomSanitizer))},e.ɵcmp=t.ɵɵdefineComponent({type:e,selectors:[["mage-xhr-img"]],inputs:{sourceUrl:["src","sourceUrl"]},features:[t.ɵɵProvidersFeature([{provide:n,useValue:URL}]),t.ɵɵNgOnChangesFeature],decls:1,vars:1,consts:[[3,"load"]],template:function(e,r){1&e&&(t.ɵɵelementStart(0,"img",0),t.ɵɵlistener("load",(function(){return r.onImgLoad()})),t.ɵɵelementEnd()),2&e&&t.ɵɵattribute("src",r.safeBlobUrl,t.ɵɵsanitizeUrl)},styles:["img[_ngcontent-%COMP%] { height: 100%; width: 100% }"]}),e}(),s=function(){function e(){}return e.ɵmod=t.ɵɵdefineNgModule({type:e}),e.ɵinj=t.ɵɵdefineInjector({factory:function(t){return new(t||e)},imports:[[o.BrowserModule]]}),e}();("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(s,{declarations:[i],imports:[o.BrowserModule],exports:[i]}),e.MageCommonModule=s,e.OBJECT_URL_SERVICE=n,e.XhrImgComponent=i,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=ngageoint-mage.web-core-lib-common.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts"],"names":["OBJECT_URL_SERVICE","InjectionToken","selector","XhrImgComponent","objectUrlService","http","sanitizer","this","sourceUrl","safeBlobUrl","prototype","ngOnChanges","changes","_this","isFirstChange","disposeCurrent","subscription","get","responseType","subscribe","x","revokeObjectURL","blobUrl","createObjectURL","bypassSecurityTrustUrl","ngOnDestroy","onImgLoad","unsubscribe","core","ɵɵdirectiveInject","HttpClient","platformBrowser","DomSanitizer","selectors","inputs","features","ɵɵProvidersFeature","provide","useValue","URL","ɵɵNgOnChangesFeature","decls","vars","consts","template","rf","ctx","i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute","MageCommonModule","imports","BrowserModule","declarations","exports"],"mappings":"0mBAKA,IAYaA,EAAqB,IAAIC,EAAAA,eAAoCC,8CAiDxE,SAAAC,EAAgDC,EAA4CC,EAA0BC,GAAtEC,KAAAH,iBAAAA,EAA4CG,KAAAF,KAAAA,EAA0BE,KAAAD,UAAAA,EANtHC,KAAAC,UAA2B,KAC3BD,KAAAE,YAA8B,YAO9BN,EAAAO,UAAAC,YAAA,SAAYC,GAAZ,IAAAC,EAAAN,KACOK,EAAQJ,YAGTI,EAAQJ,UAAUM,kBAAoBP,KAAKC,YAG/CD,KAAKQ,iBACAR,KAAKC,YAGVD,KAAKS,aAAeT,KAAKF,KAAKY,IAAIV,KAAKC,UAAW,CAAEU,aAAc,SAC/DC,WAAU,SAAAC,GACTP,EAAKT,iBAAiBiB,gBAAgBR,EAAKS,SAC3CT,EAAKS,QAAUT,EAAKT,iBAAiBmB,gBAAgBH,GACrDP,EAAKJ,YAAcI,EAAKP,UAAUkB,uBAAuBX,EAAKS,gBAIpEnB,EAAAO,UAAAe,YAAA,WACElB,KAAKQ,kBAGPZ,EAAAO,UAAAgB,UAAA,WACEnB,KAAKQ,kBAGCZ,EAAAO,UAAAK,eAAR,WACMR,KAAKe,SACPf,KAAKH,iBAAiBiB,gBAAgBd,KAAKe,SAEzCf,KAAKS,cACPT,KAAKS,aAAaW,cAEpBpB,KAAKe,QAAU,uCA7CNnB,GAAeyB,EAAAC,kBASN7B,GAAkB4B,EAAAC,kBAAAxB,EAAAyB,YAAAF,EAAAC,kBAAAE,EAAAC,iDAT3B7B,EAAe8B,UAAA,CAAA,CAAA,iBAAAC,OAAA,CAAA1B,UAAA,CAAA,MAAA,cAAA2B,SAAA,CAAAP,EAAAQ,mBAPf,CACT,CACEC,QAASrC,EACTsC,SAAUC,OAEbX,EAAAY,sBAAAC,MAAA,EAAAC,KAAA,EAAAC,OAAA,CAAA,CAAA,EAAA,SAAAC,SAAA,SAAAC,EAAAC,GAAA,EAAAD,IAPUE,EAAAA,eAAAA,EAAAA,MAAAA,GAA8BC,EAAAA,WAAAA,QAAAA,WAAAA,OAAQF,EAAApB,eAAtCuB,EAAAA,qBAAKC,EAAAA,YAAAA,MAAAA,EAAAA,YAAAA,EAAAA,oGC5ClB,SAAAC,4CAWaA,iEAAAA,IAAgBC,QAAA,CAVlB,CACPC,EAAAA,wFASSF,EAAgB,CAAAG,aAAA,CANzBnD,GAAeiD,QAAA,CAHfC,EAAAA,eAAaE,QAAA,CAMbpD","sourcesContent":["import { Component, ElementRef, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private http: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy() {\n this.disposeCurrent()\n }\n\n onImgLoad() {\n this.disposeCurrent()\n }\n\n private disposeCurrent() {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}"]}
1
+ {"version":3,"sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts"],"names":["OBJECT_URL_SERVICE","InjectionToken","selector","XhrImgComponent","objectUrlService","webClient","sanitizer","this","sourceUrl","safeBlobUrl","prototype","ngOnChanges","changes","_this","isFirstChange","disposeCurrent","subscription","get","responseType","subscribe","x","revokeObjectURL","blobUrl","createObjectURL","bypassSecurityTrustUrl","ngOnDestroy","onImgLoad","unsubscribe","core","ɵɵdirectiveInject","http","HttpClient","platformBrowser","DomSanitizer","selectors","inputs","features","ɵɵProvidersFeature","provide","useValue","URL","ɵɵNgOnChangesFeature","decls","vars","consts","template","rf","ctx","i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute","MageCommonModule","imports","BrowserModule","declarations","exports"],"mappings":"0mBAKA,IAYaA,EAAqB,IAAIC,EAAAA,eAAoCC,8CAiDxE,SAAAC,EAAgDC,EAA4CC,EAA+BC,GAA3EC,KAAAH,iBAAAA,EAA4CG,KAAAF,UAAAA,EAA+BE,KAAAD,UAAAA,EAN3HC,KAAAC,UAA2B,KAC3BD,KAAAE,YAA8B,YAO9BN,EAAAO,UAAAC,YAAA,SAAYC,GAAZ,IAAAC,EAAAN,KACOK,EAAQJ,YAGTI,EAAQJ,UAAUM,kBAAoBP,KAAKC,YAG/CD,KAAKQ,iBACAR,KAAKC,YAGVD,KAAKS,aAAeT,KAAKF,UAAUY,IAAIV,KAAKC,UAAW,CAAEU,aAAc,SACpEC,WAAU,SAAAC,GACTP,EAAKT,iBAAiBiB,gBAAgBR,EAAKS,SAC3CT,EAAKS,QAAUT,EAAKT,iBAAiBmB,gBAAgBH,GACrDP,EAAKJ,YAAcI,EAAKP,UAAUkB,uBAAuBX,EAAKS,gBAIpEnB,EAAAO,UAAAe,YAAA,WACElB,KAAKQ,kBAGPZ,EAAAO,UAAAgB,UAAA,WACEnB,KAAKQ,kBAGCZ,EAAAO,UAAAK,eAAR,WACMR,KAAKe,SACPf,KAAKH,iBAAiBiB,gBAAgBd,KAAKe,SAEzCf,KAAKS,cACPT,KAAKS,aAAaW,cAEpBpB,KAAKe,QAAU,uCA7CNnB,GAAeyB,EAAAC,kBASN7B,GAAkB4B,EAAAC,kBAAAC,EAAAC,YAAAH,EAAAC,kBAAAG,EAAAC,iDAT3B9B,EAAe+B,UAAA,CAAA,CAAA,iBAAAC,OAAA,CAAA3B,UAAA,CAAA,MAAA,cAAA4B,SAAA,CAAAR,EAAAS,mBAPf,CACT,CACEC,QAAStC,EACTuC,SAAUC,OAEbZ,EAAAa,sBAAAC,MAAA,EAAAC,KAAA,EAAAC,OAAA,CAAA,CAAA,EAAA,SAAAC,SAAA,SAAAC,EAAAC,GAAA,EAAAD,IAPUE,EAAAA,eAAAA,EAAAA,MAAAA,GAA8BC,EAAAA,WAAAA,QAAAA,WAAAA,OAAQF,EAAArB,eAAtCwB,EAAAA,qBAAKC,EAAAA,YAAAA,MAAAA,EAAAA,YAAAA,EAAAA,oGC5ClB,SAAAC,4CAWaA,iEAAAA,IAAgBC,QAAA,CAVlB,CACPC,EAAAA,wFASSF,EAAgB,CAAAG,aAAA,CANzBpD,GAAekD,QAAA,CAHfC,EAAAA,eAAaE,QAAA,CAMbrD","sourcesContent":["import { Component, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private webClient: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy(): void {\n this.disposeCurrent()\n }\n\n onImgLoad(): void {\n this.disposeCurrent()\n }\n\n private disposeCurrent(): void {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}"]}
@@ -5,8 +5,8 @@
5
5
  }(this, (function (exports, core, rxjs, operators, http) { 'use strict';
6
6
 
7
7
  var FeedService = /** @class */ (function () {
8
- function FeedService(http) {
9
- this.http = http;
8
+ function FeedService(webClient) {
9
+ this.webClient = webClient;
10
10
  // TODO: there is probably a better solution than maintaining this map here
11
11
  this._feeds = new rxjs.BehaviorSubject([]);
12
12
  this.feeds = this._feeds.asObservable();
@@ -16,57 +16,57 @@
16
16
  return this._feedItems.get(feedId).asObservable();
17
17
  };
18
18
  FeedService.prototype.fetchAllFeeds = function () {
19
- return this.http.get('/api/feeds/');
19
+ return this.webClient.get('/api/feeds/');
20
20
  };
21
21
  FeedService.prototype.fetchFeed = function (feedId) {
22
- return this.http.get("/api/feeds/" + feedId);
22
+ return this.webClient.get("/api/feeds/" + feedId);
23
23
  };
24
24
  FeedService.prototype.fetchService = function (serviceId) {
25
- return this.http.get("/api/feeds/services/" + serviceId);
25
+ return this.webClient.get("/api/feeds/services/" + serviceId);
26
26
  };
27
27
  FeedService.prototype.createService = function (service) {
28
- return this.http.post("/api/feeds/services", service);
28
+ return this.webClient.post("/api/feeds/services", service);
29
29
  };
30
30
  FeedService.prototype.fetchServices = function () {
31
- return this.http.get("/api/feeds/services");
31
+ return this.webClient.get("/api/feeds/services");
32
32
  };
33
33
  FeedService.prototype.fetchServiceFeeds = function (serviceId) {
34
- return this.http.get("/api/feeds/services/" + serviceId + "/feeds");
34
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/feeds");
35
35
  };
36
36
  FeedService.prototype.fetchServiceType = function (serviceTypeId) {
37
- return this.http.get("/api/feeds/service_types/" + serviceTypeId);
37
+ return this.webClient.get("/api/feeds/service_types/" + serviceTypeId);
38
38
  };
39
39
  FeedService.prototype.fetchTopics = function (serviceId) {
40
- return this.http.get("/api/feeds/services/" + serviceId + "/topics");
40
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/topics");
41
41
  };
42
42
  FeedService.prototype.previewFeed = function (serviceId, topicId, feedSpec, opts) {
43
43
  opts = opts || {};
44
44
  var skipContentFetch = opts.skipContentFetch === true;
45
- return this.http.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feed_preview?skip_content_fetch=" + skipContentFetch, { feed: feedSpec });
45
+ return this.webClient.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feed_preview?skip_content_fetch=" + skipContentFetch, { feed: feedSpec });
46
46
  };
47
47
  FeedService.prototype.fetchTopic = function (serviceId, topicId) {
48
- return this.http.get("/api/feeds/services/" + serviceId + "/topics/" + topicId);
48
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/topics/" + topicId);
49
49
  };
50
50
  FeedService.prototype.fetchServiceTypes = function () {
51
- return this.http.get("/api/feeds/service_types");
51
+ return this.webClient.get("/api/feeds/service_types");
52
52
  };
53
53
  FeedService.prototype.createFeed = function (serviceId, topicId, feedConfiguration) {
54
- return this.http.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feeds", feedConfiguration);
54
+ return this.webClient.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feeds", feedConfiguration);
55
55
  };
56
56
  FeedService.prototype.updateFeed = function (feed) {
57
- return this.http.put("/api/feeds/" + feed.id, feed);
57
+ return this.webClient.put("/api/feeds/" + feed.id, feed);
58
58
  };
59
59
  FeedService.prototype.deleteFeed = function (feed) {
60
- return this.http.delete("/api/feeds/" + feed.id, { responseType: 'text' });
60
+ return this.webClient.delete("/api/feeds/" + feed.id, { responseType: 'text' });
61
61
  };
62
62
  FeedService.prototype.deleteService = function (service) {
63
63
  console.log('delete');
64
- return this.http.delete("/api/feeds/services/" + service.id, { responseType: 'text' });
64
+ return this.webClient.delete("/api/feeds/services/" + service.id, { responseType: 'text' });
65
65
  };
66
66
  FeedService.prototype.fetchFeeds = function (eventId) {
67
67
  var _this = this;
68
68
  var subject = new rxjs.Subject();
69
- this.http.get("/api/events/" + eventId + "/feeds").subscribe(function (feeds) {
69
+ this.webClient.get("/api/events/" + eventId + "/feeds").subscribe(function (feeds) {
70
70
  feeds.map(function (feed) {
71
71
  feed.id = feed.id.toString();
72
72
  return feed;
@@ -85,7 +85,7 @@
85
85
  };
86
86
  FeedService.prototype.fetchFeedItems = function (event, feed) {
87
87
  var feedItems = this._feedItems.get(feed.id);
88
- return this.http.post("/api/events/" + event.id + "/feeds/" + feed.id + "/content", {}).pipe(operators.map(function (content) {
88
+ return this.webClient.post("/api/events/" + event.id + "/feeds/" + feed.id + "/content", {}).pipe(operators.map(function (content) {
89
89
  var features = content.items.features;
90
90
  features.forEach(function (feature) {
91
91
  feature.id = String(feature.id);
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-feed.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private http: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.http.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.http.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.http.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.http.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.http.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.http.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.http.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.http.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.http.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.http.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.http.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.http.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.http.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.http.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n"],"names":["BehaviorSubject","Subject","map","Injectable"],"mappings":";;;;;;;QAiBE,qBAAoB,IAAgB;YAAhB,SAAI,GAAJ,IAAI,CAAY;;YAG5B,WAAM,GAAG,IAAIA,oBAAe,CAAc,EAAE,CAAC,CAAC;YAC7C,UAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAEpC,eAAU,GAAG,IAAI,GAAG,EAA2C,CAAC;SAN/B;QAOzC,+BAAS,GAAT,UAAU,MAAc;YACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAC;SACnD;QAED,mCAAa,GAAb;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,aAAa,CAAC,CAAC;SAClD;QAED,+BAAS,GAAT,UAAU,MAAc;YACtB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,gBAAc,MAAQ,CAAC,CAAC;SAC5D;QAED,kCAAY,GAAZ,UAAa,SAAiB;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAU,yBAAuB,SAAW,CAAC,CAAC;SACnE;QAED,mCAAa,GAAb,UAAc,OAA6E;YACzF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAU,qBAAqB,EAAE,OAAO,CAAC,CAAC;SAChE;QAED,mCAAa,GAAb;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,qBAAqB,CAAC,CAAC;SAC7D;QAED,uCAAiB,GAAjB,UAAkB,SAAiB;YACjC,OAAO,IAAI,CAAC,IAAI,CAAC,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AAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAc,iBAAe,KAAK,CAAC,EAAE,eAAU,IAAI,CAAC,EAAE,aAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAC7FE,aAAG,CAAC,UAAA,OAAO;gBACT,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAA;gBACvC,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAsB;oBACtC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;oBAC/B,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAA;iBAC9C,CAAC,CAAA;gBACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACxB,OAAO,OAAO,CAAA;aACf,CAAC,CACH,CAAA;SACF;8EAlHU,WAAW;6DAAX,WAAW,WAAX,WAAW,mBAFV,MAAM;0BAbpB;KAYA,IAsHC;wDAnHY,WAAW;kBAHvBC,eAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-feed.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private webClient: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.webClient.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.webClient.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.webClient.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.webClient.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.webClient.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.webClient.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.webClient.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.webClient.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.webClient.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.webClient.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.webClient.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.webClient.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.webClient.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.webClient.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.webClient.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n"],"names":["BehaviorSubject","Subject","map","Injectable"],"mappings":";;;;;;;QAiBE,qBAAoB,SAAqB;YAArB,cAAS,GAAT,SAAS,CAAY;;YAGjC,WAAM,GAAG,IAAIA,oBAAe,CAAc,EAAE,CAAC,CAAC;YAC7C,UAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAEpC,eAAU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,CAAC,CAAA;gBACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACxB,OAAO,OAAO,CAAA;aACf,CAAC,CACH,CAAA;SACF;8EAlHU,WAAW;6DAAX,WAAW,WAAX,WAAW,mBAFV,MAAM;0BAbpB;KAYA,IAsHC;wDAnHY,WAAW;kBAHvBC,eAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/feed",["exports","@angular/core","rxjs","rxjs/operators","@angular/common/http"],t):t(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"].feed={}),e.ng.core,e.rxjs,e.rxjs.operators,e.ng.common.http)}(this,(function(e,t,i,r,n){"use strict";var o=function(){function e(e){this.http=e,this._feeds=new i.BehaviorSubject([]),this.feeds=this._feeds.asObservable(),this._feedItems=new Map}return e.prototype.feedItems=function(e){return this._feedItems.get(e).asObservable()},e.prototype.fetchAllFeeds=function(){return this.http.get("/api/feeds/")},e.prototype.fetchFeed=function(e){return this.http.get("/api/feeds/"+e)},e.prototype.fetchService=function(e){return this.http.get("/api/feeds/services/"+e)},e.prototype.createService=function(e){return this.http.post("/api/feeds/services",e)},e.prototype.fetchServices=function(){return this.http.get("/api/feeds/services")},e.prototype.fetchServiceFeeds=function(e){return this.http.get("/api/feeds/services/"+e+"/feeds")},e.prototype.fetchServiceType=function(e){return this.http.get("/api/feeds/service_types/"+e)},e.prototype.fetchTopics=function(e){return this.http.get("/api/feeds/services/"+e+"/topics")},e.prototype.previewFeed=function(e,t,i,r){var n=!0===(r=r||{}).skipContentFetch;return this.http.post("/api/feeds/services/"+e+"/topics/"+t+"/feed_preview?skip_content_fetch="+n,{feed:i})},e.prototype.fetchTopic=function(e,t){return this.http.get("/api/feeds/services/"+e+"/topics/"+t)},e.prototype.fetchServiceTypes=function(){return this.http.get("/api/feeds/service_types")},e.prototype.createFeed=function(e,t,i){return this.http.post("/api/feeds/services/"+e+"/topics/"+t+"/feeds",i)},e.prototype.updateFeed=function(e){return this.http.put("/api/feeds/"+e.id,e)},e.prototype.deleteFeed=function(e){return this.http.delete("/api/feeds/"+e.id,{responseType:"text"})},e.prototype.deleteService=function(e){return console.log("delete"),this.http.delete("/api/feeds/services/"+e.id,{responseType:"text"})},e.prototype.fetchFeeds=function(e){var t=this,r=new i.Subject;return this.http.get("/api/events/"+e+"/feeds").subscribe((function(e){e.map((function(e){return e.id=e.id.toString(),e})),e.forEach((function(e){var r=t._feedItems.get(e.id);r||(r=new i.BehaviorSubject([]),t._feedItems.set(e.id,r))})),r.next(e),t._feeds.next(e)})),r},e.prototype.fetchFeedItems=function(e,t){var i=this._feedItems.get(t.id);return this.http.post("/api/events/"+e.id+"/feeds/"+t.id+"/content",{}).pipe(r.map((function(e){var t=e.items.features;return t.forEach((function(e){e.id=String(e.id),e.properties=e.properties||{}})),i.next(t),e})))},e.ɵfac=function(i){return new(i||e)(t.ɵɵinject(n.HttpClient))},e.ɵprov=t.ɵɵdefineInjectable({token:e,factory:e.ɵfac,providedIn:"root"}),e}();e.FeedService=o,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/feed",["exports","@angular/core","rxjs","rxjs/operators","@angular/common/http"],t):t(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"].feed={}),e.ng.core,e.rxjs,e.rxjs.operators,e.ng.common.http)}(this,(function(e,t,i,n,r){"use strict";var o=function(){function e(e){this.webClient=e,this._feeds=new i.BehaviorSubject([]),this.feeds=this._feeds.asObservable(),this._feedItems=new Map}return e.prototype.feedItems=function(e){return this._feedItems.get(e).asObservable()},e.prototype.fetchAllFeeds=function(){return this.webClient.get("/api/feeds/")},e.prototype.fetchFeed=function(e){return this.webClient.get("/api/feeds/"+e)},e.prototype.fetchService=function(e){return this.webClient.get("/api/feeds/services/"+e)},e.prototype.createService=function(e){return this.webClient.post("/api/feeds/services",e)},e.prototype.fetchServices=function(){return this.webClient.get("/api/feeds/services")},e.prototype.fetchServiceFeeds=function(e){return this.webClient.get("/api/feeds/services/"+e+"/feeds")},e.prototype.fetchServiceType=function(e){return this.webClient.get("/api/feeds/service_types/"+e)},e.prototype.fetchTopics=function(e){return this.webClient.get("/api/feeds/services/"+e+"/topics")},e.prototype.previewFeed=function(e,t,i,n){var r=!0===(n=n||{}).skipContentFetch;return this.webClient.post("/api/feeds/services/"+e+"/topics/"+t+"/feed_preview?skip_content_fetch="+r,{feed:i})},e.prototype.fetchTopic=function(e,t){return this.webClient.get("/api/feeds/services/"+e+"/topics/"+t)},e.prototype.fetchServiceTypes=function(){return this.webClient.get("/api/feeds/service_types")},e.prototype.createFeed=function(e,t,i){return this.webClient.post("/api/feeds/services/"+e+"/topics/"+t+"/feeds",i)},e.prototype.updateFeed=function(e){return this.webClient.put("/api/feeds/"+e.id,e)},e.prototype.deleteFeed=function(e){return this.webClient.delete("/api/feeds/"+e.id,{responseType:"text"})},e.prototype.deleteService=function(e){return console.log("delete"),this.webClient.delete("/api/feeds/services/"+e.id,{responseType:"text"})},e.prototype.fetchFeeds=function(e){var t=this,n=new i.Subject;return this.webClient.get("/api/events/"+e+"/feeds").subscribe((function(e){e.map((function(e){return e.id=e.id.toString(),e})),e.forEach((function(e){var n=t._feedItems.get(e.id);n||(n=new i.BehaviorSubject([]),t._feedItems.set(e.id,n))})),n.next(e),t._feeds.next(e)})),n},e.prototype.fetchFeedItems=function(e,t){var i=this._feedItems.get(t.id);return this.webClient.post("/api/events/"+e.id+"/feeds/"+t.id+"/content",{}).pipe(n.map((function(e){var t=e.items.features;return t.forEach((function(e){e.id=String(e.id),e.properties=e.properties||{}})),i.next(t),e})))},e.ɵfac=function(i){return new(i||e)(t.ɵɵinject(r.HttpClient))},e.ɵprov=t.ɵɵdefineInjectable({token:e,factory:e.ɵfac,providedIn:"root"}),e}();e.FeedService=o,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=ngageoint-mage.web-core-lib-feed.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts"],"names":["FeedService","http","this","_feeds","BehaviorSubject","feeds","asObservable","_feedItems","Map","prototype","feedItems","feedId","get","fetchAllFeeds","fetchFeed","fetchService","serviceId","createService","service","post","fetchServices","fetchServiceFeeds","fetchServiceType","serviceTypeId","fetchTopics","previewFeed","topicId","feedSpec","opts","skipContentFetch","feed","fetchTopic","fetchServiceTypes","createFeed","feedConfiguration","updateFeed","put","id","deleteFeed","delete","responseType","deleteService","console","log","fetchFeeds","eventId","_this","subject","Subject","subscribe","map","toString","forEach","set","next","fetchFeedItems","event","pipe","content","features","items","feature","String","properties","core","ɵɵinject","HttpClient","factory","ɵfac","providedIn"],"mappings":"6nBAiBE,SAAAA,EAAoBC,GAAAC,KAAAD,KAAAA,EAGZC,KAAAC,OAAS,IAAIC,EAAAA,gBAA6B,IACzCF,KAAAG,MAAQH,KAAKC,OAAOG,eAErBJ,KAAAK,WAAa,IAAIC,WACzBR,EAAAS,UAAAC,UAAA,SAAUC,GACR,OAAOT,KAAKK,WAAWK,IAAID,GAAQL,gBAGrCN,EAAAS,UAAAI,cAAA,WACE,OAAOX,KAAKD,KAAKW,IAAiB,gBAGpCZ,EAAAS,UAAAK,UAAA,SAAUH,GACR,OAAOT,KAAKD,KAA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lExC,EAAAS,UAAAgC,cAAA,SAAcvB,GAEZ,OADAwB,QAAQC,IAAI,UACLzC,KAAKD,KAAKsC,OAAO,uBAAuBrB,EAAQmB,GAAM,CAAEG,aAAc,UAG/ExC,EAAAS,UAAAmC,WAAA,SAAWC,GAAX,IAAAC,EAAA5C,KACQ6C,EAAU,IAAIC,EAAAA,QAmBpB,OAlBA9C,KAAKD,KAAKW,IAAiB,eAAeiC,EAAO,UAAUI,WAAU,SAAA5C,GACnEA,EAAM6C,KAAI,SAAApB,GAER,OADAA,EAAKO,GAAKP,EAAKO,GAAGc,WACXrB,KAGTzB,EAAM+C,SAAQ,SAAAtB,GACZ,IAAIpB,EAAYoC,EAAKvC,WAAWK,IAAIkB,EAAKO,IACpC3B,IACHA,EAAY,IAAIN,EAAAA,gBAAgC,IAChD0C,EAAKvC,WAAW8C,IAAIvB,EAAKO,GAAI3B,OAIjCqC,EAAQO,KAAKjD,GACbyC,EAAK3C,OAAOmD,KAAKjD,MAGZ0C,GAGT/C,EAAAS,UAAA8C,eAAA,SAAeC,EAAY1B,GACzB,IAAMpB,EAAYR,KAAKK,WAAWK,IAAIkB,EAAKO,IAC3C,OAAOnC,KAAKD,KAAKkB,KAAkB,eAAeqC,EAAMnB,GAAE,UAAUP,EAAKO,GAAE,WAAY,IAAIoB,KACzFP,EAAAA,KAAI,SAAAQ,GACF,IAAMC,EAAWD,EAAQE,MAAMD,SAM/B,OALAA,EAASP,SAAQ,SAACS,GAChBA,EAAQxB,GAAKyB,OAAOD,EAAQxB,IAC5BwB,EAAQE,WAAaF,EAAQE,YAAc,MAE7CrD,EAAU4C,KAAKK,GACRD,wCA/GF1D,GAAWgE,EAAAC,SAAAhE,EAAAiE,kDAAXlE,EAAWmE,QAAXnE,EAAWoE,KAAAC,WAFV","sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private http: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.http.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.http.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.http.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.http.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.http.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.http.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.http.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.http.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.http.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.http.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.http.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.http.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.http.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.http.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n"]}
1
+ {"version":3,"sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts"],"names":["FeedService","webClient","this","_feeds","BehaviorSubject","feeds","asObservable","_feedItems","Map","prototype","feedItems","feedId","get","fetchAllFeeds","fetchFeed","fetchService","serviceId","createService","service","post","fetchServices","fetchServiceFeeds","fetchServiceType","serviceTypeId","fetchTopics","previewFeed","topicId","feedSpec","opts","skipContentFetch","feed","fetchTopic","fetchServiceTypes","createFeed","feedConfiguration","updateFeed","put","id","deleteFeed","delete","responseType","deleteService","console","log","fetchFeeds","eventId","_this","subject","Subject","subscribe","map","toString","forEach","set","next","fetchFeedItems","event","pipe","content","features","items","feature","String","properties","core","ɵɵinject","http","HttpClient","factory","ɵfac","providedIn"],"mappings":"6nBAiBE,SAAAA,EAAoBC,GAAAC,KAAAD,UAAAA,EAGZC,KAAAC,OAAS,IAAIC,EAAAA,gBAA6B,IACzCF,KAAAG,MAAQH,KAAKC,OAAOG,eAErBJ,KAAAK,WAAa,IAAIC,WACzBR,EAAAS,UAAAC,UAAA,SAAUC,GACR,OAAOT,KAAKK,WAAWK,IAAID,GAAQL,gBAGrCN,EAAAS,UAAAI,cAAA,WACE,OAAOX,KAAKD,UAAUW,IAAiB,gBAGzCZ,EAAAS,UAAAK,UAAA,SAAUH,GACR,OAAOT,KAAKD,UAAUW,IAAkB,cAAcD,IAGxDX,EAAAS,UAAAM,aAAA,SAAaC,GACX,OAAOd,KAAKD,UAAUW,IAAa,uBAAuBI,IAG5DhB,EAAAS,UAAAQ,cAAA,SAAcC,GACZ,OAAOhB,KAAKD,UAAUkB,KAAc,sBAAuBD,IAG7DlB,EAAAS,UAAAW,cAAA,WACE,OAAOlB,KAAKD,UAAUW,IAAoB,wBAG5CZ,EAAAS,UAAAY,kBAAA,SAAkBL,GAChB,OAAOd,KAAKD,UAAUW,IAAiB,uBAAuBI,EAAS,WAGzEhB,EAAAS,UAAAa,iBAAA,SAAiBC,GACf,OAAOrB,KAAKD,UAAUW,IAAiB,4BAA4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,EAAYoC,EAAKvC,WAAWK,IAAIkB,EAAKO,IACpC3B,IACHA,EAAY,IAAIN,EAAAA,gBAAgC,IAChD0C,EAAKvC,WAAW8C,IAAIvB,EAAKO,GAAI3B,OAIjCqC,EAAQO,KAAKjD,GACbyC,EAAK3C,OAAOmD,KAAKjD,MAGZ0C,GAGT/C,EAAAS,UAAA8C,eAAA,SAAeC,EAAY1B,GACzB,IAAMpB,EAAYR,KAAKK,WAAWK,IAAIkB,EAAKO,IAC3C,OAAOnC,KAAKD,UAAUkB,KAAkB,eAAeqC,EAAMnB,GAAE,UAAUP,EAAKO,GAAE,WAAY,IAAIoB,KAC9FP,EAAAA,KAAI,SAAAQ,GACF,IAAMC,EAAWD,EAAQE,MAAMD,SAM/B,OALAA,EAASP,SAAQ,SAACS,GAChBA,EAAQxB,GAAKyB,OAAOD,EAAQxB,IAC5BwB,EAAQE,WAAaF,EAAQE,YAAc,MAE7CrD,EAAU4C,KAAKK,GACRD,wCA/GF1D,GAAWgE,EAAAC,SAAAC,EAAAC,kDAAXnE,EAAWoE,QAAXpE,EAAWqE,KAAAC,WAFV","sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private webClient: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.webClient.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.webClient.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.webClient.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.webClient.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.webClient.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.webClient.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.webClient.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.webClient.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.webClient.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.webClient.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.webClient.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.webClient.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.webClient.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.webClient.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.webClient.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n"]}
@@ -15,8 +15,8 @@
15
15
  };
16
16
 
17
17
  var StaticIconService = /** @class */ (function () {
18
- function StaticIconService(http) {
19
- this.http = http;
18
+ function StaticIconService(webClient) {
19
+ this.webClient = webClient;
20
20
  }
21
21
  StaticIconService.prototype.fetchIcons = function (fetch) {
22
22
  var now = Date.now();
@@ -49,7 +49,7 @@
49
49
  return results;
50
50
  };
51
51
  StaticIconService.prototype.fetchIconById = function (id) {
52
- return this.http.get("/api/icons/" + id).pipe(operators.catchError(function (err, caught) {
52
+ return this.webClient.get("/api/icons/" + id).pipe(operators.catchError(function (err, caught) {
53
53
  // TODO: this is probably better practice to insulate app layer from
54
54
  // http errors
55
55
  // if (err instanceof HttpErrorResponse) {
@@ -61,7 +61,7 @@
61
61
  }));
62
62
  };
63
63
  StaticIconService.prototype.fetchIconBySourceUrl = function (url) {
64
- return this.http.get("/api/icons", {
64
+ return this.webClient.get("/api/icons", {
65
65
  params: new http.HttpParams().set('source_url', url)
66
66
  });
67
67
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-static-icon.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.model.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.service.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-img/static-icon-img.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.module.ts"],"sourcesContent":["\nexport interface StaticIcon {\n id: string\n sourceUrl: string\n contentPath: string\n title?: string\n summary?: string\n fileName?: string\n tags?: string[]\n}\n\nexport interface RegisteredStaticIconReference {\n id: string\n sourceUrl?: never\n}\n\nexport interface SourceUrlStaticIconReference {\n sourceUrl: string\n id?: never\n}\n\nexport const contentPathOfIcon = (icon?: StaticIcon | RegisteredStaticIconReference | string | null | undefined): string | undefined => {\n if (!icon) {\n return\n }\n if (typeof icon !== 'string') {\n icon = icon.id\n }\n return `/api/icons/${icon}/content`\n}\n\nexport type StaticIconReference = RegisteredStaticIconReference | SourceUrlStaticIconReference\n","import { HttpClient, HttpParams } from '@angular/common/http'\nimport { Injectable } from '@angular/core';\nimport { Observable, throwError } from 'rxjs'\nimport { catchError } from 'rxjs/operators'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon, StaticIconReference } from './static-icon.model'\n\n\nexport interface IconFetch extends PagingParameters {\n searchText?: string\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class StaticIconService {\n\n constructor(private http: HttpClient) { }\n\n fetchIcons(fetch?: IconFetch): Observable<PageOf<StaticIcon>> {\n const now = Date.now()\n const results = new Observable<PageOf<StaticIcon>>(observer => {\n const icons: StaticIcon[] = []\n let remaining = 100\n while (remaining--) {\n const id = now - remaining\n icons.unshift({\n id: String(id),\n title: `Icon ${id}`,\n fileName: `icon-${id}.png`,\n sourceUrl: `https://test.mage/${id}.png`,\n contentPath: `/icons/${id}/content`\n })\n }\n setTimeout(() => {\n observer.next({\n pageSize: 100,\n pageIndex: 0,\n totalCount: 100,\n items: icons\n })\n observer.complete()\n }, 0)\n return {\n unsubscribe() { }\n }\n })\n return results\n }\n\n fetchIconById(id: string): Observable<StaticIcon | null> {\n return this.http.get<StaticIcon>(`/api/icons/${id}`).pipe(\n catchError((err, caught) => {\n // TODO: this is probably better practice to insulate app layer from\n // http errors\n // if (err instanceof HttpErrorResponse) {\n // if (err.status === 404) {\n // return null\n // }\n // }\n return throwError(err)\n })\n )\n }\n\n fetchIconBySourceUrl(url: string): Observable<StaticIcon> {\n return this.http.get<StaticIcon | null>(`/api/icons`, {\n params: new HttpParams().set('source_url', url)\n })\n }\n\n fetchIconByReference(ref: StaticIconReference): Observable<StaticIcon | null> {\n if (ref.id) {\n return this.fetchIconById(ref.id)\n }\n else if (ref.sourceUrl) {\n return this.fetchIconBySourceUrl(ref.sourceUrl)\n }\n throw new Error('no icon id or source url')\n }\n\n registerIconUrl(url: string): Observable<StaticIcon> {\n throw new Error('unimplemented')\n }\n\n uploadIcon(): void {\n throw new Error('unimplemented')\n }\n}\n","import { HttpClient } from '@angular/common/http'\nimport { Component, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator, Validators } from '@angular/forms'\nimport { DomSanitizer } from '@angular/platform-browser'\nimport { StaticIcon, StaticIconReference } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\n\n@Component({\n selector: 'mage-static-icon-form-field',\n templateUrl: './static-icon-form-field.component.html',\n styleUrls: ['./static-icon-form-field.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n ]\n})\nexport class StaticIconFormFieldComponent implements OnChanges, OnDestroy, ControlValueAccessor, Validator {\n\n iconRef: StaticIconReference = null\n\n form: FormGroup = new FormGroup({\n iconRefToken: new FormControl(null),\n iconRefType: new FormControl(null, Validators.required)\n })\n icon: StaticIcon | null\n\n private onChange: (iconRef: StaticIconReference) => void = (iconRef: StaticIconReference) => {}\n private onValidatorChange: () => void = () => {}\n private onTouched: () => void = () => {}\n\n constructor(private iconService: StaticIconService, private httpClient: HttpClient, private sanitizer: DomSanitizer) {\n this.form.valueChanges.subscribe((x: IconRefFormValue) => {\n this.iconRef = iconRefForFormValue(x)\n this.onChange(this.iconRef)\n })\n }\n\n registerOnValidatorChange?(fn: () => void): void {\n this.onValidatorChange = fn\n }\n\n ngOnChanges(changes: SimpleChanges) { }\n\n ngOnDestroy() { }\n\n onSelectIcon() { }\n\n writeValue(iconRef: StaticIconReference): void {\n this.iconRef = iconRef\n const formValue = formValueForIconRef(iconRef)\n this.form.setValue(formValue, { emitEvent: false })\n this.resolveIconRef()\n }\n\n registerOnChange(fn: (x: StaticIconReference | null) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n if (isDisabled) {\n this.form.disable()\n }\n else {\n this.form.enable()\n }\n }\n\n validate(control: AbstractControl): ValidationErrors {\n return this.form.errors\n }\n\n private resolveIconRef() {\n if (!this.iconRef) {\n this.icon = null\n return\n }\n this.iconService.fetchIconByReference(this.iconRef).subscribe(x => {\n this.icon = x\n if (!this.icon) {\n return\n }\n })\n }\n}\n\nenum IconRefType {\n Registered = 'id',\n SourceUrl = 'sourceUrl'\n}\n\ntype IconRefFormValue = {\n iconRefToken: string | null\n iconRefType: IconRefType | null\n}\n\nfunction iconRefForFormValue(x: IconRefFormValue): StaticIconReference | null {\n if (!x.iconRefType) {\n return null\n }\n switch (x.iconRefType) {\n case IconRefType.Registered:\n return { [IconRefType.Registered]: x.iconRefToken }\n case IconRefType.SourceUrl:\n return { [IconRefType.SourceUrl]: x.iconRefToken }\n default:\n throw new Error('invalid icon ref type: ' + x.iconRefToken)\n }\n}\n\nfunction formValueForIconRef(x: StaticIconReference | null): IconRefFormValue {\n if (!x) {\n return {\n iconRefType: null,\n iconRefToken: null\n }\n }\n let iconRefType: IconRefType | null = null\n let iconRefToken: string | null = null\n if (x.hasOwnProperty(IconRefType.Registered)) {\n iconRefType = IconRefType.Registered || null\n iconRefToken = x[IconRefType.Registered] || null\n }\n else if (x.hasOwnProperty(IconRefType.SourceUrl)) {\n iconRefType = IconRefType.SourceUrl || null\n iconRefToken = x[IconRefType.SourceUrl] || null\n }\n return {\n iconRefType,\n iconRefToken\n }\n}\n","<div [formGroup]=\"form\">\n <mage-xhr-img class=\"icon-image\" [src]=\"icon?.contentPath\"></mage-xhr-img>\n <input type=\"hidden\" formControlName=\"iconRefType\"/>\n <input type=\"hidden\" formControlName=\"iconRefToken\"/>\n</div>","import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { RegisteredStaticIconReference, contentPathOfIcon } from '../static-icon.model'\n\n@Component({\n selector: 'mage-static-icon-img',\n template: `<mage-xhr-img [src]=\"iconPath\"></mage-xhr-img>`,\n})\nexport class StaticIconImgComponent implements OnInit, OnChanges {\n\n @Input()\n iconRef: RegisteredStaticIconReference | string | null\n iconPath: string | null\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.iconRef) {\n if (this.iconRef) {\n this.iconPath = contentPathOfIcon(this.iconRef)\n }\n else {\n this.iconPath = null\n }\n }\n }\n}\n","<div class=\"icon-select\">\n <cdk-virtual-scroll-viewport [itemSize]=\"40\">\n <mat-card *cdkVirtualFor=\"let icon of icons\" class=icon-select-item>\n <mat-card-header>\n <mat-card-title>{{icon.title}}</mat-card-title>\n </mat-card-header>\n <img mat-card-img [src]=\"icon.path\" />\n </mat-card>\n </cdk-virtual-scroll-viewport>\n</div>\n<!--\n <button mat-button class=\"add__button\" type=\"button\" color=\"primary\" (click)=\"file.click()\">\n Upload Icon\n </button>\n <input [hidden]=\"true\" type=\"file\" #file multiple (change)=\"onAttachmentFile($event)\">\n-->","import { Component, OnInit } from '@angular/core'\nimport { PagingParameters, PagingDataSource } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\nexport interface StaticIconSelectItem {\n id: string\n path: string\n title: string\n fileName: string\n}\n\n@Component({\n selector: 'static-icon-select',\n templateUrl: './static-icon-select.component.html',\n styleUrls: ['./static-icon-select.component.scss']\n})\nexport class StaticIconSelectComponent implements OnInit {\n\n icons: StaticIcon[] | null = null\n dataSource: PagingDataSource<StaticIcon>\n\n constructor(\n private iconService: StaticIconService\n ) {\n this.dataSource = new PagingDataSource<StaticIcon>(250, (paging: PagingParameters) => {\n return this.iconService.fetchIcons(paging)\n })\n }\n\n ngOnInit() {\n this.iconService.fetchIcons().subscribe(x => {\n this.icons = x.items\n })\n }\n\n onBrowseForUploadIcon() {\n throw new Error('unimplemented')\n }\n}\n\n","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatCardModule } from '@angular/material/card'\nimport { MageCommonModule } from '@ngageoint/mage.web-core-lib/common'\nimport { StaticIconFormFieldComponent } from './static-icon-form-field/static-icon-form-field.component'\nimport { StaticIconImgComponent } from './static-icon-img/static-icon-img.component'\nimport { StaticIconSelectComponent } from './static-icon-select/static-icon-select.component'\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatCardModule,\n MageCommonModule,\n ScrollingModule\n ],\n declarations: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ],\n exports: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ]\n})\nexport class StaticIconModule {}"],"names":["Observable","catchError","throwError","HttpParams","Injectable","FormGroup","FormControl","Validators","NG_VALUE_ACCESSOR","NG_VALIDATORS","i0.ɵɵelementStart","i0.ɵɵelement","i0.ɵɵelementEnd","i0.ɵɵproperty","i0.ɵɵadvance","Component","Input","i0.ɵɵtext","i0.ɵɵtextInterpolate","PagingDataSource","i0.ɵɵtemplate","CommonModule","FormsModule","ReactiveFormsModule","MatCardModule","MageCommonModule","ScrollingModule","NgModule"],"mappings":";;;;;;QAqBa,iBAAiB,GAAG,UAAC,IAA6E;QAC7G,IAAI,CAAC,IAAI,EAAE;YACT,OAAM;SACP;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAA;SACf;QACD,OAAO,gBAAc,IAAI,aAAU,CAAA;IACrC;;;QCZE,2BAAoB,IAAgB;YAAhB,SAAI,GAAJ,IAAI,CAAY;SAAK;QAEzC,sCAAU,GAAV,UAAW,KAAiB;YAC1B,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YACtB,IAAM,OAAO,GAAG,IAAIA,eAAU,CAAqB,UAAA,QAAQ;gBACzD,IAAM,KAAK,GAAiB,EAAE,CAAA;gBAC9B,IAAI,SAAS,GAAG,GAAG,CAAA;gBACnB,OAAO,SAAS,EAAE,EAAE;oBAClB,IAAM,EAAE,GAAG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BAAyB,aAVzBL,mBAAY;YACZC,iBAAW;YACXC,yBAAmB;YACnBC,kBAAa;YACbC,yBAAgB;YAChBC,yBAAe,aAQf,4BAA4B;YAC5B,sBAAsB;YACtB,yBAAyB;wDAGhB,gBAAgB;kBApB5BC,aAAQ;mBAAC;oBACR,OAAO,EAAE;wBACPN,mBAAY;wBACZC,iBAAW;wBACXC,yBAAmB;wBACnBC,kBAAa;wBACbC,yBAAgB;wBAChBC,yBAAe;qBAChB;oBACD,YAAY,EAAE;wBACZ,4BAA4B;wBAC5B,sBAAsB;wBACtB,yBAAyB;qBAC1B;oBACD,OAAO,EAAE;wBACP,4BAA4B;wBAC5B,sBAAsB;wBACtB,yBAAyB;qBAC1B;iBACF;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-static-icon.umd.js","sources":["ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.model.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.service.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-img/static-icon-img.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.module.ts"],"sourcesContent":["\nexport interface StaticIcon {\n id: string\n sourceUrl: string\n contentPath: string\n title?: string\n summary?: string\n fileName?: string\n tags?: string[]\n}\n\nexport interface RegisteredStaticIconReference {\n id: string\n sourceUrl?: never\n}\n\nexport interface SourceUrlStaticIconReference {\n sourceUrl: string\n id?: never\n}\n\nexport const contentPathOfIcon = (icon?: StaticIcon | RegisteredStaticIconReference | string | null | undefined): string | undefined => {\n if (!icon) {\n return\n }\n if (typeof icon !== 'string') {\n icon = icon.id\n }\n return `/api/icons/${icon}/content`\n}\n\nexport type StaticIconReference = RegisteredStaticIconReference | SourceUrlStaticIconReference\n","import { HttpClient, HttpParams } from '@angular/common/http'\nimport { Injectable } from '@angular/core';\nimport { Observable, throwError } from 'rxjs'\nimport { catchError } from 'rxjs/operators'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon, StaticIconReference } from './static-icon.model'\n\n\nexport interface IconFetch extends PagingParameters {\n searchText?: string\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class StaticIconService {\n\n constructor(private webClient: HttpClient) { }\n\n fetchIcons(fetch?: IconFetch): Observable<PageOf<StaticIcon>> {\n const now = Date.now()\n const results = new Observable<PageOf<StaticIcon>>(observer => {\n const icons: StaticIcon[] = []\n let remaining = 100\n while (remaining--) {\n const id = now - remaining\n icons.unshift({\n id: String(id),\n title: `Icon ${id}`,\n fileName: `icon-${id}.png`,\n sourceUrl: `https://test.mage/${id}.png`,\n contentPath: `/icons/${id}/content`\n })\n }\n setTimeout(() => {\n observer.next({\n pageSize: 100,\n pageIndex: 0,\n totalCount: 100,\n items: icons\n })\n observer.complete()\n }, 0)\n return {\n unsubscribe() { }\n }\n })\n return results\n }\n\n fetchIconById(id: string): Observable<StaticIcon | null> {\n return this.webClient.get<StaticIcon>(`/api/icons/${id}`).pipe(\n catchError((err, caught) => {\n // TODO: this is probably better practice to insulate app layer from\n // http errors\n // if (err instanceof HttpErrorResponse) {\n // if (err.status === 404) {\n // return null\n // }\n // }\n return throwError(err)\n })\n )\n }\n\n fetchIconBySourceUrl(url: string): Observable<StaticIcon> {\n return this.webClient.get<StaticIcon | null>(`/api/icons`, {\n params: new HttpParams().set('source_url', url)\n })\n }\n\n fetchIconByReference(ref: StaticIconReference): Observable<StaticIcon | null> {\n if (ref.id) {\n return this.fetchIconById(ref.id)\n }\n else if (ref.sourceUrl) {\n return this.fetchIconBySourceUrl(ref.sourceUrl)\n }\n throw new Error('no icon id or source url')\n }\n\n registerIconUrl(url: string): Observable<StaticIcon> {\n throw new Error('unimplemented')\n }\n\n uploadIcon(): void {\n throw new Error('unimplemented')\n }\n}\n","import { HttpClient } from '@angular/common/http'\nimport { Component, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator, Validators } from '@angular/forms'\nimport { DomSanitizer } from '@angular/platform-browser'\nimport { StaticIcon, StaticIconReference } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\n\n@Component({\n selector: 'mage-static-icon-form-field',\n templateUrl: './static-icon-form-field.component.html',\n styleUrls: ['./static-icon-form-field.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n ]\n})\nexport class StaticIconFormFieldComponent implements OnChanges, OnDestroy, ControlValueAccessor, Validator {\n\n iconRef: StaticIconReference = null\n\n form: FormGroup = new FormGroup({\n iconRefToken: new FormControl(null),\n iconRefType: new FormControl(null, Validators.required)\n })\n icon: StaticIcon | null\n\n private onChange: (iconRef: StaticIconReference) => void = (iconRef: StaticIconReference) => {}\n private onValidatorChange: () => void = () => {}\n private onTouched: () => void = () => {}\n\n constructor(private iconService: StaticIconService, private httpClient: HttpClient, private sanitizer: DomSanitizer) {\n this.form.valueChanges.subscribe((x: IconRefFormValue) => {\n this.iconRef = iconRefForFormValue(x)\n this.onChange(this.iconRef)\n })\n }\n\n registerOnValidatorChange?(fn: () => void): void {\n this.onValidatorChange = fn\n }\n\n ngOnChanges(changes: SimpleChanges) { }\n\n ngOnDestroy() { }\n\n onSelectIcon() { }\n\n writeValue(iconRef: StaticIconReference): void {\n this.iconRef = iconRef\n const formValue = formValueForIconRef(iconRef)\n this.form.setValue(formValue, { emitEvent: false })\n this.resolveIconRef()\n }\n\n registerOnChange(fn: (x: StaticIconReference | null) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n if (isDisabled) {\n this.form.disable()\n }\n else {\n this.form.enable()\n }\n }\n\n validate(control: AbstractControl): ValidationErrors {\n return this.form.errors\n }\n\n private resolveIconRef() {\n if (!this.iconRef) {\n this.icon = null\n return\n }\n this.iconService.fetchIconByReference(this.iconRef).subscribe(x => {\n this.icon = x\n if (!this.icon) {\n return\n }\n })\n }\n}\n\nenum IconRefType {\n Registered = 'id',\n SourceUrl = 'sourceUrl'\n}\n\ntype IconRefFormValue = {\n iconRefToken: string | null\n iconRefType: IconRefType | null\n}\n\nfunction iconRefForFormValue(x: IconRefFormValue): StaticIconReference | null {\n if (!x.iconRefType) {\n return null\n }\n switch (x.iconRefType) {\n case IconRefType.Registered:\n return { [IconRefType.Registered]: x.iconRefToken }\n case IconRefType.SourceUrl:\n return { [IconRefType.SourceUrl]: x.iconRefToken }\n default:\n throw new Error('invalid icon ref type: ' + x.iconRefToken)\n }\n}\n\nfunction formValueForIconRef(x: StaticIconReference | null): IconRefFormValue {\n if (!x) {\n return {\n iconRefType: null,\n iconRefToken: null\n }\n }\n let iconRefType: IconRefType | null = null\n let iconRefToken: string | null = null\n if (x.hasOwnProperty(IconRefType.Registered)) {\n iconRefType = IconRefType.Registered || null\n iconRefToken = x[IconRefType.Registered] || null\n }\n else if (x.hasOwnProperty(IconRefType.SourceUrl)) {\n iconRefType = IconRefType.SourceUrl || null\n iconRefToken = x[IconRefType.SourceUrl] || null\n }\n return {\n iconRefType,\n iconRefToken\n }\n}\n","<div [formGroup]=\"form\">\n <mage-xhr-img class=\"icon-image\" [src]=\"icon?.contentPath\"></mage-xhr-img>\n <input type=\"hidden\" formControlName=\"iconRefType\"/>\n <input type=\"hidden\" formControlName=\"iconRefToken\"/>\n</div>","import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { RegisteredStaticIconReference, contentPathOfIcon } from '../static-icon.model'\n\n@Component({\n selector: 'mage-static-icon-img',\n template: `<mage-xhr-img [src]=\"iconPath\"></mage-xhr-img>`,\n})\nexport class StaticIconImgComponent implements OnInit, OnChanges {\n\n @Input()\n iconRef: RegisteredStaticIconReference | string | null\n iconPath: string | null\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.iconRef) {\n if (this.iconRef) {\n this.iconPath = contentPathOfIcon(this.iconRef)\n }\n else {\n this.iconPath = null\n }\n }\n }\n}\n","<div class=\"icon-select\">\n <cdk-virtual-scroll-viewport [itemSize]=\"40\">\n <mat-card *cdkVirtualFor=\"let icon of icons\" class=icon-select-item>\n <mat-card-header>\n <mat-card-title>{{icon.title}}</mat-card-title>\n </mat-card-header>\n <img mat-card-img [src]=\"icon.path\" />\n </mat-card>\n </cdk-virtual-scroll-viewport>\n</div>\n<!--\n <button mat-button class=\"add__button\" type=\"button\" color=\"primary\" (click)=\"file.click()\">\n Upload Icon\n </button>\n <input [hidden]=\"true\" type=\"file\" #file multiple (change)=\"onAttachmentFile($event)\">\n-->","import { Component, OnInit } from '@angular/core'\nimport { PagingParameters, PagingDataSource } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\nexport interface StaticIconSelectItem {\n id: string\n path: string\n title: string\n fileName: string\n}\n\n@Component({\n selector: 'static-icon-select',\n templateUrl: './static-icon-select.component.html',\n styleUrls: ['./static-icon-select.component.scss']\n})\nexport class StaticIconSelectComponent implements OnInit {\n\n icons: StaticIcon[] | null = null\n dataSource: PagingDataSource<StaticIcon>\n\n constructor(\n private iconService: StaticIconService\n ) {\n this.dataSource = new PagingDataSource<StaticIcon>(250, (paging: PagingParameters) => {\n return this.iconService.fetchIcons(paging)\n })\n }\n\n ngOnInit() {\n this.iconService.fetchIcons().subscribe(x => {\n this.icons = x.items\n })\n }\n\n onBrowseForUploadIcon() {\n throw new Error('unimplemented')\n }\n}\n\n","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatCardModule } from '@angular/material/card'\nimport { MageCommonModule } from '@ngageoint/mage.web-core-lib/common'\nimport { StaticIconFormFieldComponent } from './static-icon-form-field/static-icon-form-field.component'\nimport { StaticIconImgComponent } from './static-icon-img/static-icon-img.component'\nimport { StaticIconSelectComponent } from './static-icon-select/static-icon-select.component'\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatCardModule,\n MageCommonModule,\n ScrollingModule\n ],\n declarations: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ],\n exports: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ]\n})\nexport class StaticIconModule {}"],"names":["Observable","catchError","throwError","HttpParams","Injectable","FormGroup","FormControl","Validators","NG_VALUE_ACCESSOR","NG_VALIDATORS","i0.ɵɵelementStart","i0.ɵɵelement","i0.ɵɵelementEnd","i0.ɵɵproperty","i0.ɵɵadvance","Component","Input","i0.ɵɵtext","i0.ɵɵtextInterpolate","PagingDataSource","i0.ɵɵtemplate","CommonModule","FormsModule","ReactiveFormsModule","MatCardModule","MageCommonModule","ScrollingModule","NgModule"],"mappings":";;;;;;QAqBa,iBAAiB,GAAG,UAAC,IAA6E;QAC7G,IAAI,CAAC,IAAI,EAAE;YACT,OAAM;SACP;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAA;SACf;QACD,OAAO,gBAAc,IAAI,aAAU,CAAA;IACrC;;;QCZE,2BAAoB,SAAqB;YAArB,cAAS,GAAT,SAAS,CAAY;SAAK;QAE9C,sCAAU,GAAV,UAAW,KAAiB;YAC1B,IAAM,GAAG,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oBgC;8DAAnB,gBAAgB;yHAAhB,gBAAgB,kBAnBlB;oBACPM,mBAAY;oBACZC,iBAAW;oBACXC,yBAAmB;oBACnBC,kBAAa;oBACbC,yBAAgB;oBAChBC,yBAAe;iBAChB;+BAnBH;KAWA,IAoBgC;8FAAnB,gBAAgB,mBAVzB,4BAA4B;YAC5B,sBAAsB;YACtB,yBAAyB,aAVzBL,mBAAY;YACZC,iBAAW;YACXC,yBAAmB;YACnBC,kBAAa;YACbC,yBAAgB;YAChBC,yBAAe,aAQf,4BAA4B;YAC5B,sBAAsB;YACtB,yBAAyB;wDAGhB,gBAAgB;kBApB5BC,aAAQ;mBAAC;oBACR,OAAO,EAAE;wBACPN,mBAAY;wBACZC,iBAAW;wBACXC,yBAAmB;wBACnBC,kBAAa;wBACbC,yBAAgB;wBAChBC,yBAAe;qBAChB;oBACD,YAAY,EAAE;wBACZ,4BAA4B;wBAC5B,sBAAsB;wBACtB,yBAAyB;qBAC1B;oBACD,OAAO,EAAE;wBACP,4BAA4B;wBAC5B,sBAAsB;wBACtB,yBAAyB;qBAC1B;iBACF;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/cdk/scrolling"),require("@angular/common"),require("@angular/core"),require("@angular/forms"),require("@angular/material/card"),require("@ngageoint/mage.web-core-lib/common"),require("@angular/common/http"),require("rxjs"),require("rxjs/operators"),require("@angular/platform-browser"),require("@ngageoint/mage.web-core-lib/paging")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/static-icon",["exports","@angular/cdk/scrolling","@angular/common","@angular/core","@angular/forms","@angular/material/card","@ngageoint/mage.web-core-lib/common","@angular/common/http","rxjs","rxjs/operators","@angular/platform-browser","@ngageoint/mage.web-core-lib/paging"],n):n(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"]["static-icon"]={}),e.ng.cdk.scrolling,e.ng.common,e.ng.core,e.ng.forms,e.ng.material.card,e.ngageoint.mage["web-core-lib"].common,e.ng.common.http,e.rxjs,e.rxjs.operators,e.ng.platformBrowser,e.ngageoint.mage["web-core-lib"].paging)}(this,(function(e,n,t,o,r,i,c,a,u,l,s,f){"use strict";var m,p=function(e){if(e)return"string"!=typeof e&&(e=e.id),"/api/icons/"+e+"/content"},g=function(){function e(e){this.http=e}return e.prototype.fetchIcons=function(e){var n=Date.now();return new u.Observable((function(e){for(var t=[],o=100;o--;){var r=n-o;t.unshift({id:String(r),title:"Icon "+r,fileName:"icon-"+r+".png",sourceUrl:"https://test.mage/"+r+".png",contentPath:"/icons/"+r+"/content"})}return setTimeout((function(){e.next({pageSize:100,pageIndex:0,totalCount:100,items:t}),e.complete()}),0),{unsubscribe:function(){}}}))},e.prototype.fetchIconById=function(e){return this.http.get("/api/icons/"+e).pipe(l.catchError((function(e,n){return u.throwError(e)})))},e.prototype.fetchIconBySourceUrl=function(e){return this.http.get("/api/icons",{params:(new a.HttpParams).set("source_url",e)})},e.prototype.fetchIconByReference=function(e){if(e.id)return this.fetchIconById(e.id);if(e.sourceUrl)return this.fetchIconBySourceUrl(e.sourceUrl);throw new Error("no icon id or source url")},e.prototype.registerIconUrl=function(e){throw new Error("unimplemented")},e.prototype.uploadIcon=function(){throw new Error("unimplemented")},e.ɵfac=function(n){return new(n||e)(o.ɵɵinject(a.HttpClient))},e.ɵprov=o.ɵɵdefineInjectable({token:e,factory:e.ɵfac,providedIn:"root"}),e}(),d=function(){function e(e,n,t){var o=this;this.iconService=e,this.httpClient=n,this.sanitizer=t,this.iconRef=null,this.form=new r.FormGroup({iconRefToken:new r.FormControl(null),iconRefType:new r.FormControl(null,r.Validators.required)}),this.onChange=function(e){},this.onValidatorChange=function(){},this.onTouched=function(){},this.form.valueChanges.subscribe((function(e){o.iconRef=function(e){var n,t;if(!e.iconRefType)return null;switch(e.iconRefType){case m.Registered:return(n={})[m.Registered]=e.iconRefToken,n;case m.SourceUrl:return(t={})[m.SourceUrl]=e.iconRefToken,t;default:throw new Error("invalid icon ref type: "+e.iconRefToken)}}(e),o.onChange(o.iconRef)}))}return e.prototype.registerOnValidatorChange=function(e){this.onValidatorChange=e},e.prototype.ngOnChanges=function(e){},e.prototype.ngOnDestroy=function(){},e.prototype.onSelectIcon=function(){},e.prototype.writeValue=function(e){this.iconRef=e;var n=function(e){if(!e)return{iconRefType:null,iconRefToken:null};var n=null,t=null;e.hasOwnProperty(m.Registered)?(n=m.Registered||null,t=e[m.Registered]||null):e.hasOwnProperty(m.SourceUrl)&&(n=m.SourceUrl||null,t=e[m.SourceUrl]||null);return{iconRefType:n,iconRefToken:t}}(e);this.form.setValue(n,{emitEvent:!1}),this.resolveIconRef()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){e?this.form.disable():this.form.enable()},e.prototype.validate=function(e){return this.form.errors},e.prototype.resolveIconRef=function(){var e=this;this.iconRef?this.iconService.fetchIconByReference(this.iconRef).subscribe((function(n){e.icon=n,e.icon})):this.icon=null},e.ɵfac=function(n){return new(n||e)(o.ɵɵdirectiveInject(g),o.ɵɵdirectiveInject(a.HttpClient),o.ɵɵdirectiveInject(s.DomSanitizer))},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["mage-static-icon-form-field"]],features:[o.ɵɵProvidersFeature([{provide:r.NG_VALUE_ACCESSOR,multi:!0,useExisting:e},{provide:r.NG_VALIDATORS,multi:!0,useExisting:e}]),o.ɵɵNgOnChangesFeature],decls:4,vars:2,consts:[[3,"formGroup"],[1,"icon-image",3,"src"],["type","hidden","formControlName","iconRefType"],["type","hidden","formControlName","iconRefToken"]],template:function(e,n){1&e&&(o.ɵɵelementStart(0,"div",0),o.ɵɵelement(1,"mage-xhr-img",1),o.ɵɵelement(2,"input",2),o.ɵɵelement(3,"input",3),o.ɵɵelementEnd()),2&e&&(o.ɵɵproperty("formGroup",n.form),o.ɵɵadvance(1),o.ɵɵproperty("src",null==n.icon?null:n.icon.contentPath))},directives:[r.NgControlStatusGroup,r.FormGroupDirective,c.XhrImgComponent,r.DefaultValueAccessor,r.NgControlStatus,r.FormControlName],styles:[".icon-image[_ngcontent-%COMP%]{display:block;height:3em;width:3em}"]}),e}();!function(e){e.Registered="id",e.SourceUrl="sourceUrl"}(m||(m={}));var h=function(){function e(){}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(e){e.iconRef&&(this.iconRef?this.iconPath=p(this.iconRef):this.iconPath=null)},e.ɵfac=function(n){return new(n||e)},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["mage-static-icon-img"]],inputs:{iconRef:"iconRef"},features:[o.ɵɵNgOnChangesFeature],decls:1,vars:1,consts:[[3,"src"]],template:function(e,n){1&e&&o.ɵɵelement(0,"mage-xhr-img",0),2&e&&o.ɵɵproperty("src",n.iconPath)},directives:[c.XhrImgComponent],encapsulation:2}),e}();function y(e,n){if(1&e&&(o.ɵɵelementStart(0,"mat-card",3),o.ɵɵelementStart(1,"mat-card-header"),o.ɵɵelementStart(2,"mat-card-title"),o.ɵɵtext(3),o.ɵɵelementEnd(),o.ɵɵelementEnd(),o.ɵɵelement(4,"img",4),o.ɵɵelementEnd()),2&e){var t=n.$implicit;o.ɵɵadvance(3),o.ɵɵtextInterpolate(t.title),o.ɵɵadvance(1),o.ɵɵproperty("src",t.path,o.ɵɵsanitizeUrl)}}var v=function(){function e(e){var n=this;this.iconService=e,this.icons=null,this.dataSource=new f.PagingDataSource(250,(function(e){return n.iconService.fetchIcons(e)}))}return e.prototype.ngOnInit=function(){var e=this;this.iconService.fetchIcons().subscribe((function(n){e.icons=n.items}))},e.prototype.onBrowseForUploadIcon=function(){throw new Error("unimplemented")},e.ɵfac=function(n){return new(n||e)(o.ɵɵdirectiveInject(g))},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["static-icon-select"]],decls:3,vars:2,consts:[[1,"icon-select"],[3,"itemSize"],["class","icon-select-item",4,"cdkVirtualFor","cdkVirtualForOf"],[1,"icon-select-item"],["mat-card-img","",3,"src"]],template:function(e,n){1&e&&(o.ɵɵelementStart(0,"div",0),o.ɵɵelementStart(1,"cdk-virtual-scroll-viewport",1),o.ɵɵtemplate(2,y,5,2,"mat-card",2),o.ɵɵelementEnd(),o.ɵɵelementEnd()),2&e&&(o.ɵɵadvance(1),o.ɵɵproperty("itemSize",40),o.ɵɵadvance(1),o.ɵɵproperty("cdkVirtualForOf",n.icons))},directives:[n.CdkVirtualScrollViewport,n.CdkFixedSizeVirtualScroll,n.CdkVirtualForOf,i.MatCard,i.MatCardHeader,i.MatCardTitle],styles:["virtual-scroll[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,33%);grid-auto-rows:min-content;grid-gap:0;justify-content:center;gap:0}"]}),e}(),C=function(){function e(){}return e.ɵmod=o.ɵɵdefineNgModule({type:e}),e.ɵinj=o.ɵɵdefineInjector({factory:function(n){return new(n||e)},imports:[[t.CommonModule,r.FormsModule,r.ReactiveFormsModule,i.MatCardModule,c.MageCommonModule,n.ScrollingModule]]}),e}();("undefined"==typeof ngJitMode||ngJitMode)&&o.ɵɵsetNgModuleScope(C,{declarations:[d,h,v],imports:[t.CommonModule,r.FormsModule,r.ReactiveFormsModule,i.MatCardModule,c.MageCommonModule,n.ScrollingModule],exports:[d,h,v]}),e.StaticIconFormFieldComponent=d,e.StaticIconImgComponent=h,e.StaticIconModule=C,e.StaticIconSelectComponent=v,e.StaticIconService=g,e.contentPathOfIcon=p,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/cdk/scrolling"),require("@angular/common"),require("@angular/core"),require("@angular/forms"),require("@angular/material/card"),require("@ngageoint/mage.web-core-lib/common"),require("@angular/common/http"),require("rxjs"),require("rxjs/operators"),require("@angular/platform-browser"),require("@ngageoint/mage.web-core-lib/paging")):"function"==typeof define&&define.amd?define("@ngageoint/mage.web-core-lib/static-icon",["exports","@angular/cdk/scrolling","@angular/common","@angular/core","@angular/forms","@angular/material/card","@ngageoint/mage.web-core-lib/common","@angular/common/http","rxjs","rxjs/operators","@angular/platform-browser","@ngageoint/mage.web-core-lib/paging"],n):n(((e=e||self).ngageoint=e.ngageoint||{},e.ngageoint.mage=e.ngageoint.mage||{},e.ngageoint.mage["web-core-lib"]=e.ngageoint.mage["web-core-lib"]||{},e.ngageoint.mage["web-core-lib"]["static-icon"]={}),e.ng.cdk.scrolling,e.ng.common,e.ng.core,e.ng.forms,e.ng.material.card,e.ngageoint.mage["web-core-lib"].common,e.ng.common.http,e.rxjs,e.rxjs.operators,e.ng.platformBrowser,e.ngageoint.mage["web-core-lib"].paging)}(this,(function(e,n,t,o,r,i,c,a,l,u,s,f){"use strict";var m,p=function(e){if(e)return"string"!=typeof e&&(e=e.id),"/api/icons/"+e+"/content"},g=function(){function e(e){this.webClient=e}return e.prototype.fetchIcons=function(e){var n=Date.now();return new l.Observable((function(e){for(var t=[],o=100;o--;){var r=n-o;t.unshift({id:String(r),title:"Icon "+r,fileName:"icon-"+r+".png",sourceUrl:"https://test.mage/"+r+".png",contentPath:"/icons/"+r+"/content"})}return setTimeout((function(){e.next({pageSize:100,pageIndex:0,totalCount:100,items:t}),e.complete()}),0),{unsubscribe:function(){}}}))},e.prototype.fetchIconById=function(e){return this.webClient.get("/api/icons/"+e).pipe(u.catchError((function(e,n){return l.throwError(e)})))},e.prototype.fetchIconBySourceUrl=function(e){return this.webClient.get("/api/icons",{params:(new a.HttpParams).set("source_url",e)})},e.prototype.fetchIconByReference=function(e){if(e.id)return this.fetchIconById(e.id);if(e.sourceUrl)return this.fetchIconBySourceUrl(e.sourceUrl);throw new Error("no icon id or source url")},e.prototype.registerIconUrl=function(e){throw new Error("unimplemented")},e.prototype.uploadIcon=function(){throw new Error("unimplemented")},e.ɵfac=function(n){return new(n||e)(o.ɵɵinject(a.HttpClient))},e.ɵprov=o.ɵɵdefineInjectable({token:e,factory:e.ɵfac,providedIn:"root"}),e}(),d=function(){function e(e,n,t){var o=this;this.iconService=e,this.httpClient=n,this.sanitizer=t,this.iconRef=null,this.form=new r.FormGroup({iconRefToken:new r.FormControl(null),iconRefType:new r.FormControl(null,r.Validators.required)}),this.onChange=function(e){},this.onValidatorChange=function(){},this.onTouched=function(){},this.form.valueChanges.subscribe((function(e){o.iconRef=function(e){var n,t;if(!e.iconRefType)return null;switch(e.iconRefType){case m.Registered:return(n={})[m.Registered]=e.iconRefToken,n;case m.SourceUrl:return(t={})[m.SourceUrl]=e.iconRefToken,t;default:throw new Error("invalid icon ref type: "+e.iconRefToken)}}(e),o.onChange(o.iconRef)}))}return e.prototype.registerOnValidatorChange=function(e){this.onValidatorChange=e},e.prototype.ngOnChanges=function(e){},e.prototype.ngOnDestroy=function(){},e.prototype.onSelectIcon=function(){},e.prototype.writeValue=function(e){this.iconRef=e;var n=function(e){if(!e)return{iconRefType:null,iconRefToken:null};var n=null,t=null;e.hasOwnProperty(m.Registered)?(n=m.Registered||null,t=e[m.Registered]||null):e.hasOwnProperty(m.SourceUrl)&&(n=m.SourceUrl||null,t=e[m.SourceUrl]||null);return{iconRefType:n,iconRefToken:t}}(e);this.form.setValue(n,{emitEvent:!1}),this.resolveIconRef()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){e?this.form.disable():this.form.enable()},e.prototype.validate=function(e){return this.form.errors},e.prototype.resolveIconRef=function(){var e=this;this.iconRef?this.iconService.fetchIconByReference(this.iconRef).subscribe((function(n){e.icon=n,e.icon})):this.icon=null},e.ɵfac=function(n){return new(n||e)(o.ɵɵdirectiveInject(g),o.ɵɵdirectiveInject(a.HttpClient),o.ɵɵdirectiveInject(s.DomSanitizer))},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["mage-static-icon-form-field"]],features:[o.ɵɵProvidersFeature([{provide:r.NG_VALUE_ACCESSOR,multi:!0,useExisting:e},{provide:r.NG_VALIDATORS,multi:!0,useExisting:e}]),o.ɵɵNgOnChangesFeature],decls:4,vars:2,consts:[[3,"formGroup"],[1,"icon-image",3,"src"],["type","hidden","formControlName","iconRefType"],["type","hidden","formControlName","iconRefToken"]],template:function(e,n){1&e&&(o.ɵɵelementStart(0,"div",0),o.ɵɵelement(1,"mage-xhr-img",1),o.ɵɵelement(2,"input",2),o.ɵɵelement(3,"input",3),o.ɵɵelementEnd()),2&e&&(o.ɵɵproperty("formGroup",n.form),o.ɵɵadvance(1),o.ɵɵproperty("src",null==n.icon?null:n.icon.contentPath))},directives:[r.NgControlStatusGroup,r.FormGroupDirective,c.XhrImgComponent,r.DefaultValueAccessor,r.NgControlStatus,r.FormControlName],styles:[".icon-image[_ngcontent-%COMP%]{display:block;height:3em;width:3em}"]}),e}();!function(e){e.Registered="id",e.SourceUrl="sourceUrl"}(m||(m={}));var h=function(){function e(){}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(e){e.iconRef&&(this.iconRef?this.iconPath=p(this.iconRef):this.iconPath=null)},e.ɵfac=function(n){return new(n||e)},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["mage-static-icon-img"]],inputs:{iconRef:"iconRef"},features:[o.ɵɵNgOnChangesFeature],decls:1,vars:1,consts:[[3,"src"]],template:function(e,n){1&e&&o.ɵɵelement(0,"mage-xhr-img",0),2&e&&o.ɵɵproperty("src",n.iconPath)},directives:[c.XhrImgComponent],encapsulation:2}),e}();function y(e,n){if(1&e&&(o.ɵɵelementStart(0,"mat-card",3),o.ɵɵelementStart(1,"mat-card-header"),o.ɵɵelementStart(2,"mat-card-title"),o.ɵɵtext(3),o.ɵɵelementEnd(),o.ɵɵelementEnd(),o.ɵɵelement(4,"img",4),o.ɵɵelementEnd()),2&e){var t=n.$implicit;o.ɵɵadvance(3),o.ɵɵtextInterpolate(t.title),o.ɵɵadvance(1),o.ɵɵproperty("src",t.path,o.ɵɵsanitizeUrl)}}var v=function(){function e(e){var n=this;this.iconService=e,this.icons=null,this.dataSource=new f.PagingDataSource(250,(function(e){return n.iconService.fetchIcons(e)}))}return e.prototype.ngOnInit=function(){var e=this;this.iconService.fetchIcons().subscribe((function(n){e.icons=n.items}))},e.prototype.onBrowseForUploadIcon=function(){throw new Error("unimplemented")},e.ɵfac=function(n){return new(n||e)(o.ɵɵdirectiveInject(g))},e.ɵcmp=o.ɵɵdefineComponent({type:e,selectors:[["static-icon-select"]],decls:3,vars:2,consts:[[1,"icon-select"],[3,"itemSize"],["class","icon-select-item",4,"cdkVirtualFor","cdkVirtualForOf"],[1,"icon-select-item"],["mat-card-img","",3,"src"]],template:function(e,n){1&e&&(o.ɵɵelementStart(0,"div",0),o.ɵɵelementStart(1,"cdk-virtual-scroll-viewport",1),o.ɵɵtemplate(2,y,5,2,"mat-card",2),o.ɵɵelementEnd(),o.ɵɵelementEnd()),2&e&&(o.ɵɵadvance(1),o.ɵɵproperty("itemSize",40),o.ɵɵadvance(1),o.ɵɵproperty("cdkVirtualForOf",n.icons))},directives:[n.CdkVirtualScrollViewport,n.CdkFixedSizeVirtualScroll,n.CdkVirtualForOf,i.MatCard,i.MatCardHeader,i.MatCardTitle],styles:["virtual-scroll[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,33%);grid-auto-rows:min-content;grid-gap:0;justify-content:center;gap:0}"]}),e}(),C=function(){function e(){}return e.ɵmod=o.ɵɵdefineNgModule({type:e}),e.ɵinj=o.ɵɵdefineInjector({factory:function(n){return new(n||e)},imports:[[t.CommonModule,r.FormsModule,r.ReactiveFormsModule,i.MatCardModule,c.MageCommonModule,n.ScrollingModule]]}),e}();("undefined"==typeof ngJitMode||ngJitMode)&&o.ɵɵsetNgModuleScope(C,{declarations:[d,h,v],imports:[t.CommonModule,r.FormsModule,r.ReactiveFormsModule,i.MatCardModule,c.MageCommonModule,n.ScrollingModule],exports:[d,h,v]}),e.StaticIconFormFieldComponent=d,e.StaticIconImgComponent=h,e.StaticIconModule=C,e.StaticIconSelectComponent=v,e.StaticIconService=g,e.contentPathOfIcon=p,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=ngageoint-mage.web-core-lib-static-icon.umd.min.js.map