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>
|
<h6>H6: The quick brown fox jumps over the lazy dog</h6>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
p: The quick brown fox jumps over the lazy dog.
|
I saw a werewolf with a Chinese menu in his hand.
|
||||||
The quick brown fox jumps over the lazy dog.
|
Walking through the streets of Soho in the rain.
|
||||||
The quick brown fox jumps over the lazy dog.
|
He was looking for a place called Lee Ho Fook's.
|
||||||
The quick brown fox jumps over the lazy dog.
|
Gonna get a big dish of beef chow mein.
|
||||||
The quick brown fox jumps over the lazy dog.
|
</p>
|
||||||
The quick brown fox jumps over the lazy dog.
|
|
||||||
The quick brown fox jumps over the lazy dog.
|
<p>
|
||||||
The quick brown fox jumps over the lazy dog.
|
He's the hairy-handed gent who ran amuck in Kent.
|
||||||
The quick brown fox jumps over the lazy dog.
|
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>
|
</p>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
@ -25,7 +25,7 @@ export class SearchbarInput {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef) {
|
constructor(private _elementRef: ElementRef) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,16 +116,17 @@ export class Searchbar extends Ion {
|
|||||||
blurInput: boolean = true;
|
blurInput: boolean = true;
|
||||||
inputElement: any;
|
inputElement: any;
|
||||||
searchIconElement: any;
|
searchIconElement: any;
|
||||||
|
mode: string;
|
||||||
|
|
||||||
@HostBinding('class.searchbar-focused') isFocused;
|
@HostBinding('class.searchbar-focused') isFocused;
|
||||||
@HostBinding('class.searchbar-left-aligned') shouldLeftAlign;
|
@HostBinding('class.searchbar-left-aligned') shouldLeftAlign;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
config: Config,
|
private _config: Config,
|
||||||
@Optional() ngControl: NgControl
|
@Optional() ngControl: NgControl
|
||||||
) {
|
) {
|
||||||
super(elementRef, config);
|
super(_elementRef, _config);
|
||||||
|
|
||||||
// If the user passed a ngControl we need to set the valueAccessor
|
// If the user passed a ngControl we need to set the valueAccessor
|
||||||
if (ngControl) {
|
if (ngControl) {
|
||||||
@ -138,6 +139,8 @@ export class Searchbar extends Ion {
|
|||||||
* On Initialization check for attributes
|
* On Initialization check for attributes
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.mode = this._config.get('mode');
|
||||||
|
|
||||||
let hideCancelButton = this.hideCancelButton;
|
let hideCancelButton = this.hideCancelButton;
|
||||||
if (typeof hideCancelButton === 'string') {
|
if (typeof hideCancelButton === 'string') {
|
||||||
this.hideCancelButton = (hideCancelButton === '' || hideCancelButton === 'true');
|
this.hideCancelButton = (hideCancelButton === '' || hideCancelButton === 'true');
|
||||||
@ -152,8 +155,8 @@ export class Searchbar extends Ion {
|
|||||||
this.shouldLeftAlign = this.value && this.value.trim() != '';
|
this.shouldLeftAlign = this.value && this.value.trim() != '';
|
||||||
|
|
||||||
// Using querySelector instead of searchbarInput because at this point it doesn't exist
|
// Using querySelector instead of searchbarInput because at this point it doesn't exist
|
||||||
this.inputElement = this.elementRef.nativeElement.querySelector('.searchbar-input');
|
this.inputElement = this._elementRef.nativeElement.querySelector('.searchbar-input');
|
||||||
this.searchIconElement = this.elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
this.searchIconElement = this._elementRef.nativeElement.querySelector('.searchbar-search-icon');
|
||||||
this.setElementLeft();
|
this.setElementLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,9 +177,11 @@ export class Searchbar extends Ion {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* Determines whether or not to add style to the element
|
* Determines whether or not to add style to the element
|
||||||
* to center it properly
|
* to center it properly (ios only)
|
||||||
*/
|
*/
|
||||||
setElementLeft() {
|
setElementLeft() {
|
||||||
|
if (this.mode !== 'ios') return;
|
||||||
|
|
||||||
if (this.shouldLeftAlign) {
|
if (this.shouldLeftAlign) {
|
||||||
this.inputElement.removeAttribute("style");
|
this.inputElement.removeAttribute("style");
|
||||||
this.searchIconElement.removeAttribute("style");
|
this.searchIconElement.removeAttribute("style");
|
||||||
@ -240,7 +245,7 @@ export class Searchbar extends Ion {
|
|||||||
// blurInput determines if it should blur
|
// blurInput determines if it should blur
|
||||||
// if we are clearing the input we still want to stay focused in the input
|
// if we are clearing the input we still want to stay focused in the input
|
||||||
if (this.blurInput == false) {
|
if (this.blurInput == false) {
|
||||||
this.searchbarInput.elementRef.nativeElement.focus();
|
this.searchbarInput._elementRef.nativeElement.focus();
|
||||||
this.blurInput = true;
|
this.blurInput = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,7 @@
|
|||||||
|
|
||||||
const nativeRaf = window.requestAnimationFrame ||
|
// requestAnimationFrame is polyfilled for old Android
|
||||||
window.webkitRequestAnimationFrame ||
|
// within the web-animations polyfill
|
||||||
window.mozRequestAnimationFrame;
|
export const raf = window.requestAnimationFrame;
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function rafFrames(framesToWait, callback) {
|
export function rafFrames(framesToWait, callback) {
|
||||||
framesToWait = Math.ceil(framesToWait);
|
framesToWait = Math.ceil(framesToWait);
|
||||||
|
@ -87,6 +87,21 @@ module.exports = function(grunt) {
|
|||||||
config.wrap[target] = {
|
config.wrap[target] = {
|
||||||
source: source,
|
source: source,
|
||||||
preamble: '(function() {\n' +
|
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' +
|
' if (document.documentElement.animate) {\n' +
|
||||||
' var player = document.documentElement.animate([], 0);\n' +
|
' var player = document.documentElement.animate([], 0);\n' +
|
||||||
' var load = true;\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