*/
/** @deprecated 5.4 Use a `Map` instead. */
-class Dictionary {
- private readonly _dictionary = new Map<number | string, any>();
+class Dictionary<T> {
+ private readonly _dictionary = new Map<number | string, T>();
/**
* Sets a new key with given value, will overwrite an existing key.
*/
- set(key: number | string, value: any): void {
+ set(key: number | string, value: T): void {
this._dictionary.set(key.toString(), value);
}
* Iterates over the dictionary keys and values, callback function should expect the
* value as first parameter and the key name second.
*/
- forEach(callback: (value: any, key: string) => void): void {
+ forEach(callback: (value: T, key: number | string) => void): void {
if (typeof callback !== "function") {
throw new TypeError("forEach() expects a callback as first parameter.");
}
/**
* Merges one or more Dictionary instances into this one.
*/
- merge(...dictionaries: Dictionary[]): void {
+ merge(...dictionaries: Dictionary<T>[]): void {
for (let i = 0, length = dictionaries.length; i < length; i++) {
const dictionary = dictionaries[i];
* All properties that are owned by the object will be added
* as keys to the resulting Dictionary.
*/
- static fromObject(object: object): Dictionary {
+ static fromObject(object: object): Dictionary<any> {
const result = new Dictionary();
for (const key in object) {
/**
* Examines child elements and returns all children matching the given selector.
*/
-export function childrenBySel(element, selector: string): Element[] {
+export function childrenBySel(element: Element, selector: string): Element[] {
return _getChildren(element, Type.Selector, selector);
}
excludedSearchValues.push(label.textContent!);
});
- this.searchInput = new UiUserSearchInput(document.getElementById(this.prefix + "aclSearchInput"), {
- callbackSelect: this.select.bind(this),
- includeUserGroups: true,
- excludedSearchValues: excludedSearchValues,
- preventSubmit: true,
- });
+ this.searchInput = new UiUserSearchInput(
+ document.getElementById(this.prefix + "aclSearchInput") as HTMLInputElement,
+ {
+ callbackSelect: this.select.bind(this),
+ includeUserGroups: true,
+ excludedSearchValues: excludedSearchValues,
+ preventSubmit: true,
+ }
+ );
this.aclListContainer = document.getElementById(this.prefix + "aclListContainer")!;
return data;
}
- _ajaxSuccess(data): void {
+ _ajaxSuccess(data: DatabaseObjectActionResponse): void {
this.callbackSuccess(data);
}
}
* Initializes available tab menus.
*/
function init() {
- document.querySelectorAll(".tabMenuContainer:not(.staticTabMenuContainer)").forEach((container) => {
+ document.querySelectorAll(".tabMenuContainer:not(.staticTabMenuContainer)").forEach((container: HTMLElement) => {
const containerId = DomUtil.identify(container);
if (_tabMenus.has(containerId)) {
return;
private store: HTMLInputElement | null = null;
private readonly tabs = new Map<string, HTMLLIElement>();
- constructor(container) {
+ constructor(container: HTMLElement) {
this.container = container;
}
*/
import * as Core from "../../../Core";
+import { SearchInputOptions } from "../../Search/Data";
import UiSearchInput from "../../Search/Input";
class UiUserSearchInput extends UiSearchInput {
- constructor(element, options) {
+ constructor(element: HTMLInputElement, options: UserSearchInputOptions) {
const includeUserGroups = Core.isPlainObject(options) && options.includeUserGroups === true;
options = Core.extend(
type: "user" | "group";
icon: string;
}
+
+interface UserSearchInputOptions extends SearchInputOptions {
+ includeUserGroups?: boolean;
+}