@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,267 @@
|
|
|
1
|
+
import { ɵɵinject, ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, InjectionToken, ɵɵelementStart, ɵɵtext, ɵɵelementEnd, ɵɵnextContext, ɵɵadvance, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate, ɵɵdirectiveInject, ɵɵdefineComponent, ɵɵstaticViewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ɵɵProvidersFeature, forwardRef, ɵɵNgOnChangesFeature, ɵɵlistener, ɵɵtemplate, ɵɵproperty, Component, ViewChild, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
7
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
8
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
9
|
+
import { MatInputModule } from '@angular/material/input';
|
|
10
|
+
import { MatListModule } from '@angular/material/list';
|
|
11
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
12
|
+
import { NgSelectComponent, ɵj, ɵf, NgSelectModule } from '@ng-select/ng-select';
|
|
13
|
+
import { pageForItemIndex } from '@ngageoint/mage.web-core-lib/paging';
|
|
14
|
+
import { Subject } from 'rxjs';
|
|
15
|
+
import { distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
|
16
|
+
|
|
17
|
+
const USER_READ_BASE_URL = '/api/next-users';
|
|
18
|
+
const reqKeys = {
|
|
19
|
+
term: 'term',
|
|
20
|
+
pageSize: 'page_size',
|
|
21
|
+
pageIndex: 'page',
|
|
22
|
+
includeTotalCount: 'total',
|
|
23
|
+
};
|
|
24
|
+
class UserReadService {
|
|
25
|
+
constructor(http) {
|
|
26
|
+
this.http = http;
|
|
27
|
+
}
|
|
28
|
+
search(which) {
|
|
29
|
+
const queryParams = {
|
|
30
|
+
page_size: String(which.pageSize),
|
|
31
|
+
page: String(which.pageIndex),
|
|
32
|
+
};
|
|
33
|
+
if (typeof which.term === 'string') {
|
|
34
|
+
queryParams.term = which.term;
|
|
35
|
+
}
|
|
36
|
+
if (typeof which.includeTotalCount === 'boolean') {
|
|
37
|
+
queryParams.total = which.includeTotalCount ? 'true' : 'false';
|
|
38
|
+
}
|
|
39
|
+
return this.http.get(`${USER_READ_BASE_URL}/search`, {
|
|
40
|
+
params: queryParams
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
UserReadService.ɵfac = function UserReadService_Factory(t) { return new (t || UserReadService)(ɵɵinject(HttpClient)); };
|
|
45
|
+
UserReadService.ɵprov = ɵɵdefineInjectable({ token: UserReadService, factory: UserReadService.ɵfac, providedIn: 'root' });
|
|
46
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(UserReadService, [{
|
|
47
|
+
type: Injectable,
|
|
48
|
+
args: [{
|
|
49
|
+
providedIn: 'root'
|
|
50
|
+
}]
|
|
51
|
+
}], function () { return [{ type: HttpClient }]; }, null); })();
|
|
52
|
+
const USER_READ_SERVICE = new InjectionToken('UserReadService');
|
|
53
|
+
|
|
54
|
+
function UserSelectComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
55
|
+
ɵɵelementStart(0, "small", 3);
|
|
56
|
+
ɵɵtext(1);
|
|
57
|
+
ɵɵelementEnd();
|
|
58
|
+
} if (rf & 2) {
|
|
59
|
+
const ctx_r0 = ɵɵnextContext();
|
|
60
|
+
ɵɵadvance(1);
|
|
61
|
+
ɵɵtextInterpolate1("", ctx_r0.totalCount, " matching users");
|
|
62
|
+
} }
|
|
63
|
+
function UserSelectComponent_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
64
|
+
ɵɵelementStart(0, "div", 4);
|
|
65
|
+
ɵɵelementStart(1, "p", 5);
|
|
66
|
+
ɵɵtext(2);
|
|
67
|
+
ɵɵelementEnd();
|
|
68
|
+
ɵɵelementStart(3, "p", 6);
|
|
69
|
+
ɵɵtext(4);
|
|
70
|
+
ɵɵelementEnd();
|
|
71
|
+
ɵɵelementStart(5, "p", 6);
|
|
72
|
+
ɵɵtext(6);
|
|
73
|
+
ɵɵelementEnd();
|
|
74
|
+
ɵɵelementEnd();
|
|
75
|
+
} if (rf & 2) {
|
|
76
|
+
const user_r2 = ctx.item;
|
|
77
|
+
ɵɵadvance(2);
|
|
78
|
+
ɵɵtextInterpolate2("", user_r2.displayName, " (", user_r2.username, ")");
|
|
79
|
+
ɵɵadvance(2);
|
|
80
|
+
ɵɵtextInterpolate(user_r2.email || "[no email]");
|
|
81
|
+
ɵɵadvance(2);
|
|
82
|
+
ɵɵtextInterpolate(user_r2.allPhones || "[no phone]");
|
|
83
|
+
} }
|
|
84
|
+
class UserSelectComponent {
|
|
85
|
+
constructor(userService) {
|
|
86
|
+
this.userService = userService;
|
|
87
|
+
this.baseFindParams = Object.freeze({
|
|
88
|
+
pageSize: 100,
|
|
89
|
+
pageIndex: 0,
|
|
90
|
+
term: null
|
|
91
|
+
});
|
|
92
|
+
this.nextPageScrollThreshold = 15;
|
|
93
|
+
this.searchTermDebounceTime = 500;
|
|
94
|
+
this.trackByUserId = x => x.id;
|
|
95
|
+
this.users = [];
|
|
96
|
+
this.totalCount = 0;
|
|
97
|
+
this.searchTerm$ = new Subject();
|
|
98
|
+
this.currentSearchTerm = null;
|
|
99
|
+
this.currentFetch = null;
|
|
100
|
+
}
|
|
101
|
+
get loading() {
|
|
102
|
+
return !!this.currentFetch && !this.currentFetch.closed;
|
|
103
|
+
}
|
|
104
|
+
ngOnInit() {
|
|
105
|
+
this.searchTerm$.pipe(distinctUntilChanged(), debounceTime(this.searchTermDebounceTime))
|
|
106
|
+
.subscribe(x => {
|
|
107
|
+
this.currentSearchTerm = x;
|
|
108
|
+
this.users = [];
|
|
109
|
+
this.totalCount = 0;
|
|
110
|
+
if (this.currentFetch) {
|
|
111
|
+
this.currentFetch.unsubscribe();
|
|
112
|
+
this.currentFetch = null;
|
|
113
|
+
}
|
|
114
|
+
this.fetchNextPage();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
ngOnChanges(changes) {
|
|
118
|
+
}
|
|
119
|
+
ngAfterViewInit() {
|
|
120
|
+
}
|
|
121
|
+
writeValue(x) {
|
|
122
|
+
this.userSelect.writeValue(x);
|
|
123
|
+
}
|
|
124
|
+
registerOnChange(fn) {
|
|
125
|
+
this.userSelect.registerOnChange(fn);
|
|
126
|
+
}
|
|
127
|
+
registerOnTouched(fn) {
|
|
128
|
+
this.userSelect.registerOnTouched(fn);
|
|
129
|
+
}
|
|
130
|
+
setDisabledState(isDisabled) {
|
|
131
|
+
this.userSelect.setDisabledState(isDisabled);
|
|
132
|
+
}
|
|
133
|
+
onOpen() {
|
|
134
|
+
if (this.users.length === 0) {
|
|
135
|
+
this.fetchNextPage();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
onScroll({ end }) {
|
|
139
|
+
if (end < this.users.length - this.nextPageScrollThreshold || this.users.length === this.totalCount) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.fetchNextPage();
|
|
143
|
+
}
|
|
144
|
+
onScrollToEnd() {
|
|
145
|
+
}
|
|
146
|
+
fetchNextPage() {
|
|
147
|
+
if (this.currentFetch) {
|
|
148
|
+
if (this.currentFetch.closed) {
|
|
149
|
+
this.currentFetch = null;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const nextPage = pageForItemIndex(this.users.length, this.baseFindParams.pageSize);
|
|
156
|
+
const findParams = Object.assign(Object.assign({}, this.baseFindParams), { pageIndex: nextPage });
|
|
157
|
+
if (this.currentSearchTerm) {
|
|
158
|
+
findParams.term = this.currentSearchTerm;
|
|
159
|
+
}
|
|
160
|
+
this.currentFetch = this.userService.search(findParams).subscribe(page => {
|
|
161
|
+
this.users = this.users.concat(page.items);
|
|
162
|
+
if (typeof page.totalCount === 'number') {
|
|
163
|
+
this.totalCount = page.totalCount;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
UserSelectComponent.ɵfac = function UserSelectComponent_Factory(t) { return new (t || UserSelectComponent)(ɵɵdirectiveInject(UserReadService)); };
|
|
169
|
+
UserSelectComponent.ɵcmp = ɵɵdefineComponent({ type: UserSelectComponent, selectors: [["mage-user-select"]], viewQuery: function UserSelectComponent_Query(rf, ctx) { if (rf & 1) {
|
|
170
|
+
ɵɵstaticViewQuery(NgSelectComponent, true);
|
|
171
|
+
} if (rf & 2) {
|
|
172
|
+
var _t;
|
|
173
|
+
ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.userSelect = _t.first);
|
|
174
|
+
} }, features: [ɵɵProvidersFeature([
|
|
175
|
+
{
|
|
176
|
+
provide: NG_VALUE_ACCESSOR,
|
|
177
|
+
multi: true,
|
|
178
|
+
useExisting: forwardRef(() => UserSelectComponent)
|
|
179
|
+
}
|
|
180
|
+
]), ɵɵNgOnChangesFeature], decls: 3, vars: 5, consts: [["appendTo", "body", "placeholder", "Choose a user", "bindLabel", "displayName", 3, "items", "typeahead", "virtualScroll", "loading", "trackByFn", "open", "scroll", "scrollToEnd"], ["ng-header-tmp", ""], ["class", "user-option", "ng-option-tmp", ""], [1, "form-text", "text-muted"], [1, "user-option"], [1, "user-option__line", "primary"], [1, "user-option__line", "detail"]], template: function UserSelectComponent_Template(rf, ctx) { if (rf & 1) {
|
|
181
|
+
ɵɵelementStart(0, "ng-select", 0);
|
|
182
|
+
ɵɵlistener("open", function UserSelectComponent_Template_ng_select_open_0_listener() { return ctx.onOpen(); })("scroll", function UserSelectComponent_Template_ng_select_scroll_0_listener($event) { return ctx.onScroll($event); })("scrollToEnd", function UserSelectComponent_Template_ng_select_scrollToEnd_0_listener() { return ctx.onScrollToEnd(); });
|
|
183
|
+
ɵɵtemplate(1, UserSelectComponent_ng_template_1_Template, 2, 1, "ng-template", 1);
|
|
184
|
+
ɵɵtemplate(2, UserSelectComponent_ng_template_2_Template, 7, 4, "ng-template", 2);
|
|
185
|
+
ɵɵelementEnd();
|
|
186
|
+
} if (rf & 2) {
|
|
187
|
+
ɵɵproperty("items", ctx.users)("typeahead", ctx.searchTerm$)("virtualScroll", true)("loading", ctx.loading)("trackByFn", ctx.trackByUserId);
|
|
188
|
+
} }, directives: [NgSelectComponent, ɵj, ɵf], styles: [".user-option[_ngcontent-%COMP%]{margin:.85em 0}.user-option[_ngcontent-%COMP%] > .user-option__line[_ngcontent-%COMP%]{margin:0 0 .6em;padding:0;line-height:1em;overflow:hidden;text-overflow:ellipsis}.user-option[_ngcontent-%COMP%] > .user-option__line.primary[_ngcontent-%COMP%]{font-size:1em}.user-option[_ngcontent-%COMP%] > .user-option__line.detail[_ngcontent-%COMP%]{font-size:.85em;opacity:.75}"] });
|
|
189
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(UserSelectComponent, [{
|
|
190
|
+
type: Component,
|
|
191
|
+
args: [{
|
|
192
|
+
selector: 'mage-user-select',
|
|
193
|
+
templateUrl: './user-select.component.html',
|
|
194
|
+
styleUrls: [
|
|
195
|
+
'./user-select.component.scss'
|
|
196
|
+
],
|
|
197
|
+
providers: [
|
|
198
|
+
{
|
|
199
|
+
provide: NG_VALUE_ACCESSOR,
|
|
200
|
+
multi: true,
|
|
201
|
+
useExisting: forwardRef(() => UserSelectComponent)
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}]
|
|
205
|
+
}], function () { return [{ type: UserReadService }]; }, { userSelect: [{
|
|
206
|
+
type: ViewChild,
|
|
207
|
+
args: [NgSelectComponent, { static: true }]
|
|
208
|
+
}] }); })();
|
|
209
|
+
|
|
210
|
+
class MageUserModule {
|
|
211
|
+
}
|
|
212
|
+
MageUserModule.ɵmod = ɵɵdefineNgModule({ type: MageUserModule });
|
|
213
|
+
MageUserModule.ɵinj = ɵɵdefineInjector({ factory: function MageUserModule_Factory(t) { return new (t || MageUserModule)(); }, imports: [[
|
|
214
|
+
CommonModule,
|
|
215
|
+
FormsModule,
|
|
216
|
+
ReactiveFormsModule,
|
|
217
|
+
ScrollingModule,
|
|
218
|
+
MatAutocompleteModule,
|
|
219
|
+
MatDialogModule,
|
|
220
|
+
MatFormFieldModule,
|
|
221
|
+
MatInputModule,
|
|
222
|
+
MatListModule,
|
|
223
|
+
MatSelectModule,
|
|
224
|
+
NgSelectModule,
|
|
225
|
+
]] });
|
|
226
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MageUserModule, { declarations: [UserSelectComponent], imports: [CommonModule,
|
|
227
|
+
FormsModule,
|
|
228
|
+
ReactiveFormsModule,
|
|
229
|
+
ScrollingModule,
|
|
230
|
+
MatAutocompleteModule,
|
|
231
|
+
MatDialogModule,
|
|
232
|
+
MatFormFieldModule,
|
|
233
|
+
MatInputModule,
|
|
234
|
+
MatListModule,
|
|
235
|
+
MatSelectModule,
|
|
236
|
+
NgSelectModule], exports: [UserSelectComponent] }); })();
|
|
237
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MageUserModule, [{
|
|
238
|
+
type: NgModule,
|
|
239
|
+
args: [{
|
|
240
|
+
imports: [
|
|
241
|
+
CommonModule,
|
|
242
|
+
FormsModule,
|
|
243
|
+
ReactiveFormsModule,
|
|
244
|
+
ScrollingModule,
|
|
245
|
+
MatAutocompleteModule,
|
|
246
|
+
MatDialogModule,
|
|
247
|
+
MatFormFieldModule,
|
|
248
|
+
MatInputModule,
|
|
249
|
+
MatListModule,
|
|
250
|
+
MatSelectModule,
|
|
251
|
+
NgSelectModule,
|
|
252
|
+
],
|
|
253
|
+
declarations: [
|
|
254
|
+
UserSelectComponent
|
|
255
|
+
],
|
|
256
|
+
exports: [
|
|
257
|
+
UserSelectComponent
|
|
258
|
+
]
|
|
259
|
+
}]
|
|
260
|
+
}], null, null); })();
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Generated bundle index. Do not edit.
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
export { MageUserModule, USER_READ_BASE_URL, USER_READ_SERVICE, UserReadService, UserSelectComponent };
|
|
267
|
+
//# sourceMappingURL=ngageoint-mage.web-core-lib-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib-user.js","sources":["ng://@ngageoint/mage.web-core-lib/user/user-read.service.ts","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.html","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.ts","ng://@ngageoint/mage.web-core-lib/user/user.module.ts","ng://@ngageoint/mage.web-core-lib/user/ngageoint-mage.web-core-lib-user.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http'\nimport { InjectionToken, Injectable } from '@angular/core'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { Observable } from 'rxjs'\nimport { User } from './user.model'\n\nexport const USER_READ_BASE_URL = '/api/next-users'\n\ntype SearchQueryParams = {\n page_size: string,\n page: string,\n term?: string,\n total?: 'true' | 'false'\n}\n\nconst reqKeys: { [SearchParamKey in keyof UserSearchParams]: string } = {\n term: 'term',\n pageSize: 'page_size',\n pageIndex: 'page',\n includeTotalCount: 'total',\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UserReadService {\n\n constructor(private http: HttpClient) { }\n\n search(which: UserSearchParams): Observable<PageOf<UserSearchResult>> {\n const queryParams: SearchQueryParams = {\n page_size: String(which.pageSize),\n page: String(which.pageIndex),\n }\n if (typeof which.term === 'string') {\n queryParams.term = which.term\n }\n if (typeof which.includeTotalCount === 'boolean') {\n queryParams.total = which.includeTotalCount ? 'true' : 'false'\n }\n return this.http.get<PageOf<UserSearchResult>>(`${USER_READ_BASE_URL}/search`, {\n params: queryParams\n })\n }\n}\n\nexport interface UserSearchParams extends PagingParameters {\n term?: string | null | undefined\n}\n\nexport type UserSearchResult = Pick<User, 'id' | 'username' | 'displayName' | 'email' | 'active' | 'enabled'> & {\n /**\n * A reduction of all the phone numbers to a single string\n */\n allPhones?: string | null | undefined\n}\n\nexport const USER_READ_SERVICE = new InjectionToken<UserReadService>('UserReadService')","<ng-select [items]=\"users\"\n [typeahead]=\"searchTerm$\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n [trackByFn]=\"trackByUserId\"\n appendTo=\"body\"\n placeholder=\"Choose a user\"\n bindLabel=\"displayName\"\n (open)=\"onOpen()\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\">{{totalCount}} matching users</small>\n </ng-template>\n <ng-template class=\"user-option\" ng-option-tmp let-user=\"item\" let-index=\"index\">\n <div class=\"user-option\">\n <p class=\"user-option__line primary\">{{user.displayName}} ({{user.username}})</p>\n <p class=\"user-option__line detail\">{{user.email || '[no email]'}}</p>\n <p class=\"user-option__line detail\">{{user.allPhones || '[no phone]'}}</p>\n </div>\n </ng-template>\n</ng-select>\n","import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, ViewChild, forwardRef, OnInit } from '@angular/core'\nimport { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { NgSelectComponent } from '@ng-select/ng-select'\nimport { User } from '../user.model'\nimport { UserReadService, UserSearchParams, UserSearchResult } from '../user-read.service'\nimport { pageForItemIndex, itemRangeOfPage } from '@ngageoint/mage.web-core-lib/paging'\nimport { Subject, BehaviorSubject, SubscriptionLike, Unsubscribable } from 'rxjs'\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators'\nimport { X } from '@angular/cdk/keycodes'\n\n@Component({\n selector: 'mage-user-select',\n templateUrl: './user-select.component.html',\n styleUrls: [\n './user-select.component.scss'\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: forwardRef(() => UserSelectComponent)\n }\n ]\n})\nexport class UserSelectComponent implements OnInit, OnChanges, AfterViewInit, ControlValueAccessor {\n\n readonly baseFindParams: Readonly<UserSearchParams> = Object.freeze({\n pageSize: 100,\n pageIndex: 0,\n term: null\n })\n readonly nextPageScrollThreshold = 15\n readonly searchTermDebounceTime = 500\n readonly trackByUserId: (x: User) => User['id'] = x => x.id\n get loading(): boolean {\n return !!this.currentFetch && !this.currentFetch.closed\n }\n\n users: UserSearchResult[] = []\n totalCount = 0\n searchTerm$ = new Subject<string | null>()\n currentSearchTerm: string | null = null\n @ViewChild(NgSelectComponent, { static: true })\n userSelect: NgSelectComponent\n\n private currentFetch: SubscriptionLike | null = null\n\n constructor(private userService: UserReadService) { }\n\n ngOnInit() {\n this.searchTerm$.pipe(\n distinctUntilChanged(),\n debounceTime(this.searchTermDebounceTime),\n )\n .subscribe(x => {\n this.currentSearchTerm = x\n this.users = []\n this.totalCount = 0\n if (this.currentFetch) {\n this.currentFetch.unsubscribe()\n this.currentFetch = null\n }\n this.fetchNextPage()\n })\n }\n\n ngOnChanges(changes: SimpleChanges) {\n }\n\n ngAfterViewInit() {\n }\n\n writeValue(x: User | null): void {\n this.userSelect.writeValue(x)\n }\n\n registerOnChange(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnChange(fn)\n }\n\n registerOnTouched(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnTouched(fn)\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.userSelect.setDisabledState(isDisabled)\n }\n\n onOpen() {\n if (this.users.length === 0) {\n this.fetchNextPage()\n }\n }\n\n onScroll({ end }: { start: number, end: number }) {\n if (end < this.users.length - this.nextPageScrollThreshold || this.users.length === this.totalCount) {\n return\n }\n this.fetchNextPage()\n }\n\n onScrollToEnd() {\n\n }\n\n fetchNextPage() {\n if (this.currentFetch) {\n if (this.currentFetch.closed) {\n this.currentFetch = null\n }\n else {\n return\n }\n }\n const nextPage = pageForItemIndex(this.users.length, this.baseFindParams.pageSize)\n const findParams: UserSearchParams = {\n ...this.baseFindParams,\n pageIndex: nextPage\n }\n if (this.currentSearchTerm) {\n findParams.term = this.currentSearchTerm\n }\n this.currentFetch = this.userService.search(findParams).subscribe(page => {\n this.users = this.users.concat(page.items)\n if (typeof page.totalCount === 'number') {\n this.totalCount = page.totalCount\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 { MatAutocompleteModule } from '@angular/material/autocomplete'\nimport { MatDialogModule } from '@angular/material/dialog'\nimport { MatFormFieldModule } from '@angular/material/form-field'\nimport { MatInputModule } from '@angular/material/input'\nimport { MatListModule } from '@angular/material/list'\nimport { MatSelectModule } from '@angular/material/select'\nimport { UserSelectComponent } from './user-select/user-select.component'\nimport { NgSelectModule } from '@ng-select/ng-select'\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n ScrollingModule,\n MatAutocompleteModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule,\n MatListModule,\n MatSelectModule,\n NgSelectModule,\n ],\n declarations: [\n UserSelectComponent\n ],\n exports: [\n UserSelectComponent\n ]\n})\nexport class MageUserModule {\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵtext","i0.ɵɵelementEnd","i0.ɵɵadvance","i0.ɵɵtextInterpolate1","i0.ɵɵtextInterpolate2","i0.ɵɵtextInterpolate","i0.ɵɵlistener","i0.ɵɵtemplate","i0.ɵɵproperty"],"mappings":";;;;;;;;;;;;;;;;MAMa,kBAAkB,GAAG,kBAAiB;AASnD,MAAM,OAAO,GAA2D;IACtE,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,MAAM;IACjB,iBAAiB,EAAE,OAAO;CAC3B,CAAA;MAKY,eAAe;IAE1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;KAAK;IAEzC,MAAM,CAAC,KAAuB;QAC5B,MAAM,WAAW,GAAsB;YACrC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;SAC9B,CAAA;QACD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YAClC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;SAC9B;QACD,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,SAAS,EAAE;YAChD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAA;SAC/D;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA2B,GAAG,kBAAkB,SAAS,EAAE;YAC7E,MAAM,EAAE,WAAW;SACpB,CAAC,CAAA;KACH;;8EAlBU,eAAe;oDAAf,eAAe,WAAf,eAAe,mBAFd,MAAM;+CAEP,eAAe;cAH3B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;MAiCY,iBAAiB,GAAG,IAAI,cAAc,CAAkB,iBAAiB;;;IC5ClFA,6BAAoC;IAAAC,S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AAE,MAAM,EAAE,IAAI,EAAE;;;MCRnC,cAAc;;+CAAd,cAAc;wGAAd,cAAc,kBApBhB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,eAAe;YACf,qBAAqB;YACrB,eAAe;YACf,kBAAkB;YAClB,cAAc;YACd,aAAa;YACb,eAAe;YACf,cAAc;SACf;qFAQU,cAAc,mBANvB,mBAAmB,aAbnB,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,aAAa;QACb,eAAe;QACf,cAAc,aAMd,mBAAmB;+CAGV,cAAc;cArB1B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,eAAe;oBACf,qBAAqB;oBACrB,eAAe;oBACf,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,mBAAmB;iBACpB;aACF;;;ACjCD;;;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, ɵsetClassMetadata, NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
class MageCoreLibModule {
|
|
5
|
+
}
|
|
6
|
+
MageCoreLibModule.ɵmod = ɵɵdefineNgModule({ type: MageCoreLibModule });
|
|
7
|
+
MageCoreLibModule.ɵinj = ɵɵdefineInjector({ factory: function MageCoreLibModule_Factory(t) { return new (t || MageCoreLibModule)(); }, imports: [[
|
|
8
|
+
CommonModule
|
|
9
|
+
]] });
|
|
10
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MageCoreLibModule, { imports: [CommonModule] }); })();
|
|
11
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MageCoreLibModule, [{
|
|
12
|
+
type: NgModule,
|
|
13
|
+
args: [{
|
|
14
|
+
declarations: [],
|
|
15
|
+
imports: [
|
|
16
|
+
CommonModule
|
|
17
|
+
]
|
|
18
|
+
}]
|
|
19
|
+
}], null, null); })();
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Public API Surface of core-lib
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generated bundle index. Do not edit.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export { MageCoreLibModule };
|
|
30
|
+
//# sourceMappingURL=ngageoint-mage.web-core-lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngageoint-mage.web-core-lib.js","sources":["ng://@ngageoint/mage.web-core-lib/mage-core-lib.module.ts","ng://@ngageoint/mage.web-core-lib/public-api.ts","ng://@ngageoint/mage.web-core-lib/ngageoint-mage.web-core-lib.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class MageCoreLibModule { }\n","/*\n * Public API Surface of core-lib\n */\n\nexport * from './mage-core-lib.module'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAWa,iBAAiB;;kDAAjB,iBAAiB;8GAAjB,iBAAiB,kBAJnB;YACP,YAAY;SACb;qFAEU,iBAAiB,cAH1B,YAAY;+CAGH,iBAAiB;cAN7B,QAAQ;eAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;ACVD;;;;ACAA;;;;;;"}
|
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
var selector = 'mage-xhr-img';
|
|
6
|
+
var 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
|
+
var XhrImgComponent = /** @class */ (function () {
|
|
35
|
+
function XhrImgComponent(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
|
+
XhrImgComponent.prototype.ngOnChanges = function (changes) {
|
|
43
|
+
var _this = this;
|
|
44
|
+
if (!changes.sourceUrl) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.disposeCurrent();
|
|
51
|
+
if (!this.sourceUrl) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })
|
|
55
|
+
.subscribe(function (x) {
|
|
56
|
+
_this.objectUrlService.revokeObjectURL(_this.blobUrl);
|
|
57
|
+
_this.blobUrl = _this.objectUrlService.createObjectURL(x);
|
|
58
|
+
_this.safeBlobUrl = _this.sanitizer.bypassSecurityTrustUrl(_this.blobUrl);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
XhrImgComponent.prototype.ngOnDestroy = function () {
|
|
62
|
+
this.disposeCurrent();
|
|
63
|
+
};
|
|
64
|
+
XhrImgComponent.prototype.onImgLoad = function () {
|
|
65
|
+
this.disposeCurrent();
|
|
66
|
+
};
|
|
67
|
+
XhrImgComponent.prototype.disposeCurrent = function () {
|
|
68
|
+
if (this.blobUrl) {
|
|
69
|
+
this.objectUrlService.revokeObjectURL(this.blobUrl);
|
|
70
|
+
}
|
|
71
|
+
if (this.subscription) {
|
|
72
|
+
this.subscription.unsubscribe();
|
|
73
|
+
}
|
|
74
|
+
this.blobUrl = null;
|
|
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
|
+
return XhrImgComponent;
|
|
90
|
+
}());
|
|
91
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(XhrImgComponent, [{
|
|
92
|
+
type: Component,
|
|
93
|
+
args: [{
|
|
94
|
+
selector: "" + selector,
|
|
95
|
+
template: "<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>",
|
|
96
|
+
styles: ["img { height: 100%; width: 100% }"],
|
|
97
|
+
providers: [
|
|
98
|
+
{
|
|
99
|
+
provide: OBJECT_URL_SERVICE,
|
|
100
|
+
useValue: URL
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}]
|
|
104
|
+
}], function () { return [{ type: undefined, decorators: [{
|
|
105
|
+
type: Inject,
|
|
106
|
+
args: [OBJECT_URL_SERVICE]
|
|
107
|
+
}] }, { type: HttpClient }, { type: DomSanitizer }]; }, { sourceUrl: [{
|
|
108
|
+
type: Input,
|
|
109
|
+
args: ['src']
|
|
110
|
+
}] }); })();
|
|
111
|
+
|
|
112
|
+
var MageCommonModule = /** @class */ (function () {
|
|
113
|
+
function MageCommonModule() {
|
|
114
|
+
}
|
|
115
|
+
MageCommonModule.ɵmod = ɵɵdefineNgModule({ type: MageCommonModule });
|
|
116
|
+
MageCommonModule.ɵinj = ɵɵdefineInjector({ factory: function MageCommonModule_Factory(t) { return new (t || MageCommonModule)(); }, imports: [[
|
|
117
|
+
BrowserModule
|
|
118
|
+
]] });
|
|
119
|
+
return MageCommonModule;
|
|
120
|
+
}());
|
|
121
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MageCommonModule, { declarations: [XhrImgComponent], imports: [BrowserModule], exports: [XhrImgComponent] }); })();
|
|
122
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(MageCommonModule, [{
|
|
123
|
+
type: NgModule,
|
|
124
|
+
args: [{
|
|
125
|
+
imports: [
|
|
126
|
+
BrowserModule
|
|
127
|
+
],
|
|
128
|
+
declarations: [
|
|
129
|
+
XhrImgComponent
|
|
130
|
+
],
|
|
131
|
+
exports: [
|
|
132
|
+
XhrImgComponent
|
|
133
|
+
]
|
|
134
|
+
}]
|
|
135
|
+
}], null, null); })();
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Generated bundle index. Do not edit.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
export { MageCommonModule, OBJECT_URL_SERVICE, XhrImgComponent };
|
|
142
|
+
//# 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,IAAM,QAAQ,GAAG,cAAc,CAAA;IAYlB,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;YAChB,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACpD;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;SAChC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB;kFA9CU,eAAe,oBASN,kBAAkB;qDAT3B,eAAe,4GAPf;gBACT;oBACE,OAAO,EAAE,kBAAkB;oBAC3B,QAAQ,EAAE,GAAG;iBACd;aACF;YAPUA,2BAAoD;YAAtBC,oFAAQ,eAAW,IAAC;YAAlDC,cAAoD;;YAA/CC,kDAAwB;;0BAhD1C;CA8CA,IA0DC;+CA/CY,eAAe;cAX3B,SAAS;eAAC;gBACT,QAAQ,EAAE,KAAG,QAAU;gBACvB,QAAQ,EAAE,0DAAsD;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;;;;ICvDd;KAWgC;qDAAnB,gBAAgB;gHAAhB,gBAAgB,kBAVlB;gBACP,aAAa;aACd;2BAPH;CAIA,IAWgC;qFAAnB,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
|
+
var 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":";;IAaa,kBAAkB,GAAG,IAAI,cAAc,CAAmB,kBAAkB;;ACbzF;;;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
var FeedService = /** @class */ (function () {
|
|
7
|
+
function FeedService(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
|
+
FeedService.prototype.feedItems = function (feedId) {
|
|
15
|
+
return this._feedItems.get(feedId).asObservable();
|
|
16
|
+
};
|
|
17
|
+
FeedService.prototype.fetchAllFeeds = function () {
|
|
18
|
+
return this.http.get('/api/feeds/');
|
|
19
|
+
};
|
|
20
|
+
FeedService.prototype.fetchFeed = function (feedId) {
|
|
21
|
+
return this.http.get("/api/feeds/" + feedId);
|
|
22
|
+
};
|
|
23
|
+
FeedService.prototype.fetchService = function (serviceId) {
|
|
24
|
+
return this.http.get("/api/feeds/services/" + serviceId);
|
|
25
|
+
};
|
|
26
|
+
FeedService.prototype.createService = function (service) {
|
|
27
|
+
return this.http.post("/api/feeds/services", service);
|
|
28
|
+
};
|
|
29
|
+
FeedService.prototype.fetchServices = function () {
|
|
30
|
+
return this.http.get("/api/feeds/services");
|
|
31
|
+
};
|
|
32
|
+
FeedService.prototype.fetchServiceFeeds = function (serviceId) {
|
|
33
|
+
return this.http.get("/api/feeds/services/" + serviceId + "/feeds");
|
|
34
|
+
};
|
|
35
|
+
FeedService.prototype.fetchServiceType = function (serviceTypeId) {
|
|
36
|
+
return this.http.get("/api/feeds/service_types/" + serviceTypeId);
|
|
37
|
+
};
|
|
38
|
+
FeedService.prototype.fetchTopics = function (serviceId) {
|
|
39
|
+
return this.http.get("/api/feeds/services/" + serviceId + "/topics");
|
|
40
|
+
};
|
|
41
|
+
FeedService.prototype.previewFeed = function (serviceId, topicId, feedSpec, opts) {
|
|
42
|
+
opts = opts || {};
|
|
43
|
+
var 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
|
+
FeedService.prototype.fetchTopic = function (serviceId, topicId) {
|
|
47
|
+
return this.http.get("/api/feeds/services/" + serviceId + "/topics/" + topicId);
|
|
48
|
+
};
|
|
49
|
+
FeedService.prototype.fetchServiceTypes = function () {
|
|
50
|
+
return this.http.get("/api/feeds/service_types");
|
|
51
|
+
};
|
|
52
|
+
FeedService.prototype.createFeed = function (serviceId, topicId, feedConfiguration) {
|
|
53
|
+
return this.http.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feeds", feedConfiguration);
|
|
54
|
+
};
|
|
55
|
+
FeedService.prototype.updateFeed = function (feed) {
|
|
56
|
+
return this.http.put("/api/feeds/" + feed.id, feed);
|
|
57
|
+
};
|
|
58
|
+
FeedService.prototype.deleteFeed = function (feed) {
|
|
59
|
+
return this.http.delete("/api/feeds/" + feed.id, { responseType: 'text' });
|
|
60
|
+
};
|
|
61
|
+
FeedService.prototype.deleteService = function (service) {
|
|
62
|
+
console.log('delete');
|
|
63
|
+
return this.http.delete("/api/feeds/services/" + service.id, { responseType: 'text' });
|
|
64
|
+
};
|
|
65
|
+
FeedService.prototype.fetchFeeds = function (eventId) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
var subject = new Subject();
|
|
68
|
+
this.http.get("/api/events/" + eventId + "/feeds").subscribe(function (feeds) {
|
|
69
|
+
feeds.map(function (feed) {
|
|
70
|
+
feed.id = feed.id.toString();
|
|
71
|
+
return feed;
|
|
72
|
+
});
|
|
73
|
+
feeds.forEach(function (feed) {
|
|
74
|
+
var 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
|
+
FeedService.prototype.fetchFeedItems = function (event, feed) {
|
|
86
|
+
var feedItems = this._feedItems.get(feed.id);
|
|
87
|
+
return this.http.post("/api/events/" + event.id + "/feeds/" + feed.id + "/content", {}).pipe(map(function (content) {
|
|
88
|
+
var features = content.items.features;
|
|
89
|
+
features.forEach(function (feature) {
|
|
90
|
+
feature.id = String(feature.id);
|
|
91
|
+
feature.properties = feature.properties || {};
|
|
92
|
+
});
|
|
93
|
+
feedItems.next(features);
|
|
94
|
+
return content;
|
|
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
|
+
return FeedService;
|
|
100
|
+
}());
|
|
101
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(FeedService, [{
|
|
102
|
+
type: Injectable,
|
|
103
|
+
args: [{
|
|
104
|
+
providedIn: 'root'
|
|
105
|
+
}]
|
|
106
|
+
}], function () { return [{ type: HttpClient }]; }, null); })();
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Generated bundle index. Do not edit.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
export { FeedService };
|
|
113
|
+
//# 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":";;;;;;IAiBE,qBAAoB,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,+BAAS,GAAT,UAAU,MAAc;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,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