Skip to content

Commit 0ea9272

Browse files
committed
#578 - Added the enable/disable term actions capability
1 parent 12a48e8 commit 0ea9272

File tree

11 files changed

+335
-82
lines changed

11 files changed

+335
-82
lines changed

CHANGELOG.JSON

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"`TreeView`: there should be possibility to collapse the first level nodes by default [#561](https://github.com/pnp/sp-dev-fx-controls-react/issues/561)",
1212
"`TreeView`: Expand to selected [#559](https://github.com/pnp/sp-dev-fx-controls-react/issues/559)",
1313
"`DateTimePicker`: When using the datetimePicker I would like to have an opportunity to set maximum/minimum date like in Office UI Fabric [#497](https://github.com/pnp/sp-dev-fx-controls-react/issues/497)",
14-
"`TaxonomyPicker`: Added the `selectTerm`, `hideTerm`, and `disableTerm` actions [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)"
14+
"`TaxonomyPicker`: Added the `selectTerm`, `hideTerm`, and `disableTerm` actions [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)",
15+
"`TaxonomyPicker`: Added the functionality to enable/disable term actions on the fly [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)"
1516
],
1617
"fixes": [
1718
"`TaxonomyPicker`: Correct the AnchorID getting all TermSet search options [#150](https://github.com/pnp/sp-dev-fx-controls-react/issues/150)",

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- `TreeView`: Expand to selected [#559](https://github.com/pnp/sp-dev-fx-controls-react/issues/559)
1111
- `DateTimePicker`: When using the datetimePicker I would like to have an opportunity to set maximum/minimum date like in Office UI Fabric [#497](https://github.com/pnp/sp-dev-fx-controls-react/issues/497)
1212
- `TaxonomyPicker`: Added the `selectTerm`, `hideTerm`, and `disableTerm` actions [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)
13+
- `TaxonomyPicker`: Added the functionality to enable/disable term actions on the fly [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)
1314

1415
### Fixes
1516

docs/documentation/docs/about/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- `TreeView`: Expand to selected [#559](https://github.com/pnp/sp-dev-fx-controls-react/issues/559)
1111
- `DateTimePicker`: When using the datetimePicker I would like to have an opportunity to set maximum/minimum date like in Office UI Fabric [#497](https://github.com/pnp/sp-dev-fx-controls-react/issues/497)
1212
- `TaxonomyPicker`: Added the `selectTerm`, `hideTerm`, and `disableTerm` actions [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)
13+
- `TaxonomyPicker`: Added the functionality to enable/disable term actions on the fly [#578](https://github.com/pnp/sp-dev-fx-controls-react/issues/578)
1314

1415
### Fixes
1516

docs/documentation/docs/controls/TaxonomyPicker.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Since version `1.12.0`, you can apply term actions to all terms or specific ones
7777
value: `${term.Name} (updated)`
7878
};
7979
},
80-
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void) => (term && term.Name && term.Name === "internal")
80+
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void, setActionStateForTerm: (actionId: string, termId: string, type: "disabled" | "hidden", value: boolean) => void) => (term && term.Name && term.Name === "internal")
8181
},
8282
{
8383
title: "Hide term",
@@ -90,7 +90,7 @@ Since version `1.12.0`, you can apply term actions to all terms or specific ones
9090
value: true
9191
};
9292
},
93-
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void) => (term && term.Name && (term.Name.toLowerCase() === "help desk" || term.Name.toLowerCase() === "multi-column valo site page"))
93+
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void, setActionStateForTerm: (actionId: string, termId: string, type: "disabled" | "hidden", value: boolean) => void) => (term && term.Name && (term.Name.toLowerCase() === "help desk" || term.Name.toLowerCase() === "multi-column valo site page"))
9494
},
9595
{
9696
title: "Disable term",
@@ -103,7 +103,7 @@ Since version `1.12.0`, you can apply term actions to all terms or specific ones
103103
value: true
104104
};
105105
},
106-
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void) => (term && term.Name && term.Name.toLowerCase() === "secured")
106+
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void, setActionStateForTerm: (actionId: string, termId: string, type: "disabled" | "hidden", value: boolean) => void) => (term && term.Name && term.Name.toLowerCase() === "secured")
107107
},
108108
{
109109
title: "Disable or hide term",
@@ -122,7 +122,7 @@ Since version `1.12.0`, you can apply term actions to all terms or specific ones
122122
value: true
123123
};
124124
},
125-
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void) => true
125+
applyToTerm: (term: ITerm, triggerActionCb: (updateAction: UpdateAction) => void, setActionStateForTerm: (actionId: string, termId: string, type: "disabled" | "hidden", value: boolean) => void) => true
126126
}]
127127
}} />
128128
```
@@ -199,7 +199,7 @@ Interface `ITermAction`
199199
| iconName | string | no | Name of the icon to be used to display action |
200200
| hidden | boolean | no | Specify if the action is hidden. This could be used for instance when you want to invoke the action right after rendering. |
201201
| invokeActionOnRender | boolean | no | Specifies if you want to invoke the action on render |
202-
| applyToTerm | (currentTerm: ITerm) => Promise\<boolean\> \| boolean | yes | Method checks if the current term is supported |
202+
| applyToTerm | (currentTerm: ITerm, triggerActionCallback: (updateAction: UpdateAction) => void, setActionStateForTerm: (actionId: string, termId: string, type: "disabled" | "hidden", value: boolean) => void) => Promise\<boolean> \| boolean | yes | Method checks if the current term is supported for the action. The method provices a couple of additional callback functions to make it possibe to programatically change the terms and its actions. |
203203
| actionCallback | (spTermService: SPTermStorePickerService, currentTerm: ITerm) => Promise\<UpdateAction\> | yes | Method to be executed when action is fired |
204204

205205

0 commit comments

Comments
 (0)