Skip to content

Commit cf4e341

Browse files
elisenyangElise Yangnmetulev
authored
Add specs for file, file list, and file picker components (#688)
* add mgt-file spec * add images * add file list * add file picker * edits * update specs Co-authored-by: Elise Yang <[email protected]> Co-authored-by: Nikola Metulev <[email protected]>
1 parent e61861c commit cf4e341

File tree

6 files changed

+238
-0
lines changed

6 files changed

+238
-0
lines changed

specs/images/mgt-file-list.png

50.3 KB
Loading

specs/images/mgt-file-picker.png

42.1 KB
Loading

specs/images/mgt-file.png

11.9 KB
Loading

specs/mgt-file-list.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# mgt-file-list
2+
3+
The File List component displays a list of multiple folders and files by using the file/folder name, an icon, and other properties specicified by the developer. This component uses the [mgt-file](./mgt-file.md) component. The developer is able to specify a specific drive or or site, display a list of files based on insight type (trending, used, or shared), or provide queries render to a custom list of files.
4+
5+
<img src="./images/mgt-file-list.png" width=600>
6+
7+
## Supported functionality
8+
9+
| Feature | Priority | Notes |
10+
| ------- | -------- | ----- |
11+
| Retrieve a list of files based on information provided | P0 | Can be from a specific drive or site or from an insight type |
12+
| Use the `mgt-file` component to render each item | P0 | |
13+
| Render the children of folders hierarchically using a tree view | P1 | Potentially use the FAST tree view web component |
14+
| Allow sorting of the files by the user | P2 | |
15+
16+
## Proposed Solution
17+
18+
### Example 1: No folder query, ids or insight type is provided
19+
20+
```<mgt-file-list><mgt-file-list>```
21+
22+
The request made: `GET /me/drive/root/children`
23+
24+
### Example 2: Developer provides a full query path for the folder to render the children of
25+
26+
```<mgt-file-list folder-query="/drives/123/items/456/children"></mgt-file-list>```
27+
28+
The request made: `GET /drives/123/items/456/children`
29+
30+
### Example 3: Developer specifies a type of insight
31+
32+
```<mgt-file-list insight-type=“trending”></mgt-file-list>```
33+
34+
The request made: `GET /me/insights/trending`
35+
36+
### Example 4: Developer provides drive id and item id
37+
38+
```<mgt-file-list drive-id=""123" item-id="456></mgt-file-list>```
39+
40+
The request made : `GET /drives/123/items/456/children`
41+
42+
### Example 5: Developer provides a search query
43+
```<mgt-file-list search-query="foo"></mgt-file-list>```
44+
45+
## Attributes and Properties
46+
47+
| Attribute | Property | Description |
48+
| --------- | -------- | ----------- |
49+
| `file-list-query` | `fileListQuery` | The full query or path to the drive or site that contains the list of files to render. |
50+
| `file-queries` | `fileQueries` | An array of file queries to be rendered by the component.
51+
`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. |
52+
| `insight-type` | `insightType` | Set to show the user’s trending, used, or shared files.
53+
| `drive-id` | `driveId` | Id of the drive the folder belongs to. Must also provide either `item-id` or `item-path`. |
54+
| `group-id` | `groupId` | Id of the group the folder belongs to. Must also provide either `item-id` or `item-path`. |
55+
| `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 specific list. |
56+
| `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. |
57+
| `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. |
58+
| `show-max` | `showMax` | A number value to indicate the maximum number of files to show. |
59+
60+
## APIs and Permissions
61+
62+
| Query | Use if | Permission Scopes |
63+
| ----- | ------ | ----------------- |
64+
| `GET /me/drive/root/children` | Default (no identifiers or query provided) | Files.Read, Files.Read.All, Sites.Read.All |
65+
| `GET /drives/{drive-id}/items/{item-id}/children` | `{drive-id}` AND `{item-id}` | " |
66+
| `GET /groups/{group-id}/drive/items/{item-id}/children` | `{group-id}` AND `{item-id}` | " |
67+
| `GET /me/drive/items/{item-id}/children` | ONLY `{item-id}` | " |
68+
| `GET /sites/{site-id}/drive/items/{item-id}/children` | `{site-id}` AND `{item-id}` | " |
69+
| `GET /users/{user-id}/drive/items/{item-id}/children` | `{user-id}` AND `{item-id}` | " |
70+
| `GET /drives/{drive-id}/root:/{path-relative-to-root}:/children` | `{drive-id}` AND `{path-relative-to-root}` | " |
71+
| `GET /me/insights/trending` | `insight-type` is trending | Sites.Read.All |
72+
| `GET /users/{id or userPrincipalName}/insights/trending` | {user-id or upn} AND `insight-type` is `trending` | " |
73+
| `GET /me/insights/used` | `insight-type` is `used` | " |
74+
| `GET /users/{id or userPrincipalName}/insights/used` | {user-id or upn} AND `insight-type` is `used` | " |
75+
| `GET /me/insights/shared` | `insight-type` is shared | " |
76+
| `GET /users/{id or userPrincipalName}/insights/shared` | `{user-id or upn}` AND `insight-type` is `shared` | " |
77+
|`POST /beta/search/query` Request body: `{"requests": [{"entityTypes": ["driveItem", "listItem"], "query":{"queryString":"foo"}}]}` | `search-query` | Files.Read, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
78+
79+
## Templates
80+
81+
| Data type | Data context | Description |
82+
| ----------- | -------------- | ------------ |
83+
| default | `files`: list of file objects | The default template replaces the entire component with your own. |
84+
| file | `file`: file object | The template used to render each file. |
85+
| no-data | No data context is passed | The template used when no data is available. |
86+
| loading | No data context is passed | The template used while the component loads state.

specs/mgt-file-picker.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# mgt-file-picker
2+
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.
4+
5+
<img src="./images/mgt-file-picker.png"/>
6+
7+
## Supported functionality
8+
9+
| Feature | Priority | Notes |
10+
| ------- | -------- | ----- |
11+
| 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 | |
15+
| 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. |
20+
21+
## Proposed Solution
22+
23+
### Example 1: Show the user's top 10 most recently used files to select from
24+
```<mgt-file-picker insight-type=“used” show-max=“10”></mgt-file-picker>```
25+
26+
### Example 2: Show a specific folder in OneDrive to select files from
27+
```<mgt-file-picker drive-id=“123” item-id=“456”></mgt-file-picker>```
28+
29+
## Attributes and Properties
30+
31+
| Attribute | Property | Description |
32+
| --------- | -------- | ----------- |
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 |
35+
| `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. |
36+
| `insight-type` | `insightType` | Set to show the user’s trending, used, or shared files. |
37+
| `drive-id` | `driveId` | Id of the drive the folder belongs to. Must also provide either `item-id` or `item-path`. |
38+
| `group-id ` | `groupId` | Id of the group the folder belongs to. Must also provide either `item-id` or `item-path`. |
39+
| `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. |
40+
| `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. |
41+
| `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. |
44+
| `multiselect` | `multiselect` | Enable/Disable selection of more than 1 file. Default is `false`.|
45+
46+
## Events
47+
48+
| Event | Description |
49+
| ----- | ----------- |
50+
|selectionChanged | Fired when the user selects or deselects a file |
51+
52+
## APIs and Permission
53+
54+
Same as [mgt-file-list](./mgt-file-list.md).
55+
56+
## Templates
57+
58+
| Data type | Data Context | Description |
59+
| --------- | ------------ | ----------- |
60+
| default | null: no data | The template used to override the rendering of the entire component |
61+
| loading | null: no data | The template used to render the state of the picker while the request to Graph is being made. |
62+
| 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 |

specs/mgt-file.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# mgt-file
2+
3+
The File component is used to represent an individual file/folder from OneDrive or SharePoint by displaying information such as the file/folder name, an icon indicating the file type, and other properties such as the author, last modified date, or other details selected by the developer. The developer or application provides the identifiers for a file and the component will generate the query to retreive the file based on the identifiers provided. This component can be used on it's own or as part of the [mgt-file-list](./mgt-file-list.md) and [mgt-file-picker](./mgt-file-picker.md) components.
4+
5+
<img src="./images/mgt-file.png" width=400/>
6+
7+
## Supported functionality
8+
9+
| Feature | Priority | Notes |
10+
| ------- | -------- | ----- |
11+
| Retreieve a file from Microsoft Graph using the query or identifiers provided | P0 | |
12+
| Display the name of the file/folder| P0| |
13+
| Display an icon indicating if it's a folder or file and the file type| P0 | Icons needed include generic folder icon, .docx, .pptx, .xlsx, and generic file icon for other file types |
14+
| Display relevant details of the file | P0 | Developer should be able to configure what details are being rendered |
15+
16+
## Proposed Solution
17+
18+
### Example 1: Developer provides the full query path for the file
19+
```<mgt-file file-query="/me/drives/items/123" view="twolines"></mgt-file>```
20+
21+
The request made: `GET /me/drives/items/123`
22+
23+
### Example 2: Developer provides a site-id and item-id
24+
```<mgt-file site-id="123" item-id="456"></mgt-file>```
25+
26+
The request made: `GET /sites/123/drive/items/123`
27+
28+
### Example 3: Developer provides only an item-id
29+
30+
```<mgt-file item-id="123"></mgt-file>```
31+
32+
The request made: `GET /me/drive/items/123`
33+
34+
## Example 4: The component is used inside of a File List component that uses an insight type.
35+
36+
```<mgt-file insight-type="trending" insight-id="123"></mgt-file>```
37+
38+
The request made: `GET /me/insights/trending/123/resource`
39+
40+
## Attributes and Properties
41+
42+
| Attribute | Property | Description |
43+
| --------- | -------- | ----------- |
44+
| `file-query` | `fileQuery` | The full query or path to the file to be retrieved. |
45+
| `drive-id` | `driveId` | The Id of the drive the file belongs to. Must also provide either `item-id` or `item-path`. |
46+
| `group-id` | `groupId` | Id of the group the file belongs to. Must also provide either `item-id` or `item-path`. |
47+
| `site-id` | `siteId` | Id of the site the file belongs to. Must also provide either `{item-id}` or `{item-path}`. Provide the `{list-id}` too if you’re referencing a file from a specific list. |
48+
| `list-id` | `listId` | Id of the list the file belongs to. Must also provide `{site-id}` and `{item-id}`. |
49+
| `item-id` | `itemId` | Id of the file. Default query is `/me/drive/items`. Provide `{drive-id}`, `{group-id}`, `{site-id}`, or `{user-id}` to query a specific location. |
50+
| `item-path` | `itemPath` | Item path of the file. Default query is `/me/drive/root`. Provide `{drive-id}`, `{group-id}`, `{site-id}`, or `{user-id}` to query a specific location. |
51+
| `insight-type` | `insightType` | Type of insight the file is retrieved from. Can be `trending`, `used`, or `shared`. |
52+
| `insight-id` | `insightId` | Id of the insight resource. |
53+
| `file-details` | `fileDetails` | Set to an object representing a file |
54+
| `file-icon` | `fileIcon` | Set to an icon to show for the file |
55+
| `view` | `view` | Set to control how the file is rendered. The default is `name`. <br>`oneline` - show the icon, name and one line of text (`lastModifiedDateTime` by default)<br> `twolines` - show the icon, name, and two lines of text (`displayName` of the author by default) |
56+
| `line1-property` | `line1Property` | Sets the property of `fileDetails` to use for the first line of text. Default is `lastModifiedDateTime`. |
57+
| `line2-property` | `line2Property` | Sets the property of `fileDetails` to use for the second line of text. Default is `displayName` of author. |
58+
59+
60+
## APIs and Permissions
61+
62+
| Query | Use if | Permission Scopes |
63+
| ----- | ------ | ----------------- |
64+
| `GET /drives/{drive-id}/items/{item-id}` | `{drive-id}` AND `{item-id}` | Files.Read, Files.Read.All, Sites.Read.All |
65+
| `GET /drives/{drive-id}/root:/{item-path}` | `{drive-id}` AND `{item-path}` | " |
66+
| `GET /groups/{group-id}/drive/items/{item-id}` | `{group-id}` AND `{item-id}` | " |
67+
| `GET /groups/{group-id}/drive/root:/{item-path}` | `{group-id}` AND `{item-path}` | " |
68+
| `GET /me/drive/items/{item-id}` | ONLY `{item-id}` | " |
69+
| `GET /me/drive/root:/{item-path}` | ONLY `{item-path}` | " |
70+
| `GET /sites/{site-id}/drive/items/{item-id}` | `{site-id}` AND `{item-id}` | " |
71+
| `GET /sites/{site-id}/drive/root:/{item-path}` | `{site-id}` AND `{item-path}` | " |
72+
| `GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem` | `{site-id}` AND `{list-id}` AND `{item-id}` | " |
73+
| `GET /users/{user-id}/drive/items/{item-id}` | `{user-id}` AND `{item-id}` | " |
74+
| `GET /users/{user-id}/drive/root:/{item-path}` | `{user-id}` AND `{item-path}` | " |
75+
| `GET /me/insights/trending/{id}/resource` | `insight-type` is `trending` AND `{id}` | Sites.Read.All |
76+
| `GET /users/{id or userPrincipalName}/insights/trending/{id}/resource` | `{user-id or upn}` AND `insight-type` is `trending` AND `{id}` | " |
77+
| `GET /me/insights/used/{id}/resource` | `insight-type` is `used` AND `{id}` | " |
78+
| `GET /users/{id or userPrincipalName}/insights/used/{id}/resource` | `{user-id or upn}` AND `insight-type` is `used` AND `{id}` | " |
79+
| `GET /me/insights/shared/{id}/resource` | `insight-type` is `shared` AND `{id}` | " |
80+
| `GET /users/{id or userPrincipalName}/insights/shared/{id}/resource` | `{user-id or upn}` AND `insight-type` is `shared` AND `{id}` | " |
81+
82+
## Templates
83+
84+
| Data Type | Data Context | Description |
85+
| ----------- | -------------- | ------------- |
86+
| loading | none | The template to render while the component is in a loading state. |
87+
| no-data | none | The template to render when no file data is available. |
88+
| default | file: the file details object | The default template replaces the entire component with your own. |

0 commit comments

Comments
 (0)