@micropermit/client-angular 0.4.4 → 0.4.5-alpha2
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/{fesm2015/micropermit-client-angular.js → fesm2022/micropermit-client-angular.mjs} +354 -1513
- package/fesm2022/micropermit-client-angular.mjs.map +1 -0
- package/{micropermit-client-angular.d.ts → index.d.ts} +1 -0
- package/lib/components/errorindicator.component.d.ts +3 -0
- package/lib/components/loadingindicator.component.d.ts +3 -0
- package/lib/directives/call-link.directive.d.ts +3 -0
- package/lib/directives/linkfield.directive.d.ts +7 -4
- package/lib/directives/micro-link-validate.directive.d.ts +3 -0
- package/lib/link-field-paging-support.d.ts +1 -1
- package/lib/microclient.module.d.ts +10 -0
- package/lib/microclient.service.d.ts +3 -0
- package/lib/pipes/linkfield.pipe.d.ts +3 -0
- package/package.json +14 -12
- package/bundles/micropermit-client-angular.umd.js +0 -3315
- package/bundles/micropermit-client-angular.umd.js.map +0 -1
- package/bundles/micropermit-client-angular.umd.min.js +0 -16
- package/bundles/micropermit-client-angular.umd.min.js.map +0 -1
- package/esm2015/lib/components/errorindicator.component.js +0 -53
- package/esm2015/lib/components/loadingindicator.component.js +0 -49
- package/esm2015/lib/directives/call-link.directive.js +0 -110
- package/esm2015/lib/directives/linkfield.directive.js +0 -363
- package/esm2015/lib/directives/micro-link-validate.directive.js +0 -141
- package/esm2015/lib/error/microerror.js +0 -27
- package/esm2015/lib/link-field-paging-support.js +0 -318
- package/esm2015/lib/links/callablelink.js +0 -265
- package/esm2015/lib/links/linkfield.js +0 -289
- package/esm2015/lib/links/mock-linkfield.js +0 -42
- package/esm2015/lib/microclient.module.js +0 -54
- package/esm2015/lib/microclient.service.js +0 -515
- package/esm2015/lib/microobject.js +0 -222
- package/esm2015/lib/paramutils.js +0 -176
- package/esm2015/lib/pipes/linkfield.pipe.js +0 -53
- package/esm2015/micropermit-client-angular.js +0 -9
- package/esm2015/public_api.js +0 -23
- package/esm5/lib/components/errorindicator.component.js +0 -36
- package/esm5/lib/components/loadingindicator.component.js +0 -19
- package/esm5/lib/directives/call-link.directive.js +0 -112
- package/esm5/lib/directives/linkfield.directive.js +0 -420
- package/esm5/lib/directives/micro-link-validate.directive.js +0 -152
- package/esm5/lib/error/microerror.js +0 -31
- package/esm5/lib/link-field-paging-support.js +0 -387
- package/esm5/lib/links/callablelink.js +0 -336
- package/esm5/lib/links/linkfield.js +0 -369
- package/esm5/lib/links/mock-linkfield.js +0 -56
- package/esm5/lib/microclient.module.js +0 -61
- package/esm5/lib/microclient.service.js +0 -616
- package/esm5/lib/microobject.js +0 -296
- package/esm5/lib/paramutils.js +0 -228
- package/esm5/lib/pipes/linkfield.pipe.js +0 -60
- package/esm5/micropermit-client-angular.js +0 -9
- package/esm5/public_api.js +0 -23
- package/fesm2015/micropermit-client-angular.js.map +0 -1
- package/fesm5/micropermit-client-angular.js +0 -3116
- package/fesm5/micropermit-client-angular.js.map +0 -1
- package/micropermit-client-angular.metadata.json +0 -1
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, Pipe, Input, Directive, EventEmitter, Output, HostListener, forwardRef, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common/http';
|
|
4
|
+
import { HttpHeaders, provideHttpClient } from '@angular/common/http';
|
|
3
5
|
import { ReplaySubject, defer, throwError, timer, of } from 'rxjs';
|
|
4
6
|
import { take, map, catchError, finalize, switchMap, delay } from 'rxjs/operators';
|
|
5
|
-
import
|
|
7
|
+
import * as _ from 'lodash';
|
|
6
8
|
import { AsyncPipe } from '@angular/common';
|
|
7
9
|
import { FormGroup, NG_ASYNC_VALIDATORS } from '@angular/forms';
|
|
8
10
|
|
|
9
|
-
/**
|
|
10
|
-
* @fileoverview added by tsickle
|
|
11
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
12
|
-
*/
|
|
13
11
|
class ParamUtils {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @return {?}
|
|
20
|
-
*/
|
|
12
|
+
static plusRegex = new RegExp('\\+');
|
|
13
|
+
static slashRegex = new RegExp('/', 'g');
|
|
14
|
+
static multiEqualRegex = new RegExp('=+$', 'g');
|
|
15
|
+
static minusRegex = new RegExp('-', 'g');
|
|
16
|
+
static underscoreRegex = new RegExp('_', 'g');
|
|
21
17
|
static addParam(url, key, value, replaceExisting = true) {
|
|
22
|
-
/** @type {?} */
|
|
23
18
|
const hasQueryParams = url.indexOf('?') >= 0;
|
|
24
19
|
if (!hasQueryParams) {
|
|
25
20
|
url += '?';
|
|
26
21
|
}
|
|
27
|
-
/** @type {?} */
|
|
28
22
|
const existingParam = ParamUtils.getParam(url, key);
|
|
29
23
|
if (existingParam != null && replaceExisting) {
|
|
30
24
|
url = url.replace(key + '=' + existingParam, key + '=' + value);
|
|
@@ -37,17 +31,9 @@ class ParamUtils {
|
|
|
37
31
|
}
|
|
38
32
|
return url;
|
|
39
33
|
}
|
|
40
|
-
/**
|
|
41
|
-
* @param {?} url
|
|
42
|
-
* @param {?} params
|
|
43
|
-
* @return {?}
|
|
44
|
-
*/
|
|
45
34
|
static setParams(url, params) {
|
|
46
|
-
/** @type {?} */
|
|
47
35
|
const splitted = url.split('?');
|
|
48
|
-
/** @type {?} */
|
|
49
36
|
let resURL = splitted[0];
|
|
50
|
-
/** @type {?} */
|
|
51
37
|
let first = true;
|
|
52
38
|
for (const key in params) {
|
|
53
39
|
if (params.hasOwnProperty(key)) {
|
|
@@ -60,26 +46,16 @@ class ParamUtils {
|
|
|
60
46
|
}
|
|
61
47
|
return resURL;
|
|
62
48
|
}
|
|
63
|
-
/**
|
|
64
|
-
* @param {?} url
|
|
65
|
-
* @return {?}
|
|
66
|
-
*/
|
|
67
49
|
static getParams(url) {
|
|
68
|
-
/** @type {?} */
|
|
69
50
|
const splitted = url.split('?');
|
|
70
51
|
if (splitted.length < 2) {
|
|
71
52
|
return {};
|
|
72
53
|
}
|
|
73
|
-
/** @type {?} */
|
|
74
54
|
const queryStr = splitted[1];
|
|
75
|
-
/** @type {?} */
|
|
76
55
|
const params = {};
|
|
77
|
-
/** @type {?} */
|
|
78
56
|
const paramsStrs = queryStr.split('&');
|
|
79
57
|
for (const paramStr of paramsStrs) {
|
|
80
|
-
/** @type {?} */
|
|
81
58
|
const splittedParamStr = paramStr.split('=', 2);
|
|
82
|
-
/** @type {?} */
|
|
83
59
|
const key = splittedParamStr[0];
|
|
84
60
|
if (splittedParamStr.length === 2) {
|
|
85
61
|
params[key] = splittedParamStr[1];
|
|
@@ -90,30 +66,18 @@ class ParamUtils {
|
|
|
90
66
|
}
|
|
91
67
|
return params;
|
|
92
68
|
}
|
|
93
|
-
/**
|
|
94
|
-
* @param {?} toEncode
|
|
95
|
-
* @return {?}
|
|
96
|
-
*/
|
|
97
69
|
static base64UrlEncode(toEncode) {
|
|
98
70
|
return btoa(toEncode)
|
|
99
71
|
.replace(ParamUtils.plusRegex, '-')
|
|
100
72
|
.replace(ParamUtils.slashRegex, '_')
|
|
101
73
|
.replace(ParamUtils.multiEqualRegex, '');
|
|
102
74
|
}
|
|
103
|
-
/**
|
|
104
|
-
* @param {?} toDecode
|
|
105
|
-
* @return {?}
|
|
106
|
-
*/
|
|
107
75
|
static base64UrlDecode(toDecode) {
|
|
108
76
|
toDecode = (toDecode + '===').slice(0, toDecode.length + (toDecode.length % 4));
|
|
109
77
|
return atob(toDecode
|
|
110
78
|
.replace(ParamUtils.minusRegex, '+')
|
|
111
79
|
.replace(ParamUtils.underscoreRegex, '/'));
|
|
112
80
|
}
|
|
113
|
-
/**
|
|
114
|
-
* @param {?} toCheck
|
|
115
|
-
* @return {?}
|
|
116
|
-
*/
|
|
117
81
|
static needsBase64UrlEncoding(toCheck) {
|
|
118
82
|
if (toCheck == null) {
|
|
119
83
|
return false;
|
|
@@ -122,19 +86,10 @@ class ParamUtils {
|
|
|
122
86
|
return typeof toCheck === 'object';
|
|
123
87
|
}
|
|
124
88
|
}
|
|
125
|
-
/**
|
|
126
|
-
* @param {?} url
|
|
127
|
-
* @param {?} name
|
|
128
|
-
* @param {?=} urlDecode
|
|
129
|
-
* @return {?}
|
|
130
|
-
*/
|
|
131
89
|
static getParam(url, name, urlDecode = false) {
|
|
132
|
-
/** @type {?} */
|
|
133
90
|
const paramsQueryIdx = url.indexOf('?');
|
|
134
91
|
url = url.substr(paramsQueryIdx);
|
|
135
|
-
/** @type {?} */
|
|
136
92
|
const regExp = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)'));
|
|
137
|
-
/** @type {?} */
|
|
138
93
|
const match = regExp.exec(url);
|
|
139
94
|
if (match) {
|
|
140
95
|
if (urlDecode && match[1]) {
|
|
@@ -149,97 +104,36 @@ class ParamUtils {
|
|
|
149
104
|
}
|
|
150
105
|
}
|
|
151
106
|
}
|
|
152
|
-
ParamUtils.plusRegex = new RegExp('\\+');
|
|
153
|
-
ParamUtils.slashRegex = new RegExp('/', 'g');
|
|
154
|
-
ParamUtils.multiEqualRegex = new RegExp('=+$', 'g');
|
|
155
|
-
ParamUtils.minusRegex = new RegExp('-', 'g');
|
|
156
|
-
ParamUtils.underscoreRegex = new RegExp('_', 'g');
|
|
157
|
-
if (false) {
|
|
158
|
-
/**
|
|
159
|
-
* @type {?}
|
|
160
|
-
* @private
|
|
161
|
-
*/
|
|
162
|
-
ParamUtils.plusRegex;
|
|
163
|
-
/**
|
|
164
|
-
* @type {?}
|
|
165
|
-
* @private
|
|
166
|
-
*/
|
|
167
|
-
ParamUtils.slashRegex;
|
|
168
|
-
/**
|
|
169
|
-
* @type {?}
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
ParamUtils.multiEqualRegex;
|
|
173
|
-
/**
|
|
174
|
-
* @type {?}
|
|
175
|
-
* @private
|
|
176
|
-
*/
|
|
177
|
-
ParamUtils.minusRegex;
|
|
178
|
-
/**
|
|
179
|
-
* @type {?}
|
|
180
|
-
* @private
|
|
181
|
-
*/
|
|
182
|
-
ParamUtils.underscoreRegex;
|
|
183
|
-
}
|
|
184
107
|
|
|
185
|
-
/**
|
|
186
|
-
* @fileoverview added by tsickle
|
|
187
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
188
|
-
*/
|
|
189
|
-
/**
|
|
190
|
-
* @template T
|
|
191
|
-
*/
|
|
192
108
|
class CallableLink {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @param {?=} requestOptions
|
|
198
|
-
*/
|
|
109
|
+
link;
|
|
110
|
+
microClient;
|
|
111
|
+
callParams;
|
|
112
|
+
requestOptions;
|
|
199
113
|
constructor(link, microClient, callParams = null, requestOptions = null) {
|
|
200
114
|
this.link = link;
|
|
201
115
|
this.microClient = microClient;
|
|
202
116
|
this.callParams = callParams;
|
|
203
117
|
this.requestOptions = requestOptions;
|
|
204
|
-
this.serializeTo = LinkSerializer.DONT_SERIALIZE;
|
|
205
118
|
}
|
|
206
|
-
|
|
207
|
-
* @return {?}
|
|
208
|
-
*/
|
|
119
|
+
serializeTo = LinkSerializer.DONT_SERIALIZE;
|
|
209
120
|
hasLink() {
|
|
210
121
|
return this.link != null;
|
|
211
122
|
}
|
|
212
|
-
/**
|
|
213
|
-
* @return {?}
|
|
214
|
-
*/
|
|
215
123
|
getLink() {
|
|
216
124
|
return this.link;
|
|
217
125
|
}
|
|
218
|
-
/**
|
|
219
|
-
* @param {?} key
|
|
220
|
-
* @param {?=} urlDecode
|
|
221
|
-
* @return {?}
|
|
222
|
-
*/
|
|
223
126
|
getQueryParam(key, urlDecode = false) {
|
|
224
127
|
return ParamUtils.getParam(this.link, key, urlDecode);
|
|
225
128
|
}
|
|
226
|
-
/**
|
|
227
|
-
* @return {?}
|
|
228
|
-
*/
|
|
229
129
|
getSignedParams() {
|
|
230
|
-
/** @type {?} */
|
|
231
130
|
let params = this.getSignedMicroObjectParam('params');
|
|
232
131
|
if (params == null) {
|
|
233
132
|
params = this.getSignedMicroObjectParam('bParams');
|
|
234
133
|
}
|
|
235
134
|
return params;
|
|
236
135
|
}
|
|
237
|
-
/**
|
|
238
|
-
* @param {?=} copy
|
|
239
|
-
* @return {?}
|
|
240
|
-
*/
|
|
241
136
|
getOpenParams(copy = false) {
|
|
242
|
-
/** @type {?} */
|
|
243
137
|
let params = this.getMicroObjectParam('oParams');
|
|
244
138
|
if (params == null) {
|
|
245
139
|
params = this.getMicroObjectParam('bOParams');
|
|
@@ -254,11 +148,7 @@ class CallableLink {
|
|
|
254
148
|
}
|
|
255
149
|
return params;
|
|
256
150
|
}
|
|
257
|
-
/**
|
|
258
|
-
* @return {?}
|
|
259
|
-
*/
|
|
260
151
|
getOptions() {
|
|
261
|
-
/** @type {?} */
|
|
262
152
|
let options = this.getMicroObjectParam('options');
|
|
263
153
|
if (this.requestOptions) {
|
|
264
154
|
if (options == null) {
|
|
@@ -268,18 +158,10 @@ class CallableLink {
|
|
|
268
158
|
}
|
|
269
159
|
return options;
|
|
270
160
|
}
|
|
271
|
-
/**
|
|
272
|
-
* @private
|
|
273
|
-
* @param {?} key
|
|
274
|
-
* @return {?}
|
|
275
|
-
*/
|
|
276
161
|
getSignedMicroObjectParam(key) {
|
|
277
|
-
/** @type {?} */
|
|
278
162
|
const paramsStr = ParamUtils.getParam(this.link, key, false);
|
|
279
|
-
/** @type {?} */
|
|
280
163
|
let params = null;
|
|
281
164
|
if (paramsStr) {
|
|
282
|
-
/** @type {?} */
|
|
283
165
|
const splitted = paramsStr.split('.');
|
|
284
166
|
if (splitted.length !== 3) {
|
|
285
167
|
throw new Error('Expected a signed query param to have a JWT like structure');
|
|
@@ -288,41 +170,20 @@ class CallableLink {
|
|
|
288
170
|
}
|
|
289
171
|
return params;
|
|
290
172
|
}
|
|
291
|
-
/**
|
|
292
|
-
* @param {?} key
|
|
293
|
-
* @return {?}
|
|
294
|
-
*/
|
|
295
173
|
getMicroObjectParam(key) {
|
|
296
|
-
/** @type {?} */
|
|
297
174
|
const paramsStr = ParamUtils.getParam(this.link, key, true);
|
|
298
|
-
/** @type {?} */
|
|
299
175
|
let params = null;
|
|
300
176
|
if (paramsStr) {
|
|
301
177
|
params = MicroObject.fromString(paramsStr, this.microClient);
|
|
302
178
|
}
|
|
303
179
|
return params;
|
|
304
180
|
}
|
|
305
|
-
/**
|
|
306
|
-
* @param {?} onNext
|
|
307
|
-
* @return {?}
|
|
308
|
-
*/
|
|
309
181
|
call(onNext) {
|
|
310
182
|
return this.callWith(null, null, onNext);
|
|
311
183
|
}
|
|
312
|
-
/**
|
|
313
|
-
* @param {?=} params
|
|
314
|
-
* @param {?=} requestOptions
|
|
315
|
-
* @param {?=} onNext
|
|
316
|
-
* @return {?}
|
|
317
|
-
*/
|
|
318
184
|
callWith(params = null, requestOptions = null, onNext) {
|
|
319
|
-
return
|
|
185
|
+
return this.callWithObs(params, requestOptions).toPromise().then(onNext);
|
|
320
186
|
}
|
|
321
|
-
/**
|
|
322
|
-
* @param {?=} params
|
|
323
|
-
* @param {?=} requestOptions
|
|
324
|
-
* @return {?}
|
|
325
|
-
*/
|
|
326
187
|
callWithObs(params = null, requestOptions = null) {
|
|
327
188
|
if (this.link == null) {
|
|
328
189
|
throw Error('Can\'t use callWithObs without a provided link');
|
|
@@ -330,7 +191,6 @@ class CallableLink {
|
|
|
330
191
|
if (this.microClient == null) {
|
|
331
192
|
throw Error('Can\'t use callWithObs without a provided microClient');
|
|
332
193
|
}
|
|
333
|
-
/** @type {?} */
|
|
334
194
|
let paramsToUse = null;
|
|
335
195
|
if (this.callParams != null) {
|
|
336
196
|
paramsToUse = Object.assign(new MicroObject(), this.callParams);
|
|
@@ -341,7 +201,6 @@ class CallableLink {
|
|
|
341
201
|
}
|
|
342
202
|
paramsToUse = Object.assign(paramsToUse, params);
|
|
343
203
|
}
|
|
344
|
-
/** @type {?} */
|
|
345
204
|
let optionsToUse = null;
|
|
346
205
|
if (this.requestOptions != null) {
|
|
347
206
|
optionsToUse = Object.assign(new MicroObject(), this.requestOptions);
|
|
@@ -352,25 +211,14 @@ class CallableLink {
|
|
|
352
211
|
}
|
|
353
212
|
optionsToUse = Object.assign(optionsToUse, requestOptions);
|
|
354
213
|
}
|
|
355
|
-
return
|
|
214
|
+
return this.microClient.load(this.link, paramsToUse, optionsToUse);
|
|
356
215
|
}
|
|
357
|
-
/**
|
|
358
|
-
* @return {?}
|
|
359
|
-
*/
|
|
360
216
|
copy() {
|
|
361
217
|
return new CallableLink(this.link, this.microClient, this.callParams, this.requestOptions);
|
|
362
218
|
}
|
|
363
|
-
/**
|
|
364
|
-
* @param {?} callParams
|
|
365
|
-
* @param {?=} requestOptions
|
|
366
|
-
* @return {?}
|
|
367
|
-
*/
|
|
368
219
|
withCallParams(callParams, requestOptions = this.requestOptions) {
|
|
369
220
|
return new CallableLink(this.link, this.microClient, callParams, requestOptions);
|
|
370
221
|
}
|
|
371
|
-
/**
|
|
372
|
-
* @return {?}
|
|
373
|
-
*/
|
|
374
222
|
toJSON() {
|
|
375
223
|
if (this.serializeTo) {
|
|
376
224
|
return this.serializeTo(this.link, this.callParams, this.requestOptions, undefined, undefined);
|
|
@@ -380,109 +228,39 @@ class CallableLink {
|
|
|
380
228
|
}
|
|
381
229
|
}
|
|
382
230
|
}
|
|
383
|
-
if (false) {
|
|
384
|
-
/** @type {?} */
|
|
385
|
-
CallableLink.prototype.serializeTo;
|
|
386
|
-
/**
|
|
387
|
-
* @type {?}
|
|
388
|
-
* @protected
|
|
389
|
-
*/
|
|
390
|
-
CallableLink.prototype.link;
|
|
391
|
-
/**
|
|
392
|
-
* @type {?}
|
|
393
|
-
* @protected
|
|
394
|
-
*/
|
|
395
|
-
CallableLink.prototype.microClient;
|
|
396
|
-
/**
|
|
397
|
-
* @type {?}
|
|
398
|
-
* @protected
|
|
399
|
-
*/
|
|
400
|
-
CallableLink.prototype.callParams;
|
|
401
|
-
/**
|
|
402
|
-
* @type {?}
|
|
403
|
-
* @protected
|
|
404
|
-
*/
|
|
405
|
-
CallableLink.prototype.requestOptions;
|
|
406
|
-
}
|
|
407
231
|
// @dynamic
|
|
408
232
|
class LinkSerializer {
|
|
409
|
-
|
|
410
|
-
LinkSerializer.DONT_SERIALIZE = (/**
|
|
411
|
-
* @return {?}
|
|
412
|
-
*/
|
|
413
|
-
function () {
|
|
414
|
-
return undefined;
|
|
415
|
-
});
|
|
416
|
-
LinkSerializer.AS_LINK = (/**
|
|
417
|
-
* @param {?} link
|
|
418
|
-
* @return {?}
|
|
419
|
-
*/
|
|
420
|
-
function (link) {
|
|
421
|
-
return link;
|
|
422
|
-
});
|
|
423
|
-
LinkSerializer.AS_VALUE_IF_INITIALIZED = (/**
|
|
424
|
-
* @param {?} link
|
|
425
|
-
* @param {?} callParams
|
|
426
|
-
* @param {?} requestOptions
|
|
427
|
-
* @param {?} value
|
|
428
|
-
* @param {?} isInitialized
|
|
429
|
-
* @return {?}
|
|
430
|
-
*/
|
|
431
|
-
function (link, callParams, requestOptions, value, isInitialized) {
|
|
432
|
-
if (isInitialized) {
|
|
433
|
-
return value;
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
233
|
+
static DONT_SERIALIZE = function () {
|
|
436
234
|
return undefined;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
235
|
+
};
|
|
236
|
+
static AS_LINK = function (link) {
|
|
237
|
+
return link;
|
|
238
|
+
};
|
|
239
|
+
static AS_VALUE_IF_INITIALIZED = function (link, callParams, requestOptions, value, isInitialized) {
|
|
240
|
+
if (isInitialized) {
|
|
241
|
+
return value;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
446
247
|
}
|
|
447
248
|
|
|
448
|
-
/**
|
|
449
|
-
* @fileoverview added by tsickle
|
|
450
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
451
|
-
*/
|
|
452
|
-
/**
|
|
453
|
-
* @template T
|
|
454
|
-
*/
|
|
455
249
|
class LinkField extends CallableLink {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
* @param {?=} callParams
|
|
462
|
-
* @param {?=} requestOptions
|
|
463
|
-
*/
|
|
250
|
+
value;
|
|
251
|
+
initialized = false;
|
|
252
|
+
_getPromise;
|
|
253
|
+
valueSubj;
|
|
254
|
+
serializeTo = LinkSerializer.AS_VALUE_IF_INITIALIZED;
|
|
464
255
|
constructor(link, microClient, initialValue = null, initialized = false, callParams = null, requestOptions = null) {
|
|
465
256
|
super(link, microClient, callParams, requestOptions);
|
|
466
|
-
this.initialized = false;
|
|
467
|
-
this.serializeTo = LinkSerializer.AS_VALUE_IF_INITIALIZED;
|
|
468
|
-
this.intervalId = null;
|
|
469
|
-
this.isRefreshing = false;
|
|
470
257
|
if (initialized) {
|
|
471
258
|
this.set(initialValue);
|
|
472
259
|
}
|
|
473
260
|
}
|
|
474
|
-
/**
|
|
475
|
-
* @template T
|
|
476
|
-
* @param {?} value
|
|
477
|
-
* @return {?}
|
|
478
|
-
*/
|
|
479
261
|
static from(value) {
|
|
480
262
|
return new LinkField(null, null, value, true);
|
|
481
263
|
}
|
|
482
|
-
/**
|
|
483
|
-
* @param {?=} callback
|
|
484
|
-
* @return {?}
|
|
485
|
-
*/
|
|
486
264
|
get(callback) {
|
|
487
265
|
if (callback) {
|
|
488
266
|
this.getObs().subscribe(callback);
|
|
@@ -490,113 +268,70 @@ class LinkField extends CallableLink {
|
|
|
490
268
|
}
|
|
491
269
|
return this.getPromise();
|
|
492
270
|
}
|
|
493
|
-
/**
|
|
494
|
-
* @return {?}
|
|
495
|
-
*/
|
|
496
271
|
getPromise() {
|
|
497
272
|
if (!this._getPromise) {
|
|
498
273
|
this._getPromise = this.getObs().toPromise();
|
|
499
274
|
}
|
|
500
275
|
return this._getPromise;
|
|
501
276
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
* @param {?=} errorHandler
|
|
505
|
-
* @return {?}
|
|
506
|
-
*/
|
|
277
|
+
intervalId = null;
|
|
278
|
+
isRefreshing = false;
|
|
507
279
|
refresh(interval, errorHandler) {
|
|
508
280
|
if (interval) {
|
|
509
281
|
this.stopRefresh();
|
|
510
282
|
}
|
|
511
|
-
|
|
512
|
-
let resCb = (/**
|
|
513
|
-
* @return {?}
|
|
514
|
-
*/
|
|
515
|
-
() => {
|
|
283
|
+
let resCb = () => {
|
|
516
284
|
this.isRefreshing = false;
|
|
517
|
-
}
|
|
285
|
+
};
|
|
518
286
|
this.isRefreshing = true;
|
|
519
|
-
this.initWithObs().subscribe(resCb, (
|
|
520
|
-
* @param {?} error
|
|
521
|
-
* @return {?}
|
|
522
|
-
*/
|
|
523
|
-
(error) => {
|
|
287
|
+
this.initWithObs().subscribe(resCb, (error) => {
|
|
524
288
|
resCb();
|
|
525
289
|
if (errorHandler) {
|
|
526
290
|
errorHandler(error);
|
|
527
291
|
}
|
|
528
|
-
}
|
|
292
|
+
}, resCb);
|
|
529
293
|
if (interval) {
|
|
530
|
-
this.intervalId = setInterval((
|
|
531
|
-
* @return {?}
|
|
532
|
-
*/
|
|
533
|
-
() => {
|
|
294
|
+
this.intervalId = setInterval(() => {
|
|
534
295
|
if (!this.isRefreshing) {
|
|
535
296
|
this.isRefreshing = true;
|
|
536
|
-
this.initWithObs().subscribe(resCb, (
|
|
537
|
-
* @param {?} error
|
|
538
|
-
* @return {?}
|
|
539
|
-
*/
|
|
540
|
-
(error) => {
|
|
297
|
+
this.initWithObs().subscribe(resCb, (error) => {
|
|
541
298
|
resCb();
|
|
542
299
|
if (errorHandler) {
|
|
543
300
|
errorHandler(error);
|
|
544
301
|
}
|
|
545
|
-
}
|
|
302
|
+
}, resCb);
|
|
546
303
|
}
|
|
547
|
-
}
|
|
304
|
+
}, interval);
|
|
548
305
|
}
|
|
549
306
|
}
|
|
550
|
-
/**
|
|
551
|
-
* @return {?}
|
|
552
|
-
*/
|
|
553
307
|
stopRefresh() {
|
|
554
308
|
if (this.intervalId) {
|
|
555
309
|
clearInterval(this.intervalId);
|
|
556
310
|
}
|
|
557
311
|
}
|
|
558
|
-
/**
|
|
559
|
-
* @return {?}
|
|
560
|
-
*/
|
|
561
312
|
listenObs() {
|
|
562
313
|
//TODO handle listeners in case of intermidiate uninitialize (new valueSubj)
|
|
563
314
|
if (this.valueSubj) {
|
|
564
315
|
return this.valueSubj;
|
|
565
316
|
}
|
|
566
317
|
else {
|
|
567
|
-
/** @type {?} */
|
|
568
318
|
let valueSubj = new ReplaySubject(1);
|
|
569
319
|
this.valueSubj = valueSubj;
|
|
570
|
-
return defer((
|
|
571
|
-
|
|
572
|
-
*/
|
|
573
|
-
() => {
|
|
574
|
-
this.initWithObs(null, null).subscribe((/**
|
|
575
|
-
* @param {?} value
|
|
576
|
-
* @return {?}
|
|
577
|
-
*/
|
|
578
|
-
(value) => {
|
|
320
|
+
return defer(() => {
|
|
321
|
+
this.initWithObs(null, null).subscribe((value) => {
|
|
579
322
|
if (this.valueSubj !== valueSubj) {
|
|
580
323
|
valueSubj.next(value);
|
|
581
324
|
valueSubj.complete();
|
|
582
325
|
}
|
|
583
|
-
})
|
|
326
|
+
});
|
|
584
327
|
return valueSubj;
|
|
585
|
-
})
|
|
328
|
+
});
|
|
586
329
|
}
|
|
587
330
|
}
|
|
588
|
-
/**
|
|
589
|
-
* @return {?}
|
|
590
|
-
*/
|
|
591
331
|
getObs() {
|
|
592
332
|
return this.listenObs().pipe(take(1));
|
|
593
333
|
}
|
|
594
|
-
/**
|
|
595
|
-
* @param {?} value
|
|
596
|
-
* @return {?}
|
|
597
|
-
*/
|
|
598
334
|
set(value) {
|
|
599
|
-
/** @type {?} */
|
|
600
335
|
const oldValue = this.value;
|
|
601
336
|
this.value = value;
|
|
602
337
|
this.initialized = true;
|
|
@@ -607,75 +342,38 @@ class LinkField extends CallableLink {
|
|
|
607
342
|
this._getPromise = null;
|
|
608
343
|
return oldValue;
|
|
609
344
|
}
|
|
610
|
-
/**
|
|
611
|
-
* @return {?}
|
|
612
|
-
*/
|
|
613
345
|
isInitialized() {
|
|
614
346
|
return this.initialized;
|
|
615
347
|
}
|
|
616
|
-
/**
|
|
617
|
-
* @return {?}
|
|
618
|
-
*/
|
|
619
348
|
uninitialize() {
|
|
620
349
|
this.value = null;
|
|
621
350
|
this.initialized = false;
|
|
622
351
|
this.valueSubj = null;
|
|
623
352
|
this._getPromise = null;
|
|
624
353
|
}
|
|
625
|
-
/**
|
|
626
|
-
* @return {?}
|
|
627
|
-
*/
|
|
628
354
|
copyUninitialized() {
|
|
629
|
-
/** @type {?} */
|
|
630
355
|
let copy = this.copy();
|
|
631
356
|
copy.uninitialize();
|
|
632
357
|
return copy;
|
|
633
358
|
}
|
|
634
|
-
/**
|
|
635
|
-
* @return {?}
|
|
636
|
-
*/
|
|
637
359
|
getInitializedValue() {
|
|
638
360
|
if (!this.isInitialized()) {
|
|
639
361
|
throw new Error('Can\'t get the intialized value for a LinkField that hasn\'t been initialized');
|
|
640
362
|
}
|
|
641
363
|
return this.value;
|
|
642
364
|
}
|
|
643
|
-
/**
|
|
644
|
-
* @param {?=} parms
|
|
645
|
-
* @param {?=} requestOptions
|
|
646
|
-
* @param {?=} callback
|
|
647
|
-
* @return {?}
|
|
648
|
-
*/
|
|
649
365
|
initWith(parms = null, requestOptions = null, callback) {
|
|
650
366
|
this.initWithObs(parms, requestOptions).subscribe(callback);
|
|
651
367
|
}
|
|
652
|
-
/**
|
|
653
|
-
* @param {?=} params
|
|
654
|
-
* @param {?=} requestOptions
|
|
655
|
-
* @return {?}
|
|
656
|
-
*/
|
|
657
368
|
initWithObs(params = null, requestOptions = null) {
|
|
658
|
-
return this.callWithObs(params, requestOptions).pipe(map((
|
|
659
|
-
|
|
660
|
-
* @return {?}
|
|
661
|
-
*/
|
|
662
|
-
(value) => {
|
|
663
|
-
this.set((/** @type {?} */ (value)));
|
|
369
|
+
return this.callWithObs(params, requestOptions).pipe(map((value) => {
|
|
370
|
+
this.set(value);
|
|
664
371
|
return value;
|
|
665
|
-
}))
|
|
372
|
+
}));
|
|
666
373
|
}
|
|
667
|
-
/**
|
|
668
|
-
* @param {?} callParams
|
|
669
|
-
* @param {?=} requestOptions
|
|
670
|
-
* @return {?}
|
|
671
|
-
*/
|
|
672
374
|
withCallParams(callParams, requestOptions = this.requestOptions) {
|
|
673
375
|
return new LinkField(this.link, this.microClient, this.value, this.initialized, callParams, requestOptions);
|
|
674
376
|
}
|
|
675
|
-
/**
|
|
676
|
-
* @param {?=} withValue
|
|
677
|
-
* @return {?}
|
|
678
|
-
*/
|
|
679
377
|
copy(withValue) {
|
|
680
378
|
if (withValue === undefined) {
|
|
681
379
|
return new LinkField(this.link, this.microClient, this.value, this.initialized, this.callParams, this.requestOptions);
|
|
@@ -684,9 +382,6 @@ class LinkField extends CallableLink {
|
|
|
684
382
|
return new LinkField(this.link, this.microClient, withValue, true, this.callParams, this.requestOptions);
|
|
685
383
|
}
|
|
686
384
|
}
|
|
687
|
-
/**
|
|
688
|
-
* @return {?}
|
|
689
|
-
*/
|
|
690
385
|
toJSON() {
|
|
691
386
|
if (this.serializeTo) {
|
|
692
387
|
return this.serializeTo(this.link, this.callParams, this.requestOptions, this.value, this.isInitialized());
|
|
@@ -696,101 +391,33 @@ class LinkField extends CallableLink {
|
|
|
696
391
|
}
|
|
697
392
|
}
|
|
698
393
|
}
|
|
699
|
-
if (false) {
|
|
700
|
-
/**
|
|
701
|
-
* @type {?}
|
|
702
|
-
* @private
|
|
703
|
-
*/
|
|
704
|
-
LinkField.prototype.value;
|
|
705
|
-
/**
|
|
706
|
-
* @type {?}
|
|
707
|
-
* @private
|
|
708
|
-
*/
|
|
709
|
-
LinkField.prototype.initialized;
|
|
710
|
-
/**
|
|
711
|
-
* @type {?}
|
|
712
|
-
* @private
|
|
713
|
-
*/
|
|
714
|
-
LinkField.prototype._getPromise;
|
|
715
|
-
/**
|
|
716
|
-
* @type {?}
|
|
717
|
-
* @private
|
|
718
|
-
*/
|
|
719
|
-
LinkField.prototype.valueSubj;
|
|
720
|
-
/** @type {?} */
|
|
721
|
-
LinkField.prototype.serializeTo;
|
|
722
|
-
/**
|
|
723
|
-
* @type {?}
|
|
724
|
-
* @private
|
|
725
|
-
*/
|
|
726
|
-
LinkField.prototype.intervalId;
|
|
727
|
-
/**
|
|
728
|
-
* @type {?}
|
|
729
|
-
* @private
|
|
730
|
-
*/
|
|
731
|
-
LinkField.prototype.isRefreshing;
|
|
732
|
-
}
|
|
733
394
|
|
|
734
|
-
/**
|
|
735
|
-
* @fileoverview added by tsickle
|
|
736
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
737
|
-
*/
|
|
738
|
-
// WARNING: interface has both a type and a value, skipping emit
|
|
739
395
|
class MicroObject {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* @template T
|
|
745
|
-
* @param {?} toCopy
|
|
746
|
-
* @param {?=} client
|
|
747
|
-
* @return {?}
|
|
748
|
-
*/
|
|
396
|
+
static META_KEY = '__meta';
|
|
397
|
+
__meta = undefined;
|
|
749
398
|
static deepCopy(toCopy, client) {
|
|
750
|
-
return
|
|
399
|
+
return _.cloneDeepWith(toCopy, MicroObject.deepCopyCustomizer);
|
|
751
400
|
}
|
|
752
|
-
/**
|
|
753
|
-
* @private
|
|
754
|
-
* @param {?} value
|
|
755
|
-
* @return {?}
|
|
756
|
-
*/
|
|
757
401
|
static deepCopyCustomizer(value) {
|
|
758
402
|
if (value instanceof MicroClient) {
|
|
759
403
|
return value;
|
|
760
404
|
}
|
|
761
405
|
return undefined;
|
|
762
406
|
}
|
|
763
|
-
/**
|
|
764
|
-
* @template T
|
|
765
|
-
* @param {?} str
|
|
766
|
-
* @param {?} client
|
|
767
|
-
* @param {?=} prototype
|
|
768
|
-
* @return {?}
|
|
769
|
-
*/
|
|
770
407
|
static fromString(str, client, prototype = null) {
|
|
771
|
-
/** @type {?} */
|
|
772
408
|
const obj = JSON.parse(str);
|
|
773
409
|
return this.fromObject(obj, client, prototype);
|
|
774
410
|
}
|
|
775
|
-
/**
|
|
776
|
-
* @template T
|
|
777
|
-
* @param {?} obj
|
|
778
|
-
* @param {?} client
|
|
779
|
-
* @param {?=} prototype
|
|
780
|
-
* @return {?}
|
|
781
|
-
*/
|
|
782
411
|
static fromObject(obj, client, prototype = null) {
|
|
783
412
|
if (obj === null) {
|
|
784
413
|
return null;
|
|
785
414
|
}
|
|
786
415
|
if (Array.isArray(obj)) {
|
|
787
|
-
/** @type {?} */
|
|
788
416
|
const objArr = obj;
|
|
789
417
|
for (let i = 0; i < objArr.length; i++) {
|
|
790
|
-
/** @type {?} */
|
|
791
418
|
const elem = objArr[i];
|
|
792
419
|
if (typeof elem === 'object') {
|
|
793
|
-
objArr[i] =
|
|
420
|
+
objArr[i] = MicroObject.fromObject(elem, client, prototype);
|
|
794
421
|
}
|
|
795
422
|
}
|
|
796
423
|
return objArr;
|
|
@@ -798,7 +425,6 @@ class MicroObject {
|
|
|
798
425
|
else {
|
|
799
426
|
for (const field in obj) {
|
|
800
427
|
if (field !== MicroObject.META_KEY && obj.hasOwnProperty(field)) {
|
|
801
|
-
/** @type {?} */
|
|
802
428
|
const fieldValue = obj[field];
|
|
803
429
|
if (fieldValue) {
|
|
804
430
|
if (fieldValue instanceof Object || Array.isArray(fieldValue)) {
|
|
@@ -807,25 +433,15 @@ class MicroObject {
|
|
|
807
433
|
}
|
|
808
434
|
}
|
|
809
435
|
}
|
|
810
|
-
/** @type {?} */
|
|
811
436
|
const src = prototype == null ? MicroObject.prototype : prototype;
|
|
812
|
-
/** @type {?} */
|
|
813
437
|
const microObject = Object.assign(Object.create(src), obj);
|
|
814
438
|
MicroObject.attachMetadataObject(microObject, client);
|
|
815
|
-
return
|
|
439
|
+
return microObject;
|
|
816
440
|
}
|
|
817
441
|
}
|
|
818
|
-
/**
|
|
819
|
-
* @private
|
|
820
|
-
* @param {?} microObject
|
|
821
|
-
* @param {?} client
|
|
822
|
-
* @return {?}
|
|
823
|
-
*/
|
|
824
442
|
static attachMetadataObject(microObject, client) {
|
|
825
|
-
/** @type {?} */
|
|
826
443
|
const rawMeta = microObject != null ? microObject[MicroObject.META_KEY] : null;
|
|
827
444
|
if (rawMeta != null) {
|
|
828
|
-
/** @type {?} */
|
|
829
445
|
let clientToUse = client;
|
|
830
446
|
if (rawMeta.permitToken) {
|
|
831
447
|
if (client.getEntryPoint() != null) {
|
|
@@ -840,83 +456,38 @@ class MicroObject {
|
|
|
840
456
|
return null;
|
|
841
457
|
}
|
|
842
458
|
}
|
|
843
|
-
/**
|
|
844
|
-
* @private
|
|
845
|
-
* @param {?} meta
|
|
846
|
-
* @param {?} microObject
|
|
847
|
-
* @param {?} client
|
|
848
|
-
* @return {?}
|
|
849
|
-
*/
|
|
850
459
|
static attachLinkFields(meta, microObject, client) {
|
|
851
|
-
meta.forEachLink((
|
|
852
|
-
* @param {?} linkName
|
|
853
|
-
* @param {?} linkUrl
|
|
854
|
-
* @return {?}
|
|
855
|
-
*/
|
|
856
|
-
(linkName, linkUrl) => {
|
|
857
|
-
/** @type {?} */
|
|
460
|
+
meta.forEachLink((linkName, linkUrl) => {
|
|
858
461
|
const value = microObject[linkName];
|
|
859
462
|
microObject[linkName] = new LinkField(linkUrl, client, value, value !== undefined);
|
|
860
|
-
})
|
|
463
|
+
});
|
|
861
464
|
}
|
|
862
|
-
/**
|
|
863
|
-
* @private
|
|
864
|
-
* @param {?} meta
|
|
865
|
-
* @param {?} microObject
|
|
866
|
-
* @param {?} client
|
|
867
|
-
* @return {?}
|
|
868
|
-
*/
|
|
869
465
|
static attachCallableLinks(meta, microObject, client) {
|
|
870
|
-
meta.forEachAction((
|
|
871
|
-
* @param {?} linkName
|
|
872
|
-
* @param {?} linkUrl
|
|
873
|
-
* @return {?}
|
|
874
|
-
*/
|
|
875
|
-
(linkName, linkUrl) => {
|
|
466
|
+
meta.forEachAction((linkName, linkUrl) => {
|
|
876
467
|
microObject[linkName] = new CallableLink(linkUrl, client);
|
|
877
|
-
})
|
|
468
|
+
});
|
|
878
469
|
}
|
|
879
470
|
}
|
|
880
|
-
MicroObject.META_KEY = '__meta';
|
|
881
|
-
if (false) {
|
|
882
|
-
/** @type {?} */
|
|
883
|
-
MicroObject.META_KEY;
|
|
884
|
-
/** @type {?} */
|
|
885
|
-
MicroObject.prototype.__meta;
|
|
886
|
-
}
|
|
887
471
|
class MicroObjectMetadata {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
472
|
+
links;
|
|
473
|
+
actions;
|
|
474
|
+
permitToken;
|
|
475
|
+
nextPage;
|
|
476
|
+
error;
|
|
893
477
|
static fromObject(obj, client) {
|
|
894
|
-
/** @type {?} */
|
|
895
478
|
const objMetadata = Object.assign(new MicroObjectMetadata(), obj);
|
|
896
479
|
if (objMetadata.nextPage != null) {
|
|
897
|
-
objMetadata.nextPage = new LinkField(
|
|
480
|
+
objMetadata.nextPage = new LinkField(objMetadata.nextPage, client);
|
|
898
481
|
objMetadata.nextPage.serializeTo = LinkSerializer.AS_LINK;
|
|
899
482
|
}
|
|
900
483
|
return objMetadata;
|
|
901
484
|
}
|
|
902
|
-
/**
|
|
903
|
-
* @param {?} key
|
|
904
|
-
* @return {?}
|
|
905
|
-
*/
|
|
906
485
|
getLinkUrl(key) {
|
|
907
486
|
return this.links[key];
|
|
908
487
|
}
|
|
909
|
-
/**
|
|
910
|
-
* @param {?} key
|
|
911
|
-
* @return {?}
|
|
912
|
-
*/
|
|
913
488
|
hasLink(key) {
|
|
914
489
|
return this.links[key] != null;
|
|
915
490
|
}
|
|
916
|
-
/**
|
|
917
|
-
* @param {?} op
|
|
918
|
-
* @return {?}
|
|
919
|
-
*/
|
|
920
491
|
forEachLink(op) {
|
|
921
492
|
for (const link in this.links) {
|
|
922
493
|
if (this.links.hasOwnProperty(link)) {
|
|
@@ -924,10 +495,6 @@ class MicroObjectMetadata {
|
|
|
924
495
|
}
|
|
925
496
|
}
|
|
926
497
|
}
|
|
927
|
-
/**
|
|
928
|
-
* @param {?} op
|
|
929
|
-
* @return {?}
|
|
930
|
-
*/
|
|
931
498
|
forEachAction(op) {
|
|
932
499
|
for (const link in this.actions) {
|
|
933
500
|
if (this.actions.hasOwnProperty(link)) {
|
|
@@ -936,93 +503,46 @@ class MicroObjectMetadata {
|
|
|
936
503
|
}
|
|
937
504
|
}
|
|
938
505
|
}
|
|
939
|
-
if (false) {
|
|
940
|
-
/** @type {?} */
|
|
941
|
-
MicroObjectMetadata.prototype.links;
|
|
942
|
-
/** @type {?} */
|
|
943
|
-
MicroObjectMetadata.prototype.actions;
|
|
944
|
-
/** @type {?} */
|
|
945
|
-
MicroObjectMetadata.prototype.permitToken;
|
|
946
|
-
/** @type {?} */
|
|
947
|
-
MicroObjectMetadata.prototype.nextPage;
|
|
948
|
-
/** @type {?} */
|
|
949
|
-
MicroObjectMetadata.prototype.error;
|
|
950
|
-
}
|
|
951
506
|
|
|
952
|
-
/**
|
|
953
|
-
* @fileoverview added by tsickle
|
|
954
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
955
|
-
*/
|
|
956
507
|
class MicroError {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
MicroError.prototype.atEndpoint;
|
|
967
|
-
/** @type {?} */
|
|
968
|
-
MicroError.prototype.instanceID;
|
|
969
|
-
/** @type {?} */
|
|
970
|
-
MicroError.prototype.httpEquivCode;
|
|
971
|
-
/** @type {?} */
|
|
972
|
-
MicroError.prototype.cause;
|
|
973
|
-
/** @type {?} */
|
|
974
|
-
MicroError.prototype.errorID;
|
|
975
|
-
/** @type {?} */
|
|
976
|
-
MicroError.prototype.errorType;
|
|
508
|
+
timestamp;
|
|
509
|
+
errorMessage;
|
|
510
|
+
atService;
|
|
511
|
+
atEndpoint;
|
|
512
|
+
instanceID;
|
|
513
|
+
httpEquivCode;
|
|
514
|
+
cause;
|
|
515
|
+
errorID;
|
|
516
|
+
errorType;
|
|
977
517
|
}
|
|
978
518
|
|
|
979
|
-
/**
|
|
980
|
-
* @fileoverview added by tsickle
|
|
981
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
982
|
-
*/
|
|
983
519
|
class MicroClient {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
520
|
+
httpClient;
|
|
521
|
+
authHeader;
|
|
522
|
+
permitToken;
|
|
523
|
+
entryPoint;
|
|
524
|
+
entryPointSubject = new ReplaySubject();
|
|
525
|
+
urlRewriter;
|
|
526
|
+
defaultErrorHandler;
|
|
527
|
+
usePost = true;
|
|
528
|
+
sendAsPermitTokenHeader = true;
|
|
529
|
+
sendAsMultipartFormData = false;
|
|
987
530
|
constructor(httpClient) {
|
|
988
531
|
this.httpClient = httpClient;
|
|
989
|
-
|
|
990
|
-
this.usePost = true;
|
|
991
|
-
this.sendAsPermitTokenHeader = true;
|
|
992
|
-
this.sendAsMultipartFormData = false;
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* @param {?} sendAsPermitTokenHeader
|
|
996
|
-
* @return {?}
|
|
997
|
-
*/
|
|
532
|
+
}
|
|
998
533
|
setSendAsPermitTokenHeader(sendAsPermitTokenHeader) {
|
|
999
534
|
this.sendAsPermitTokenHeader = sendAsPermitTokenHeader;
|
|
1000
535
|
}
|
|
1001
|
-
/**
|
|
1002
|
-
* @param {?} token
|
|
1003
|
-
* @return {?}
|
|
1004
|
-
*/
|
|
1005
536
|
setAuthToken(token) {
|
|
1006
537
|
this.authHeader = 'Bearer ' + token;
|
|
1007
538
|
this.permitToken = token;
|
|
1008
539
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* @param {?} authHeader
|
|
1011
|
-
* @return {?}
|
|
1012
|
-
*/
|
|
1013
540
|
setAuthHeader(authHeader) {
|
|
1014
541
|
this.authHeader = authHeader;
|
|
1015
542
|
}
|
|
1016
|
-
/**
|
|
1017
|
-
* @return {?}
|
|
1018
|
-
*/
|
|
1019
543
|
getEntryPoint() {
|
|
1020
544
|
return this.entryPoint;
|
|
1021
545
|
}
|
|
1022
|
-
/**
|
|
1023
|
-
* @param {?=} cb
|
|
1024
|
-
* @return {?}
|
|
1025
|
-
*/
|
|
1026
546
|
waitForEntryPoint(cb) {
|
|
1027
547
|
if (cb != null) {
|
|
1028
548
|
this.entryPointSubject.subscribe(cb);
|
|
@@ -1030,20 +550,11 @@ class MicroClient {
|
|
|
1030
550
|
}
|
|
1031
551
|
return this.entryPointSubject.toPromise();
|
|
1032
552
|
}
|
|
1033
|
-
/**
|
|
1034
|
-
* @param {?} other
|
|
1035
|
-
* @return {?}
|
|
1036
|
-
*/
|
|
1037
553
|
copyAuthAndEntrypointOf(other) {
|
|
1038
554
|
this.authHeader = other.authHeader;
|
|
1039
555
|
this.permitToken = other.permitToken;
|
|
1040
556
|
this.entryPoint = other.entryPoint;
|
|
1041
557
|
}
|
|
1042
|
-
/**
|
|
1043
|
-
* @template T
|
|
1044
|
-
* @param {?} entryPoint
|
|
1045
|
-
* @return {?}
|
|
1046
|
-
*/
|
|
1047
558
|
setEntryPoint(entryPoint) {
|
|
1048
559
|
if (entryPoint == null) {
|
|
1049
560
|
this.authHeader = null;
|
|
@@ -1061,24 +572,14 @@ class MicroClient {
|
|
|
1061
572
|
this.entryPointSubject.next(entryPoint);
|
|
1062
573
|
}
|
|
1063
574
|
}
|
|
1064
|
-
/**
|
|
1065
|
-
* @param {?} handler
|
|
1066
|
-
* @return {?}
|
|
1067
|
-
*/
|
|
1068
575
|
setDefaultErrorHandler(handler) {
|
|
1069
576
|
this.defaultErrorHandler = handler;
|
|
1070
577
|
}
|
|
1071
|
-
/**
|
|
1072
|
-
* @param {?} httpErr
|
|
1073
|
-
* @return {?}
|
|
1074
|
-
*/
|
|
1075
578
|
handleError(httpErr) {
|
|
1076
579
|
if (this.defaultErrorHandler) {
|
|
1077
|
-
/** @type {?} */
|
|
1078
580
|
const microError = MicroClient.toMicroError(httpErr);
|
|
1079
581
|
if (microError) {
|
|
1080
|
-
|
|
1081
|
-
const microResultObj = (/** @type {?} */ (MicroObject.fromObject(httpErr.error, this)));
|
|
582
|
+
const microResultObj = MicroObject.fromObject(httpErr.error, this);
|
|
1082
583
|
this.defaultErrorHandler(httpErr, microResultObj);
|
|
1083
584
|
}
|
|
1084
585
|
else {
|
|
@@ -1086,19 +587,10 @@ class MicroClient {
|
|
|
1086
587
|
}
|
|
1087
588
|
}
|
|
1088
589
|
}
|
|
1089
|
-
/**
|
|
1090
|
-
* @template T
|
|
1091
|
-
* @param {?} url
|
|
1092
|
-
* @param {?=} username
|
|
1093
|
-
* @param {?=} password
|
|
1094
|
-
* @param {?=} headers
|
|
1095
|
-
* @return {?}
|
|
1096
|
-
*/
|
|
1097
590
|
ignite(url, username = null, password = null, headers = {}) {
|
|
1098
591
|
if (this.urlRewriter) {
|
|
1099
592
|
url = this.urlRewriter(url);
|
|
1100
593
|
}
|
|
1101
|
-
/** @type {?} */
|
|
1102
594
|
let requestHeaders = new HttpHeaders();
|
|
1103
595
|
for (const headerKey in headers) {
|
|
1104
596
|
if (headers.hasOwnProperty(headerKey)) {
|
|
@@ -1110,26 +602,13 @@ class MicroClient {
|
|
|
1110
602
|
}
|
|
1111
603
|
return this.httpClient.get(url, {
|
|
1112
604
|
headers: requestHeaders
|
|
1113
|
-
}).pipe(map(
|
|
1114
|
-
* @param {?} val
|
|
1115
|
-
* @return {?}
|
|
1116
|
-
*/
|
|
1117
|
-
val => {
|
|
1118
|
-
/** @type {?} */
|
|
605
|
+
}).pipe(map(val => {
|
|
1119
606
|
const entryPoint = MicroObject.fromObject(val, this);
|
|
1120
607
|
this.setEntryPoint(entryPoint);
|
|
1121
|
-
return
|
|
1122
|
-
})
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* @template T
|
|
1126
|
-
* @param {?} url
|
|
1127
|
-
* @param {?=} params
|
|
1128
|
-
* @param {?=} requestOptions
|
|
1129
|
-
* @return {?}
|
|
1130
|
-
*/
|
|
608
|
+
return entryPoint;
|
|
609
|
+
}), this.catchAndHandleError());
|
|
610
|
+
}
|
|
1131
611
|
load(url, params, requestOptions) {
|
|
1132
|
-
/** @type {?} */
|
|
1133
612
|
let requestHeaders = new HttpHeaders();
|
|
1134
613
|
if (this.authHeader) {
|
|
1135
614
|
requestHeaders = requestHeaders.set('Authorization', this.authHeader);
|
|
@@ -1137,12 +616,9 @@ class MicroClient {
|
|
|
1137
616
|
requestHeaders = requestHeaders.set('MicroPermitToken', this.permitToken);
|
|
1138
617
|
}
|
|
1139
618
|
}
|
|
1140
|
-
/** @type {?} */
|
|
1141
619
|
let oParams = params;
|
|
1142
620
|
if (params != null || this.usePost) {
|
|
1143
|
-
/** @type {?} */
|
|
1144
621
|
const existingParamsStr = ParamUtils.getParam(url, 'oParams', true);
|
|
1145
|
-
/** @type {?} */
|
|
1146
622
|
let existingParams;
|
|
1147
623
|
if (existingParamsStr) {
|
|
1148
624
|
existingParams = JSON.parse(existingParamsStr);
|
|
@@ -1152,10 +628,8 @@ class MicroClient {
|
|
|
1152
628
|
}
|
|
1153
629
|
oParams = Object.assign(existingParams, params);
|
|
1154
630
|
}
|
|
1155
|
-
/** @type {?} */
|
|
1156
631
|
let options = requestOptions;
|
|
1157
632
|
if (requestOptions != null || this.usePost) {
|
|
1158
|
-
/** @type {?} */
|
|
1159
633
|
const prevOptionsStr = ParamUtils.getParam(url, 'options', true);
|
|
1160
634
|
if (prevOptionsStr) {
|
|
1161
635
|
options = JSON.parse(prevOptionsStr);
|
|
@@ -1165,19 +639,14 @@ class MicroClient {
|
|
|
1165
639
|
}
|
|
1166
640
|
options = Object.assign(options, requestOptions);
|
|
1167
641
|
}
|
|
1168
|
-
/** @type {?} */
|
|
1169
642
|
const queryParams = ParamUtils.getParams(url);
|
|
1170
|
-
/** @type {?} */
|
|
1171
643
|
let httpObs = null;
|
|
1172
644
|
if (this.usePost) {
|
|
1173
|
-
/** @type {?} */
|
|
1174
645
|
let bOParams;
|
|
1175
|
-
/** @type {?} */
|
|
1176
646
|
const encBOParams = queryParams['bOParams'];
|
|
1177
647
|
if (encBOParams) {
|
|
1178
648
|
bOParams = JSON.parse(ParamUtils.base64UrlDecode(encBOParams));
|
|
1179
649
|
}
|
|
1180
|
-
/** @type {?} */
|
|
1181
650
|
const body = {
|
|
1182
651
|
params: queryParams['params'],
|
|
1183
652
|
oParams: oParams,
|
|
@@ -1213,25 +682,14 @@ class MicroClient {
|
|
|
1213
682
|
headers: requestHeaders
|
|
1214
683
|
});
|
|
1215
684
|
}
|
|
1216
|
-
httpObs = httpObs.pipe(map(
|
|
1217
|
-
* @param {?} val
|
|
1218
|
-
* @return {?}
|
|
1219
|
-
*/
|
|
1220
|
-
val => {
|
|
685
|
+
httpObs = httpObs.pipe(map(val => {
|
|
1221
686
|
return MicroObject.fromObject(val, this);
|
|
1222
|
-
})
|
|
687
|
+
}), this.catchAndHandleError());
|
|
1223
688
|
return httpObs;
|
|
1224
689
|
}
|
|
1225
|
-
/**
|
|
1226
|
-
* @private
|
|
1227
|
-
* @param {?} body
|
|
1228
|
-
* @return {?}
|
|
1229
|
-
*/
|
|
1230
690
|
encodeBody(body) {
|
|
1231
691
|
if (this.sendAsMultipartFormData) {
|
|
1232
|
-
/** @type {?} */
|
|
1233
692
|
let formData = new FormData();
|
|
1234
|
-
/** @type {?} */
|
|
1235
693
|
let paramBlob = new Blob([JSON.stringify(body)], { type: "application/json" });
|
|
1236
694
|
formData.append('*', paramBlob);
|
|
1237
695
|
return formData;
|
|
@@ -1240,48 +698,22 @@ class MicroClient {
|
|
|
1240
698
|
return body;
|
|
1241
699
|
}
|
|
1242
700
|
}
|
|
1243
|
-
/**
|
|
1244
|
-
* @private
|
|
1245
|
-
* @template T
|
|
1246
|
-
* @return {?}
|
|
1247
|
-
*/
|
|
1248
701
|
catchAndHandleError() {
|
|
1249
|
-
return (
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
*/
|
|
1253
|
-
(source) => {
|
|
1254
|
-
return source.pipe(catchError((/**
|
|
1255
|
-
* @param {?} err
|
|
1256
|
-
* @return {?}
|
|
1257
|
-
*/
|
|
1258
|
-
err => {
|
|
1259
|
-
/** @type {?} */
|
|
1260
|
-
let loadError = new MicroClientLoadError(err, (/**
|
|
1261
|
-
* @param {?} errToHandle
|
|
1262
|
-
* @return {?}
|
|
1263
|
-
*/
|
|
1264
|
-
(errToHandle) => {
|
|
702
|
+
return (source) => {
|
|
703
|
+
return source.pipe(catchError(err => {
|
|
704
|
+
let loadError = new MicroClientLoadError(err, (errToHandle) => {
|
|
1265
705
|
this.handleError(errToHandle);
|
|
1266
|
-
})
|
|
1267
|
-
return throwError(loadError).pipe(finalize((
|
|
1268
|
-
* @return {?}
|
|
1269
|
-
*/
|
|
1270
|
-
() => {
|
|
706
|
+
});
|
|
707
|
+
return throwError(loadError).pipe(finalize(() => {
|
|
1271
708
|
if (!loadError.shouldPreventDefault()) {
|
|
1272
709
|
loadError.handleDefault();
|
|
1273
710
|
}
|
|
1274
|
-
}))
|
|
1275
|
-
}))
|
|
1276
|
-
}
|
|
711
|
+
}));
|
|
712
|
+
}));
|
|
713
|
+
};
|
|
1277
714
|
}
|
|
1278
|
-
/**
|
|
1279
|
-
* @param {?} entryPoint
|
|
1280
|
-
* @return {?}
|
|
1281
|
-
*/
|
|
1282
715
|
createChildClientForEntryPoint(entryPoint) {
|
|
1283
716
|
if (entryPoint.__meta && entryPoint.__meta.permitToken) {
|
|
1284
|
-
/** @type {?} */
|
|
1285
717
|
const childClient = Object.create(this, {
|
|
1286
718
|
entryPoint: {
|
|
1287
719
|
configurable: true,
|
|
@@ -1306,30 +738,18 @@ class MicroClient {
|
|
|
1306
738
|
throw new Error('The supplied value can\'t be used to construct a child MicroClient because it doesn\'t contain metadata with a permitToken ');
|
|
1307
739
|
}
|
|
1308
740
|
}
|
|
1309
|
-
/**
|
|
1310
|
-
* @param {?} rewriter
|
|
1311
|
-
* @return {?}
|
|
1312
|
-
*/
|
|
1313
741
|
setURLRewriter(rewriter) {
|
|
1314
742
|
this.urlRewriter = rewriter;
|
|
1315
743
|
}
|
|
1316
|
-
/**
|
|
1317
|
-
* @param {?} httpResponse
|
|
1318
|
-
* @return {?}
|
|
1319
|
-
*/
|
|
1320
744
|
static toMicroError(httpResponse) {
|
|
1321
|
-
/** @type {?} */
|
|
1322
745
|
const res = httpResponse.error;
|
|
1323
746
|
if (res && res.__meta && res.__meta.error) {
|
|
1324
747
|
return Object.assign(new MicroError(), res.__meta.error);
|
|
1325
748
|
}
|
|
1326
749
|
return null;
|
|
1327
750
|
}
|
|
1328
|
-
|
|
1329
|
-
* @return {?}
|
|
1330
|
-
*/
|
|
751
|
+
static staticContentRegExp = new RegExp('[a-zA-Z0-9]://.*(:[0-9]+)?(/.*)*/static(/.*(\\?.*)?(#.*)?)?');
|
|
1331
752
|
static guessMicroComponentBaseURL() {
|
|
1332
|
-
/** @type {?} */
|
|
1333
753
|
const href = window.location.href;
|
|
1334
754
|
// Last URL-Segement is static
|
|
1335
755
|
if (MicroClient.staticContentRegExp.test(href)) {
|
|
@@ -1345,215 +765,73 @@ class MicroClient {
|
|
|
1345
765
|
}
|
|
1346
766
|
}
|
|
1347
767
|
}
|
|
1348
|
-
/**
|
|
1349
|
-
* @return {?}
|
|
1350
|
-
*/
|
|
1351
768
|
static guessMicroComponentAuthorizeURL() {
|
|
1352
769
|
return this.guessMicroComponentBaseURL() + '/authorize';
|
|
1353
770
|
}
|
|
771
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClient, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
772
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClient });
|
|
1354
773
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
];
|
|
1359
|
-
/** @nocollapse */
|
|
1360
|
-
MicroClient.ctorParameters = () => [
|
|
1361
|
-
{ type: HttpClient }
|
|
1362
|
-
];
|
|
1363
|
-
if (false) {
|
|
1364
|
-
/**
|
|
1365
|
-
* @type {?}
|
|
1366
|
-
* @private
|
|
1367
|
-
*/
|
|
1368
|
-
MicroClient.staticContentRegExp;
|
|
1369
|
-
/**
|
|
1370
|
-
* @type {?}
|
|
1371
|
-
* @private
|
|
1372
|
-
*/
|
|
1373
|
-
MicroClient.prototype.authHeader;
|
|
1374
|
-
/**
|
|
1375
|
-
* @type {?}
|
|
1376
|
-
* @private
|
|
1377
|
-
*/
|
|
1378
|
-
MicroClient.prototype.permitToken;
|
|
1379
|
-
/**
|
|
1380
|
-
* @type {?}
|
|
1381
|
-
* @private
|
|
1382
|
-
*/
|
|
1383
|
-
MicroClient.prototype.entryPoint;
|
|
1384
|
-
/**
|
|
1385
|
-
* @type {?}
|
|
1386
|
-
* @private
|
|
1387
|
-
*/
|
|
1388
|
-
MicroClient.prototype.entryPointSubject;
|
|
1389
|
-
/**
|
|
1390
|
-
* @type {?}
|
|
1391
|
-
* @private
|
|
1392
|
-
*/
|
|
1393
|
-
MicroClient.prototype.urlRewriter;
|
|
1394
|
-
/**
|
|
1395
|
-
* @type {?}
|
|
1396
|
-
* @private
|
|
1397
|
-
*/
|
|
1398
|
-
MicroClient.prototype.defaultErrorHandler;
|
|
1399
|
-
/** @type {?} */
|
|
1400
|
-
MicroClient.prototype.usePost;
|
|
1401
|
-
/** @type {?} */
|
|
1402
|
-
MicroClient.prototype.sendAsPermitTokenHeader;
|
|
1403
|
-
/** @type {?} */
|
|
1404
|
-
MicroClient.prototype.sendAsMultipartFormData;
|
|
1405
|
-
/**
|
|
1406
|
-
* @type {?}
|
|
1407
|
-
* @private
|
|
1408
|
-
*/
|
|
1409
|
-
MicroClient.prototype.httpClient;
|
|
1410
|
-
}
|
|
774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClient, decorators: [{
|
|
775
|
+
type: Injectable
|
|
776
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
1411
777
|
class MicroClientLoadError {
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
778
|
+
error;
|
|
779
|
+
defaultHandler;
|
|
780
|
+
handled = false;
|
|
781
|
+
doPreventDefault = false;
|
|
1416
782
|
constructor(error, defaultHandler) {
|
|
1417
783
|
this.error = error;
|
|
1418
784
|
this.defaultHandler = defaultHandler;
|
|
1419
|
-
this.handled = false;
|
|
1420
|
-
this.doPreventDefault = false;
|
|
1421
785
|
}
|
|
1422
|
-
/**
|
|
1423
|
-
* @return {?}
|
|
1424
|
-
*/
|
|
1425
786
|
handleDefault() {
|
|
1426
787
|
if (this.defaultHandler) {
|
|
1427
788
|
this.defaultHandler(this.error);
|
|
1428
789
|
this.handled = true;
|
|
1429
790
|
}
|
|
1430
791
|
}
|
|
1431
|
-
/**
|
|
1432
|
-
* @param {?} handler
|
|
1433
|
-
* @return {?}
|
|
1434
|
-
*/
|
|
1435
792
|
handleError(handler) {
|
|
1436
793
|
handler(this.error);
|
|
1437
794
|
this.handled = true;
|
|
1438
795
|
}
|
|
1439
|
-
/**
|
|
1440
|
-
* @return {?}
|
|
1441
|
-
*/
|
|
1442
796
|
isHandled() {
|
|
1443
797
|
return this.handled;
|
|
1444
798
|
}
|
|
1445
|
-
/**
|
|
1446
|
-
* @return {?}
|
|
1447
|
-
*/
|
|
1448
799
|
shouldPreventDefault() {
|
|
1449
800
|
return this.doPreventDefault;
|
|
1450
801
|
}
|
|
1451
|
-
/**
|
|
1452
|
-
* @return {?}
|
|
1453
|
-
*/
|
|
1454
802
|
preventDefault() {
|
|
1455
803
|
this.doPreventDefault = true;
|
|
1456
804
|
}
|
|
1457
|
-
/**
|
|
1458
|
-
* @return {?}
|
|
1459
|
-
*/
|
|
1460
805
|
hasDefaultHandler() {
|
|
1461
806
|
return this.defaultHandler != null;
|
|
1462
807
|
}
|
|
1463
808
|
}
|
|
1464
|
-
if (false) {
|
|
1465
|
-
/**
|
|
1466
|
-
* @type {?}
|
|
1467
|
-
* @private
|
|
1468
|
-
*/
|
|
1469
|
-
MicroClientLoadError.prototype.handled;
|
|
1470
|
-
/**
|
|
1471
|
-
* @type {?}
|
|
1472
|
-
* @private
|
|
1473
|
-
*/
|
|
1474
|
-
MicroClientLoadError.prototype.doPreventDefault;
|
|
1475
|
-
/**
|
|
1476
|
-
* @type {?}
|
|
1477
|
-
* @private
|
|
1478
|
-
*/
|
|
1479
|
-
MicroClientLoadError.prototype.error;
|
|
1480
|
-
/**
|
|
1481
|
-
* @type {?}
|
|
1482
|
-
* @private
|
|
1483
|
-
*/
|
|
1484
|
-
MicroClientLoadError.prototype.defaultHandler;
|
|
1485
|
-
}
|
|
1486
809
|
|
|
1487
|
-
/**
|
|
1488
|
-
* @fileoverview added by tsickle
|
|
1489
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1490
|
-
*/
|
|
1491
810
|
class MicroClientLoadingIndicatorComponent {
|
|
811
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientLoadingIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
812
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: MicroClientLoadingIndicatorComponent, isStandalone: false, selector: "mc-loadingindicator", ngImport: i0, template: `
|
|
813
|
+
<div id="container">
|
|
814
|
+
<div id="bar"></div>
|
|
815
|
+
</div>
|
|
816
|
+
`, isInline: true, styles: ["#container{display:block;overflow:hidden;width:100%;height:5px;-webkit-transform:translate(0,0) scale(1,1);transform:translate(0) scale(1);background-color:#aad1f9}#container #bar{transition:all .2s linear;-webkit-animation:query .8s infinite cubic-bezier(.39,.575,.565,1);animation:query .8s infinite cubic-bezier(.39,.575,.565,1);transition:-webkit-transform .2s linear;transition:transform .2s linear;background-color:#106cc8;width:100%;height:5px}@keyframes query{0%{opacity:1;transform:translate(35%) scaleX(.3)}to{opacity:0;transform:translate(-50%) scaleX(0)}}\n"] });
|
|
1492
817
|
}
|
|
1493
|
-
MicroClientLoadingIndicatorComponent
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
template: `
|
|
818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientLoadingIndicatorComponent, decorators: [{
|
|
819
|
+
type: Component,
|
|
820
|
+
args: [{ standalone: false, selector: 'mc-loadingindicator', template: `
|
|
1497
821
|
<div id="container">
|
|
1498
822
|
<div id="bar"></div>
|
|
1499
823
|
</div>
|
|
1500
|
-
`,
|
|
1501
|
-
|
|
1502
|
-
#container {
|
|
1503
|
-
display: block;
|
|
1504
|
-
overflow: hidden;
|
|
1505
|
-
width: 100%;
|
|
1506
|
-
height: 5px;
|
|
1507
|
-
-webkit-transform: translate(0, 0) scale(1, 1);
|
|
1508
|
-
transform: translate(0, 0) scale(1, 1);
|
|
1509
|
-
background-color: #aad1f9;
|
|
1510
|
-
}
|
|
1511
|
-
#container #bar {
|
|
1512
|
-
transition: all .2s linear;
|
|
1513
|
-
-webkit-animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);
|
|
1514
|
-
animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);
|
|
1515
|
-
transition: -webkit-transform .2s linear;
|
|
1516
|
-
transition: transform .2s linear;
|
|
1517
|
-
background-color: #106cc8;
|
|
1518
|
-
width: 100%;
|
|
1519
|
-
height: 5px;
|
|
1520
|
-
}
|
|
1521
|
-
@keyframes query {
|
|
1522
|
-
0% {
|
|
1523
|
-
opacity: 1;
|
|
1524
|
-
transform: translateX(35%) scale(0.3, 1);
|
|
1525
|
-
}
|
|
1526
|
-
100% {
|
|
1527
|
-
opacity: 0;
|
|
1528
|
-
transform: translateX(-50%) scale(0, 1);
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
`]
|
|
1532
|
-
}] }
|
|
1533
|
-
];
|
|
824
|
+
`, styles: ["#container{display:block;overflow:hidden;width:100%;height:5px;-webkit-transform:translate(0,0) scale(1,1);transform:translate(0) scale(1);background-color:#aad1f9}#container #bar{transition:all .2s linear;-webkit-animation:query .8s infinite cubic-bezier(.39,.575,.565,1);animation:query .8s infinite cubic-bezier(.39,.575,.565,1);transition:-webkit-transform .2s linear;transition:transform .2s linear;background-color:#106cc8;width:100%;height:5px}@keyframes query{0%{opacity:1;transform:translate(35%) scaleX(.3)}to{opacity:0;transform:translate(-50%) scaleX(0)}}\n"] }]
|
|
825
|
+
}] });
|
|
1534
826
|
|
|
1535
|
-
/**
|
|
1536
|
-
* @fileoverview added by tsickle
|
|
1537
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1538
|
-
*/
|
|
1539
827
|
class LinkFieldPipe {
|
|
1540
|
-
|
|
1541
|
-
* @param {?} changeDetectorRef
|
|
1542
|
-
*/
|
|
828
|
+
asyncPipe;
|
|
1543
829
|
constructor(changeDetectorRef) {
|
|
1544
830
|
this.asyncPipe = new AsyncPipe(changeDetectorRef);
|
|
1545
831
|
}
|
|
1546
|
-
/**
|
|
1547
|
-
* @return {?}
|
|
1548
|
-
*/
|
|
1549
832
|
ngOnDestroy() {
|
|
1550
833
|
this.asyncPipe.ngOnDestroy();
|
|
1551
834
|
}
|
|
1552
|
-
/**
|
|
1553
|
-
* @template T
|
|
1554
|
-
* @param {?} linkField
|
|
1555
|
-
* @return {?}
|
|
1556
|
-
*/
|
|
1557
835
|
transform(linkField) {
|
|
1558
836
|
if (linkField == null) {
|
|
1559
837
|
return null;
|
|
@@ -1566,142 +844,85 @@ class LinkFieldPipe {
|
|
|
1566
844
|
throw new Error('Can\'t use the linkField pipe with a value which isn\'t an instance of LinkField');
|
|
1567
845
|
}
|
|
1568
846
|
}
|
|
847
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkFieldPipe, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
848
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: LinkFieldPipe, isStandalone: false, name: "linkField", pure: false });
|
|
1569
849
|
}
|
|
1570
|
-
LinkFieldPipe
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
]
|
|
1577
|
-
|
|
1578
|
-
/**
|
|
1579
|
-
* @type {?}
|
|
1580
|
-
* @private
|
|
1581
|
-
*/
|
|
1582
|
-
LinkFieldPipe.prototype.asyncPipe;
|
|
1583
|
-
}
|
|
850
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkFieldPipe, decorators: [{
|
|
851
|
+
type: Pipe,
|
|
852
|
+
args: [{
|
|
853
|
+
name: 'linkField',
|
|
854
|
+
pure: false,
|
|
855
|
+
standalone: false
|
|
856
|
+
}]
|
|
857
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
1584
858
|
|
|
1585
|
-
/**
|
|
1586
|
-
* @fileoverview added by tsickle
|
|
1587
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1588
|
-
*/
|
|
1589
859
|
class MicroClientErrorIndicatorComponent {
|
|
1590
|
-
|
|
1591
|
-
* @return {?}
|
|
1592
|
-
*/
|
|
860
|
+
error;
|
|
1593
861
|
onClick() {
|
|
1594
862
|
this.error.handleDefault();
|
|
1595
863
|
}
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
{ type: Component, args: [{
|
|
1599
|
-
selector: 'mc-errorindicator',
|
|
1600
|
-
template: `
|
|
864
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientErrorIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
865
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: MicroClientErrorIndicatorComponent, isStandalone: false, selector: "mc-errorindicator", inputs: { error: "error" }, ngImport: i0, template: `
|
|
1601
866
|
<div class="blinking-error" [class.clickable]="error.hasDefaultHandler()" (click)="onClick()"></div>
|
|
1602
|
-
`,
|
|
1603
|
-
styles: [`
|
|
1604
|
-
.blinking-error {
|
|
1605
|
-
background-image: linear-gradient(to right, tomato 0%, darkred 50%, tomato 100%);
|
|
1606
|
-
animation: blinkingText 0.5s 1;
|
|
1607
|
-
height: 5px;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
.blinking-error.clickable {
|
|
1611
|
-
cursor: pointer;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
@keyframes blinkingText {
|
|
1615
|
-
0% {
|
|
1616
|
-
opacity: 0;
|
|
1617
|
-
}
|
|
1618
|
-
50% {
|
|
1619
|
-
opacity: 1;
|
|
1620
|
-
}
|
|
1621
|
-
100% {
|
|
1622
|
-
opacity: 0;
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
`]
|
|
1626
|
-
}] }
|
|
1627
|
-
];
|
|
1628
|
-
MicroClientErrorIndicatorComponent.propDecorators = {
|
|
1629
|
-
error: [{ type: Input }]
|
|
1630
|
-
};
|
|
1631
|
-
if (false) {
|
|
1632
|
-
/** @type {?} */
|
|
1633
|
-
MicroClientErrorIndicatorComponent.prototype.error;
|
|
867
|
+
`, isInline: true, styles: [".blinking-error{background-image:linear-gradient(to right,tomato,#8b0000,tomato);animation:blinkingText .5s 1;height:5px}.blinking-error.clickable{cursor:pointer}@keyframes blinkingText{0%{opacity:0}50%{opacity:1}to{opacity:0}}\n"] });
|
|
1634
868
|
}
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientErrorIndicatorComponent, decorators: [{
|
|
870
|
+
type: Component,
|
|
871
|
+
args: [{ selector: 'mc-errorindicator', template: `
|
|
872
|
+
<div class="blinking-error" [class.clickable]="error.hasDefaultHandler()" (click)="onClick()"></div>
|
|
873
|
+
`, standalone: false, styles: [".blinking-error{background-image:linear-gradient(to right,tomato,#8b0000,tomato);animation:blinkingText .5s 1;height:5px}.blinking-error.clickable{cursor:pointer}@keyframes blinkingText{0%{opacity:0}50%{opacity:1}to{opacity:0}}\n"] }]
|
|
874
|
+
}], propDecorators: { error: [{
|
|
875
|
+
type: Input
|
|
876
|
+
}] } });
|
|
1635
877
|
|
|
1636
|
-
/**
|
|
1637
|
-
* @fileoverview added by tsickle
|
|
1638
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1639
|
-
*/
|
|
1640
|
-
/**
|
|
1641
|
-
* @template T
|
|
1642
|
-
*/
|
|
1643
878
|
class LinkFieldDirective {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
879
|
+
_viewContainer;
|
|
880
|
+
_template;
|
|
881
|
+
componentResolver;
|
|
882
|
+
changeDetectorRef;
|
|
883
|
+
_from;
|
|
884
|
+
_loadingTemplate;
|
|
885
|
+
_errorTemplate;
|
|
886
|
+
_defaultLoadingComponent;
|
|
887
|
+
_defaultErrorComponent;
|
|
888
|
+
isDirty = true;
|
|
889
|
+
isLoading = false;
|
|
890
|
+
loadedResult = null;
|
|
891
|
+
hasResult = false;
|
|
892
|
+
lastObs;
|
|
893
|
+
subscription = null;
|
|
894
|
+
currentContext;
|
|
1650
895
|
constructor(_viewContainer, _template, componentResolver, changeDetectorRef) {
|
|
1651
896
|
this._viewContainer = _viewContainer;
|
|
1652
897
|
this._template = _template;
|
|
1653
898
|
this.componentResolver = componentResolver;
|
|
1654
899
|
this.changeDetectorRef = changeDetectorRef;
|
|
1655
|
-
this.isDirty = true;
|
|
1656
|
-
this.isLoading = false;
|
|
1657
|
-
this.loadedResult = null;
|
|
1658
|
-
this.hasResult = false;
|
|
1659
|
-
this.subscription = null;
|
|
1660
|
-
this.linkFieldDefaultErrorHandling = false;
|
|
1661
|
-
this.linkFieldParams = null;
|
|
1662
900
|
this._defaultLoadingComponent = componentResolver.resolveComponentFactory(MicroClientLoadingIndicatorComponent);
|
|
1663
901
|
this._defaultErrorComponent = componentResolver.resolveComponentFactory(MicroClientErrorIndicatorComponent);
|
|
1664
902
|
}
|
|
1665
|
-
/**
|
|
1666
|
-
* @param {?} from
|
|
1667
|
-
* @return {?}
|
|
1668
|
-
*/
|
|
1669
903
|
set linkFieldFrom(from) {
|
|
1670
904
|
this._from = from;
|
|
1671
905
|
}
|
|
1672
|
-
/**
|
|
1673
|
-
* @param {?} loadingTemplate
|
|
1674
|
-
* @return {?}
|
|
1675
|
-
*/
|
|
1676
906
|
set linkFieldLoadingTemplate(loadingTemplate) {
|
|
1677
907
|
if (loadingTemplate) {
|
|
1678
908
|
this._loadingTemplate = loadingTemplate;
|
|
1679
909
|
}
|
|
1680
910
|
this.updateIfDirty(true);
|
|
1681
911
|
}
|
|
1682
|
-
/**
|
|
1683
|
-
* @param {?} errorTemplate
|
|
1684
|
-
* @return {?}
|
|
1685
|
-
*/
|
|
1686
912
|
set linkFieldErrorTemplate(errorTemplate) {
|
|
1687
913
|
if (errorTemplate) {
|
|
1688
914
|
this._errorTemplate = errorTemplate;
|
|
1689
915
|
}
|
|
1690
916
|
this.updateIfDirty(true);
|
|
1691
917
|
}
|
|
1692
|
-
/**
|
|
1693
|
-
* @param {?} value
|
|
1694
|
-
* @return {?}
|
|
1695
|
-
*/
|
|
1696
918
|
set linkFieldTemplate(value) {
|
|
1697
919
|
if (value) {
|
|
1698
920
|
this._template = value;
|
|
1699
921
|
}
|
|
1700
922
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
*/
|
|
923
|
+
linkFieldDefaultErrorHandling = false;
|
|
924
|
+
linkFieldValueChange;
|
|
925
|
+
linkFieldParams = null;
|
|
1705
926
|
load() {
|
|
1706
927
|
if (this._from) {
|
|
1707
928
|
if (this._from instanceof LinkField) {
|
|
@@ -1710,30 +931,19 @@ class LinkFieldDirective {
|
|
|
1710
931
|
if (this.subscription) {
|
|
1711
932
|
this.subscription.unsubscribe();
|
|
1712
933
|
}
|
|
1713
|
-
this.subscription = this.lastObs.pipe(finalize((
|
|
1714
|
-
* @return {?}
|
|
1715
|
-
*/
|
|
1716
|
-
() => {
|
|
934
|
+
this.subscription = this.lastObs.pipe(finalize(() => {
|
|
1717
935
|
this.setLoading(false);
|
|
1718
|
-
}))
|
|
1719
|
-
* @param {?} loadedResult
|
|
1720
|
-
* @return {?}
|
|
1721
|
-
*/
|
|
1722
|
-
(loadedResult) => {
|
|
936
|
+
})).subscribe((loadedResult) => {
|
|
1723
937
|
this.setLoadedResult(loadedResult);
|
|
1724
938
|
if (this.linkFieldValueChange) {
|
|
1725
939
|
this.linkFieldValueChange(loadedResult);
|
|
1726
940
|
}
|
|
1727
|
-
}
|
|
1728
|
-
* @param {?} loadError
|
|
1729
|
-
* @return {?}
|
|
1730
|
-
*/
|
|
1731
|
-
(loadError) => {
|
|
941
|
+
}, (loadError) => {
|
|
1732
942
|
if (!this.linkFieldDefaultErrorHandling) {
|
|
1733
943
|
loadError.preventDefault();
|
|
1734
944
|
}
|
|
1735
945
|
this.setError(loadError);
|
|
1736
|
-
})
|
|
946
|
+
});
|
|
1737
947
|
}
|
|
1738
948
|
else {
|
|
1739
949
|
this.setLoadedResult(this._from);
|
|
@@ -1742,26 +952,16 @@ class LinkFieldDirective {
|
|
|
1742
952
|
}
|
|
1743
953
|
}
|
|
1744
954
|
}
|
|
1745
|
-
/**
|
|
1746
|
-
* @return {?}
|
|
1747
|
-
*/
|
|
1748
955
|
ngDoCheck() {
|
|
1749
956
|
this.updateIfDirty();
|
|
1750
957
|
}
|
|
1751
|
-
/**
|
|
1752
|
-
* @return {?}
|
|
1753
|
-
*/
|
|
1754
958
|
ngOnDestroy() {
|
|
1755
959
|
this.clear();
|
|
1756
960
|
}
|
|
1757
|
-
/**
|
|
1758
|
-
* @param {?} changes
|
|
1759
|
-
* @return {?}
|
|
1760
|
-
*/
|
|
1761
961
|
ngOnChanges(changes) {
|
|
1762
962
|
if (changes.linkFieldFrom) {
|
|
1763
963
|
if (!(this._from instanceof LinkField)) {
|
|
1764
|
-
this._from = LinkField.from(
|
|
964
|
+
this._from = LinkField.from(this._from);
|
|
1765
965
|
}
|
|
1766
966
|
if (changes.linkFieldFrom.previousValue !== changes.linkFieldFrom.currentValue) {
|
|
1767
967
|
this.clear();
|
|
@@ -1769,16 +969,10 @@ class LinkFieldDirective {
|
|
|
1769
969
|
}
|
|
1770
970
|
}
|
|
1771
971
|
if (changes.linkFieldParams && this.linkFieldParams) {
|
|
1772
|
-
|
|
1773
|
-
let link = (/** @type {?} */ (this._from));
|
|
972
|
+
let link = this._from;
|
|
1774
973
|
this._from = link.withCallParams(this.linkFieldParams);
|
|
1775
974
|
}
|
|
1776
975
|
}
|
|
1777
|
-
/**
|
|
1778
|
-
* @private
|
|
1779
|
-
* @param {?} error
|
|
1780
|
-
* @return {?}
|
|
1781
|
-
*/
|
|
1782
976
|
setError(error) {
|
|
1783
977
|
this._viewContainer.remove();
|
|
1784
978
|
if (this._errorTemplate) {
|
|
@@ -1787,16 +981,10 @@ class LinkFieldDirective {
|
|
|
1787
981
|
});
|
|
1788
982
|
}
|
|
1789
983
|
else {
|
|
1790
|
-
/** @type {?} */
|
|
1791
984
|
let errorComponentInstance = this._viewContainer.createComponent(this._defaultErrorComponent);
|
|
1792
985
|
errorComponentInstance.instance['error'] = error;
|
|
1793
986
|
}
|
|
1794
987
|
}
|
|
1795
|
-
/**
|
|
1796
|
-
* @private
|
|
1797
|
-
* @param {?} loading
|
|
1798
|
-
* @return {?}
|
|
1799
|
-
*/
|
|
1800
988
|
setLoading(loading) {
|
|
1801
989
|
this.isLoading = loading;
|
|
1802
990
|
if (this.isLoading) {
|
|
@@ -1810,11 +998,6 @@ class LinkFieldDirective {
|
|
|
1810
998
|
}
|
|
1811
999
|
}
|
|
1812
1000
|
}
|
|
1813
|
-
/**
|
|
1814
|
-
* @private
|
|
1815
|
-
* @param {?} result
|
|
1816
|
-
* @return {?}
|
|
1817
|
-
*/
|
|
1818
1001
|
setLoadedResult(result) {
|
|
1819
1002
|
this.hasResult = true;
|
|
1820
1003
|
this.loadedResult = result;
|
|
@@ -1837,11 +1020,6 @@ class LinkFieldDirective {
|
|
|
1837
1020
|
}
|
|
1838
1021
|
}
|
|
1839
1022
|
}
|
|
1840
|
-
/**
|
|
1841
|
-
* @private
|
|
1842
|
-
* @param {?=} ignoreDirty
|
|
1843
|
-
* @return {?}
|
|
1844
|
-
*/
|
|
1845
1023
|
updateIfDirty(ignoreDirty = false) {
|
|
1846
1024
|
if ((this.isDirty || ignoreDirty) && this._loadingTemplate && this._from && this._template && this._viewContainer) {
|
|
1847
1025
|
if (this.hasResult) {
|
|
@@ -1850,10 +1028,6 @@ class LinkFieldDirective {
|
|
|
1850
1028
|
this.isDirty = false;
|
|
1851
1029
|
}
|
|
1852
1030
|
}
|
|
1853
|
-
/**
|
|
1854
|
-
* @private
|
|
1855
|
-
* @return {?}
|
|
1856
|
-
*/
|
|
1857
1031
|
clear() {
|
|
1858
1032
|
this.hasResult = false;
|
|
1859
1033
|
this.loadedResult = null;
|
|
@@ -1865,212 +1039,92 @@ class LinkFieldDirective {
|
|
|
1865
1039
|
this.lastObs = null;
|
|
1866
1040
|
this.currentContext = null;
|
|
1867
1041
|
}
|
|
1042
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1043
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: LinkFieldDirective, isStandalone: false, selector: "[linkField][linkFieldFrom]", inputs: { linkFieldFrom: "linkFieldFrom", linkFieldLoadingTemplate: "linkFieldLoadingTemplate", linkFieldErrorTemplate: "linkFieldErrorTemplate", linkFieldTemplate: "linkFieldTemplate", linkFieldDefaultErrorHandling: "linkFieldDefaultErrorHandling", linkFieldValueChange: "linkFieldValueChange", linkFieldParams: "linkFieldParams" }, usesOnChanges: true, ngImport: i0 });
|
|
1868
1044
|
}
|
|
1869
|
-
LinkFieldDirective
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
};
|
|
1890
|
-
if (false) {
|
|
1891
|
-
/**
|
|
1892
|
-
* @type {?}
|
|
1893
|
-
* @private
|
|
1894
|
-
*/
|
|
1895
|
-
LinkFieldDirective.prototype._from;
|
|
1896
|
-
/**
|
|
1897
|
-
* @type {?}
|
|
1898
|
-
* @private
|
|
1899
|
-
*/
|
|
1900
|
-
LinkFieldDirective.prototype._loadingTemplate;
|
|
1901
|
-
/**
|
|
1902
|
-
* @type {?}
|
|
1903
|
-
* @private
|
|
1904
|
-
*/
|
|
1905
|
-
LinkFieldDirective.prototype._errorTemplate;
|
|
1906
|
-
/**
|
|
1907
|
-
* @type {?}
|
|
1908
|
-
* @private
|
|
1909
|
-
*/
|
|
1910
|
-
LinkFieldDirective.prototype._defaultLoadingComponent;
|
|
1911
|
-
/**
|
|
1912
|
-
* @type {?}
|
|
1913
|
-
* @private
|
|
1914
|
-
*/
|
|
1915
|
-
LinkFieldDirective.prototype._defaultErrorComponent;
|
|
1916
|
-
/**
|
|
1917
|
-
* @type {?}
|
|
1918
|
-
* @private
|
|
1919
|
-
*/
|
|
1920
|
-
LinkFieldDirective.prototype.isDirty;
|
|
1921
|
-
/**
|
|
1922
|
-
* @type {?}
|
|
1923
|
-
* @private
|
|
1924
|
-
*/
|
|
1925
|
-
LinkFieldDirective.prototype.isLoading;
|
|
1926
|
-
/**
|
|
1927
|
-
* @type {?}
|
|
1928
|
-
* @private
|
|
1929
|
-
*/
|
|
1930
|
-
LinkFieldDirective.prototype.loadedResult;
|
|
1931
|
-
/**
|
|
1932
|
-
* @type {?}
|
|
1933
|
-
* @private
|
|
1934
|
-
*/
|
|
1935
|
-
LinkFieldDirective.prototype.hasResult;
|
|
1936
|
-
/**
|
|
1937
|
-
* @type {?}
|
|
1938
|
-
* @private
|
|
1939
|
-
*/
|
|
1940
|
-
LinkFieldDirective.prototype.lastObs;
|
|
1941
|
-
/**
|
|
1942
|
-
* @type {?}
|
|
1943
|
-
* @private
|
|
1944
|
-
*/
|
|
1945
|
-
LinkFieldDirective.prototype.subscription;
|
|
1946
|
-
/**
|
|
1947
|
-
* @type {?}
|
|
1948
|
-
* @private
|
|
1949
|
-
*/
|
|
1950
|
-
LinkFieldDirective.prototype.currentContext;
|
|
1951
|
-
/** @type {?} */
|
|
1952
|
-
LinkFieldDirective.prototype.linkFieldDefaultErrorHandling;
|
|
1953
|
-
/** @type {?} */
|
|
1954
|
-
LinkFieldDirective.prototype.linkFieldValueChange;
|
|
1955
|
-
/** @type {?} */
|
|
1956
|
-
LinkFieldDirective.prototype.linkFieldParams;
|
|
1957
|
-
/**
|
|
1958
|
-
* @type {?}
|
|
1959
|
-
* @private
|
|
1960
|
-
*/
|
|
1961
|
-
LinkFieldDirective.prototype._viewContainer;
|
|
1962
|
-
/**
|
|
1963
|
-
* @type {?}
|
|
1964
|
-
* @private
|
|
1965
|
-
*/
|
|
1966
|
-
LinkFieldDirective.prototype._template;
|
|
1967
|
-
/**
|
|
1968
|
-
* @type {?}
|
|
1969
|
-
* @private
|
|
1970
|
-
*/
|
|
1971
|
-
LinkFieldDirective.prototype.componentResolver;
|
|
1972
|
-
/**
|
|
1973
|
-
* @type {?}
|
|
1974
|
-
* @private
|
|
1975
|
-
*/
|
|
1976
|
-
LinkFieldDirective.prototype.changeDetectorRef;
|
|
1977
|
-
}
|
|
1978
|
-
/**
|
|
1979
|
-
* @template T
|
|
1980
|
-
*/
|
|
1045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkFieldDirective, decorators: [{
|
|
1046
|
+
type: Directive,
|
|
1047
|
+
args: [{
|
|
1048
|
+
selector: '[linkField][linkFieldFrom]',
|
|
1049
|
+
standalone: false
|
|
1050
|
+
}]
|
|
1051
|
+
}], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }], propDecorators: { linkFieldFrom: [{
|
|
1052
|
+
type: Input
|
|
1053
|
+
}], linkFieldLoadingTemplate: [{
|
|
1054
|
+
type: Input
|
|
1055
|
+
}], linkFieldErrorTemplate: [{
|
|
1056
|
+
type: Input
|
|
1057
|
+
}], linkFieldTemplate: [{
|
|
1058
|
+
type: Input
|
|
1059
|
+
}], linkFieldDefaultErrorHandling: [{
|
|
1060
|
+
type: Input
|
|
1061
|
+
}], linkFieldValueChange: [{
|
|
1062
|
+
type: Input
|
|
1063
|
+
}], linkFieldParams: [{
|
|
1064
|
+
type: Input
|
|
1065
|
+
}] } });
|
|
1981
1066
|
class LinkFieldContext {
|
|
1982
|
-
|
|
1983
|
-
* @param {?} $implicit
|
|
1984
|
-
*/
|
|
1067
|
+
$implicit;
|
|
1985
1068
|
constructor($implicit) {
|
|
1986
1069
|
this.$implicit = $implicit;
|
|
1987
1070
|
}
|
|
1988
1071
|
}
|
|
1989
|
-
if (false) {
|
|
1990
|
-
/** @type {?} */
|
|
1991
|
-
LinkFieldContext.prototype.$implicit;
|
|
1992
|
-
}
|
|
1993
1072
|
|
|
1994
|
-
/**
|
|
1995
|
-
* @fileoverview added by tsickle
|
|
1996
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1997
|
-
*/
|
|
1998
1073
|
class CallLinkDirective {
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
* @return {?}
|
|
2008
|
-
*/
|
|
1074
|
+
callLink;
|
|
1075
|
+
callStatusChange = new EventEmitter();
|
|
1076
|
+
callSucess = new EventEmitter();
|
|
1077
|
+
callFinish = new EventEmitter();
|
|
1078
|
+
callError = new EventEmitter();
|
|
1079
|
+
callStart = new EventEmitter();
|
|
1080
|
+
callOptions;
|
|
1081
|
+
callParameters;
|
|
2009
1082
|
onClick() {
|
|
2010
|
-
this.callLink.callWithObs(this.callParameters, this.callOptions).subscribe((
|
|
2011
|
-
* @param {?} response
|
|
2012
|
-
* @return {?}
|
|
2013
|
-
*/
|
|
2014
|
-
(response) => {
|
|
1083
|
+
this.callLink.callWithObs(this.callParameters, this.callOptions).subscribe((response) => {
|
|
2015
1084
|
this.callSucess.emit(response);
|
|
2016
1085
|
this.callStatusChange.emit(new CallStatus(this.callLink, CallState.SUCCESS, response, null));
|
|
2017
|
-
}
|
|
2018
|
-
* @param {?} error
|
|
2019
|
-
* @return {?}
|
|
2020
|
-
*/
|
|
2021
|
-
(error) => {
|
|
1086
|
+
}, (error) => {
|
|
2022
1087
|
this.callError.emit(error);
|
|
2023
1088
|
this.callStatusChange.emit(new CallStatus(this.callLink, CallState.ERROR, null, error));
|
|
2024
|
-
}
|
|
2025
|
-
* @return {?}
|
|
2026
|
-
*/
|
|
2027
|
-
() => {
|
|
1089
|
+
}, () => {
|
|
2028
1090
|
this.callFinish.emit();
|
|
2029
|
-
})
|
|
1091
|
+
});
|
|
2030
1092
|
this.callStatusChange.emit(new CallStatus(this.callLink, CallState.CALLING, null, null));
|
|
2031
1093
|
}
|
|
1094
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CallLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1095
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: CallLinkDirective, isStandalone: false, selector: "[callLink]", inputs: { callLink: "callLink", callOptions: "callOptions", callParameters: "callParameters" }, outputs: { callStatusChange: "callStatusChange", callSucess: "callSucess", callFinish: "callFinish", callError: "callError", callStart: "callStart" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
2032
1096
|
}
|
|
2033
|
-
CallLinkDirective
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
CallLinkDirective.prototype.callError;
|
|
2060
|
-
/** @type {?} */
|
|
2061
|
-
CallLinkDirective.prototype.callStart;
|
|
2062
|
-
/** @type {?} */
|
|
2063
|
-
CallLinkDirective.prototype.callOptions;
|
|
2064
|
-
/** @type {?} */
|
|
2065
|
-
CallLinkDirective.prototype.callParameters;
|
|
2066
|
-
}
|
|
1097
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CallLinkDirective, decorators: [{
|
|
1098
|
+
type: Directive,
|
|
1099
|
+
args: [{
|
|
1100
|
+
selector: '[callLink]',
|
|
1101
|
+
standalone: false
|
|
1102
|
+
}]
|
|
1103
|
+
}], propDecorators: { callLink: [{
|
|
1104
|
+
type: Input
|
|
1105
|
+
}], callStatusChange: [{
|
|
1106
|
+
type: Output
|
|
1107
|
+
}], callSucess: [{
|
|
1108
|
+
type: Output
|
|
1109
|
+
}], callFinish: [{
|
|
1110
|
+
type: Output
|
|
1111
|
+
}], callError: [{
|
|
1112
|
+
type: Output
|
|
1113
|
+
}], callStart: [{
|
|
1114
|
+
type: Output
|
|
1115
|
+
}], callOptions: [{
|
|
1116
|
+
type: Input
|
|
1117
|
+
}], callParameters: [{
|
|
1118
|
+
type: Input
|
|
1119
|
+
}], onClick: [{
|
|
1120
|
+
type: HostListener,
|
|
1121
|
+
args: ['click']
|
|
1122
|
+
}] } });
|
|
2067
1123
|
class CallStatus {
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
* @param {?} error
|
|
2073
|
-
*/
|
|
1124
|
+
link;
|
|
1125
|
+
state;
|
|
1126
|
+
response;
|
|
1127
|
+
error;
|
|
2074
1128
|
constructor(link, state, response, error) {
|
|
2075
1129
|
this.link = link;
|
|
2076
1130
|
this.state = state;
|
|
@@ -2078,52 +1132,26 @@ class CallStatus {
|
|
|
2078
1132
|
this.error = error;
|
|
2079
1133
|
}
|
|
2080
1134
|
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
CallStatus.prototype.response;
|
|
2088
|
-
/** @type {?} */
|
|
2089
|
-
CallStatus.prototype.error;
|
|
2090
|
-
}
|
|
2091
|
-
/** @enum {number} */
|
|
2092
|
-
const CallState = {
|
|
2093
|
-
CALLING: 0,
|
|
2094
|
-
SUCCESS: 1,
|
|
2095
|
-
ERROR: 2,
|
|
2096
|
-
};
|
|
2097
|
-
CallState[CallState.CALLING] = 'CALLING';
|
|
2098
|
-
CallState[CallState.SUCCESS] = 'SUCCESS';
|
|
2099
|
-
CallState[CallState.ERROR] = 'ERROR';
|
|
1135
|
+
var CallState;
|
|
1136
|
+
(function (CallState) {
|
|
1137
|
+
CallState[CallState["CALLING"] = 0] = "CALLING";
|
|
1138
|
+
CallState[CallState["SUCCESS"] = 1] = "SUCCESS";
|
|
1139
|
+
CallState[CallState["ERROR"] = 2] = "ERROR";
|
|
1140
|
+
})(CallState || (CallState = {}));
|
|
2100
1141
|
|
|
2101
|
-
/**
|
|
2102
|
-
* @fileoverview added by tsickle
|
|
2103
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2104
|
-
*/
|
|
2105
1142
|
class MicroLinkValidateDirective {
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
/**
|
|
2113
|
-
* @param {?} control
|
|
2114
|
-
* @return {?}
|
|
2115
|
-
*/
|
|
1143
|
+
UNSET = "";
|
|
1144
|
+
microLinkValidate;
|
|
1145
|
+
microLinkValidateField = null;
|
|
1146
|
+
microLinkValidateValue = this.UNSET;
|
|
1147
|
+
microLinkValidateDebounce = 500;
|
|
1148
|
+
result;
|
|
2116
1149
|
validate(control) {
|
|
2117
|
-
return timer(this.microLinkValidateDebounce).pipe(switchMap((
|
|
2118
|
-
* @return {?}
|
|
2119
|
-
*/
|
|
2120
|
-
() => {
|
|
2121
|
-
/** @type {?} */
|
|
1150
|
+
return timer(this.microLinkValidateDebounce).pipe(switchMap(() => {
|
|
2122
1151
|
let validateValue = this.microLinkValidateValue;
|
|
2123
1152
|
if (validateValue === this.UNSET) {
|
|
2124
1153
|
validateValue = control.value;
|
|
2125
1154
|
}
|
|
2126
|
-
/** @type {?} */
|
|
2127
1155
|
let obj = {};
|
|
2128
1156
|
if (this.microLinkValidateField) {
|
|
2129
1157
|
obj[this.microLinkValidateField] = validateValue;
|
|
@@ -2131,12 +1159,7 @@ class MicroLinkValidateDirective {
|
|
|
2131
1159
|
else {
|
|
2132
1160
|
obj = validateValue;
|
|
2133
1161
|
}
|
|
2134
|
-
return this.microLinkValidate.callWithObs(obj, null).pipe(map(
|
|
2135
|
-
* @param {?} validationRes
|
|
2136
|
-
* @return {?}
|
|
2137
|
-
*/
|
|
2138
|
-
validationRes => {
|
|
2139
|
-
/** @type {?} */
|
|
1162
|
+
return this.microLinkValidate.callWithObs(obj, null).pipe(map(validationRes => {
|
|
2140
1163
|
let hasErrors = false;
|
|
2141
1164
|
if (this.microLinkValidateField) {
|
|
2142
1165
|
if (validationRes[this.microLinkValidateField] != null) {
|
|
@@ -2160,27 +1183,17 @@ class MicroLinkValidateDirective {
|
|
|
2160
1183
|
this.result = null;
|
|
2161
1184
|
return null;
|
|
2162
1185
|
}
|
|
2163
|
-
}))
|
|
2164
|
-
}))
|
|
1186
|
+
}));
|
|
1187
|
+
}));
|
|
2165
1188
|
}
|
|
2166
|
-
/**
|
|
2167
|
-
* @param {?} control
|
|
2168
|
-
* @return {?}
|
|
2169
|
-
*/
|
|
2170
1189
|
getControlName(control) {
|
|
2171
|
-
/** @type {?} */
|
|
2172
1190
|
let controlName = null;
|
|
2173
|
-
/** @type {?} */
|
|
2174
1191
|
let parent = control.parent;
|
|
2175
1192
|
// only such parent, which is FormGroup, has a dictionary
|
|
2176
1193
|
// with control-names as a key and a form-control as a value
|
|
2177
1194
|
if (parent instanceof FormGroup) {
|
|
2178
1195
|
// now we will iterate those keys (i.e. names of controls)
|
|
2179
|
-
Object.keys(parent.controls).forEach((
|
|
2180
|
-
* @param {?} name
|
|
2181
|
-
* @return {?}
|
|
2182
|
-
*/
|
|
2183
|
-
(name) => {
|
|
1196
|
+
Object.keys(parent.controls).forEach((name) => {
|
|
2184
1197
|
// and compare the passed control and
|
|
2185
1198
|
// a child control of a parent - with provided name (we iterate them all)
|
|
2186
1199
|
if (control === parent.controls[name]) {
|
|
@@ -2188,60 +1201,45 @@ class MicroLinkValidateDirective {
|
|
|
2188
1201
|
// and this child - are the same references
|
|
2189
1202
|
controlName = name;
|
|
2190
1203
|
}
|
|
2191
|
-
})
|
|
1204
|
+
});
|
|
2192
1205
|
}
|
|
2193
1206
|
// we either found a name or simply return null
|
|
2194
1207
|
return controlName;
|
|
2195
1208
|
}
|
|
1209
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroLinkValidateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1210
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: MicroLinkValidateDirective, isStandalone: false, selector: "[microLinkValidate]", inputs: { microLinkValidate: "microLinkValidate", microLinkValidateField: "microLinkValidateField", microLinkValidateValue: "microLinkValidateValue", microLinkValidateDebounce: "microLinkValidateDebounce" }, providers: [
|
|
1211
|
+
{
|
|
1212
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
1213
|
+
useExisting: forwardRef(() => MicroLinkValidateDirective),
|
|
1214
|
+
multi: true
|
|
1215
|
+
}
|
|
1216
|
+
], exportAs: ["microValidator"], ngImport: i0 });
|
|
2196
1217
|
}
|
|
2197
|
-
MicroLinkValidateDirective
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
/**
|
|
2221
|
-
* @type {?}
|
|
2222
|
-
* @private
|
|
2223
|
-
*/
|
|
2224
|
-
MicroLinkValidateDirective.prototype.UNSET;
|
|
2225
|
-
/** @type {?} */
|
|
2226
|
-
MicroLinkValidateDirective.prototype.microLinkValidate;
|
|
2227
|
-
/** @type {?} */
|
|
2228
|
-
MicroLinkValidateDirective.prototype.microLinkValidateField;
|
|
2229
|
-
/** @type {?} */
|
|
2230
|
-
MicroLinkValidateDirective.prototype.microLinkValidateValue;
|
|
2231
|
-
/** @type {?} */
|
|
2232
|
-
MicroLinkValidateDirective.prototype.microLinkValidateDebounce;
|
|
2233
|
-
/** @type {?} */
|
|
2234
|
-
MicroLinkValidateDirective.prototype.result;
|
|
2235
|
-
}
|
|
1218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroLinkValidateDirective, decorators: [{
|
|
1219
|
+
type: Directive,
|
|
1220
|
+
args: [{
|
|
1221
|
+
selector: '[microLinkValidate]',
|
|
1222
|
+
providers: [
|
|
1223
|
+
{
|
|
1224
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
1225
|
+
useExisting: forwardRef(() => MicroLinkValidateDirective),
|
|
1226
|
+
multi: true
|
|
1227
|
+
}
|
|
1228
|
+
],
|
|
1229
|
+
exportAs: 'microValidator',
|
|
1230
|
+
standalone: false
|
|
1231
|
+
}]
|
|
1232
|
+
}], propDecorators: { microLinkValidate: [{
|
|
1233
|
+
type: Input
|
|
1234
|
+
}], microLinkValidateField: [{
|
|
1235
|
+
type: Input
|
|
1236
|
+
}], microLinkValidateValue: [{
|
|
1237
|
+
type: Input
|
|
1238
|
+
}], microLinkValidateDebounce: [{
|
|
1239
|
+
type: Input
|
|
1240
|
+
}] } });
|
|
2236
1241
|
|
|
2237
|
-
/**
|
|
2238
|
-
* @fileoverview added by tsickle
|
|
2239
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2240
|
-
*/
|
|
2241
1242
|
class MicroClientModule {
|
|
2242
|
-
/**
|
|
2243
|
-
* @return {?}
|
|
2244
|
-
*/
|
|
2245
1243
|
static forClientRoot() {
|
|
2246
1244
|
return {
|
|
2247
1245
|
ngModule: MicroClientModule,
|
|
@@ -2250,85 +1248,74 @@ class MicroClientModule {
|
|
|
2250
1248
|
]
|
|
2251
1249
|
};
|
|
2252
1250
|
}
|
|
1251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1252
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: MicroClientModule, declarations: [LinkFieldPipe,
|
|
1253
|
+
LinkFieldDirective,
|
|
1254
|
+
CallLinkDirective,
|
|
1255
|
+
MicroClientLoadingIndicatorComponent,
|
|
1256
|
+
MicroClientErrorIndicatorComponent,
|
|
1257
|
+
MicroLinkValidateDirective], exports: [LinkFieldPipe,
|
|
1258
|
+
LinkFieldDirective,
|
|
1259
|
+
CallLinkDirective,
|
|
1260
|
+
MicroClientErrorIndicatorComponent,
|
|
1261
|
+
MicroClientLoadingIndicatorComponent,
|
|
1262
|
+
MicroLinkValidateDirective] });
|
|
1263
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientModule, providers: [
|
|
1264
|
+
provideHttpClient()
|
|
1265
|
+
] });
|
|
2253
1266
|
}
|
|
2254
|
-
MicroClientModule
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
},] }
|
|
2280
|
-
];
|
|
1267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MicroClientModule, decorators: [{
|
|
1268
|
+
type: NgModule,
|
|
1269
|
+
args: [{
|
|
1270
|
+
imports: [],
|
|
1271
|
+
declarations: [
|
|
1272
|
+
LinkFieldPipe,
|
|
1273
|
+
LinkFieldDirective,
|
|
1274
|
+
CallLinkDirective,
|
|
1275
|
+
MicroClientLoadingIndicatorComponent,
|
|
1276
|
+
MicroClientErrorIndicatorComponent,
|
|
1277
|
+
MicroLinkValidateDirective
|
|
1278
|
+
],
|
|
1279
|
+
exports: [
|
|
1280
|
+
LinkFieldPipe,
|
|
1281
|
+
LinkFieldDirective,
|
|
1282
|
+
CallLinkDirective,
|
|
1283
|
+
MicroClientErrorIndicatorComponent,
|
|
1284
|
+
MicroClientLoadingIndicatorComponent,
|
|
1285
|
+
MicroLinkValidateDirective
|
|
1286
|
+
],
|
|
1287
|
+
providers: [
|
|
1288
|
+
provideHttpClient()
|
|
1289
|
+
]
|
|
1290
|
+
}]
|
|
1291
|
+
}] });
|
|
2281
1292
|
|
|
2282
|
-
/**
|
|
2283
|
-
* @fileoverview added by tsickle
|
|
2284
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2285
|
-
*/
|
|
2286
1293
|
class LinkFieldPagingSupport {
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
* @param {?=} pageLimit
|
|
2291
|
-
*/
|
|
1294
|
+
pageLink;
|
|
1295
|
+
changeDetectorRef;
|
|
1296
|
+
pageLimit;
|
|
2292
1297
|
constructor(pageLink, changeDetectorRef, pageLimit = 200) {
|
|
2293
1298
|
this.pageLink = pageLink;
|
|
2294
1299
|
this.changeDetectorRef = changeDetectorRef;
|
|
2295
1300
|
this.pageLimit = pageLimit;
|
|
2296
|
-
this.sorts = null;
|
|
2297
|
-
this.isLoading = false;
|
|
2298
|
-
this.loadedCompletely = false;
|
|
2299
|
-
this.hasLoaded = false;
|
|
2300
|
-
this._rows = null;
|
|
2301
|
-
this.loadingSubscription = null;
|
|
2302
|
-
this.loadingCallback = (/**
|
|
2303
|
-
* @return {?}
|
|
2304
|
-
*/
|
|
2305
|
-
() => {
|
|
2306
|
-
this.setLoading(false);
|
|
2307
|
-
});
|
|
2308
1301
|
}
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
1302
|
+
sorts = null;
|
|
1303
|
+
isLoading = false;
|
|
1304
|
+
loadedCompletely = false;
|
|
1305
|
+
hasLoaded = false;
|
|
1306
|
+
_rows = null;
|
|
1307
|
+
loadingSubscription = null;
|
|
1308
|
+
rowsChangeCallback;
|
|
1309
|
+
isLoadingCallback;
|
|
2312
1310
|
get rows() {
|
|
2313
1311
|
if (!this.hasLoaded) {
|
|
2314
1312
|
this.loadNextPage();
|
|
2315
1313
|
}
|
|
2316
1314
|
return this._rows;
|
|
2317
1315
|
}
|
|
2318
|
-
/**
|
|
2319
|
-
* @param {?} pageLink
|
|
2320
|
-
* @param {?} changeDetectorRef
|
|
2321
|
-
* @param {?=} pageLimit
|
|
2322
|
-
* @return {?}
|
|
2323
|
-
*/
|
|
2324
1316
|
static from(pageLink, changeDetectorRef, pageLimit = 200) {
|
|
2325
1317
|
return new LinkFieldPagingSupport(pageLink, changeDetectorRef, pageLimit);
|
|
2326
1318
|
}
|
|
2327
|
-
/**
|
|
2328
|
-
* @param {?} sorts
|
|
2329
|
-
* @param {?=} externalSorting
|
|
2330
|
-
* @return {?}
|
|
2331
|
-
*/
|
|
2332
1319
|
applySort(sorts, externalSorting = true) {
|
|
2333
1320
|
this.hasLoaded = false;
|
|
2334
1321
|
this.sorts = null;
|
|
@@ -2346,11 +1333,9 @@ class LinkFieldPagingSupport {
|
|
|
2346
1333
|
}
|
|
2347
1334
|
}
|
|
2348
1335
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
* @return {?}
|
|
2353
|
-
*/
|
|
1336
|
+
loadingCallback = () => {
|
|
1337
|
+
this.setLoading(false);
|
|
1338
|
+
};
|
|
2354
1339
|
loadNextPage(pageSize = this.pageLimit, resultCallback = null) {
|
|
2355
1340
|
if (this.pageLink && !this.isLoading) {
|
|
2356
1341
|
if (this.loadingSubscription) {
|
|
@@ -2361,7 +1346,6 @@ class LinkFieldPagingSupport {
|
|
|
2361
1346
|
this.loadedCompletely = false;
|
|
2362
1347
|
if (this._rows == null) {
|
|
2363
1348
|
this.setLoading(true);
|
|
2364
|
-
/** @type {?} */
|
|
2365
1349
|
const reqOptions = {};
|
|
2366
1350
|
if (this.sorts != null) {
|
|
2367
1351
|
reqOptions.sorting = this.sorts;
|
|
@@ -2369,37 +1353,26 @@ class LinkFieldPagingSupport {
|
|
|
2369
1353
|
if (pageSize != null) {
|
|
2370
1354
|
reqOptions.pageSize = pageSize;
|
|
2371
1355
|
}
|
|
2372
|
-
this.loadingSubscription = this.pageLink.initWithObs(null, reqOptions).subscribe((
|
|
2373
|
-
* @param {?} firstPage
|
|
2374
|
-
* @return {?}
|
|
2375
|
-
*/
|
|
2376
|
-
(firstPage) => {
|
|
1356
|
+
this.loadingSubscription = this.pageLink.initWithObs(null, reqOptions).subscribe((firstPage) => {
|
|
2377
1357
|
this.setRows(firstPage, resultCallback);
|
|
2378
|
-
}
|
|
1358
|
+
}, this.loadingCallback, this.loadingCallback);
|
|
2379
1359
|
}
|
|
2380
1360
|
else {
|
|
2381
|
-
/** @type {?} */
|
|
2382
1361
|
const lastRow = this.lastRow();
|
|
2383
1362
|
if (lastRow) {
|
|
2384
1363
|
if (lastRow.__meta.nextPage) {
|
|
2385
|
-
/** @type {?} */
|
|
2386
1364
|
let reqOptions = null;
|
|
2387
1365
|
if (pageSize != null) {
|
|
2388
1366
|
reqOptions = {
|
|
2389
1367
|
pageSize: pageSize
|
|
2390
1368
|
};
|
|
2391
1369
|
}
|
|
2392
|
-
/** @type {?} */
|
|
2393
1370
|
const nextPageObs = lastRow.__meta.nextPage.initWithObs(null, reqOptions);
|
|
2394
1371
|
if (nextPageObs) {
|
|
2395
1372
|
this.setLoading(true);
|
|
2396
|
-
this.loadingSubscription = nextPageObs.subscribe((
|
|
2397
|
-
* @param {?} nextPage
|
|
2398
|
-
* @return {?}
|
|
2399
|
-
*/
|
|
2400
|
-
(nextPage) => {
|
|
1373
|
+
this.loadingSubscription = nextPageObs.subscribe((nextPage) => {
|
|
2401
1374
|
this.setRows(nextPage, resultCallback);
|
|
2402
|
-
}
|
|
1375
|
+
}, this.loadingCallback, this.loadingCallback);
|
|
2403
1376
|
}
|
|
2404
1377
|
}
|
|
2405
1378
|
}
|
|
@@ -2409,25 +1382,12 @@ class LinkFieldPagingSupport {
|
|
|
2409
1382
|
this.clearRows();
|
|
2410
1383
|
}
|
|
2411
1384
|
}
|
|
2412
|
-
/**
|
|
2413
|
-
* @return {?}
|
|
2414
|
-
*/
|
|
2415
1385
|
loadEverything() {
|
|
2416
1386
|
this.loadNextPage(null);
|
|
2417
1387
|
}
|
|
2418
|
-
/**
|
|
2419
|
-
* @private
|
|
2420
|
-
* @return {?}
|
|
2421
|
-
*/
|
|
2422
1388
|
lastRow() {
|
|
2423
1389
|
return this._rows[this._rows.length - 1];
|
|
2424
1390
|
}
|
|
2425
|
-
/**
|
|
2426
|
-
* @private
|
|
2427
|
-
* @param {?} additionalPage
|
|
2428
|
-
* @param {?} loadCallback
|
|
2429
|
-
* @return {?}
|
|
2430
|
-
*/
|
|
2431
1391
|
setRows(additionalPage, loadCallback) {
|
|
2432
1392
|
if (this._rows) {
|
|
2433
1393
|
this._rows = [...this.rows, ...additionalPage];
|
|
@@ -2440,22 +1400,13 @@ class LinkFieldPagingSupport {
|
|
|
2440
1400
|
}
|
|
2441
1401
|
this.reflectChanges();
|
|
2442
1402
|
}
|
|
2443
|
-
/**
|
|
2444
|
-
* @private
|
|
2445
|
-
* @return {?}
|
|
2446
|
-
*/
|
|
2447
1403
|
clearRows() {
|
|
2448
1404
|
if (this._rows != null) {
|
|
2449
1405
|
this._rows = null;
|
|
2450
1406
|
this.reflectChanges();
|
|
2451
1407
|
}
|
|
2452
1408
|
}
|
|
2453
|
-
/**
|
|
2454
|
-
* @private
|
|
2455
|
-
* @return {?}
|
|
2456
|
-
*/
|
|
2457
1409
|
reflectChanges() {
|
|
2458
|
-
/** @type {?} */
|
|
2459
1410
|
const lastRow = this.lastRow();
|
|
2460
1411
|
if (lastRow && lastRow.__meta) {
|
|
2461
1412
|
this.loadedCompletely = lastRow.__meta.nextPage == null;
|
|
@@ -2468,11 +1419,6 @@ class LinkFieldPagingSupport {
|
|
|
2468
1419
|
}
|
|
2469
1420
|
this.changeDetectorRef.detectChanges();
|
|
2470
1421
|
}
|
|
2471
|
-
/**
|
|
2472
|
-
* @private
|
|
2473
|
-
* @param {?} isLoading
|
|
2474
|
-
* @return {?}
|
|
2475
|
-
*/
|
|
2476
1422
|
setLoading(isLoading) {
|
|
2477
1423
|
this.isLoading = isLoading;
|
|
2478
1424
|
if (this.isLoadingCallback) {
|
|
@@ -2480,41 +1426,22 @@ class LinkFieldPagingSupport {
|
|
|
2480
1426
|
}
|
|
2481
1427
|
this.changeDetectorRef.detectChanges();
|
|
2482
1428
|
}
|
|
2483
|
-
/**
|
|
2484
|
-
* @return {?}
|
|
2485
|
-
*/
|
|
2486
1429
|
dispose() {
|
|
2487
1430
|
this.rowsChangeCallback = null;
|
|
2488
1431
|
this.isLoadingCallback = null;
|
|
2489
1432
|
}
|
|
2490
|
-
/**
|
|
2491
|
-
* @param {?} pageLink
|
|
2492
|
-
* @return {?}
|
|
2493
|
-
*/
|
|
2494
1433
|
setPageLink(pageLink) {
|
|
2495
1434
|
this.clearState();
|
|
2496
1435
|
this.pageLink = pageLink;
|
|
2497
1436
|
this.loadNextPage();
|
|
2498
1437
|
}
|
|
2499
|
-
/**
|
|
2500
|
-
* @return {?}
|
|
2501
|
-
*/
|
|
2502
1438
|
hasLoadedCompletely() {
|
|
2503
1439
|
return this.loadedCompletely;
|
|
2504
1440
|
}
|
|
2505
|
-
/**
|
|
2506
|
-
* @param {?} rowsChangeCallback
|
|
2507
|
-
* @param {?=} isLoadingCallback
|
|
2508
|
-
* @return {?}
|
|
2509
|
-
*/
|
|
2510
1441
|
init(rowsChangeCallback, isLoadingCallback = null) {
|
|
2511
1442
|
this.rowsChangeCallback = rowsChangeCallback;
|
|
2512
1443
|
this.isLoadingCallback = isLoadingCallback;
|
|
2513
1444
|
}
|
|
2514
|
-
/**
|
|
2515
|
-
* @private
|
|
2516
|
-
* @return {?}
|
|
2517
|
-
*/
|
|
2518
1445
|
clearState() {
|
|
2519
1446
|
this.isLoading = false;
|
|
2520
1447
|
this.loadedCompletely = false;
|
|
@@ -2526,61 +1453,9 @@ class LinkFieldPagingSupport {
|
|
|
2526
1453
|
}
|
|
2527
1454
|
}
|
|
2528
1455
|
}
|
|
2529
|
-
if (false) {
|
|
2530
|
-
/**
|
|
2531
|
-
* @type {?}
|
|
2532
|
-
* @private
|
|
2533
|
-
*/
|
|
2534
|
-
LinkFieldPagingSupport.prototype.sorts;
|
|
2535
|
-
/** @type {?} */
|
|
2536
|
-
LinkFieldPagingSupport.prototype.isLoading;
|
|
2537
|
-
/**
|
|
2538
|
-
* @type {?}
|
|
2539
|
-
* @private
|
|
2540
|
-
*/
|
|
2541
|
-
LinkFieldPagingSupport.prototype.loadedCompletely;
|
|
2542
|
-
/**
|
|
2543
|
-
* @type {?}
|
|
2544
|
-
* @private
|
|
2545
|
-
*/
|
|
2546
|
-
LinkFieldPagingSupport.prototype.hasLoaded;
|
|
2547
|
-
/**
|
|
2548
|
-
* @type {?}
|
|
2549
|
-
* @private
|
|
2550
|
-
*/
|
|
2551
|
-
LinkFieldPagingSupport.prototype._rows;
|
|
2552
|
-
/**
|
|
2553
|
-
* @type {?}
|
|
2554
|
-
* @private
|
|
2555
|
-
*/
|
|
2556
|
-
LinkFieldPagingSupport.prototype.loadingSubscription;
|
|
2557
|
-
/** @type {?} */
|
|
2558
|
-
LinkFieldPagingSupport.prototype.rowsChangeCallback;
|
|
2559
|
-
/** @type {?} */
|
|
2560
|
-
LinkFieldPagingSupport.prototype.isLoadingCallback;
|
|
2561
|
-
/**
|
|
2562
|
-
* @type {?}
|
|
2563
|
-
* @private
|
|
2564
|
-
*/
|
|
2565
|
-
LinkFieldPagingSupport.prototype.loadingCallback;
|
|
2566
|
-
/**
|
|
2567
|
-
* @type {?}
|
|
2568
|
-
* @private
|
|
2569
|
-
*/
|
|
2570
|
-
LinkFieldPagingSupport.prototype.pageLink;
|
|
2571
|
-
/**
|
|
2572
|
-
* @type {?}
|
|
2573
|
-
* @private
|
|
2574
|
-
*/
|
|
2575
|
-
LinkFieldPagingSupport.prototype.changeDetectorRef;
|
|
2576
|
-
/** @type {?} */
|
|
2577
|
-
LinkFieldPagingSupport.prototype.pageLimit;
|
|
2578
|
-
}
|
|
2579
1456
|
class SortInfo {
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
* @param {?} dir
|
|
2583
|
-
*/
|
|
1457
|
+
field;
|
|
1458
|
+
dir;
|
|
2584
1459
|
constructor(field, dir) {
|
|
2585
1460
|
this.field = field;
|
|
2586
1461
|
this.dir = dir;
|
|
@@ -2590,61 +1465,27 @@ class SortInfo {
|
|
|
2590
1465
|
}
|
|
2591
1466
|
}
|
|
2592
1467
|
}
|
|
2593
|
-
if (false) {
|
|
2594
|
-
/** @type {?} */
|
|
2595
|
-
SortInfo.prototype.field;
|
|
2596
|
-
/** @type {?} */
|
|
2597
|
-
SortInfo.prototype.dir;
|
|
2598
|
-
}
|
|
2599
1468
|
|
|
2600
|
-
/**
|
|
2601
|
-
* @fileoverview added by tsickle
|
|
2602
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2603
|
-
*/
|
|
2604
|
-
/**
|
|
2605
|
-
* @template T
|
|
2606
|
-
*/
|
|
2607
1469
|
class MockLinkField extends LinkField {
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
* @param {?} delay
|
|
2611
|
-
*/
|
|
1470
|
+
valueToLoad;
|
|
1471
|
+
delay;
|
|
2612
1472
|
constructor(valueToLoad, delay) {
|
|
2613
1473
|
super(null, null);
|
|
2614
1474
|
this.valueToLoad = valueToLoad;
|
|
2615
1475
|
this.delay = delay;
|
|
2616
1476
|
}
|
|
2617
|
-
/**
|
|
2618
|
-
* @param {?=} params
|
|
2619
|
-
* @param {?=} requestOptions
|
|
2620
|
-
* @return {?}
|
|
2621
|
-
*/
|
|
2622
1477
|
callWithObs(params = null, requestOptions = null) {
|
|
2623
1478
|
return of(this.valueToLoad).pipe(delay(this.delay));
|
|
2624
1479
|
}
|
|
2625
1480
|
}
|
|
2626
|
-
if (false) {
|
|
2627
|
-
/**
|
|
2628
|
-
* @type {?}
|
|
2629
|
-
* @private
|
|
2630
|
-
*/
|
|
2631
|
-
MockLinkField.prototype.valueToLoad;
|
|
2632
|
-
/**
|
|
2633
|
-
* @type {?}
|
|
2634
|
-
* @private
|
|
2635
|
-
*/
|
|
2636
|
-
MockLinkField.prototype.delay;
|
|
2637
|
-
}
|
|
2638
1481
|
|
|
2639
|
-
|
|
2640
|
-
*
|
|
2641
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1482
|
+
/*
|
|
1483
|
+
* Public API Surface of micropermit
|
|
2642
1484
|
*/
|
|
2643
1485
|
|
|
2644
1486
|
/**
|
|
2645
|
-
*
|
|
2646
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1487
|
+
* Generated bundle index. Do not edit.
|
|
2647
1488
|
*/
|
|
2648
1489
|
|
|
2649
1490
|
export { CallLinkDirective, CallState, CallStatus, CallableLink, LinkField, LinkFieldContext, LinkFieldDirective, LinkFieldPagingSupport, LinkFieldPipe, LinkSerializer, MicroClient, MicroClientErrorIndicatorComponent, MicroClientLoadError, MicroClientLoadingIndicatorComponent, MicroClientModule, MicroError, MicroLinkValidateDirective, MicroObject, MicroObjectMetadata, MockLinkField, ParamUtils, SortInfo };
|
|
2650
|
-
//# sourceMappingURL=micropermit-client-angular.
|
|
1491
|
+
//# sourceMappingURL=micropermit-client-angular.mjs.map
|