@ckeditor/ckeditor5-ui 48.2.0 → 48.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arialiveannouncer.d.ts +90 -90
- package/dist/augmentation.d.ts +86 -86
- package/dist/autocomplete/autocompleteview.d.ts +70 -70
- package/dist/badge/badge.d.ts +119 -121
- package/dist/bindings/addkeyboardhandlingforgrid.d.ts +22 -22
- package/dist/bindings/clickoutsidehandler.d.ts +25 -25
- package/dist/bindings/csstransitiondisablermixin.d.ts +47 -36
- package/dist/bindings/draggableviewmixin.d.ts +45 -37
- package/dist/bindings/preventdefault.d.ts +30 -30
- package/dist/bindings/submithandler.d.ts +49 -49
- package/dist/button/button.d.ts +167 -167
- package/dist/button/buttonlabel.d.ts +28 -28
- package/dist/button/buttonlabelview.d.ts +26 -26
- package/dist/button/buttonview.d.ts +192 -192
- package/dist/button/filedialogbuttonview.d.ts +107 -99
- package/dist/button/listitembuttonview.d.ts +73 -73
- package/dist/button/switchbuttonview.d.ts +40 -40
- package/dist/collapsible/collapsibleview.d.ts +63 -63
- package/dist/colorgrid/colorgridview.d.ts +117 -117
- package/dist/colorgrid/colortileview.d.ts +21 -21
- package/dist/colorgrid/utils.d.ts +35 -35
- package/dist/colorpicker/colorpickerview.d.ts +155 -157
- package/dist/colorpicker/utils.d.ts +37 -37
- package/dist/colorselector/colorgridsfragmentview.d.ts +191 -191
- package/dist/colorselector/colorpickerfragmentview.d.ts +129 -129
- package/dist/colorselector/colorselectorview.d.ts +227 -229
- package/dist/colorselector/documentcolorcollection.d.ts +52 -59
- package/dist/componentfactory.d.ts +76 -76
- package/dist/dialog/dialog.d.ts +311 -288
- package/dist/dialog/dialogactionsview.d.ts +62 -62
- package/dist/dialog/dialogcontentview.d.ts +22 -22
- package/dist/dialog/dialogview.d.ts +255 -251
- package/dist/dropdown/button/dropdownbutton.d.ts +17 -17
- package/dist/dropdown/button/dropdownbuttonview.d.ts +41 -41
- package/dist/dropdown/button/splitbuttonview.d.ts +155 -155
- package/dist/dropdown/dropdownpanelfocusable.d.ts +16 -16
- package/dist/dropdown/dropdownpanelview.d.ts +56 -56
- package/dist/dropdown/dropdownview.d.ts +326 -326
- package/dist/dropdown/menu/dropdownmenubehaviors.d.ts +43 -43
- package/dist/dropdown/menu/dropdownmenubuttonview.d.ts +29 -29
- package/dist/dropdown/menu/dropdownmenulistitembuttonview.d.ts +12 -12
- package/dist/dropdown/menu/dropdownmenulistitemview.d.ts +17 -17
- package/dist/dropdown/menu/dropdownmenulistview.d.ts +19 -19
- package/dist/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +28 -28
- package/dist/dropdown/menu/dropdownmenunestedmenuview.d.ts +126 -126
- package/dist/dropdown/menu/dropdownmenurootlistview.d.ts +132 -132
- package/dist/dropdown/menu/utils.d.ts +112 -112
- package/dist/dropdown/utils.d.ts +272 -272
- package/dist/editableui/editableuiview.d.ts +78 -78
- package/dist/editableui/inline/inlineeditableuiview.d.ts +38 -38
- package/dist/editorui/accessibilityhelp/accessibilityhelp.d.ts +50 -50
- package/dist/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +30 -30
- package/dist/editorui/bodycollection.d.ts +86 -86
- package/dist/editorui/boxed/boxededitoruiview.d.ts +35 -35
- package/dist/editorui/editorui.d.ts +348 -351
- package/dist/editorui/editoruiview.d.ts +53 -53
- package/dist/editorui/evaluationbadge.d.ts +28 -28
- package/dist/editorui/poweredby.d.ts +25 -25
- package/dist/focuscycler.d.ts +265 -270
- package/dist/formheader/formheaderview.d.ts +53 -53
- package/dist/formrow/formrowview.d.ts +52 -52
- package/dist/highlightedtext/buttonlabelwithhighlightview.d.ts +25 -25
- package/dist/highlightedtext/highlightedtextview.d.ts +33 -33
- package/dist/highlightedtext/labelwithhighlightview.d.ts +21 -21
- package/dist/icon/iconview.d.ts +83 -83
- package/dist/iframe/iframeview.d.ts +42 -42
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +136 -136
- package/dist/index.js +16467 -17751
- package/dist/index.js.map +1 -1
- package/dist/input/inputbase.d.ts +114 -114
- package/dist/input/inputview.d.ts +28 -28
- package/dist/inputnumber/inputnumberview.d.ts +44 -44
- package/dist/inputtext/inputtextview.d.ts +13 -13
- package/dist/label/labelview.d.ts +31 -31
- package/dist/labeledfield/labeledfieldview.d.ts +180 -180
- package/dist/labeledfield/utils.d.ts +112 -112
- package/dist/labeledinput/labeledinputview.d.ts +120 -120
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/list/listitemgroupview.d.ts +54 -54
- package/dist/list/listitemview.d.ts +31 -31
- package/dist/list/listseparatorview.d.ts +13 -13
- package/dist/list/listview.d.ts +119 -119
- package/dist/menubar/menubarmenubuttonview.d.ts +28 -28
- package/dist/menubar/menubarmenulistitembuttonview.d.ts +16 -16
- package/dist/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +18 -18
- package/dist/menubar/menubarmenulistitemview.d.ts +20 -20
- package/dist/menubar/menubarmenulistview.d.ts +24 -24
- package/dist/menubar/menubarmenupanelview.d.ts +47 -47
- package/dist/menubar/menubarmenuview.d.ts +113 -113
- package/dist/menubar/menubarview.d.ts +145 -145
- package/dist/menubar/utils.d.ts +455 -455
- package/dist/model.d.ts +19 -18
- package/dist/notification/notification.d.ts +200 -200
- package/dist/panel/balloon/balloonpanelview.d.ts +692 -692
- package/dist/panel/balloon/contextualballoon.d.ts +298 -298
- package/dist/panel/sticky/stickypanelview.d.ts +151 -151
- package/dist/search/filteredview.d.ts +23 -23
- package/dist/search/filtergroupanditemnames.d.ts +11 -11
- package/dist/search/searchinfoview.d.ts +39 -39
- package/dist/search/searchresultsview.d.ts +49 -49
- package/dist/search/text/searchtextqueryview.d.ts +63 -63
- package/dist/search/text/searchtextview.d.ts +203 -203
- package/dist/spinner/spinnerview.d.ts +20 -20
- package/dist/template.d.ts +897 -902
- package/dist/textarea/textareaview.d.ts +96 -96
- package/dist/toolbar/balloon/balloontoolbar.d.ts +122 -122
- package/dist/toolbar/block/blockbuttonview.d.ts +30 -30
- package/dist/toolbar/block/blocktoolbar.d.ts +166 -166
- package/dist/toolbar/normalizetoolbarconfig.d.ts +35 -35
- package/dist/toolbar/toolbarlinebreakview.d.ts +13 -13
- package/dist/toolbar/toolbarseparatorview.d.ts +13 -13
- package/dist/toolbar/toolbarview.d.ts +271 -271
- package/dist/tooltipmanager.d.ts +190 -193
- package/dist/view.d.ts +385 -388
- package/dist/viewcollection.d.ts +134 -134
- package/package.json +6 -6
package/dist/dropdown/utils.d.ts
CHANGED
|
@@ -1,296 +1,296 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { DropdownView } from
|
|
6
|
-
import { ViewCollection } from
|
|
7
|
-
import type { View } from
|
|
8
|
-
import { type UIModel } from
|
|
9
|
-
import { type DropdownButton } from
|
|
10
|
-
import type { FocusableView } from
|
|
11
|
-
import type { FalsyValue } from
|
|
12
|
-
import { type BodyCollection } from
|
|
13
|
-
import { type Collection, type Locale } from
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import type { DropdownMenuDefinition } from
|
|
17
|
-
import type { ButtonLabelView } from
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
import { DropdownView } from "./dropdownview.js";
|
|
6
|
+
import { ViewCollection } from "../viewcollection.js";
|
|
7
|
+
import type { View } from "../view.js";
|
|
8
|
+
import { type UIModel } from "../model.js";
|
|
9
|
+
import { type DropdownButton } from "./button/dropdownbutton.js";
|
|
10
|
+
import type { FocusableView } from "../focuscycler.js";
|
|
11
|
+
import type { FalsyValue } from "../template.js";
|
|
12
|
+
import { type BodyCollection } from "../editorui/bodycollection.js";
|
|
13
|
+
import { type Collection, type Locale } from "@ckeditor/ckeditor5-utils";
|
|
14
|
+
import "../../theme/components/dropdown/toolbardropdown.css";
|
|
15
|
+
import "../../theme/components/dropdown/listdropdown.css";
|
|
16
|
+
import type { DropdownMenuDefinition } from "./menu/utils.js";
|
|
17
|
+
import type { ButtonLabelView } from "../button/buttonlabelview.js";
|
|
18
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
|
-
export declare function createDropdown(locale: Locale | undefined, ButtonClassOrInstance?: (new (locale?: Locale) => DropdownButton & FocusableView) |
|
|
19
|
+
* A helper for creating dropdowns. It creates an instance of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown},
|
|
20
|
+
* with a {@link module:ui/dropdown/button/dropdownbutton~DropdownButton button},
|
|
21
|
+
* {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView panel} and all standard dropdown's behaviors.
|
|
22
|
+
*
|
|
23
|
+
* # Creating dropdowns
|
|
24
|
+
*
|
|
25
|
+
* By default, the default {@link module:ui/dropdown/button/dropdownbuttonview~DropdownButtonView} class is used as
|
|
26
|
+
* definition of the button:
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* const dropdown = createDropdown( model );
|
|
30
|
+
*
|
|
31
|
+
* // Configure dropdown's button properties:
|
|
32
|
+
* dropdown.buttonView.set( {
|
|
33
|
+
* label: 'A dropdown',
|
|
34
|
+
* withText: true
|
|
35
|
+
* } );
|
|
36
|
+
*
|
|
37
|
+
* dropdown.render();
|
|
38
|
+
*
|
|
39
|
+
* // Will render a dropdown labeled "A dropdown" with an empty panel.
|
|
40
|
+
* document.body.appendChild( dropdown.element );
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* You can also provide other button views (they need to implement the
|
|
44
|
+
* {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface). For instance, you can use
|
|
45
|
+
* {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} to create a dropdown with a split button.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const dropdown = createDropdown( locale, SplitButtonView );
|
|
49
|
+
*
|
|
50
|
+
* // Configure dropdown's button properties:
|
|
51
|
+
* dropdown.buttonView.set( {
|
|
52
|
+
* label: 'A dropdown',
|
|
53
|
+
* withText: true
|
|
54
|
+
* } );
|
|
55
|
+
*
|
|
56
|
+
* dropdown.buttonView.on( 'execute', () => {
|
|
57
|
+
* // Add the behavior of the "action part" of the split button.
|
|
58
|
+
* // Split button consists of the "action part" and "arrow part".
|
|
59
|
+
* // The arrow opens the dropdown while the action part can have some other behavior.
|
|
60
|
+
* } );
|
|
61
|
+
*
|
|
62
|
+
* dropdown.render();
|
|
63
|
+
*
|
|
64
|
+
* // Will render a dropdown labeled "A dropdown" with an empty panel.
|
|
65
|
+
* document.body.appendChild( dropdown.element );
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* # Adding content to the dropdown's panel
|
|
69
|
+
*
|
|
70
|
+
* The content of the panel can be inserted directly into the `dropdown.panelView.element`:
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* dropdown.panelView.element.textContent = 'Content of the panel';
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* However, most of the time you will want to add there either a {@link module:ui/list/listview~ListView list of options}
|
|
77
|
+
* or a list of buttons (i.e. a {@link module:ui/toolbar/toolbarview~ToolbarView toolbar}).
|
|
78
|
+
* To simplify the task, you can use, respectively, {@link module:ui/dropdown/utils~addListToDropdown} or
|
|
79
|
+
* {@link module:ui/dropdown/utils~addToolbarToDropdown} utils.
|
|
80
|
+
*
|
|
81
|
+
* @param locale The locale instance.
|
|
82
|
+
* @param ButtonClassOrInstance The dropdown button view class. Needs to implement the
|
|
83
|
+
* {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface.
|
|
84
|
+
* @returns The dropdown view instance.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createDropdown(locale: Locale | undefined, ButtonClassOrInstance?: (new (locale?: Locale) => DropdownButton & FocusableView) | DropdownButton & FocusableView): DropdownView;
|
|
87
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
|
-
|
|
88
|
+
* Adds a menu UI component to a dropdown and sets all common behaviors and interactions between the dropdown and the menu.
|
|
89
|
+
*
|
|
90
|
+
* Use this helper to create multi-level dropdown menus that are displayed in a toolbar.
|
|
91
|
+
*
|
|
92
|
+
* Internally, it creates an instance of {@link module:ui/dropdown/menu/dropdownmenurootlistview~DropdownMenuRootListView}.
|
|
93
|
+
*
|
|
94
|
+
* Example:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const definitions = [
|
|
98
|
+
* {
|
|
99
|
+
* id: 'menu_1',
|
|
100
|
+
* menu: 'Menu 1',
|
|
101
|
+
* children: [
|
|
102
|
+
* {
|
|
103
|
+
* id: 'menu_1_a',
|
|
104
|
+
* label: 'Item A'
|
|
105
|
+
* },
|
|
106
|
+
* {
|
|
107
|
+
* id: 'menu_1_b',
|
|
108
|
+
* label: 'Item B'
|
|
109
|
+
* }
|
|
110
|
+
* ]
|
|
111
|
+
* },
|
|
112
|
+
* {
|
|
113
|
+
* id: 'top_a',
|
|
114
|
+
* label: 'Top Item A'
|
|
115
|
+
* },
|
|
116
|
+
* {
|
|
117
|
+
* id: 'top_b',
|
|
118
|
+
* label: 'Top Item B'
|
|
119
|
+
* }
|
|
120
|
+
* ];
|
|
121
|
+
*
|
|
122
|
+
* const dropdownView = createDropdown( editor.locale );
|
|
123
|
+
*
|
|
124
|
+
* addMenuToDropdown( dropdownView, editor.ui.view.body, definitions );
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* After using this helper, the `dropdown` will fire {@link module:ui/dropdown/dropdownview~DropdownViewEvent `execute`} event when
|
|
128
|
+
* a nested menu button is pressed.
|
|
129
|
+
*
|
|
130
|
+
* The helper will make sure that the `dropdownMenuRootListView` is lazy loaded, i.e., the menu component structure will be initialized
|
|
131
|
+
* and rendered only after the `dropdown` is opened for the first time.
|
|
132
|
+
*
|
|
133
|
+
* @param dropdownView A dropdown instance to which the menu component will be added.
|
|
134
|
+
* @param body Body collection to which floating menu panels will be added.
|
|
135
|
+
* @param definition The menu component definition.
|
|
136
|
+
* @param options.ariaLabel Label used by assistive technologies to describe the top-level menu.
|
|
137
|
+
*/
|
|
138
138
|
export declare function addMenuToDropdown(dropdownView: DropdownView, body: BodyCollection, definition: DropdownMenuDefinition, options?: {
|
|
139
|
-
|
|
139
|
+
ariaLabel?: string;
|
|
140
140
|
}): void;
|
|
141
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
142
|
+
* Adds an instance of {@link module:ui/toolbar/toolbarview~ToolbarView} to a dropdown.
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* const buttonsCreator = () => {
|
|
146
|
+
* const buttons = [];
|
|
147
|
+
*
|
|
148
|
+
* // Either create a new ButtonView instance or create existing.
|
|
149
|
+
* buttons.push( new ButtonView() );
|
|
150
|
+
* buttons.push( editor.ui.componentFactory.create( 'someButton' ) );
|
|
151
|
+
* };
|
|
152
|
+
*
|
|
153
|
+
* const dropdown = createDropdown( locale );
|
|
154
|
+
*
|
|
155
|
+
* addToolbarToDropdown( dropdown, buttonsCreator, { isVertical: true } );
|
|
156
|
+
*
|
|
157
|
+
* // Will render a vertical button dropdown labeled "A button dropdown"
|
|
158
|
+
* // with a button group in the panel containing two buttons.
|
|
159
|
+
* // Buttons inside the dropdown will be created on first dropdown panel open.
|
|
160
|
+
* dropdown.render()
|
|
161
|
+
* document.body.appendChild( dropdown.element );
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* **Note:** To improve the accessibility, you can tell the dropdown to focus the first active button of the toolbar when the dropdown
|
|
165
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open}. See the documentation of `options` to learn more.
|
|
166
|
+
*
|
|
167
|
+
* **Note:** Toolbar view will be created on first open of the dropdown.
|
|
168
|
+
*
|
|
169
|
+
* See {@link module:ui/dropdown/utils~createDropdown} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
|
|
170
|
+
*
|
|
171
|
+
* @param dropdownView A dropdown instance to which `ToolbarView` will be added.
|
|
172
|
+
* @param options.enableActiveItemFocusOnDropdownOpen When set `true`, the focus will automatically move to the first
|
|
173
|
+
* active {@link module:ui/toolbar/toolbarview~ToolbarView#items item} of the toolbar upon
|
|
174
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView#isOpen opening} the dropdown. Active items are those with the `isOn` property set
|
|
175
|
+
* `true` (for instance {@link module:ui/button/buttonview~ButtonView buttons}). If no active items is found, the toolbar will be focused
|
|
176
|
+
* as a whole resulting in the focus moving to its first focusable item (default behavior of
|
|
177
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView}).
|
|
178
|
+
* @param options.ariaLabel Label used by assistive technologies to describe toolbar element.
|
|
179
|
+
* @param options.maxWidth The maximum width of the toolbar element.
|
|
180
|
+
* Details: {@link module:ui/toolbar/toolbarview~ToolbarView#maxWidth}.
|
|
181
|
+
* @param options.class An additional CSS class added to the toolbar element.
|
|
182
|
+
* @param options.isCompact When set true, makes the toolbar look compact with toolbar element.
|
|
183
|
+
* @param options.isVertical Controls the orientation of toolbar items.
|
|
184
|
+
*/
|
|
185
185
|
export declare function addToolbarToDropdown(dropdownView: DropdownView, buttonsOrCallback: Array<View> | ViewCollection | (() => Array<View> | ViewCollection), options?: {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
enableActiveItemFocusOnDropdownOpen?: boolean;
|
|
187
|
+
ariaLabel?: string;
|
|
188
|
+
maxWidth?: string;
|
|
189
|
+
class?: string;
|
|
190
|
+
isCompact?: boolean;
|
|
191
|
+
isVertical?: boolean;
|
|
192
192
|
}): void;
|
|
193
193
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
194
|
+
* Adds an instance of {@link module:ui/list/listview~ListView} to a dropdown.
|
|
195
|
+
*
|
|
196
|
+
* ```ts
|
|
197
|
+
* const items = new Collection<ListDropdownItemDefinition>();
|
|
198
|
+
*
|
|
199
|
+
* items.add( {
|
|
200
|
+
* type: 'button',
|
|
201
|
+
* model: new Model( {
|
|
202
|
+
* withText: true,
|
|
203
|
+
* label: 'First item',
|
|
204
|
+
* labelStyle: 'color: red'
|
|
205
|
+
* } )
|
|
206
|
+
* } );
|
|
207
|
+
*
|
|
208
|
+
* items.add( {
|
|
209
|
+
* type: 'button',
|
|
210
|
+
* model: new Model( {
|
|
211
|
+
* withText: true,
|
|
212
|
+
* label: 'Second item',
|
|
213
|
+
* labelStyle: 'color: green',
|
|
214
|
+
* class: 'foo'
|
|
215
|
+
* } )
|
|
216
|
+
* } );
|
|
217
|
+
*
|
|
218
|
+
* const dropdown = createDropdown( locale );
|
|
219
|
+
*
|
|
220
|
+
* addListToDropdown( dropdown, items );
|
|
221
|
+
*
|
|
222
|
+
* // Will render a dropdown with a list in the panel containing two items.
|
|
223
|
+
* dropdown.render()
|
|
224
|
+
* document.body.appendChild( dropdown.element );
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* The `items` collection passed to this methods controls the presence and attributes of respective
|
|
228
|
+
* {@link module:ui/list/listitemview~ListItemView list items}.
|
|
229
|
+
*
|
|
230
|
+
* **Note:** To improve the accessibility, when a list is added to the dropdown using this helper the dropdown will automatically attempt
|
|
231
|
+
* to focus the first active item (a host to a {@link module:ui/button/buttonview~ButtonView} with
|
|
232
|
+
* {@link module:ui/button/buttonview~ButtonView#isOn} set `true`) or the very first item when none are active.
|
|
233
|
+
*
|
|
234
|
+
* **Note:** List view will be created on first open of the dropdown.
|
|
235
|
+
*
|
|
236
|
+
* See {@link module:ui/dropdown/utils~createDropdown} and {@link module:list/list~List}.
|
|
237
|
+
*
|
|
238
|
+
* @param dropdownView A dropdown instance to which `ListVIew` will be added.
|
|
239
|
+
* @param itemsOrCallback A collection of the list item definitions or a callback returning a list item definitions to populate the list.
|
|
240
|
+
* @param options.ariaLabel Label used by assistive technologies to describe list element.
|
|
241
|
+
* @param options.role Will be reflected by the `role` DOM attribute in `ListVIew` and used by assistive technologies.
|
|
242
|
+
*/
|
|
243
243
|
export declare function addListToDropdown(dropdownView: DropdownView, itemsOrCallback: Collection<ListDropdownItemDefinition> | (() => Collection<ListDropdownItemDefinition>), options?: {
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
ariaLabel?: string;
|
|
245
|
+
role?: string;
|
|
246
246
|
}): void;
|
|
247
247
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
248
|
+
* A helper to be used on an existing {@link module:ui/dropdown/dropdownview~DropdownView} that focuses
|
|
249
|
+
* a specific child in DOM when the dropdown {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open}.
|
|
250
|
+
*
|
|
251
|
+
* @param dropdownView A dropdown instance to which the focus behavior will be added.
|
|
252
|
+
* @param childSelectorCallback A callback executed when the dropdown gets open. It should return a {@link module:ui/view~View}
|
|
253
|
+
* instance (child of {@link module:ui/dropdown/dropdownview~DropdownView#panelView}) that will get focused or a falsy value.
|
|
254
|
+
* If falsy value is returned, a default behavior of the dropdown will engage focusing the first focusable child in
|
|
255
|
+
* the {@link module:ui/dropdown/dropdownview~DropdownView#panelView}.
|
|
256
|
+
*/
|
|
257
257
|
export declare function focusChildOnDropdownOpen(dropdownView: DropdownView, childSelectorCallback: () => View | FalsyValue): void;
|
|
258
258
|
/**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
* A definition of the list item used by the {@link module:ui/dropdown/utils~addListToDropdown}
|
|
260
|
+
* utility.
|
|
261
|
+
*/
|
|
262
262
|
export type ListDropdownItemDefinition = ListDropdownSeparatorDefinition | ListDropdownButtonDefinition | ListDropdownGroupDefinition;
|
|
263
263
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
* A definition of the 'separator' list item.
|
|
265
|
+
*/
|
|
266
266
|
export type ListDropdownSeparatorDefinition = {
|
|
267
|
-
|
|
267
|
+
type: "separator";
|
|
268
268
|
};
|
|
269
269
|
/**
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
* A definition of the 'button' or 'switchbutton' list item.
|
|
271
|
+
*/
|
|
272
272
|
export type ListDropdownButtonDefinition = {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
273
|
+
type: "button" | "switchbutton";
|
|
274
|
+
/**
|
|
275
|
+
* Model of the item. Its properties fuel the newly created list item (or its children, depending on the `type`).
|
|
276
|
+
*/
|
|
277
|
+
model: UIModel;
|
|
278
|
+
/**
|
|
279
|
+
* A view that will be used as a button body in the list item.
|
|
280
|
+
*/
|
|
281
|
+
labelView?: ButtonLabelView;
|
|
282
282
|
};
|
|
283
283
|
/**
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
* A definition of the group inside the list. A group can contain one or more list items (buttons).
|
|
285
|
+
*/
|
|
286
286
|
export type ListDropdownGroupDefinition = {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
287
|
+
type: "group";
|
|
288
|
+
/**
|
|
289
|
+
* The visible label of the group.
|
|
290
|
+
*/
|
|
291
|
+
label: string;
|
|
292
|
+
/**
|
|
293
|
+
* The collection of the child list items inside this group.
|
|
294
|
+
*/
|
|
295
|
+
items: Collection<ListDropdownButtonDefinition>;
|
|
296
296
|
};
|