UNPKG

spfx-kql-data-retriever

Version:

Search Query Service for retrieve data with Kql with Sharepoint 365

72 lines (64 loc) 2.36 kB
import { IPropertyPaneField, PropertyPaneTextField, PropertyPaneLabel, PropertyPaneSlider } from "@microsoft/sp-webpart-base"; import { strings } from './../loc/en-us'; export class SearchServicePane { public static GetKeywordQueryFields(keywordQueryValue: string): Array<IPropertyPaneField<any>> { const searchQueryConfigFields = new Array<IPropertyPaneField<any>>(); searchQueryConfigFields.push( PropertyPaneTextField('keywordQuery', { deferredValidationTime: 500, description: strings.SearchQueryKeywordsFieldDescription, label: strings.SearchQueryKeywordsFieldLabel, multiline: true, placeholder: strings.SearchQueryKeywordsFieldPlaceHolderText, resizable: true, value: keywordQueryValue, }) ); searchQueryConfigFields.push( PropertyPaneLabel('', { text: '' }), // dummy space PropertyPaneSlider('maxResultsCount', { label: strings.MaxResultsCount, max: 50, min: 1, showValue: true, step: 1, value: 50, }) ); return searchQueryConfigFields; } /* * * Determines the group fields for the search settings options inside the property pane */ public static GetSearchSettingsFields(templateQueryValue: string, sortList: string, selectedProperties: string): Array<IPropertyPaneField<any>> { // Sets up search settings fields const searchSettingsFields: Array<IPropertyPaneField<any>> = [ PropertyPaneTextField('templateQuery', { deferredValidationTime: 300, label: strings.QueryTemplateFieldLabel, multiline: true, placeholder: strings.SearchQueryPlaceHolderText, resizable: true, value: templateQueryValue }), PropertyPaneTextField('sortList', { deferredValidationTime: 300, description: strings.SortListDescription, label: strings.SortList, multiline: false, resizable: true, value: sortList }), PropertyPaneTextField('selectedProperties', { deferredValidationTime: 300, description: strings.SelectedPropertiesFieldDescription, label: strings.SelectedPropertiesFieldLabel, multiline: true, resizable: true, value: selectedProperties }), ]; return searchSettingsFields; } }