Skip to content

Commit 94654e1

Browse files
committed
#97 - Rewrite of the PeoplePicker control
1 parent 251706e commit 94654e1

File tree

14 files changed

+450
-597
lines changed

14 files changed

+450
-597
lines changed

docs/documentation/docs/controls/PeoplePicker.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { PeoplePicker, PrincipalType } from "@pnp/spfx-controls-react/lib/People
3737
disabled={true}
3838
selectedItems={this._getPeoplePickerItems}
3939
showHiddenInUI={false}
40-
principleTypes={[PrincipalType.User]}
40+
principalTypes={[PrincipalType.User]}
4141
resolveDelay={1000} />
4242
```
4343

@@ -64,28 +64,27 @@ The People picker control can be configured with the following properties:
6464
| errorMessage | string | no | Specify the error message to display | |
6565
| errorMessageClassName | string | no | applies custom styling to the error message section | |
6666
| showtooltip | boolean | no | Defines if need a tooltip or not | false |
67-
| tooltip | string | no | Specify the tooltip message to display | |
67+
| tooltipMessage | string | no | Specify the tooltip message to display | |
6868
| tooltipDirectional | DirectionalHint | no | Direction where the tooltip would be shown | |
69-
| selectedItems | function | no | get the selected users in the control | |
69+
| selectedItems | (items: IPersonaProps[]) => void | no | Get the selected users in the control. | |
7070
| peoplePickerWPclassName | string | no | applies custom styling to the people picker element | |
7171
| peoplePickerCntrlclassName | string | no | applies custom styling to the people picker control only | |
72-
| defaultSelectedUsers | string[] | no | Default selected user emails | |
73-
| webAbsoluteUrl | string | no | Specify the site URL on which you want to perform the user query call. | Current site URL |
72+
| defaultSelectedUsers | string[] | no | Default selected user emails or login names | |
73+
| webAbsoluteUrl | string | no | Specify the site URL on which you want to perform the user query call. If not provided, the people picker will perform a tenant wide people/group search. When provided it will search users/groups on the provided site. | |
7474
| showHiddenInUI | boolean | no | Show users which are hidden from the UI. By default these users/groups hidden for the UI will not be shown. | false |
75-
| principleTypes | PrincipleType[] | no | Define which type of data you want to retrieve: User, SharePoint groups, Security groups. Multiple are possible. | |
75+
| principalTypes | PrincipalType[] | no | Define which type of data you want to retrieve: User, SharePoint groups, Security groups. Multiple are possible. | |
7676
| suggestionsLimit | number | no | Maximum number of suggestions to show in the full suggestion list. | 5 |
77-
| resolveDelay | number | no | Add delay to resolve and search users | 1000 |
77+
| resolveDelay | number | no | Add delay to resolve and search users | 200 |
7878

7979
Enum `PrincipalType`
8080

8181
The `PrincipalType` enum can be used to specify the types of information you want to query: User, Security groups, and/or SharePoint groups.
8282

83-
| Name |
84-
| ---- |
85-
| User |
86-
| DistributionList |
87-
| SecurityGroup |
88-
| SharePointGroup |
89-
| All |
83+
| Name | Value |
84+
| ---- | -- -- |
85+
| User | 1 |
86+
| DistributionList | 2 |
87+
| SecurityGroup | 4 |
88+
| SharePointGroup | 8 |
9089

9190
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/PeoplePicker)

src/controls/peoplepicker/IPeoplePicker.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface IPeoplePickerProps {
5656
/**
5757
* Method to check value of People Picker text
5858
*/
59-
selectedItems?: (items: any[]) => void;
59+
selectedItems?: (items: IPersonaProps[]) => void;
6060
/**
6161
* Tooltip Message
6262
*/
@@ -87,24 +87,19 @@ export interface IPeoplePickerProps {
8787
showHiddenInUI?: boolean;
8888
/**
8989
* Specify the user / group types to retrieve
90+
*
9091
*/
91-
principleTypes?: PrincipalType[];
92+
principalTypes?: PrincipalType[];
9293
}
9394

9495
export interface IPeoplePickerState {
95-
selectedPersons?: IPersonaProps[];
9696
mostRecentlyUsedPersons: IPersonaProps[];
97-
currentSelectedPersons: IPersonaProps[];
98-
allPersons: IPeoplePickerUserItem[];
99-
delayResults?: boolean;
100-
currentPicker?: number | string;
101-
peoplePersonaMenu?: IPersonaProps[];
102-
peoplePartTitle: string;
103-
peoplePartTooltip: string;
104-
isLoading: boolean;
105-
peopleValidatorText?: string;
10697
showmessageerror: boolean;
10798
resolveDelay : number;
99+
100+
selectedPersons?: IPersonaProps[];
101+
peoplePersonaMenu?: IPersonaProps[];
102+
delayResults?: boolean;
108103
}
109104

110105
export interface IPeoplePickerUserItem {

src/controls/peoplepicker/IUsers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export interface IUsers {
22
'@odata.context': string;
3-
value: Value[];
3+
value: IUserInfo[];
44
}
55

6-
export interface Value {
6+
export interface IUserInfo {
77
'@odata.type': string;
88
'@odata.id': string;
99
'@odata.editLink': string;

0 commit comments

Comments
 (0)