diff --git a/CHANGELOG.JSON b/CHANGELOG.JSON index c3e60469c..ee7a17952 100644 --- a/CHANGELOG.JSON +++ b/CHANGELOG.JSON @@ -4,7 +4,7 @@ "version": "1.10.0", "changes": { "new": [ - "`FieldPickerListData`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165)" + "`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)", diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f2fa4403..ca7c8e430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ **New control(s)** -- `FieldPickerListData`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165) +- `ListItemPicker`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165) **Enhancements** diff --git a/docs/documentation/docs/about/release-notes.md b/docs/documentation/docs/about/release-notes.md index 7f2fa4403..ca7c8e430 100644 --- a/docs/documentation/docs/about/release-notes.md +++ b/docs/documentation/docs/about/release-notes.md @@ -4,7 +4,7 @@ **New control(s)** -- `FieldPickerListData`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165) +- `ListItemPicker`: New field control [#165](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/165) **Enhancements** diff --git a/src/FieldPickerListData.ts b/src/FieldPickerListData.ts deleted file mode 100644 index ce95f0dff..000000000 --- a/src/FieldPickerListData.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './controls/fieldPickerListData/index'; 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/fieldPickerListData/index.ts b/src/controls/fieldPickerListData/index.ts deleted file mode 100644 index 99315e560..000000000 --- a/src/controls/fieldPickerListData/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// A file is required to be in the root of the /src directory by the TypeScript compiler -export * from './IFieldPickerListDataProps'; -export * from './IFieldPickerListDataState'; -export * from './FieldPickerListData'; diff --git a/src/controls/fieldPickerListData/IFieldPickerListDataProps.ts b/src/controls/listItemPicker/IListItemPickerProps.ts similarity index 90% rename from src/controls/fieldPickerListData/IFieldPickerListDataProps.ts rename to src/controls/listItemPicker/IListItemPickerProps.ts index 133c15873..67e2247eb 100644 --- a/src/controls/fieldPickerListData/IFieldPickerListDataProps.ts +++ b/src/controls/listItemPicker/IListItemPickerProps.ts @@ -1,7 +1,7 @@ import { WebPartContext } from "@microsoft/sp-webpart-base"; import { ApplicationCustomizerContext } from "@microsoft/sp-application-base"; -export interface IFieldPickerListDataProps { +export interface IListItemPickerProps { listId: string; columnInternalName:string; onSelectedItem: (item:any) => void; diff --git a/src/controls/fieldPickerListData/IFieldPickerListDataState.ts b/src/controls/listItemPicker/IListItemPickerState.ts similarity index 70% rename from src/controls/fieldPickerListData/IFieldPickerListDataState.ts rename to src/controls/listItemPicker/IListItemPickerState.ts index b965218bd..9c6a3de79 100644 --- a/src/controls/fieldPickerListData/IFieldPickerListDataState.ts +++ b/src/controls/listItemPicker/IListItemPickerState.ts @@ -1,4 +1,4 @@ -export interface IFieldPickerListDataState { +export interface IListItemPickerState { noresultsFoundText: string; showError: boolean; errorMessage: string; diff --git a/src/controls/fieldPickerListData/FieldPickerListData.tsx b/src/controls/listItemPicker/ListItemPicker.tsx similarity index 87% rename from src/controls/fieldPickerListData/FieldPickerListData.tsx rename to src/controls/listItemPicker/ListItemPicker.tsx index 62fa5be66..d54ea0ceb 100644 --- a/src/controls/fieldPickerListData/FieldPickerListData.tsx +++ b/src/controls/listItemPicker/ListItemPicker.tsx @@ -4,26 +4,26 @@ 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 { IFieldPickerListDataProps, IFieldPickerListDataState } from "."; +import { IListItemPickerProps, IListItemPickerState } from "."; import * as telemetry from '../../common/telemetry'; -export class FieldPickerListData extends React.Component { +export class ListItemPicker extends React.Component { private _value: any[]; private _spservice: SPservice; private selectedItems: any[]; - constructor(props: IFieldPickerListDataProps) { + constructor(props: IListItemPickerProps) { super(props); - telemetry.track('FieldPickerListData', {}); + telemetry.track('ListItemPicker', {}); // States this.state = { noresultsFoundText: typeof this.props.noresultsFoundText === undefined ? strings.genericNoResultsFoundText : this.props.noresultsFoundText, showError: false, errorMessage: "", - suggestionsHeaderText: typeof this.props.sugestedHeaderText === undefined ? strings.FieldPickerListDataSelectValue : this.props.sugestedHeaderText + suggestionsHeaderText: typeof this.props.sugestedHeaderText === undefined ? strings.ListItemPickerSelectValue : this.props.sugestedHeaderText }; // Get SPService Factory @@ -34,7 +34,7 @@ export class FieldPickerListData extends React.Component { + public render(): React.ReactElement { const { className, disabled, itemLimit } = this.props; return ( diff --git a/src/controls/listItemPicker/index.ts b/src/controls/listItemPicker/index.ts new file mode 100644 index 000000000..1f118bfde --- /dev/null +++ b/src/controls/listItemPicker/index.ts @@ -0,0 +1,4 @@ +// A file is required to be in the root of the /src directory by the TypeScript compiler +export * from './IListItemPickerProps'; +export * from './IListItemPickerState'; +export * from './ListItemPicker'; diff --git a/src/index.ts b/src/index.ts index 1acd4866c..f1fe003fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ export * from './SiteBreadcrumb'; export * from './TaxonomyPicker'; export * from './WebPartTitle'; export * from './ListPicker'; +export * from './ListItemPicker'; export * from './IFrameDialog'; export * from './Common'; @@ -22,4 +23,3 @@ export * from './FieldTextRenderer'; export * from './FieldTitleRenderer'; export * from './FieldUrlRenderer'; export * from './FieldUserRenderer'; -export * from './FieldPickerListData'; diff --git a/src/loc/de-de.ts b/src/loc/de-de.ts index d8fa6742e..350f17dbd 100644 --- a/src/loc/de-de.ts +++ b/src/loc/de-de.ts @@ -52,7 +52,7 @@ define([], () => { peoplePickerSuggestionsHeaderText: 'Vorgeschlagene Benutzer', peoplePickerLoadingText: 'Laden', - FieldPickerListDataSelectValue: 'Wähle Wert', + ListItemPickerSelectValue: 'Wähle Wert', genericNoResultsFoundText: 'Kein Ergebnis gefunden' }; diff --git a/src/loc/en-us.ts b/src/loc/en-us.ts index 18013e808..4948bbc2a 100644 --- a/src/loc/en-us.ts +++ b/src/loc/en-us.ts @@ -52,7 +52,7 @@ define([], () => { peoplePickerSuggestionsHeaderText: 'Suggested People', peoplePickerLoadingText: 'Loading', - FieldPickerListDataSelectValue: 'Select value', + ListItemPickerSelectValue: 'Select value', genericNoResultsFoundText: 'No results found' }; diff --git a/src/loc/fr-fr.ts b/src/loc/fr-fr.ts index 98a99b929..75359af7a 100644 --- a/src/loc/fr-fr.ts +++ b/src/loc/fr-fr.ts @@ -52,7 +52,7 @@ define([], () => { peoplePickerSuggestionsHeaderText: 'Personnes suggérées', peoplePickerLoadingText: 'Chargement', - FieldPickerListDataSelectValue: 'Sélectionnez une valeur', + ListItemPickerSelectValue: 'Sélectionnez une valeur', genericNoResultsFoundText: 'Aucun résultat trouvé' }; diff --git a/src/loc/mystrings.d.ts b/src/loc/mystrings.d.ts index 9e322b750..2b58ffa1b 100644 --- a/src/loc/mystrings.d.ts +++ b/src/loc/mystrings.d.ts @@ -24,7 +24,7 @@ declare interface IControlStrings { TaxonomyPickerInLabel: string; TaxonomyPickerTermSetLabel: string; - FieldPickerListDataSelectValue: string; + ListItemPickerSelectValue: string; } declare module 'ControlStrings' { diff --git a/src/loc/nl-nl.ts b/src/loc/nl-nl.ts index db3e70684..541730aab 100644 --- a/src/loc/nl-nl.ts +++ b/src/loc/nl-nl.ts @@ -52,7 +52,7 @@ define([], () => { peoplePickerSuggestionsHeaderText: 'Voorgestelde personen', peoplePickerLoadingText: 'Laden', - FieldPickerListDataSelectValue: 'Selecteer veld', + ListItemPickerSelectValue: 'Selecteer veld', genericNoResultsFoundText: 'Geen resultaten gevonden' }; diff --git a/src/webparts/controlsTest/components/ControlsTest.tsx b/src/webparts/controlsTest/components/ControlsTest.tsx index a37ed0eb4..18ff386f0 100644 --- a/src/webparts/controlsTest/components/ControlsTest.tsx +++ b/src/webparts/controlsTest/components/ControlsTest.tsx @@ -19,7 +19,7 @@ import { SecurityTrimmedControl, PermissionLevel } from '../../../SecurityTrimme import { SPPermission } from '@microsoft/sp-page-context'; import { PeoplePicker, PrincipalType } from '../../../PeoplePicker'; import { getItemClassNames } from 'office-ui-fabric-react/lib/components/ContextualMenu/ContextualMenu.classNames'; -import { FieldPickerListData } from "../../../../lib/FieldPickerListData"; +import { ListItemPicker } from "../../../ListItemPicker"; /** * Component that can be used to test out the React controls from this project @@ -152,7 +152,7 @@ private onServicePickerChange(terms: IPickerTerms): void { /** * Selected item from the list data picker */ - private fieldPickerListDataSelected(item: any) { + private listItemPickerDataSelected(item: any) { console.log(item); } @@ -277,11 +277,11 @@ private onServicePickerChange(terms: IPickerTerms): void {
Field picker list data tester: - + onSelectedItem={this.listItemPickerDataSelected} />
Services tester: