@stemy/ngx-utils 13.6.11 → 13.6.13
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 +2 -1
- package/esm2020/ngx-utils/ngx-utils.module.mjs +4 -2
- package/esm2020/ngx-utils/services/base-http.service.mjs +2 -2
- package/esm2020/ngx-utils/utils/cached-factory.mjs +16 -7
- package/esm2020/ngx-utils/utils/with-options-provider.mjs +24 -0
- package/esm2020/public_api.mjs +3 -2
- package/fesm2015/stemy-ngx-utils.mjs +38 -8
- package/fesm2015/stemy-ngx-utils.mjs.map +1 -1
- package/fesm2020/stemy-ngx-utils.mjs +42 -8
- package/fesm2020/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +10 -0
- package/ngx-utils/utils/cached-factory.d.ts +2 -3
- package/ngx-utils/utils/with-options-provider.d.ts +3 -0
- package/package.json +1 -1
- package/public_api.d.ts +3 -2
|
@@ -371,6 +371,7 @@ class ReflectUtils {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
+
const OPTIONS_TOKEN = new InjectionToken("custom-options-token");
|
|
374
375
|
class CanvasColor {
|
|
375
376
|
constructor(r, g, b, a = 255) {
|
|
376
377
|
this.r = r;
|
|
@@ -1050,22 +1051,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
1050
1051
|
args: [AUTH_SERVICE]
|
|
1051
1052
|
}] }]; } });
|
|
1052
1053
|
|
|
1053
|
-
|
|
1054
|
+
const CACHED_TOKEN = new InjectionToken("cached-factory-token");
|
|
1055
|
+
function cachedFactory(providers) {
|
|
1054
1056
|
let cached = null;
|
|
1055
1057
|
return (injector) => {
|
|
1056
1058
|
if (cached !== null) {
|
|
1057
1059
|
return cached;
|
|
1058
1060
|
}
|
|
1059
1061
|
const subInjector = Injector.create({
|
|
1060
|
-
providers:
|
|
1062
|
+
providers: providers.map(p => {
|
|
1063
|
+
if (("useFactory" in p && "deps" in p) || "useValue" in p) {
|
|
1064
|
+
return {
|
|
1065
|
+
provide: CACHED_TOKEN,
|
|
1066
|
+
multi: true,
|
|
1067
|
+
...p
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1061
1070
|
return {
|
|
1062
|
-
provide:
|
|
1063
|
-
|
|
1071
|
+
provide: CACHED_TOKEN,
|
|
1072
|
+
multi: true,
|
|
1073
|
+
useClass: p
|
|
1064
1074
|
};
|
|
1065
1075
|
}),
|
|
1066
1076
|
parent: injector
|
|
1067
1077
|
});
|
|
1068
|
-
cached =
|
|
1078
|
+
cached = subInjector.get(CACHED_TOKEN);
|
|
1069
1079
|
return cached;
|
|
1070
1080
|
};
|
|
1071
1081
|
}
|
|
@@ -2182,6 +2192,28 @@ class Vector {
|
|
|
2182
2192
|
}
|
|
2183
2193
|
}
|
|
2184
2194
|
|
|
2195
|
+
function provideWithOptions(type, options) {
|
|
2196
|
+
return {
|
|
2197
|
+
useFactory: function (injector) {
|
|
2198
|
+
const subInjector = Injector.create({
|
|
2199
|
+
providers: [
|
|
2200
|
+
{
|
|
2201
|
+
provide: OPTIONS_TOKEN,
|
|
2202
|
+
useValue: options
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
provide: type,
|
|
2206
|
+
useClass: type
|
|
2207
|
+
}
|
|
2208
|
+
],
|
|
2209
|
+
parent: injector
|
|
2210
|
+
});
|
|
2211
|
+
return subInjector.get(type);
|
|
2212
|
+
},
|
|
2213
|
+
deps: [Injector]
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2185
2217
|
function workerFunction(JSONfn, logTimes) {
|
|
2186
2218
|
let wasmResolve = null;
|
|
2187
2219
|
const wasmInstance = new Promise(resolve => {
|
|
@@ -2528,7 +2560,7 @@ class BaseHttpService {
|
|
|
2528
2560
|
const finalRequest = ObjectUtils.isNumber(options.timeout) && options.timeout > 0
|
|
2529
2561
|
? request.pipe(timeout(options.timeout)) : request;
|
|
2530
2562
|
finalRequest.subscribe((event) => {
|
|
2531
|
-
if (options.reportProgress && event
|
|
2563
|
+
if (options.reportProgress && event?.type === HttpEventType.UploadProgress) {
|
|
2532
2564
|
const progress = {
|
|
2533
2565
|
percentage: MathUtils.round(event.loaded / event.total, 2, 0.01),
|
|
2534
2566
|
loaded: event.loaded,
|
|
@@ -5640,7 +5672,9 @@ function loadBaseUrl() {
|
|
|
5640
5672
|
catch (e) {
|
|
5641
5673
|
const qualifiedUrl = location.protocol + "//" + location.host;
|
|
5642
5674
|
const stack = (e.stack || "");
|
|
5643
|
-
const srcUrl = (stack.match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) ||
|
|
5675
|
+
const srcUrl = (stack.match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) ||
|
|
5676
|
+
stack.match(/http([A-Z0-9:\/\-.]+)\.js/gi) ||
|
|
5677
|
+
[`${qualifiedUrl}/main.js`]).shift();
|
|
5644
5678
|
currentUrl = new URL(srcUrl ?? "");
|
|
5645
5679
|
}
|
|
5646
5680
|
}
|
|
@@ -5773,5 +5807,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
5773
5807
|
* Generated bundle index. Do not edit.
|
|
5774
5808
|
*/
|
|
5775
5809
|
|
|
5776
|
-
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, 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, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, ValuedPromise, ValuesPipe, Vector, WASI_IMPLEMENTATION, WasmService, cachedFactory };
|
|
5810
|
+
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, 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, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, ValuedPromise, ValuesPipe, Vector, WASI_IMPLEMENTATION, WasmService, cachedFactory, provideWithOptions };
|
|
5777
5811
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|