30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
// tslint:disable:no-any no-string-literal max-line-length
|
|
var MenuItem = (function () {
|
|
function MenuItem(term, level, siteCollectionUrl) {
|
|
this.level = level;
|
|
this.id = term.Id;
|
|
this.label = term.Name;
|
|
this.hoverText = term.LocalCustomProperties['_Sys_Nav_HoverText'];
|
|
this.pathDepth = term.PathDepth;
|
|
var rawUrl = term.LocalCustomProperties['_Sys_Nav_SimpleLinkUrl'] || term.LocalCustomProperties['_Sys_Nav_TargetUrl'];
|
|
if (rawUrl) {
|
|
this.url = siteCollectionUrl && rawUrl.indexOf('~sitecollection') === 0
|
|
? siteCollectionUrl + rawUrl.substring('~sitecollection'.length)
|
|
: rawUrl;
|
|
}
|
|
this.items = [];
|
|
}
|
|
MenuItem.prototype.hasChildren = function () {
|
|
return this.items && this.items.length > 0;
|
|
};
|
|
MenuItem.prototype.command = function () {
|
|
if (this.url) {
|
|
window.location.href = this.url;
|
|
}
|
|
};
|
|
return MenuItem;
|
|
}());
|
|
export { MenuItem };
|
|
|
|
//# sourceMappingURL=MenuItem.js.map
|