Skip to content

Commit 591deea

Browse files
committed
#488 - new parameter storeLastActiveTab has been added
1 parent 7033ee8 commit 591deea

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

CHANGELOG.JSON

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"`FilePicker` - French translation [#449](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/449)",
1313
"Slovak localization [#457](https://github.com/SharePoint/sp-dev-fx-controls-react/pull/457)",
1414
"`TaxonomyPicker`: Placeholder for Taxonomy Picker [#464](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/464)",
15-
"`ListItemPicker`, `PeoplePicker`: Placeholder for `ListItemPicker` and `PeoplePicker` [#486](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/486)"
15+
"`ListItemPicker`, `PeoplePicker`: Placeholder for `ListItemPicker` and `PeoplePicker` [#486](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/486)",
16+
"`FilePicker`: Do not store active tab in url's hash [#488](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/488)"
1617
],
1718
"fixes": [
1819
"`RichText`: problem with edit mode [#445](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/445)",

docs/documentation/docs/controls/FilePicker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The FilePicker component can be configured with the following properties:
7474
| hideSiteFilesTab | boolean | no | Specifies if SiteFilesTab should be hidden. |
7575
| hideLocalUploadTab | boolean | no | Specifies if LocalUploadTab should be hidden. |
7676
| hideLinkUploadTab | boolean | no | Specifies if LinkUploadTab should be hidden. |
77+
| 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` |
7778

7879
interface `IFilePickerResult`
7980

src/controls/filePicker/FilePicker.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,60 +221,61 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
221221
* Prepares navigation panel options
222222
*/
223223
private _getNavPanelOptions = () => {
224+
const addUrl = this.props.storeLastActiveTab !== false;
224225
let links = [];
225226

226227
if (!this.props.hideRecentTab) {
227228
links.push({
228229
name: strings.RecentLinkLabel,
229-
url: '#recent',
230+
url: addUrl ? '#recent' : undefined,
230231
icon: 'Recent',
231232
key: 'keyRecent',
232233
});
233234
}
234235
if (this.props.bingAPIKey && !this.props.hideWebSearchTab) {
235236
links.push({
236237
name: strings.WebSearchLinkLabel,
237-
url: '#search',
238+
url: addUrl ? '#search' : undefined,
238239
key: 'keyWeb',
239240
icon: 'Search',
240241
});
241242
}
242243
if (!this.props.hideOrganisationalAssetTab && this.state.organisationAssetsEnabled) {
243244
links.push({
244245
name: 'Your organisation',
245-
url: '#orgAssets',
246+
url: addUrl ? '#orgAssets' : undefined,
246247
icon: 'FabricFolderConfirm',
247248
key: 'keyOrgAssets',
248249
});
249250
}
250251
if (!this.props.hideOneDriveTab) {
251252
links.push({
252253
name: "OneDrive",
253-
url: '#onedrive',
254+
url: addUrl ? '#onedrive' : undefined,
254255
key: 'keyOneDrive',
255256
icon: 'OneDrive',
256257
});
257258
}
258259
if (!this.props.hideSiteFilesTab) {
259260
links.push({
260261
name: strings.SiteLinkLabel,
261-
url: '#globe',
262+
url: addUrl ? '#globe' : undefined,
262263
key: 'keySite',
263264
icon: 'Globe',
264265
});
265266
}
266267
if (!this.props.hideLocalUploadTab) {
267268
links.push({
268269
name: strings.UploadLinkLabel,
269-
url: '#upload',
270+
url: addUrl ? '#upload' : undefined,
270271
key: 'keyUpload',
271272
icon: 'System'
272273
});
273274
}
274275
if (!this.props.hideLinkUploadTab) {
275276
links.push({
276277
name: strings.FromLinkLinkLabel,
277-
url: '#link',
278+
url: addUrl ? '#link' : undefined,
278279
key: 'keyLink',
279280
icon: 'Link'
280281
});

src/controls/filePicker/IFilePickerProps.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,11 @@ export interface IFilePickerProps {
101101
* Specifies if LinkUploadTab should be hidden.
102102
*/
103103
hideLinkUploadTab?: boolean;
104+
105+
/**
106+
* Specifies if last active tab will be stored after the Upload panel has been closed.
107+
* Note: the value of selected tab is stored in the queryString hash.
108+
* @default true
109+
*/
110+
storeLastActiveTab?: boolean;
104111
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
537537
<PeoplePicker context={this.props.context}
538538
titleText="People Picker (disabled)"
539539
disabled={true}
540-
showtooltip={true} />
540+
showtooltip={true}
541+
defaultSelectedUsers={['[email protected]']} />
541542

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

0 commit comments

Comments
 (0)