diff --git a/samples/react-content-query-online/README.md b/samples/react-content-query-online/README.md
index a2880e160..1fa28ef36 100644
--- a/samples/react-content-query-online/README.md
+++ b/samples/react-content-query-online/README.md
@@ -283,16 +283,19 @@ Property | Description
`{{MyField.htmlValue}}` | Renders the HTML value of the field. For example, a *Link* field HTML value would render something like `My Link Field`
`{{MyField.rawValue}}` | Returns the raw value of the field. For example, a *Taxonomy* field raw value would return an object which contains the term `wssId` and its label
`{{MyField.jsonValue}}` | Returns a JSON object value of the field. For example, an *Image* field JSON value would return a JSON object which contains the `serverRelativeUrl` property
+`{{MyField.personValue}}` | Returns an object value of a person field. The `personValue` property provides `email`, `displayName` and `image` properties. The `image` property contains `small`, `medium`, and `large` properties, each of which pointing to the profile image URL for the small, medium, and large profile images.
+
##### Handlebars
```handlebars
{{#each items}}
-
MyUserField text value : {{MyUserField.textValue}}
-
MyUserField html value : {{MyUserField.htmlValue}}
-
MyUserField raw value : {{MyUserField.rawValue}}
+
MyField text value : {{MyField.textValue}}
+
MyField html value : {{MyField.htmlValue}}
+
MyField raw value : {{MyField.rawValue}}
MyImageField JSON value : {{MyImageField.jsonValue}}
+
MyPersonField person value : {{MyPersonField.personValue}}
{{/each}}
```
@@ -301,10 +304,11 @@ Property | Description
```html
-
MyUserField text value : Simon-Pierre Plante
-
MyUserField html value : Simon-Pierre Plante
-
MyUserField raw value : 26
+
MyField text value : Simon-Pierre Plante
+
MyField html value : Simon-Pierre Plante
+
MyField raw value : 26
MyImageField JSON value: [Object]
+
MyPersonField person value: [Object]
...
```
@@ -315,6 +319,12 @@ You can use `JSONValue` to parse complex fields -- such as image fields -- and d
```
+For fields containing person values (e.g.: the `Author`, `Editor` fields and **Person or Group** fields), you can use the `personValue` property to retrieve values such as `email`, `displayName`, and `image.small`, `image.medium`, `image.large`.
+
+```html
+
+```
+
### Including your own external scripts and/or block helpers
#### Including basic library files
diff --git a/samples/react-content-query-online/package-lock.json b/samples/react-content-query-online/package-lock.json
index 9567d1c6c..c549b7af8 100644
--- a/samples/react-content-query-online/package-lock.json
+++ b/samples/react-content-query-online/package-lock.json
@@ -12483,6 +12483,23 @@
"integrity": "sha1-5zA08A3MH0CHYAj9IP6ud71LfC8=",
"dev": true
},
+ "array-sort": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-0.1.4.tgz",
+ "integrity": "sha512-BNcM+RXxndPxiZ2rd76k6nyQLRZr2/B/sdi8pQ+Joafr5AH279L40dfokSUTp8O+AaqYjXWhblBWa2st2nc4fQ==",
+ "requires": {
+ "default-compare": "^1.0.0",
+ "get-value": "^2.0.6",
+ "kind-of": "^5.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
+ }
+ }
+ },
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
@@ -18708,23 +18725,6 @@
"to-gfm-code-block": "^0.1.1"
},
"dependencies": {
- "array-sort": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-0.1.4.tgz",
- "integrity": "sha512-BNcM+RXxndPxiZ2rd76k6nyQLRZr2/B/sdi8pQ+Joafr5AH279L40dfokSUTp8O+AaqYjXWhblBWa2st2nc4fQ==",
- "requires": {
- "default-compare": "^1.0.0",
- "get-value": "^2.0.6",
- "kind-of": "^5.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
- }
- }
- },
"for-in": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz",
diff --git a/samples/react-content-query-online/package.json b/samples/react-content-query-online/package.json
index 055a0faf5..685def351 100644
--- a/samples/react-content-query-online/package.json
+++ b/samples/react-content-query-online/package.json
@@ -34,7 +34,7 @@
"fstream": ">=1.0.12",
"growl": ">=1.10.0",
"handlebars": "^4.0.6",
- "handlebars-helpers": "^0.8.2",
+ "handlebars-helpers": "^0.8.4",
"hoek": ">=4.2.1",
"is-my-json-valid": ">=2.17.2",
"js-yaml": ">=3.13.1",
diff --git a/samples/react-content-query-online/src/common/dataContracts/INormalizedResult.ts b/samples/react-content-query-online/src/common/dataContracts/INormalizedResult.ts
index cd86737a5..aef9adc13 100644
--- a/samples/react-content-query-online/src/common/dataContracts/INormalizedResult.ts
+++ b/samples/react-content-query-online/src/common/dataContracts/INormalizedResult.ts
@@ -1,9 +1,9 @@
-import { IUserValue } from "./IUserValue";
+import { IPersonValue } from "./IPersonValue";
export interface INormalizedResult {
textValue: string;
htmlValue: string;
rawValue: any;
jsonValue: any;
- userValue?: IUserValue;
+ personValue?: IPersonValue;
}
diff --git a/samples/react-content-query-online/src/common/dataContracts/IPersonValue.ts b/samples/react-content-query-online/src/common/dataContracts/IPersonValue.ts
new file mode 100644
index 000000000..793748cef
--- /dev/null
+++ b/samples/react-content-query-online/src/common/dataContracts/IPersonValue.ts
@@ -0,0 +1,9 @@
+export interface IPersonValue {
+ email: string;
+ displayName: string;
+ picture: {
+ small: string;
+ medium: string;
+ large: string;
+ };
+}
diff --git a/samples/react-content-query-online/src/common/dataContracts/IUserValue.ts b/samples/react-content-query-online/src/common/dataContracts/IUserValue.ts
deleted file mode 100644
index 1b8f671e2..000000000
--- a/samples/react-content-query-online/src/common/dataContracts/IUserValue.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface IUserValue {
- email: string;
- name: string;
-}
diff --git a/samples/react-content-query-online/src/common/services/ContentQueryService.ts b/samples/react-content-query-online/src/common/services/ContentQueryService.ts
index 4644f9b6e..36cb93f9c 100644
--- a/samples/react-content-query-online/src/common/services/ContentQueryService.ts
+++ b/samples/react-content-query-online/src/common/services/ContentQueryService.ts
@@ -16,6 +16,7 @@ import { SearchService } from './SearchService';
import { PeoplePickerService } from './PeoplePickerService';
import { TaxonomyService } from './TaxonomyService';
import { INormalizedResult } from '../dataContracts/INormalizedResult';
+import { IPersonValue } from '../dataContracts/IPersonValue';
export class ContentQueryService implements IContentQueryService {
@@ -610,25 +611,9 @@ export class ContentQueryService implements IContentQueryService {
textValue: result.FieldValuesAsText[formattedName],
htmlValue: htmlValue,
rawValue: result[viewField] || result[viewField + 'Id'],
- jsonValue: this.jsonParseField(result[viewField] || result[viewField + 'Id'])
+ jsonValue: this.jsonParseField(result[viewField] || result[viewField + 'Id']),
+ personValue: this.extractPersonInfo(htmlValue)
};
-
- // Try to extract the user email and name
- const sipIndex = htmlValue.indexOf(`sip='`);
- if (sipIndex > -1) {
- // Get the email address
- const sipValue = htmlValue.substring(sipIndex + 5, htmlValue.indexOf(`'`, sipIndex + 5));
- const anchorEnd: number = htmlValue.lastIndexOf('');
- const anchorStart: number = htmlValue.substring(0, anchorEnd).lastIndexOf('>');
- const name: string = htmlValue.substring(anchorStart + 1, anchorEnd);
-
- normalizedResult[viewField].userValue = {
- email: sipValue,
- displayName: name
- };
-
- }
-
}
return normalizedResult;
@@ -657,6 +642,50 @@ export class ContentQueryService implements IContentQueryService {
return value;
}
+ /**
+ * Returns user profile information based on a user field
+ * @param htmlValue : A string representation of the HTML field rendering
+ * This function does a very rudimentary extraction of user information based on very limited
+ * HTML parsing. We need to update this in the future to make it more sturdy.
+ */
+ private extractPersonInfo(htmlValue: string): IPersonValue {
+
+ try {
+ const sipIndex = htmlValue.indexOf(`sip='`);
+ if (sipIndex === -1) {
+ return null;
+ }
+ // Try to extract the user email and name
+
+ // Get the email address -- we should use RegExp for this, but I suck at RegExp
+ const sipValue = htmlValue.substring(sipIndex + 5, htmlValue.indexOf(`'`, sipIndex + 5));
+ const anchorEnd: number = htmlValue.lastIndexOf('');
+ const anchorStart: number = htmlValue.substring(0, anchorEnd).lastIndexOf('>');
+ const name: string = htmlValue.substring(anchorStart + 1, anchorEnd);
+
+ // Generate picture URLs
+ const smallPictureUrl: string = `/_layouts/15/userphoto.aspx?size=S&username=${sipValue}`;
+ const medPictureUrl: string = `/_layouts/15/userphoto.aspx?size=M&username=${sipValue}`;
+ const largePictureUrl: string = `/_layouts/15/userphoto.aspx?size=L&username=${sipValue}`;
+
+
+ let result: IPersonValue = {
+ email: sipValue,
+ displayName: name,
+ picture: {
+ small: smallPictureUrl,
+ medium: medPictureUrl,
+ large: largePictureUrl
+ }
+ };
+ return result;
+
+ } catch (error) {
+
+ return null;
+ }
+ }
+
/**************************************************************************************************
* Returns an error message based on the specified error object
diff --git a/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.manifest.json b/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.manifest.json
index 1b5e0fd1b..2b01f8d83 100644
--- a/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.manifest.json
+++ b/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.manifest.json
@@ -19,7 +19,8 @@
},
"officeFabricIconFontName": "QueryList",
"properties": {
- "description": "Content Query"
+ "description": "Content Query",
+ "enableMGT": false
}
}]
}
diff --git a/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.ts b/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.ts
index f5c26751f..a046f3d0e 100644
--- a/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.ts
+++ b/samples/react-content-query-online/src/webparts/contentQuery/ContentQueryWebPart.ts
@@ -1,35 +1,35 @@
-import * as React from 'react';
-import * as ReactDom from 'react-dom';
-import * as strings from 'contentQueryStrings';
-import { Version, Text, Log } from '@microsoft/sp-core-library';
-import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
-import { IPropertyPaneConfiguration, IPropertyPaneField } from "@microsoft/sp-property-pane";
-import { IPropertyPaneTextFieldProps, PropertyPaneTextField } from "@microsoft/sp-property-pane";
-import { IPropertyPaneChoiceGroupProps, PropertyPaneChoiceGroup } from "@microsoft/sp-property-pane";
-import { } from "@microsoft/sp-webpart-base";
-import { IPropertyPaneToggleProps, PropertyPaneToggle } from "@microsoft/sp-property-pane";
-import { IPropertyPaneLabelProps, PropertyPaneLabel } from "@microsoft/sp-property-pane";
-import { IPropertyPaneButtonProps, PropertyPaneButton, PropertyPaneButtonType } from "@microsoft/sp-property-pane";
-import { update, get, isEmpty } from '@microsoft/sp-lodash-subset';
-import { IDropdownOption, IPersonaProps, ITag } from 'office-ui-fabric-react';
-import ContentQuery from './components/ContentQuery';
-import { IContentQueryProps } from './components/IContentQueryProps';
-import { IQuerySettings } from './components/IQuerySettings';
-import { IContentQueryTemplateContext } from './components/IContentQueryTemplateContext';
-import { IContentQueryWebPartProps } from './IContentQueryWebPartProps';
-import { PropertyPaneAsyncDropdown } from '../../controls/PropertyPaneAsyncDropdown/PropertyPaneAsyncDropdown';
-import { PropertyPaneQueryFilterPanel } from '../../controls/PropertyPaneQueryFilterPanel/PropertyPaneQueryFilterPanel';
-import { PropertyPaneAsyncChecklist } from '../../controls/PropertyPaneAsyncChecklist/PropertyPaneAsyncChecklist';
-import { PropertyPaneTextDialog } from '../../controls/PropertyPaneTextDialog/PropertyPaneTextDialog';
-import { IQueryFilterField } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilterField';
-import { IChecklistItem } from '../../controls/PropertyPaneAsyncChecklist/components/AsyncChecklist/IChecklistItem';
-import { ContentQueryService } from '../../common/services/ContentQueryService';
-import { IContentQueryService } from '../../common/services/IContentQueryService';
-import { ContentQueryConstants } from '../../common/constants/ContentQueryConstants';
-import { IDynamicDataPropertyDefinition } from '@microsoft/sp-dynamic-data';
-import { IDynamicDataCallables } from '@microsoft/sp-dynamic-data';
-import { IDynamicItem } from '../../common/dataContracts/IDynamicItem';
-import { ThemeProvider, ThemeChangedEventArgs, IReadonlyTheme } from '@microsoft/sp-component-base';
+import * as React from 'react';
+import * as ReactDom from 'react-dom';
+import * as strings from 'contentQueryStrings';
+import { Version, Text, Log } from '@microsoft/sp-core-library';
+import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
+import { IPropertyPaneConfiguration, IPropertyPaneField } from "@microsoft/sp-property-pane";
+import { IPropertyPaneTextFieldProps, PropertyPaneTextField } from "@microsoft/sp-property-pane";
+import { IPropertyPaneChoiceGroupProps, PropertyPaneChoiceGroup } from "@microsoft/sp-property-pane";
+import { } from "@microsoft/sp-webpart-base";
+import { IPropertyPaneToggleProps, PropertyPaneToggle } from "@microsoft/sp-property-pane";
+import { IPropertyPaneLabelProps, PropertyPaneLabel } from "@microsoft/sp-property-pane";
+import { IPropertyPaneButtonProps, PropertyPaneButton, PropertyPaneButtonType } from "@microsoft/sp-property-pane";
+import { update, get, isEmpty } from '@microsoft/sp-lodash-subset';
+import { IDropdownOption, IPersonaProps, ITag } from 'office-ui-fabric-react';
+import ContentQuery from './components/ContentQuery';
+import { IContentQueryProps } from './components/IContentQueryProps';
+import { IQuerySettings } from './components/IQuerySettings';
+import { IContentQueryTemplateContext } from './components/IContentQueryTemplateContext';
+import { IContentQueryWebPartProps } from './IContentQueryWebPartProps';
+import { PropertyPaneAsyncDropdown } from '../../controls/PropertyPaneAsyncDropdown/PropertyPaneAsyncDropdown';
+import { PropertyPaneQueryFilterPanel } from '../../controls/PropertyPaneQueryFilterPanel/PropertyPaneQueryFilterPanel';
+import { PropertyPaneAsyncChecklist } from '../../controls/PropertyPaneAsyncChecklist/PropertyPaneAsyncChecklist';
+import { PropertyPaneTextDialog } from '../../controls/PropertyPaneTextDialog/PropertyPaneTextDialog';
+import { IQueryFilterField } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilterField';
+import { IChecklistItem } from '../../controls/PropertyPaneAsyncChecklist/components/AsyncChecklist/IChecklistItem';
+import { ContentQueryService } from '../../common/services/ContentQueryService';
+import { IContentQueryService } from '../../common/services/IContentQueryService';
+import { ContentQueryConstants } from '../../common/constants/ContentQueryConstants';
+import { IDynamicDataPropertyDefinition } from '@microsoft/sp-dynamic-data';
+import { IDynamicDataCallables } from '@microsoft/sp-dynamic-data';
+import { IDynamicItem } from '../../common/dataContracts/IDynamicItem';
+import { ThemeProvider, ThemeChangedEventArgs, IReadonlyTheme } from '@microsoft/sp-component-base';
import { Providers, SharePointProvider } from '@microsoft/mgt';
@@ -97,10 +97,7 @@ export default class ContentQueryWebPart
// Register a handler to be notified if the theme variant changes
this._themeProvider.themeChangedEvent.add(this, this._handleThemeChangedEvent);
- // ADDED: For MGT support
- Providers.globalProvider = new SharePointProvider(this.context);
-
- return new Promise((resolve, reject) => {
+ return new Promise((resolve, _reject) => {
this.ContentQueryService = new ContentQueryService(this.context, this.context.spHttpClient);
this.properties.webUrl = this.properties.siteUrl || this.properties.webUrl ? this.properties.webUrl : this.context.pageContext.web.absoluteUrl.toLocaleLowerCase().trim();
this.properties.siteUrl = this.properties.siteUrl ? this.properties.siteUrl : this.context.pageContext.site.absoluteUrl.toLowerCase().trim();
@@ -117,6 +114,10 @@ export default class ContentQueryWebPart
// Select a dummy item
this.selectedItem = { webUrl: '', listId: '', itemId: -1 };
+ if (this.properties.enableMGT === undefined) {
+ this.properties.enableMGT = false;
+ }
+
resolve();
});
}
@@ -137,6 +138,12 @@ export default class ContentQueryWebPart
viewFields: this.properties.viewFields,
};
+ // Enable MGT support if provider isn't registered and we requested MGT support
+ if (this.properties.enableMGT && Providers.globalProvider === undefined) {
+ Providers.globalProvider = new SharePointProvider(this.context);
+ }
+
+
const element: React.ReactElement = React.createElement(ContentQuery,
{
onLoadTemplate: this.loadTemplate.bind(this),
@@ -308,7 +315,7 @@ export default class ContentQueryWebPart
{
groupName: strings.SourceGroupName,
groupFields: [
- PropertyPaneLabel(ContentQueryConstants.propertySiteUrl,{
+ PropertyPaneLabel(ContentQueryConstants.propertySiteUrl, {
text: strings.SourcePageDescription
}),
this.siteUrlDropdown,
@@ -316,15 +323,10 @@ export default class ContentQueryWebPart
this.listTitleDropdown
]
},
- // ]
- // },
- // {
- // header: { description: strings.QueryPageDescription },
- // groups: [
{
groupName: strings.QueryGroupName,
groupFields: [
- PropertyPaneLabel(ContentQueryConstants.propertyOrderBy,{
+ PropertyPaneLabel(ContentQueryConstants.propertyOrderBy, {
text: strings.QueryPageDescription
}),
this.orderByDropdown,
@@ -335,15 +337,10 @@ export default class ContentQueryWebPart
this.filtersPanel
]
},
- // ]
- // },
- // {
- // header: { description: strings.DisplayPageDescription },
- // groups: [
{
groupName: strings.DisplayGroupName,
groupFields: [
- PropertyPaneLabel(ContentQueryConstants.propertyViewFields,{
+ PropertyPaneLabel(ContentQueryConstants.propertyViewFields, {
text: strings.DisplayPageDescription
}),
this.viewFieldsChecklist,
@@ -353,18 +350,19 @@ export default class ContentQueryWebPart
this.templateUrlTextField
]
},
- // ]
- // },
- // {
- // header: { description: strings.ExternalPageDescription },
- // groups: [
{
groupName: strings.ExternalGroupName,
groupFields: [
- PropertyPaneLabel(ContentQueryConstants.propertyExternalScripts,{
+ PropertyPaneLabel(ContentQueryConstants.propertyExternalScripts, {
text: strings.ExternalPageDescription
}),
- this.externalScripts
+ this.externalScripts,
+ PropertyPaneToggle("enableMGT", {
+ label: "Microsoft Graph Toolkit support",
+ checked: this.properties.enableMGT,
+ offText: "Disabled",
+ onText: "Enabled"
+ })
]
}
]
@@ -427,14 +425,14 @@ export default class ContentQueryWebPart
/***************************************************************************
* Loads the HandleBars template from the specified url
***************************************************************************/
- private loadTemplate(templateUrl:string): Promise {
+ private loadTemplate(templateUrl: string): Promise {
return this.ContentQueryService.getFileContent(templateUrl);
}
/***************************************************************************
* Loads the HandleBars context based on the specified query
***************************************************************************/
- private loadTemplateContext(querySettings:IQuerySettings, callTimeStamp: number): Promise {
+ private loadTemplateContext(querySettings: IQuerySettings, callTimeStamp: number): Promise {
return this.ContentQueryService.getTemplateContext(querySettings, callTimeStamp);
}
@@ -469,14 +467,14 @@ export default class ContentQueryWebPart
/***************************************************************************
* Loads the dropdown options for the listTitle property
***************************************************************************/
- private loadFilterFields():Promise {
+ private loadFilterFields(): Promise {
return this.ContentQueryService.getFilterFields(this.properties.webUrl, this.properties.listId);
}
/***************************************************************************
* Loads the checklist items for the viewFields property
***************************************************************************/
- private loadViewFieldsChecklistItems():Promise {
+ private loadViewFieldsChecklistItems(): Promise {
return this.ContentQueryService.getViewFieldsChecklistItems(this.properties.webUrl, this.properties.listId);
}
@@ -486,7 +484,7 @@ export default class ContentQueryWebPart
* @param currentPersonas : The IPersonaProps already selected in the people picker
* @param limitResults : The results limit if any
***************************************************************************/
- private loadPeoplePickerSuggestions(filterText: string, currentPersonas: IPersonaProps[], limitResults?: number):Promise {
+ private loadPeoplePickerSuggestions(filterText: string, currentPersonas: IPersonaProps[], limitResults?: number): Promise {
return this.ContentQueryService.getPeoplePickerSuggestions(this.properties.webUrl, filterText, currentPersonas, limitResults);
}
@@ -497,7 +495,7 @@ export default class ContentQueryWebPart
* @param currentPersonas : The IPersonaProps already selected in the people picker
* @param limitResults : The results limit if any
***************************************************************************/
- private loadTaxonomyPickerSuggestions(field: IQueryFilterField, filterText: string, currentTerms: ITag[]):Promise {
+ private loadTaxonomyPickerSuggestions(field: IQueryFilterField, filterText: string, currentTerms: ITag[]): Promise {
return this.ContentQueryService.getTaxonomyPickerSuggestions(this.properties.webUrl, this.properties.listId, field, filterText, currentTerms);
}
@@ -517,7 +515,7 @@ export default class ContentQueryWebPart
this.resetDependentPropertyPanes(propertyPath);
// If the viewfields have changed, update the default template text if it hasn't been altered by the user
- if(propertyPath == ContentQueryConstants.propertyViewFields && !this.properties.hasDefaultTemplateBeenUpdated) {
+ if (propertyPath == ContentQueryConstants.propertyViewFields && !this.properties.hasDefaultTemplateBeenUpdated) {
let generatedTemplate = this.ContentQueryService.generateDefaultTemplate(newValue, this.properties.itemSelectorEnabled);
update(this.properties, ContentQueryConstants.propertyTemplateText, (): any => { return generatedTemplate; });
this.templateTextDialog.properties.dialogTextFieldValue = generatedTemplate;
@@ -525,7 +523,7 @@ export default class ContentQueryWebPart
}
// If the templateText have changed, update the "hasDefaultTemplateBeenUpdated" to true so the WebPart doesn't override the user template after updating view fields
- if(propertyPath == ContentQueryConstants.propertyTemplateText && !this.properties.hasDefaultTemplateBeenUpdated) {
+ if (propertyPath == ContentQueryConstants.propertyTemplateText && !this.properties.hasDefaultTemplateBeenUpdated) {
update(this.properties, ContentQueryConstants.propertyhasDefaultTemplateBeenUpdated, (): any => { return true; });
}
@@ -534,7 +532,7 @@ export default class ContentQueryWebPart
if (!this.disableReactivePropertyChanges)
this.render();
- if(rerenderTemplateTextDialog) {
+ if (rerenderTemplateTextDialog) {
this.templateTextDialog.render();
}
}
@@ -548,21 +546,21 @@ export default class ContentQueryWebPart
return new Promise((resolve, reject) => {
// Doesn't raise any error if file is empty (otherwise error message will show on initial load...)
- if(isEmpty(value)) {
+ if (isEmpty(value)) {
resolve('');
}
// Resolves an error if the file isn't a valid .htm or .html file
- else if(!this.ContentQueryService.isValidTemplateFile(value)) {
+ else if (!this.ContentQueryService.isValidTemplateFile(value)) {
resolve(strings.ErrorTemplateExtension);
}
// Resolves an error if the file doesn't answer a simple head request
else {
- this.ContentQueryService.ensureFileResolves(value).then((isFileResolving:boolean) => {
+ this.ContentQueryService.ensureFileResolves(value).then((isFileResolving: boolean) => {
resolve('');
})
- .catch((error) => {
- resolve(Text.format(strings.ErrorTemplateResolve, error));
- });
+ .catch((error) => {
+ resolve(Text.format(strings.ErrorTemplateResolve, error));
+ });
}
});
}
@@ -586,14 +584,14 @@ export default class ContentQueryWebPart
* Resets dependent property panes if needed
***************************************************************************/
private resetDependentPropertyPanes(propertyPath: string): void {
- if(propertyPath == ContentQueryConstants.propertySiteUrl) {
+ if (propertyPath == ContentQueryConstants.propertySiteUrl) {
this.resetWebUrlPropertyPane();
this.resetListTitlePropertyPane();
this.resetOrderByPropertyPane();
this.resetFiltersPropertyPane();
this.resetViewFieldsPropertyPane();
}
- else if(propertyPath == ContentQueryConstants.propertyWebUrl) {
+ else if (propertyPath == ContentQueryConstants.propertyWebUrl) {
this.resetListTitlePropertyPane();
this.resetOrderByPropertyPane();
this.resetFiltersPropertyPane();
diff --git a/samples/react-content-query-online/src/webparts/contentQuery/IContentQueryWebPartProps.ts b/samples/react-content-query-online/src/webparts/contentQuery/IContentQueryWebPartProps.ts
index cc2f1b7f1..767df3770 100644
--- a/samples/react-content-query-online/src/webparts/contentQuery/IContentQueryWebPartProps.ts
+++ b/samples/react-content-query-online/src/webparts/contentQuery/IContentQueryWebPartProps.ts
@@ -1,6 +1,4 @@
import { IQueryFilter } from "../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilter";
-import { IPropertyFieldSite } from "@pnp/spfx-property-controls/lib/PropertyFieldSitePicker";
-
export interface IContentQueryWebPartProps {
siteUrl: string;
@@ -19,4 +17,5 @@ export interface IContentQueryWebPartProps {
externalScripts: string;
itemSelectorEnabled: boolean;
idFieldForciblyAdded: boolean;
+ enableMGT: boolean;
}