@stemy/ngx-utils 19.7.30 → 19.8.1

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.
@@ -111,6 +111,7 @@ const RESIZE_DELAY = new InjectionToken("resize-event-delay");
111
111
  const RESIZE_STRATEGY = new InjectionToken("resize-event-strategy");
112
112
  const ERROR_HANDLER = new InjectionToken("error-handler-callback");
113
113
  const STATIC_SCHEMAS = new InjectionToken("static-openapi-schemas");
114
+ const SCHEMA_SELECTOR = new InjectionToken("openapi-schema-selector");
114
115
 
115
116
  class AjaxRequestHandler {
116
117
  static { this.isOverridden = false; }
@@ -4510,9 +4511,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
4510
4511
  }] });
4511
4512
 
4512
4513
  class OpenApiService {
4513
- constructor(api, staticSchemas) {
4514
+ constructor(api, schemaSelector, staticSchemas, injector) {
4514
4515
  this.api = api;
4516
+ this.schemaSelector = schemaSelector;
4515
4517
  this.staticSchemas = staticSchemas;
4518
+ this.injector = injector;
4516
4519
  this.dynamicSchemas = {};
4517
4520
  }
4518
4521
  isDynamicSchema(value) {
@@ -4566,7 +4569,7 @@ class OpenApiService {
4566
4569
  }
4567
4570
  async getSchema(name) {
4568
4571
  const schemas = await this.getSchemas();
4569
- return schemas[name] || null;
4572
+ return this.schemaSelector(name, schemas, this.injector) || null;
4570
4573
  }
4571
4574
  async getDynamicSchema(definition) {
4572
4575
  const cache = this.api.cached("auth");
@@ -4586,7 +4589,7 @@ class OpenApiService {
4586
4589
  });
4587
4590
  return schemas;
4588
4591
  }
4589
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OpenApiService, deps: [{ token: API_SERVICE }, { token: STATIC_SCHEMAS }], target: i0.ɵɵFactoryTarget.Injectable }); }
4592
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OpenApiService, deps: [{ token: API_SERVICE }, { token: SCHEMA_SELECTOR }, { token: STATIC_SCHEMAS }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
4590
4593
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OpenApiService }); }
4591
4594
  }
4592
4595
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OpenApiService, decorators: [{
@@ -4594,10 +4597,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
4594
4597
  }], ctorParameters: () => [{ type: undefined, decorators: [{
4595
4598
  type: Inject,
4596
4599
  args: [API_SERVICE]
4600
+ }] }, { type: undefined, decorators: [{
4601
+ type: Inject,
4602
+ args: [SCHEMA_SELECTOR]
4597
4603
  }] }, { type: undefined, decorators: [{
4598
4604
  type: Inject,
4599
4605
  args: [STATIC_SCHEMAS]
4600
- }] }] });
4606
+ }] }, { type: i0.Injector }] });
4601
4607
 
4602
4608
  class BaseToasterService {
4603
4609
  constructor(language) {
@@ -5970,6 +5976,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
5970
5976
  }]
5971
5977
  }] });
5972
5978
 
5979
+ async function defaultMethod() {
5980
+ return null;
5981
+ }
5973
5982
  class AsyncMethodBase {
5974
5983
  constructor() {
5975
5984
  this.disabled = signal(false);
@@ -5999,25 +6008,18 @@ class AsyncMethodBase {
5999
6008
  switchClass(previous, "loading", false);
6000
6009
  });
6001
6010
  }
6002
- getMethod() {
6003
- return async () => null;
6004
- }
6005
6011
  ngOnChanges() {
6006
6012
  this.cdr.detectChanges();
6007
6013
  }
6008
- click(ev) {
6009
- ev?.preventDefault();
6010
- if (this.disabled())
6011
- return true;
6012
- this.callMethod(ev);
6013
- return true;
6014
+ onClick(ev) {
6015
+ return this.handleClick(ev);
6014
6016
  }
6015
6017
  callMethod(ev) {
6016
6018
  if (this.loading())
6017
6019
  return true;
6018
6020
  this.loading.set(true);
6019
- const method = this.getMethod();
6020
- const result = !method ? null : method(this.context(), ev);
6021
+ const method = this.getMethod() || defaultMethod;
6022
+ const result = method(...this.getArgs(ev));
6021
6023
  if (!(result instanceof Promise)) {
6022
6024
  this.loading.set(false);
6023
6025
  return false;
@@ -6041,8 +6043,21 @@ class AsyncMethodBase {
6041
6043
  });
6042
6044
  return true;
6043
6045
  }
6046
+ handleClick(ev) {
6047
+ ev?.preventDefault();
6048
+ if (this.disabled())
6049
+ return true;
6050
+ this.callMethod(ev);
6051
+ return true;
6052
+ }
6053
+ getMethod() {
6054
+ return null;
6055
+ }
6056
+ getArgs(ev) {
6057
+ return untracked(() => [this.context(), ev]);
6058
+ }
6044
6059
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
6045
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodBase, isStandalone: false, selector: "[__asmb__]", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click($event)" } }, usesOnChanges: true, ngImport: i0 }); }
6060
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodBase, isStandalone: false, selector: "[__asmb__]", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "onClick($event)" } }, usesOnChanges: true, ngImport: i0 }); }
6046
6061
  }
6047
6062
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodBase, decorators: [{
6048
6063
  type: Directive,
@@ -6050,7 +6065,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
6050
6065
  standalone: false,
6051
6066
  selector: "[__asmb__]"
6052
6067
  }]
6053
- }], ctorParameters: () => [], propDecorators: { click: [{
6068
+ }], ctorParameters: () => [], propDecorators: { onClick: [{
6054
6069
  type: HostListener,
6055
6070
  args: ["click", ["$event"]]
6056
6071
  }] } });
@@ -6061,7 +6076,7 @@ class AsyncMethodDirective extends AsyncMethodBase {
6061
6076
  this.method = input(null, { alias: "async-method" });
6062
6077
  }
6063
6078
  getMethod() {
6064
- return this.method();
6079
+ return untracked(() => this.method());
6065
6080
  }
6066
6081
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
6067
6082
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodDirective, isStandalone: false, selector: "[async-method]", inputs: { method: { classPropertyName: "method", publicName: "async-method", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
@@ -7004,7 +7019,7 @@ class DropdownToggleDirective extends AsyncMethodBase {
7004
7019
  this.dropdown = inject(DropdownDirective);
7005
7020
  }
7006
7021
  getMethod() {
7007
- return this.beforeOpen();
7022
+ return untracked(() => this.beforeOpen());
7008
7023
  }
7009
7024
  callMethod(ev) {
7010
7025
  if (this.dropdown.isOpened) {
@@ -9496,6 +9511,12 @@ class NgxUtilsModule {
9496
9511
  provide: STATIC_SCHEMAS,
9497
9512
  useValue: (!config ? null : config.staticSchemas) ?? {},
9498
9513
  },
9514
+ {
9515
+ provide: SCHEMA_SELECTOR,
9516
+ useValue: (!config ? null : config.schemaSelector) ?? ((name, schemas) => {
9517
+ return schemas[name];
9518
+ }),
9519
+ },
9499
9520
  {
9500
9521
  provide: APP_BASE_HREF,
9501
9522
  useFactory: loadBaseHref,
@@ -9578,5 +9599,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
9578
9599
  * Generated bundle index. Do not edit.
9579
9600
  */
9580
9601
 
9581
- 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, 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, WysiwygComponent, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, md5, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, stringify, subPts, svgToDataUri, switchClass, toDegrees, toRadians, tripleProduct };
9602
+ 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, 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, SCHEMA_SELECTOR, 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, WysiwygComponent, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, md5, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, stringify, subPts, svgToDataUri, switchClass, toDegrees, toRadians, tripleProduct };
9582
9603
  //# sourceMappingURL=stemy-ngx-utils.mjs.map