From 2bc70bd7ca978bffaabe83172dcb53f65dfbc9ea Mon Sep 17 00:00:00 2001 From: CSimoesJr Date: Mon, 18 Sep 2023 14:26:23 -0300 Subject: [PATCH] =?UTF-8?q?feat(lookup):=20implementa=20op=C3=A7=C3=A3o=20?= =?UTF-8?q?de=20esconder=20gerenciador=20de=20colunas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Esconde gerenciador de colunas no lookup fixes DTHFUI-7637 --- .../po-lookup/po-lookup-base.component.spec.ts | 12 ++++++++++++ .../po-field/po-lookup/po-lookup-base.component.ts | 12 ++++++++++++ .../po-lookup-modal-base.component.spec.ts | 12 ++++++++++++ .../po-lookup-modal-base.component.ts | 4 ++++ .../po-lookup-modal/po-lookup-modal.component.html | 1 + .../po-field/po-lookup/po-lookup.component.spec.ts | 3 +++ .../po-field/po-lookup/po-lookup.component.ts | 2 ++ .../sample-po-lookup-hero.component.html | 1 + .../sample-po-lookup-labs.component.html | 1 + .../sample-po-lookup-labs.component.ts | 3 ++- .../services/po-lookup-modal.service.spec.ts | 1 + .../po-lookup/services/po-lookup-modal.service.ts | 3 +++ 12 files changed, 54 insertions(+), 1 deletion(-) diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.spec.ts index b2a686f5a..d4c63d29e 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.spec.ts @@ -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'); diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.ts index 9bd9595f8..7be2879fe 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-base.component.ts @@ -233,6 +233,18 @@ export abstract class PoLookupBaseComponent */ @Input('p-advanced-filters') advancedFilters: Array; + /** + * @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 * diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.spec.ts index 1a01b5764..532805339 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.spec.ts @@ -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); diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.ts index 8e40ea522..efc1011ca 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.ts @@ -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; diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.html b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.html index eb3b4333b..53a173a05 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.html +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.html @@ -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" diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts index 1455fc1ea..f437ce0f3 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts @@ -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'; @@ -966,6 +967,7 @@ describe('PoLookupComponent:', () => { columns, filterParams, literals, + hideColumnsManager, infiniteScroll, multiple, fieldLabel, @@ -983,6 +985,7 @@ describe('PoLookupComponent:', () => { filterParams, title: component.label, literals, + hideColumnsManager, infiniteScroll, multiple, selectedItems, diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.ts index 1153c8c40..a5a13a789 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.ts @@ -198,6 +198,7 @@ export class PoLookupComponent extends PoLookupBaseComponent implements AfterVie service, columns, filterParams, + hideColumnsManager, literals, infiniteScroll, multiple, @@ -214,6 +215,7 @@ export class PoLookupComponent extends PoLookupBaseComponent implements AfterVie service, columns, filterParams, + hideColumnsManager, title: this.label, literals, infiniteScroll, diff --git a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-hero/sample-po-lookup-hero.component.html b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-hero/sample-po-lookup-hero.component.html index 8c57bb472..6920b0a2b 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-hero/sample-po-lookup-hero.component.html +++ b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-hero/sample-po-lookup-hero.component.html @@ -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' }" > diff --git a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.html b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.html index 190e12a2a..307f90105 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.html +++ b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.html @@ -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')" diff --git a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.ts b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.ts index 5666a36eb..ab45d8f4f 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.ts @@ -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 = { diff --git a/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.spec.ts index caa0cfe69..3dc24ed9c 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.spec.ts @@ -40,6 +40,7 @@ describe('PoLookupModalService:', () => { filterParams: undefined, title: 'Teste', literals: undefined, + hideColumnsManager: false, infiniteScroll: false, multiple: false, selectedItems: null, diff --git a/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.ts b/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.ts index 80965565d..4ca4987c1 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/services/po-lookup-modal.service.ts @@ -40,6 +40,7 @@ export class PoLookupModalService { service: PoLookupFilter; columns: Array; filterParams: any; + hideColumnsManager: boolean; title: string; literals: PoLookupLiterals; infiniteScroll: boolean; @@ -55,6 +56,7 @@ export class PoLookupModalService { service, columns, filterParams, + hideColumnsManager, title, literals, infiniteScroll, @@ -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(); }