diff --git a/CHANGELOG.JSON b/CHANGELOG.JSON
index 934a8e935..ee7a17952 100644
--- a/CHANGELOG.JSON
+++ b/CHANGELOG.JSON
@@ -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",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae20b82d3..ca7c8e430 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/docs/documentation/docs/about/release-notes.md b/docs/documentation/docs/about/release-notes.md
index ae20b82d3..ca7c8e430 100644
--- a/docs/documentation/docs/about/release-notes.md
+++ b/docs/documentation/docs/about/release-notes.md
@@ -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
diff --git a/docs/documentation/docs/assets/ListItemPicker-selectedItems.png b/docs/documentation/docs/assets/ListItemPicker-selectedItems.png
new file mode 100644
index 000000000..bca220555
Binary files /dev/null and b/docs/documentation/docs/assets/ListItemPicker-selectedItems.png differ
diff --git a/docs/documentation/docs/assets/ListItemPicker-selectlist.png b/docs/documentation/docs/assets/ListItemPicker-selectlist.png
new file mode 100644
index 000000000..aff7eb624
Binary files /dev/null and b/docs/documentation/docs/assets/ListItemPicker-selectlist.png differ
diff --git a/docs/documentation/docs/assets/ListItemPicker-selectlist2.png b/docs/documentation/docs/assets/ListItemPicker-selectlist2.png
new file mode 100644
index 000000000..c900bbe7b
Binary files /dev/null and b/docs/documentation/docs/assets/ListItemPicker-selectlist2.png differ
diff --git a/docs/documentation/docs/controls/ListItemPicker.md b/docs/documentation/docs/controls/ListItemPicker.md
new file mode 100644
index 000000000..1aaecca45
--- /dev/null
+++ b/docs/documentation/docs/controls/ListItemPicker.md
@@ -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
+
+```
+
+- 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)
diff --git a/docs/documentation/docs/controls/PeoplePicker.md b/docs/documentation/docs/controls/PeoplePicker.md
index 5c802f7c3..8275b0568 100644
--- a/docs/documentation/docs/controls/PeoplePicker.md
+++ b/docs/documentation/docs/controls/PeoplePicker.md
@@ -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`
diff --git a/docs/documentation/mkdocs.yml b/docs/documentation/mkdocs.yml
index 861e8bef5..7332026be 100644
--- a/docs/documentation/mkdocs.yml
+++ b/docs/documentation/mkdocs.yml
@@ -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'
diff --git a/package-lock.json b/package-lock.json
index df956b13a..7037c03c9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4697,7 +4697,7 @@
},
"file-type": {
"version": "3.9.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
+ "resolved": "http://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
"integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=",
"dev": true
},
@@ -9303,7 +9303,7 @@
},
"into-stream": {
"version": "3.1.0",
- "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
+ "resolved": "http://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
"integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=",
"dev": true,
"requires": {
@@ -14878,9 +14878,9 @@
}
},
"sonarqube-scanner": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/sonarqube-scanner/-/sonarqube-scanner-2.1.1.tgz",
- "integrity": "sha512-KhvOBP1IBXnnkVAbfdINLyDnsR6W6NsX4m5z57s4/wxlfUIeRMT8MNsqmGWRRIzYqtPPUCpHT3R3sUChGZmALg==",
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/sonarqube-scanner/-/sonarqube-scanner-2.1.2.tgz",
+ "integrity": "sha512-4Sf01R7zOnR3YTofaQI5HH6UTz46l0kUov7cJvWmhD9Hi+U16komI/e61GjOyC2JrVrFiWqFsO/o15ceHbKd/Q==",
"dev": true,
"requires": {
"download": "7.0.0",
@@ -14916,9 +14916,9 @@
}
},
"progress": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
- "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz",
+ "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==",
"dev": true
},
"read-pkg": {
@@ -16210,9 +16210,9 @@
"dev": true
},
"unbzip2-stream": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.0.tgz",
- "integrity": "sha512-kE2WkurNnPUMcryNioS68DDbhoPB8Qxsd8btHSj+sd5Pjh2GsjmeHLzMSqV9HHziAo8FzVxVCJl9ZYhk7yY1pA==",
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.1.tgz",
+ "integrity": "sha512-fIZnvdjblYs7Cru/xC6tCPVhz7JkYcVQQkePwMLyQELzYTds2Xn8QefPVnvdVhhZqubxNA1cASXEH5wcK0Bucw==",
"dev": true,
"requires": {
"buffer": "^3.0.1",
diff --git a/package.json b/package.json
index 05213422b..cffff5e38 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/src/ListItemPicker.ts b/src/ListItemPicker.ts
new file mode 100644
index 000000000..be6838119
--- /dev/null
+++ b/src/ListItemPicker.ts
@@ -0,0 +1 @@
+export * from './controls/listItemPicker';
diff --git a/src/controls/listItemPicker/IListItemPickerProps.ts b/src/controls/listItemPicker/IListItemPickerProps.ts
new file mode 100644
index 000000000..96e2499ab
--- /dev/null
+++ b/src/controls/listItemPicker/IListItemPickerProps.ts
@@ -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;
+}
diff --git a/src/controls/listItemPicker/IListItemPickerState.ts b/src/controls/listItemPicker/IListItemPickerState.ts
new file mode 100644
index 000000000..9c6a3de79
--- /dev/null
+++ b/src/controls/listItemPicker/IListItemPickerState.ts
@@ -0,0 +1,6 @@
+export interface IListItemPickerState {
+ noresultsFoundText: string;
+ showError: boolean;
+ errorMessage: string;
+ suggestionsHeaderText:string;
+}
diff --git a/src/controls/listItemPicker/ListItemPicker.tsx b/src/controls/listItemPicker/ListItemPicker.tsx
new file mode 100644
index 000000000..449720a39
--- /dev/null
+++ b/src/controls/listItemPicker/ListItemPicker.tsx
@@ -0,0 +1,137 @@
+import * as strings from 'ControlStrings';
+import * as React from "react";
+import SPservice from "../../services/SPService";
+import { escape } from "@microsoft/sp-lodash-subset";
+import { TagPicker } from "office-ui-fabric-react/lib/components/pickers/TagPicker/TagPicker";
+import { Label } from "office-ui-fabric-react/lib/Label";
+import { IListItemPickerProps, IListItemPickerState } from ".";
+import * as telemetry from '../../common/telemetry';
+
+
+export class ListItemPicker extends React.Component {
+ private _spservice: SPservice;
+ private selectedItems: any[];
+
+ constructor(props: IListItemPickerProps) {
+ super(props);
+
+ telemetry.track('ListItemPicker', {});
+
+ // States
+ this.state = {
+ noresultsFoundText: !this.props.noResultsFoundText ? strings.genericNoResultsFoundText : this.props.noResultsFoundText,
+ showError: false,
+ errorMessage: "",
+ suggestionsHeaderText: !this.props.suggestionsHeaderText ? strings.ListItemPickerSelectValue : this.props.suggestionsHeaderText
+ };
+
+ // Get SPService Factory
+ this._spservice = new SPservice(this.props.context);
+
+ this.selectedItems = [];
+ }
+
+ public componentDidUpdate(prevProps: IListItemPickerProps, prevState: IListItemPickerState): void {
+ if (this.props.listId !== prevProps.listId) {
+ this.selectedItems = [];
+ }
+ }
+
+ /**
+ * Render the field
+ */
+ public render(): React.ReactElement {
+ const { className, disabled, itemLimit } = this.props;
+
+ return (
+