UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

85 lines (84 loc) 3.25 kB
/// <reference types="react" /> import * as React from 'react'; import { BaseComponent } from '../../Utilities'; import { IWithResponsiveModeState } from '../../utilities/decorators/withResponsiveMode'; import { IDropdownProps } from './Dropdown.types'; export interface IDropdownInternalProps extends IDropdownProps, IWithResponsiveModeState { } export interface IDropdownState { isOpen: boolean; selectedIndices: number[]; /** Whether the root dropdown element has focus. */ hasFocus: boolean; } export declare class DropdownBase extends BaseComponent<IDropdownInternalProps, IDropdownState> { static defaultProps: { options: any[]; }; private _host; private _focusZone; private _dropDown; private _id; private _isScrollIdle; private readonly _scrollIdleDelay; private _scrollIdleTimeoutId; private _processingExpandCollapseKeyOnly; private _sizePosCache; private _classNames; private _gotMouseMove; constructor(props: IDropdownProps); componentWillReceiveProps(newProps: IDropdownProps): void; componentDidUpdate(prevProps: IDropdownProps, prevState: IDropdownState): void; render(): JSX.Element; focus(shouldOpenOnFocus?: boolean): void; setSelectedIndex(event: React.FormEvent<HTMLDivElement>, index: number): void; private _copyArray(array); /** * Finds the next valid Dropdown option and sets the selected index to it. * @param stepValue Value of how many items the function should traverse. Should be -1 or 1. * @param index Index of where the search should start * @param selectedIndex The selectedIndex Dropdown's state * @returns The next valid dropdown option's index */ private _moveIndex(event, stepValue, index, selectedIndex); private _onRenderTitle; private _onRenderPlaceHolder; private _onRenderContainer; private _onRenderCaretDown; private _onRenderList; private _onRenderItem; private _renderSeparator(item); private _renderHeader(item); private _renderOption; private _onRenderOption; private _onRenderLabel; private _onPositioned; private _onItemClick; /** * Scroll handler for the callout to make sure the mouse events * for updating focus are not interacting during scroll */ private _onScroll; private _onItemMouseEnter(item, ev); private _onItemMouseMove(item, ev); private _onMouseItemLeave; private _shouldIgnoreMouseEvent(); private _onDismiss; private _getSelectedIndexes(options, selectedKey); private _getAllSelectedOptions(options, selectedIndices); private _getAllSelectedIndices(options); private _getSelectedIndex(options, selectedKey); private _onDropdownBlur; private _onDropdownKeyDown; private _onDropdownKeyUp; private _isExpandCollapseKey(ev); private _onZoneKeyDown; private _onZoneKeyUp; private _onDropdownClick; private _onFocus; /** * Because the isDisabled prop is deprecated, we have had to repeat this logic all over the place. * This helper method avoids all the repetition. */ private _isDisabled; }