@stemy/ngx-utils 19.7.20 → 19.7.21
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/fesm2022/stemy-ngx-utils.mjs +243 -193
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +10 -3
- package/ngx-utils/components/upload/upload.component.d.ts +2 -3
- package/ngx-utils/ngx-utils.imports.d.ts +2 -2
- package/ngx-utils/services/base-http.client.d.ts +10 -9
- package/ngx-utils/services/base-http.service.d.ts +8 -4
- package/ngx-utils/services/request-bag.d.ts +15 -0
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'zone.js';
|
|
2
|
-
import 'reflect-metadata';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
3
|
import { InjectionToken, PLATFORM_ID, Inject, Injectable, Optional, Injector, inject, untracked, computed, signal, DestroyRef, isDevMode, ErrorHandler, EventEmitter, createComponent, NgZone, Pipe, input, output, ChangeDetectorRef, ElementRef, effect, HostListener, Directive, Input, HostBinding, Output, TemplateRef, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewChild, forwardRef, ContentChild, ContentChildren, Renderer2, model, contentChildren, provideAppInitializer, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
4
|
+
import 'reflect-metadata';
|
|
5
5
|
import * as i2 from '@angular/router';
|
|
6
6
|
import { ActivatedRouteSnapshot, Scroll, NavigationEnd, Router, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer, ROUTES } from '@angular/router';
|
|
7
7
|
import { BehaviorSubject, Observable, firstValueFrom, Subject, Subscription, from, delay, timer, TimeoutError, combineLatest, isObservable, of, lastValueFrom } from 'rxjs';
|
|
@@ -13,7 +13,7 @@ import { DeviceDetectorService } from 'ngx-device-detector';
|
|
|
13
13
|
import { DateTime } from 'luxon';
|
|
14
14
|
import { Invokable } from 'invokable';
|
|
15
15
|
import * as i1$1 from '@angular/common/http';
|
|
16
|
-
import {
|
|
16
|
+
import { HttpHeaders, HttpParams, HttpUrlEncodingCodec, HttpClient, HttpEventType, HttpResponse } from '@angular/common/http';
|
|
17
17
|
import JSON5 from 'json5';
|
|
18
18
|
import * as i1$2 from '@angular/platform-browser';
|
|
19
19
|
import { ɵDomEventsPlugin as _DomEventsPlugin, EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
@@ -22,6 +22,136 @@ import { shift, limitShift, autoPlacement, arrow, computePosition, autoUpdate }
|
|
|
22
22
|
import * as i2$1 from '@angular/forms';
|
|
23
23
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
24
24
|
|
|
25
|
+
class CanvasColor {
|
|
26
|
+
constructor(r, g, b, a = 255) {
|
|
27
|
+
this.r = r;
|
|
28
|
+
this.g = g;
|
|
29
|
+
this.b = b;
|
|
30
|
+
this.a = a;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// --- Storage Service ---
|
|
34
|
+
var StorageMode;
|
|
35
|
+
(function (StorageMode) {
|
|
36
|
+
StorageMode[StorageMode["Local"] = 0] = "Local";
|
|
37
|
+
StorageMode[StorageMode["Session"] = 1] = "Session";
|
|
38
|
+
})(StorageMode || (StorageMode = {}));
|
|
39
|
+
// --- Reflect utils ---
|
|
40
|
+
function FactoryDependencies(...dependencies) {
|
|
41
|
+
return function (target, method) {
|
|
42
|
+
Reflect.defineMetadata("factoryDependencies", dependencies, target, method);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function ObjectType(type) {
|
|
46
|
+
return function (target) {
|
|
47
|
+
Reflect.defineMetadata("objectType", type, target);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
class PaginationItemContext {
|
|
51
|
+
constructor(item, parallelItem, count, index, dataIndex) {
|
|
52
|
+
this.item = item;
|
|
53
|
+
this.parallelItem = parallelItem;
|
|
54
|
+
this.count = count;
|
|
55
|
+
this.index = index;
|
|
56
|
+
this.dataIndex = dataIndex;
|
|
57
|
+
}
|
|
58
|
+
get first() {
|
|
59
|
+
return this.index === 0;
|
|
60
|
+
}
|
|
61
|
+
get last() {
|
|
62
|
+
return this.index === this.count - 1;
|
|
63
|
+
}
|
|
64
|
+
get even() {
|
|
65
|
+
return this.index % 2 === 0;
|
|
66
|
+
}
|
|
67
|
+
get odd() {
|
|
68
|
+
return !this.even;
|
|
69
|
+
}
|
|
70
|
+
// Support for old dynamic table implementation
|
|
71
|
+
get row() {
|
|
72
|
+
console.log("DynamicTable row is deprecated use item instead");
|
|
73
|
+
return this.item;
|
|
74
|
+
}
|
|
75
|
+
// Support for old dynamic table implementation
|
|
76
|
+
get parallelRow() {
|
|
77
|
+
console.log("DynamicTable parallelRow is deprecated use parallelItem instead");
|
|
78
|
+
return this.parallelItem;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// --- Resource if ---
|
|
82
|
+
class ResourceIfContext {
|
|
83
|
+
}
|
|
84
|
+
class IConfiguration {
|
|
85
|
+
}
|
|
86
|
+
// --- Valued promise ---
|
|
87
|
+
class ValuedPromise extends Promise {
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const ICON_TYPE = new InjectionToken("icon-component-type");
|
|
91
|
+
const ICON_MAP = new InjectionToken("icon-map");
|
|
92
|
+
const BUTTON_TYPE = new InjectionToken("button-component-type");
|
|
93
|
+
const OPTIONS_TOKEN = new InjectionToken("custom-options-token");
|
|
94
|
+
const ICON_SERVICE = new InjectionToken("icon-service");
|
|
95
|
+
const LANGUAGE_SERVICE = new InjectionToken("language-service");
|
|
96
|
+
const AUTH_SERVICE = new InjectionToken("auth-service");
|
|
97
|
+
const TOASTER_SERVICE = new InjectionToken("toaster-service");
|
|
98
|
+
const DIALOG_SERVICE = new InjectionToken("dialog-service");
|
|
99
|
+
const SOCKET_IO_PATH = new InjectionToken("socket-io-path");
|
|
100
|
+
const PROMISE_SERVICE = new InjectionToken("promise-service");
|
|
101
|
+
const EXPRESS_REQUEST = new InjectionToken("express-request");
|
|
102
|
+
const API_SERVICE = new InjectionToken("api-service");
|
|
103
|
+
const DYNAMIC_ENTRY_COMPONENTS = new InjectionToken("dynamic-entry-components");
|
|
104
|
+
const DYNAMIC_MODULE_INFO = new InjectionToken("dynamic-module-info");
|
|
105
|
+
const APP_BASE_URL = new InjectionToken("app-base-url");
|
|
106
|
+
const CONFIG_SERVICE = new InjectionToken("config-service");
|
|
107
|
+
const BASE_CONFIG = new InjectionToken("base-config");
|
|
108
|
+
const SCRIPT_PARAMS = new InjectionToken("script-params");
|
|
109
|
+
const ROOT_ELEMENT = new InjectionToken("app-root-element");
|
|
110
|
+
const RESIZE_DELAY = new InjectionToken("resize-event-delay");
|
|
111
|
+
const RESIZE_STRATEGY = new InjectionToken("resize-event-strategy");
|
|
112
|
+
const ERROR_HANDLER = new InjectionToken("error-handler-callback");
|
|
113
|
+
const STATIC_SCHEMAS = new InjectionToken("static-openapi-schemas");
|
|
114
|
+
|
|
115
|
+
class AjaxRequestHandler {
|
|
116
|
+
static { this.isOverridden = false; }
|
|
117
|
+
constructor(pattern, callback) {
|
|
118
|
+
this.pattern = pattern;
|
|
119
|
+
this.callback = callback;
|
|
120
|
+
this.listener = (event) => {
|
|
121
|
+
const details = event.detail;
|
|
122
|
+
if (this.pattern.test(details.url))
|
|
123
|
+
this.callback(details, this.params);
|
|
124
|
+
};
|
|
125
|
+
this.params = {};
|
|
126
|
+
if (typeof XMLHttpRequest !== "undefined" && !AjaxRequestHandler.isOverridden) {
|
|
127
|
+
AjaxRequestHandler.isOverridden = true;
|
|
128
|
+
const originalOpen = XMLHttpRequest.prototype.open;
|
|
129
|
+
XMLHttpRequest.prototype.open = function (method, url) {
|
|
130
|
+
originalOpen.apply(this, arguments);
|
|
131
|
+
window.dispatchEvent(new CustomEvent("ajaxRequest", {
|
|
132
|
+
detail: {
|
|
133
|
+
request: this,
|
|
134
|
+
method: method,
|
|
135
|
+
url: url
|
|
136
|
+
}
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
listen() {
|
|
142
|
+
if (typeof window === "undefined")
|
|
143
|
+
return this;
|
|
144
|
+
window.addEventListener("ajaxRequest", this.listener);
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
forget() {
|
|
148
|
+
if (typeof window === "undefined")
|
|
149
|
+
return;
|
|
150
|
+
window.removeEventListener("ajaxRequest", this.listener);
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
25
155
|
function defaultPredicate(value, key, target, source) {
|
|
26
156
|
return true;
|
|
27
157
|
}
|
|
@@ -352,167 +482,6 @@ class ObjectUtils {
|
|
|
352
482
|
}
|
|
353
483
|
}
|
|
354
484
|
|
|
355
|
-
class ReflectUtils {
|
|
356
|
-
static defineMetadata(key, data, target, name) {
|
|
357
|
-
Reflect.defineMetadata(key, data, target, name);
|
|
358
|
-
}
|
|
359
|
-
static getMetadata(key, target, name) {
|
|
360
|
-
return Reflect.getMetadata(key, target, name);
|
|
361
|
-
}
|
|
362
|
-
static getOwnMetadata(key, target, name) {
|
|
363
|
-
return Reflect.getOwnMetadata(key, target, name);
|
|
364
|
-
}
|
|
365
|
-
static resolve(obj, injector) {
|
|
366
|
-
if (!ObjectUtils.checkInterface(obj, { func: "function" }))
|
|
367
|
-
return obj;
|
|
368
|
-
const factory = obj;
|
|
369
|
-
let depends;
|
|
370
|
-
if (factory.type) {
|
|
371
|
-
const method = ObjectUtils.getProperties(factory.type).find(function (key) {
|
|
372
|
-
return factory.type[key] === factory.func;
|
|
373
|
-
});
|
|
374
|
-
depends = ReflectUtils.getMetadata("factoryDependencies", factory.type, method) || [];
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
depends = ReflectUtils.getMetadata("factoryDependencies", factory.func) || [];
|
|
378
|
-
}
|
|
379
|
-
const parameters = depends.map(function (dep) {
|
|
380
|
-
return injector.get(dep);
|
|
381
|
-
}).concat(factory.params);
|
|
382
|
-
return factory.func.apply(null, parameters);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
class CanvasColor {
|
|
387
|
-
constructor(r, g, b, a = 255) {
|
|
388
|
-
this.r = r;
|
|
389
|
-
this.g = g;
|
|
390
|
-
this.b = b;
|
|
391
|
-
this.a = a;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
// --- Storage Service ---
|
|
395
|
-
var StorageMode;
|
|
396
|
-
(function (StorageMode) {
|
|
397
|
-
StorageMode[StorageMode["Local"] = 0] = "Local";
|
|
398
|
-
StorageMode[StorageMode["Session"] = 1] = "Session";
|
|
399
|
-
})(StorageMode || (StorageMode = {}));
|
|
400
|
-
// --- Reflect utils ---
|
|
401
|
-
function FactoryDependencies(...dependencies) {
|
|
402
|
-
return function (target, method) {
|
|
403
|
-
ReflectUtils.defineMetadata("factoryDependencies", dependencies, target, method);
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
function ObjectType(type) {
|
|
407
|
-
return function (target) {
|
|
408
|
-
ReflectUtils.defineMetadata("objectType", type, target);
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
|
-
class PaginationItemContext {
|
|
412
|
-
constructor(item, parallelItem, count, index, dataIndex) {
|
|
413
|
-
this.item = item;
|
|
414
|
-
this.parallelItem = parallelItem;
|
|
415
|
-
this.count = count;
|
|
416
|
-
this.index = index;
|
|
417
|
-
this.dataIndex = dataIndex;
|
|
418
|
-
}
|
|
419
|
-
get first() {
|
|
420
|
-
return this.index === 0;
|
|
421
|
-
}
|
|
422
|
-
get last() {
|
|
423
|
-
return this.index === this.count - 1;
|
|
424
|
-
}
|
|
425
|
-
get even() {
|
|
426
|
-
return this.index % 2 === 0;
|
|
427
|
-
}
|
|
428
|
-
get odd() {
|
|
429
|
-
return !this.even;
|
|
430
|
-
}
|
|
431
|
-
// Support for old dynamic table implementation
|
|
432
|
-
get row() {
|
|
433
|
-
console.log("DynamicTable row is deprecated use item instead");
|
|
434
|
-
return this.item;
|
|
435
|
-
}
|
|
436
|
-
// Support for old dynamic table implementation
|
|
437
|
-
get parallelRow() {
|
|
438
|
-
console.log("DynamicTable parallelRow is deprecated use parallelItem instead");
|
|
439
|
-
return this.parallelItem;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
// --- Resource if ---
|
|
443
|
-
class ResourceIfContext {
|
|
444
|
-
}
|
|
445
|
-
class IConfiguration {
|
|
446
|
-
}
|
|
447
|
-
// --- Valued promise ---
|
|
448
|
-
class ValuedPromise extends Promise {
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
const ICON_TYPE = new InjectionToken("icon-component-type");
|
|
452
|
-
const ICON_MAP = new InjectionToken("icon-map");
|
|
453
|
-
const BUTTON_TYPE = new InjectionToken("button-component-type");
|
|
454
|
-
const OPTIONS_TOKEN = new InjectionToken("custom-options-token");
|
|
455
|
-
const ICON_SERVICE = new InjectionToken("icon-service");
|
|
456
|
-
const LANGUAGE_SERVICE = new InjectionToken("language-service");
|
|
457
|
-
const AUTH_SERVICE = new InjectionToken("auth-service");
|
|
458
|
-
const TOASTER_SERVICE = new InjectionToken("toaster-service");
|
|
459
|
-
const DIALOG_SERVICE = new InjectionToken("dialog-service");
|
|
460
|
-
const SOCKET_IO_PATH = new InjectionToken("socket-io-path");
|
|
461
|
-
const PROMISE_SERVICE = new InjectionToken("promise-service");
|
|
462
|
-
const EXPRESS_REQUEST = new InjectionToken("express-request");
|
|
463
|
-
const API_SERVICE = new InjectionToken("api-service");
|
|
464
|
-
const DYNAMIC_ENTRY_COMPONENTS = new InjectionToken("dynamic-entry-components");
|
|
465
|
-
const DYNAMIC_MODULE_INFO = new InjectionToken("dynamic-module-info");
|
|
466
|
-
const APP_BASE_URL = new InjectionToken("app-base-url");
|
|
467
|
-
const CONFIG_SERVICE = new InjectionToken("config-service");
|
|
468
|
-
const BASE_CONFIG = new InjectionToken("base-config");
|
|
469
|
-
const SCRIPT_PARAMS = new InjectionToken("script-params");
|
|
470
|
-
const ROOT_ELEMENT = new InjectionToken("app-root-element");
|
|
471
|
-
const RESIZE_DELAY = new InjectionToken("resize-event-delay");
|
|
472
|
-
const RESIZE_STRATEGY = new InjectionToken("resize-event-strategy");
|
|
473
|
-
const ERROR_HANDLER = new InjectionToken("error-handler-callback");
|
|
474
|
-
const STATIC_SCHEMAS = new InjectionToken("static-openapi-schemas");
|
|
475
|
-
|
|
476
|
-
class AjaxRequestHandler {
|
|
477
|
-
static { this.isOverridden = false; }
|
|
478
|
-
constructor(pattern, callback) {
|
|
479
|
-
this.pattern = pattern;
|
|
480
|
-
this.callback = callback;
|
|
481
|
-
this.listener = (event) => {
|
|
482
|
-
const details = event.detail;
|
|
483
|
-
if (this.pattern.test(details.url))
|
|
484
|
-
this.callback(details, this.params);
|
|
485
|
-
};
|
|
486
|
-
this.params = {};
|
|
487
|
-
if (typeof XMLHttpRequest !== "undefined" && !AjaxRequestHandler.isOverridden) {
|
|
488
|
-
AjaxRequestHandler.isOverridden = true;
|
|
489
|
-
const originalOpen = XMLHttpRequest.prototype.open;
|
|
490
|
-
XMLHttpRequest.prototype.open = function (method, url) {
|
|
491
|
-
originalOpen.apply(this, arguments);
|
|
492
|
-
window.dispatchEvent(new CustomEvent("ajaxRequest", {
|
|
493
|
-
detail: {
|
|
494
|
-
request: this,
|
|
495
|
-
method: method,
|
|
496
|
-
url: url
|
|
497
|
-
}
|
|
498
|
-
}));
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
listen() {
|
|
503
|
-
if (typeof window === "undefined")
|
|
504
|
-
return this;
|
|
505
|
-
window.addEventListener("ajaxRequest", this.listener);
|
|
506
|
-
return this;
|
|
507
|
-
}
|
|
508
|
-
forget() {
|
|
509
|
-
if (typeof window === "undefined")
|
|
510
|
-
return;
|
|
511
|
-
window.removeEventListener("ajaxRequest", this.listener);
|
|
512
|
-
return this;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
485
|
class ArrayUtils {
|
|
517
486
|
static has(arr, ...items) {
|
|
518
487
|
if (!ObjectUtils.isArray(arr) || !ObjectUtils.isArray(items))
|
|
@@ -619,6 +588,37 @@ class ArrayUtils {
|
|
|
619
588
|
}
|
|
620
589
|
}
|
|
621
590
|
|
|
591
|
+
class ReflectUtils {
|
|
592
|
+
static defineMetadata(key, data, target, name) {
|
|
593
|
+
Reflect.defineMetadata(key, data, target, name);
|
|
594
|
+
}
|
|
595
|
+
static getMetadata(key, target, name) {
|
|
596
|
+
return Reflect.getMetadata(key, target, name);
|
|
597
|
+
}
|
|
598
|
+
static getOwnMetadata(key, target, name) {
|
|
599
|
+
return Reflect.getOwnMetadata(key, target, name);
|
|
600
|
+
}
|
|
601
|
+
static resolve(obj, injector) {
|
|
602
|
+
if (!ObjectUtils.checkInterface(obj, { func: "function" }))
|
|
603
|
+
return obj;
|
|
604
|
+
const factory = obj;
|
|
605
|
+
let depends;
|
|
606
|
+
if (factory.type) {
|
|
607
|
+
const method = ObjectUtils.getProperties(factory.type).find(function (key) {
|
|
608
|
+
return factory.type[key] === factory.func;
|
|
609
|
+
});
|
|
610
|
+
depends = ReflectUtils.getMetadata("factoryDependencies", factory.type, method) || [];
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
depends = ReflectUtils.getMetadata("factoryDependencies", factory.func) || [];
|
|
614
|
+
}
|
|
615
|
+
const parameters = depends.map(function (dep) {
|
|
616
|
+
return injector.get(dep);
|
|
617
|
+
}).concat(factory.params);
|
|
618
|
+
return factory.func.apply(null, parameters);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
622
|
/**
|
|
623
623
|
* Use this service to determine which is the current environment
|
|
624
624
|
*/
|
|
@@ -3106,25 +3106,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3106
3106
|
type: Injectable
|
|
3107
3107
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: StateService }, { type: EventsService }] });
|
|
3108
3108
|
|
|
3109
|
-
class
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
this.
|
|
3115
|
-
|
|
3116
|
-
|
|
3109
|
+
class RequestBag {
|
|
3110
|
+
get requestHeaders() {
|
|
3111
|
+
return this.headers;
|
|
3112
|
+
}
|
|
3113
|
+
get requestParams() {
|
|
3114
|
+
return this.params;
|
|
3115
|
+
}
|
|
3116
|
+
constructor(source) {
|
|
3117
|
+
this.source = source;
|
|
3118
|
+
this.headers = {};
|
|
3119
|
+
this.params = {};
|
|
3117
3120
|
}
|
|
3118
|
-
makeHeaders(
|
|
3119
|
-
|
|
3121
|
+
makeHeaders(headersObj, withCredentials = true) {
|
|
3122
|
+
const source = headersObj instanceof HttpHeaders ? this.convertHeaders(headersObj) : headersObj || {};
|
|
3123
|
+
const headers = Object.assign({}, this.source?.headers || {}, this.headers, source);
|
|
3120
3124
|
const authHeader = headers["Authorization"] || "";
|
|
3121
3125
|
if (!withCredentials && !authHeader.startsWith("Bearer")) {
|
|
3122
3126
|
delete headers["Authorization"];
|
|
3123
3127
|
}
|
|
3124
3128
|
return new HttpHeaders(headers);
|
|
3125
3129
|
}
|
|
3126
|
-
makeParams(
|
|
3127
|
-
params = Object.assign({}, this.
|
|
3130
|
+
makeParams(paramsObj) {
|
|
3131
|
+
const params = Object.assign({}, this.params?.headers || {}, this.params, paramsObj);
|
|
3128
3132
|
return new HttpParams({
|
|
3129
3133
|
encoder: new HttpUrlEncodingCodec(),
|
|
3130
3134
|
fromObject: Object.keys(params || {}).reduce((result, key) => {
|
|
@@ -3134,12 +3138,47 @@ class BaseHttpClient extends HttpClient {
|
|
|
3134
3138
|
}, {})
|
|
3135
3139
|
});
|
|
3136
3140
|
}
|
|
3137
|
-
|
|
3138
|
-
if (
|
|
3139
|
-
delete this.
|
|
3141
|
+
setHeader(name, value) {
|
|
3142
|
+
if (value === undefined) {
|
|
3143
|
+
delete this.headers[name];
|
|
3140
3144
|
return;
|
|
3141
3145
|
}
|
|
3142
|
-
this.
|
|
3146
|
+
this.headers[name] = value;
|
|
3147
|
+
}
|
|
3148
|
+
setParam(name, value) {
|
|
3149
|
+
if (value === undefined) {
|
|
3150
|
+
delete this.params[name];
|
|
3151
|
+
return;
|
|
3152
|
+
}
|
|
3153
|
+
this.params[name] = value;
|
|
3154
|
+
}
|
|
3155
|
+
convertHeaders(headers) {
|
|
3156
|
+
return headers.keys().reduce((res, key) => {
|
|
3157
|
+
res[key] = headers.getAll(key);
|
|
3158
|
+
return res;
|
|
3159
|
+
}, {});
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
class BaseHttpClient extends HttpClient {
|
|
3164
|
+
constructor(handler) {
|
|
3165
|
+
super(handler);
|
|
3166
|
+
this.bag = new RequestBag();
|
|
3167
|
+
}
|
|
3168
|
+
get requestHeaders() {
|
|
3169
|
+
return this.bag.requestHeaders;
|
|
3170
|
+
}
|
|
3171
|
+
get requestParams() {
|
|
3172
|
+
return this.bag.requestParams;
|
|
3173
|
+
}
|
|
3174
|
+
setHeader(name, value) {
|
|
3175
|
+
this.bag.setHeader(name, value);
|
|
3176
|
+
}
|
|
3177
|
+
setParam(name, value) {
|
|
3178
|
+
this.bag.setParam(name, value);
|
|
3179
|
+
}
|
|
3180
|
+
makeHeaders() {
|
|
3181
|
+
return this.bag.makeHeaders();
|
|
3143
3182
|
}
|
|
3144
3183
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BaseHttpClient, deps: [{ token: i1$1.HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3145
3184
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BaseHttpClient }); }
|
|
@@ -3232,20 +3271,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3232
3271
|
}], ctorParameters: () => [{ type: EventsService }] });
|
|
3233
3272
|
|
|
3234
3273
|
class BaseHttpService {
|
|
3235
|
-
static { this.failedRequests = []; }
|
|
3236
3274
|
get name() {
|
|
3237
3275
|
return "base";
|
|
3238
3276
|
}
|
|
3277
|
+
get requestHeaders() {
|
|
3278
|
+
return this.bag.requestHeaders;
|
|
3279
|
+
}
|
|
3280
|
+
get requestParams() {
|
|
3281
|
+
return this.bag.requestParams;
|
|
3282
|
+
}
|
|
3239
3283
|
get withCredentials() {
|
|
3240
3284
|
return true;
|
|
3241
3285
|
}
|
|
3286
|
+
get universal() {
|
|
3287
|
+
return this.storage.universal;
|
|
3288
|
+
}
|
|
3289
|
+
static { this.failedRequests = []; }
|
|
3242
3290
|
static retryFailedRequests() {
|
|
3243
3291
|
BaseHttpService.failedRequests.forEach(r => r());
|
|
3244
3292
|
BaseHttpService.failedRequests = [];
|
|
3245
3293
|
}
|
|
3246
|
-
get universal() {
|
|
3247
|
-
return this.storage.universal;
|
|
3248
|
-
}
|
|
3249
3294
|
constructor(injector, client, storage, caches, language, toaster, configs, request = null) {
|
|
3250
3295
|
this.injector = injector;
|
|
3251
3296
|
this.client = client;
|
|
@@ -3255,12 +3300,17 @@ class BaseHttpService {
|
|
|
3255
3300
|
this.toaster = toaster;
|
|
3256
3301
|
this.configs = configs;
|
|
3257
3302
|
this.request = request;
|
|
3258
|
-
this.
|
|
3259
|
-
this.requestParams = {};
|
|
3303
|
+
this.bag = new RequestBag(this.client.bag);
|
|
3260
3304
|
this.initService();
|
|
3261
3305
|
}
|
|
3262
3306
|
initService() {
|
|
3263
3307
|
}
|
|
3308
|
+
setHeader(name, value) {
|
|
3309
|
+
this.bag.setHeader(name, value);
|
|
3310
|
+
}
|
|
3311
|
+
setParam(name, value) {
|
|
3312
|
+
this.bag.setParam(name, value);
|
|
3313
|
+
}
|
|
3264
3314
|
cached(mode) {
|
|
3265
3315
|
if (mode === "auth") {
|
|
3266
3316
|
return this.caches.userChanged;
|
|
@@ -3274,7 +3324,7 @@ class BaseHttpService {
|
|
|
3274
3324
|
return url;
|
|
3275
3325
|
}
|
|
3276
3326
|
createUrl(url, params) {
|
|
3277
|
-
const httpParams = this.
|
|
3327
|
+
const httpParams = this.bag.makeParams(params);
|
|
3278
3328
|
const query = httpParams.keys().map(key => {
|
|
3279
3329
|
return `${key}=${httpParams.get(key)}`;
|
|
3280
3330
|
}).join("&");
|
|
@@ -3489,10 +3539,10 @@ class BaseHttpService {
|
|
|
3489
3539
|
return options;
|
|
3490
3540
|
}
|
|
3491
3541
|
makeHeaders(options) {
|
|
3492
|
-
return this.
|
|
3542
|
+
return this.bag.makeHeaders(options?.headers || {});
|
|
3493
3543
|
}
|
|
3494
3544
|
makeParams(options) {
|
|
3495
|
-
return this.
|
|
3545
|
+
return this.bag.makeParams(options?.params || {});
|
|
3496
3546
|
}
|
|
3497
3547
|
parseResponse(response, url, options, read) {
|
|
3498
3548
|
if (!read)
|
|
@@ -3503,7 +3553,7 @@ class BaseHttpService {
|
|
|
3503
3553
|
return ObjectUtils.isObject(response) ? response[read] : response;
|
|
3504
3554
|
}
|
|
3505
3555
|
parseUrl(url) {
|
|
3506
|
-
return this.url(url).replace(/(
|
|
3556
|
+
return this.url(url).replace(/((?!:).\/)\//g, "$1");
|
|
3507
3557
|
}
|
|
3508
3558
|
absoluteUrl(url, options) {
|
|
3509
3559
|
return this.parseUrl(url);
|
|
@@ -4243,7 +4293,7 @@ class LanguageService extends StaticLanguageService {
|
|
|
4243
4293
|
}
|
|
4244
4294
|
initService() {
|
|
4245
4295
|
super.initService();
|
|
4246
|
-
this.client.
|
|
4296
|
+
this.client.setParam("language", "de");
|
|
4247
4297
|
this.translationRequests = {};
|
|
4248
4298
|
this.languageSettings = new BehaviorSubject(null);
|
|
4249
4299
|
if (this.universal.isServer)
|
|
@@ -4277,8 +4327,8 @@ class LanguageService extends StaticLanguageService {
|
|
|
4277
4327
|
}
|
|
4278
4328
|
async useLanguage(lang) {
|
|
4279
4329
|
lang = this.languages.indexOf(lang) < 0 ? this.languages[0] : lang;
|
|
4280
|
-
this.client.
|
|
4281
|
-
if (lang
|
|
4330
|
+
this.client.setParam("language", lang);
|
|
4331
|
+
if (lang === this.currentLang)
|
|
4282
4332
|
return this.dictionary;
|
|
4283
4333
|
this.storage.set("language", lang);
|
|
4284
4334
|
this.currentLang = lang;
|
|
@@ -9314,5 +9364,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
9314
9364
|
* Generated bundle index. Do not edit.
|
|
9315
9365
|
*/
|
|
9316
9366
|
|
|
9317
|
-
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, EPSILON, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExclusionsRenderer, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, Oval, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, RulerCanvasRenderer, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, SyncAsyncPipe, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, hashCode, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, subPts, svgToDataUri, switchClass, toDegrees, toRadians, tripleProduct };
|
|
9367
|
+
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, EPSILON, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExclusionsRenderer, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, Oval, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, RequestBag, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, RulerCanvasRenderer, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, SyncAsyncPipe, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, hashCode, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, subPts, svgToDataUri, switchClass, toDegrees, toRadians, tripleProduct };
|
|
9318
9368
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|