Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// use CORS toggle
PropertyFieldToggleWithCallout("useCORS", {
disabled: isMock,
calloutTrigger: CalloutTriggers.Hover,
key: "useCORSFieldId",
label: strings.UseCORSFieldLabel,
//calloutWidth: 200,
calloutContent: React.createElement("p", {}, isMock ? strings.UseCORSFieldCalloutDisabled : strings.UseCORSFieldCallout),
onText: strings.CORSOn,
offText: strings.CORSOff,
checked: useCORS
}),
// cache duration slider
PropertyFieldSliderWithCallout("cacheDuration", {
calloutContent: React.createElement("div", {}, strings.CacheDurationFieldCallout),
calloutTrigger: CalloutTriggers.Hover,
calloutWidth: 200,
key: "cacheDurationFieldId",
label: strings.CacheDurationFieldLabel,
max: 1440,
min: 0,
step: 15,
showValue: true,
value: cacheDuration
}),
// how many items are we diplaying in a page
PropertyFieldNumber("maxEvents", {
key: "maxEventsFieldId",
label: strings.MaxEventsFieldLabel,
description: strings.MaxEventsFieldDescription,
value: maxEvents,
minValue: 0,
displayGroupsAsAccordion: true,
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.FeedSettingsGroupName,
groupFields: [
// feed type drop down. Add your own types in the drop-down list
PropertyPaneDropdown("feedType", {
label: strings.FeedTypeFieldLabel,
options: feedTypeOptions
}),
// feed url input box -- only if not using a mock provider
!isMock && PropertyFieldTextWithCallout("feedUrl", {
calloutTrigger: CalloutTriggers.Hover,
key: "feedUrlFieldId",
label: strings.FeedUrlFieldLabel,
calloutContent:
React.createElement("div", {}, strings.FeedUrlCallout),
calloutWidth: 200,
value: feedUrl,
placeholder: "https://",
deferredValidationTime: 200,
onGetErrorMessage: this._validateFeedUrl.bind(this)
}),
// how days ahead from today are we getting
PropertyPaneDropdown("dateRange", {
label: strings.DateRangeFieldLabel,
options: [
{ key: DateRange.OneWeek, text: strings.DateRangeOptionWeek },
{ key: DateRange.TwoWeeks, text: strings.DateRangeOptionTwoWeeks },
}),
// cache duration slider
PropertyFieldSliderWithCallout("cacheDuration", {
calloutContent: React.createElement("div", {}, strings.CacheDurationFieldCallout),
calloutTrigger: CalloutTriggers.Hover,
calloutWidth: 200,
key: "cacheDurationFieldId",
label: strings.CacheDurationFieldLabel,
max: 1440,
min: 0,
step: 15,
showValue: true,
value: cacheDuration
}),
// how many items are we diplaying in a page
PropertyFieldNumber("maxEvents", {
key: "maxEventsFieldId",
label: strings.MaxEventsFieldLabel,
description: strings.MaxEventsFieldDescription,
value: maxEvents,
minValue: 0,
disabled: false
}),
PropertyFieldNumber("maxTotal", {
key: "maxTotalFieldId",
label: strings.MaxTotalFieldLabel,
description: strings.MaxTotalFieldDescription,
value: maxTotal,
minValue: 0,
disabled: false
})
],
max: 1440,
min: 0,
step: 15,
showValue: true,
value: cacheDuration
}),
// how many items are we diplaying in a page
PropertyFieldNumber("maxEvents", {
key: "maxEventsFieldId",
label: strings.MaxEventsFieldLabel,
description: strings.MaxEventsFieldDescription,
value: maxEvents,
minValue: 0,
disabled: false
}),
PropertyFieldNumber("maxTotal", {
key: "maxTotalFieldId",
label: strings.MaxTotalFieldLabel,
description: strings.MaxTotalFieldDescription,
value: maxTotal,
minValue: 0,
disabled: false
})
],
}
]
}
]
};
}
{
displayGroupsAsAccordion: true,
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.FeedSettingsGroupName,
groupFields: [
// feed type drop down. Add your own types in the drop-down list
PropertyPaneDropdown("feedType", {
label: strings.FeedTypeFieldLabel,
options: feedTypeOptions
}),
// feed url input box -- only if not using a mock provider
!isMock && PropertyFieldTextWithCallout("feedUrl", {
calloutTrigger: CalloutTriggers.Hover,
key: "feedUrlFieldId",
label: strings.FeedUrlFieldLabel,
calloutContent:
React.createElement("div", {}, strings.FeedUrlCallout),
calloutWidth: 200,
value: feedUrl,
placeholder: "https://",
deferredValidationTime: 200,
onGetErrorMessage: this._validateFeedUrl.bind(this)
}),
// how days ahead from today are we getting
PropertyPaneDropdown("dateRange", {
label: strings.DateRangeFieldLabel,
options: [
{ key: DateRange.OneWeek, text: strings.DateRangeOptionWeek },
onChanged: (fieldValue) => onUpdate(field.id, fieldValue),
strings: {
cancelButtonText: strings.CancelButtonText,
dialogButtonText: strings.DialogButtonText,
dialogTitle: strings.DialogTitle,
saveButtonText: strings.SaveButtonText
}
})
)
);
}
},
{
id: 'externalTemplateUrl',
title: strings.ResultTypes.ExternalUrlLabel,
type: CustomCollectionFieldType.url,
onGetErrorMessage: this._onTemplateUrlChange.bind(this),
placeholder: 'https://mysite/Documents/external.html'
},
]
})
);
}
// Only show the template external URL for 'Custom' option
if (this.properties.selectedLayout === ResultsLayoutOption.Custom) {
stylingFields.splice(6, 0, PropertyPaneTextField('externalTemplateUrl', {
label: strings.TemplateUrlFieldLabel,
placeholder: strings.TemplateUrlPlaceholder,
deferredValidationTime: 500,
onGetErrorMessage: this._onTemplateUrlChange.bind(this)
}));
}
text: strings.UseCorsFieldDescription
}),
// use CORS toggle
PropertyFieldToggleWithCallout("useCORS", {
disabled: isMock,
calloutTrigger: CalloutTriggers.Hover,
key: "useCORSFieldId",
label: strings.UseCORSFieldLabel,
//calloutWidth: 200,
calloutContent: React.createElement("p", {}, isMock ? strings.UseCORSFieldCalloutDisabled : strings.UseCORSFieldCallout),
onText: strings.CORSOn,
offText: strings.CORSOff,
checked: useCORS
}),
// cache duration slider
PropertyFieldSliderWithCallout("cacheDuration", {
calloutContent: React.createElement("div", {}, strings.CacheDurationFieldCallout),
calloutTrigger: CalloutTriggers.Hover,
calloutWidth: 200,
key: "cacheDurationFieldId",
label: strings.CacheDurationFieldLabel,
max: 1440,
min: 0,
step: 15,
showValue: true,
value: cacheDuration
}),
// how many items are we diplaying in a page
PropertyFieldNumber("maxEvents", {
key: "maxEventsFieldId",
label: strings.MaxEventsFieldLabel,
description: strings.MaxEventsFieldDescription,
PropertyPaneLabel('convertFromUTC', {
text: strings.ConvertFromUTCFieldDescription
}),
// Convert from UTC toggle
PropertyPaneToggle("convertFromUTC", {
key: "convertFromUTCFieldId",
label: strings.ConvertFromUTCLabel,
onText: strings.ConvertFromUTCOptionYes,
offText: strings.ConvertFromUTCOptionNo,
checked: convertFromUTC,
}),
PropertyPaneLabel('useCORS', {
text: strings.UseCorsFieldDescription
}),
// use CORS toggle
PropertyFieldToggleWithCallout("useCORS", {
disabled: isMock,
calloutTrigger: CalloutTriggers.Hover,
key: "useCORSFieldId",
label: strings.UseCORSFieldLabel,
//calloutWidth: 200,
calloutContent: React.createElement("p", {}, isMock ? strings.UseCORSFieldCalloutDisabled : strings.UseCORSFieldCallout),
onText: strings.CORSOn,
offText: strings.CORSOff,
checked: useCORS
}),
// cache duration slider
PropertyFieldSliderWithCallout("cacheDuration", {
calloutContent: React.createElement("div", {}, strings.CacheDurationFieldCallout),
calloutTrigger: CalloutTriggers.Hover,
calloutWidth: 200,
key: "cacheDurationFieldId",
if (!this.properties.customTemplateFieldValues) {
this.properties.customTemplateFieldValues = currentCodeRenderer.customFields.map(field => {
return {
fieldName: field,
searchProperty: ''
};
});
}
if (currentCodeRenderer.customFields && currentCodeRenderer.customFields.length > 0) {
const searchPropertyOptions = this.properties.selectedProperties.split(',').map(prop => {
return ({
key: prop,
text: prop
});
});
stylingFields.push(PropertyFieldCollectionData('customTemplateFieldValues', {
key: 'customTemplateFieldValues',
label: strings.customTemplateFieldsLabel,
panelHeader: strings.customTemplateFieldsPanelHeader,
manageBtnLabel: strings.customTemplateFieldsConfigureButtonLabel,
value: this.properties.customTemplateFieldValues,
fields: [
{
id: 'fieldName',
title: strings.customTemplateFieldTitleLabel,
type: CustomCollectionFieldType.string,
},
{
id: 'searchProperty',
title: strings.customTemplateFieldPropertyLabel,
type: CustomCollectionFieldType.dropdown,
options: searchPropertyOptions
];
console.log(stylingFields);
if (!this.codeRendererIsSelected()) {
stylingFields.push(
this._propertyFieldCodeEditor('inlineTemplateText', {
label: strings.DialogButtonLabel,
panelTitle: strings.DialogTitle,
initialValue: this._templateContentToDisplay,
deferredValidationTime: 500,
onPropertyChange: this.onPropertyPaneFieldChanged,
properties: this.properties,
disabled: !canEditTemplate,
key: 'inlineTemplateTextCodeEditor',
language: this._propertyFieldCodeEditorLanguages.Handlebars
}),
PropertyFieldCollectionData('resultTypes', {
manageBtnLabel: strings.ResultTypes.EditResultTypesLabel,
key: 'resultTypes',
panelHeader: strings.ResultTypes.EditResultTypesLabel,
panelDescription: strings.ResultTypes.ResultTypesDescription,
enableSorting: true,
label: strings.ResultTypes.ResultTypeslabel,
value: this.properties.resultTypes,
fields: [
{
id: 'property',
title: strings.ResultTypes.ConditionPropertyLabel,
type: CustomCollectionFieldType.string,
required: true,
},
{
id: 'operator',