Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 4 | |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 5 | import * as ARIAUtils from './ARIAUtils.js'; |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 6 | import {Size} from './Geometry.js'; |
| 7 | import {AnchorBehavior, GlassPane, MarginBehavior, PointerEventsBehavior} from './GlassPane.js'; |
| 8 | import {Icon} from './Icon.js'; |
| 9 | import {ListControl, ListDelegate, ListMode} from './ListControl.js'; // eslint-disable-line no-unused-vars |
| 10 | import {Events as ListModelEvents, ListModel} from './ListModel.js'; // eslint-disable-line no-unused-vars |
| 11 | import {appendStyle} from './utils/append-style.js'; |
| 12 | import {createShadowRootWithCoreStyles} from './utils/create-shadow-root-with-core-styles.js'; |
| 13 | |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 14 | /** |
| 15 | * @template T |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 16 | * @implements {ListDelegate<T>} |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 17 | */ |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 18 | export class SoftDropDown { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 19 | /** |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 20 | * @param {!ListModel<T>} model |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 21 | * @param {!Delegate<T>} delegate |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 22 | */ |
| 23 | constructor(model, delegate) { |
| 24 | this._delegate = delegate; |
| 25 | this._selectedItem = null; |
| 26 | this._model = model; |
| 27 | |
Hongchan Choi | 8364823 | 2019-05-04 01:35:46 | [diff] [blame] | 28 | this._placeholderText = ls`(no item selected)`; |
| 29 | |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 30 | this.element = createElementWithClass('button', 'soft-dropdown'); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 31 | appendStyle(this.element, 'ui/softDropDownButton.css'); |
Joel Einbinder | 7fbe24c | 2019-01-24 05:19:01 | [diff] [blame] | 32 | this._titleElement = this.element.createChild('span', 'title'); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 33 | const dropdownArrowIcon = Icon.create('smallicon-triangle-down'); |
Joel Einbinder | 7fbe24c | 2019-01-24 05:19:01 | [diff] [blame] | 34 | this.element.appendChild(dropdownArrowIcon); |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 35 | ARIAUtils.setExpanded(this.element, false); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 36 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 37 | this._glassPane = new GlassPane(); |
| 38 | this._glassPane.setMarginBehavior(MarginBehavior.NoMargin); |
| 39 | this._glassPane.setAnchorBehavior(AnchorBehavior.PreferBottom); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 40 | this._glassPane.setOutsideClickCallback(this._hide.bind(this)); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 41 | this._glassPane.setPointerEventsBehavior(PointerEventsBehavior.BlockedByGlassPane); |
| 42 | this._list = new ListControl(model, this, ListMode.EqualHeightItems); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 43 | this._list.element.classList.add('item-list'); |
| 44 | this._rowHeight = 36; |
| 45 | this._width = 315; |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 46 | createShadowRootWithCoreStyles(this._glassPane.contentElement, 'ui/softDropDown.css') |
John Emau | 2fe6351 | 2020-02-05 18:52:47 | [diff] [blame] | 47 | .createChild('slot') // issue #972755 |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 48 | .appendChild(this._list.element); |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 49 | ARIAUtils.markAsMenu(this._list.element); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 50 | |
| 51 | this._listWasShowing200msAgo = false; |
| 52 | this.element.addEventListener('mousedown', event => { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 53 | if (this._listWasShowing200msAgo) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 54 | this._hide(event); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 55 | } else if (!this.element.disabled) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 56 | this._show(event); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 57 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 58 | }, false); |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 59 | this.element.addEventListener('keydown', this._onKeyDownButton.bind(this), false); |
| 60 | this._list.element.addEventListener('keydown', this._onKeyDownList.bind(this), false); |
| 61 | this._list.element.addEventListener('focusout', this._hide.bind(this), false); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 62 | this._list.element.addEventListener('mousedown', event => event.consume(true), false); |
| 63 | this._list.element.addEventListener('mouseup', event => { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 64 | if (event.target === this._list.element) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 65 | return; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 66 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 67 | |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 68 | if (!this._listWasShowing200msAgo) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 69 | return; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 70 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 71 | this._selectHighlightedItem(); |
| 72 | this._hide(event); |
| 73 | }, false); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 74 | model.addEventListener(ListModelEvents.ItemsReplaced, this._itemsReplaced, this); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @param {!Event} event |
| 79 | */ |
| 80 | _show(event) { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 81 | if (this._glassPane.isShowing()) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 82 | return; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 83 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 84 | this._glassPane.setContentAnchorBox(this.element.boxInWindow()); |
| 85 | this._glassPane.show(/** @type {!Document} **/ (this.element.ownerDocument)); |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 86 | this._list.element.focus(); |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 87 | ARIAUtils.setExpanded(this.element, true); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 88 | this._updateGlasspaneSize(); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 89 | if (this._selectedItem) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 90 | this._list.selectItem(this._selectedItem); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 91 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 92 | event.consume(true); |
| 93 | setTimeout(() => this._listWasShowing200msAgo = true, 200); |
| 94 | } |
| 95 | |
| 96 | _updateGlasspaneSize() { |
| 97 | const maxHeight = this._rowHeight * (Math.min(this._model.length, 9)); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 98 | this._glassPane.setMaxContentSize(new Size(this._width, maxHeight)); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 99 | this._list.viewportResized(); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * @param {!Event} event |
| 104 | */ |
| 105 | _hide(event) { |
| 106 | setTimeout(() => this._listWasShowing200msAgo = false, 200); |
| 107 | this._glassPane.hide(); |
| 108 | this._list.selectItem(null); |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 109 | ARIAUtils.setExpanded(this.element, false); |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 110 | this.element.focus(); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 111 | event.consume(true); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * @param {!Event} event |
| 116 | */ |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 117 | _onKeyDownButton(event) { |
| 118 | let handled = false; |
| 119 | switch (event.key) { |
| 120 | case 'ArrowUp': |
| 121 | this._show(event); |
| 122 | this._list.selectItemNextPage(); |
| 123 | handled = true; |
| 124 | break; |
| 125 | case 'ArrowDown': |
| 126 | this._show(event); |
| 127 | this._list.selectItemPreviousPage(); |
| 128 | handled = true; |
| 129 | break; |
| 130 | case 'Enter': |
| 131 | case ' ': |
| 132 | this._show(event); |
| 133 | handled = true; |
| 134 | break; |
| 135 | default: |
| 136 | break; |
| 137 | } |
| 138 | |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 139 | if (handled) { |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 140 | event.consume(true); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 141 | } |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | /** |
| 145 | * @param {!Event} event |
| 146 | */ |
| 147 | _onKeyDownList(event) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 148 | let handled = false; |
| 149 | switch (event.key) { |
| 150 | case 'ArrowLeft': |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 151 | handled = this._list.selectPreviousItem(false, false); |
| 152 | break; |
| 153 | case 'ArrowRight': |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 154 | handled = this._list.selectNextItem(false, false); |
| 155 | break; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 156 | case 'Home': |
| 157 | for (let i = 0; i < this._model.length; i++) { |
| 158 | if (this.isItemSelectable(this._model.at(i))) { |
| 159 | this._list.selectItem(this._model.at(i)); |
| 160 | handled = true; |
| 161 | break; |
| 162 | } |
| 163 | } |
| 164 | break; |
| 165 | case 'End': |
| 166 | for (let i = this._model.length - 1; i >= 0; i--) { |
| 167 | if (this.isItemSelectable(this._model.at(i))) { |
| 168 | this._list.selectItem(this._model.at(i)); |
| 169 | handled = true; |
| 170 | break; |
| 171 | } |
| 172 | } |
| 173 | break; |
| 174 | case 'Escape': |
| 175 | this._hide(event); |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 176 | handled = true; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 177 | break; |
| 178 | case 'Tab': |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 179 | case 'Enter': |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 180 | case ' ': |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 181 | this._selectHighlightedItem(); |
| 182 | this._hide(event); |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 183 | handled = true; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 184 | break; |
| 185 | default: |
| 186 | if (event.key.length === 1) { |
| 187 | const selectedIndex = this._list.selectedIndex(); |
| 188 | const letter = event.key.toUpperCase(); |
| 189 | for (let i = 0; i < this._model.length; i++) { |
| 190 | const item = this._model.at((selectedIndex + i + 1) % this._model.length); |
| 191 | if (this._delegate.titleFor(item).toUpperCase().startsWith(letter)) { |
| 192 | this._list.selectItem(item); |
| 193 | break; |
| 194 | } |
| 195 | } |
| 196 | handled = true; |
| 197 | } |
| 198 | break; |
| 199 | } |
| 200 | |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 201 | if (handled) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 202 | event.consume(true); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 203 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | /** |
| 207 | * @param {number} width |
| 208 | */ |
| 209 | setWidth(width) { |
| 210 | this._width = width; |
| 211 | this._updateGlasspaneSize(); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @param {number} rowHeight |
| 216 | */ |
| 217 | setRowHeight(rowHeight) { |
| 218 | this._rowHeight = rowHeight; |
| 219 | } |
| 220 | |
| 221 | /** |
Hongchan Choi | 8364823 | 2019-05-04 01:35:46 | [diff] [blame] | 222 | * @param {string} text |
| 223 | */ |
| 224 | setPlaceholderText(text) { |
| 225 | this._placeholderText = text; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 226 | if (!this._selectedItem) { |
Hongchan Choi | 8364823 | 2019-05-04 01:35:46 | [diff] [blame] | 227 | this._titleElement.textContent = this._placeholderText; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 228 | } |
Hongchan Choi | 8364823 | 2019-05-04 01:35:46 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /** |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 232 | * @param {!Common.Event} event |
| 233 | */ |
| 234 | _itemsReplaced(event) { |
| 235 | const removed = /** @type {!Array<T>} */ (event.data.removed); |
| 236 | if (removed.indexOf(this._selectedItem) !== -1) { |
| 237 | this._selectedItem = null; |
| 238 | this._selectHighlightedItem(); |
| 239 | } |
| 240 | this._updateGlasspaneSize(); |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * @param {?T} item |
| 245 | */ |
| 246 | selectItem(item) { |
| 247 | this._selectedItem = item; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 248 | if (this._selectedItem) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 249 | this._titleElement.textContent = this._delegate.titleFor(this._selectedItem); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 250 | } else { |
Hongchan Choi | 8364823 | 2019-05-04 01:35:46 | [diff] [blame] | 251 | this._titleElement.textContent = this._placeholderText; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 252 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 253 | this._delegate.itemSelected(this._selectedItem); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @override |
| 258 | * @param {T} item |
| 259 | * @return {!Element} |
| 260 | */ |
| 261 | createElementForItem(item) { |
| 262 | const element = createElementWithClass('div', 'item'); |
| 263 | element.addEventListener('mousemove', e => { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 264 | if ((e.movementX || e.movementY) && this._delegate.isItemSelectable(item)) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 265 | this._list.selectItem(item, false, /* Don't scroll */ true); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 266 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 267 | }); |
| 268 | element.classList.toggle('disabled', !this._delegate.isItemSelectable(item)); |
| 269 | element.classList.toggle('highlighted', this._list.selectedItem() === item); |
| 270 | |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 271 | ARIAUtils.markAsMenuItem(element); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 272 | element.appendChild(this._delegate.createElementForItem(item)); |
| 273 | |
| 274 | return element; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * @override |
| 279 | * @param {T} item |
| 280 | * @return {number} |
| 281 | */ |
| 282 | heightForItem(item) { |
| 283 | return this._rowHeight; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * @override |
| 288 | * @param {T} item |
| 289 | * @return {boolean} |
| 290 | */ |
| 291 | isItemSelectable(item) { |
| 292 | return this._delegate.isItemSelectable(item); |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * @override |
| 297 | * @param {?T} from |
| 298 | * @param {?T} to |
| 299 | * @param {?Element} fromElement |
| 300 | * @param {?Element} toElement |
| 301 | */ |
| 302 | selectedItemChanged(from, to, fromElement, toElement) { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 303 | if (fromElement) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 304 | fromElement.classList.remove('highlighted'); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 305 | } |
| 306 | if (toElement) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 307 | toElement.classList.add('highlighted'); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 308 | } |
John Emau | 8def92f | 2019-08-14 03:01:53 | [diff] [blame] | 309 | |
Tim van der Lippe | aa76aa2 | 2020-02-14 14:38:24 | [diff] [blame^] | 310 | ARIAUtils.setActiveDescendant(this._list.element, toElement); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 311 | this._delegate.highlightedItemChanged( |
| 312 | from, to, fromElement && fromElement.firstElementChild, toElement && toElement.firstElementChild); |
| 313 | } |
| 314 | |
Jack Lynch | 805641c | 2019-12-07 00:05:39 | [diff] [blame] | 315 | /** |
| 316 | * @override |
| 317 | * @param {?Element} fromElement |
| 318 | * @param {?Element} toElement |
| 319 | * @return {boolean} |
| 320 | */ |
| 321 | updateSelectedItemARIA(fromElement, toElement) { |
| 322 | return false; |
| 323 | } |
| 324 | |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 325 | _selectHighlightedItem() { |
| 326 | this.selectItem(this._list.selectedItem()); |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * @param {T} item |
| 331 | */ |
| 332 | refreshItem(item) { |
| 333 | this._list.refreshItem(item); |
| 334 | } |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 335 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 336 | |
| 337 | /** |
| 338 | * @interface |
| 339 | * @template T |
| 340 | */ |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 341 | export class Delegate { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 342 | /** |
| 343 | * @param {T} item |
| 344 | * @return {string} |
| 345 | */ |
| 346 | titleFor(item) { |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * @param {T} item |
| 351 | * @return {!Element} |
| 352 | */ |
| 353 | createElementForItem(item) { |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * @param {T} item |
| 358 | * @return {boolean} |
| 359 | */ |
| 360 | isItemSelectable(item) { |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * @param {?T} item |
| 365 | */ |
| 366 | itemSelected(item) { |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * @param {?T} from |
| 371 | * @param {?T} to |
| 372 | * @param {?Element} fromElement |
| 373 | * @param {?Element} toElement |
| 374 | */ |
| 375 | highlightedItemChanged(from, to, fromElement, toElement) { |
| 376 | } |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 377 | } |