mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
feat(search-bar): Added input blur on the cancelAction function and some awful animation to the cancel button
references #247
This commit is contained in:
@ -80,20 +80,22 @@ $search-bar-ios-input-close-icon-size: 17px !default;
|
||||
.search-bar-input-container.left-align {
|
||||
.search-bar-search-icon {
|
||||
margin-left: 0;
|
||||
transition: $search-bar-ios-input-transition;
|
||||
}
|
||||
.search-bar-input {
|
||||
padding-left: 28px;
|
||||
transition: $search-bar-ios-input-transition;
|
||||
}
|
||||
}
|
||||
|
||||
.search-bar-cancel.left-align {
|
||||
.search-bar-cancel {
|
||||
@extend button[clear];
|
||||
display: block;
|
||||
padding-left: 8px;
|
||||
padding-right: 0;
|
||||
min-height: 0;
|
||||
transition: $search-bar-ios-input-transition;
|
||||
}
|
||||
|
||||
.search-bar-cancel.left-align {
|
||||
margin-right: 0;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
&.hairlines .search-bar {
|
||||
|
@ -33,5 +33,7 @@ input[type="search"].search-bar-input {
|
||||
}
|
||||
|
||||
.search-bar-cancel {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
margin-right: -200px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
@ -27,10 +27,13 @@ import {IonicComponent, IonicView} from '../../config/decorators';
|
||||
'cancelText': 'Cancel',
|
||||
'placeholder': 'Search',
|
||||
'cancelAction': function() {
|
||||
// TODO user will override this if they pass a function
|
||||
// need to allow user to call these
|
||||
console.log('Default Cancel');
|
||||
this.isFocused = false;
|
||||
this.shouldLeftAlign = this.value.trim() != '';
|
||||
// TODO input blur
|
||||
this.element = this.elementRef.nativeElement.querySelector('input');
|
||||
this.element.blur();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user