-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(*): Remove the need of hardcoded item heights in combo #14871
base: master
Are you sure you want to change the base?
Conversation
chore(*): fix lint chore(*): fix another lint chore(*): Clean up code. Change some tests and remove some chore(*): Some more cleanup. Fix tests
8d2cfb1
to
7b9d9fc
Compare
private _itemsMaxHeight = null; | ||
private _overlaySettings: OverlaySettings; | ||
private _groupSortingDirection: SortingDirection = SortingDirection.Asc; | ||
private _filteringOptions: IComboFilteringOptions; | ||
private _defaultFilteringOptions: IComboFilteringOptions = { caseSensitive: false }; | ||
private itemsInCointaner = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo -> itemsInContainer
:)
this.dropdown?.animationStarting.subscribe((_args: ToggleViewEventArgs) => { | ||
// calculate the container size and item size based on the sizes from the DOM | ||
const dropdownContainerHeight = this.dropdownContainer.nativeElement.getBoundingClientRect().height; | ||
if (dropdownContainerHeight) { | ||
this.containerSize = parseFloat(dropdownContainerHeight); | ||
} | ||
if (this.dropdown.children?.first) { | ||
this.itemSize = this.dropdown.children.first.element.nativeElement.getBoundingClientRect().height; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so this is happening because the overlay opening
is emitted before updating sizes, which I realize is likely to check for cancel and avoid doing redundant work. The issue is animationStarting
is not guaranteed:
igniteui-angular/projects/igniteui-angular/src/lib/services/overlay/overlay.ts
Lines 424 to 427 in 509f5a6
if (info.settings.positionStrategy.settings.openAnimation) { | |
// TODO: should we build players again. This was already done in attach!!! | |
// this.buildAnimationPlayers(info); | |
this.playOpenAnimation(info); |
As we discussed, the things updateSize
can probably be performed in advance without causing trouble, though I'll tag @wnvko in case he can recall reasons not to.
Alternatively, the combo itself can patch opening and force the update sooner to be able to calculate those on opening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it's also quite possible we could move the --ig-size
transfer on attach
entirely, since that doesn't change after the fact and it's applied to the content container, if the other stuff are not safe to move.
That's all to avoid both relying on animationStarting
and propagating it across components :)
* Initial chunk size if no container size is passed. If container size is passed then the igxForOf calculates its chunk size | ||
*/ | ||
@Input() | ||
public igxForInitialChunkSize: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess existing combo tests somewhat cover the use of igxForInitialChunkSize
but it wouldn't hurt to have at least one unit test covering this just for the for-of
Closes #14285
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes (migrations guidelines)