@@ -142,6 +142,7 @@ class PopoverEngine {
142142 * @param {{x: number, y: number} } displayZoneMargins the margins to apply at the edge of the display zone
143143 * @param {{main: MainAxisPopoverPosition, cross: CrossAxisPopoverPosition} } position the position of the popover relative to the trigger
144144 * @param {{main: BoundingBoxProjector, cross: BoundingBoxProjector} } projectors the axis projectors
145+ * @param {boolean } setChildrenSize if true, children component size will be set to the popover size
145146 */
146147 constructor (
147148 trigger ,
@@ -150,6 +151,7 @@ class PopoverEngine {
150151 displayZoneMargins ,
151152 position ,
152153 projectors ,
154+ setChildrenSize ,
153155 ) {
154156 this . _popover = popover ;
155157
@@ -164,6 +166,8 @@ class PopoverEngine {
164166
165167 this . _displayBoundingBox = displayBoundingBox ;
166168 this . _displayZoneMargins = displayZoneMargins ;
169+
170+ this . _setChildrensize = setChildrenSize ;
167171 }
168172
169173 /**
@@ -222,6 +226,11 @@ class PopoverEngine {
222226 }
223227
224228 this . _mainAxisProjector . setSize ( this . _popover . style , `${ mainAxisSize } px` ) ;
229+ if ( this . _setChildrensize ) {
230+ for ( const children of this . _popover . children ) {
231+ this . _mainAxisProjector . setSize ( children . style , `${ mainAxisSize } px` ) ;
232+ }
233+ }
225234
226235 this . _refreshPopoverBoundingBox ( ) ;
227236 }
@@ -235,6 +244,11 @@ class PopoverEngine {
235244 resizeAlongCrossAxis ( ) {
236245 if ( this . _popoverSizeCrossAxis > this . _availableSpaceInCrossAxis ) {
237246 this . _crossAxisProjector . setSize ( this . _popover . style , `${ this . _availableSpaceInCrossAxis } px` ) ;
247+ if ( this . _setChildrensize ) {
248+ for ( const children of this . _popover . children ) {
249+ this . _crossAxisProjector . setSize ( children . style , `${ this . _availableSpaceInCrossAxis } px` ) ;
250+ }
251+ }
238252
239253 this . _refreshPopoverBoundingBox ( ) ;
240254 }
@@ -280,7 +294,7 @@ class PopoverEngine {
280294
281295 const crossAxisPosition = Math . max (
282296 this . _crossAxisProjector . getPosition ( this . _displayBoundingBox )
283- + this . _crossAxisProjector . getPosition ( this . _displayZoneMargins ) ,
297+ + this . _crossAxisProjector . getPosition ( this . _displayZoneMargins ) ,
284298 Math . min (
285299 this . _availableSpaceInCrossAxis - this . _popoverSizeCrossAxis ,
286300 targetStartCrossAxis ,
@@ -420,9 +434,10 @@ class PopoverEngine {
420434 * @param {BoundingBox } displayBoundingBox the bounding box of the display zone, representing the limits where the popover may be drawn
421435 * @param {{x: number, y: number} } displayZoneMargins the margins to apply at the edge of the display zone
422436 * @param {PopoverAnchor } anchor the anchor to place the popover
437+ * @param {boolean } setChildrenSize if true, children component size will be set to the popover size
423438 * @return {PopoverEngine } the created popover engine
424439 */
425- export const createPopoverEngine = ( trigger , popover , displayBoundingBox , displayZoneMargins , anchor ) => {
440+ export const createPopoverEngine = ( trigger , popover , displayBoundingBox , displayZoneMargins , anchor , setChildrenSize ) => {
426441 // Top and Bottom are the 6 first anchors
427442 const mainAxisProjector = anchor / 6 < 1 ? verticalProjector : horizontalProjector ;
428443 const crossAxisProjector = anchor / 6 < 1 ? horizontalProjector : verticalProjector ;
@@ -440,5 +455,6 @@ export const createPopoverEngine = (trigger, popover, displayBoundingBox, displa
440455 displayZoneMargins ,
441456 { main : mainAxisPosition , cross : crossAxisPosition } ,
442457 { main : mainAxisProjector , cross : crossAxisProjector } ,
458+ setChildrenSize ,
443459 ) ;
444460} ;
0 commit comments