Skip to content

Commit

Permalink
Merge pull request #2 from SharePoint/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
trillian74 authored Nov 6, 2018
2 parents 8fd2d8f + a903091 commit 10a95f7
Show file tree
Hide file tree
Showing 30 changed files with 674 additions and 115 deletions.
24 changes: 21 additions & 3 deletions CHANGELOG.JSON
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,33 @@
{
"version": "1.10.0",
"changes": {
"new": [],
"new": [
"`ListItemPicker`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165)"
],
"enhancements": [
"Dutch localization added [#100](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/100)",
"German localization added [#101](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/101)",
"French localization added [#102](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/102)",
"`PeoplePicker`: Move defaultSelectedUsers from ComponentWillMount to ComponentDidUpdate Lifecycle [#135](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/135)",
"`PeoplePicker`: Initialize with users from a list item [#138](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/138)",
"`PeoplePicker`: Remove Messagebar error handling to match Office UI Fabric field error styling [#140](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/140)",
"`PeoplePicker`: REST API filter and nometadata header added to reduce payload [#139](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/139)",
"`PeoplePicker`: Allow to set the maximum number of suggestions `suggestionsLimit` [#143](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/143) [#148](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/148)",
"`TaxonomyPicker`: retreiving the terms in the correct custom sort order [#146](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/146)"
"`TaxonomyPicker`: retreiving the terms in the correct custom sort order [#146](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/146)",
"`PeoplePicker`: Documentation format updated to make it easier to check the default values [#159](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/159)"
],
"fixes": []
},
"contributions": ["[Gautam Sheth](https://github.com/gautamdsheth)", "[Ole Bergtun](https://github.com/trillian74)", "[Tse Kit Yam](https://github.com/tsekityam)"]
"contributions": [
"[Marc D Anderson](https://github.com/sympmarc)",
"[Ole Bergtun](https://github.com/trillian74)",
"[João Mendes](https://github.com/joaojmendes)",
"[Markus Möller](https://github.com/mmsharepoint)",
"[Asish Padhy](https://github.com/AsishP)",
"[PooLP](https://github.com/PooLP)",
"[Gautam Sheth](https://github.com/gautamdsheth)",
"[Tse Kit Yam](https://github.com/tsekityam)"
]
},
{
"version": "1.9.0",
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

## 1.10.0

**New control(s)**

- `ListItemPicker`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165)

**Enhancements**

- Dutch localization added [#100](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/100)
- German localization added [#101](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/101)
- French localization added [#102](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/102)
- `PeoplePicker`: Move defaultSelectedUsers from ComponentWillMount to ComponentDidUpdate Lifecycle [#135](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/135)
- `PeoplePicker`: Initialize with users from a list item [#138](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/138)
- `PeoplePicker`: Remove Messagebar error handling to match Office UI Fabric field error styling [#140](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/140)
- `PeoplePicker`: REST API filter and nometadata header added to reduce payload [#139](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/139)
- `PeoplePicker`: Allow to set the maximum number of suggestions `suggestionsLimit` [#143](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/143) [#148](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/148)
- `TaxonomyPicker`: retreiving the terms in the correct custom sort order [#146](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/146)
- `PeoplePicker`: Documentation format updated to make it easier to check the default values [#159](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/159)

### Contributors

Special thanks to our contributors (in alphabetical order): [Gautam Sheth](https://github.com/gautamdsheth), [Ole Bergtun](https://github.com/trillian74), [Tse Kit Yam](https://github.com/tsekityam).
Special thanks to our contributors (in alphabetical order): [Marc D Anderson](https://github.com/sympmarc), [Ole Bergtun](https://github.com/trillian74), [João Mendes](https://github.com/joaojmendes), [Markus Möller](https://github.com/mmsharepoint), [Asish Padhy](https://github.com/AsishP), [PooLP](https://github.com/PooLP), [Gautam Sheth](https://github.com/gautamdsheth), [Tse Kit Yam](https://github.com/tsekityam).

## 1.9.0

Expand Down
13 changes: 12 additions & 1 deletion docs/documentation/docs/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

## 1.10.0

**New control(s)**

- `ListItemPicker`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165)

**Enhancements**

- Dutch localization added [#100](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/100)
- German localization added [#101](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/101)
- French localization added [#102](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/102)
- `PeoplePicker`: Move defaultSelectedUsers from ComponentWillMount to ComponentDidUpdate Lifecycle [#135](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/135)
- `PeoplePicker`: Initialize with users from a list item [#138](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/138)
- `PeoplePicker`: Remove Messagebar error handling to match Office UI Fabric field error styling [#140](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/140)
- `PeoplePicker`: REST API filter and nometadata header added to reduce payload [#139](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/139)
- `PeoplePicker`: Allow to set the maximum number of suggestions `suggestionsLimit` [#143](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/143) [#148](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/148)
- `TaxonomyPicker`: retreiving the terms in the correct custom sort order [#146](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/146)
- `PeoplePicker`: Documentation format updated to make it easier to check the default values [#159](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/159)

### Contributors

Special thanks to our contributors (in alphabetical order): [Gautam Sheth](https://github.com/gautamdsheth), [Ole Bergtun](https://github.com/trillian74), [Tse Kit Yam](https://github.com/tsekityam).
Special thanks to our contributors (in alphabetical order): [Marc D Anderson](https://github.com/sympmarc), [Ole Bergtun](https://github.com/trillian74), [João Mendes](https://github.com/joaojmendes), [Markus Möller](https://github.com/mmsharepoint), [Asish Padhy](https://github.com/AsishP), [PooLP](https://github.com/PooLP), [Gautam Sheth](https://github.com/gautamdsheth), [Tse Kit Yam](https://github.com/tsekityam).

## 1.9.0

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions docs/documentation/docs/controls/ListItemPicker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ListItemPicker control

This control allows you to select one or more items from a list. The item selection is based from a column value. The control will suggest items based on the inserted value.

Here is an example of the control:

![ListItemPicker select list items](../assets/ListItemPicker-selectlist.png)

![ListItemPicker select list items](../assets/ListItemPicker-selectlist2.png)

![ListItemPicker selected Items](../assets/ListItemPicker-selectedItems.png)

## How to use this control in your solutions

- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../#getting-started) page for more information about installing the dependency.
- Import the control into your component:

```TypeScript
import { ListItemPicker } from '@pnp/spfx-controls-react/listItemPicker';
```
- Use the `ListItemPicker` control in your code as follows:

```TypeScript
<ListItemPicker listId='da8daf15-d84f-4ab1-9800-7568f82fed3f'
columnInternalName='Title'
itemLimit={2}
onSelectedItem={this.onSelectedItem}
context={this.props.context} />
```

- The `onSelectedItem` change event returns the list items selected and can be implemented as follows:

```TypeScript
private onSelectedItem(data: { key: string; name: string }[]) {
for (const item of data) {
console.log(`Item value: ${item.name}`);
}
}
```
## Implementation

The `ListItemPicker` control can be configured with the following properties:


| Property | Type | Required | Description |
| ---- | ---- | ---- | ---- |
| columnInternalName | string | yes | InternalName of column to search and get values. |
| context | WebPartContext \| ApplicationCustomizerContext | yes | SPFx web part or extention context |
| listId | string | yes | Guid of the list. |
| itemLimit | number | yes | Number of items which can be selected |
| onSelectItem | (items: any[]) => void | yes | Callback function which returns the selected items. |
| className | string | no | ClassName for the picker. |
| webUrl | string | no | URL of the site. By default it uses the current site URL. |
| defaultSelectedItems | any[] | no | Initial items that have already been selected and should appear in the people picker. |
| suggestionsHeaderText | string | no | The text that should appear at the top of the suggestion box. |
| noResultsFoundText | string | no | The text that should appear when no results are returned. |
| disabled | boolean | no | Specifies if the control is disabled or not. |

![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ListItemPicker)
42 changes: 21 additions & 21 deletions docs/documentation/docs/controls/PeoplePicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,27 @@ private _getPeoplePickerItems(items: any[]) {

The People picker control can be configured with the following properties:

| Property | Type | Required | Description |
| ---- | ---- | ---- | ---- |
| context | WebPartContext | yes | Context of the current web part. |
| titleText | string | yes | Text to be displayed on the control |
| groupName | string | no | group from which users are fetched. Leave it blank if need to filter all users |
| personSelectionLimit | number | no | Defines the limit of people that can be selected in the control|
| isRequired | boolean | no | Set if the control is required or not |
| disabled | boolean | no | Set if the control is disabled or not |
| errorMessage | string | no | Specify the error message to display |
| errorMessageclassName | string | no | applies custom styling to the error message section|
| showtooltip | boolean | no | Defines if need a tooltip or not |
| tooltip | string | no | Specify the tooltip message to display |
| tooltipDirectional | DirectionalHint | no | Direction where the tooltip would be shown |
| selectedItems | function | no | get the selected users in the control |
| peoplePickerWPclassName | string | no | applies custom styling to the people picker element |
| peoplePickerCntrlclassName | string | no | applies custom styling to the people picker control only |
| defaultSelectedUsers | string[] | no | Default selected user emails |
| webAbsoluteUrl | string | no | Specify the site URL on which you want to perform the user query call. Default is the current site URL. |
| showHiddenInUI | boolean | no | Show users which are hidden from the UI. By default these users/groups hidden for the UI will not be shown. |
| principleTypes | PrincipleType[] | no | Define which type of data you want to retrieve: User, SharePoint groups, Security groups. Multiple are possible. |
| suggestionsLimit | number | no | Maximum number of suggestions to show in the full suggestion list. Default is 5. |
| Property | Type | Required | Description | Default |
| ---- | ---- | ---- | ---- | ---- |
| context | WebPartContext | yes | Context of the current web part. | |
| titleText | string | yes | Text to be displayed on the control | |
| groupName | string | no | group from which users are fetched. Leave it blank if need to filter all users | _none_ |
| personSelectionLimit | number | no | Defines the limit of people that can be selected in the control | |
| isRequired | boolean | no | Set if the control is required or not | false |
| disabled | boolean | no | Set if the control is disabled or not | false |
| errorMessage | string | no | Specify the error message to display | |
| errorMessageClassName | string | no | applies custom styling to the error message section | |
| showtooltip | boolean | no | Defines if need a tooltip or not | false |
| tooltip | string | no | Specify the tooltip message to display | |
| tooltipDirectional | DirectionalHint | no | Direction where the tooltip would be shown | |
| selectedItems | function | no | get the selected users in the control | |
| peoplePickerWPclassName | string | no | applies custom styling to the people picker element | |
| peoplePickerCntrlclassName | string | no | applies custom styling to the people picker control only | |
| defaultSelectedUsers | string[] | no | Default selected user emails | |
| webAbsoluteUrl | string | no | Specify the site URL on which you want to perform the user query call. | Current site URL |
| 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 |
| principleTypes | PrincipleType[] | no | Define which type of data you want to retrieve: User, SharePoint groups, Security groups. Multiple are possible. | |
| suggestionsLimit | number | no | Maximum number of suggestions to show in the full suggestion list. | 5 |

Enum `PrincipalType`

Expand Down
1 change: 1 addition & 0 deletions docs/documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ nav:
- Home: 'index.md'
- Controls:
- FileTypeIcon: 'controls/FileTypeIcon.md'
- ListItemPicker: 'controls/ListItemPicker.md'
- ListPicker: 'controls/ListPicker.md'
- ListView: 'controls/ListView.md'
- "ListView: add a contextual menu": 'controls/ListView.ContextualMenu.md'
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"react": "15.4.2",
"react-addons-test-utils": "15.6.0",
"react-dom": "15.4.2",
"sonarqube-scanner": "2.1.1"
"sonarqube-scanner": "2.1.2"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/ListItemPicker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './controls/listItemPicker';
18 changes: 18 additions & 0 deletions src/controls/listItemPicker/IListItemPickerProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";
import { ApplicationCustomizerContext } from "@microsoft/sp-application-base";

export interface IListItemPickerProps {
columnInternalName: string;
context: WebPartContext | ApplicationCustomizerContext;
listId: string;
itemLimit: number;

className?: string;
webUrl?: string;
defaultSelectedItems?: any[];
disabled?: boolean;
suggestionsHeaderText?:string;
noResultsFoundText?:string;

onSelectedItem: (item:any) => void;
}
6 changes: 6 additions & 0 deletions src/controls/listItemPicker/IListItemPickerState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface IListItemPickerState {
noresultsFoundText: string;
showError: boolean;
errorMessage: string;
suggestionsHeaderText:string;
}
Loading

0 comments on commit 10a95f7

Please sign in to comment.