UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

44 lines 2.01 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { autobind, BaseComponent } from '../../Utilities'; import { ComboBox } from './ComboBox'; import { List } from '../../List'; var VirtualizedComboBox = /** @class */ (function (_super) { tslib_1.__extends(VirtualizedComboBox, _super); function VirtualizedComboBox() { return _super !== null && _super.apply(this, arguments) || this; } VirtualizedComboBox.prototype.dismissMenu = function () { if (this._comboBox) { return this._comboBox.dismissMenu(); } }; VirtualizedComboBox.prototype.focus = function () { if (this._comboBox) { this._comboBox.focus(); return true; } return false; }; VirtualizedComboBox.prototype.render = function () { return (React.createElement(ComboBox, tslib_1.__assign({}, this.props, { componentRef: this._resolveRef('_comboBox'), onRenderList: this._onRenderList, onScrollToItem: this._onScrollToItem }))); }; VirtualizedComboBox.prototype._onRenderList = function (props) { var onRenderItem = props.onRenderItem; // Render virtualized list return (React.createElement(List, { componentRef: this._resolveRef('_list'), role: 'listbox', items: props.options, onRenderCell: onRenderItem ? function (item) { return onRenderItem(item); } : function () { return null; } })); }; VirtualizedComboBox.prototype._onScrollToItem = function (itemIndex) { // We are using the List component, call scrollToIndex this._list.scrollToIndex(itemIndex); }; tslib_1.__decorate([ autobind ], VirtualizedComboBox.prototype, "_onRenderList", null); tslib_1.__decorate([ autobind ], VirtualizedComboBox.prototype, "_onScrollToItem", null); return VirtualizedComboBox; }(BaseComponent)); export { VirtualizedComboBox }; //# sourceMappingURL=VirtualizedComboBox.js.map