@@ -4,11 +4,15 @@ import { IControlsTestProps, IControlsTestState } from './IControlsTestProps';
4
4
import { escape } from '@microsoft/sp-lodash-subset' ;
5
5
import { FileTypeIcon , IconType , ApplicationType , ImageSize } from '../../../FileTypeIcon' ;
6
6
import { Dropdown , IDropdownOption } from 'office-ui-fabric-react/lib/components/Dropdown' ;
7
+ import { PrimaryButton } from 'office-ui-fabric-react/lib/components/Button' ;
8
+ import { DialogType } from 'office-ui-fabric-react/lib/components/Dialog' ;
7
9
import { Placeholder } from '../../../Placeholder' ;
8
10
import { ListView , IViewField , SelectionMode , GroupOrder , IGrouping } from '../../../ListView' ;
9
11
import { SPHttpClient } from '@microsoft/sp-http' ;
10
12
import { SiteBreadcrumb } from '../../../SiteBreadcrumb' ;
11
13
import { WebPartTitle } from '../../../WebPartTitle' ;
14
+ import { IFrameDialog } from '../../../IFrameDialog' ;
15
+ import { Environment , EnvironmentType } from '@microsoft/sp-core-library' ;
12
16
13
17
/**
14
18
* Component that can be used to test out the React controls from this project
@@ -19,7 +23,8 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
19
23
20
24
this . state = {
21
25
imgSize : ImageSize . small ,
22
- items : [ ]
26
+ items : [ ] ,
27
+ iFrameDialogOpened : false
23
28
} ;
24
29
25
30
this . _onIconSizeChange = this . _onIconSizeChange . bind ( this ) ;
@@ -120,13 +125,21 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
120
125
121
126
// Specify the fields on which you want to group your items
122
127
// Grouping is takes the field order into account from the array
123
- const groupByFields : IGrouping [ ] = [ { name : "ListItemAllFields.City" , order : GroupOrder . ascending } , { name : "ListItemAllFields.Country.Label" , order : GroupOrder . descending } ] ;
128
+ const groupByFields : IGrouping [ ] = [ { name : "ListItemAllFields.City" , order : GroupOrder . ascending } , { name : "ListItemAllFields.Country.Label" , order : GroupOrder . descending } ] ;
129
+
130
+ let iframeUrl : string = '/temp/workbench.html' ;
131
+ if ( Environment . type === EnvironmentType . SharePoint ) {
132
+ iframeUrl = '/_layouts/15/sharepoint.aspx' ;
133
+ }
134
+ else if ( Environment . type === EnvironmentType . ClassicSharePoint ) {
135
+ iframeUrl = this . context . pageContext . web . serverRelativeUrl ;
136
+ }
124
137
125
138
return (
126
139
< div className = { styles . controlsTest } >
127
140
< WebPartTitle displayMode = { this . props . displayMode }
128
- title = { this . props . title }
129
- updateProperty = { this . props . updateProperty } />
141
+ title = { this . props . title }
142
+ updateProperty = { this . props . updateProperty } />
130
143
131
144
< div className = { styles . container } >
132
145
< div className = { `ms-Grid-row ms-bgColor-neutralLight ms-fontColor-neutralDark ${ styles . row } ` } >
@@ -157,6 +170,25 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
157
170
< FileTypeIcon type = { IconType . image } size = { this . state . imgSize } application = { ApplicationType . Excel } />
158
171
< FileTypeIcon type = { IconType . image } size = { this . state . imgSize } />
159
172
</ div >
173
+ < div className = "ms-font-m" > iframe dialog tester:
174
+ < PrimaryButton
175
+ text = "Open iframe Dialog"
176
+ onClick = { ( ) => { this . setState ( { iFrameDialogOpened : true } ) ; } } />
177
+ < IFrameDialog
178
+ url = { iframeUrl }
179
+ iframeOnLoad = { ( iframe : any ) => { console . log ( 'iframe loaded' ) ; } }
180
+ hidden = { ! this . state . iFrameDialogOpened }
181
+ onDismiss = { ( ) => { this . setState ( { iFrameDialogOpened : false } ) ; } }
182
+ modalProps = { {
183
+ isBlocking : true
184
+ } }
185
+ dialogContentProps = { {
186
+ type : DialogType . close ,
187
+ showCloseButton : true
188
+ } }
189
+ width = { '570px' }
190
+ height = { '315px' } />
191
+ </ div >
160
192
</ div >
161
193
</ div >
162
194
</ div >
0 commit comments