Skip to content

Commit

Permalink
#165 - Control name change to ListItemPicker
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Oct 28, 2018
1 parent f69b539 commit 8f494f4
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.JSON
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/docs/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
1 change: 0 additions & 1 deletion src/FieldPickerListData.ts

This file was deleted.

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';
4 changes: 0 additions & 4 deletions src/controls/fieldPickerListData/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface IFieldPickerListDataState {
export interface IListItemPickerState {
noresultsFoundText: string;
showError: boolean;
errorMessage: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IFieldPickerListDataProps, IFieldPickerListDataState> {
export class ListItemPicker extends React.Component<IListItemPickerProps, IListItemPickerState> {
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
Expand All @@ -34,7 +34,7 @@ export class FieldPickerListData extends React.Component<IFieldPickerListDataPro
this.selectedItems = [];
}

public componentDidUpdate(prevProps: IFieldPickerListDataProps, prevState: IFieldPickerListDataState): void {
public componentDidUpdate(prevProps: IListItemPickerProps, prevState: IListItemPickerState): void {
if (this.props.listId !== prevProps.listId) {
this.selectedItems = [];
}
Expand All @@ -43,7 +43,7 @@ export class FieldPickerListData extends React.Component<IFieldPickerListDataPro
/**
* Render the field
*/
public render(): React.ReactElement<IFieldPickerListDataProps> {
public render(): React.ReactElement<IListItemPickerProps> {
const { className, disabled, itemLimit } = this.props;

return (
Expand Down
4 changes: 4 additions & 0 deletions src/controls/listItemPicker/index.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -22,4 +23,3 @@ export * from './FieldTextRenderer';
export * from './FieldTitleRenderer';
export * from './FieldUrlRenderer';
export * from './FieldUserRenderer';
export * from './FieldPickerListData';
2 changes: 1 addition & 1 deletion src/loc/de-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define([], () => {
peoplePickerSuggestionsHeaderText: 'Vorgeschlagene Benutzer',
peoplePickerLoadingText: 'Laden',

FieldPickerListDataSelectValue: 'Wähle Wert',
ListItemPickerSelectValue: 'Wähle Wert',

genericNoResultsFoundText: 'Kein Ergebnis gefunden'
};
Expand Down
2 changes: 1 addition & 1 deletion src/loc/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define([], () => {
peoplePickerSuggestionsHeaderText: 'Suggested People',
peoplePickerLoadingText: 'Loading',

FieldPickerListDataSelectValue: 'Select value',
ListItemPickerSelectValue: 'Select value',

genericNoResultsFoundText: 'No results found'
};
Expand Down
2 changes: 1 addition & 1 deletion src/loc/fr-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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é'
};
Expand Down
2 changes: 1 addition & 1 deletion src/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declare interface IControlStrings {
TaxonomyPickerInLabel: string;
TaxonomyPickerTermSetLabel: string;

FieldPickerListDataSelectValue: string;
ListItemPickerSelectValue: string;
}

declare module 'ControlStrings' {
Expand Down
2 changes: 1 addition & 1 deletion src/loc/nl-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define([], () => {
peoplePickerSuggestionsHeaderText: 'Voorgestelde personen',
peoplePickerLoadingText: 'Laden',

FieldPickerListDataSelectValue: 'Selecteer veld',
ListItemPickerSelectValue: 'Selecteer veld',

genericNoResultsFoundText: 'Geen resultaten gevonden'
};
Expand Down
8 changes: 4 additions & 4 deletions src/webparts/controlsTest/components/ControlsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -277,11 +277,11 @@ private onServicePickerChange(terms: IPickerTerms): void {
</div>

<div className="ms-font-m">Field picker list data tester:
<FieldPickerListData listId={this.state.selectedList}
<ListItemPicker listId={this.state.selectedList}
columnInternalName="Title"
itemLimit={5}
context={this.props.context}
onSelectedItem={this.fieldPickerListDataSelected} />
onSelectedItem={this.listItemPickerDataSelected} />
</div>

<div className="ms-font-m">Services tester:
Expand Down

0 comments on commit 8f494f4

Please sign in to comment.