Use rainbow bg color to mark build in label & Add behavior select counter & Optim popup focus #28
@ -1,7 +1,7 @@
 | 
				
			|||||||
import { BehaviorRecorder, IAnyBehaviorRecorder } from "@Model/Behavior";
 | 
					import { BehaviorRecorder, IAnyBehaviorRecorder } from "@Model/Behavior";
 | 
				
			||||||
import { Template } from "./Template";
 | 
					import { Template } from "./Template";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const AllBehaviors: IAnyBehaviorRecorder[] = new Array(20).fill(0).map((_, i) => {
 | 
					const AllBehaviors: IAnyBehaviorRecorder[] = new Array(4).fill(0).map((_, i) => {
 | 
				
			||||||
    let behavior = new BehaviorRecorder(Template);
 | 
					    let behavior = new BehaviorRecorder(Template);
 | 
				
			||||||
    behavior.behaviorId = behavior.behaviorId + i;
 | 
					    behavior.behaviorId = behavior.behaviorId + i;
 | 
				
			||||||
    return behavior;
 | 
					    return behavior;
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,7 @@ div.behavior-list {
 | 
				
			|||||||
	div.behavior-item {
 | 
						div.behavior-item {
 | 
				
			||||||
		margin: 5px;
 | 
							margin: 5px;
 | 
				
			||||||
		height: $behavior-item-height;
 | 
							height: $behavior-item-height;
 | 
				
			||||||
 | 
							user-select: none;
 | 
				
			||||||
		border-radius: 3px;
 | 
							border-radius: 3px;
 | 
				
			||||||
		cursor: pointer;
 | 
							cursor: pointer;
 | 
				
			||||||
		display: flex;
 | 
							display: flex;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,10 @@ div.behavior-popup {
 | 
				
			|||||||
	height: 100%;
 | 
						height: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					span.behavior-popup-select-counter {
 | 
				
			||||||
 | 
						opacity: .75;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div.behavior-popup-search-box {
 | 
					div.behavior-popup-search-box {
 | 
				
			||||||
	padding: 10px 0 10px 10px;
 | 
						padding: 10px 0 10px 10px;
 | 
				
			||||||
	width: calc(100% - 10px);
 | 
						width: calc(100% - 10px);
 | 
				
			||||||
 | 
				
			|||||||
@ -62,28 +62,7 @@ class BehaviorPopupComponent extends Component<
 | 
				
			|||||||
		</div>;
 | 
							</div>;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public render(): ReactNode {
 | 
						private showBehaviorInfo = (behavior: IRenderBehavior) => {
 | 
				
			||||||
		return <ConfirmContent
 | 
					 | 
				
			||||||
			className="behavior-popup"
 | 
					 | 
				
			||||||
			actions={[{
 | 
					 | 
				
			||||||
				i18nKey: "Popup.Add.Behavior.Action.Add"
 | 
					 | 
				
			||||||
			}]}
 | 
					 | 
				
			||||||
			header={this.renderHeader}
 | 
					 | 
				
			||||||
			headerHeight={46}
 | 
					 | 
				
			||||||
		>
 | 
					 | 
				
			||||||
			<Message i18nKey="ZH_CN" isTitle first/>
 | 
					 | 
				
			||||||
			<BehaviorList
 | 
					 | 
				
			||||||
				focusBehaviors={Array.from(this.state.focusBehavior)}
 | 
					 | 
				
			||||||
				behaviors={AllBehaviors}
 | 
					 | 
				
			||||||
				click={(behavior) => {
 | 
					 | 
				
			||||||
					if (this.state.focusBehavior.has(behavior)) {
 | 
					 | 
				
			||||||
						this.state.focusBehavior.delete(behavior);
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						this.state.focusBehavior.add(behavior);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
					this.forceUpdate();
 | 
					 | 
				
			||||||
				}}
 | 
					 | 
				
			||||||
				action={(behavior)=>{
 | 
					 | 
				
			||||||
		if (this.props.status) {
 | 
							if (this.props.status) {
 | 
				
			||||||
			const status = this.props.status;
 | 
								const status = this.props.status;
 | 
				
			||||||
			status.popup.showPopup(ConfirmPopup, {
 | 
								status.popup.showPopup(ConfirmPopup, {
 | 
				
			||||||
@ -95,6 +74,41 @@ class BehaviorPopupComponent extends Component<
 | 
				
			|||||||
				yesI18n: "Popup.Behavior.Info.Confirm",
 | 
									yesI18n: "Popup.Behavior.Info.Confirm",
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private renderActionBar = () => {
 | 
				
			||||||
 | 
							return <Localization
 | 
				
			||||||
 | 
								className="behavior-popup-select-counter"
 | 
				
			||||||
 | 
								i18nKey="Popup.Add.Behavior.Select.Counter"
 | 
				
			||||||
 | 
								options={{
 | 
				
			||||||
 | 
									count: this.state.focusBehavior.size.toString()
 | 
				
			||||||
 | 
								}}
 | 
				
			||||||
 | 
							/>
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public render(): ReactNode {
 | 
				
			||||||
 | 
							return <ConfirmContent
 | 
				
			||||||
 | 
								className="behavior-popup"
 | 
				
			||||||
 | 
								actions={[{
 | 
				
			||||||
 | 
									i18nKey: "Popup.Add.Behavior.Action.Add",
 | 
				
			||||||
 | 
									disable: this.state.focusBehavior.size <= 0
 | 
				
			||||||
 | 
								}]}
 | 
				
			||||||
 | 
								header={this.renderHeader}
 | 
				
			||||||
 | 
								customFooter={this.renderActionBar}
 | 
				
			||||||
 | 
								headerHeight={46}
 | 
				
			||||||
 | 
							>
 | 
				
			||||||
 | 
								<Message i18nKey="ZH_CN" isTitle first/>
 | 
				
			||||||
 | 
								<BehaviorList
 | 
				
			||||||
 | 
									focusBehaviors={Array.from(this.state.focusBehavior)}
 | 
				
			||||||
 | 
									behaviors={AllBehaviors}
 | 
				
			||||||
 | 
									action={this.showBehaviorInfo}
 | 
				
			||||||
 | 
									click={(behavior) => {
 | 
				
			||||||
 | 
										if (this.state.focusBehavior.has(behavior)) {
 | 
				
			||||||
 | 
											this.state.focusBehavior.delete(behavior);
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											this.state.focusBehavior.add(behavior);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										this.forceUpdate();
 | 
				
			||||||
				}}
 | 
									}}
 | 
				
			||||||
			/>
 | 
								/>
 | 
				
			||||||
		</ConfirmContent>
 | 
							</ConfirmContent>
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,17 @@ div.confirm-root {
 | 
				
			|||||||
		justify-content: flex-end;
 | 
							justify-content: flex-end;
 | 
				
			||||||
		align-items: center;
 | 
							align-items: center;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							div.action-right-view {
 | 
				
			||||||
 | 
								width: 100%;
 | 
				
			||||||
 | 
								height: 100%;
 | 
				
			||||||
 | 
								flex-shrink: 1;
 | 
				
			||||||
 | 
								display: flex;
 | 
				
			||||||
 | 
								align-items: center;
 | 
				
			||||||
 | 
								padding-left: 10px;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		div.action-button {
 | 
							div.action-button {
 | 
				
			||||||
 | 
								flex-shrink: 0;
 | 
				
			||||||
			height: 26px;
 | 
								height: 26px;
 | 
				
			||||||
			padding: 0 10px;
 | 
								padding: 0 10px;
 | 
				
			||||||
			border-radius: 3px;
 | 
								border-radius: 3px;
 | 
				
			||||||
 | 
				
			|||||||
@ -68,6 +68,7 @@ interface IConfirmContentProps {
 | 
				
			|||||||
	hidePadding?: boolean;
 | 
						hidePadding?: boolean;
 | 
				
			||||||
	className?: string;
 | 
						className?: string;
 | 
				
			||||||
	actions: IActionButtonProps[];
 | 
						actions: IActionButtonProps[];
 | 
				
			||||||
 | 
						customFooter?: () => ReactNode;
 | 
				
			||||||
	header?: () => ReactNode;
 | 
						header?: () => ReactNode;
 | 
				
			||||||
	headerHeight?: number;
 | 
						headerHeight?: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -154,10 +155,14 @@ class ConfirmContent extends Component<IConfirmContentProps> {
 | 
				
			|||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			<div className="action-view">
 | 
								<div className="action-view">
 | 
				
			||||||
 | 
									<div className="action-right-view">
 | 
				
			||||||
 | 
										{this.props.customFooter ? this.props.customFooter() : null}
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
 | 
										this.props.actions ? 
 | 
				
			||||||
						this.props.actions.map((prop, index) => {
 | 
											this.props.actions.map((prop, index) => {
 | 
				
			||||||
							return this.renderActionButton(prop, index);
 | 
												return this.renderActionButton(prop, index);
 | 
				
			||||||
					})
 | 
											}) : null
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</Theme>;
 | 
							</Theme>;
 | 
				
			||||||
 | 
				
			|||||||
@ -54,6 +54,7 @@ const EN_US = {
 | 
				
			|||||||
    "Popup.Setting.Title": "Preferences setting",
 | 
					    "Popup.Setting.Title": "Preferences setting",
 | 
				
			||||||
    "Popup.Add.Behavior.Title": "Add behavior",
 | 
					    "Popup.Add.Behavior.Title": "Add behavior",
 | 
				
			||||||
    "Popup.Add.Behavior.Action.Add": "Add all select behavior",
 | 
					    "Popup.Add.Behavior.Action.Add": "Add all select behavior",
 | 
				
			||||||
 | 
					    "Popup.Add.Behavior.Select.Counter": "Selected {count} behavior",
 | 
				
			||||||
    "Popup.Behavior.Info.Title": "Behavior details: {behavior}",
 | 
					    "Popup.Behavior.Info.Title": "Behavior details: {behavior}",
 | 
				
			||||||
    "Popup.Behavior.Info.Confirm": "OK, I know it",
 | 
					    "Popup.Behavior.Info.Confirm": "OK, I know it",
 | 
				
			||||||
    "Build.In.Label.Name.All.Group": "All group",
 | 
					    "Build.In.Label.Name.All.Group": "All group",
 | 
				
			||||||
 | 
				
			|||||||
@ -54,6 +54,7 @@ const ZH_CN = {
 | 
				
			|||||||
    "Popup.Setting.Title": "首选项设置",
 | 
					    "Popup.Setting.Title": "首选项设置",
 | 
				
			||||||
    "Popup.Add.Behavior.Title": "添加行为",
 | 
					    "Popup.Add.Behavior.Title": "添加行为",
 | 
				
			||||||
    "Popup.Add.Behavior.Action.Add": "添加全部选中行为",
 | 
					    "Popup.Add.Behavior.Action.Add": "添加全部选中行为",
 | 
				
			||||||
 | 
					    "Popup.Add.Behavior.Select.Counter": "已选择 {count} 个行为",
 | 
				
			||||||
    "Popup.Behavior.Info.Title": "行为详情: {behavior}",
 | 
					    "Popup.Behavior.Info.Title": "行为详情: {behavior}",
 | 
				
			||||||
    "Popup.Behavior.Info.Confirm": "好的, 我知道了",
 | 
					    "Popup.Behavior.Info.Confirm": "好的, 我知道了",
 | 
				
			||||||
    "Build.In.Label.Name.All.Group": "全部群",
 | 
					    "Build.In.Label.Name.All.Group": "全部群",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user