-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dynamic-view): ajustes finais de sample e documentação
- Loading branch information
Showing
5 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
8 changes: 3 additions & 5 deletions
8
...lib/components/po-dynamic/po-dynamic-view/interfaces/po-dynamic-view-request.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import { Observable } from 'rxjs'; | ||
|
||
/** | ||
* @usedBy PoLookupComponent | ||
* @usedBy PoDynamicViewComponent | ||
* | ||
* @description | ||
* | ||
* Define o tipo de busca utilizado no po-lookup. | ||
* Define o tipo de busca customizada para um campo em específico. | ||
*/ | ||
export interface PoDynamicViewRequest { | ||
/** | ||
* Método responsável por enviar um valor que será buscado no serviço. | ||
* | ||
* Caso a funcionalidade de múltipla seleção estver habilitada, o parametro value será enviado como uma lista de valores | ||
* e o observable deve retornar uma lista de objetos. | ||
* | ||
* @param {string|Array<any>} value Valor único a ser buscado na fonte de dados. | ||
* @param {any} filterParams Valor informado através da propriedade `p-filter-params`. | ||
* @param {any} filterParams Valor opcional para informar filtros customizados. | ||
*/ | ||
getObjectByValue(value: string | Array<any>, filterParams?: any): Observable<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ample-po-dynamic-view-employee-on-load/sample-po-dynamic-view-employee-on-load.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { Observable, map } from 'rxjs'; | ||
|
||
@Injectable() | ||
export class SamplePoDynamicViewEmployeeOnLoadService { | ||
readonly headers: HttpHeaders = new HttpHeaders({ | ||
'X-PO-No-Message': 'true' | ||
}); | ||
|
||
url: string; | ||
filterParams; | ||
|
||
constructor(private httpClient: HttpClient) {} | ||
|
||
getObjectByValue(value: string | Array<any>, filterParams?: any): Observable<Array<any> | { [key: string]: any }> { | ||
return this.httpClient | ||
.get(this.url, { | ||
headers: this.headers, | ||
params: this.filterParams | ||
}) | ||
.pipe(map((response: any) => ('items' in response ? response.items : response))); | ||
} | ||
|
||
setConfig(url: string, filterParams) { | ||
this.url = url; | ||
this.filterParams = filterParams; | ||
} | ||
} |