ngx-axis-appforge 0.0.91 → 0.0.92

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/core/index.d.ts CHANGED
@@ -88,7 +88,6 @@ declare class ScopeDirective implements OnInit, OnDestroy {
88
88
  private readonly updateDs;
89
89
  private dynamicOptionsSubs;
90
90
  private rootSubs;
91
- private injectDataSub?;
92
91
  private readonly instanceMap;
93
92
  private readonly changeSubject;
94
93
  private readonly latestUpdateOptions;
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, effect, inject, input, ElementRef, isSignal, Directive, Optional, Inject, Injectable, Injector, HostBinding, untracked, model, ViewChild, output, ViewContainerRef, forwardRef, Pipe, signal, ChangeDetectionStrategy, Component, computed, ContentChild } from '@angular/core';
3
- import { BehaviorSubject, filter, map, catchError, of, Subject, switchMap, debounceTime, Observable, isObservable, merge, NEVER, take, zip, tap, concat, last, mergeMap, from, mergeWith } from 'rxjs';
3
+ import { BehaviorSubject, filter, map, catchError, of, Subject, switchMap, debounceTime, isObservable, NEVER, merge, take, zip, Observable, tap, concat, last, mergeMap, from, mergeWith } from 'rxjs';
4
4
  import * as i1 from '@angular/common/http';
5
5
  import { HttpContextToken, HttpContext, HttpRequest, HttpEventType, HttpClient } from '@angular/common/http';
6
6
  import { fromPromise } from 'rxjs/internal/observable/innerFrom';
@@ -404,7 +404,6 @@ class ScopeDirective {
404
404
  updateDs = new Map();
405
405
  dynamicOptionsSubs = [];
406
406
  rootSubs = [];
407
- injectDataSub;
408
407
  instanceMap = new Map();
409
408
  changeSubject = new BehaviorSubject(void (0));
410
409
  latestUpdateOptions = new Map();
@@ -461,48 +460,38 @@ class ScopeDirective {
461
460
  this.changeSubject.next();
462
461
  }
463
462
  updateDataSource(opt) {
464
- return new Observable(sub => {
465
- this.latestUpdateOptions.set(opt.name, opt);
466
- switch (opt.type) {
467
- case 'api':
468
- if (opt.api?.url) {
469
- opt.api.context ??= this.httpContextData;
470
- this.rootSubs.push(sendApi(opt.api, this.http).subscribe({
471
- next: (res) => sub.next(res),
472
- }));
473
- }
474
- break;
475
- case 'local':
476
- if (opt.data !== undefined) {
477
- sub.next(opt.data);
463
+ this.latestUpdateOptions.set(opt.name, opt);
464
+ switch (opt.type) {
465
+ case "api":
466
+ if (opt.api?.url) {
467
+ opt.api.context ??= this.httpContextData;
468
+ return sendApi(opt.api, this.http);
469
+ }
470
+ break;
471
+ case "local":
472
+ if (opt.data !== undefined) {
473
+ return of(opt.data);
474
+ }
475
+ break;
476
+ case "inject":
477
+ if (opt.injectField && this.injectData) {
478
+ if (isObservable(this.injectData)) {
479
+ return this.injectData.pipe(map((data) => data[opt.injectField]));
478
480
  }
479
- break;
480
- case 'inject':
481
- if (opt.injectField) {
482
- this.injectDataSub?.unsubscribe();
483
- if (this.injectData) {
484
- if (isObservable(this.injectData)) {
485
- this.injectDataSub = this.injectData
486
- .subscribe((injectData) => {
487
- sub.next(injectData?.[opt.injectField]);
488
- });
489
- }
490
- else {
491
- sub.next(this.injectData?.[opt.injectField]);
492
- }
493
- }
481
+ else {
482
+ return of(this.injectData?.[opt.injectField]);
494
483
  }
495
- break;
496
- case 'cache':
497
- if (opt.cacheKey) {
498
- const cacheData = localStorage.getItem(opt.cacheKey);
499
- if (cacheData != null && cacheData != "undefined") {
500
- sub.next(JSON.parse(cacheData));
501
- }
484
+ }
485
+ break;
486
+ case "cache":
487
+ if (opt.cacheKey) {
488
+ const cacheData = localStorage.getItem(opt.cacheKey);
489
+ if (cacheData != null && cacheData != "undefined") {
490
+ return of(JSON.parse(cacheData));
502
491
  }
503
- break;
504
- }
505
- });
492
+ }
493
+ }
494
+ return NEVER;
506
495
  }
507
496
  get(name, init = true) {
508
497
  let res;