Skip to content

Commit eb0fb28

Browse files
authored
Merge pull request #127 from SharePoint/dev
Merge for v1.13.0
2 parents 4c7ace0 + f7ebb25 commit eb0fb28

30 files changed

+535
-177
lines changed

CHANGELOG.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
{
22
"versions": [
3+
{
4+
"version": "1.13.0",
5+
"changes": {
6+
"new": [
7+
],
8+
"enhancements": [
9+
"Updated the `office-ui-fabric-react` to the same version as in SPFx 1.7.0 [#105](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/105)",
10+
"`PropertyFieldPeoplePicker`: Ability to select only from a specific site [#9](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/9)",
11+
"`PropertyFieldCodeEditor`: Added support for custom field rendering [#122](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/122)",
12+
"`PropertyFieldCodeEditor`: Added the functionality to sort the items in the collection [#123](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/123)"
13+
],
14+
"fixes": [
15+
"`PropertyFieldDateTimePicker`: Fix for the hours dropdown not showing values [#112](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/112)",
16+
"`PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)",
17+
"`PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)",
18+
"`PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)"
19+
]
20+
},
21+
"contributions": ["[Erwin van Hunen](https://github.com/erwinvanhunen)"]
22+
},
323
{
424
"version": "1.12.0",
525
"changes": {

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Releases
22

3+
## 1.13.0
4+
5+
**Enhancements**
6+
7+
- Updated the `office-ui-fabric-react` to the same version as in SPFx 1.7.0 [#105](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/105)
8+
- `PropertyFieldPeoplePicker`: Ability to select only from a specific site [#9](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/9)
9+
- `PropertyFieldCodeEditor`: Added support for custom field rendering [#122](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/122)
10+
- `PropertyFieldCodeEditor`: Added the functionality to sort the items in the collection [#123](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/123)
11+
12+
**Fixes**
13+
14+
- `PropertyFieldDateTimePicker`: Fix for the hours dropdown not showing values [#112](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/112)
15+
- `PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)
16+
- `PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)
17+
- `PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)
18+
19+
### Contributors
20+
21+
Special thanks to our contributor: [Erwin van Hunen](https://github.com/erwinvanhunen).
22+
323
## 1.12.0
424

525
**New control(s)**

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Releases
22

3+
## 1.13.0
4+
5+
**Enhancements**
6+
7+
- Updated the `office-ui-fabric-react` to the same version as in SPFx 1.7.0 [#105](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/105)
8+
- `PropertyFieldPeoplePicker`: Ability to select only from a specific site [#9](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/9)
9+
- `PropertyFieldCodeEditor`: Added support for custom field rendering [#122](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/122)
10+
- `PropertyFieldCodeEditor`: Added the functionality to sort the items in the collection [#123](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/123)
11+
12+
**Fixes**
13+
14+
- `PropertyFieldDateTimePicker`: Fix for the hours dropdown not showing values [#112](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/112)
15+
- `PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)
16+
- `PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)
17+
- `PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)
18+
19+
### Contributors
20+
21+
Special thanks to our contributor: [Erwin van Hunen](https://github.com/erwinvanhunen).
22+
323
## 1.12.0
424

525
**New control(s)**

docs/documentation/docs/controls/PropertyFieldCollectionData.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,40 @@ PropertyFieldCollectionData("collectionData", {
9191
})
9292
```
9393

94+
### Sample of custom field rendering
95+
96+
Here is an example of how you can render your own controls in the `PropertyFieldCollectionData` control:
97+
98+
```TypeScript
99+
{
100+
id: "customFieldId",
101+
title: "Custom Field",
102+
type: CustomCollectionFieldType.custom,
103+
onCustomRender: (field, value, onUpdate) => {
104+
return (
105+
React.createElement("div", null,
106+
React.createElement("input", { value: value, onChange: (event: React.FormEvent<HTMLInputElement>) => onUpdate(field.id, event.currentTarget.value) }), " 🎉"
107+
)
108+
);
109+
}
110+
}
111+
```
112+
94113
## Implementation
95114

96115
The `PropertyFieldCollectionData` control can be configured with the following properties:
97116

98-
| Property | Type | Required | Description |
117+
| Property | Type | Required | Description | Default Value |
99118
| ---- | ---- | ---- | ---- |
100-
| key | string | yes | An unique key that indicates the identity of this control. |
101-
| label | string | yes | Property field label displayed on top. |
102-
| panelHeader | string | yes | Label to be used as the header in the panel. |
103-
| panelDescription | string | no | Property that allows you to specify a description in the collection panel. |
104-
| manageBtnLabel | string | yes | Label of the button to open the panel. |
105-
| fields | ICustomCollectionField[] | yes | The fields to be used for the list of collection data. |
106-
| value | string | yes | The collection data value. |
107-
| disabled | boolean | no | Specify if the control is disabled. |
119+
| key | string | yes | An unique key that indicates the identity of this control. | |
120+
| label | string | yes | Property field label displayed on top. | |
121+
| panelHeader | string | yes | Label to be used as the header in the panel. | |
122+
| panelDescription | string | no | Property that allows you to specify a description in the collection panel. | |
123+
| manageBtnLabel | string | yes | Label of the button to open the panel. | |
124+
| fields | ICustomCollectionField[] | yes | The fields to be used for the list of collection data. | |
125+
| value | string | yes | The collection data value. | |
126+
| enableSorting | boolean | no | Specify if you want to be able to sort the items in the collection. | false |
127+
| disabled | boolean | no | Specify if the control is disabled. | false |
108128

109129
Interface `ICustomCollectionField`
110130

@@ -120,6 +140,7 @@ Interface `ICustomCollectionField`
120140
| defaultValue | any | no | Specify a default value for the input field. |
121141
| deferredValidationTime | number | no | Field will start to validate after users stop typing for `deferredValidationTime` milliseconds. Default: 200ms. |
122142
| onGetErrorMessage | (value: any, index: number, crntItem: any): string \| Promise<string> | no | The method is used to get the validation error message and determine whether the input value is valid or not. It provides you the current row index and the item you are currently editing. |
143+
| onCustomRender | (field: ICustomCollectionField, value: any, onUpdate: (fieldId: string, value: any) => void) => JSX.Element | no | This property is only required if you are using the `custom` field type and it can be used to specify the custom rendering of your control in the collection data. |
123144

124145
Enum `CustomCollectionFieldType`
125146

@@ -131,5 +152,6 @@ Enum `CustomCollectionFieldType`
131152
| dropdown | Dropdown field. You will have to specify the `options` property when using this field type |
132153
| fabricIcon | Name of the [Office UI Fabric icon](https://developer.microsoft.com/en-us/fabric#/styles/icons) |
133154
| url | URL field |
155+
| custom | This gives you control over the whole field rendering. Be sure to provide the `onCustomRender` method to render your control in the collection data. |
134156

135157
![](https://telemetry.sharepointpnp.com/sp-dev-fx-property-controls/wiki/PropertyFieldCollectionData)

docs/documentation/docs/controls/PropertyFieldPeoplePicker.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ The `PropertyFieldPeoplePicker` control can be configured with the following pro
6464
| multiSelect | boolean | no | Define if you want to allow multi user / group selection. (optional, true by default). |
6565
| principalType | PrincipalType[] | no | Define which type of data you want to retrieve: User, SharePoint groups, Security groups. Multiple are possible. |
6666
| onPropertyChange | function | yes | Defines a onPropertyChange function to raise when the date gets changed. |
67-
| properties | any | yes | Parent web part properties, this object is use to update the property value. |
67+
| properties | any | yes | Parent web part properties, this object is use to update the property value. |
68+
| targetSiteUrl | string | no | Specify the URL of the target site from which you want to retreive the users/groups. |
6869
| key | string | yes | An unique key that indicates the identity of this control. |
6970
| onGetErrorMessage | function | no | The method is used to get the validation error message and determine whether the input value is valid or not. See [this documentation](https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/validate-web-part-property-values) to learn how to use it. |
7071
| deferredValidationTime | number | no | Control will start to validate after users stop typing for `deferredValidationTime` milliseconds. Default value is 200. |

docs/documentation/docs/controls/PropertyPanePropertyEditor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This control allows the user to edit the webpart properties in JSON. It can also
1717
2. Import the following modules to your component:
1818

1919
```TypeScript
20-
import { PropertyWebPartInformation } from '@pnp/spfx-property-controls/lib/PropertyPanePropertyEditor';
20+
import { PropertyPanePropertyEditor } from '@pnp/spfx-property-controls/lib/PropertyPanePropertyEditor';
2121
```
2222

2323
3. Create a new property for your web part, for example:

docs/documentation/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ nav:
1414
- PropertyFieldSpinButton: 'controls/PropertyFieldSpinButton.md'
1515
- PropertyFieldSwatchColorPicker: 'controls/PropertyFieldSwatchColorPicker.md'
1616
- PropertyFieldTermPicker: 'controls/PropertyFieldTermPicker.md'
17+
- PropertyPanePropertyEditor: 'controls/PropertyPanePropertyEditor.md'
18+
- PropertyPaneWebPartInformation: 'controls/PropertyPaneWebPartInformation.md'
1719
- 'Controls with callout':
1820
- PropertyFieldButtonWithCallout: 'controls/PropertyFieldButtonWithCallout.md'
1921
- PropertyFieldCheckboxWithCallout: 'controls/PropertyFieldCheckboxWithCallout.md'

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pnp/spfx-property-controls",
33
"description": "Reusable property pane controls for SharePoint Framework solutions",
4-
"version": "1.12.0",
4+
"version": "1.13.0",
55
"engines": {
66
"node": ">=0.10.0"
77
},
@@ -18,7 +18,8 @@
1818
},
1919
"dependencies": {
2020
"@pnp/telemetry-js": "1.0.0",
21-
"react-ace": "5.8.0"
21+
"react-ace": "5.8.0",
22+
"office-ui-fabric-react": "5.131.0"
2223
},
2324
"devDependencies": {
2425
"@microsoft/sp-build-web": "~1.3.0",

src/common/telemetry/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version: string = "1.12.0";
1+
export const version: string = "1.13.0";

src/propertyFields/buttonWithCallout/PropertyFieldButtonWithCallout.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import PropertyFieldButtonHost from './PropertyFieldButtonWithCalloutHost';
1010

1111
import { IPropertyFieldButtonWithCalloutPropsInternal, IPropertyFieldButtonWithCalloutProps } from './IPropertyFieldButtonWithCallout';
1212
import { ButtonType } from 'office-ui-fabric-react/lib/components/Button';
13-
import * as _ from 'lodash';
13+
import { omit } from 'lodash';
1414

1515
/**
1616
* Represents a PropertyFieldButtonWithCallout object
@@ -31,16 +31,16 @@ class PropertyFieldButtonWithCalloutBuilder implements IPropertyPaneField<IPrope
3131

3232
private _render(elem: HTMLElement, context?: any, changeCallback?: (targetProperty?: string, newValue?: any) => void): void {
3333

34-
const props: IPropertyFieldButtonWithCalloutProps = <IPropertyFieldButtonWithCalloutProps>_.omit(this.properties, ['buttonType']);
34+
const props: IPropertyFieldButtonWithCalloutProps = <IPropertyFieldButtonWithCalloutProps>omit(this.properties, ['buttonType']);
3535

3636
//
3737
// PropertyPaneButtonType is not assignable to ButtonType
3838
//
3939
const buttonTypeString: string = ButtonType[this.properties.buttonType];
4040
const buttonType: ButtonType = ButtonType[buttonTypeString];
41-
41+
const propsWithoutRef = omit(props, "ref");
4242
const element = React.createElement(PropertyFieldButtonHost, {
43-
...props,
43+
...propsWithoutRef,
4444
buttonType: buttonType
4545
});
4646

0 commit comments

Comments
 (0)