@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.
@@ -372,6 +372,7 @@ class ReflectUtils {
372
372
  }
373
373
  }
374
374
 
375
+ const OPTIONS_TOKEN = new InjectionToken("custom-options-token");
375
376
  class CanvasColor {
376
377
  constructor(r, g, b, a = 255) {
377
378
  this.r = r;
@@ -1071,22 +1072,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
1071
1072
  }] }];
1072
1073
  } });
1073
1074
 
1074
- function cachedFactory(types) {
1075
+ const CACHED_TOKEN = new InjectionToken("cached-factory-token");
1076
+ function cachedFactory(providers) {
1075
1077
  let cached = null;
1076
1078
  return (injector) => {
1077
1079
  if (cached !== null) {
1078
1080
  return cached;
1079
1081
  }
1080
1082
  const subInjector = Injector.create({
1081
- providers: types.map(type => {
1083
+ providers: providers.map(p => {
1084
+ if (("useFactory" in p && "deps" in p) || "useValue" in p) {
1085
+ return Object.assign({ provide: CACHED_TOKEN, multi: true }, p);
1086
+ }
1082
1087
  return {
1083
- provide: type,
1084
- useClass: type,
1088
+ provide: CACHED_TOKEN,
1089
+ multi: true,
1090
+ useClass: p
1085
1091
  };
1086
1092
  }),
1087
1093
  parent: injector
1088
1094
  });
1089
- cached = types.map(type => subInjector.get(type));
1095
+ cached = subInjector.get(CACHED_TOKEN);
1090
1096
  return cached;
1091
1097
  };
1092
1098
  }
@@ -2204,6 +2210,28 @@ class Vector {
2204
2210
  }
2205
2211
  }
2206
2212
 
2213
+ function provideWithOptions(type, options) {
2214
+ return {
2215
+ useFactory: function (injector) {
2216
+ const subInjector = Injector.create({
2217
+ providers: [
2218
+ {
2219
+ provide: OPTIONS_TOKEN,
2220
+ useValue: options
2221
+ },
2222
+ {
2223
+ provide: type,
2224
+ useClass: type
2225
+ }
2226
+ ],
2227
+ parent: injector
2228
+ });
2229
+ return subInjector.get(type);
2230
+ },
2231
+ deps: [Injector]
2232
+ };
2233
+ }
2234
+
2207
2235
  function workerFunction(JSONfn, logTimes) {
2208
2236
  let wasmResolve = null;
2209
2237
  const wasmInstance = new Promise(resolve => {
@@ -2553,7 +2581,7 @@ class BaseHttpService {
2553
2581
  const finalRequest = ObjectUtils.isNumber(options.timeout) && options.timeout > 0
2554
2582
  ? request.pipe(timeout(options.timeout)) : request;
2555
2583
  finalRequest.subscribe((event) => {
2556
- if (options.reportProgress && event.type === HttpEventType.UploadProgress) {
2584
+ if (options.reportProgress && (event === null || event === void 0 ? void 0 : event.type) === HttpEventType.UploadProgress) {
2557
2585
  const progress = {
2558
2586
  percentage: MathUtils.round(event.loaded / event.total, 2, 0.01),
2559
2587
  loaded: event.loaded,
@@ -5719,7 +5747,9 @@ function loadBaseUrl() {
5719
5747
  catch (e) {
5720
5748
  const qualifiedUrl = location.protocol + "//" + location.host;
5721
5749
  const stack = (e.stack || "");
5722
- const srcUrl = (stack.match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) || stack.match(/http([A-Z:\/\-.]+)\.js/gi)).shift();
5750
+ const srcUrl = (stack.match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) ||
5751
+ stack.match(/http([A-Z0-9:\/\-.]+)\.js/gi) ||
5752
+ [`${qualifiedUrl}/main.js`]).shift();
5723
5753
  currentUrl = new URL(srcUrl !== null && srcUrl !== void 0 ? srcUrl : "");
5724
5754
  }
5725
5755
  }
@@ -5853,5 +5883,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
5853
5883
  * Generated bundle index. Do not edit.
5854
5884
  */
5855
5885
 
5856
- 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 };
5886
+ 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 };
5857
5887
  //# sourceMappingURL=stemy-ngx-utils.mjs.map