Skip to content

Commit 670a3cb

Browse files
feat: added spec for mgt-taxonomy-picker (#2156)
* feat: added spec for mgt-taxonomy-picker refs: #634 * feat: made changes as per the review comments * feat: made changes as per the comments. --------- Co-authored-by: Sébastien Levert <[email protected]>
1 parent 9af2bf5 commit 670a3cb

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed
4.15 KB
Loading
12.3 KB
Loading
4.07 KB
Loading
4.91 KB
Loading

specs/mgt-taxonomy-picker.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# mgt-taxonomy-picker
2+
3+
## Overview
4+
The taxonomy picker is a component that can query the [Microsoft Graph API for Taxonomy](https://learn.microsoft.com/graph/api/resources/termstore-term?view=graph-rest-1.0) and render a dropdown control with terms, allowing selection of **a single** term based on the specified term set `id` or a combination of the specified term set `id` and the specified term `id`.
5+
6+
The component retrieves the first level terms that are present under a specified termset or term. If only the term set id is provided, it returns the first level terms under that termset. If both the term set id and term id are provided, it returns the first level terms under the specified term.
7+
8+
9+
> **Note**
10+
> This capability currently supports a **single** selection of terms coming from the term store. This will be reviewed in the future.
11+
12+
## User Scenarios
13+
14+
Let's assume a term store with the following structure:
15+
16+
![mgt-taxonomy-pikcer-structure](./images/mgt-taxonomy-pikcer-structure.png)
17+
18+
### Scenario 1 - Select a term from a term set
19+
20+
Shows the terms marked with a red box in the image above.
21+
22+
![mgt-taxonomy-pikcer-termset](./images/mgt-taxonomy-pikcer-termset.png)
23+
24+
### Scenario 2 - Select a term from a term in a term set
25+
26+
Shows the terms marked with a green box in the image above.
27+
28+
![mgt-taxonomy-pikcer-term](./images/mgt-taxonomy-pikcer-term.png)
29+
30+
31+
### Scenario 3 - Select a term from a term in a term set in a different language
32+
33+
Shows French labels of the terms marked with a green box in the image above.
34+
35+
![mgt-taxonomy-pikcer-locale-term](./images/mgt-taxonomy-pikcer-locale-term.png)
36+
37+
38+
## Proposed Solution
39+
40+
### Examples
41+
42+
#### Show the first level children of the term set with the specified id.
43+
44+
`<mgt-taxonomy-picker termset-id="138a652e-7f23-46f6-b480-13da2308c235"></mgt-taxonomy-picker>`
45+
46+
#### Show the first level children of the term with the specified id under the term set with the specified id.
47+
48+
`<mgt-taxonomy-picker termset-id="138a652e-7f23-46f6-b480-13da2308c235" term-id="a56caeb7-3b7d-4d22-93a9-0232e12905f6"></mgt-taxonomy-picker>`
49+
50+
#### Show the first level children of the term with the specified id under the term set with the specified id in a different language.
51+
52+
`<mgt-taxonomy-picker termset-id="138a652e-7f23-46f6-b480-13da2308c235" term-id="a56caeb7-3b7d-4d22-93a9-0232e12905f6" locale="fr-FR"></mgt-taxonomy-picker>`
53+
54+
#### Cache the response from the API call for 50 seconds.
55+
56+
`<mgt-taxonomy-picker termset-id="138a652e-7f23-46f6-b480-13da2308c235" cache-enabled="true" cache-invalidation-period="50000"></mgt-taxonomy-picker>`
57+
58+
## Properties and Attributes
59+
60+
| Attribute | Property | Description | Type |
61+
| - | - | - | - |
62+
| placeholder | placeholder | Optional. The placeholder to use in the combobox. Default value is `Select a term`. | string |
63+
| termset-id | termsetId | Mandatory. The ID of the termset to retrieve first level terms from. | string |
64+
| term-id | termId | Optional. The ID of the term to retrieve first level terms from. If not provided, the function retrieves the first level terms under the termset specified by `termset-id`. <br> *Note* that this term must be one of the terms under the termset with ID `termset-id`. | Number |
65+
| locale | locale | Optional. The locale of the terms that need to be displayed. This will be useful only when terms have multiple labels in different languages. | String |
66+
| default-selected-term-id | defaultSelectedTermId | Optional. The id of the term that should be selected by default. | String |
67+
| version | version | Optional. API version to use when making the GET request. Default is `beta`. | String |
68+
| cache-enabled | cacheEnabled | Optional. When set, it indicates that the response from the resource will be cached. Default is `false`.| Boolean |
69+
| cache-invalidation-period | cacheInvalidationPeriod | Optional. (Number of milliseconds) When set in combination with `cacheEnabled`, the delay before the cache reaches its invalidation period will be modified by this value. Default is `0` and will use the default invalidation period. | Number |
70+
71+
## Events
72+
73+
| Event | When is it fired | Custom data |
74+
| - | - | - |
75+
| selectionChanged | Fired when the user makes a change in selection | The selected term which will of the type `TermStore.Term` |
76+
77+
## Templates
78+
79+
| Data type | Data Context | Description |
80+
| - | - | - |
81+
| default | null: no data | The template used to override the rendering of the entire component. |
82+
| loading | null: no data | The template used to render the state of the picker while the request to Graph is being made. |
83+
| error | error | The template used there is an error.|
84+
| no-data | no data | The template used if no terms are present. |
85+
86+
## APIs and Permissions
87+
88+
Permissions required by this component are `TermStore.Read.All`.

0 commit comments

Comments
 (0)