UNPKG

@raona/sp

Version:

Raona utilities to work with Sharepoint using pnp/sp

31 lines (30 loc) 1.5 kB
import { ITerm, ITermData } from "@pnp/sp-taxonomy"; export declare type PNPTerm = ITerm & ITermData; export declare class TermTree { private terms; private nameToPosition; private termPathToPosition; private guidToPosition; private childrenInfo; private parentInfo; private upperTerms; constructor(terms: PNPTerm[], keepTopLevelOrder?: boolean); getRootTermsOfTermSet(): PNPTerm[]; getRootTermNamesOfTermSet(): string[]; getChildrenTermsByTermName(termName: string): PNPTerm[]; getChildrenTermNamesByTermName(termName: string): string[]; getChildrenTermsByTermGuid(guid: string): PNPTerm[]; getChildrenTermNamesByTermGuid(guid: string): string[]; getTermsById(...guids: string[]): PNPTerm[]; getTermNamesById(...guids: string[]): string[]; getParenTermById(guid: string): PNPTerm; /** * Gets the parent chain optionally cutting it at certain depthLevel * @param childrenGuid the guid of the children taxonomy * @example tree -> A[B, C, D[E, F]], B[C, D] -> if you pass the guid from F and don't specify depth level, it will return F, D, A; if you specify a depthLevel of 0 it will return only A; etc. * @param [untilDepthLevel] Depth level starting from the upper parent from where you want to cut the chain * @returns parent chain */ getParentChain(childrenGuid: string, untilDepthLevel?: number): PNPTerm[]; termExistsOnTermSet(guid: string): boolean; }