Bump version to 1.1.2 and update TaxonomyNavigationService to hide tags not available for tagging

- Updated TaxonomyNavigationService to set hideTagsNotAvailableForTagging to true.
- Modified getAllTerms call to include the updated parameter for hiding unavailable tags.
- Removed external CSS loading functionality from MegaMenuApplicationCustomizer.
- Updated cache prefixes in SPTermStorePickerService for versioning.
- Bumped version in package.json and package-lock.json to 1.1.2.
- Updated deployment manifest files to reflect the new version.
This commit is contained in:
Torsten Brendgen
2026-07-19 21:11:29 +02:00
parent 0ab514ca21
commit 5f1d26c7f6
20 changed files with 34 additions and 158 deletions
+11 -16
View File
@@ -4,7 +4,7 @@ Barrierearme, dreistufige Portalnavigation auf Basis von SharePoint Managed Meta
| Eigenschaft | Wert |
|---|---|
| Version | 1.1.1 |
| Version | 1.1.2 |
| SharePoint Framework | SPFx 1.4.1 |
| Node.js | 8.17.0 |
| Zieloberfläche | Moderne SharePoint-Seiten |
@@ -63,7 +63,6 @@ Die UserCustomAction unterstützt folgende `ClientSideComponentProperties`:
"termSetId": "6f36a1a8-7bd8-4ed0-a22f-e219f4d2eacc",
"termSetName": "Global Navigation",
"cacheMinutes": 15,
"cssUrl": "/SiteAssets/megamenu/megamenu-custom.css",
"debug": false
}
```
@@ -73,16 +72,13 @@ Die UserCustomAction unterstützt folgende `ClientSideComponentProperties`:
| `termSetId` | GUID | leer | Bevorzugte, eindeutige Identifikation des Termsets |
| `termSetName` | String | leer | Rückwärtskompatibler Fallback, wenn keine gültige `termSetId` vorhanden ist |
| `cacheMinutes` | Zahl | `15` | Gültigkeit des Session-Caches, zulässig sind 1 bis 1440 Minuten |
| `cssUrl` | String | leer | Relatives/same-origin Stylesheet oder externe HTTPS-Adresse |
| `debug` | Boolean | `false` | Aktiviert zusätzliche Konsolenausgaben |
`termSetId` hat Vorrang vor `termSetName`. Für neue Installationen wird die GUID empfohlen, weil Termset-Namen nicht zwingend eindeutig sind.
### Kompatibilität mit PortalSettings
Die bisherige PortalSettings-Version verwaltet `termSetName`, `cssUrl` und `debug`. Das MegaMenu 1.1.0 bleibt damit vollständig lauffähig und verwendet für nicht vorhandene `cacheMinutes` automatisch 15 Minuten.
Damit auch `termSetId` und `cacheMinutes` zentral bearbeitet werden können, muss das MegaMenu-Formular in PortalSettings um diese beiden Eigenschaften ergänzt werden. Bis dahin können sie über das Deployment-Skript gesetzt werden. Speichert eine ältere PortalSettings-Version anschließend erneut, werden die beiden noch unbekannten Eigenschaften entfernt; das MegaMenu fällt dann kontrolliert auf `termSetName` und den Standard-Cache zurück.
PortalSettings verwaltet `termSetId`, `termSetName`, `cacheMinutes` und `debug`. Individuelle Gestaltung wird nicht vom MegaMenu selbst geladen, sondern zentral über die Solution Custom Branding bereitgestellt.
## Termset-Aufbau
@@ -142,8 +138,7 @@ Empfohlen mit Termset-GUID:
-SiteUrl 'https://sharepoint/sites/portal' `
-TermSetId '6f36a1a8-7bd8-4ed0-a22f-e219f4d2eacc' `
-TermSetName 'Global Navigation' `
-CacheMinutes 15 `
-CssUrl '/SiteAssets/megamenu/megamenu-custom.css'
-CacheMinutes 15
```
Abwärtskompatibel nur mit Namen:
@@ -156,15 +151,9 @@ Abwärtskompatibel nur mit Namen:
Das Skript entfernt ältere web-scoped Registrierungen derselben Komponente und erstellt beziehungsweise aktualisiert eine site-scoped UserCustomAction mit dem Description-Tag `MSFT-Custom-Solution:MegaMenu`. Dieses Tag wird von PortalSettings zur Erkennung verwendet.
## Zusätzliches CSS
## Individuelles Branding
Zulässig sind:
- serverrelative oder relative Pfade derselben SharePoint-Origin,
- absolute URLs derselben Origin,
- externe URLs ausschließlich über HTTPS.
Nicht-HTTP(S)-Schemes und unverschlüsselte externe HTTP-Adressen werden zur Laufzeit verworfen.
Zusätzliche Stylesheets werden zentral über die Solution Custom Branding eingebunden. Das MegaMenu besitzt bewusst keine eigene `cssUrl`-Property.
Die wichtigsten CSS-Klassen sind:
@@ -265,6 +254,12 @@ MegaMenu/
## Versionshistorie
### 1.1.2
- `cssUrl` zugunsten der zentralen Custom-Branding-Solution entfernt
- deaktivierte, veraltete oder nicht zum Tagging verfügbare Terms werden ausgeblendet
- Cache-Namespace aktualisiert, damit alte deaktivierte Einträge nicht weiter angezeigt werden
### 1.1.1
- automatische Registrierung des MegaMenu Application Customizers bei der App-Installation
+2 -2
View File
@@ -3,7 +3,7 @@
"solution": {
"name": "mega-menu-client-side-solution",
"id": "f4660e06-ce08-43ee-bfb7-5c4464e01133",
"version": "1.1.1.0",
"version": "1.1.2.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": false,
"features": [
@@ -11,7 +11,7 @@
"title": "MegaMenu extension registration",
"description": "Registers the MegaMenu Application Customizer in the host web.",
"id": "1e4fdc74-8053-48b2-a15b-e975d61eb71f",
"version": "1.1.1.0",
"version": "1.1.2.0",
"assets": {
"elementManifests": [
"elements.xml"
+1 -5
View File
@@ -10,8 +10,6 @@ param(
[ValidateRange(1, 1440)]
[int]$CacheMinutes = 15,
[string]$CssUrl = '',
[switch]$EnableDebug,
[string]$Description = 'MSFT-Custom-Solution:MegaMenu'
@@ -29,7 +27,6 @@ function Get-MegaMenuPropertiesJson {
[string]$CurrentTermSetName,
[string]$CurrentTermSetId,
[int]$CurrentCacheMinutes,
[string]$CurrentCssUrl,
[bool]$CurrentDebug
)
@@ -37,7 +34,6 @@ function Get-MegaMenuPropertiesJson {
termSetName = $CurrentTermSetName
termSetId = $CurrentTermSetId
cacheMinutes = $CurrentCacheMinutes
cssUrl = $CurrentCssUrl
debug = $CurrentDebug
} | ConvertTo-Json -Depth 10 -Compress)
}
@@ -98,7 +94,7 @@ try {
$action.Description = $Description
$action.Location = $location
$action.ClientSideComponentId = [Guid]$componentId
$action.ClientSideComponentProperties = Get-MegaMenuPropertiesJson -CurrentTermSetName $TermSetName -CurrentTermSetId $TermSetId -CurrentCacheMinutes $CacheMinutes -CurrentCssUrl $CssUrl -CurrentDebug ([bool]$EnableDebug.IsPresent)
$action.ClientSideComponentProperties = Get-MegaMenuPropertiesJson -CurrentTermSetName $TermSetName -CurrentTermSetId $TermSetId -CurrentCacheMinutes $CacheMinutes -CurrentDebug ([bool]$EnableDebug.IsPresent)
$action.Update()
Write-Host 'Mega Menu wurde site-scoped registriert.' -ForegroundColor Green
+1 -1
View File
@@ -3,7 +3,7 @@
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "1.1.1",
"version": "1.1.2",
"manifestVersion": 2,
"requiresCustomScript": false,
"loaderConfig": {
File diff suppressed because one or more lines are too long
@@ -5,7 +5,6 @@ export interface IMegaMenuApplicationCustomizerProperties {
termSetName?: string;
termSetId?: string;
cacheMinutes?: number;
cssUrl?: string;
debug?: boolean;
}
export default class MegaMenuApplicationCustomizer extends BaseApplicationCustomizer<IMegaMenuApplicationCustomizerProperties> {
@@ -16,11 +15,9 @@ export default class MegaMenuApplicationCustomizer extends BaseApplicationCustom
private _renderPlaceHolders();
private _renderMegaMenu(termSetIdentifier, debug?);
private _getOrCreateContainer(id, placeholder);
private _loadExternalCss(cssUrl?, debug?);
private _onDispose;
private _getTermSetIdentifier();
private _getCacheMinutes();
private _validateCssUrl(cssUrl);
private _renderStatus(message);
private _isGuid(value);
private _isDebugEnabled(debugOverride?);
@@ -72,10 +72,6 @@ var MegaMenuApplicationCustomizer = (function (_super) {
_this._renderer.dispose();
_this._renderer = undefined;
}
var externalCssLink = document.getElementById('mega-menu-additional-css-34FAB720');
if (externalCssLink) {
externalCssLink.remove();
}
_this._menuContainer = undefined;
_this._topPlaceholder = undefined;
debugLog(_this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.');
@@ -84,9 +80,6 @@ var MegaMenuApplicationCustomizer = (function (_super) {
}
MegaMenuApplicationCustomizer.prototype.onInit = function () {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Initialized ' + strings.Title);
if (this.properties.cssUrl) {
this._loadExternalCss(this.properties.cssUrl);
}
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
this._renderPlaceHolders();
return Promise.resolve();
@@ -164,39 +157,6 @@ var MegaMenuApplicationCustomizer = (function (_super) {
}
return placeholder.domElement;
};
MegaMenuApplicationCustomizer.prototype._loadExternalCss = function (cssUrl, debug) {
if (debug === void 0) { debug = this._isDebugEnabled(); }
var externalCssLinkId = 'mega-menu-additional-css-34FAB720';
var link = document.getElementById(externalCssLinkId);
if (cssUrl && cssUrl.trim() !== '') {
var validatedUrl = this._validateCssUrl(cssUrl);
if (!validatedUrl) {
debugWarn(debug, LOG_SOURCE, 'Rejected unsafe external CSS URL:', cssUrl);
if (link) {
link.remove();
}
return;
}
if (!link) {
var head = document.getElementsByTagName('head')[0];
link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.id = externalCssLinkId;
link.onload = function () {
debugLog(debug, LOG_SOURCE, 'External CSS loaded successfully from:', cssUrl);
};
link.onerror = function () {
debugWarn(debug, LOG_SOURCE, 'Failed to load external CSS from:', cssUrl);
};
head.appendChild(link);
}
link.href = validatedUrl;
}
else if (link) {
link.remove();
}
};
MegaMenuApplicationCustomizer.prototype._getTermSetIdentifier = function () {
var termSetId = this.properties && this.properties.termSetId
? this.properties.termSetId.trim()
@@ -212,20 +172,6 @@ var MegaMenuApplicationCustomizer = (function (_super) {
var value = this.properties ? Number(this.properties.cacheMinutes) : 15;
return isFinite(value) ? Math.min(Math.max(Math.floor(value), 1), 1440) : 15;
};
MegaMenuApplicationCustomizer.prototype._validateCssUrl = function (cssUrl) {
try {
var parsed = new URL(cssUrl.trim(), window.location.origin);
var isHttp = parsed.protocol === 'http:' || parsed.protocol === 'https:';
var isSameOrigin = parsed.origin === window.location.origin;
if (!isHttp || (!isSameOrigin && parsed.protocol !== 'https:')) {
return undefined;
}
return parsed.href;
}
catch (error) {
return undefined;
}
};
MegaMenuApplicationCustomizer.prototype._renderStatus = function (message) {
if (!this._topPlaceholder) {
return;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -41,8 +41,8 @@ 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:';
var PickerCachePrefix = 'MegaMenu:PickerTerms:';
var TermCachePrefix = 'MegaMenu:TermSet:v2:';
var PickerCachePrefix = 'MegaMenu:PickerTerms:v2:';
/**
* Service implementation to manage term stores in SharePoint
*/
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -55,7 +55,7 @@ var TaxonomyNavigationService = (function () {
termsetNameOrID: termSetNameOrId,
useSessionStorage: true,
hideDeprecatedTags: true,
hideTagsNotAvailableForTagging: false,
hideTagsNotAvailableForTagging: true,
cacheMinutes: cacheMinutes
}, this.context, this.debug);
}
@@ -67,7 +67,7 @@ var TaxonomyNavigationService = (function () {
switch (_a.label) {
case 0:
siteCollectionUrl = this.context.pageContext.site.absoluteUrl;
return [4 /*yield*/, this._taxonomyPickerService.getAllTerms(this.termSetNameOrId, true, false, true, this.cacheMinutes)];
return [4 /*yield*/, this._taxonomyPickerService.getAllTerms(this.termSetNameOrId, true, true, true, this.cacheMinutes)];
case 1:
termset = _a.sent();
itemsDict = new ItemDictionary();
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mega-menu",
"version": "1.1.1",
"version": "1.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mega-menu",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"main": "lib/index.js",
"engines": {
@@ -25,7 +25,6 @@ export interface IMegaMenuApplicationCustomizerProperties {
termSetName?: string;
termSetId?: string;
cacheMinutes?: number;
cssUrl?: string;
debug?: boolean;
}
@@ -40,10 +39,6 @@ export default class MegaMenuApplicationCustomizer
public onInit(): Promise<void> {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Initialized ' + strings.Title);
if (this.properties.cssUrl) {
this._loadExternalCss(this.properties.cssUrl);
}
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
this._renderPlaceHolders();
@@ -134,51 +129,12 @@ export default class MegaMenuApplicationCustomizer
return placeholder.domElement;
}
private _loadExternalCss(cssUrl?: string, debug: boolean = this._isDebugEnabled()): void {
const externalCssLinkId: string = 'mega-menu-additional-css-34FAB720';
let link: HTMLLinkElement = document.getElementById(externalCssLinkId) as HTMLLinkElement;
if (cssUrl && cssUrl.trim() !== '') {
const validatedUrl: string | undefined = this._validateCssUrl(cssUrl);
if (!validatedUrl) {
debugWarn(debug, LOG_SOURCE, 'Rejected unsafe external CSS URL:', cssUrl);
if (link) {
link.remove();
}
return;
}
if (!link) {
const head: HTMLHeadElement = document.getElementsByTagName('head')[0];
link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.id = externalCssLinkId;
link.onload = () => {
debugLog(debug, LOG_SOURCE, 'External CSS loaded successfully from:', cssUrl);
};
link.onerror = () => {
debugWarn(debug, LOG_SOURCE, 'Failed to load external CSS from:', cssUrl);
};
head.appendChild(link);
}
link.href = validatedUrl;
} else if (link) {
link.remove();
}
}
private _onDispose = (): void => {
this.context.placeholderProvider.changedEvent.remove(this, this._renderPlaceHolders);
if (this._renderer) {
this._renderer.dispose();
this._renderer = undefined;
}
const externalCssLink: HTMLElement = document.getElementById('mega-menu-additional-css-34FAB720');
if (externalCssLink) {
externalCssLink.remove();
}
this._menuContainer = undefined;
this._topPlaceholder = undefined;
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.');
@@ -201,20 +157,6 @@ export default class MegaMenuApplicationCustomizer
return isFinite(value) ? Math.min(Math.max(Math.floor(value), 1), 1440) : 15;
}
private _validateCssUrl(cssUrl: string): string | undefined {
try {
const parsed: URL = new URL(cssUrl.trim(), window.location.origin);
const isHttp: boolean = parsed.protocol === 'http:' || parsed.protocol === 'https:';
const isSameOrigin: boolean = parsed.origin === window.location.origin;
if (!isHttp || (!isSameOrigin && parsed.protocol !== 'https:')) {
return undefined;
}
return parsed.href;
} catch (error) {
return undefined;
}
}
private _renderStatus(message: string): void {
if (!this._topPlaceholder) {
return;
+2 -2
View File
@@ -12,8 +12,8 @@ import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
import { debugError } from './MegaMenuDebug';
const EmptyGuid: string = '00000000-0000-0000-0000-000000000000';
const TermCachePrefix: string = 'MegaMenu:TermSet:';
const PickerCachePrefix: string = 'MegaMenu:PickerTerms:';
const TermCachePrefix: string = 'MegaMenu:TermSet:v2:';
const PickerCachePrefix: string = 'MegaMenu:PickerTerms:v2:';
interface ITermCacheEntry {
expiresAt: number;
+2 -2
View File
@@ -27,7 +27,7 @@ export class TaxonomyNavigationService implements ITaxonomyNavigationService {
termsetNameOrID: termSetNameOrId,
useSessionStorage: true,
hideDeprecatedTags: true,
hideTagsNotAvailableForTagging: false,
hideTagsNotAvailableForTagging: true,
cacheMinutes: cacheMinutes
},
this.context,
@@ -40,7 +40,7 @@ export class TaxonomyNavigationService implements ITaxonomyNavigationService {
const termset: ITermSet = await this._taxonomyPickerService.getAllTerms(
this.termSetNameOrId,
true,
false,
true,
true,
this.cacheMinutes
);
@@ -1 +1 @@
{"id":"abc3361f-bb2d-491f-aba3-cd51c19a299b","alias":"MegaMenuApplicationCustomizer","componentType":"Extension","extensionType":"ApplicationCustomizer","version":"1.1.1","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_9c0a9d18bcd93369da3fd20a4ed3dd7c.js"},"MegaMenuApplicationCustomizerStrings":{"defaultPath":"megamenu-megamenuapplicationcustomizerstrings_en-us_c5b741e5b77398ea44801b5b5c0a11a3.js","type":"localizedPath","paths":{"en-US":"megamenu-megamenuapplicationcustomizerstrings_en-us_c5b741e5b77398ea44801b5b5c0a11a3.js","de-DE":"megamenu-megamenuapplicationcustomizerstrings_de-de_b346aef029646a3a296989aa5e40a5ae.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"}}}}
{"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"}}}}
+1 -1
View File
@@ -2300,7 +2300,7 @@ function getManifests() {
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "1.1.1",
"version": "1.1.2",
"manifestVersion": 2,
"requiresCustomScript": false,
"loaderConfig": {
+1 -1
View File
@@ -695,7 +695,7 @@
"alias": "MegaMenuApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "1.1.1",
"version": "1.1.2",
"manifestVersion": 2,
"requiresCustomScript": false,
"loaderConfig": {