office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
60 lines (59 loc) • 2.66 kB
TypeScript
/// <reference types="react" />
import { IBaseAutoFillProps, IBaseAutoFill } from './BaseAutoFill.types';
import { BaseComponent, KeyCodes } from '../../../Utilities';
export interface IBaseAutoFillState {
displayValue?: string;
}
export declare class BaseAutoFill extends BaseComponent<IBaseAutoFillProps, IBaseAutoFillState> implements IBaseAutoFill {
static defaultProps: {
enableAutoFillOnKeyPress: KeyCodes[];
};
private _inputElement;
private _autoFillEnabled;
private _value;
constructor(props: IBaseAutoFillProps);
readonly cursorLocation: number;
readonly isValueSelected: boolean;
readonly value: string;
readonly selectionStart: number;
readonly selectionEnd: number;
readonly inputElement: HTMLInputElement;
componentWillReceiveProps(nextProps: IBaseAutoFillProps): void;
componentDidUpdate(): void;
render(): JSX.Element;
focus(): void;
clear(): void;
private _onCompositionStart(ev);
private _onCompositionEnd(ev);
private _onClick();
private _onKeyDown(ev);
private _onChange(ev);
private _getCurrentInputValue(ev?);
/**
* Attempts to enable autofill. Whether or not autofill is enabled depends on the input value,
* whether or not any text is selected, and only if the new input value is longer than the old input value.
* Autofill should never be set to true if the value is composing. Once compositionEnd is called, then
* it should be completed.
* See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition.
* @param newValue
* @param oldValue
* @param isComposing if true then the text is actively being composed and it has not completed.
* @param isComposed if the text is a composed text value.
*/
private _tryEnableAutofill(newValue, oldValue, isComposing?, isComposed?);
private _notifyInputChange(newValue);
/**
* Updates the current input value as well as getting a new display value.
* @param newValue The new value from the input
*/
private _updateValue(newValue);
/**
* Returns a string that should be used as the display value.
* It evaluates this based on whether or not the suggested value starts with the input value
* and whether or not autofill is enabled.
* @param inputValue the value that the input currently has.
* @param suggestedDisplayValue the possible full value
*/
private _getDisplayValue(inputValue, suggestedDisplayValue?);
private _doesTextStartWith(text, startWith);
}