@abp/ng.core 5.0.1 → 5.1.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.
- package/{esm2015/abp-ng.core.js → esm2020/abp-ng.core.mjs} +0 -0
- package/{esm2015/lib/abstracts/index.js → esm2020/lib/abstracts/index.mjs} +0 -0
- package/{esm2015/lib/abstracts/ng-model.component.js → esm2020/lib/abstracts/ng-model.component.mjs} +4 -4
- package/esm2020/lib/components/dynamic-layout.component.mjs +88 -0
- package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
- package/{esm2015/lib/components/replaceable-route-container.component.js → esm2020/lib/components/replaceable-route-container.component.mjs} +4 -4
- package/{esm2015/lib/components/router-outlet.component.js → esm2020/lib/components/router-outlet.component.mjs} +4 -4
- package/{esm2015/lib/constants/different-locales.js → esm2020/lib/constants/different-locales.mjs} +0 -0
- package/{esm2015/lib/constants/index.js → esm2020/lib/constants/index.mjs} +0 -0
- package/esm2020/lib/core.module.mjs +281 -0
- package/{esm2015/lib/directives/autofocus.directive.js → esm2020/lib/directives/autofocus.directive.mjs} +4 -4
- package/{esm2015/lib/directives/debounce.directive.js → esm2020/lib/directives/debounce.directive.mjs} +4 -4
- package/{esm2015/lib/directives/for.directive.js → esm2020/lib/directives/for.directive.mjs} +4 -4
- package/{esm2015/lib/directives/form-submit.directive.js → esm2020/lib/directives/form-submit.directive.mjs} +4 -4
- package/{esm2015/lib/directives/index.js → esm2020/lib/directives/index.mjs} +0 -0
- package/{esm2015/lib/directives/init.directive.js → esm2020/lib/directives/init.directive.mjs} +4 -4
- package/{esm2015/lib/directives/permission.directive.js → esm2020/lib/directives/permission.directive.mjs} +4 -4
- package/esm2020/lib/directives/replaceable-template.directive.mjs +126 -0
- package/{esm2015/lib/directives/stop-propagation.directive.js → esm2020/lib/directives/stop-propagation.directive.mjs} +4 -4
- package/{esm2015/lib/enums/common.js → esm2020/lib/enums/common.mjs} +0 -0
- package/{esm2015/lib/enums/index.js → esm2020/lib/enums/index.mjs} +0 -0
- package/{esm2015/lib/guards/auth.guard.js → esm2020/lib/guards/auth.guard.mjs} +4 -4
- package/{esm2015/lib/guards/index.js → esm2020/lib/guards/index.mjs} +0 -0
- package/{esm2015/lib/guards/permission.guard.js → esm2020/lib/guards/permission.guard.mjs} +5 -5
- package/{esm2015/lib/handlers/oauth-configuration.handler.js → esm2020/lib/handlers/oauth-configuration.handler.mjs} +4 -4
- package/esm2020/lib/handlers/routes.handler.mjs +49 -0
- package/esm2020/lib/interceptors/api.interceptor.mjs +54 -0
- package/{esm2015/lib/interceptors/index.js → esm2020/lib/interceptors/index.mjs} +0 -0
- package/{esm2015/lib/localization.module.js → esm2020/lib/localization.module.mjs} +5 -5
- package/{esm2015/lib/models/auth.js → esm2020/lib/models/auth.mjs} +0 -0
- package/{esm2015/lib/models/common.js → esm2020/lib/models/common.mjs} +0 -0
- package/{esm2015/lib/models/dtos.js → esm2020/lib/models/dtos.mjs} +0 -0
- package/{esm2015/lib/models/environment.js → esm2020/lib/models/environment.mjs} +0 -0
- package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
- package/{esm2015/lib/models/localization.js → esm2020/lib/models/localization.mjs} +0 -0
- package/{esm2015/lib/models/replaceable-components.js → esm2020/lib/models/replaceable-components.mjs} +0 -0
- package/{esm2015/lib/models/rest.js → esm2020/lib/models/rest.mjs} +0 -0
- package/{esm2015/lib/models/session.js → esm2020/lib/models/session.mjs} +0 -0
- package/{esm2015/lib/models/utility.js → esm2020/lib/models/utility.mjs} +0 -0
- package/{esm2015/lib/pipes/index.js → esm2020/lib/pipes/index.mjs} +2 -1
- package/{esm2015/lib/pipes/localization.pipe.js → esm2020/lib/pipes/localization.pipe.mjs} +5 -5
- package/{esm2015/lib/pipes/sort.pipe.js → esm2020/lib/pipes/sort.pipe.mjs} +5 -5
- package/esm2020/lib/pipes/to-injector.pipe.mjs +29 -0
- package/{esm2015/lib/providers/cookie-language.provider.js → esm2020/lib/providers/cookie-language.provider.mjs} +0 -0
- package/{esm2015/lib/providers/locale.provider.js → esm2020/lib/providers/locale.provider.mjs} +0 -0
- package/{esm2015/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.js → esm2020/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.mjs} +4 -4
- package/{esm2015/lib/proxy/pages/abp/multi-tenancy/index.js → esm2020/lib/proxy/pages/abp/multi-tenancy/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/abp-api-definition.service.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/abp-api-definition.service.mjs} +4 -4
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/index.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.mjs} +4 -4
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/index.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/index.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/models.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/models.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/index.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.js → esm2020/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/http/modeling/index.js → esm2020/lib/proxy/volo/abp/http/modeling/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/http/modeling/models.js → esm2020/lib/proxy/volo/abp/http/modeling/models.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/localization/index.js → esm2020/lib/proxy/volo/abp/localization/index.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/localization/models.js → esm2020/lib/proxy/volo/abp/localization/models.mjs} +0 -0
- package/{esm2015/lib/proxy/volo/abp/models.js → esm2020/lib/proxy/volo/abp/models.mjs} +0 -0
- package/esm2020/lib/services/auth.service.mjs +44 -0
- package/{esm2015/lib/services/config-state.service.js → esm2020/lib/services/config-state.service.mjs} +13 -16
- package/{esm2015/lib/services/content-projection.service.js → esm2020/lib/services/content-projection.service.mjs} +4 -4
- package/{esm2015/lib/services/dom-insertion.service.js → esm2020/lib/services/dom-insertion.service.mjs} +4 -4
- package/{esm2015/lib/services/environment.service.js → esm2020/lib/services/environment.service.mjs} +4 -4
- package/{esm2015/lib/services/http-error-reporter.service.js → esm2020/lib/services/http-error-reporter.service.mjs} +4 -4
- package/{esm2015/lib/services/http-wait.service.js → esm2020/lib/services/http-wait.service.mjs} +4 -4
- package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
- package/{esm2015/lib/services/lazy-load.service.js → esm2020/lib/services/lazy-load.service.mjs} +4 -4
- package/{esm2015/lib/services/list.service.js → esm2020/lib/services/list.service.mjs} +4 -4
- package/esm2020/lib/services/localization.service.mjs +182 -0
- package/{esm2015/lib/services/multi-tenancy.service.js → esm2020/lib/services/multi-tenancy.service.mjs} +4 -4
- package/{esm2015/lib/services/permission.service.js → esm2020/lib/services/permission.service.mjs} +5 -6
- package/{esm2015/lib/services/replaceable-components.service.js → esm2020/lib/services/replaceable-components.service.mjs} +4 -4
- package/{esm2015/lib/services/resource-wait.service.js → esm2020/lib/services/resource-wait.service.mjs} +4 -4
- package/esm2020/lib/services/rest.service.mjs +66 -0
- package/{esm2015/lib/services/router-events.service.js → esm2020/lib/services/router-events.service.mjs} +4 -4
- package/{esm2015/lib/services/router-wait.service.js → esm2020/lib/services/router-wait.service.mjs} +4 -4
- package/esm2020/lib/services/routes.service.mjs +145 -0
- package/{esm2015/lib/services/session-state.service.js → esm2020/lib/services/session-state.service.mjs} +5 -5
- package/{esm2015/lib/services/subscription.service.js → esm2020/lib/services/subscription.service.mjs} +4 -4
- package/{esm2015/lib/services/track-by.service.js → esm2020/lib/services/track-by.service.mjs} +4 -4
- package/esm2020/lib/strategies/auth-flow.strategy.mjs +190 -0
- package/{esm2015/lib/strategies/container.strategy.js → esm2020/lib/strategies/container.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/content-security.strategy.js → esm2020/lib/strategies/content-security.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/content.strategy.js → esm2020/lib/strategies/content.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/context.strategy.js → esm2020/lib/strategies/context.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/cross-origin.strategy.js → esm2020/lib/strategies/cross-origin.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/dom.strategy.js → esm2020/lib/strategies/dom.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/index.js → esm2020/lib/strategies/index.mjs} +0 -0
- package/{esm2015/lib/strategies/loading.strategy.js → esm2020/lib/strategies/loading.strategy.mjs} +0 -0
- package/{esm2015/lib/strategies/projection.strategy.js → esm2020/lib/strategies/projection.strategy.mjs} +0 -0
- package/{esm2015/lib/tokens/app-config.token.js → esm2020/lib/tokens/app-config.token.mjs} +0 -0
- package/{esm2015/lib/tokens/cookie-language-key.token.js → esm2020/lib/tokens/cookie-language-key.token.mjs} +0 -0
- package/{esm2015/lib/tokens/index.js → esm2020/lib/tokens/index.mjs} +0 -0
- package/{esm2015/lib/tokens/list.token.js → esm2020/lib/tokens/list.token.mjs} +0 -0
- package/{esm2015/lib/tokens/localization.token.js → esm2020/lib/tokens/localization.token.mjs} +0 -0
- package/{esm2015/lib/tokens/lodaer-delay.token.js → esm2020/lib/tokens/lodaer-delay.token.mjs} +0 -0
- package/{esm2015/lib/tokens/manage-profile.token.js → esm2020/lib/tokens/manage-profile.token.mjs} +0 -0
- package/esm2020/lib/tokens/options.token.mjs +8 -0
- package/{esm2015/lib/tokens/tenant-key.token.js → esm2020/lib/tokens/tenant-key.token.mjs} +0 -0
- package/esm2020/lib/utils/array-utils.mjs +7 -0
- package/{esm2015/lib/utils/auth-utils.js → esm2020/lib/utils/auth-utils.mjs} +0 -0
- package/{esm2015/lib/utils/common-utils.js → esm2020/lib/utils/common-utils.mjs} +0 -0
- package/{esm2015/lib/utils/date-extensions.js → esm2020/lib/utils/date-extensions.mjs} +0 -0
- package/{esm2015/lib/utils/date-utils.js → esm2020/lib/utils/date-utils.mjs} +0 -0
- package/{esm2015/lib/utils/environment-utils.js → esm2020/lib/utils/environment-utils.mjs} +0 -0
- package/{esm2015/lib/utils/factory-utils.js → esm2020/lib/utils/factory-utils.mjs} +0 -0
- package/{esm2015/lib/utils/file-utils.js → esm2020/lib/utils/file-utils.mjs} +0 -0
- package/{esm2015/lib/utils/form-utils.js → esm2020/lib/utils/form-utils.mjs} +0 -0
- package/{esm2015/lib/utils/generator-utils.js → esm2020/lib/utils/generator-utils.mjs} +0 -0
- package/{esm2015/lib/utils/http-utils.js → esm2020/lib/utils/http-utils.mjs} +0 -0
- package/{esm2015/lib/utils/index.js → esm2020/lib/utils/index.mjs} +0 -0
- package/esm2020/lib/utils/initial-utils.mjs +63 -0
- package/esm2020/lib/utils/internal-store-utils.mjs +36 -0
- package/{esm2015/lib/utils/lazy-load-utils.js → esm2020/lib/utils/lazy-load-utils.mjs} +0 -0
- package/esm2020/lib/utils/localization-utils.mjs +49 -0
- package/esm2020/lib/utils/multi-tenancy-utils.mjs +78 -0
- package/{esm2015/lib/utils/number-utils.js → esm2020/lib/utils/number-utils.mjs} +0 -0
- package/{esm2015/lib/utils/object-utils.js → esm2020/lib/utils/object-utils.mjs} +0 -0
- package/esm2020/lib/utils/route-utils.mjs +26 -0
- package/esm2020/lib/utils/string-utils.mjs +25 -0
- package/{esm2015/lib/utils/tree-utils.js → esm2020/lib/utils/tree-utils.mjs} +1 -1
- package/{esm2015/lib/validators/age.validator.js → esm2020/lib/validators/age.validator.mjs} +0 -0
- package/{esm2015/lib/validators/credit-card.validator.js → esm2020/lib/validators/credit-card.validator.mjs} +0 -0
- package/{esm2015/lib/validators/index.js → esm2020/lib/validators/index.mjs} +0 -0
- package/{esm2015/lib/validators/range.validator.js → esm2020/lib/validators/range.validator.mjs} +0 -0
- package/{esm2015/lib/validators/required.validator.js → esm2020/lib/validators/required.validator.mjs} +0 -0
- package/{esm2015/lib/validators/string-length.validator.js → esm2020/lib/validators/string-length.validator.mjs} +0 -0
- package/{esm2015/lib/validators/url.validator.js → esm2020/lib/validators/url.validator.mjs} +0 -0
- package/{esm2015/locale/abp-ng.core-locale.js → esm2020/locale/abp-ng.core-locale.mjs} +0 -0
- package/{esm2015/locale/public-api.js → esm2020/locale/public-api.mjs} +0 -0
- package/esm2020/locale/utils/register-locale.mjs +47 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/{esm2015/testing/abp-ng.core-testing.js → esm2020/testing/abp-ng.core-testing.mjs} +0 -0
- package/esm2020/testing/lib/core-testing.module.mjs +63 -0
- package/{esm2015/testing/lib/services/index.js → esm2020/testing/lib/services/index.mjs} +0 -0
- package/{esm2015/testing/lib/services/mock-permission.service.js → esm2020/testing/lib/services/mock-permission.service.mjs} +4 -4
- package/{esm2015/testing/lib/services/mock-rest.service.js → esm2020/testing/lib/services/mock-rest.service.mjs} +4 -4
- package/{esm2015/testing/lib/utils/clear-page.util.js → esm2020/testing/lib/utils/clear-page.util.mjs} +0 -0
- package/{esm2015/testing/lib/utils/index.js → esm2020/testing/lib/utils/index.mjs} +0 -0
- package/{esm2015/testing/lib/utils/wait.util.js → esm2020/testing/lib/utils/wait.util.mjs} +0 -0
- package/{esm2015/testing/public-api.js → esm2020/testing/public-api.mjs} +0 -0
- package/fesm2015/{abp-ng.core-locale.js → abp-ng.core-locale.mjs} +11 -4
- package/fesm2015/abp-ng.core-locale.mjs.map +1 -0
- package/fesm2015/{abp-ng.core-testing.js → abp-ng.core-testing.mjs} +18 -16
- package/fesm2015/abp-ng.core-testing.mjs.map +1 -0
- package/fesm2015/{abp-ng.core.js → abp-ng.core.mjs} +812 -768
- package/fesm2015/abp-ng.core.mjs.map +1 -0
- package/fesm2020/abp-ng.core-locale.mjs +54 -0
- package/fesm2020/abp-ng.core-locale.mjs.map +1 -0
- package/fesm2020/abp-ng.core-testing.mjs +140 -0
- package/fesm2020/abp-ng.core-testing.mjs.map +1 -0
- package/fesm2020/abp-ng.core.mjs +4211 -0
- package/fesm2020/abp-ng.core.mjs.map +1 -0
- package/lib/core.module.d.ts +9 -8
- package/lib/pipes/index.d.ts +1 -0
- package/lib/pipes/to-injector.pipe.d.ts +10 -0
- package/lib/services/environment.service.d.ts +1 -0
- package/lib/services/list.service.d.ts +1 -1
- package/lib/services/subscription.service.d.ts +2 -2
- package/lib/utils/array-utils.d.ts +1 -1
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/tree-utils.d.ts +2 -2
- package/locale/package.json +5 -5
- package/package.json +37 -8
- package/src/lib/proxy/README.md +17 -0
- package/testing/package.json +5 -5
- package/bundles/abp-ng.core-locale.umd.js +0 -381
- package/bundles/abp-ng.core-locale.umd.js.map +0 -1
- package/bundles/abp-ng.core-testing.umd.js +0 -494
- package/bundles/abp-ng.core-testing.umd.js.map +0 -1
- package/bundles/abp-ng.core.umd.js +0 -5277
- package/bundles/abp-ng.core.umd.js.map +0 -1
- package/esm2015/lib/components/dynamic-layout.component.js +0 -89
- package/esm2015/lib/core.module.js +0 -281
- package/esm2015/lib/directives/replaceable-template.directive.js +0 -121
- package/esm2015/lib/handlers/routes.handler.js +0 -47
- package/esm2015/lib/interceptors/api.interceptor.js +0 -54
- package/esm2015/lib/services/auth.service.js +0 -47
- package/esm2015/lib/services/localization.service.js +0 -182
- package/esm2015/lib/services/rest.service.js +0 -63
- package/esm2015/lib/services/routes.service.js +0 -147
- package/esm2015/lib/strategies/auth-flow.strategy.js +0 -202
- package/esm2015/lib/tokens/options.token.js +0 -8
- package/esm2015/lib/utils/array-utils.js +0 -7
- package/esm2015/lib/utils/initial-utils.js +0 -64
- package/esm2015/lib/utils/internal-store-utils.js +0 -36
- package/esm2015/lib/utils/localization-utils.js +0 -50
- package/esm2015/lib/utils/multi-tenancy-utils.js +0 -83
- package/esm2015/lib/utils/route-utils.js +0 -27
- package/esm2015/lib/utils/string-utils.js +0 -21
- package/esm2015/locale/utils/register-locale.js +0 -43
- package/esm2015/testing/lib/core-testing.module.js +0 -62
- package/fesm2015/abp-ng.core-locale.js.map +0 -1
- package/fesm2015/abp-ng.core-testing.js.map +0 -1
- package/fesm2015/abp-ng.core.js.map +0 -1
|
@@ -0,0 +1,4211 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ChangeDetectorRef, Component, Input, InjectionToken, Injectable, Inject, isDevMode, Optional, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, ComponentFactoryResolver, ApplicationRef, inject } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/router';
|
|
4
|
+
import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
5
|
+
import * as i5 from '@angular/common';
|
|
6
|
+
import { registerLocaleData, DOCUMENT, CommonModule } from '@angular/common';
|
|
7
|
+
import { BehaviorSubject, Subject, throwError, combineLatest, from, Subscription, fromEvent, of, timer, pipe, Observable, concat, ReplaySubject } from 'rxjs';
|
|
8
|
+
import { map, distinctUntilChanged, filter, catchError, switchMap, take, mapTo, debounceTime, takeUntil, tap, finalize, retryWhen, delay, shareReplay } from 'rxjs/operators';
|
|
9
|
+
import * as i1 from '@angular/common/http';
|
|
10
|
+
import { HttpParams, HttpHeaders, HttpClient, HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
11
|
+
import compare from 'just-compare';
|
|
12
|
+
import * as i1$2 from '@angular/forms';
|
|
13
|
+
import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
14
|
+
import * as i1$3 from 'angular-oauth2-oidc';
|
|
15
|
+
import { OAuthStorage, OAuthService, OAuthErrorEvent, OAuthInfoEvent, OAuthModule } from 'angular-oauth2-oidc';
|
|
16
|
+
import clone from 'just-clone';
|
|
17
|
+
|
|
18
|
+
// Not an abstract class on purpose. Do not change!
|
|
19
|
+
class AbstractNgModelComponent {
|
|
20
|
+
constructor(injector) {
|
|
21
|
+
this.injector = injector;
|
|
22
|
+
this.valueFn = value => value;
|
|
23
|
+
this.valueLimitFn = value => false;
|
|
24
|
+
this.cdRef = injector.get(ChangeDetectorRef);
|
|
25
|
+
}
|
|
26
|
+
set value(value) {
|
|
27
|
+
value = this.valueFn(value, this._value);
|
|
28
|
+
if (this.valueLimitFn(value, this._value) !== false || this.readonly)
|
|
29
|
+
return;
|
|
30
|
+
this._value = value;
|
|
31
|
+
this.notifyValueChange();
|
|
32
|
+
}
|
|
33
|
+
get value() {
|
|
34
|
+
return this._value || this.defaultValue;
|
|
35
|
+
}
|
|
36
|
+
get defaultValue() {
|
|
37
|
+
return this._value;
|
|
38
|
+
}
|
|
39
|
+
notifyValueChange() {
|
|
40
|
+
if (this.onChange) {
|
|
41
|
+
this.onChange(this.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
writeValue(value) {
|
|
45
|
+
this._value = this.valueLimitFn(value, this._value) || value;
|
|
46
|
+
setTimeout(() => this.cdRef.markForCheck(), 0);
|
|
47
|
+
}
|
|
48
|
+
registerOnChange(fn) {
|
|
49
|
+
this.onChange = fn;
|
|
50
|
+
}
|
|
51
|
+
registerOnTouched(fn) {
|
|
52
|
+
this.onTouched = fn;
|
|
53
|
+
}
|
|
54
|
+
setDisabledState(isDisabled) {
|
|
55
|
+
this.disabled = isDisabled;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
AbstractNgModelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbstractNgModelComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
+
AbstractNgModelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: AbstractNgModelComponent, selector: "ng-component", inputs: { disabled: "disabled", readonly: "readonly", valueFn: "valueFn", valueLimitFn: "valueLimitFn", value: "value" }, ngImport: i0, template: '', isInline: true });
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbstractNgModelComponent, decorators: [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{ template: '' }]
|
|
63
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { disabled: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], readonly: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}], valueFn: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], valueLimitFn: [{
|
|
70
|
+
type: Input
|
|
71
|
+
}], value: [{
|
|
72
|
+
type: Input
|
|
73
|
+
}] } });
|
|
74
|
+
|
|
75
|
+
const LOCALIZATIONS = new InjectionToken('LOCALIZATIONS');
|
|
76
|
+
function localizationContributor(localizations) {
|
|
77
|
+
if (localizations) {
|
|
78
|
+
localizations$.next([...localizations$.value, ...localizations]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const localizations$ = new BehaviorSubject([]);
|
|
82
|
+
|
|
83
|
+
const CORE_OPTIONS = new InjectionToken('CORE_OPTIONS');
|
|
84
|
+
function coreOptionsFactory({ ...options }) {
|
|
85
|
+
return {
|
|
86
|
+
...options,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// This will not be necessary when only Angukar 9.1+ is supported
|
|
91
|
+
function getLocaleDirection(locale) {
|
|
92
|
+
return /^(ar(-[A-Z]{2})?|ckb(-IR)?|fa(-AF)?|he|ks|lrc(-IQ)?|mzn|pa-Arab|ps(-PK)?|sd|ug|ur(-IN)?|uz-Arab|yi)$/.test(locale)
|
|
93
|
+
? 'rtl'
|
|
94
|
+
: 'ltr';
|
|
95
|
+
}
|
|
96
|
+
function createLocalizer(localization) {
|
|
97
|
+
return (resourceName, key, defaultValue) => {
|
|
98
|
+
if (resourceName === '_')
|
|
99
|
+
return key;
|
|
100
|
+
const resource = localization?.values?.[resourceName];
|
|
101
|
+
if (!resource)
|
|
102
|
+
return defaultValue;
|
|
103
|
+
return resource[key] || defaultValue;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function createLocalizerWithFallback(localization) {
|
|
107
|
+
const findLocalization = createLocalizationFinder(localization);
|
|
108
|
+
return (resourceNames, keys, defaultValue) => {
|
|
109
|
+
const { localized } = findLocalization(resourceNames, keys);
|
|
110
|
+
return localized || defaultValue;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function createLocalizationPipeKeyGenerator(localization) {
|
|
114
|
+
const findLocalization = createLocalizationFinder(localization);
|
|
115
|
+
return (resourceNames, keys, defaultKey) => {
|
|
116
|
+
const { resourceName, key } = findLocalization(resourceNames, keys);
|
|
117
|
+
return !resourceName ? defaultKey : resourceName === '_' ? key : `${resourceName}::${key}`;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function createLocalizationFinder(localization) {
|
|
121
|
+
const localize = createLocalizer(localization);
|
|
122
|
+
return (resourceNames, keys) => {
|
|
123
|
+
resourceNames = resourceNames.concat(localization.defaultResourceName || '').filter(Boolean);
|
|
124
|
+
const resourceCount = resourceNames.length;
|
|
125
|
+
const keyCount = keys.length;
|
|
126
|
+
for (let i = 0; i < resourceCount; i++) {
|
|
127
|
+
const resourceName = resourceNames[i];
|
|
128
|
+
for (let j = 0; j < keyCount; j++) {
|
|
129
|
+
const key = keys[j];
|
|
130
|
+
const localized = localize(resourceName, key, null);
|
|
131
|
+
if (localized)
|
|
132
|
+
return { resourceName, key, localized };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { resourceName: undefined, key: undefined, localized: undefined };
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function createTokenParser(format) {
|
|
140
|
+
return (str) => {
|
|
141
|
+
const tokens = [];
|
|
142
|
+
const regex = format.replace(/\./g, '\\.').replace(/\{\s?([0-9a-zA-Z]+)\s?\}/g, (_, token) => {
|
|
143
|
+
tokens.push(token);
|
|
144
|
+
return '(.+)';
|
|
145
|
+
});
|
|
146
|
+
const matches = (str.match(regex) || []).slice(1);
|
|
147
|
+
return matches.reduce((acc, v, i) => {
|
|
148
|
+
const key = tokens[i];
|
|
149
|
+
acc[key] = [...(acc[key] || []), v].filter(Boolean);
|
|
150
|
+
return acc;
|
|
151
|
+
}, {});
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function interpolate(text, params) {
|
|
155
|
+
return text
|
|
156
|
+
.replace(/(['"]?\{\s*(\d+)\s*\}['"]?)/g, (_, match, digit) => params[digit] ?? match)
|
|
157
|
+
.replace(/\s+/g, ' ');
|
|
158
|
+
}
|
|
159
|
+
function escapeHtmlChars(value) {
|
|
160
|
+
return (value &&
|
|
161
|
+
value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function noop() {
|
|
165
|
+
const fn = function () { };
|
|
166
|
+
return fn;
|
|
167
|
+
}
|
|
168
|
+
function isUndefinedOrEmptyString(value) {
|
|
169
|
+
return value === undefined || value === '';
|
|
170
|
+
}
|
|
171
|
+
function isNullOrUndefined(obj) {
|
|
172
|
+
return obj === null || obj === undefined;
|
|
173
|
+
}
|
|
174
|
+
function exists(obj) {
|
|
175
|
+
return !isNullOrUndefined(obj);
|
|
176
|
+
}
|
|
177
|
+
function isObject(obj) {
|
|
178
|
+
return obj instanceof Object;
|
|
179
|
+
}
|
|
180
|
+
function isArray(obj) {
|
|
181
|
+
return Array.isArray(obj);
|
|
182
|
+
}
|
|
183
|
+
function isObjectAndNotArray(obj) {
|
|
184
|
+
return isObject(obj) && !isArray(obj);
|
|
185
|
+
}
|
|
186
|
+
function isNode(obj) {
|
|
187
|
+
return obj instanceof Node;
|
|
188
|
+
}
|
|
189
|
+
function isObjectAndNotArrayNotNode(obj) {
|
|
190
|
+
return isObjectAndNotArray(obj) && !isNode(obj);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function deepMerge(target, source) {
|
|
194
|
+
if (isObjectAndNotArrayNotNode(target) && isObjectAndNotArrayNotNode(source)) {
|
|
195
|
+
return deepMergeRecursively(target, source);
|
|
196
|
+
}
|
|
197
|
+
else if (isNullOrUndefined(target) && isNullOrUndefined(source)) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
return exists(source) ? source : target;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function deepMergeRecursively(target, source) {
|
|
205
|
+
const shouldNotRecurse = isNullOrUndefined(target) ||
|
|
206
|
+
isNullOrUndefined(source) || // at least one not defined
|
|
207
|
+
isArray(target) ||
|
|
208
|
+
isArray(source) || // at least one array
|
|
209
|
+
!isObject(target) ||
|
|
210
|
+
!isObject(source) || // at least one not an object
|
|
211
|
+
isNode(target) ||
|
|
212
|
+
isNode(source); // at least one node
|
|
213
|
+
/**
|
|
214
|
+
* if we will not recurse any further,
|
|
215
|
+
* we will prioritize source if it is a defined value.
|
|
216
|
+
*/
|
|
217
|
+
if (shouldNotRecurse) {
|
|
218
|
+
return exists(source) ? source : target;
|
|
219
|
+
}
|
|
220
|
+
const keysOfTarget = Object.keys(target);
|
|
221
|
+
const keysOfSource = Object.keys(source);
|
|
222
|
+
const uniqueKeys = new Set(keysOfTarget.concat(keysOfSource));
|
|
223
|
+
return [...uniqueKeys].reduce((retVal, key) => {
|
|
224
|
+
retVal[key] = deepMergeRecursively(target[key], source[key]);
|
|
225
|
+
return retVal;
|
|
226
|
+
}, {});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
class InternalStore {
|
|
230
|
+
constructor(initialState) {
|
|
231
|
+
this.initialState = initialState;
|
|
232
|
+
this.state$ = new BehaviorSubject(this.initialState);
|
|
233
|
+
this.update$ = new Subject();
|
|
234
|
+
this.sliceState = (selector, compareFn = compare) => this.state$.pipe(map(selector), distinctUntilChanged(compareFn));
|
|
235
|
+
this.sliceUpdate = (selector, filterFn = (x) => x !== undefined) => this.update$.pipe(map(selector), filter(filterFn));
|
|
236
|
+
}
|
|
237
|
+
get state() {
|
|
238
|
+
return this.state$.value;
|
|
239
|
+
}
|
|
240
|
+
patch(state) {
|
|
241
|
+
let patchedState = state;
|
|
242
|
+
if (typeof state === 'object' && !Array.isArray(state)) {
|
|
243
|
+
patchedState = { ...this.state, ...state };
|
|
244
|
+
}
|
|
245
|
+
this.state$.next(patchedState);
|
|
246
|
+
this.update$.next(patchedState);
|
|
247
|
+
}
|
|
248
|
+
deepPatch(state) {
|
|
249
|
+
this.state$.next(deepMerge(this.state, state));
|
|
250
|
+
this.update$.next(state);
|
|
251
|
+
}
|
|
252
|
+
set(state) {
|
|
253
|
+
this.state$.next(state);
|
|
254
|
+
this.update$.next(state);
|
|
255
|
+
}
|
|
256
|
+
reset() {
|
|
257
|
+
this.set(this.initialState);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const mapToApiUrl = (key) => (apis) => (apis[key] || apis.default).url || apis.default.url;
|
|
262
|
+
class EnvironmentService {
|
|
263
|
+
constructor() {
|
|
264
|
+
this.store = new InternalStore({});
|
|
265
|
+
}
|
|
266
|
+
get createOnUpdateStream() {
|
|
267
|
+
return this.store.sliceUpdate;
|
|
268
|
+
}
|
|
269
|
+
getEnvironment$() {
|
|
270
|
+
return this.store.sliceState(state => state);
|
|
271
|
+
}
|
|
272
|
+
getEnvironment() {
|
|
273
|
+
return this.store.state;
|
|
274
|
+
}
|
|
275
|
+
getApiUrl(key) {
|
|
276
|
+
return mapToApiUrl(key)(this.store.state.apis);
|
|
277
|
+
}
|
|
278
|
+
getApiUrl$(key) {
|
|
279
|
+
return this.store.sliceState(state => state.apis).pipe(map(mapToApiUrl(key)));
|
|
280
|
+
}
|
|
281
|
+
setState(environment) {
|
|
282
|
+
this.store.set(environment);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
286
|
+
EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EnvironmentService, decorators: [{
|
|
288
|
+
type: Injectable,
|
|
289
|
+
args: [{ providedIn: 'root' }]
|
|
290
|
+
}] });
|
|
291
|
+
|
|
292
|
+
class HttpErrorReporterService {
|
|
293
|
+
constructor() {
|
|
294
|
+
this._reporter$ = new Subject();
|
|
295
|
+
this._errors$ = new BehaviorSubject([]);
|
|
296
|
+
this.reportError = (error) => {
|
|
297
|
+
this._reporter$.next(error);
|
|
298
|
+
this._errors$.next([...this.errors, error]);
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
get reporter$() {
|
|
302
|
+
return this._reporter$.asObservable();
|
|
303
|
+
}
|
|
304
|
+
get errors$() {
|
|
305
|
+
return this._errors$.asObservable();
|
|
306
|
+
}
|
|
307
|
+
get errors() {
|
|
308
|
+
return this._errors$.value;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
HttpErrorReporterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpErrorReporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
312
|
+
HttpErrorReporterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpErrorReporterService, providedIn: 'root' });
|
|
313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpErrorReporterService, decorators: [{
|
|
314
|
+
type: Injectable,
|
|
315
|
+
args: [{ providedIn: 'root' }]
|
|
316
|
+
}] });
|
|
317
|
+
|
|
318
|
+
class RestService {
|
|
319
|
+
constructor(options, http, environment, httpErrorReporter) {
|
|
320
|
+
this.options = options;
|
|
321
|
+
this.http = http;
|
|
322
|
+
this.environment = environment;
|
|
323
|
+
this.httpErrorReporter = httpErrorReporter;
|
|
324
|
+
}
|
|
325
|
+
getApiFromStore(apiName) {
|
|
326
|
+
return this.environment.getApiUrl(apiName);
|
|
327
|
+
}
|
|
328
|
+
handleError(err) {
|
|
329
|
+
this.httpErrorReporter.reportError(err);
|
|
330
|
+
return throwError(err);
|
|
331
|
+
}
|
|
332
|
+
request(request, config, api) {
|
|
333
|
+
config = config || {};
|
|
334
|
+
api = api || this.getApiFromStore(config.apiName);
|
|
335
|
+
const { method, params, ...options } = request;
|
|
336
|
+
const { observe = "body" /* Body */, skipHandleError } = config;
|
|
337
|
+
return this.http
|
|
338
|
+
.request(method, api + request.url, {
|
|
339
|
+
observe,
|
|
340
|
+
...(params && {
|
|
341
|
+
params: this.getParams(params, config.httpParamEncoder),
|
|
342
|
+
}),
|
|
343
|
+
...options,
|
|
344
|
+
})
|
|
345
|
+
.pipe(catchError(err => (skipHandleError ? throwError(err) : this.handleError(err))));
|
|
346
|
+
}
|
|
347
|
+
getParams(params, encoder) {
|
|
348
|
+
const httpParams = encoder ? new HttpParams({ encoder }) : new HttpParams();
|
|
349
|
+
return Object.keys(params).reduce((acc, key) => {
|
|
350
|
+
const value = params[key];
|
|
351
|
+
if (isUndefinedOrEmptyString(value))
|
|
352
|
+
return acc;
|
|
353
|
+
if (value === null && !this.options.sendNullsAsQueryParam)
|
|
354
|
+
return acc;
|
|
355
|
+
acc = acc.set(key, value);
|
|
356
|
+
return acc;
|
|
357
|
+
}, httpParams);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
RestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RestService, deps: [{ token: CORE_OPTIONS }, { token: i1.HttpClient }, { token: EnvironmentService }, { token: HttpErrorReporterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
361
|
+
RestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RestService, providedIn: 'root' });
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RestService, decorators: [{
|
|
363
|
+
type: Injectable,
|
|
364
|
+
args: [{
|
|
365
|
+
providedIn: 'root',
|
|
366
|
+
}]
|
|
367
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
368
|
+
type: Inject,
|
|
369
|
+
args: [CORE_OPTIONS]
|
|
370
|
+
}] }, { type: i1.HttpClient }, { type: EnvironmentService }, { type: HttpErrorReporterService }]; } });
|
|
371
|
+
|
|
372
|
+
class AbpApplicationConfigurationService {
|
|
373
|
+
constructor(restService) {
|
|
374
|
+
this.restService = restService;
|
|
375
|
+
this.apiName = 'abp';
|
|
376
|
+
}
|
|
377
|
+
get() {
|
|
378
|
+
return this.restService.request({
|
|
379
|
+
method: 'GET',
|
|
380
|
+
url: '/api/abp/application-configuration',
|
|
381
|
+
}, { apiName: this.apiName });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
AbpApplicationConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApplicationConfigurationService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
385
|
+
AbpApplicationConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApplicationConfigurationService, providedIn: 'root' });
|
|
386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApplicationConfigurationService, decorators: [{
|
|
387
|
+
type: Injectable,
|
|
388
|
+
args: [{
|
|
389
|
+
providedIn: 'root',
|
|
390
|
+
}]
|
|
391
|
+
}], ctorParameters: function () { return [{ type: RestService }]; } });
|
|
392
|
+
|
|
393
|
+
class ConfigStateService {
|
|
394
|
+
constructor(abpConfigService) {
|
|
395
|
+
this.abpConfigService = abpConfigService;
|
|
396
|
+
this.store = new InternalStore({});
|
|
397
|
+
this.updateSubject = new Subject();
|
|
398
|
+
this.initUpdateStream();
|
|
399
|
+
}
|
|
400
|
+
get createOnUpdateStream() {
|
|
401
|
+
return this.store.sliceUpdate;
|
|
402
|
+
}
|
|
403
|
+
initUpdateStream() {
|
|
404
|
+
this.updateSubject
|
|
405
|
+
.pipe(switchMap(() => this.abpConfigService.get()))
|
|
406
|
+
.subscribe(res => this.store.set(res));
|
|
407
|
+
}
|
|
408
|
+
refreshAppState() {
|
|
409
|
+
this.updateSubject.next();
|
|
410
|
+
return this.createOnUpdateStream(state => state).pipe(take(1));
|
|
411
|
+
}
|
|
412
|
+
getOne$(key) {
|
|
413
|
+
return this.store.sliceState(state => state[key]);
|
|
414
|
+
}
|
|
415
|
+
getOne(key) {
|
|
416
|
+
return this.store.state[key];
|
|
417
|
+
}
|
|
418
|
+
getAll$() {
|
|
419
|
+
return this.store.sliceState(state => state);
|
|
420
|
+
}
|
|
421
|
+
getAll() {
|
|
422
|
+
return this.store.state;
|
|
423
|
+
}
|
|
424
|
+
getDeep$(keys) {
|
|
425
|
+
keys = splitKeys(keys);
|
|
426
|
+
return this.store
|
|
427
|
+
.sliceState(state => state)
|
|
428
|
+
.pipe(map(state => {
|
|
429
|
+
return keys.reduce((acc, val) => {
|
|
430
|
+
if (acc) {
|
|
431
|
+
return acc[val];
|
|
432
|
+
}
|
|
433
|
+
return undefined;
|
|
434
|
+
}, state);
|
|
435
|
+
}));
|
|
436
|
+
}
|
|
437
|
+
getDeep(keys) {
|
|
438
|
+
keys = splitKeys(keys);
|
|
439
|
+
return keys.reduce((acc, val) => {
|
|
440
|
+
if (acc) {
|
|
441
|
+
return acc[val];
|
|
442
|
+
}
|
|
443
|
+
return undefined;
|
|
444
|
+
}, this.store.state);
|
|
445
|
+
}
|
|
446
|
+
getFeature(key) {
|
|
447
|
+
return this.store.state.features?.values?.[key];
|
|
448
|
+
}
|
|
449
|
+
getFeature$(key) {
|
|
450
|
+
return this.store.sliceState(state => state.features?.values?.[key]);
|
|
451
|
+
}
|
|
452
|
+
getFeatures(keys) {
|
|
453
|
+
const { features } = this.store.state;
|
|
454
|
+
if (!features)
|
|
455
|
+
return;
|
|
456
|
+
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {});
|
|
457
|
+
}
|
|
458
|
+
getFeatures$(keys) {
|
|
459
|
+
return this.store.sliceState(({ features }) => {
|
|
460
|
+
if (!features?.values)
|
|
461
|
+
return;
|
|
462
|
+
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {});
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
getSetting(key) {
|
|
466
|
+
return this.store.state.setting?.values?.[key];
|
|
467
|
+
}
|
|
468
|
+
getSetting$(key) {
|
|
469
|
+
return this.store.sliceState(state => state.setting?.values?.[key]);
|
|
470
|
+
}
|
|
471
|
+
getSettings(keyword) {
|
|
472
|
+
const settings = this.store.state.setting?.values || {};
|
|
473
|
+
if (!keyword)
|
|
474
|
+
return settings;
|
|
475
|
+
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1);
|
|
476
|
+
return keysFound.reduce((acc, key) => {
|
|
477
|
+
acc[key] = settings[key];
|
|
478
|
+
return acc;
|
|
479
|
+
}, {});
|
|
480
|
+
}
|
|
481
|
+
getSettings$(keyword) {
|
|
482
|
+
return this.store
|
|
483
|
+
.sliceState(state => state.setting?.values)
|
|
484
|
+
.pipe(map((settings = {}) => {
|
|
485
|
+
if (!keyword)
|
|
486
|
+
return settings;
|
|
487
|
+
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1);
|
|
488
|
+
return keysFound.reduce((acc, key) => {
|
|
489
|
+
acc[key] = settings[key];
|
|
490
|
+
return acc;
|
|
491
|
+
}, {});
|
|
492
|
+
}));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
ConfigStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConfigStateService, deps: [{ token: AbpApplicationConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
496
|
+
ConfigStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConfigStateService, providedIn: 'root' });
|
|
497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConfigStateService, decorators: [{
|
|
498
|
+
type: Injectable,
|
|
499
|
+
args: [{
|
|
500
|
+
providedIn: 'root',
|
|
501
|
+
}]
|
|
502
|
+
}], ctorParameters: function () { return [{ type: AbpApplicationConfigurationService }]; } });
|
|
503
|
+
function splitKeys(keys) {
|
|
504
|
+
if (typeof keys === 'string') {
|
|
505
|
+
keys = keys.split('.');
|
|
506
|
+
}
|
|
507
|
+
if (!Array.isArray(keys)) {
|
|
508
|
+
throw new Error('The argument must be a dot string or an string array.');
|
|
509
|
+
}
|
|
510
|
+
return keys;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
class SessionStateService {
|
|
514
|
+
constructor(configState) {
|
|
515
|
+
this.configState = configState;
|
|
516
|
+
this.store = new InternalStore({});
|
|
517
|
+
this.updateLocalStorage = () => {
|
|
518
|
+
localStorage.setItem('abpSession', JSON.stringify(this.store.state));
|
|
519
|
+
};
|
|
520
|
+
this.init();
|
|
521
|
+
this.setInitialLanguage();
|
|
522
|
+
}
|
|
523
|
+
init() {
|
|
524
|
+
const session = localStorage.getItem('abpSession');
|
|
525
|
+
if (session) {
|
|
526
|
+
this.store.set(JSON.parse(session));
|
|
527
|
+
}
|
|
528
|
+
this.store.sliceUpdate(state => state).subscribe(this.updateLocalStorage);
|
|
529
|
+
}
|
|
530
|
+
setInitialLanguage() {
|
|
531
|
+
if (this.getLanguage())
|
|
532
|
+
return;
|
|
533
|
+
this.configState
|
|
534
|
+
.getDeep$('localization.currentCulture.cultureName')
|
|
535
|
+
.pipe(filter(cultureName => !!cultureName), take(1))
|
|
536
|
+
.subscribe(lang => {
|
|
537
|
+
if (lang.includes(';')) {
|
|
538
|
+
lang = lang.split(';')[0];
|
|
539
|
+
}
|
|
540
|
+
this.setLanguage(lang);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
onLanguageChange$() {
|
|
544
|
+
return this.store.sliceUpdate(state => state.language);
|
|
545
|
+
}
|
|
546
|
+
onTenantChange$() {
|
|
547
|
+
return this.store.sliceUpdate(state => state.tenant);
|
|
548
|
+
}
|
|
549
|
+
getLanguage() {
|
|
550
|
+
return this.store.state.language;
|
|
551
|
+
}
|
|
552
|
+
getLanguage$() {
|
|
553
|
+
return this.store.sliceState(state => state.language);
|
|
554
|
+
}
|
|
555
|
+
getTenant() {
|
|
556
|
+
return this.store.state.tenant;
|
|
557
|
+
}
|
|
558
|
+
getTenant$() {
|
|
559
|
+
return this.store.sliceState(state => state.tenant);
|
|
560
|
+
}
|
|
561
|
+
setTenant(tenant) {
|
|
562
|
+
if (compare(tenant, this.store.state.tenant))
|
|
563
|
+
return;
|
|
564
|
+
this.store.set({ ...this.store.state, tenant });
|
|
565
|
+
}
|
|
566
|
+
setLanguage(language) {
|
|
567
|
+
if (language === this.store.state.language)
|
|
568
|
+
return;
|
|
569
|
+
this.store.patch({ language });
|
|
570
|
+
document.documentElement.setAttribute('lang', language);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
SessionStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SessionStateService, deps: [{ token: ConfigStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
574
|
+
SessionStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SessionStateService, providedIn: 'root' });
|
|
575
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SessionStateService, decorators: [{
|
|
576
|
+
type: Injectable,
|
|
577
|
+
args: [{
|
|
578
|
+
providedIn: 'root',
|
|
579
|
+
}]
|
|
580
|
+
}], ctorParameters: function () { return [{ type: ConfigStateService }]; } });
|
|
581
|
+
|
|
582
|
+
class LocalizationService {
|
|
583
|
+
constructor(sessionState, injector, otherInstance, configState) {
|
|
584
|
+
this.sessionState = sessionState;
|
|
585
|
+
this.injector = injector;
|
|
586
|
+
this.configState = configState;
|
|
587
|
+
this.latestLang = this.sessionState.getLanguage();
|
|
588
|
+
this._languageChange$ = new Subject();
|
|
589
|
+
this.uiLocalizations$ = new BehaviorSubject(new Map());
|
|
590
|
+
this.localizations$ = new BehaviorSubject(new Map());
|
|
591
|
+
if (otherInstance)
|
|
592
|
+
throw new Error('LocalizationService should have only one instance.');
|
|
593
|
+
this.listenToSetLanguage();
|
|
594
|
+
this.initLocalizationValues();
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Returns currently selected language
|
|
598
|
+
*/
|
|
599
|
+
get currentLang() {
|
|
600
|
+
return this.latestLang || this.sessionState.getLanguage();
|
|
601
|
+
}
|
|
602
|
+
get languageChange$() {
|
|
603
|
+
return this._languageChange$.asObservable();
|
|
604
|
+
}
|
|
605
|
+
initLocalizationValues() {
|
|
606
|
+
localizations$.subscribe(val => this.addLocalization(val));
|
|
607
|
+
const remoteLocalizations$ = this.configState.getDeep$('localization.values');
|
|
608
|
+
const currentLanguage$ = this.sessionState.getLanguage$();
|
|
609
|
+
const uiLocalizations$ = combineLatest([currentLanguage$, this.uiLocalizations$]).pipe(map(([currentLang, localizations]) => localizations.get(currentLang)));
|
|
610
|
+
combineLatest([remoteLocalizations$, uiLocalizations$])
|
|
611
|
+
.pipe(map(([remote, local]) => {
|
|
612
|
+
if (remote) {
|
|
613
|
+
if (!local) {
|
|
614
|
+
local = new Map();
|
|
615
|
+
}
|
|
616
|
+
Object.entries(remote).forEach(entry => {
|
|
617
|
+
const resourceName = entry[0];
|
|
618
|
+
const remoteTexts = entry[1];
|
|
619
|
+
let resource = local.get(resourceName) || {};
|
|
620
|
+
resource = { ...resource, ...remoteTexts };
|
|
621
|
+
local.set(resourceName, resource);
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
return local;
|
|
625
|
+
}))
|
|
626
|
+
.subscribe(val => this.localizations$.next(val));
|
|
627
|
+
}
|
|
628
|
+
addLocalization(localizations) {
|
|
629
|
+
if (!localizations)
|
|
630
|
+
return;
|
|
631
|
+
const localizationMap = this.uiLocalizations$.value;
|
|
632
|
+
localizations.forEach(loc => {
|
|
633
|
+
const cultureMap = localizationMap.get(loc.culture) || new Map();
|
|
634
|
+
loc.resources.forEach(res => {
|
|
635
|
+
let resource = cultureMap.get(res.resourceName) || {};
|
|
636
|
+
resource = { ...resource, ...res.texts };
|
|
637
|
+
cultureMap.set(res.resourceName, resource);
|
|
638
|
+
});
|
|
639
|
+
localizationMap.set(loc.culture, cultureMap);
|
|
640
|
+
});
|
|
641
|
+
this.uiLocalizations$.next(localizationMap);
|
|
642
|
+
}
|
|
643
|
+
listenToSetLanguage() {
|
|
644
|
+
this.sessionState
|
|
645
|
+
.onLanguageChange$()
|
|
646
|
+
.pipe(filter(lang => this.configState.getDeep('localization.currentCulture.cultureName') !== lang), switchMap(lang => this.configState.refreshAppState().pipe(mapTo(lang))), switchMap(lang => from(this.registerLocale(lang).then(() => lang))))
|
|
647
|
+
.subscribe(lang => this._languageChange$.next(lang));
|
|
648
|
+
}
|
|
649
|
+
registerLocale(locale) {
|
|
650
|
+
const { registerLocaleFn } = this.injector.get(CORE_OPTIONS);
|
|
651
|
+
return registerLocaleFn(locale).then(module => {
|
|
652
|
+
if (module?.default)
|
|
653
|
+
registerLocaleData(module.default);
|
|
654
|
+
this.latestLang = locale;
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Returns an observable localized text with the given interpolation parameters in current language.
|
|
659
|
+
* @param key Localizaton key to replace with localized text
|
|
660
|
+
* @param interpolateParams Values to interpolate
|
|
661
|
+
*/
|
|
662
|
+
get(key, ...interpolateParams) {
|
|
663
|
+
return this.configState
|
|
664
|
+
.getAll$()
|
|
665
|
+
.pipe(map(state => this.getLocalization(state, key, ...interpolateParams)));
|
|
666
|
+
}
|
|
667
|
+
getResource(resourceName) {
|
|
668
|
+
return this.localizations$.value.get(resourceName);
|
|
669
|
+
}
|
|
670
|
+
getResource$(resourceName) {
|
|
671
|
+
return this.localizations$.pipe(map(res => res.get(resourceName)));
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Returns localized text with the given interpolation parameters in current language.
|
|
675
|
+
* @param key Localization key to replace with localized text
|
|
676
|
+
* @param interpolateParams Values to intepolate.
|
|
677
|
+
*/
|
|
678
|
+
instant(key, ...interpolateParams) {
|
|
679
|
+
return this.getLocalization(this.configState.getAll(), key, ...interpolateParams);
|
|
680
|
+
}
|
|
681
|
+
localize(resourceName, key, defaultValue) {
|
|
682
|
+
return this.configState.getOne$('localization').pipe(map(createLocalizer), map(localize => localize(resourceName, key, defaultValue)));
|
|
683
|
+
}
|
|
684
|
+
localizeSync(resourceName, key, defaultValue) {
|
|
685
|
+
const localization = this.configState.getOne('localization');
|
|
686
|
+
return createLocalizer(localization)(resourceName, key, defaultValue);
|
|
687
|
+
}
|
|
688
|
+
localizeWithFallback(resourceNames, keys, defaultValue) {
|
|
689
|
+
return this.configState.getOne$('localization').pipe(map(createLocalizerWithFallback), map(localizeWithFallback => localizeWithFallback(resourceNames, keys, defaultValue)));
|
|
690
|
+
}
|
|
691
|
+
localizeWithFallbackSync(resourceNames, keys, defaultValue) {
|
|
692
|
+
const localization = this.configState.getOne('localization');
|
|
693
|
+
return createLocalizerWithFallback(localization)(resourceNames, keys, defaultValue);
|
|
694
|
+
}
|
|
695
|
+
getLocalization(state, key, ...interpolateParams) {
|
|
696
|
+
if (!key)
|
|
697
|
+
key = '';
|
|
698
|
+
let defaultValue;
|
|
699
|
+
if (typeof key !== 'string') {
|
|
700
|
+
defaultValue = key.defaultValue;
|
|
701
|
+
key = key.key;
|
|
702
|
+
}
|
|
703
|
+
const keys = key.split('::');
|
|
704
|
+
const warn = (message) => {
|
|
705
|
+
if (isDevMode)
|
|
706
|
+
console.warn(message);
|
|
707
|
+
};
|
|
708
|
+
if (keys.length < 2) {
|
|
709
|
+
warn('The localization source separator (::) not found.');
|
|
710
|
+
return defaultValue || key;
|
|
711
|
+
}
|
|
712
|
+
if (!state.localization)
|
|
713
|
+
return defaultValue || keys[1];
|
|
714
|
+
const sourceName = keys[0] || state.localization.defaultResourceName;
|
|
715
|
+
const sourceKey = keys[1];
|
|
716
|
+
if (sourceName === '_') {
|
|
717
|
+
return defaultValue || sourceKey;
|
|
718
|
+
}
|
|
719
|
+
if (!sourceName) {
|
|
720
|
+
warn('Localization source name is not specified and the defaultResourceName was not defined!');
|
|
721
|
+
return defaultValue || sourceKey;
|
|
722
|
+
}
|
|
723
|
+
const source = this.localizations$.value.get(sourceName);
|
|
724
|
+
if (!source) {
|
|
725
|
+
warn('Could not find localization source: ' + sourceName);
|
|
726
|
+
return defaultValue || sourceKey;
|
|
727
|
+
}
|
|
728
|
+
let localization = source[sourceKey];
|
|
729
|
+
if (typeof localization === 'undefined') {
|
|
730
|
+
return defaultValue || sourceKey;
|
|
731
|
+
}
|
|
732
|
+
interpolateParams = interpolateParams.filter(params => params != null);
|
|
733
|
+
if (localization)
|
|
734
|
+
localization = interpolate(localization, interpolateParams);
|
|
735
|
+
if (typeof localization !== 'string')
|
|
736
|
+
localization = '';
|
|
737
|
+
return localization || defaultValue || key;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
LocalizationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationService, deps: [{ token: SessionStateService }, { token: i0.Injector }, { token: LocalizationService, optional: true, skipSelf: true }, { token: ConfigStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
741
|
+
LocalizationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationService, providedIn: 'root' });
|
|
742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationService, decorators: [{
|
|
743
|
+
type: Injectable,
|
|
744
|
+
args: [{ providedIn: 'root' }]
|
|
745
|
+
}], ctorParameters: function () { return [{ type: SessionStateService }, { type: i0.Injector }, { type: LocalizationService, decorators: [{
|
|
746
|
+
type: Optional
|
|
747
|
+
}, {
|
|
748
|
+
type: SkipSelf
|
|
749
|
+
}] }, { type: ConfigStateService }]; } });
|
|
750
|
+
|
|
751
|
+
function findRoute(routesService, path) {
|
|
752
|
+
const node = routesService.find(route => route.path === path);
|
|
753
|
+
return node || path === '/'
|
|
754
|
+
? node
|
|
755
|
+
: findRoute(routesService, path.split('/').slice(0, -1).join('/') || '/');
|
|
756
|
+
}
|
|
757
|
+
function getRoutePath(router, url = router.url) {
|
|
758
|
+
const emptyGroup = { segments: [] };
|
|
759
|
+
const primaryGroup = router.parseUrl(url).root.children[PRIMARY_OUTLET];
|
|
760
|
+
return '/' + (primaryGroup || emptyGroup).segments.map(({ path }) => path).join('/');
|
|
761
|
+
}
|
|
762
|
+
function reloadRoute(router, ngZone) {
|
|
763
|
+
const { shouldReuseRoute } = router.routeReuseStrategy;
|
|
764
|
+
const setRouteReuse = (reuse) => {
|
|
765
|
+
router.routeReuseStrategy.shouldReuseRoute = reuse;
|
|
766
|
+
};
|
|
767
|
+
setRouteReuse(() => false);
|
|
768
|
+
router.navigated = false;
|
|
769
|
+
ngZone.run(async () => {
|
|
770
|
+
await router.navigateByUrl(router.url).catch(noop);
|
|
771
|
+
setRouteReuse(shouldReuseRoute);
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
class ReplaceableComponentsService {
|
|
776
|
+
constructor(ngZone, router) {
|
|
777
|
+
this.ngZone = ngZone;
|
|
778
|
+
this.router = router;
|
|
779
|
+
this.store = new InternalStore([]);
|
|
780
|
+
}
|
|
781
|
+
get replaceableComponents$() {
|
|
782
|
+
return this.store.sliceState(state => state);
|
|
783
|
+
}
|
|
784
|
+
get replaceableComponents() {
|
|
785
|
+
return this.store.state;
|
|
786
|
+
}
|
|
787
|
+
get onUpdate$() {
|
|
788
|
+
return this.store.sliceUpdate(state => state);
|
|
789
|
+
}
|
|
790
|
+
add(replaceableComponent, reload) {
|
|
791
|
+
const replaceableComponents = [...this.store.state];
|
|
792
|
+
const index = replaceableComponents.findIndex(component => component.key === replaceableComponent.key);
|
|
793
|
+
if (index > -1) {
|
|
794
|
+
replaceableComponents[index] = replaceableComponent;
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
replaceableComponents.push(replaceableComponent);
|
|
798
|
+
}
|
|
799
|
+
this.store.set(replaceableComponents);
|
|
800
|
+
if (reload)
|
|
801
|
+
reloadRoute(this.router, this.ngZone);
|
|
802
|
+
}
|
|
803
|
+
get(replaceableComponentKey) {
|
|
804
|
+
return this.replaceableComponents.find(component => component.key === replaceableComponentKey);
|
|
805
|
+
}
|
|
806
|
+
get$(replaceableComponentKey) {
|
|
807
|
+
return this.replaceableComponents$.pipe(map(components => components.find(component => component.key === replaceableComponentKey)));
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
ReplaceableComponentsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableComponentsService, deps: [{ token: i0.NgZone }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
811
|
+
ReplaceableComponentsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableComponentsService, providedIn: 'root' });
|
|
812
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableComponentsService, decorators: [{
|
|
813
|
+
type: Injectable,
|
|
814
|
+
args: [{ providedIn: 'root' }]
|
|
815
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.Router }]; } });
|
|
816
|
+
|
|
817
|
+
const NavigationEvent = {
|
|
818
|
+
Cancel: NavigationCancel,
|
|
819
|
+
End: NavigationEnd,
|
|
820
|
+
Error: NavigationError,
|
|
821
|
+
Start: NavigationStart,
|
|
822
|
+
};
|
|
823
|
+
class RouterEvents {
|
|
824
|
+
constructor(router) {
|
|
825
|
+
this.router = router;
|
|
826
|
+
}
|
|
827
|
+
getEvents(...eventTypes) {
|
|
828
|
+
const filterRouterEvents = (event) => eventTypes.some(type => event instanceof type);
|
|
829
|
+
return this.router.events.pipe(filter(filterRouterEvents));
|
|
830
|
+
}
|
|
831
|
+
getNavigationEvents(...navigationEventKeys) {
|
|
832
|
+
const filterNavigationEvents = (event) => navigationEventKeys.some(key => event instanceof NavigationEvent[key]);
|
|
833
|
+
return this.router.events.pipe(filter(filterNavigationEvents));
|
|
834
|
+
}
|
|
835
|
+
getAllEvents() {
|
|
836
|
+
return this.router.events;
|
|
837
|
+
}
|
|
838
|
+
getAllNavigationEvents() {
|
|
839
|
+
const keys = Object.keys(NavigationEvent);
|
|
840
|
+
return this.getNavigationEvents(...keys);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
RouterEvents.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterEvents, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
844
|
+
RouterEvents.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterEvents, providedIn: 'root' });
|
|
845
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterEvents, decorators: [{
|
|
846
|
+
type: Injectable,
|
|
847
|
+
args: [{ providedIn: 'root' }]
|
|
848
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
849
|
+
|
|
850
|
+
function pushValueTo(array) {
|
|
851
|
+
return (element) => {
|
|
852
|
+
array.push(element);
|
|
853
|
+
return array;
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
858
|
+
class BaseTreeNode {
|
|
859
|
+
constructor(props) {
|
|
860
|
+
this.children = [];
|
|
861
|
+
this.isLeaf = true;
|
|
862
|
+
Object.assign(this, props);
|
|
863
|
+
}
|
|
864
|
+
static create(props) {
|
|
865
|
+
return new BaseTreeNode(props);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function createTreeFromList(list, keySelector, parentKeySelector, valueMapper) {
|
|
869
|
+
const map = createMapFromList(list, keySelector, valueMapper);
|
|
870
|
+
const tree = [];
|
|
871
|
+
list.forEach(row => {
|
|
872
|
+
const id = keySelector(row);
|
|
873
|
+
const parentId = parentKeySelector(row);
|
|
874
|
+
const node = map.get(id);
|
|
875
|
+
if (!node)
|
|
876
|
+
return;
|
|
877
|
+
if (parentId) {
|
|
878
|
+
const parent = map.get(parentId);
|
|
879
|
+
if (!parent)
|
|
880
|
+
return;
|
|
881
|
+
parent.children.push(node);
|
|
882
|
+
parent.isLeaf = false;
|
|
883
|
+
node.parent = parent;
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
tree.push(node);
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
return tree;
|
|
890
|
+
}
|
|
891
|
+
function createMapFromList(list, keySelector, valueMapper) {
|
|
892
|
+
const map = new Map();
|
|
893
|
+
list.forEach(row => map.set(keySelector(row), valueMapper(row)));
|
|
894
|
+
return map;
|
|
895
|
+
}
|
|
896
|
+
function createTreeNodeFilterCreator(key, mapperFn) {
|
|
897
|
+
return (search) => {
|
|
898
|
+
const regex = new RegExp('.*' + search + '.*', 'i');
|
|
899
|
+
return function collectNodes(nodes, matches = []) {
|
|
900
|
+
for (const node of nodes) {
|
|
901
|
+
if (regex.test(mapperFn(node[key])))
|
|
902
|
+
matches.push(node);
|
|
903
|
+
if (node.children.length)
|
|
904
|
+
collectNodes(node.children, matches);
|
|
905
|
+
}
|
|
906
|
+
return matches;
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
class PermissionService {
|
|
912
|
+
constructor(configState) {
|
|
913
|
+
this.configState = configState;
|
|
914
|
+
}
|
|
915
|
+
getGrantedPolicy$(key) {
|
|
916
|
+
return this.getStream().pipe(map(grantedPolicies => this.isPolicyGranted(key, grantedPolicies)));
|
|
917
|
+
}
|
|
918
|
+
getGrantedPolicy(key) {
|
|
919
|
+
const policies = this.getSnapshot();
|
|
920
|
+
return this.isPolicyGranted(key, policies);
|
|
921
|
+
}
|
|
922
|
+
filterItemsByPolicy(items) {
|
|
923
|
+
const policies = this.getSnapshot();
|
|
924
|
+
return items.filter(item => !item.requiredPolicy || this.isPolicyGranted(item.requiredPolicy, policies));
|
|
925
|
+
}
|
|
926
|
+
filterItemsByPolicy$(items) {
|
|
927
|
+
return this.getStream().pipe(map(policies => items.filter(item => !item.requiredPolicy || this.isPolicyGranted(item.requiredPolicy, policies))));
|
|
928
|
+
}
|
|
929
|
+
isPolicyGranted(key, grantedPolicies) {
|
|
930
|
+
if (!key)
|
|
931
|
+
return true;
|
|
932
|
+
const orRegexp = /\|\|/g;
|
|
933
|
+
const andRegexp = /&&/g;
|
|
934
|
+
// TODO: Allow combination of ANDs & ORs
|
|
935
|
+
if (orRegexp.test(key)) {
|
|
936
|
+
const keys = key.split('||').filter(Boolean);
|
|
937
|
+
if (keys.length < 2)
|
|
938
|
+
return false;
|
|
939
|
+
return keys.some(k => this.getPolicy(k.trim(), grantedPolicies));
|
|
940
|
+
}
|
|
941
|
+
else if (andRegexp.test(key)) {
|
|
942
|
+
const keys = key.split('&&').filter(Boolean);
|
|
943
|
+
if (keys.length < 2)
|
|
944
|
+
return false;
|
|
945
|
+
return keys.every(k => this.getPolicy(k.trim(), grantedPolicies));
|
|
946
|
+
}
|
|
947
|
+
return this.getPolicy(key, grantedPolicies);
|
|
948
|
+
}
|
|
949
|
+
getStream() {
|
|
950
|
+
return this.configState.getAll$().pipe(map(this.mapToPolicies));
|
|
951
|
+
}
|
|
952
|
+
getSnapshot() {
|
|
953
|
+
return this.mapToPolicies(this.configState.getAll());
|
|
954
|
+
}
|
|
955
|
+
mapToPolicies(applicationConfiguration) {
|
|
956
|
+
return applicationConfiguration?.auth?.grantedPolicies || {};
|
|
957
|
+
}
|
|
958
|
+
getPolicy(key, grantedPolicies) {
|
|
959
|
+
return grantedPolicies[key] || false;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
PermissionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionService, deps: [{ token: ConfigStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
963
|
+
PermissionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionService, providedIn: 'root' });
|
|
964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionService, decorators: [{
|
|
965
|
+
type: Injectable,
|
|
966
|
+
args: [{ providedIn: 'root' }]
|
|
967
|
+
}], ctorParameters: function () { return [{ type: ConfigStateService }]; } });
|
|
968
|
+
|
|
969
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
970
|
+
class AbstractTreeService {
|
|
971
|
+
constructor() {
|
|
972
|
+
this._flat$ = new BehaviorSubject([]);
|
|
973
|
+
this._tree$ = new BehaviorSubject([]);
|
|
974
|
+
this._visible$ = new BehaviorSubject([]);
|
|
975
|
+
}
|
|
976
|
+
get flat() {
|
|
977
|
+
return this._flat$.value;
|
|
978
|
+
}
|
|
979
|
+
get flat$() {
|
|
980
|
+
return this._flat$.asObservable();
|
|
981
|
+
}
|
|
982
|
+
get tree() {
|
|
983
|
+
return this._tree$.value;
|
|
984
|
+
}
|
|
985
|
+
get tree$() {
|
|
986
|
+
return this._tree$.asObservable();
|
|
987
|
+
}
|
|
988
|
+
get visible() {
|
|
989
|
+
return this._visible$.value;
|
|
990
|
+
}
|
|
991
|
+
get visible$() {
|
|
992
|
+
return this._visible$.asObservable();
|
|
993
|
+
}
|
|
994
|
+
createTree(items) {
|
|
995
|
+
return createTreeFromList(items, item => item[this.id], item => item[this.parentId], item => BaseTreeNode.create(item));
|
|
996
|
+
}
|
|
997
|
+
filterWith(setOrMap) {
|
|
998
|
+
return this._flat$.value.filter(item => !setOrMap.has(item[this.id]));
|
|
999
|
+
}
|
|
1000
|
+
findItemsToRemove(set) {
|
|
1001
|
+
return this._flat$.value.reduce((acc, item) => {
|
|
1002
|
+
if (!acc.has(item[this.parentId]))
|
|
1003
|
+
return acc;
|
|
1004
|
+
const childSet = new Set([item[this.id]]);
|
|
1005
|
+
const children = this.findItemsToRemove(childSet);
|
|
1006
|
+
return new Set([...acc, ...children]);
|
|
1007
|
+
}, set);
|
|
1008
|
+
}
|
|
1009
|
+
publish(flatItems, visibleItems) {
|
|
1010
|
+
this._flat$.next(flatItems);
|
|
1011
|
+
this._tree$.next(this.createTree(flatItems));
|
|
1012
|
+
this._visible$.next(this.createTree(visibleItems));
|
|
1013
|
+
return flatItems;
|
|
1014
|
+
}
|
|
1015
|
+
add(items) {
|
|
1016
|
+
const map = new Map();
|
|
1017
|
+
items.forEach(item => map.set(item[this.id], item));
|
|
1018
|
+
const flatItems = this.filterWith(map);
|
|
1019
|
+
map.forEach(pushValueTo(flatItems));
|
|
1020
|
+
flatItems.sort(this.sort);
|
|
1021
|
+
const visibleItems = flatItems.filter(item => !this.hide(item));
|
|
1022
|
+
return this.publish(flatItems, visibleItems);
|
|
1023
|
+
}
|
|
1024
|
+
find(predicate, tree = this.tree) {
|
|
1025
|
+
return tree.reduce((acc, node) => (acc ? acc : predicate(node) ? node : this.find(predicate, node.children)), null);
|
|
1026
|
+
}
|
|
1027
|
+
patch(identifier, props) {
|
|
1028
|
+
const flatItems = this._flat$.value;
|
|
1029
|
+
const index = flatItems.findIndex(item => item[this.id] === identifier);
|
|
1030
|
+
if (index < 0)
|
|
1031
|
+
return false;
|
|
1032
|
+
flatItems[index] = { ...flatItems[index], ...props };
|
|
1033
|
+
flatItems.sort(this.sort);
|
|
1034
|
+
const visibleItems = flatItems.filter(item => !this.hide(item));
|
|
1035
|
+
return this.publish(flatItems, visibleItems);
|
|
1036
|
+
}
|
|
1037
|
+
refresh() {
|
|
1038
|
+
return this.add([]);
|
|
1039
|
+
}
|
|
1040
|
+
remove(identifiers) {
|
|
1041
|
+
const set = new Set();
|
|
1042
|
+
identifiers.forEach(id => set.add(id));
|
|
1043
|
+
const setToRemove = this.findItemsToRemove(set);
|
|
1044
|
+
const flatItems = this.filterWith(setToRemove);
|
|
1045
|
+
const visibleItems = flatItems.filter(item => !this.hide(item));
|
|
1046
|
+
return this.publish(flatItems, visibleItems);
|
|
1047
|
+
}
|
|
1048
|
+
search(params, tree = this.tree) {
|
|
1049
|
+
const searchKeys = Object.keys(params);
|
|
1050
|
+
return tree.reduce((acc, node) => acc
|
|
1051
|
+
? acc
|
|
1052
|
+
: searchKeys.every(key => node[key] === params[key])
|
|
1053
|
+
? node
|
|
1054
|
+
: this.search(params, node.children), null);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
class AbstractNavTreeService extends AbstractTreeService {
|
|
1058
|
+
constructor(injector) {
|
|
1059
|
+
super();
|
|
1060
|
+
this.injector = injector;
|
|
1061
|
+
this.id = 'name';
|
|
1062
|
+
this.parentId = 'parentName';
|
|
1063
|
+
this.hide = (item) => item.invisible || !this.isGranted(item);
|
|
1064
|
+
this.sort = (a, b) => {
|
|
1065
|
+
if (!Number.isInteger(a.order))
|
|
1066
|
+
return 1;
|
|
1067
|
+
if (!Number.isInteger(b.order))
|
|
1068
|
+
return -1;
|
|
1069
|
+
return a.order - b.order;
|
|
1070
|
+
};
|
|
1071
|
+
const configState = this.injector.get(ConfigStateService);
|
|
1072
|
+
this.subscription = configState
|
|
1073
|
+
.createOnUpdateStream(state => state)
|
|
1074
|
+
.subscribe(() => this.refresh());
|
|
1075
|
+
this.permissionService = injector.get(PermissionService);
|
|
1076
|
+
}
|
|
1077
|
+
isGranted({ requiredPolicy }) {
|
|
1078
|
+
return this.permissionService.getGrantedPolicy(requiredPolicy);
|
|
1079
|
+
}
|
|
1080
|
+
hasChildren(identifier) {
|
|
1081
|
+
const node = this.find(item => item[this.id] === identifier);
|
|
1082
|
+
return Boolean(node?.children?.length);
|
|
1083
|
+
}
|
|
1084
|
+
hasInvisibleChild(identifier) {
|
|
1085
|
+
const node = this.find(item => item[this.id] === identifier);
|
|
1086
|
+
return node?.children?.some(child => child.invisible);
|
|
1087
|
+
}
|
|
1088
|
+
/* istanbul ignore next */
|
|
1089
|
+
ngOnDestroy() {
|
|
1090
|
+
this.subscription.unsubscribe();
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
AbstractNavTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbstractNavTreeService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1094
|
+
AbstractNavTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbstractNavTreeService });
|
|
1095
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbstractNavTreeService, decorators: [{
|
|
1096
|
+
type: Injectable
|
|
1097
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
1098
|
+
class RoutesService extends AbstractNavTreeService {
|
|
1099
|
+
}
|
|
1100
|
+
RoutesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1101
|
+
RoutesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesService, providedIn: 'root' });
|
|
1102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesService, decorators: [{
|
|
1103
|
+
type: Injectable,
|
|
1104
|
+
args: [{ providedIn: 'root' }]
|
|
1105
|
+
}] });
|
|
1106
|
+
|
|
1107
|
+
class SubscriptionService {
|
|
1108
|
+
constructor() {
|
|
1109
|
+
this.subscription = new Subscription();
|
|
1110
|
+
}
|
|
1111
|
+
get isClosed() {
|
|
1112
|
+
return this.subscription.closed;
|
|
1113
|
+
}
|
|
1114
|
+
addOne(source$, nextOrObserver, error) {
|
|
1115
|
+
const subscription = source$.subscribe(nextOrObserver, error);
|
|
1116
|
+
this.subscription.add(subscription);
|
|
1117
|
+
return subscription;
|
|
1118
|
+
}
|
|
1119
|
+
closeAll() {
|
|
1120
|
+
this.subscription.unsubscribe();
|
|
1121
|
+
}
|
|
1122
|
+
closeOne(subscription) {
|
|
1123
|
+
this.removeOne(subscription);
|
|
1124
|
+
subscription.unsubscribe();
|
|
1125
|
+
}
|
|
1126
|
+
ngOnDestroy() {
|
|
1127
|
+
this.subscription.unsubscribe();
|
|
1128
|
+
}
|
|
1129
|
+
removeOne(subscription) {
|
|
1130
|
+
if (!subscription)
|
|
1131
|
+
return;
|
|
1132
|
+
this.subscription.remove(subscription);
|
|
1133
|
+
}
|
|
1134
|
+
reset() {
|
|
1135
|
+
this.subscription.unsubscribe();
|
|
1136
|
+
this.subscription = new Subscription();
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SubscriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1140
|
+
SubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SubscriptionService });
|
|
1141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SubscriptionService, decorators: [{
|
|
1142
|
+
type: Injectable
|
|
1143
|
+
}] });
|
|
1144
|
+
|
|
1145
|
+
class DynamicLayoutComponent {
|
|
1146
|
+
constructor(injector, localizationService, replaceableComponents, subscription, routerEvents, dynamicLayoutComponent) {
|
|
1147
|
+
this.localizationService = localizationService;
|
|
1148
|
+
this.replaceableComponents = replaceableComponents;
|
|
1149
|
+
this.subscription = subscription;
|
|
1150
|
+
this.routerEvents = routerEvents;
|
|
1151
|
+
// TODO: Consider a shared enum (eThemeSharedComponents) for known layouts
|
|
1152
|
+
this.layouts = new Map([
|
|
1153
|
+
['application', 'Theme.ApplicationLayoutComponent'],
|
|
1154
|
+
['account', 'Theme.AccountLayoutComponent'],
|
|
1155
|
+
['empty', 'Theme.EmptyLayoutComponent'],
|
|
1156
|
+
]);
|
|
1157
|
+
this.isLayoutVisible = true;
|
|
1158
|
+
if (dynamicLayoutComponent) {
|
|
1159
|
+
if (isDevMode)
|
|
1160
|
+
console.warn('DynamicLayoutComponent must be used only in AppComponent.');
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
this.route = injector.get(ActivatedRoute);
|
|
1164
|
+
this.router = injector.get(Router);
|
|
1165
|
+
this.routes = injector.get(RoutesService);
|
|
1166
|
+
this.checkLayoutOnNavigationEnd();
|
|
1167
|
+
this.listenToLanguageChange();
|
|
1168
|
+
}
|
|
1169
|
+
checkLayoutOnNavigationEnd() {
|
|
1170
|
+
const navigationEnd$ = this.routerEvents.getNavigationEvents('End');
|
|
1171
|
+
this.subscription.addOne(navigationEnd$, () => this.getLayout());
|
|
1172
|
+
}
|
|
1173
|
+
getLayout() {
|
|
1174
|
+
let expectedLayout = (this.route.snapshot.data || {}).layout;
|
|
1175
|
+
if (!expectedLayout) {
|
|
1176
|
+
let node = findRoute(this.routes, getRoutePath(this.router));
|
|
1177
|
+
node = { parent: node };
|
|
1178
|
+
while (node.parent) {
|
|
1179
|
+
node = node.parent;
|
|
1180
|
+
if (node.layout) {
|
|
1181
|
+
expectedLayout = node.layout;
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (!expectedLayout)
|
|
1187
|
+
expectedLayout = "empty" /* empty */;
|
|
1188
|
+
if (this.layoutKey === expectedLayout)
|
|
1189
|
+
return;
|
|
1190
|
+
const key = this.layouts.get(expectedLayout);
|
|
1191
|
+
this.layout = this.getComponent(key)?.component;
|
|
1192
|
+
this.layoutKey = expectedLayout;
|
|
1193
|
+
}
|
|
1194
|
+
listenToLanguageChange() {
|
|
1195
|
+
this.subscription.addOne(this.localizationService.languageChange$, () => {
|
|
1196
|
+
this.isLayoutVisible = false;
|
|
1197
|
+
setTimeout(() => (this.isLayoutVisible = true), 0);
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
getComponent(key) {
|
|
1201
|
+
return this.replaceableComponents.get(key);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
DynamicLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DynamicLayoutComponent, deps: [{ token: i0.Injector }, { token: LocalizationService }, { token: ReplaceableComponentsService }, { token: SubscriptionService }, { token: RouterEvents }, { token: DynamicLayoutComponent, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1205
|
+
DynamicLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: DynamicLayoutComponent, selector: "abp-dynamic-layout", providers: [SubscriptionService], ngImport: i0, template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `, isInline: true, directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModuleFactory"] }] });
|
|
1206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DynamicLayoutComponent, decorators: [{
|
|
1207
|
+
type: Component,
|
|
1208
|
+
args: [{
|
|
1209
|
+
selector: 'abp-dynamic-layout',
|
|
1210
|
+
template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `,
|
|
1211
|
+
providers: [SubscriptionService],
|
|
1212
|
+
}]
|
|
1213
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: LocalizationService }, { type: ReplaceableComponentsService }, { type: SubscriptionService }, { type: RouterEvents }, { type: DynamicLayoutComponent, decorators: [{
|
|
1214
|
+
type: Optional
|
|
1215
|
+
}, {
|
|
1216
|
+
type: SkipSelf
|
|
1217
|
+
}] }]; } });
|
|
1218
|
+
|
|
1219
|
+
class ReplaceableRouteContainerComponent {
|
|
1220
|
+
constructor(route, replaceableComponents, subscription) {
|
|
1221
|
+
this.route = route;
|
|
1222
|
+
this.replaceableComponents = replaceableComponents;
|
|
1223
|
+
this.subscription = subscription;
|
|
1224
|
+
}
|
|
1225
|
+
ngOnInit() {
|
|
1226
|
+
this.defaultComponent = this.route.snapshot.data.replaceableComponent.defaultComponent;
|
|
1227
|
+
this.componentKey = this.route.snapshot.data.replaceableComponent.key;
|
|
1228
|
+
const component$ = this.replaceableComponents
|
|
1229
|
+
.get$(this.componentKey)
|
|
1230
|
+
.pipe(distinctUntilChanged());
|
|
1231
|
+
this.subscription.addOne(component$, (res = {}) => {
|
|
1232
|
+
this.externalComponent = res.component;
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
ReplaceableRouteContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableRouteContainerComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1237
|
+
ReplaceableRouteContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ReplaceableRouteContainerComponent, selector: "abp-replaceable-route-container", providers: [SubscriptionService], ngImport: i0, template: `
|
|
1238
|
+
<ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
|
|
1239
|
+
`, isInline: true, directives: [{ type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModuleFactory"] }] });
|
|
1240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableRouteContainerComponent, decorators: [{
|
|
1241
|
+
type: Component,
|
|
1242
|
+
args: [{
|
|
1243
|
+
selector: 'abp-replaceable-route-container',
|
|
1244
|
+
template: `
|
|
1245
|
+
<ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
|
|
1246
|
+
`,
|
|
1247
|
+
providers: [SubscriptionService],
|
|
1248
|
+
}]
|
|
1249
|
+
}], ctorParameters: function () { return [{ type: i1$1.ActivatedRoute }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; } });
|
|
1250
|
+
|
|
1251
|
+
class RouterOutletComponent {
|
|
1252
|
+
}
|
|
1253
|
+
RouterOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1254
|
+
RouterOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: RouterOutletComponent, selector: "abp-router-outlet", ngImport: i0, template: ` <router-outlet></router-outlet> `, isInline: true, directives: [{ type: i1$1.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
1255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterOutletComponent, decorators: [{
|
|
1256
|
+
type: Component,
|
|
1257
|
+
args: [{
|
|
1258
|
+
selector: 'abp-router-outlet',
|
|
1259
|
+
template: ` <router-outlet></router-outlet> `,
|
|
1260
|
+
}]
|
|
1261
|
+
}] });
|
|
1262
|
+
|
|
1263
|
+
// Different locales from .NET
|
|
1264
|
+
// Key is .NET locale, value is Angular locale
|
|
1265
|
+
const differentLocales = {
|
|
1266
|
+
aa: 'en',
|
|
1267
|
+
'aa-DJ': 'en',
|
|
1268
|
+
'aa-ER': 'en',
|
|
1269
|
+
'aa-ET': 'en',
|
|
1270
|
+
'af-ZA': 'af',
|
|
1271
|
+
'agq-CM': 'agq',
|
|
1272
|
+
'ak-GH': 'ak',
|
|
1273
|
+
'am-ET': 'am',
|
|
1274
|
+
'ar-001': 'ar',
|
|
1275
|
+
arn: 'en',
|
|
1276
|
+
'arn-CL': 'en',
|
|
1277
|
+
'as-IN': 'as',
|
|
1278
|
+
'asa-TZ': 'asa',
|
|
1279
|
+
'ast-ES': 'ast',
|
|
1280
|
+
'az-Cyrl-AZ': 'az-Cyrl',
|
|
1281
|
+
'az-Latn-AZ': 'az-Latn',
|
|
1282
|
+
ba: 'ru',
|
|
1283
|
+
'ba-RU': 'ru',
|
|
1284
|
+
'bas-CM': 'bas',
|
|
1285
|
+
'be-BY': 'be',
|
|
1286
|
+
'bem-ZM': 'bem',
|
|
1287
|
+
'bez-TZ': 'bez',
|
|
1288
|
+
'bg-BG': 'bg',
|
|
1289
|
+
bin: 'en',
|
|
1290
|
+
'bin-NG': 'en',
|
|
1291
|
+
'bm-Latn': 'bm',
|
|
1292
|
+
'bm-Latn-ML': 'bm',
|
|
1293
|
+
'bn-BD': 'bn',
|
|
1294
|
+
'bo-CN': 'bo',
|
|
1295
|
+
'br-FR': 'br',
|
|
1296
|
+
'brx-IN': 'brx',
|
|
1297
|
+
'bs-Cyrl-BA': 'bs-Cyrl',
|
|
1298
|
+
'bs-Latn-BA': 'bs-Latn',
|
|
1299
|
+
byn: 'en',
|
|
1300
|
+
'byn-ER': 'en',
|
|
1301
|
+
'ca-ES': 'ca',
|
|
1302
|
+
'ca-ES-valencia': 'ca-ES-VALENCIA',
|
|
1303
|
+
'ce-RU': 'ce',
|
|
1304
|
+
'cgg-UG': 'cgg',
|
|
1305
|
+
'chr-Cher': 'chr',
|
|
1306
|
+
'chr-Cher-US': 'chr',
|
|
1307
|
+
co: 'en',
|
|
1308
|
+
'co-FR': 'fr',
|
|
1309
|
+
'cs-CZ': 'cs',
|
|
1310
|
+
'cu-RU': 'cu',
|
|
1311
|
+
'cy-GB': 'cy',
|
|
1312
|
+
'da-DK': 'da',
|
|
1313
|
+
'dav-KE': 'dav',
|
|
1314
|
+
'de-DE': 'de',
|
|
1315
|
+
'dje-NE': 'dje',
|
|
1316
|
+
'dsb-DE': 'dsb',
|
|
1317
|
+
'dua-CM': 'dua',
|
|
1318
|
+
dv: 'en',
|
|
1319
|
+
'dv-MV': 'en',
|
|
1320
|
+
'dyo-SN': 'dyo',
|
|
1321
|
+
'dz-BT': 'dz',
|
|
1322
|
+
'ebu-KE': 'ebu',
|
|
1323
|
+
'ee-GH': 'ee',
|
|
1324
|
+
'el-GR': 'el',
|
|
1325
|
+
'en-029': 'en',
|
|
1326
|
+
'en-ID': 'en',
|
|
1327
|
+
'en-US': 'en',
|
|
1328
|
+
'eo-001': 'en',
|
|
1329
|
+
'es-ES': 'es',
|
|
1330
|
+
'et-EE': 'et',
|
|
1331
|
+
'eu-ES': 'eu',
|
|
1332
|
+
'ewo-CM': 'ewo',
|
|
1333
|
+
'fa-IR': 'fa',
|
|
1334
|
+
'ff-Latn-SN': 'ff-Latn',
|
|
1335
|
+
'ff-NG': 'ff',
|
|
1336
|
+
'fi-FI': 'fi',
|
|
1337
|
+
'fil-PH': 'fil',
|
|
1338
|
+
'fo-FO': 'fo',
|
|
1339
|
+
'fr-029': 'fr',
|
|
1340
|
+
'fr-FR': 'fr',
|
|
1341
|
+
'fur-IT': 'fur',
|
|
1342
|
+
'fy-NL': 'fy',
|
|
1343
|
+
'ga-IE': 'ga',
|
|
1344
|
+
'gd-GB': 'gd',
|
|
1345
|
+
'gl-ES': 'gl',
|
|
1346
|
+
gn: 'en',
|
|
1347
|
+
'gn-PY': 'en',
|
|
1348
|
+
'gsw-CH': 'gsw',
|
|
1349
|
+
'gu-IN': 'gu',
|
|
1350
|
+
'guz-KE': 'guz',
|
|
1351
|
+
'gv-IM': 'gv',
|
|
1352
|
+
'ha-Latn': 'ha',
|
|
1353
|
+
'ha-Latn-GH': 'ha-GH',
|
|
1354
|
+
'ha-Latn-NE': 'ha-NE',
|
|
1355
|
+
'ha-Latn-NG': 'ha',
|
|
1356
|
+
'haw-US': 'haw',
|
|
1357
|
+
'he-IL': 'he',
|
|
1358
|
+
'hi-IN': 'hi',
|
|
1359
|
+
'hr-HR': 'hr',
|
|
1360
|
+
'hsb-DE': 'hsb',
|
|
1361
|
+
'hu-HU': 'hu',
|
|
1362
|
+
'hy-AM': 'hy',
|
|
1363
|
+
'ia-001': 'ia',
|
|
1364
|
+
'ia-FR': 'ia',
|
|
1365
|
+
ibb: 'en',
|
|
1366
|
+
'ibb-NG': 'en',
|
|
1367
|
+
'id-ID': 'id',
|
|
1368
|
+
'ig-NG': 'ig',
|
|
1369
|
+
'ii-CN': 'ii',
|
|
1370
|
+
'is-IS': 'is',
|
|
1371
|
+
'it-IT': 'it',
|
|
1372
|
+
iu: 'en',
|
|
1373
|
+
'iu-Cans': 'en',
|
|
1374
|
+
'iu-Cans-CA': 'en',
|
|
1375
|
+
'iu-Latn': 'en',
|
|
1376
|
+
'iu-Latn-CA': 'en',
|
|
1377
|
+
'ja-JP': 'ja',
|
|
1378
|
+
'jgo-CM': 'jgo',
|
|
1379
|
+
'jmc-TZ': 'jmc',
|
|
1380
|
+
'jv-Java': 'jv',
|
|
1381
|
+
'jv-Java-ID': 'jv',
|
|
1382
|
+
'jv-Latn': 'jv',
|
|
1383
|
+
'jv-Latn-ID': 'jv',
|
|
1384
|
+
'ka-GE': 'ka',
|
|
1385
|
+
'kab-DZ': 'kab',
|
|
1386
|
+
'kam-KE': 'kam',
|
|
1387
|
+
'kde-TZ': 'kde',
|
|
1388
|
+
'kea-CV': 'kea',
|
|
1389
|
+
'khq-ML': 'khq',
|
|
1390
|
+
'ki-KE': 'ki',
|
|
1391
|
+
'kk-KZ': 'kk',
|
|
1392
|
+
'kkj-CM': 'kkj',
|
|
1393
|
+
'kl-GL': 'kl',
|
|
1394
|
+
'kln-KE': 'kln',
|
|
1395
|
+
'km-KH': 'km',
|
|
1396
|
+
'kn-IN': 'kn',
|
|
1397
|
+
'ko-KR': 'ko',
|
|
1398
|
+
'kok-IN': 'kok',
|
|
1399
|
+
kr: 'en',
|
|
1400
|
+
'kr-NG': 'en',
|
|
1401
|
+
'ks-Arab': 'ks',
|
|
1402
|
+
'ks-Arab-IN': 'ks',
|
|
1403
|
+
'ks-Deva': 'ks',
|
|
1404
|
+
'ks-Deva-IN': 'ks',
|
|
1405
|
+
'ksb-TZ': 'ksb',
|
|
1406
|
+
'ksf-CM': 'ksf',
|
|
1407
|
+
'ksh-DE': 'ksh',
|
|
1408
|
+
'ku-Arab': 'ku',
|
|
1409
|
+
'ku-Arab-IQ': 'ku',
|
|
1410
|
+
'ku-Arab-IR': 'ku',
|
|
1411
|
+
'kw-GB': 'kw',
|
|
1412
|
+
'ky-KG': 'ky',
|
|
1413
|
+
la: 'en',
|
|
1414
|
+
'la-001': 'en',
|
|
1415
|
+
'lag-TZ': 'lag',
|
|
1416
|
+
'lb-LU': 'lb',
|
|
1417
|
+
'lg-UG': 'lg',
|
|
1418
|
+
'lkt-US': 'lkt',
|
|
1419
|
+
'ln-CD': 'ln',
|
|
1420
|
+
'lo-LA': 'lo',
|
|
1421
|
+
'lrc-IR': 'lrc',
|
|
1422
|
+
'lt-LT': 'lt',
|
|
1423
|
+
'lu-CD': 'lu',
|
|
1424
|
+
'luo-KE': 'luo',
|
|
1425
|
+
'luy-KE': 'luy',
|
|
1426
|
+
'lv-LV': 'lv',
|
|
1427
|
+
'mas-KE': 'mas',
|
|
1428
|
+
'mer-KE': 'mer',
|
|
1429
|
+
'mfe-MU': 'mfe',
|
|
1430
|
+
'mg-MG': 'mg',
|
|
1431
|
+
'mgh-MZ': 'mgh',
|
|
1432
|
+
'mgo-CM': 'mgo',
|
|
1433
|
+
'mi-NZ': 'mi',
|
|
1434
|
+
'mk-MK': 'mk',
|
|
1435
|
+
'ml-IN': 'ml',
|
|
1436
|
+
'mn-Cyrl': 'mn',
|
|
1437
|
+
'mn-MN': 'mn',
|
|
1438
|
+
'mn-Mong': 'mn',
|
|
1439
|
+
'mn-Mong-CN': 'mn',
|
|
1440
|
+
'mn-Mong-MN': 'mn',
|
|
1441
|
+
mni: 'en',
|
|
1442
|
+
'mni-IN': 'en',
|
|
1443
|
+
moh: 'en',
|
|
1444
|
+
'moh-CA': 'en',
|
|
1445
|
+
'mr-IN': 'mr',
|
|
1446
|
+
'ms-MY': 'ms',
|
|
1447
|
+
'mt-MT': 'mt',
|
|
1448
|
+
'mua-CM': 'mua',
|
|
1449
|
+
'my-MM': 'my',
|
|
1450
|
+
'mzn-IR': 'mzn',
|
|
1451
|
+
'naq-NA': 'naq',
|
|
1452
|
+
'nb-NO': 'nb',
|
|
1453
|
+
'nd-ZW': 'nd',
|
|
1454
|
+
'ne-NP': 'ne',
|
|
1455
|
+
'nl-NL': 'nl',
|
|
1456
|
+
'nmg-CM': 'ngm',
|
|
1457
|
+
'nn-NO': 'nn',
|
|
1458
|
+
'nnh-CM': 'nnh',
|
|
1459
|
+
no: 'en',
|
|
1460
|
+
nqo: 'en',
|
|
1461
|
+
'nqo-GN': 'en',
|
|
1462
|
+
nr: 'en',
|
|
1463
|
+
'nr-ZA': 'en',
|
|
1464
|
+
nso: 'en',
|
|
1465
|
+
'nso-ZA': 'en',
|
|
1466
|
+
'nus-SS': 'nus',
|
|
1467
|
+
'nyn-UG': 'nyn',
|
|
1468
|
+
oc: 'en',
|
|
1469
|
+
'oc-FR': 'fr',
|
|
1470
|
+
'om-ET': 'om',
|
|
1471
|
+
'or-IN': 'or',
|
|
1472
|
+
'os-GE': 'os',
|
|
1473
|
+
'pa-Arab-PK': 'pa-Arab',
|
|
1474
|
+
'pa-IN': 'pa',
|
|
1475
|
+
pap: 'en',
|
|
1476
|
+
'pap-029': 'en',
|
|
1477
|
+
'pl-PL': 'pl',
|
|
1478
|
+
'prg-001': 'prg',
|
|
1479
|
+
prs: 'en',
|
|
1480
|
+
'prs-AF': 'en',
|
|
1481
|
+
'ps-AF': 'ps',
|
|
1482
|
+
'pt-BR': 'pt',
|
|
1483
|
+
quc: 'en',
|
|
1484
|
+
'quc-Latn': 'en',
|
|
1485
|
+
'quc-Latn-GT': 'en',
|
|
1486
|
+
quz: 'en',
|
|
1487
|
+
'quz-BO': 'en',
|
|
1488
|
+
'quz-EC': 'en',
|
|
1489
|
+
'quz-PE': 'en',
|
|
1490
|
+
'rm-CH': 'rm',
|
|
1491
|
+
'rn-BI': 'rn',
|
|
1492
|
+
'ro-RO': 'ro',
|
|
1493
|
+
'rof-TZ': 'rof',
|
|
1494
|
+
'ru-RU': 'ru',
|
|
1495
|
+
'rw-RW': 'rw',
|
|
1496
|
+
'rwk-TZ': 'rwk',
|
|
1497
|
+
sa: 'en',
|
|
1498
|
+
'sa-IN': 'en',
|
|
1499
|
+
'sah-RU': 'sah',
|
|
1500
|
+
'saq-KE': 'saq',
|
|
1501
|
+
'sbp-TZ': 'en',
|
|
1502
|
+
'sd-Arab': 'sd',
|
|
1503
|
+
'sd-Arab-PK': 'sd',
|
|
1504
|
+
'sd-Deva': 'sd',
|
|
1505
|
+
'sd-Deva-IN': 'sd',
|
|
1506
|
+
'se-NO': 'se',
|
|
1507
|
+
'seh-MZ': 'seh',
|
|
1508
|
+
'ses-ML': 'ses',
|
|
1509
|
+
'sg-CF': 'sg',
|
|
1510
|
+
'shi-Latn-MA': 'shi-Latn',
|
|
1511
|
+
'shi-Tfng-MA': 'shi-Tfng',
|
|
1512
|
+
'si-LK': 'si',
|
|
1513
|
+
'sk-SK': 'sk',
|
|
1514
|
+
'sl-SI': 'sl',
|
|
1515
|
+
sma: 'en',
|
|
1516
|
+
'sma-NO': 'en',
|
|
1517
|
+
'sma-SE': 'en',
|
|
1518
|
+
smj: 'en',
|
|
1519
|
+
'smj-NO': 'en',
|
|
1520
|
+
'smj-SE': 'en',
|
|
1521
|
+
'smn-FI': 'en',
|
|
1522
|
+
sms: 'en',
|
|
1523
|
+
'sms-FI': 'en',
|
|
1524
|
+
'sn-Latn': 'sn',
|
|
1525
|
+
'sn-Latn-ZW': 'sn',
|
|
1526
|
+
'so-SO': 'so',
|
|
1527
|
+
'sq-AL': 'so',
|
|
1528
|
+
'sr-Cyrl-RS': 'sr-Cryl',
|
|
1529
|
+
'sr-Latn-RS': 'sr-Latn',
|
|
1530
|
+
ss: 'en',
|
|
1531
|
+
'ss-SZ': 'en',
|
|
1532
|
+
'ss-ZA': 'en',
|
|
1533
|
+
ssy: 'en',
|
|
1534
|
+
'ssy-ER': 'en',
|
|
1535
|
+
st: 'en',
|
|
1536
|
+
'st-LS': 'en',
|
|
1537
|
+
'st-ZA': 'en',
|
|
1538
|
+
'sv-SE': 'sv',
|
|
1539
|
+
'sw-TZ': 'sw',
|
|
1540
|
+
syr: 'en',
|
|
1541
|
+
'syr-SY': 'en',
|
|
1542
|
+
'ta-IN': 'ta',
|
|
1543
|
+
'te-IN': 'te',
|
|
1544
|
+
'teo-UG': 'teo',
|
|
1545
|
+
'tg-Cyrl': 'tg',
|
|
1546
|
+
'tg-Cyrl-TJ': 'tg',
|
|
1547
|
+
'th-TH': 'th',
|
|
1548
|
+
'ti-ET': 'ti',
|
|
1549
|
+
tig: 'en',
|
|
1550
|
+
'tig-ER': 'en',
|
|
1551
|
+
'tk-TM': 'tk',
|
|
1552
|
+
tn: 'en',
|
|
1553
|
+
'tn-BW': 'en',
|
|
1554
|
+
'tn-ZA': 'en',
|
|
1555
|
+
'to-TO': 'to',
|
|
1556
|
+
'tr-TR': 'tr',
|
|
1557
|
+
ts: 'en',
|
|
1558
|
+
'ts-ZA': 'en',
|
|
1559
|
+
'tt-RU': 'tt',
|
|
1560
|
+
'twq-NE': 'twq',
|
|
1561
|
+
'tzm-Arab': 'tzm',
|
|
1562
|
+
'tzm-Arab-MA': 'tzm',
|
|
1563
|
+
'tzm-Latn': 'tzm',
|
|
1564
|
+
'tzm-Latn-DZ': 'tzm',
|
|
1565
|
+
'tzm-Latn-MA': 'tzm',
|
|
1566
|
+
'tzm-Tfng': 'tzm',
|
|
1567
|
+
'tzm-Tfng-MA': 'tzm',
|
|
1568
|
+
'ug-CN': 'ug',
|
|
1569
|
+
'uk-UA': 'uk',
|
|
1570
|
+
'ur-PK': 'ur',
|
|
1571
|
+
'uz-Arab-AF': 'uz-Arab',
|
|
1572
|
+
'uz-Cyrl-UZ': 'uz-Cyrl',
|
|
1573
|
+
'uz-Latn-UZ': 'uz-Latn',
|
|
1574
|
+
'vai-Latn-LR': 'vai-Latn',
|
|
1575
|
+
'vai-Vaii-LR': 'vai-Vaii',
|
|
1576
|
+
ve: 'en',
|
|
1577
|
+
've-ZA': 'en',
|
|
1578
|
+
'vi-VN': 'vi',
|
|
1579
|
+
'vo-001': 'vo',
|
|
1580
|
+
'vun-TZ': 'vun',
|
|
1581
|
+
'wae-CH': 'wae',
|
|
1582
|
+
wal: 'en',
|
|
1583
|
+
'wal-ET': 'en',
|
|
1584
|
+
'wo-SN': 'wo',
|
|
1585
|
+
'xh-ZA': 'xh',
|
|
1586
|
+
'xog-UG': 'xog',
|
|
1587
|
+
'yav-CM': 'yav',
|
|
1588
|
+
'yi-001': 'yi',
|
|
1589
|
+
'yo-NG': 'yo',
|
|
1590
|
+
'zgh-Tfng': 'zgh',
|
|
1591
|
+
'zgh-Tfng-MA': 'zgh',
|
|
1592
|
+
'zh-CN': 'zh',
|
|
1593
|
+
'zh-HK': 'zh',
|
|
1594
|
+
'zh-MO': 'zh',
|
|
1595
|
+
'zh-SG': 'zh',
|
|
1596
|
+
'zh-TW': 'zh',
|
|
1597
|
+
'zu-ZA': 'zu',
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
class AutofocusDirective {
|
|
1601
|
+
constructor(elRef) {
|
|
1602
|
+
this.elRef = elRef;
|
|
1603
|
+
this._delay = 0;
|
|
1604
|
+
}
|
|
1605
|
+
set delay(val) {
|
|
1606
|
+
this._delay = Number(val) || 0;
|
|
1607
|
+
}
|
|
1608
|
+
get delay() {
|
|
1609
|
+
return this._delay;
|
|
1610
|
+
}
|
|
1611
|
+
ngAfterViewInit() {
|
|
1612
|
+
setTimeout(() => this.elRef.nativeElement.focus(), this.delay);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
AutofocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1616
|
+
AutofocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: AutofocusDirective, selector: "[autofocus]", inputs: { delay: ["autofocus", "delay"] }, ngImport: i0 });
|
|
1617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AutofocusDirective, decorators: [{
|
|
1618
|
+
type: Directive,
|
|
1619
|
+
args: [{
|
|
1620
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1621
|
+
selector: '[autofocus]',
|
|
1622
|
+
}]
|
|
1623
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { delay: [{
|
|
1624
|
+
type: Input,
|
|
1625
|
+
args: ['autofocus']
|
|
1626
|
+
}] } });
|
|
1627
|
+
|
|
1628
|
+
class InputEventDebounceDirective {
|
|
1629
|
+
constructor(el, subscription) {
|
|
1630
|
+
this.el = el;
|
|
1631
|
+
this.subscription = subscription;
|
|
1632
|
+
this.debounce = 300;
|
|
1633
|
+
this.debounceEvent = new EventEmitter();
|
|
1634
|
+
}
|
|
1635
|
+
ngOnInit() {
|
|
1636
|
+
const input$ = fromEvent(this.el.nativeElement, 'input').pipe(debounceTime(this.debounce));
|
|
1637
|
+
this.subscription.addOne(input$, (event) => {
|
|
1638
|
+
this.debounceEvent.emit(event);
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
InputEventDebounceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InputEventDebounceDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1643
|
+
InputEventDebounceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: InputEventDebounceDirective, selector: "[input.debounce]", inputs: { debounce: "debounce" }, outputs: { debounceEvent: "input.debounce" }, providers: [SubscriptionService], ngImport: i0 });
|
|
1644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InputEventDebounceDirective, decorators: [{
|
|
1645
|
+
type: Directive,
|
|
1646
|
+
args: [{
|
|
1647
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1648
|
+
selector: '[input.debounce]',
|
|
1649
|
+
providers: [SubscriptionService],
|
|
1650
|
+
}]
|
|
1651
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
|
|
1652
|
+
type: Input
|
|
1653
|
+
}], debounceEvent: [{
|
|
1654
|
+
type: Output,
|
|
1655
|
+
args: ['input.debounce']
|
|
1656
|
+
}] } });
|
|
1657
|
+
|
|
1658
|
+
class AbpForContext {
|
|
1659
|
+
constructor($implicit, index, count, list) {
|
|
1660
|
+
this.$implicit = $implicit;
|
|
1661
|
+
this.index = index;
|
|
1662
|
+
this.count = count;
|
|
1663
|
+
this.list = list;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
class RecordView {
|
|
1667
|
+
constructor(record, view) {
|
|
1668
|
+
this.record = record;
|
|
1669
|
+
this.view = view;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
class ForDirective {
|
|
1673
|
+
constructor(tempRef, vcRef, differs) {
|
|
1674
|
+
this.tempRef = tempRef;
|
|
1675
|
+
this.vcRef = vcRef;
|
|
1676
|
+
this.differs = differs;
|
|
1677
|
+
}
|
|
1678
|
+
get compareFn() {
|
|
1679
|
+
return this.compareBy || compare;
|
|
1680
|
+
}
|
|
1681
|
+
get trackByFn() {
|
|
1682
|
+
return this.trackBy || ((index, item) => item.id || index);
|
|
1683
|
+
}
|
|
1684
|
+
iterateOverAppliedOperations(changes) {
|
|
1685
|
+
const rw = [];
|
|
1686
|
+
changes.forEachOperation((record, previousIndex, currentIndex) => {
|
|
1687
|
+
if (record.previousIndex == null) {
|
|
1688
|
+
const view = this.vcRef.createEmbeddedView(this.tempRef, new AbpForContext(null, -1, -1, this.items), currentIndex);
|
|
1689
|
+
rw.push(new RecordView(record, view));
|
|
1690
|
+
}
|
|
1691
|
+
else if (currentIndex == null) {
|
|
1692
|
+
this.vcRef.remove(previousIndex);
|
|
1693
|
+
}
|
|
1694
|
+
else {
|
|
1695
|
+
const view = this.vcRef.get(previousIndex);
|
|
1696
|
+
this.vcRef.move(view, currentIndex);
|
|
1697
|
+
rw.push(new RecordView(record, view));
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
for (let i = 0, l = rw.length; i < l; i++) {
|
|
1701
|
+
rw[i].view.context.$implicit = rw[i].record.item;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
iterateOverAttachedViews(changes) {
|
|
1705
|
+
for (let i = 0, l = this.vcRef.length; i < l; i++) {
|
|
1706
|
+
const viewRef = this.vcRef.get(i);
|
|
1707
|
+
viewRef.context.index = i;
|
|
1708
|
+
viewRef.context.count = l;
|
|
1709
|
+
viewRef.context.list = this.items;
|
|
1710
|
+
}
|
|
1711
|
+
changes.forEachIdentityChange((record) => {
|
|
1712
|
+
const viewRef = this.vcRef.get(record.currentIndex);
|
|
1713
|
+
viewRef.context.$implicit = record.item;
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
projectItems(items) {
|
|
1717
|
+
if (!items.length && this.emptyRef) {
|
|
1718
|
+
this.vcRef.clear();
|
|
1719
|
+
this.vcRef.createEmbeddedView(this.emptyRef).rootNodes;
|
|
1720
|
+
this.isShowEmptyRef = true;
|
|
1721
|
+
this.differ = null;
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
if (this.emptyRef && this.isShowEmptyRef) {
|
|
1725
|
+
this.vcRef.clear();
|
|
1726
|
+
this.isShowEmptyRef = false;
|
|
1727
|
+
}
|
|
1728
|
+
if (!this.differ && items) {
|
|
1729
|
+
this.differ = this.differs.find(items).create(this.trackByFn);
|
|
1730
|
+
}
|
|
1731
|
+
if (this.differ) {
|
|
1732
|
+
const changes = this.differ.diff(items);
|
|
1733
|
+
if (changes) {
|
|
1734
|
+
this.iterateOverAppliedOperations(changes);
|
|
1735
|
+
this.iterateOverAttachedViews(changes);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
sortItems(items) {
|
|
1740
|
+
if (this.orderBy) {
|
|
1741
|
+
items.sort((a, b) => a[this.orderBy] > b[this.orderBy] ? 1 : a[this.orderBy] < b[this.orderBy] ? -1 : 0);
|
|
1742
|
+
}
|
|
1743
|
+
else {
|
|
1744
|
+
items.sort();
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
ngOnChanges() {
|
|
1748
|
+
let items = clone(this.items);
|
|
1749
|
+
if (!Array.isArray(items))
|
|
1750
|
+
return;
|
|
1751
|
+
const compareFn = this.compareFn;
|
|
1752
|
+
if (typeof this.filterBy !== 'undefined' &&
|
|
1753
|
+
typeof this.filterVal !== 'undefined' &&
|
|
1754
|
+
this.filterVal !== '') {
|
|
1755
|
+
items = items.filter(item => compareFn(item[this.filterBy], this.filterVal));
|
|
1756
|
+
}
|
|
1757
|
+
switch (this.orderDir) {
|
|
1758
|
+
case 'ASC':
|
|
1759
|
+
this.sortItems(items);
|
|
1760
|
+
this.projectItems(items);
|
|
1761
|
+
break;
|
|
1762
|
+
case 'DESC':
|
|
1763
|
+
this.sortItems(items);
|
|
1764
|
+
items.reverse();
|
|
1765
|
+
this.projectItems(items);
|
|
1766
|
+
break;
|
|
1767
|
+
default:
|
|
1768
|
+
this.projectItems(items);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
ForDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ForDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1773
|
+
ForDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: ForDirective, selector: "[abpFor]", inputs: { items: ["abpForOf", "items"], orderBy: ["abpForOrderBy", "orderBy"], orderDir: ["abpForOrderDir", "orderDir"], filterBy: ["abpForFilterBy", "filterBy"], filterVal: ["abpForFilterVal", "filterVal"], trackBy: ["abpForTrackBy", "trackBy"], compareBy: ["abpForCompareBy", "compareBy"], emptyRef: ["abpForEmptyRef", "emptyRef"] }, usesOnChanges: true, ngImport: i0 });
|
|
1774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ForDirective, decorators: [{
|
|
1775
|
+
type: Directive,
|
|
1776
|
+
args: [{
|
|
1777
|
+
selector: '[abpFor]',
|
|
1778
|
+
}]
|
|
1779
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.IterableDiffers }]; }, propDecorators: { items: [{
|
|
1780
|
+
type: Input,
|
|
1781
|
+
args: ['abpForOf']
|
|
1782
|
+
}], orderBy: [{
|
|
1783
|
+
type: Input,
|
|
1784
|
+
args: ['abpForOrderBy']
|
|
1785
|
+
}], orderDir: [{
|
|
1786
|
+
type: Input,
|
|
1787
|
+
args: ['abpForOrderDir']
|
|
1788
|
+
}], filterBy: [{
|
|
1789
|
+
type: Input,
|
|
1790
|
+
args: ['abpForFilterBy']
|
|
1791
|
+
}], filterVal: [{
|
|
1792
|
+
type: Input,
|
|
1793
|
+
args: ['abpForFilterVal']
|
|
1794
|
+
}], trackBy: [{
|
|
1795
|
+
type: Input,
|
|
1796
|
+
args: ['abpForTrackBy']
|
|
1797
|
+
}], compareBy: [{
|
|
1798
|
+
type: Input,
|
|
1799
|
+
args: ['abpForCompareBy']
|
|
1800
|
+
}], emptyRef: [{
|
|
1801
|
+
type: Input,
|
|
1802
|
+
args: ['abpForEmptyRef']
|
|
1803
|
+
}] } });
|
|
1804
|
+
|
|
1805
|
+
class FormSubmitDirective {
|
|
1806
|
+
constructor(formGroupDirective, host, cdRef, subscription) {
|
|
1807
|
+
this.formGroupDirective = formGroupDirective;
|
|
1808
|
+
this.host = host;
|
|
1809
|
+
this.cdRef = cdRef;
|
|
1810
|
+
this.subscription = subscription;
|
|
1811
|
+
this.debounce = 200;
|
|
1812
|
+
this.ngSubmit = new EventEmitter();
|
|
1813
|
+
this.executedNgSubmit = false;
|
|
1814
|
+
}
|
|
1815
|
+
ngOnInit() {
|
|
1816
|
+
this.subscription.addOne(this.formGroupDirective.ngSubmit, () => {
|
|
1817
|
+
this.markAsDirty();
|
|
1818
|
+
this.executedNgSubmit = true;
|
|
1819
|
+
});
|
|
1820
|
+
const keyup$ = fromEvent(this.host.nativeElement, 'keyup').pipe(debounceTime(this.debounce), filter(event => !(event.target instanceof HTMLTextAreaElement)), filter((event) => event && event.key === 'Enter'));
|
|
1821
|
+
this.subscription.addOne(keyup$, () => {
|
|
1822
|
+
if (!this.executedNgSubmit) {
|
|
1823
|
+
this.host.nativeElement.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
|
|
1824
|
+
}
|
|
1825
|
+
this.executedNgSubmit = false;
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
markAsDirty() {
|
|
1829
|
+
const { form } = this.formGroupDirective;
|
|
1830
|
+
setDirty(form.controls);
|
|
1831
|
+
form.markAsDirty();
|
|
1832
|
+
this.cdRef.detectChanges();
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
FormSubmitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSubmitDirective, deps: [{ token: i1$2.FormGroupDirective, self: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1836
|
+
FormSubmitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: { debounce: "debounce", notValidateOnSubmit: "notValidateOnSubmit" }, outputs: { ngSubmit: "ngSubmit" }, providers: [SubscriptionService], ngImport: i0 });
|
|
1837
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormSubmitDirective, decorators: [{
|
|
1838
|
+
type: Directive,
|
|
1839
|
+
args: [{
|
|
1840
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1841
|
+
selector: 'form[ngSubmit][formGroup]',
|
|
1842
|
+
providers: [SubscriptionService],
|
|
1843
|
+
}]
|
|
1844
|
+
}], ctorParameters: function () { return [{ type: i1$2.FormGroupDirective, decorators: [{
|
|
1845
|
+
type: Self
|
|
1846
|
+
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: SubscriptionService }]; }, propDecorators: { debounce: [{
|
|
1847
|
+
type: Input
|
|
1848
|
+
}], notValidateOnSubmit: [{
|
|
1849
|
+
type: Input
|
|
1850
|
+
}], ngSubmit: [{
|
|
1851
|
+
type: Output
|
|
1852
|
+
}] } });
|
|
1853
|
+
function setDirty(controls) {
|
|
1854
|
+
if (Array.isArray(controls)) {
|
|
1855
|
+
controls.forEach(group => {
|
|
1856
|
+
setDirty(group.controls);
|
|
1857
|
+
});
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
Object.keys(controls).forEach(key => {
|
|
1861
|
+
controls[key].markAsDirty();
|
|
1862
|
+
controls[key].updateValueAndValidity();
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
class InitDirective {
|
|
1867
|
+
constructor(elRef) {
|
|
1868
|
+
this.elRef = elRef;
|
|
1869
|
+
this.init = new EventEmitter();
|
|
1870
|
+
}
|
|
1871
|
+
ngAfterViewInit() {
|
|
1872
|
+
this.init.emit(this.elRef);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
InitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InitDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1876
|
+
InitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: InitDirective, selector: "[abpInit]", outputs: { init: "abpInit" }, ngImport: i0 });
|
|
1877
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InitDirective, decorators: [{
|
|
1878
|
+
type: Directive,
|
|
1879
|
+
args: [{ selector: '[abpInit]' }]
|
|
1880
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { init: [{
|
|
1881
|
+
type: Output,
|
|
1882
|
+
args: ['abpInit']
|
|
1883
|
+
}] } });
|
|
1884
|
+
|
|
1885
|
+
class PermissionDirective {
|
|
1886
|
+
constructor(templateRef, vcRef, permissionService, cdRef) {
|
|
1887
|
+
this.templateRef = templateRef;
|
|
1888
|
+
this.vcRef = vcRef;
|
|
1889
|
+
this.permissionService = permissionService;
|
|
1890
|
+
this.cdRef = cdRef;
|
|
1891
|
+
}
|
|
1892
|
+
check() {
|
|
1893
|
+
if (this.subscription) {
|
|
1894
|
+
this.subscription.unsubscribe();
|
|
1895
|
+
}
|
|
1896
|
+
this.subscription = this.permissionService
|
|
1897
|
+
.getGrantedPolicy$(this.condition || '')
|
|
1898
|
+
.pipe(distinctUntilChanged())
|
|
1899
|
+
.subscribe(isGranted => {
|
|
1900
|
+
this.vcRef.clear();
|
|
1901
|
+
if (isGranted)
|
|
1902
|
+
this.vcRef.createEmbeddedView(this.templateRef);
|
|
1903
|
+
this.cdRef.detectChanges();
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
ngOnDestroy() {
|
|
1907
|
+
if (this.subscription)
|
|
1908
|
+
this.subscription.unsubscribe();
|
|
1909
|
+
}
|
|
1910
|
+
ngOnChanges() {
|
|
1911
|
+
this.check();
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
PermissionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1915
|
+
PermissionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"] }, usesOnChanges: true, ngImport: i0 });
|
|
1916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionDirective, decorators: [{
|
|
1917
|
+
type: Directive,
|
|
1918
|
+
args: [{
|
|
1919
|
+
selector: '[abpPermission]',
|
|
1920
|
+
}]
|
|
1921
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
1922
|
+
type: Optional
|
|
1923
|
+
}] }, { type: i0.ViewContainerRef }, { type: PermissionService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { condition: [{
|
|
1924
|
+
type: Input,
|
|
1925
|
+
args: ['abpPermission']
|
|
1926
|
+
}] } });
|
|
1927
|
+
|
|
1928
|
+
class ReplaceableTemplateDirective {
|
|
1929
|
+
constructor(injector, templateRef, cfRes, vcRef, replaceableComponents, subscription) {
|
|
1930
|
+
this.injector = injector;
|
|
1931
|
+
this.templateRef = templateRef;
|
|
1932
|
+
this.cfRes = cfRes;
|
|
1933
|
+
this.vcRef = vcRef;
|
|
1934
|
+
this.replaceableComponents = replaceableComponents;
|
|
1935
|
+
this.subscription = subscription;
|
|
1936
|
+
this.providedData = {
|
|
1937
|
+
inputs: {},
|
|
1938
|
+
outputs: {},
|
|
1939
|
+
};
|
|
1940
|
+
this.context = {};
|
|
1941
|
+
this.defaultComponentSubscriptions = {};
|
|
1942
|
+
this.initialized = false;
|
|
1943
|
+
this.context = {
|
|
1944
|
+
initTemplate: (ref) => {
|
|
1945
|
+
this.resetDefaultComponent();
|
|
1946
|
+
this.defaultComponentRef = ref;
|
|
1947
|
+
this.setDefaultComponentInputs();
|
|
1948
|
+
},
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
ngOnInit() {
|
|
1952
|
+
const component$ = this.replaceableComponents
|
|
1953
|
+
.get$(this.data.componentKey)
|
|
1954
|
+
.pipe(filter((res = {}) => !this.initialized || !compare(res.component, this.externalComponent)));
|
|
1955
|
+
this.subscription.addOne(component$, (res = {}) => {
|
|
1956
|
+
this.vcRef.clear();
|
|
1957
|
+
this.externalComponent = res.component;
|
|
1958
|
+
if (this.defaultComponentRef) {
|
|
1959
|
+
this.resetDefaultComponent();
|
|
1960
|
+
}
|
|
1961
|
+
if (res.component) {
|
|
1962
|
+
this.setProvidedData();
|
|
1963
|
+
const customInjector = Injector.create({
|
|
1964
|
+
providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }],
|
|
1965
|
+
parent: this.injector,
|
|
1966
|
+
});
|
|
1967
|
+
this.vcRef.createComponent(this.cfRes.resolveComponentFactory(res.component), 0, customInjector);
|
|
1968
|
+
}
|
|
1969
|
+
else {
|
|
1970
|
+
this.vcRef.createEmbeddedView(this.templateRef, this.context);
|
|
1971
|
+
}
|
|
1972
|
+
this.initialized = true;
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
ngOnChanges(changes) {
|
|
1976
|
+
if (changes?.data?.currentValue?.inputs && this.defaultComponentRef) {
|
|
1977
|
+
this.setDefaultComponentInputs();
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
setDefaultComponentInputs() {
|
|
1981
|
+
if (!this.defaultComponentRef || (!this.data.inputs && !this.data.outputs))
|
|
1982
|
+
return;
|
|
1983
|
+
if (this.data.inputs) {
|
|
1984
|
+
for (const key in this.data.inputs) {
|
|
1985
|
+
if (Object.prototype.hasOwnProperty.call(this.data.inputs, key)) {
|
|
1986
|
+
if (!compare(this.defaultComponentRef[key], this.data.inputs[key].value)) {
|
|
1987
|
+
this.defaultComponentRef[key] = this.data.inputs[key].value;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
if (this.data.outputs) {
|
|
1993
|
+
for (const key in this.data.outputs) {
|
|
1994
|
+
if (Object.prototype.hasOwnProperty.call(this.data.outputs, key)) {
|
|
1995
|
+
if (!this.defaultComponentSubscriptions[key]) {
|
|
1996
|
+
this.defaultComponentSubscriptions[key] = this.defaultComponentRef[key].subscribe((value) => {
|
|
1997
|
+
this.data.outputs?.[key](value);
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
setProvidedData() {
|
|
2005
|
+
this.providedData = { outputs: {}, ...this.data, inputs: {} };
|
|
2006
|
+
if (!this.data.inputs)
|
|
2007
|
+
return;
|
|
2008
|
+
Object.defineProperties(this.providedData.inputs, {
|
|
2009
|
+
...Object.keys(this.data.inputs).reduce((acc, key) => ({
|
|
2010
|
+
...acc,
|
|
2011
|
+
[key]: {
|
|
2012
|
+
enumerable: true,
|
|
2013
|
+
configurable: true,
|
|
2014
|
+
get: () => this.data.inputs[key]?.value,
|
|
2015
|
+
...(this.data.inputs[key]?.twoWay && {
|
|
2016
|
+
set: (newValue) => {
|
|
2017
|
+
this.data.inputs[key].value = newValue;
|
|
2018
|
+
this.data.outputs[`${key}Change`](newValue);
|
|
2019
|
+
},
|
|
2020
|
+
}),
|
|
2021
|
+
},
|
|
2022
|
+
}), {}),
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
resetDefaultComponent() {
|
|
2026
|
+
Object.keys(this.defaultComponentSubscriptions).forEach(key => {
|
|
2027
|
+
this.defaultComponentSubscriptions[key].unsubscribe();
|
|
2028
|
+
});
|
|
2029
|
+
this.defaultComponentSubscriptions = {};
|
|
2030
|
+
this.defaultComponentRef = null;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
ReplaceableTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableTemplateDirective, deps: [{ token: i0.Injector }, { token: i0.TemplateRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: ReplaceableComponentsService }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2034
|
+
ReplaceableTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: ReplaceableTemplateDirective, selector: "[abpReplaceableTemplate]", inputs: { data: ["abpReplaceableTemplate", "data"] }, providers: [SubscriptionService], usesOnChanges: true, ngImport: i0 });
|
|
2035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ReplaceableTemplateDirective, decorators: [{
|
|
2036
|
+
type: Directive,
|
|
2037
|
+
args: [{
|
|
2038
|
+
selector: '[abpReplaceableTemplate]',
|
|
2039
|
+
providers: [SubscriptionService],
|
|
2040
|
+
}]
|
|
2041
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.TemplateRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ReplaceableComponentsService }, { type: SubscriptionService }]; }, propDecorators: { data: [{
|
|
2042
|
+
type: Input,
|
|
2043
|
+
args: ['abpReplaceableTemplate']
|
|
2044
|
+
}] } });
|
|
2045
|
+
|
|
2046
|
+
class StopPropagationDirective {
|
|
2047
|
+
constructor(el, subscription) {
|
|
2048
|
+
this.el = el;
|
|
2049
|
+
this.subscription = subscription;
|
|
2050
|
+
this.stopPropEvent = new EventEmitter();
|
|
2051
|
+
}
|
|
2052
|
+
ngOnInit() {
|
|
2053
|
+
this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), (event) => {
|
|
2054
|
+
event.stopPropagation();
|
|
2055
|
+
this.stopPropEvent.emit(event);
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
StopPropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: SubscriptionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2060
|
+
StopPropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: StopPropagationDirective, selector: "[click.stop]", outputs: { stopPropEvent: "click.stop" }, providers: [SubscriptionService], ngImport: i0 });
|
|
2061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: StopPropagationDirective, decorators: [{
|
|
2062
|
+
type: Directive,
|
|
2063
|
+
args: [{
|
|
2064
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
2065
|
+
selector: '[click.stop]',
|
|
2066
|
+
providers: [SubscriptionService],
|
|
2067
|
+
}]
|
|
2068
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SubscriptionService }]; }, propDecorators: { stopPropEvent: [{
|
|
2069
|
+
type: Output,
|
|
2070
|
+
args: ['click.stop']
|
|
2071
|
+
}] } });
|
|
2072
|
+
|
|
2073
|
+
class OAuthConfigurationHandler {
|
|
2074
|
+
constructor(oAuthService, environmentService, options) {
|
|
2075
|
+
this.oAuthService = oAuthService;
|
|
2076
|
+
this.environmentService = environmentService;
|
|
2077
|
+
this.options = options;
|
|
2078
|
+
this.listenToSetEnvironment();
|
|
2079
|
+
}
|
|
2080
|
+
listenToSetEnvironment() {
|
|
2081
|
+
this.environmentService
|
|
2082
|
+
.createOnUpdateStream(state => state)
|
|
2083
|
+
.pipe(map(environment => environment.oAuthConfig), filter(config => !compare(config, this.options.environment.oAuthConfig)))
|
|
2084
|
+
.subscribe(config => {
|
|
2085
|
+
this.oAuthService.configure(config);
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
OAuthConfigurationHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OAuthConfigurationHandler, deps: [{ token: i1$3.OAuthService }, { token: EnvironmentService }, { token: CORE_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2090
|
+
OAuthConfigurationHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OAuthConfigurationHandler, providedIn: 'root' });
|
|
2091
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OAuthConfigurationHandler, decorators: [{
|
|
2092
|
+
type: Injectable,
|
|
2093
|
+
args: [{
|
|
2094
|
+
providedIn: 'root',
|
|
2095
|
+
}]
|
|
2096
|
+
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: EnvironmentService }, { type: undefined, decorators: [{
|
|
2097
|
+
type: Inject,
|
|
2098
|
+
args: [CORE_OPTIONS]
|
|
2099
|
+
}] }]; } });
|
|
2100
|
+
|
|
2101
|
+
class RoutesHandler {
|
|
2102
|
+
constructor(routes, router) {
|
|
2103
|
+
this.routes = routes;
|
|
2104
|
+
this.router = router;
|
|
2105
|
+
this.addRoutes();
|
|
2106
|
+
}
|
|
2107
|
+
addRoutes() {
|
|
2108
|
+
this.router?.config?.forEach(({ path = '', data }) => {
|
|
2109
|
+
if (!data?.routes)
|
|
2110
|
+
return;
|
|
2111
|
+
if (Array.isArray(data.routes)) {
|
|
2112
|
+
this.routes.add(data.routes);
|
|
2113
|
+
return;
|
|
2114
|
+
}
|
|
2115
|
+
const routes = flatRoutes([{ path, ...data.routes }], { path: '' });
|
|
2116
|
+
this.routes.add(routes);
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
RoutesHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesHandler, deps: [{ token: RoutesService }, { token: i1$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2121
|
+
RoutesHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesHandler, providedIn: 'root' });
|
|
2122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RoutesHandler, decorators: [{
|
|
2123
|
+
type: Injectable,
|
|
2124
|
+
args: [{
|
|
2125
|
+
providedIn: 'root',
|
|
2126
|
+
}]
|
|
2127
|
+
}], ctorParameters: function () { return [{ type: RoutesService }, { type: i1$1.Router, decorators: [{
|
|
2128
|
+
type: Optional
|
|
2129
|
+
}] }]; } });
|
|
2130
|
+
function flatRoutes(routes, parent) {
|
|
2131
|
+
if (!routes)
|
|
2132
|
+
return [];
|
|
2133
|
+
return routes.reduce((acc, route) => {
|
|
2134
|
+
const { children, ...current } = {
|
|
2135
|
+
...route,
|
|
2136
|
+
parentName: parent.name,
|
|
2137
|
+
path: (parent.path + '/' + route.path).replace(/\/\//g, '/'),
|
|
2138
|
+
};
|
|
2139
|
+
acc.push(current, ...flatRoutes(children, current));
|
|
2140
|
+
return acc;
|
|
2141
|
+
}, []);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
function getPathName(url) {
|
|
2145
|
+
const { pathname } = new URL(url, window.location.origin);
|
|
2146
|
+
return pathname;
|
|
2147
|
+
}
|
|
2148
|
+
class WebHttpUrlEncodingCodec {
|
|
2149
|
+
encodeKey(k) {
|
|
2150
|
+
return encodeURIComponent(k);
|
|
2151
|
+
}
|
|
2152
|
+
encodeValue(v) {
|
|
2153
|
+
return encodeURIComponent(v);
|
|
2154
|
+
}
|
|
2155
|
+
decodeKey(k) {
|
|
2156
|
+
return decodeURIComponent(k);
|
|
2157
|
+
}
|
|
2158
|
+
decodeValue(v) {
|
|
2159
|
+
return decodeURIComponent(v);
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
const LOADER_DELAY = new InjectionToken('LOADER_DELAY');
|
|
2164
|
+
|
|
2165
|
+
class HttpWaitService {
|
|
2166
|
+
constructor(injector) {
|
|
2167
|
+
this.store = new InternalStore({
|
|
2168
|
+
requests: [],
|
|
2169
|
+
filteredRequests: [],
|
|
2170
|
+
});
|
|
2171
|
+
this.destroy$ = new Subject();
|
|
2172
|
+
this.delay = injector.get(LOADER_DELAY, 500);
|
|
2173
|
+
}
|
|
2174
|
+
getLoading() {
|
|
2175
|
+
return !!this.applyFilter(this.store.state.requests).length;
|
|
2176
|
+
}
|
|
2177
|
+
getLoading$() {
|
|
2178
|
+
return this.store
|
|
2179
|
+
.sliceState(({ requests }) => requests)
|
|
2180
|
+
.pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
|
|
2181
|
+
? this.delay === 0
|
|
2182
|
+
? of(true)
|
|
2183
|
+
: timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
|
|
2184
|
+
: of(false)), tap(() => this.destroy$.next()));
|
|
2185
|
+
}
|
|
2186
|
+
updateLoading$() {
|
|
2187
|
+
return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
|
|
2188
|
+
}
|
|
2189
|
+
clearLoading() {
|
|
2190
|
+
this.store.patch({ requests: [] });
|
|
2191
|
+
}
|
|
2192
|
+
addRequest(request) {
|
|
2193
|
+
this.store.patch({ requests: [...this.store.state.requests, request] });
|
|
2194
|
+
}
|
|
2195
|
+
deleteRequest(request) {
|
|
2196
|
+
const requests = this.store.state.requests.filter(r => r !== request);
|
|
2197
|
+
this.store.patch({ requests });
|
|
2198
|
+
}
|
|
2199
|
+
addFilter(request) {
|
|
2200
|
+
const requests = Array.isArray(request) ? request : [request];
|
|
2201
|
+
const filteredRequests = [
|
|
2202
|
+
...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
|
|
2203
|
+
...requests,
|
|
2204
|
+
];
|
|
2205
|
+
this.store.patch({ filteredRequests });
|
|
2206
|
+
}
|
|
2207
|
+
removeFilter(request) {
|
|
2208
|
+
const requests = Array.isArray(request) ? request : [request];
|
|
2209
|
+
const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
|
|
2210
|
+
this.store.patch({ filteredRequests });
|
|
2211
|
+
}
|
|
2212
|
+
applyFilter(requests) {
|
|
2213
|
+
const { filteredRequests } = this.store.state;
|
|
2214
|
+
return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
|
|
2215
|
+
}
|
|
2216
|
+
isSameRequest(filteredRequest, request) {
|
|
2217
|
+
const { method, endpoint } = filteredRequest;
|
|
2218
|
+
return endpoint === request.endpoint && method === request.method;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
HttpWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2222
|
+
HttpWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpWaitService, providedIn: 'root' });
|
|
2223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: HttpWaitService, decorators: [{
|
|
2224
|
+
type: Injectable,
|
|
2225
|
+
args: [{
|
|
2226
|
+
providedIn: 'root',
|
|
2227
|
+
}]
|
|
2228
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2229
|
+
|
|
2230
|
+
const TENANT_KEY = new InjectionToken('TENANT_KEY');
|
|
2231
|
+
|
|
2232
|
+
class ApiInterceptor {
|
|
2233
|
+
constructor(oAuthService, sessionState, httpWaitService, tenantKey) {
|
|
2234
|
+
this.oAuthService = oAuthService;
|
|
2235
|
+
this.sessionState = sessionState;
|
|
2236
|
+
this.httpWaitService = httpWaitService;
|
|
2237
|
+
this.tenantKey = tenantKey;
|
|
2238
|
+
}
|
|
2239
|
+
intercept(request, next) {
|
|
2240
|
+
this.httpWaitService.addRequest(request);
|
|
2241
|
+
return next
|
|
2242
|
+
.handle(request.clone({
|
|
2243
|
+
setHeaders: this.getAdditionalHeaders(request.headers),
|
|
2244
|
+
}))
|
|
2245
|
+
.pipe(finalize(() => this.httpWaitService.deleteRequest(request)));
|
|
2246
|
+
}
|
|
2247
|
+
getAdditionalHeaders(existingHeaders) {
|
|
2248
|
+
const headers = {};
|
|
2249
|
+
const token = this.oAuthService.getAccessToken();
|
|
2250
|
+
if (!existingHeaders?.has('Authorization') && token) {
|
|
2251
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
2252
|
+
}
|
|
2253
|
+
const lang = this.sessionState.getLanguage();
|
|
2254
|
+
if (!existingHeaders?.has('Accept-Language') && lang) {
|
|
2255
|
+
headers['Accept-Language'] = lang;
|
|
2256
|
+
}
|
|
2257
|
+
const tenant = this.sessionState.getTenant();
|
|
2258
|
+
if (!existingHeaders?.has(this.tenantKey) && tenant?.id) {
|
|
2259
|
+
headers[this.tenantKey] = tenant.id;
|
|
2260
|
+
}
|
|
2261
|
+
return headers;
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
ApiInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ApiInterceptor, deps: [{ token: i1$3.OAuthService }, { token: SessionStateService }, { token: HttpWaitService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2265
|
+
ApiInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ApiInterceptor, providedIn: 'root' });
|
|
2266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ApiInterceptor, decorators: [{
|
|
2267
|
+
type: Injectable,
|
|
2268
|
+
args: [{
|
|
2269
|
+
providedIn: 'root',
|
|
2270
|
+
}]
|
|
2271
|
+
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: SessionStateService }, { type: HttpWaitService }, { type: undefined, decorators: [{
|
|
2272
|
+
type: Inject,
|
|
2273
|
+
args: [TENANT_KEY]
|
|
2274
|
+
}] }]; } });
|
|
2275
|
+
|
|
2276
|
+
class LocalizationPipe {
|
|
2277
|
+
constructor(localization) {
|
|
2278
|
+
this.localization = localization;
|
|
2279
|
+
}
|
|
2280
|
+
transform(value = '', ...interpolateParams) {
|
|
2281
|
+
const params = interpolateParams.reduce((acc, val) => {
|
|
2282
|
+
if (!acc) {
|
|
2283
|
+
return val;
|
|
2284
|
+
}
|
|
2285
|
+
if (!val) {
|
|
2286
|
+
return acc;
|
|
2287
|
+
}
|
|
2288
|
+
return Array.isArray(val) ? [...acc, ...val] : [...acc, val];
|
|
2289
|
+
}, []) || [];
|
|
2290
|
+
return this.localization.instant(value, ...params);
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
LocalizationPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2294
|
+
LocalizationPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationPipe, name: "abpLocalization" });
|
|
2295
|
+
LocalizationPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationPipe });
|
|
2296
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationPipe, decorators: [{
|
|
2297
|
+
type: Injectable
|
|
2298
|
+
}, {
|
|
2299
|
+
type: Pipe,
|
|
2300
|
+
args: [{
|
|
2301
|
+
name: 'abpLocalization',
|
|
2302
|
+
}]
|
|
2303
|
+
}], ctorParameters: function () { return [{ type: LocalizationService }]; } });
|
|
2304
|
+
|
|
2305
|
+
class LocalizationModule {
|
|
2306
|
+
}
|
|
2307
|
+
LocalizationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2308
|
+
LocalizationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationModule, declarations: [LocalizationPipe], exports: [LocalizationPipe] });
|
|
2309
|
+
LocalizationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationModule });
|
|
2310
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
2311
|
+
type: NgModule,
|
|
2312
|
+
args: [{
|
|
2313
|
+
exports: [LocalizationPipe],
|
|
2314
|
+
declarations: [LocalizationPipe],
|
|
2315
|
+
}]
|
|
2316
|
+
}] });
|
|
2317
|
+
|
|
2318
|
+
class SortPipe {
|
|
2319
|
+
transform(value, sortOrder = 'asc', sortKey) {
|
|
2320
|
+
sortOrder = sortOrder && sortOrder.toLowerCase();
|
|
2321
|
+
if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc'))
|
|
2322
|
+
return value;
|
|
2323
|
+
let numberArray = [];
|
|
2324
|
+
let stringArray = [];
|
|
2325
|
+
if (!sortKey) {
|
|
2326
|
+
numberArray = value.filter(item => typeof item === 'number').sort();
|
|
2327
|
+
stringArray = value.filter(item => typeof item === 'string').sort();
|
|
2328
|
+
}
|
|
2329
|
+
else {
|
|
2330
|
+
numberArray = value
|
|
2331
|
+
.filter(item => typeof item[sortKey] === 'number')
|
|
2332
|
+
.sort((a, b) => a[sortKey] - b[sortKey]);
|
|
2333
|
+
stringArray = value
|
|
2334
|
+
.filter(item => typeof item[sortKey] === 'string')
|
|
2335
|
+
.sort((a, b) => {
|
|
2336
|
+
if (a[sortKey] < b[sortKey])
|
|
2337
|
+
return -1;
|
|
2338
|
+
else if (a[sortKey] > b[sortKey])
|
|
2339
|
+
return 1;
|
|
2340
|
+
else
|
|
2341
|
+
return 0;
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
const sorted = [
|
|
2345
|
+
...numberArray,
|
|
2346
|
+
...stringArray,
|
|
2347
|
+
...value.filter(item => typeof (sortKey ? item[sortKey] : item) !== 'number' &&
|
|
2348
|
+
typeof (sortKey ? item[sortKey] : item) !== 'string'),
|
|
2349
|
+
];
|
|
2350
|
+
return sortOrder === 'asc' ? sorted : sorted.reverse();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
SortPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2354
|
+
SortPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SortPipe, name: "abpSort" });
|
|
2355
|
+
SortPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SortPipe });
|
|
2356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SortPipe, decorators: [{
|
|
2357
|
+
type: Injectable
|
|
2358
|
+
}, {
|
|
2359
|
+
type: Pipe,
|
|
2360
|
+
args: [{
|
|
2361
|
+
name: 'abpSort',
|
|
2362
|
+
}]
|
|
2363
|
+
}] });
|
|
2364
|
+
|
|
2365
|
+
const INJECTOR_PIPE_DATA_TOKEN = new InjectionToken('INJECTOR_PIPE_DATA_TOKEN');
|
|
2366
|
+
class ToInjectorPipe {
|
|
2367
|
+
constructor(injector) {
|
|
2368
|
+
this.injector = injector;
|
|
2369
|
+
}
|
|
2370
|
+
transform(value, token = INJECTOR_PIPE_DATA_TOKEN, name = 'ToInjectorPipe') {
|
|
2371
|
+
return Injector.create({
|
|
2372
|
+
providers: [
|
|
2373
|
+
{
|
|
2374
|
+
provide: token,
|
|
2375
|
+
useValue: value,
|
|
2376
|
+
},
|
|
2377
|
+
],
|
|
2378
|
+
parent: this.injector,
|
|
2379
|
+
name,
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
ToInjectorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ToInjectorPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2384
|
+
ToInjectorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ToInjectorPipe, name: "toInjector" });
|
|
2385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ToInjectorPipe, decorators: [{
|
|
2386
|
+
type: Pipe,
|
|
2387
|
+
args: [{
|
|
2388
|
+
name: 'toInjector',
|
|
2389
|
+
}]
|
|
2390
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2391
|
+
|
|
2392
|
+
const COOKIE_LANGUAGE_KEY = new InjectionToken('COOKIE_LANGUAGE_KEY', {
|
|
2393
|
+
factory: () => '.AspNetCore.Culture',
|
|
2394
|
+
});
|
|
2395
|
+
|
|
2396
|
+
function setLanguageToCookie(injector) {
|
|
2397
|
+
return () => {
|
|
2398
|
+
const sessionState = injector.get(SessionStateService);
|
|
2399
|
+
const document = injector.get(DOCUMENT);
|
|
2400
|
+
const cookieLanguageKey = injector.get(COOKIE_LANGUAGE_KEY);
|
|
2401
|
+
sessionState.getLanguage$().subscribe(language => {
|
|
2402
|
+
const cookieValue = encodeURIComponent(`c=${language}|uic=${language}`);
|
|
2403
|
+
document.cookie = `${cookieLanguageKey}=${cookieValue}`;
|
|
2404
|
+
});
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
const CookieLanguageProvider = {
|
|
2408
|
+
provide: APP_INITIALIZER,
|
|
2409
|
+
useFactory: setLanguageToCookie,
|
|
2410
|
+
deps: [Injector],
|
|
2411
|
+
multi: true,
|
|
2412
|
+
};
|
|
2413
|
+
|
|
2414
|
+
class LocaleId extends String {
|
|
2415
|
+
constructor(localizationService) {
|
|
2416
|
+
super();
|
|
2417
|
+
this.localizationService = localizationService;
|
|
2418
|
+
}
|
|
2419
|
+
toString() {
|
|
2420
|
+
const { currentLang } = this.localizationService;
|
|
2421
|
+
return differentLocales[currentLang] || currentLang;
|
|
2422
|
+
}
|
|
2423
|
+
valueOf() {
|
|
2424
|
+
return this.toString();
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
const LocaleProvider = {
|
|
2428
|
+
provide: LOCALE_ID,
|
|
2429
|
+
useClass: LocaleId,
|
|
2430
|
+
deps: [LocalizationService],
|
|
2431
|
+
};
|
|
2432
|
+
|
|
2433
|
+
const cookieKey = 'rememberMe';
|
|
2434
|
+
const storageKey = 'passwordFlow';
|
|
2435
|
+
function pipeToLogin(params, injector) {
|
|
2436
|
+
const configState = injector.get(ConfigStateService);
|
|
2437
|
+
const router = injector.get(Router);
|
|
2438
|
+
return pipe(switchMap(() => configState.refreshAppState()), tap(() => {
|
|
2439
|
+
setRememberMe(params.rememberMe);
|
|
2440
|
+
if (params.redirectUrl)
|
|
2441
|
+
router.navigate([params.redirectUrl]);
|
|
2442
|
+
}));
|
|
2443
|
+
}
|
|
2444
|
+
function setTokenResponseToStorage(injector, tokenRes) {
|
|
2445
|
+
const { access_token, refresh_token, scope: grantedScopes, expires_in } = tokenRes;
|
|
2446
|
+
const storage = injector.get(OAuthStorage);
|
|
2447
|
+
storage.setItem('access_token', access_token);
|
|
2448
|
+
storage.setItem('refresh_token', refresh_token);
|
|
2449
|
+
storage.setItem('access_token_stored_at', '' + Date.now());
|
|
2450
|
+
if (grantedScopes) {
|
|
2451
|
+
storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split(' ')));
|
|
2452
|
+
}
|
|
2453
|
+
if (expires_in) {
|
|
2454
|
+
const expiresInMilliSeconds = expires_in * 1000;
|
|
2455
|
+
const now = new Date();
|
|
2456
|
+
const expiresAt = now.getTime() + expiresInMilliSeconds;
|
|
2457
|
+
storage.setItem('expires_at', '' + expiresAt);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
function setRememberMe(remember) {
|
|
2461
|
+
removeRememberMe();
|
|
2462
|
+
localStorage.setItem(storageKey, 'true');
|
|
2463
|
+
document.cookie = `${cookieKey}=true; path=/${remember ? ' ;expires=Fri, 31 Dec 9999 23:59:59 GMT' : ''}`;
|
|
2464
|
+
}
|
|
2465
|
+
function removeRememberMe() {
|
|
2466
|
+
localStorage.removeItem(storageKey);
|
|
2467
|
+
document.cookie = cookieKey + '= ; path=/; expires = Thu, 01 Jan 1970 00:00:00 GMT';
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
const oAuthStorage = localStorage;
|
|
2471
|
+
class AuthFlowStrategy {
|
|
2472
|
+
constructor(injector) {
|
|
2473
|
+
this.injector = injector;
|
|
2474
|
+
this.catchError = err => {
|
|
2475
|
+
this.httpErrorReporter.reportError(err);
|
|
2476
|
+
return of(null);
|
|
2477
|
+
};
|
|
2478
|
+
this.httpErrorReporter = injector.get(HttpErrorReporterService);
|
|
2479
|
+
this.environment = injector.get(EnvironmentService);
|
|
2480
|
+
this.configState = injector.get(ConfigStateService);
|
|
2481
|
+
this.oAuthService = injector.get(OAuthService);
|
|
2482
|
+
this.sessionState = injector.get(SessionStateService);
|
|
2483
|
+
this.oAuthConfig = this.environment.getEnvironment().oAuthConfig;
|
|
2484
|
+
this.tenantKey = injector.get(TENANT_KEY);
|
|
2485
|
+
this.listenToOauthErrors();
|
|
2486
|
+
}
|
|
2487
|
+
async init() {
|
|
2488
|
+
const shouldClear = shouldStorageClear(this.environment.getEnvironment().oAuthConfig.clientId, oAuthStorage);
|
|
2489
|
+
if (shouldClear)
|
|
2490
|
+
clearOAuthStorage(oAuthStorage);
|
|
2491
|
+
this.oAuthService.configure(this.oAuthConfig);
|
|
2492
|
+
this.oAuthService.events
|
|
2493
|
+
.pipe(filter(event => event.type === 'token_refresh_error'))
|
|
2494
|
+
.subscribe(() => this.navigateToLogin());
|
|
2495
|
+
return this.oAuthService
|
|
2496
|
+
.loadDiscoveryDocument()
|
|
2497
|
+
.then(() => {
|
|
2498
|
+
if (this.oAuthService.hasValidAccessToken() || !this.oAuthService.getRefreshToken()) {
|
|
2499
|
+
return Promise.resolve();
|
|
2500
|
+
}
|
|
2501
|
+
return this.refreshToken();
|
|
2502
|
+
})
|
|
2503
|
+
.catch(this.catchError);
|
|
2504
|
+
}
|
|
2505
|
+
refreshToken() {
|
|
2506
|
+
return this.oAuthService.refreshToken().catch(() => clearOAuthStorage());
|
|
2507
|
+
}
|
|
2508
|
+
listenToOauthErrors() {
|
|
2509
|
+
this.oAuthService.events
|
|
2510
|
+
.pipe(filter(event => event instanceof OAuthErrorEvent), tap(() => clearOAuthStorage()), switchMap(() => this.configState.refreshAppState()))
|
|
2511
|
+
.subscribe();
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
class AuthCodeFlowStrategy extends AuthFlowStrategy {
|
|
2515
|
+
constructor() {
|
|
2516
|
+
super(...arguments);
|
|
2517
|
+
this.isInternalAuth = false;
|
|
2518
|
+
}
|
|
2519
|
+
async init() {
|
|
2520
|
+
return super
|
|
2521
|
+
.init()
|
|
2522
|
+
.then(() => this.oAuthService.tryLogin().catch(noop))
|
|
2523
|
+
.then(() => this.oAuthService.setupAutomaticSilentRefresh({}, 'access_token'));
|
|
2524
|
+
}
|
|
2525
|
+
navigateToLogin(queryParams) {
|
|
2526
|
+
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2527
|
+
}
|
|
2528
|
+
checkIfInternalAuth(queryParams) {
|
|
2529
|
+
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2530
|
+
return false;
|
|
2531
|
+
}
|
|
2532
|
+
logout(queryParams) {
|
|
2533
|
+
return from(this.oAuthService.revokeTokenAndLogout(this.getCultureParams(queryParams)));
|
|
2534
|
+
}
|
|
2535
|
+
login(queryParams) {
|
|
2536
|
+
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2537
|
+
return of(null);
|
|
2538
|
+
}
|
|
2539
|
+
getCultureParams(queryParams) {
|
|
2540
|
+
const lang = this.sessionState.getLanguage();
|
|
2541
|
+
const culture = { culture: lang, 'ui-culture': lang };
|
|
2542
|
+
return { ...(lang && culture), ...queryParams };
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
class AuthPasswordFlowStrategy extends AuthFlowStrategy {
|
|
2546
|
+
constructor() {
|
|
2547
|
+
super(...arguments);
|
|
2548
|
+
this.isInternalAuth = true;
|
|
2549
|
+
this.cookieKey = 'rememberMe';
|
|
2550
|
+
this.storageKey = 'passwordFlow';
|
|
2551
|
+
}
|
|
2552
|
+
listenToTokenExpiration() {
|
|
2553
|
+
this.oAuthService.events
|
|
2554
|
+
.pipe(filter(event => event instanceof OAuthInfoEvent &&
|
|
2555
|
+
event.type === 'token_expires' &&
|
|
2556
|
+
event.info === 'access_token'))
|
|
2557
|
+
.subscribe(() => {
|
|
2558
|
+
if (this.oAuthService.getRefreshToken()) {
|
|
2559
|
+
this.refreshToken();
|
|
2560
|
+
}
|
|
2561
|
+
else {
|
|
2562
|
+
this.oAuthService.logOut();
|
|
2563
|
+
removeRememberMe();
|
|
2564
|
+
this.configState.refreshAppState().subscribe();
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
}
|
|
2568
|
+
async init() {
|
|
2569
|
+
if (!getCookieValueByName(this.cookieKey) && localStorage.getItem(this.storageKey)) {
|
|
2570
|
+
this.oAuthService.logOut();
|
|
2571
|
+
}
|
|
2572
|
+
return super.init().then(() => this.listenToTokenExpiration());
|
|
2573
|
+
}
|
|
2574
|
+
navigateToLogin(queryParams) {
|
|
2575
|
+
const router = this.injector.get(Router);
|
|
2576
|
+
router.navigate(['/account/login'], { queryParams });
|
|
2577
|
+
}
|
|
2578
|
+
checkIfInternalAuth() {
|
|
2579
|
+
return true;
|
|
2580
|
+
}
|
|
2581
|
+
login(params) {
|
|
2582
|
+
const tenant = this.sessionState.getTenant();
|
|
2583
|
+
return from(this.oAuthService.fetchTokenUsingPasswordFlow(params.username, params.password, new HttpHeaders({ ...(tenant && tenant.id && { [this.tenantKey]: tenant.id }) }))).pipe(this.pipeToLogin(params));
|
|
2584
|
+
}
|
|
2585
|
+
pipeToLogin(params) {
|
|
2586
|
+
const router = this.injector.get(Router);
|
|
2587
|
+
return pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
|
|
2588
|
+
setRememberMe(params.rememberMe);
|
|
2589
|
+
if (params.redirectUrl)
|
|
2590
|
+
router.navigate([params.redirectUrl]);
|
|
2591
|
+
}));
|
|
2592
|
+
}
|
|
2593
|
+
logout(queryParams) {
|
|
2594
|
+
const router = this.injector.get(Router);
|
|
2595
|
+
return from(this.oAuthService.revokeTokenAndLogout(queryParams)).pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
|
|
2596
|
+
router.navigateByUrl('/');
|
|
2597
|
+
removeRememberMe();
|
|
2598
|
+
}));
|
|
2599
|
+
}
|
|
2600
|
+
refreshToken() {
|
|
2601
|
+
return this.oAuthService.refreshToken().catch(() => {
|
|
2602
|
+
clearOAuthStorage();
|
|
2603
|
+
removeRememberMe();
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
const AUTH_FLOW_STRATEGY = {
|
|
2608
|
+
Code(injector) {
|
|
2609
|
+
return new AuthCodeFlowStrategy(injector);
|
|
2610
|
+
},
|
|
2611
|
+
Password(injector) {
|
|
2612
|
+
return new AuthPasswordFlowStrategy(injector);
|
|
2613
|
+
},
|
|
2614
|
+
};
|
|
2615
|
+
function clearOAuthStorage(storage = oAuthStorage) {
|
|
2616
|
+
const keys = [
|
|
2617
|
+
'access_token',
|
|
2618
|
+
'id_token',
|
|
2619
|
+
'refresh_token',
|
|
2620
|
+
'nonce',
|
|
2621
|
+
'PKCE_verifier',
|
|
2622
|
+
'expires_at',
|
|
2623
|
+
'id_token_claims_obj',
|
|
2624
|
+
'id_token_expires_at',
|
|
2625
|
+
'id_token_stored_at',
|
|
2626
|
+
'access_token_stored_at',
|
|
2627
|
+
'granted_scopes',
|
|
2628
|
+
'session_state',
|
|
2629
|
+
];
|
|
2630
|
+
keys.forEach(key => storage.removeItem(key));
|
|
2631
|
+
}
|
|
2632
|
+
function shouldStorageClear(clientId, storage) {
|
|
2633
|
+
const key = 'abpOAuthClientId';
|
|
2634
|
+
if (!storage.getItem(key)) {
|
|
2635
|
+
storage.setItem(key, clientId);
|
|
2636
|
+
return false;
|
|
2637
|
+
}
|
|
2638
|
+
const shouldClear = storage.getItem(key) !== clientId;
|
|
2639
|
+
if (shouldClear)
|
|
2640
|
+
storage.setItem(key, clientId);
|
|
2641
|
+
return shouldClear;
|
|
2642
|
+
}
|
|
2643
|
+
function getCookieValueByName(name) {
|
|
2644
|
+
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
2645
|
+
return match ? match[2] : '';
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
Date.prototype.toLocalISOString = function () {
|
|
2649
|
+
const timezoneOffset = this.getTimezoneOffset();
|
|
2650
|
+
return new Date(this.getTime() - timezoneOffset * 60000).toISOString();
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2653
|
+
class AuthService {
|
|
2654
|
+
constructor(injector) {
|
|
2655
|
+
this.injector = injector;
|
|
2656
|
+
}
|
|
2657
|
+
get isInternalAuth() {
|
|
2658
|
+
return this.strategy.isInternalAuth;
|
|
2659
|
+
}
|
|
2660
|
+
async init() {
|
|
2661
|
+
const environmentService = this.injector.get(EnvironmentService);
|
|
2662
|
+
return environmentService
|
|
2663
|
+
.getEnvironment$()
|
|
2664
|
+
.pipe(map(env => env?.oAuthConfig), filter(oAuthConfig => !!oAuthConfig), tap(oAuthConfig => {
|
|
2665
|
+
this.strategy =
|
|
2666
|
+
oAuthConfig.responseType === 'code'
|
|
2667
|
+
? AUTH_FLOW_STRATEGY.Code(this.injector)
|
|
2668
|
+
: AUTH_FLOW_STRATEGY.Password(this.injector);
|
|
2669
|
+
}), switchMap(() => from(this.strategy.init())), take(1))
|
|
2670
|
+
.toPromise();
|
|
2671
|
+
}
|
|
2672
|
+
logout(queryParams) {
|
|
2673
|
+
return this.strategy.logout(queryParams);
|
|
2674
|
+
}
|
|
2675
|
+
navigateToLogin(queryParams) {
|
|
2676
|
+
this.strategy.navigateToLogin(queryParams);
|
|
2677
|
+
}
|
|
2678
|
+
login(params) {
|
|
2679
|
+
return this.strategy.login(params);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2683
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
2684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthService, decorators: [{
|
|
2685
|
+
type: Injectable,
|
|
2686
|
+
args: [{
|
|
2687
|
+
providedIn: 'root',
|
|
2688
|
+
}]
|
|
2689
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2690
|
+
|
|
2691
|
+
const APP_INIT_ERROR_HANDLERS = new InjectionToken('APP_INIT_ERROR_HANDLERS');
|
|
2692
|
+
|
|
2693
|
+
function getRemoteEnv(injector, environment) {
|
|
2694
|
+
const environmentService = injector.get(EnvironmentService);
|
|
2695
|
+
const { remoteEnv } = environment;
|
|
2696
|
+
const { headers = {}, method = 'GET', url } = remoteEnv || {};
|
|
2697
|
+
if (!url)
|
|
2698
|
+
return Promise.resolve();
|
|
2699
|
+
const http = injector.get(HttpClient);
|
|
2700
|
+
const httpErrorReporter = injector.get(HttpErrorReporterService);
|
|
2701
|
+
return http
|
|
2702
|
+
.request(method, url, { headers })
|
|
2703
|
+
.pipe(catchError(err => {
|
|
2704
|
+
httpErrorReporter.reportError(err);
|
|
2705
|
+
return of(null);
|
|
2706
|
+
}), // TODO: Consider get handle function from a provider
|
|
2707
|
+
tap(env => environmentService.setState(mergeEnvironments(environment, env, remoteEnv))))
|
|
2708
|
+
.toPromise();
|
|
2709
|
+
}
|
|
2710
|
+
function mergeEnvironments(local, remote, config) {
|
|
2711
|
+
switch (config.mergeStrategy) {
|
|
2712
|
+
case 'deepmerge':
|
|
2713
|
+
return deepMerge(local, remote);
|
|
2714
|
+
case 'overwrite':
|
|
2715
|
+
case null:
|
|
2716
|
+
case undefined:
|
|
2717
|
+
return remote;
|
|
2718
|
+
default:
|
|
2719
|
+
return config.mergeStrategy(local, remote);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
class AbpTenantService {
|
|
2724
|
+
constructor(restService) {
|
|
2725
|
+
this.restService = restService;
|
|
2726
|
+
this.apiName = 'abp';
|
|
2727
|
+
this.findTenantById = (id, headers) => this.restService.request({
|
|
2728
|
+
method: 'GET',
|
|
2729
|
+
url: `/api/abp/multi-tenancy/tenants/by-id/${id}`,
|
|
2730
|
+
headers,
|
|
2731
|
+
}, { apiName: this.apiName });
|
|
2732
|
+
this.findTenantByName = (name, headers) => this.restService.request({
|
|
2733
|
+
method: 'GET',
|
|
2734
|
+
url: `/api/abp/multi-tenancy/tenants/by-name/${name}`,
|
|
2735
|
+
headers,
|
|
2736
|
+
}, { apiName: this.apiName });
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
AbpTenantService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpTenantService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2740
|
+
AbpTenantService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpTenantService, providedIn: 'root' });
|
|
2741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpTenantService, decorators: [{
|
|
2742
|
+
type: Injectable,
|
|
2743
|
+
args: [{
|
|
2744
|
+
providedIn: 'root',
|
|
2745
|
+
}]
|
|
2746
|
+
}], ctorParameters: function () { return [{ type: RestService }]; } });
|
|
2747
|
+
|
|
2748
|
+
class MultiTenancyService {
|
|
2749
|
+
constructor(restService, sessionState, tenantService, configStateService, tenantKey) {
|
|
2750
|
+
this.restService = restService;
|
|
2751
|
+
this.sessionState = sessionState;
|
|
2752
|
+
this.tenantService = tenantService;
|
|
2753
|
+
this.configStateService = configStateService;
|
|
2754
|
+
this.tenantKey = tenantKey;
|
|
2755
|
+
this.domainTenant = null;
|
|
2756
|
+
this.isTenantBoxVisible = true;
|
|
2757
|
+
this.apiName = 'abp';
|
|
2758
|
+
this.setTenantToState = (tenant) => {
|
|
2759
|
+
this.sessionState.setTenant({ id: tenant.tenantId, name: tenant.name, isAvailable: true });
|
|
2760
|
+
return this.configStateService.refreshAppState().pipe(map(_ => tenant));
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
setTenantByName(tenantName) {
|
|
2764
|
+
return this.tenantService
|
|
2765
|
+
.findTenantByName(tenantName, { [this.tenantKey]: '' })
|
|
2766
|
+
.pipe(switchMap(this.setTenantToState));
|
|
2767
|
+
}
|
|
2768
|
+
setTenantById(tenantId) {
|
|
2769
|
+
return this.tenantService
|
|
2770
|
+
.findTenantById(tenantId, { [this.tenantKey]: '' })
|
|
2771
|
+
.pipe(switchMap(this.setTenantToState));
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
MultiTenancyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MultiTenancyService, deps: [{ token: RestService }, { token: SessionStateService }, { token: AbpTenantService }, { token: ConfigStateService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2775
|
+
MultiTenancyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MultiTenancyService, providedIn: 'root' });
|
|
2776
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MultiTenancyService, decorators: [{
|
|
2777
|
+
type: Injectable,
|
|
2778
|
+
args: [{ providedIn: 'root' }]
|
|
2779
|
+
}], ctorParameters: function () { return [{ type: RestService }, { type: SessionStateService }, { type: AbpTenantService }, { type: ConfigStateService }, { type: undefined, decorators: [{
|
|
2780
|
+
type: Inject,
|
|
2781
|
+
args: [TENANT_KEY]
|
|
2782
|
+
}] }]; } });
|
|
2783
|
+
|
|
2784
|
+
const tenancyPlaceholder = '{0}';
|
|
2785
|
+
function getCurrentTenancyName(appBaseUrl) {
|
|
2786
|
+
if (appBaseUrl.charAt(appBaseUrl.length - 1) !== '/')
|
|
2787
|
+
appBaseUrl += '/';
|
|
2788
|
+
const parseTokens = createTokenParser(appBaseUrl);
|
|
2789
|
+
const token = tenancyPlaceholder.replace(/[}{]/g, '');
|
|
2790
|
+
return parseTokens(window.location.href)[token]?.[0];
|
|
2791
|
+
}
|
|
2792
|
+
function getCurrentTenancyNameFromUrl(tenantKey) {
|
|
2793
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
2794
|
+
return urlParams.get(tenantKey);
|
|
2795
|
+
}
|
|
2796
|
+
async function parseTenantFromUrl(injector) {
|
|
2797
|
+
const environmentService = injector.get(EnvironmentService);
|
|
2798
|
+
const multiTenancyService = injector.get(MultiTenancyService);
|
|
2799
|
+
const baseUrl = environmentService.getEnvironment()?.application?.baseUrl || '';
|
|
2800
|
+
const tenancyName = getCurrentTenancyName(baseUrl);
|
|
2801
|
+
const hideTenantBox = () => {
|
|
2802
|
+
multiTenancyService.isTenantBoxVisible = false;
|
|
2803
|
+
};
|
|
2804
|
+
const setDomainTenant = (tenant) => {
|
|
2805
|
+
multiTenancyService.domainTenant = {
|
|
2806
|
+
id: tenant.tenantId,
|
|
2807
|
+
name: tenant.name,
|
|
2808
|
+
isAvailable: true,
|
|
2809
|
+
};
|
|
2810
|
+
};
|
|
2811
|
+
const setEnvironmentWithDomainTenant = (tenant) => {
|
|
2812
|
+
hideTenantBox();
|
|
2813
|
+
setDomainTenant(tenant);
|
|
2814
|
+
};
|
|
2815
|
+
if (tenancyName) {
|
|
2816
|
+
/**
|
|
2817
|
+
* We have to replace tenant name within the urls from environment,
|
|
2818
|
+
* because the code below will make a http request to find information about the domain tenant.
|
|
2819
|
+
* Before this request takes place, we need to replace placeholders aka "{0}".
|
|
2820
|
+
*/
|
|
2821
|
+
replaceTenantNameWithinEnvironment(injector, tenancyName);
|
|
2822
|
+
return multiTenancyService
|
|
2823
|
+
.setTenantByName(tenancyName)
|
|
2824
|
+
.pipe(tap(setEnvironmentWithDomainTenant))
|
|
2825
|
+
.toPromise();
|
|
2826
|
+
}
|
|
2827
|
+
else {
|
|
2828
|
+
/**
|
|
2829
|
+
* If there is no tenant, we still have to clean up {0}. from baseUrl to avoid incorrect http requests.
|
|
2830
|
+
*/
|
|
2831
|
+
replaceTenantNameWithinEnvironment(injector, '', tenancyPlaceholder + '.');
|
|
2832
|
+
const tenantIdFromQueryParams = getCurrentTenancyNameFromUrl(multiTenancyService.tenantKey);
|
|
2833
|
+
if (tenantIdFromQueryParams) {
|
|
2834
|
+
return multiTenancyService.setTenantById(tenantIdFromQueryParams).toPromise();
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
return Promise.resolve();
|
|
2838
|
+
}
|
|
2839
|
+
function replaceTenantNameWithinEnvironment(injector, tenancyName, placeholder = tenancyPlaceholder) {
|
|
2840
|
+
const environmentService = injector.get(EnvironmentService);
|
|
2841
|
+
const environment = clone(environmentService.getEnvironment());
|
|
2842
|
+
if (environment.application.baseUrl) {
|
|
2843
|
+
environment.application.baseUrl = environment.application.baseUrl.replace(placeholder, tenancyName);
|
|
2844
|
+
}
|
|
2845
|
+
if (environment.oAuthConfig.redirectUri) {
|
|
2846
|
+
environment.oAuthConfig.redirectUri = environment.oAuthConfig.redirectUri.replace(placeholder, tenancyName);
|
|
2847
|
+
}
|
|
2848
|
+
environment.oAuthConfig.issuer = environment.oAuthConfig.issuer.replace(placeholder, tenancyName);
|
|
2849
|
+
Object.keys(environment.apis).forEach(api => {
|
|
2850
|
+
Object.keys(environment.apis[api]).forEach(key => {
|
|
2851
|
+
environment.apis[api][key] = environment.apis[api][key].replace(placeholder, tenancyName);
|
|
2852
|
+
});
|
|
2853
|
+
});
|
|
2854
|
+
return environmentService.setState(environment);
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
function getInitialData(injector) {
|
|
2858
|
+
const fn = async () => {
|
|
2859
|
+
const environmentService = injector.get(EnvironmentService);
|
|
2860
|
+
const configState = injector.get(ConfigStateService);
|
|
2861
|
+
const options = injector.get(CORE_OPTIONS);
|
|
2862
|
+
environmentService.setState(options.environment);
|
|
2863
|
+
await getRemoteEnv(injector, options.environment);
|
|
2864
|
+
await parseTenantFromUrl(injector);
|
|
2865
|
+
await injector.get(AuthService).init();
|
|
2866
|
+
if (options.skipGetAppConfiguration)
|
|
2867
|
+
return;
|
|
2868
|
+
return configState
|
|
2869
|
+
.refreshAppState()
|
|
2870
|
+
.pipe(tap(() => checkAccessToken(injector)), tap(() => {
|
|
2871
|
+
const currentTenant = configState.getOne('currentTenant');
|
|
2872
|
+
injector.get(SessionStateService).setTenant(currentTenant);
|
|
2873
|
+
}), catchError(error => {
|
|
2874
|
+
const appInitErrorHandlers = injector.get(APP_INIT_ERROR_HANDLERS, null);
|
|
2875
|
+
if (appInitErrorHandlers && appInitErrorHandlers.length) {
|
|
2876
|
+
appInitErrorHandlers.forEach(func => func(error));
|
|
2877
|
+
}
|
|
2878
|
+
return throwError(error);
|
|
2879
|
+
}))
|
|
2880
|
+
.toPromise();
|
|
2881
|
+
};
|
|
2882
|
+
return fn;
|
|
2883
|
+
}
|
|
2884
|
+
function checkAccessToken(injector) {
|
|
2885
|
+
const configState = injector.get(ConfigStateService);
|
|
2886
|
+
const oAuth = injector.get(OAuthService);
|
|
2887
|
+
if (oAuth.hasValidAccessToken() && !configState.getDeep('currentUser.id')) {
|
|
2888
|
+
clearOAuthStorage();
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
function localeInitializer(injector) {
|
|
2892
|
+
const fn = () => {
|
|
2893
|
+
const sessionState = injector.get(SessionStateService);
|
|
2894
|
+
const { registerLocaleFn } = injector.get(CORE_OPTIONS);
|
|
2895
|
+
const lang = sessionState.getLanguage() || 'en';
|
|
2896
|
+
return new Promise((resolve, reject) => {
|
|
2897
|
+
registerLocaleFn(lang).then(module => {
|
|
2898
|
+
if (module?.default)
|
|
2899
|
+
registerLocaleData(module.default);
|
|
2900
|
+
return resolve('resolved');
|
|
2901
|
+
}, reject);
|
|
2902
|
+
});
|
|
2903
|
+
};
|
|
2904
|
+
return fn;
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
function storageFactory() {
|
|
2908
|
+
return oAuthStorage;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* BaseCoreModule is the module that holds
|
|
2912
|
+
* all imports, declarations, exports, and entryComponents
|
|
2913
|
+
* but not the providers.
|
|
2914
|
+
* This module will be imported and exported by all others.
|
|
2915
|
+
*/
|
|
2916
|
+
class BaseCoreModule {
|
|
2917
|
+
}
|
|
2918
|
+
BaseCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2919
|
+
BaseCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseCoreModule, declarations: [AbstractNgModelComponent,
|
|
2920
|
+
AutofocusDirective,
|
|
2921
|
+
DynamicLayoutComponent,
|
|
2922
|
+
ForDirective,
|
|
2923
|
+
FormSubmitDirective,
|
|
2924
|
+
InitDirective,
|
|
2925
|
+
InputEventDebounceDirective,
|
|
2926
|
+
PermissionDirective,
|
|
2927
|
+
ReplaceableRouteContainerComponent,
|
|
2928
|
+
ReplaceableTemplateDirective,
|
|
2929
|
+
RouterOutletComponent,
|
|
2930
|
+
SortPipe,
|
|
2931
|
+
StopPropagationDirective,
|
|
2932
|
+
ToInjectorPipe], imports: [OAuthModule,
|
|
2933
|
+
CommonModule,
|
|
2934
|
+
HttpClientModule,
|
|
2935
|
+
FormsModule,
|
|
2936
|
+
ReactiveFormsModule,
|
|
2937
|
+
RouterModule,
|
|
2938
|
+
LocalizationModule], exports: [CommonModule,
|
|
2939
|
+
HttpClientModule,
|
|
2940
|
+
FormsModule,
|
|
2941
|
+
ReactiveFormsModule,
|
|
2942
|
+
RouterModule,
|
|
2943
|
+
LocalizationModule,
|
|
2944
|
+
AbstractNgModelComponent,
|
|
2945
|
+
AutofocusDirective,
|
|
2946
|
+
DynamicLayoutComponent,
|
|
2947
|
+
ForDirective,
|
|
2948
|
+
FormSubmitDirective,
|
|
2949
|
+
InitDirective,
|
|
2950
|
+
InputEventDebounceDirective,
|
|
2951
|
+
PermissionDirective,
|
|
2952
|
+
ReplaceableRouteContainerComponent,
|
|
2953
|
+
ReplaceableTemplateDirective,
|
|
2954
|
+
RouterOutletComponent,
|
|
2955
|
+
SortPipe,
|
|
2956
|
+
StopPropagationDirective,
|
|
2957
|
+
ToInjectorPipe] });
|
|
2958
|
+
BaseCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseCoreModule, providers: [LocalizationPipe], imports: [[
|
|
2959
|
+
OAuthModule,
|
|
2960
|
+
CommonModule,
|
|
2961
|
+
HttpClientModule,
|
|
2962
|
+
FormsModule,
|
|
2963
|
+
ReactiveFormsModule,
|
|
2964
|
+
RouterModule,
|
|
2965
|
+
LocalizationModule,
|
|
2966
|
+
], CommonModule,
|
|
2967
|
+
HttpClientModule,
|
|
2968
|
+
FormsModule,
|
|
2969
|
+
ReactiveFormsModule,
|
|
2970
|
+
RouterModule,
|
|
2971
|
+
LocalizationModule] });
|
|
2972
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseCoreModule, decorators: [{
|
|
2973
|
+
type: NgModule,
|
|
2974
|
+
args: [{
|
|
2975
|
+
exports: [
|
|
2976
|
+
CommonModule,
|
|
2977
|
+
HttpClientModule,
|
|
2978
|
+
FormsModule,
|
|
2979
|
+
ReactiveFormsModule,
|
|
2980
|
+
RouterModule,
|
|
2981
|
+
LocalizationModule,
|
|
2982
|
+
AbstractNgModelComponent,
|
|
2983
|
+
AutofocusDirective,
|
|
2984
|
+
DynamicLayoutComponent,
|
|
2985
|
+
ForDirective,
|
|
2986
|
+
FormSubmitDirective,
|
|
2987
|
+
InitDirective,
|
|
2988
|
+
InputEventDebounceDirective,
|
|
2989
|
+
PermissionDirective,
|
|
2990
|
+
ReplaceableRouteContainerComponent,
|
|
2991
|
+
ReplaceableTemplateDirective,
|
|
2992
|
+
RouterOutletComponent,
|
|
2993
|
+
SortPipe,
|
|
2994
|
+
StopPropagationDirective,
|
|
2995
|
+
ToInjectorPipe,
|
|
2996
|
+
],
|
|
2997
|
+
imports: [
|
|
2998
|
+
OAuthModule,
|
|
2999
|
+
CommonModule,
|
|
3000
|
+
HttpClientModule,
|
|
3001
|
+
FormsModule,
|
|
3002
|
+
ReactiveFormsModule,
|
|
3003
|
+
RouterModule,
|
|
3004
|
+
LocalizationModule,
|
|
3005
|
+
],
|
|
3006
|
+
declarations: [
|
|
3007
|
+
AbstractNgModelComponent,
|
|
3008
|
+
AutofocusDirective,
|
|
3009
|
+
DynamicLayoutComponent,
|
|
3010
|
+
ForDirective,
|
|
3011
|
+
FormSubmitDirective,
|
|
3012
|
+
InitDirective,
|
|
3013
|
+
InputEventDebounceDirective,
|
|
3014
|
+
PermissionDirective,
|
|
3015
|
+
ReplaceableRouteContainerComponent,
|
|
3016
|
+
ReplaceableTemplateDirective,
|
|
3017
|
+
RouterOutletComponent,
|
|
3018
|
+
SortPipe,
|
|
3019
|
+
StopPropagationDirective,
|
|
3020
|
+
ToInjectorPipe,
|
|
3021
|
+
],
|
|
3022
|
+
providers: [LocalizationPipe]
|
|
3023
|
+
}]
|
|
3024
|
+
}] });
|
|
3025
|
+
/**
|
|
3026
|
+
* RootCoreModule is the module that will be used at root level
|
|
3027
|
+
* and it introduces imports useful at root level (e.g. NGXS)
|
|
3028
|
+
*/
|
|
3029
|
+
class RootCoreModule {
|
|
3030
|
+
}
|
|
3031
|
+
RootCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RootCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3032
|
+
RootCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule, LocalizationModule, i1$3.OAuthModule, i1.HttpClientXsrfModule], exports: [BaseCoreModule, LocalizationModule] });
|
|
3033
|
+
RootCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RootCoreModule, imports: [[
|
|
3034
|
+
BaseCoreModule,
|
|
3035
|
+
LocalizationModule,
|
|
3036
|
+
OAuthModule.forRoot(),
|
|
3037
|
+
HttpClientXsrfModule.withOptions({
|
|
3038
|
+
cookieName: 'XSRF-TOKEN',
|
|
3039
|
+
headerName: 'RequestVerificationToken',
|
|
3040
|
+
}),
|
|
3041
|
+
], BaseCoreModule, LocalizationModule] });
|
|
3042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RootCoreModule, decorators: [{
|
|
3043
|
+
type: NgModule,
|
|
3044
|
+
args: [{
|
|
3045
|
+
exports: [BaseCoreModule, LocalizationModule],
|
|
3046
|
+
imports: [
|
|
3047
|
+
BaseCoreModule,
|
|
3048
|
+
LocalizationModule,
|
|
3049
|
+
OAuthModule.forRoot(),
|
|
3050
|
+
HttpClientXsrfModule.withOptions({
|
|
3051
|
+
cookieName: 'XSRF-TOKEN',
|
|
3052
|
+
headerName: 'RequestVerificationToken',
|
|
3053
|
+
}),
|
|
3054
|
+
],
|
|
3055
|
+
}]
|
|
3056
|
+
}] });
|
|
3057
|
+
/**
|
|
3058
|
+
* CoreModule is the module that is publicly available
|
|
3059
|
+
*/
|
|
3060
|
+
class CoreModule {
|
|
3061
|
+
static forRoot(options = {}) {
|
|
3062
|
+
return {
|
|
3063
|
+
ngModule: RootCoreModule,
|
|
3064
|
+
providers: [
|
|
3065
|
+
LocaleProvider,
|
|
3066
|
+
CookieLanguageProvider,
|
|
3067
|
+
{
|
|
3068
|
+
provide: 'CORE_OPTIONS',
|
|
3069
|
+
useValue: options,
|
|
3070
|
+
},
|
|
3071
|
+
{
|
|
3072
|
+
provide: CORE_OPTIONS,
|
|
3073
|
+
useFactory: coreOptionsFactory,
|
|
3074
|
+
deps: ['CORE_OPTIONS'],
|
|
3075
|
+
},
|
|
3076
|
+
{
|
|
3077
|
+
provide: HTTP_INTERCEPTORS,
|
|
3078
|
+
useExisting: ApiInterceptor,
|
|
3079
|
+
multi: true,
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
provide: APP_INITIALIZER,
|
|
3083
|
+
multi: true,
|
|
3084
|
+
deps: [OAuthConfigurationHandler],
|
|
3085
|
+
useFactory: noop,
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
provide: APP_INITIALIZER,
|
|
3089
|
+
multi: true,
|
|
3090
|
+
deps: [Injector],
|
|
3091
|
+
useFactory: getInitialData,
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
provide: APP_INITIALIZER,
|
|
3095
|
+
multi: true,
|
|
3096
|
+
deps: [Injector],
|
|
3097
|
+
useFactory: localeInitializer,
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
provide: APP_INITIALIZER,
|
|
3101
|
+
multi: true,
|
|
3102
|
+
deps: [LocalizationService],
|
|
3103
|
+
useFactory: noop,
|
|
3104
|
+
},
|
|
3105
|
+
{
|
|
3106
|
+
provide: APP_INITIALIZER,
|
|
3107
|
+
multi: true,
|
|
3108
|
+
deps: [RoutesHandler],
|
|
3109
|
+
useFactory: noop,
|
|
3110
|
+
},
|
|
3111
|
+
{ provide: OAuthStorage, useFactory: storageFactory },
|
|
3112
|
+
{ provide: TENANT_KEY, useValue: options.tenantKey || '__tenant' },
|
|
3113
|
+
{
|
|
3114
|
+
provide: LOCALIZATIONS,
|
|
3115
|
+
multi: true,
|
|
3116
|
+
useValue: localizationContributor(options.localizations),
|
|
3117
|
+
deps: [LocalizationService],
|
|
3118
|
+
},
|
|
3119
|
+
],
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
|
+
static forChild(options = {}) {
|
|
3123
|
+
return {
|
|
3124
|
+
ngModule: RootCoreModule,
|
|
3125
|
+
providers: [
|
|
3126
|
+
{
|
|
3127
|
+
provide: LOCALIZATIONS,
|
|
3128
|
+
multi: true,
|
|
3129
|
+
useValue: localizationContributor(options.localizations),
|
|
3130
|
+
deps: [LocalizationService],
|
|
3131
|
+
},
|
|
3132
|
+
],
|
|
3133
|
+
};
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
CoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3137
|
+
CoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CoreModule, imports: [BaseCoreModule], exports: [BaseCoreModule] });
|
|
3138
|
+
CoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CoreModule, imports: [[BaseCoreModule], BaseCoreModule] });
|
|
3139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CoreModule, decorators: [{
|
|
3140
|
+
type: NgModule,
|
|
3141
|
+
args: [{
|
|
3142
|
+
exports: [BaseCoreModule],
|
|
3143
|
+
imports: [BaseCoreModule],
|
|
3144
|
+
}]
|
|
3145
|
+
}] });
|
|
3146
|
+
function ngxsStoragePluginSerialize(data) {
|
|
3147
|
+
return data;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
class AuthGuard {
|
|
3151
|
+
constructor(oauthService, authService) {
|
|
3152
|
+
this.oauthService = oauthService;
|
|
3153
|
+
this.authService = authService;
|
|
3154
|
+
}
|
|
3155
|
+
canActivate() {
|
|
3156
|
+
const hasValidAccessToken = this.oauthService.hasValidAccessToken();
|
|
3157
|
+
if (hasValidAccessToken) {
|
|
3158
|
+
return true;
|
|
3159
|
+
}
|
|
3160
|
+
this.authService.navigateToLogin();
|
|
3161
|
+
return false;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthGuard, deps: [{ token: i1$3.OAuthService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3165
|
+
AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthGuard, providedIn: 'root' });
|
|
3166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AuthGuard, decorators: [{
|
|
3167
|
+
type: Injectable,
|
|
3168
|
+
args: [{
|
|
3169
|
+
providedIn: 'root',
|
|
3170
|
+
}]
|
|
3171
|
+
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: AuthService }]; } });
|
|
3172
|
+
|
|
3173
|
+
class PermissionGuard {
|
|
3174
|
+
constructor(router, routesService, permissionService, httpErrorReporter) {
|
|
3175
|
+
this.router = router;
|
|
3176
|
+
this.routesService = routesService;
|
|
3177
|
+
this.permissionService = permissionService;
|
|
3178
|
+
this.httpErrorReporter = httpErrorReporter;
|
|
3179
|
+
}
|
|
3180
|
+
canActivate(route, state) {
|
|
3181
|
+
let { requiredPolicy } = route.data || {};
|
|
3182
|
+
if (!requiredPolicy) {
|
|
3183
|
+
const routeFound = findRoute(this.routesService, getRoutePath(this.router, state.url));
|
|
3184
|
+
requiredPolicy = routeFound?.requiredPolicy;
|
|
3185
|
+
}
|
|
3186
|
+
if (!requiredPolicy)
|
|
3187
|
+
return of(true);
|
|
3188
|
+
return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe(tap(access => {
|
|
3189
|
+
if (!access) {
|
|
3190
|
+
this.httpErrorReporter.reportError({ status: 403 });
|
|
3191
|
+
}
|
|
3192
|
+
}));
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
PermissionGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionGuard, deps: [{ token: i1$1.Router }, { token: RoutesService }, { token: PermissionService }, { token: HttpErrorReporterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3196
|
+
PermissionGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionGuard, providedIn: 'root' });
|
|
3197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PermissionGuard, decorators: [{
|
|
3198
|
+
type: Injectable,
|
|
3199
|
+
args: [{
|
|
3200
|
+
providedIn: 'root',
|
|
3201
|
+
}]
|
|
3202
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: RoutesService }, { type: PermissionService }, { type: HttpErrorReporterService }]; } });
|
|
3203
|
+
|
|
3204
|
+
class ListResultDto {
|
|
3205
|
+
constructor(initialValues = {}) {
|
|
3206
|
+
for (const key in initialValues) {
|
|
3207
|
+
if (Object.prototype.hasOwnProperty.call(initialValues, key)) {
|
|
3208
|
+
this[key] = initialValues[key];
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
class PagedResultDto extends ListResultDto {
|
|
3214
|
+
constructor(initialValues = {}) {
|
|
3215
|
+
super(initialValues);
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
class LimitedResultRequestDto {
|
|
3219
|
+
constructor(initialValues = {}) {
|
|
3220
|
+
this.maxResultCount = 10;
|
|
3221
|
+
for (const key in initialValues) {
|
|
3222
|
+
if (Object.prototype.hasOwnProperty.call(initialValues, key) &&
|
|
3223
|
+
initialValues[key] !== undefined) {
|
|
3224
|
+
this[key] = initialValues[key];
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
class PagedResultRequestDto extends LimitedResultRequestDto {
|
|
3230
|
+
constructor(initialValues = {}) {
|
|
3231
|
+
super(initialValues);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
class PagedAndSortedResultRequestDto extends PagedResultRequestDto {
|
|
3235
|
+
constructor(initialValues = {}) {
|
|
3236
|
+
super(initialValues);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
class EntityDto {
|
|
3240
|
+
constructor(initialValues = {}) {
|
|
3241
|
+
for (const key in initialValues) {
|
|
3242
|
+
if (Object.prototype.hasOwnProperty.call(initialValues, key)) {
|
|
3243
|
+
this[key] = initialValues[key];
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
class CreationAuditedEntityDto extends EntityDto {
|
|
3249
|
+
constructor(initialValues = {}) {
|
|
3250
|
+
super(initialValues);
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
class CreationAuditedEntityWithUserDto extends CreationAuditedEntityDto {
|
|
3254
|
+
constructor(initialValues = {}) {
|
|
3255
|
+
super(initialValues);
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
class AuditedEntityDto extends CreationAuditedEntityDto {
|
|
3259
|
+
constructor(initialValues = {}) {
|
|
3260
|
+
super(initialValues);
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
class AuditedEntityWithUserDto extends AuditedEntityDto {
|
|
3264
|
+
constructor(initialValues = {}) {
|
|
3265
|
+
super(initialValues);
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
class FullAuditedEntityDto extends AuditedEntityDto {
|
|
3269
|
+
constructor(initialValues = {}) {
|
|
3270
|
+
super(initialValues);
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
class FullAuditedEntityWithUserDto extends FullAuditedEntityDto {
|
|
3274
|
+
constructor(initialValues = {}) {
|
|
3275
|
+
super(initialValues);
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
class ExtensibleObject {
|
|
3279
|
+
constructor(initialValues = {}) {
|
|
3280
|
+
for (const key in initialValues) {
|
|
3281
|
+
if (Object.prototype.hasOwnProperty.call(initialValues, key)) {
|
|
3282
|
+
this[key] = initialValues[key];
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
class ExtensibleEntityDto extends ExtensibleObject {
|
|
3288
|
+
constructor(initialValues = {}) {
|
|
3289
|
+
super(initialValues);
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
class ExtensibleCreationAuditedEntityDto extends ExtensibleEntityDto {
|
|
3293
|
+
constructor(initialValues = {}) {
|
|
3294
|
+
super(initialValues);
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
class ExtensibleAuditedEntityDto extends ExtensibleCreationAuditedEntityDto {
|
|
3298
|
+
constructor(initialValues = {}) {
|
|
3299
|
+
super(initialValues);
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
class ExtensibleAuditedEntityWithUserDto extends ExtensibleAuditedEntityDto {
|
|
3303
|
+
constructor(initialValues = {}) {
|
|
3304
|
+
super(initialValues);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
class ExtensibleCreationAuditedEntityWithUserDto extends ExtensibleCreationAuditedEntityDto {
|
|
3308
|
+
constructor(initialValues = {}) {
|
|
3309
|
+
super(initialValues);
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
class ExtensibleFullAuditedEntityDto extends ExtensibleAuditedEntityDto {
|
|
3313
|
+
constructor(initialValues = {}) {
|
|
3314
|
+
super(initialValues);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
class ExtensibleFullAuditedEntityWithUserDto extends ExtensibleFullAuditedEntityDto {
|
|
3318
|
+
constructor(initialValues = {}) {
|
|
3319
|
+
super(initialValues);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
class AbpApiDefinitionService {
|
|
3324
|
+
constructor(restService) {
|
|
3325
|
+
this.restService = restService;
|
|
3326
|
+
this.apiName = 'abp';
|
|
3327
|
+
this.getByModel = (model) => this.restService.request({
|
|
3328
|
+
method: 'GET',
|
|
3329
|
+
url: '/api/abp/api-definition',
|
|
3330
|
+
params: { includeTypes: model.includeTypes },
|
|
3331
|
+
}, { apiName: this.apiName });
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
AbpApiDefinitionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApiDefinitionService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3335
|
+
AbpApiDefinitionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApiDefinitionService, providedIn: 'root' });
|
|
3336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AbpApiDefinitionService, decorators: [{
|
|
3337
|
+
type: Injectable,
|
|
3338
|
+
args: [{
|
|
3339
|
+
providedIn: 'root',
|
|
3340
|
+
}]
|
|
3341
|
+
}], ctorParameters: function () { return [{ type: RestService }]; } });
|
|
3342
|
+
|
|
3343
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3344
|
+
|
|
3345
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
3346
|
+
__proto__: null
|
|
3347
|
+
});
|
|
3348
|
+
|
|
3349
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3350
|
+
|
|
3351
|
+
class ContentProjectionService {
|
|
3352
|
+
constructor(injector) {
|
|
3353
|
+
this.injector = injector;
|
|
3354
|
+
}
|
|
3355
|
+
projectContent(projectionStrategy, injector = this.injector) {
|
|
3356
|
+
return projectionStrategy.injectContent(injector);
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
ContentProjectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContentProjectionService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3360
|
+
ContentProjectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContentProjectionService, providedIn: 'root' });
|
|
3361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContentProjectionService, decorators: [{
|
|
3362
|
+
type: Injectable,
|
|
3363
|
+
args: [{ providedIn: 'root' }]
|
|
3364
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
3365
|
+
|
|
3366
|
+
function getShortDateFormat(configStateService) {
|
|
3367
|
+
const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
|
|
3368
|
+
return dateTimeFormat.shortDatePattern;
|
|
3369
|
+
}
|
|
3370
|
+
function getShortTimeFormat(configStateService) {
|
|
3371
|
+
const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
|
|
3372
|
+
return dateTimeFormat.shortTimePattern.replace('tt', 'a');
|
|
3373
|
+
}
|
|
3374
|
+
function getShortDateShortTimeFormat(configStateService) {
|
|
3375
|
+
const dateTimeFormat = configStateService.getDeep('localization.currentCulture.dateTimeFormat');
|
|
3376
|
+
return `${dateTimeFormat.shortDatePattern} ${dateTimeFormat.shortTimePattern.replace('tt', 'a')}`;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
class LazyModuleFactory extends NgModuleFactory {
|
|
3380
|
+
constructor(moduleWithProviders) {
|
|
3381
|
+
super();
|
|
3382
|
+
this.moduleWithProviders = moduleWithProviders;
|
|
3383
|
+
}
|
|
3384
|
+
get moduleType() {
|
|
3385
|
+
return this.moduleWithProviders.ngModule;
|
|
3386
|
+
}
|
|
3387
|
+
create(parentInjector) {
|
|
3388
|
+
const injector = Injector.create({
|
|
3389
|
+
parent: parentInjector,
|
|
3390
|
+
providers: this.moduleWithProviders.providers,
|
|
3391
|
+
});
|
|
3392
|
+
const compiler = injector.get(Compiler);
|
|
3393
|
+
const factory = compiler.compileModuleSync(this.moduleType);
|
|
3394
|
+
return factory.create(injector);
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
function featuresFactory(configState, featureKeys, mapFn = features => features) {
|
|
3398
|
+
return configState.getFeatures$(featureKeys).pipe(filter(Boolean), map(mapFn));
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
function downloadBlob(blob, filename) {
|
|
3402
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
3403
|
+
const link = document.createElement('a');
|
|
3404
|
+
link.href = blobUrl;
|
|
3405
|
+
link.download = filename;
|
|
3406
|
+
document.body.appendChild(link);
|
|
3407
|
+
link.dispatchEvent(new MouseEvent('click', {
|
|
3408
|
+
bubbles: true,
|
|
3409
|
+
cancelable: true,
|
|
3410
|
+
view: window,
|
|
3411
|
+
}));
|
|
3412
|
+
document.body.removeChild(link);
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
function isNumber(value) {
|
|
3416
|
+
return value == Number(value);
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
function mapEnumToOptions(_enum) {
|
|
3420
|
+
const options = [];
|
|
3421
|
+
for (const member in _enum)
|
|
3422
|
+
if (!isNumber(member))
|
|
3423
|
+
options.push({
|
|
3424
|
+
key: member,
|
|
3425
|
+
value: _enum[member],
|
|
3426
|
+
});
|
|
3427
|
+
return options;
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
function uuid(a) {
|
|
3431
|
+
return a
|
|
3432
|
+
? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
|
|
3433
|
+
: ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
|
|
3434
|
+
}
|
|
3435
|
+
function generateHash(value) {
|
|
3436
|
+
let hashed = 0;
|
|
3437
|
+
let charCode;
|
|
3438
|
+
for (let i = 0; i < value.length; i++) {
|
|
3439
|
+
charCode = value.charCodeAt(i);
|
|
3440
|
+
hashed = (hashed << 5) - hashed + charCode;
|
|
3441
|
+
hashed |= 0;
|
|
3442
|
+
}
|
|
3443
|
+
return hashed;
|
|
3444
|
+
}
|
|
3445
|
+
function generatePassword(length = 8) {
|
|
3446
|
+
length = Math.min(Math.max(4, length), 128);
|
|
3447
|
+
const lowers = 'abcdefghijklmnopqrstuvwxyz';
|
|
3448
|
+
const uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
3449
|
+
const numbers = '0123456789';
|
|
3450
|
+
const specials = '!@#$%&*()_+{}<>?[]./';
|
|
3451
|
+
const all = lowers + uppers + numbers + specials;
|
|
3452
|
+
const getRandom = (chrSet) => chrSet[Math.floor(Math.random() * chrSet.length)];
|
|
3453
|
+
const password = Array({ length });
|
|
3454
|
+
password[0] = getRandom(lowers);
|
|
3455
|
+
password[1] = getRandom(uppers);
|
|
3456
|
+
password[2] = getRandom(numbers);
|
|
3457
|
+
password[3] = getRandom(specials);
|
|
3458
|
+
for (let i = 4; i < length; i++) {
|
|
3459
|
+
password[i] = getRandom(all);
|
|
3460
|
+
}
|
|
3461
|
+
return password.sort(() => 0.5 - Math.random()).join('');
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3464
|
+
class CrossOriginStrategy {
|
|
3465
|
+
constructor(crossorigin, integrity) {
|
|
3466
|
+
this.crossorigin = crossorigin;
|
|
3467
|
+
this.integrity = integrity;
|
|
3468
|
+
}
|
|
3469
|
+
setCrossOrigin(element) {
|
|
3470
|
+
if (this.integrity)
|
|
3471
|
+
element.setAttribute('integrity', this.integrity);
|
|
3472
|
+
element.setAttribute('crossorigin', this.crossorigin);
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
class NoCrossOriginStrategy extends CrossOriginStrategy {
|
|
3476
|
+
setCrossOrigin() { }
|
|
3477
|
+
}
|
|
3478
|
+
const CROSS_ORIGIN_STRATEGY = {
|
|
3479
|
+
Anonymous(integrity) {
|
|
3480
|
+
return new CrossOriginStrategy('anonymous', integrity);
|
|
3481
|
+
},
|
|
3482
|
+
UseCredentials(integrity) {
|
|
3483
|
+
return new CrossOriginStrategy('use-credentials', integrity);
|
|
3484
|
+
},
|
|
3485
|
+
None() {
|
|
3486
|
+
return new NoCrossOriginStrategy(null);
|
|
3487
|
+
},
|
|
3488
|
+
};
|
|
3489
|
+
|
|
3490
|
+
class DomStrategy {
|
|
3491
|
+
constructor(target = document.head, position = 'beforeend') {
|
|
3492
|
+
this.target = target;
|
|
3493
|
+
this.position = position;
|
|
3494
|
+
}
|
|
3495
|
+
insertElement(element) {
|
|
3496
|
+
this.target.insertAdjacentElement(this.position, element);
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
const DOM_STRATEGY = {
|
|
3500
|
+
AfterElement(element) {
|
|
3501
|
+
return new DomStrategy(element, 'afterend');
|
|
3502
|
+
},
|
|
3503
|
+
AppendToBody() {
|
|
3504
|
+
return new DomStrategy(document.body, 'beforeend');
|
|
3505
|
+
},
|
|
3506
|
+
AppendToHead() {
|
|
3507
|
+
return new DomStrategy(document.head, 'beforeend');
|
|
3508
|
+
},
|
|
3509
|
+
BeforeElement(element) {
|
|
3510
|
+
return new DomStrategy(element, 'beforebegin');
|
|
3511
|
+
},
|
|
3512
|
+
PrependToHead() {
|
|
3513
|
+
return new DomStrategy(document.head, 'afterbegin');
|
|
3514
|
+
},
|
|
3515
|
+
};
|
|
3516
|
+
|
|
3517
|
+
function fromLazyLoad(element, domStrategy = DOM_STRATEGY.AppendToHead(), crossOriginStrategy = CROSS_ORIGIN_STRATEGY.Anonymous()) {
|
|
3518
|
+
crossOriginStrategy.setCrossOrigin(element);
|
|
3519
|
+
domStrategy.insertElement(element);
|
|
3520
|
+
return new Observable((observer) => {
|
|
3521
|
+
element.onload = (event) => {
|
|
3522
|
+
clearCallbacks(element);
|
|
3523
|
+
observer.next(event);
|
|
3524
|
+
observer.complete();
|
|
3525
|
+
};
|
|
3526
|
+
const handleError = createErrorHandler(observer, element);
|
|
3527
|
+
element.onerror = handleError;
|
|
3528
|
+
element.onabort = handleError;
|
|
3529
|
+
element.onemptied = handleError;
|
|
3530
|
+
element.onstalled = handleError;
|
|
3531
|
+
element.onsuspend = handleError;
|
|
3532
|
+
return () => {
|
|
3533
|
+
clearCallbacks(element);
|
|
3534
|
+
observer.complete();
|
|
3535
|
+
};
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3538
|
+
function createErrorHandler(observer, element) {
|
|
3539
|
+
return function (event) {
|
|
3540
|
+
clearCallbacks(element);
|
|
3541
|
+
element.parentNode.removeChild(element);
|
|
3542
|
+
observer.error(event);
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
function clearCallbacks(element) {
|
|
3546
|
+
element.onload = null;
|
|
3547
|
+
element.onerror = null;
|
|
3548
|
+
element.onabort = null;
|
|
3549
|
+
element.onemptied = null;
|
|
3550
|
+
element.onstalled = null;
|
|
3551
|
+
element.onsuspend = null;
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
class DomInsertionService {
|
|
3555
|
+
constructor() {
|
|
3556
|
+
this.inserted = new Set();
|
|
3557
|
+
}
|
|
3558
|
+
insertContent(contentStrategy) {
|
|
3559
|
+
const hash = generateHash(contentStrategy.content);
|
|
3560
|
+
if (this.inserted.has(hash))
|
|
3561
|
+
return;
|
|
3562
|
+
const element = contentStrategy.insertElement();
|
|
3563
|
+
this.inserted.add(hash);
|
|
3564
|
+
return element;
|
|
3565
|
+
}
|
|
3566
|
+
removeContent(element) {
|
|
3567
|
+
const hash = generateHash(element.textContent);
|
|
3568
|
+
this.inserted.delete(hash);
|
|
3569
|
+
element.parentNode.removeChild(element);
|
|
3570
|
+
}
|
|
3571
|
+
has(content) {
|
|
3572
|
+
const hash = generateHash(content);
|
|
3573
|
+
return this.inserted.has(hash);
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
DomInsertionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DomInsertionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3577
|
+
DomInsertionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DomInsertionService, providedIn: 'root' });
|
|
3578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DomInsertionService, decorators: [{
|
|
3579
|
+
type: Injectable,
|
|
3580
|
+
args: [{ providedIn: 'root' }]
|
|
3581
|
+
}] });
|
|
3582
|
+
|
|
3583
|
+
class ResourceWaitService {
|
|
3584
|
+
constructor() {
|
|
3585
|
+
this.store = new InternalStore({ resources: new Set() });
|
|
3586
|
+
}
|
|
3587
|
+
getLoading() {
|
|
3588
|
+
return !!this.store.state.resources.size;
|
|
3589
|
+
}
|
|
3590
|
+
getLoading$() {
|
|
3591
|
+
return this.store.sliceState(({ resources }) => !!resources.size);
|
|
3592
|
+
}
|
|
3593
|
+
updateLoading$() {
|
|
3594
|
+
return this.store.sliceUpdate(({ resources }) => !!resources.size);
|
|
3595
|
+
}
|
|
3596
|
+
clearLoading() {
|
|
3597
|
+
this.store.patch({ resources: new Set() });
|
|
3598
|
+
}
|
|
3599
|
+
addResource(resource) {
|
|
3600
|
+
const resources = this.store.state.resources;
|
|
3601
|
+
resources.add(resource);
|
|
3602
|
+
this.store.patch({ resources });
|
|
3603
|
+
}
|
|
3604
|
+
deleteResource(resource) {
|
|
3605
|
+
const resources = this.store.state.resources;
|
|
3606
|
+
resources.delete(resource);
|
|
3607
|
+
this.store.patch({ resources });
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
ResourceWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ResourceWaitService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3611
|
+
ResourceWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ResourceWaitService, providedIn: 'root' });
|
|
3612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ResourceWaitService, decorators: [{
|
|
3613
|
+
type: Injectable,
|
|
3614
|
+
args: [{
|
|
3615
|
+
providedIn: 'root',
|
|
3616
|
+
}]
|
|
3617
|
+
}] });
|
|
3618
|
+
|
|
3619
|
+
class LazyLoadService {
|
|
3620
|
+
constructor(resourceWaitService) {
|
|
3621
|
+
this.resourceWaitService = resourceWaitService;
|
|
3622
|
+
this.loaded = new Map();
|
|
3623
|
+
}
|
|
3624
|
+
load(strategy, retryTimes, retryDelay) {
|
|
3625
|
+
if (this.loaded.has(strategy.path))
|
|
3626
|
+
return of(new CustomEvent('load'));
|
|
3627
|
+
this.resourceWaitService.addResource(strategy.path);
|
|
3628
|
+
return strategy.createStream().pipe(retryWhen(error$ => concat(error$.pipe(delay(retryDelay), take(retryTimes)), throwError(new CustomEvent('error')))), tap(() => {
|
|
3629
|
+
this.loaded.set(strategy.path, strategy.element);
|
|
3630
|
+
this.resourceWaitService.deleteResource(strategy.path);
|
|
3631
|
+
}), delay(100), shareReplay({ bufferSize: 1, refCount: true }));
|
|
3632
|
+
}
|
|
3633
|
+
remove(path) {
|
|
3634
|
+
const element = this.loaded.get(path);
|
|
3635
|
+
if (!element)
|
|
3636
|
+
return false;
|
|
3637
|
+
element.parentNode.removeChild(element);
|
|
3638
|
+
this.loaded.delete(path);
|
|
3639
|
+
return true;
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
LazyLoadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LazyLoadService, deps: [{ token: ResourceWaitService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3643
|
+
LazyLoadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LazyLoadService, providedIn: 'root' });
|
|
3644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LazyLoadService, decorators: [{
|
|
3645
|
+
type: Injectable,
|
|
3646
|
+
args: [{
|
|
3647
|
+
providedIn: 'root',
|
|
3648
|
+
}]
|
|
3649
|
+
}], ctorParameters: function () { return [{ type: ResourceWaitService }]; } });
|
|
3650
|
+
|
|
3651
|
+
const LIST_QUERY_DEBOUNCE_TIME = new InjectionToken('LIST_QUERY_DEBOUNCE_TIME');
|
|
3652
|
+
|
|
3653
|
+
class ListService {
|
|
3654
|
+
constructor(injector) {
|
|
3655
|
+
this._filter = '';
|
|
3656
|
+
this._maxResultCount = 10;
|
|
3657
|
+
this._skipCount = 0;
|
|
3658
|
+
this._page = 0;
|
|
3659
|
+
this._sortKey = '';
|
|
3660
|
+
this._sortOrder = '';
|
|
3661
|
+
this._query$ = new ReplaySubject(1);
|
|
3662
|
+
this._isLoading$ = new BehaviorSubject(false);
|
|
3663
|
+
this.destroy$ = new Subject();
|
|
3664
|
+
this.get = () => {
|
|
3665
|
+
this.resetPageWhenUnchanged();
|
|
3666
|
+
this.next();
|
|
3667
|
+
};
|
|
3668
|
+
this.getWithoutPageReset = () => {
|
|
3669
|
+
this.next();
|
|
3670
|
+
};
|
|
3671
|
+
const delay = injector.get(LIST_QUERY_DEBOUNCE_TIME, 300);
|
|
3672
|
+
this.delay = delay ? debounceTime(delay) : tap();
|
|
3673
|
+
this.get();
|
|
3674
|
+
}
|
|
3675
|
+
set filter(value) {
|
|
3676
|
+
this._filter = value;
|
|
3677
|
+
this.get();
|
|
3678
|
+
}
|
|
3679
|
+
get filter() {
|
|
3680
|
+
return this._filter;
|
|
3681
|
+
}
|
|
3682
|
+
set maxResultCount(value) {
|
|
3683
|
+
this._maxResultCount = value;
|
|
3684
|
+
this.get();
|
|
3685
|
+
}
|
|
3686
|
+
get maxResultCount() {
|
|
3687
|
+
return this._maxResultCount;
|
|
3688
|
+
}
|
|
3689
|
+
set page(value) {
|
|
3690
|
+
if (value === this._page)
|
|
3691
|
+
return;
|
|
3692
|
+
this._page = value;
|
|
3693
|
+
this.get();
|
|
3694
|
+
}
|
|
3695
|
+
get page() {
|
|
3696
|
+
return this._page;
|
|
3697
|
+
}
|
|
3698
|
+
set sortKey(value) {
|
|
3699
|
+
this._sortKey = value;
|
|
3700
|
+
this.get();
|
|
3701
|
+
}
|
|
3702
|
+
get sortKey() {
|
|
3703
|
+
return this._sortKey;
|
|
3704
|
+
}
|
|
3705
|
+
set sortOrder(value) {
|
|
3706
|
+
this._sortOrder = value;
|
|
3707
|
+
this.get();
|
|
3708
|
+
}
|
|
3709
|
+
get sortOrder() {
|
|
3710
|
+
return this._sortOrder;
|
|
3711
|
+
}
|
|
3712
|
+
get query$() {
|
|
3713
|
+
return this._query$
|
|
3714
|
+
.asObservable()
|
|
3715
|
+
.pipe(this.delay, shareReplay({ bufferSize: 1, refCount: true }));
|
|
3716
|
+
}
|
|
3717
|
+
get isLoading$() {
|
|
3718
|
+
return this._isLoading$.asObservable();
|
|
3719
|
+
}
|
|
3720
|
+
hookToQuery(streamCreatorCallback) {
|
|
3721
|
+
this._isLoading$.next(true);
|
|
3722
|
+
return this.query$.pipe(switchMap(query => streamCreatorCallback(query).pipe(catchError(() => of(null)))), filter(Boolean), tap(() => this._isLoading$.next(false)), shareReplay({ bufferSize: 1, refCount: true }), takeUntil(this.destroy$));
|
|
3723
|
+
}
|
|
3724
|
+
ngOnDestroy() {
|
|
3725
|
+
this.destroy$.next();
|
|
3726
|
+
}
|
|
3727
|
+
resetPageWhenUnchanged() {
|
|
3728
|
+
const skipCount = this._page * this._maxResultCount;
|
|
3729
|
+
if (skipCount === this._skipCount) {
|
|
3730
|
+
this._page = 0;
|
|
3731
|
+
this._skipCount = 0;
|
|
3732
|
+
}
|
|
3733
|
+
else
|
|
3734
|
+
this._skipCount = skipCount;
|
|
3735
|
+
}
|
|
3736
|
+
next() {
|
|
3737
|
+
this._query$.next({
|
|
3738
|
+
filter: this._filter || undefined,
|
|
3739
|
+
maxResultCount: this._maxResultCount,
|
|
3740
|
+
skipCount: this._page * this._maxResultCount,
|
|
3741
|
+
sorting: this._sortOrder ? `${this._sortKey} ${this._sortOrder}` : undefined,
|
|
3742
|
+
});
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
ListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ListService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3746
|
+
ListService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ListService });
|
|
3747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ListService, decorators: [{
|
|
3748
|
+
type: Injectable
|
|
3749
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
3750
|
+
|
|
3751
|
+
class RouterWaitService {
|
|
3752
|
+
constructor(routerEvents, injector) {
|
|
3753
|
+
this.routerEvents = routerEvents;
|
|
3754
|
+
this.store = new InternalStore({ loading: false });
|
|
3755
|
+
this.destroy$ = new Subject();
|
|
3756
|
+
this.delay = injector.get(LOADER_DELAY, 500);
|
|
3757
|
+
this.updateLoadingStatusOnNavigationEvents();
|
|
3758
|
+
}
|
|
3759
|
+
updateLoadingStatusOnNavigationEvents() {
|
|
3760
|
+
this.routerEvents
|
|
3761
|
+
.getAllNavigationEvents()
|
|
3762
|
+
.pipe(map(event => event instanceof NavigationStart), switchMap(condition => condition
|
|
3763
|
+
? this.delay === 0
|
|
3764
|
+
? of(true)
|
|
3765
|
+
: timer(this.delay || 0).pipe(mapTo(true), takeUntil(this.destroy$))
|
|
3766
|
+
: of(false)), tap(() => this.destroy$.next()))
|
|
3767
|
+
.subscribe(status => {
|
|
3768
|
+
this.setLoading(status);
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
getLoading() {
|
|
3772
|
+
return this.store.state.loading;
|
|
3773
|
+
}
|
|
3774
|
+
getLoading$() {
|
|
3775
|
+
return this.store.sliceState(({ loading }) => loading);
|
|
3776
|
+
}
|
|
3777
|
+
updateLoading$() {
|
|
3778
|
+
return this.store.sliceUpdate(({ loading }) => loading);
|
|
3779
|
+
}
|
|
3780
|
+
setLoading(loading) {
|
|
3781
|
+
this.store.patch({ loading });
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
RouterWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterWaitService, deps: [{ token: RouterEvents }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3785
|
+
RouterWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterWaitService, providedIn: 'root' });
|
|
3786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RouterWaitService, decorators: [{
|
|
3787
|
+
type: Injectable,
|
|
3788
|
+
args: [{
|
|
3789
|
+
providedIn: 'root',
|
|
3790
|
+
}]
|
|
3791
|
+
}], ctorParameters: function () { return [{ type: RouterEvents }, { type: i0.Injector }]; } });
|
|
3792
|
+
|
|
3793
|
+
const trackBy = (key) => (_, item) => item[key];
|
|
3794
|
+
const trackByDeep = (
|
|
3795
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3796
|
+
...keys) => (_, item) => keys.reduce((acc, key) => acc[key], item);
|
|
3797
|
+
class TrackByService {
|
|
3798
|
+
constructor() {
|
|
3799
|
+
this.by = trackBy;
|
|
3800
|
+
this.byDeep = trackByDeep;
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
TrackByService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TrackByService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3804
|
+
TrackByService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TrackByService, providedIn: 'root' });
|
|
3805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TrackByService, decorators: [{
|
|
3806
|
+
type: Injectable,
|
|
3807
|
+
args: [{
|
|
3808
|
+
providedIn: 'root',
|
|
3809
|
+
}]
|
|
3810
|
+
}] });
|
|
3811
|
+
|
|
3812
|
+
class ContainerStrategy {
|
|
3813
|
+
constructor(containerRef) {
|
|
3814
|
+
this.containerRef = containerRef;
|
|
3815
|
+
}
|
|
3816
|
+
prepare() { }
|
|
3817
|
+
}
|
|
3818
|
+
class ClearContainerStrategy extends ContainerStrategy {
|
|
3819
|
+
getIndex() {
|
|
3820
|
+
return 0;
|
|
3821
|
+
}
|
|
3822
|
+
prepare() {
|
|
3823
|
+
this.containerRef.clear();
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
class InsertIntoContainerStrategy extends ContainerStrategy {
|
|
3827
|
+
constructor(containerRef, index) {
|
|
3828
|
+
super(containerRef);
|
|
3829
|
+
this.index = index;
|
|
3830
|
+
}
|
|
3831
|
+
getIndex() {
|
|
3832
|
+
return Math.min(Math.max(0, this.index), this.containerRef.length);
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
const CONTAINER_STRATEGY = {
|
|
3836
|
+
Clear(containerRef) {
|
|
3837
|
+
return new ClearContainerStrategy(containerRef);
|
|
3838
|
+
},
|
|
3839
|
+
Append(containerRef) {
|
|
3840
|
+
return new InsertIntoContainerStrategy(containerRef, containerRef.length);
|
|
3841
|
+
},
|
|
3842
|
+
Prepend(containerRef) {
|
|
3843
|
+
return new InsertIntoContainerStrategy(containerRef, 0);
|
|
3844
|
+
},
|
|
3845
|
+
Insert(containerRef, index) {
|
|
3846
|
+
return new InsertIntoContainerStrategy(containerRef, index);
|
|
3847
|
+
},
|
|
3848
|
+
};
|
|
3849
|
+
|
|
3850
|
+
class ContentSecurityStrategy {
|
|
3851
|
+
constructor(nonce) {
|
|
3852
|
+
this.nonce = nonce;
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
class LooseContentSecurityStrategy extends ContentSecurityStrategy {
|
|
3856
|
+
constructor(nonce) {
|
|
3857
|
+
super(nonce);
|
|
3858
|
+
}
|
|
3859
|
+
applyCSP(element) {
|
|
3860
|
+
element.setAttribute('nonce', this.nonce);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
class NoContentSecurityStrategy extends ContentSecurityStrategy {
|
|
3864
|
+
constructor() {
|
|
3865
|
+
super();
|
|
3866
|
+
}
|
|
3867
|
+
applyCSP(_) { }
|
|
3868
|
+
}
|
|
3869
|
+
const CONTENT_SECURITY_STRATEGY = {
|
|
3870
|
+
Loose(nonce) {
|
|
3871
|
+
return new LooseContentSecurityStrategy(nonce);
|
|
3872
|
+
},
|
|
3873
|
+
None() {
|
|
3874
|
+
return new NoContentSecurityStrategy();
|
|
3875
|
+
},
|
|
3876
|
+
};
|
|
3877
|
+
|
|
3878
|
+
class ContentStrategy {
|
|
3879
|
+
constructor(content, domStrategy = DOM_STRATEGY.AppendToHead(), contentSecurityStrategy = CONTENT_SECURITY_STRATEGY.None(), options = {}) {
|
|
3880
|
+
this.content = content;
|
|
3881
|
+
this.domStrategy = domStrategy;
|
|
3882
|
+
this.contentSecurityStrategy = contentSecurityStrategy;
|
|
3883
|
+
this.options = options;
|
|
3884
|
+
}
|
|
3885
|
+
insertElement() {
|
|
3886
|
+
const element = this.createElement();
|
|
3887
|
+
if (this.options && Object.keys(this.options).length > 0) {
|
|
3888
|
+
Object.keys(this.options).forEach(key => (element[key] = this.options[key]));
|
|
3889
|
+
}
|
|
3890
|
+
this.contentSecurityStrategy.applyCSP(element);
|
|
3891
|
+
this.domStrategy.insertElement(element);
|
|
3892
|
+
return element;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
class StyleContentStrategy extends ContentStrategy {
|
|
3896
|
+
createElement() {
|
|
3897
|
+
const element = document.createElement('style');
|
|
3898
|
+
element.textContent = this.content;
|
|
3899
|
+
return element;
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
class ScriptContentStrategy extends ContentStrategy {
|
|
3903
|
+
createElement() {
|
|
3904
|
+
const element = document.createElement('script');
|
|
3905
|
+
element.textContent = this.content;
|
|
3906
|
+
return element;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
const CONTENT_STRATEGY = {
|
|
3910
|
+
AppendScriptToBody(content, options) {
|
|
3911
|
+
return new ScriptContentStrategy(content, DOM_STRATEGY.AppendToBody(), undefined, options);
|
|
3912
|
+
},
|
|
3913
|
+
AppendScriptToHead(content, options) {
|
|
3914
|
+
return new ScriptContentStrategy(content, DOM_STRATEGY.AppendToHead(), undefined, options);
|
|
3915
|
+
},
|
|
3916
|
+
AppendStyleToHead(content, options) {
|
|
3917
|
+
return new StyleContentStrategy(content, DOM_STRATEGY.AppendToHead(), undefined, options);
|
|
3918
|
+
},
|
|
3919
|
+
PrependStyleToHead(content, options) {
|
|
3920
|
+
return new StyleContentStrategy(content, DOM_STRATEGY.PrependToHead(), undefined, options);
|
|
3921
|
+
},
|
|
3922
|
+
};
|
|
3923
|
+
|
|
3924
|
+
class ContextStrategy {
|
|
3925
|
+
constructor(context) {
|
|
3926
|
+
this.context = context;
|
|
3927
|
+
}
|
|
3928
|
+
setContext(componentRef) {
|
|
3929
|
+
return this.context;
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
class NoContextStrategy extends ContextStrategy {
|
|
3933
|
+
constructor() {
|
|
3934
|
+
super(undefined);
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
class ComponentContextStrategy extends ContextStrategy {
|
|
3938
|
+
setContext(componentRef) {
|
|
3939
|
+
Object.keys(this.context).forEach(key => (componentRef.instance[key] = this.context[key]));
|
|
3940
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
3941
|
+
return this.context;
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
class TemplateContextStrategy extends ContextStrategy {
|
|
3945
|
+
setContext() {
|
|
3946
|
+
return this.context;
|
|
3947
|
+
}
|
|
3948
|
+
}
|
|
3949
|
+
const CONTEXT_STRATEGY = {
|
|
3950
|
+
None() {
|
|
3951
|
+
return new NoContextStrategy();
|
|
3952
|
+
},
|
|
3953
|
+
Component(context) {
|
|
3954
|
+
return new ComponentContextStrategy(context);
|
|
3955
|
+
},
|
|
3956
|
+
Template(context) {
|
|
3957
|
+
return new TemplateContextStrategy(context);
|
|
3958
|
+
},
|
|
3959
|
+
};
|
|
3960
|
+
|
|
3961
|
+
class LoadingStrategy {
|
|
3962
|
+
constructor(path, domStrategy = DOM_STRATEGY.AppendToHead(), crossOriginStrategy = CROSS_ORIGIN_STRATEGY.Anonymous()) {
|
|
3963
|
+
this.path = path;
|
|
3964
|
+
this.domStrategy = domStrategy;
|
|
3965
|
+
this.crossOriginStrategy = crossOriginStrategy;
|
|
3966
|
+
}
|
|
3967
|
+
createStream() {
|
|
3968
|
+
this.element = this.createElement();
|
|
3969
|
+
return of(null).pipe(switchMap(() => fromLazyLoad(this.element, this.domStrategy, this.crossOriginStrategy)));
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
class ScriptLoadingStrategy extends LoadingStrategy {
|
|
3973
|
+
constructor(src, domStrategy, crossOriginStrategy) {
|
|
3974
|
+
super(src, domStrategy, crossOriginStrategy);
|
|
3975
|
+
}
|
|
3976
|
+
createElement() {
|
|
3977
|
+
const element = document.createElement('script');
|
|
3978
|
+
element.src = this.path;
|
|
3979
|
+
return element;
|
|
3980
|
+
}
|
|
3981
|
+
}
|
|
3982
|
+
class StyleLoadingStrategy extends LoadingStrategy {
|
|
3983
|
+
constructor(href, domStrategy, crossOriginStrategy) {
|
|
3984
|
+
super(href, domStrategy, crossOriginStrategy);
|
|
3985
|
+
}
|
|
3986
|
+
createElement() {
|
|
3987
|
+
const element = document.createElement('link');
|
|
3988
|
+
element.rel = 'stylesheet';
|
|
3989
|
+
element.href = this.path;
|
|
3990
|
+
return element;
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
const LOADING_STRATEGY = {
|
|
3994
|
+
AppendScriptToBody(src) {
|
|
3995
|
+
return new ScriptLoadingStrategy(src, DOM_STRATEGY.AppendToBody(), CROSS_ORIGIN_STRATEGY.None());
|
|
3996
|
+
},
|
|
3997
|
+
AppendAnonymousScriptToBody(src, integrity) {
|
|
3998
|
+
return new ScriptLoadingStrategy(src, DOM_STRATEGY.AppendToBody(), CROSS_ORIGIN_STRATEGY.Anonymous(integrity));
|
|
3999
|
+
},
|
|
4000
|
+
AppendAnonymousScriptToHead(src, integrity) {
|
|
4001
|
+
return new ScriptLoadingStrategy(src, DOM_STRATEGY.AppendToHead(), CROSS_ORIGIN_STRATEGY.Anonymous(integrity));
|
|
4002
|
+
},
|
|
4003
|
+
AppendAnonymousStyleToHead(src, integrity) {
|
|
4004
|
+
return new StyleLoadingStrategy(src, DOM_STRATEGY.AppendToHead(), CROSS_ORIGIN_STRATEGY.Anonymous(integrity));
|
|
4005
|
+
},
|
|
4006
|
+
PrependAnonymousScriptToHead(src, integrity) {
|
|
4007
|
+
return new ScriptLoadingStrategy(src, DOM_STRATEGY.PrependToHead(), CROSS_ORIGIN_STRATEGY.Anonymous(integrity));
|
|
4008
|
+
},
|
|
4009
|
+
PrependAnonymousStyleToHead(src, integrity) {
|
|
4010
|
+
return new StyleLoadingStrategy(src, DOM_STRATEGY.PrependToHead(), CROSS_ORIGIN_STRATEGY.Anonymous(integrity));
|
|
4011
|
+
},
|
|
4012
|
+
};
|
|
4013
|
+
|
|
4014
|
+
class ProjectionStrategy {
|
|
4015
|
+
constructor(content) {
|
|
4016
|
+
this.content = content;
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
class ComponentProjectionStrategy extends ProjectionStrategy {
|
|
4020
|
+
constructor(component, containerStrategy, contextStrategy = CONTEXT_STRATEGY.None()) {
|
|
4021
|
+
super(component);
|
|
4022
|
+
this.containerStrategy = containerStrategy;
|
|
4023
|
+
this.contextStrategy = contextStrategy;
|
|
4024
|
+
}
|
|
4025
|
+
injectContent(injector) {
|
|
4026
|
+
this.containerStrategy.prepare();
|
|
4027
|
+
const resolver = injector.get(ComponentFactoryResolver);
|
|
4028
|
+
const factory = resolver.resolveComponentFactory(this.content);
|
|
4029
|
+
const componentRef = this.containerStrategy.containerRef.createComponent(factory, this.containerStrategy.getIndex(), injector);
|
|
4030
|
+
this.contextStrategy.setContext(componentRef);
|
|
4031
|
+
return componentRef;
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
class RootComponentProjectionStrategy extends ProjectionStrategy {
|
|
4035
|
+
constructor(component, contextStrategy = CONTEXT_STRATEGY.None(), domStrategy = DOM_STRATEGY.AppendToBody()) {
|
|
4036
|
+
super(component);
|
|
4037
|
+
this.contextStrategy = contextStrategy;
|
|
4038
|
+
this.domStrategy = domStrategy;
|
|
4039
|
+
}
|
|
4040
|
+
injectContent(injector) {
|
|
4041
|
+
const appRef = injector.get(ApplicationRef);
|
|
4042
|
+
const resolver = injector.get(ComponentFactoryResolver);
|
|
4043
|
+
const componentRef = resolver
|
|
4044
|
+
.resolveComponentFactory(this.content)
|
|
4045
|
+
.create(injector);
|
|
4046
|
+
this.contextStrategy.setContext(componentRef);
|
|
4047
|
+
appRef.attachView(componentRef.hostView);
|
|
4048
|
+
const element = componentRef.hostView.rootNodes[0];
|
|
4049
|
+
this.domStrategy.insertElement(element);
|
|
4050
|
+
return componentRef;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
class TemplateProjectionStrategy extends ProjectionStrategy {
|
|
4054
|
+
constructor(templateRef, containerStrategy, contextStrategy = CONTEXT_STRATEGY.None()) {
|
|
4055
|
+
super(templateRef);
|
|
4056
|
+
this.containerStrategy = containerStrategy;
|
|
4057
|
+
this.contextStrategy = contextStrategy;
|
|
4058
|
+
}
|
|
4059
|
+
injectContent() {
|
|
4060
|
+
this.containerStrategy.prepare();
|
|
4061
|
+
const embeddedViewRef = this.containerStrategy.containerRef.createEmbeddedView(this.content, this.contextStrategy.context, this.containerStrategy.getIndex());
|
|
4062
|
+
embeddedViewRef.detectChanges();
|
|
4063
|
+
return embeddedViewRef;
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
const PROJECTION_STRATEGY = {
|
|
4067
|
+
AppendComponentToBody(component, context) {
|
|
4068
|
+
return new RootComponentProjectionStrategy(component, context && CONTEXT_STRATEGY.Component(context));
|
|
4069
|
+
},
|
|
4070
|
+
AppendComponentToContainer(component, containerRef, context) {
|
|
4071
|
+
return new ComponentProjectionStrategy(component, CONTAINER_STRATEGY.Append(containerRef), context && CONTEXT_STRATEGY.Component(context));
|
|
4072
|
+
},
|
|
4073
|
+
AppendTemplateToContainer(templateRef, containerRef, context) {
|
|
4074
|
+
return new TemplateProjectionStrategy(templateRef, CONTAINER_STRATEGY.Append(containerRef), context && CONTEXT_STRATEGY.Template(context));
|
|
4075
|
+
},
|
|
4076
|
+
PrependComponentToContainer(component, containerRef, context) {
|
|
4077
|
+
return new ComponentProjectionStrategy(component, CONTAINER_STRATEGY.Prepend(containerRef), context && CONTEXT_STRATEGY.Component(context));
|
|
4078
|
+
},
|
|
4079
|
+
PrependTemplateToContainer(templateRef, containerRef, context) {
|
|
4080
|
+
return new TemplateProjectionStrategy(templateRef, CONTAINER_STRATEGY.Prepend(containerRef), context && CONTEXT_STRATEGY.Template(context));
|
|
4081
|
+
},
|
|
4082
|
+
ProjectComponentToContainer(component, containerRef, context) {
|
|
4083
|
+
return new ComponentProjectionStrategy(component, CONTAINER_STRATEGY.Clear(containerRef), context && CONTEXT_STRATEGY.Component(context));
|
|
4084
|
+
},
|
|
4085
|
+
ProjectTemplateToContainer(templateRef, containerRef, context) {
|
|
4086
|
+
return new TemplateProjectionStrategy(templateRef, CONTAINER_STRATEGY.Clear(containerRef), context && CONTEXT_STRATEGY.Template(context));
|
|
4087
|
+
},
|
|
4088
|
+
};
|
|
4089
|
+
|
|
4090
|
+
const NAVIGATE_TO_MANAGE_PROFILE = new InjectionToken('NAVIGATE_TO_MANAGE_PROFILE', {
|
|
4091
|
+
providedIn: 'root',
|
|
4092
|
+
factory: () => {
|
|
4093
|
+
const environment = inject(EnvironmentService);
|
|
4094
|
+
return () => {
|
|
4095
|
+
window.open(`${environment.getEnvironment().oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`, '_self');
|
|
4096
|
+
};
|
|
4097
|
+
},
|
|
4098
|
+
});
|
|
4099
|
+
|
|
4100
|
+
function validateMinAge({ age = 18 } = {}) {
|
|
4101
|
+
return (control) => {
|
|
4102
|
+
if (['', null, undefined].indexOf(control.value) > -1)
|
|
4103
|
+
return null;
|
|
4104
|
+
return isValidMinAge(control.value, age) ? null : { minAge: { age } };
|
|
4105
|
+
};
|
|
4106
|
+
}
|
|
4107
|
+
function isValidMinAge(value, minAge) {
|
|
4108
|
+
const date = new Date();
|
|
4109
|
+
date.setFullYear(date.getFullYear() - minAge);
|
|
4110
|
+
date.setHours(23, 59, 59, 999);
|
|
4111
|
+
return Number(new Date(value)) <= date.valueOf();
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
function validateCreditCard() {
|
|
4115
|
+
return (control) => {
|
|
4116
|
+
if (['', null, undefined].indexOf(control.value) > -1)
|
|
4117
|
+
return null;
|
|
4118
|
+
return isValidCreditCard(String(control.value)) ? null : { creditCard: true };
|
|
4119
|
+
};
|
|
4120
|
+
}
|
|
4121
|
+
function isValidCreditCard(value) {
|
|
4122
|
+
value = value.replace(/[ -]/g, '');
|
|
4123
|
+
if (!/^[0-9]{13,19}$/.test(value))
|
|
4124
|
+
return false;
|
|
4125
|
+
let checksum = 0;
|
|
4126
|
+
let multiplier = 1;
|
|
4127
|
+
for (let i = value.length; i > 0; i--) {
|
|
4128
|
+
const digit = Number(value[i - 1]) * multiplier;
|
|
4129
|
+
checksum += (digit % 10) + ~~(digit / 10);
|
|
4130
|
+
multiplier = (multiplier * 2) % 3;
|
|
4131
|
+
}
|
|
4132
|
+
return checksum % 10 === 0;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
function validateRange({ maximum = Infinity, minimum = 0 } = {}) {
|
|
4136
|
+
return (control) => {
|
|
4137
|
+
if (['', null, undefined].indexOf(control.value) > -1)
|
|
4138
|
+
return null;
|
|
4139
|
+
const value = Number(control.value);
|
|
4140
|
+
return getMinError(value, minimum, maximum) || getMaxError(value, maximum, minimum);
|
|
4141
|
+
};
|
|
4142
|
+
}
|
|
4143
|
+
function getMaxError(value, max, min) {
|
|
4144
|
+
return value > max ? { range: { max, min } } : null;
|
|
4145
|
+
}
|
|
4146
|
+
function getMinError(value, min, max) {
|
|
4147
|
+
return value < min ? { range: { min, max } } : null;
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4150
|
+
function validateRequired({ allowEmptyStrings } = {}) {
|
|
4151
|
+
return (control) => {
|
|
4152
|
+
return isValidRequired(control.value, allowEmptyStrings) ? null : { required: true };
|
|
4153
|
+
};
|
|
4154
|
+
}
|
|
4155
|
+
function isValidRequired(value, allowEmptyStrings) {
|
|
4156
|
+
if (value || value === 0 || value === false)
|
|
4157
|
+
return true;
|
|
4158
|
+
if (allowEmptyStrings && value === '')
|
|
4159
|
+
return true;
|
|
4160
|
+
return false;
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
function validateStringLength({ maximumLength = Infinity, minimumLength = 0, } = {}) {
|
|
4164
|
+
return (control) => {
|
|
4165
|
+
if (['', null, undefined].indexOf(control.value) > -1)
|
|
4166
|
+
return null;
|
|
4167
|
+
const value = String(control.value);
|
|
4168
|
+
return getMinLengthError(value, minimumLength) || getMaxLengthError(value, maximumLength);
|
|
4169
|
+
};
|
|
4170
|
+
}
|
|
4171
|
+
function getMaxLengthError(value, requiredLength) {
|
|
4172
|
+
return value.length > requiredLength ? { maxlength: { requiredLength } } : null;
|
|
4173
|
+
}
|
|
4174
|
+
function getMinLengthError(value, requiredLength) {
|
|
4175
|
+
return value.length < requiredLength ? { minlength: { requiredLength } } : null;
|
|
4176
|
+
}
|
|
4177
|
+
|
|
4178
|
+
function validateUrl() {
|
|
4179
|
+
return (control) => {
|
|
4180
|
+
if (['', null, undefined].indexOf(control.value) > -1)
|
|
4181
|
+
return null;
|
|
4182
|
+
return isValidUrl(control.value) ? null : { url: true };
|
|
4183
|
+
};
|
|
4184
|
+
}
|
|
4185
|
+
function isValidUrl(value) {
|
|
4186
|
+
if (/^http(s)?:\/\/[^/]/.test(value) || /^ftp:\/\/[^/]/.test(value)) {
|
|
4187
|
+
const a = document.createElement('a');
|
|
4188
|
+
a.href = value;
|
|
4189
|
+
return !!a.host;
|
|
4190
|
+
}
|
|
4191
|
+
return false;
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
const AbpValidators = {
|
|
4195
|
+
creditCard: validateCreditCard,
|
|
4196
|
+
emailAddress: () => Validators.email,
|
|
4197
|
+
minAge: validateMinAge,
|
|
4198
|
+
range: validateRange,
|
|
4199
|
+
required: validateRequired,
|
|
4200
|
+
stringLength: validateStringLength,
|
|
4201
|
+
url: validateUrl,
|
|
4202
|
+
};
|
|
4203
|
+
|
|
4204
|
+
// export * from './lib/handlers';
|
|
4205
|
+
|
|
4206
|
+
/**
|
|
4207
|
+
* Generated bundle index. Do not edit.
|
|
4208
|
+
*/
|
|
4209
|
+
|
|
4210
|
+
export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, 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, 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, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, checkAccessToken, 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, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, ngxsStoragePluginSerialize, noop, parseTenantFromUrl, pipeToLogin, pushValueTo, reloadRoute, removeRememberMe, setRememberMe, setTokenResponseToStorage, storageFactory, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
|
|
4211
|
+
//# sourceMappingURL=abp-ng.core.mjs.map
|