From c4eab6766bb122aa3ad96f299da4650468075519 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 16 Aug 2021 16:13:59 +0300 Subject: [PATCH] reformat all files --- .../dev-app/src/app/shared/shared.module.ts | 14 +- .../nx/ng-packs/apps/dev-app/src/main.ts | 2 +- .../change-password.component.ts | 3 +- .../personal-settings.component.ts | 3 +- .../src/lib/proxy/account/account.service.ts | 42 +++--- .../account/controllers/account.service.ts | 40 +++--- .../page/src/page-parts.component.ts | 12 +- .../src/lib/abstracts/ng-model.component.ts | 11 +- .../replaceable-route-container.component.ts | 5 +- .../lib/components/router-outlet.component.ts | 4 +- .../src/lib/directives/debounce.directive.ts | 18 +-- .../src/lib/directives/ellipsis.directive.ts | 9 +- .../core/src/lib/directives/for.directive.ts | 38 ++--- .../lib/directives/form-submit.directive.ts | 17 +-- .../directives/stop-propagation.directive.ts | 24 +--- .../packages/core/src/lib/pipes/sort.pipe.ts | 6 +- .../asp-net-core/mvc/multi-tenancy/models.ts | 1 - .../lib/proxy/volo/abp/localization/models.ts | 1 - .../core/src/lib/proxy/volo/abp/models.ts | 1 - .../core/src/lib/states/config.state.ts | 15 +- .../src/lib/strategies/context.strategy.ts | 2 +- .../src/lib/tests/container.strategy.spec.ts | 12 +- .../src/lib/tests/environment.service.spec.ts | 4 +- .../core/src/lib/tests/for.directive.spec.ts | 9 +- .../core/src/lib/tests/internal-store.spec.ts | 39 ++--- .../src/lib/tests/lazy-load-utils.spec.ts | 4 +- .../src/lib/tests/profile.service.spec.ts | 19 +-- .../src/lib/tests/projection.strategy.spec.ts | 51 ++----- .../core/src/lib/tests/rest.service.spec.ts | 39 ++--- .../core/src/lib/tests/route-utils.spec.ts | 2 +- .../lib/tests/router-outlet.component.spec.ts | 9 +- .../core/src/lib/tests/routes.handler.spec.ts | 6 +- .../core/src/lib/tests/sort.pipe.spec.ts | 8 +- .../core/src/lib/tests/utils/common.utils.ts | 4 +- .../core/src/lib/utils/common-utils.ts | 2 +- .../core/src/lib/utils/date-extensions.ts | 2 +- .../core/src/lib/utils/lazy-load-utils.ts | 2 +- .../feature-management.component.ts | 3 +- .../feature-management/features.service.ts | 30 ++-- .../proxy/identity/identity-role.service.ts | 82 ++++++----- .../identity/identity-user-lookup.service.ts | 57 +++++--- .../proxy/identity/identity-user.service.ts | 136 +++++++++++------- .../src/lib/proxy/identity/profile.service.ts | 40 +++--- .../identity/src/lib/proxy/users/models.ts | 1 - .../src/lib/tokens/extensions.token.ts | 5 +- .../permission-management.component.ts | 7 +- .../src/lib/proxy/models.ts | 1 - .../src/lib/proxy/permissions.service.ts | 30 ++-- .../src/commands/proxy-add/index.ts | 2 +- .../src/commands/proxy-refresh/index.ts | 2 +- .../schematics/src/utils/angular/change.ts | 17 +-- .../src/utils/angular/dependencies.ts | 18 ++- .../schematics/src/utils/angular/json-file.ts | 40 +++--- .../src/utils/angular/json-utils.ts | 31 ++-- .../schematics/src/utils/angular/lint-fix.ts | 17 ++- .../src/utils/angular/parse-name.ts | 1 - .../schematics/src/utils/angular/tsconfig.ts | 14 +- .../src/utils/angular/validation.ts | 6 +- .../schematics/src/utils/angular/workspace.ts | 11 +- .../schematics/src/utils/namespace.ts | 5 +- .../src/proxy/email-settings.service.ts | 26 ++-- .../config/src/proxy/models.ts | 1 - .../src/lib/proxy/tenant.service.ts | 111 ++++++++------ .../src/lib/tokens/extensions.token.ts | 25 ++-- .../src/lib/adapters/date-time.adapter.ts | 2 +- .../src/lib/adapters/time.adapter.ts | 2 +- .../abstract-actions.component.ts | 2 +- .../src/lib/directives/prop-data.directive.ts | 6 +- .../extensions/src/lib/utils/state.util.ts | 2 +- .../extensions/src/tests/actions.util.spec.ts | 4 +- .../extensions/src/tests/enum.util.spec.ts | 31 ++-- .../extensions/src/tests/props.util.spec.ts | 4 +- .../extensions/src/tests/state.util.spec.ts | 27 ++-- .../src/lib/animations/bounce.animations.ts | 12 +- .../src/lib/animations/fade.animations.ts | 49 +++++-- .../http-error-wrapper.component.ts | 12 +- .../lib/components/modal/modal.component.ts | 2 +- .../src/lib/services/toaster.service.ts | 18 ++- .../src/lib/tests/button.component.spec.ts | 9 +- .../src/lib/tests/chart.component.spec.ts | 43 +++--- .../lib/tests/confirmation.service.spec.ts | 43 +++--- .../src/lib/tests/error.component.spec.ts | 4 +- .../src/lib/tests/error.handler.spec.ts | 30 ++-- .../src/lib/tests/lazy-style.handler.spec.ts | 2 +- .../src/lib/tests/modal.component.spec.ts | 18 +-- .../src/lib/utils/date-parser-formatter.ts | 5 +- 86 files changed, 747 insertions(+), 779 deletions(-) diff --git a/npm/ng-packs/nx/ng-packs/apps/dev-app/src/app/shared/shared.module.ts b/npm/ng-packs/nx/ng-packs/apps/dev-app/src/app/shared/shared.module.ts index 58e820f816..964170499d 100644 --- a/npm/ng-packs/nx/ng-packs/apps/dev-app/src/app/shared/shared.module.ts +++ b/npm/ng-packs/nx/ng-packs/apps/dev-app/src/app/shared/shared.module.ts @@ -6,18 +6,8 @@ import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ declarations: [], - imports: [ - CoreModule, - ThemeSharedModule, - NgbDropdownModule, - NgxValidateCoreModule, - ], - exports: [ - CoreModule, - ThemeSharedModule, - NgbDropdownModule, - NgxValidateCoreModule, - ], + imports: [CoreModule, ThemeSharedModule, NgbDropdownModule, NgxValidateCoreModule], + exports: [CoreModule, ThemeSharedModule, NgbDropdownModule, NgxValidateCoreModule], providers: [], }) export class SharedModule {} diff --git a/npm/ng-packs/nx/ng-packs/apps/dev-app/src/main.ts b/npm/ng-packs/nx/ng-packs/apps/dev-app/src/main.ts index d9a2e7e4a5..fa4e0aef33 100644 --- a/npm/ng-packs/nx/ng-packs/apps/dev-app/src/main.ts +++ b/npm/ng-packs/nx/ng-packs/apps/dev-app/src/main.ts @@ -10,4 +10,4 @@ if (environment.production) { platformBrowserDynamic() .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .catch(err => console.error(err)); diff --git a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts index d18bd8b165..47b02e4b6e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts @@ -18,7 +18,8 @@ const PASSWORD_FIELDS = ['newPassword', 'repeatNewPassword']; exportAs: 'abpChangePasswordForm', }) export class ChangePasswordComponent - implements OnInit, Account.ChangePasswordComponentInputs, Account.ChangePasswordComponentOutputs { + implements OnInit, Account.ChangePasswordComponentInputs, Account.ChangePasswordComponentOutputs +{ form: FormGroup; inProgress: boolean; diff --git a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts index dd7789220f..67db73a5a6 100644 --- a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts @@ -17,7 +17,8 @@ export class PersonalSettingsComponent implements OnInit, Account.PersonalSettingsComponentInputs, - Account.PersonalSettingsComponentOutputs { + Account.PersonalSettingsComponentOutputs +{ form: FormGroup; inProgress: boolean; diff --git a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/account.service.ts b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/account.service.ts index adeb2ee5c9..4d62086f7f 100644 --- a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/account.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/account.service.ts @@ -10,28 +10,34 @@ export class AccountService { apiName = 'AbpAccount'; register = (input: RegisterDto) => - this.restService.request({ - method: 'POST', - url: '/api/account/register', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/account/register', + body: input, + }, + { apiName: this.apiName }, + ); resetPassword = (input: ResetPasswordDto) => - this.restService.request({ - method: 'POST', - url: '/api/account/reset-password', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/account/reset-password', + body: input, + }, + { apiName: this.apiName }, + ); sendPasswordResetCode = (input: SendPasswordResetCodeDto) => - this.restService.request({ - method: 'POST', - url: '/api/account/send-password-reset-code', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/account/send-password-reset-code', + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/web/areas/account/controllers/account.service.ts b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/web/areas/account/controllers/account.service.ts index 8adf5385b0..75b07bf963 100644 --- a/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/web/areas/account/controllers/account.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/web/areas/account/controllers/account.service.ts @@ -9,27 +9,33 @@ export class AccountService { apiName = 'AbpAccount'; checkPasswordByLogin = (login: UserLoginInfo) => - this.restService.request({ - method: 'POST', - url: '/api/account/check-password', - body: login, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/account/check-password', + body: login, + }, + { apiName: this.apiName }, + ); loginByLogin = (login: UserLoginInfo) => - this.restService.request({ - method: 'POST', - url: '/api/account/login', - body: login, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/account/login', + body: login, + }, + { apiName: this.apiName }, + ); logout = () => - this.restService.request({ - method: 'GET', - url: '/api/account/logout', - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/account/logout', + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/components/page/src/page-parts.component.ts b/npm/ng-packs/nx/ng-packs/packages/components/page/src/page-parts.component.ts index 8438593268..720a14c4a9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/components/page/src/page-parts.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/components/page/src/page-parts.component.ts @@ -8,27 +8,21 @@ export enum PageParts { @Component({ selector: 'abp-page-title-container', - template: ` - - `, + template: ` `, encapsulation: ViewEncapsulation.None, }) export class PageTitleContainerComponent {} @Component({ selector: 'abp-page-breadcrumb-container', - template: ` - - `, + template: ` `, encapsulation: ViewEncapsulation.None, }) export class PageBreadcrumbContainerComponent {} @Component({ selector: 'abp-page-toolbar-container', - template: ` - - `, + template: ` `, encapsulation: ViewEncapsulation.None, }) export class PageToolbarContainerComponent {} diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts index 93225990d5..9c22741693 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts @@ -4,9 +4,7 @@ import { ControlValueAccessor } from '@angular/forms'; // Not an abstract class on purpose. Do not change! // tslint:disable-next-line: use-component-selector @Component({ template: '' }) -export class AbstractNgModelComponent - implements ControlValueAccessor -{ +export class AbstractNgModelComponent implements ControlValueAccessor { protected _value: T; protected cdRef: ChangeDetectorRef; onChange: (value: T) => void; @@ -19,17 +17,16 @@ export class AbstractNgModelComponent readonly: boolean; @Input() - valueFn: (value: U, previousValue?: T) => T = (value) => value as any as T; + valueFn: (value: U, previousValue?: T) => T = value => value as any as T; @Input() - valueLimitFn: (value: T, previousValue?: T) => any = (value) => false; + valueLimitFn: (value: T, previousValue?: T) => any = value => false; @Input() set value(value: T) { value = this.valueFn(value as any as U, this._value); - if (this.valueLimitFn(value, this._value) !== false || this.readonly) - return; + if (this.valueLimitFn(value, this._value) !== false || this.readonly) return; this._value = value; this.notifyValueChange(); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts index 6c0dabd511..9d60fcda84 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts @@ -27,8 +27,9 @@ export class ReplaceableRouteContainerComponent implements OnInit { ngOnInit() { this.defaultComponent = this.route.snapshot.data.replaceableComponent.defaultComponent; - this.componentKey = (this.route.snapshot.data - .replaceableComponent as ReplaceableComponents.RouteData).key; + this.componentKey = ( + this.route.snapshot.data.replaceableComponent as ReplaceableComponents.RouteData + ).key; const component$ = this.replaceableComponents .get$(this.componentKey) diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/router-outlet.component.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/router-outlet.component.ts index 1fc5d002ac..fee29d9dd8 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/router-outlet.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/router-outlet.component.ts @@ -2,8 +2,6 @@ import { Component } from '@angular/core'; @Component({ selector: 'abp-router-outlet', - template: ` - - `, + template: ` `, }) export class RouterOutletComponent {} diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/debounce.directive.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/debounce.directive.ts index 16bcb07590..431305738a 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/debounce.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/debounce.directive.ts @@ -1,11 +1,4 @@ -import { - Directive, - ElementRef, - EventEmitter, - Input, - OnInit, - Output, -} from '@angular/core'; +import { Directive, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { fromEvent } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { SubscriptionService } from '../services/subscription.service'; @@ -20,15 +13,10 @@ export class InputEventDebounceDirective implements OnInit { @Output('input.debounce') readonly debounceEvent = new EventEmitter(); - constructor( - private el: ElementRef, - private subscription: SubscriptionService - ) {} + constructor(private el: ElementRef, private subscription: SubscriptionService) {} ngOnInit(): void { - const input$ = fromEvent(this.el.nativeElement, 'input').pipe( - debounceTime(this.debounce) - ); + const input$ = fromEvent(this.el.nativeElement, 'input').pipe(debounceTime(this.debounce)); this.subscription.addOne(input$, (event: Event) => { this.debounceEvent.emit(event); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts index 1837d1d8e1..1c178da1af 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts @@ -1,4 +1,11 @@ -import { AfterViewInit, ChangeDetectorRef, Directive, ElementRef, HostBinding, Input } from '@angular/core'; +import { + AfterViewInit, + ChangeDetectorRef, + Directive, + ElementRef, + HostBinding, + Input, +} from '@angular/core'; @Directive({ selector: '[abpEllipsis]', diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/for.directive.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/for.directive.ts index b9bd04f0fb..913fff3a5a 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/for.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/for.directive.ts @@ -21,14 +21,14 @@ class AbpForContext { public $implicit: any, public index: number, public count: number, - public list: any[] + public list: any[], ) {} } class RecordView { constructor( public record: IterableChangeRecord, - public view: EmbeddedViewRef + public view: EmbeddedViewRef, ) {} } @@ -70,31 +70,25 @@ export class ForDirective implements OnChanges { } get trackByFn(): TrackByFunction { - return ( - this.trackBy || ((index: number, item: any) => (item as any).id || index) - ); + return this.trackBy || ((index: number, item: any) => (item as any).id || index); } constructor( private tempRef: TemplateRef, private vcRef: ViewContainerRef, - private differs: IterableDiffers + private differs: IterableDiffers, ) {} private iterateOverAppliedOperations(changes: IterableChanges) { const rw: RecordView[] = []; changes.forEachOperation( - ( - record: IterableChangeRecord, - previousIndex: number, - currentIndex: number - ) => { + (record: IterableChangeRecord, previousIndex: number, currentIndex: number) => { if (record.previousIndex == null) { const view = this.vcRef.createEmbeddedView( this.tempRef, new AbpForContext(null, -1, -1, this.items), - currentIndex + currentIndex, ); rw.push(new RecordView(record, view)); @@ -104,11 +98,9 @@ export class ForDirective implements OnChanges { const view = this.vcRef.get(previousIndex); this.vcRef.move(view, currentIndex); - rw.push( - new RecordView(record, view as EmbeddedViewRef) - ); + rw.push(new RecordView(record, view as EmbeddedViewRef)); } - } + }, ); for (let i = 0, l = rw.length; i < l; i++) { @@ -125,9 +117,7 @@ export class ForDirective implements OnChanges { } changes.forEachIdentityChange((record: IterableChangeRecord) => { - const viewRef = this.vcRef.get( - record.currentIndex - ) as EmbeddedViewRef; + const viewRef = this.vcRef.get(record.currentIndex) as EmbeddedViewRef; viewRef.context.$implicit = record.item; }); } @@ -165,11 +155,7 @@ export class ForDirective implements OnChanges { private sortItems(items: any[]) { if (this.orderBy) { items.sort((a, b) => - a[this.orderBy] > b[this.orderBy] - ? 1 - : a[this.orderBy] < b[this.orderBy] - ? -1 - : 0 + a[this.orderBy] > b[this.orderBy] ? 1 : a[this.orderBy] < b[this.orderBy] ? -1 : 0, ); } else { items.sort(); @@ -187,9 +173,7 @@ export class ForDirective implements OnChanges { typeof this.filterVal !== 'undefined' && this.filterVal !== '' ) { - items = items.filter((item) => - compareFn(item[this.filterBy], this.filterVal) - ); + items = items.filter(item => compareFn(item[this.filterBy], this.filterVal)); } switch (this.orderDir) { diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts index 04e3269ce4..2ca2b9757d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts @@ -35,7 +35,7 @@ export class FormSubmitDirective implements OnInit { @Self() private formGroupDirective: FormGroupDirective, private host: ElementRef, private cdRef: ChangeDetectorRef, - private subscription: SubscriptionService + private subscription: SubscriptionService, ) {} ngOnInit() { @@ -44,19 +44,16 @@ export class FormSubmitDirective implements OnInit { this.executedNgSubmit = true; }); - const keyup$ = fromEvent( - this.host.nativeElement as HTMLElement, - 'keyup' - ).pipe( + const keyup$ = fromEvent(this.host.nativeElement as HTMLElement, 'keyup').pipe( debounceTime(this.debounce), - filter((event) => !(event.target instanceof HTMLTextAreaElement)), - filter((event: KeyboardEvent) => event && event.key === 'Enter') + filter(event => !(event.target instanceof HTMLTextAreaElement)), + filter((event: KeyboardEvent) => event && event.key === 'Enter'), ); this.subscription.addOne(keyup$, () => { if (!this.executedNgSubmit) { this.host.nativeElement.dispatchEvent( - new Event('submit', { bubbles: true, cancelable: true }) + new Event('submit', { bubbles: true, cancelable: true }), ); } @@ -76,13 +73,13 @@ export class FormSubmitDirective implements OnInit { function setDirty(controls: Controls) { if (Array.isArray(controls)) { - controls.forEach((group) => { + controls.forEach(group => { setDirty(group.controls as { [key: string]: FormControl }); }); return; } - Object.keys(controls).forEach((key) => { + Object.keys(controls).forEach(key => { controls[key].markAsDirty(); controls[key].updateValueAndValidity(); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts index c297bfd90d..52722e95a9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts @@ -1,10 +1,4 @@ -import { - Directive, - ElementRef, - EventEmitter, - OnInit, - Output, -} from '@angular/core'; +import { Directive, ElementRef, EventEmitter, OnInit, Output } from '@angular/core'; import { fromEvent } from 'rxjs'; import { SubscriptionService } from '../services/subscription.service'; @@ -16,18 +10,12 @@ import { SubscriptionService } from '../services/subscription.service'; export class StopPropagationDirective implements OnInit { @Output('click.stop') readonly stopPropEvent = new EventEmitter(); - constructor( - private el: ElementRef, - private subscription: SubscriptionService - ) {} + constructor(private el: ElementRef, private subscription: SubscriptionService) {} ngOnInit(): void { - this.subscription.addOne( - fromEvent(this.el.nativeElement, 'click'), - (event: MouseEvent) => { - event.stopPropagation(); - this.stopPropEvent.emit(event); - } - ); + this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), (event: MouseEvent) => { + event.stopPropagation(); + this.stopPropEvent.emit(event); + }); } } diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts index 4d634f33c7..c44ca6f075 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts @@ -5,11 +5,7 @@ export type SortOrder = 'asc' | 'desc'; name: 'abpSort', }) export class SortPipe implements PipeTransform { - transform( - value: any[], - sortOrder: SortOrder | string = 'asc', - sortKey?: string, - ): any { + transform(value: any[], sortOrder: SortOrder | string = 'asc', sortKey?: string): any { sortOrder = sortOrder && (sortOrder.toLowerCase() as any); if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc')) return value; diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.ts index 2c948099b4..a88493c5c7 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.ts @@ -1,4 +1,3 @@ - export interface FindTenantResultDto { success: boolean; tenantId?: string; diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/localization/models.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/localization/models.ts index c881e7da2b..e46e9b6d3c 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/localization/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/localization/models.ts @@ -1,4 +1,3 @@ - export interface LanguageInfo { cultureName?: string; uiCultureName?: string; diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts index 5f16437958..f6f19c97ad 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts @@ -1,4 +1,3 @@ - export interface NameValue { name?: string; value: T; diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/states/config.state.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/states/config.state.ts index 4cc2dc741d..412759667e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/states/config.state.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/states/config.state.ts @@ -143,11 +143,16 @@ export class ConfigState { } static getLocalizationResource(resourceName: string) { - const selector = createSelector([ConfigState], (state: Config.State): { - [key: string]: string; - } => { - return state.localization.values[resourceName]; - }); + const selector = createSelector( + [ConfigState], + ( + state: Config.State, + ): { + [key: string]: string; + } => { + return state.localization.values[resourceName]; + }, + ); return selector; } diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts index 21007eae1c..06cceee54c 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts @@ -11,7 +11,7 @@ export abstract class ContextStrategy { } export class NoContextStrategy< - T extends Type | TemplateRef = any + T extends Type | TemplateRef = any, > extends ContextStrategy { constructor() { super(undefined); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts index e85e7b5a50..d34de7d6ec 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts @@ -6,10 +6,10 @@ import { } from '../strategies'; describe('ClearContainerStrategy', () => { - const containerRef = ({ + const containerRef = { clear: jest.fn(), length: 7, - } as any) as ViewContainerRef; + } as any as ViewContainerRef; describe('#getIndex', () => { it('should return 0', () => { @@ -29,10 +29,10 @@ describe('ClearContainerStrategy', () => { }); describe('InsertIntoContainerStrategy', () => { - const containerRef = ({ + const containerRef = { clear: jest.fn(), length: 7, - } as any) as ViewContainerRef; + } as any as ViewContainerRef; describe('#getIndex', () => { test.each` @@ -61,10 +61,10 @@ describe('InsertIntoContainerStrategy', () => { }); describe('CONTAINER_STRATEGY', () => { - const containerRef = ({ + const containerRef = { clear: jest.fn(), length: 7, - } as any) as ViewContainerRef; + } as any as ViewContainerRef; test.each` name | Strategy | index diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts index 95c2b58a6c..a1c44d8a7b 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts @@ -3,7 +3,7 @@ import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { Environment } from '../models'; import { EnvironmentService } from '../services'; -export const ENVIRONMENT_DATA = ({ +export const ENVIRONMENT_DATA = { production: false, application: { name: 'MyProjectName', @@ -23,7 +23,7 @@ export const ENVIRONMENT_DATA = ({ localization: { defaultResourceName: 'MyProjectName', }, -} as any) as Environment; +} as any as Environment; describe('ConfigState', () => { let spectator: SpectatorService; diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/for.directive.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/for.directive.spec.ts index 1405935b62..d83be2ff0e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/for.directive.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/for.directive.spec.ts @@ -51,9 +51,12 @@ describe('ForDirective', () => { describe('trackBy', () => { const trackByFn = (_, item) => item; beforeEach(() => { - spectator = createDirective('
  • {{ item }}
', { - hostProps: { items, trackByFn }, - }); + spectator = createDirective( + '
  • {{ item }}
', + { + hostProps: { items, trackByFn }, + }, + ); directive = spectator.directive; }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts index 7a13adf9e4..3fb3cb5f02 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts @@ -82,13 +82,10 @@ describe('Internal Store', () => { async ({ selector, expected }) => { const store = new InternalStore(mockInitialState); - const value = await store - .sliceState(selector) - .pipe(take(1)) - .toPromise(); + const value = await store.sliceState(selector).pipe(take(1)).toPromise(); expect(value).toEqual(expected); - } + }, ); }); @@ -100,16 +97,13 @@ describe('Internal Store', () => { ${deepPatch3} | ${deepPatchExpected3} ${deepPatch4} | ${deepPatchExpected4} ${deepPatch5} | ${deepPatchExpected5} - `( - 'should set state as $expected when patch is $patch', - ({ patch, expected }) => { - const store = new InternalStore(mockInitialState); + `('should set state as $expected when patch is $patch', ({ patch, expected }) => { + const store = new InternalStore(mockInitialState); - store.deepPatch(patch); + store.deepPatch(patch); - expect(store.state).toEqual(expected); - } - ); + expect(store.state).toEqual(expected); + }); }); describe('patchState', () => { @@ -120,25 +114,22 @@ describe('Internal Store', () => { ${patch3} | ${patchExpected3} ${patch4} | ${patchExpected4} ${patch5} | ${patchExpected5} - `( - 'should set state as $expected when patch is $patch', - ({ patch, expected }) => { - const store = new InternalStore(mockInitialState); + `('should set state as $expected when patch is $patch', ({ patch, expected }) => { + const store = new InternalStore(mockInitialState); - store.patch(patch); + store.patch(patch); - expect(store.state).toEqual(expected); - } - ); + expect(store.state).toEqual(expected); + }); }); describe('sliceUpdate', () => { - it('should return slice of update$ based on selector', (done) => { + it('should return slice of update$ based on selector', done => { const store = new InternalStore(mockInitialState); - const onQux$ = store.sliceUpdate((state) => state.foo.bar.qux); + const onQux$ = store.sliceUpdate(state => state.foo.bar.qux); - onQux$.pipe(take(1)).subscribe((value) => { + onQux$.pipe(take(1)).subscribe(value => { expect(value).toEqual(deepPatch2.foo.bar.qux); done(); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts index 7afb343e80..4d4d55caf7 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts @@ -55,7 +55,7 @@ describe('Lazy Load Utils', () => { it('should emit error event on fail and clear callbacks', done => { const error = new CustomEvent('error'); const parentNode = { removeChild: jest.fn() }; - const element = ({ parentNode } as any) as HTMLLinkElement; + const element = { parentNode } as any as HTMLLinkElement; fromLazyLoad( element, @@ -84,7 +84,7 @@ describe('Lazy Load Utils', () => { it('should emit load event on success and clear callbacks', done => { const success = new CustomEvent('load'); const parentNode = { removeChild: jest.fn() }; - const element = ({ parentNode } as any) as HTMLLinkElement; + const element = { parentNode } as any as HTMLLinkElement; fromLazyLoad( element, diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts index 32dcf030d7..894a7c20cf 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts @@ -1,9 +1,4 @@ -import { - createHttpFactory, - HttpMethod, - SpectatorHttp, - SpyObject, -} from '@ngneat/spectator/jest'; +import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; import { EnvironmentService, ProfileService, RestService } from '../services'; import { CORE_OPTIONS } from '../tokens'; @@ -31,10 +26,7 @@ describe('ProfileService', () => { it('should send a GET to my-profile API', () => { spectator.service.get().subscribe(); - spectator.expectOne( - 'https://abp.io/api/identity/my-profile', - HttpMethod.GET - ); + spectator.expectOne('https://abp.io/api/identity/my-profile', HttpMethod.GET); }); it('should send a POST to change-password API', () => { @@ -42,7 +34,7 @@ describe('ProfileService', () => { spectator.service.changePassword(mock).subscribe(); const req = spectator.expectOne( 'https://abp.io/api/identity/my-profile/change-password', - HttpMethod.POST + HttpMethod.POST, ); expect(req.request.body).toEqual(mock); }); @@ -58,10 +50,7 @@ describe('ProfileService', () => { hasPassword: false, }; spectator.service.update(mock).subscribe(); - const req = spectator.expectOne( - 'https://abp.io/api/identity/my-profile', - HttpMethod.PUT - ); + const req = spectator.expectOne('https://abp.io/api/identity/my-profile', HttpMethod.PUT); expect(req.request.body).toEqual(mock); }); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts index 8c5cf1fc3a..1f1927366a 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts @@ -46,9 +46,7 @@ describe('ComponentProjectionStrategy', () => { beforeEach(() => { spectator = createComponent({}); - containerStrategy = CONTAINER_STRATEGY.Clear( - spectator.component.containerRef - ); + containerStrategy = CONTAINER_STRATEGY.Clear(spectator.component.containerRef); }); afterEach(() => { @@ -58,10 +56,7 @@ describe('ComponentProjectionStrategy', () => { describe('#injectContent', () => { it('should should insert content into container and return a ComponentRef', () => { - const strategy = new ComponentProjectionStrategy( - TestComponent, - containerStrategy - ); + const strategy = new ComponentProjectionStrategy(TestComponent, containerStrategy); componentRef = strategy.injectContent({ get: spectator.inject }); spectator.detectChanges(); @@ -75,7 +70,7 @@ describe('ComponentProjectionStrategy', () => { const strategy = new ComponentProjectionStrategy( TestComponent, containerStrategy, - contextStrategy + contextStrategy, ); componentRef = strategy.injectContent({ get: spectator.inject }); spectator.detectChanges(); @@ -131,10 +126,7 @@ describe('RootComponentProjectionStrategy', () => { it('should be able to map context to projected component', () => { const contextStrategy = CONTEXT_STRATEGY.Component({ bar: 'bar' }); - const strategy = new RootComponentProjectionStrategy( - TestComponent, - contextStrategy - ); + const strategy = new RootComponentProjectionStrategy(TestComponent, contextStrategy); componentRef = strategy.injectContent({ get: spectator.inject }); spectator.detectChanges(); @@ -174,9 +166,7 @@ describe('TemplateProjectionStrategy', () => { beforeEach(() => { spectator = createComponent({}); - containerStrategy = CONTAINER_STRATEGY.Clear( - spectator.component.containerRef - ); + containerStrategy = CONTAINER_STRATEGY.Clear(spectator.component.containerRef); }); afterEach(() => { @@ -187,10 +177,7 @@ describe('TemplateProjectionStrategy', () => { describe('#injectContent', () => { it('should should insert content into container and return an EmbeddedViewRef', () => { const templateRef = spectator.component.templateRef; - const strategy = new TemplateProjectionStrategy( - templateRef, - containerStrategy - ); + const strategy = new TemplateProjectionStrategy(templateRef, containerStrategy); embeddedViewRef = strategy.injectContent(); spectator.detectChanges(); @@ -213,7 +200,7 @@ describe('TemplateProjectionStrategy', () => { const strategy = new TemplateProjectionStrategy( templateRef, containerStrategy, - contextStrategy + contextStrategy, ); embeddedViewRef = strategy.injectContent(); spectator.detectChanges(); @@ -242,13 +229,9 @@ describe('PROJECTION_STRATEGY', () => { 'should successfully map $name to $Strategy.name with $containerStrategy.name container strategy and $contextStrategy.name context strategy', ({ name, Strategy, containerStrategy }) => { expect(PROJECTION_STRATEGY[name](content, containerRef, context)).toEqual( - new Strategy( - content, - containerStrategy(containerRef), - CONTEXT_STRATEGY.None() - ) + new Strategy(content, containerStrategy(containerRef), CONTEXT_STRATEGY.None()), ); - } + }, ); test.each` name | Strategy | domStrategy @@ -257,9 +240,9 @@ describe('PROJECTION_STRATEGY', () => { 'should successfully map $name to $Strategy.name with $domStrategy.name dom strategy', ({ name, Strategy, domStrategy }) => { expect(PROJECTION_STRATEGY[name](content, context)).toEqual( - new Strategy(content, CONTEXT_STRATEGY.None(), domStrategy()) + new Strategy(content, CONTEXT_STRATEGY.None(), domStrategy()), ); - } + }, ); test.each` @@ -275,13 +258,9 @@ describe('PROJECTION_STRATEGY', () => { ({ name, Strategy, containerStrategy, contextStrategy }) => { context = { x: true }; expect(PROJECTION_STRATEGY[name](content, containerRef, context)).toEqual( - new Strategy( - content, - containerStrategy(containerRef), - contextStrategy(context) - ) + new Strategy(content, containerStrategy(containerRef), contextStrategy(context)), ); - } + }, ); test.each` @@ -292,8 +271,8 @@ describe('PROJECTION_STRATEGY', () => { ({ name, Strategy, domStrategy, contextStrategy }) => { context = { x: true }; expect(PROJECTION_STRATEGY[name](content, context)).toEqual( - new Strategy(content, contextStrategy(context), domStrategy()) + new Strategy(content, contextStrategy(context), domStrategy()), ); - } + }, ); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts index 881f85a3c4..15c20aee18 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts @@ -1,9 +1,4 @@ -import { - createHttpFactory, - HttpMethod, - SpectatorHttp, - SpyObject, -} from '@ngneat/spectator/jest'; +import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; import { OAuthService } from 'angular-oauth2-oidc'; import { of, throwError } from 'rxjs'; @@ -21,10 +16,7 @@ describe('HttpClient testing', () => { const createHttp = createHttpFactory({ service: RestService, - providers: [ - EnvironmentService, - { provide: CORE_OPTIONS, useValue: { environment: {} } }, - ], + providers: [EnvironmentService, { provide: CORE_OPTIONS, useValue: { environment: {} } }], mocks: [OAuthService, Store], }); @@ -65,11 +57,7 @@ describe('HttpClient testing', () => { test('should use the specific api', () => { spectator.service - .request( - { method: HttpMethod.GET, url: '/test' }, - null, - 'http://test.api' - ) + .request({ method: HttpMethod.GET, url: '/test' }, null, 'http://test.api') .subscribe(); spectator.expectOne('http://test.api' + '/test', HttpMethod.GET); }); @@ -82,12 +70,10 @@ describe('HttpClient testing', () => { spectator.expectOne('bar' + '/test', HttpMethod.GET); }); - test('should complete upon successful request', (done) => { + test('should complete upon successful request', done => { const complete = jest.fn(done); - spectator.service - .request({ method: HttpMethod.GET, url: '/test' }) - .subscribe({ complete }); + spectator.service.request({ method: HttpMethod.GET, url: '/test' }).subscribe({ complete }); const req = spectator.expectOne(api + '/test', HttpMethod.GET); spectator.flushAll([req], [{}]); @@ -97,16 +83,13 @@ describe('HttpClient testing', () => { const spy = jest.spyOn(store, 'dispatch'); spectator.service - .request( - { method: HttpMethod.GET, url: '/test' }, - { observe: Rest.Observe.Events } - ) + .request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Events }) .pipe( - catchError((err) => { + catchError(err => { expect(err).toBeTruthy(); expect(spy).toHaveBeenCalled(); return of(null); - }) + }), ) .subscribe(); @@ -120,14 +103,14 @@ describe('HttpClient testing', () => { spectator.service .request( { method: HttpMethod.GET, url: '/test' }, - { observe: Rest.Observe.Events, skipHandleError: true } + { observe: Rest.Observe.Events, skipHandleError: true }, ) .pipe( - catchError((err) => { + catchError(err => { expect(err).toBeTruthy(); expect(spy).toHaveBeenCalledTimes(0); return of(null); - }) + }), ) .subscribe(); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts index 3945a6527d..e6da7d4a0e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts @@ -23,7 +23,7 @@ describe('Route Utils', () => { 'should find $expected in $count turns when path is $path', async ({ path, expected, count }) => { const find = jest.fn(cb => (cb(node) ? node : null)); - const routes = ({ find } as any) as RoutesService; + const routes = { find } as any as RoutesService; const route = findRoute(routes, path); expect(route).toBe(expected); expect(find).toHaveBeenCalledTimes(count); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts index b7e79b9c08..1de681bc60 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts @@ -4,11 +4,16 @@ import { RouterOutletComponent } from '../components/router-outlet.component'; describe('RouterOutletComponent', () => { let spectator: Spectator; - const createHost = createHostFactory({ component: RouterOutletComponent, imports: [RouterTestingModule] }); + const createHost = createHostFactory({ + component: RouterOutletComponent, + imports: [RouterTestingModule], + }); it('should have a router-outlet element', () => { spectator = createHost(''); expect((spectator.debugElement.nativeElement as HTMLElement).children.length).toBe(1); - expect((spectator.debugElement.nativeElement as HTMLElement).children[0].tagName).toBe('ROUTER-OUTLET'); + expect((spectator.debugElement.nativeElement as HTMLElement).children[0].tagName).toBe( + 'ROUTER-OUTLET', + ); }); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts index 777df39c60..a8c5d92734 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts @@ -18,8 +18,8 @@ describe('Routes Handler', () => { const routes = []; const add = jest.fn(routes.push.bind(routes)); - const mockRoutesService = ({ add } as unknown) as RoutesService; - const mockRouter = ({ config } as unknown) as Router; + const mockRoutesService = { add } as unknown as RoutesService; + const mockRouter = { config } as unknown as Router; const handler = new RoutesHandler(mockRoutesService, mockRouter); @@ -30,7 +30,7 @@ describe('Routes Handler', () => { it('should not add routes when there is no router', () => { const routes = []; const add = jest.fn(routes.push.bind(routes)); - const mockRoutesService = ({ add } as unknown) as RoutesService; + const mockRoutesService = { add } as unknown as RoutesService; const handler = new RoutesHandler(mockRoutesService, null); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts index b69d139091..0d60ab0b21 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts @@ -17,13 +17,7 @@ describe('SortPipe', () => { }); test('should sort object array in given order with given key', () => { - const array = [ - { key: 5 }, - { key: 'b' }, - { key: 1 }, - { key: 'a' }, - { key: null }, - ]; + const array = [{ key: 5 }, { key: 'b' }, { key: 1 }, { key: 'a' }, { key: null }]; expect(pipe.transform(array, 'asc', 'key')).toEqual([ { key: 1 }, diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/utils/common.utils.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/utils/common.utils.ts index ba05659736..327119bb00 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/utils/common.utils.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/utils/common.utils.ts @@ -3,14 +3,14 @@ import { Store } from '@ngxs/store'; import { AbstractType, InjectFlags, InjectionToken, Injector, Type } from '@angular/core'; export const mockActions = new Subject(); -export const mockStore = ({ +export const mockStore = { selectSnapshot() { return true; }, select(): Observable { return of(null); }, -} as unknown) as Store; +} as unknown as Store; export class DummyInjector extends Injector { constructor(public payload: { [key: string]: any }) { diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/common-utils.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/common-utils.ts index 3b0446240b..41ce2e1141 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/common-utils.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/common-utils.ts @@ -1,6 +1,6 @@ export function noop() { // tslint:disable-next-line: only-arrow-functions - const fn = function() {}; + const fn = function () {}; return fn; } diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/date-extensions.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/date-extensions.ts index 8f0d17504d..6c6c1453ad 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/date-extensions.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/date-extensions.ts @@ -6,7 +6,7 @@ declare global { } } -Date.prototype.toLocalISOString = function(this: Date): string { +Date.prototype.toLocalISOString = function (this: Date): string { const timezoneOffset = this.getTimezoneOffset(); return new Date(this.getTime() - timezoneOffset * 60000).toISOString(); diff --git a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts index f602bf06ef..6f9154f98d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts +++ b/npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts @@ -34,7 +34,7 @@ export function fromLazyLoad( function createErrorHandler(observer: Observer, element: HTMLElement) { /* tslint:disable-next-line:only-arrow-functions */ - return function(event: Event | string) { + return function (event: Event | string) { clearCallbacks(element); element.parentNode.removeChild(element); observer.error(event); diff --git a/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts b/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts index 4bda77b4fb..65cf5d91d6 100644 --- a/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts @@ -29,7 +29,8 @@ enum ValueTypes { export class FeatureManagementComponent implements FeatureManagement.FeatureManagementComponentInputs, - FeatureManagement.FeatureManagementComponentOutputs { + FeatureManagement.FeatureManagementComponentOutputs +{ @Input() providerKey: string; diff --git a/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/proxy/feature-management/features.service.ts b/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/proxy/feature-management/features.service.ts index c1ff025b1b..cdc12ad36d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/proxy/feature-management/features.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/proxy/feature-management/features.service.ts @@ -9,21 +9,25 @@ export class FeaturesService { apiName = 'AbpFeatureManagement'; get = (providerName: string, providerKey: string) => - this.restService.request({ - method: 'GET', - url: '/api/feature-management/features', - params: { providerName, providerKey }, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/feature-management/features', + params: { providerName, providerKey }, + }, + { apiName: this.apiName }, + ); update = (providerName: string, providerKey: string, input: UpdateFeaturesDto) => - this.restService.request({ - method: 'PUT', - url: '/api/feature-management/features', - params: { providerName, providerKey }, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: '/api/feature-management/features', + params: { providerName, providerKey }, + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-role.service.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-role.service.ts index 5fd029c43d..edbc094037 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-role.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-role.service.ts @@ -10,49 +10,65 @@ export class IdentityRoleService { apiName = 'AbpIdentity'; create = (input: IdentityRoleCreateDto) => - this.restService.request({ - method: 'POST', - url: '/api/identity/roles', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/identity/roles', + body: input, + }, + { apiName: this.apiName }, + ); delete = (id: string) => - this.restService.request({ - method: 'DELETE', - url: `/api/identity/roles/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'DELETE', + url: `/api/identity/roles/${id}`, + }, + { apiName: this.apiName }, + ); get = (id: string) => - this.restService.request({ - method: 'GET', - url: `/api/identity/roles/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/identity/roles/${id}`, + }, + { apiName: this.apiName }, + ); getAllList = () => - this.restService.request>({ - method: 'GET', - url: '/api/identity/roles/all', - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/identity/roles/all', + }, + { apiName: this.apiName }, + ); getList = (input: PagedAndSortedResultRequestDto) => - this.restService.request>({ - method: 'GET', - url: '/api/identity/roles', - params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/identity/roles', + params: { + sorting: input.sorting, + skipCount: input.skipCount, + maxResultCount: input.maxResultCount, + }, + }, + { apiName: this.apiName }, + ); update = (id: string, input: IdentityRoleUpdateDto) => - this.restService.request({ - method: 'PUT', - url: `/api/identity/roles/${id}`, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: `/api/identity/roles/${id}`, + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user-lookup.service.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user-lookup.service.ts index af4583aa28..50eeef604e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user-lookup.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user-lookup.service.ts @@ -11,34 +11,47 @@ export class IdentityUserLookupService { apiName = 'AbpIdentity'; findById = (id: string) => - this.restService.request({ - method: 'GET', - url: `/api/identity/users/lookup/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/identity/users/lookup/${id}`, + }, + { apiName: this.apiName }, + ); findByUserName = (userName: string) => - this.restService.request({ - method: 'GET', - url: `/api/identity/users/lookup/by-username/${userName}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/identity/users/lookup/by-username/${userName}`, + }, + { apiName: this.apiName }, + ); getCount = (input: UserLookupCountInputDto) => - this.restService.request({ - method: 'GET', - url: '/api/identity/users/lookup/count', - params: { filter: input.filter }, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/identity/users/lookup/count', + params: { filter: input.filter }, + }, + { apiName: this.apiName }, + ); search = (input: UserLookupSearchInputDto) => - this.restService.request>({ - method: 'GET', - url: '/api/identity/users/lookup/search', - params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/identity/users/lookup/search', + params: { + filter: input.filter, + sorting: input.sorting, + skipCount: input.skipCount, + maxResultCount: input.maxResultCount, + }, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user.service.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user.service.ts index fe69946ff1..7e3b22a96a 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user.service.ts @@ -4,7 +4,8 @@ import type { IdentityUserCreateDto, IdentityUserDto, IdentityUserUpdateDto, - IdentityUserUpdateRolesDto } from './models'; + IdentityUserUpdateRolesDto, +} from './models'; import { RestService } from '@abp/ng.core'; import type { ListResultDto, PagedResultDto } from '@abp/ng.core'; import { Injectable } from '@angular/core'; @@ -16,78 +17,103 @@ export class IdentityUserService { apiName = 'AbpIdentity'; create = (input: IdentityUserCreateDto) => - this.restService.request({ - method: 'POST', - url: '/api/identity/users', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/identity/users', + body: input, + }, + { apiName: this.apiName }, + ); delete = (id: string) => - this.restService.request({ - method: 'DELETE', - url: `/api/identity/users/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'DELETE', + url: `/api/identity/users/${id}`, + }, + { apiName: this.apiName }, + ); findByEmail = (email: string) => - this.restService.request({ - method: 'GET', - url: `/api/identity/users/by-email/${email}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/identity/users/by-email/${email}`, + }, + { apiName: this.apiName }, + ); findByUsername = (username: string) => - this.restService.request({ - method: 'GET', - url: '/api/identity/users/by-username/{userName}', - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/identity/users/by-username/{userName}', + }, + { apiName: this.apiName }, + ); get = (id: string) => - this.restService.request({ - method: 'GET', - url: `/api/identity/users/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/identity/users/${id}`, + }, + { apiName: this.apiName }, + ); getAssignableRoles = () => - this.restService.request>({ - method: 'GET', - url: '/api/identity/users/assignable-roles', - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/identity/users/assignable-roles', + }, + { apiName: this.apiName }, + ); getList = (input: GetIdentityUsersInput) => - this.restService.request>({ - method: 'GET', - url: '/api/identity/users', - params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/identity/users', + params: { + filter: input.filter, + sorting: input.sorting, + skipCount: input.skipCount, + maxResultCount: input.maxResultCount, + }, + }, + { apiName: this.apiName }, + ); getRoles = (id: string) => - this.restService.request>({ - method: 'GET', - url: `/api/identity/users/${id}/roles`, - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: `/api/identity/users/${id}/roles`, + }, + { apiName: this.apiName }, + ); update = (id: string, input: IdentityUserUpdateDto) => - this.restService.request({ - method: 'PUT', - url: `/api/identity/users/${id}`, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: `/api/identity/users/${id}`, + body: input, + }, + { apiName: this.apiName }, + ); updateRoles = (id: string, input: IdentityUserUpdateRolesDto) => - this.restService.request({ - method: 'PUT', - url: `/api/identity/users/${id}/roles`, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: `/api/identity/users/${id}/roles`, + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/profile.service.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/profile.service.ts index 4b8460d03b..d40f7d9aca 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/profile.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/profile.service.ts @@ -9,27 +9,33 @@ export class ProfileService { apiName = 'AbpIdentity'; changePassword = (input: ChangePasswordInput) => - this.restService.request({ - method: 'POST', - url: '/api/identity/my-profile/change-password', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/identity/my-profile/change-password', + body: input, + }, + { apiName: this.apiName }, + ); get = () => - this.restService.request({ - method: 'GET', - url: '/api/identity/my-profile', - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/identity/my-profile', + }, + { apiName: this.apiName }, + ); update = (input: UpdateProfileDto) => - this.restService.request({ - method: 'PUT', - url: '/api/identity/my-profile', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: '/api/identity/my-profile', + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/users/models.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/users/models.ts index 5201620e29..5273ed9522 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/users/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/users/models.ts @@ -1,4 +1,3 @@ - export interface UserData { id: string; tenantId?: string; diff --git a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/tokens/extensions.token.ts b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/tokens/extensions.token.ts index 14e506da0a..771f896aea 100644 --- a/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/tokens/extensions.token.ts +++ b/npm/ng-packs/nx/ng-packs/packages/identity/src/lib/tokens/extensions.token.ts @@ -60,9 +60,8 @@ export const IDENTITY_ENTITY_PROP_CONTRIBUTORS = new InjectionToken( - 'IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS', -); +export const IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS = + new InjectionToken('IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS'); export const IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS = new InjectionToken( 'IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS', diff --git a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts index 67a48cb507..c1f1ccda95 100644 --- a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts @@ -39,7 +39,8 @@ type PermissionWithStyle = PermissionGrantInfoDto & { export class PermissionManagementComponent implements PermissionManagement.PermissionManagementComponentInputs, - PermissionManagement.PermissionManagementComponentOutputs { + PermissionManagement.PermissionManagementComponentOutputs +{ @Input() readonly providerName: string; @@ -105,11 +106,11 @@ export class PermissionManagementComponent map(permissions => permissions.map( permission => - (({ + ({ ...permission, style: { [margin]: findMargin(permissions, permission) }, isGranted: this.permissions.find(per => per.name === permission.name).isGranted, - } as any) as PermissionWithStyle), + } as any as PermissionWithStyle), ), ), ); diff --git a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/models.ts b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/models.ts index c366b2c315..36b6a89bd9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/models.ts @@ -1,4 +1,3 @@ - export interface GetPermissionListResultDto { entityDisplayName: string; groups: PermissionGroupDto[]; diff --git a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/permissions.service.ts b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/permissions.service.ts index 45ac0b40e1..381fd952f5 100644 --- a/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/permissions.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/permissions.service.ts @@ -9,21 +9,25 @@ export class PermissionsService { apiName = 'AbpPermissionManagement'; get = (providerName: string, providerKey: string) => - this.restService.request({ - method: 'GET', - url: '/api/permission-management/permissions', - params: { providerName, providerKey }, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/permission-management/permissions', + params: { providerName, providerKey }, + }, + { apiName: this.apiName }, + ); update = (providerName: string, providerKey: string, input: UpdatePermissionsDto) => - this.restService.request({ - method: 'PUT', - url: '/api/permission-management/permissions', - params: { providerName, providerKey }, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: '/api/permission-management/permissions', + params: { providerName, providerKey }, + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-add/index.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-add/index.ts index a8387045f9..4a6b4cf92e 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-add/index.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-add/index.ts @@ -14,7 +14,7 @@ import { resolveProject, } from '../../utils'; -export default function(schema: GenerateProxySchema) { +export default function (schema: GenerateProxySchema) { const params = removeDefaultPlaceholders(schema); const moduleName = params.module || 'app'; diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts index 1a0a5ea3be..9428b9ae4d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts @@ -13,7 +13,7 @@ import { resolveProject, } from '../../utils'; -export default function(schema: GenerateProxySchema) { +export default function (schema: GenerateProxySchema) { const params = removeDefaultPlaceholders(schema); return async (host: Tree, _context: SchematicContext) => { diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts index 12556352ab..543e41427b 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts @@ -10,7 +10,6 @@ export interface Host { read(path: string): Promise; } - export interface Change { apply(host: Host): Promise; @@ -26,7 +25,6 @@ export interface Change { readonly description: string; } - /** * An operation that does nothing. */ @@ -34,15 +32,15 @@ export class NoopChange implements Change { description = 'No operation.'; order = Infinity; path = null; - apply() { return Promise.resolve(); } + apply() { + return Promise.resolve(); + } } - /** * Will add text to the source code. */ export class InsertChange implements Change { - order: number; description: string; @@ -71,7 +69,6 @@ export class InsertChange implements Change { * Will remove text from the source code. */ export class RemoveChange implements Change { - order: number; description: string; @@ -101,8 +98,12 @@ export class ReplaceChange implements Change { order: number; description: string; - constructor(public path: string, private pos: number, private oldText: string, - private newText: string) { + constructor( + public path: string, + private pos: number, + private oldText: string, + private newText: string, + ) { if (pos < 0) { throw new Error('Negative positions are invalid'); } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/dependencies.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/dependencies.ts index 76a60f53e6..9298dba3b8 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/dependencies.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/dependencies.ts @@ -30,7 +30,11 @@ const ALL_DEPENDENCY_TYPE = [ NodeDependencyType.Peer, ]; -export function addPackageJsonDependency(tree: Tree, dependency: NodeDependency, pkgJsonPath = PKG_JSON_PATH): void { +export function addPackageJsonDependency( + tree: Tree, + dependency: NodeDependency, + pkgJsonPath = PKG_JSON_PATH, +): void { const json = new JSONFile(tree, pkgJsonPath); if (json.error) { throw json.error; @@ -43,7 +47,11 @@ export function addPackageJsonDependency(tree: Tree, dependency: NodeDependency, } } -export function removePackageJsonDependency(tree: Tree, name: string, pkgJsonPath = PKG_JSON_PATH): void { +export function removePackageJsonDependency( + tree: Tree, + name: string, + pkgJsonPath = PKG_JSON_PATH, +): void { const json = new JSONFile(tree, pkgJsonPath); if (json.error) { throw json.error; @@ -54,7 +62,11 @@ export function removePackageJsonDependency(tree: Tree, name: string, pkgJsonPat } } -export function getPackageJsonDependency(tree: Tree, name: string, pkgJsonPath = PKG_JSON_PATH): NodeDependency | null { +export function getPackageJsonDependency( + tree: Tree, + name: string, + pkgJsonPath = PKG_JSON_PATH, +): NodeDependency | null { const json = new JSONFile(tree, pkgJsonPath); if (json.error) { throw json.error; diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-file.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-file.ts index 1832f38c5c..25df010315 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-file.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-file.ts @@ -8,7 +8,14 @@ import { JsonValue } from '@angular-devkit/core'; import { Tree } from '@angular-devkit/schematics'; -import { Node, applyEdits, findNodeAtLocation, getNodeValue, modify, parseTree } from 'jsonc-parser'; +import { + Node, + applyEdits, + findNodeAtLocation, + getNodeValue, + modify, + parseTree, +} from 'jsonc-parser'; export type JSONPath = (string | number)[]; @@ -17,10 +24,7 @@ export class JSONFile { private content: string; error: undefined | Error; - constructor( - private readonly host: Tree, - private readonly path: string, - ) { + constructor(private readonly host: Tree, private readonly path: string) { const buffer = this.host.read(this.path); if (buffer) { this.content = buffer.toString(); @@ -50,24 +54,24 @@ export class JSONFile { return node === undefined ? undefined : getNodeValue(node); } - modify(jsonPath: JSONPath, value: JsonValue | undefined, getInsertionIndex?: (properties: string[]) => number): void { + modify( + jsonPath: JSONPath, + value: JsonValue | undefined, + getInsertionIndex?: (properties: string[]) => number, + ): void { if (!getInsertionIndex) { const property = jsonPath.slice(-1)[0]; - getInsertionIndex = properties => [...properties, property].sort().findIndex(p => p === property); + getInsertionIndex = properties => + [...properties, property].sort().findIndex(p => p === property); } - const edits = modify( - this.content, - jsonPath, - value, - { - getInsertionIndex, - formattingOptions: { - insertSpaces: true, - tabSize: 2, - }, + const edits = modify(this.content, jsonPath, value, { + getInsertionIndex, + formattingOptions: { + insertSpaces: true, + tabSize: 2, }, - ); + }); this.content = applyEdits(this.content, edits); this.host.overwrite(this.path, this.content); diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-utils.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-utils.ts index cf1754a9a4..8425032021 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-utils.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-utils.ts @@ -34,10 +34,10 @@ export function appendPropertyInAstObject( const content = _stringifyContent(value, indentStr); recorder.insertRight( index, - (node.properties.length === 0 && indent ? '\n' : '') - + ' '.repeat(indent) - + `"${propertyName}":${indent ? ' ' : ''}${content}` - + indentStr.slice(0, -indent), + (node.properties.length === 0 && indent ? '\n' : '') + + ' '.repeat(indent) + + `"${propertyName}":${indent ? ' ' : ''}${content}` + + indentStr.slice(0, -indent), ); } @@ -48,7 +48,6 @@ export function insertPropertyInAstObjectInOrder( value: JsonValue, indent: number, ) { - if (node.properties.length === 0) { appendPropertyInAstObject(recorder, node, propertyName, value, indent); @@ -81,15 +80,12 @@ export function insertPropertyInAstObjectInOrder( } const indentStr = _buildIndent(indent); - const insertIndex = insertAfterProp === null - ? node.start.offset + 1 - : insertAfterProp.end.offset + 1; + const insertIndex = + insertAfterProp === null ? node.start.offset + 1 : insertAfterProp.end.offset + 1; const content = _stringifyContent(value, indentStr); recorder.insertRight( insertIndex, - indentStr - + `"${propertyName}":${indent ? ' ' : ''}${content}` - + ',', + indentStr + `"${propertyName}":${indent ? ' ' : ''}${content}` + ',', ); } @@ -147,7 +143,6 @@ export function removePropertyInAstObject( } } - export function appendValueInAstArray( recorder: UpdateRecorder, node: JsonAstArray, @@ -167,10 +162,7 @@ export function appendValueInAstArray( if (isClosingOnSameLine && indent) { // Reformat the entire array recorder.remove(node.start.offset, node.end.offset - node.start.offset); - newNodes = [ - ...node.elements.map(({ value }) => value), - value, - ]; + newNodes = [...node.elements.map(({ value }) => value), value]; index = node.start.offset; // In case we are generating the entire node we need to reduce the spacing as // otherwise we'd end up having incorrect double spacing @@ -184,13 +176,12 @@ export function appendValueInAstArray( recorder.insertRight( index, - (newNodes ? '' : indentStr) - + _stringifyContent(newNodes || value, indentStr) - + (node.elements.length === 0 && indent ? indentStr.substr(0, -indent) + '\n' : ''), + (newNodes ? '' : indentStr) + + _stringifyContent(newNodes || value, indentStr) + + (node.elements.length === 0 && indent ? indentStr.substr(0, -indent) + '\n' : ''), ); } - export function findPropertyInAstObject( node: JsonAstObject, propertyName: string, diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/lint-fix.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/lint-fix.ts index f794bf681f..d0998db7ab 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/lint-fix.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/lint-fix.ts @@ -29,12 +29,13 @@ export function applyLintFix(path = '/'): Rule { if (dir === null) { throw new SchematicsException( - 'Asked to run lint fixes, but could not find a tslint.json or tslint.yaml config file.'); + 'Asked to run lint fixes, but could not find a tslint.json or tslint.yaml config file.', + ); } // Only include files that have been touched. const files = tree.actions.reduce((acc: Set, action) => { - const path = action.path.substr(1); // Remove the starting '/'. + const path = action.path.substr(1); // Remove the starting '/'. if (path.endsWith('.ts') && dir && action.path.startsWith(dir.path)) { acc.add(path); } @@ -42,10 +43,12 @@ export function applyLintFix(path = '/'): Rule { return acc; }, new Set()); - context.addTask(new TslintFixTask({ - ignoreErrors: true, - tsConfigPath: 'tsconfig.json', - files: [...files], - })); + context.addTask( + new TslintFixTask({ + ignoreErrors: true, + tsConfigPath: 'tsconfig.json', + files: [...files], + }), + ); }; } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/parse-name.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/parse-name.ts index cac57b0868..65a45c21ee 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/parse-name.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/parse-name.ts @@ -1,4 +1,3 @@ - /** * @license * Copyright Google Inc. All Rights Reserved. diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/tsconfig.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/tsconfig.ts index 4d6679a1d8..290312f3f2 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/tsconfig.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/tsconfig.ts @@ -24,7 +24,9 @@ export function addTsConfigProjectReferences(paths: string[]): Rule { const source = host.read(SOLUTION_TSCONFIG_PATH); if (!source) { // Solution tsconfig doesn't exist. - logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. File doesn't exists.`); + logger.warn( + `Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. File doesn't exists.`, + ); return; } @@ -45,14 +47,16 @@ export function addTsConfigProjectReferences(paths: string[]): Rule { filesAst.elements.length !== 0 || referencesAst?.kind !== 'array' ) { - logger.warn(`Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. It appears to be an invalid solution style tsconfig.`); + logger.warn( + `Cannot add reference '${path}' in '${SOLUTION_TSCONFIG_PATH}'. It appears to be an invalid solution style tsconfig.`, + ); return; } // Append new paths const recorder = host.beginUpdate(SOLUTION_TSCONFIG_PATH); - appendValueInAstArray(recorder, referencesAst, { 'path': `./${path}` }, 4); + appendValueInAstArray(recorder, referencesAst, { path: `./${path}` }, 4); host.commitUpdate(recorder); } }; @@ -66,5 +70,7 @@ export function verifyBaseTsConfigExists(host: Tree): void { return; } - throw new SchematicsException(`Cannot find base TypeScript configuration file 'tsconfig.base.json'.`); + throw new SchematicsException( + `Cannot find base TypeScript configuration file 'tsconfig.base.json'.`, + ); } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/validation.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/validation.ts index 923b819df9..4fa3182a10 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/validation.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/validation.ts @@ -26,7 +26,6 @@ export function validateHtmlSelector(selector: string): void { } } - export function validateProjectName(projectName: string) { const errorIndex = getRegExpFailPosition(projectName); const unsupportedProjectNames: string[] = []; @@ -45,7 +44,8 @@ export function validateProjectName(projectName: string) { throw new SchematicsException(msg); } else if (unsupportedProjectNames.indexOf(projectName) !== -1) { throw new SchematicsException( - `Project name ${JSON.stringify(projectName)} is not a supported name.`); + `Project name ${JSON.stringify(projectName)} is not a supported name.`, + ); } else if (!packageNameRegex.test(projectName)) { throw new SchematicsException(`Project name ${JSON.stringify(projectName)} is invalid.`); } @@ -73,5 +73,5 @@ function getRegExpFailPosition(str: string): number | null { const compare = matched.join('-'); - return (str !== compare) ? compare.length : null; + return str !== compare ? compare.length : null; } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/workspace.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/workspace.ts index 79dbfbb6ad..f2c3403ed9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/workspace.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/workspace.ts @@ -35,18 +35,16 @@ function createHost(tree: Tree): workspaces.WorkspaceHost { export function updateWorkspace( updater: (workspace: workspaces.WorkspaceDefinition) => void | PromiseLike, ): Rule; +export function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule; export function updateWorkspace( - workspace: workspaces.WorkspaceDefinition, -): Rule; -export function updateWorkspace( - updaterOrWorkspace: workspaces.WorkspaceDefinition + updaterOrWorkspace: + | workspaces.WorkspaceDefinition | ((workspace: workspaces.WorkspaceDefinition) => void | PromiseLike), ): Rule { return async (tree: Tree) => { const host = createHost(tree); if (typeof updaterOrWorkspace === 'function') { - const { workspace } = await workspaces.readWorkspace('/', host); const result = updaterOrWorkspace(workspace); @@ -75,7 +73,8 @@ export async function getWorkspace(tree: Tree, path = '/') { */ export function buildDefaultPath(project: workspaces.ProjectDefinition): string { const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`; - const projectDirName = project.extensions['projectType'] === ProjectType.Application ? 'app' : 'lib'; + const projectDirName = + project.extensions['projectType'] === ProjectType.Application ? 'app' : 'lib'; return `${root}${projectDirName}`; } diff --git a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/namespace.ts b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/namespace.ts index 779c7b9770..b646e7ca2d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/namespace.ts +++ b/npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/namespace.ts @@ -2,10 +2,7 @@ import { createTypeParser, removeGenerics } from './type'; export function parseNamespace(solution: string, type: string) { const parseType = createTypeParser(removeGenerics); - let namespace = parseType(type)[0] - .split('.') - .slice(0, -1) - .join('.'); + let namespace = parseType(type)[0].split('.').slice(0, -1).join('.'); if (solution === namespace) return ''; diff --git a/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/email-settings.service.ts b/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/email-settings.service.ts index a9967ef6a4..a681a32c8d 100644 --- a/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/email-settings.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/email-settings.service.ts @@ -9,19 +9,23 @@ export class EmailSettingsService { apiName = 'SettingManagement'; get = () => - this.restService.request({ - method: 'GET', - url: '/api/setting-management/emailing', - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: '/api/setting-management/emailing', + }, + { apiName: this.apiName }, + ); update = (input: UpdateEmailSettingsDto) => - this.restService.request({ - method: 'POST', - url: '/api/setting-management/emailing', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/setting-management/emailing', + body: input, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/models.ts b/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/models.ts index 99e2268d0e..9a87f0d345 100644 --- a/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/models.ts +++ b/npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/models.ts @@ -1,4 +1,3 @@ - export interface EmailSettingsDto { smtpHost?: string; smtpPort: number; diff --git a/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/proxy/tenant.service.ts b/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/proxy/tenant.service.ts index 61d1667be4..1559bd3eb9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/proxy/tenant.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/proxy/tenant.service.ts @@ -10,65 +10,86 @@ export class TenantService { apiName = 'AbpTenantManagement'; create = (input: TenantCreateDto) => - this.restService.request({ - method: 'POST', - url: '/api/multi-tenancy/tenants', - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'POST', + url: '/api/multi-tenancy/tenants', + body: input, + }, + { apiName: this.apiName }, + ); delete = (id: string) => - this.restService.request({ - method: 'DELETE', - url: `/api/multi-tenancy/tenants/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'DELETE', + url: `/api/multi-tenancy/tenants/${id}`, + }, + { apiName: this.apiName }, + ); deleteDefaultConnectionString = (id: string) => - this.restService.request({ - method: 'DELETE', - url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'DELETE', + url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, + }, + { apiName: this.apiName }, + ); get = (id: string) => - this.restService.request({ - method: 'GET', - url: `/api/multi-tenancy/tenants/${id}`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + url: `/api/multi-tenancy/tenants/${id}`, + }, + { apiName: this.apiName }, + ); getDefaultConnectionString = (id: string) => - this.restService.request({ - method: 'GET', - responseType: 'text', - url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'GET', + responseType: 'text', + url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, + }, + { apiName: this.apiName }, + ); getList = (input: GetTenantsInput) => - this.restService.request>({ - method: 'GET', - url: '/api/multi-tenancy/tenants', - params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, - }, - { apiName: this.apiName }); + this.restService.request>( + { + method: 'GET', + url: '/api/multi-tenancy/tenants', + params: { + filter: input.filter, + sorting: input.sorting, + skipCount: input.skipCount, + maxResultCount: input.maxResultCount, + }, + }, + { apiName: this.apiName }, + ); update = (id: string, input: TenantUpdateDto) => - this.restService.request({ - method: 'PUT', - url: `/api/multi-tenancy/tenants/${id}`, - body: input, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: `/api/multi-tenancy/tenants/${id}`, + body: input, + }, + { apiName: this.apiName }, + ); updateDefaultConnectionString = (id: string, defaultConnectionString: string) => - this.restService.request({ - method: 'PUT', - url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, - params: { defaultConnectionString }, - }, - { apiName: this.apiName }); + this.restService.request( + { + method: 'PUT', + url: `/api/multi-tenancy/tenants/${id}/default-connection-string`, + params: { defaultConnectionString }, + }, + { apiName: this.apiName }, + ); constructor(private restService: RestService) {} } diff --git a/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/tokens/extensions.token.ts b/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/tokens/extensions.token.ts index fb79b126d9..fec18d94fc 100644 --- a/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/tokens/extensions.token.ts +++ b/npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/tokens/extensions.token.ts @@ -36,25 +36,20 @@ export const DEFAULT_TENANT_MANAGEMENT_EDIT_FORM_PROPS = { [eTenantManagementComponents.Tenants]: DEFAULT_TENANTS_EDIT_FORM_PROPS, }; -export const TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS = new InjectionToken( - 'TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS', -); +export const TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS = + new InjectionToken('TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS'); -export const TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS = new InjectionToken( - 'TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS', -); +export const TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS = + new InjectionToken('TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS'); -export const TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS = new InjectionToken( - 'TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS', -); +export const TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS = + new InjectionToken('TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS'); -export const TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS = new InjectionToken( - 'TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS', -); +export const TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS = + new InjectionToken('TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS'); -export const TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS = new InjectionToken( - 'TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS', -); +export const TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS = + new InjectionToken('TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS'); // Fix for TS4023 -> https://github.com/microsoft/TypeScript/issues/9944#issuecomment-254693497 type EntityActionContributors = Partial<{ diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/date-time.adapter.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/date-time.adapter.ts index 11da774d1b..10b39627e3 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/date-time.adapter.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/date-time.adapter.ts @@ -10,7 +10,7 @@ export class DateTimeAdapter { const date = new Date(value); - if (isNaN((date as unknown) as number)) return null; + if (isNaN(date as unknown as number)) return null; this.value = { year: date.getFullYear(), diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/time.adapter.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/time.adapter.ts index 33c25ddd8c..704d2b6167 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/time.adapter.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/time.adapter.ts @@ -11,7 +11,7 @@ export class TimeAdapter extends NgbTimeAdapter { ? new Date(0, 0, 1, ...value.split(':').map(Number)) : new Date(value); - if (isNaN((date as unknown) as number)) return null; + if (isNaN(date as unknown as number)) return null; return { hour: date.getHours(), diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/components/abstract-actions/abstract-actions.component.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/components/abstract-actions/abstract-actions.component.ts index 14d680059a..21399c56f5 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/components/abstract-actions/abstract-actions.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/components/abstract-actions/abstract-actions.component.ts @@ -24,7 +24,7 @@ export abstract class AbstractActionsComponent> extend const extensions = injector.get(ExtensionsService); const name = injector.get(EXTENSIONS_IDENTIFIER); const type = injector.get(EXTENSIONS_ACTION_TYPE); - this.actionList = (extensions[type].get(name).actions as unknown) as L; + this.actionList = extensions[type].get(name).actions as unknown as L; } } diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/directives/prop-data.directive.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/directives/prop-data.directive.ts index 8de502f14b..8f57dfda88 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/directives/prop-data.directive.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/directives/prop-data.directive.ts @@ -13,8 +13,10 @@ import { PropData, PropList } from '../models/props'; exportAs: 'abpPropData', selector: '[abpPropData]', }) -export class PropDataDirective> extends PropData> - implements OnChanges, OnDestroy { +export class PropDataDirective> + extends PropData> + implements OnChanges, OnDestroy +{ /* tslint:disable:no-input-rename */ @Input('abpPropDataFromList') readonly propList: L; diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts index 4920687077..96d83ba8f7 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts @@ -192,7 +192,7 @@ function createPropertiesToContributorsMapper( } function getTypeFromProperty(property: ObjectExtensions.ExtensionPropertyDto): ePropType { - return (property.typeSimple.replace(/\?$/, '') as string) as ePropType; + return property.typeSimple.replace(/\?$/, '') as string as ePropType; } function isUndefined(obj: any): obj is undefined { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/actions.util.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/actions.util.spec.ts index fd3b27c564..5a79556071 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/actions.util.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/actions.util.spec.ts @@ -16,8 +16,8 @@ describe('Entity Action Utils', () => { it('should merge default actions with action contributors', () => { const defaults: EntityActionDefaults = { - x: [(1 as any) as EntityAction, (2 as any) as EntityAction, (3 as any) as EntityAction], - y: [(1 as any) as EntityAction, (2 as any) as EntityAction, (3 as any) as EntityAction], + x: [1 as any as EntityAction, 2 as any as EntityAction, 3 as any as EntityAction], + y: [1 as any as EntityAction, 2 as any as EntityAction, 3 as any as EntityAction], }; const contributors1: EntityActionContributorCallbacks = { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/enum.util.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/enum.util.spec.ts index 3cb377d300..e89efb5467 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/enum.util.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/enum.util.spec.ts @@ -2,11 +2,7 @@ import { ConfigStateService, LocalizationService } from '@abp/ng.core'; import { BehaviorSubject } from 'rxjs'; import { take } from 'rxjs/operators'; import { PropData } from '../lib/models/props'; -import { - createEnum, - createEnumOptions, - createEnumValueResolver, -} from '../lib/utils/enum.util'; +import { createEnum, createEnumOptions, createEnumValueResolver } from '../lib/utils/enum.util'; const mockSessionState = { languageChange$: new BehaviorSubject('tr'), @@ -53,12 +49,9 @@ describe('Enum Utils', () => { ${1} | ${'foo'} ${2} | ${'bar'} ${3} | ${'baz'} - `( - 'should create an enum that returns $expected when $key is accessed', - ({ key, expected }) => { - expect(enumFromFields[key]).toBe(expected); - } - ); + `('should create an enum that returns $expected when $key is accessed', ({ key, expected }) => { + expect(enumFromFields[key]).toBe(expected); + }); }); describe('#createEnumValueResolver', () => { @@ -78,19 +71,17 @@ describe('Enum Utils', () => { localizationResource: null, transformed: createEnum(fields), }, - 'EnumProp' + 'EnumProp', ); const propData = new MockPropData({ extraProperties: { EnumProp: value }, }); propData.getInjected = () => service as any; - const resolved = await valueResolver(propData) - .pipe(take(1)) - .toPromise(); + const resolved = await valueResolver(propData).pipe(take(1)).toPromise(); expect(resolved).toBe(expected); - } + }, ); }); @@ -121,11 +112,5 @@ function createMockLocalizationService() { const configState = new ConfigStateService(null); configState.setState({ localization: mockL10n } as any); - return new LocalizationService( - mockSessionState, - null, - null, - configState, - null - ); + return new LocalizationService(mockSessionState, null, null, configState, null); } diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/props.util.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/props.util.spec.ts index 0c18d71eb5..fc2b9a3282 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/props.util.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/props.util.spec.ts @@ -35,8 +35,8 @@ describe('Entity Prop Utils', () => { it('should merge default props with prop contributors', () => { const defaults: EntityPropDefaults = { - x: [(1 as any) as EntityProp, (2 as any) as EntityProp, (3 as any) as EntityProp], - y: [(1 as any) as EntityProp, (2 as any) as EntityProp, (3 as any) as EntityProp], + x: [1 as any as EntityProp, 2 as any as EntityProp, 3 as any as EntityProp], + y: [1 as any as EntityProp, 2 as any as EntityProp, 3 as any as EntityProp], }; const contributors1: EntityPropContributorCallbacks = { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/state.util.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/state.util.spec.ts index 5e8174adff..000b4b4255 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/state.util.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/state.util.spec.ts @@ -18,27 +18,21 @@ describe('State Utils', () => { it('should return observable entities of an existing module', async () => { const entities = await getObjectExtensionEntitiesFromStore( configState, - 'Identity' + 'Identity', ).toPromise(); expect('Role' in entities).toBe(true); }); it('should return observable empty object if module does not exist', async () => { - const entities = await getObjectExtensionEntitiesFromStore( - configState, - 'Saas' - ).toPromise(); + const entities = await getObjectExtensionEntitiesFromStore(configState, 'Saas').toPromise(); expect(entities).toEqual({}); }); - it('should not emit when object extensions do not exist', (done) => { + it('should not emit when object extensions do not exist', done => { const emptyConfigState = new ConfigStateService(null); const emit = jest.fn(); - getObjectExtensionEntitiesFromStore( - emptyConfigState, - 'Identity' - ).subscribe(emit); + getObjectExtensionEntitiesFromStore(emptyConfigState, 'Identity').subscribe(emit); setTimeout(() => { expect(emit).not.toHaveBeenCalled(); @@ -54,7 +48,7 @@ describe('State Utils', () => { .toPromise(); const propList = new EntityPropList(); - contributors.prop.Role.forEach((callback) => callback(propList)); + contributors.prop.Role.forEach(callback => callback(propList)); expect(propList.length).toBe(4); expect(propList.head.value.name).toBe('Title'); @@ -63,9 +57,7 @@ describe('State Utils', () => { expect(propList.head.next.next.next.value.name).toBe('Foo_Text'); const createFormList = new FormPropList(); - contributors.createForm.Role.forEach((callback) => - callback(createFormList) - ); + contributors.createForm.Role.forEach(callback => callback(createFormList)); expect(createFormList.length).toBe(4); expect(createFormList.head.value.name).toBe('Title'); @@ -74,7 +66,7 @@ describe('State Utils', () => { expect(createFormList.head.next.next.next.value.name).toBe('Foo_Text'); const editFormList = new FormPropList(); - contributors.editForm.Role.forEach((callback) => callback(editFormList)); + contributors.editForm.Role.forEach(callback => callback(editFormList)); expect(editFormList.length).toBe(4); expect(editFormList.head.value.name).toBe('Title'); @@ -126,10 +118,7 @@ function createMockState() { }; } -function createMockEntities(): Record< - string, - ObjectExtensions.EntityExtensionDto -> { +function createMockEntities(): Record { return { Role: { properties: { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts index c539725a0a..f983be7fc5 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts @@ -8,16 +8,16 @@ export const bounceIn = animation( keyframes([ style({ opacity: '0', transform: '{{ transform }} scale(0.0)', offset: 0 }), style({ opacity: '0', transform: '{{ transform }} scale(0.8)', offset: 0.5 }), - style({ opacity: '1', transform: '{{ transform }} scale(1.0)', offset: 1 }) - ]) - ) + style({ opacity: '1', transform: '{{ transform }} scale(1.0)', offset: 1 }), + ]), + ), ], { params: { time: '350ms', easing: 'cubic-bezier(.7,.31,.72,1.47)', display: 'block', - transform: 'translate(-50%, -50%)' - } - } + transform: 'translate(-50%, -50%)', + }, + }, ); diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts index 3321974a77..b1d9f876fc 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts @@ -1,8 +1,11 @@ import { animate, animation, style } from '@angular/animations'; -export const fadeIn = animation([style({ opacity: '0' }), animate('{{ time}} {{ easing }}', style({ opacity: '1' }))], { - params: { time: '350ms', easing: 'ease' }, -}); +export const fadeIn = animation( + [style({ opacity: '0' }), animate('{{ time}} {{ easing }}', style({ opacity: '1' }))], + { + params: { time: '350ms', easing: 'ease' }, + }, +); export const fadeOut = animation( [style({ opacity: '1' }), animate('{{ time}} {{ easing }}', style({ opacity: '0' }))], @@ -12,7 +15,10 @@ export const fadeOut = animation( export const fadeInDown = animation( [ style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -20,7 +26,10 @@ export const fadeInDown = animation( export const fadeInUp = animation( [ style({ opacity: '0', transform: '{{ transform }} translateY(20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -28,7 +37,10 @@ export const fadeInUp = animation( export const fadeInLeft = animation( [ style({ opacity: '0', transform: '{{ transform }} translateX(20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -36,7 +48,10 @@ export const fadeInLeft = animation( export const fadeInRight = animation( [ style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -44,7 +59,10 @@ export const fadeInRight = animation( export const fadeOutDown = animation( [ style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(20px)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '0', transform: '{{ transform }} translateY(20px)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -52,7 +70,10 @@ export const fadeOutDown = animation( export const fadeOutUp = animation( [ style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -60,7 +81,10 @@ export const fadeOutUp = animation( export const fadeOutLeft = animation( [ style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(20px)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '0', transform: '{{ transform }} translateX(20px)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); @@ -68,7 +92,10 @@ export const fadeOutLeft = animation( export const fadeOutRight = animation( [ style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' })), + animate( + '{{ time }} {{ easing }}', + style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' }), + ), ], { params: { time: '350ms', easing: 'ease', transform: '' } }, ); diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts index 0a8fe44b2c..234bad0825 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts @@ -21,9 +21,7 @@ import { debounceTime, filter } from 'rxjs/operators'; styleUrls: ['http-error-wrapper.component.scss'], providers: [SubscriptionService], }) -export class HttpErrorWrapperComponent - implements AfterViewInit, OnDestroy, OnInit -{ +export class HttpErrorWrapperComponent implements AfterViewInit, OnDestroy, OnInit { appRef: ApplicationRef; cfRes: ComponentFactoryResolver; @@ -57,9 +55,7 @@ export class HttpErrorWrapperComponent ngOnInit() { this.backgroundColor = - window - .getComputedStyle(document.body) - ?.getPropertyValue('background-color') || '#fff'; + window.getComputedStyle(document.body)?.getPropertyValue('background-color') || '#fff'; } ngAfterViewInit() { @@ -71,14 +67,14 @@ export class HttpErrorWrapperComponent customComponentRef.instance.destroy$ = this.destroy$; this.appRef.attachView(customComponentRef.hostView); this.containerRef.nativeElement.appendChild( - (customComponentRef.hostView as EmbeddedViewRef).rootNodes[0] + (customComponentRef.hostView as EmbeddedViewRef).rootNodes[0], ); customComponentRef.changeDetectorRef.detectChanges(); } const keyup$ = fromEvent(document, 'keyup').pipe( debounceTime(150), - filter((key: KeyboardEvent) => key && key.key === 'Escape') + filter((key: KeyboardEvent) => key && key.key === 'Escape'), ); this.subscription.addOne(keyup$, () => this.destroy()); } diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index feb4ba5fd8..44aea4d9f7 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -12,7 +12,7 @@ import { Optional, Output, TemplateRef, - ViewChild + ViewChild, } from '@angular/core'; import { NgbModal, NgbModalOptions, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { fromEvent, Subject } from 'rxjs'; diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts index b7a98ac733..ed4430aa92 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts @@ -27,7 +27,7 @@ export class ToasterService implements ToasterContract { this.containerComponentRef = this.contentProjectionService.projectContent( PROJECTION_STRATEGY.AppendComponentToBody(ToastContainerComponent, { toasts$: this.toasts$, - }) + }), ); this.containerComponentRef.changeDetectorRef.detectChanges(); @@ -42,7 +42,7 @@ export class ToasterService implements ToasterContract { info( message: LocalizationParam, title?: LocalizationParam, - options?: Partial + options?: Partial, ): Toaster.ToasterId { return this.show(message, title, 'info', options); } @@ -56,7 +56,7 @@ export class ToasterService implements ToasterContract { success( message: LocalizationParam, title?: LocalizationParam, - options?: Partial + options?: Partial, ): Toaster.ToasterId { return this.show(message, title, 'success', options); } @@ -70,7 +70,7 @@ export class ToasterService implements ToasterContract { warn( message: LocalizationParam, title?: LocalizationParam, - options?: Partial + options?: Partial, ): Toaster.ToasterId { return this.show(message, title, 'warning', options); } @@ -84,7 +84,7 @@ export class ToasterService implements ToasterContract { error( message: LocalizationParam, title?: LocalizationParam, - options?: Partial + options?: Partial, ): Toaster.ToasterId { return this.show(message, title, 'error', options); } @@ -101,7 +101,7 @@ export class ToasterService implements ToasterContract { message: LocalizationParam, title: LocalizationParam = null, severity: Toaster.Severity = 'neutral', - options = {} as Partial + options = {} as Partial, ): Toaster.ToasterId { if (!this.containerComponentRef) this.setContainer(); @@ -121,7 +121,7 @@ export class ToasterService implements ToasterContract { * @param id ID of the toast to be removed. */ remove(id: number): void { - this.toasts = this.toasts.filter((toast) => toast.options?.id !== id); + this.toasts = this.toasts.filter(toast => toast.options?.id !== id); this.toasts$.next(this.toasts); } @@ -131,9 +131,7 @@ export class ToasterService implements ToasterContract { clear(containerKey?: string): void { this.toasts = !containerKey ? [] - : this.toasts.filter( - (toast) => toast.options?.containerKey !== containerKey - ); + : this.toasts.filter(toast => toast.options?.containerKey !== containerKey); this.toasts$.next(this.toasts); } } diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts index c272b665e7..32c75dafb1 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts @@ -8,9 +8,12 @@ describe('ButtonComponent', () => { beforeEach( () => - (spectator = createHost('Button', { - hostProps: { attributes: { autofocus: '', name: 'abp-button' } }, - })), + (spectator = createHost( + 'Button', + { + hostProps: { attributes: { autofocus: '', name: 'abp-button' } }, + }, + )), ); it('should display the button', () => { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/chart.component.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/chart.component.spec.ts index 1aab771307..083d810043 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/chart.component.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/chart.component.spec.ts @@ -8,7 +8,7 @@ declare const Chart; Object.defineProperty(window, 'getComputedStyle', { value: () => ({ - getPropertyValue: (prop) => { + getPropertyValue: prop => { return ''; }, }), @@ -20,23 +20,20 @@ describe('ChartComponent', () => { beforeEach(() => { (widgetUtils as any).chartJsLoaded$ = new ReplaySubject(1); - spectator = createHost( - '', - { - hostProps: { - data: { - datasets: [ - { - data: [11], - backgroundColor: ['#FF6384'], - label: 'My dataset', - }, - ], - labels: ['Red'], - }, + spectator = createHost('', { + hostProps: { + data: { + datasets: [ + { + data: [11], + backgroundColor: ['#FF6384'], + label: 'My dataset', + }, + ], + labels: ['Red'], }, - } - ); + }, + }); }); test('should throw error when chart.js is not loaded', () => { @@ -47,7 +44,7 @@ describe('ChartComponent', () => { } }); - test('should have a success class by default', (done) => { + test('should have a success class by default', done => { import('chart.js').then(() => { chartJsLoaded$.next(); setTimeout(() => { @@ -58,7 +55,7 @@ describe('ChartComponent', () => { }); describe('#reinit', () => { - it('should call the destroy method', (done) => { + it('should call the destroy method', done => { chartJsLoaded$.next(); const spy = jest.spyOn(spectator.component.chart, 'destroy'); spectator.setHostInput({ @@ -81,7 +78,7 @@ describe('ChartComponent', () => { }); describe('#refresh', () => { - it('should call the update method', (done) => { + it('should call the update method', done => { chartJsLoaded$.next(); const spy = jest.spyOn(spectator.component.chart, 'update'); spectator.component.refresh(); @@ -93,7 +90,7 @@ describe('ChartComponent', () => { }); describe('#generateLegend', () => { - it('should call the generateLegend method', (done) => { + it('should call the generateLegend method', done => { chartJsLoaded$.next(); const spy = jest.spyOn(spectator.component.chart, 'generateLegend'); spectator.component.generateLegend(); @@ -105,7 +102,7 @@ describe('ChartComponent', () => { }); describe('#onCanvasClick', () => { - it('should emit the onDataSelect', (done) => { + it('should emit the onDataSelect', done => { spectator.component.onDataSelect.subscribe(() => { done(); }); @@ -119,7 +116,7 @@ describe('ChartComponent', () => { }); describe('#base64Image', () => { - it('should return the base64 image', (done) => { + it('should return the base64 image', done => { chartJsLoaded$.next(); setTimeout(() => { diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts index efb0c20380..937da926d9 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts @@ -50,7 +50,7 @@ describe('ConfirmationService', () => { { cancelText: 'CANCEL', yesText: 'YES', - } + }, ); tick(); @@ -67,19 +67,16 @@ describe('ConfirmationService', () => { ${'success'} | ${'.success'} | ${'.fa-check-circle'} ${'warn'} | ${'.warning'} | ${'.fa-exclamation-triangle'} ${'error'} | ${'.error'} | ${'.fa-times-circle'} - `( - 'should display $type confirmation popup', - async ({ type, selector, icon }) => { - service[type]('MESSAGE', 'TITLE'); + `('should display $type confirmation popup', async ({ type, selector, icon }) => { + service[type]('MESSAGE', 'TITLE'); - await timer(0).toPromise(); + await timer(0).toPromise(); - expect(selectConfirmationContent('.title')).toBe('TITLE'); - expect(selectConfirmationContent('.message')).toBe('MESSAGE'); - expect(selectConfirmationElement(selector)).toBeTruthy(); - expect(selectConfirmationElement(icon)).toBeTruthy(); - } - ); + expect(selectConfirmationContent('.title')).toBe('TITLE'); + expect(selectConfirmationContent('.message')).toBe('MESSAGE'); + expect(selectConfirmationElement(selector)).toBeTruthy(); + expect(selectConfirmationElement(icon)).toBeTruthy(); + }); // test('should close with ESC key', (done) => { // service @@ -94,13 +91,11 @@ describe('ConfirmationService', () => { // document.dispatchEvent(escape); // }); - test('should close when click cancel button', (done) => { - service - .info('', '', { yesText: 'Sure', cancelText: 'Exit' }) - .subscribe((status) => { - expect(status).toBe(Confirmation.Status.reject); - done(); - }); + test('should close when click cancel button', done => { + service.info('', '', { yesText: 'Sure', cancelText: 'Exit' }).subscribe(status => { + expect(status).toBe(Confirmation.Status.reject); + done(); + }); timer(0).subscribe(() => { expect(selectConfirmationContent('button#cancel')).toBe('Exit'); @@ -122,22 +117,18 @@ describe('ConfirmationService', () => { service.info('', '', { dismissible }); expect(spy).toHaveBeenCalledTimes(count); - } + }, ); }); function clearElements(selector = '.confirmation') { - document - .querySelectorAll(selector) - .forEach((element) => element.parentNode.removeChild(element)); + document.querySelectorAll(selector).forEach(element => element.parentNode.removeChild(element)); } function selectConfirmationContent(selector = '.confirmation'): string { return selectConfirmationElement(selector).textContent.trim(); } -function selectConfirmationElement( - selector = '.confirmation' -): T { +function selectConfirmationElement(selector = '.confirmation'): T { return document.querySelector(selector); } diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts index 0316ad5e9b..b9e1c0af9a 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts @@ -28,7 +28,7 @@ describe('ErrorComponent', () => { }); describe('#destroy', () => { - it('should be call when pressed the esc key', (done) => { + it('should be call when pressed the esc key', done => { spectator.component.destroy$.subscribe(() => { done(); }); @@ -36,7 +36,7 @@ describe('ErrorComponent', () => { spectator.keyboard.pressEscape(); }); - it('should be call when clicked the close button', (done) => { + it('should be call when clicked the close button', done => { spectator.component.destroy$.subscribe(() => { done(); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts index dbfb5e43f3..2d2be39f59 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts @@ -8,11 +8,7 @@ import { NgxsModule, Store } from '@ngxs/store'; import { OAuthService } from 'angular-oauth2-oidc'; import { of } from 'rxjs'; import { HttpErrorWrapperComponent } from '../components/http-error-wrapper/http-error-wrapper.component'; -import { - DEFAULT_ERROR_LOCALIZATIONS, - DEFAULT_ERROR_MESSAGES, - ErrorHandler, -} from '../handlers'; +import { DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, ErrorHandler } from '../handlers'; import { ConfirmationService } from '../services'; import { httpErrorConfigFactory } from '../tokens/http-error.token'; @@ -35,11 +31,7 @@ const CONFIRMATION_BUTTONS = { describe('ErrorHandler', () => { const createService = createServiceFactory({ service: ErrorHandler, - imports: [ - NgxsModule.forRoot([]), - CoreTestingModule.withConfig(), - MockModule, - ], + imports: [NgxsModule.forRoot([]), CoreTestingModule.withConfig(), MockModule], mocks: [OAuthService], providers: [ { provide: APP_BASE_HREF, useValue: '/' }, @@ -146,7 +138,7 @@ describe('ErrorHandler', () => { key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title, defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title, }, - CONFIRMATION_BUTTONS + CONFIRMATION_BUTTONS, ); }); @@ -162,7 +154,7 @@ describe('ErrorHandler', () => { key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, }, - CONFIRMATION_BUTTONS + CONFIRMATION_BUTTONS, ); }); @@ -178,7 +170,7 @@ describe('ErrorHandler', () => { key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.details, defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details, }, - CONFIRMATION_BUTTONS + CONFIRMATION_BUTTONS, ); }); @@ -186,9 +178,7 @@ describe('ErrorHandler', () => { const headers: HttpHeaders = new HttpHeaders({ _AbpErrorFormat: '_AbpErrorFormat', }); - store.dispatch( - new RestOccurError(new HttpErrorResponse({ status: 401, headers })) - ); + store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 401, headers }))); expect(errorConfirmation).toHaveBeenCalledWith( { @@ -196,7 +186,7 @@ describe('ErrorHandler', () => { defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, }, null, - CONFIRMATION_BUTTONS + CONFIRMATION_BUTTONS, ); }); @@ -209,14 +199,14 @@ describe('ErrorHandler', () => { error: { error: { message: 'test message', details: 'test detail' } }, status: 412, headers, - }) - ) + }), + ), ); expect(errorConfirmation).toHaveBeenCalledWith( 'test detail', 'test message', - CONFIRMATION_BUTTONS + CONFIRMATION_BUTTONS, ); }); }); diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/lazy-style.handler.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/lazy-style.handler.spec.ts index 1c120db08f..ea02893f90 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/lazy-style.handler.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/lazy-style.handler.spec.ts @@ -50,7 +50,7 @@ describe('LazyStyleHandler', () => { describe('initLazyStyleHandler', () => { it('should return a LazyStyleHandler factory', () => { - const generator = (function*() { + const generator = (function* () { yield undefined; // LAZY_STYLES yield { loaded: new Map() }; // LazyLoadService yield { currentLang: 'en', languageChange$: EMPTY }; // LocalizationService diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts index 14a6193f68..3fdf0a6cb6 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts @@ -5,11 +5,7 @@ import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; import { fromEvent, Subject, timer } from 'rxjs'; import { delay, reduce, take } from 'rxjs/operators'; -import { - ButtonComponent, - ConfirmationComponent, - ModalComponent, -} from '../components'; +import { ButtonComponent, ConfirmationComponent, ModalComponent } from '../components'; import { Confirmation } from '../models'; import { ConfirmationService } from '../services'; @@ -69,7 +65,7 @@ describe('ModalComponent', () => { appearFn, disappearFn, }, - } + }, ); await wait0ms(); @@ -161,11 +157,7 @@ describe('ModalComponent', () => { it('should close with esc key', async () => { await wait0ms(); - spectator.dispatchKeyboardEvent( - spectator.component.modalWindowRef, - 'keyup', - 'Escape' - ); + spectator.dispatchKeyboardEvent(spectator.component.modalWindowRef, 'keyup', 'Escape'); await wait300ms(); @@ -183,12 +175,12 @@ describe('ModalComponent', () => { expect(disappearFn).not.toHaveBeenCalled(); }); - xit('should not let window unload when form is dirty', (done) => { + xit('should not let window unload when form is dirty', done => { fromEvent(window, 'beforeunload') .pipe( take(2), delay(0), - reduce((acc, v) => acc.concat(v), []) + reduce((acc, v) => acc.concat(v), []), ) .subscribe(([event1, event2]) => { expect(event1.returnValue).toBe(false); diff --git a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts index cf8565435a..b095ae821c 100644 --- a/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts +++ b/npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts @@ -44,9 +44,8 @@ export class DateParserFormatter extends NgbDateParserFormatter { format(date: NgbDateStruct): string { if (!date) return ''; - const localization: ApplicationLocalizationConfigurationDto = this.configState.getOne( - 'localization', - ); + const localization: ApplicationLocalizationConfigurationDto = + this.configState.getOne('localization'); const dateFormat = snq(() => localization.currentCulture.dateTimeFormat.shortDatePattern) || 'yyyy-MM-dd';