From 216a40eea6f662b097c823896a9ffed866fc57d0 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 4 Sep 2019 17:58:29 +0800 Subject: [PATCH 001/109] Replace the email with the username before using the Identity methods. --- .../Account/Controllers/AccountController.cs | 25 +++++++++++++++++++ .../Volo.Abp.IdentityServer.Domain.csproj | 1 + .../AbpIdentityServerDomainModule.cs | 4 ++- .../AbpResourceOwnerPasswordValidator.cs | 25 +++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index 700d52b3a9..5bc347d84d 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp.Account.Web.Areas.Account.Controllers.Models; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.Identity; +using Volo.Abp.Validation; using SignInResult = Microsoft.AspNetCore.Identity.SignInResult; using UserLoginInfo = Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo; @@ -33,6 +34,8 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers { ValidateLoginInfo(login); + await ReplaceEmailToUsernameOfInputIfNeeds(login); + return GetAbpLoginResult(await _signInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, @@ -56,6 +59,28 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true)); } + protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login) + { + if (!ValidationHandler.IsValidEmailAddress(login.UserNameOrEmailAddress)) + { + return; + } + + var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); + if (userByUsername != null) + { + return; + } + + var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress); + if (userByEmail == null) + { + return; + } + + login.UserNameOrEmailAddress = userByEmail.UserName; + } + private static AbpLoginResult GetAbpLoginResult(SignInResult result) { if (result.IsLockedOut) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index f642574118..d485c69016 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -19,6 +19,7 @@ + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 7ddc619cfa..dbda3dd9aa 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -7,6 +7,7 @@ using Volo.Abp.Identity; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.Modularity; using Volo.Abp.Security; +using Volo.Abp.Validation; namespace Volo.Abp.IdentityServer { @@ -15,7 +16,8 @@ namespace Volo.Abp.IdentityServer typeof(AbpAutoMapperModule), typeof(AbpIdentityDomainModule), typeof(AbpSecurityModule), - typeof(AbpCachingModule) + typeof(AbpCachingModule), + typeof(AbpValidationModule) )] public class AbpIdentityServerDomainModule : AbpModule { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index 00d5d1039a..60af80e1da 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -12,6 +12,7 @@ using Microsoft.Extensions.Logging; using Volo.Abp.Identity; using Volo.Abp.Security.Claims; using Volo.Abp.Uow; +using Volo.Abp.Validation; namespace Volo.Abp.IdentityServer.AspNetIdentity { @@ -42,6 +43,8 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity [UnitOfWork] public virtual async Task ValidateAsync(ResourceOwnerPasswordValidationContext context) { + await ReplaceEmailToUsernameOfInputIfNeeds(context); + var user = await _userManager.FindByNameAsync(context.UserName); if (user != null) { @@ -90,6 +93,28 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); } + protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(ResourceOwnerPasswordValidationContext context) + { + if (!ValidationHandler.IsValidEmailAddress(context.UserName)) + { + return; + } + + var userByUsername = await _userManager.FindByNameAsync(context.UserName); + if (userByUsername != null) + { + return; + } + + var userByEmail = await _userManager.FindByEmailAsync(context.UserName); + if (userByEmail == null) + { + return; + } + + context.UserName = userByEmail.UserName; + } + protected virtual Task AddCustomClaimsAsync(List customClaims, IdentityUser user, ResourceOwnerPasswordValidationContext context) { if (user.TenantId.HasValue) From 0c561b6edc8a2f1440fd256f86fe77ed30cce41e Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 25 Sep 2019 15:12:49 +0800 Subject: [PATCH 002/109] Use Newtonsoft.Json in AbpAspNetCoreMvc Module. Resolve #1790 --- .../Volo.Abp.AspNetCore.Mvc.csproj | 1 + .../Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index a90b113dc3..c0330fc577 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -26,6 +26,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index b094505f6c..1600419ccb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -15,6 +15,7 @@ using System.Reflection; using Volo.Abp.ApiVersioning; using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc.Json; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.DependencyInjection; @@ -76,6 +77,11 @@ namespace Volo.Abp.AspNetCore.Mvc ); var mvcBuilder = context.Services.AddMvc() + .AddNewtonsoftJson(options => + { + options.SerializerSettings.ContractResolver = + new AbpMvcJsonContractResolver(context.Services); + }) .AddRazorRuntimeCompilation() .AddDataAnnotationsLocalization(options => { @@ -110,11 +116,6 @@ namespace Volo.Abp.AspNetCore.Mvc { mvcOptions.AddAbp(context.Services); }); - - //Configure(jsonOptions => @3.0.0! - //{ - // jsonOptions.SerializerSettings.ContractResolver = new AbpMvcJsonContractResolver(context.Services); - //}); } public override void OnApplicationInitialization(ApplicationInitializationContext context) From cd67360bb753b370ba0236eba158993f9afca215 Mon Sep 17 00:00:00 2001 From: Xeevis Date: Fri, 27 Sep 2019 21:56:53 +0200 Subject: [PATCH 003/109] Fix case of misleading CLI update advisory --- .../Volo/Abp/Cli/CliService.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index d7dbb70d14..1264580e17 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs @@ -169,8 +169,16 @@ namespace Volo.Abp.Cli } } + private static bool IsGlobalTool(string toolPath) + { + var globalPaths = new[] { @"%USERPROFILE%\.dotnet\tools\", "%HOME%/.dotnet/tools/", }; + return globalPaths.Select(path => Environment.ExpandEnvironmentVariables(path)).Contains(toolPath); + } + private void LogNewVersionInfo(UpdateChannel updateChannel, SemanticVersion latestVersion, string toolPath) { + var toolPathArg = IsGlobalTool(toolPath) ? "-g" : $"--tool-path {toolPath}"; + Logger.LogWarning($"ABP CLI has a newer {updateChannel.ToString().ToLowerInvariant()} version {latestVersion}, please update to get the latest features and fixes."); Logger.LogWarning(string.Empty); Logger.LogWarning("Update Command: "); @@ -179,18 +187,18 @@ namespace Volo.Abp.Cli switch (updateChannel) { case UpdateChannel.Stable: - Logger.LogWarning("dotnet tool update -g Volo.Abp.Cli"); + Logger.LogWarning($"dotnet tool update {toolPathArg} Volo.Abp.Cli"); break; case UpdateChannel.Prerelease: - Logger.LogWarning("dotnet tool uninstall -g Volo.Abp.Cli"); - Logger.LogWarning($"dotnet tool install -g Volo.Abp.Cli --version {latestVersion}"); + Logger.LogWarning($"dotnet tool uninstall {toolPathArg} Volo.Abp.Cli"); + Logger.LogWarning($"dotnet tool install {toolPathArg} Volo.Abp.Cli --version {latestVersion}"); break; case UpdateChannel.Nightly: case UpdateChannel.Development: - Logger.LogWarning("dotnet tool uninstall -g Volo.Abp.Cli"); - Logger.LogWarning($"dotnet tool install -g Volo.Abp.Cli --add-source https://www.myget.org/F/abp-nightly/api/v3/index.json --version {latestVersion}"); + Logger.LogWarning($"dotnet tool uninstall {toolPathArg} Volo.Abp.Cli"); + Logger.LogWarning($"dotnet tool install {toolPathArg} Volo.Abp.Cli --add-source https://www.myget.org/F/abp-nightly/api/v3/index.json --version {latestVersion}"); break; default: throw new ArgumentOutOfRangeException(nameof(updateChannel), updateChannel, null); From 4dd1bddd41ef358624ba57fb3d31c2de9e6c98b3 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Sat, 28 Sep 2019 00:03:34 +0300 Subject: [PATCH 004/109] tests(theme-shared): add button component tests --- .../src/lib/tests/button.component.spec.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts new file mode 100644 index 0000000000..bfb70f9518 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts @@ -0,0 +1,54 @@ +import { CoreModule } from '@abp/ng.core'; +import { + createComponentFactory, + createHostFactory, + Spectator, + SpectatorHost, + createTestComponentFactory, +} from '@ngneat/spectator'; +import { ButtonComponent } from '../components'; + +describe('ButtonComponent', () => { + let host: SpectatorHost; + + const createHost = createHostFactory(ButtonComponent); + + beforeEach(() => (host = createHost(`Button`))); + + it('should display the button', () => { + expect(host.query('button')).toBeTruthy(); + }); + + it('should equal the default classes to btn btn-primary', () => { + expect(host.query('button')).toHaveClass('btn btn-primary'); + }); + + it('should equal the default type to button', () => { + expect(host.query('button')).toHaveAttribute('type', 'button'); + }); + + it('should enabled', () => { + expect(host.query('[disabled]')).toBeFalsy(); + }); + + it('should have the text content', () => { + expect(host.query('button')).toHaveText('Button'); + }); + + it('should display the icon', () => { + expect(host.query('i.d-none')).toBeFalsy(); + expect(host.query('i')).toHaveClass('fa'); + }); + + it('should display the spinner icon', () => { + host.component.loading = true; + host.detectComponentChanges(); + expect(host.query('i')).toHaveClass('fa-spinner'); + }); + + it('should disabled when the loading input is true', () => { + host.component.loading = true; + host.detectComponentChanges(); + expect(host.query('[disabled]')).toBeDefined(); + }); +}); From 0bcd977d1df796f6fed38ea2f40f87eaa6591237 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Sat, 28 Sep 2019 14:30:40 +0300 Subject: [PATCH 005/109] feature: error handler tests --- .../src/lib/handlers/error.handler.ts | 53 ++++++++------- .../src/lib/tests/error.handler.spec.ts | 64 +++++++++++++++++++ 2 files changed, 95 insertions(+), 22 deletions(-) create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index 0baff0da8f..d18cd45bf1 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -16,26 +16,31 @@ import { Toaster } from '../models/toaster'; import { ConfirmationService } from '../services/confirmation.service'; import snq from 'snq'; -const DEFAULTS = { +export const DEFAULT_ERROR_MESSAGES = { defaultError: { - message: 'An error has occurred!', + title: 'An error has occurred!', details: 'Error detail not sent by server.', }, - defaultError401: { - message: 'You are not authenticated!', + title: 'You are not authenticated!', details: 'You should be authenticated (sign in) in order to perform this operation.', }, - defaultError403: { - message: 'You are not authorized!', + title: 'You are not authorized!', details: 'You are not allowed to perform this operation.', }, - defaultError404: { - message: 'Resource not found!', + title: 'Resource not found!', details: 'The resource requested could not found on the server.', }, + defaultError500: { + title: '500', + details: 'AbpAccount::InternalServerErrorMessage', + }, + defaultErrorUnknown: { + title: 'Unknown Error', + details: 'AbpAccount::InternalServerErrorMessage', + }, }; @Injectable({ providedIn: 'root' }) @@ -51,7 +56,7 @@ export class ErrorHandler { ) { actions.pipe(ofActionSuccessful(RestOccurError)).subscribe(res => { const { payload: err = {} as HttpErrorResponse | any } = res; - const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULTS.defaultError.message); + const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULT_ERROR_MESSAGES.defaultError.title); if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) { const confirmation$ = this.showError(null, null, body); @@ -64,35 +69,39 @@ export class ErrorHandler { } else { switch ((err as HttpErrorResponse).status) { case 401: - this.showError(DEFAULTS.defaultError401.details, DEFAULTS.defaultError401.message).subscribe(() => - this.navigateToLogin(), - ); + this.showError( + DEFAULT_ERROR_MESSAGES.defaultError401.details, + DEFAULT_ERROR_MESSAGES.defaultError401.title, + ).subscribe(() => this.navigateToLogin()); break; case 403: this.createErrorComponent({ - title: DEFAULTS.defaultError403.message, - details: DEFAULTS.defaultError403.details, + title: DEFAULT_ERROR_MESSAGES.defaultError403.title, + details: DEFAULT_ERROR_MESSAGES.defaultError403.details, }); break; case 404: - this.showError(DEFAULTS.defaultError404.details, DEFAULTS.defaultError404.message); + this.showError( + DEFAULT_ERROR_MESSAGES.defaultError404.details, + DEFAULT_ERROR_MESSAGES.defaultError404.title, + ); break; case 500: this.createErrorComponent({ - title: '500', - details: 'AbpAccount::InternalServerErrorMessage', + title: DEFAULT_ERROR_MESSAGES.defaultError500.title, + details: DEFAULT_ERROR_MESSAGES.defaultError500.details, }); break; case 0: if ((err as HttpErrorResponse).statusText === 'Unknown Error') { this.createErrorComponent({ - title: 'Unknown Error', - details: 'AbpAccount::InternalServerErrorMessage', + title: DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.title, + details: DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.details, }); } break; default: - this.showError(DEFAULTS.defaultError.details, DEFAULTS.defaultError.message); + this.showError(DEFAULT_ERROR_MESSAGES.defaultError.details, DEFAULT_ERROR_MESSAGES.defaultError.title); break; } } @@ -105,7 +114,7 @@ export class ErrorHandler { message = body.details; title = body.message; } else { - message = body.message || DEFAULTS.defaultError.message; + message = body.message || DEFAULT_ERROR_MESSAGES.defaultError.title; } } @@ -125,7 +134,7 @@ export class ErrorHandler { createErrorComponent(instance: Partial) { const renderer = this.rendererFactory.createRenderer(null, null); - const host = renderer.selectRootElement('app-root', true); + const host = renderer.selectRootElement(document.body, true); const componentRef = this.cfRes.resolveComponentFactory(ErrorComponent).create(this.injector); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts new file mode 100644 index 0000000000..0f64652cfe --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts @@ -0,0 +1,64 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator'; +import { Component } from '@angular/core'; +import { ErrorHandler, DEFAULT_ERROR_MESSAGES } from '../handlers'; +import { CoreModule, RestOccurError } from '@abp/ng.core'; +import { ThemeSharedModule } from '../theme-shared.module'; +import { NgxsModule, Store } from '@ngxs/store'; +import { RouterModule } from '@angular/router'; +import { HttpErrorResponse } from '@angular/common/http'; + +@Component({ selector: 'dummy', template: 'dummy works! ' }) +class DummyComponent { + constructor(public errorHandler: ErrorHandler, public store: Store) {} +} + +describe('With Custom Host Component', function() { + let host: SpectatorHost; + const createHost = createHostFactory({ + component: DummyComponent, + imports: [CoreModule, ThemeSharedModule.forRoot(), NgxsModule.forRoot([]), RouterModule.forRoot([])], + }); + + beforeEach(() => { + host = createHost(``); + const abpError = document.querySelector('abp-error'); + if (abpError) document.body.removeChild(abpError); + }); + + it('should display the error component when server error occurs', () => { + host.component.store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 500 }))); + host.detectChanges(); + expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.title); + expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.details); + }); + + it('should display the error component when authorize error occurs', () => { + host.component.store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 403 }))); + host.detectChanges(); + expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError403.title); + expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError403.details); + }); + + it('should display the error component when unknown error occurs', () => { + host.component.store.dispatch( + new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' })), + ); + host.detectChanges(); + expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.title); + expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.details); + }); + + it('should display the confirmation when not found error occurs', () => { + host.component.store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 404 }))); + host.detectChanges(); + expect(host.query('.abp-confirm-summary')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError404.title); + expect(host.query('.abp-confirm-body')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError404.details); + }); + + it('should display the confirmation when default error occurs', () => { + host.component.store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 412 }))); + host.detectChanges(); + expect(host.query('.abp-confirm-summary')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError.title); + expect(host.query('.abp-confirm-body')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError.details); + }); +}); From c762edc1498d03f97f8aabc476e166b78e1bd116 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 30 Sep 2019 09:42:04 +0300 Subject: [PATCH 006/109] feature: add 401 error tests fix: some for directive bugs --- .../core/src/lib/directives/for.directive.ts | 2 + .../theme-shared/src/lib/abstracts/toaster.ts | 2 +- .../confirmation/confirmation.component.ts | 9 ++- .../src/lib/tests/error.handler.spec.ts | 63 ++++++++++++++++--- 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/directives/for.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/for.directive.ts index 604f7a8660..f9c5abeb56 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/for.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/for.directive.ts @@ -113,8 +113,10 @@ export class ForDirective implements OnChanges { private projectItems(items: any[]): void { if (!items.length && this.emptyRef) { + this.vcRef.clear(); this.vcRef.createEmbeddedView(this.emptyRef).rootNodes; this.isShowEmptyRef = true; + this.differ = null; return; } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts b/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts index 5dbba869f1..9172297039 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts @@ -2,7 +2,7 @@ import { MessageService } from 'primeng/components/common/messageservice'; import { Observable, Subject } from 'rxjs'; import { Toaster } from '../models/toaster'; -export class AbstractToaster { +export abstract class AbstractToaster { status$: Subject; key: string = 'abpToast'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts index 39cf9b73a2..398f975ff7 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts @@ -23,11 +23,18 @@ import { Toaster } from '../../models/toaster'; `, - styleUrls: ['./loader-bar.component.scss'], + styleUrls: ['./loader-bar.component.scss'] }) export class LoaderBarComponent implements OnDestroy { - @Input() - containerClass: string = 'abp-loader-bar'; - - @Input() - color: string = '#77b6ff'; - - @Input() - isLoading: boolean = false; - - @Input() - filter = (action: StartLoader | StopLoader) => action.payload.url.indexOf('openid-configuration') < 0; - - progressLevel: number = 0; - - interval: Subscription; - - timer: Subscription; - get boxShadow(): string { return `0 0 10px rgba(${this.color}, 0.5)`; } @@ -50,7 +32,7 @@ export class LoaderBarComponent implements OnDestroy { .pipe( ofActionSuccessful(StartLoader, StopLoader), filter(this.filter), - takeUntilDestroy(this), + takeUntilDestroy(this) ) .subscribe(action => { if (action instanceof StartLoader) this.startLoading(); @@ -61,15 +43,32 @@ export class LoaderBarComponent implements OnDestroy { .pipe( filter( event => - event instanceof NavigationStart || event instanceof NavigationEnd || event instanceof NavigationError, + event instanceof NavigationStart || event instanceof NavigationEnd || event instanceof NavigationError ), - takeUntilDestroy(this), + takeUntilDestroy(this) ) .subscribe(event => { if (event instanceof NavigationStart) this.startLoading(); else this.stopLoading(); }); } + @Input() + containerClass = 'abp-loader-bar'; + + @Input() + color = '#77b6ff'; + + @Input() + isLoading = false; + + progressLevel = 0; + + interval: Subscription; + + timer: Subscription; + + @Input() + filter = (action: StartLoader | StopLoader) => action.payload.url.indexOf('openid-configuration') < 0; ngOnDestroy() { this.interval.unsubscribe(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index e38ba270cb..5e6ebff228 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -9,7 +9,7 @@ import { Renderer2, TemplateRef, ViewChild, - ViewChildren, + ViewChildren } from '@angular/core'; import { fromEvent, Subject, timer } from 'rxjs'; import { filter, take, takeUntil, debounceTime } from 'rxjs/operators'; @@ -23,7 +23,7 @@ const ANIMATION_TIMEOUT = 200; @Component({ selector: 'abp-modal', - templateUrl: './modal.component.html', + templateUrl: './modal.component.html' }) export class ModalComponent implements OnDestroy { @Input() @@ -51,7 +51,7 @@ export class ModalComponent implements OnDestroy { this.renderer.addClass(this.modalContent.nativeElement, 'fade-out-top'); setTimeout(() => { this.setVisible(value); - this.ngOnDestroy(); + this.destroy$.next(); }, ANIMATION_TIMEOUT - 10); } } @@ -68,9 +68,9 @@ export class ModalComponent implements OnDestroy { this._busy = value; } - @Input() centered: boolean = false; + @Input() centered = false; - @Input() modalClass: string = ''; + @Input() modalClass = ''; @Input() size: ModalSize = 'lg'; @@ -78,9 +78,9 @@ export class ModalComponent implements OnDestroy { @Input() minHeight: number; - @Output() visibleChange = new EventEmitter(); + @Output() readonly visibleChange = new EventEmitter(); - @Output() init = new EventEmitter(); + @Output() readonly init = new EventEmitter(); @ContentChild('abpHeader', { static: false }) abpHeader: TemplateRef; @@ -88,29 +88,29 @@ export class ModalComponent implements OnDestroy { @ContentChild('abpFooter', { static: false }) abpFooter: TemplateRef; - @ContentChild('abpClose', { static: false, read: ElementRef }) abpClose: ElementRef; + @ContentChild('abpClose', { static: false, read: ElementRef }) + abpClose: ElementRef; - @ContentChild(ButtonComponent, { static: false, read: ButtonComponent }) abpSubmit: ButtonComponent; + @ContentChild(ButtonComponent, { static: false, read: ButtonComponent }) + abpSubmit: ButtonComponent; @ViewChild('abpModalContent', { static: false }) modalContent: ElementRef; @ViewChildren('abp-button') abpButtons; - @Output() - show = new EventEmitter(); + @Output() readonly appear = new EventEmitter(); - @Output() - hide = new EventEmitter(); + @Output() readonly disappear = new EventEmitter(); - _visible: boolean = false; + _visible = false; - _busy: boolean = false; + _busy = false; - showModal: boolean = false; + showModal = false; - isOpenConfirmation: boolean = false; + isOpenConfirmation = false; - closable: boolean = false; + closable = false; destroy$ = new Subject(); @@ -131,11 +131,11 @@ export class ModalComponent implements OnDestroy { .subscribe(_ => (this.closable = true)); this.renderer.addClass(document.body, 'modal-open'); - this.show.emit(); + this.appear.emit(); } else { this.closable = false; this.renderer.removeClass(document.body, 'modal-open'); - this.hide.emit(); + this.disappear.emit(); } } @@ -144,7 +144,7 @@ export class ModalComponent implements OnDestroy { .pipe( takeUntil(this.destroy$), debounceTime(150), - filter((key: KeyboardEvent) => key && key.code === 'Escape' && this.closable), + filter((key: KeyboardEvent) => key && key.code === 'Escape' && this.closable) ) .subscribe(_ => { this.close(); @@ -155,7 +155,7 @@ export class ModalComponent implements OnDestroy { fromEvent(this.abpClose.nativeElement, 'click') .pipe( takeUntil(this.destroy$), - filter(() => !!(this.closable && this.modalContent)), + filter(() => !!(this.closable && this.modalContent)) ) .subscribe(() => this.close()); }, 0); @@ -167,7 +167,7 @@ export class ModalComponent implements OnDestroy { if (!this.closable || this.busy) return; const nodes = getFlatNodes( - (this.modalContent.nativeElement.querySelector('#abp-modal-body') as HTMLElement).childNodes, + (this.modalContent.nativeElement.querySelector('#abp-modal-body') as HTMLElement).childNodes ); if (hasNgDirty(nodes)) { @@ -194,7 +194,7 @@ export class ModalComponent implements OnDestroy { function getFlatNodes(nodes: NodeList): HTMLElement[] { return Array.from(nodes).reduce( (acc, val) => [...acc, ...(val.childNodes && val.childNodes.length ? getFlatNodes(val.childNodes) : [val])], - [], + [] ); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts index 0dc8ef2768..e7d110365b 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts @@ -9,7 +9,7 @@ const { maxLength, required, email } = Validators; @Component({ selector: 'abp-profile', - templateUrl: './profile.component.html', + templateUrl: './profile.component.html' }) export class ProfileComponent implements OnChanges { protected _visible; @@ -24,15 +24,14 @@ export class ProfileComponent implements OnChanges { this.visibleChange.emit(value); } - @Output() - visibleChange = new EventEmitter(); + @Output() readonly visibleChange = new EventEmitter(); @Select(ProfileState.getProfile) profile$: Observable; form: FormGroup; - modalBusy: boolean = false; + modalBusy = false; constructor(private fb: FormBuilder, private store: Store) {} @@ -41,7 +40,7 @@ export class ProfileComponent implements OnChanges { .dispatch(new GetProfile()) .pipe( withLatestFrom(this.profile$), - take(1), + take(1) ) .subscribe(([, profile]) => { this.form = this.fb.group({ @@ -49,7 +48,7 @@ export class ProfileComponent implements OnChanges { email: [profile.email, [required, email, maxLength(256)]], name: [profile.name || '', [maxLength(64)]], surname: [profile.surname || '', [maxLength(64)]], - phoneNumber: [profile.phoneNumber || '', [maxLength(16)]], + phoneNumber: [profile.phoneNumber || '', [maxLength(16)]] }); }); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts index e53b90129e..5924a9f187 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts @@ -1,12 +1,13 @@ import { Component, OnInit, Input } from '@angular/core'; @Component({ + // tslint:disable-next-line: component-selector selector: '[abp-table-empty-message]', template: ` {{ emptyMessage | abpLocalization }} - `, + ` }) export class TableEmptyMessageComponent { @Input() @@ -16,10 +17,10 @@ export class TableEmptyMessageComponent { message: string; @Input() - localizationResource: string = 'AbpAccount'; + localizationResource = 'AbpAccount'; @Input() - localizationProp: string = 'NoDataAvailableInDatatable'; + localizationProp = 'NoDataAvailableInDatatable'; get emptyMessage(): string { return this.message || `${this.localizationResource}::${this.localizationProp}`; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts index 382b18974b..422c67f3b9 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts @@ -2,6 +2,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'abp-toast', + // tslint:disable-next-line: component-max-inline-declarations template: ` @@ -20,6 +21,6 @@ import { Component } from '@angular/core'; - `, + ` }) export class ToastComponent {} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/contants/scripts.ts b/npm/ng-packs/packages/theme-shared/src/lib/contants/scripts.ts index 1bc3ad0fa9..08d725cd4e 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/contants/scripts.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/contants/scripts.ts @@ -1 +1 @@ -export default ``; +export default ''; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts index f8338d95e8..69bb5eaf72 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts @@ -8,9 +8,9 @@ import { Toaster } from '../models/toaster'; @Injectable({ providedIn: 'root' }) export class ConfirmationService extends AbstractToaster { - key: string = 'abpConfirmation'; + key = 'abpConfirmation'; - sticky: boolean = true; + sticky = true; destroy$ = new Subject(); @@ -22,7 +22,7 @@ export class ConfirmationService extends AbstractToaster { message: string, title: string, severity: Toaster.Severity, - options?: Confirmation.Options, + options?: Confirmation.Options ): Observable { this.listenToEscape(); @@ -40,7 +40,7 @@ export class ConfirmationService extends AbstractToaster { .pipe( takeUntil(this.destroy$), debounceTime(150), - filter((key: KeyboardEvent) => key && key.code === 'Escape'), + filter((key: KeyboardEvent) => key && key.code === 'Escape') ) .subscribe(_ => { this.clear(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts index bfb70f9518..b8682ae224 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts @@ -4,7 +4,7 @@ import { createHostFactory, Spectator, SpectatorHost, - createTestComponentFactory, + createTestComponentFactory } from '@ngneat/spectator'; import { ButtonComponent } from '../components'; @@ -13,7 +13,7 @@ describe('ButtonComponent', () => { const createHost = createHostFactory(ButtonComponent); - beforeEach(() => (host = createHost(`Button`))); + beforeEach(() => (host = createHost('Button'))); it('should display the button', () => { expect(host.query('button')).toBeTruthy(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts index 835f4a33a9..26e3753609 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts @@ -9,18 +9,18 @@ import { NgxsResetPluginModule, StateOverwrite } from 'ngxs-reset-plugin'; import { DEFAULT_ERROR_MESSAGES, ErrorHandler } from '../handlers'; import { ThemeSharedModule } from '../theme-shared.module'; -@Component({ selector: 'dummy', template: 'dummy works! ' }) +@Component({ selector: 'abp-dummy', template: 'dummy works! ' }) class DummyComponent { constructor(public errorHandler: ErrorHandler, public store: Store) {} } -describe('With Custom Host Component', function() { +describe('With Custom Host Component', () => { let component: SpectatorRouting; const createComponent = createRoutingFactory({ component: DummyComponent, imports: [CoreModule, ThemeSharedModule.forRoot(), NgxsModule.forRoot([]), NgxsResetPluginModule.forRoot()], stubsEnabled: false, - routes: [{ path: '', component: DummyComponent }, { path: 'account/login', component: RouterOutletComponent }], + routes: [{ path: '', component: DummyComponent }, { path: 'account/login', component: RouterOutletComponent }] }); beforeEach(() => { @@ -45,7 +45,7 @@ describe('With Custom Host Component', function() { it('should display the error component when unknown error occurs', () => { component.component.store.dispatch( - new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' })), + new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' })) ); component.detectChanges(); expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.title); @@ -97,9 +97,9 @@ describe('With Custom Host Component', function() { new HttpErrorResponse({ error: { error: { message: 'test message', details: 'test detail' } }, status: 412, - headers, - }), - ), + headers + }) + ) ); component.detectChanges(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index 58e2ab5bb4..a1839f6217 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -21,7 +21,7 @@ import { TableEmptyMessageComponent } from './components/table-empty-message/tab import { NgxValidateCoreModule } from '@ngx-validate/core'; export function appendScript(injector: Injector) { - const fn = function() { + const fn = () => { import('chart.js').then(() => chartJsLoaded$.next(true)); const lazyLoadService: LazyLoadService = injector.get(LazyLoadService); @@ -32,8 +32,8 @@ export function appendScript(injector: Injector) { 'style', styles, 'head', - 'afterbegin', - ) /* lazyLoadService.load(null, 'script', scripts) */, + 'afterbegin' + ) /* lazyLoadService.load(null, 'script', scripts) */ ).pipe(take(1)); }; @@ -53,7 +53,7 @@ export function appendScript(injector: Injector) { ModalComponent, ProfileComponent, TableEmptyMessageComponent, - ToastComponent, + ToastComponent ], exports: [ BreadcrumbComponent, @@ -65,9 +65,9 @@ export function appendScript(injector: Injector) { ModalComponent, ProfileComponent, TableEmptyMessageComponent, - ToastComponent, + ToastComponent ], - entryComponents: [ErrorComponent], + entryComponents: [ErrorComponent] }) export class ThemeSharedModule { static forRoot(): ModuleWithProviders { @@ -78,10 +78,10 @@ export class ThemeSharedModule { provide: APP_INITIALIZER, multi: true, deps: [Injector, ErrorHandler], - useFactory: appendScript, + useFactory: appendScript }, - { provide: MessageService, useClass: MessageService }, - ], + { provide: MessageService, useClass: MessageService } + ] }; } } diff --git a/npm/ng-packs/packages/theme-shared/tslint.json b/npm/ng-packs/packages/theme-shared/tslint.json index 124133f849..9d39c7dc74 100644 --- a/npm/ng-packs/packages/theme-shared/tslint.json +++ b/npm/ng-packs/packages/theme-shared/tslint.json @@ -1,17 +1,7 @@ { "extends": "../../tslint.json", "rules": { - "directive-selector": [ - true, - "attribute", - "lib", - "camelCase" - ], - "component-selector": [ - true, - "element", - "lib", - "kebab-case" - ] + "directive-selector": [true, "attribute", "abp", "camelCase"], + "component-selector": [true, "element", "abp", "kebab-case"] } } diff --git a/npm/ng-packs/tslint.json b/npm/ng-packs/tslint.json index 0888c34adb..348320008c 100644 --- a/npm/ng-packs/tslint.json +++ b/npm/ng-packs/tslint.json @@ -1,55 +1,100 @@ { "extends": "tslint:recommended", + "rulesDirectory": ["node_modules/codelyzer"], "rules": { "array-type": false, + "contextual-lifecycle": true, + "component-class-suffix": [true, "Component"], + "directive-class-suffix": [true, "Directive"], + "max-line-length": [true, 140], + "no-consecutive-blank-lines": false, + "no-redundant-jsdoc": true, + "no-var-requires": false, + "object-literal-key-quotes": [true, "as-needed"], + "ordered-imports": false, + "trailing-comma": false, + "component-max-inline-declarations": [true, { "animations": 20, "styles": 10, "template": 10 }], + "no-forward-ref": true, + "no-lifecycle-call": true, + "no-pipe-impure": true, + "no-queries-metadata-property": true, + "no-unused-css": true, + "prefer-output-readonly": true, + "template-conditional-complexity": [true, 4], + "use-component-selector": true, + "max-classes-per-file": false, "arrow-parens": false, + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "component-selector": [true, "element", "abp", "kebab-case"], + "curly": false, "deprecation": { "severity": "warn" }, - "component-class-suffix": true, - "contextual-lifecycle": true, - "directive-class-suffix": true, "directive-selector": [true, "attribute", "abp", "camelCase"], - "component-selector": [true, "element", "abp", "kebab-case"], + "forin": true, "import-blacklist": [true, "rxjs/Rx"], - "interface-name": false, - "max-classes-per-file": false, - "max-line-length": [true, 140], - "member-access": false, + "interface-over-type-literal": true, + "interface-name": [true, "never-prefix"], + "member-access": [true, "no-public"], "member-ordering": [ true, { "order": ["static-field", "instance-field", "static-method", "instance-method"] } ], - "no-consecutive-blank-lines": false, + "no-arg": true, + "no-bitwise": true, + "no-conflicting-lifecycle": true, "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty-interface": true, "no-empty": false, - "no-inferrable-types": [false, "ignore-params"], - "no-non-null-assertion": true, - "no-redundant-jsdoc": true, - "no-switch-case-fall-through": true, - "no-use-before-declare": true, - "no-var-requires": false, - "curly": false, - "object-literal-key-quotes": [true, "as-needed"], - "object-literal-sort-keys": false, - "ordered-imports": false, - "quotemark": [true, "single"], - "trailing-comma": false, - "no-conflicting-lifecycle": true, + "no-eval": true, "no-host-metadata-property": true, - "no-input-rename": true, + "no-inferrable-types": [true, "ignore-params"], + "no-input-rename": false, "no-inputs-metadata-property": true, + "no-misused-new": true, + "no-namespace": false, + "no-non-null-assertion": true, "no-output-native": true, "no-output-on-prefix": true, - "no-output-rename": true, + "no-output-rename": false, "no-outputs-metadata-property": true, - "no-namespace": false, - "template-banana-in-box": true, - "template-no-negated-async": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-unnecessary-initializer": true, + "no-unnecessary-semicolons": false, + "no-unused-expression": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "prefer-const": true, + "quotemark": [true, "single", "avoid-escape", "avoid-template"], + "radix": true, + "semicolon": [true, "always", "ignore-bound-class-methods"], + // "template-accessibility-alt-text": true, + // "template-accessibility-elements-content": true, + // "template-accessibility-label-for": true, + // "template-accessibility-tabindex-no-positive": true, + // "template-accessibility-table-scope": true, + // "template-accessibility-valid-aria": true, + // "template-banana-in-box": true, + // "template-click-events-have-key-events": true, + // "template-mouse-events-have-key-events": true, + // "template-no-autofocus": true, + // "template-no-distracting-elements": true, + // "template-no-negated-async": true, + "triple-equals": [true, "allow-null-check"], + "unified-signatures": true, "use-lifecycle-interface": true, - "use-pipe-transform-interface": true - }, - "rulesDirectory": ["codelyzer"] + "use-pipe-transform-interface": true, + "variable-name": false, + "prefer-for-of": false + } } From b913396358650a1caf16556478fbbfcb538d8ead Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 1 Oct 2019 11:37:08 +0300 Subject: [PATCH 019/109] chore: update workspace settings --- npm/ng-packs/.vscode/settings.json | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/.vscode/settings.json b/npm/ng-packs/.vscode/settings.json index a768ac15eb..ba819b4f57 100644 --- a/npm/ng-packs/.vscode/settings.json +++ b/npm/ng-packs/.vscode/settings.json @@ -1,5 +1,22 @@ { "search.exclude": { "**/dist": true - } -} \ No newline at end of file + }, + "tslint.rulesDirectory": "../node_modules/codelyzer", + "typescript.tsdk": "../node_modules/typescript/lib", + "workbench.colorCustomizations": { + "activityBar.background": "#df7fa2", + "activityBar.foreground": "#15202b", + "activityBar.inactiveForeground": "#15202b99", + "activityBarBadge.background": "#c7ecb3", + "activityBarBadge.foreground": "#15202b", + "titleBar.activeBackground": "#d55685", + "titleBar.inactiveBackground": "#d5568599", + "titleBar.activeForeground": "#15202b", + "titleBar.inactiveForeground": "#15202b99", + "statusBar.background": "#d55685", + "statusBarItem.hoverBackground": "#c73169", + "statusBar.foreground": "#15202b" + }, + "peacock.color": "#d55685" +} From 1c484a2b8d11a1e5161b35b96eff6040915f9216 Mon Sep 17 00:00:00 2001 From: TheDiaval Date: Tue, 1 Oct 2019 11:38:03 +0300 Subject: [PATCH 020/109] bump: change build-angular and build-ng-packagr versions --- npm/ng-packs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index b40344ed62..019aa90d26 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -9,8 +9,8 @@ "@abp/ng.feature-management": "^0.9.0", "@abp/ng.permission-management": "^0.9.0", "@abp/ng.theme.shared": "^0.9.0", - "@angular-devkit/build-angular": "~0.803.5", - "@angular-devkit/build-ng-packagr": "~0.803.5", + "@angular-devkit/build-angular": "~0.803.6", + "@angular-devkit/build-ng-packagr": "~0.803.6", "@angular/animations": "~8.2.7", "@angular/cdk": "^8.0.1", "@angular/cli": "~8.3.5", From baf086b818096319033a5ac32c3da01d98a421d0 Mon Sep 17 00:00:00 2001 From: Xeevis Date: Tue, 1 Oct 2019 11:23:59 +0200 Subject: [PATCH 021/109] Cleanup default AspNetCoreHostingModel --- .../app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj | 1 - .../Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj | 1 - modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj | 1 - .../DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj | 1 - .../applications/AuthServer.Host/AuthServer.Host.csproj | 1 - .../BackendAdminApp.Host/BackendAdminApp.Host.csproj | 1 - .../applications/PublicWebSite.Host/PublicWebSite.Host.csproj | 1 - .../BackendAdminAppGateway.Host.csproj | 1 - .../gateways/InternalGateway.Host/InternalGateway.Host.csproj | 1 - .../PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj | 1 - .../BloggingService.Host/BloggingService.Host.csproj | 1 - .../IdentityService.Host/IdentityService.Host.csproj | 1 - .../microservices/ProductService.Host/ProductService.Host.csproj | 1 - .../MyCompanyName.MyProjectName.HttpApi.Host.csproj | 1 - .../MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj | 1 - .../MyCompanyName.MyProjectName.IdentityServer.csproj | 1 - .../MyCompanyName.MyProjectName.Web.Host.csproj | 1 - .../MyCompanyName.MyProjectName.Web.csproj | 1 - .../MyCompanyName.MyProjectName.HttpApi.Host.csproj | 1 - .../MyCompanyName.MyProjectName.IdentityServer.csproj | 1 - .../MyCompanyName.MyProjectName.Web.Host.csproj | 1 - .../MyCompanyName.MyProjectName.Web.Unified.csproj | 1 - 22 files changed, 22 deletions(-) diff --git a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj index a0df8b49dc..a0712e66f1 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj +++ b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj index e3cc5d272b..6cfdef4205 100644 --- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess true diff --git a/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj b/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj index fa6ddeaecc..f7b0567f4c 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj +++ b/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess true true false diff --git a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj index b7d55edcc6..56a3fa2209 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess DashboardDemo.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj index afb74d50af..0c6538bf57 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj index 14a095e1c1..96ff8bb1dc 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj index 9dd7893417..1475311f4b 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 99f77f1cf7..cc8cd37351 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj index b1a53d5937..ae9b1d5dd1 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj index c6984b675b..f9bc566169 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj index 1387ead184..51f991da3f 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj index 1807d88dfe..684f1bd4f1 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj index 6e55f1f952..80d2a33bd6 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true true diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index 4dca96ebc3..a6e9f78048 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj index 90bbba330a..c8f15b6820 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index 7923f258c4..bdd8139f79 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 290d5f7f2c..ca8202b42a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index e1b7935faa..9bfeded944 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; true diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index 0e4a3fb1a5..efcb7e857a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index 1636df98d8..5586141e5a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -2,7 +2,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 0a3cb9dbc2..f98264ed74 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj index af9c8fb429..acf0fcb8c3 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj @@ -4,7 +4,6 @@ netcoreapp3.0 - InProcess MyCompanyName.MyProjectName true From bb6462e2c2dc8957a458ddf1e3a2bed5799b4530 Mon Sep 17 00:00:00 2001 From: TheDiaval Date: Tue, 1 Oct 2019 16:06:20 +0300 Subject: [PATCH 022/109] refactor(theme-shared): change collapse and fade animations --- .../src/lib/animations/collapse.animations.ts | 53 +++++++++++++------ .../src/lib/animations/fade.animations.ts | 30 +++++------ 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/collapse.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/collapse.animations.ts index af71b948df..ad6cf81e70 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/collapse.animations.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/collapse.animations.ts @@ -1,19 +1,40 @@ -import { trigger, state, style, transition, animate } from '@angular/animations'; +import { animate, animation, trigger, state, style, transition, useAnimation } from '@angular/animations'; + +export const collapseY = animation( + [ + style({ height: '*', overflow: 'hidden', 'box-sizing': 'border-box' }), + animate('{{ time }} {{ easing }}', style({ height: '0', padding: '0px' })) + ], + { params: { time: '350ms', easing: 'ease' } } +); + +export const collapseX = animation( + [ + style({ width: '*', overflow: 'hidden', 'box-sizing': 'border-box' }), + animate('{{ time }} {{ easing }}', style({ width: '0', padding: '0px' })) + ], + { params: { time: '350ms', easing: 'ease' } } +); + +export const expandY = animation( + [ + style({ height: '0', overflow: 'hidden', 'box-sizing': 'border-box' }), + animate('{{ time }} {{ easing }}', style({ height: '*', padding: '*' })) + ], + { params: { time: '350ms', easing: 'ease' } } +); + +export const expandX = animation( + [ + style({ width: '0', overflow: 'hidden', 'box-sizing': 'border-box' }), + animate('{{ time }} {{ easing }}', style({ width: '*', padding: '*' })) + ], + { params: { time: '350ms', easing: 'ease' } } +); export const collapse = trigger('collapse', [ - state( - 'open', - style({ - height: '*', - overflow: 'hidden' - }) - ), - state( - 'close', - style({ - height: '0px', - overflow: 'hidden' - }) - ), - transition('open <=> close', animate('{{duration}}ms'), { params: { duration: '350' } }) + state('collapsed', style({ height: '0', overflow: 'hidden' })), + state('expanded', style({ height: '*', overflow: 'hidden' })), + transition('expanded => collapsed', useAnimation(collapseY)), + transition('collapsed => expanded', useAnimation(expandY)) ]); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts index fb523e0d56..60be602291 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts @@ -1,19 +1,15 @@ -import { animate, state, style, transition, trigger } from '@angular/animations'; +import { animate, animation, style } from '@angular/animations'; -export const fade = trigger('fade', [ - state('void', style({ opacity: 1 })), - transition(':enter', [style({ opacity: 0 }), animate(250)]), - transition(':leave', animate(250, style({ opacity: 0 }))), -]); +export const fadeIn = animation( + [style({ opacity: '0', display: '{{ display }}' }), animate('{{ time}} {{ easing }}', style({ opacity: '1' }))], + { params: { time: '350ms', easing: 'ease', display: 'block' } } +); -export const fadeWithStates = trigger('fadeInOut', [ - state('out', style({ opacity: 0 })), - state('in', style({ opacity: 1 })), - transition('in <=> out', [animate(250)]), -]); - -export const fadeIn = trigger('fadeIn', [ - state('*', style({ opacity: 1 })), - transition('* => *', [style({ opacity: 0 }), animate(250)]), - transition(':enter', [style({ opacity: 0 }), animate(250)]), -]); +export const fadeOut = animation( + [ + style({ opacity: '1' }), + animate('{{ time}} {{ easing }}', style({ opacity: '0' })), + style({ opacity: '0', display: 'none' }) + ], + { params: { time: '350ms', easing: 'ease' } } +); From 40513fbd1b06d176a5a1741dea57067820b8e3a3 Mon Sep 17 00:00:00 2001 From: TheDiaval Date: Tue, 1 Oct 2019 16:06:47 +0300 Subject: [PATCH 023/109] feature(theme-shared): add bounceIn animation --- .../src/lib/animations/bounce.animations.ts | 23 +++++++++++++++++++ .../theme-shared/src/lib/animations/index.ts | 1 + 2 files changed, 24 insertions(+) create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts new file mode 100644 index 0000000000..ccdc62c491 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/bounce.animations.ts @@ -0,0 +1,23 @@ +import { animation, animate, style, trigger, transition, state, useAnimation, keyframes } from '@angular/animations'; + +export const bounceIn = animation( + [ + style({ opacity: '0', display: '{{ display }}' }), + animate( + '{{ time}} {{ easing }}', + 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 }) + ]) + ) + ], + { + params: { + time: '350ms', + easing: 'cubic-bezier(.7,.31,.72,1.47)', + display: 'block', + transform: 'translate(-50%, -50%)' + } + } +); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts index 50772ccedc..5a7009be17 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts @@ -1,3 +1,4 @@ export * from './collapse.animations'; export * from './fade.animations'; export * from './slide.animations'; +export * from './bounce.animations'; From 45ebb59a4908ef8db9e454da7ef4cae285a41845 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 2 Oct 2019 13:59:33 +0300 Subject: [PATCH 024/109] fix: some bugs --- .../application-configuration.service.ts | 3 +- .../src/lib/services/localization.service.ts | 13 +++---- .../core/src/lib/services/rest.service.ts | 7 ++-- .../core/src/lib/states/config.state.ts | 35 ++++++++++--------- .../core/src/lib/utils/initial-utils.ts | 3 +- .../setting-management.component.html | 3 -- .../setting-management.component.ts | 6 ++-- 7 files changed, 32 insertions(+), 38 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts b/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts index d0a653e1e0..5081f94068 100644 --- a/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { ApplicationConfiguration, Rest } from '../models'; +import { Rest } from '../models/rest'; +import { ApplicationConfiguration } from '../models/application-configuration'; import { RestService } from './rest.service'; @Injectable({ diff --git a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts index 2af99ee227..a26f1af06f 100644 --- a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts @@ -1,9 +1,7 @@ -import { Injectable, Optional, SkipSelf, NgZone } from '@angular/core'; +import { Injectable, NgZone, Optional, SkipSelf } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; -import { Actions, Store } from '@ngxs/store'; +import { Store } from '@ngxs/store'; import { noop, Observable } from 'rxjs'; -import { ConfigState } from '../states/config.state'; -import { SessionState } from '../states/session.state'; import { registerLocale } from '../utils/initial-utils'; type ShouldReuseRoute = (future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot) => boolean; @@ -11,14 +9,13 @@ type ShouldReuseRoute = (future: ActivatedRouteSnapshot, curr: ActivatedRouteSna @Injectable({ providedIn: 'root' }) export class LocalizationService { get currentLang(): string { - return this.store.selectSnapshot(SessionState.getLanguage); + return this.store.selectSnapshot(state => state.SessionState.getLanguage); } constructor( private store: Store, private router: Router, private ngZone: NgZone, - private actions: Actions, @Optional() @SkipSelf() otherInstance: LocalizationService, @@ -45,10 +42,10 @@ export class LocalizationService { } get(keys: string, ...interpolateParams: string[]): Observable { - return this.store.select(ConfigState.getCopy(keys, ...interpolateParams)); + return this.store.select(state => state.ConfigState.getCopy(keys, ...interpolateParams)); } instant(keys: string, ...interpolateParams: string[]): string { - return this.store.selectSnapshot(ConfigState.getCopy(keys, ...interpolateParams)); + return this.store.selectSnapshot(state => state.ConfigState.getCopy(keys, ...interpolateParams)); } } diff --git a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts index 7ff1a42af0..5f402f896b 100644 --- a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts @@ -1,11 +1,10 @@ import { HttpClient, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Store } from '@ngxs/store'; -import { NEVER, Observable, throwError } from 'rxjs'; +import { Observable, throwError } from 'rxjs'; import { catchError, take } from 'rxjs/operators'; +import { RestOccurError } from '../actions/rest.actions'; import { Rest } from '../models/rest'; -import { ConfigState } from '../states'; -import { RestOccurError } from '../actions'; @Injectable({ providedIn: 'root', @@ -21,7 +20,7 @@ export class RestService { request(request: HttpRequest | Rest.Request, config: Rest.Config = {}, api?: string): Observable { const { observe = Rest.Observe.Body, skipHandleError } = config; - const url = api || this.store.selectSnapshot(ConfigState.getApiUrl()) + request.url; + const url = api || this.store.selectSnapshot(state => state.ConfigState).environment.apis.default.url + request.url; const { method, ...options } = request; return this.http.request(method, url, { observe, ...options } as any).pipe( observe === Rest.Observe.Body ? take(1) : null, diff --git a/npm/ng-packs/packages/core/src/lib/states/config.state.ts b/npm/ng-packs/packages/core/src/lib/states/config.state.ts index 4f43a0bf65..29799a502b 100644 --- a/npm/ng-packs/packages/core/src/lib/states/config.state.ts +++ b/npm/ng-packs/packages/core/src/lib/states/config.state.ts @@ -1,17 +1,18 @@ import { State, Selector, createSelector, Action, StateContext, Store } from '@ngxs/store'; -import { Config, ABP } from '../models'; +import { Config } from '../models/config'; +import { ABP } from '../models/common'; import { GetAppConfiguration, PatchRouteByName } from '../actions/config.actions'; import { ApplicationConfigurationService } from '../services/application-configuration.service'; import { tap, switchMap } from 'rxjs/operators'; import snq from 'snq'; -import { SetLanguage } from '../actions'; +import { SetLanguage } from '../actions/session.actions'; import { SessionState } from './session.state'; import { of } from 'rxjs'; import { setChildRoute, sortRoutes, organizeRoutes } from '../utils/route-utils'; @State({ name: 'ConfigState', - defaults: {} as Config.State + defaults: {} as Config.State, }) export class ConfigState { @Selector() @@ -29,7 +30,7 @@ export class ConfigState { [ConfigState], (state: Config.State) => { return state[key]; - } + }, ); return selector; @@ -54,7 +55,7 @@ export class ConfigState { return undefined; }, state); - } + }, ); return selector; @@ -72,7 +73,7 @@ export class ConfigState { return route; } }); - } + }, ); return selector; @@ -83,7 +84,7 @@ export class ConfigState { [ConfigState], (state: Config.State): string => { return state.environment.apis[key || 'default'].url; - } + }, ); return selector; @@ -94,7 +95,7 @@ export class ConfigState { [ConfigState], (state: Config.State) => { return snq(() => state.setting.values[key]); - } + }, ); return selector; @@ -106,7 +107,7 @@ export class ConfigState { (state: Config.State): boolean => { if (!key) return true; return snq(() => state.auth.grantedPolicies[key], false); - } + }, ); return selector; @@ -131,7 +132,7 @@ export class ConfigState { localization: { defaultResourceName: 'MyProjectName' } - }` + }`, ); } @@ -154,7 +155,7 @@ export class ConfigState { } return copy || key; - } + }, ); return selector; @@ -167,8 +168,8 @@ export class ConfigState { return this.appConfigurationService.getConfiguration().pipe( tap(configuration => patchState({ - ...configuration - }) + ...configuration, + }), ), switchMap(configuration => { let defaultLang: string = configuration.setting.values['Abp.Localization.DefaultLanguage']; @@ -178,7 +179,7 @@ export class ConfigState { } return this.store.selectSnapshot(SessionState.getLanguage) ? of(null) : dispatch(new SetLanguage(defaultLang)); - }) + }), ); } @@ -191,7 +192,7 @@ export class ConfigState { routes = patchRouteDeep(routes, name, newValue); return patchState({ - routes + routes, }); } } @@ -200,7 +201,7 @@ function patchRouteDeep( routes: ABP.FullRoute[], name: string, newValue: Partial, - parentUrl: string = null + parentUrl: string = null, ): ABP.FullRoute[] { routes = routes.map(route => { if (route.name === name) { @@ -211,7 +212,7 @@ function patchRouteDeep( if (newValue.children && newValue.children.length) { newValue.children = newValue.children.map(child => ({ ...child, - url: `${parentUrl}/${route.path}/${child.path}` + url: `${parentUrl}/${route.path}/${child.path}`, })); } diff --git a/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts index dc4ae36065..d1e703165e 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts @@ -3,7 +3,6 @@ import { Injector } from '@angular/core'; import { Store } from '@ngxs/store'; import { GetAppConfiguration } from '../actions/config.actions'; import differentLocales from '../constants/different-locales'; -import { SessionState } from '../states/session.state'; export function getInitialData(injector: Injector) { const fn = () => { @@ -19,7 +18,7 @@ export function localeInitializer(injector: Injector) { const fn = () => { const store: Store = injector.get(Store); - const lang = store.selectSnapshot(SessionState.getLanguage) || 'en'; + const lang = store.selectSnapshot(state => state.SessionState.getLanguage) || 'en'; return new Promise((resolve, reject) => { registerLocale(lang).then(() => resolve(), reject); diff --git a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html index 030a020418..58659ff50b 100644 --- a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html +++ b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html @@ -13,9 +13,6 @@
-
- -