-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
PopupToolGroup.d.ts
165 lines (149 loc) · 6.25 KB
/
PopupToolGroup.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
declare namespace OO.ui {
/**
* PopupToolGroup is an abstract base class used by both {@link OO.ui.MenuToolGroup MenuToolGroup}
* and {@link OO.ui.ListToolGroup ListToolGroup} to provide a popup (an overlaid menu or list of
* tools with an optional icon and label). This class can be used for other base classes that
* also use this functionality.
*
* ResourceLoader module: `oojs-ui-toolbars`
*
* @see https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.PopupToolGroup
*/
interface PopupToolGroup extends PopupToolGroup.Props, PopupToolGroup.Prototype {}
namespace PopupToolGroup {
interface EventMap extends ToolGroup.EventMap, mixin.LabelElement.EventMap, mixin.FlaggedElement.EventMap {}
interface ConfigOptions
extends
ToolGroup.ConfigOptions,
mixin.IconElement.ConfigOptions,
mixin.IndicatorElement.ConfigOptions,
mixin.LabelElement.ConfigOptions,
mixin.TitledElement.ConfigOptions,
mixin.FlaggedElement.ConfigOptions,
mixin.ClippableElement.ConfigOptions,
mixin.FloatableElement.ConfigOptions,
mixin.TabIndexedElement.ConfigOptions
{
/** Text to display at the top of the popup */
header?: string;
/** See {@link Static.narrowConfig static.narrowConfig} */
narrowConfig?: Pick<this, `invisibleLabel` | `label` | `icon`>;
}
interface Static
extends
ToolGroup.Static,
mixin.IconElement.Static,
mixin.IndicatorElement.Static,
mixin.LabelElement.Static,
mixin.TitledElement.Static,
mixin.FlaggedElement.Static
{
/**
* Config options to change when toolbar is in narrow mode
*
* Supports `invisibleLabel`, `label` and `icon` properties.
*/
narrowConfig: Pick<ConfigOptions, `invisibleLabel` | `label` | `icon`> | null;
}
interface Props
extends
ToolGroup.Props,
mixin.IconElement.Props,
mixin.IndicatorElement.Props,
mixin.LabelElement.Props,
mixin.TitledElement.Props,
mixin.FlaggedElement.Props,
mixin.ClippableElement.Props,
mixin.FloatableElement.Props,
mixin.TabIndexedElement.Props
{
$handle: JQuery;
}
interface Prototype
extends
ToolGroup.Prototype,
mixin.IconElement.Prototype,
mixin.IndicatorElement.Prototype,
mixin.LabelElement.Prototype,
mixin.TitledElement.Prototype,
mixin.FlaggedElement.Prototype,
mixin.ClippableElement.Prototype,
mixin.FloatableElement.Prototype,
mixin.TabIndexedElement.Prototype
{
/**
* Handle resize events from the toolbar
*/
onToolbarResize(): void;
/**
* Check if the tool group is active.
*
* @return Tool group is active
*/
isActive(): boolean;
/**
* Switch into 'active' mode.
*
* When active, the popup is visible. A mouseup event anywhere in the document will trigger
* deactivation.
*
* @param value The active state to set
*/
setActive(value: boolean): void;
// #region EventEmitter overloads
on<K extends keyof EventMap, A extends ArgTuple = [], C = null>(
event: K,
method: EventHandler<C, (this: C, ...args: [...A, ...EventMap[K]]) => void>,
args?: A,
context?: C,
): this;
on<K extends string, C = null>(
event: K extends keyof EventMap ? never : K,
method: EventHandler<C>,
args?: any[],
context?: C,
): this;
once<K extends keyof EventMap>(event: K, listener: (this: null, ...args: EventMap[K]) => void): this;
once<K extends string>(
event: K extends keyof EventMap ? never : K,
listener: (this: null, ...args: any[]) => void,
): this;
off<K extends keyof EventMap, C = null>(
event: K,
method?: EventHandler<C, (this: C, ...args: EventMap[K]) => void>,
context?: C,
): this;
off<K extends string, C = null>(
event: K extends keyof EventMap ? never : K,
method?: EventHandler<C>,
context?: C,
): this;
emit<K extends keyof EventMap>(event: K, ...args: EventMap[K]): boolean;
emit<K extends string>(event: K extends keyof EventMap ? never : K, ...args: any[]): boolean;
emitThrow<K extends keyof EventMap>(event: K, ...args: EventMap[K]): boolean;
emitThrow<K extends string>(event: K extends keyof EventMap ? never : K, ...args: any[]): boolean;
connect<T extends Partial<Record<keyof EventMap, any>>, C>( // eslint-disable-line @definitelytyped/no-unnecessary-generics
context: C,
methods: EventConnectionMap<T, C, EventMap>,
): this;
disconnect<T extends Partial<Record<keyof EventMap, any>>, C>( // eslint-disable-line @definitelytyped/no-unnecessary-generics
context: C,
methods?: EventConnectionMap<T, C, EventMap>,
): this;
// #endregion
}
interface Constructor {
/**
* @param toolbar
* @param config Configuration options
*/
new(toolbar: Toolbar, config?: ConfigOptions): PopupToolGroup;
prototype: Prototype;
static: Static;
super: ToolGroup.Constructor;
/** @deprecated Use `super` instead */
parent: ToolGroup.Constructor;
}
}
const PopupToolGroup: PopupToolGroup.Constructor;
}