Improvements to react-search-refiner web part (#589)

* Added weburl/siteurl tokens
Added getUrlField helper method
Changed property pane settings headers/grouping
Updated ouifr version to v5.118.0
Updated handlebar helper to v0.8.4
Updated readme

* Added webpack-bundle-analyzer

* Fixed ouifr static references to limit bundle size
This commit is contained in:
Mikael Svenson 2018-08-07 16:27:46 +02:00 committed by Vesa Juvonen
parent 10af3ba114
commit df2648f8f4
12 changed files with 271 additions and 63 deletions

View File

@ -120,8 +120,11 @@ Setting | Description
`{{getDate <date_managed_property> "<format>}}"` | Format the date with moment.ts according to the current language.
`{{getPreviewSrc item}}` | Determine the image thumbnail URL if applicable.
`{{getUrl item}}` | Get the item URL. For a document, it means the URL to the Office Online instance or the direct URL (to download it).
`{{getUrlField managed_propertyOWSURLH "URL/Title"}}` | Return the URL or Title part of a URL field managed property.
`{{getCountMessage totalRows <?keywords>}}` | Display a friendly message displaying the result and the entered keywords.
`{{<search_managed_property_name>}}` | Any valid search managed property returned in the results set. These are typically managed properties set in the *"Selected properties"* setting in the property pane. You don't need to prefix them with `item.` if you are in the "each" loop.
`{{webUrl}}` | The current web relative url. Use `{{../webUrl}}` inside a loop.
`{{siteUrl}}` | The current site relative url. Use `{{../siteUrl}}` inside a loop.
Also the [Handlebars helpers](https://github.com/helpers/handlebars-helpers) (188 helpers) are also available. You can also define your own in the *BaseTemplateService.ts* file.

View File

@ -1,7 +1,9 @@
'use strict';
const gulp = require('gulp');
const path = require('path');
const build = require('@microsoft/sp-build-web');
const bundleAnalyzer = require('webpack-bundle-analyzer');
/********************************************************************************************
* Adds an alias for handlebars in order to avoid errors while gulping the project
@ -27,9 +29,21 @@ build.configureWebpack.mergeConfig({
generatedConfiguration.node = {
fs: 'empty'
}
const lastDirName = path.basename(__dirname);
const dropPath = path.join(__dirname, 'temp', 'stats');
generatedConfiguration.plugins.push(new bundleAnalyzer.BundleAnalyzerPlugin({
openAnalyzer: false,
analyzerMode: 'static',
reportFilename: path.join(dropPath, `${lastDirName}.stats.html`),
generateStatsFile: true,
statsFilename: path.join(dropPath, `${lastDirName}.stats.json`),
logLevel: 'error'
}));
return generatedConfiguration;
}
});
build.initialize(gulp);

View File

@ -2169,9 +2169,9 @@
}
},
"@types/fabric": {
"version": "1.5.37",
"resolved": "https://registry.npmjs.org/@types/fabric/-/fabric-1.5.37.tgz",
"integrity": "sha512-SBgayDbEmiZ8VYDNqHd3vdqx0qjuCjt9X1B8fZ1aJRtHjGFxj6CRE+v/l7nnKEtJNfb4g/4HVNwD694/1hQMqg=="
"version": "1.5.40",
"resolved": "https://registry.npmjs.org/@types/fabric/-/fabric-1.5.40.tgz",
"integrity": "sha512-fs+hmCkRw9SRrwu61MuVD6ZeBzY9XVKzi42mLDgKpysQ5pILX+p7JL2XZlBhi0ygii1lxZjU1e/LgVarIflfQg=="
},
"@types/finalhandler": {
"version": "0.0.31",
@ -2234,9 +2234,9 @@
}
},
"@types/handlebars": {
"version": "4.0.38",
"resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.38.tgz",
"integrity": "sha512-oMzU0D7jDp+H2go/i0XqBHfr+HEhYD/e1TvkhHi3yrhQm/7JFR8FJMdvoH76X8G1FBpgc6Pwi+QslCJBeJ1N9g=="
"version": "4.0.39",
"resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.39.tgz",
"integrity": "sha512-vjaS7Q0dVqFp85QhyPSZqDKnTTCemcSHNHFvDdalO1s0Ifz5KuE64jQD5xoUkfdWwF4WpqdJEl7LsWH8rzhKJA=="
},
"@types/karma": {
"version": "0.13.33",
@ -3295,6 +3295,12 @@
"integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=",
"dev": true
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -3881,6 +3887,25 @@
"callsite": "1.0.0"
}
},
"bfj-node4": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/bfj-node4/-/bfj-node4-5.3.1.tgz",
"integrity": "sha512-SOmOsowQWfXc7ybFARsK3C4MCOWzERaOMV/Fl3Tgjs+5dJWyzo3oa127jL44eMbQiAN17J7SvAs2TRxEScTUmg==",
"dev": true,
"requires": {
"bluebird": "3.5.1",
"check-types": "7.4.0",
"tryer": "1.0.1"
},
"dependencies": {
"bluebird": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==",
"dev": true
}
}
},
"big.js": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz",
@ -4351,6 +4376,12 @@
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=",
"dev": true
},
"check-types": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/check-types/-/check-types-7.4.0.tgz",
"integrity": "sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg==",
"dev": true
},
"chokidar": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
@ -5630,6 +5661,12 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"dev": true
},
"ejs": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz",
"integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==",
"dev": true
},
"electron-to-chromium": {
"version": "1.3.50",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz",
@ -6547,6 +6584,12 @@
"minimatch": "3.0.4"
}
},
"filesize": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz",
"integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==",
"dev": true
},
"fill-range": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz",
@ -9172,6 +9215,24 @@
"glogg": "1.0.1"
}
},
"gzip-size": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-4.1.0.tgz",
"integrity": "sha1-iuCWJX6r59acRb4rZ8RIEk/7UXw=",
"dev": true,
"requires": {
"duplexer": "0.1.1",
"pify": "3.0.0"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"handlebars": {
"version": "4.0.11",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz",
@ -9184,9 +9245,9 @@
}
},
"handlebars-helpers": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/handlebars-helpers/-/handlebars-helpers-0.8.2.tgz",
"integrity": "sha1-jg232KkYSyVXIyEyFqpmh0KgpN0=",
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/handlebars-helpers/-/handlebars-helpers-0.8.4.tgz",
"integrity": "sha1-+YgLeujYkOYxoxRvAZBQAFxU7RI=",
"requires": {
"arr-filter": "1.1.2",
"arr-flatten": "1.1.0",
@ -13673,17 +13734,49 @@
"integrity": "sha512-VwGbHIT89e+9XdGcb2gdPgKgYQGjRG5peyPNO982znlCSB/UIM9g7gF6JmHpaMHb8xvEScY7UGJ8GRz6GQVBRg=="
},
"office-ui-fabric-react": {
"version": "5.21.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-5.21.0.tgz",
"integrity": "sha512-9IBLK6JUWYvdCumKywjkSP7mf/MqTRorP1qXtb2c+w2fQJH4NkdBjanO0zr37c5VPwlqc0KvPf51E9t1NU7oTg==",
"version": "5.118.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-5.118.0.tgz",
"integrity": "sha512-foDTN918nHDoBrotjviSJWrmR+eGJj6nWkNT8pGcyQIrrw09/TIeihAmNbMmsu8RewLltDlvC2SiSkny6N0iLw==",
"requires": {
"@microsoft/load-themed-styles": "1.7.53",
"@uifabric/icons": "5.7.1",
"@uifabric/icons": "5.8.0",
"@uifabric/merge-styles": "5.17.1",
"@uifabric/styling": "5.31.0",
"@uifabric/utilities": "5.27.0",
"@uifabric/styling": "5.31.2",
"@uifabric/utilities": "5.34.1",
"prop-types": "15.6.2",
"tslib": "1.8.1"
},
"dependencies": {
"@uifabric/icons": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-5.8.0.tgz",
"integrity": "sha512-EUhKxYlIPJshg4fQvCNTYSk0p7RhzEWeEAJBV4sao1SKmN0/pZBnkLbDqWjU5VUfdwZZYiIdaLRpM+pyzhniZw==",
"requires": {
"@uifabric/styling": "5.31.2",
"tslib": "1.8.1"
}
},
"@uifabric/styling": {
"version": "5.31.2",
"resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-5.31.2.tgz",
"integrity": "sha512-G7grRENxdB4NcUEtQmSisRDnIeQHQmAfcpIe5AWmVQxnB/e8U/jT+SzYqK6V12SnLf4ufN5nepZkdOjgbtuA1Q==",
"requires": {
"@microsoft/load-themed-styles": "1.7.53",
"@uifabric/merge-styles": "5.17.1",
"@uifabric/utilities": "5.34.1",
"tslib": "1.8.1"
}
},
"@uifabric/utilities": {
"version": "5.34.1",
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-5.34.1.tgz",
"integrity": "sha512-xUZ+KlCxmA9PCEOtutfeyYnPmySkEVA/ak3fb8Uj54684GlbrnlqrfNEencVG5YgQDcNEaztTwxW3I7jSCrYJQ==",
"requires": {
"@uifabric/merge-styles": "5.17.1",
"prop-types": "15.6.2",
"tslib": "1.8.1"
}
}
}
},
"on-finished": {
@ -13716,6 +13809,12 @@
"integrity": "sha1-QsPhjslUZra/DcQvOilFw/DK2Pw=",
"dev": true
},
"opener": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz",
"integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=",
"dev": true
},
"optimist": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
@ -18123,6 +18222,12 @@
"integrity": "sha1-jbAWIuh35RuDFAyu58gIZK05DII=",
"dev": true
},
"tryer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz",
"integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==",
"dev": true
},
"tslib": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz",
@ -19035,6 +19140,73 @@
}
}
},
"webpack-bundle-analyzer": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-2.13.1.tgz",
"integrity": "sha512-rwxyfecTAxoarCC9VlHlIpfQCmmJ/qWD5bpbjkof+7HrNhTNZIwZITxN6CdlYL2axGmwNUQ+tFgcSOiNXMf/sQ==",
"dev": true,
"requires": {
"acorn": "5.7.1",
"bfj-node4": "5.3.1",
"chalk": "2.4.1",
"commander": "2.16.0",
"ejs": "2.6.1",
"express": "4.16.3",
"filesize": "3.6.1",
"gzip-size": "4.1.0",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"opener": "1.4.3",
"ws": "4.1.0"
},
"dependencies": {
"acorn": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",
"integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "1.9.2"
}
},
"chalk": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"dev": true,
"requires": {
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "5.4.0"
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "3.0.0"
}
},
"ws": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
"integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
"dev": true,
"requires": {
"async-limiter": "1.0.0",
"safe-buffer": "5.1.2"
}
}
}
},
"webpack-dev-middleware": {
"version": "1.12.2",
"resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz",

View File

@ -11,49 +11,50 @@
"test": "gulp test"
},
"dependencies": {
"react": "15.6.2",
"react-dom": "15.6.2",
"@types/react": "15.6.6",
"@types/react-dom": "15.5.6",
"@microsoft/sp-loader": "1.5.1-plusbeta",
"@microsoft/decorators": "1.5.1-plusbeta",
"@microsoft/sp-application-base": "1.5.1-plusbeta",
"@microsoft/sp-core-library": "1.5.1-plusbeta",
"@microsoft/sp-webpart-base": "1.5.1-plusbeta",
"@microsoft/sp-dialog": "1.5.1-plusbeta",
"@microsoft/sp-loader": "1.5.1-plusbeta",
"@microsoft/sp-lodash-subset": "1.5.1-plusbeta",
"@microsoft/sp-office-ui-fabric-core": "1.5.1-plusbeta",
"@types/webpack-env": "1.13.1",
"@types/es6-promise": "0.0.33",
"@microsoft/sp-webpart-base": "1.5.1-plusbeta",
"@pnp/common": "1.0.3",
"@pnp/logging": "1.0.3",
"@pnp/odata": "1.0.3",
"@pnp/sp": "1.0.3",
"@pnp/spfx-controls-react": "1.5.0",
"@pnp/spfx-property-controls": "1.7.0",
"@types/fabric": "^1.5.34",
"@types/handlebars": "^4.0.38",
"@types/es6-promise": "0.0.33",
"@types/fabric": "^1.5.40",
"@types/handlebars": "^4.0.39",
"@types/react": "15.6.6",
"@types/react-dom": "15.5.6",
"@types/sharepoint": "2013.1.9",
"@types/webpack-env": "1.13.1",
"common-tags": "^1.8.0",
"downshift": "^1.31.14",
"handlebars": "4.0.11",
"handlebars-helpers": "0.8.2",
"handlebars-helpers": "0.8.4",
"immutability-helper": "2.4.0",
"lodash-es": "4.17.4",
"moment": "2.21.0",
"office-ui-fabric-react": "5.21.0",
"office-ui-fabric-react": "^5.118.0",
"react": "15.6.2",
"react-ace": "^6.1.1",
"react-custom-scrollbars": "4.1.2",
"react-js-pagination": "3.0.0",
"@microsoft/decorators": "1.5.1-plusbeta",
"@microsoft/sp-dialog": "1.5.1-plusbeta",
"@microsoft/sp-application-base": "1.5.1-plusbeta"
"react-dom": "15.6.2",
"react-js-pagination": "3.0.0"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.5.1-plusbeta",
"@microsoft/sp-module-interfaces": "1.5.1-plusbeta",
"@microsoft/sp-webpart-workbench": "1.5.1-plusbeta",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2",
"unlazy-loader": "0.1.2"
"gulp": "~3.9.1",
"unlazy-loader": "0.1.2",
"webpack-bundle-analyzer": "^2.13.1"
}
}

View File

@ -1,13 +1,13 @@
import * as Handlebars from 'handlebars';
import { ISearchResult } from '../../models/ISearchResult';
import { html } from 'common-tags';
import { isEmpty } from '@microsoft/sp-lodash-subset';
import * as strings from 'SearchWebPartStrings';
import { Text } from '@microsoft/sp-core-library';
import * as moment from 'moment';
import * as Handlebars from 'handlebars';
import { ISearchResult } from '../../models/ISearchResult';
import { html } from 'common-tags';
import { isEmpty } from '@microsoft/sp-lodash-subset';
import * as strings from 'SearchWebPartStrings';
import { Text } from '@microsoft/sp-core-library';
import * as moment from 'moment';
abstract class BaseTemplateService {
constructor() {
// Registers all helpers
this.registerTemplateServices();
@ -111,11 +111,11 @@ abstract class BaseTemplateService {
* Registers useful helpers for search results templates
*/
private registerTemplateServices() {
// Return the URL of the search result item
// Usage: <a href="{{url item}}">
Handlebars.registerHelper("getUrl", (item: ISearchResult) => {
if (!isEmpty(item))
if (!isEmpty(item))
return item.ServerRedirectedURL ? item.ServerRedirectedURL : item.Path;
});
@ -156,7 +156,17 @@ abstract class BaseTemplateService {
Handlebars.registerHelper("getDate", (date: string, format: string) => {
if (moment(date).isValid()) {
return moment(date).format(format);
}
}
});
// Return the URL or Title part of a URL automatic managed property
// <p>{{getDate MyLinkOWSURLH "Title"}}</p>
Handlebars.registerHelper("getUrlField", (urlField: string, value: "URL" | "Title" ) => {
let separatorPos = urlField.lastIndexOf(",");
if(value === "URL") {
return urlField.substr(0, separatorPos);
}
return urlField.substr(separatorPos+1).trim();
});
}

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { Dialog, DialogType, DialogFooter } from 'office-ui-fabric-react';
import { Button, ButtonType, Label } from 'office-ui-fabric-react';
import { TextField } from 'office-ui-fabric-react';
import { Dialog, DialogType, DialogFooter } from 'office-ui-fabric-react/lib/Dialog';
import { Button, ButtonType } from 'office-ui-fabric-react/lib/Button';
import { Label } from 'office-ui-fabric-react/lib/Label';
import { ITextDialogProps } from './ITextDialogProps';
import { ITextDialogState } from './ITextDialogState';
import AceEditor from 'react-ace';

View File

@ -3,16 +3,12 @@
"id": "42ad2740-3c60-49cf-971a-c44e33511b93",
"alias": "SearchWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"preconfiguredEntries": [
{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
"group": {
"default": "PnP"
},

View File

@ -547,7 +547,8 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart<ISearchR
showBlank: this.properties.showBlank,
displayMode: this.displayMode,
templateService: this._templateService,
templateContent: this._templateContentToDisplay
templateContent: this._templateContentToDisplay,
context: this.context
} as ISearchContainerProps
);
@ -581,23 +582,24 @@ export default class SearchResultsWebPart extends BaseClientSideWebPart<ISearchR
return {
pages: [
{
header: {
description: "Query settings"
},
groups: [
{
groupName: strings.SearchQuerySettingsGroupName,
groupFields: this._getSearchQueryFields()
groupFields: this._getSearchQueryFields(),
isCollapsed: false
},
{
groupName: strings.SearchSettingsGroupName,
groupFields: this._getSearchSettingsFields()
groupFields: this._getSearchSettingsFields(),
isCollapsed: false
},
],
displayGroupsAsAccordion: true
},
{
groups: [
{
groupName: strings.StylingSettingsGroupName,
groupFields: this._getStylingFields()
groupFields: this._getStylingFields(),
isCollapsed: false
}
],
displayGroupsAsAccordion: true

View File

@ -16,7 +16,7 @@ import {
IGroupDividerProps
} from 'office-ui-fabric-react/lib/components/GroupedList/index';
import { Scrollbars } from 'react-custom-scrollbars';
import { ActionButton } from 'office-ui-fabric-react';
import { ActionButton } from 'office-ui-fabric-react/lib/Button';
export default class FilterPanel extends React.Component<IFilterPanelProps, IFilterPanelState> {

View File

@ -8,6 +8,8 @@ interface ISearchResultsTemplateContext {
totalRows: number;
keywords: string;
showResultsCount: boolean;
siteUrl: string;
webUrl: string;
}
export default ISearchResultsTemplateContext;

View File

@ -2,6 +2,7 @@ import ISearchService from '../../../../services/SearchService/ISearchServi
import ITaxonomyService from '../../../../services/TaxonomyService/ITaxonomyService';
import { DisplayMode } from '@microsoft/sp-core-library';
import TemplateService from '../../../../services/TemplateService/TemplateService';
import { WebPartContext } from '@microsoft/sp-webpart-base';
interface ISearchResultsContainerProps {
@ -74,6 +75,11 @@ interface ISearchResultsContainerProps {
* The template raw content to display
*/
templateContent: string;
/**
* The web part context
*/
context: WebPartContext;
}
export default ISearchResultsContainerProps;

View File

@ -94,7 +94,9 @@ export default class SearchResultsContainer extends React.Component<ISearchConta
items: this.state.results.RelevantResults,
totalRows: this.state.resultCount,
keywords: this.props.queryKeywords,
showResultsCount: this.props.showResultsCount
showResultsCount: this.props.showResultsCount,
siteUrl: this.props.context.pageContext.site.serverRelativeUrl,
webUrl: this.props.context.pageContext.web.serverRelativeUrl
}
}
/>