diff --git a/src/Explorer/Controls/InputTypeahead/InputTypeahead.less b/src/Explorer/Controls/InputTypeahead/InputTypeahead.less index e56bfaa51..1d68e3b7e 100644 --- a/src/Explorer/Controls/InputTypeahead/InputTypeahead.less +++ b/src/Explorer/Controls/InputTypeahead/InputTypeahead.less @@ -5,6 +5,9 @@ display: inline-block; width: 100%; + .input-type-head-text-field { + width: 100%; + } textarea { width: 100%; line-height: 1; @@ -21,4 +24,11 @@ } } } - +.input-typeahead-chocies-container { + border: 1px solid lightgrey; + padding: 5px 10px 5px 10px; + cursor: pointer; + .choice-caption{ + font-size: 14px; + } +} \ No newline at end of file diff --git a/src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx b/src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx index 69f01a745..2e9a2d104 100644 --- a/src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx +++ b/src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx @@ -6,14 +6,13 @@ * typeaheadOverrideOptions: { dynamic:false } * */ -import "jquery-typeahead"; +import { getTheme, IconButton, IIconProps, List, Stack, TextField } from "@fluentui/react"; import * as React from "react"; -import { KeyCodes } from "../../../Common/Constants"; import "./InputTypeahead.less"; export interface Item { caption: string; - value: any; + value: string; } /** @@ -75,170 +74,125 @@ export interface InputTypeaheadComponentProps { useTextarea?: boolean; } -interface OnClickItem { - matchedKey: string; - value: any; - caption: string; - group: string; +interface InputTypeaheadComponentState { + isSuggestionVisible: boolean; + selectedChoice: Item; + filteredChoices: Item[]; } -interface Cache { - inputValue: string; - selection: Item; -} - -interface InputTypeaheadComponentState {} - export class InputTypeaheadComponent extends React.Component< InputTypeaheadComponentProps, InputTypeaheadComponentState > { - private inputElt: HTMLElement; - private containerElt: HTMLElement; - - private cache: Cache; - private inputValue: string; - private selection: Item; - - public constructor(props: InputTypeaheadComponentProps) { + constructor(props: InputTypeaheadComponentProps) { super(props); - this.cache = { - inputValue: null, - selection: null, + this.state = { + isSuggestionVisible: false, + filteredChoices: [], + selectedChoice: { + caption: "", + value: "", + }, }; } - /** - * Props have changed - * @param prevProps - * @param prevState - * @param snapshot - */ - public componentDidUpdate( - prevProps: InputTypeaheadComponentProps, - prevState: InputTypeaheadComponentState, - snapshot: any - ): void { - if (prevProps.defaultValue !== this.props.defaultValue) { - $(this.inputElt).val(this.props.defaultValue); - this.initializeTypeahead(); - } - } - - /** - * Executed once react is done building the DOM for this component - */ - public componentDidMount(): void { - this.initializeTypeahead(); - } - - public render(): JSX.Element { + private onRenderCell = (item: Item): JSX.Element => { return ( - -
) => this.onKeyDown(event)} - > -
(this.containerElt = input)}> -
- - {this.props.useTextarea ? ( -