mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1968] Search input tunings (#817)
* [ACA-1968] clear & placeholder changes * [ACA-1968] auto focus input * [ACA-1968] don't float placeholder on click
This commit is contained in:
committed by
Denys Vuika
parent
43b55102be
commit
54892e71d4
@@ -5,18 +5,20 @@
|
|||||||
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
|
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
|
||||||
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
|
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-form-field class="app-input-form-field">
|
<mat-form-field class="app-input-form-field" [floatLabel]="'never'">
|
||||||
<input matInput #searchInput
|
<input matInput #searchInput
|
||||||
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
|
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
|
||||||
[type]="inputType"
|
[type]="inputType"
|
||||||
id="app-control-input"
|
id="app-control-input"
|
||||||
[(ngModel)]="searchTerm"
|
[(ngModel)]="searchTerm"
|
||||||
(ngModelChange)="inputChange($event)"
|
(ngModelChange)="inputChange($event)"
|
||||||
(keyup.enter)="searchSubmit($event)">
|
(keyup.enter)="searchSubmit($event)"
|
||||||
<mat-placeholder class="placeholder" *ngIf="!searchTerm.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
|
[placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate">
|
||||||
|
|
||||||
|
|
||||||
<div matSuffix class="app-suffix-search-icon-wrapper">
|
<div matSuffix class="app-suffix-search-icon-wrapper">
|
||||||
<mat-icon>arrow_drop_down</mat-icon>
|
<mat-icon *ngIf="searchTerm.length" (click)="clear()" class="app-clear-icon">clear</mat-icon>
|
||||||
|
<mat-icon *ngIf="!searchTerm.length">arrow_drop_down</mat-icon>
|
||||||
</div>
|
</div>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -11,6 +11,10 @@ $top-margin: 12px;
|
|||||||
|
|
||||||
.mat-form-field-label-wrapper {
|
.mat-form-field-label-wrapper {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fixes pointer event on FF
|
||||||
|
&.searchMenuTrigger .mat-form-field-label-wrapper {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,10 +27,6 @@ $top-margin: 12px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mat-focused .placeholder {
|
|
||||||
color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-search-button.mat-icon-button {
|
.app-search-button.mat-icon-button {
|
||||||
top: -2px;
|
top: -2px;
|
||||||
left: -8px;
|
left: -8px;
|
||||||
@@ -48,4 +48,9 @@ $top-margin: 12px;
|
|||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-clear-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
margin: 3px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,17 @@
|
|||||||
<div class="app-search-container" [matMenuTriggerFor]="searchOptionsMenu">
|
<div class="app-search-container searchMenuTrigger" [matMenuTriggerFor]="searchOptionsMenu"
|
||||||
|
(menuOpened)="onMenuOpened()">
|
||||||
<button mat-icon-button
|
<button mat-icon-button
|
||||||
class="app-search-button"
|
class="app-search-button"
|
||||||
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
|
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
|
||||||
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
|
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-form-field class="app-input-form-field">
|
<mat-form-field class="app-input-form-field" [floatLabel]="'never'">
|
||||||
<input matInput
|
<input matInput
|
||||||
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
|
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
|
||||||
[type]="'text'"
|
[type]="'text'"
|
||||||
[disabled]="true"
|
[disabled]="true"
|
||||||
[value]="searchedWord">
|
[value]="searchedWord"
|
||||||
<mat-placeholder class="placeholder" *ngIf="!searchedWord.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
|
[placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate">
|
||||||
|
|
||||||
<div matSuffix class="app-suffix-search-icon-wrapper">
|
<div matSuffix class="app-suffix-search-icon-wrapper">
|
||||||
<mat-icon>arrow_drop_down</mat-icon>
|
<mat-icon>arrow_drop_down</mat-icon>
|
||||||
|
@@ -21,6 +21,10 @@ $top-margin: 12px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mat-focused label.mat-form-field-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-search-options-menu {
|
.app-search-options-menu {
|
||||||
|
@@ -143,6 +143,10 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMenuOpened() {
|
||||||
|
this.searchInputControl.searchInput.nativeElement.focus();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user submits the search, e.g. hits enter or clicks submit
|
* Called when the user submits the search, e.g. hits enter or clicks submit
|
||||||
*
|
*
|
||||||
@@ -160,6 +164,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
onSearchChange(searchTerm: string) {
|
onSearchChange(searchTerm: string) {
|
||||||
this.has400LibraryError = false;
|
this.has400LibraryError = false;
|
||||||
|
this.searchedWord = searchTerm;
|
||||||
|
|
||||||
if (this.hasOneChange) {
|
if (this.hasOneChange) {
|
||||||
this.hasNewChange = true;
|
this.hasNewChange = true;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -390,7 +390,7 @@
|
|||||||
|
|
||||||
"SEARCH": {
|
"SEARCH": {
|
||||||
"INPUT": {
|
"INPUT": {
|
||||||
"PLACEHOLDER": "Search everywhere",
|
"PLACEHOLDER": "Search",
|
||||||
"FILES": "Files",
|
"FILES": "Files",
|
||||||
"FOLDERS": "Folders",
|
"FOLDERS": "Folders",
|
||||||
"LIBRARIES": "Libraries",
|
"LIBRARIES": "Libraries",
|
||||||
|
Reference in New Issue
Block a user