File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
projects/klippa/ngx-enhancy-forms Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @klippa/ngx-enhancy-forms" ,
3
- "version" : " 14.6.0 " ,
3
+ "version" : " 14.6.1 " ,
4
4
"publishConfig" : {
5
5
"access" : " public"
6
6
},
Original file line number Diff line number Diff line change @@ -151,15 +151,18 @@ export class SelectComponent extends ValueAccessorBase<string | string[]> implem
151
151
dropdownPanel . style . width = `${ Math . max ( this . elRef . nativeElement . clientWidth , maxWidth + 40 , dropdownPanel . getBoundingClientRect ( ) . width ) } px` ;
152
152
}
153
153
154
- let current = this . elRef . nativeElement ;
155
- while ( current . parentElement && ! this . isLimitingContainer ( current ) ) {
156
- current = current . parentElement ;
154
+ let limitingParentContainer = this . elRef . nativeElement ;
155
+ while ( limitingParentContainer . parentElement && ! this . isLimitingContainer ( limitingParentContainer ) ) {
156
+ limitingParentContainer = limitingParentContainer . parentElement ;
157
157
}
158
158
159
159
if ( dropdownPanel ) {
160
- const spaceLeft = ( current . clientWidth + current . getBoundingClientRect ( ) . left ) - ( dropdownPanel . clientWidth + dropdownPanel . getBoundingClientRect ( ) . left ) - 20 ;
161
- if ( spaceLeft < 0 ) {
162
- dropdownPanel . style . left = `${ spaceLeft } px` ;
160
+ const spaceInParent = limitingParentContainer . clientWidth ;
161
+ const spaceLeftOfElRef = this . elRef ?. nativeElement . getBoundingClientRect ( ) . left - limitingParentContainer . getBoundingClientRect ( ) . left ;
162
+ const spaceRightOfElRef = spaceInParent - spaceLeftOfElRef ;
163
+ const shiftToLeft = dropdownPanel ?. clientWidth - spaceRightOfElRef + 20 ;
164
+ if ( shiftToLeft > 0 ) {
165
+ dropdownPanel . style . left = `-${ shiftToLeft } px` ;
163
166
}
164
167
}
165
168
} ) ;
You can’t perform that action at this time.
0 commit comments