Add the `label` attribute for groups
authorAlexander Ebert <ebert@woltlab.com>
Tue, 3 Oct 2023 15:53:12 +0000 (17:53 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 5 Oct 2023 15:22:08 +0000 (17:22 +0200)
ts/WoltLabSuite/Core/Component/Menu/Builder.ts
ts/WoltLabSuite/Core/Component/Menu/Group.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Menu/Builder.js
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Menu/Group.js

index 4e88d972783728a141f02ada988aae0e24078312..296377db1e02567e0eb4cda7417e579e70d021ca 100644 (file)
@@ -8,8 +8,8 @@ export class MenuBuilder {
     this.#menu = menu;
   }
 
-  addGroup(callback: (group: MenuGroup) => void): this {
-    const group = new MenuGroup(this.#menu);
+  addGroup(label: string, callback: (group: MenuGroup) => void): this {
+    const group = new MenuGroup(label, this.#menu);
     callback(group);
 
     return this;
index 6a3e94c8d3003a206363c18cd51836e00cf6261c..da1ff18c0302016c61d516d709868997db8becb0 100644 (file)
@@ -4,8 +4,10 @@ import type WoltlabCoreMenuGroupElement from "WoltLabSuite/Core/Element/woltlab-
 export class MenuGroup {
   readonly #group: WoltlabCoreMenuGroupElement;
 
-  constructor(menu: WoltlabCoreMenuElement) {
+  constructor(label: string, menu: WoltlabCoreMenuElement) {
     this.#group = document.createElement("woltlab-core-menu-group");
+    this.#group.label = label;
+
     menu.append(this.#group);
   }
 
index 6a3f76c9cf1c7ececbf10660ab76e048b1adde2a..fac2625c368ce74e4b5838b322fc31642d3b2376 100644 (file)
@@ -8,8 +8,8 @@ define(["require", "exports", "tslib", "./Group"], function (require, exports, t
         constructor(menu) {
             this.#menu = menu;
         }
-        addGroup(callback) {
-            const group = new Group_1.default(this.#menu);
+        addGroup(label, callback) {
+            const group = new Group_1.default(label, this.#menu);
             callback(group);
             return this;
         }
index f65ae811a60994a22051845bc694ce903e98efff..c6657f06b5efe5015ec69d16cfff334f3155666c 100644 (file)
@@ -4,8 +4,9 @@ define(["require", "exports"], function (require, exports) {
     exports.MenuGroup = void 0;
     class MenuGroup {
         #group;
-        constructor(menu) {
+        constructor(label, menu) {
             this.#group = document.createElement("woltlab-core-menu-group");
+            this.#group.label = label;
             menu.append(this.#group);
         }
         addItem(value, label) {