Browse Source

UI: Fixed hotkey event for search field on rule chain page

pull/10855/head
Artem Dzhereleiko 2 years ago
parent
commit
616fa5c6ec
  1. 2
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html
  2. 14
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts

2
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html

@ -47,7 +47,7 @@
<mat-icon>search</mat-icon>
</button>
<input matInput
[formControl]="ruleNodeTypeSearch"
[formControl]="ruleNodeTypeSearch" (focusin)="focus(true)" (focusout)="focus(false)"
placeholder="{{'rulenode.search' | translate}}"/>
<button mat-icon-button matSuffix class="tb-small"
[fxShow]="ruleNodeTypeSearch.value !== ''"

14
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts

@ -167,6 +167,8 @@ export class RuleChainPageComponent extends PageComponent
ruleNodeSearch = '';
ruleNodeTypeSearch = this.fb.control('', {nonNullable: true});
ruleNodeTypeSearchFocus = false;
ruleChain: RuleChain;
ruleChainMetaData: RuleChainMetaData;
@ -294,6 +296,10 @@ export class RuleChainPageComponent extends PageComponent
).subscribe(() => this.updateRuleChainLibrary());
}
focus(focus: boolean) {
this.ruleNodeTypeSearchFocus = focus;
}
ngAfterViewChecked(){
this.changeDetector.detectChanges();
}
@ -367,7 +373,7 @@ export class RuleChainPageComponent extends PageComponent
if (!this.hotKeys.length) {
this.hotKeys.push(
new Hotkey('ctrl+a', (event: KeyboardEvent) => {
if (this.enableHotKeys) {
if (this.enableHotKeys && !this.ruleNodeTypeSearchFocus) {
event.preventDefault();
this.ruleChainCanvas.modelService.selectAll();
return false;
@ -378,7 +384,7 @@ export class RuleChainPageComponent extends PageComponent
);
this.hotKeys.push(
new Hotkey('ctrl+c', (event: KeyboardEvent) => {
if (this.enableHotKeys) {
if (this.enableHotKeys && !this.ruleNodeTypeSearchFocus) {
event.preventDefault();
this.copyRuleNodes();
return false;
@ -389,7 +395,7 @@ export class RuleChainPageComponent extends PageComponent
);
this.hotKeys.push(
new Hotkey('ctrl+v', (event: KeyboardEvent) => {
if (this.enableHotKeys) {
if (this.enableHotKeys && !this.ruleNodeTypeSearchFocus) {
event.preventDefault();
if (this.itembuffer.hasRuleNodes()) {
this.pasteRuleNodes();
@ -436,7 +442,7 @@ export class RuleChainPageComponent extends PageComponent
);
this.hotKeys.push(
new Hotkey('del', (event: KeyboardEvent) => {
if (this.enableHotKeys) {
if (this.enableHotKeys && !this.ruleNodeTypeSearchFocus) {
event.preventDefault();
this.ruleChainCanvas.modelService.deleteSelected();
return false;

Loading…
Cancel
Save