mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(build): rename ionic directory to src and update all references in the build process.
This commit is contained in:
221
src/components/picker/test/basic/index.ts
Normal file
221
src/components/picker/test/basic/index.ts
Normal file
@@ -0,0 +1,221 @@
|
||||
import {ViewEncapsulation} from '@angular/core';
|
||||
import {App, Page, Picker, NavController} from '../../../../../ionic';
|
||||
|
||||
|
||||
@Page({
|
||||
templateUrl: 'main.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
})
|
||||
class E2EPage {
|
||||
smoothie: string;
|
||||
timer: string;
|
||||
|
||||
constructor(private nav: NavController) {}
|
||||
|
||||
twoColumns() {
|
||||
let picker = Picker.create({
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
text: 'Done',
|
||||
handler: (data) => {
|
||||
this.smoothie = `${data.flavor1} ${data.flavor2}`;
|
||||
}
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: 'flavor1',
|
||||
align: 'right',
|
||||
options: [
|
||||
{ text: 'Mango' },
|
||||
{ text: 'Banana' },
|
||||
{ text: 'Cherry' },
|
||||
{ text: 'Strawberry' },
|
||||
{ text: 'Raspberry' },
|
||||
{ text: 'Blueberry' },
|
||||
{ text: 'Peach' },
|
||||
{ text: 'Coconut' },
|
||||
{ text: 'Pineapple' },
|
||||
{ text: 'Honeydew' },
|
||||
{ text: 'Watermelon' },
|
||||
{ text: 'Grape' },
|
||||
{ text: 'Avocado' },
|
||||
{ text: 'Kiwi' },
|
||||
{ text: 'Orange' },
|
||||
{ text: 'Papaya' },
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'flavor2',
|
||||
align: 'left',
|
||||
options: [
|
||||
{ text: 'Banana' },
|
||||
{ text: 'Orange' },
|
||||
{ text: 'Grape' },
|
||||
{ text: 'Watermelon' },
|
||||
{ text: 'Strawberry' },
|
||||
{ text: 'Papaya' },
|
||||
{ text: 'Kiwi' },
|
||||
{ text: 'Cherry' },
|
||||
{ text: 'Raspberry' },
|
||||
{ text: 'Mango' },
|
||||
{ text: 'Pineapple' },
|
||||
{ text: 'Peach' },
|
||||
{ text: 'Avocado' },
|
||||
{ text: 'Honeydew' },
|
||||
{ text: 'Blueberry' },
|
||||
{ text: 'Coconut' },
|
||||
]
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
this.nav.present(picker);
|
||||
}
|
||||
|
||||
prefixLabel() {
|
||||
let picker = Picker.create({
|
||||
buttons: [
|
||||
{
|
||||
text: 'Nerp',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
text: 'Woot!',
|
||||
handler: (data) => {
|
||||
this.smoothie = `${data.flavor1}`;
|
||||
}
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: 'flavor1',
|
||||
align: 'left',
|
||||
prefix: 'Flavor',
|
||||
options: [
|
||||
{ text: 'Mango' },
|
||||
{ text: 'Banana' },
|
||||
{ text: 'Cherry' },
|
||||
{ text: 'Strawberry' },
|
||||
{ text: 'Raspberry' },
|
||||
{ text: 'Blueberry' },
|
||||
{ text: 'Peach' },
|
||||
{ text: 'Coconut' },
|
||||
{ text: 'Pineapple' },
|
||||
{ text: 'Honeydew' },
|
||||
{ text: 'Watermelon' },
|
||||
{ text: 'Grape' },
|
||||
{ text: 'Avocado' },
|
||||
{ text: 'Kiwi' },
|
||||
{ text: 'Orange' },
|
||||
{ text: 'Papaya' },
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.nav.present(picker);
|
||||
}
|
||||
|
||||
suffixLabel() {
|
||||
let picker = Picker.create({
|
||||
buttons: [
|
||||
{
|
||||
text: 'No',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
text: 'Si',
|
||||
handler: (data) => {
|
||||
this.smoothie = `${data.flavor1}`;
|
||||
}
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: 'flavor1',
|
||||
align: 'right',
|
||||
suffix: 'flavor',
|
||||
options: [
|
||||
{ text: 'Mango' },
|
||||
{ text: 'Banana' },
|
||||
{ text: 'Cherry' },
|
||||
{ text: 'Strawberry' },
|
||||
{ text: 'Raspberry' },
|
||||
{ text: 'Blueberry' },
|
||||
{ text: 'Peach' },
|
||||
{ text: 'Coconut' },
|
||||
{ text: 'Pineapple' },
|
||||
{ text: 'Honeydew' },
|
||||
{ text: 'Watermelon' },
|
||||
{ text: 'Grape' },
|
||||
{ text: 'Avocado' },
|
||||
{ text: 'Kiwi' },
|
||||
{ text: 'Orange' },
|
||||
{ text: 'Papaya' },
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.nav.present(picker);
|
||||
}
|
||||
|
||||
columnSizes() {
|
||||
let picker = Picker.create();
|
||||
|
||||
picker.addButton({
|
||||
text: 'Cancel',
|
||||
role: 'cancel'
|
||||
});
|
||||
|
||||
picker.addButton({
|
||||
text: 'Set Timer',
|
||||
handler: (data) => {
|
||||
this.timer = `${data.hour}:${data.min}`;
|
||||
}
|
||||
});
|
||||
|
||||
picker.addColumn({
|
||||
name: 'hour',
|
||||
suffix: 'hour',
|
||||
columnWidth: '30%',
|
||||
optionsWidth: '50px',
|
||||
options: Array.apply(null, {length: 23}).map(Number.call, Number)
|
||||
});
|
||||
|
||||
var minuteOptions = [];
|
||||
|
||||
for (var i = 0; i < 60; i++) {
|
||||
minuteOptions.push({
|
||||
text: i,
|
||||
value: ('0' + i).slice(-2)
|
||||
});
|
||||
}
|
||||
|
||||
picker.addColumn({
|
||||
name: 'min',
|
||||
suffix: 'min',
|
||||
columnWidth: '40%',
|
||||
optionsWidth: '80px',
|
||||
options: minuteOptions
|
||||
});
|
||||
|
||||
this.nav.present(picker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@App({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
class E2EApp {
|
||||
root;
|
||||
constructor() {
|
||||
this.root = E2EPage;
|
||||
}
|
||||
}
|
||||
33
src/components/picker/test/basic/main.html
Normal file
33
src/components/picker/test/basic/main.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<ion-navbar *navbar>
|
||||
<ion-title>Picker</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<button block class="e2eTwoColumns" (click)="twoColumns()">
|
||||
2 Columns
|
||||
</button>
|
||||
|
||||
<button block class="e2ePrefixLabel" (click)="prefixLabel()">
|
||||
Prefix Label
|
||||
</button>
|
||||
|
||||
<button block class="e2eSuffixLabel" (click)="suffixLabel()">
|
||||
Suffix Label
|
||||
</button>
|
||||
|
||||
<button block class="e2eColumnSizesLabel" (click)="columnSizes()">
|
||||
Columns with sizes
|
||||
</button>
|
||||
|
||||
|
||||
<p aria-hidden="true" padding>
|
||||
<code>Smoothie: {{ smoothie }}</code><br>
|
||||
<code>Timer: {{ timer }}</code><br>
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user