From ea2333d95679264115142adc534c564529f07e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E8=AF=97=E9=9B=85?= Date: Mon, 17 Dec 2018 13:34:00 +0800 Subject: [PATCH] =?UTF-8?q?!218=20=E5=91=BD=E4=BB=A4=E9=9D=A2=E6=9D=BF(F1)?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20Merge=20pull=20request=20!218=20from=20?= =?UTF-8?q?=E8=82=96=E8=AF=97=E9=9B=85/commanPanel=5Frepair=5Fpr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UI/Components/CommandPanel/CommandItem.tsx | 16 ++++++++++++++-- src/UI/Components/CommandPanel/CommandList.ts | 8 ++++---- src/UI/Components/CommandPanel/commandPanel.tsx | 12 ++++++++---- .../ContextMenu/KeyWordContextMenu.tsx | 2 +- .../Modal/ModalStyle/CommandModal.less | 3 ++- src/UI/Css/blue.less | 2 +- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/UI/Components/CommandPanel/CommandItem.tsx b/src/UI/Components/CommandPanel/CommandItem.tsx index f0bce4c83..3c7b6dcfb 100644 --- a/src/UI/Components/CommandPanel/CommandItem.tsx +++ b/src/UI/Components/CommandPanel/CommandItem.tsx @@ -34,6 +34,7 @@ interface CommandItemProps export class CommandItem extends React.Component{ @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{ } e.stopPropagation(); } + this.m_InputEl.addEventListener('blur', () => + { + this.m_commandItemEl.parentElement.focus(); + }); } handleLiClick = () => { @@ -130,6 +135,7 @@ export class CommandItem extends React.Component{
  • this.m_commandItemEl = el} >
  • {store.commandData.chName}
  • @@ -170,7 +176,11 @@ export class CommandItem extends React.Component{ this.isReset = false} + onClosed={() => + { + this.isReset = false; + this.m_InputEl.focus(); + }} content={
    { 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{ intent={Intent.PRIMARY} onClick={() => { - this.m_InputEl.focus(); store.commandData.customize = store.commandData.defaultCustom; this.handleOnChange(store.commandData.customize); }} diff --git a/src/UI/Components/CommandPanel/CommandList.ts b/src/UI/Components/CommandPanel/CommandList.ts index d05dfe2f1..abeab038a 100644 --- a/src/UI/Components/CommandPanel/CommandList.ts +++ b/src/UI/Components/CommandPanel/CommandList.ts @@ -86,14 +86,14 @@ export const CommandList: ICommand[] = observable([ { typeId: "i2d", link: "#", - defaultCustom: "R", - customizeed: "R", - common: "R", + defaultCustom: "RECTANG", + customizeed: "RECTANG", + common: "RECTANG", type: "二维", chName: "矩形", // enName: "Rectangle", chDes: "画一个矩形", - customize: "R", + customize: "RECTANG", }, { typeId: "i2d", diff --git a/src/UI/Components/CommandPanel/commandPanel.tsx b/src/UI/Components/CommandPanel/commandPanel.tsx index c859394fd..1883fa3eb 100644 --- a/src/UI/Components/CommandPanel/commandPanel.tsx +++ b/src/UI/Components/CommandPanel/commandPanel.tsx @@ -167,8 +167,11 @@ export class CommandPanel extends React.Component<{}, CommandPanelState> onScroll={async () => { let cserver = Singleton.GetInstance(CommandServer); - let index = Math.floor(this.scrollCard.scrollTop / 57); - this.id = this.searchRes[index].typeId; + let index = Math.floor(this.scrollCard.scrollTop / 57); + if (index < this.searchRes.length) + this.id = this.searchRes[index].typeId; + else + this.id = this.searchRes[this.searchRes.length - 1].typeId; await cserver.SetLastScrollTop(this.scrollCard.scrollTop); }} > @@ -191,13 +194,14 @@ export class CommandPanel extends React.Component<{}, CommandPanelState> if (id !== command.typeId) { id = command.typeId; - return

      {command.type}命令

      + return <> +

        {command.type}命令

      -
    + } return this.m_Menu = el} diff --git a/src/UI/Components/Modal/ModalStyle/CommandModal.less b/src/UI/Components/Modal/ModalStyle/CommandModal.less index df652424d..e3cbbc70a 100644 --- a/src/UI/Components/Modal/ModalStyle/CommandModal.less +++ b/src/UI/Components/Modal/ModalStyle/CommandModal.less @@ -35,7 +35,7 @@ height: 50vh; min-height: 300px; overflow: auto; - padding: 10px; + padding: 0 10px 10px 10px; margin: 10px; } #commandPanel .bp3-card>ul>ul>div>h1 @@ -57,6 +57,7 @@ #commandPanel .bp3-card>ul>li:hover,#commandPanel .bp3-card>ul>ul>li:hover { background-color: #394B59;//todo:更好的适应主题切换 + cursor: pointer; } #commandPanel .bp3-card>ul>li>li,#commandPanel .bp3-card>ul>ul>li>li { diff --git a/src/UI/Css/blue.less b/src/UI/Css/blue.less index 0e6ab6db9..f4370e834 100644 --- a/src/UI/Css/blue.less +++ b/src/UI/Css/blue.less @@ -49,7 +49,7 @@ margin: 0; } .bp3-portal{ - z-index: 25; + z-index: 27; } /**************** DownPanel *********************/