Initial commit
This commit is contained in:
29
lib/services/MenuItem.js
Normal file
29
lib/services/MenuItem.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user