@abp/ng.core 7.0.0 → 7.1.0-rc.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.
Files changed (37) hide show
  1. package/esm2020/lib/clients/http.client.mjs +34 -0
  2. package/esm2020/lib/clients/index.mjs +2 -0
  3. package/esm2020/lib/core.module.mjs +7 -1
  4. package/esm2020/lib/directives/permission.directive.mjs +11 -6
  5. package/esm2020/lib/providers/include-localization-resources.provider.mjs +2 -2
  6. package/esm2020/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.mjs +1 -1
  7. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/abp-api-definition.service.mjs +1 -1
  8. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.mjs +1 -1
  9. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-localization.service.mjs +2 -2
  10. package/esm2020/lib/proxy/volo/abp/http/modeling/models.mjs +1 -1
  11. package/esm2020/lib/proxy/volo/abp/localization/models.mjs +1 -1
  12. package/esm2020/lib/services/localization.service.mjs +2 -2
  13. package/esm2020/lib/tokens/http-context.token.mjs +3 -0
  14. package/esm2020/lib/tokens/include-localization-resources.token.mjs +2 -2
  15. package/esm2020/lib/tokens/index.mjs +3 -1
  16. package/esm2020/lib/tokens/queue.token.mjs +3 -0
  17. package/esm2020/lib/utils/index.mjs +2 -1
  18. package/esm2020/lib/utils/queue.mjs +41 -0
  19. package/esm2020/public-api.mjs +2 -1
  20. package/fesm2015/abp-ng.core.mjs +91 -8
  21. package/fesm2015/abp-ng.core.mjs.map +1 -1
  22. package/fesm2020/abp-ng.core.mjs +90 -7
  23. package/fesm2020/abp-ng.core.mjs.map +1 -1
  24. package/lib/clients/http.client.d.ts +11 -0
  25. package/lib/clients/index.d.ts +1 -0
  26. package/lib/directives/permission.directive.d.ts +4 -2
  27. package/lib/providers/include-localization-resources.provider.d.ts +1 -1
  28. package/lib/proxy/volo/abp/http/modeling/models.d.ts +1 -1
  29. package/lib/proxy/volo/abp/localization/models.d.ts +1 -0
  30. package/lib/tokens/http-context.token.d.ts +2 -0
  31. package/lib/tokens/include-localization-resources.token.d.ts +1 -1
  32. package/lib/tokens/index.d.ts +2 -0
  33. package/lib/tokens/queue.token.d.ts +3 -0
  34. package/lib/utils/index.d.ts +1 -0
  35. package/lib/utils/queue.d.ts +14 -0
  36. package/package.json +2 -2
  37. package/public-api.d.ts +1 -0
@@ -7,11 +7,12 @@ import * as i5 from '@angular/common';
7
7
  import { registerLocaleData, DOCUMENT, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
8
8
  import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, retryWhen, delay, shareReplay, finalize } from 'rxjs/operators';
9
9
  import * as i1 from '@angular/common/http';
10
- import { HttpParams, HttpClient, HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
10
+ import { HttpParams, HttpClient, HttpClientModule, HttpClientXsrfModule, HttpContextToken, HttpContext } from '@angular/common/http';
11
11
  import compare from 'just-compare';
12
12
  import * as i1$2 from '@angular/forms';
13
13
  import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
14
14
  import clone from 'just-clone';
15
+ import { __classPrivateFieldGet } from 'tslib';
15
16
 
16
17
  // Not an abstract class on purpose. Do not change!
17
18
  class AbstractNgModelComponent {
@@ -798,7 +799,7 @@ class LocalizationService {
798
799
  listenToSetLanguage() {
799
800
  this.sessionState
800
801
  .onLanguageChange$()
801
- .pipe(filter(lang => this.configState.getDeep('localization.currentCulture.cultureName') !== lang), switchMap(lang => this.configState.refreshLocalization(lang).pipe(map(() => lang))), switchMap(lang => from(this.registerLocale(lang).then(() => lang))))
802
+ .pipe(filter(lang => this.configState.getDeep('localization.currentCulture.cultureName') !== lang), switchMap(lang => this.configState.refreshAppState().pipe(map(() => lang))), switchMap(lang => from(this.registerLocale(lang).then(() => lang))))
802
803
  .subscribe(lang => this._languageChange$.next(lang));
803
804
  }
804
805
  registerLocale(locale) {
@@ -2079,12 +2080,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
2079
2080
  args: ['abpInit']
2080
2081
  }] } });
2081
2082
 
2083
+ const QUEUE_MANAGER = new InjectionToken("QUEUE_MANAGER");
2084
+
2082
2085
  class PermissionDirective {
2083
- constructor(templateRef, vcRef, permissionService, cdRef) {
2086
+ constructor(templateRef, vcRef, permissionService, cdRef, queue) {
2084
2087
  this.templateRef = templateRef;
2085
2088
  this.vcRef = vcRef;
2086
2089
  this.permissionService = permissionService;
2087
2090
  this.cdRef = cdRef;
2091
+ this.queue = queue;
2088
2092
  this.runChangeDetection = true;
2089
2093
  this.cdrSubject = new ReplaySubject();
2090
2094
  this.rendered = false;
@@ -2121,11 +2125,11 @@ class PermissionDirective {
2121
2125
  this.check();
2122
2126
  }
2123
2127
  ngAfterViewInit() {
2124
- this.cdrSubject.pipe(take(1)).subscribe(() => this.cdRef.detectChanges());
2128
+ this.cdrSubject.pipe(take(1)).subscribe(() => this.queue.add(() => this.cdRef.detectChanges()));
2125
2129
  this.rendered = true;
2126
2130
  }
2127
2131
  }
2128
- PermissionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2132
+ PermissionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }, { token: QUEUE_MANAGER }], target: i0.ɵɵFactoryTarget.Directive });
2129
2133
  PermissionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"], runChangeDetection: ["abpPermissionRunChangeDetection", "runChangeDetection"] }, usesOnChanges: true, ngImport: i0 });
2130
2134
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PermissionDirective, decorators: [{
2131
2135
  type: Directive,
@@ -2134,7 +2138,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
2134
2138
  }]
2135
2139
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
2136
2140
  type: Optional
2137
- }] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { condition: [{
2141
+ }] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
2142
+ type: Inject,
2143
+ args: [QUEUE_MANAGER]
2144
+ }] }]; }, propDecorators: { condition: [{
2138
2145
  type: Input,
2139
2146
  args: ['abpPermission']
2140
2147
  }], runChangeDetection: [{
@@ -2931,6 +2938,47 @@ function clearCallbacks(element) {
2931
2938
  element.onsuspend = null;
2932
2939
  }
2933
2940
 
2941
+ class DefaultQueueManager {
2942
+ constructor() {
2943
+ this.queue = [];
2944
+ this.isRunning = false;
2945
+ this.stack = 0;
2946
+ this.interval = 0;
2947
+ this.stackSize = 100;
2948
+ }
2949
+ init(interval, stackSize) {
2950
+ this.interval = interval;
2951
+ this.stackSize = stackSize;
2952
+ }
2953
+ add(fn) {
2954
+ this.queue.push(fn);
2955
+ this.run();
2956
+ }
2957
+ run() {
2958
+ if (this.isRunning)
2959
+ return;
2960
+ this.stack++;
2961
+ this.isRunning = true;
2962
+ const fn = this.queue.shift();
2963
+ if (!fn) {
2964
+ this.isRunning = false;
2965
+ return;
2966
+ }
2967
+ fn();
2968
+ if (this.stack > this.stackSize) {
2969
+ setTimeout(() => {
2970
+ this.isRunning = false;
2971
+ this.run();
2972
+ this.stack = 0;
2973
+ }, this.interval);
2974
+ }
2975
+ else {
2976
+ this.isRunning = false;
2977
+ this.run();
2978
+ }
2979
+ }
2980
+ }
2981
+
2934
2982
  class DomInsertionService {
2935
2983
  constructor() {
2936
2984
  this.inserted = new Set();
@@ -3544,6 +3592,10 @@ class CoreModule {
3544
3592
  useValue: localizationContributor(options.localizations),
3545
3593
  deps: [LocalizationService],
3546
3594
  },
3595
+ {
3596
+ provide: QUEUE_MANAGER,
3597
+ useClass: DefaultQueueManager,
3598
+ },
3547
3599
  IncludeLocalizationResourcesProvider,
3548
3600
  ],
3549
3601
  };
@@ -4031,6 +4083,8 @@ const PIPE_TO_LOGIN_FN_KEY = new InjectionToken('PIPE_TO_LOGIN_FN_KEY');
4031
4083
 
4032
4084
  const SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY = new InjectionToken('SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY');
4033
4085
 
4086
+ const IS_EXTERNAL_REQUEST = new HttpContextToken(() => false);
4087
+
4034
4088
  function validateMinAge({ age = 18 } = {}) {
4035
4089
  return (control) => {
4036
4090
  if (['', null, undefined].indexOf(control.value) > -1)
@@ -4172,11 +4226,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
4172
4226
  }]
4173
4227
  }], ctorParameters: function () { return [{ type: HttpWaitService }]; } });
4174
4228
 
4229
+ var _ExternalHttpClient_instances, _ExternalHttpClient_setPlaceholderContext;
4230
+ // source : https://github.com/armanozak/demo-angular-server-specific-interceptors
4231
+ class ExternalHttpClient extends HttpClient {
4232
+ constructor() {
4233
+ super(...arguments);
4234
+ _ExternalHttpClient_instances.add(this);
4235
+ }
4236
+ request(first, url, options = {}) {
4237
+ if (typeof first === 'string') {
4238
+ __classPrivateFieldGet(this, _ExternalHttpClient_instances, "m", _ExternalHttpClient_setPlaceholderContext).call(this, options);
4239
+ return super.request(first, url, options);
4240
+ }
4241
+ __classPrivateFieldGet(this, _ExternalHttpClient_instances, "m", _ExternalHttpClient_setPlaceholderContext).call(this, first);
4242
+ return super.request(first);
4243
+ }
4244
+ }
4245
+ _ExternalHttpClient_instances = new WeakSet(), _ExternalHttpClient_setPlaceholderContext = function _ExternalHttpClient_setPlaceholderContext(optionsOrRequest) {
4246
+ optionsOrRequest.context ?? (optionsOrRequest.context = new HttpContext());
4247
+ optionsOrRequest.context.set(IS_EXTERNAL_REQUEST, true);
4248
+ };
4249
+ ExternalHttpClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ExternalHttpClient, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4250
+ ExternalHttpClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ExternalHttpClient, providedIn: 'root' });
4251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ExternalHttpClient, decorators: [{
4252
+ type: Injectable,
4253
+ args: [{
4254
+ providedIn: 'root',
4255
+ }]
4256
+ }] });
4257
+
4175
4258
  // export * from './lib/handlers';
4176
4259
 
4177
4260
  /**
4178
4261
  * Generated bundle index. Do not edit.
4179
4262
  */
4180
4263
 
4181
- export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, coreOptionsFactory, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
4264
+ export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DefaultQueueManager, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ExternalHttpClient, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, IS_EXTERNAL_REQUEST, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, QUEUE_MANAGER, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, coreOptionsFactory, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
4182
4265
  //# sourceMappingURL=abp-ng.core.mjs.map