@stemy/ngx-utils 13.0.3 → 13.0.6
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/esm2020/ngx-utils/common-types.mjs +1 -1
- package/esm2020/ngx-utils/directives/async-method.base.mjs +16 -6
- package/esm2020/ngx-utils/directives/async-method.directive.mjs +4 -11
- package/esm2020/ngx-utils/ngx-utils.imports.mjs +3 -1
- package/esm2020/ngx-utils/ngx-utils.module.mjs +46 -20
- package/esm2020/ngx-utils/services/config.service.mjs +12 -15
- package/fesm2015/stemy-ngx-utils.mjs +56 -31
- package/fesm2015/stemy-ngx-utils.mjs.map +1 -1
- package/fesm2020/stemy-ngx-utils.mjs +54 -29
- package/fesm2020/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +1 -0
- package/ngx-utils/directives/async-method.base.d.ts +4 -4
- package/ngx-utils/directives/async-method.directive.d.ts +1 -2
- package/ngx-utils/ngx-utils.module.d.ts +21 -19
- package/ngx-utils/services/config.service.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, TemplateRef, PLATFORM_ID, Injectable, Inject, Optional, Injector, EventEmitter, isDevMode, ErrorHandler, NgZone, Pipe, Input, Output, HostBinding, HostListener,
|
|
2
|
+
import { InjectionToken, TemplateRef, PLATFORM_ID, Injectable, Inject, Optional, Injector, EventEmitter, isDevMode, ErrorHandler, NgZone, Pipe, Directive, Input, Output, HostBinding, HostListener, Component, ContentChildren, ViewChild, ContentChild, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import { utc } from 'moment';
|
|
5
5
|
import { first, skipWhile, mergeMap, timeout, map } from 'rxjs/operators';
|
|
@@ -9,11 +9,12 @@ import { __awaiter } from 'tslib';
|
|
|
9
9
|
import * as i2 from '@angular/router';
|
|
10
10
|
import { ActivatedRouteSnapshot, NavigationEnd, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer } from '@angular/router';
|
|
11
11
|
import * as i1$3 from '@angular/common';
|
|
12
|
-
import { isPlatformBrowser, isPlatformServer, DOCUMENT, CommonModule } from '@angular/common';
|
|
12
|
+
import { isPlatformBrowser, isPlatformServer, APP_BASE_HREF, DOCUMENT, CommonModule } from '@angular/common';
|
|
13
13
|
import * as i1 from 'ngx-device-detector';
|
|
14
14
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
15
15
|
import * as i1$1 from '@angular/common/http';
|
|
16
16
|
import { HttpClient, HttpHeaders, HttpParams, HttpUrlEncodingCodec, HttpEventType } from '@angular/common/http';
|
|
17
|
+
import * as JSON5 from 'json5';
|
|
17
18
|
import * as i1$2 from '@angular/platform-browser';
|
|
18
19
|
import { ɵDomEventsPlugin, EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
19
20
|
import { addListener, removeListener } from 'resize-detector';
|
|
@@ -2495,26 +2496,18 @@ class StaticAuthService {
|
|
|
2495
2496
|
}
|
|
2496
2497
|
|
|
2497
2498
|
class ConfigService {
|
|
2498
|
-
constructor(http, universal, rootElement, baseConfig = null, scriptParams = null) {
|
|
2499
|
+
constructor(http, universal, rootElement, baseHref, baseConfig = null, scriptParams = null) {
|
|
2499
2500
|
this.http = http;
|
|
2500
2501
|
this.universal = universal;
|
|
2501
2502
|
this.rootElement = rootElement;
|
|
2503
|
+
this.baseHref = baseHref;
|
|
2502
2504
|
for (const key in []) {
|
|
2503
2505
|
Object.defineProperty(Array.prototype, key, {
|
|
2504
2506
|
enumerable: false
|
|
2505
2507
|
});
|
|
2506
2508
|
}
|
|
2507
|
-
let baseUrl = "";
|
|
2508
|
-
if (this.universal.isBrowser) {
|
|
2509
|
-
const currentScript = document.currentScript;
|
|
2510
|
-
if (!!currentScript) {
|
|
2511
|
-
const scriptSrc = currentScript.src;
|
|
2512
|
-
const srcParts = scriptSrc.split(".js");
|
|
2513
|
-
baseUrl = scriptSrc.substr(0, srcParts[0].lastIndexOf("/") + 1);
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
2509
|
this.baseConfig = baseConfig || {};
|
|
2517
|
-
this.loadedConfig = Object.assign(!
|
|
2510
|
+
this.loadedConfig = Object.assign(!this.baseHref ? {} : { baseUrl: this.baseHref, baseDomain: this.parseDomain(this.baseHref) }, this.baseConfig);
|
|
2518
2511
|
this.scriptParameters = scriptParams || {};
|
|
2519
2512
|
this.loaderFunc = () => {
|
|
2520
2513
|
this.loader = this.loader || new Promise((resolve, reject) => {
|
|
@@ -2560,7 +2553,7 @@ class ConfigService {
|
|
|
2560
2553
|
const configUrl = this.configUrl;
|
|
2561
2554
|
try {
|
|
2562
2555
|
const config5 = yield this.http.get(isDevMode() ? `${configUrl}5` : configUrl, { responseType: "text" }).toPromise();
|
|
2563
|
-
return
|
|
2556
|
+
return JSON5.parse(config5);
|
|
2564
2557
|
}
|
|
2565
2558
|
catch (e) {
|
|
2566
2559
|
try {
|
|
@@ -2599,7 +2592,7 @@ class ConfigService {
|
|
|
2599
2592
|
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
|
2600
2593
|
}
|
|
2601
2594
|
}
|
|
2602
|
-
ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, deps: [{ token: i1$1.HttpClient }, { token: UniversalService }, { token: ROOT_ELEMENT }, { token: BASE_CONFIG, optional: true }, { token: SCRIPT_PARAMS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2595
|
+
ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, deps: [{ token: i1$1.HttpClient }, { token: UniversalService }, { token: ROOT_ELEMENT }, { token: APP_BASE_HREF }, { token: BASE_CONFIG, optional: true }, { token: SCRIPT_PARAMS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2603
2596
|
ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService });
|
|
2604
2597
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, decorators: [{
|
|
2605
2598
|
type: Injectable
|
|
@@ -2607,6 +2600,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
2607
2600
|
return [{ type: i1$1.HttpClient }, { type: UniversalService }, { type: undefined, decorators: [{
|
|
2608
2601
|
type: Inject,
|
|
2609
2602
|
args: [ROOT_ELEMENT]
|
|
2603
|
+
}] }, { type: undefined, decorators: [{
|
|
2604
|
+
type: Inject,
|
|
2605
|
+
args: [APP_BASE_HREF]
|
|
2610
2606
|
}] }, { type: IConfiguration, decorators: [{
|
|
2611
2607
|
type: Optional
|
|
2612
2608
|
}, {
|
|
@@ -3973,6 +3969,9 @@ class AsyncMethodBase {
|
|
|
3973
3969
|
get isLoading() {
|
|
3974
3970
|
return this.loading;
|
|
3975
3971
|
}
|
|
3972
|
+
getMethod() {
|
|
3973
|
+
return () => __awaiter(this, void 0, void 0, function* () { return null; });
|
|
3974
|
+
}
|
|
3976
3975
|
click() {
|
|
3977
3976
|
if (this.disabled)
|
|
3978
3977
|
return;
|
|
@@ -4004,11 +4003,19 @@ class AsyncMethodBase {
|
|
|
4004
4003
|
return true;
|
|
4005
4004
|
}
|
|
4006
4005
|
}
|
|
4007
|
-
AsyncMethodBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, deps:
|
|
4008
|
-
AsyncMethodBase.ɵ
|
|
4006
|
+
AsyncMethodBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, deps: [{ token: TOASTER_SERVICE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4007
|
+
AsyncMethodBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AsyncMethodBase, selector: "[__asmb__]", inputs: { disabled: "disabled", context: "context" }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click()" }, properties: { "class.disabled": "this.isDisabled", "class.loading": "this.isLoading" } }, ngImport: i0 });
|
|
4009
4008
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, decorators: [{
|
|
4010
|
-
type:
|
|
4011
|
-
|
|
4009
|
+
type: Directive,
|
|
4010
|
+
args: [{
|
|
4011
|
+
selector: "[__asmb__]"
|
|
4012
|
+
}]
|
|
4013
|
+
}], ctorParameters: function () {
|
|
4014
|
+
return [{ type: undefined, decorators: [{
|
|
4015
|
+
type: Inject,
|
|
4016
|
+
args: [TOASTER_SERVICE]
|
|
4017
|
+
}] }];
|
|
4018
|
+
}, propDecorators: { disabled: [{
|
|
4012
4019
|
type: Input
|
|
4013
4020
|
}], context: [{
|
|
4014
4021
|
type: Input
|
|
@@ -4028,14 +4035,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
4028
4035
|
}] } });
|
|
4029
4036
|
|
|
4030
4037
|
class AsyncMethodDirective extends AsyncMethodBase {
|
|
4031
|
-
constructor(toaster) {
|
|
4032
|
-
super(toaster);
|
|
4033
|
-
}
|
|
4034
4038
|
getMethod() {
|
|
4035
4039
|
return this.method;
|
|
4036
4040
|
}
|
|
4037
4041
|
}
|
|
4038
|
-
AsyncMethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, deps:
|
|
4042
|
+
AsyncMethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
4039
4043
|
AsyncMethodDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AsyncMethodDirective, selector: "[async-method]", inputs: { method: ["async-method", "method"] }, exportAs: ["async-method"], usesInheritance: true, ngImport: i0 });
|
|
4040
4044
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, decorators: [{
|
|
4041
4045
|
type: Directive,
|
|
@@ -4043,12 +4047,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
4043
4047
|
selector: "[async-method]",
|
|
4044
4048
|
exportAs: "async-method"
|
|
4045
4049
|
}]
|
|
4046
|
-
}],
|
|
4047
|
-
return [{ type: undefined, decorators: [{
|
|
4048
|
-
type: Inject,
|
|
4049
|
-
args: [TOASTER_SERVICE]
|
|
4050
|
-
}] }];
|
|
4051
|
-
}, propDecorators: { method: [{
|
|
4050
|
+
}], propDecorators: { method: [{
|
|
4052
4051
|
type: Input,
|
|
4053
4052
|
args: ["async-method"]
|
|
4054
4053
|
}] } });
|
|
@@ -4966,6 +4965,7 @@ const pipes = [
|
|
|
4966
4965
|
];
|
|
4967
4966
|
// --- Directives ---
|
|
4968
4967
|
const directives = [
|
|
4968
|
+
AsyncMethodBase,
|
|
4969
4969
|
AsyncMethodDirective,
|
|
4970
4970
|
BackgroundDirective,
|
|
4971
4971
|
DynamicTableTemplateDirective,
|
|
@@ -5033,6 +5033,26 @@ function loadConfig(config) {
|
|
|
5033
5033
|
return config.load;
|
|
5034
5034
|
}
|
|
5035
5035
|
|
|
5036
|
+
function loadBaseHref() {
|
|
5037
|
+
if (typeof (document) === "undefined" || typeof (location) === "undefined")
|
|
5038
|
+
return "/";
|
|
5039
|
+
const currentScript = document.currentScript;
|
|
5040
|
+
if (!currentScript) {
|
|
5041
|
+
try {
|
|
5042
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
5043
|
+
throw new Error();
|
|
5044
|
+
}
|
|
5045
|
+
catch (e) {
|
|
5046
|
+
const qualifiedUrl = location.protocol + "//" + location.host;
|
|
5047
|
+
const srcUrl = (e.stack || "").match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) || e.stack.match(/http([A-Z:\/\-\.]+)\.js/gi).shift();
|
|
5048
|
+
const lastIndex = srcUrl.lastIndexOf("/");
|
|
5049
|
+
return lastIndex < 0 ? "/" : srcUrl.substring(0, lastIndex + 1);
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
const scriptSrc = currentScript.src;
|
|
5053
|
+
const lastIndex = scriptSrc.lastIndexOf("/");
|
|
5054
|
+
return lastIndex < 0 ? "/" : scriptSrc.substring(0, lastIndex + 1);
|
|
5055
|
+
}
|
|
5036
5056
|
class NgxUtilsModule {
|
|
5037
5057
|
constructor() {
|
|
5038
5058
|
}
|
|
@@ -5082,14 +5102,19 @@ class NgxUtilsModule {
|
|
|
5082
5102
|
useFactory: (!config ? null : config.initializeApp) || loadConfig,
|
|
5083
5103
|
multi: true,
|
|
5084
5104
|
deps: [(!config ? null : config.initializeApp) ? Injector : CONFIG_SERVICE]
|
|
5105
|
+
},
|
|
5106
|
+
{
|
|
5107
|
+
provide: APP_BASE_HREF,
|
|
5108
|
+
useFactory: (!config ? null : config.baseHref) || loadBaseHref,
|
|
5109
|
+
deps: [Injector]
|
|
5085
5110
|
}
|
|
5086
5111
|
]
|
|
5087
5112
|
};
|
|
5088
5113
|
}
|
|
5089
5114
|
}
|
|
5090
5115
|
NgxUtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5091
|
-
NgxUtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, declarations: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, TranslatePipe, ValuesPipe, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent], imports: [CommonModule,
|
|
5092
|
-
FormsModule], exports: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, TranslatePipe, ValuesPipe, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent, FormsModule] });
|
|
5116
|
+
NgxUtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, declarations: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, TranslatePipe, ValuesPipe, AsyncMethodBase, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent], imports: [CommonModule,
|
|
5117
|
+
FormsModule], exports: [ChunkPipe, EntriesPipe, ExtraItemPropertiesPipe, FilterPipe, FindPipe, FormatNumberPipe, GetOffsetPipe, GetTypePipe, GlobalTemplatePipe, GroupByPipe, IsTypePipe, JoinPipe, KeysPipe, MapPipe, MaxPipe, MinPipe, ReducePipe, RemapPipe, ReplacePipe, ReversePipe, RoundPipe, SafeHtmlPipe, TranslatePipe, ValuesPipe, AsyncMethodBase, AsyncMethodDirective, BackgroundDirective, DynamicTableTemplateDirective, GlobalTemplateDirective, IconDirective, NgxTemplateOutletDirective, PaginationDirective, PaginationItemDirective, ResourceIfDirective, StickyDirective, StickyClassDirective, UnorderedListItemDirective, UnorderedListTemplateDirective, DynamicTableComponent, PaginationMenuComponent, UnorderedListComponent, FormsModule] });
|
|
5093
5118
|
NgxUtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, providers: pipes, imports: [[
|
|
5094
5119
|
CommonModule,
|
|
5095
5120
|
FormsModule
|