Skip to content

Commit

Permalink
Merge pull request #373 from pnp/v2-dev
Browse files Browse the repository at this point in the history
merge for 2.7.0
  • Loading branch information
estruyf authored Jun 23, 2021
2 parents 4cee9d5 + faaa16f commit 12fe1fe
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 17 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
{
"versions": [
{
"version": "2.7.0",
"changes": {
"new": [],
"enhancements": [
"`PropertyFieldColorPicker`: Add debounce property to color picker control [#352](https://github.com/pnp/sp-dev-fx-property-controls/issues/352)"
],
"fixes": [
"`PropertyFieldFilePicker`: Stock images url is getting a 404 server error [#364](https://github.com/pnp/sp-dev-fx-property-controls/issues/364)",
"`PropertyFieldColumnPicker`: Filter not working properly [#356](https://github.com/pnp/sp-dev-fx-property-controls/issues/356)",
"`PropertyFieldFilePicker`: React crash on large folders [#371](https://github.com/pnp/sp-dev-fx-property-controls/pull/371)",
"`PropertyFieldCollectionData`: PropertyFieldCollectionData is not setting sortIdx on resulting collection when using Add and Save [#369](https://github.com/pnp/sp-dev-fx-property-controls/issues/369)"
]
},
"contributions": [
"[Chrisrb05](https://github.com/Chrisrb05)",
"[Konrad K.](https://github.com/wilecoyotegenius)",
"[Mark Bice](https://github.com/mbice)"
]
},
{
"version": "2.6.0",
"changes": {
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Releases

## 2.7.0

### Enhancements

- `PropertyFieldColorPicker`: Add debounce property to color picker control [#352](https://github.com/pnp/sp-dev-fx-property-controls/issues/352)

### Fixes

- `PropertyFieldFilePicker`: Stock images url is getting a 404 server error [#364](https://github.com/pnp/sp-dev-fx-property-controls/issues/364)
- `PropertyFieldColumnPicker`: Filter not working properly [#356](https://github.com/pnp/sp-dev-fx-property-controls/issues/356)
- `PropertyFieldFilePicker`: React crash on large folders [#371](https://github.com/pnp/sp-dev-fx-property-controls/pull/371)
- `PropertyFieldCollectionData`: PropertyFieldCollectionData is not setting sortIdx on resulting collection when using Add and Save [#369](https://github.com/pnp/sp-dev-fx-property-controls/issues/369)

### Contributors

Special thanks to our contributors (in alphabetical order): [Chrisrb05](https://github.com/Chrisrb05), [Konrad K.](https://github.com/wilecoyotegenius), [Mark Bice](https://github.com/mbice).

## 2.6.0

### Fixes
Expand Down
17 changes: 17 additions & 0 deletions docs/documentation/docs/about/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Releases

## 2.7.0

### Enhancements

- `PropertyFieldColorPicker`: Add debounce property to color picker control [#352](https://github.com/pnp/sp-dev-fx-property-controls/issues/352)

### Fixes

- `PropertyFieldFilePicker`: Stock images url is getting a 404 server error [#364](https://github.com/pnp/sp-dev-fx-property-controls/issues/364)
- `PropertyFieldColumnPicker`: Filter not working properly [#356](https://github.com/pnp/sp-dev-fx-property-controls/issues/356)
- `PropertyFieldFilePicker`: React crash on large folders [#371](https://github.com/pnp/sp-dev-fx-property-controls/pull/371)
- `PropertyFieldCollectionData`: PropertyFieldCollectionData is not setting sortIdx on resulting collection when using Add and Save [#369](https://github.com/pnp/sp-dev-fx-property-controls/issues/369)

### Contributors

Special thanks to our contributors (in alphabetical order): [Chrisrb05](https://github.com/Chrisrb05), [Konrad K.](https://github.com/wilecoyotegenius), [Mark Bice](https://github.com/mbice).

## 2.6.0

### Fixes
Expand Down
2 changes: 2 additions & 0 deletions docs/documentation/docs/controls/PropertyFieldColorPicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ PropertyFieldColorPicker('color', {
onPropertyChange: this.onPropertyPaneFieldChanged,
properties: this.properties,
disabled: false,
debounce: 1000,
isHidden: false,
alphaSliderHidden: false,
style: PropertyFieldColorPickerStyle.Full,
Expand All @@ -52,6 +53,7 @@ The `PropertyFieldColorPicker` control can be configured with the following prop
| ---- | ---- | ---- | ---- |
| label | string | yes | Property field label displayed on top. |
| disabled | boolean | no | Specify if the control needs to be disabled. |
| debounce | number | no | Specify delay after which control value will be set. |
| isHidden | boolean | no | Specify if the control needs to be hidden. |
| selectedColor | string or IColor | no | The CSS-compatible string or an IColor object to describe the initial color |
| alphaSliderHidden | boolean | no | When true, the alpha slider control is hidden |
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pnp/spfx-property-controls",
"description": "Reusable property pane controls for SharePoint Framework solutions",
"version": "2.6.0",
"version": "2.7.0",
"engines": {
"node": ">=0.10.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/common/telemetry/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version: string = "2.6.0";
export const version: string = "2.7.0";
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export class CollectionDataViewer extends React.Component<ICollectionDataViewerP
private addAndSave = () => {
// Check if the item is not empty
if (this.state.inCreationItem) {
this.props.fOnSave([...this.state.crntItems, this.state.inCreationItem]);
let crntItems = [...this.state.crntItems, this.state.inCreationItem];
crntItems = this.updateSortProperty(crntItems);
this.props.fOnSave(crntItems);
} else {
this.onSave();
}
Expand Down
5 changes: 5 additions & 0 deletions src/propertyFields/colorPicker/IPropertyFieldColorPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export interface IPropertyFieldColorPickerProps {
*/
disabled?: boolean;

/**
* Time after which the control is updated
*/
debounce?: number;

/**
* Whether the property pane field is hidden or not.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface IPropertyFieldColorPickerHostProps {
label: string;
alphaSliderHidden: boolean;
disabled: boolean;
debounce: number;
isHidden: boolean;
selectedColor: string;
style: PropertyFieldColorPickerStyle;
Expand Down
22 changes: 16 additions & 6 deletions src/propertyFields/colorPicker/PropertyFieldColorPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getColorFromString, IColor } from 'office-ui-fabric-react/lib/utilities
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { setPropertyValue } from '../../helpers/GeneralHelper';
import { debounce } from '../../common/util/Util';

import {
IPropertyFieldColorPickerProps,
Expand All @@ -22,6 +23,7 @@ class PropertyFieldColorPickerBuilder implements IPropertyPaneField<IPropertyFie
private color: string;
private valueAsObject: boolean;
private changeCB?: (targetProperty?: string, newValue?: any) => void;
private _debounce: (fnc: any, timeout:number) => void = debounce();

public constructor(_targetProperty: string, _properties: IPropertyFieldColorPickerProps) {
this.targetProperty = _targetProperty;
Expand All @@ -31,6 +33,7 @@ class PropertyFieldColorPickerBuilder implements IPropertyPaneField<IPropertyFie
onPropertyChange: _properties.onPropertyChange,
selectedColor: _properties.selectedColor,
disabled: _properties.disabled,
debounce: _properties.debounce,
isHidden: _properties.isHidden,
alphaSliderHidden: _properties.alphaSliderHidden,
properties: _properties.properties,
Expand Down Expand Up @@ -70,6 +73,7 @@ class PropertyFieldColorPickerBuilder implements IPropertyPaneField<IPropertyFie
label: this.properties.label,
alphaSliderHidden: this.properties.alphaSliderHidden,
disabled: this.properties.disabled,
debounce: this.properties.debounce,
isHidden: this.properties.isHidden,
selectedColor: this.color,
style: this.properties.style || PropertyFieldColorPickerStyle.Inline,
Expand All @@ -84,14 +88,20 @@ class PropertyFieldColorPickerBuilder implements IPropertyPaneField<IPropertyFie
let newValue: string | IColor = (this.valueAsObject ? getColorFromString(newColor) : newColor);
let oldValue: string | IColor = (this.valueAsObject ? getColorFromString(this.color) : this.color);
this.color = newColor;
this.properties.onPropertyChange(this.targetProperty, oldValue, newValue);
setPropertyValue(this.properties.properties, this.targetProperty, newValue);
if (typeof this.changeCB !== 'undefined' && this.changeCB !== null) {
this.changeCB(this.targetProperty, newValue);
}
this.properties.debounce ?
this._debounce(() => {
this.onColorChangedInternal(oldValue, newValue);
}, this.properties.debounce) :
this.onColorChangedInternal(oldValue, newValue);
}
}
private onColorChangedInternal(oldValue: string | IColor , newValue: string | IColor ) {
this.properties.onPropertyChange(this.targetProperty, oldValue, newValue);
setPropertyValue(this.properties.properties, this.targetProperty, newValue);
if (typeof this.changeCB !== 'undefined' && this.changeCB !== null) {
this.changeCB(this.targetProperty, newValue);
}
}

}

export function PropertyFieldColorPicker(targetProperty: string, properties: IPropertyFieldColorPickerProps): IPropertyPaneField<IPropertyFieldColorPickerProps> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export default class PropertyFieldColumnPickerHost extends React.Component<IProp
this.options = [];
columnService.getColumns(displayHiddenColumns).then((response: ISPColumns) => {
// Start mapping the Columns that are selected
response.value.forEach((column: ISPColumn) => {
const value = response.value || [];
value.forEach((column: ISPColumn) => {
let colPropsToCheck = columnReturnProperty ? column[columnReturnProperty] : column.Id;
if (selectedColumn === colPropsToCheck) {
this.selectedKey = columnReturnProperty ? column[columnReturnProperty] : column.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class StockImages extends React.Component<IStockImagesProps> {
const { language } = this.props;

const themesColor = `&themecolors=${encodeURIComponent(this.getCurrentThemeConfiguration())}`;
const contentPickerUrl = `https://hubblecontent.osi.office.net/contentsvc/external/m365contentpicker/index.html?p=3&app=1001&aud=prod&channel=devmain&setlang=${language}&msel=0&env=prod&premium=1${themesColor}`;
const contentPickerUrl = `https://hubblecontent.osi.office.net/contentsvc/m365contentpicker/index.html?p=3&app=1001&aud=prod&channel=devmain&setlang=${language}&msel=0&env=prod&premium=1${themesColor}`;

return (
<div className={styles.tabContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class FileBrowser extends React.Component<IFileBrowserProps, IFileBrowser
selectionPreservedOnEmptyClick={true}
enterModalSelectionOnTouch={true}
onRenderRow={this._onRenderRow}
onRenderMissingItem={this._loadNextDataRequest}
onRenderMissingItem={() => { this._loadNextDataRequest(); return null; }}
/>) :
(<TilesList
fileBrowserService={this.props.fileBrowserService}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IWebPartContext, IPropertyPaneCustomFieldProps } from '@microsoft/sp-webpart-base';
import { IWebPartContext } from '@microsoft/sp-webpart-base';

/**
* PrincipalType controls the type of entities that are returned in the results.
Expand Down
4 changes: 2 additions & 2 deletions src/services/SPColumnPickerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class SPColumnPickerService implements ISPColumnPickerService {

// Adds an OData Filter to the list
if (this.props.filter) {
if (displayHiddenColumns) queryUrl += `&$filter=&${encodeURIComponent(this.props.filter)}`;
else queryUrl += `&$filter=Hidden eq false&${encodeURIComponent(this.props.filter)}`;
if (displayHiddenColumns) queryUrl += `&$filter=${encodeURIComponent(this.props.filter)}`;
else queryUrl += `&$filter=Hidden eq false and ${encodeURIComponent(this.props.filter)}`;
} else {
if (!displayHiddenColumns) queryUrl += `&$filter=Hidden eq false`;
}
Expand Down
1 change: 0 additions & 1 deletion src/services/SPPeopleSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { PrincipalType, IPropertyFieldGroupOrPerson } from './../propertyFields/
import { ISPPeopleSearchService } from './ISPPeopleSearchService';
import SPPeoplePickerMockHttpClient from './SPPeopleSearchMockService';
import { IWebPartContext } from '@microsoft/sp-webpart-base';
import { IUsers } from './IUsers';

/**
* Service implementation to search people in SharePoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ export default class PropertyControlsTestWebPart extends BaseClientSideWebPart<I
selectedColor: this.properties.color,
onPropertyChange: this.onPropertyPaneFieldChanged,
properties: this.properties,
debounce: 500,
//disabled: true,
//alphaSliderHidden: true,
//style: PropertyFieldColorPickerStyle.Full,
Expand Down

0 comments on commit 12fe1fe

Please sign in to comment.