diff --git a/samples/react-search-refiners/README.md b/samples/react-search-refiners/README.md index d78c0650e..2c082bf96 100644 --- a/samples/react-search-refiners/README.md +++ b/samples/react-search-refiners/README.md @@ -56,14 +56,15 @@ Version|Date|Comments 1.3 | Apr1, 2018 | Added the result count + entered keywords option 1.4 | May 10, 2018 | 1.5 | Jul 2, 2018 | -2.0.0.5 | Sept 18, 2018 | -2.1.0.0 | Oct 14, 2018 | -2.1.1.0 | Oct 30, 2018 | -2.1.2.0 | Nov 9, 2018 | -2.2.0.0 | Nov 11, 2018 | -2.2.0.1 | Dec 3, 2018 | -2.3.0.0 | Dec 13, 2018 | -2.4.0.0 | Jan 03, 2019 | Added custom code renderer support. +2.0.5 | Sept 18, 2018 | +2.1.0 | Oct 14, 2018 | +2.1.1 | Oct 30, 2018 | +2.1.2 | Nov 9, 2018 | +2.2.0 | Nov 11, 2018 | +2.2.0 | Dec 3, 2018 | +2.3.0 | Dec 13, 2018 | +2.4.0 | Jan 03, 2019 | Added custom code renderer support. +2.4.1 | Jan 07, 2019 | Added backwards compability for older sort configurations, and old empty refiner configurations ## Important notice on upgrading the solution from pre v2.2.0.0 **Due to code restucturing we have hit an edge case which impacts upgrades from previous versions. To solve the issue go to `https://.sharepoint.com/sites//Lists/ComponentManifests` and remove the entries for SearchBox and Search Results, and then upload the .sppkg for the new release.** diff --git a/samples/react-search-refiners/spfx/package.json b/samples/react-search-refiners/spfx/package.json index 46f563ca2..eadbd1a86 100644 --- a/samples/react-search-refiners/spfx/package.json +++ b/samples/react-search-refiners/spfx/package.json @@ -1,6 +1,6 @@ { "name": "pnp-react-search-refiners", - "version": "2.4.0", + "version": "2.4.1", "private": true, "engines": { "node": ">=0.10.0" diff --git a/samples/react-search-refiners/spfx/src/webparts/searchResults/SearchResultsWebPart.ts b/samples/react-search-refiners/spfx/src/webparts/searchResults/SearchResultsWebPart.ts index 0ca6e3ce7..27e63fd99 100644 --- a/samples/react-search-refiners/spfx/src/webparts/searchResults/SearchResultsWebPart.ts +++ b/samples/react-search-refiners/spfx/src/webparts/searchResults/SearchResultsWebPart.ts @@ -2,21 +2,21 @@ import * as ReactDom from 'react-dom'; import { Version, Text, Environment, EnvironmentType, DisplayMode, Log } from '@microsoft/sp-core-library'; import { - BaseClientSideWebPart, - IPropertyPaneConfiguration, - PropertyPaneTextField, - IWebPartPropertiesMetadata, - PropertyPaneDynamicFieldSet, - PropertyPaneDynamicField, - DynamicDataSharedDepth, - IPropertyPaneConditionalGroup, - IPropertyPaneField, - PropertyPaneToggle, - PropertyPaneSlider, - IPropertyPaneChoiceGroupOption, - PropertyPaneChoiceGroup, - PropertyPaneCheckbox, - PropertyPaneHorizontalRule, + BaseClientSideWebPart, + IPropertyPaneConfiguration, + PropertyPaneTextField, + IWebPartPropertiesMetadata, + PropertyPaneDynamicFieldSet, + PropertyPaneDynamicField, + DynamicDataSharedDepth, + IPropertyPaneConditionalGroup, + IPropertyPaneField, + PropertyPaneToggle, + PropertyPaneSlider, + IPropertyPaneChoiceGroupOption, + PropertyPaneChoiceGroup, + PropertyPaneCheckbox, + PropertyPaneHorizontalRule, } from '@microsoft/sp-webpart-base'; import * as strings from 'SearchResultsWebPartStrings'; import SearchResultsContainer from './components/SearchResultsContainer/SearchResultsContainer'; @@ -94,34 +94,34 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart = React.createElement( SearchResultsContainer, { @@ -163,7 +163,7 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart { this.initializeRequiredProperties(); @@ -195,11 +195,11 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart { + let direction; + let kvp = sort.split(':'); + if (kvp[1].toLocaleLowerCase().trim() === "ascending") { + direction = ISortFieldDirection.Ascending; + } else { + direction = ISortFieldDirection.Descending; + } + + return { + sortField: kvp[0].trim(), + sortDirection: direction + } as ISortFieldConfiguration; + }); + } + private _convertToSortList(sortList: ISortFieldConfiguration[]): Sort[] { return sortList.map(e => { - + let direction; switch (e.sortDirection) { @@ -247,31 +265,41 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart { // Code editor component for result types @@ -330,10 +358,10 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart 0) { - itemProp = item[term[0]].map(e => { return e[term[1]]; }).join(','); + itemProp = item[term[0]].map(e => { return e[term[1]]; }).join(','); } else { - itemProp = item[term[0]][term[1]]; + itemProp = item[term[0]][term[1]]; } } else { itemProp = item[pageProp]; @@ -548,7 +576,7 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart[] { - + // Sets up search settings fields const searchSettingsFields: IPropertyPaneField[] = [ PropertyPaneTextField('queryTemplate', { @@ -707,7 +735,7 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart { - return ( - React.createElement("div", null, - React.createElement(this._textDialogComponent.TextDialog, { - language: this._propertyFieldCodeEditorLanguages.Handlebars, - dialogTextFieldValue: value ? value : dialogTextFieldValue, - onChanged: (fieldValue) => onUpdate(field.id, fieldValue), - strings: { - cancelButtonText: strings.CancelButtonText, - dialogButtonText: strings.DialogButtonText, - dialogTitle: strings.DialogTitle, - saveButtonText: strings.SaveButtonText - } - }) - ) - ); + return ( + React.createElement("div", null, + React.createElement(this._textDialogComponent.TextDialog, { + language: this._propertyFieldCodeEditorLanguages.Handlebars, + dialogTextFieldValue: value ? value : dialogTextFieldValue, + onChanged: (fieldValue) => onUpdate(field.id, fieldValue), + strings: { + cancelButtonText: strings.CancelButtonText, + dialogButtonText: strings.DialogButtonText, + dialogTitle: strings.DialogTitle, + saveButtonText: strings.SaveButtonText + } + }) + ) + ); } }, { @@ -943,9 +971,9 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart renderer.id === (this.properties.selectedLayout as any)); - if(!this.properties.customTemplateFieldValues) { + if (!this.properties.customTemplateFieldValues) { this.properties.customTemplateFieldValues = currentCodeRenderer.customFields.map(field => { return { fieldName: field, @@ -953,7 +981,7 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart 0) { + if (currentCodeRenderer.customFields && currentCodeRenderer.customFields.length > 0) { const searchPropertyOptions = this.properties.selectedProperties.split(',').map(prop => { return ({ key: prop, @@ -980,7 +1008,7 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart 0) { + if (registeredRenderers && registeredRenderers.length > 0) { return registeredRenderers.map(ca => { return { key: ca.id,