From ae1bcd4d0aec350886eb94fd901fdefd6db9cf76 Mon Sep 17 00:00:00 2001 From: endy Date: Wed, 25 Apr 2018 15:45:16 +0500 Subject: [PATCH] fix(forms): Add checkIsDirty for disable show errors in form on init --- apps/demo/src/app/app.component.ts | 7 ++++--- .../base/base-prompt-form-modal.component.ts | 2 ++ .../base/base-prompt-modal.component.ts | 2 ++ .../base/base-prompt-panel.component.ts | 2 ++ .../content-type-modal.component.html | 4 ++-- .../group/group-modal/group-modal.component.html | 4 ++-- .../permission-modal.component.html | 6 +++--- .../profile-panel/profile-panel.component.html | 16 ++++++++-------- .../profile-panel/profile-panel.component.ts | 5 ++++- .../user/user-modal/user-modal.component.html | 16 ++++++++-------- .../user/user-modal/user-modal.component.ts | 1 - .../modals/auth-modal/auth-modal.component.html | 4 ++-- .../entity-modal/entity-modal.component.html | 2 +- .../entity-modal/entity-modal.component.ts | 2 +- .../others/form-group/form-group.component.ts | 2 +- 15 files changed, 42 insertions(+), 33 deletions(-) diff --git a/apps/demo/src/app/app.component.ts b/apps/demo/src/app/app.component.ts index 58a0e364..ba99aa38 100644 --- a/apps/demo/src/app/app.component.ts +++ b/apps/demo/src/app/app.component.ts @@ -47,7 +47,7 @@ export class AppComponent implements OnDestroy { lang => { this._bsLocaleService.use(lang); } - ); + ); this._tokenService.tokenHasExpired$.pipe( takeUntil(this._destroyed$) ).subscribe(result => { @@ -80,7 +80,7 @@ export class AppComponent implements OnDestroy { data => this.onLogoutSuccess(undefined) ) - ); + ); } else { if (!this.accountService.current) { this.accountService.info(token).subscribe( @@ -125,7 +125,8 @@ export class AppComponent implements OnDestroy { initialState: { title: this._translateService.instant('Authorization'), yesTitle: this._translateService.instant('Sign in'), - data: {} + data: {}, + checkIsDirty: true } }); bsModalRef.content.yes.subscribe( diff --git a/libs/@rucken/web/src/components/base/base-prompt-form-modal.component.ts b/libs/@rucken/web/src/components/base/base-prompt-form-modal.component.ts index b9d1d540..255a2763 100644 --- a/libs/@rucken/web/src/components/base/base-prompt-form-modal.component.ts +++ b/libs/@rucken/web/src/components/base/base-prompt-form-modal.component.ts @@ -7,6 +7,8 @@ import { IFactoryModel, IModel } from 'ngx-repository'; export class BasePromptFormModalComponent { + @Input() + checkIsDirty?: boolean; @Input() processing: boolean; @Input() diff --git a/libs/@rucken/web/src/components/base/base-prompt-modal.component.ts b/libs/@rucken/web/src/components/base/base-prompt-modal.component.ts index 7559cb21..f3ab6967 100644 --- a/libs/@rucken/web/src/components/base/base-prompt-modal.component.ts +++ b/libs/@rucken/web/src/components/base/base-prompt-modal.component.ts @@ -4,6 +4,8 @@ import { BsModalRef } from 'ngx-bootstrap/modal'; export class BasePromptModalComponent { + @Input() + checkIsDirty?: boolean; @Input() processing: boolean; @Input() diff --git a/libs/@rucken/web/src/components/base/base-prompt-panel.component.ts b/libs/@rucken/web/src/components/base/base-prompt-panel.component.ts index fe8e5fd5..d2b039fa 100644 --- a/libs/@rucken/web/src/components/base/base-prompt-panel.component.ts +++ b/libs/@rucken/web/src/components/base/base-prompt-panel.component.ts @@ -7,6 +7,8 @@ import { IFactoryModel, IModel } from 'ngx-repository'; export class BasePromptPanelComponent implements ControlValueAccessor, OnChanges { + @Input() + checkIsDirty?: boolean; @Input() processing: boolean; @Input() diff --git a/libs/@rucken/web/src/components/entities/content-type/content-type-modal/content-type-modal.component.html b/libs/@rucken/web/src/components/entities/content-type/content-type-modal/content-type-modal.component.html index 1a351f98..28de4f9d 100644 --- a/libs/@rucken/web/src/components/entities/content-type/content-type-modal/content-type-modal.component.html +++ b/libs/@rucken/web/src/components/entities/content-type/content-type-modal/content-type-modal.component.html @@ -1,10 +1,10 @@
- + - + diff --git a/libs/@rucken/web/src/components/entities/group/group-modal/group-modal.component.html b/libs/@rucken/web/src/components/entities/group/group-modal/group-modal.component.html index 6a179078..0fa3290b 100644 --- a/libs/@rucken/web/src/components/entities/group/group-modal/group-modal.component.html +++ b/libs/@rucken/web/src/components/entities/group/group-modal/group-modal.component.html @@ -1,10 +1,10 @@ - + - + - + - + - + diff --git a/libs/@rucken/web/src/components/entities/user/profile-panel/profile-panel.component.html b/libs/@rucken/web/src/components/entities/user/profile-panel/profile-panel.component.html index b7061148..b55c96e0 100644 --- a/libs/@rucken/web/src/components/entities/user/profile-panel/profile-panel.component.html +++ b/libs/@rucken/web/src/components/entities/user/profile-panel/profile-panel.component.html @@ -3,37 +3,37 @@
- +
- +
- +
- +
- +
- +
- +
@@ -45,7 +45,7 @@
- +