Skip to content

Commit

Permalink
feat(lookup): implementa opção de esconder gerenciador de colunas
Browse files Browse the repository at this point in the history
Esconde gerenciador de colunas no lookup

fixes DTHFUI-7637
  • Loading branch information
CSimoesJr authored and rafaellmarques committed Oct 4, 2023
1 parent 1cd1ba9 commit 2bc70bd
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ describe('PoLookupBaseComponent:', () => {
expectSettersMethod(component, 'noAutocomplete', undefined, '_noAutocomplete', false);
});

it('p-hide-columns-manager: should update property `p-hide-columns-manager` with valid value', () => {
component.hideColumnsManager = convertToBoolean(1);

expect(component.hideColumnsManager).toBe(true);
});

it('p-hide-columns-manager: should update property `p-hide-columns-manager` with invalid value', () => {
component.hideColumnsManager = convertToBoolean(21211);

expect(component.hideColumnsManager).toBe(false);
});

it('p-infinite-scroll: should update property `p-infinite-scroll` with valid params', () => {
component.infiniteScroll = convertToBoolean('true');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ export abstract class PoLookupBaseComponent
*/
@Input('p-advanced-filters') advancedFilters: Array<PoLookupAdvancedFilter>;

/**
* @optional
*
* @description
*
* Permite que o gerenciador de colunas, responsável pela definição de quais colunas serão exibidas, seja escondido.
*
* @default `false`
*/
@Input({ alias: 'p-hide-columns-manager', transform: convertToBoolean })
hideColumnsManager: boolean = false;

/**
* @optional
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,18 @@ describe('PoLookupModalBaseComponent:', () => {
expect(component['disclaimerLabel']).toBe('true');
});

it('p-hide-columns-manager: should update property `p-hide-columns-manager` with valid value', () => {
component.hideColumnsManager = convertToBoolean(1);

expect(component.hideColumnsManager).toBe(true);
});

it('p-hide-columns-manager: should update property `p-hide-columns-manager` with invalid value', () => {
component.hideColumnsManager = convertToBoolean(21211);

expect(component.hideColumnsManager).toBe(false);
});

it('p-infinite-scroll: should update property `p-infinite-scroll` with valid value', () => {
component.infiniteScroll = convertToBoolean(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export abstract class PoLookupModalBaseComponent implements OnDestroy, OnInit {
/** Classe de serviço com a implementação do cliente. */
@Input('p-filter-params') filterParams: any;

/** Se verdadeiro, esconde o gerenciador de tarefas, responsável pela definição de quais colunas serão exibidas. */
@Input({ alias: 'p-hide-columns-manager', transform: convertToBoolean })
hideColumnsManager: boolean = false;

/** Se verdadeiro, ativa a funcionalidade de scroll infinito para a tabela exibida no retorno da consulta. */
@Input({ alias: 'p-infinite-scroll', transform: convertToBoolean }) infiniteScroll: boolean = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
[p-hide-table-search]="true"
[p-columns]="columns"
[p-height]="tableHeight"
[p-hide-columns-manager]="hideColumnsManager"
[p-items]="items"
[p-literals]="tableLiterals"
[p-loading]="isLoading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ describe('PoLookupComponent:', () => {
component.label = 'Estabelecimento';
component.literals = undefined;
component.infiniteScroll = false;
component.hideColumnsManager = false;
component.multiple = false;
component.fieldLabel = 'label';
component.fieldValue = 'value';
Expand All @@ -966,6 +967,7 @@ describe('PoLookupComponent:', () => {
columns,
filterParams,
literals,
hideColumnsManager,
infiniteScroll,
multiple,
fieldLabel,
Expand All @@ -983,6 +985,7 @@ describe('PoLookupComponent:', () => {
filterParams,
title: component.label,
literals,
hideColumnsManager,
infiniteScroll,
multiple,
selectedItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class PoLookupComponent extends PoLookupBaseComponent implements AfterVie
service,
columns,
filterParams,
hideColumnsManager,
literals,
infiniteScroll,
multiple,
Expand All @@ -214,6 +215,7 @@ export class PoLookupComponent extends PoLookupBaseComponent implements AfterVie
service,
columns,
filterParams,
hideColumnsManager,
title: this.label,
literals,
infiniteScroll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[p-columns]="columns"
[p-field-format]="fieldFormat"
[p-filter-service]="service"
[p-hide-columns-manager]="true"
[p-advanced-filters]="advancedFilters"
[p-literals]="{ 'modalTitle': 'Heroes available for mission' }"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
[p-placeholder]="placeholder"
[p-required]="properties.includes('required')"
[p-show-required]="properties.includes('showRequired')"
[p-hide-columns-manager]="properties.includes('hideColumnsManager')"
[p-infinite-scroll]="properties.includes('infiniteScroll')"
[p-multiple]="properties.includes('multiple')"
[p-auto-height]="properties.includes('autoHeight')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class SamplePoLookupLabsComponent implements OnInit {
{ value: 'showRequired', label: 'Show Required' },
{ value: 'infiniteScroll', label: 'Infinite Scroll' },
{ value: 'multiple', label: 'Multiple' },
{ value: 'autoHeight', label: 'Auto Height' }
{ value: 'autoHeight', label: 'Auto Height' },
{ value: 'hideColumnsManager', label: 'Hide Columns Manager' }
];

private readonly columnsDefinition = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('PoLookupModalService:', () => {
filterParams: undefined,
title: 'Teste',
literals: undefined,
hideColumnsManager: false,
infiniteScroll: false,
multiple: false,
selectedItems: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class PoLookupModalService {
service: PoLookupFilter;
columns: Array<PoLookupColumn>;
filterParams: any;
hideColumnsManager: boolean;
title: string;
literals: PoLookupLiterals;
infiniteScroll: boolean;
Expand All @@ -55,6 +56,7 @@ export class PoLookupModalService {
service,
columns,
filterParams,
hideColumnsManager,
title,
literals,
infiniteScroll,
Expand Down Expand Up @@ -83,6 +85,7 @@ export class PoLookupModalService {
this.componentRef.instance.fieldValue = fieldValue;
this.componentRef.instance.changeVisibleColumns = changeVisibleColumns;
this.componentRef.instance.columnRestoreManager = columnRestoreManager;
this.componentRef.instance.hideColumnsManager = hideColumnsManager;
this.componentRef.changeDetectorRef.detectChanges();
this.componentRef.instance.openModal();
}
Expand Down

0 comments on commit 2bc70bd

Please sign in to comment.