mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
Merge branch 'master' into item-buttons
This commit is contained in:
@ -18,15 +18,18 @@
|
||||
<h6>H6: The quick brown fox jumps over the lazy dog</h6>
|
||||
|
||||
<p>
|
||||
p: The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
The quick brown fox jumps over the lazy dog.
|
||||
I saw a werewolf with a Chinese menu in his hand.
|
||||
Walking through the streets of Soho in the rain.
|
||||
He was looking for a place called Lee Ho Fook's.
|
||||
Gonna get a big dish of beef chow mein.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
He's the hairy-handed gent who ran amuck in Kent.
|
||||
Lately he's been overheard in Mayfair.
|
||||
Better stay away from him.
|
||||
He'll rip your lungs out, Jim.
|
||||
I'd like to meet his tailor.
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
|
@ -25,7 +25,7 @@ export class SearchbarInput {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
constructor(public elementRef: ElementRef) {
|
||||
constructor(private _elementRef: ElementRef) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -116,16 +116,17 @@ export class Searchbar extends Ion {
|
||||
blurInput: boolean = true;
|
||||
inputElement: any;
|
||||
searchIconElement: any;
|
||||
mode: string;
|
||||
|
||||
@HostBinding('class.searchbar-focused') isFocused;
|
||||
@HostBinding('class.searchbar-left-aligned') shouldLeftAlign;
|
||||
|
||||
constructor(
|
||||
public elementRef: ElementRef,
|
||||
config: Config,
|
||||
private _elementRef: ElementRef,
|
||||
private _config: Config,
|
||||
@Optional() ngControl: NgControl
|
||||
) {
|
||||
super(elementRef, config);
|
||||
super(_elementRef, _config);
|
||||
|
||||
// If the user passed a ngControl we need to set the valueAccessor
|
||||
if (ngControl) {
|
||||
@ -138,6 +139,8 @@ export class Searchbar extends Ion {
|
||||
* On Initialization check for attributes
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.mode = this._config.get('mode');
|
||||
|
||||
let hideCancelButton = this.hideCancelButton;
|
||||
if (typeof hideCancelButton === 'string') {
|
||||
this.hideCancelButton = (hideCancelButton === '' || hideCancelButton === 'true');
|
||||
@ -152,8 +155,8 @@ export class Searchbar extends Ion {
|
||||
this.shouldLeftAlign = this.value && this.value.trim() != '';
|
||||
|
||||
// Using querySelector instead of searchbarInput because at this point it doesn't exist
|
||||
this.inputElement = this.elementRef.nativeElement.querySelector('.searchbar-input');
|
||||
this.searchIconElement = this.elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
||||
this.inputElement = this._elementRef.nativeElement.querySelector('.searchbar-input');
|
||||
this.searchIconElement = this._elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
||||
this.setElementLeft();
|
||||
}
|
||||
|
||||
@ -174,9 +177,11 @@ export class Searchbar extends Ion {
|
||||
/**
|
||||
* @private
|
||||
* Determines whether or not to add style to the element
|
||||
* to center it properly
|
||||
* to center it properly (ios only)
|
||||
*/
|
||||
setElementLeft() {
|
||||
if (this.mode !== 'ios') return;
|
||||
|
||||
if (this.shouldLeftAlign) {
|
||||
this.inputElement.removeAttribute("style");
|
||||
this.searchIconElement.removeAttribute("style");
|
||||
@ -240,7 +245,7 @@ export class Searchbar extends Ion {
|
||||
// blurInput determines if it should blur
|
||||
// if we are clearing the input we still want to stay focused in the input
|
||||
if (this.blurInput == false) {
|
||||
this.searchbarInput.elementRef.nativeElement.focus();
|
||||
this.searchbarInput._elementRef.nativeElement.focus();
|
||||
this.blurInput = true;
|
||||
return;
|
||||
}
|
||||
|
@ -1,33 +1,7 @@
|
||||
|
||||
const nativeRaf = window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame;
|
||||
|
||||
const nativeCancelRaf = window.cancelAnimationFrame ||
|
||||
window.webkitCancelAnimationFrame ||
|
||||
window.webkitCancelRequestAnimationFrame;
|
||||
|
||||
export function raf(callback) {
|
||||
//console.log('raf', callback.toString().replace(/\s/g, '').replace('function', '').substring(0, 50));
|
||||
//console.log('raf, isRootZone()', zone.isRootZone(), '$id', zone.$id);
|
||||
_raf(callback);
|
||||
}
|
||||
|
||||
const _raf = nativeRaf || function(callback) {
|
||||
let timeCurrent = (new Date()).getTime(),
|
||||
timeDelta;
|
||||
|
||||
/* Dynamically set delay on a per-tick basis to match 60fps. */
|
||||
/* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */
|
||||
timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
|
||||
timeLast = timeCurrent + timeDelta;
|
||||
|
||||
return setTimeout(function() { callback(timeCurrent + timeDelta); }, timeDelta);
|
||||
}
|
||||
|
||||
export const rafCancel = nativeRaf ? nativeCancelRaf : function(id) {
|
||||
return window.cancelTimeout(id);
|
||||
}
|
||||
// requestAnimationFrame is polyfilled for old Android
|
||||
// within the web-animations polyfill
|
||||
export const raf = window.requestAnimationFrame;
|
||||
|
||||
export function rafFrames(framesToWait, callback) {
|
||||
framesToWait = Math.ceil(framesToWait);
|
||||
|
@ -87,6 +87,21 @@ module.exports = function(grunt) {
|
||||
config.wrap[target] = {
|
||||
source: source,
|
||||
preamble: '(function() {\n' +
|
||||
' // RequestAnimationFrame Polyfill (Android 4.1, 4.2, 4.3)\n' +
|
||||
' /*! @author Paul Irish */\n' +
|
||||
' /*! @source https://gist.github.com/paulirish/1579671 */\n' +
|
||||
' var rafLastTime = 0;\n' +
|
||||
' if (!window.requestAnimationFrame)\n' +
|
||||
' window.requestAnimationFrame = function(callback, element) {\n' +
|
||||
' var currTime = Date.now();\n' +
|
||||
' var timeToCall = Math.max(0, 16 - (currTime - rafLastTime));\n' +
|
||||
' var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);\n' +
|
||||
' rafLastTime = currTime + timeToCall;\n' +
|
||||
' return id;\n' +
|
||||
' };\n' +
|
||||
' if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function(id) { clearTimeout(id); };\n' +
|
||||
' \n' +
|
||||
' // Web Animations Polyfill\n' +
|
||||
' if (document.documentElement.animate) {\n' +
|
||||
' var player = document.documentElement.animate([], 0);\n' +
|
||||
' var load = true;\n' +
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user