@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';
|
|
@@ -8,11 +8,12 @@ import { Invokable } from 'invokable';
|
|
|
8
8
|
import * as i2 from '@angular/router';
|
|
9
9
|
import { ActivatedRouteSnapshot, NavigationEnd, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer } from '@angular/router';
|
|
10
10
|
import * as i1$3 from '@angular/common';
|
|
11
|
-
import { isPlatformBrowser, isPlatformServer, DOCUMENT, CommonModule } from '@angular/common';
|
|
11
|
+
import { isPlatformBrowser, isPlatformServer, APP_BASE_HREF, DOCUMENT, CommonModule } from '@angular/common';
|
|
12
12
|
import * as i1 from 'ngx-device-detector';
|
|
13
13
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
14
14
|
import * as i1$1 from '@angular/common/http';
|
|
15
15
|
import { HttpClient, HttpHeaders, HttpParams, HttpUrlEncodingCodec, HttpEventType } from '@angular/common/http';
|
|
16
|
+
import * as JSON5 from 'json5';
|
|
16
17
|
import * as i1$2 from '@angular/platform-browser';
|
|
17
18
|
import { ɵDomEventsPlugin, EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
18
19
|
import { addListener, removeListener } from 'resize-detector';
|
|
@@ -2468,26 +2469,18 @@ class StaticAuthService {
|
|
|
2468
2469
|
}
|
|
2469
2470
|
|
|
2470
2471
|
class ConfigService {
|
|
2471
|
-
constructor(http, universal, rootElement, baseConfig = null, scriptParams = null) {
|
|
2472
|
+
constructor(http, universal, rootElement, baseHref, baseConfig = null, scriptParams = null) {
|
|
2472
2473
|
this.http = http;
|
|
2473
2474
|
this.universal = universal;
|
|
2474
2475
|
this.rootElement = rootElement;
|
|
2476
|
+
this.baseHref = baseHref;
|
|
2475
2477
|
for (const key in []) {
|
|
2476
2478
|
Object.defineProperty(Array.prototype, key, {
|
|
2477
2479
|
enumerable: false
|
|
2478
2480
|
});
|
|
2479
2481
|
}
|
|
2480
|
-
let baseUrl = "";
|
|
2481
|
-
if (this.universal.isBrowser) {
|
|
2482
|
-
const currentScript = document.currentScript;
|
|
2483
|
-
if (!!currentScript) {
|
|
2484
|
-
const scriptSrc = currentScript.src;
|
|
2485
|
-
const srcParts = scriptSrc.split(".js");
|
|
2486
|
-
baseUrl = scriptSrc.substr(0, srcParts[0].lastIndexOf("/") + 1);
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
2482
|
this.baseConfig = baseConfig || {};
|
|
2490
|
-
this.loadedConfig = Object.assign(!
|
|
2483
|
+
this.loadedConfig = Object.assign(!this.baseHref ? {} : { baseUrl: this.baseHref, baseDomain: this.parseDomain(this.baseHref) }, this.baseConfig);
|
|
2491
2484
|
this.scriptParameters = scriptParams || {};
|
|
2492
2485
|
this.loaderFunc = () => {
|
|
2493
2486
|
this.loader = this.loader || new Promise((resolve, reject) => {
|
|
@@ -2532,7 +2525,7 @@ class ConfigService {
|
|
|
2532
2525
|
const configUrl = this.configUrl;
|
|
2533
2526
|
try {
|
|
2534
2527
|
const config5 = await this.http.get(isDevMode() ? `${configUrl}5` : configUrl, { responseType: "text" }).toPromise();
|
|
2535
|
-
return
|
|
2528
|
+
return JSON5.parse(config5);
|
|
2536
2529
|
}
|
|
2537
2530
|
catch (e) {
|
|
2538
2531
|
try {
|
|
@@ -2569,13 +2562,16 @@ class ConfigService {
|
|
|
2569
2562
|
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
|
2570
2563
|
}
|
|
2571
2564
|
}
|
|
2572
|
-
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 });
|
|
2565
|
+
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 });
|
|
2573
2566
|
ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService });
|
|
2574
2567
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, decorators: [{
|
|
2575
2568
|
type: Injectable
|
|
2576
2569
|
}], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: UniversalService }, { type: undefined, decorators: [{
|
|
2577
2570
|
type: Inject,
|
|
2578
2571
|
args: [ROOT_ELEMENT]
|
|
2572
|
+
}] }, { type: undefined, decorators: [{
|
|
2573
|
+
type: Inject,
|
|
2574
|
+
args: [APP_BASE_HREF]
|
|
2579
2575
|
}] }, { type: IConfiguration, decorators: [{
|
|
2580
2576
|
type: Optional
|
|
2581
2577
|
}, {
|
|
@@ -3912,6 +3908,9 @@ class AsyncMethodBase {
|
|
|
3912
3908
|
get isLoading() {
|
|
3913
3909
|
return this.loading;
|
|
3914
3910
|
}
|
|
3911
|
+
getMethod() {
|
|
3912
|
+
return async () => null;
|
|
3913
|
+
}
|
|
3915
3914
|
click() {
|
|
3916
3915
|
if (this.disabled)
|
|
3917
3916
|
return;
|
|
@@ -3943,11 +3942,17 @@ class AsyncMethodBase {
|
|
|
3943
3942
|
return true;
|
|
3944
3943
|
}
|
|
3945
3944
|
}
|
|
3946
|
-
AsyncMethodBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, deps:
|
|
3947
|
-
AsyncMethodBase.ɵ
|
|
3945
|
+
AsyncMethodBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, deps: [{ token: TOASTER_SERVICE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3946
|
+
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 });
|
|
3948
3947
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodBase, decorators: [{
|
|
3949
|
-
type:
|
|
3950
|
-
|
|
3948
|
+
type: Directive,
|
|
3949
|
+
args: [{
|
|
3950
|
+
selector: "[__asmb__]"
|
|
3951
|
+
}]
|
|
3952
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3953
|
+
type: Inject,
|
|
3954
|
+
args: [TOASTER_SERVICE]
|
|
3955
|
+
}] }]; }, propDecorators: { disabled: [{
|
|
3951
3956
|
type: Input
|
|
3952
3957
|
}], context: [{
|
|
3953
3958
|
type: Input
|
|
@@ -3967,14 +3972,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
3967
3972
|
}] } });
|
|
3968
3973
|
|
|
3969
3974
|
class AsyncMethodDirective extends AsyncMethodBase {
|
|
3970
|
-
constructor(toaster) {
|
|
3971
|
-
super(toaster);
|
|
3972
|
-
}
|
|
3973
3975
|
getMethod() {
|
|
3974
3976
|
return this.method;
|
|
3975
3977
|
}
|
|
3976
3978
|
}
|
|
3977
|
-
AsyncMethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, deps:
|
|
3979
|
+
AsyncMethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
3978
3980
|
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 });
|
|
3979
3981
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AsyncMethodDirective, decorators: [{
|
|
3980
3982
|
type: Directive,
|
|
@@ -3982,10 +3984,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
3982
3984
|
selector: "[async-method]",
|
|
3983
3985
|
exportAs: "async-method"
|
|
3984
3986
|
}]
|
|
3985
|
-
}],
|
|
3986
|
-
type: Inject,
|
|
3987
|
-
args: [TOASTER_SERVICE]
|
|
3988
|
-
}] }]; }, propDecorators: { method: [{
|
|
3987
|
+
}], propDecorators: { method: [{
|
|
3989
3988
|
type: Input,
|
|
3990
3989
|
args: ["async-method"]
|
|
3991
3990
|
}] } });
|
|
@@ -4897,6 +4896,7 @@ const pipes = [
|
|
|
4897
4896
|
];
|
|
4898
4897
|
// --- Directives ---
|
|
4899
4898
|
const directives = [
|
|
4899
|
+
AsyncMethodBase,
|
|
4900
4900
|
AsyncMethodDirective,
|
|
4901
4901
|
BackgroundDirective,
|
|
4902
4902
|
DynamicTableTemplateDirective,
|
|
@@ -4964,6 +4964,26 @@ function loadConfig(config) {
|
|
|
4964
4964
|
return config.load;
|
|
4965
4965
|
}
|
|
4966
4966
|
|
|
4967
|
+
function loadBaseHref() {
|
|
4968
|
+
if (typeof (document) === "undefined" || typeof (location) === "undefined")
|
|
4969
|
+
return "/";
|
|
4970
|
+
const currentScript = document.currentScript;
|
|
4971
|
+
if (!currentScript) {
|
|
4972
|
+
try {
|
|
4973
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
4974
|
+
throw new Error();
|
|
4975
|
+
}
|
|
4976
|
+
catch (e) {
|
|
4977
|
+
const qualifiedUrl = location.protocol + "//" + location.host;
|
|
4978
|
+
const srcUrl = (e.stack || "").match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) || e.stack.match(/http([A-Z:\/\-\.]+)\.js/gi).shift();
|
|
4979
|
+
const lastIndex = srcUrl.lastIndexOf("/");
|
|
4980
|
+
return lastIndex < 0 ? "/" : srcUrl.substring(0, lastIndex + 1);
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
const scriptSrc = currentScript.src;
|
|
4984
|
+
const lastIndex = scriptSrc.lastIndexOf("/");
|
|
4985
|
+
return lastIndex < 0 ? "/" : scriptSrc.substring(0, lastIndex + 1);
|
|
4986
|
+
}
|
|
4967
4987
|
class NgxUtilsModule {
|
|
4968
4988
|
constructor() {
|
|
4969
4989
|
}
|
|
@@ -5013,14 +5033,19 @@ class NgxUtilsModule {
|
|
|
5013
5033
|
useFactory: (!config ? null : config.initializeApp) || loadConfig,
|
|
5014
5034
|
multi: true,
|
|
5015
5035
|
deps: [(!config ? null : config.initializeApp) ? Injector : CONFIG_SERVICE]
|
|
5036
|
+
},
|
|
5037
|
+
{
|
|
5038
|
+
provide: APP_BASE_HREF,
|
|
5039
|
+
useFactory: (!config ? null : config.baseHref) || loadBaseHref,
|
|
5040
|
+
deps: [Injector]
|
|
5016
5041
|
}
|
|
5017
5042
|
]
|
|
5018
5043
|
};
|
|
5019
5044
|
}
|
|
5020
5045
|
}
|
|
5021
5046
|
NgxUtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5022
|
-
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,
|
|
5023
|
-
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] });
|
|
5047
|
+
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,
|
|
5048
|
+
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] });
|
|
5024
5049
|
NgxUtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxUtilsModule, providers: pipes, imports: [[
|
|
5025
5050
|
CommonModule,
|
|
5026
5051
|
FormsModule
|