Bump version to 1.1.4, remove unnecessary external dependency, and update term sorting logic
This commit is contained in:
@@ -40,7 +40,7 @@ export default class MegaMenuApplicationCustomizer
|
||||
const debug: boolean = this._isDebugEnabled();
|
||||
debugLog(debug, LOG_SOURCE, 'onInit started.', {
|
||||
componentId: UserCustomActionMegaMenuId,
|
||||
version: '1.1.3',
|
||||
version: '1.1.4',
|
||||
properties: this.properties || {},
|
||||
pageUrl: window.location.href,
|
||||
webUrl: this.context.pageContext.web.absoluteUrl,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { SPHttpClient, SPHttpClientResponse, ISPHttpClientOptions } from '@microsoft/sp-http';
|
||||
import { ITermStore, ITerms, ITerm, IGroup, ITermSet, ISuggestTerm } from './ISPTermStorePickerService';
|
||||
import { findIndex } from '@microsoft/sp-lodash-subset';
|
||||
import { ISPTermStorePickerServiceProps } from './ISPTermStorePickerServiceProps';
|
||||
import { IPickerTerm } from './IPickerTerm';
|
||||
import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
|
||||
@@ -587,7 +586,7 @@ export default class SPTermStorePickerService {
|
||||
// Last item is not needed for parent path
|
||||
pathElms.pop();
|
||||
// Find the parent item and add the new item
|
||||
const idx: number = findIndex(newTermsOrder, term => term.PathOfTerm === pathElms.join(';'));
|
||||
const idx: number = this.findTermIndexByPath(newTermsOrder, pathElms.join(';'));
|
||||
if (idx !== -1) {
|
||||
newTermsOrder.splice(idx + 1, 0, crntTerm);
|
||||
} else {
|
||||
@@ -607,6 +606,16 @@ export default class SPTermStorePickerService {
|
||||
return newTermsOrder;
|
||||
}
|
||||
|
||||
private findTermIndexByPath(terms: ITerm[], path: string): number {
|
||||
for (let index: number = 0; index < terms.length; index++) {
|
||||
if (terms[index].PathOfTerm === path) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the terms by their path
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user