Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set a view search query #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default App;
| disableDefaultView | boolean | false | disables default view |
| viewId | string | DOCS | ViewIdOptions |
| viewMimeTypes | string | optional |Comma separated mimetypes. Use this in place of viewId if you need to filter multiple type of files. list: https://developers.google.com/drive/api/v3/mime-types.|
| viewQuery | string | optional |Used to set a search query i.e. View.searchQuery(viewQuery) |
|setIncludeFolders| boolean | false |Show folders in the view items.|
|setSelectFolderEnabled|boolean| false |Allows the user to select a folder in Google Drive.|
| token | string | optional | access_token to skip auth part|
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default function useDrivePicker(): [
showUploadFolders,
setParentFolder = '',
viewMimeTypes,
viewQuery,
customViews,
locale = 'en',
setIncludeFolders,
Expand All @@ -125,6 +126,7 @@ export default function useDrivePicker(): [
if (viewMimeTypes) view.setMimeTypes(viewMimeTypes)
if (setIncludeFolders) view.setSelectFolderEnabled(true)
if (setSelectFolderEnabled) view.setSelectFolderEnabled(true)
if (viewQuery) view.setQuery(viewQuery)

const uploadView = new google.picker.DocsUploadView()
if (viewMimeTypes) uploadView.setMimeTypes(viewMimeTypes)
Expand Down
1 change: 1 addition & 0 deletions src/typeDefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type PickerConfiguration = {
developerKey: string
viewId?: ViewIdOptions
viewMimeTypes?: string
viewQuery?: string
setIncludeFolders?: boolean
setSelectFolderEnabled?: boolean
disableDefaultView?: boolean
Expand Down