@ngageoint/mage.web-core-lib 6.2.2
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.
- package/README.md +24 -0
- package/bundles/ngageoint-mage.web-core-lib-common.umd.js +146 -0
- package/bundles/ngageoint-mage.web-core-lib-common.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-event.umd.js +14 -0
- package/bundles/ngageoint-mage.web-core-lib-event.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-event.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib-event.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-feed.umd.js +114 -0
- package/bundles/ngageoint-mage.web-core-lib-feed.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-paging.umd.js +313 -0
- package/bundles/ngageoint-mage.web-core-lib-paging.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-paging.umd.min.js +16 -0
- package/bundles/ngageoint-mage.web-core-lib-paging.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-plugin.umd.js +11 -0
- package/bundles/ngageoint-mage.web-core-lib-plugin.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-plugin.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib-plugin.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js +391 -0
- package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-user.umd.js +492 -0
- package/bundles/ngageoint-mage.web-core-lib-user.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js +16 -0
- package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib.umd.js +32 -0
- package/bundles/ngageoint-mage.web-core-lib.umd.js.map +1 -0
- package/bundles/ngageoint-mage.web-core-lib.umd.min.js +2 -0
- package/bundles/ngageoint-mage.web-core-lib.umd.min.js.map +1 -0
- package/common/mage-common.module.d.ts +7 -0
- package/common/ngageoint-mage.web-core-lib-common.d.ts +5 -0
- package/common/package.json +12 -0
- package/common/public-api.d.ts +2 -0
- package/common/xhr-img.component.d.ts +58 -0
- package/esm2015/common/mage-common.module.js +26 -0
- package/esm2015/common/ngageoint-mage.web-core-lib-common.js +5 -0
- package/esm2015/common/public-api.js +3 -0
- package/esm2015/common/xhr-img.component.js +109 -0
- package/esm2015/event/event-read.service.js +3 -0
- package/esm2015/event/event.model.js +1 -0
- package/esm2015/event/ngageoint-mage.web-core-lib-event.js +5 -0
- package/esm2015/event/public-api.js +2 -0
- package/esm2015/feed/feed.model.js +1 -0
- package/esm2015/feed/feed.service.js +105 -0
- package/esm2015/feed/ngageoint-mage.web-core-lib-feed.js +5 -0
- package/esm2015/feed/public-api.js +2 -0
- package/esm2015/mage-core-lib.module.js +20 -0
- package/esm2015/ngageoint-mage.web-core-lib.js +5 -0
- package/esm2015/paging/ngageoint-mage.web-core-lib-paging.js +5 -0
- package/esm2015/paging/paging.cdk-data-source.adapter.js +52 -0
- package/esm2015/paging/paging.model.js +25 -0
- package/esm2015/paging/public-api.js +3 -0
- package/esm2015/plugin/ngageoint-mage.web-core-lib-plugin.js +4 -0
- package/esm2015/plugin/plugin.model.js +1 -0
- package/esm2015/plugin/public-api.js +1 -0
- package/esm2015/public-api.js +5 -0
- package/esm2015/static-icon/ngageoint-mage.web-core-lib-static-icon.js +5 -0
- package/esm2015/static-icon/public-api.js +7 -0
- package/esm2015/static-icon/static-icon-form-field/static-icon-form-field.component.js +152 -0
- package/esm2015/static-icon/static-icon-img/static-icon-img.component.js +35 -0
- package/esm2015/static-icon/static-icon-select/static-icon-select.component.js +61 -0
- package/esm2015/static-icon/static-icon.model.js +10 -0
- package/esm2015/static-icon/static-icon.module.js +55 -0
- package/esm2015/static-icon/static-icon.service.js +82 -0
- package/esm2015/user/ngageoint-mage.web-core-lib-user.js +5 -0
- package/esm2015/user/public-api.js +4 -0
- package/esm2015/user/user-read.service.js +40 -0
- package/esm2015/user/user-select/user-select.component.js +165 -0
- package/esm2015/user/user.model.js +1 -0
- package/esm2015/user/user.module.js +65 -0
- package/esm5/common/mage-common.module.js +30 -0
- package/esm5/common/ngageoint-mage.web-core-lib-common.js +5 -0
- package/esm5/common/public-api.js +3 -0
- package/esm5/common/xhr-img.component.js +112 -0
- package/esm5/event/event-read.service.js +3 -0
- package/esm5/event/event.model.js +1 -0
- package/esm5/event/ngageoint-mage.web-core-lib-event.js +5 -0
- package/esm5/event/public-api.js +2 -0
- package/esm5/feed/feed.model.js +1 -0
- package/esm5/feed/feed.service.js +108 -0
- package/esm5/feed/ngageoint-mage.web-core-lib-feed.js +5 -0
- package/esm5/feed/public-api.js +2 -0
- package/esm5/mage-core-lib.module.js +24 -0
- package/esm5/ngageoint-mage.web-core-lib.js +5 -0
- package/esm5/paging/ngageoint-mage.web-core-lib-paging.js +5 -0
- package/esm5/paging/paging.cdk-data-source.adapter.js +60 -0
- package/esm5/paging/paging.model.js +25 -0
- package/esm5/paging/public-api.js +3 -0
- package/esm5/plugin/ngageoint-mage.web-core-lib-plugin.js +4 -0
- package/esm5/plugin/plugin.model.js +1 -0
- package/esm5/plugin/public-api.js +1 -0
- package/esm5/public-api.js +5 -0
- package/esm5/static-icon/ngageoint-mage.web-core-lib-static-icon.js +5 -0
- package/esm5/static-icon/public-api.js +7 -0
- package/esm5/static-icon/static-icon-form-field/static-icon-form-field.component.js +157 -0
- package/esm5/static-icon/static-icon-img/static-icon-img.component.js +38 -0
- package/esm5/static-icon/static-icon-select/static-icon-select.component.js +65 -0
- package/esm5/static-icon/static-icon.model.js +10 -0
- package/esm5/static-icon/static-icon.module.js +59 -0
- package/esm5/static-icon/static-icon.service.js +84 -0
- package/esm5/user/ngageoint-mage.web-core-lib-user.js +5 -0
- package/esm5/user/public-api.js +4 -0
- package/esm5/user/user-read.service.js +42 -0
- package/esm5/user/user-select/user-select.component.js +175 -0
- package/esm5/user/user.model.js +1 -0
- package/esm5/user/user.module.js +69 -0
- package/event/event-read.service.d.ts +11 -0
- package/event/event.model.d.ts +6 -0
- package/event/ngageoint-mage.web-core-lib-event.d.ts +5 -0
- package/event/package.json +12 -0
- package/event/public-api.d.ts +2 -0
- package/feed/feed.model.d.ts +83 -0
- package/feed/feed.service.d.ts +40 -0
- package/feed/ngageoint-mage.web-core-lib-feed.d.ts +5 -0
- package/feed/package.json +12 -0
- package/feed/public-api.d.ts +2 -0
- package/fesm2015/ngageoint-mage.web-core-lib-common.js +137 -0
- package/fesm2015/ngageoint-mage.web-core-lib-common.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-event.js +10 -0
- package/fesm2015/ngageoint-mage.web-core-lib-event.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-feed.js +111 -0
- package/fesm2015/ngageoint-mage.web-core-lib-feed.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-paging.js +83 -0
- package/fesm2015/ngageoint-mage.web-core-lib-paging.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-plugin.js +4 -0
- package/fesm2015/ngageoint-mage.web-core-lib-plugin.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js +379 -0
- package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib-user.js +267 -0
- package/fesm2015/ngageoint-mage.web-core-lib-user.js.map +1 -0
- package/fesm2015/ngageoint-mage.web-core-lib.js +30 -0
- package/fesm2015/ngageoint-mage.web-core-lib.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-common.js +142 -0
- package/fesm5/ngageoint-mage.web-core-lib-common.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-event.js +10 -0
- package/fesm5/ngageoint-mage.web-core-lib-event.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-feed.js +113 -0
- package/fesm5/ngageoint-mage.web-core-lib-feed.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-paging.js +90 -0
- package/fesm5/ngageoint-mage.web-core-lib-paging.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-plugin.js +4 -0
- package/fesm5/ngageoint-mage.web-core-lib-plugin.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-static-icon.js +392 -0
- package/fesm5/ngageoint-mage.web-core-lib-static-icon.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib-user.js +280 -0
- package/fesm5/ngageoint-mage.web-core-lib-user.js.map +1 -0
- package/fesm5/ngageoint-mage.web-core-lib.js +33 -0
- package/fesm5/ngageoint-mage.web-core-lib.js.map +1 -0
- package/mage-core-lib.module.d.ts +6 -0
- package/ngageoint-mage.web-core-lib.d.ts +5 -0
- package/package.json +35 -0
- package/paging/ngageoint-mage.web-core-lib-paging.d.ts +5 -0
- package/paging/package.json +12 -0
- package/paging/paging.cdk-data-source.adapter.d.ts +20 -0
- package/paging/paging.model.d.ts +27 -0
- package/paging/public-api.d.ts +2 -0
- package/plugin/ngageoint-mage.web-core-lib-plugin.d.ts +5 -0
- package/plugin/package.json +12 -0
- package/plugin/plugin.model.d.ts +13 -0
- package/plugin/public-api.d.ts +1 -0
- package/public-api.d.ts +1 -0
- package/static-icon/ngageoint-mage.web-core-lib-static-icon.d.ts +5 -0
- package/static-icon/package.json +12 -0
- package/static-icon/public-api.d.ts +6 -0
- package/static-icon/static-icon-form-field/static-icon-form-field.component.d.ts +31 -0
- package/static-icon/static-icon-img/static-icon-img.component.d.ts +12 -0
- package/static-icon/static-icon-select/static-icon-select.component.d.ts +21 -0
- package/static-icon/static-icon.model.d.ts +19 -0
- package/static-icon/static-icon.module.d.ts +13 -0
- package/static-icon/static-icon.service.d.ts +20 -0
- package/user/ngageoint-mage.web-core-lib-user.d.ts +5 -0
- package/user/package.json +12 -0
- package/user/public-api.d.ts +4 -0
- package/user/user-read.service.d.ts +24 -0
- package/user/user-select/user-select.component.d.ts +38 -0
- package/user/user.model.d.ts +85 -0
- package/user/user.module.d.ts +16 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Feature } from 'geojson';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType } from './feed.model';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export interface FeedPreviewOptions {
|
|
7
|
+
skipContentFetch?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class FeedService {
|
|
10
|
+
private http;
|
|
11
|
+
constructor(http: HttpClient);
|
|
12
|
+
private _feeds;
|
|
13
|
+
readonly feeds: Observable<Feed[]>;
|
|
14
|
+
private _feedItems;
|
|
15
|
+
feedItems(feedId: string): Observable<Array<Feature>>;
|
|
16
|
+
fetchAllFeeds(): Observable<Array<Feed>>;
|
|
17
|
+
fetchFeed(feedId: string): Observable<FeedExpanded>;
|
|
18
|
+
fetchService(serviceId: string): Observable<Service>;
|
|
19
|
+
createService(service: {
|
|
20
|
+
title: string;
|
|
21
|
+
summary?: string;
|
|
22
|
+
serviceType: string;
|
|
23
|
+
config: any;
|
|
24
|
+
}): Observable<Service>;
|
|
25
|
+
fetchServices(): Observable<Array<Service>>;
|
|
26
|
+
fetchServiceFeeds(serviceId: string): Observable<Array<Feed>>;
|
|
27
|
+
fetchServiceType(serviceTypeId: string): Observable<ServiceType>;
|
|
28
|
+
fetchTopics(serviceId: string): Observable<Array<FeedTopic>>;
|
|
29
|
+
previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview>;
|
|
30
|
+
fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic>;
|
|
31
|
+
fetchServiceTypes(): Observable<Array<ServiceType>>;
|
|
32
|
+
createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded>;
|
|
33
|
+
updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded>;
|
|
34
|
+
deleteFeed(feed: Feed | FeedExpanded): Observable<{}>;
|
|
35
|
+
deleteService(service: Service): Observable<{}>;
|
|
36
|
+
fetchFeeds(eventId: number): Observable<Array<Feed>>;
|
|
37
|
+
fetchFeedItems(event: any, feed: Feed): Observable<FeedContent>;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDef<FeedService, never>;
|
|
39
|
+
static ɵprov: i0.ɵɵInjectableDef<FeedService>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "../bundles/ngageoint-mage.web-core-lib-feed.umd.js",
|
|
3
|
+
"module": "../fesm5/ngageoint-mage.web-core-lib-feed.js",
|
|
4
|
+
"es2015": "../fesm2015/ngageoint-mage.web-core-lib-feed.js",
|
|
5
|
+
"esm5": "../esm5/feed/ngageoint-mage.web-core-lib-feed.js",
|
|
6
|
+
"esm2015": "../esm2015/feed/ngageoint-mage.web-core-lib-feed.js",
|
|
7
|
+
"fesm5": "../fesm5/ngageoint-mage.web-core-lib-feed.js",
|
|
8
|
+
"fesm2015": "../fesm2015/ngageoint-mage.web-core-lib-feed.js",
|
|
9
|
+
"typings": "ngageoint-mage.web-core-lib-feed.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"name": "@ngageoint/mage.web-core-lib/feed"
|
|
12
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { InjectionToken, ɵɵdirectiveInject, ɵɵdefineComponent, ɵɵProvidersFeature, ɵɵNgOnChangesFeature, ɵɵelementStart, ɵɵlistener, ɵɵelementEnd, ɵɵattribute, ɵɵsanitizeUrl, ɵsetClassMetadata, Component, Inject, Input, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { DomSanitizer, BrowserModule } from '@angular/platform-browser';
|
|
4
|
+
|
|
5
|
+
const selector = 'mage-xhr-img';
|
|
6
|
+
const OBJECT_URL_SERVICE = new InjectionToken(`${selector}.objectUrlService`);
|
|
7
|
+
/**
|
|
8
|
+
* This component allows fetching images by `XMLHttpRequest` rather than the
|
|
9
|
+
* browser's native mechanism. These image requests are subject to HTTP
|
|
10
|
+
* interceptors that can add authorization headers to the request instead of
|
|
11
|
+
* using cache-defeating URL query parameters to set an auth token. Applying
|
|
12
|
+
* headers to the browser's native `img` requests is impossible, so a query
|
|
13
|
+
* parameter is necessary for authorization, but adding the parameter to the
|
|
14
|
+
* URL effectively bypasses the browser's caching mechanism when the auth token
|
|
15
|
+
* changes for images that
|
|
16
|
+
* should otherwise be subject to caching.
|
|
17
|
+
*
|
|
18
|
+
* The catch to fetching images by XHR is the response must be fetched as a
|
|
19
|
+
* `Blob`. The user then gets a browser-specific URL for the blob by
|
|
20
|
+
* `URL.createObjectURL(blob)`, which can then be assigned to the `src`
|
|
21
|
+
* attribute of an `img` tag. These blob URLs must then be "revoked" by
|
|
22
|
+
* `URL.revokeObjectURL(url)` in order to reclaim object URL's associated
|
|
23
|
+
* 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)
|
|
24
|
+
* on the subject.
|
|
25
|
+
*
|
|
26
|
+
* To use the component, simply add the tag to a template and bind the `src`
|
|
27
|
+
* attribute to the source URL of the desired image.
|
|
28
|
+
* ```
|
|
29
|
+
* <mage-xhr-img [src]="someComponent.imageUrlRequiresAuth"></mage-xhr-img>
|
|
30
|
+
* ```
|
|
31
|
+
* The component encapsulates the logic of creating and releasing the object
|
|
32
|
+
* URLs for the image data, preventing memory leaks.
|
|
33
|
+
*/
|
|
34
|
+
class XhrImgComponent {
|
|
35
|
+
constructor(objectUrlService, http, sanitizer) {
|
|
36
|
+
this.objectUrlService = objectUrlService;
|
|
37
|
+
this.http = http;
|
|
38
|
+
this.sanitizer = sanitizer;
|
|
39
|
+
this.sourceUrl = null;
|
|
40
|
+
this.safeBlobUrl = null;
|
|
41
|
+
}
|
|
42
|
+
ngOnChanges(changes) {
|
|
43
|
+
if (!changes.sourceUrl) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.disposeCurrent();
|
|
50
|
+
if (!this.sourceUrl) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })
|
|
54
|
+
.subscribe(x => {
|
|
55
|
+
this.objectUrlService.revokeObjectURL(this.blobUrl);
|
|
56
|
+
this.blobUrl = this.objectUrlService.createObjectURL(x);
|
|
57
|
+
this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
ngOnDestroy() {
|
|
61
|
+
this.disposeCurrent();
|
|
62
|
+
}
|
|
63
|
+
onImgLoad() {
|
|
64
|
+
this.disposeCurrent();
|
|
65
|
+
}
|
|
66
|
+
disposeCurrent() {
|
|
67
|
+
if (this.blobUrl) {
|
|
68
|
+
this.objectUrlService.revokeObjectURL(this.blobUrl);
|
|
69
|
+
}
|
|
70
|
+
if (this.subscription) {
|
|
71
|
+
this.subscription.unsubscribe();
|
|
72
|
+
}
|
|
73
|
+
this.blobUrl = null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
XhrImgComponent.ɵfac = function XhrImgComponent_Factory(t) { return new (t || XhrImgComponent)(ɵɵdirectiveInject(OBJECT_URL_SERVICE), ɵɵdirectiveInject(HttpClient), ɵɵdirectiveInject(DomSanitizer)); };
|
|
77
|
+
XhrImgComponent.ɵcmp = ɵɵdefineComponent({ type: XhrImgComponent, selectors: [["mage-xhr-img"]], inputs: { sourceUrl: ["src", "sourceUrl"] }, features: [ɵɵProvidersFeature([
|
|
78
|
+
{
|
|
79
|
+
provide: OBJECT_URL_SERVICE,
|
|
80
|
+
useValue: URL
|
|
81
|
+
}
|
|
82
|
+
]), ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "load"]], template: function XhrImgComponent_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
ɵɵelementStart(0, "img", 0);
|
|
84
|
+
ɵɵlistener("load", function XhrImgComponent_Template_img_load_0_listener() { return ctx.onImgLoad(); });
|
|
85
|
+
ɵɵelementEnd();
|
|
86
|
+
} if (rf & 2) {
|
|
87
|
+
ɵɵattribute("src", ctx.safeBlobUrl, ɵɵsanitizeUrl);
|
|
88
|
+
} }, styles: ["img[_ngcontent-%COMP%] { height: 100%; width: 100% }"] });
|
|
89
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(XhrImgComponent, [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{
|
|
92
|
+
selector: `${selector}`,
|
|
93
|
+
template: `<img [attr.src]="safeBlobUrl" (load)="onImgLoad()"/>`,
|
|
94
|
+
styles: [`img { height: 100%; width: 100% }`],
|
|
95
|
+
providers: [
|
|
96
|
+
{
|
|
97
|
+
provide: OBJECT_URL_SERVICE,
|
|
98
|
+
useValue: URL
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}]
|
|
102
|
+
}], function () { return [{ type: undefined, decorators: [{
|
|
103
|
+
type: Inject,
|
|
104
|
+
args: [OBJECT_URL_SERVICE]
|
|
105
|
+
}] }, { type: HttpClient }, { type: DomSanitizer }]; }, { sourceUrl: [{
|
|
106
|
+
type: Input,
|
|
107
|
+
args: ['src']
|
|
108
|
+
}] }); })();
|
|
109
|
+
|
|
110
|
+
class MageCommonModule {
|
|
111
|
+
}
|
|
112
|
+
MageCommonModule.ɵmod = ɵɵdefineNgModule({ type: MageCommonModule });
|
|
113
|
+
MageCommonModule.ɵinj = ɵɵdefineInjector({ factory: function MageCommonModule_Factory(t) { return new (t || MageCommonModule)(); }, imports: [[
|
|
114
|
+
BrowserModule
|
|
115
|
+
]] });
|
|
116
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MageCommonModule, { declarations: [XhrImgComponent], imports: [BrowserModule], exports: [XhrImgComponent] }); })();
|
|
117
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MageCommonModule, [{
|
|
118
|
+
type: NgModule,
|
|
119
|
+
args: [{
|
|
120
|
+
imports: [
|
|
121
|
+
BrowserModule
|
|
122
|
+
],
|
|
123
|
+
declarations: [
|
|
124
|
+
XhrImgComponent
|
|
125
|
+
],
|
|
126
|
+
exports: [
|
|
127
|
+
XhrImgComponent
|
|
128
|
+
]
|
|
129
|
+
}]
|
|
130
|
+
}], null, null); })();
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Generated bundle index. Do not edit.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
export { MageCommonModule, OBJECT_URL_SERVICE, XhrImgComponent };
|
|
137
|
+
//# sourceMappingURL=ngageoint-mage.web-core-lib-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-common.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts","ng://@ngageoint/mage.web-core-lib/common/ngageoint-mage.web-core-lib-common.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 {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute"],"mappings":";;;;AAKA,MAAM,QAAQ,GAAG,cAAc,CAAA;MAYlB,kBAAkB,GAAG,IAAI,cAAc,CAAmB,GAAG,QAAQ,mBAAmB,EAAC;AAEtG;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,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;SAChC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB;;8EA9CU,eAAe,oBASN,kBAAkB;iDAT3B,eAAe,4GAPf;YACT;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,QAAQ,EAAE,GAAG;aACd;SACF;QAPUA,2BAAoD;QAAtBC,oFAAQ,eAAW,IAAC;QAAlDC,cAAoD;;QAA/CC,kDAAwB;;+CAS7B,eAAe;cAX3B,SAAS;eAAC;gBACT,QAAQ,EAAE,GAAG,QAAQ,EAAE;gBACvB,QAAQ,EAAE,sDAAsD;gBAChE,MAAM,EAAE,CAAE,mCAAmC,CAAE;gBAC/C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,kBAAkB;wBAC3B,QAAQ,EAAE,GAAG;qBACd;iBACF;aACF;;sBAUc,MAAM;uBAAC,kBAAkB;;kBAPrC,KAAK;mBAAC,KAAK;;;MC5CD,gBAAgB;;iDAAhB,gBAAgB;4GAAhB,gBAAgB,kBAVlB;YACP,aAAa;SACd;qFAQU,gBAAgB,mBANzB,eAAe,aAHf,aAAa,aAMb,eAAe;+CAGN,gBAAgB;cAX5B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,aAAa;iBACd;gBACD,YAAY,EAAE;oBACZ,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,eAAe;iBAChB;aACF;;;ACdD;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
const EVENT_READ_SERVICE = new InjectionToken('EventReadService');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generated bundle index. Do not edit.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { EVENT_READ_SERVICE };
|
|
10
|
+
//# sourceMappingURL=ngageoint-mage.web-core-lib-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-event.js","sources":["ng://@ngageoint/mage.web-core-lib/event/event-read.service.ts","ng://@ngageoint/mage.web-core-lib/event/ngageoint-mage.web-core-lib-event.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\nimport { PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { Observable } from 'rxjs'\nimport { MageEvent } from './event.model'\n\nexport interface EventReadService {\n find(which: EventReadParams): Observable<MageEvent[]>\n}\n\nexport interface EventReadParams {\n page: PagingParameters\n}\n\nexport const EVENT_READ_SERVICE = new InjectionToken<EventReadService>('EventReadService')","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAaa,kBAAkB,GAAG,IAAI,cAAc,CAAmB,kBAAkB;;ACbzF;;;;;;"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ɵɵinject, ɵɵdefineInjectable, ɵsetClassMetadata, Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { HttpClient } from '@angular/common/http';
|
|
5
|
+
|
|
6
|
+
class FeedService {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
// TODO: there is probably a better solution than maintaining this map here
|
|
10
|
+
this._feeds = new BehaviorSubject([]);
|
|
11
|
+
this.feeds = this._feeds.asObservable();
|
|
12
|
+
this._feedItems = new Map();
|
|
13
|
+
}
|
|
14
|
+
feedItems(feedId) {
|
|
15
|
+
return this._feedItems.get(feedId).asObservable();
|
|
16
|
+
}
|
|
17
|
+
fetchAllFeeds() {
|
|
18
|
+
return this.http.get('/api/feeds/');
|
|
19
|
+
}
|
|
20
|
+
fetchFeed(feedId) {
|
|
21
|
+
return this.http.get(`/api/feeds/${feedId}`);
|
|
22
|
+
}
|
|
23
|
+
fetchService(serviceId) {
|
|
24
|
+
return this.http.get(`/api/feeds/services/${serviceId}`);
|
|
25
|
+
}
|
|
26
|
+
createService(service) {
|
|
27
|
+
return this.http.post(`/api/feeds/services`, service);
|
|
28
|
+
}
|
|
29
|
+
fetchServices() {
|
|
30
|
+
return this.http.get(`/api/feeds/services`);
|
|
31
|
+
}
|
|
32
|
+
fetchServiceFeeds(serviceId) {
|
|
33
|
+
return this.http.get(`/api/feeds/services/${serviceId}/feeds`);
|
|
34
|
+
}
|
|
35
|
+
fetchServiceType(serviceTypeId) {
|
|
36
|
+
return this.http.get(`/api/feeds/service_types/${serviceTypeId}`);
|
|
37
|
+
}
|
|
38
|
+
fetchTopics(serviceId) {
|
|
39
|
+
return this.http.get(`/api/feeds/services/${serviceId}/topics`);
|
|
40
|
+
}
|
|
41
|
+
previewFeed(serviceId, topicId, feedSpec, opts) {
|
|
42
|
+
opts = opts || {};
|
|
43
|
+
const skipContentFetch = opts.skipContentFetch === true;
|
|
44
|
+
return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`, { feed: feedSpec });
|
|
45
|
+
}
|
|
46
|
+
fetchTopic(serviceId, topicId) {
|
|
47
|
+
return this.http.get(`/api/feeds/services/${serviceId}/topics/${topicId}`);
|
|
48
|
+
}
|
|
49
|
+
fetchServiceTypes() {
|
|
50
|
+
return this.http.get(`/api/feeds/service_types`);
|
|
51
|
+
}
|
|
52
|
+
createFeed(serviceId, topicId, feedConfiguration) {
|
|
53
|
+
return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);
|
|
54
|
+
}
|
|
55
|
+
updateFeed(feed) {
|
|
56
|
+
return this.http.put(`/api/feeds/${feed.id}`, feed);
|
|
57
|
+
}
|
|
58
|
+
deleteFeed(feed) {
|
|
59
|
+
return this.http.delete(`/api/feeds/${feed.id}`, { responseType: 'text' });
|
|
60
|
+
}
|
|
61
|
+
deleteService(service) {
|
|
62
|
+
console.log('delete');
|
|
63
|
+
return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });
|
|
64
|
+
}
|
|
65
|
+
fetchFeeds(eventId) {
|
|
66
|
+
const subject = new Subject();
|
|
67
|
+
this.http.get(`/api/events/${eventId}/feeds`).subscribe(feeds => {
|
|
68
|
+
feeds.map(feed => {
|
|
69
|
+
feed.id = feed.id.toString();
|
|
70
|
+
return feed;
|
|
71
|
+
});
|
|
72
|
+
feeds.forEach(feed => {
|
|
73
|
+
let feedItems = this._feedItems.get(feed.id);
|
|
74
|
+
if (!feedItems) {
|
|
75
|
+
feedItems = new BehaviorSubject([]);
|
|
76
|
+
this._feedItems.set(feed.id, feedItems);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
subject.next(feeds);
|
|
80
|
+
this._feeds.next(feeds);
|
|
81
|
+
});
|
|
82
|
+
return subject;
|
|
83
|
+
}
|
|
84
|
+
fetchFeedItems(event, feed) {
|
|
85
|
+
const feedItems = this._feedItems.get(feed.id);
|
|
86
|
+
return this.http.post(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(map(content => {
|
|
87
|
+
const features = content.items.features;
|
|
88
|
+
features.forEach((feature) => {
|
|
89
|
+
feature.id = String(feature.id);
|
|
90
|
+
feature.properties = feature.properties || {};
|
|
91
|
+
});
|
|
92
|
+
feedItems.next(features);
|
|
93
|
+
return content;
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
FeedService.ɵfac = function FeedService_Factory(t) { return new (t || FeedService)(ɵɵinject(HttpClient)); };
|
|
98
|
+
FeedService.ɵprov = ɵɵdefineInjectable({ token: FeedService, factory: FeedService.ɵfac, providedIn: 'root' });
|
|
99
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(FeedService, [{
|
|
100
|
+
type: Injectable,
|
|
101
|
+
args: [{
|
|
102
|
+
providedIn: 'root'
|
|
103
|
+
}]
|
|
104
|
+
}], function () { return [{ type: HttpClient }]; }, null); })();
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Generated bundle index. Do not edit.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
export { FeedService };
|
|
111
|
+
//# sourceMappingURL=ngageoint-mage.web-core-lib-feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-feed.js","sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts","ng://@ngageoint/mage.web-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;IAEtB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;;QAG5B,WAAM,GAAG,IAAI,eAAe,CAAc,EAAE,CAAC,CAAC;QAC7C,UAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAEpC,eAAU,GAAG,IAAI,GAAG,EAA2C,CAAC;KAN/B;IAOzC,SAAS,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAC;KACnD;IAED,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,aAAa,CAAC,CAAC;KAClD;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,cAAc,MAAM,EAAE,CAAC,CAAC;KAC5D;IAED,YAAY,CAAC,SAAiB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAU,uBAAuB,SAAS,EAAE,CAAC,CAAC;KACnE;IAED,aAAa,CAAC,OAA6E;QACzF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAU,qBAAqB,EAAE,OAAO,CAAC,CAAC;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AAU,EAAE,IAAU;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAc,eAAe,KAAK,CAAC,EAAE,UAAU,IAAI,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAC7F,GAAG,CAAC,OAAO;YACT,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAA;YACvC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAsB;gBACtC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;gBAC/B,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAA;aAC9C,CAAC,CAAA;YACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACxB,OAAO,OAAO,CAAA;SACf,CAAC,CACH,CAAA;KACF;;sEAlHU,WAAW;gDAAX,WAAW,WAAX,WAAW,mBAFV,MAAM;+CAEP,WAAW;cAHvB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;ACdD;;;;;;"}
|
|
@@ -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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-paging.js","sources":["ng://@ngageoint/mage.web-core-lib/paging/paging.model.ts","ng://@ngageoint/mage.web-core-lib/paging/paging.cdk-data-source.adapter.ts","ng://@ngageoint/mage.web-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;IACrF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;KAC7B;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAA;AACzC,EAAC;AAED;;;;;;;;;MASa,eAAe,GAGxB,CAAC,SAAoC,EAAE,QAAiB;IAC1D,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QACjC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAA;QAC7B,SAAS,GAAG,SAAS,CAAC,SAAS,CAAA;KAChC;IACD,MAAM,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAA;IAClC,MAAM,GAAG,GAAG,KAAK,GAAG,QAAQ,CAAA;IAC5B,OAAO,CAAE,KAAK,EAAE,GAAG,CAAE,CAAA;AACvB;;ACvCA;;;;MAIa,gBAAoB,SAAQ,UAAa;IAOpD,YAAoB,QAAgB,EAAU,SAA8D;QAC1G,KAAK,EAAE,CAAA;QADW,aAAQ,GAAR,QAAQ,CAAQ;QAAU,cAAS,GAAT,SAAS,CAAqD;QALpG,SAAI,GAAe,IAAI,CAAA;QACvB,UAAK,GAAG,IAAI,eAAe,CAAM,EAAE,CAAC,CAAA;QACpC,iBAAY,GAAG,IAAI,GAAG,EAAU,CAAA;QAChC,iBAAY,GAAG,IAAI,YAAY,EAAE,CAAA;KAIxC;IAED,OAAO,CAAC,gBAAkC;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,gBAAgB,CA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I,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;YACzE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SAC3B,CAAC,CAAA;KACH;;;ACtDH;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-plugin.js","sources":["ng://@ngageoint/mage.web-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;;"}
|