Skip to content

Commit

Permalink
#488 - new parameter storeLastActiveTab has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
AJIXuMuK committed Mar 1, 2020
1 parent 7033ee8 commit 591deea
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.JSON
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"`FilePicker` - French translation [#449](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/449)",
"Slovak localization [#457](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/457)",
"`TaxonomyPicker`: Placeholder for Taxonomy Picker [#464](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/464)",
"`ListItemPicker`, `PeoplePicker`: Placeholder for `ListItemPicker` and `PeoplePicker` [#486](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/486)"
"`ListItemPicker`, `PeoplePicker`: Placeholder for `ListItemPicker` and `PeoplePicker` [#486](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/486)",
"`FilePicker`: Do not store active tab in url's hash [#488](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/488)"
],
"fixes": [
"`RichText`: problem with edit mode [#445](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/445)",
Expand Down
1 change: 1 addition & 0 deletions docs/documentation/docs/controls/FilePicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The FilePicker component can be configured with the following properties:
| hideSiteFilesTab | boolean | no | Specifies if SiteFilesTab should be hidden. |
| hideLocalUploadTab | boolean | no | Specifies if LocalUploadTab should be hidden. |
| hideLinkUploadTab | boolean | no | Specifies if LinkUploadTab should be hidden. |
| storeLastActiveTab | boolean | no | Specifies if last active tab will be stored after the Upload panel has been closed. Note: the value of selected tab is stored in the queryString hash. Default `true` |

interface `IFilePickerResult`

Expand Down
15 changes: 8 additions & 7 deletions src/controls/filePicker/FilePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,60 +221,61 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
* Prepares navigation panel options
*/
private _getNavPanelOptions = () => {
const addUrl = this.props.storeLastActiveTab !== false;
let links = [];

if (!this.props.hideRecentTab) {
links.push({
name: strings.RecentLinkLabel,
url: '#recent',
url: addUrl ? '#recent' : undefined,
icon: 'Recent',
key: 'keyRecent',
});
}
if (this.props.bingAPIKey && !this.props.hideWebSearchTab) {
links.push({
name: strings.WebSearchLinkLabel,
url: '#search',
url: addUrl ? '#search' : undefined,
key: 'keyWeb',
icon: 'Search',
});
}
if (!this.props.hideOrganisationalAssetTab && this.state.organisationAssetsEnabled) {
links.push({
name: 'Your organisation',
url: '#orgAssets',
url: addUrl ? '#orgAssets' : undefined,
icon: 'FabricFolderConfirm',
key: 'keyOrgAssets',
});
}
if (!this.props.hideOneDriveTab) {
links.push({
name: "OneDrive",
url: '#onedrive',
url: addUrl ? '#onedrive' : undefined,
key: 'keyOneDrive',
icon: 'OneDrive',
});
}
if (!this.props.hideSiteFilesTab) {
links.push({
name: strings.SiteLinkLabel,
url: '#globe',
url: addUrl ? '#globe' : undefined,
key: 'keySite',
icon: 'Globe',
});
}
if (!this.props.hideLocalUploadTab) {
links.push({
name: strings.UploadLinkLabel,
url: '#upload',
url: addUrl ? '#upload' : undefined,
key: 'keyUpload',
icon: 'System'
});
}
if (!this.props.hideLinkUploadTab) {
links.push({
name: strings.FromLinkLinkLabel,
url: '#link',
url: addUrl ? '#link' : undefined,
key: 'keyLink',
icon: 'Link'
});
Expand Down
7 changes: 7 additions & 0 deletions src/controls/filePicker/IFilePickerProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,11 @@ export interface IFilePickerProps {
* Specifies if LinkUploadTab should be hidden.
*/
hideLinkUploadTab?: boolean;

/**
* Specifies if last active tab will be stored after the Upload panel has been closed.
* Note: the value of selected tab is stored in the queryString hash.
* @default true
*/
storeLastActiveTab?: boolean;
}
3 changes: 2 additions & 1 deletion src/webparts/controlsTest/components/ControlsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
<PeoplePicker context={this.props.context}
titleText="People Picker (disabled)"
disabled={true}
showtooltip={true} />
showtooltip={true}
defaultSelectedUsers={['aleksei.dovzhyk@sharepointalist.com']} />

<DateTimePicker label="DateTime Picker (unspecified = date and time)" />

Expand Down

0 comments on commit 591deea

Please sign in to comment.