@ngageoint/mage.web-core-lib 6.3.0-beta.0

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 (142) hide show
  1. package/README.md +24 -0
  2. package/common/index.d.ts +6 -0
  3. package/common/mage-common.module.d.ts +9 -0
  4. package/common/mage-common.module.d.ts.map +1 -0
  5. package/common/ngageoint-mage.web-core-lib-common.d.ts.map +1 -0
  6. package/common/public-api.d.ts +3 -0
  7. package/common/public-api.d.ts.map +1 -0
  8. package/common/xhr-img.component.d.ts +59 -0
  9. package/common/xhr-img.component.d.ts.map +1 -0
  10. package/esm2020/common/mage-common.module.mjs +25 -0
  11. package/esm2020/common/ngageoint-mage.web-core-lib-common.mjs +5 -0
  12. package/esm2020/common/public-api.mjs +3 -0
  13. package/esm2020/common/xhr-img.component.mjs +104 -0
  14. package/esm2020/event/event-read.service.mjs +3 -0
  15. package/esm2020/event/event.model.mjs +2 -0
  16. package/esm2020/event/ngageoint-mage.web-core-lib-event.mjs +5 -0
  17. package/esm2020/event/public-api.mjs +3 -0
  18. package/esm2020/feed/feed.model.mjs +2 -0
  19. package/esm2020/feed/feed.service.mjs +105 -0
  20. package/esm2020/feed/ngageoint-mage.web-core-lib-feed.mjs +5 -0
  21. package/esm2020/feed/public-api.mjs +3 -0
  22. package/esm2020/mage-core-lib.module.mjs +19 -0
  23. package/esm2020/ngageoint-mage.web-core-lib.mjs +5 -0
  24. package/esm2020/paging/ngageoint-mage.web-core-lib-paging.mjs +5 -0
  25. package/esm2020/paging/paging.cdk-data-source.adapter.mjs +52 -0
  26. package/esm2020/paging/paging.model.mjs +25 -0
  27. package/esm2020/paging/public-api.mjs +3 -0
  28. package/esm2020/plugin/ngageoint-mage.web-core-lib-plugin.mjs +5 -0
  29. package/esm2020/plugin/plugin.model.mjs +2 -0
  30. package/esm2020/plugin/public-api.mjs +2 -0
  31. package/esm2020/public-api.mjs +5 -0
  32. package/esm2020/static-icon/ngageoint-mage.web-core-lib-static-icon.mjs +5 -0
  33. package/esm2020/static-icon/public-api.mjs +7 -0
  34. package/esm2020/static-icon/static-icon-form-field/static-icon-form-field.component.mjs +145 -0
  35. package/esm2020/static-icon/static-icon-img/static-icon-img.component.mjs +35 -0
  36. package/esm2020/static-icon/static-icon-select/static-icon-select.component.mjs +52 -0
  37. package/esm2020/static-icon/static-icon.model.mjs +10 -0
  38. package/esm2020/static-icon/static-icon.module.mjs +54 -0
  39. package/esm2020/static-icon/static-icon.service.mjs +82 -0
  40. package/esm2020/user/ngageoint-mage.web-core-lib-user.mjs +5 -0
  41. package/esm2020/user/public-api.mjs +5 -0
  42. package/esm2020/user/user-read.service.mjs +40 -0
  43. package/esm2020/user/user-select/user-select.component.mjs +159 -0
  44. package/esm2020/user/user.model.mjs +2 -0
  45. package/esm2020/user/user.module.mjs +64 -0
  46. package/event/event-read.service.d.ts +12 -0
  47. package/event/event-read.service.d.ts.map +1 -0
  48. package/event/event.model.d.ts +7 -0
  49. package/event/event.model.d.ts.map +1 -0
  50. package/event/index.d.ts +6 -0
  51. package/event/ngageoint-mage.web-core-lib-event.d.ts.map +1 -0
  52. package/event/public-api.d.ts +3 -0
  53. package/event/public-api.d.ts.map +1 -0
  54. package/feed/feed.model.d.ts +84 -0
  55. package/feed/feed.model.d.ts.map +1 -0
  56. package/feed/feed.service.d.ts +41 -0
  57. package/feed/feed.service.d.ts.map +1 -0
  58. package/feed/index.d.ts +6 -0
  59. package/feed/ngageoint-mage.web-core-lib-feed.d.ts.map +1 -0
  60. package/feed/public-api.d.ts +3 -0
  61. package/feed/public-api.d.ts.map +1 -0
  62. package/fesm2015/ngageoint-mage.web-core-lib-common.mjs +142 -0
  63. package/fesm2015/ngageoint-mage.web-core-lib-common.mjs.map +1 -0
  64. package/fesm2015/ngageoint-mage.web-core-lib-event.mjs +10 -0
  65. package/fesm2015/ngageoint-mage.web-core-lib-event.mjs.map +1 -0
  66. package/fesm2015/ngageoint-mage.web-core-lib-feed.mjs +114 -0
  67. package/fesm2015/ngageoint-mage.web-core-lib-feed.mjs.map +1 -0
  68. package/fesm2015/ngageoint-mage.web-core-lib-paging.mjs +83 -0
  69. package/fesm2015/ngageoint-mage.web-core-lib-paging.mjs.map +1 -0
  70. package/fesm2015/ngageoint-mage.web-core-lib-plugin.mjs +4 -0
  71. package/fesm2015/ngageoint-mage.web-core-lib-plugin.mjs.map +1 -0
  72. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.mjs +392 -0
  73. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.mjs.map +1 -0
  74. package/fesm2015/ngageoint-mage.web-core-lib-user.mjs +279 -0
  75. package/fesm2015/ngageoint-mage.web-core-lib-user.mjs.map +1 -0
  76. package/fesm2015/ngageoint-mage.web-core-lib.mjs +32 -0
  77. package/fesm2015/ngageoint-mage.web-core-lib.mjs.map +1 -0
  78. package/fesm2020/ngageoint-mage.web-core-lib-common.mjs +133 -0
  79. package/fesm2020/ngageoint-mage.web-core-lib-common.mjs.map +1 -0
  80. package/fesm2020/ngageoint-mage.web-core-lib-event.mjs +10 -0
  81. package/fesm2020/ngageoint-mage.web-core-lib-event.mjs.map +1 -0
  82. package/fesm2020/ngageoint-mage.web-core-lib-feed.mjs +112 -0
  83. package/fesm2020/ngageoint-mage.web-core-lib-feed.mjs.map +1 -0
  84. package/fesm2020/ngageoint-mage.web-core-lib-paging.mjs +83 -0
  85. package/fesm2020/ngageoint-mage.web-core-lib-paging.mjs.map +1 -0
  86. package/fesm2020/ngageoint-mage.web-core-lib-plugin.mjs +4 -0
  87. package/fesm2020/ngageoint-mage.web-core-lib-plugin.mjs.map +1 -0
  88. package/fesm2020/ngageoint-mage.web-core-lib-static-icon.mjs +368 -0
  89. package/fesm2020/ngageoint-mage.web-core-lib-static-icon.mjs.map +1 -0
  90. package/fesm2020/ngageoint-mage.web-core-lib-user.mjs +262 -0
  91. package/fesm2020/ngageoint-mage.web-core-lib-user.mjs.map +1 -0
  92. package/fesm2020/ngageoint-mage.web-core-lib.mjs +30 -0
  93. package/fesm2020/ngageoint-mage.web-core-lib.mjs.map +1 -0
  94. package/index.d.ts +6 -0
  95. package/mage-core-lib.module.d.ts +8 -0
  96. package/mage-core-lib.module.d.ts.map +1 -0
  97. package/ngageoint-mage.web-core-lib.d.ts.map +1 -0
  98. package/package.json +102 -0
  99. package/paging/index.d.ts +6 -0
  100. package/paging/ngageoint-mage.web-core-lib-paging.d.ts.map +1 -0
  101. package/paging/paging.cdk-data-source.adapter.d.ts +21 -0
  102. package/paging/paging.cdk-data-source.adapter.d.ts.map +1 -0
  103. package/paging/paging.model.d.ts +28 -0
  104. package/paging/paging.model.d.ts.map +1 -0
  105. package/paging/public-api.d.ts +3 -0
  106. package/paging/public-api.d.ts.map +1 -0
  107. package/plugin/index.d.ts +6 -0
  108. package/plugin/ngageoint-mage.web-core-lib-plugin.d.ts.map +1 -0
  109. package/plugin/plugin.model.d.ts +14 -0
  110. package/plugin/plugin.model.d.ts.map +1 -0
  111. package/plugin/public-api.d.ts +2 -0
  112. package/plugin/public-api.d.ts.map +1 -0
  113. package/public-api.d.ts +2 -0
  114. package/public-api.d.ts.map +1 -0
  115. package/static-icon/index.d.ts +6 -0
  116. package/static-icon/ngageoint-mage.web-core-lib-static-icon.d.ts.map +1 -0
  117. package/static-icon/public-api.d.ts +7 -0
  118. package/static-icon/public-api.d.ts.map +1 -0
  119. package/static-icon/static-icon-form-field/static-icon-form-field.component.d.ts +32 -0
  120. package/static-icon/static-icon-form-field/static-icon-form-field.component.d.ts.map +1 -0
  121. package/static-icon/static-icon-img/static-icon-img.component.d.ts +13 -0
  122. package/static-icon/static-icon-img/static-icon-img.component.d.ts.map +1 -0
  123. package/static-icon/static-icon-select/static-icon-select.component.d.ts +22 -0
  124. package/static-icon/static-icon-select/static-icon-select.component.d.ts.map +1 -0
  125. package/static-icon/static-icon.model.d.ts +20 -0
  126. package/static-icon/static-icon.model.d.ts.map +1 -0
  127. package/static-icon/static-icon.module.d.ts +15 -0
  128. package/static-icon/static-icon.module.d.ts.map +1 -0
  129. package/static-icon/static-icon.service.d.ts +21 -0
  130. package/static-icon/static-icon.service.d.ts.map +1 -0
  131. package/user/index.d.ts +6 -0
  132. package/user/ngageoint-mage.web-core-lib-user.d.ts.map +1 -0
  133. package/user/public-api.d.ts +5 -0
  134. package/user/public-api.d.ts.map +1 -0
  135. package/user/user-read.service.d.ts +25 -0
  136. package/user/user-read.service.d.ts.map +1 -0
  137. package/user/user-select/user-select.component.d.ts +39 -0
  138. package/user/user-select/user-select.component.d.ts.map +1 -0
  139. package/user/user.model.d.ts +86 -0
  140. package/user/user.model.d.ts.map +1 -0
  141. package/user/user.module.d.ts +18 -0
  142. package/user/user.module.d.ts.map +1 -0
@@ -0,0 +1,112 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable } from '@angular/core';
3
+ import { BehaviorSubject, Subject } from 'rxjs';
4
+ import { map } from 'rxjs/operators';
5
+ import * as i1 from '@angular/common/http';
6
+
7
+ class FeedService {
8
+ constructor(http) {
9
+ this.http = http;
10
+ // TODO: there is probably a better solution than maintaining this map here
11
+ this._feeds = new BehaviorSubject([]);
12
+ this.feeds = this._feeds.asObservable();
13
+ this._feedItems = new Map();
14
+ }
15
+ feedItems(feedId) {
16
+ return this._feedItems.get(feedId).asObservable();
17
+ }
18
+ fetchAllFeeds() {
19
+ return this.http.get('/api/feeds/');
20
+ }
21
+ fetchFeed(feedId) {
22
+ return this.http.get(`/api/feeds/${feedId}`);
23
+ }
24
+ fetchService(serviceId) {
25
+ return this.http.get(`/api/feeds/services/${serviceId}`);
26
+ }
27
+ createService(service) {
28
+ return this.http.post(`/api/feeds/services`, service);
29
+ }
30
+ fetchServices() {
31
+ return this.http.get(`/api/feeds/services`);
32
+ }
33
+ fetchServiceFeeds(serviceId) {
34
+ return this.http.get(`/api/feeds/services/${serviceId}/feeds`);
35
+ }
36
+ fetchServiceType(serviceTypeId) {
37
+ return this.http.get(`/api/feeds/service_types/${serviceTypeId}`);
38
+ }
39
+ fetchTopics(serviceId) {
40
+ return this.http.get(`/api/feeds/services/${serviceId}/topics`);
41
+ }
42
+ previewFeed(serviceId, topicId, feedSpec, opts) {
43
+ opts = opts || {};
44
+ const skipContentFetch = opts.skipContentFetch === true;
45
+ return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`, { feed: feedSpec });
46
+ }
47
+ fetchTopic(serviceId, topicId) {
48
+ return this.http.get(`/api/feeds/services/${serviceId}/topics/${topicId}`);
49
+ }
50
+ fetchServiceTypes() {
51
+ return this.http.get(`/api/feeds/service_types`);
52
+ }
53
+ createFeed(serviceId, topicId, feedConfiguration) {
54
+ return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);
55
+ }
56
+ updateFeed(feed) {
57
+ return this.http.put(`/api/feeds/${feed.id}`, feed);
58
+ }
59
+ deleteFeed(feed) {
60
+ return this.http.delete(`/api/feeds/${feed.id}`, { responseType: 'text' });
61
+ }
62
+ deleteService(service) {
63
+ console.log('delete');
64
+ return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });
65
+ }
66
+ fetchFeeds(eventId) {
67
+ const subject = new Subject();
68
+ this.http.get(`/api/events/${eventId}/feeds`).subscribe(feeds => {
69
+ feeds.map(feed => {
70
+ feed.id = feed.id.toString();
71
+ return feed;
72
+ });
73
+ feeds.forEach(feed => {
74
+ let feedItems = this._feedItems.get(feed.id);
75
+ if (!feedItems) {
76
+ feedItems = new BehaviorSubject([]);
77
+ this._feedItems.set(feed.id, feedItems);
78
+ }
79
+ });
80
+ subject.next(feeds);
81
+ this._feeds.next(feeds);
82
+ });
83
+ return subject;
84
+ }
85
+ fetchFeedItems(event, feed) {
86
+ const feedItems = this._feedItems.get(feed.id);
87
+ return this.http.post(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(map(content => {
88
+ const features = content.items.features;
89
+ features.forEach((feature) => {
90
+ feature.id = String(feature.id);
91
+ feature.properties = feature.properties || {};
92
+ });
93
+ feedItems.next(features);
94
+ return content;
95
+ }));
96
+ }
97
+ }
98
+ FeedService.ɵfac = function FeedService_Factory(t) { return new (t || FeedService)(i0.ɵɵinject(i1.HttpClient)); };
99
+ FeedService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FeedService, factory: FeedService.ɵfac, providedIn: 'root' });
100
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FeedService, [{
101
+ type: Injectable,
102
+ args: [{
103
+ providedIn: 'root'
104
+ }]
105
+ }], function () { return [{ type: i1.HttpClient }]; }, null); })();
106
+
107
+ /**
108
+ * Generated bundle index. Do not edit.
109
+ */
110
+
111
+ export { FeedService };
112
+ //# sourceMappingURL=ngageoint-mage.web-core-lib-feed.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-feed.mjs","sources":["../../../projects/core-lib/feed/feed.service.ts","../../../projects/core-lib/feed/ngageoint-mage.web-core-lib-feed.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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAea,WAAW,CAAA;AAEtB,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;;AAG5B,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,eAAe,CAAc,EAAE,CAAC,CAAC;AAC7C,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;AAEpC,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,GAAG,EAA2C,CAAC;KAN/B;AAOzC,IAAA,SAAS,CAAC,MAAc,EAAA;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,C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AAe,YAAA,EAAA,KAAK,CAAC,EAAE,CAAU,OAAA,EAAA,IAAI,CAAC,EAAE,CAAA,QAAA,CAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAC7F,GAAG,CAAC,OAAO,IAAG;AACZ,YAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAA;AACvC,YAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAsB,KAAI;gBAC1C,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;gBAC/B,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAA;AAC/C,aAAC,CAAC,CAAA;AACF,YAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACxB,YAAA,OAAO,OAAO,CAAA;SACf,CAAC,CACH,CAAA;KACF;;sEAlHU,WAAW,EAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,UAAA,CAAA,CAAA,CAAA,EAAA,CAAA;iEAAX,WAAW,EAAA,OAAA,EAAX,WAAW,CAAA,IAAA,EAAA,UAAA,EAFV,MAAM,EAAA,CAAA,CAAA;uFAEP,WAAW,EAAA,CAAA;cAHvB,UAAU;AAAC,QAAA,IAAA,EAAA,CAAA;AACV,gBAAA,UAAU,EAAE,MAAM;AACnB,aAAA,CAAA;;;ACdD;;AAEG;;;;"}
@@ -0,0 +1,83 @@
1
+ import { DataSource } from '@angular/cdk/collections';
2
+ import { BehaviorSubject, Subscription } from 'rxjs';
3
+
4
+ const pageForItemIndex = (itemIndex, pageSize) => {
5
+ if (typeof pageSize === 'object') {
6
+ pageSize = pageSize.pageSize;
7
+ }
8
+ return Math.floor(itemIndex / pageSize);
9
+ };
10
+ /**
11
+ * Return the range of item indexes for the given page and page size. The last
12
+ * end portion of the range is exclusive, so when indexing an array the last
13
+ * item of the page would have position `end - 1`. This allows one to pass the
14
+ * values to `Array.slice()`.
15
+ * @param pageIndex
16
+ * @param pageSize
17
+ * @returns
18
+ */
19
+ const itemRangeOfPage = (pageIndex, pageSize) => {
20
+ if (typeof pageIndex === 'object') {
21
+ pageSize = pageIndex.pageSize;
22
+ pageIndex = pageIndex.pageIndex;
23
+ }
24
+ const start = pageSize * pageIndex;
25
+ const end = start + pageSize;
26
+ return [start, end];
27
+ };
28
+
29
+ /**
30
+ * This class is an adaptation from the [Angular Material Guide](https://v8.material.angular.io/cdk/scrolling/overview), _"Specifying data" example_, also
31
+ * available on [StackBlitz](https://stackblitz.com/angular/mrbkjagnnra?file=src%2Fapp%2Fcdk-virtual-scroll-data-source-example.ts).
32
+ */
33
+ class PagingDataSource extends DataSource {
34
+ constructor(pageSize, fetchPage) {
35
+ super();
36
+ this.pageSize = pageSize;
37
+ this.fetchPage = fetchPage;
38
+ this.data = null;
39
+ this.data$ = new BehaviorSubject([]);
40
+ this.fetchedPages = new Set();
41
+ this.subscription = new Subscription();
42
+ }
43
+ connect(collectionViewer) {
44
+ this.subscription.add(collectionViewer.viewChange.subscribe(range => {
45
+ const startPage = this.pageForItemIndex(range.start);
46
+ const endPage = this.pageForItemIndex(range.end - 1);
47
+ for (let page = startPage; page <= endPage; page++) {
48
+ this.fetch(page);
49
+ }
50
+ }));
51
+ return this.data$;
52
+ }
53
+ disconnect() {
54
+ this.subscription.unsubscribe();
55
+ }
56
+ pageForItemIndex(index) {
57
+ return pageForItemIndex(index, this.pageSize);
58
+ }
59
+ fetch(pageIndex) {
60
+ if (this.fetchedPages.has(pageIndex)) {
61
+ return;
62
+ }
63
+ this.fetchedPages.add(pageIndex);
64
+ const includeTotalCount = !this.data;
65
+ this.fetchPage({ pageSize: this.pageSize, pageIndex: pageIndex, includeTotalCount }).subscribe(page => {
66
+ if (!this.data) {
67
+ if (typeof (page.totalCount) !== 'number') {
68
+ throw new Error('data is null and no total count is available to inform allocation');
69
+ }
70
+ this.data = Array.from({ length: page.totalCount });
71
+ }
72
+ this.data.splice(pageIndex * this.pageSize, this.pageSize, ...page.items);
73
+ this.data$.next(this.data);
74
+ });
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Generated bundle index. Do not edit.
80
+ */
81
+
82
+ export { PagingDataSource, itemRangeOfPage, pageForItemIndex };
83
+ //# sourceMappingURL=ngageoint-mage.web-core-lib-paging.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-paging.mjs","sources":["../../../projects/core-lib/paging/paging.model.ts","../../../projects/core-lib/paging/paging.cdk-data-source.adapter.ts","../../../projects/core-lib/paging/ngageoint-mage.web-core-lib-paging.ts"],"sourcesContent":["\nexport interface PagingParameters {\n pageSize: number,\n pageIndex: number,\n includeTotalCount?: boolean | null\n}\n\nexport interface PageOf<T> {\n pageSize: number,\n pageIndex: number,\n totalCount?: number | null,\n next?: PagingParameters | null\n prev?: PagingParameters | null\n items: T[]\n}\n\nexport const pageForItemIndex = (itemIndex: number, pageSize: number | PagingParameters): number => {\n if (typeof pageSize === 'object') {\n pageSize = pageSize.pageSize\n }\n return Math.floor(itemIndex / pageSize)\n}\n\n/**\n * Return the range of item indexes for the given page and page size. The last\n * end portion of the range is exclusive, so when indexing an array the last\n * item of the page would have position `end - 1`. This allows one to pass the\n * values to `Array.slice()`.\n * @param pageIndex\n * @param pageSize\n * @returns\n */\nexport const itemRangeOfPage: {\n (pageIndex: number, pageSize: number): [ number, number ]\n (paging: PagingParameters)\n} = (pageIndex: number | PagingParameters, pageSize?: number): [ number, number ] => {\n if (typeof pageIndex === 'object') {\n pageSize = pageIndex.pageSize\n pageIndex = pageIndex.pageIndex\n }\n const start = pageSize * pageIndex\n const end = start + pageSize\n return [ start, end ]\n}\n","import { CollectionViewer, DataSource } from '@angular/cdk/collections'\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs'\nimport { pageForItemIndex, PageOf, PagingParameters } from './paging.model'\n\n/**\n * This class is an adaptation from the [Angular Material Guide](https://v8.material.angular.io/cdk/scrolling/overview), _\"Specifying data\" example_, also\n * available on [StackBlitz](https://stackblitz.com/angular/mrbkjagnnra?file=src%2Fapp%2Fcdk-virtual-scroll-data-source-example.ts).\n */\nexport class PagingDataSource<T> extends DataSource<T> {\n\n private data: T[] | null = null\n private data$ = new BehaviorSubject<T[]>([])\n private fetchedPages = new Set<number>()\n private subscription = new Subscription()\n\n constructor(private pageSize: number, private fetchPage: (paging: PagingParameters) => Observable<PageOf<T>>) {\n super()\n }\n\n connect(collectionViewer: CollectionViewer): Observable<T[]> {\n this.subscription.add(collectionViewer.viewChange.subscribe(range => {\n const startPage = this.pageForItemIndex(range.start)\n const endPage = this.pageForItemIndex(range.end - 1)\n for (let page = startPage; page <= endPage; page++) {\n this.fetch(page)\n }\n }))\n return this.data$\n }\n\n disconnect(): void {\n this.subscription.unsubscribe()\n }\n\n private pageForItemIndex(index: number): number {\n return pageForItemIndex(index, this.pageSize)\n }\n\n private fetch(pageIndex: number) {\n if (this.fetchedPages.has(pageIndex)) {\n return\n }\n this.fetchedPages.add(pageIndex)\n const includeTotalCount = !this.data\n this.fetchPage({ pageSize: this.pageSize, pageIndex: pageIndex, includeTotalCount }).subscribe(page => {\n if (!this.data) {\n if (typeof(page.totalCount) !== 'number') {\n throw new Error('data is null and no total count is available to inform allocation')\n }\n this.data = Array.from({ length: page.totalCount })\n }\n this.data.splice(pageIndex * this.pageSize, this.pageSize, ...page.items)\n this.data$.next(this.data)\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAgBa,gBAAgB,GAAG,CAAC,SAAiB,EAAE,QAAmC,KAAY;AACjG,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;AAChC,QAAA,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;AAC7B,KAAA;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAA;AACzC,EAAC;AAED;;;;;;;;AAQG;MACU,eAAe,GAGxB,CAAC,SAAoC,EA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,SAAC,CAAC,CAAA;KACH;AACF;;ACvDD;;AAEG;;;;"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ //# sourceMappingURL=ngageoint-mage.web-core-lib-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-plugin.mjs","sources":["../../../projects/core-lib/plugin/ngageoint-mage.web-core-lib-plugin.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;AAEG"}
@@ -0,0 +1,368 @@
1
+ import * as i3$1 from '@angular/cdk/scrolling';
2
+ import { ScrollingModule } from '@angular/cdk/scrolling';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i0 from '@angular/core';
5
+ import { Injectable, Component, Input, NgModule } from '@angular/core';
6
+ import * as i4 from '@angular/forms';
7
+ import { UntypedFormGroup, UntypedFormControl, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
+ import * as i2 from '@angular/material/card';
9
+ import { MatCardModule } from '@angular/material/card';
10
+ import * as i5 from '@ngageoint/mage.web-core-lib/common';
11
+ import { MageCommonModule } from '@ngageoint/mage.web-core-lib/common';
12
+ import * as i1 from '@angular/common/http';
13
+ import { HttpParams } from '@angular/common/http';
14
+ import { Observable, throwError } from 'rxjs';
15
+ import { catchError } from 'rxjs/operators';
16
+ import * as i3 from '@angular/platform-browser';
17
+ import { PagingDataSource } from '@ngageoint/mage.web-core-lib/paging';
18
+
19
+ const contentPathOfIcon = (icon) => {
20
+ if (!icon) {
21
+ return;
22
+ }
23
+ if (typeof icon !== 'string') {
24
+ icon = icon.id;
25
+ }
26
+ return `/api/icons/${icon}/content`;
27
+ };
28
+
29
+ class StaticIconService {
30
+ constructor(http) {
31
+ this.http = http;
32
+ }
33
+ fetchIcons(fetch) {
34
+ const now = Date.now();
35
+ const results = new Observable(observer => {
36
+ const icons = [];
37
+ let remaining = 100;
38
+ while (remaining--) {
39
+ const id = now - remaining;
40
+ icons.unshift({
41
+ id: String(id),
42
+ title: `Icon ${id}`,
43
+ fileName: `icon-${id}.png`,
44
+ sourceUrl: `https://test.mage/${id}.png`,
45
+ contentPath: `/icons/${id}/content`
46
+ });
47
+ }
48
+ setTimeout(() => {
49
+ observer.next({
50
+ pageSize: 100,
51
+ pageIndex: 0,
52
+ totalCount: 100,
53
+ items: icons
54
+ });
55
+ observer.complete();
56
+ }, 0);
57
+ return {
58
+ unsubscribe() { }
59
+ };
60
+ });
61
+ return results;
62
+ }
63
+ fetchIconById(id) {
64
+ return this.http.get(`/api/icons/${id}`).pipe(catchError((err, caught) => {
65
+ // TODO: this is probably better practice to insulate app layer from
66
+ // http errors
67
+ // if (err instanceof HttpErrorResponse) {
68
+ // if (err.status === 404) {
69
+ // return null
70
+ // }
71
+ // }
72
+ return throwError(err);
73
+ }));
74
+ }
75
+ fetchIconBySourceUrl(url) {
76
+ return this.http.get(`/api/icons`, {
77
+ params: new HttpParams().set('source_url', url)
78
+ });
79
+ }
80
+ fetchIconByReference(ref) {
81
+ if (ref.id) {
82
+ return this.fetchIconById(ref.id);
83
+ }
84
+ else if (ref.sourceUrl) {
85
+ return this.fetchIconBySourceUrl(ref.sourceUrl);
86
+ }
87
+ throw new Error('no icon id or source url');
88
+ }
89
+ registerIconUrl(url) {
90
+ throw new Error('unimplemented');
91
+ }
92
+ uploadIcon() {
93
+ throw new Error('unimplemented');
94
+ }
95
+ }
96
+ StaticIconService.ɵfac = function StaticIconService_Factory(t) { return new (t || StaticIconService)(i0.ɵɵinject(i1.HttpClient)); };
97
+ StaticIconService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StaticIconService, factory: StaticIconService.ɵfac, providedIn: 'root' });
98
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StaticIconService, [{
99
+ type: Injectable,
100
+ args: [{
101
+ providedIn: 'root'
102
+ }]
103
+ }], function () { return [{ type: i1.HttpClient }]; }, null); })();
104
+
105
+ class StaticIconFormFieldComponent {
106
+ constructor(iconService, httpClient, sanitizer) {
107
+ this.iconService = iconService;
108
+ this.httpClient = httpClient;
109
+ this.sanitizer = sanitizer;
110
+ this.iconRef = null;
111
+ this.form = new UntypedFormGroup({
112
+ iconRefToken: new UntypedFormControl(null),
113
+ iconRefType: new UntypedFormControl(null, Validators.required)
114
+ });
115
+ this.onChange = (iconRef) => { };
116
+ this.onValidatorChange = () => { };
117
+ this.onTouched = () => { };
118
+ this.form.valueChanges.subscribe((x) => {
119
+ this.iconRef = iconRefForFormValue(x);
120
+ this.onChange(this.iconRef);
121
+ });
122
+ }
123
+ registerOnValidatorChange(fn) {
124
+ this.onValidatorChange = fn;
125
+ }
126
+ ngOnChanges(changes) { }
127
+ ngOnDestroy() { }
128
+ onSelectIcon() { }
129
+ writeValue(iconRef) {
130
+ this.iconRef = iconRef;
131
+ const formValue = formValueForIconRef(iconRef);
132
+ this.form.setValue(formValue, { emitEvent: false });
133
+ this.resolveIconRef();
134
+ }
135
+ registerOnChange(fn) {
136
+ this.onChange = fn;
137
+ }
138
+ registerOnTouched(fn) {
139
+ this.onTouched = fn;
140
+ }
141
+ setDisabledState(isDisabled) {
142
+ if (isDisabled) {
143
+ this.form.disable();
144
+ }
145
+ else {
146
+ this.form.enable();
147
+ }
148
+ }
149
+ validate(control) {
150
+ return this.form.errors;
151
+ }
152
+ resolveIconRef() {
153
+ if (!this.iconRef) {
154
+ this.icon = null;
155
+ return;
156
+ }
157
+ this.iconService.fetchIconByReference(this.iconRef).subscribe(x => {
158
+ this.icon = x;
159
+ if (!this.icon) {
160
+ return;
161
+ }
162
+ });
163
+ }
164
+ }
165
+ StaticIconFormFieldComponent.ɵfac = function StaticIconFormFieldComponent_Factory(t) { return new (t || StaticIconFormFieldComponent)(i0.ɵɵdirectiveInject(StaticIconService), i0.ɵɵdirectiveInject(i1.HttpClient), i0.ɵɵdirectiveInject(i3.DomSanitizer)); };
166
+ StaticIconFormFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StaticIconFormFieldComponent, selectors: [["mage-static-icon-form-field"]], features: [i0.ɵɵProvidersFeature([
167
+ {
168
+ provide: NG_VALUE_ACCESSOR,
169
+ multi: true,
170
+ useExisting: StaticIconFormFieldComponent
171
+ },
172
+ {
173
+ provide: NG_VALIDATORS,
174
+ multi: true,
175
+ useExisting: StaticIconFormFieldComponent
176
+ },
177
+ ]), i0.ɵɵNgOnChangesFeature], decls: 4, vars: 2, consts: [[3, "formGroup"], [1, "icon-image", 3, "src"], ["type", "hidden", "formControlName", "iconRefType"], ["type", "hidden", "formControlName", "iconRefToken"]], template: function StaticIconFormFieldComponent_Template(rf, ctx) { if (rf & 1) {
178
+ i0.ɵɵelementStart(0, "div", 0);
179
+ i0.ɵɵelement(1, "mage-xhr-img", 1)(2, "input", 2)(3, "input", 3);
180
+ i0.ɵɵelementEnd();
181
+ } if (rf & 2) {
182
+ i0.ɵɵproperty("formGroup", ctx.form);
183
+ i0.ɵɵadvance(1);
184
+ i0.ɵɵproperty("src", ctx.icon == null ? null : ctx.icon.contentPath);
185
+ } }, dependencies: [i4.DefaultValueAccessor, i4.NgControlStatus, i4.NgControlStatusGroup, i4.FormGroupDirective, i4.FormControlName, i5.XhrImgComponent], styles: [".icon-image[_ngcontent-%COMP%]{display:block;height:3em;width:3em}"] });
186
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StaticIconFormFieldComponent, [{
187
+ type: Component,
188
+ args: [{ selector: 'mage-static-icon-form-field', providers: [
189
+ {
190
+ provide: NG_VALUE_ACCESSOR,
191
+ multi: true,
192
+ useExisting: StaticIconFormFieldComponent
193
+ },
194
+ {
195
+ provide: NG_VALIDATORS,
196
+ multi: true,
197
+ useExisting: StaticIconFormFieldComponent
198
+ },
199
+ ], template: "<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>", styles: [".icon-image{display:block;height:3em;width:3em}\n"] }]
200
+ }], function () { return [{ type: StaticIconService }, { type: i1.HttpClient }, { type: i3.DomSanitizer }]; }, null); })();
201
+ var IconRefType;
202
+ (function (IconRefType) {
203
+ IconRefType["Registered"] = "id";
204
+ IconRefType["SourceUrl"] = "sourceUrl";
205
+ })(IconRefType || (IconRefType = {}));
206
+ function iconRefForFormValue(x) {
207
+ if (!x.iconRefType) {
208
+ return null;
209
+ }
210
+ switch (x.iconRefType) {
211
+ case IconRefType.Registered:
212
+ return { [IconRefType.Registered]: x.iconRefToken };
213
+ case IconRefType.SourceUrl:
214
+ return { [IconRefType.SourceUrl]: x.iconRefToken };
215
+ default:
216
+ throw new Error('invalid icon ref type: ' + x.iconRefToken);
217
+ }
218
+ }
219
+ function formValueForIconRef(x) {
220
+ if (!x) {
221
+ return {
222
+ iconRefType: null,
223
+ iconRefToken: null
224
+ };
225
+ }
226
+ let iconRefType = null;
227
+ let iconRefToken = null;
228
+ if (x.hasOwnProperty(IconRefType.Registered)) {
229
+ iconRefType = IconRefType.Registered || null;
230
+ iconRefToken = x[IconRefType.Registered] || null;
231
+ }
232
+ else if (x.hasOwnProperty(IconRefType.SourceUrl)) {
233
+ iconRefType = IconRefType.SourceUrl || null;
234
+ iconRefToken = x[IconRefType.SourceUrl] || null;
235
+ }
236
+ return {
237
+ iconRefType,
238
+ iconRefToken
239
+ };
240
+ }
241
+
242
+ class StaticIconImgComponent {
243
+ constructor() { }
244
+ ngOnInit() {
245
+ }
246
+ ngOnChanges(changes) {
247
+ if (changes.iconRef) {
248
+ if (this.iconRef) {
249
+ this.iconPath = contentPathOfIcon(this.iconRef);
250
+ }
251
+ else {
252
+ this.iconPath = null;
253
+ }
254
+ }
255
+ }
256
+ }
257
+ StaticIconImgComponent.ɵfac = function StaticIconImgComponent_Factory(t) { return new (t || StaticIconImgComponent)(); };
258
+ StaticIconImgComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StaticIconImgComponent, selectors: [["mage-static-icon-img"]], inputs: { iconRef: "iconRef" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "src"]], template: function StaticIconImgComponent_Template(rf, ctx) { if (rf & 1) {
259
+ i0.ɵɵelement(0, "mage-xhr-img", 0);
260
+ } if (rf & 2) {
261
+ i0.ɵɵproperty("src", ctx.iconPath);
262
+ } }, dependencies: [i5.XhrImgComponent], encapsulation: 2 });
263
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StaticIconImgComponent, [{
264
+ type: Component,
265
+ args: [{
266
+ selector: 'mage-static-icon-img',
267
+ template: `<mage-xhr-img [src]="iconPath"></mage-xhr-img>`,
268
+ }]
269
+ }], function () { return []; }, { iconRef: [{
270
+ type: Input
271
+ }] }); })();
272
+
273
+ function StaticIconSelectComponent_mat_card_2_Template(rf, ctx) { if (rf & 1) {
274
+ i0.ɵɵelementStart(0, "mat-card", 3)(1, "mat-card-header")(2, "mat-card-title");
275
+ i0.ɵɵtext(3);
276
+ i0.ɵɵelementEnd()();
277
+ i0.ɵɵelement(4, "img", 4);
278
+ i0.ɵɵelementEnd();
279
+ } if (rf & 2) {
280
+ const icon_r1 = ctx.$implicit;
281
+ i0.ɵɵadvance(3);
282
+ i0.ɵɵtextInterpolate(icon_r1.title);
283
+ i0.ɵɵadvance(1);
284
+ i0.ɵɵproperty("src", icon_r1.path, i0.ɵɵsanitizeUrl);
285
+ } }
286
+ class StaticIconSelectComponent {
287
+ constructor(iconService) {
288
+ this.iconService = iconService;
289
+ this.icons = null;
290
+ this.dataSource = new PagingDataSource(250, (paging) => {
291
+ return this.iconService.fetchIcons(paging);
292
+ });
293
+ }
294
+ ngOnInit() {
295
+ this.iconService.fetchIcons().subscribe(x => {
296
+ this.icons = x.items;
297
+ });
298
+ }
299
+ onBrowseForUploadIcon() {
300
+ throw new Error('unimplemented');
301
+ }
302
+ }
303
+ StaticIconSelectComponent.ɵfac = function StaticIconSelectComponent_Factory(t) { return new (t || StaticIconSelectComponent)(i0.ɵɵdirectiveInject(StaticIconService)); };
304
+ StaticIconSelectComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StaticIconSelectComponent, 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 StaticIconSelectComponent_Template(rf, ctx) { if (rf & 1) {
305
+ i0.ɵɵelementStart(0, "div", 0)(1, "cdk-virtual-scroll-viewport", 1);
306
+ i0.ɵɵtemplate(2, StaticIconSelectComponent_mat_card_2_Template, 5, 2, "mat-card", 2);
307
+ i0.ɵɵelementEnd()();
308
+ } if (rf & 2) {
309
+ i0.ɵɵadvance(1);
310
+ i0.ɵɵproperty("itemSize", 40);
311
+ i0.ɵɵadvance(1);
312
+ i0.ɵɵproperty("cdkVirtualForOf", ctx.icons);
313
+ } }, dependencies: [i2.MatCard, i2.MatCardHeader, i2.MatCardTitle, i3$1.CdkFixedSizeVirtualScroll, i3$1.CdkVirtualForOf, i3$1.CdkVirtualScrollViewport], 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}"] });
314
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StaticIconSelectComponent, [{
315
+ type: Component,
316
+ args: [{ selector: 'static-icon-select', template: "<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-->", styles: ["virtual-scroll{display:grid;grid-template-columns:repeat(3,33%);grid-auto-rows:min-content;grid-gap:0;justify-content:center;gap:0}\n"] }]
317
+ }], function () { return [{ type: StaticIconService }]; }, null); })();
318
+
319
+ class StaticIconModule {
320
+ }
321
+ StaticIconModule.ɵfac = function StaticIconModule_Factory(t) { return new (t || StaticIconModule)(); };
322
+ StaticIconModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: StaticIconModule });
323
+ StaticIconModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
324
+ FormsModule,
325
+ ReactiveFormsModule,
326
+ MatCardModule,
327
+ MageCommonModule,
328
+ ScrollingModule] });
329
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StaticIconModule, [{
330
+ type: NgModule,
331
+ args: [{
332
+ imports: [
333
+ CommonModule,
334
+ FormsModule,
335
+ ReactiveFormsModule,
336
+ MatCardModule,
337
+ MageCommonModule,
338
+ ScrollingModule
339
+ ],
340
+ declarations: [
341
+ StaticIconFormFieldComponent,
342
+ StaticIconImgComponent,
343
+ StaticIconSelectComponent,
344
+ ],
345
+ exports: [
346
+ StaticIconFormFieldComponent,
347
+ StaticIconImgComponent,
348
+ StaticIconSelectComponent,
349
+ ]
350
+ }]
351
+ }], null, null); })();
352
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(StaticIconModule, { declarations: [StaticIconFormFieldComponent,
353
+ StaticIconImgComponent,
354
+ StaticIconSelectComponent], imports: [CommonModule,
355
+ FormsModule,
356
+ ReactiveFormsModule,
357
+ MatCardModule,
358
+ MageCommonModule,
359
+ ScrollingModule], exports: [StaticIconFormFieldComponent,
360
+ StaticIconImgComponent,
361
+ StaticIconSelectComponent] }); })();
362
+
363
+ /**
364
+ * Generated bundle index. Do not edit.
365
+ */
366
+
367
+ export { StaticIconFormFieldComponent, StaticIconImgComponent, StaticIconModule, StaticIconSelectComponent, StaticIconService, contentPathOfIcon };
368
+ //# sourceMappingURL=ngageoint-mage.web-core-lib-static-icon.mjs.map