mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
docs(): labels, keyboard
This commit is contained in:
@ -50,6 +50,9 @@ export class Label {
|
|||||||
this.container = container;
|
this.container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
this.id = 'lbl-' + this.form.nextId();
|
this.id = 'lbl-' + this.form.nextId();
|
||||||
|
@ -4,6 +4,21 @@ import {Config} from '../config/config';
|
|||||||
import {Form} from './form';
|
import {Form} from './form';
|
||||||
import {hasFocusedTextInput, raf, rafFrames} from './dom';
|
import {hasFocusedTextInput, raf, rafFrames} from './dom';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Keyboard
|
||||||
|
* @description
|
||||||
|
* The `Keyboard` class allows you to work with the keyboard events provide by the Ionic keyboard plugin.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(keyboard: Keyboard){
|
||||||
|
* this.keyboard = keyboard;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Keyboard {
|
export class Keyboard {
|
||||||
@ -17,10 +32,47 @@ export class Keyboard {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chech to see if the keyboard is open or not.
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(keyboard: Keyboard){
|
||||||
|
* this.keyboard = keyboard;
|
||||||
|
* }
|
||||||
|
* keyboardCheck(){
|
||||||
|
* setTimeout(() => console.log('is the keyboard open ', this.keyboard.isOpen()));
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @return {Bool} returns a true or flase value if the keyboard is open or not
|
||||||
|
*/
|
||||||
isOpen() {
|
isOpen() {
|
||||||
return hasFocusedTextInput();
|
return hasFocusedTextInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the keyboard is closed, call any methods you want
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(keyboard: Keyboard){
|
||||||
|
* this.keyboard = keyboard;
|
||||||
|
* this.keyboard.onClose(this.closeCallback);
|
||||||
|
* }
|
||||||
|
* closeCallback(){
|
||||||
|
* // call what ever functionality you want on keyboard close
|
||||||
|
* console.log('Closing time");
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @param {Function} callback method you want to call when the keyboard has been closed
|
||||||
|
* @return {Function} returns a callback that gets fired when the keyboard is closed
|
||||||
|
*/
|
||||||
onClose(callback, pollingInternval=KEYBOARD_CLOSE_POLLING) {
|
onClose(callback, pollingInternval=KEYBOARD_CLOSE_POLLING) {
|
||||||
console.debug('keyboard onClose');
|
console.debug('keyboard onClose');
|
||||||
const self = this;
|
const self = this;
|
||||||
@ -57,6 +109,10 @@ export class Keyboard {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Progamatically close they keyboard
|
||||||
|
*
|
||||||
|
*/
|
||||||
close() {
|
close() {
|
||||||
console.debug('keyboard close()');
|
console.debug('keyboard close()');
|
||||||
raf(() => {
|
raf(() => {
|
||||||
@ -67,6 +123,9 @@ export class Keyboard {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
focusOutline(setting, document) {
|
focusOutline(setting, document) {
|
||||||
/* Focus Outline
|
/* Focus Outline
|
||||||
* --------------------------------------------------
|
* --------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user