({minHeight, minWidth, ...props})
| 208 | } |
| 209 | |
| 210 | function PaperComponent({minHeight, minWidth, ...props}) { |
| 211 | let [dialogPosition, setDialogPosition] = useState(null); |
| 212 | let resizeable = checkIsResizable(props); |
| 213 | const nodeRef = useRef(null); |
| 214 | |
| 215 | const setConditionalPosition = () => { |
| 216 | return props.isfullscreen == 'true' ? { x: 0, y: 0 } : dialogPosition && { x: dialogPosition.x, y: dialogPosition.y }; |
| 217 | }; |
| 218 | |
| 219 | const y_position = window.innerHeight*0.02; // 2% of total height |
| 220 | const x_position = props.width ? (window.innerWidth/2) - (props.width/2) : (window.innerWidth/2) - (MIN_WIDTH/2); |
| 221 | |
| 222 | return ( |
| 223 | props.isresizeable == 'true' ? |
| 224 | <StyledRnd |
| 225 | size={props.isfullscreen == 'true' && { width: '100%', height: '100%' }} |
| 226 | className={'Dialog-content ' + ( props.isfullscreen == 'true' ? 'Dialog-fullScreen' : '')} |
| 227 | default={{ |
| 228 | x: x_position, |
| 229 | y: y_position, |
| 230 | ...(props.width && { width: props.width }), |
| 231 | ...(props.height && { height: props.height }), |
| 232 | }} |
| 233 | minWidth = { minWidth || MIN_WIDTH } |
| 234 | minHeight = { minHeight || MIN_HEIGHT } |
| 235 | // {...(props.width && { minWidth: MIN_WIDTH })} |
| 236 | // {...(props.height && { minHeight: MIN_HEIGHT })} |
| 237 | bounds="window" |
| 238 | enableResizing={setEnableResizing(props, resizeable)} |
| 239 | position={setConditionalPosition()} |
| 240 | onDragStop={(e, position) => { |
| 241 | if (props.isfullscreen !== 'true') { |
| 242 | setDialogPosition({ |
| 243 | ...position, |
| 244 | }); |
| 245 | } |
| 246 | }} |
| 247 | onResize={(e, direction, ref, delta, position) => { |
| 248 | setDialogPosition({ |
| 249 | ...position, |
| 250 | }); |
| 251 | }} |
| 252 | dragHandleClassName="modal-drag-area" |
| 253 | > |
| 254 | <Paper {...props} style={{ width: '100%', height: '100%', maxHeight: '100%', maxWidth: '100%' }} /> |
| 255 | </StyledRnd> |
| 256 | : |
| 257 | <Draggable nodeRef={nodeRef} cancel={'[class*="MuiDialogContent-root"]'}> |
| 258 | <Paper {...props} ref={nodeRef} style={{ minWidth: '600px' }} /> |
| 259 | </Draggable> |
| 260 | ); |
| 261 | } |
| 262 | |
| 263 | PaperComponent.propTypes = { |
| 264 | isfullscreen: PropTypes.string, |
nothing calls this directly
no test coverage detected