Skip to content

Commit e14f2b5

Browse files
committed
Merge branch 'spdavid-dev' into dev
2 parents 8226fdd + 50870ba commit e14f2b5

19 files changed

+1584
-4
lines changed

config/tslint.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"use-named-parameter": true,
4040
"valid-typeof": true,
4141
"variable-name": false,
42-
"whitespace": false
42+
"whitespace": false,
43+
"no-debugger": true
4344
}
4445
}
45-
}
46+
}

docs/documentation/docs/beta.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Testing out a beta release ![](https://img.shields.io/npm/v/@pnp/spfx-controls-react/next.svg)
2+
3+
All you need to do for testing out a beta release of `@pnp/spfx-controls-react` is to install the dependency as follows:
4+
5+
```
6+
npm install @pnp/spfx-controls-react@next --save
7+
```
8+
9+
## Beta control documentation
10+
11+
The control documentation is only live for public releases, not for beta versions. If you want to checkout the markdown files of all controls in the `dev` branch: [beta documentation](https://github.com/SharePoint/sp-dev-fx-controls-react/tree/dev/docs/documentation/docs/controls).
12+
13+
## Next Steps
14+
15+
Once you installed the beta version, you can start using the controls in your solution. Go to the homepage to get an overview of all the available controls and the steps to get started: [home](./).
16+
17+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/beta)

docs/documentation/docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
This repository provides developers with a set of reusable React controls that can be used in SharePoint Framework (SPFx) solutions. The project provides controls for building web parts and extensions.
44

5-
!!! attention The controls project has a minimal dependency on SharePoint Framework version `1.3.0`. Be aware that the controls might not work in solutions your building for on-premises. As for on-premises solutions version `1.1.0` is currently used.
5+
!!! attention
6+
The controls project has a minimal dependency on SharePoint Framework version `1.3.0`. Be aware that the controls might not work in solutions your building for on-premises. As for on-premises solutions version `1.1.0` is currently used.
67

78
## Getting started
89

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pages:
2121
- FieldTitleRenderer: 'controls/fields/FieldTitleRenderer.md'
2222
- FieldUrlRenderer: 'controls/fields/FieldUrlRenderer.md'
2323
- FieldUserRenderer: 'controls/fields/FieldUserRenderer.md'
24+
- 'Beta testing': 'beta.md'
2425
- About:
2526
- 'Release notes': 'about/release-notes.md'
2627
- License: 'about/license.md'

src/TaxonomyPicker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './controls/taxonomyPicker/index';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as React from 'react';
2+
import styles from './TaxonomyPicker.module.scss';
3+
import { Icon } from 'office-ui-fabric-react/lib/Icon';
4+
5+
export interface IFieldErrorMessageProps {
6+
errorMessage: string;
7+
}
8+
9+
/**
10+
* Component that shows an error message when something went wront with the property control
11+
*/
12+
export default class FieldErrorMessage extends React.Component<IFieldErrorMessageProps> {
13+
public render(): JSX.Element {
14+
if (this.props.errorMessage !== 'undefined' && this.props.errorMessage !== null && this.props.errorMessage !== '') {
15+
return (
16+
<div aria-live="assertive">
17+
<p className={`ms-TextField-errorMessage ${styles.errorMessage}`}>
18+
<Icon iconName='Error' className={styles.errorIcon} />
19+
<span data-automation-id="error-message">{this.props.errorMessage}</span>
20+
</p>
21+
</div>
22+
);
23+
} else {
24+
return null;
25+
}
26+
}
27+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { IPickerTerms } from './ITermPicker';
2+
import { ITermStore, IGroup, ITermSet, ITerm } from '../../services/ISPTermStorePickerService';
3+
import SPTermStorePickerService from '../../services/SPTermStorePickerService';
4+
import { IWebPartContext } from '@microsoft/sp-webpart-base';
5+
6+
/**
7+
* PropertyFieldTermPickerHost properties interface
8+
// */
9+
export interface ITaxonomyPickerProps {
10+
/**
11+
* Property field label displayed on top
12+
*/
13+
label: string;
14+
/**
15+
* TermSet Picker Panel title
16+
*/
17+
panelTitle: string;
18+
/**
19+
* Defines if the user can select only one or many term sets. Default value is false.
20+
*/
21+
allowMultipleSelections?: boolean;
22+
/**
23+
* Defines the selected by default term sets.
24+
*/
25+
initialValues?: IPickerTerms;
26+
/**
27+
* WebPart's context
28+
*/
29+
context: IWebPartContext;
30+
/**
31+
* Limit the terms that can be picked by the Term Set name or ID
32+
*/
33+
termsetNameOrID: string;
34+
/**
35+
* Id of a child term in the termset where to be able to selected and search the terms from
36+
*/
37+
ancoreId?: string;
38+
/**
39+
* Whether the property pane field is enabled or not.
40+
*/
41+
disabled?: boolean;
42+
/**
43+
* The method is used to get the validation error message and determine whether the input value is valid or not.
44+
*
45+
* When it returns string:
46+
* - If valid, it returns empty string.
47+
* - If invalid, it returns the error message string and the text field will
48+
* show a red border and show an error message below the text field.
49+
*
50+
* When it returns Promise<string>:
51+
* - The resolved value is display as error message.
52+
* - The rejected, the value is thrown away.
53+
*
54+
*/
55+
onGetErrorMessage?: (value: IPickerTerms) => string | Promise<string>;
56+
57+
/**
58+
* onChange Event
59+
*/
60+
onChange?: (newValue?: IPickerTerms) => void;
61+
}
62+
63+
/**
64+
* PropertyFieldTermPickerHost state interface
65+
*/
66+
export interface ITaxonomyPickerState {
67+
68+
termSetAndTerms? : ITermSet;
69+
errorMessage?: string;
70+
openPanel?: boolean;
71+
loaded?: boolean;
72+
activeNodes?: IPickerTerms;
73+
}
74+
75+
export interface ITermChanges {
76+
changedCallback: (term: ITerm, checked: boolean) => void;
77+
activeNodes?: IPickerTerms;
78+
}
79+
80+
81+
export interface ITermParentProps extends ITermChanges {
82+
termset: ITermSet;
83+
autoExpand: () => void;
84+
multiSelection: boolean;
85+
anchorId? : string;
86+
}
87+
88+
export interface ITermParentState {
89+
90+
loaded?: boolean;
91+
expanded?: boolean;
92+
}
93+
94+
export interface ITermProps extends ITermChanges {
95+
termset: string;
96+
term: ITerm;
97+
multiSelection: boolean;
98+
}
99+
100+
export interface ITermState {
101+
selected?: boolean;
102+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { IWebPartContext } from '@microsoft/sp-webpart-base';
2+
3+
4+
5+
/**
6+
* Selected terms
7+
*/
8+
export interface IPickerTerm {
9+
name: string;
10+
key: string;
11+
path: string;
12+
termSet: string;
13+
termSetName? : string;
14+
}
15+
16+
export interface IPickerTerms extends Array<IPickerTerm> { }
17+
18+
/**
19+
* Public properties of the PropertyFieldTermPicker custom field
20+
*/
21+
export interface IPropertyFieldTermPickerProps {
22+
/**
23+
* Property field label displayed on top
24+
*/
25+
label: string;
26+
/**
27+
* TermSet Picker Panel title
28+
*/
29+
panelTitle: string;
30+
/**
31+
* Defines if the user can select only one or many term sets. Default value is false.
32+
*/
33+
allowMultipleSelections?: boolean;
34+
/**
35+
* Defines the selected by default term sets.
36+
*/
37+
initialValues?: IPickerTerms;
38+
/**
39+
* Indicator to define if the system Groups are exclude. Default is false.
40+
*/
41+
excludeSystemGroup?: boolean;
42+
/**
43+
* WebPart's context
44+
*/
45+
context: IWebPartContext;
46+
/**
47+
* Limit the term sets that can be used by the group name or ID
48+
*/
49+
limitByGroupNameOrID?: string;
50+
/**
51+
* Limit the terms that can be picked by the Term Set name or ID
52+
*/
53+
limitByTermsetNameOrID?: string;
54+
/**
55+
* Defines a onPropertyChange function to raise when the selected value changed.
56+
* Normally this function must be always defined with the 'this.onPropertyChange'
57+
* method of the web part object.
58+
*/
59+
onPropertyChange(propertyPath: string, oldValue: any, newValue: any): void;
60+
/**
61+
* Parent Web Part properties
62+
*/
63+
properties: any;
64+
/**
65+
* An UNIQUE key indicates the identity of this control
66+
*/
67+
key: string;
68+
/**
69+
* Whether the property pane field is enabled or not.
70+
*/
71+
disabled?: boolean;
72+
/**
73+
* The method is used to get the validation error message and determine whether the input value is valid or not.
74+
*
75+
* When it returns string:
76+
* - If valid, it returns empty string.
77+
* - If invalid, it returns the error message string and the text field will
78+
* show a red border and show an error message below the text field.
79+
*
80+
* When it returns Promise<string>:
81+
* - The resolved value is display as error message.
82+
* - The rejected, the value is thrown away.
83+
*
84+
*/
85+
onGetErrorMessage?: (value: IPickerTerms) => string | Promise<string>;
86+
/**
87+
* Custom Field will start to validate after users stop typing for `deferredValidationTime` milliseconds.
88+
* Default value is 200.
89+
*/
90+
deferredValidationTime?: number;
91+
92+
}
93+

0 commit comments

Comments
 (0)