Skip to content

Commit be69314

Browse files
authored
Merge pull request #668 from gautamdsheth/feature/additionalFilePickerProps
Feature: added additional props for File Picker
2 parents 5faa158 + 8f649f6 commit be69314

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/controls/filePicker/FilePicker.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
4646
this.fileSearchService = new FilesSearchService(props.context, this.props.bingAPIKey);
4747

4848
this.state = {
49-
panelOpen: false,
49+
panelOpen: this.props.isPanelOpen || false,
5050
organisationAssetsEnabled: false,
5151
showFullNav: true
5252
};
@@ -206,6 +206,9 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
206206
* Closes the panel
207207
*/
208208
private _handleClosePanel = () => {
209+
if (this.props.onCancel) {
210+
this.props.onCancel();
211+
}
209212
this.setState({
210213
panelOpen: false
211214
});

src/controls/filePicker/IFilePickerProps.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,12 @@ export interface IFilePickerProps {
113113
* @default true
114114
*/
115115
storeLastActiveTab?: boolean;
116+
/**
117+
* Specifies if the file picker panel is open by default or not
118+
*/
119+
isPanelOpen?: boolean;
120+
/**
121+
* Handler when file picker has been cancelled.
122+
*/
123+
onCancel?: () => void;
116124
}

0 commit comments

Comments
 (0)