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