iaudit-core-library v17.0.0
IauditCoreLibrary
This library was generated with Angular CLI version 12.0.6.
Code scaffolding
Run ng generate component component-name --project iaudit-core-library
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project iaudit-core-library
.
Note: Don't forget to add
--project iaudit-core-library
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build iaudit-core-library
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build iaudit-core-library
, go to the dist folder cd dist/iaudit-core-library
and run npm publish
.
Running unit tests
Run ng test iaudit-core-library
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.
Content
Here you will find all the resources available to be used in the application
ApplicationService
Your responsibility is to manager all notifications
Methods
notifyUser(user: any): void notifyTranslate(language: DataValueResponse): void
Variables
- public userEmmitter: EventEmitter<string> = new EventEmitter(null); - public translateEmmitter: EventEmitter<DataValueResponse> = new EventEmitter(null);
CookieService
Your responsibility is to manage custom cookies
Methods
get(name: string): any create(name: string, value: any): void delete(name: string ): void
CookieUserService
Your responsability is to manager informations about user Methods
create(response: any): void delete(): void getUserInfo(): UserInfo
CookieLanguageService
Your responsability is to manager informations about language
Methods
create(language: any): void delete(): void get(): DataValueResponse[]
CookieCustomerService
Your responsability is to manager informations about customer
Methods
create(customer: string): void get(): string delete(): void
AuthenticationService
Your responsability is to manager life cicle user
Methods
createSession(expiresIn: number): any tokenExpired(): boolean login(user: Authentication, apiUrl: string): Observable<any> logout(): void change(changePassword: ChangePassword, url: string): Observable<any> recover(recover: RecoverPassword, url: string): Observable<any> isAuthenticated()
Types
export enum UserType { External = 1, Internal = 2 }
export enum GmtType { Application, User }
#### [CustomTranslateService]
Your responsibility is to configure '@ngx-translate/core' and allow the language to be changed.
> Methods
```bashsh
setup(codes: string[]): void
use(code: string): void
Share
This section is more important, here we have mandatory and other optional features to be used in the applications.
BaseComponent
Your responsibility is to share resources with all angular components. To use it will be necessary to inherit this class
Methods
ngOnInit(): void translate(key: string): string translateButtonPagination(): void getActives(): void onEditorChangeValue(owner: any): void updateLocate(code: string = null): void ngAfterViewInit(): void validateField(form: FormGroup, field: string, error: string = 'required'): boolean openModal(modalId: string): void closeModal(modalId: string): void split(text: string, character: string): string[] activeTab(tabId: string): void getFormValidationErrors(form: FormGroup): void getTabKey(form: FormGroup): string private findInput(key: string): string protected getCookieUser(): string protected getGmt(who: GmtType) protected setTimeZone(date: Date, gmt: number): Date public setCookieUser(cookieUserName: string): void mustMatch(controlName: string, matchingControlName: string)
Tabs - SmartAdmin
<ul class="nav nav-pills nav-justified" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" name='js_change_pill_justified-1' href="#js_change_pill_justified-1">{{'context.report.create.tabs.tab01' | translate}}</a>
</li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" name='js_change_pill_justified-2' href="#js_change_pill_justified-2">{{'context.report.create.tabs.tab02' | translate}}</a>
</li>
<ul>
<div class="tab-content py-3">
<div class="tab-pane fade show active" id="js_change_pill_justified-1" role="tabpanel">
<div class="row">
<div class="col-lg-3">
<div class="form-group">
<label class="control-label">{{'context.report.create.denounced.function' | translate}}</label>
<div class="input-group bg-white shadow-inset-2">
<input [readonly]="isReadOnlyReportData" type="text" class="form-control" formControlName="Function" id="Function" tab="js_change_pill_justified-1">
</div>
<span *ngIf="validateField(denouncedForm,'Function')" class="text-danger help-block"><strong>
{{'messages.requiredfield' | translate}}
</strong> </span>
</div>
</div>
</div>
<div class="tab-pane fade" id="js_change_pill_justified-2" role="tabpanel">
<div class="row">
<div class="col-lg-3">
<div class="form-group">
<label class="control-label">{{'context.report.create.denounced.LastNanme' | translate}}</label>
<div class="input-group bg-white shadow-inset-2">
<input [readonly]="isReadOnlyReportData" type="text" class="form-control" formControlName="LastName" id="LastName" tab="js_change_pill_justified-2">
</div>
<span *ngIf="validateField(denouncedForm,'LastName')" class="text-danger help-block"><strong>
{{'messages.requiredfield' | translate}}
</strong> </span>
</div>
</div>
</div>
Obs. play attention on id inputs property and tab property.
if (!this.form.valid) {
const tab = this.getTabKey(this.form);
this.activeTab(tab);
this.form.markAllAsTouched();
this.message.fire({
icon: 'error',
title: this.translate('messages.dialogs.title'),
text: this.translate('messages.dialogs.required'),
footer: ''
});
return;
}
Case want show specific tab use this this.activeTab('js_change_pill_justified-2')
#### [Models]
Here we are have some generics models to use in application
> class
```bash
export class DataResponse {
public success = false;
}
export class DataValueResponse {
constructor(
public Id: any = null,
public Name: string = null,
public Code: string = null
) { }
}
export class Dropdown extends DataResponse {
constructor(
public data: DataValueResponse[] = null
) {
super();
}
}
Public variables
declare var $: any;
defineLocale('pt-br', ptBrLocale);
config: NgSelectConfig;
authenticationService: AuthenticationService;
applicationService: ApplicationService;
cookieLanguageService: CookieLanguageService;
cookieUserService: CookieUserService;
cookieService: CookieService;
customTranslateService: CustomTranslateService;
crosscutService: CrosscutService;
localeService: BsLocaleService;
subscription: Subscription;
route: ActivatedRoute;
router: Router;
fb: FormBuilder;
form: FormGroup;
nameMask: any = null;
maskType: any = null;
placeholderMask: any = null;
errors: any[] = [];
message = Swal;
@ViewChild('editor') editor: { dataChange: { subscribe: (arg0: (value: string) => void) => void; }; };
locales: string[];
page = 1;
pageBefore = '';
pageNext = '';
modalId = '';
isSearch = false;
canDelete = false;
maxDate: Date = new Date();
currentlanguage: DataValueResponse;
actives = new Array<DataValueResponse>();
element: ElementRef;
spinner: NgxSpinnerService;
gmt: number;
Required Module
Your responsibility is to share all visual and non-visual components for each application module.
Exports
imports: [ CommonModule, FormsModule, ReactiveFormsModule, RouterModule, HttpClientModule, NgxPaginationModule, NgxCurrencyModule, NgxMaskModule.forRoot(options), BsDatepickerModule.forRoot(), NgSelectModule, NgxDropzoneModule, TranslateModule, NgxSpinnerModule ], declarations: [ IauditDataFilterPipe ], exports: [ CommonModule, FormsModule, ReactiveFormsModule, RouterModule, HttpClientModule, NgxPaginationModule, NgxCurrencyModule, NgxMaskModule, BsDatepickerModule, NgSelectModule, CKEditorModule, NgxDropzoneModule, TranslateModule, IauditDataFilterPipe ]
Obs. IauditDataFilterPipe it is a pipe, to use is necessary call per your name @Pipe({ name: 'iauditdatafilter', pure: false }) Exemple as use this pipe
#### [BaseService]
Your responsibility is to share resources about calls with api.
> Methods
```bash
protected translate(key: string): string
protected getHeaderJson(): { headers: HttpHeaders; }
protected getHeaderFormDataWithoutContent():
protected getHeaderFormData(name: string): { headers: HttpHeaders; }
protected getAuthHeaderJson(): { headers: HttpHeaders; }
protected getUserToken(): string
protected extractData(response: any): any
protected serviceError(error: Response | any): Observable<never>
protected getGmt(who: GmtType)
protected setTimeZone(date: Date, gmt: number): Date
protected getCookieUser(): string
public setUrl(urlApi: string): void
public setCookieUser(cookieUserName: string): void
CrosscutService
Your responsibility is not to provide adequate abstractions to modularize.
Methods
newGuid(): string nullGuid(): string getYesNo(): DataValueResponse[] getCountries(): DataValueResponse[]
3 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago