1
1
import * as strings from 'ControlStrings' ;
2
2
import * as React from 'react' ;
3
3
import { IPeoplePickerProps , IPeoplePickerState , IPeoplePickerUserItem } from './IPeoplePicker' ;
4
- import { IPersonaProps } from 'office-ui-fabric-react/lib/Persona' ;
5
4
import { TooltipHost , DirectionalHint } from 'office-ui-fabric-react/lib/Tooltip' ;
6
- import { IBasePickerSuggestionsProps } from 'office-ui-fabric-react/lib/Pickers' ;
7
5
import { NormalPeoplePicker } from 'office-ui-fabric-react/lib/components/pickers/PeoplePicker/PeoplePicker' ;
8
- import { IPersonaWithMenu } from 'office-ui-fabric-react/lib/components/pickers/PeoplePicker/PeoplePickerItems/PeoplePickerItem.Props' ;
9
- import { ValidationState } from 'office-ui-fabric-react/lib/Pickers' ;
10
- import { MessageBar , MessageBarType } from 'office-ui-fabric-react/lib/MessageBar' ;
6
+ import { MessageBar } from 'office-ui-fabric-react/lib/MessageBar' ;
11
7
import { SPHttpClient } from '@microsoft/sp-http' ;
12
8
import styles from './PeoplePickerComponent.module.scss' ;
13
9
import * as telemetry from '../../common/telemetry' ;
14
10
import { assign } from 'office-ui-fabric-react/lib/Utilities' ;
15
11
import { IUsers } from './IUsers' ;
16
- import { Label } from 'office-ui-fabric-react/lib/Label' ;
12
+ import { Label } from 'office-ui-fabric-react/lib/components/ Label' ;
17
13
import { Environment , EnvironmentType } from "@microsoft/sp-core-library" ;
14
+ import { IBasePickerSuggestionsProps } from "office-ui-fabric-react/lib/components/pickers/BasePicker.types" ;
15
+ import { IPersonaWithMenu } from "office-ui-fabric-react/lib/components/pickers/PeoplePicker/PeoplePickerItems/PeoplePickerItem.types" ;
16
+ import { IPersonaProps } from "office-ui-fabric-react/lib/components/Persona/Persona.types" ;
17
+ import { MessageBarType } from "office-ui-fabric-react/lib/components/MessageBar" ;
18
+ import { ValidationState } from 'office-ui-fabric-react/lib/components/pickers/BasePicker.types' ;
18
19
19
20
const suggestionProps : IBasePickerSuggestionsProps = {
20
21
suggestionsHeaderText : 'Suggested People' ,
@@ -82,7 +83,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
82
83
id : "10dfa208-d7d4-4aef-a7ea-f9e4bb1b85c1" ,
83
84
imageUrl : "" ,
84
85
imageInitials : "RF" ,
85
- primaryText : "Roger Federer" ,
86
+ text : "Roger Federer" ,
86
87
secondaryText :
"[email protected] " ,
87
88
tertiaryText : "" ,
88
89
optionalText :""
@@ -91,7 +92,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
91
92
id : "10dfa208-d7d4-4aef-a7ea-f9e4bb1b85c2" ,
92
93
imageUrl : "" ,
93
94
imageInitials : "RN" ,
94
- primaryText : "Rafael Nadal" ,
95
+ text : "Rafael Nadal" ,
95
96
secondaryText :
"[email protected] " ,
96
97
tertiaryText : "" ,
97
98
optionalText :""
@@ -100,7 +101,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
100
101
id : "10dfa208-d7d4-4aef-a7ea-f9e4bb1b85c3" ,
101
102
imageUrl : "" ,
102
103
imageInitials : "ND" ,
103
- primaryText : "Novak Djokovic" ,
104
+ text : "Novak Djokovic" ,
104
105
secondaryText :
"[email protected] " ,
105
106
tertiaryText : "" ,
106
107
optionalText :""
@@ -109,15 +110,15 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
109
110
id : "10dfa208-d7d4-4aef-a7ea-f9e4bb1b85c4" ,
110
111
imageUrl : "" ,
111
112
imageInitials : "JP" ,
112
- primaryText : "Juan Martin del Potro" ,
113
+ text : "Juan Martin del Potro" ,
113
114
secondaryText :
"[email protected] " ,
114
115
tertiaryText : "" ,
115
116
optionalText :""
116
117
} ) ;
117
118
118
- let personaList : IPersonaWithMenu [ ] = [ ] ;
119
+ let personaList : IPersonaProps [ ] = [ ] ;
119
120
for ( const persona of _fakeUsers ) {
120
- let personaWithMenu : IPersonaWithMenu = { } ;
121
+ let personaWithMenu : IPersonaProps = { } ;
121
122
assign ( personaWithMenu , persona ) ;
122
123
personaList . push ( personaWithMenu ) ;
123
124
}
@@ -162,7 +163,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
162
163
id : items . value [ i ] . Id . toString ( ) ,
163
164
imageUrl : this . generateUserPhotoLink ( items . value [ i ] . Email ) ,
164
165
imageInitials : "" ,
165
- primaryText : items . value [ i ] . Title , // name
166
+ text : items . value [ i ] . Title , // name
166
167
secondaryText : items . value [ i ] . Email , // email
167
168
tertiaryText : "" , // status
168
169
optionalText : "" // anything
@@ -171,19 +172,19 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
171
172
172
173
// Set Default selected persons
173
174
let defaultUsers : any = [ ] ;
174
- let defaultPeopleList : IPersonaWithMenu [ ] = [ ] ;
175
+ let defaultPeopleList : IPersonaProps [ ] = [ ] ;
175
176
if ( this . props . defaultSelectedUsers ) {
176
177
defaultUsers = this . getDefaultUsers ( userValuesArray , this . props . defaultSelectedUsers ) ;
177
178
for ( const persona of defaultUsers ) {
178
- let selectedPeople : IPersonaWithMenu = { } ;
179
+ let selectedPeople : IPersonaProps = { } ;
179
180
assign ( selectedPeople , persona ) ;
180
181
defaultPeopleList . push ( selectedPeople ) ;
181
182
}
182
183
}
183
184
184
- let personaList : IPersonaWithMenu [ ] = [ ] ;
185
+ let personaList : IPersonaProps [ ] = [ ] ;
185
186
for ( const persona of userValuesArray ) {
186
- let personaWithMenu : IPersonaWithMenu = { } ;
187
+ let personaWithMenu : IPersonaProps = { } ;
187
188
assign ( personaWithMenu , persona ) ;
188
189
personaList . push ( personaWithMenu ) ;
189
190
}
@@ -292,7 +293,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
292
293
* @param filterText
293
294
*/
294
295
private _doesTextStartWith ( text : string , filterText : string ) : boolean {
295
- return text . toLowerCase ( ) . indexOf ( filterText . toLowerCase ( ) ) === 0 ;
296
+ return text && text . toLowerCase ( ) . indexOf ( filterText . toLowerCase ( ) ) === 0 ;
296
297
}
297
298
298
299
/**
@@ -302,7 +303,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
302
303
* @param filterText
303
304
*/
304
305
private _doesTextContains ( text : string , filterText : string ) : boolean {
305
- return text . toLowerCase ( ) . indexOf ( filterText . toLowerCase ( ) ) > 0 ;
306
+ return text && text . toLowerCase ( ) . indexOf ( filterText . toLowerCase ( ) ) > 0 ;
306
307
}
307
308
308
309
/**
0 commit comments