diff --git a/src/Common/CheckoutVaildValue.ts b/src/Common/CheckoutVaildValue.ts index 5f29c36d9..b8ebad2df 100644 --- a/src/Common/CheckoutVaildValue.ts +++ b/src/Common/CheckoutVaildValue.ts @@ -460,6 +460,7 @@ export namespace CheckoutValid case "leftDoorSeal": case "rightDoorSeal": case "hingeCount": + case "count": if (v.includes(',')) return "表达式不能有逗号"; if (isNaN(val)) diff --git a/src/UI/Components/Board/Door/HingeRule.tsx b/src/UI/Components/Board/Door/HingeRule.tsx index 0432d1319..31849027b 100644 --- a/src/UI/Components/Board/Door/HingeRule.tsx +++ b/src/UI/Components/Board/Door/HingeRule.tsx @@ -20,6 +20,26 @@ const SelectStyle: React.CSSProperties = { @observer export class HingeRules extends React.Component { + + private onOpening(store: DoorStore) + { + + + } + + private onClosing(store: DoorStore) + { + let error = store.CheckRule((store.uiRule)); + if (error) + { + store.uiRule.count = store.currentRule.count.toString(); + store.uiRule.down = store.currentRule.down.toString(); + store.uiRule.endDist = store.currentRule.endDist.toString(); + store.uiRule.startDist = store.currentRule.startDist.toString(); + store.uiRule.up = store.currentRule.up.toString(); + } + } + public render() { const { store, uiOption } = this.props; @@ -44,6 +64,8 @@ export class HingeRules extends React.Component { /> this.onOpening(store)} + onClosing={() => this.onClosing(store)} >
铰链配置规则
diff --git a/src/UI/Components/Common/PopoverContent.tsx b/src/UI/Components/Common/PopoverContent.tsx index a96d74d30..cae2a9dc8 100644 --- a/src/UI/Components/Common/PopoverContent.tsx +++ b/src/UI/Components/Common/PopoverContent.tsx @@ -1,5 +1,5 @@ +import { Button, IconName, Intent, MaybeElement, Popover, Position } from '@blueprintjs/core'; import * as React from 'react'; -import { Popover, Position, Button, Intent, Classes, Card, IconName, MaybeElement } from '@blueprintjs/core'; import { KeyBoard } from '../../../Common/KeyEnum'; interface IPopOverContentProps @@ -12,6 +12,8 @@ interface IPopOverContentProps style?: React.CSSProperties; className?: string; intent?: Intent; + onClosing?: () => void; + onOpening?: () => void; } export class PopoverContent extends React.Component { @@ -28,12 +30,16 @@ export class PopoverContent extends React.Component { disabled={this.props.disabled} onOpening={e => { + if (this.props.onOpening) + this.props.onOpening(); e.tabIndex = -1; e.focus(); e.addEventListener("keydown", this.handleKeyDown); }} onClosing={e => { + if (this.props.onClosing) + this.props.onClosing(); e.removeEventListener('keydown', this.handleKeyDown); if (this.props.closeFocusElement) this.props.closeFocusElement.focus(); @@ -60,6 +66,7 @@ export class PopoverContent extends React.Component { { if (this.cancelBtn) this.cancelBtn.click(); + e.preventDefault(); } else if (e.keyCode === KeyBoard.Escape) { diff --git a/src/UI/Store/DoorDrawerStore/DoorStore.ts b/src/UI/Store/DoorDrawerStore/DoorStore.ts index e1f950785..2a85c7840 100644 --- a/src/UI/Store/DoorDrawerStore/DoorStore.ts +++ b/src/UI/Store/DoorDrawerStore/DoorStore.ts @@ -1,14 +1,15 @@ +import { Intent } from "@blueprintjs/core"; import { observable, toJS } from "mobx"; -import { DoorOpenDir, IDoorConfigOption, IDoorInfo } from "../DoorInterface"; -import { DoorDrawerStore } from "./DoorDrawerStore"; +import { CheckObjectType, CheckoutValid } from "../../../Common/CheckoutVaildValue"; +import { DataAdapter } from "../../../Common/DataAdapter"; import { DefaultDoorOption } from "../../../Editor/DefaultConfig"; import { IConfigOption } from "../../Components/Board/UserConfig"; -import { FixErrorDataConfig } from "../BoardStore"; -import { IUiOption } from "../BoardInterface"; -import { DataAdapter } from "../../../Common/DataAdapter"; import { AppConfirm } from "../../Components/Common/Confirm"; import { AppToaster } from "../../Components/Toaster"; -import { Intent } from "@blueprintjs/core"; +import { IUiOption } from "../BoardInterface"; +import { FixErrorDataConfig } from "../BoardStore"; +import { DoorOpenDir, IDoorConfigOption, IDoorInfo } from "../DoorInterface"; +import { DoorDrawerStore } from "./DoorDrawerStore"; export const openDirTitle = {}; //门板开门类型对应 openDirTitle[DoorOpenDir.Left] = "左"; @@ -250,4 +251,8 @@ export class DoorStore extends DoorDrawerStore } } } + CheckRule(ruleOption) + { + return CheckoutValid.HasInvailValue(ruleOption, CheckObjectType.Do); + } }