Skip to content

Commit 126d185

Browse files
elisenyangElise Yangshweaver-MSFT
authored
update file picker spec (#892)
* update file picker spec * edits * address review comments Co-authored-by: Elise Yang <[email protected]> Co-authored-by: Shane Weaver <[email protected]>
1 parent 4271b19 commit 126d185

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

specs/mgt-file-picker.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,74 @@
11
# mgt-file-picker
22

3-
The file picker component provides a button, a drop down list of files, and as well as button to launch a full file browsing experience to enable a user to select a file from OneDrive or SharePoint for further action. This component uses the [mgt-file-list](./mgt-file-list.md) component to display files in the dropdown. The selected file object(s) is returned to the developer.
3+
The file picker component provides a button, a drop down list of files, and as well as button to launch a full file browsing experience to enable a user to select a file from OneDrive or SharePoint for further action. This component uses the [mgt-file](./mgt-file.md) components to display files in the dropdown. The selected file object(s) is returned to the developer.
44

55
<img src="./images/mgt-file-picker.png"/>
66

77
## Supported functionality
88

99
| Feature | Priority | Notes |
1010
| ------- | -------- | ----- |
11+
| **v1** | | |
1112
| Provide a button that renders a drop down when clicked | P0 | |
12-
| Retrieve a list of files based on information provided | P0 | |
13-
| Use the `mgt-file-list` component to render the list inside of the drop down | P0 | |
14-
| On selection or deselection of a file, an event is fired | P0 | |
13+
| Retrieve files based on specified insight type | P0 | |
14+
| Use `mgt-file` components to render each file inside of the drop down | P0 | |
15+
| On selection of a file, a `selectionChanged` event is fired | P0 | |
1516
| The selected file object(s) is accessible by the developer for further action |P0 | |
16-
| Ability for developer to toggle between single-select and multiselect | P1 | |
17-
| Visual indication of selected files | P2 | Will not be included in v1. |
18-
| Render the selected files | P2 | Will not be included in v1. We will provide a sample for developers to render selected files using `mgt-file` components themselves. |
19-
| Extended file picker is launched when “See all” is clicked | P2 | Not included in v1. |
17+
| Extended file picker is launched when “See all” is clicked | P0 | |
18+
| **v2** | | |
19+
| Retrieve files from a specified insight type or from a specific drive location based on identifiers provided by developer | P1 | |
20+
| Ability for developer to toggle between single-select and multiselect | P1 | |
21+
| Visual indication of selected files | P2 | |
22+
| Render the selected files | P2 | |
2023

2124
## Proposed Solution
2225

23-
### Example 1: Show the user's top 10 most recently used files to select from
26+
### Example 1 (v1): Show the user's top 10 most recently used files to select from
2427
```<mgt-file-picker insight-type=“used” show-max=“10”></mgt-file-picker>```
2528

26-
### Example 2: Show a specific folder in OneDrive to select files from
29+
### Example 2 (v2): Show a specific folder in OneDrive to select files from
2730
```<mgt-file-picker drive-id=“123” item-id=“456”></mgt-file-picker>```
2831

2932
## Attributes and Properties
3033

3134
| Attribute | Property | Description |
3235
| --------- | -------- | ----------- |
33-
| `file-list-query` | `fileListQuery` | The full query or path to the folder in a drive or site to retrieve the list of files from |
34-
| `file-queries` | `fileQueries` | An array of file queries to be rendered by the component |
36+
| **v1** | | |
3537
| `files` | `files` | An array of files to get or set the list of files rendered by the component. Use this to access the files loaded by the component. Set this value to load your own files. |
3638
| `insight-type` | `insightType` | Set to show the user’s trending, used, or shared files. |
39+
| `show-max` | `showMax` | A number value to indicate the maximum number of files to show. |
40+
| **v2** | | |
41+
| `file-list-query` | `fileListQuery` | The full query or path to the folder in a drive or site to retrieve the list of files from |
42+
| `file-queries` | `fileQueries` | An array of file queries to be rendered by the component |
3743
| `drive-id` | `driveId` | Id of the drive the folder belongs to. Must also provide either `item-id` or `item-path`. |
3844
| `group-id ` | `groupId` | Id of the group the folder belongs to. Must also provide either `item-id` or `item-path`. |
3945
| `site-id` | `siteId` | Id of the site the folder belongs to. Must also provide either `{item-id}` or `{item-path}`. Provide `{list-id}` if you’re referencing a file from a list. |
4046
| `item-id` | `itemId` | Id of the folder. Default query is `/me/drive/items`. Provide `{drive-id}`, `{group-id}`, `{site-id}`, or `{user-id}` to query a specific location. |
4147
| `item-path` | `itemPath` | Item path of the folder. Default query is `/me/drive/root`. Provide `{drive-id}`, `{group-id}`, `{site-id}`, or `{user-id}` to query a specific location. |
42-
| `show-max` | `showMax` | A number value to indicate the maximum number of files to show. |
43-
| `selected-files` | `selectedFiles`| An array of selected file objects. |
4448
| `multiselect` | `multiselect` | Enable/Disable selection of more than 1 file. Default is `false`.|
4549

4650
## Events
4751

4852
| Event | Description |
4953
| ----- | ----------- |
50-
|selectionChanged | Fired when the user selects or deselects a file |
54+
| filesSelected | Fired when the user selects a file |
5155

5256
## APIs and Permission
5357

54-
Same as [mgt-file-list](./mgt-file-list.md).
58+
| Query | Use if | Permission Scopes |
59+
| ----- | ------ | ----------------- |
60+
| **v1** | | |
61+
| `GET /me/insights/trending` | `insight-type` is trending | Sites.Read.All |
62+
| `GET /me/insights/used` | `insight-type` is `used` | " |
63+
| `GET /me/insights/shared` | `insight-type` is shared | " |
64+
| **v2** | | |
65+
| `GET /me/drive/root/children` | Default (no identifiers or query provided) | Files.Read, Files.Read.All, Sites.Read.All |
66+
| `GET /drives/{drive-id}/items/{item-id}/children` | `{drive-id}` AND `{item-id}` | " |
67+
| `GET /groups/{group-id}/drive/items/{item-id}/children` | `{group-id}` AND `{item-id}` | " |
68+
| `GET /me/drive/items/{item-id}/children` | ONLY `{item-id}` | " |
69+
| `GET /sites/{site-id}/drive/items/{item-id}/children` | `{site-id}` AND `{item-id}` | " |
70+
| `GET /users/{user-id}/drive/items/{item-id}/children` | `{user-id}` AND `{item-id}` | " |
71+
| `GET /drives/{drive-id}/root:/{path-relative-to-root}:/children` | `{drive-id}` AND `{path-relative-to-root}` | " |
5572

5673
## Templates
5774

@@ -60,5 +77,6 @@ Same as [mgt-file-list](./mgt-file-list.md).
6077
| default | null: no data | The template used to override the rendering of the entire component |
6178
| loading | null: no data | The template used to render the state of the picker while the request to Graph is being made. |
6279
| error | null: no data | The template used if no files are returned |
63-
| selected-file | file: the file details object | The template to render selected files |
64-
| file | file: the file details object | The template to render files in the dropdown |
80+
| file | file: the file details object | The template to render files in the dropdown |
81+
| button | null: no data | The template used to override the default button that opens the picker |
82+
| header | null: no data | The template used to override the header (text and "See All" button) displayed in the picker |

0 commit comments

Comments
 (0)