Skip to content

Commit 9dbdee1

Browse files
anabyejcorrea97
authored andcommitted
fix(lookup): corrige itens selecionados que são omitidos após a pesquisa
Ao selecionar itens no componente po-lookup, pesquisando e selecionando novos itens, alguns itens previamente selecionados sumiam. Corrige itens selecionados que são omitidos após a pesquisa Fixes DTHFUI-9253
1 parent bee771d commit 9dbdee1

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,16 @@ describe('PoLookupModalBaseComponent:', () => {
733733
expect(component.selecteds).toEqual(expectSelecteds);
734734
});
735735

736+
it('setDisclaimersItems: should set selecteds with selectedItems if selecteds is empty and selectedItems is an array with elements', () => {
737+
const expectSelecteds = [{ value: 123, label: '123' }];
738+
component.selecteds = [];
739+
component.selectedItems = [...expectSelecteds];
740+
741+
component.setDisclaimersItems();
742+
743+
expect(component.selecteds).toEqual(expectSelecteds);
744+
});
745+
736746
it('Should emit item selected when component is not multiple ', () => {
737747
component.selecteds = [{ value: 123456789 }];
738748
component.multiple = true;

projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal-base.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export abstract class PoLookupModalBaseComponent implements OnDestroy, OnInit {
419419
return;
420420
}
421421

422-
if (this.selectedItems && this.selectedItems.length) {
422+
if (this.selecteds.length === 0 && this.selectedItems && this.selectedItems.length) {
423423
this.selecteds = [...this.selectedItems];
424424
}
425425
}

projects/ui/src/lib/components/po-field/po-lookup/samples/sample-po-lookup-labs/sample-po-lookup-labs.component.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030

3131
<hr />
3232

33-
<div class="po-row">
34-
<po-info class="po-md-6" p-label="Model" [p-value]="lookup"> </po-info>
33+
<po-container p-no-border="true" p-no-padding="true">
34+
<div class="po-row">
35+
<po-info class="po-md-12" p-label="Model" [p-value]="lookup"> </po-info>
3536

36-
<po-info class="po-md-6" p-label="Event" [p-value]="event"> </po-info>
37-
</div>
37+
<po-info class="po-md-6" p-label="Event" [p-value]="event"> </po-info>
38+
</div>
39+
</po-container>
3840

3941
<hr />
4042

0 commit comments

Comments
 (0)