@@ -1452,6 +1452,89 @@ window.Radzen = {
14521452 }
14531453 } , 500 ) ;
14541454 } ,
1455+ initSideDialogResize : function ( handle , sideDialog ) {
1456+ const dir = ( handle . dataset . dir || 'right' ) . toLowerCase ( ) ;
1457+ const cs = window . getComputedStyle ( sideDialog ) ;
1458+ const parent = sideDialog . parentNode ;
1459+ const parentIsFlex = parent && getComputedStyle ( parent ) . display . includes ( 'flex' ) ;
1460+ const toPixels = ( v , axis ) => {
1461+ if ( ! v || v === 'none' ) return NaN ;
1462+ if ( v . endsWith && v . endsWith ( 'px' ) ) return parseFloat ( v ) ;
1463+ if ( v . endsWith && v . endsWith ( '%' ) ) {
1464+ const base = axis === 'y' ? window . innerHeight : window . innerWidth ;
1465+ const p = parseFloat ( v ) ;
1466+ return Number . isFinite ( p ) ? ( base * p / 100 ) : NaN ;
1467+ }
1468+ const n = parseFloat ( v ) ;
1469+ return Number . isFinite ( n ) ? n : NaN ;
1470+ } ;
1471+
1472+ let MIN_W = toPixels ( cs . minWidth , 'x' ) || 300 ;
1473+ let MAX_W = toPixels ( cs . maxWidth , 'x' ) || Infinity ;
1474+ let MIN_H = toPixels ( cs . minHeight , 'y' ) || 200 ;
1475+ let MAX_H = toPixels ( cs . maxHeight , 'y' ) || Infinity ;
1476+
1477+ // Guard against invalid ranges caused by percentage max being smaller than min
1478+ if ( Number . isFinite ( MIN_W ) && Number . isFinite ( MAX_W ) && MAX_W < MIN_W ) MAX_W = Infinity ;
1479+ if ( Number . isFinite ( MIN_H ) && Number . isFinite ( MAX_H ) && MAX_H < MIN_H ) MAX_H = Infinity ;
1480+
1481+ let start = null ;
1482+
1483+ const onDown = ( e ) => {
1484+ e . preventDefault ( ) ;
1485+ handle . setPointerCapture ?. ( e . pointerId ) ;
1486+
1487+ const rect = sideDialog . getBoundingClientRect ( ) ;
1488+ start = { x : e . clientX , y : e . clientY , w : rect . width , h : rect . height } ;
1489+
1490+ document . addEventListener ( 'pointermove' , onMove ) ;
1491+ document . addEventListener ( 'pointerup' , onUp , { once : true } ) ;
1492+ document . body . classList . add ( 'dragging' ) ;
1493+ } ;
1494+
1495+ const clamp = ( v , min , max ) => Math . max ( min , Math . min ( max , v ) ) ;
1496+
1497+ const applyWidth = ( w ) => {
1498+ if ( parentIsFlex )
1499+ sideDialog . style . flexBasis = Math . round ( w ) + 'px' ;
1500+ else
1501+ sideDialog . style . width = Math . round ( w ) + 'px' ;
1502+ } ;
1503+ const applyHeight = ( h ) => {
1504+ sideDialog . style . height = `${ Math . round ( h ) } px` ;
1505+ } ;
1506+
1507+ const onMove = ( e ) => {
1508+ if ( ! start ) return ;
1509+
1510+ const dx = e . clientX - start . x ;
1511+ const dy = e . clientY - start . y ;
1512+
1513+ switch ( dir ) {
1514+ case 'right' : applyWidth ( clamp ( start . w - dx , MIN_W , MAX_W ) ) ; break ;
1515+ case 'left' : applyWidth ( clamp ( start . w + dx , MIN_W , MAX_W ) ) ; break ;
1516+ case 'bottom' : applyHeight ( clamp ( start . h - dy , MIN_H , MAX_H ) ) ; break ;
1517+ case 'top' : applyHeight ( clamp ( start . h + dy , MIN_H , MAX_H ) ) ; break ;
1518+ }
1519+ } ;
1520+
1521+ const onUp = ( e ) => {
1522+ handle . releasePointerCapture ?. ( e . pointerId ) ;
1523+ start = null ;
1524+ document . removeEventListener ( 'pointermove' , onMove ) ;
1525+ document . body . classList . remove ( 'dragging' ) ;
1526+ } ;
1527+
1528+ handle . addEventListener ( 'pointerdown' , onDown ) ;
1529+
1530+ return {
1531+ dispose ( ) {
1532+ handle . removeEventListener ( 'pointerdown' , onDown ) ;
1533+ document . removeEventListener ( 'pointermove' , onMove ) ;
1534+ document . body . classList . remove ( 'dragging' ) ;
1535+ }
1536+ } ;
1537+ } ,
14551538 openDialog : function ( options , dialogService , dialog ) {
14561539 if ( Radzen . closeAllPopups ) {
14571540 Radzen . closeAllPopups ( ) ;
0 commit comments