77 lines
2.6 KiB
TypeScript
77 lines
2.6 KiB
TypeScript
import { ITermStore, ITermSet } from './ISPTermStorePickerService';
|
|
import { ISPTermStorePickerServiceProps } from './ISPTermStorePickerServiceProps';
|
|
import { IPickerTerm } from './IPickerTerm';
|
|
import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
|
|
/**
|
|
* Service implementation to manage term stores in SharePoint
|
|
*/
|
|
export default class SPTermStorePickerService {
|
|
private props;
|
|
private context;
|
|
private clientServiceUrl;
|
|
private suggestionServiceUrl;
|
|
/**
|
|
* Service constructor
|
|
*/
|
|
constructor(props: ISPTermStorePickerServiceProps, context: ApplicationCustomizerContext);
|
|
getTermLabels(termId: string): Promise<string[]>;
|
|
/**
|
|
* Gets the collection of term stores in the current SharePoint env
|
|
*/
|
|
getTermStores(): Promise<ITermStore[]>;
|
|
/**
|
|
* Gets the current term set
|
|
*/
|
|
getTermSet(): Promise<ITermSet>;
|
|
/**
|
|
* Retrieve all terms for the given term set
|
|
* @param termset
|
|
*/
|
|
getAllTerms(termset: string, hideDeprecatedTags?: boolean, hideTagsNotAvailableForTagging?: boolean, useSessionStorage?: boolean): Promise<ITermSet>;
|
|
/**
|
|
* Retrieve all terms that starts with the searchText
|
|
* @param searchText
|
|
*/
|
|
searchTermsByName(searchText: string): Promise<IPickerTerm[]>;
|
|
searchTermsByTermId(searchText: string, termId: string): Promise<IPickerTerm[]>;
|
|
/**
|
|
* Retrieve all terms for the given term set and anchorId
|
|
*/
|
|
getAllTermsByAnchorId(termsetNameOrID: string, anchorId: string, hideDeprecatedTags?: boolean, hideTagsNotAvailableForTagging?: boolean, useSessionStorage?: boolean): Promise<IPickerTerm[]>;
|
|
/**
|
|
* Clean the Guid from the Web Service response
|
|
* @param guid
|
|
*/
|
|
cleanGuid(guid: string): string;
|
|
/**
|
|
* Get the term set ID by its name
|
|
* @param termstore
|
|
* @param termset
|
|
*/
|
|
private getTermSetId(termstore, termsetName);
|
|
private getTermsById(termId, useSessionStorage?);
|
|
private searchTermsBySearchText(terms, searchText);
|
|
/**
|
|
* Searches terms for the given term set
|
|
* @param searchText
|
|
* @param termsetId
|
|
*/
|
|
private searchTermsByTermSet(searchText);
|
|
private isGuid(strGuid);
|
|
/**
|
|
* Sorting terms based on their path and depth
|
|
*
|
|
* @param terms
|
|
*/
|
|
private sortTerms(terms);
|
|
/**
|
|
* Sort the terms by their path
|
|
*
|
|
* @param a term 2
|
|
* @param b term 2
|
|
*/
|
|
private sortTermByPath(a, b);
|
|
private convertTermToPickerTerm(term);
|
|
private convertSuggestTermToPickerTerm(term);
|
|
}
|