7 Commits
73 changed files with 85 additions and 8819 deletions
+10 -1
View File
@@ -4,7 +4,7 @@ Zentrale, barrierearme Portalnavigation aus SharePoint Managed Metadata für Sha
| Eigenschaft | Wert | | Eigenschaft | Wert |
|---|---| |---|---|
| Version | 2.2.3 | | Version | 2.2.5 |
| SharePoint Framework | 1.4.1 | | SharePoint Framework | 1.4.1 |
| Node.js für den Build | 8.17.0 | | Node.js für den Build | 8.17.0 |
| Moderne Seiten | SPFx Application Customizer | | Moderne Seiten | SPFx Application Customizer |
@@ -272,6 +272,15 @@ MegaMenu/
## Versionshistorie ## Versionshistorie
### 2.2.5
- Das Mega Menu wartet bei vertauschter Ladefolge auf `#CustomHeader` und verschiebt seine bereits gerenderte
Navigation automatisch in den Custom-Branding-Header.
### 2.2.4
- Der Ladehinweis wird auch dann zuverlässig entfernt, wenn der Custom-Branding-Host während des asynchronen Ladens erzeugt wird.
### 2.2.1 ### 2.2.1
- Terms mit `_Sys_Nav_ExcludedProviders = GlobalNavigationTaxonomyProvider` werden einschließlich ihres Unterbaums - Terms mit `_Sys_Nav_ExcludedProviders = GlobalNavigationTaxonomyProvider` werden einschließlich ihres Unterbaums
+2 -1
View File
@@ -1,4 +1,4 @@
# MegaMenu – Arbeitsplan Version 2.2.3 # MegaMenu – Arbeitsplan Version 2.2.5
Status: Implementierung abgeschlossen; Ship-Build auf der vorgesehenen Node-8-Buildumgebung ausstehend Status: Implementierung abgeschlossen; Ship-Build auf der vorgesehenen Node-8-Buildumgebung ausstehend
@@ -10,6 +10,7 @@ Status: Implementierung abgeschlossen; Ship-Build auf der vorgesehenen Node-8-Bu
- [x] Navigations-URLs validieren und unsichere Protokolle blockieren. - [x] Navigations-URLs validieren und unsichere Protokolle blockieren.
- [x] Externe Links und `MegaMenu.OpenInNewWindow` sicher unterstützen. - [x] Externe Links und `MegaMenu.OpenInNewWindow` sicher unterstützen.
- [x] Lade-, Leer- und Fehlerzustände verständlich und barrierearm darstellen. - [x] Lade-, Leer- und Fehlerzustände verständlich und barrierearm darstellen.
- [x] Spät erzeugten Custom-Branding-Header beobachten und die Navigation ohne Reload dorthin verschieben.
## Lokale Term-Eigenschaften ## Lokale Term-Eigenschaften
+1 -1
View File
@@ -3,7 +3,7 @@
"solution": { "solution": {
"name": "mega-menu-client-side-solution", "name": "mega-menu-client-side-solution",
"id": "f4660e06-ce08-43ee-bfb7-5c4464e01133", "id": "f4660e06-ce08-43ee-bfb7-5c4464e01133",
"version": "2.2.3.0", "version": "2.2.5.0",
"includeClientSideAssets": true, "includeClientSideAssets": true,
"skipFeatureDeployment": true "skipFeatureDeployment": true
}, },
-49
View File
@@ -1,49 +0,0 @@
{
"id": "abc3361f-bb2d-491f-aba3-cd51c19a299b",
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "1.1.2",
"manifestVersion": 2,
"requiresCustomScript": false,
"loaderConfig": {
"entryModuleId": "mega-menu-application-customizer",
"internalModuleBaseUrls": [
"https://localhost:4321/"
],
"scriptResources": {
"mega-menu-application-customizer": {
"type": "path",
"path": "dist/mega-menu-application-customizer.js"
},
"MegaMenuApplicationCustomizerStrings": {
"defaultPath": "lib/extensions/megaMenu/loc/en-us.js",
"type": "localizedPath",
"paths": {
"de-DE": "lib/extensions/megaMenu/loc/de-de.js",
"en-US": "lib/extensions/megaMenu/loc/en-us.js"
}
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@microsoft/sp-application-base": {
"type": "component",
"version": "1.4.1",
"id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
}
}
File diff suppressed because one or more lines are too long
-435
View File
@@ -1,435 +0,0 @@
:root {
--megaMenuNavBackground: #5f6f74;
--megaMenuNavHoverBackground: #6f8085;
--megaMenuNavOpenBackground: #728388;
--megaMenuNavTextColor: #ffffff;
--megaMenuNavDividerColor: rgba(255, 255, 255, 0.22);
--megaMenuTopNavHeight: 34px;
--megaMenuPanelWidth: 1280px;
--megaMenuPanelShadow: 0 14px 28px rgba(0, 0, 0, 0.18);
--megaMenuZIndex: 6000;
--megaMenuNavInlinePadding: 8px;
--megaMenuItemInlinePadding: 12px;
--megaMenuColumnPaddingX: 18px;
--megaMenuColumnPaddingY: 16px;
--megaMenuLinkRadius: 2px;
--megaMenuColumnCount: 4
}
.skip-link {
position: absolute;
top: -40px;
left: 6px;
background: var(--themePrimary, [theme:themePrimary, default: #0078d7]);
color: var(--white, [theme:white, default: #fff]);
padding: 8px 12px;
text-decoration: none;
font-weight: 600;
border-radius: 4px;
z-index: 10000;
transition: top .2s ease
}
.skip-link:focus {
top: 6px
}
#CustomNavigation {
position: relative;
overflow: visible;
z-index: var(--megaMenuZIndex, 6000)
}
.mega-menu-status {
padding: 8px 14px;
border-bottom: 1px solid var(--neutralLight, [theme:neutralLight, default: #eaeaea]);
background: var(--themeLighterAlt, [theme:themeLighterAlt, default: #eff6fc]);
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
font-size: 13px
}
.mega-menu-main {
position: relative;
width: 100%;
background-color: #5f6f74;
background-color: var(--megaMenuNavBackground, #5f6f74);
border-bottom: 1px solid rgba(0, 0, 0, .18);
box-shadow: none;
overflow: visible;
z-index: var(--megaMenuZIndex, 6000)
}
.mega-menu-main>ul,
.mega-menu-top-level {
margin: 0 auto;
max-width: var(--megaMenuPanelWidth, 1280px);
background-color: inherit;
width: 100%;
box-sizing: border-box;
list-style: none;
padding: 0 var(--megaMenuNavInlinePadding, 8px);
padding-inline-start: var(--megaMenuNavInlinePadding, 8px);
display: -ms-flexbox;
display: flex;
-ms-flex-align: stretch;
align-items: stretch;
-ms-flex-pack: start;
justify-content: flex-start;
gap: 0
}
.mega-menu-main>ul>li,
.mega-menu-top-item {
position: static;
display: -ms-flexbox;
display: flex;
-ms-flex-align: stretch;
align-items: stretch;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
border-right: 1px solid var(--megaMenuNavDividerColor, rgba(255, 255, 255, .22))
}
.mega-menu-main>ul>li:last-child,
.mega-menu-top-item:last-child {
border-right: 0
}
.mega-menu-main>ul>li>.menu-item-text,
.mega-menu-main>ul>li>a,
.menu-item-link,
.menu-item-text {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
min-height: var(--megaMenuTopNavHeight, 34px);
padding: 0 var(--megaMenuItemInlinePadding, 12px);
color: var(--megaMenuNavTextColor, #fff);
font-size: 12px;
font-weight: 400;
line-height: 1;
text-decoration: none;
background: 0 0;
border: 0;
transition: background-color .14s ease, color .14s ease;
outline: 0;
white-space: nowrap
}
.menu-item-text {
cursor: pointer
}
.menu-item-has-children::after {
content: '';
width: 5px;
height: 5px;
margin-left: 8px;
border-right: 1px solid currentColor;
border-bottom: 1px solid currentColor;
transform: translateY(-1px) rotate(45deg);
transition: transform .14s ease
}
.menu-item-has-children[aria-expanded=true]::after {
transform: translateY(1px) rotate(-135deg)
}
.mega-menu-top-item.is-active>a,
.mega-menu-top-item.is-active>span,
.menu-item-link.is-active,
.menu-item-text.is-active {
background: var(--megaMenuNavOpenBackground, #728388)
}
.mega-menu-top-item.is-current>a,
.mega-menu-top-item.is-current>span,
.menu-item-link.is-current,
.menu-item-text.is-current {
font-weight: 600
}
.mega-menu-main>ul>li:hover>.menu-item-text,
.mega-menu-main>ul>li:hover>a,
.mega-menu-main>ul>li>a[aria-expanded=true],
.mega-menu-main>ul>li>span[aria-expanded=true],
.menu-item-link:hover,
.menu-item-text:hover {
color: var(--megaMenuNavTextColor, #fff);
background: var(--megaMenuNavHoverBackground, #6f8085)
}
.mega-menu-main>ul>li>a[aria-expanded=true],
.mega-menu-main>ul>li>span[aria-expanded=true] {
background: var(--megaMenuNavOpenBackground, #728388)
}
.mega-menu-main>ul>li>.menu-item-text:focus,
.mega-menu-main>ul>li>a:focus,
.menu-item-link:focus,
.menu-item-text:focus {
color: var(--megaMenuNavTextColor, #fff);
background: var(--megaMenuNavOpenBackground, #728388);
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .65)
}
.mega-menu {
position: absolute;
left: 0;
right: 0;
top: 100%;
display: none;
visibility: hidden;
opacity: 0;
background-color: #fff;
background-color: var(--white, [theme:white, default: #fff]);
background-image: none;
mix-blend-mode: normal;
border: 1px solid var(--neutralLight, [theme:neutralLight, default: #eaeaea]);
border-top: 0;
box-shadow: var(--megaMenuPanelShadow, 0 14px 28px rgba(0, 0, 0, .18));
max-height: calc(100vh - var(--megaMenuTopNavHeight, 34px));
isolation: isolate;
overflow-y: auto;
overflow-x: hidden;
z-index: calc(var(--megaMenuZIndex, 6000) + 1);
transition: opacity .16s ease, visibility .16s ease
}
.mega-menu-main>ul>li:hover .mega-menu,
.mega-menu.js-open {
visibility: visible;
opacity: 1;
display: block;
background-color: #fff;
background-color: var(--white, [theme:white, default: #fff]);
background-image: none
}
.mega-menu-grid {
max-width: var(--megaMenuPanelWidth, 1280px);
background-color: inherit;
margin: 0 auto;
display: -ms-grid;
display: grid;
-ms-grid-columns: (minmax(0, 1fr)) [var];
grid-template-columns: repeat(var(--megaMenuColumnCount, 4), minmax(0, 1fr));
gap: 0;
-ms-grid-row-align: start;
align-items: start
}
.mega-menu-category {
min-width: 0;
padding: var(--megaMenuColumnPaddingY, 16px) var(--megaMenuColumnPaddingX, 18px) 14px;
border-right: 1px solid var(--neutralQuaternaryAlt, [theme:neutralQuaternaryAlt, default: #dadada])
}
.mega-menu-grid>.mega-menu-category:last-child {
border-right: 0
}
.mega-menu-category-title,
.mega-menu-category>h3 {
margin: 0 0 10px;
padding: 0;
border: 0
}
.mega-menu-category>h3>a,
.mega-menu-category>h3>span {
display: block;
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
font-size: 13px;
font-weight: 600;
line-height: 18px;
text-decoration: none
}
.mega-menu-category.is-active>h3>a,
.mega-menu-category.is-active>h3>span,
.mega-menu-category>h3>a.is-active,
.mega-menu-category>h3>span.is-active {
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333])
}
.mega-menu-category.is-current>h3>a,
.mega-menu-category>h3>a.is-current {
text-decoration: underline
}
.mega-menu-category>h3>a:hover {
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
text-decoration: underline
}
.mega-menu-category>h3>a:focus {
background: var(--themeLighterAlt, [theme:themeLighterAlt, default: #eff6fc]);
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
border-radius: 2px;
box-shadow: 0 0 0 2px var(--themePrimary, [theme:themePrimary, default: #0078d7]);
padding: 1px 4px;
margin: -1px -4px
}
.mega-menu-category ul,
.mega-menu-links {
list-style: none;
margin: 0;
padding-inline-start: 0
}
.mega-menu-category ul li,
.mega-menu-links li {
margin: 0 0 6px
}
.mega-menu-category ul li:last-child,
.mega-menu-links li:last-child {
margin-bottom: 0
}
.mega-menu-category ul li a,
.mega-menu-links li a {
display: block;
margin: 0;
padding: 1px 2px;
border-radius: var(--megaMenuLinkRadius, 2px);
color: var(--neutralSecondary, [theme:neutralSecondary, default: #666]);
font-size: 12px;
font-weight: 400;
line-height: 18px;
text-decoration: none;
transition: background-color .14s ease, color .14s ease, box-shadow .14s ease
}
.mega-menu-category ul li a.is-active,
.mega-menu-category ul li.is-active>a,
.mega-menu-links li a.is-active,
.mega-menu-links li.is-active>a {
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333])
}
.mega-menu-category ul li a.is-current,
.mega-menu-category ul li.is-current>a,
.mega-menu-links li a.is-current,
.mega-menu-links li.is-current>a {
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
font-weight: 600;
text-decoration: underline
}
.mega-menu-category ul li a:hover,
.mega-menu-links li a:hover {
background: 0 0;
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
text-decoration: underline
}
.mega-menu-category ul li a:focus,
.mega-menu-links li a:focus {
background: var(--themeLighterAlt, [theme:themeLighterAlt, default: #eff6fc]);
color: var(--neutralPrimary, [theme:neutralPrimary, default: #333]);
box-shadow: 0 0 0 2px var(--themePrimary, [theme:themePrimary, default: #0078d7]);
outline: 0
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0
}
@media (max-width:1024px) {
.mega-menu-grid {
-ms-grid-columns: (minmax(200px, 1fr)) [auto-fit];
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))
}
.mega-menu-category {
padding: 14px 16px 12px
}
}
@media (max-width:767px) {
.mega-menu-main>ul,
.mega-menu-top-level {
padding: 0 6px;
padding-inline-start: 6px;
-ms-flex-wrap: wrap;
flex-wrap: wrap
}
.mega-menu-main>ul>li,
.mega-menu-top-item {
border-right: 0
}
.mega-menu-main>ul>li>.menu-item-text,
.mega-menu-main>ul>li>a,
.menu-item-link,
.menu-item-text {
min-height: 36px;
padding: 0 10px;
font-size: 12px
}
.mega-menu {
border-left: 0;
border-right: 0
}
.mega-menu-grid {
-ms-grid-columns: 1fr;
grid-template-columns: 1fr
}
.mega-menu-category {
padding: 14px 12px;
border-right: 0;
border-bottom: 1px solid var(--neutralQuaternaryAlt, [theme:neutralQuaternaryAlt, default: #dadada])
}
.mega-menu-grid>.mega-menu-category:last-child {
border-bottom: 0
}
}
@media (prefers-reduced-motion:reduce) {
.mega-menu,
.mega-menu-category ul li a,
.mega-menu-links li a,
.mega-menu-main>ul>li>.menu-item-text,
.mega-menu-main>ul>li>a,
.menu-item-has-children::after,
.menu-item-link,
.menu-item-text,
.skip-link {
transition: none
}
}
@media (prefers-contrast:high) {
.mega-menu-category ul li a:focus,
.mega-menu-category>h3>a:focus,
.mega-menu-links li a:focus,
.mega-menu-main>ul>li>.menu-item-text:focus,
.mega-menu-main>ul>li>a:focus,
.menu-item-link:focus,
.menu-item-text:focus {
outline: 2px solid;
outline-offset: 2px;
box-shadow: none
}
}
-2
View File
@@ -1,2 +0,0 @@
declare const styles: {};
export default styles;
@@ -1,7 +0,0 @@
/* tslint:disable */
require('./MegaMenu.module.css');
var styles = {};
export default styles;
/* tslint:enable */
//# sourceMappingURL=MegaMenu.module.scss.js.map
@@ -1 +0,0 @@
{"version":3,"sources":["extensions/megaMenu/MegaMenu.module.scss.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACjC,IAAM,MAAM,GAAG,EACd,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,mBAAmB","file":"extensions/megaMenu/MegaMenu.module.scss.js","sourcesContent":["/* tslint:disable */\r\nrequire('./MegaMenu.module.css');\r\nconst styles = {\r\n};\r\n\r\nexport default styles;\r\n/* tslint:enable */"],"sourceRoot":"..\\..\\..\\src"}
@@ -1,24 +0,0 @@
import { BaseApplicationCustomizer } from '@microsoft/sp-application-base';
import './MegaMenu.module.scss';
export declare const UserCustomActionMegaMenuId: string;
export interface IMegaMenuApplicationCustomizerProperties {
termSetName?: string;
termSetId?: string;
cacheMinutes?: number;
debug?: boolean;
}
export default class MegaMenuApplicationCustomizer extends BaseApplicationCustomizer<IMegaMenuApplicationCustomizerProperties> {
private _topPlaceholder;
private _menuContainer;
private _renderer;
onInit(): Promise<void>;
private _renderPlaceHolders();
private _renderMegaMenu(termSetIdentifier, debug?);
private _getOrCreateContainer(id, placeholder);
private _onDispose;
private _getTermSetIdentifier();
private _getCacheMinutes();
private _renderStatus(message);
private _isGuid(value);
private _isDebugEnabled(debugOverride?);
}
@@ -1,204 +0,0 @@
// tslint:disable:max-line-length
// tslint:disable:match-default-export-name
// tslint:disable:typedef
// tslint:disable:variable-name
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import { override } from '@microsoft/decorators';
import { BaseApplicationCustomizer, PlaceholderName } from '@microsoft/sp-application-base';
import * as strings from 'MegaMenuApplicationCustomizerStrings';
import { TaxonomyNavigationService } from '../../services/TaxonomyNavigationService';
import { MegaMenuRenderer } from './MegaMenuRenderer';
import { debugError, debugLog, debugWarn } from '../../services/MegaMenuDebug';
import './MegaMenu.module.scss';
var LOG_SOURCE = 'MegaMenuApplicationCustomizer';
export var UserCustomActionMegaMenuId = 'abc3361f-bb2d-491f-aba3-cd51c19a299b';
var MegaMenuApplicationCustomizer = (function (_super) {
__extends(MegaMenuApplicationCustomizer, _super);
function MegaMenuApplicationCustomizer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._onDispose = function () {
_this.context.placeholderProvider.changedEvent.remove(_this, _this._renderPlaceHolders);
if (_this._renderer) {
_this._renderer.dispose();
_this._renderer = undefined;
}
_this._menuContainer = undefined;
_this._topPlaceholder = undefined;
debugLog(_this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.');
};
return _this;
}
MegaMenuApplicationCustomizer.prototype.onInit = function () {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Initialized ' + strings.Title);
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
this._renderPlaceHolders();
return Promise.resolve();
};
MegaMenuApplicationCustomizer.prototype._renderPlaceHolders = function () {
var availablePlaceholders = this.context.placeholderProvider.placeholderNames
.map(function (name) { return PlaceholderName[name]; })
.join(', ');
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Available placeholders:', availablePlaceholders);
if (!this._topPlaceholder) {
this._topPlaceholder = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Top, { onDispose: this._onDispose });
if (!this._topPlaceholder) {
debugError(this._isDebugEnabled(), LOG_SOURCE, 'The expected placeholder (Top) was not found.');
return;
}
var termSetIdentifier = this._getTermSetIdentifier();
if (!termSetIdentifier) {
debugWarn(this._isDebugEnabled(), LOG_SOURCE, 'No termSetId or termSetName configured. Mega Menu rendering is skipped.');
this._renderStatus(strings.ConfigurationMissing);
return;
}
this._renderMegaMenu(termSetIdentifier);
}
};
MegaMenuApplicationCustomizer.prototype._renderMegaMenu = function (termSetIdentifier, debug) {
if (debug === void 0) { debug = this._isDebugEnabled(); }
return __awaiter(this, void 0, void 0, function () {
var taxonomyService, menuItems, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this._topPlaceholder) {
return [2 /*return*/];
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
taxonomyService = new TaxonomyNavigationService(this.context, termSetIdentifier, debug, this._getCacheMinutes());
return [4 /*yield*/, taxonomyService.getMenuItems()];
case 2:
menuItems = _a.sent();
if (this._renderer) {
this._renderer.dispose();
}
this._renderer = new MegaMenuRenderer(menuItems, debug);
this._menuContainer = this._getOrCreateContainer('CustomHeader', this._topPlaceholder);
if (this._menuContainer) {
this._renderer.render(this._menuContainer);
}
else {
this._renderer.render(this._topPlaceholder.domElement);
}
debugLog(debug, LOG_SOURCE, 'MegaMenu rendered successfully with ' + menuItems.length + ' top-level items.');
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
debugError(debug, LOG_SOURCE, 'Error rendering MegaMenu.', error_1);
this._renderStatus(strings.LoadError);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
};
MegaMenuApplicationCustomizer.prototype._getOrCreateContainer = function (id, placeholder) {
var container = document.getElementById(id);
if (container) {
var host = document.getElementById('MegaMenuHost');
if (!host) {
host = document.createElement('div');
host.id = 'MegaMenuHost';
container.appendChild(host);
}
return host;
}
return placeholder.domElement;
};
MegaMenuApplicationCustomizer.prototype._getTermSetIdentifier = function () {
var termSetId = this.properties && this.properties.termSetId
? this.properties.termSetId.trim()
: '';
if (termSetId && this._isGuid(termSetId)) {
return termSetId;
}
return this.properties && this.properties.termSetName
? this.properties.termSetName.trim()
: '';
};
MegaMenuApplicationCustomizer.prototype._getCacheMinutes = function () {
var value = this.properties ? Number(this.properties.cacheMinutes) : 15;
return isFinite(value) ? Math.min(Math.max(Math.floor(value), 1), 1440) : 15;
};
MegaMenuApplicationCustomizer.prototype._renderStatus = function (message) {
if (!this._topPlaceholder) {
return;
}
this._menuContainer = this._getOrCreateContainer('CustomHeader', this._topPlaceholder);
var container = this._menuContainer || this._topPlaceholder.domElement;
container.innerHTML = '';
var status = document.createElement('div');
status.className = 'mega-menu-status';
status.setAttribute('role', 'status');
status.textContent = message;
container.appendChild(status);
};
MegaMenuApplicationCustomizer.prototype._isGuid = function (value) {
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(value);
};
MegaMenuApplicationCustomizer.prototype._isDebugEnabled = function (debugOverride) {
if (typeof debugOverride === 'boolean') {
return debugOverride;
}
return !!(this.properties && this.properties.debug === true);
};
__decorate([
override
], MegaMenuApplicationCustomizer.prototype, "onInit", null);
return MegaMenuApplicationCustomizer;
}(BaseApplicationCustomizer));
export default MegaMenuApplicationCustomizer;
//# sourceMappingURL=MegaMenuApplicationCustomizer.js.map
File diff suppressed because one or more lines are too long
@@ -1,17 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-extension-manifest.schema.json",
"id": "abc3361f-bb2d-491f-aba3-cd51c19a299b",
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false
}
-36
View File
@@ -1,36 +0,0 @@
import { IMenuItem } from '../../services/IMenuItem';
export declare class MegaMenuRenderer {
private menuItems;
private debug;
private static readonly hoverOpenDelayMs;
private static readonly hoverCloseDelayMs;
private _container;
private _documentKeydownHandler;
private _documentClickHandler;
private _announcer;
constructor(menuItems: IMenuItem[], debug?: boolean);
render(container: HTMLElement): void;
dispose(): void;
private createTopLevelItem(item);
private createTopLevelElement(item, hasChildren, isActive, isCurrent);
private createMegaMenu(parentItem);
private createCategorySection(item);
private attachEventListeners();
private attachKeyboardNavigation(heading, megaMenu);
private attachMouseEvents(heading, megaMenu);
private attachFocusManagement(heading, megaMenu);
private attachGlobalKeyboardNavigation();
private attachGlobalClickOutsideHandler();
private openMegaMenu(trigger, menu);
private closeMegaMenu(trigger, menu);
private toggleMegaMenu(trigger, menu);
private closeAllMegaMenus(exceptMenu?);
private focusFirstLink(megaMenu);
private isItemActive(item);
private isCurrentUrl(url?);
private normalizePath(url?);
private getColumnCount(items?);
private joinClasses(...classNames);
private createScreenReaderAnnouncer();
private announce(message);
}
-470
View File
@@ -1,470 +0,0 @@
// tslint:disable:max-line-length
// tslint:disable:match-default-export-name
// tslint:disable:typedef
// tslint:disable:variable-name
import { debugLog } from '../../services/MegaMenuDebug';
var LOG_SOURCE = 'MegaMenuRenderer';
var MegaMenuRenderer = (function () {
function MegaMenuRenderer(menuItems, debug) {
if (debug === void 0) { debug = false; }
this.menuItems = menuItems;
this.debug = debug;
}
MegaMenuRenderer.prototype.render = function (container) {
var _this = this;
this.dispose();
this._container = container;
container.innerHTML = '';
container.id = 'CustomNavigation';
var nav = document.createElement('nav');
nav.id = 'Mega-Menu';
nav.className = 'mega-menu-main';
nav.setAttribute('aria-label', 'Hauptnavigation');
var topLevelUl = document.createElement('ul');
topLevelUl.className = 'mega-menu-top-level';
this.menuItems.forEach(function (topLevelItem) {
var topLevelLi = _this.createTopLevelItem(topLevelItem);
topLevelUl.appendChild(topLevelLi);
});
nav.appendChild(topLevelUl);
container.appendChild(nav);
this.attachEventListeners();
this.createScreenReaderAnnouncer();
};
MegaMenuRenderer.prototype.dispose = function () {
if (this._documentKeydownHandler) {
document.removeEventListener('keydown', this._documentKeydownHandler);
this._documentKeydownHandler = undefined;
}
if (this._documentClickHandler) {
document.removeEventListener('click', this._documentClickHandler);
this._documentClickHandler = undefined;
}
if (this._announcer && this._announcer.parentElement) {
this._announcer.parentElement.removeChild(this._announcer);
}
this._announcer = undefined;
if (this._container) {
this._container.innerHTML = '';
}
this._container = undefined;
};
MegaMenuRenderer.prototype.createTopLevelItem = function (item) {
var li = document.createElement('li');
var hasChildren = item.hasChildren() && item.items && item.items.length > 0;
var isActive = this.isItemActive(item);
var isCurrent = this.isCurrentUrl(item.url);
li.className = this.joinClasses('mega-menu-top-item', hasChildren ? 'has-children' : undefined, isActive ? 'is-active' : undefined, isCurrent ? 'is-current' : undefined);
var topElement = this.createTopLevelElement(item, hasChildren, isActive, isCurrent);
li.appendChild(topElement);
if (hasChildren) {
var megaMenu = this.createMegaMenu(item);
li.appendChild(megaMenu);
}
return li;
};
MegaMenuRenderer.prototype.createTopLevelElement = function (item, hasChildren, isActive, isCurrent) {
var element;
if (item.url) {
element = document.createElement('a');
element.href = item.url;
element.className = 'menu-item-link';
}
else {
element = document.createElement('span');
element.className = 'menu-item-text';
element.setAttribute('tabindex', '0');
}
element.textContent = item.label;
element.className = this.joinClasses(element.className, hasChildren ? 'menu-item-has-children' : undefined, isActive ? 'is-active' : undefined, isCurrent ? 'is-current' : undefined);
if (hasChildren) {
element.setAttribute('aria-haspopup', 'true');
element.setAttribute('aria-expanded', 'false');
}
if (isCurrent && item.url) {
element.setAttribute('aria-current', 'page');
}
if (item.hoverText) {
element.title = item.hoverText;
}
return element;
};
MegaMenuRenderer.prototype.createMegaMenu = function (parentItem) {
var _this = this;
var megaMenuDiv = document.createElement('div');
megaMenuDiv.className = 'mega-menu';
megaMenuDiv.setAttribute('aria-expanded', 'false');
megaMenuDiv.setAttribute('aria-label', parentItem.label + ' Unterkategorien');
var gridDiv = document.createElement('div');
gridDiv.className = 'mega-menu-grid';
gridDiv.style.setProperty('--megaMenuColumnCount', this.getColumnCount(parentItem.items));
if (parentItem.items) {
parentItem.items.forEach(function (secondLevelItem) {
var categoryDiv = _this.createCategorySection(secondLevelItem);
gridDiv.appendChild(categoryDiv);
});
}
megaMenuDiv.appendChild(gridDiv);
return megaMenuDiv;
};
MegaMenuRenderer.prototype.createCategorySection = function (item) {
var _this = this;
var categoryDiv = document.createElement('div');
var isActive = this.isItemActive(item);
var isCurrent = this.isCurrentUrl(item.url);
categoryDiv.className = this.joinClasses('mega-menu-category', isActive ? 'is-active' : undefined, isCurrent ? 'is-current' : undefined);
var h3 = document.createElement('h3');
h3.className = 'mega-menu-category-title';
if (item.url) {
var link = document.createElement('a');
link.href = item.url;
link.textContent = item.label;
link.className = this.joinClasses(isActive ? 'is-active' : undefined, isCurrent ? 'is-current' : undefined);
if (isCurrent) {
link.setAttribute('aria-current', 'page');
}
if (item.hoverText) {
link.title = item.hoverText;
}
h3.appendChild(link);
}
else {
var span = document.createElement('span');
span.textContent = item.label;
span.className = this.joinClasses(isActive ? 'is-active' : undefined);
if (item.hoverText) {
span.title = item.hoverText;
}
h3.appendChild(span);
}
categoryDiv.appendChild(h3);
if (item.hasChildren() && item.items && item.items.length > 0) {
var ul_1 = document.createElement('ul');
ul_1.className = 'mega-menu-links';
item.items.forEach(function (thirdLevelItem) {
var li = document.createElement('li');
var link = document.createElement('a');
var isLinkActive = _this.isItemActive(thirdLevelItem);
var isLinkCurrent = _this.isCurrentUrl(thirdLevelItem.url);
li.className = _this.joinClasses(isLinkActive ? 'is-active' : undefined, isLinkCurrent ? 'is-current' : undefined);
link.href = thirdLevelItem.url || '#';
link.textContent = thirdLevelItem.label;
link.className = _this.joinClasses(isLinkActive ? 'is-active' : undefined, isLinkCurrent ? 'is-current' : undefined);
if (isLinkCurrent && thirdLevelItem.url) {
link.setAttribute('aria-current', 'page');
}
if (thirdLevelItem.hoverText) {
link.title = thirdLevelItem.hoverText;
}
li.appendChild(link);
ul_1.appendChild(li);
});
categoryDiv.appendChild(ul_1);
}
return categoryDiv;
};
MegaMenuRenderer.prototype.attachEventListeners = function () {
var headings = document.querySelectorAll('#Mega-Menu > ul > li > a, #Mega-Menu > ul > li > .menu-item-text');
for (var i = 0; i < headings.length; i++) {
var heading = headings[i];
var megaMenu = heading.nextElementSibling;
if (megaMenu && megaMenu.classList.contains('mega-menu')) {
this.attachKeyboardNavigation(heading, megaMenu);
this.attachMouseEvents(heading, megaMenu);
this.attachFocusManagement(heading, megaMenu);
}
}
this.attachGlobalKeyboardNavigation();
this.attachGlobalClickOutsideHandler();
};
MegaMenuRenderer.prototype.attachKeyboardNavigation = function (heading, megaMenu) {
var _this = this;
heading.addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
if (heading.tagName === 'A') {
return;
}
e.preventDefault();
_this.toggleMegaMenu(heading, megaMenu);
}
else if (e.key === ' ') {
e.preventDefault();
_this.toggleMegaMenu(heading, megaMenu);
}
else if (e.key === 'ArrowDown') {
e.preventDefault();
_this.openMegaMenu(heading, megaMenu);
_this.focusFirstLink(megaMenu);
}
else if (e.key === 'ArrowUp') {
e.preventDefault();
_this.closeMegaMenu(heading, megaMenu);
}
else if (e.key === 'Escape') {
e.preventDefault();
_this.closeMegaMenu(heading, megaMenu);
heading.focus();
}
});
if (heading.tagName === 'A') {
heading.addEventListener('click', function () {
debugLog(_this.debug, LOG_SOURCE, 'Link clicked:', heading.href);
});
}
heading.addEventListener('focus', function () {
debugLog(_this.debug, LOG_SOURCE, 'Focus moved to:', heading.textContent);
});
};
MegaMenuRenderer.prototype.attachMouseEvents = function (heading, megaMenu) {
var _this = this;
var parentLi = heading.parentElement;
var openTimeout;
var closeTimeout;
var clearOpenTimeout = function () {
if (typeof openTimeout === 'number') {
window.clearTimeout(openTimeout);
openTimeout = undefined;
}
};
var clearCloseTimeout = function () {
if (typeof closeTimeout === 'number') {
window.clearTimeout(closeTimeout);
closeTimeout = undefined;
}
};
parentLi.addEventListener('mouseenter', function () {
clearCloseTimeout();
if (megaMenu.classList.contains('js-open')) {
return;
}
clearOpenTimeout();
openTimeout = window.setTimeout(function () {
_this.openMegaMenu(heading, megaMenu);
openTimeout = undefined;
}, MegaMenuRenderer.hoverOpenDelayMs);
});
parentLi.addEventListener('mouseleave', function () {
clearOpenTimeout();
clearCloseTimeout();
closeTimeout = window.setTimeout(function () {
_this.closeMegaMenu(heading, megaMenu);
closeTimeout = undefined;
}, MegaMenuRenderer.hoverCloseDelayMs);
});
heading.addEventListener('focus', function () {
clearCloseTimeout();
});
megaMenu.addEventListener('mouseenter', function () {
clearCloseTimeout();
});
};
MegaMenuRenderer.prototype.attachFocusManagement = function (heading, megaMenu) {
var _this = this;
megaMenu.addEventListener('focusout', function () {
setTimeout(function () {
var focusedElement = document.activeElement;
var isInsideThisMenu = megaMenu.contains(focusedElement);
var isOnThisTrigger = focusedElement === heading;
var isInAnyMegaMenu = focusedElement.closest('.mega-menu');
var isOnAnyTopLevel = focusedElement.closest('#Mega-Menu > ul > li > a, #Mega-Menu > ul > li > span');
if (!isInsideThisMenu && !isOnThisTrigger && !isInAnyMegaMenu && !isOnAnyTopLevel) {
debugLog(_this.debug, LOG_SOURCE, 'Closing menu because focus left the navigation.');
_this.closeMegaMenu(heading, megaMenu);
}
}, 150);
});
};
MegaMenuRenderer.prototype.attachGlobalKeyboardNavigation = function () {
var _this = this;
this._documentKeydownHandler = function (e) {
var activeElement = document.activeElement;
if (e.key === 'Escape') {
var openMenu = document.querySelector('.mega-menu[aria-expanded="true"]');
if (openMenu) {
var triggerLink = openMenu.previousElementSibling;
_this.closeMegaMenu(triggerLink, openMenu);
triggerLink.focus();
}
}
if (e.key === 'Tab') {
if (!e.shiftKey) {
var currentTopLevel = activeElement.closest('#Mega-Menu > ul > li > a, #Mega-Menu > ul > li > span');
if (currentTopLevel) {
var parentLi = currentTopLevel.closest('li');
var megaMenu = parentLi.querySelector('.mega-menu.js-open');
if (megaMenu) {
e.preventDefault();
var firstLink = megaMenu.querySelector('a');
if (firstLink) {
firstLink.focus();
}
return;
}
}
}
if (e.shiftKey) {
var megaMenu = activeElement.closest('.mega-menu');
if (megaMenu && megaMenu.classList.contains('js-open')) {
var allLinksInMenu = megaMenu.querySelectorAll('a');
var firstLinkInMenu = allLinksInMenu[0];
if (activeElement === firstLinkInMenu) {
e.preventDefault();
var triggerElement = megaMenu.previousElementSibling;
triggerElement.focus();
return;
}
}
}
}
};
document.addEventListener('keydown', this._documentKeydownHandler);
};
MegaMenuRenderer.prototype.attachGlobalClickOutsideHandler = function () {
var _this = this;
this._documentClickHandler = function (e) {
var eventTarget = e.target;
var isInsideNavigation = !!(eventTarget && typeof eventTarget.closest === 'function' &&
eventTarget.closest('#CustomNavigation'));
if (isInsideNavigation) {
return;
}
var openMenu = document.querySelector('.mega-menu.js-open');
if (openMenu) {
debugLog(_this.debug, LOG_SOURCE, 'Closing menu because of outside click.');
_this.closeAllMegaMenus();
}
};
document.addEventListener('click', this._documentClickHandler);
};
MegaMenuRenderer.prototype.openMegaMenu = function (trigger, menu) {
this.closeAllMegaMenus(menu);
trigger.setAttribute('aria-expanded', 'true');
menu.setAttribute('aria-expanded', 'true');
menu.classList.add('js-open');
this.announce((trigger.textContent || '') + ' geöffnet');
debugLog(this.debug, LOG_SOURCE, 'Menu opened:', trigger.textContent);
};
MegaMenuRenderer.prototype.closeMegaMenu = function (trigger, menu) {
trigger.setAttribute('aria-expanded', 'false');
menu.setAttribute('aria-expanded', 'false');
menu.classList.remove('js-open');
this.announce((trigger.textContent || '') + ' geschlossen');
debugLog(this.debug, LOG_SOURCE, 'Menu closed:', trigger.textContent);
};
MegaMenuRenderer.prototype.toggleMegaMenu = function (trigger, menu) {
var isOpen = trigger.getAttribute('aria-expanded') === 'true';
if (isOpen) {
this.closeMegaMenu(trigger, menu);
}
else {
this.openMegaMenu(trigger, menu);
}
};
MegaMenuRenderer.prototype.closeAllMegaMenus = function (exceptMenu) {
var allTriggers = document.querySelectorAll('#Mega-Menu > ul > li > a[aria-expanded="true"], #Mega-Menu > ul > li > span[aria-expanded="true"]');
for (var i = 0; i < allTriggers.length; i++) {
var trigger = allTriggers[i];
var menu = trigger.nextElementSibling;
if (menu && menu !== exceptMenu) {
this.closeMegaMenu(trigger, menu);
}
}
};
MegaMenuRenderer.prototype.focusFirstLink = function (megaMenu) {
var firstLink = megaMenu.querySelector('a');
if (firstLink) {
firstLink.focus();
}
};
MegaMenuRenderer.prototype.isItemActive = function (item) {
if (this.isCurrentUrl(item.url)) {
return true;
}
if (!item.items || item.items.length === 0) {
return false;
}
for (var i = 0; i < item.items.length; i++) {
if (this.isItemActive(item.items[i])) {
return true;
}
}
return false;
};
MegaMenuRenderer.prototype.isCurrentUrl = function (url) {
var currentPath = this.normalizePath(window.location.href);
var itemPath = this.normalizePath(url);
if (!currentPath || !itemPath) {
return false;
}
if (itemPath === '/') {
return currentPath === '/';
}
if (currentPath === itemPath) {
return true;
}
return currentPath.indexOf(itemPath + '/') === 0;
};
MegaMenuRenderer.prototype.normalizePath = function (url) {
if (!url) {
return '';
}
try {
var parsedUrl = new URL(url, window.location.origin);
var pathname = (parsedUrl.pathname || '/').replace(/\/+$/, '');
return (pathname || '/').toLowerCase();
}
catch (error) {
return '';
}
};
MegaMenuRenderer.prototype.getColumnCount = function (items) {
var itemCount = items ? items.length : 0;
var columnCount = Math.min(Math.max(itemCount, 1), 4);
return columnCount.toString();
};
MegaMenuRenderer.prototype.joinClasses = function () {
var classNames = [];
for (var _i = 0; _i < arguments.length; _i++) {
classNames[_i] = arguments[_i];
}
var filteredClassNames = [];
for (var i = 0; i < classNames.length; i++) {
if (classNames[i]) {
filteredClassNames.push(classNames[i]);
}
}
return filteredClassNames.join(' ');
};
MegaMenuRenderer.prototype.createScreenReaderAnnouncer = function () {
var existingAnnouncer = document.getElementById('mega-menu-sr-announcer');
if (existingAnnouncer) {
this._announcer = existingAnnouncer;
return;
}
var srAnnouncer = document.createElement('div');
srAnnouncer.id = 'mega-menu-sr-announcer';
srAnnouncer.setAttribute('aria-live', 'polite');
srAnnouncer.setAttribute('aria-atomic', 'true');
srAnnouncer.className = 'sr-only';
document.body.appendChild(srAnnouncer);
this._announcer = srAnnouncer;
debugLog(this.debug, LOG_SOURCE, 'Screen reader announcer is ready.');
};
MegaMenuRenderer.prototype.announce = function (message) {
var _this = this;
if (this._announcer) {
this._announcer.textContent = '';
window.setTimeout(function () {
if (_this._announcer) {
_this._announcer.textContent = message;
}
}, 20);
}
};
MegaMenuRenderer.hoverOpenDelayMs = 140;
MegaMenuRenderer.hoverCloseDelayMs = 180;
return MegaMenuRenderer;
}());
export { MegaMenuRenderer };
//# sourceMappingURL=MegaMenuRenderer.js.map
File diff suppressed because one or more lines are too long
-7
View File
@@ -1,7 +0,0 @@
define([], function() {
return {
"Title": "MegaMenuApplicationCustomizer",
"ConfigurationMissing": "Navigation is not configured.",
"LoadError": "Navigation could not be loaded."
}
});
-4
View File
@@ -1,4 +0,0 @@
export { TaxonomyNavigationService } from './services/TaxonomyNavigationService';
export { MegaMenuRenderer } from './extensions/megaMenu/MegaMenuRenderer';
export { UserCustomActionService } from './services/UserCustomActionService/UserCustomActionService';
export { UserCustomActionScope } from './services/UserCustomActionService/UserCustomActionScope';
-17
View File
@@ -1,17 +0,0 @@
// tslint:disable:max-line-length no-any
// A file is required to be in the root of the /src directory by the TypeScript compiler
// Export services for classic SharePoint usage
export { TaxonomyNavigationService } from './services/TaxonomyNavigationService';
export { MegaMenuRenderer } from './extensions/megaMenu/MegaMenuRenderer';
export { UserCustomActionService } from './services/UserCustomActionService/UserCustomActionService';
export { UserCustomActionScope } from './services/UserCustomActionService/UserCustomActionScope';
if (typeof window !== 'undefined') {
window.__megaMenuServices = {
TaxonomyNavigationService: require('./services/TaxonomyNavigationService').TaxonomyNavigationService,
MegaMenuRenderer: require('./extensions/megaMenu/MegaMenuRenderer').MegaMenuRenderer,
UserCustomActionService: require('./services/UserCustomActionService/UserCustomActionService').UserCustomActionService,
UserCustomActionScope: require('./services/UserCustomActionService/UserCustomActionScope').UserCustomActionScope
};
}
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,wFAAwF;AAExF,+CAA+C;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAKjG,EAAE,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,kBAAkB,GAAG;QACxB,yBAAyB,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC,yBAAyB;QACpG,gBAAgB,EAAE,OAAO,CAAC,wCAAwC,CAAC,CAAC,gBAAgB;QACpF,uBAAuB,EAAE,OAAO,CAAC,4DAA4D,CAAC,CAAC,uBAAuB;QACtH,qBAAqB,EAAE,OAAO,CAAC,0DAA0D,CAAC,CAAC,qBAAqB;KACnH,CAAC;AACN,CAAC","file":"index.js","sourcesContent":["// tslint:disable:max-line-length no-any\r\n// A file is required to be in the root of the /src directory by the TypeScript compiler\r\n\r\n// Export services for classic SharePoint usage\r\nexport { TaxonomyNavigationService } from './services/TaxonomyNavigationService';\r\nexport { MegaMenuRenderer } from './extensions/megaMenu/MegaMenuRenderer';\r\nexport { UserCustomActionService } from './services/UserCustomActionService/UserCustomActionService';\r\nexport { UserCustomActionScope } from './services/UserCustomActionService/UserCustomActionScope';\r\n\r\n// Expose services globally for classic JavaScript consumption\r\ndeclare var window: any;\r\n\r\nif (typeof window !== 'undefined') {\r\n window.__megaMenuServices = {\r\n TaxonomyNavigationService: require('./services/TaxonomyNavigationService').TaxonomyNavigationService,\r\n MegaMenuRenderer: require('./extensions/megaMenu/MegaMenuRenderer').MegaMenuRenderer,\r\n UserCustomActionService: require('./services/UserCustomActionService/UserCustomActionService').UserCustomActionService,\r\n UserCustomActionScope: require('./services/UserCustomActionService/UserCustomActionScope').UserCustomActionScope\r\n };\r\n}\r\n"],"sourceRoot":"..\\src"}
-10
View File
@@ -1,10 +0,0 @@
export interface IMenuItem {
id: string;
label: string;
icon?: string;
hoverText: string;
url?: string;
pathDepth: number;
items?: IMenuItem[];
hasChildren: () => boolean;
}
-3
View File
@@ -1,3 +0,0 @@
//# sourceMappingURL=IMenuItem.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/IMenuItem.js","sourcesContent":[],"sourceRoot":"..\\..\\src"}
-9
View File
@@ -1,9 +0,0 @@
export interface IPickerTerm {
name: string;
key: string;
path: string;
termSet: string;
termSetName?: string;
}
export interface IPickerTerms extends Array<IPickerTerm> {
}
-3
View File
@@ -1,3 +0,0 @@
//# sourceMappingURL=IPickerTerm.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/IPickerTerm.js","sourcesContent":[],"sourceRoot":"..\\..\\src"}
-84
View File
@@ -1,84 +0,0 @@
/**
* Interfaces for Term store, groups and term sets
* This code is a copy from the library @pnp/sp-dev-fx-controls-react
*/
export interface ITermStore {
_ObjectType_: string;
_ObjectIdentity_: string;
Id: string;
Name: string;
Groups: IGroups;
}
export interface IGroups {
_ObjectType_: string;
_Child_Items_: IGroup[];
}
export interface IGroup {
_ObjectType_: string;
_ObjectIdentity_: string;
TermSets: ITermSets;
Id: string;
Name: string;
IsSystemGroup: boolean;
}
export interface ITermSets {
_ObjectType_: string;
_Child_Items_: ITermSet[];
}
export interface ITermSet {
_ObjectType_: string;
_ObjectIdentity_: string;
Id: string;
CustomSortOrder?: string;
Name: string;
Description: string;
Names: ITermSetNames;
Terms?: ITerm[];
}
export interface ITermSetMinimal {
_ObjectType_?: string;
_ObjectIdentity_?: string;
Id: string;
Name: string;
}
export interface ITermSetNames {
[locale: string]: string;
}
/**
* Interfaces for the terms
*/
export interface ITerms {
_ObjectType_: string;
_Child_Items_: ITerm[];
}
/**
* Term
*/
export interface ITerm {
_ObjectType_: string;
_ObjectIdentity_: string;
Id: string;
Name: string;
Description: string;
IsDeprecated: boolean;
IsAvailableForTagging: boolean;
IsRoot: boolean;
PathOfTerm: string;
TermSet: ITermSetMinimal;
CustomSortOrderIndex?: number;
PathDepth?: number;
ParentId?: string;
TermsCount?: number;
LocalCustomProperties?: {
[property: string]: any;
};
}
export interface ISuggestTerm {
Id: string;
DefaultLabel: string;
Description: string;
IsKeyword: boolean;
IsSynonym: boolean;
Paths: Array<string>;
Synonyms: string;
}
@@ -1,3 +0,0 @@
//# sourceMappingURL=ISPTermStorePickerService.js.map
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/ISPTermStorePickerService.js","sourcesContent":[],"sourceRoot":"..\\..\\src"}
-8
View File
@@ -1,8 +0,0 @@
export interface ISPTermStorePickerServiceProps {
termsetNameOrID: string;
useSessionStorage: boolean;
hideDeprecatedTags: boolean;
hideTagsNotAvailableForTagging: boolean;
anchorId: string;
cacheMinutes: number;
}
@@ -1,3 +0,0 @@
//# sourceMappingURL=ISPTermStorePickerServiceProps.js.map
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/ISPTermStorePickerServiceProps.js","sourcesContent":[],"sourceRoot":"..\\..\\src"}
-4
View File
@@ -1,4 +0,0 @@
import { IMenuItem } from './IMenuItem';
export interface ITaxonomyNavigationService {
getMenuItems(): Promise<IMenuItem[]>;
}
@@ -1,3 +0,0 @@
//# sourceMappingURL=ITaxonomyNavigationService.js.map
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/ITaxonomyNavigationService.js","sourcesContent":[],"sourceRoot":"..\\..\\src"}
-4
View File
@@ -1,4 +0,0 @@
export declare class ItemDictionary<T> {
Get(key: string): T;
Add(key: string, value: T): void;
}
-14
View File
@@ -1,14 +0,0 @@
var ItemDictionary = (function () {
function ItemDictionary() {
}
ItemDictionary.prototype.Get = function (key) {
return this[key];
};
ItemDictionary.prototype.Add = function (key, value) {
this[key] = value;
};
return ItemDictionary;
}());
export { ItemDictionary };
//# sourceMappingURL=ItemDictionary.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["services/ItemDictionary.ts"],"names":[],"mappings":"AAAA;IAAA;IAQA,CAAC;IAPU,4BAAG,GAAV,UAAW,GAAW;QAClB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAEM,4BAAG,GAAV,UAAW,GAAW,EAAE,KAAQ;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACL,qBAAC;AAAD,CARA,AAQC,IAAA","file":"services/ItemDictionary.js","sourcesContent":["export class ItemDictionary<T> {\r\n public Get(key: string): T {\r\n return this[key];\r\n }\r\n\r\n public Add(key: string, value: T): void {\r\n this[key] = value;\r\n }\r\n}\r\n"],"sourceRoot":"..\\..\\src"}
-14
View File
@@ -1,14 +0,0 @@
import { IMenuItem } from './IMenuItem';
import { ITerm } from './ISPTermStorePickerService';
export declare class MenuItem implements IMenuItem {
level: number;
id: string;
label: string;
hoverText: string;
pathDepth: number;
url?: string;
items?: IMenuItem[];
constructor(term: ITerm, level: number, siteCollectionUrl?: string);
hasChildren(): boolean;
command(): void;
}
-29
View File
@@ -1,29 +0,0 @@
// 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
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["services/MenuItem.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAK1D;IAQI,kBAAY,IAAW,EAAS,KAAa,EAAE,iBAA0B;QAAzC,UAAK,GAAL,KAAK,CAAQ;QACzC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAM,MAAM,GAAW,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;QAChI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACT,IAAI,CAAC,GAAG,GAAG,iBAAiB,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC;kBACjE,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC;kBAC9D,MAAM,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACpB,CAAC;IAEM,8BAAW,GAAlB;QACI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/C,CAAC;IAEM,0BAAO,GAAd;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACV,MAAc,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QAC7C,CAAC;IACL,CAAC;IACL,eAAC;AAAD,CA/BA,AA+BC,IAAA","file":"services/MenuItem.js","sourcesContent":["// tslint:disable:no-any no-string-literal max-line-length\r\n\r\nimport { IMenuItem } from './IMenuItem';\r\nimport { ITerm } from './ISPTermStorePickerService';\r\n\r\nexport class MenuItem implements IMenuItem {\r\n public id: string;\r\n public label: string;\r\n public hoverText: string;\r\n public pathDepth: number;\r\n public url?: string;\r\n public items?: IMenuItem[];\r\n\r\n constructor(term: ITerm, public level: number, siteCollectionUrl?: string) {\r\n this.id = term.Id;\r\n this.label = term.Name;\r\n this.hoverText = term.LocalCustomProperties['_Sys_Nav_HoverText'];\r\n this.pathDepth = term.PathDepth;\r\n const rawUrl: string = term.LocalCustomProperties['_Sys_Nav_SimpleLinkUrl'] || term.LocalCustomProperties['_Sys_Nav_TargetUrl'];\r\n if (rawUrl) {\r\n this.url = siteCollectionUrl && rawUrl.indexOf('~sitecollection') === 0\r\n ? siteCollectionUrl + rawUrl.substring('~sitecollection'.length)\r\n : rawUrl;\r\n }\r\n this.items = [];\r\n }\r\n\r\n public hasChildren(): boolean {\r\n return this.items && this.items.length > 0;\r\n }\r\n\r\n public command(): void {\r\n if (this.url) {\r\n (window as any).location.href = this.url;\r\n }\r\n }\r\n}\r\n"],"sourceRoot":"..\\..\\src"}
-5
View File
@@ -1,5 +0,0 @@
import { IMenuItem } from './IMenuItem';
import { ITaxonomyNavigationService } from './ITaxonomyNavigationService';
export default class MockTaxonomyNavigationService implements ITaxonomyNavigationService {
getMenuItems(): Promise<IMenuItem[]>;
}
@@ -1,109 +0,0 @@
import * as uuid from 'uuid';
var MockTaxonomyNavigationService = (function () {
function MockTaxonomyNavigationService() {
}
MockTaxonomyNavigationService.prototype.getMenuItems = function () {
return new Promise(function (resolve) {
resolve([
{
id: uuid.v4(),
label: 'Menu Item 1',
url: 'https://www.bing.com',
hoverText: 'Hover me!',
pathDepth: 1,
hasChildren: function () { return true; },
items: [
{
id: uuid.v4(),
label: 'Submenu Item 1',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return false; }
},
{
id: uuid.v4(),
label: 'Submenu Item 2',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return false; }
}
]
},
{
id: uuid.v4(),
label: 'Menu Item 2',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 1,
hasChildren: function () { return false; }
},
{
id: uuid.v4(),
label: 'Menu Item 3',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 1,
hasChildren: function () { return true; },
items: [
{
id: uuid.v4(),
label: 'Submenu Item 1',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return false; }
},
{
id: uuid.v4(),
label: 'Submenu Item 2',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return true; },
items: [
{
id: uuid.v4(),
label: 'Submenu Item 1',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 3,
hasChildren: function () { return false; }
},
{
id: uuid.v4(),
label: 'Submenu Item 2',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 3,
hasChildren: function () { return false; }
}
]
},
{
id: uuid.v4(),
label: 'Submenu Item 3',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return false; }
},
{
id: uuid.v4(),
label: 'Submenu Item 4',
hoverText: 'Huch!',
url: 'https://www.bing.com',
pathDepth: 2,
hasChildren: function () { return false; }
}
]
}
]);
});
};
return MockTaxonomyNavigationService;
}());
export default MockTaxonomyNavigationService;
//# sourceMappingURL=MockTaxonomyNavigationService.js.map
File diff suppressed because one or more lines are too long
-80
View File
@@ -1,80 +0,0 @@
import { ITermStore, ITermSet } from './ISPTermStorePickerService';
import { ISPTermStorePickerServiceProps } from './ISPTermStorePickerServiceProps';
import { IPickerTerm } from './IPickerTerm';
import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
/**
* Service implementation to manage term stores in SharePoint
*/
export default class SPTermStorePickerService {
private props;
private context;
private debug;
private clientServiceUrl;
private suggestionServiceUrl;
/**
* Service constructor
*/
constructor(props: ISPTermStorePickerServiceProps, context: ApplicationCustomizerContext, debug?: boolean);
getTermLabels(termId: string): Promise<string[]>;
/**
* Gets the collection of term stores in the current SharePoint env
*/
getTermStores(): Promise<ITermStore[]>;
/**
* Gets the current term set
*/
getTermSet(): Promise<ITermSet>;
/**
* Retrieve all terms for the given term set
* @param termset
*/
getAllTerms(termset: string, hideDeprecatedTags?: boolean, hideTagsNotAvailableForTagging?: boolean, useSessionStorage?: boolean, cacheMinutes?: number): Promise<ITermSet>;
/**
* Retrieve all terms that starts with the searchText
* @param searchText
*/
searchTermsByName(searchText: string): Promise<IPickerTerm[]>;
searchTermsByTermId(searchText: string, termId: string): Promise<IPickerTerm[]>;
/**
* Retrieve all terms for the given term set and anchorId
*/
getAllTermsByAnchorId(termsetNameOrID: string, anchorId: string, hideDeprecatedTags?: boolean, hideTagsNotAvailableForTagging?: boolean, useSessionStorage?: boolean): Promise<IPickerTerm[]>;
/**
* Clean the Guid from the Web Service response
* @param guid
*/
cleanGuid(guid: string): string;
/**
* Get the term set ID by its name
* @param termstore
* @param termset
*/
private getTermSetId(termstore, termsetName);
private getCachedTermSet(termId, useSessionStorage?);
private getCachedPickerTerms(termId, useSessionStorage?);
private normalizeCacheMinutes(value);
private ensureSuccessfulResponse(response, operation);
private searchTermsBySearchText(terms, searchText);
/**
* Searches terms for the given term set
* @param searchText
* @param termsetId
*/
private searchTermsByTermSet(searchText);
private isGuid(strGuid);
/**
* Sorting terms based on their path and depth
*
* @param terms
*/
private sortTerms(terms);
/**
* Sort the terms by their path
*
* @param a term 2
* @param b term 2
*/
private sortTermByPath(a, b);
private convertTermToPickerTerm(term);
private convertSuggestTermToPickerTerm(term);
}
-632
View File
@@ -1,632 +0,0 @@
/* tslint:disable:no-null-keyword max-line-length typedef no-any no-string-literal variable-name */
/**
* This code is a copy from the library @pnp/sp-dev-fx-controls-react
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import { SPHttpClient } from '@microsoft/sp-http';
import { findIndex } from '@microsoft/sp-lodash-subset';
import { debugError } from './MegaMenuDebug';
var EmptyGuid = '00000000-0000-0000-0000-000000000000';
var TermCachePrefix = 'MegaMenu:TermSet:v2:';
var PickerCachePrefix = 'MegaMenu:PickerTerms:v2:';
/**
* Service implementation to manage term stores in SharePoint
*/
var SPTermStorePickerService = (function () {
/**
* Service constructor
*/
function SPTermStorePickerService(props, context, debug) {
if (debug === void 0) { debug = false; }
this.props = props;
this.context = context;
this.debug = debug;
this.clientServiceUrl = this.context.pageContext.web.absoluteUrl + '/_vti_bin/client.svc/ProcessQuery';
this.suggestionServiceUrl = this.context.pageContext.web.absoluteUrl + '/_vti_bin/TaxonomyInternalService.json/GetSuggestions';
}
SPTermStorePickerService.prototype.getTermLabels = function (termId) {
return __awaiter(this, void 0, void 0, function () {
var result, data, reqHeaders, httpPostOptions, callResult, jsonResult, node, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
result = null;
_a.label = 1;
case 1:
_a.trys.push([1, 4, , 5]);
data = "<Request AddExpandoFieldTypeSuffix=\"true\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\".NET Library\" xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\"><Actions><ObjectPath Id=\"8\" ObjectPathId=\"7\" /><ObjectIdentityQuery Id=\"9\" ObjectPathId=\"7\" /><ObjectPath Id=\"11\" ObjectPathId=\"10\" /><ObjectIdentityQuery Id=\"12\" ObjectPathId=\"10\" /><ObjectPath Id=\"14\" ObjectPathId=\"13\" /><ObjectIdentityQuery Id=\"15\" ObjectPathId=\"13\" /><Query Id=\"16\" ObjectPathId=\"13\"><Query SelectAllProperties=\"false\"><Properties><Property Name=\"Labels\" SelectAll=\"true\"><Query SelectAllProperties=\"false\"><Properties /></Query></Property></Properties></Query></Query></Actions><ObjectPaths><StaticMethod Id=\"7\" Name=\"GetTaxonomySession\" TypeId=\"{981cbc68-9edc-4f8d-872f-71146fcbb84f}\" /><Method Id=\"10\" ParentId=\"7\" Name=\"GetDefaultSiteCollectionTermStore\" /><Method Id=\"13\" ParentId=\"10\" Name=\"GetTerm\"><Parameters><Parameter Type=\"Guid\">" + termId + "</Parameter></Parameters></Method></ObjectPaths></Request>";
reqHeaders = new Headers();
reqHeaders.append('accept', 'application/json');
reqHeaders.append('content-type', 'application/xml');
httpPostOptions = {
headers: reqHeaders,
body: data
};
return [4 /*yield*/, this.context.spHttpClient.post(this.clientServiceUrl, SPHttpClient.configurations.v1, httpPostOptions)];
case 2:
callResult = _a.sent();
this.ensureSuccessfulResponse(callResult, 'Term labels');
return [4 /*yield*/, callResult.json()];
case 3:
jsonResult = _a.sent();
node = jsonResult.find(function (x) { return x._ObjectType_ === 'SP.Taxonomy.Term'; });
if (node && node.Labels && node.Labels._Child_Items_) {
result = node.Labels._Child_Items_.map(function (termLabel) { return termLabel.Value; });
}
return [3 /*break*/, 5];
case 4:
error_1 = _a.sent();
result = null;
debugError(this.debug, 'SPTermStorePickerService', 'Error reading term labels.', error_1);
return [3 /*break*/, 5];
case 5: return [2 /*return*/, result];
}
});
});
};
/**
* Gets the collection of term stores in the current SharePoint env
*/
SPTermStorePickerService.prototype.getTermStores = function () {
var _this = this;
// Retrieve the term store name, groups, and term sets
var data = '<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectIdentityQuery Id="3" ObjectPathId="1" /><ObjectPath Id="5" ObjectPathId="4" /><ObjectIdentityQuery Id="6" ObjectPathId="4" /><Query Id="7" ObjectPathId="4"><Query SelectAllProperties="false"><Properties><Property Name="Id" ScalarProperty="true" /><Property Name="Name" ScalarProperty="true" /><Property Name="Groups"><Query SelectAllProperties="false"><Properties /></Query><ChildItemQuery SelectAllProperties="false"><Properties><Property Name="Name" ScalarProperty="true" /><Property Name="Id" ScalarProperty="true" /><Property Name="IsSystemGroup" ScalarProperty="true" /><Property Name="TermSets"><Query SelectAllProperties="false"><Properties /></Query><ChildItemQuery SelectAllProperties="false"><Properties><Property Name="Name" ScalarProperty="true" /><Property Name="Id" ScalarProperty="true" /><Property Name="Description" ScalarProperty="true" /><Property Name="Names" ScalarProperty="true" /></Properties></ChildItemQuery></Property></Properties></ChildItemQuery></Property></Properties></Query></Query></Actions><ObjectPaths><StaticMethod Id="1" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="4" ParentId="1" Name="GetDefaultSiteCollectionTermStore" /></ObjectPaths></Request>';
var reqHeaders = new Headers();
reqHeaders.append('accept', 'application/json');
reqHeaders.append('content-type', 'application/xml');
var httpPostOptions = {
headers: reqHeaders,
body: data
};
return this.context.spHttpClient.post(this.clientServiceUrl, SPHttpClient.configurations.v1, httpPostOptions).then(function (serviceResponse) {
_this.ensureSuccessfulResponse(serviceResponse, 'Term stores');
return serviceResponse.json().then(function (serviceJSONResponse) {
// Construct results
var termStoreResult = serviceJSONResponse.filter(function (r) { return r['_ObjectType_'] === 'SP.Taxonomy.TermStore'; });
// Check if term store was retrieved
if (termStoreResult.length > 0) {
// Check if the termstore needs to be filtered or limited
if (_this.props.termsetNameOrID) {
return termStoreResult.map(function (termstore) {
var termGroups = termstore.Groups._Child_Items_;
// Check if the groups have to be limited to a specific term set
if (_this.props.termsetNameOrID) {
var termsetNameOrId_1 = _this.props.termsetNameOrID;
termGroups = termGroups.map(function (group) {
group.TermSets._Child_Items_ = group.TermSets._Child_Items_.filter(function (termSet) { return termSet.Name === termsetNameOrId_1 || _this.cleanGuid(termSet.Id).toLowerCase() === _this.cleanGuid(termsetNameOrId_1).toLowerCase(); });
return group;
});
}
// Filter out all systen groups
termGroups = termGroups.filter(function (group) { return !group.IsSystemGroup; });
// Filter out empty groups
termGroups = termGroups.filter(function (group) { return group.TermSets._Child_Items_.length > 0; });
// Map the new groups
termstore.Groups._Child_Items_ = termGroups;
return termstore;
});
}
// Return the term store results
return termStoreResult;
}
return [];
});
});
};
/**
* Gets the current term set
*/
SPTermStorePickerService.prototype.getTermSet = function () {
return __awaiter(this, void 0, void 0, function () {
var termStore;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getTermStores()];
case 1:
termStore = _a.sent();
return [2 /*return*/, this.getTermSetId(termStore, this.props.termsetNameOrID)];
}
});
});
};
/**
* Retrieve all terms for the given term set
* @param termset
*/
SPTermStorePickerService.prototype.getAllTerms = function (termset, hideDeprecatedTags, hideTagsNotAvailableForTagging, useSessionStorage, cacheMinutes) {
if (useSessionStorage === void 0) { useSessionStorage = true; }
if (cacheMinutes === void 0) { cacheMinutes = 15; }
return __awaiter(this, void 0, void 0, function () {
var _this = this;
var termsetId, termStore, crntTermSet, childTerms, data, reqHeaders, httpPostOptions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
termsetId = termset;
if (!!this.isGuid(termset)) return [3 /*break*/, 2];
return [4 /*yield*/, this.getTermStores()];
case 1:
termStore = _a.sent();
crntTermSet = this.getTermSetId(termStore, termset);
if (crntTermSet) {
termsetId = this.cleanGuid(crntTermSet.Id);
}
else {
return [2 /*return*/, null];
}
_a.label = 2;
case 2:
childTerms = this.getCachedTermSet(termsetId, useSessionStorage);
if (childTerms) {
return [2 /*return*/, childTerms];
}
data = "<Request xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\"Javascript Library\"><Actions><ObjectPath Id=\"1\" ObjectPathId=\"0\" /><ObjectIdentityQuery Id=\"2\" ObjectPathId=\"0\" /><ObjectPath Id=\"4\" ObjectPathId=\"3\" /><ObjectIdentityQuery Id=\"5\" ObjectPathId=\"3\" /><ObjectPath Id=\"7\" ObjectPathId=\"6\" /><ObjectIdentityQuery Id=\"8\" ObjectPathId=\"6\" /><ObjectPath Id=\"10\" ObjectPathId=\"9\" /><Query Id=\"11\" ObjectPathId=\"6\"><Query SelectAllProperties=\"true\"><Properties /></Query></Query><Query Id=\"12\" ObjectPathId=\"9\"><Query SelectAllProperties=\"false\"><Properties /></Query><ChildItemQuery SelectAllProperties=\"false\"><Properties><Property Name=\"IsRoot\" SelectAll=\"true\" /><Property Name=\"Labels\" SelectAll=\"true\" /><Property Name=\"TermsCount\" SelectAll=\"true\" /><Property Name=\"CustomSortOrder\" SelectAll=\"true\" /><Property Name=\"Id\" SelectAll=\"true\" /><Property Name=\"Name\" SelectAll=\"true\" /><Property Name=\"PathOfTerm\" SelectAll=\"true\" /><Property Name=\"Parent\" SelectAll=\"true\" /><Property Name=\"LocalCustomProperties\" SelectAll=\"true\" /><Property Name=\"IsDeprecated\" ScalarProperty=\"true\" /><Property Name=\"IsAvailableForTagging\" ScalarProperty=\"true\" /></Properties></ChildItemQuery></Query></Actions><ObjectPaths><StaticMethod Id=\"0\" Name=\"GetTaxonomySession\" TypeId=\"{981cbc68-9edc-4f8d-872f-71146fcbb84f}\" /><Method Id=\"3\" ParentId=\"0\" Name=\"GetDefaultSiteCollectionTermStore\" /><Method Id=\"6\" ParentId=\"3\" Name=\"GetTermSet\"><Parameters><Parameter Type=\"Guid\">" + termsetId + "</Parameter></Parameters></Method><Method Id=\"9\" ParentId=\"6\" Name=\"GetAllTerms\" /></ObjectPaths></Request>";
reqHeaders = new Headers();
reqHeaders.append('accept', 'application/json');
reqHeaders.append('content-type', 'application/xml');
httpPostOptions = {
headers: reqHeaders,
body: data
};
return [2 /*return*/, this.context.spHttpClient.post(this.clientServiceUrl, SPHttpClient.configurations.v1, httpPostOptions).then(function (serviceResponse) {
_this.ensureSuccessfulResponse(serviceResponse, 'Terms');
return serviceResponse.json().then(function (serviceJSONResponse) {
if (!Array.isArray(serviceJSONResponse)) {
throw new Error('The taxonomy service returned an unexpected response.');
}
var termStoreResultTermSets = serviceJSONResponse.filter(function (r) { return r['_ObjectType_'] === 'SP.Taxonomy.TermSet'; });
if (termStoreResultTermSets.length > 0) {
var termStoreResultTermSet_1 = termStoreResultTermSets[0];
termStoreResultTermSet_1.Terms = [];
// Retrieve the term collection results
var termStoreResultTerms = serviceJSONResponse.filter(function (r) { return r['_ObjectType_'] === 'SP.Taxonomy.TermCollection'; });
if (termStoreResultTerms.length > 0) {
// Retrieve all terms
var terms = termStoreResultTerms[0]._Child_Items_;
if (hideDeprecatedTags === true) {
terms = terms.filter(function (d) { return d.IsDeprecated === false; });
}
if (hideTagsNotAvailableForTagging === true) {
terms = terms.filter(function (d) { return d.IsAvailableForTagging === true; });
}
// Clean the term ID and specify the path depth
terms = terms.map(function (term) {
if (term.IsRoot) {
term.CustomSortOrderIndex = (termStoreResultTermSet_1.CustomSortOrder) ? termStoreResultTermSet_1.CustomSortOrder.split(':').indexOf(_this.cleanGuid(term.Id)) : -1;
}
else {
term.CustomSortOrderIndex = (term['Parent'].CustomSortOrder) ? term['Parent'].CustomSortOrder.split(':').indexOf(_this.cleanGuid(term.Id)) : -1;
}
term.Id = _this.cleanGuid(term.Id);
term['PathDepth'] = term.PathOfTerm.split(';').length;
term.TermSet = { Id: _this.cleanGuid(termStoreResultTermSet_1.Id), Name: termStoreResultTermSet_1.Name };
if (term['Parent']) {
term.ParentId = _this.cleanGuid(term['Parent'].Id);
}
return term;
});
// Check if the term set was not empty
if (terms.length > 0) {
// Sort the terms by PathOfTerm and their depth
terms = _this.sortTerms(terms);
termStoreResultTermSet_1.Terms = terms;
}
}
try {
if (useSessionStorage && window.sessionStorage) {
var ttlMinutes = _this.normalizeCacheMinutes(cacheMinutes);
var cacheEntry = {
expiresAt: Date.now() + ttlMinutes * 60 * 1000,
value: termStoreResultTermSet_1
};
window.sessionStorage.setItem(TermCachePrefix + termsetId, JSON.stringify(cacheEntry));
}
}
catch (error) {
// Do nothing, sometimes "storage quota exceeded" error if too many items
}
return termStoreResultTermSet_1;
}
return null;
});
})];
}
});
});
};
/**
* Retrieve all terms that starts with the searchText
* @param searchText
*/
SPTermStorePickerService.prototype.searchTermsByName = function (searchText) {
return this.searchTermsByTermSet(searchText);
};
SPTermStorePickerService.prototype.searchTermsByTermId = function (searchText, termId) {
return __awaiter(this, void 0, void 0, function () {
var useSessionStorage, childTerms, _a, termsetNameOrID, hideDeprecatedTags, hideTagsNotAvailableForTagging, terms;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
useSessionStorage = this.props.useSessionStorage;
childTerms = this.getCachedPickerTerms(termId, useSessionStorage);
if (!childTerms) return [3 /*break*/, 1];
return [2 /*return*/, this.searchTermsBySearchText(childTerms, searchText)];
case 1:
_a = this.props, termsetNameOrID = _a.termsetNameOrID, hideDeprecatedTags = _a.hideDeprecatedTags, hideTagsNotAvailableForTagging = _a.hideTagsNotAvailableForTagging;
return [4 /*yield*/, this.getAllTermsByAnchorId(termsetNameOrID, termId, hideDeprecatedTags, hideTagsNotAvailableForTagging, useSessionStorage)];
case 2:
terms = _b.sent();
if (terms) {
return [2 /*return*/, this.searchTermsBySearchText(terms, searchText)];
}
_b.label = 3;
case 3: return [2 /*return*/, null];
}
});
});
};
/**
* Retrieve all terms for the given term set and anchorId
*/
SPTermStorePickerService.prototype.getAllTermsByAnchorId = function (termsetNameOrID, anchorId, hideDeprecatedTags, hideTagsNotAvailableForTagging, useSessionStorage) {
if (useSessionStorage === void 0) { useSessionStorage = true; }
return __awaiter(this, void 0, void 0, function () {
var _this = this;
var returnTerms, childTerms, termSet, terms, anchorTerm_1, anchorTermPath_1, anchorTerms, cacheEntry;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
returnTerms = [];
childTerms = this.getCachedPickerTerms(anchorId, useSessionStorage);
if (childTerms) {
return [2 /*return*/, childTerms];
}
return [4 /*yield*/, this.getAllTerms(termsetNameOrID, hideDeprecatedTags, hideTagsNotAvailableForTagging, useSessionStorage, this.props.cacheMinutes)];
case 1:
termSet = _a.sent();
terms = termSet.Terms;
if (anchorId) {
anchorTerm_1 = terms.filter(function (t) { return t.Id.toLowerCase() === anchorId.toLowerCase(); }).shift();
if (anchorTerm_1) {
anchorTermPath_1 = anchorTerm_1.PathOfTerm + ";";
anchorTerms = terms.filter(function (t) { return t.PathOfTerm.substring(0, anchorTermPath_1.length) === anchorTermPath_1 && t.Id !== anchorTerm_1.Id; });
anchorTerms.forEach(function (term) {
returnTerms.push(_this.convertTermToPickerTerm(term));
});
try {
if (useSessionStorage && window.sessionStorage) {
cacheEntry = {
expiresAt: Date.now() + this.normalizeCacheMinutes(this.props.cacheMinutes) * 60 * 1000,
value: returnTerms
};
window.sessionStorage.setItem(PickerCachePrefix + anchorId, JSON.stringify(cacheEntry));
}
}
catch (error) {
// Do nothing
}
}
}
else {
terms.forEach(function (term) {
returnTerms.push(_this.convertTermToPickerTerm(term));
});
}
return [2 /*return*/, returnTerms];
}
});
});
};
/**
* Clean the Guid from the Web Service response
* @param guid
*/
SPTermStorePickerService.prototype.cleanGuid = function (guid) {
if (guid !== undefined) {
return guid.replace('/Guid(', '').replace('/', '').replace(')', '');
}
else {
return '';
}
};
/**
* Get the term set ID by its name
* @param termstore
* @param termset
*/
SPTermStorePickerService.prototype.getTermSetId = function (termstore, termsetName) {
if (termstore && termstore.length > 0 && termsetName) {
// Get the first term store
var ts = termstore[0];
// Check if the term store contains groups
if (ts.Groups && ts.Groups._Child_Items_) {
for (var _i = 0, _a = ts.Groups._Child_Items_; _i < _a.length; _i++) {
var group = _a[_i];
// Check if the group contains term sets
if (group.TermSets && group.TermSets._Child_Items_) {
for (var _b = 0, _c = group.TermSets._Child_Items_; _b < _c.length; _b++) {
var termSet = _c[_b];
// Check if the term set is found
if (termSet.Name === termsetName) {
return termSet;
}
}
}
}
}
}
return null;
};
SPTermStorePickerService.prototype.getCachedTermSet = function (termId, useSessionStorage) {
if (useSessionStorage === void 0) { useSessionStorage = true; }
try {
if (useSessionStorage && window.sessionStorage) {
var key = TermCachePrefix + termId;
var terms = window.sessionStorage.getItem(key);
if (!terms) {
return null;
}
var cacheEntry = JSON.parse(terms);
if (!cacheEntry || !cacheEntry.value || !cacheEntry.expiresAt || cacheEntry.expiresAt <= Date.now()) {
window.sessionStorage.removeItem(key);
return null;
}
return cacheEntry.value;
}
else {
return null;
}
}
catch (error) {
return null;
}
};
SPTermStorePickerService.prototype.getCachedPickerTerms = function (termId, useSessionStorage) {
if (useSessionStorage === void 0) { useSessionStorage = true; }
try {
if (!useSessionStorage || !window.sessionStorage) {
return null;
}
var key = PickerCachePrefix + termId;
var serialized = window.sessionStorage.getItem(key);
if (!serialized) {
return null;
}
var cacheEntry = JSON.parse(serialized);
if (!cacheEntry || !cacheEntry.value || !cacheEntry.expiresAt || cacheEntry.expiresAt <= Date.now()) {
window.sessionStorage.removeItem(key);
return null;
}
return cacheEntry.value;
}
catch (error) {
return null;
}
};
SPTermStorePickerService.prototype.normalizeCacheMinutes = function (value) {
if (typeof value !== 'number' || !isFinite(value)) {
return 15;
}
return Math.min(Math.max(Math.floor(value), 1), 1440);
};
SPTermStorePickerService.prototype.ensureSuccessfulResponse = function (response, operation) {
if (!response.ok) {
throw new Error(operation + ' request failed (' + response.status + ' ' + response.statusText + ').');
}
};
SPTermStorePickerService.prototype.searchTermsBySearchText = function (terms, searchText) {
if (terms) {
return terms.filter(function (t) { return t.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1; });
}
else {
return [];
}
};
/**
* Searches terms for the given term set
* @param searchText
* @param termsetId
*/
SPTermStorePickerService.prototype.searchTermsByTermSet = function (searchText) {
var _this = this;
return new Promise(function (resolve) {
_this.getTermStores().then(function (termStore) {
var termSetId = _this.props.termsetNameOrID;
if (!_this.isGuid(termSetId)) {
// Get the ID of the provided term set name
var crntTermSet = _this.getTermSetId(termStore, termSetId);
if (crntTermSet) {
termSetId = _this.cleanGuid(crntTermSet.Id);
}
else {
resolve(null);
return;
}
}
if (termStore === undefined || termStore.length === 0) {
resolve(null);
return;
}
var loc = _this.context.pageContext.cultureInfo.currentUICultureName === 'de-de' ? 1031 : 1033;
var data = {
start: searchText,
lcid: loc !== 0 ? loc : _this.context.pageContext.web.language,
sspList: _this.cleanGuid(termStore[0].Id),
termSetList: termSetId,
anchorId: _this.props.anchorId ? _this.props.anchorId : EmptyGuid,
isSpanTermStores: false,
isSpanTermSets: false,
isIncludeUnavailable: _this.props.hideTagsNotAvailableForTagging === true,
isIncludeDeprecated: _this.props.hideDeprecatedTags === true,
isAddTerms: false,
isIncludePathData: false,
excludeKeyword: false,
excludedTermset: EmptyGuid
};
var reqHeaders = new Headers();
reqHeaders.append('accept', 'application/json');
reqHeaders.append('content-type', 'application/json');
var httpPostOptions = {
headers: reqHeaders,
body: JSON.stringify(data)
};
return _this.context.spHttpClient.post(_this.suggestionServiceUrl, SPHttpClient.configurations.v1, httpPostOptions).then(function (serviceResponse) {
return serviceResponse.json().then(function (serviceJSONResponse) {
var groups = serviceJSONResponse.d.Groups;
if (groups && groups.length > 0) {
// Retrieve the term collection results
var terms = groups[0].Suggestions;
if (terms.length > 0) {
// Retrieve all terms
var returnTerms = terms.map(function (term) { return _this.convertSuggestTermToPickerTerm(term); });
resolve(returnTerms);
return;
}
}
resolve([]);
});
});
});
});
};
SPTermStorePickerService.prototype.isGuid = function (strGuid) {
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(strGuid);
};
/**
* Sorting terms based on their path and depth
*
* @param terms
*/
SPTermStorePickerService.prototype.sortTerms = function (terms) {
// Start sorting by depth
var newTermsOrder = [];
var itemsToSort = true;
var pathLevel = 1;
while (itemsToSort) {
// Get terms for the current level
var crntTerms = terms.filter(function (term) { return term.PathDepth === pathLevel; });
if (crntTerms && crntTerms.length > 0) {
crntTerms = crntTerms.sort(this.sortTermByPath);
if (pathLevel !== 1) {
crntTerms = crntTerms.reverse();
var _loop_1 = function (crntTerm) {
var pathElms = crntTerm.PathOfTerm.split(';');
// Last item is not needed for parent path
pathElms.pop();
// Find the parent item and add the new item
var idx = findIndex(newTermsOrder, function (term) { return term.PathOfTerm === pathElms.join(';'); });
if (idx !== -1) {
newTermsOrder.splice(idx + 1, 0, crntTerm);
}
else {
// Push the item at the end if the parent couldn't be found
newTermsOrder.push(crntTerm);
}
};
for (var _i = 0, crntTerms_1 = crntTerms; _i < crntTerms_1.length; _i++) {
var crntTerm = crntTerms_1[_i];
_loop_1(crntTerm);
}
}
else {
newTermsOrder = crntTerms;
}
++pathLevel;
}
else {
itemsToSort = false;
}
}
return newTermsOrder;
};
/**
* Sort the terms by their path
*
* @param a term 2
* @param b term 2
*/
SPTermStorePickerService.prototype.sortTermByPath = function (a, b) {
if (a.CustomSortOrderIndex === -1) {
if (a.PathOfTerm.toLowerCase() < b.PathOfTerm.toLowerCase()) {
return -1;
}
if (a.PathOfTerm.toLowerCase() > b.PathOfTerm.toLowerCase()) {
return 1;
}
return 0;
}
else {
if (a.CustomSortOrderIndex < b.CustomSortOrderIndex) {
return -1;
}
if (a.CustomSortOrderIndex > b.CustomSortOrderIndex) {
return 1;
}
return 0;
}
};
SPTermStorePickerService.prototype.convertTermToPickerTerm = function (term) {
return {
key: this.cleanGuid(term.Id),
name: term.Name,
path: term.PathOfTerm,
termSet: this.cleanGuid(term.TermSet.Id),
termSetName: term.TermSet.Name
};
};
SPTermStorePickerService.prototype.convertSuggestTermToPickerTerm = function (term) {
var path = '';
var termSetName = '';
if (term.Paths && term.Paths.length > 0) {
var fullPath = term.Paths[0].replace(/^\[/, '').replace(/\]$/, '');
var fullPathParts = fullPath.split(':');
path = fullPathParts.join(';') + ';' + term.DefaultLabel;
termSetName = fullPathParts[0];
}
return {
key: this.cleanGuid(term.Id),
name: term.DefaultLabel,
path: path,
termSet: EmptyGuid,
termSetName: termSetName
};
};
return SPTermStorePickerService;
}());
export default SPTermStorePickerService;
//# sourceMappingURL=SPTermStorePickerService.js.map
File diff suppressed because one or more lines are too long
-12
View File
@@ -1,12 +0,0 @@
import { ITaxonomyNavigationService } from './ITaxonomyNavigationService';
import { IMenuItem } from './IMenuItem';
import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
export declare class TaxonomyNavigationService implements ITaxonomyNavigationService {
private context;
private termSetNameOrId;
private debug;
private cacheMinutes;
private _taxonomyPickerService;
constructor(context: ApplicationCustomizerContext, termSetNameOrId: string, debug?: boolean, cacheMinutes?: number);
getMenuItems(): Promise<IMenuItem[]>;
}
-104
View File
@@ -1,104 +0,0 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
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, 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: termSetNameOrId,
useSessionStorage: true,
hideDeprecatedTags: true,
hideTagsNotAvailableForTagging: true,
cacheMinutes: cacheMinutes
}, this.context, this.debug);
}
TaxonomyNavigationService.prototype.getMenuItems = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
var siteCollectionUrl, termset, itemsDict, menuItems;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
siteCollectionUrl = this.context.pageContext.site.absoluteUrl;
return [4 /*yield*/, this._taxonomyPickerService.getAllTerms(this.termSetNameOrId, true, true, true, this.cacheMinutes)];
case 1:
termset = _a.sent();
itemsDict = new ItemDictionary();
menuItems = [];
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) {
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 {
debugWarn(_this.debug, LOG_SOURCE, 'Item without parent:', term.PathOfTerm);
}
}
});
return [2 /*return*/, menuItems];
}
});
});
};
return TaxonomyNavigationService;
}());
export { TaxonomyNavigationService };
//# sourceMappingURL=TaxonomyNavigationService.js.map
File diff suppressed because one or more lines are too long
@@ -1,20 +0,0 @@
export interface IUserCustomActionProps {
Id?: string;
Title: string;
Name?: string;
Description?: string;
Location: string;
ScriptSrc?: string;
ScriptBlock?: string;
Url?: string;
Sequence?: number;
Group?: string;
ImageUrl?: string;
CommandUIExtension?: string;
RegistrationType?: number;
RegistrationId?: string;
Rights?: {};
Scope?: number;
ClientSideComponentId?: string;
ClientSideComponentProperties?: string;
}
@@ -1,3 +0,0 @@
//# sourceMappingURL=IUserCustomActionProps.js.map
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/UserCustomActionService/IUserCustomActionProps.js","sourcesContent":[],"sourceRoot":"..\\..\\..\\src"}
@@ -1,10 +0,0 @@
import { UserCustomActionScope } from './UserCustomActionScope';
import { IUserCustomActionProps } from './IUserCustomActionProps';
import { UserCustomActionAddResult, UserCustomActionUpdateResult } from '@pnp/sp';
export interface IUserCustomActionService {
getUserCustomActions(scope: UserCustomActionScope, listId?: string): Promise<IUserCustomActionProps[]>;
getUserCustomActionById(scope: UserCustomActionScope, id: string, listId?: string): Promise<IUserCustomActionProps>;
addUserCustomAction(scope: UserCustomActionScope, customAction: IUserCustomActionProps, listId?: string): Promise<UserCustomActionAddResult>;
updateUserCustomAction(scope: UserCustomActionScope, id: string, props: {}, listId?: string): Promise<UserCustomActionUpdateResult>;
deleteUserCustomAction(scope: UserCustomActionScope, customAction: IUserCustomActionProps, listId?: string): Promise<void>;
}
@@ -1,3 +0,0 @@
//# sourceMappingURL=IUserCustomActionService.js.map
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"services/UserCustomActionService/IUserCustomActionService.js","sourcesContent":[],"sourceRoot":"..\\..\\..\\src"}
@@ -1,5 +0,0 @@
export declare enum UserCustomActionScope {
Web = "web",
Site = "site",
List = "list",
}
@@ -1,8 +0,0 @@
export var UserCustomActionScope;
(function (UserCustomActionScope) {
UserCustomActionScope["Web"] = "web";
UserCustomActionScope["Site"] = "site";
UserCustomActionScope["List"] = "list";
})(UserCustomActionScope = UserCustomActionScope || (UserCustomActionScope = {}));
//# sourceMappingURL=UserCustomActionScope.js.map
@@ -1 +0,0 @@
{"version":3,"sources":["services/UserCustomActionService/UserCustomActionScope.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,sCAAa,CAAA;IACb,sCAAa,CAAA;AACjB,CAAC,EAJW,qBAAqB,GAArB,qBAAqB,KAArB,qBAAqB,QAIhC","file":"services/UserCustomActionService/UserCustomActionScope.js","sourcesContent":["export enum UserCustomActionScope {\r\n Web = 'web',\r\n Site = 'site',\r\n List = 'list'\r\n}\r\n"],"sourceRoot":"..\\..\\..\\src"}
@@ -1,14 +0,0 @@
import { UserCustomActionAddResult, UserCustomActionUpdateResult } from '@pnp/sp/src/usercustomactions';
import { IUserCustomActionService } from './IUserCustomActionService';
import { UserCustomActionScope } from './UserCustomActionScope';
import { IUserCustomActionProps } from './IUserCustomActionProps';
import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
export declare class UserCustomActionService implements IUserCustomActionService {
private debug;
constructor(context: ApplicationCustomizerContext, debug?: boolean);
getUserCustomActions(scope: UserCustomActionScope, listId?: string): Promise<IUserCustomActionProps[]>;
getUserCustomActionById(scope: UserCustomActionScope, id: string, listId?: string): Promise<IUserCustomActionProps>;
addUserCustomAction(scope: UserCustomActionScope, customAction: IUserCustomActionProps, listId?: string): Promise<UserCustomActionAddResult>;
updateUserCustomAction(scope: UserCustomActionScope, id: string, props: {}, listId?: string): Promise<UserCustomActionUpdateResult>;
deleteUserCustomAction(scope: UserCustomActionScope, customAction: IUserCustomActionProps, listId?: string): Promise<void>;
}
@@ -1,214 +0,0 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import { sp } from '@pnp/sp';
import { UserCustomActionScope } from './UserCustomActionScope';
import { debugError } from '../MegaMenuDebug';
var LOG_SOURCE = 'UserCustomActionService';
var UserCustomActionService = (function () {
function UserCustomActionService(context, debug) {
if (debug === void 0) { debug = false; }
this.debug = debug;
sp.setup({
spfxContext: context
});
}
UserCustomActionService.prototype.getUserCustomActions = function (scope, listId) {
return __awaiter(this, void 0, void 0, function () {
var actions, _a, error_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 9, , 10]);
actions = void 0;
_a = scope;
switch (_a) {
case UserCustomActionScope.Web: return [3 /*break*/, 1];
case UserCustomActionScope.Site: return [3 /*break*/, 3];
case UserCustomActionScope.List: return [3 /*break*/, 5];
}
return [3 /*break*/, 7];
case 1: return [4 /*yield*/, sp.web.userCustomActions.get()];
case 2:
actions = _b.sent();
return [3 /*break*/, 8];
case 3: return [4 /*yield*/, sp.site.userCustomActions.get()];
case 4:
actions = _b.sent();
return [3 /*break*/, 8];
case 5:
if (!listId) {
throw new Error('List ID is required for List scope');
}
return [4 /*yield*/, sp.web.lists.getById(listId).userCustomActions.get()];
case 6:
actions = _b.sent();
return [3 /*break*/, 8];
case 7: throw new Error('Invalid scope');
case 8: return [2 /*return*/, actions];
case 9:
error_1 = _b.sent();
debugError(this.debug, LOG_SOURCE, 'Error getting user custom actions.', error_1);
throw error_1;
case 10: return [2 /*return*/];
}
});
});
};
UserCustomActionService.prototype.getUserCustomActionById = function (scope, id, listId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
try {
switch (scope) {
case UserCustomActionScope.Web:
return [2 /*return*/, sp.web.userCustomActions.getById(id)];
case UserCustomActionScope.Site:
return [2 /*return*/, sp.site.userCustomActions.getById(id)];
case UserCustomActionScope.List:
if (!listId) {
throw new Error('List ID is required for List scope');
}
return [2 /*return*/, sp.web.lists.getById(listId).userCustomActions.getById(id)];
default:
throw new Error('Invalid scope');
}
}
catch (error) {
debugError(this.debug, LOG_SOURCE, 'Error getting user custom action by ID.', error);
throw error;
}
return [2 /*return*/];
});
});
};
UserCustomActionService.prototype.addUserCustomAction = function (scope, customAction, listId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
try {
switch (scope) {
case UserCustomActionScope.Web:
return [2 /*return*/, sp.web.userCustomActions.add(customAction)];
case UserCustomActionScope.Site:
return [2 /*return*/, sp.site.userCustomActions.add(customAction)];
case UserCustomActionScope.List:
if (!listId) {
throw new Error('List ID is required for List scope');
}
return [2 /*return*/, sp.web.lists.getById(listId).userCustomActions.add(customAction)];
default:
throw new Error('Invalid scope');
}
}
catch (error) {
debugError(this.debug, LOG_SOURCE, 'Error adding user custom action.', error);
throw error;
}
return [2 /*return*/];
});
});
};
UserCustomActionService.prototype.updateUserCustomAction = function (scope, id, props, listId) {
return __awaiter(this, void 0, void 0, function () {
var result, _a, error_2;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 9, , 10]);
result = void 0;
_a = scope;
switch (_a) {
case UserCustomActionScope.Web: return [3 /*break*/, 1];
case UserCustomActionScope.Site: return [3 /*break*/, 3];
case UserCustomActionScope.List: return [3 /*break*/, 5];
}
return [3 /*break*/, 7];
case 1: return [4 /*yield*/, sp.web.userCustomActions.getById(id).update(props)];
case 2:
result = _b.sent();
return [3 /*break*/, 8];
case 3: return [4 /*yield*/, sp.site.userCustomActions.getById(id).update(props)];
case 4:
result = _b.sent();
return [3 /*break*/, 8];
case 5:
if (!listId) {
throw new Error('List ID is required for List scope');
}
return [4 /*yield*/, sp.web.lists.getById(listId).userCustomActions.getById(id).update(props)];
case 6:
result = _b.sent();
return [3 /*break*/, 8];
case 7: throw new Error('Invalid scope');
case 8: return [2 /*return*/, result];
case 9:
error_2 = _b.sent();
debugError(this.debug, LOG_SOURCE, 'Error updating user custom action.', error_2);
throw error_2;
case 10: return [2 /*return*/];
}
});
});
};
UserCustomActionService.prototype.deleteUserCustomAction = function (scope, customAction, listId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
try {
switch (scope) {
case UserCustomActionScope.Web:
return [2 /*return*/, sp.web.userCustomActions.getById(customAction.Id).delete()];
case UserCustomActionScope.Site:
return [2 /*return*/, sp.site.userCustomActions.getById(customAction.Id).delete()];
case UserCustomActionScope.List:
if (!listId) {
throw new Error('List ID is required for List scope');
}
return [2 /*return*/, sp.web.lists.getById(listId).userCustomActions.getById(customAction.Id).delete()];
default:
throw new Error('Invalid scope');
}
}
catch (error) {
debugError(this.debug, LOG_SOURCE, 'Error deleting user custom action.', error);
throw error;
}
return [2 /*return*/];
});
});
};
return UserCustomActionService;
}());
export { UserCustomActionService };
//# sourceMappingURL=UserCustomActionService.js.map
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "mega-menu", "name": "mega-menu",
"version": "2.2.3", "version": "2.2.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "mega-menu", "name": "mega-menu",
"version": "2.2.3", "version": "2.2.5",
"private": true, "private": true,
"main": "lib/index.js", "main": "lib/index.js",
"engines": { "engines": {
+4 -4
View File
@@ -17,7 +17,7 @@ $menuLayer: var(--megaMenuZIndex, 6000);
--megaMenuBarHeight: 44px; --megaMenuBarHeight: 44px;
--megaMenuContentWidth: 1200px; --megaMenuContentWidth: 1200px;
--megaMenuFlyoutWidth: 288px; --megaMenuFlyoutWidth: 288px;
--megaMenuZIndex: 6000; --megaMenuZIndex: 9.5;
} }
#CustomNavigation { #CustomNavigation {
@@ -187,7 +187,7 @@ $menuLayer: var(--megaMenuZIndex, 6000);
box-sizing: border-box; box-sizing: border-box;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
border: 1px solid $neutralLight; border: 1px solid #edebe9;
border-top: 0; border-top: 0;
background: $white; background: $white;
box-shadow: $menuShadow; box-shadow: $menuShadow;
@@ -203,11 +203,11 @@ $menuLayer: var(--megaMenuZIndex, 6000);
.mega-menu-grid { .mega-menu-grid {
display: grid; display: grid;
grid-template-columns: repeat(var(--megaMenuColumnCount, 4), minmax(0, 1fr)); grid-template-columns: repeat(var(--megaMenuColumnCount, 6), minmax(0, 1fr));
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
max-width: var(--megaMenuContentWidth, 1200px); max-width: var(--megaMenuContentWidth, 1200px);
margin: 0 auto; margin: 0;
padding: 24px; padding: 24px;
gap: 24px 32px; gap: 24px 32px;
background: $white; background: $white;
@@ -37,13 +37,15 @@ export default class MegaMenuApplicationCustomizer
private _topPlaceholder: PlaceholderContent | undefined; private _topPlaceholder: PlaceholderContent | undefined;
private _menuContainer: HTMLElement | undefined; private _menuContainer: HTMLElement | undefined;
private _renderer: MegaMenuRenderer | undefined; private _renderer: MegaMenuRenderer | undefined;
private _statusElement: HTMLElement | undefined;
private _customHeaderObserver: MutationObserver | undefined;
@override @override
public onInit(): Promise<void> { public onInit(): Promise<void> {
const debug: boolean = this._isDebugEnabled(); const debug: boolean = this._isDebugEnabled();
debugLog(debug, LOG_SOURCE, 'onInit started.', { debugLog(debug, LOG_SOURCE, 'onInit started.', {
componentId: UserCustomActionMegaMenuId, componentId: UserCustomActionMegaMenuId,
version: '2.2.0', version: '2.2.5',
properties: this.properties || {}, properties: this.properties || {},
pageUrl: window.location.href, pageUrl: window.location.href,
webUrl: this.context.pageContext.web.absoluteUrl, webUrl: this.context.pageContext.web.absoluteUrl,
@@ -132,6 +134,8 @@ export default class MegaMenuApplicationCustomizer
return; return;
} }
this._clearStatus();
if (this._renderer) { if (this._renderer) {
debugLog(debug, LOG_SOURCE, 'Disposing the previous renderer instance.'); debugLog(debug, LOG_SOURCE, 'Disposing the previous renderer instance.');
this._renderer.dispose(); this._renderer.dispose();
@@ -175,7 +179,9 @@ export default class MegaMenuApplicationCustomizer
} }
private _getOrCreateContainer(id: string, placeholder: PlaceholderContent): HTMLElement { private _getOrCreateContainer(id: string, placeholder: PlaceholderContent): HTMLElement {
const container = document.getElementById(id); const container: HTMLElement = document.getElementById(id);
let host: HTMLElement = this._menuContainer || document.getElementById('MegaMenuHost') ||
document.getElementById('CustomNavigation');
if (container) { if (container) {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Existing host container found.', { debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Existing host container found.', {
@@ -183,30 +189,63 @@ export default class MegaMenuApplicationCustomizer
containerId: container.id, containerId: container.id,
containerClassName: container.className || '' containerClassName: container.className || ''
}); });
let host: HTMLElement = document.getElementById('MegaMenuHost');
if (!host) { if (!host) {
host = document.createElement('div'); host = document.createElement('div');
host.id = 'MegaMenuHost'; host.id = 'MegaMenuHost';
container.appendChild(host);
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'MegaMenuHost was created inside the existing host container.');
} else {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Existing MegaMenuHost will be reused.');
} }
if (host.parentElement !== container) { container.appendChild(host); }
this._stopCustomHeaderObserver();
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'MegaMenu host is located inside the existing CustomHeader.');
return host; return host;
} }
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'No external host container found; the Top placeholder will be used.', { if (!host) {
host = document.createElement('div');
host.id = 'MegaMenuHost';
}
if (host.parentElement !== placeholder.domElement) { placeholder.domElement.appendChild(host); }
this._startCustomHeaderObserver(id);
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'No external host container found; using a temporary host in the Top placeholder.', {
requestedId: id requestedId: id
}); });
return placeholder.domElement; return host;
}
private _startCustomHeaderObserver(id: string): void {
if (this._customHeaderObserver || typeof MutationObserver === 'undefined') { return; }
this._customHeaderObserver = new MutationObserver((): void => {
const customHeader: HTMLElement = document.getElementById(id);
if (!customHeader || !this._menuContainer || this._menuContainer === customHeader) { return; }
if (this._menuContainer.parentElement !== customHeader) {
customHeader.appendChild(this._menuContainer);
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'MegaMenu host moved into the late CustomHeader.', {
containerId: this._menuContainer.id || ''
});
}
this._stopCustomHeaderObserver();
});
this._customHeaderObserver.observe(document.documentElement, { childList: true, subtree: true });
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Waiting for CustomHeader DOM registration.');
}
private _stopCustomHeaderObserver(): void {
if (this._customHeaderObserver) {
this._customHeaderObserver.disconnect();
this._customHeaderObserver = undefined;
}
} }
private _onDispose = (): void => { private _onDispose = (): void => {
this.context.placeholderProvider.changedEvent.remove(this, this._renderPlaceHolders); this.context.placeholderProvider.changedEvent.remove(this, this._renderPlaceHolders);
this._stopCustomHeaderObserver();
this._clearStatus();
if (this._renderer) { if (this._renderer) {
this._renderer.dispose(); this._renderer.dispose();
this._renderer = undefined; this._renderer = undefined;
} }
if (this._menuContainer && this._menuContainer.parentElement) {
this._menuContainer.parentElement.removeChild(this._menuContainer);
}
this._menuContainer = undefined; this._menuContainer = undefined;
this._topPlaceholder = undefined; this._topPlaceholder = undefined;
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.'); debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.');
@@ -250,6 +289,7 @@ export default class MegaMenuApplicationCustomizer
if (!this._topPlaceholder) { if (!this._topPlaceholder) {
return; return;
} }
this._clearStatus();
this._menuContainer = this._getOrCreateContainer('CustomHeader', this._topPlaceholder); this._menuContainer = this._getOrCreateContainer('CustomHeader', this._topPlaceholder);
const container: HTMLElement = this._menuContainer || this._topPlaceholder.domElement; const container: HTMLElement = this._menuContainer || this._topPlaceholder.domElement;
container.innerHTML = ''; container.innerHTML = '';
@@ -258,6 +298,14 @@ export default class MegaMenuApplicationCustomizer
status.setAttribute('role', 'status'); status.setAttribute('role', 'status');
status.textContent = message; status.textContent = message;
container.appendChild(status); container.appendChild(status);
this._statusElement = status;
}
private _clearStatus(): void {
if (this._statusElement && this._statusElement.parentNode) {
this._statusElement.parentNode.removeChild(this._statusElement);
}
this._statusElement = undefined;
} }
private _isGuid(value: string): boolean { private _isGuid(value: string): boolean {
+1 -1
View File
@@ -726,7 +726,7 @@ export class MegaMenuRenderer {
private getColumnCount(items?: IMenuItem[]): string { private getColumnCount(items?: IMenuItem[]): string {
const itemCount = items ? items.length : 0; const itemCount = items ? items.length : 0;
const columnCount = Math.min(Math.max(itemCount, 1), 4); const columnCount = Math.min(Math.max(itemCount, 1), 6);
return columnCount.toString(); return columnCount.toString();
} }
@@ -1 +0,0 @@
{"id":"abc3361f-bb2d-491f-aba3-cd51c19a299b","alias":"MegaMenuApplicationCustomizer","componentType":"Extension","extensionType":"ApplicationCustomizer","version":"1.1.2","manifestVersion":2,"requiresCustomScript":false,"loaderConfig":{"entryModuleId":"mega-menu-application-customizer","internalModuleBaseUrls":["<!-- PATH TO CDN -->/"],"scriptResources":{"mega-menu-application-customizer":{"type":"path","path":"mega-menu-application-customizer_4b71d735107c7ad3a5ddc7b19a2c8ce9.js"},"MegaMenuApplicationCustomizerStrings":{"defaultPath":"megamenu-megamenuapplicationcustomizerstrings_en-us_c5b741e5b77398ea44801b5b5c0a11a3.js","type":"localizedPath","paths":{"de-DE":"megamenu-megamenuapplicationcustomizerstrings_de-de_b346aef029646a3a296989aa5e40a5ae.js","en-US":"megamenu-megamenuapplicationcustomizerstrings_en-us_c5b741e5b77398ea44801b5b5c0a11a3.js"}},"@microsoft/decorators":{"type":"component","version":"1.4.1","id":"f97266fb-ccb7-430e-9384-4124d05295d3"},"@microsoft/sp-application-base":{"type":"component","version":"1.4.1","id":"4df9bb86-ab0a-4aab-ab5f-48bf167048fb"},"@microsoft/sp-http":{"type":"component","version":"1.4.1","id":"c07208f0-ea3b-4c1a-9965-ac1b825211a6"},"@microsoft/sp-lodash-subset":{"type":"component","version":"1.4.1","id":"73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"}}}}
-5162
View File
File diff suppressed because it is too large Load Diff
-742
View File
@@ -1,742 +0,0 @@
[
{
"id": "f97266fb-ccb7-430e-9384-4124d05295d3",
"alias": "Decorators",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "decorators",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/decorators/"
],
"scriptResources": {
"decorators": {
"type": "path",
"path": "dist/decorators.js"
}
}
},
"isInternal": true
},
{
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a",
"alias": "SPLodashSubset",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-lodash-subset",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-lodash-subset/"
],
"scriptResources": {
"sp-lodash-subset": {
"type": "path",
"path": "dist/sp-lodash-subset.js"
}
}
},
"isInternal": true
},
{
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"alias": "SPCoreLibrary",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-core-library",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-core-library/"
],
"scriptResources": {
"sp-core-library": {
"type": "localizedPath",
"defaultPath": "dist/sp-core-library_en-us.js"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
},
"isInternal": true
},
{
"id": "02a01e42-69ab-403d-8a16-acd128661f8e",
"alias": "OfficeUIFabricReact",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "office-ui-fabric-react-bundle",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/office-ui-fabric-react-bundle/"
],
"scriptResources": {
"office-ui-fabric-react-bundle": {
"type": "path",
"path": "dist/office-ui-fabric-react-bundle.js"
},
"react": {
"type": "component",
"version": "15.6.2",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"failoverPath": "node_modules/react/dist/react.js"
},
"react-dom": {
"type": "component",
"version": "15.6.2",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"failoverPath": "node_modules/react-dom/dist/react-dom.js"
}
}
},
"isInternal": true
},
{
"id": "1e384972-6346-49b4-93c7-b2e6763938e6",
"alias": "sp-polyfills",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-polyfills",
"internalModuleBaseUrls": [
"/"
],
"scriptResources": {
"sp-polyfills": {
"type": "path",
"path": "dist/sp-polyfills.js"
}
}
}
},
{
"id": "1c6c9123-7aac-41f3-a376-3caea41ed83f",
"alias": "SPLoader",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-loader",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-loader/"
],
"scriptResources": {
"sp-loader": {
"type": "localizedPath",
"defaultPath": "dist/sp-loader_en-us.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
},
"isInternal": true
},
{
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6",
"alias": "SPHttp",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-http",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-http/"
],
"scriptResources": {
"sp-http": {
"type": "localizedPath",
"defaultPath": "dist/sp-http_en-us.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
},
"isInternal": true
},
{
"id": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8",
"alias": "SPPageContext",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-page-context",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-page-context/"
],
"scriptResources": {
"sp-page-context": {
"type": "path",
"path": "dist/sp-page-context.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
}
}
},
"isInternal": true
},
{
"id": "467dc675-7cc5-4709-8aac-78e3b71bd2f6",
"alias": "SPComponentBase",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-component-base",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-component-base/"
],
"scriptResources": {
"sp-component-base": {
"type": "path",
"path": "dist/sp-component-base.js"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-page-context": {
"type": "component",
"version": "1.4.1",
"id": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8"
}
}
},
"isInternal": true
},
{
"id": "0773bd53-a69e-4293-87e6-ba80ea4d614b",
"alias": "SPExtensionBase",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-extension-base",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-extension-base/"
],
"scriptResources": {
"sp-extension-base": {
"type": "localizedPath",
"defaultPath": "dist/sp-extension-base_en-us.js"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-component-base": {
"type": "component",
"version": "1.4.1",
"id": "467dc675-7cc5-4709-8aac-78e3b71bd2f6"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/sp-loader": {
"type": "component",
"version": "1.4.1",
"id": "1c6c9123-7aac-41f3-a376-3caea41ed83f"
}
}
},
"isInternal": true
},
{
"id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb",
"alias": "SPApplicationBase",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-application-base",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-application-base/"
],
"scriptResources": {
"sp-application-base": {
"type": "localizedPath",
"defaultPath": "dist/sp-application-base_en-us.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-loader": {
"type": "component",
"version": "1.4.1",
"id": "1c6c9123-7aac-41f3-a376-3caea41ed83f"
},
"@microsoft/sp-page-context": {
"type": "component",
"version": "1.4.1",
"id": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8"
},
"@microsoft/sp-extension-base": {
"type": "component",
"version": "1.4.1",
"id": "0773bd53-a69e-4293-87e6-ba80ea4d614b"
},
"@microsoft/sp-component-base": {
"type": "component",
"version": "1.4.1",
"id": "467dc675-7cc5-4709-8aac-78e3b71bd2f6"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
},
"isInternal": true
},
{
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"alias": "SPWebPartBase",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-webpart-base",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-webpart-base/"
],
"scriptResources": {
"sp-webpart-base": {
"type": "localizedPath",
"defaultPath": "dist/sp-webpart-base_en-us.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"react": {
"type": "component",
"version": "15.6.2",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"failoverPath": "node_modules/react/dist/react.js"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
},
"office-ui-fabric-react": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
},
"react-dom": {
"type": "component",
"version": "15.6.2",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"failoverPath": "node_modules/react-dom/dist/react-dom.js"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-component-base": {
"type": "component",
"version": "1.4.1",
"id": "467dc675-7cc5-4709-8aac-78e3b71bd2f6"
},
"@microsoft/sp-loader": {
"type": "component",
"version": "1.4.1",
"id": "1c6c9123-7aac-41f3-a376-3caea41ed83f"
},
"@microsoft/sp-page-context": {
"type": "component",
"version": "1.4.1",
"id": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8"
},
"@microsoft/office-ui-fabric-react-bundle": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
}
}
},
"isInternal": true
},
{
"id": "c0c518b8-701b-4f6f-956d-5782772bb731",
"alias": "SPDialog",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-dialog",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-dialog/"
],
"scriptResources": {
"sp-dialog": {
"type": "path",
"path": "dist/sp-dialog.js"
},
"react": {
"type": "component",
"version": "15.6.2",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"failoverPath": "node_modules/react/dist/react.js"
},
"react-dom": {
"type": "component",
"version": "15.6.2",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"failoverPath": "node_modules/react-dom/dist/react-dom.js"
},
"office-ui-fabric-react": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/sp-application-base": {
"type": "component",
"version": "1.4.1",
"id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb"
},
"@microsoft/office-ui-fabric-react-bundle": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"version": "1.4.1",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0"
}
}
},
"isInternal": true
},
{
"id": "29bd516f-4ece-40b7-8028-597cbc65a223",
"alias": "SpOfficeUIFabricCore",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "office-ui-fabric-core",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-office-ui-fabric-core/"
],
"scriptResources": {
"office-ui-fabric-core": {
"type": "path",
"path": "dist/office-ui-fabric-core.js"
}
}
},
"isInternal": true
},
{
"id": "4d5eb168-6729-49a8-aec7-0e397f486b6e",
"alias": "SPClientPreview",
"componentType": "Library",
"version": "1.4.1",
"manifestVersion": 2,
"loaderConfig": {
"entryModuleId": "sp-client-preview",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-client-preview/"
],
"scriptResources": {
"sp-client-preview": {
"type": "path",
"path": "dist/sp-client-preview.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
}
}
},
"isInternal": true
},
{
"id": "8be81a5c-af38-4bb2-af97-afa3b64dfbed",
"alias": "WebPartWorkbench",
"componentType": "Application",
"version": "1.4.1",
"manifestVersion": 2,
"title": {
"default": "WebpartWorkbench"
},
"description": {
"default": "WebpartWorkbench"
},
"assemblyId": "5dae53c4-db1e-4d0b-b8b2-88c874dabf83",
"preloadComponents": [
"8217e442-8ed3-41fd-957d-b112e841286a",
"4df9bb86-ab0a-4aab-ab5f-48bf167048fb",
"05ed6956-59ad-4aa6-9e4e-b832c96ae87b"
],
"preloadOptions": {
"shouldPreloadWeb": true,
"shouldPreloadUser": true,
"shouldPreloadList": false,
"shouldPreloadItem": true,
"shouldPreloadQuickLaunch": true
},
"loaderConfig": {
"entryModuleId": "sp-webpart-workbench",
"internalModuleBaseUrls": [
"https://localhost:4321/node_modules/@microsoft/sp-webpart-workbench/"
],
"scriptResources": {
"sp-webpart-workbench": {
"type": "localizedPath",
"defaultPath": "dist/sp-webpart-workbench_en-us.js"
},
"react": {
"type": "component",
"version": "15.6.2",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"failoverPath": "node_modules/react/dist/react.js"
},
"office-ui-fabric-react": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.4.1",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@ms/sp-telemetry": {
"type": "component",
"version": "0.2.2",
"id": "8217e442-8ed3-41fd-957d-b112e841286a"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"version": "1.4.1",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0"
},
"react-dom": {
"type": "component",
"version": "15.6.2",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"failoverPath": "node_modules/react-dom/dist/react-dom.js"
},
"@microsoft/office-ui-fabric-react-bundle": {
"type": "component",
"version": "1.4.1",
"id": "02a01e42-69ab-403d-8a16-acd128661f8e"
},
"@microsoft/sp-page-context": {
"type": "component",
"version": "1.4.1",
"id": "1c4541f7-5c31-41aa-9fa8-fbc9dc14c0a8"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-application-base": {
"type": "component",
"version": "1.4.1",
"id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb"
},
"@microsoft/sp-loader": {
"type": "component",
"version": "1.4.1",
"id": "1c6c9123-7aac-41f3-a376-3caea41ed83f"
}
}
},
"isInternal": true
},
{
"id": "abc3361f-bb2d-491f-aba3-cd51c19a299b",
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "1.1.2",
"manifestVersion": 2,
"requiresCustomScript": false,
"loaderConfig": {
"entryModuleId": "mega-menu-application-customizer",
"internalModuleBaseUrls": [
"https://localhost:4321/"
],
"scriptResources": {
"mega-menu-application-customizer": {
"type": "path",
"path": "dist/mega-menu-application-customizer.js"
},
"MegaMenuApplicationCustomizerStrings": {
"defaultPath": "lib/extensions/megaMenu/loc/en-us.js",
"type": "localizedPath",
"paths": {
"de-DE": "lib/extensions/megaMenu/loc/de-de.js",
"en-US": "lib/extensions/megaMenu/loc/en-us.js"
}
},
"@microsoft/decorators": {
"type": "component",
"version": "1.4.1",
"id": "f97266fb-ccb7-430e-9384-4124d05295d3"
},
"@microsoft/sp-application-base": {
"type": "component",
"version": "1.4.1",
"id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.4.1",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"version": "1.4.1",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a"
}
}
}
}
]
-26
View File
@@ -1,26 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
]
}
}
-158
View File
@@ -1,158 +0,0 @@
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": false,
"export-name": true,
"forin": true,
"indent": [
true,
"spaces",
2
],
"interface-name": true,
"label-position": true,
"max-line-length": [
true,
120
],
"member-access": true,
"member-ordering": [
true,
{
"order": [
"public-static-field",
"protected-static-field",
"private-static-field",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-static-method",
"protected-static-method",
"private-static-method",
"public-constructor",
"public-instance-method",
"protected-constructor",
"protected-instance-method",
"private-constructor",
"private-instance-method"
]
}
],
"missing-optional-annotation": true,
"no-arg": true,
"no-any": true,
"no-bitwise": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-constant-condition": true,
"no-construct": true,
"no-debugger": true,
"no-duplicate-case": true,
"no-duplicate-parameter-names": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-function-expression": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-null-keyword": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-with-statement": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"prefer-const": true,
"radix": true,
"semicolon": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": [
true,
"call-signature",
"parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-isnan": true,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"react-a11y-aria-unsupported-elements": true,
"react-a11y-event-has-role": true,
"react-a11y-image-button-has-alt": true,
"react-a11y-img-has-alt": true,
"react-a11y-lang": true,
"react-a11y-anchors": false,
"react-a11y-meta": true,
"react-a11y-props": true,
"react-a11y-proptypes": true,
"react-a11y-role-has-required-aria-props": true,
"react-a11y-role-supports-aria-props": true,
"react-a11y-role": true,
"react-a11y-tabindex-no-positive": true,
"react-a11y-titles": true
}
}
+8
View File
@@ -41,6 +41,14 @@ validateStyle('classic/megamenu-classic.css');
validateStyle('src/extensions/megaMenu/MegaMenu.module.scss'); validateStyle('src/extensions/megaMenu/MegaMenu.module.scss');
var modernStyles = read('src/extensions/megaMenu/MegaMenu.module.scss'); var modernStyles = read('src/extensions/megaMenu/MegaMenu.module.scss');
var applicationCustomizer = read('src/extensions/megaMenu/MegaMenuApplicationCustomizer.ts');
assert('modern loading status is cleared before menu render',
applicationCustomizer.indexOf('this._clearStatus();') >= 0 &&
applicationCustomizer.indexOf('private _statusElement: HTMLElement | undefined;') >= 0);
assert('late CustomHeader is observed and receives the menu host',
applicationCustomizer.indexOf('new MutationObserver') >= 0 &&
applicationCustomizer.indexOf('customHeader.appendChild(this._menuContainer)') >= 0 &&
applicationCustomizer.indexOf('this._stopCustomHeaderObserver();') >= 0);
[ [
'white', 'white',
'neutralLighter', 'neutralLighter',