UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

42 lines 2.29 kB
define(["require", "exports", "tslib", "react", "../../Utilities", "./ComboBox", "../../List"], function (require, exports, tslib_1, React, Utilities_1, ComboBox_1, List_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var VirtualizedComboBox = /** @class */ (function (_super) { tslib_1.__extends(VirtualizedComboBox, _super); function VirtualizedComboBox() { var _this = _super !== null && _super.apply(this, arguments) || this; /** The combo box element */ _this._comboBox = Utilities_1.createRef(); /** The virtualized list element */ _this._list = Utilities_1.createRef(); _this._onRenderList = function (props) { var onRenderItem = props.onRenderItem; // Render virtualized list return (React.createElement(List_1.List, { componentRef: _this._list, role: "listbox", items: props.options, onRenderCell: onRenderItem ? function (item) { return onRenderItem(item); } : function () { return null; } })); }; _this._onScrollToItem = function (itemIndex) { // We are using the List component, call scrollToIndex _this._list.current && _this._list.current.scrollToIndex(itemIndex); }; return _this; } VirtualizedComboBox.prototype.dismissMenu = function () { if (this._comboBox.current) { return this._comboBox.current.dismissMenu(); } }; VirtualizedComboBox.prototype.focus = function () { if (this._comboBox.current) { this._comboBox.current.focus(); return true; } return false; }; VirtualizedComboBox.prototype.render = function () { return (React.createElement(ComboBox_1.ComboBox, tslib_1.__assign({}, this.props, { componentRef: this._comboBox, onRenderList: this._onRenderList, onScrollToItem: this._onScrollToItem }))); }; return VirtualizedComboBox; }(Utilities_1.BaseComponent)); exports.VirtualizedComboBox = VirtualizedComboBox; }); //# sourceMappingURL=VirtualizedComboBox.js.map