|
|
|
@ -34,6 +34,7 @@ interface CommandItemProps
|
|
|
|
|
export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
@observable private flag: TipType = TipType.OK;
|
|
|
|
|
private m_InputEl: HTMLInputElement;
|
|
|
|
|
private m_commandItemEl: HTMLLIElement;
|
|
|
|
|
@observable private isCNInput: boolean = false;
|
|
|
|
|
private isReset = false;
|
|
|
|
|
constructor(props)
|
|
|
|
@ -56,6 +57,10 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
this.m_InputEl.addEventListener('blur', () =>
|
|
|
|
|
{
|
|
|
|
|
this.m_commandItemEl.parentElement.focus();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
handleLiClick = () =>
|
|
|
|
|
{
|
|
|
|
@ -130,6 +135,7 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
<li
|
|
|
|
|
id={this.props.commandData.typeId}
|
|
|
|
|
onClick={this.handleLiClick}
|
|
|
|
|
ref={el => this.m_commandItemEl = el}
|
|
|
|
|
>
|
|
|
|
|
<li></li>
|
|
|
|
|
<li>{store.commandData.chName}</li>
|
|
|
|
@ -170,7 +176,11 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
<Popover
|
|
|
|
|
usePortal={true}
|
|
|
|
|
position={Position.RIGHT}
|
|
|
|
|
onClosed={() => this.isReset = false}
|
|
|
|
|
onClosed={() =>
|
|
|
|
|
{
|
|
|
|
|
this.isReset = false;
|
|
|
|
|
this.m_InputEl.focus();
|
|
|
|
|
}}
|
|
|
|
|
content={
|
|
|
|
|
<div
|
|
|
|
|
style={popStyle}
|
|
|
|
@ -178,7 +188,10 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
onKeyDown={(e) =>
|
|
|
|
|
{
|
|
|
|
|
if (e.keyCode === KeyBoard.Escape)
|
|
|
|
|
{
|
|
|
|
|
(e.currentTarget.lastElementChild.firstElementChild as HTMLButtonElement).click();
|
|
|
|
|
this.m_commandItemEl.parentElement.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (e.keyCode === KeyBoard.Enter || e.keyCode === KeyBoard.Space)
|
|
|
|
|
(e.currentTarget.lastElementChild.lastElementChild as HTMLButtonElement).click();
|
|
|
|
@ -195,7 +208,6 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
|
|
|
|
|
intent={Intent.PRIMARY}
|
|
|
|
|
onClick={() =>
|
|
|
|
|
{
|
|
|
|
|
this.m_InputEl.focus();
|
|
|
|
|
store.commandData.customize = store.commandData.defaultCustom;
|
|
|
|
|
this.handleOnChange(store.commandData.customize);
|
|
|
|
|
}}
|
|
|
|
|