Skip to content

Commit 981533c

Browse files
authored
Merge pull request #314 from pnp/dev
Merge for 2.2.0
2 parents 597f58e + dc99c20 commit 981533c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+906
-65
lines changed

CHANGELOG.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
22
"versions": [
3+
{
4+
"version": "2.2.0",
5+
"changes": {
6+
"new": [
7+
"`PropertyFieldTeamPicker`: new Teams picker control [#303](https://github.com/pnp/sp-dev-fx-property-controls/pull/303)"
8+
],
9+
"enhancements": [],
10+
"fixes": []
11+
},
12+
"contributions": [
13+
"[João Mendes](https://github.com/joaojmendes)"
14+
]
15+
},
316
{
417
"version": "2.1.1",
518
"changes": {

config/package-solution.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
"version": "1.0.0.0",
77
"skipFeatureDeployment": true,
88
"isDomainIsolated": false,
9-
"includeClientSideAssets": true
9+
"includeClientSideAssets": true,
10+
"webApiPermissionRequests": [
11+
{
12+
"resource": "Microsoft Graph",
13+
"scope": "Team.ReadBasic.All"
14+
}, {
15+
"resource": "Microsoft Graph",
16+
"scope": "Files.Read"
17+
}]
1018
},
1119
"paths": {
1220
"zippedPackage": "solution/sp-dev-fx-property-controls.sppkg"
46.6 KB
Loading
26.4 KB
Loading

docs/documentation/docs/controls/PropertyFieldSitePicker.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ The `PropertyFieldSitePicker` control can be configured with the following prope
5353
| label | string | yes | Property field label displayed on top. |
5454
| disabled | boolean | no | Specify if the control needs to be disabled. |
5555
| context | WebPartContext | yes | Context of the current web part. |
56-
| initialSites | IPropertyFieldGroupOrPerson[] | no | Intial sites to load in the site picker (optional). |
57-
| multiSelect | boolean | no | Define if you want to allow multi sites selection. (optional, false by default). |
58-
| onPropertyChange | function | yes | Defines a onPropertyChange function to raise when the sites get changed. |
56+
| initialSites | IPropertyFieldSite[] | no | Intial sites to load in the site picker (optional). |
57+
| multiSelect | boolean | no | Define if you want to allow multiple sites selection. (optional, false by default). |
58+
| onPropertyChange | function | yes | Defines a `onPropertyChange` function to raise when the sites get changed. |
5959
| properties | any | yes | Parent web part properties, this object is use to update the property value. |
6060
| key | string | yes | An unique key that indicates the identity of this control. |
6161
| onGetErrorMessage | function | no | The method is used to get the validation error message and determine whether the input value is valid or not. See [this documentation](https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/validate-web-part-property-values) to learn how to use it. |
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# PropertyFieldTeamPicker control
2+
This control generates a team picker that can be used in the property pane of your SharePoint Framework web parts.
3+
4+
**Searching for teams**
5+
6+
![Site picker](../assets/teampicker.png)
7+
8+
**Selected teams**
9+
10+
![Site picker](../assets/teampicker-selected.png)
11+
12+
## How to use this control in your solutions
13+
14+
1. Check that you installed the `@pnp/spfx-property-controls` dependency. Check out The [getting started](../../#getting-started) page for more information about installing the dependency.
15+
2. Request Microsoft Graph permissions in `config/package-solution.json`:
16+
```json
17+
{
18+
"solution": {
19+
"webApiPermissionRequests": [
20+
{
21+
"resource": "Microsoft Graph",
22+
"scope": "Team.ReadBasic.All"
23+
}, {
24+
"resource": "Microsoft Graph",
25+
"scope": "Files.Read"
26+
}]
27+
}
28+
}
29+
```
30+
!!! Note
31+
`Team.ReadBasic.All` and `Files.Read` is a minimum set of permissions needed for the component. For other options please see [List Joined Teams](https://docs.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=http) and [Get Drive](https://docs.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-1.0&tabs=http) documentation.
32+
33+
3. Import the following modules to your component:
34+
35+
```TypeScript
36+
import { PropertyFieldSitePicker } from '@pnp/spfx-property-controls/lib/PropertyFieldSitePicker';
37+
```
38+
39+
4. Create a new property for your web part, for example:
40+
41+
```TypeScript
42+
import { IPropertyFieldTeam } from '../../PropertyFieldTeamPicker';
43+
44+
export interface IPropertyControlsTestWebPartProps {
45+
teams: IPropertyFieldTeam[];
46+
}
47+
```
48+
49+
5. Add the custom property control to the `groupFields` of the web part property pane configuration:
50+
51+
```TypeScript
52+
PropertyFieldTeamPicker('teams', {
53+
key: 'teamsPicker',
54+
context: this.context,
55+
label: 'Select teams',
56+
onPropertyChange: this.onPropertyPaneFieldChanged,
57+
properties: this.properties,
58+
initialTeams: this.properties.teams,
59+
multiSelect: true
60+
})
61+
```
62+
63+
## Implementation
64+
65+
The `PropertyFieldTeamPicker` control can be configured with the following properties:
66+
67+
| Property | Type | Required | Description |
68+
| ---- | ---- | ---- | ---- |
69+
| label | string | yes | Property field label displayed on top. |
70+
| disabled | boolean | no | Specify if the control needs to be disabled. |
71+
| context | WebPartContext | yes | Context of the current web part. |
72+
| initialTeams | IPropertyFieldTeam[] | no | Initial teams to load in the site picker (optional). |
73+
| multiSelect | boolean | no | Define if you want to allow multiple teams selection. (optional, false by default). |
74+
| onPropertyChange | function | yes | Defines a `onPropertyChange` function to raise when the teams get changed. |
75+
| properties | any | yes | Parent web part properties, this object is used to update the property value. |
76+
| key | string | yes | An unique key that indicates the identity of this control. |
77+
| onGetErrorMessage | function | no | The method is used to get the validation error message and determine whether the input value is valid or not. See [this documentation](https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/validate-web-part-property-values) to learn how to use it. |
78+
| deferredValidationTime | number | no | Control will start to validate after users stop typing for `deferredValidationTime` milliseconds. Default value is 200. |
79+
80+
Interface `IPropertyFieldTeam`
81+
82+
| Property | Type | Required | Description |
83+
| ---- | ---- | ---- | ---- |
84+
| id | string | no | The ID of the team (group) |
85+
| title | string | no | Teams's display name |
86+
| url | string | no | URL to the underlying site |
87+
88+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-property-controls/wiki/PropertyFieldTeamPicker)

docs/documentation/docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The following controls are currently available:
7070
- [PropertyFieldSpinButton](./controls/PropertyFieldSpinButton) (Property pane spin button)
7171
- [PropertyFieldSpinner](./controls/PropertyFieldSpinButton) (Property pane spinner)
7272
- [PropertyFieldSwatchColorPicker](./controls/PropertyFieldSwatchColorPicker) (Property pane color selector)
73+
- [PropertyFieldTeamPicker](./controls/PropertyFieldTeamPicker) (Property pane team selector)
7374
- [PropertyFieldTermPicker](./controls/PropertyFieldTermPicker) (Property pane managed metadata term selector)
7475
- [PropertyFieldEnterpriseTermPicker](./controls/PropertyFieldEnterpriseTermPicker) (Property pane managed metadata term selector for enterprise scenarios)
7576
- [PropertyFieldViewPicker](./controls/PropertyFIeldViewPicker) (Property pane view selector)

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ nav:
2323
- PropertyFieldSpinButton: 'controls/PropertyFieldSpinButton.md'
2424
- PropertyFieldSpinner: 'controls/PropertyFieldSpinner.md'
2525
- PropertyFieldSwatchColorPicker: 'controls/PropertyFieldSwatchColorPicker.md'
26+
- PropertyFieldTeamPicker: 'controls/PropertyFieldTeamPicker.md'
2627
- PropertyFieldTermPicker: 'controls/PropertyFieldTermPicker.md'
2728
- PropertyFieldViewPicker: 'controls/PropertyFieldViewPicker.md'
2829
- PropertyPaneMarkdownContent: 'controls/PropertyPaneMarkdownContent.md'

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pnp/spfx-property-controls",
33
"description": "Reusable property pane controls for SharePoint Framework solutions",
4-
"version": "2.1.1",
4+
"version": "2.2.0",
55
"engines": {
66
"node": ">=0.10.0"
77
},

0 commit comments

Comments
 (0)