Browse Source

reformat all files

pull/9837/head
mehmet-erim 5 years ago
parent
commit
c4eab6766b
  1. 14
      npm/ng-packs/nx/ng-packs/apps/dev-app/src/app/shared/shared.module.ts
  2. 2
      npm/ng-packs/nx/ng-packs/apps/dev-app/src/main.ts
  3. 3
      npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts
  4. 3
      npm/ng-packs/nx/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts
  5. 42
      npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/account.service.ts
  6. 40
      npm/ng-packs/nx/ng-packs/packages/account/src/lib/proxy/account/web/areas/account/controllers/account.service.ts
  7. 12
      npm/ng-packs/nx/ng-packs/packages/components/page/src/page-parts.component.ts
  8. 11
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts
  9. 5
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts
  10. 4
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/components/router-outlet.component.ts
  11. 18
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/debounce.directive.ts
  12. 9
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts
  13. 38
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/for.directive.ts
  14. 17
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts
  15. 24
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts
  16. 6
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts
  17. 1
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.ts
  18. 1
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/localization/models.ts
  19. 1
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts
  20. 15
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/states/config.state.ts
  21. 2
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts
  22. 12
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts
  23. 4
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts
  24. 9
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/for.directive.spec.ts
  25. 39
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts
  26. 4
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts
  27. 19
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts
  28. 51
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts
  29. 39
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts
  30. 2
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts
  31. 9
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts
  32. 6
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts
  33. 8
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts
  34. 4
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/tests/utils/common.utils.ts
  35. 2
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/common-utils.ts
  36. 2
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/date-extensions.ts
  37. 2
      npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts
  38. 3
      npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts
  39. 30
      npm/ng-packs/nx/ng-packs/packages/feature-management/src/lib/proxy/feature-management/features.service.ts
  40. 82
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-role.service.ts
  41. 57
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user-lookup.service.ts
  42. 136
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/identity-user.service.ts
  43. 40
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/identity/profile.service.ts
  44. 1
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/proxy/users/models.ts
  45. 5
      npm/ng-packs/nx/ng-packs/packages/identity/src/lib/tokens/extensions.token.ts
  46. 7
      npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts
  47. 1
      npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/models.ts
  48. 30
      npm/ng-packs/nx/ng-packs/packages/permission-management/src/lib/proxy/permissions.service.ts
  49. 2
      npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-add/index.ts
  50. 2
      npm/ng-packs/nx/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts
  51. 17
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts
  52. 18
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/dependencies.ts
  53. 40
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-file.ts
  54. 31
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/json-utils.ts
  55. 17
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/lint-fix.ts
  56. 1
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/parse-name.ts
  57. 14
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/tsconfig.ts
  58. 6
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/validation.ts
  59. 11
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/workspace.ts
  60. 5
      npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/namespace.ts
  61. 26
      npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/email-settings.service.ts
  62. 1
      npm/ng-packs/nx/ng-packs/packages/setting-management/config/src/proxy/models.ts
  63. 111
      npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/proxy/tenant.service.ts
  64. 25
      npm/ng-packs/nx/ng-packs/packages/tenant-management/src/lib/tokens/extensions.token.ts
  65. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/date-time.adapter.ts
  66. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/adapters/time.adapter.ts
  67. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/components/abstract-actions/abstract-actions.component.ts
  68. 6
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/directives/prop-data.directive.ts
  69. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts
  70. 4
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/actions.util.spec.ts
  71. 31
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/enum.util.spec.ts
  72. 4
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/props.util.spec.ts
  73. 27
      npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/tests/state.util.spec.ts
  74. 12
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts
  75. 49
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts
  76. 12
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts
  77. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
  78. 18
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts
  79. 9
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts
  80. 43
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/chart.component.spec.ts
  81. 43
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts
  82. 4
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts
  83. 30
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts
  84. 2
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/lazy-style.handler.spec.ts
  85. 18
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts
  86. 5
      npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts

14
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 {}

2
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));

3
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;

3
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;

42
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<any, IdentityUserDto>({
method: 'POST',
url: '/api/account/register',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'POST',
url: '/api/account/register',
body: input,
},
{ apiName: this.apiName },
);
resetPassword = (input: ResetPasswordDto) =>
this.restService.request<any, void>({
method: 'POST',
url: '/api/account/reset-password',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/account/reset-password',
body: input,
},
{ apiName: this.apiName },
);
sendPasswordResetCode = (input: SendPasswordResetCodeDto) =>
this.restService.request<any, void>({
method: 'POST',
url: '/api/account/send-password-reset-code',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/account/send-password-reset-code',
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

40
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<any, AbpLoginResult>({
method: 'POST',
url: '/api/account/check-password',
body: login,
},
{ apiName: this.apiName });
this.restService.request<any, AbpLoginResult>(
{
method: 'POST',
url: '/api/account/check-password',
body: login,
},
{ apiName: this.apiName },
);
loginByLogin = (login: UserLoginInfo) =>
this.restService.request<any, AbpLoginResult>({
method: 'POST',
url: '/api/account/login',
body: login,
},
{ apiName: this.apiName });
this.restService.request<any, AbpLoginResult>(
{
method: 'POST',
url: '/api/account/login',
body: login,
},
{ apiName: this.apiName },
);
logout = () =>
this.restService.request<any, void>({
method: 'GET',
url: '/api/account/logout',
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'GET',
url: '/api/account/logout',
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

12
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: `
<ng-content></ng-content>
`,
template: ` <ng-content></ng-content> `,
encapsulation: ViewEncapsulation.None,
})
export class PageTitleContainerComponent {}
@Component({
selector: 'abp-page-breadcrumb-container',
template: `
<ng-content></ng-content>
`,
template: ` <ng-content></ng-content> `,
encapsulation: ViewEncapsulation.None,
})
export class PageBreadcrumbContainerComponent {}
@Component({
selector: 'abp-page-toolbar-container',
template: `
<ng-content></ng-content>
`,
template: ` <ng-content></ng-content> `,
encapsulation: ViewEncapsulation.None,
})
export class PageToolbarContainerComponent {}

11
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<T = any, U = T>
implements ControlValueAccessor
{
export class AbstractNgModelComponent<T = any, U = T> implements ControlValueAccessor {
protected _value: T;
protected cdRef: ChangeDetectorRef;
onChange: (value: T) => void;
@ -19,17 +17,16 @@ export class AbstractNgModelComponent<T = any, U = T>
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();

5
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)

4
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: `
<router-outlet></router-outlet>
`,
template: ` <router-outlet></router-outlet> `,
})
export class RouterOutletComponent {}

18
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<Event>();
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);

9
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]',

38
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<any>,
public view: EmbeddedViewRef<AbpForContext>
public view: EmbeddedViewRef<AbpForContext>,
) {}
}
@ -70,31 +70,25 @@ export class ForDirective implements OnChanges {
}
get trackByFn(): TrackByFunction<any> {
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<AbpForContext>,
private vcRef: ViewContainerRef,
private differs: IterableDiffers
private differs: IterableDiffers,
) {}
private iterateOverAppliedOperations(changes: IterableChanges<any>) {
const rw: RecordView[] = [];
changes.forEachOperation(
(
record: IterableChangeRecord<any>,
previousIndex: number,
currentIndex: number
) => {
(record: IterableChangeRecord<any>, 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<AbpForContext>)
);
rw.push(new RecordView(record, view as EmbeddedViewRef<AbpForContext>));
}
}
},
);
for (let i = 0, l = rw.length; i < l; i++) {
@ -125,9 +117,7 @@ export class ForDirective implements OnChanges {
}
changes.forEachIdentityChange((record: IterableChangeRecord<any>) => {
const viewRef = this.vcRef.get(
record.currentIndex
) as EmbeddedViewRef<AbpForContext>;
const viewRef = this.vcRef.get(record.currentIndex) as EmbeddedViewRef<AbpForContext>;
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) {

17
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<HTMLFormElement>,
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();
});

24
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<MouseEvent>();
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);
});
}
}

6
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;

1
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;

1
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;

1
npm/ng-packs/nx/ng-packs/packages/core/src/lib/proxy/volo/abp/models.ts

@ -1,4 +1,3 @@
export interface NameValue<T = string> {
name?: string;
value: T;

15
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;
}

2
npm/ng-packs/nx/ng-packs/packages/core/src/lib/strategies/context.strategy.ts

@ -11,7 +11,7 @@ export abstract class ContextStrategy<T = any> {
}
export class NoContextStrategy<
T extends Type<any> | TemplateRef<any> = any
T extends Type<any> | TemplateRef<any> = any,
> extends ContextStrategy<T> {
constructor() {
super(undefined);

12
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

4
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<EnvironmentService>;

9
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('<ul><li *abpFor="let item of items; trackBy: trackByFn">{{ item }}</li></ul>', {
hostProps: { items, trackByFn },
});
spectator = createDirective(
'<ul><li *abpFor="let item of items; trackBy: trackByFn">{{ item }}</li></ul>',
{
hostProps: { items, trackByFn },
},
);
directive = spectator.directive;
});

39
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();
});

4
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,

19
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);
});
});

51
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()),
);
}
},
);
});

39
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();

2
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);

9
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<RouterOutletComponent>;
const createHost = createHostFactory({ component: RouterOutletComponent, imports: [RouterTestingModule] });
const createHost = createHostFactory({
component: RouterOutletComponent,
imports: [RouterTestingModule],
});
it('should have a router-outlet element', () => {
spectator = createHost('<abp-router-outlet></abp-router-outlet>');
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',
);
});
});

6
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);

8
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 },

4
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<any> {
return of(null);
},
} as unknown) as Store;
} as unknown as Store;
export class DummyInjector extends Injector {
constructor(public payload: { [key: string]: any }) {

2
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;
}

2
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();

2
npm/ng-packs/nx/ng-packs/packages/core/src/lib/utils/lazy-load-utils.ts

@ -34,7 +34,7 @@ export function fromLazyLoad<T extends Event>(
function createErrorHandler(observer: Observer<Event>, 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);

3
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;

30
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<any, GetFeatureListResultDto>({
method: 'GET',
url: '/api/feature-management/features',
params: { providerName, providerKey },
},
{ apiName: this.apiName });
this.restService.request<any, GetFeatureListResultDto>(
{
method: 'GET',
url: '/api/feature-management/features',
params: { providerName, providerKey },
},
{ apiName: this.apiName },
);
update = (providerName: string, providerKey: string, input: UpdateFeaturesDto) =>
this.restService.request<any, void>({
method: 'PUT',
url: '/api/feature-management/features',
params: { providerName, providerKey },
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'PUT',
url: '/api/feature-management/features',
params: { providerName, providerKey },
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

82
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<any, IdentityRoleDto>({
method: 'POST',
url: '/api/identity/roles',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityRoleDto>(
{
method: 'POST',
url: '/api/identity/roles',
body: input,
},
{ apiName: this.apiName },
);
delete = (id: string) =>
this.restService.request<any, void>({
method: 'DELETE',
url: `/api/identity/roles/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'DELETE',
url: `/api/identity/roles/${id}`,
},
{ apiName: this.apiName },
);
get = (id: string) =>
this.restService.request<any, IdentityRoleDto>({
method: 'GET',
url: `/api/identity/roles/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityRoleDto>(
{
method: 'GET',
url: `/api/identity/roles/${id}`,
},
{ apiName: this.apiName },
);
getAllList = () =>
this.restService.request<any, ListResultDto<IdentityRoleDto>>({
method: 'GET',
url: '/api/identity/roles/all',
},
{ apiName: this.apiName });
this.restService.request<any, ListResultDto<IdentityRoleDto>>(
{
method: 'GET',
url: '/api/identity/roles/all',
},
{ apiName: this.apiName },
);
getList = (input: PagedAndSortedResultRequestDto) =>
this.restService.request<any, PagedResultDto<IdentityRoleDto>>({
method: 'GET',
url: '/api/identity/roles',
params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
},
{ apiName: this.apiName });
this.restService.request<any, PagedResultDto<IdentityRoleDto>>(
{
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<any, IdentityRoleDto>({
method: 'PUT',
url: `/api/identity/roles/${id}`,
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityRoleDto>(
{
method: 'PUT',
url: `/api/identity/roles/${id}`,
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

57
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<any, UserData>({
method: 'GET',
url: `/api/identity/users/lookup/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, UserData>(
{
method: 'GET',
url: `/api/identity/users/lookup/${id}`,
},
{ apiName: this.apiName },
);
findByUserName = (userName: string) =>
this.restService.request<any, UserData>({
method: 'GET',
url: `/api/identity/users/lookup/by-username/${userName}`,
},
{ apiName: this.apiName });
this.restService.request<any, UserData>(
{
method: 'GET',
url: `/api/identity/users/lookup/by-username/${userName}`,
},
{ apiName: this.apiName },
);
getCount = (input: UserLookupCountInputDto) =>
this.restService.request<any, number>({
method: 'GET',
url: '/api/identity/users/lookup/count',
params: { filter: input.filter },
},
{ apiName: this.apiName });
this.restService.request<any, number>(
{
method: 'GET',
url: '/api/identity/users/lookup/count',
params: { filter: input.filter },
},
{ apiName: this.apiName },
);
search = (input: UserLookupSearchInputDto) =>
this.restService.request<any, ListResultDto<UserData>>({
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<any, ListResultDto<UserData>>(
{
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) {}
}

136
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<any, IdentityUserDto>({
method: 'POST',
url: '/api/identity/users',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'POST',
url: '/api/identity/users',
body: input,
},
{ apiName: this.apiName },
);
delete = (id: string) =>
this.restService.request<any, void>({
method: 'DELETE',
url: `/api/identity/users/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'DELETE',
url: `/api/identity/users/${id}`,
},
{ apiName: this.apiName },
);
findByEmail = (email: string) =>
this.restService.request<any, IdentityUserDto>({
method: 'GET',
url: `/api/identity/users/by-email/${email}`,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'GET',
url: `/api/identity/users/by-email/${email}`,
},
{ apiName: this.apiName },
);
findByUsername = (username: string) =>
this.restService.request<any, IdentityUserDto>({
method: 'GET',
url: '/api/identity/users/by-username/{userName}',
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'GET',
url: '/api/identity/users/by-username/{userName}',
},
{ apiName: this.apiName },
);
get = (id: string) =>
this.restService.request<any, IdentityUserDto>({
method: 'GET',
url: `/api/identity/users/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'GET',
url: `/api/identity/users/${id}`,
},
{ apiName: this.apiName },
);
getAssignableRoles = () =>
this.restService.request<any, ListResultDto<IdentityRoleDto>>({
method: 'GET',
url: '/api/identity/users/assignable-roles',
},
{ apiName: this.apiName });
this.restService.request<any, ListResultDto<IdentityRoleDto>>(
{
method: 'GET',
url: '/api/identity/users/assignable-roles',
},
{ apiName: this.apiName },
);
getList = (input: GetIdentityUsersInput) =>
this.restService.request<any, PagedResultDto<IdentityUserDto>>({
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<any, PagedResultDto<IdentityUserDto>>(
{
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<any, ListResultDto<IdentityRoleDto>>({
method: 'GET',
url: `/api/identity/users/${id}/roles`,
},
{ apiName: this.apiName });
this.restService.request<any, ListResultDto<IdentityRoleDto>>(
{
method: 'GET',
url: `/api/identity/users/${id}/roles`,
},
{ apiName: this.apiName },
);
update = (id: string, input: IdentityUserUpdateDto) =>
this.restService.request<any, IdentityUserDto>({
method: 'PUT',
url: `/api/identity/users/${id}`,
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, IdentityUserDto>(
{
method: 'PUT',
url: `/api/identity/users/${id}`,
body: input,
},
{ apiName: this.apiName },
);
updateRoles = (id: string, input: IdentityUserUpdateRolesDto) =>
this.restService.request<any, void>({
method: 'PUT',
url: `/api/identity/users/${id}/roles`,
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'PUT',
url: `/api/identity/users/${id}/roles`,
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

40
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<any, void>({
method: 'POST',
url: '/api/identity/my-profile/change-password',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/identity/my-profile/change-password',
body: input,
},
{ apiName: this.apiName },
);
get = () =>
this.restService.request<any, ProfileDto>({
method: 'GET',
url: '/api/identity/my-profile',
},
{ apiName: this.apiName });
this.restService.request<any, ProfileDto>(
{
method: 'GET',
url: '/api/identity/my-profile',
},
{ apiName: this.apiName },
);
update = (input: UpdateProfileDto) =>
this.restService.request<any, ProfileDto>({
method: 'PUT',
url: '/api/identity/my-profile',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, ProfileDto>(
{
method: 'PUT',
url: '/api/identity/my-profile',
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

1
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;

5
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<EntityPropCo
'IDENTITY_ENTITY_PROP_CONTRIBUTORS',
);
export const IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS = new InjectionToken<CreateFormPropContributors>(
'IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS',
);
export const IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS =
new InjectionToken<CreateFormPropContributors>('IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS');
export const IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS = new InjectionToken<EditFormPropContributors>(
'IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS',

7
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<PermissionGrantInfoDto[], PermissionWithStyle[]>(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),
),
),
);

1
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[];

30
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<any, GetPermissionListResultDto>({
method: 'GET',
url: '/api/permission-management/permissions',
params: { providerName, providerKey },
},
{ apiName: this.apiName });
this.restService.request<any, GetPermissionListResultDto>(
{
method: 'GET',
url: '/api/permission-management/permissions',
params: { providerName, providerKey },
},
{ apiName: this.apiName },
);
update = (providerName: string, providerKey: string, input: UpdatePermissionsDto) =>
this.restService.request<any, void>({
method: 'PUT',
url: '/api/permission-management/permissions',
params: { providerName, providerKey },
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'PUT',
url: '/api/permission-management/permissions',
params: { providerName, providerKey },
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

2
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';

2
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) => {

17
npm/ng-packs/nx/ng-packs/packages/schematics/src/utils/angular/change.ts

@ -10,7 +10,6 @@ export interface Host {
read(path: string): Promise<string>;
}
export interface Change {
apply(host: Host): Promise<void>;
@ -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');
}

18
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;

40
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);

31
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,

17
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<string>, 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<string>());
context.addTask(new TslintFixTask({
ignoreErrors: true,
tsConfigPath: 'tsconfig.json',
files: [...files],
}));
context.addTask(
new TslintFixTask({
ignoreErrors: true,
tsConfigPath: 'tsconfig.json',
files: [...files],
}),
);
};
}

1
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.

14
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'.`,
);
}

6
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;
}

11
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<void>,
): 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<void>),
): 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}`;
}

5
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 '';

26
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<any, EmailSettingsDto>({
method: 'GET',
url: '/api/setting-management/emailing',
},
{ apiName: this.apiName });
this.restService.request<any, EmailSettingsDto>(
{
method: 'GET',
url: '/api/setting-management/emailing',
},
{ apiName: this.apiName },
);
update = (input: UpdateEmailSettingsDto) =>
this.restService.request<any, void>({
method: 'POST',
url: '/api/setting-management/emailing',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'POST',
url: '/api/setting-management/emailing',
body: input,
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

1
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;

111
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<any, TenantDto>({
method: 'POST',
url: '/api/multi-tenancy/tenants',
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, TenantDto>(
{
method: 'POST',
url: '/api/multi-tenancy/tenants',
body: input,
},
{ apiName: this.apiName },
);
delete = (id: string) =>
this.restService.request<any, void>({
method: 'DELETE',
url: `/api/multi-tenancy/tenants/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'DELETE',
url: `/api/multi-tenancy/tenants/${id}`,
},
{ apiName: this.apiName },
);
deleteDefaultConnectionString = (id: string) =>
this.restService.request<any, void>({
method: 'DELETE',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'DELETE',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
},
{ apiName: this.apiName },
);
get = (id: string) =>
this.restService.request<any, TenantDto>({
method: 'GET',
url: `/api/multi-tenancy/tenants/${id}`,
},
{ apiName: this.apiName });
this.restService.request<any, TenantDto>(
{
method: 'GET',
url: `/api/multi-tenancy/tenants/${id}`,
},
{ apiName: this.apiName },
);
getDefaultConnectionString = (id: string) =>
this.restService.request<any, string>({
method: 'GET',
responseType: 'text',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
},
{ apiName: this.apiName });
this.restService.request<any, string>(
{
method: 'GET',
responseType: 'text',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
},
{ apiName: this.apiName },
);
getList = (input: GetTenantsInput) =>
this.restService.request<any, PagedResultDto<TenantDto>>({
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<any, PagedResultDto<TenantDto>>(
{
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<any, TenantDto>({
method: 'PUT',
url: `/api/multi-tenancy/tenants/${id}`,
body: input,
},
{ apiName: this.apiName });
this.restService.request<any, TenantDto>(
{
method: 'PUT',
url: `/api/multi-tenancy/tenants/${id}`,
body: input,
},
{ apiName: this.apiName },
);
updateDefaultConnectionString = (id: string, defaultConnectionString: string) =>
this.restService.request<any, void>({
method: 'PUT',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
params: { defaultConnectionString },
},
{ apiName: this.apiName });
this.restService.request<any, void>(
{
method: 'PUT',
url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
params: { defaultConnectionString },
},
{ apiName: this.apiName },
);
constructor(private restService: RestService) {}
}

25
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<EntityActionContributors>(
'TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS',
);
export const TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS =
new InjectionToken<EntityActionContributors>('TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS');
export const TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS = new InjectionToken<ToolbarActionContributors>(
'TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS',
);
export const TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS =
new InjectionToken<ToolbarActionContributors>('TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS');
export const TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS = new InjectionToken<EntityPropContributors>(
'TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS',
);
export const TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS =
new InjectionToken<EntityPropContributors>('TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS');
export const TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS = new InjectionToken<CreateFormPropContributors>(
'TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS',
);
export const TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS =
new InjectionToken<CreateFormPropContributors>('TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS');
export const TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS = new InjectionToken<EditFormPropContributors>(
'TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS',
);
export const TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS =
new InjectionToken<EditFormPropContributors>('TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS');
// Fix for TS4023 -> https://github.com/microsoft/TypeScript/issues/9944#issuecomment-254693497
type EntityActionContributors = Partial<{

2
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(),

2
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<string> {
? 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(),

2
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<L extends ActionList<any>> 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;
}
}

6
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<L extends PropList<any>> extends PropData<InferredData<L>>
implements OnChanges, OnDestroy {
export class PropDataDirective<L extends PropList<any>>
extends PropData<InferredData<L>>
implements OnChanges, OnDestroy
{
/* tslint:disable:no-input-rename */
@Input('abpPropDataFromList') readonly propList: L;

2
npm/ng-packs/nx/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts

@ -192,7 +192,7 @@ function createPropertiesToContributorsMapper<T = any>(
}
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 {

4
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 = {

31
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);
}

4
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 = {

27
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<string, ObjectExtensions.EntityExtensionDto> {
return {
Role: {
properties: {

12
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%)',
},
},
);

49
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: '' } },
);

12
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<any>).rootNodes[0]
(customComponentRef.hostView as EmbeddedViewRef<any>).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());
}

2
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';

18
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<Toaster.ToastOptions>
options?: Partial<Toaster.ToastOptions>,
): 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<Toaster.ToastOptions>
options?: Partial<Toaster.ToastOptions>,
): 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<Toaster.ToastOptions>
options?: Partial<Toaster.ToastOptions>,
): 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<Toaster.ToastOptions>
options?: Partial<Toaster.ToastOptions>,
): 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<Toaster.ToastOptions>
options = {} as Partial<Toaster.ToastOptions>,
): 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);
}
}

9
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('<abp-button iconClass="fa fa-check" [attributes]="attributes">Button</abp-button>', {
hostProps: { attributes: { autofocus: '', name: 'abp-button' } },
})),
(spectator = createHost(
'<abp-button iconClass="fa fa-check" [attributes]="attributes">Button</abp-button>',
{
hostProps: { attributes: { autofocus: '', name: 'abp-button' } },
},
)),
);
it('should display the button', () => {

43
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(
'<abp-chart [data]="data" type="polarArea"></abp-chart>',
{
hostProps: {
data: {
datasets: [
{
data: [11],
backgroundColor: ['#FF6384'],
label: 'My dataset',
},
],
labels: ['Red'],
},
spectator = createHost('<abp-chart [data]="data" type="polarArea"></abp-chart>', {
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(() => {

43
npm/ng-packs/nx/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts

@ -50,7 +50,7 @@ describe('ConfirmationService', () => {
{
cancelText: '<span class="custom-cancel">CANCEL</span>',
yesText: '<span class="custom-yes">YES</span>',
}
},
);
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<T extends HTMLElement>(
selector = '.confirmation'
): T {
function selectConfirmationElement<T extends HTMLElement>(selector = '.confirmation'): T {
return document.querySelector(selector);
}

4
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();
});

30
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,
);
});
});

2
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

18
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<Event[]>((acc, v) => acc.concat(v), [])
reduce<Event[]>((acc, v) => acc.concat(v), []),
)
.subscribe(([event1, event2]) => {
expect(event1.returnValue).toBe(false);

5
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';

Loading…
Cancel
Save