@@ -18,6 +18,7 @@ export class IgxGridBodyDirective { }
1818 */
1919export interface RowEditPositionSettings extends PositionSettings {
2020 container ?: HTMLElement ;
21+ clipToVisibleArea ?: boolean ;
2122}
2223
2324/**
@@ -64,8 +65,10 @@ export class RowEditPositionStrategy extends ConnectedPositioningStrategy {
6465 super . position ( contentElement , { width : targetElement . clientWidth , height : targetElement . clientHeight } ,
6566 document , initialCall , targetElement ) ;
6667
67- // After positioning in the top layer, keep the overlay clipped to the visible grid body.
68- this . updateContentClip ( contentElement ) ;
68+ if ( this . settings . clipToVisibleArea ) {
69+ // After positioning in the top layer, keep the overlay clipped to the visible grid body.
70+ this . updateContentClip ( contentElement ) ;
71+ }
6972 }
7073
7174 private updateContentClip ( contentElement : HTMLElement ) : void {
@@ -98,28 +101,27 @@ export class RowEditPositionStrategy extends ConnectedPositioningStrategy {
98101
99102 private getClippingRect ( element : HTMLElement ) : Pick < DOMRect , 'top' | 'right' | 'bottom' | 'left' > {
100103 const document = element . ownerDocument ;
101- const rect = element . getBoundingClientRect ( ) ;
102- // Start with the current grid body, then narrow it by every clipping parent.
104+ const gridBody = element . closest ( '[igxgridbody]' ) as HTMLElement || element ;
105+ const rect = gridBody . getBoundingClientRect ( ) ;
106+ // Start with the current grid body, then narrow it by parent grid bodies.
103107 const clippingRect = { top : rect . top , right : rect . right , bottom : rect . bottom , left : rect . left } ;
104108
105- let parent = element . parentElement ;
109+ let parent = gridBody . parentElement ?. closest ( '[igxgridbody]' ) as HTMLElement ;
106110
107- // Intersect with clipping ancestors so nested grids respect their parent grid scroll bounds.
108- while ( parent && parent !== document . body && parent !== document . documentElement ) {
109- const style = document . defaultView ?. getComputedStyle ( parent ) ?? parent . style ;
110- const overflow = `${ style . overflow } ${ style . overflowX } ${ style . overflowY } ` ;
111+ // Intersect with parent grid bodies so nested grids respect their parent scroll bounds.
112+ while ( parent ) {
113+ const parentRect = parent . getBoundingClientRect ( ) ;
111114
112- // Only ancestors that clip their children should reduce the visible area.
113- if ( / ( a u t o | s c r o l l | h i d d e n | c l i p ) / . test ( overflow ) ) {
114- const parentRect = parent . getBoundingClientRect ( ) ;
115+ clippingRect . top = Math . max ( clippingRect . top , parentRect . top ) ;
116+ clippingRect . right = Math . min ( clippingRect . right , parentRect . right ) ;
117+ clippingRect . bottom = Math . min ( clippingRect . bottom , parentRect . bottom ) ;
118+ clippingRect . left = Math . max ( clippingRect . left , parentRect . left ) ;
115119
116- clippingRect . top = Math . max ( clippingRect . top , parentRect . top ) ;
117- clippingRect . right = Math . min ( clippingRect . right , parentRect . right ) ;
118- clippingRect . bottom = Math . min ( clippingRect . bottom , parentRect . bottom ) ;
119- clippingRect . left = Math . max ( clippingRect . left , parentRect . left ) ;
120+ if ( clippingRect . top >= clippingRect . bottom || clippingRect . left >= clippingRect . right ) {
121+ break ;
120122 }
121123
122- parent = parent . parentElement ;
124+ parent = parent . parentElement ?. closest ( '[igxgridbody]' ) as HTMLElement ;
123125 }
124126
125127 // Keep the clipping area inside the viewport because popover content is viewport-positioned.
0 commit comments