Update MegaMenu Application Customizer: Version bump to 1.1.0, localization support added, and unnecessary files removed
- Deleted obsolete localization file for English (en-us). - Updated version number from 1.0.4 to 1.1.0 in manifests.js and manifests.json. - Added localization support for German (de-de) in a new localization file. - Removed unnecessary dependencies from manifests. - Added .gitignore to exclude build artifacts and temporary files.
This commit is contained in:
@@ -37,40 +37,28 @@ import { sp } from '@pnp/sp';
|
||||
import { MenuItem } from './MenuItem';
|
||||
import SPTermStorePickerService from './SPTermStorePickerService';
|
||||
import { ItemDictionary } from './ItemDictionary';
|
||||
import { debugWarn } from './MegaMenuDebug';
|
||||
var LOG_SOURCE = 'TaxonomyNavigationService';
|
||||
var TaxonomyNavigationService = (function () {
|
||||
function TaxonomyNavigationService(context /*, private lcid: number*/, termSetName) {
|
||||
this.context = context; /*, private lcid: number*/
|
||||
this.termSetName = termSetName;
|
||||
this._noTerm = {
|
||||
_ObjectType_: '',
|
||||
_ObjectIdentity_: '',
|
||||
CustomSortOrderIndex: 0,
|
||||
Description: '',
|
||||
Id: '',
|
||||
IsAvailableForTagging: false,
|
||||
IsDeprecated: false,
|
||||
IsRoot: true,
|
||||
LocalCustomProperties: {
|
||||
_Sys_Nav_HoverText: 'Es wurden keine Terms gefunden. Bitte überprüfen Sie Ihre Einstellungen.',
|
||||
_Sys_Nav_ExcludedProviders: undefined,
|
||||
_Sys_Nav_SimpleLinkUrl: undefined
|
||||
},
|
||||
Name: 'Es wurden keine Terms gefunden. Bitte überprüfen Sie Ihre Einstellungen.',
|
||||
PathOfTerm: '',
|
||||
TermSet: undefined
|
||||
};
|
||||
function TaxonomyNavigationService(context, termSetNameOrId, debug, cacheMinutes) {
|
||||
if (debug === void 0) { debug = false; }
|
||||
if (cacheMinutes === void 0) { cacheMinutes = 15; }
|
||||
this.context = context;
|
||||
this.termSetNameOrId = termSetNameOrId;
|
||||
this.debug = debug;
|
||||
this.cacheMinutes = cacheMinutes;
|
||||
sp.setup({
|
||||
spfxContext: context
|
||||
});
|
||||
this._taxonomyPickerService = new SPTermStorePickerService({
|
||||
anchorId: '',
|
||||
termsetNameOrID: termSetName,
|
||||
termsetNameOrID: termSetNameOrId,
|
||||
useSessionStorage: true,
|
||||
hideDeprecatedTags: true,
|
||||
hideTagsNotAvailableForTagging: false
|
||||
}, this.context);
|
||||
hideTagsNotAvailableForTagging: false,
|
||||
cacheMinutes: cacheMinutes
|
||||
}, this.context, this.debug);
|
||||
}
|
||||
// Implement the methods from ITaxonomyNavigationService interface here
|
||||
TaxonomyNavigationService.prototype.getMenuItems = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
@@ -79,35 +67,31 @@ var TaxonomyNavigationService = (function () {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
siteCollectionUrl = this.context.pageContext.site.absoluteUrl;
|
||||
return [4 /*yield*/, this._taxonomyPickerService.getAllTerms(this.termSetName)];
|
||||
return [4 /*yield*/, this._taxonomyPickerService.getAllTerms(this.termSetNameOrId, true, false, true, this.cacheMinutes)];
|
||||
case 1:
|
||||
termset = _a.sent();
|
||||
itemsDict = new ItemDictionary();
|
||||
menuItems = [];
|
||||
if (!termset || !termset.Terms) {
|
||||
console.warn('No terms found in the term set');
|
||||
return [2 /*return*/, [new MenuItem(this._noTerm, 0, siteCollectionUrl)]];
|
||||
if (!termset || !termset.Terms || termset.Terms.length === 0) {
|
||||
debugWarn(this.debug, LOG_SOURCE, 'No terms found in the term set.');
|
||||
throw new Error('The configured navigation term set was not found or contains no terms.');
|
||||
}
|
||||
termset.Terms.forEach(function (term) { return __awaiter(_this, void 0, void 0, function () {
|
||||
var menuItem, parentItem;
|
||||
return __generator(this, function (_a) {
|
||||
menuItem = new MenuItem(term, 0, siteCollectionUrl);
|
||||
itemsDict.Add(term.Id, menuItem);
|
||||
if (menuItem.pathDepth === 1) {
|
||||
menuItems.push(menuItem);
|
||||
termset.Terms.forEach(function (term) {
|
||||
var menuItem = new MenuItem(term, 0, siteCollectionUrl);
|
||||
itemsDict.Add(term.Id, menuItem);
|
||||
if (menuItem.pathDepth === 1) {
|
||||
menuItems.push(menuItem);
|
||||
}
|
||||
else {
|
||||
var parentItem = itemsDict.Get(term.ParentId);
|
||||
if (parentItem) {
|
||||
parentItem.items.push(menuItem);
|
||||
}
|
||||
else {
|
||||
parentItem = itemsDict.Get(term.ParentId);
|
||||
if (parentItem) {
|
||||
parentItem.items.push(menuItem);
|
||||
}
|
||||
else {
|
||||
console.warn("Item without parent: " + term.PathOfTerm);
|
||||
}
|
||||
debugWarn(_this.debug, LOG_SOURCE, 'Item without parent:', term.PathOfTerm);
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}); });
|
||||
}
|
||||
});
|
||||
return [2 /*return*/, menuItems];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user