ng-tailwind 5.0.19 → 5.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2020/ng-tailwind.mjs
CHANGED
|
@@ -3193,9 +3193,10 @@ class NgtSelectComponent extends NgtBaseNgModel {
|
|
|
3193
3193
|
this.destroySubscriptions();
|
|
3194
3194
|
}
|
|
3195
3195
|
onOpen() {
|
|
3196
|
-
const
|
|
3197
|
-
if (this.dropdownPosition == 'auto' &&
|
|
3198
|
-
|
|
3196
|
+
const parentElements = document.querySelectorAll('#ngtSelectParentContainer');
|
|
3197
|
+
if (this.dropdownPosition == 'auto' && parentElements?.length) {
|
|
3198
|
+
const parentContainer = parentElements[parentElements.length - 1];
|
|
3199
|
+
this.calculateDropdownPosition(parentContainer);
|
|
3199
3200
|
}
|
|
3200
3201
|
}
|
|
3201
3202
|
removeItem(event, item) {
|
|
@@ -3324,7 +3325,7 @@ class NgtSelectComponent extends NgtBaseNgModel {
|
|
|
3324
3325
|
disabled() {
|
|
3325
3326
|
return this.isDisabled || this.isDisabledByParent();
|
|
3326
3327
|
}
|
|
3327
|
-
async calculateDropdownPosition(
|
|
3328
|
+
async calculateDropdownPosition(parentContainer) {
|
|
3328
3329
|
while (!this.componentReady || this.loading || this.ngSelectComponent.showNoItemsFound()) {
|
|
3329
3330
|
await delay(200);
|
|
3330
3331
|
if (this.ngSelectComponent.showNoItemsFound() && !this.loading && this.componentReady) {
|
|
@@ -3338,10 +3339,13 @@ class NgtSelectComponent extends NgtBaseNgModel {
|
|
|
3338
3339
|
const ngSelectYPosition = ngSelectElement.getBoundingClientRect().y;
|
|
3339
3340
|
const dropdownHeight = this.ngSelectComponent.dropdownPanel.contentElementRef.nativeElement.offsetHeight;
|
|
3340
3341
|
const openedSelectHeight = ngSelectHeight + dropdownHeight;
|
|
3341
|
-
const parentYPosition =
|
|
3342
|
+
const parentYPosition = parentContainer.getBoundingClientRect().y;
|
|
3342
3343
|
const ngSelectYPositionInsideParent = ngSelectYPosition - parentYPosition;
|
|
3343
3344
|
const openedSelectTotalHeight = openedSelectHeight + ngSelectYPositionInsideParent;
|
|
3344
|
-
const
|
|
3345
|
+
const parentContainerHeight = parentContainer.clientHeight;
|
|
3346
|
+
const fitsOnTop = openedSelectHeight < ngSelectYPositionInsideParent;
|
|
3347
|
+
const fitsOnBottom = openedSelectTotalHeight < parentContainerHeight;
|
|
3348
|
+
const dropdownPosition = !fitsOnBottom && fitsOnTop
|
|
3345
3349
|
? 'top'
|
|
3346
3350
|
: 'bottom';
|
|
3347
3351
|
this.ngSelectComponent.dropdownPanel['_currentPosition'] = dropdownPosition;
|