1
1
import * as React from "react" ;
2
2
import * as ReactDOM from "react-dom" ;
3
- import { Dialog , IDialogProps } from 'office-ui-fabric-react/lib/Dialog' ;
3
+ import { Dialog , IDialogContentProps , IDialogProps , IDialogStyleProps , IDialogStyles } from 'office-ui-fabric-react/lib/Dialog' ;
4
4
import { IFrameDialogContent } from './IFrameDialogContent' ;
5
5
import * as telemetry from '../../common/telemetry' ;
6
6
import { Guid } from "@microsoft/sp-core-library" ;
7
7
import omit from 'lodash/omit' ;
8
+ import merge from 'lodash/merge' ;
9
+ import { IStyleFunctionOrObject } from "office-ui-fabric-react/lib/Utilities" ;
8
10
9
11
export interface IFrameDialogProps extends IDialogProps {
10
12
/**
@@ -110,6 +112,7 @@ export class IFrameDialog extends React.Component<IFrameDialogProps, IFrameDialo
110
112
const {
111
113
iframeOnLoad,
112
114
height,
115
+ width,
113
116
allowFullScreen,
114
117
allowTransparency,
115
118
marginHeight,
@@ -119,6 +122,7 @@ export class IFrameDialog extends React.Component<IFrameDialogProps, IFrameDialo
119
122
scrolling,
120
123
seamless,
121
124
modalProps,
125
+ dialogContentProps,
122
126
className
123
127
} = this . props ;
124
128
@@ -127,11 +131,40 @@ export class IFrameDialog extends React.Component<IFrameDialogProps, IFrameDialo
127
131
onLayerDidMount : ( ) => { this . setDialogStyling ( ) ; }
128
132
} ;
129
133
134
+ const dlgContentProps = merge < IDialogContentProps , IDialogContentProps , IDialogContentProps > ( { } , dialogContentProps , {
135
+ styles : {
136
+ content : {
137
+ display : 'flex' ,
138
+ flexDirection : 'column' ,
139
+ height : '100%'
140
+ } ,
141
+ inner : {
142
+ flexGrow : 1
143
+ } ,
144
+ innerContent : {
145
+ height : '100%'
146
+ }
147
+ }
148
+ } ) ;
149
+
150
+
151
+ const dlgStyles : IStyleFunctionOrObject < IDialogStyleProps , IDialogStyles > = {
152
+ main : {
153
+ width : width ,
154
+ maxWidth : width ,
155
+ minWidth : width ,
156
+ height : height
157
+ }
158
+ } ;
159
+
130
160
return (
131
161
< Dialog
132
162
className = { `${ this . state . dialogId } ${ className || '' } ` }
163
+
164
+ styles = { dlgStyles }
133
165
modalProps = { dlgModalProps }
134
- { ...omit ( this . props , 'className' , 'modalProps' ) } >
166
+ dialogContentProps = { dlgContentProps }
167
+ { ...omit ( this . props , 'className' , 'modalProps' , 'dialogContentProps' ) } >
135
168
< IFrameDialogContent src = { this . props . url }
136
169
iframeOnLoad = { iframeOnLoad }
137
170
close = { this . props . onDismiss }
0 commit comments