+/**
+ * Provides the menu items for the mobile main menu in the admin panel.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend
+ */
+
import { MenuItem, PageMenuMainProvider } from "../../../../../Ui/Page/Menu/Main/Provider";
function getSubMenuItems(subMenu: HTMLElement, menuItem: string): MenuItem[] {
import * as UiObjectActionDelete from "./Ui/Object/Action/Delete";
import * as UiObjectActionToggle from "./Ui/Object/Action/Toggle";
import { init as initSearch } from "./Ui/Search";
+import { PageMenuMainProvider } from "./Ui/Page/Menu/Main/Provider";
// perfectScrollbar does not need to be bound anywhere, it just has to be loaded for WCF.js
import "perfect-scrollbar";
-import { PageMenuMainProvider } from "./Ui/Page/Menu/Main/Provider";
// non strict equals by intent
if (window.WCF == null) {
+/**
+ * Wrapper logic for elements that are placed over the main content
+ * such as the mobile main menu and the user menu with its tabs.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Container
+ */
+
import { PageMenuProvider } from "./Provider";
import { createFocusTrap, FocusTrap } from "focus-trap";
import { pageOverlayClose, pageOverlayOpen, scrollDisable, scrollEnable } from "../../Screen";
* Provides the touch-friendly main menu.
*
* @author Alexander Ebert
- * @copyright 2001-2021 WoltLab GmbH
+ * @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/Page/Menu/Main
*/
+/**
+ * Provides the menu items for the mobile main menu in the frontend.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Main/Frontend
+ */
+
import { MenuItem, MenuItemDepth, PageMenuMainProvider } from "./Provider";
function normalizeMenuItem(menuItem: HTMLElement, depth: MenuItemDepth): MenuItem {
let counter = 0;
const outstandingItems = anchor.querySelector(".boxMenuLinkOutstandingItems");
if (outstandingItems) {
- counter = +outstandingItems.textContent!.replace(/[^0-9]/, "");
+ counter = parseInt(outstandingItems.textContent!.replace(/[^0-9]/, ""), 10);
}
const subMenu = menuItem.querySelector("ol");
+/**
+ * Common interface and data types for containers that
+ * span the entire content area.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Provider
+ * @woltlabExcludeBundle all
+ */
+
export type MenuItemDepth = 0 | 1 | 2;
export type MenuItem = {
+/**
+ * Page menus are placed above the content and their visibility
+ * is controlled through buttons placed in the page header.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Provider
+ * @woltlabExcludeBundle all
+ */
+
export interface PageMenuProvider {
+ /**
+ * Disables this menu when switching from the mobile to the desktop view.
+ */
disable(): void;
+ /**
+ * Enables the menu once the mobile view became active.
+ */
enable(): void;
+ /**
+ * Returns arbitrary HTML elements that are placed inside the overlay container.
+ */
getContent(): DocumentFragment;
+ /**
+ * Provides the button that is used to change the visibility of the overlay container.
+ */
getMenuButton(): HTMLElement;
+ /**
+ * Suspends the activity of the container and returns any borrowed HTML elements
+ * to their previous position. It is primarily used to restore the UI in case the
+ * mobile view bcomes inactive.
+ */
sleep(): void;
+ /**
+ * Restores the view by moving any borrowed HTML elements back into the container.
+ * This method is also responsible to refresh the UI in case the underlying data
+ * has changed.
+ */
wakeup(): void;
}
* Provides the touch-friendly user menu.
*
* @author Alexander Ebert
- * @copyright 2001-2021 WoltLab GmbH
+ * @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/Page/Menu/User
+ * @woltlabExcludeBundle tiny
*/
import PageMenuContainer, { Orientation } from "./Container";
/**
- * Manages the sticky page header.
+ * Controls the behavior and placement of the search input depending on
+ * the context (frontend or admin panel) and the active view (mobile or
+ * desktop).
*
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module WoltLabSuite/Core/Ui/Page/Header/Fixed
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Search
*/
import * as EventHandler from "../Event/Handler";
searchButton.setAttribute("aria-expanded", "false");
} else {
+ // iOS Safari behaves unpredictable when the keyboard focus
+ // is moved into a HTML element that is inside a parent with
+ // fixed positioning *and* the page had been scrolled down.
if (Environment.platform() === "ios") {
_scrollTop = document.body.scrollTop;
UiScreen.scrollDisable();
return views.get(provider)!;
}
-export function getUserMenuProviders(): Set<UserMenuProvider> {
+export function getUserMenuProviders(): ReadonlySet<UserMenuProvider> {
return providers;
}
+/**
+ * Provides the menu items for the mobile main menu in the admin panel.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend
+ */
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * Wrapper logic for elements that are placed over the main content
+ * such as the mobile main menu and the user menu with its tabs.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Container
+ */
define(["require", "exports", "tslib", "focus-trap", "../../Screen", "../../CloseOverlay", "../../../Dom/Util"], function (require, exports, tslib_1, focus_trap_1, Screen_1, CloseOverlay_1, Util_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
* Provides the touch-friendly main menu.
*
* @author Alexander Ebert
- * @copyright 2001-2021 WoltLab GmbH
+ * @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/Page/Menu/Main
*/
+/**
+ * Provides the menu items for the mobile main menu in the frontend.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Main/Frontend
+ */
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let counter = 0;
const outstandingItems = anchor.querySelector(".boxMenuLinkOutstandingItems");
if (outstandingItems) {
- counter = +outstandingItems.textContent.replace(/[^0-9]/, "");
+ counter = parseInt(outstandingItems.textContent.replace(/[^0-9]/, ""), 10);
}
const subMenu = menuItem.querySelector("ol");
let children = [];
+/**
+ * Common interface and data types for containers that
+ * span the entire content area.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Provider
+ * @woltlabExcludeBundle all
+ */
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * Page menus are placed above the content and their visibility
+ * is controlled through buttons placed in the page header.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Page/Menu/Provider
+ * @woltlabExcludeBundle all
+ */
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
* Provides the touch-friendly user menu.
*
* @author Alexander Ebert
- * @copyright 2001-2021 WoltLab GmbH
+ * @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/Page/Menu/User
+ * @woltlabExcludeBundle tiny
*/
define(["require", "exports", "tslib", "./Container", "../../../Language", "../../User/Menu/Manager", "../../../Dom/Util", "../../User/Menu/ControlPanel", "../../../Event/Handler"], function (require, exports, tslib_1, Container_1, Language, Manager_1, Util_1, ControlPanel_1, EventHandler) {
"use strict";
/**
- * Manages the sticky page header.
+ * Controls the behavior and placement of the search input depending on
+ * the context (frontend or admin panel) and the active view (mobile or
+ * desktop).
*
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module WoltLabSuite/Core/Ui/Page/Header/Fixed
+ * @author Alexander Ebert
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Search
*/
define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./CloseOverlay", "./Dropdown/Simple", "./Screen", "../Environment", "../Dom/Util"], function (require, exports, tslib_1, EventHandler, UiAlignment, CloseOverlay_1, Simple_1, UiScreen, Environment, Util_1) {
"use strict";
searchButton.setAttribute("aria-expanded", "false");
}
else {
+ // iOS Safari behaves unpredictable when the keyboard focus
+ // is moved into a HTML element that is inside a parent with
+ // fixed positioning *and* the page had been scrolled down.
if (Environment.platform() === "ios") {
_scrollTop = document.body.scrollTop;
UiScreen.scrollDisable();