@abp/ng.core 5.3.0 → 5.3.3

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.
@@ -4,7 +4,7 @@ import * as i1$1 from '@angular/router';
4
4
  import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
5
5
  import * as i5 from '@angular/common';
6
6
  import { registerLocaleData, DOCUMENT, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
7
- import { BehaviorSubject, Subject, throwError, combineLatest, from, Subscription, fromEvent, of, timer, pipe, Observable, concat, ReplaySubject } from 'rxjs';
7
+ import { BehaviorSubject, Subject, throwError, combineLatest, from, Subscription, fromEvent, ReplaySubject, of, timer, pipe, Observable, concat } from 'rxjs';
8
8
  import { map, distinctUntilChanged, filter, catchError, switchMap, take, mapTo, debounceTime, takeUntil, tap, finalize, retryWhen, delay, shareReplay } from 'rxjs/operators';
9
9
  import * as i1 from '@angular/common/http';
10
10
  import { HttpParams, HttpHeaders, HttpClient, HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
@@ -1906,6 +1906,9 @@ class PermissionDirective {
1906
1906
  this.vcRef = vcRef;
1907
1907
  this.permissionService = permissionService;
1908
1908
  this.cdRef = cdRef;
1909
+ this.runChangeDetection = true;
1910
+ this.cdrSubject = new ReplaySubject();
1911
+ this.rendered = false;
1909
1912
  }
1910
1913
  check() {
1911
1914
  if (this.subscription) {
@@ -1918,7 +1921,17 @@ class PermissionDirective {
1918
1921
  this.vcRef.clear();
1919
1922
  if (isGranted)
1920
1923
  this.vcRef.createEmbeddedView(this.templateRef);
1921
- this.cdRef.detectChanges();
1924
+ if (this.runChangeDetection) {
1925
+ if (!this.rendered) {
1926
+ this.cdrSubject.next();
1927
+ }
1928
+ else {
1929
+ this.cdRef.detectChanges();
1930
+ }
1931
+ }
1932
+ else {
1933
+ this.cdRef.markForCheck();
1934
+ }
1922
1935
  });
1923
1936
  }
1924
1937
  ngOnDestroy() {
@@ -1928,9 +1941,13 @@ class PermissionDirective {
1928
1941
  ngOnChanges() {
1929
1942
  this.check();
1930
1943
  }
1944
+ ngAfterViewInit() {
1945
+ this.cdrSubject.pipe(take(1)).subscribe(() => this.cdRef.detectChanges());
1946
+ this.rendered = true;
1947
+ }
1931
1948
  }
1932
1949
  PermissionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1933
- PermissionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"] }, usesOnChanges: true, ngImport: i0 });
1950
+ PermissionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"], runChangeDetection: ["abpPermissionRunChangeDetection", "runChangeDetection"] }, usesOnChanges: true, ngImport: i0 });
1934
1951
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: PermissionDirective, decorators: [{
1935
1952
  type: Directive,
1936
1953
  args: [{
@@ -1941,6 +1958,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
1941
1958
  }] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { condition: [{
1942
1959
  type: Input,
1943
1960
  args: ['abpPermission']
1961
+ }], runChangeDetection: [{
1962
+ type: Input,
1963
+ args: ['abpPermissionRunChangeDetection']
1944
1964
  }] } });
1945
1965
 
1946
1966
  class ReplaceableTemplateDirective {
@@ -3637,6 +3657,7 @@ class CoreModule {
3637
3657
  return {
3638
3658
  ngModule: RootCoreModule,
3639
3659
  providers: [
3660
+ OAuthModule.forRoot().providers,
3640
3661
  LocaleProvider,
3641
3662
  CookieLanguageProvider,
3642
3663
  {
@@ -3691,7 +3712,6 @@ class CoreModule {
3691
3712
  useValue: localizationContributor(options.localizations),
3692
3713
  deps: [LocalizationService],
3693
3714
  },
3694
- OAuthModule.forRoot().providers,
3695
3715
  ],
3696
3716
  };
3697
3717
  }