-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
MultioptionWidget.d.ts
110 lines (95 loc) · 4.59 KB
/
MultioptionWidget.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
declare namespace OO.ui {
/**
* MultioptionWidgets are special elements that can be selected and configured with data. The
* data is often unique for each option, but it does not have to be. MultioptionWidgets are used
* with OO.ui.SelectWidget to create a selection of mutually exclusive options. For more information
* and examples, please see the [OOUI documentation on MediaWiki](https://www.mediawiki.org/wiki/OOUI/Widgets/Selects_and_Options).
*
* ResourceLoader module: `oojs-ui-core`
*
* @see https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.MultioptionWidget
*/
interface MultioptionWidget extends MultioptionWidget.Props, MultioptionWidget.Prototype {}
namespace MultioptionWidget {
interface EventMap extends Widget.EventMap, mixin.LabelElement.EventMap {
change: [selected: boolean];
}
interface ConfigOptions
extends Widget.ConfigOptions, mixin.LabelElement.ConfigOptions, mixin.TitledElement.ConfigOptions
{
/** Whether the option is initially selected */
selected?: boolean;
}
interface Static extends Widget.Static, mixin.LabelElement.Static, mixin.TitledElement.Static {}
interface Props extends Widget.Props, mixin.LabelElement.Props, mixin.TitledElement.Props {}
interface Prototype extends Widget.Prototype, mixin.LabelElement.Prototype, mixin.TitledElement.Prototype {
/**
* Check if the option is selected.
*
* @return Item is selected
*/
isSelected(): boolean;
/**
* Set the option’s selected state. In general, all modifications to the selection
* should be handled by the SelectWidget’s
* {@link OO.ui.SelectWidget.selectItem selectItem( [item] )} method instead of this
* method.
*
* @param state Select option
* @return The widget, for chaining
*/
setSelected(state?: boolean): this;
// #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 config Configuration options */
new(config?: ConfigOptions): MultioptionWidget;
prototype: Prototype;
static: Static;
super: Widget.Constructor;
/** @deprecated Use `super` instead */
parent: Widget.Constructor;
}
}
const MultioptionWidget: MultioptionWidget.Constructor;
}