Skip to content

Commit a2e5d33

Browse files
committed
Enhancement for #69
1 parent d4fc573 commit a2e5d33

File tree

13 files changed

+93
-33
lines changed

13 files changed

+93
-33
lines changed

CHANGELOG.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"new": [],
77
"enhancements": [
88
"Add `npm postinstall` script to automatically add the localization config [#64](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/64)",
9+
"Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)",
910
"Added a font field type for the `PropertyFieldCollectionData` control [#66](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/66)",
1011
"Added a URL field type for the `PropertyFieldCollectionData` control [#72](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/72)",
11-
"Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)",
12-
"Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control"
12+
"Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control. Related to previous enhancement.",
13+
"Added a properties to the `TaxonomyPicker` to specify which terms are disabled/not-selectable [#69](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/69)"
1314
],
1415
"fixes": [
1516
"`PropertyFieldPeoplePicker` validation error does not clear as expected [#68](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/68)"

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
**Enhancements**
66

77
- Add `npm postinstall` script to automatically add the localization config [#64](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/64)
8+
- Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)
89
- Added a font field type for the `PropertyFieldCollectionData` control [#66](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/66)
910
- Added a URL field type for the `PropertyFieldCollectionData` control [#72](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/72)
10-
- Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)
11-
- Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control
11+
- Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control. Related to previous enhancement.
12+
- Added a properties to the `TaxonomyPicker` to specify which terms are disabled/not-selectable [#69](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/69)
1213

1314
**Fixes**
1415

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
**Enhancements**
66

77
- Add `npm postinstall` script to automatically add the localization config [#64](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/64)
8+
- Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)
89
- Added a font field type for the `PropertyFieldCollectionData` control [#66](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/66)
910
- Added a URL field type for the `PropertyFieldCollectionData` control [#72](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/72)
10-
- Add a description to the `PropertyFieldCollectionData` panel [#67](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/67)
11-
- Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control
11+
- Field validation implemented to enable/disable save buttons in `PropertyFieldCollectionData` control. Related to previous enhancement.
12+
- Added a properties to the `TaxonomyPicker` to specify which terms are disabled/not-selectable [#69](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/69)
1213

1314
**Fixes**
1415

docs/documentation/docs/controls/PropertyFieldTermPicker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ The `PropertyFieldTermPicker` control can be configured with the following prope
8484
| limitByTermsetNameOrID | string | no | Limit the terms that can be picked by the Term Set name or ID. |
8585
| hideTermStoreName | boolean | no | Specifies if you want to show or hide the term store name from the panel. |
8686
| isTermSetSelectable | boolean | no | Specify if the term set itself is selectable in the tree view. |
87+
| disabledTermIds | string[] | no | Specify which terms should be disabled in the term set so that they cannot be selected. |
8788
| onPropertyChange | function | yes | Defines a onPropertyChange function to raise when the date gets changed. |
8889
| properties | any | yes | Parent web part properties, this object is use to update the property value. |
8990
| key | string | yes | An unique key that indicates the identity of this control. |

src/propertyFields/termPicker/IPropertyFieldTermPicker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ export interface IPropertyFieldTermPickerProps {
142142
* Specify if the term set itself is selectable in the tree view
143143
*/
144144
isTermSetSelectable?: boolean;
145+
/**
146+
* Specify which terms should be disabled in the term set so that they cannot be selected
147+
*/
148+
disabledTermIds?: string[];
145149
}
146150

147151
/**

src/propertyFields/termPicker/IPropertyFieldTermPickerHost.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface ITermGroupProps extends ITermChanges {
3232
termsService: SPTermStorePickerService;
3333
multiSelection: boolean;
3434
isTermSetSelectable?: boolean;
35+
disabledTermIds?: string[];
3536
}
3637

3738
export interface ITermGroupState {
@@ -45,6 +46,7 @@ export interface ITermSetProps extends ITermChanges {
4546
autoExpand: () => void;
4647
multiSelection: boolean;
4748
isTermSetSelectable?: boolean;
49+
disabledTermIds?: string[];
4850
}
4951

5052
export interface ITermSetState {
@@ -57,6 +59,7 @@ export interface ITermProps extends ITermChanges {
5759
termset: string;
5860
term: ITerm;
5961
multiSelection: boolean;
62+
disabled: boolean;
6063
}
6164

6265
export interface ITermState {

src/propertyFields/termPicker/PropertyFieldTermPicker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class PropertyFieldTermPickerBuilder implements IPropertyPaneField<IPropertyFiel
2929
private panelTitle: string;
3030
private hideTermStoreName: boolean;
3131
private isTermSetSelectable: boolean;
32+
private disabledTermIds: string[];
3233

3334
public onPropertyChange(propertyPath: string, oldValue: any, newValue: any): void { }
3435
private customProperties: any;
@@ -57,6 +58,7 @@ class PropertyFieldTermPickerBuilder implements IPropertyPaneField<IPropertyFiel
5758
this.limitByTermsetNameOrID = _properties.limitByTermsetNameOrID;
5859
this.hideTermStoreName = _properties.hideTermStoreName;
5960
this.isTermSetSelectable = _properties.isTermSetSelectable;
61+
this.disabledTermIds = _properties.disabledTermIds;
6062

6163
if (_properties.disabled === true) {
6264
this.disabled = _properties.disabled;
@@ -91,6 +93,7 @@ class PropertyFieldTermPickerBuilder implements IPropertyPaneField<IPropertyFiel
9193
limitByTermsetNameOrID: this.limitByTermsetNameOrID,
9294
hideTermStoreName: this.hideTermStoreName,
9395
isTermSetSelectable: this.isTermSetSelectable,
96+
disabledTermIds: this.disabledTermIds,
9497
context: this.context,
9598
onDispose: this.dispose,
9699
onRender: this.render,

src/propertyFields/termPicker/PropertyFieldTermPickerHost.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export default class PropertyFieldTermPickerHost extends React.Component<IProper
290290
onChanged={this.termsFromPickerChanged}
291291
allowMultipleSelections={this.props.allowMultipleSelections}
292292
isTermSetSelectable={this.props.isTermSetSelectable}
293+
disabledTermIds={this.props.disabledTermIds}
293294
/>
294295
</td>
295296
<td className={styles.termFieldRow}>
@@ -335,7 +336,15 @@ export default class PropertyFieldTermPickerHost extends React.Component<IProper
335336
}
336337
{
337338
termStore.Groups._Child_Items_.map((group) => {
338-
return <TermGroup key={group.Id} group={group} termstore={termStore.Id} termsService={this.termsService} activeNodes={this.state.activeNodes} changedCallback={this.termsChanged} multiSelection={this.props.allowMultipleSelections} isTermSetSelectable={this.props.isTermSetSelectable} />;
339+
return <TermGroup key={group.Id}
340+
group={group}
341+
termstore={termStore.Id}
342+
termsService={this.termsService}
343+
activeNodes={this.state.activeNodes}
344+
changedCallback={this.termsChanged}
345+
multiSelection={this.props.allowMultipleSelections}
346+
isTermSetSelectable={this.props.isTermSetSelectable}
347+
disabledTermIds={this.props.disabledTermIds} />;
339348
})
340349
}
341350
</div>

src/propertyFields/termPicker/Term.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class Term extends React.Component<ITermProps, ITermState> {
5858
<div className={`${styles.listItem} ${styles.term}`} style={styleProps}>
5959
<Checkbox
6060
checked={this.state.selected}
61-
disabled={this.props.term.IsDeprecated}
61+
disabled={this.props.term.IsDeprecated || this.props.disabled}
6262
className={this.props.term.IsDeprecated ? styles.termDisabled : styles.termEnabled}
6363
label={this.props.term.Name}
6464
onChange={this._handleChange} />

src/propertyFields/termPicker/TermGroup.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ export default class TermGroup extends React.Component<ITermGroupProps, ITermGro
5454
<div style={styleProps}>
5555
{
5656
this.props.group.TermSets._Child_Items_.map(termset => {
57-
return <TermSet key={termset.Id} termset={termset} termstore={this.props.termstore} termsService={this.props.termsService} autoExpand={this._autoExpand} activeNodes={this.props.activeNodes} changedCallback={this.props.changedCallback} multiSelection={this.props.multiSelection} isTermSetSelectable={this.props.isTermSetSelectable} />;
57+
return <TermSet key={termset.Id}
58+
termset={termset}
59+
termstore={this.props.termstore}
60+
termsService={this.props.termsService}
61+
autoExpand={this._autoExpand}
62+
activeNodes={this.props.activeNodes}
63+
changedCallback={this.props.changedCallback}
64+
multiSelection={this.props.multiSelection}
65+
isTermSetSelectable={this.props.isTermSetSelectable}
66+
disabledTermIds={this.props.disabledTermIds} />;
5867
})
5968
}
6069
</div>

0 commit comments

Comments
 (0)