mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Merge branch 'master' into css-refactor
# Conflicts: # ionic/components/action-sheet/action-sheet.ts
This commit is contained in:
@ -122,7 +122,17 @@ export class ActionSheet {
|
|||||||
* public API, and most often you will only use ActionSheet.open()
|
* public API, and most often you will only use ActionSheet.open()
|
||||||
*
|
*
|
||||||
* @param {Object} [opts={}] An object containing optional settings.
|
* @param {Object} [opts={}] An object containing optional settings.
|
||||||
* @param {String} [opts.pageType='action-sheet'] The page type that determines how the page renders and animates.
|
* - `[Object]` `buttons` Which buttons to show. Each button is an object with a `text` field.
|
||||||
|
* - `{string}` `titleText` The title to show on the action sheet.
|
||||||
|
* - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.
|
||||||
|
* - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.
|
||||||
|
* - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or
|
||||||
|
* the hardware back button is pressed.
|
||||||
|
* - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,
|
||||||
|
* with the index of the button that was clicked and the button object. Return true to close
|
||||||
|
* the action sheet, or false to keep it opened.
|
||||||
|
* - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.
|
||||||
|
* Return true to close the action sheet, or false to keep it opened.
|
||||||
* @param {String} [opts.enterAnimation='action-sheet-slide-in'] The class used to animate an actionSheet that is entering.
|
* @param {String} [opts.enterAnimation='action-sheet-slide-in'] The class used to animate an actionSheet that is entering.
|
||||||
* @param {String} [opts.leaveAnimation='action-sheet-slide-out'] The class used to animate an actionSheet that is leaving.
|
* @param {String} [opts.leaveAnimation='action-sheet-slide-out'] The class used to animate an actionSheet that is leaving.
|
||||||
* @return {Promise} Promise that resolves when the action sheet is open.
|
* @return {Promise} Promise that resolves when the action sheet is open.
|
||||||
|
42
ionic/components/app/test/storage/index.ts
Normal file
42
ionic/components/app/test/storage/index.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import {Component, Control, ControlGroup} from 'angular2/angular2';
|
||||||
|
|
||||||
|
import {App, Storage, LocalStorage, SqlStorage} from 'ionic/ionic';
|
||||||
|
|
||||||
|
@App({
|
||||||
|
templateUrl: 'main.html'
|
||||||
|
})
|
||||||
|
class IonicApp {
|
||||||
|
constructor() {
|
||||||
|
this.local = new Storage(LocalStorage);
|
||||||
|
this.sql = new Storage(SqlStorage);
|
||||||
|
}
|
||||||
|
getLocal() {
|
||||||
|
this.local.get('name').then(value => {
|
||||||
|
alert('Your name is: ' + value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setLocal() {
|
||||||
|
let name = prompt('Your name?');
|
||||||
|
|
||||||
|
this.local.set('name', name);
|
||||||
|
}
|
||||||
|
removeLocal() {
|
||||||
|
this.local.remove('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
getSql() {
|
||||||
|
this.sql.get('name').then(value => {
|
||||||
|
alert('Your name is: ' + value);
|
||||||
|
}, (errResult) => {
|
||||||
|
console.error('Unable to get item from SQL db:', errResult);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setSql() {
|
||||||
|
let name = prompt('Your name?');
|
||||||
|
|
||||||
|
this.sql.set('name', name);
|
||||||
|
}
|
||||||
|
removeSql() {
|
||||||
|
this.sql.remove('name');
|
||||||
|
}
|
||||||
|
}
|
11
ionic/components/app/test/storage/main.html
Normal file
11
ionic/components/app/test/storage/main.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<ion-content padding>
|
||||||
|
<h2>Local Storage</h2>
|
||||||
|
<button primary (click)="getLocal()">Get</button>
|
||||||
|
<button primary (click)="setLocal()">Set</button>
|
||||||
|
<button primary (click)="removeLocal()">Remove</button>
|
||||||
|
|
||||||
|
<h2>SQL Storage</h2>
|
||||||
|
<button primary (click)="getSql()">Get</button>
|
||||||
|
<button primary (click)="setSql()">Set</button>
|
||||||
|
<button primary (click)="removeSql()">Remove</button>
|
||||||
|
</ion-content>
|
@ -44,6 +44,7 @@ ion-segment {
|
|||||||
ion-segment-button[button][outline].activated,
|
ion-segment-button[button][outline].activated,
|
||||||
ion-segment-button[button][outline].segment-activated {
|
ion-segment-button[button][outline].segment-activated {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ const DB_NAME = '__ionicstorage';
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // Sql storage also exposes the full engine underneath
|
* // Sql storage also exposes the full engine underneath
|
||||||
* storage.query('insert into projects(name, data) values('Cool Project', 'blah');'
|
* storage.query('insert into projects(name, data) values('Cool Project', 'blah')');
|
||||||
* storage.query('select * from projects').then((resp) => {})
|
* storage.query('select * from projects').then((resp) => {})
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ export class SqlStorage extends StorageEngine {
|
|||||||
static BACKUP_LIBRARY = 1
|
static BACKUP_LIBRARY = 1
|
||||||
static BACKUP_DOCUMENTS = 0
|
static BACKUP_DOCUMENTS = 0
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options={}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
let dbOptions = util.defaults(options, {
|
let dbOptions = util.defaults(options, {
|
||||||
@ -98,6 +98,7 @@ export class SqlStorage extends StorageEngine {
|
|||||||
*/
|
*/
|
||||||
query(query, ...params) {
|
query(query, ...params) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
this._db.transaction((tx) => {
|
this._db.transaction((tx) => {
|
||||||
tx.executeSql(query, params, (tx, res) => {
|
tx.executeSql(query, params, (tx, res) => {
|
||||||
resolve({
|
resolve({
|
||||||
@ -110,7 +111,12 @@ export class SqlStorage extends StorageEngine {
|
|||||||
err: err
|
err: err
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
}, err => {
|
||||||
|
reject(err);
|
||||||
});
|
});
|
||||||
|
} catch(e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ionic-framework",
|
"name": "ionic-framework",
|
||||||
"version": "2.0.0-alpha.39",
|
"version": "2.0.0-alpha.40",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
2
scripts/docs/templates/common.template.html
vendored
2
scripts/docs/templates/common.template.html
vendored
@ -151,8 +151,8 @@ Delegate: <$ doc.delegate $>
|
|||||||
<@ endif -@>
|
<@ endif -@>
|
||||||
|
|
||||||
|
|
||||||
<h2>Usage</h2>
|
|
||||||
<@ if doc.usage @>
|
<@ if doc.usage @>
|
||||||
|
<h2>Usage</h2>
|
||||||
<@ block usage @>
|
<@ block usage @>
|
||||||
<$ doc.usage | marked $>
|
<$ doc.usage | marked $>
|
||||||
<@ endblock @>
|
<@ endblock @>
|
||||||
|
Reference in New Issue
Block a user