!2656 优化:显示隐藏功能,允许空格或回车确定

pull/2574/MERGE
钱若寒 6 months ago committed by ChenX
parent 82273f4714
commit 6c6d9887fd

@ -1,11 +1,13 @@
import { Button, Card, Checkbox, H5, HTMLSelect, Intent, Radio, RadioGroup, Tooltip } from '@blueprintjs/core'; import { Button, Card, Checkbox, H5, HTMLSelect, Intent, Radio, RadioGroup, Tooltip } from '@blueprintjs/core';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import React from 'react'; import React from 'react';
import { begin } from 'xaop';
import { CompareIsEqual } from '../../../Add-on/BoardFindModify'; import { CompareIsEqual } from '../../../Add-on/BoardFindModify';
import { IsDoor, IsDrawer, IsHandle, IsHinge, IsLattice, IsWinerack, isDingDiBan } from '../../../Add-on/HideSelect/HideSelectUtils'; import { IsDoor, IsDrawer, IsHandle, IsHinge, IsLattice, IsWinerack, isDingDiBan } from '../../../Add-on/HideSelect/HideSelectUtils';
import { app } from '../../../ApplicationServices/Application'; import { app } from '../../../ApplicationServices/Application';
import { arrayRemoveIf } from '../../../Common/ArrayExt'; import { arrayRemoveIf } from '../../../Common/ArrayExt';
import { CommandNames } from '../../../Common/CommandNames'; import { CommandNames } from '../../../Common/CommandNames';
import { KeyBoard } from '../../../Common/KeyEnum';
import { CylinderHole, GangDrillType } from '../../../DatabaseServices/3DSolid/CylinderHole'; import { CylinderHole, GangDrillType } from '../../../DatabaseServices/3DSolid/CylinderHole';
import { Hole } from '../../../DatabaseServices/3DSolid/Hole'; import { Hole } from '../../../DatabaseServices/3DSolid/Hole';
import { Dimension } from '../../../DatabaseServices/Dimension/Dimension'; import { Dimension } from '../../../DatabaseServices/Dimension/Dimension';
@ -26,14 +28,15 @@ import { TemplateRecord } from '../../../DatabaseServices/Template/TemplateRecor
import { CommandWrap } from '../../../Editor/CommandMachine'; import { CommandWrap } from '../../../Editor/CommandMachine';
import { PromptStatus } from '../../../Editor/PromptResult'; import { PromptStatus } from '../../../Editor/PromptResult';
import { SelectSetBase } from '../../../Editor/SelectBase'; import { SelectSetBase } from '../../../Editor/SelectBase';
import { VisualSpaceBox } from '../../../Editor/VisualSpaceBox';
import { ECompareType } from '../../Store/BoardFindInterface'; import { ECompareType } from '../../Store/BoardFindInterface';
import { IHSOption } from '../../Store/HSInterface'; import { IHSOption } from '../../Store/HSInterface';
import { HideSelectStore } from '../../Store/HideSelectStore'; import { HideSelectStore } from '../../Store/HideSelectStore';
import { BoardModalType } from "../Board/BoardModalType"; import { BoardModalType } from "../Board/BoardModalType";
import { Config_ModalType } from '../Board/UserConfigComponent'; import { Config_ModalType } from '../Board/UserConfigComponent';
import { GetCompoentObjectIdString } from '../ComponentObjectId';
import './HideSelectModal.less'; import './HideSelectModal.less';
import { CommonModal } from './ModalContainer'; import { CommonModal } from './ModalContainer';
import { VisualSpaceBox } from '../../../Editor/VisualSpaceBox';
type AllString<T> = { type AllString<T> = {
@ -96,6 +99,27 @@ const KEYS: [string, string[]][] = [
@observer @observer
export class HideSelectModal extends React.Component<{ store: HideSelectStore; hideEntitys: Entity[]; }> export class HideSelectModal extends React.Component<{ store: HideSelectStore; hideEntitys: Entity[]; }>
{ {
private event: Function;
componentDidMount()
{
this.event = begin(app.Editor.ModalManage, app.Editor.ModalManage.OnKeyDown, (e: KeyboardEvent) =>
{
if (GetCompoentObjectIdString(HideSelectModal) !== app.Editor.ModalManage.CurrentModalKey) return;
let el = e.target as HTMLInputElement;
if (e.keyCode === KeyBoard.Enter || (e.keyCode === KeyBoard.Space &&
(el.nodeName !== "INPUT" || el.type !== "text" || el.getAttribute('data-isNum') != null)))
this.ok();
});
}
componentWillUnmount()
{
if (this.event)
{
this.event();
this.event = null;
}
}
render() render()
{ {
const store = this.props.store; const store = this.props.store;

Loading…
Cancel
Save