Skip to content

Commit

Permalink
IBX-5576: [Payments] Issues with filters
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabowskiM committed Apr 25, 2023
1 parent 1ce04f0 commit 3ab831c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/bundle/Resources/public/js/scripts/core/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
}

clearCurrentSelection(shouldFireChangeEvent = true) {
const overflowNumber = this.selectedItemsContainer.querySelector('.ibexa-dropdown__selected-overflow-number').cloneNode();
const overflowNumber = this.selectedItemsContainer.querySelector('.ibexa-dropdown__selected-overflow-number').cloneNode(true);

this.sourceInput.querySelectorAll('option').forEach((option) => (option.selected = false));
this.itemsListContainer.querySelectorAll('.ibexa-dropdown__item--selected').forEach((option) => {
Expand All @@ -127,7 +127,9 @@
}
});
this.selectedItemsContainer.innerHTML = '';
this.selectedItemsContainer.insertAdjacentHTML('beforeend', this.selectedItemsContainer.dataset.placeholderTemplate);
this.selectedItemsContainer.append(overflowNumber);
this.fitItems();

if (shouldFireChangeEvent) {
this.fireValueChangedEvent();
Expand Down Expand Up @@ -263,6 +265,7 @@
let numberOfOverflowItems = 0;
const selectedItems = this.selectedItemsContainer.querySelectorAll('.ibexa-dropdown__selected-item');
const selectedItemsOverflow = this.selectedItemsContainer.querySelector('.ibexa-dropdown__selected-overflow-number');
const dropdownItemsContainerWidth = this.selectedItemsContainer.offsetWidth - RESTRICTED_AREA_ITEMS_CONTAINER;

if (selectedItemsOverflow) {
selectedItems.forEach((item) => {
Expand All @@ -273,11 +276,7 @@

itemsWidth += item.offsetWidth;

if (
!isOverflowNumber &&
index !== 0 &&
itemsWidth > this.selectedItemsContainer.offsetWidth - RESTRICTED_AREA_ITEMS_CONTAINER
) {
if (!isOverflowNumber && index !== 0 && itemsWidth > dropdownItemsContainerWidth) {
const isPlaceholder = item.classList.contains('ibexa-dropdown__selected-placeholder');

item.hidden = true;
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/scss/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
&--overflow {
.ibexa-dropdown {
&__selected-item {
max-width: calc(100% - #{calculateRem(96px)});
max-width: calc(100% - #{calculateRem(40px)});
}
}
}
Expand Down

0 comments on commit 3ab831c

Please sign in to comment.