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-input-container.left-align {
|
||||||
.search-bar-search-icon {
|
.search-bar-search-icon {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
transition: $search-bar-ios-input-transition;
|
|
||||||
}
|
}
|
||||||
.search-bar-input {
|
.search-bar-input {
|
||||||
padding-left: 28px;
|
padding-left: 28px;
|
||||||
transition: $search-bar-ios-input-transition;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-bar-cancel.left-align {
|
.search-bar-cancel {
|
||||||
@extend button[clear];
|
@extend button[clear];
|
||||||
display: block;
|
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
padding-right: 0;
|
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 {
|
&.hairlines .search-bar {
|
||||||
|
@ -33,5 +33,7 @@ input[type="search"].search-bar-input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-bar-cancel {
|
.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',
|
'cancelText': 'Cancel',
|
||||||
'placeholder': 'Search',
|
'placeholder': 'Search',
|
||||||
'cancelAction': function() {
|
'cancelAction': function() {
|
||||||
|
// TODO user will override this if they pass a function
|
||||||
|
// need to allow user to call these
|
||||||
console.log('Default Cancel');
|
console.log('Default Cancel');
|
||||||
this.isFocused = false;
|
this.isFocused = false;
|
||||||
this.shouldLeftAlign = this.value.trim() != '';
|
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