mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(): update to Stencil One 🎉🎊
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Prop, QueueApi, Watch } from '@stencil/core';
|
||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Prop, QueueApi, Watch, h } from '@stencil/core';
|
||||
|
||||
import { Gesture, GestureDetail, Mode, PickerColumn } from '../../interface';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { Gesture, GestureDetail, PickerColumn } from '../../interface';
|
||||
import { hapticSelectionChanged } from '../../utils/haptic';
|
||||
import { clamp } from '../../utils/helpers';
|
||||
|
||||
@ -15,7 +16,6 @@ import { clamp } from '../../utils/helpers';
|
||||
}
|
||||
})
|
||||
export class PickerColumnCmp implements ComponentInterface {
|
||||
mode!: Mode;
|
||||
|
||||
private bounceFrom!: number;
|
||||
private lastIndex?: number;
|
||||
@ -53,7 +53,9 @@ export class PickerColumnCmp implements ComponentInterface {
|
||||
let pickerRotateFactor = 0;
|
||||
let pickerScaleFactor = 0.81;
|
||||
|
||||
if (this.mode === 'ios') {
|
||||
const mode = getIonMode(this);
|
||||
|
||||
if (mode === 'ios') {
|
||||
pickerRotateFactor = -0.46;
|
||||
pickerScaleFactor = 1;
|
||||
}
|
||||
@ -73,7 +75,6 @@ export class PickerColumnCmp implements ComponentInterface {
|
||||
|
||||
this.gesture = (await import('../../utils/gesture')).createGesture({
|
||||
el: this.el,
|
||||
queue: this.queue,
|
||||
gestureName: 'picker-swipe',
|
||||
gesturePriority: 100,
|
||||
threshold: 0,
|
||||
@ -347,9 +348,10 @@ export class PickerColumnCmp implements ComponentInterface {
|
||||
}
|
||||
|
||||
hostData() {
|
||||
const mode = getIonMode(this);
|
||||
return {
|
||||
class: {
|
||||
[`${this.mode}`]: true,
|
||||
[`${mode}`]: true,
|
||||
'picker-col': true,
|
||||
'picker-opts-left': this.col.align === 'left',
|
||||
'picker-opts-right': this.col.align === 'right'
|
||||
|
@ -8,8 +8,8 @@
|
||||
<link href="../../../../../css/core.css" rel="stylesheet">
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script src="../../../../../dist/ionic.js"></script>
|
||||
</head>
|
||||
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
|
||||
|
||||
<body>
|
||||
<ion-picker-controller></ion-picker-controller>
|
||||
@ -26,7 +26,7 @@
|
||||
'Chinchilla'
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
const multiColumnOptions = [
|
||||
[
|
||||
'Minified',
|
||||
@ -43,7 +43,7 @@
|
||||
'Artichoke'
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
async function openPicker(numColumns = 1, numOptions = 5, columnOptions = defaultColumnOptions) {
|
||||
const picker = await pickerController.create({
|
||||
columns: this.getColumns(numColumns, numOptions, columnOptions),
|
||||
@ -56,14 +56,14 @@
|
||||
text: 'Confirm',
|
||||
handler: (value) => {
|
||||
console.log(`Got Value ${value}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
await picker.present();
|
||||
}
|
||||
|
||||
|
||||
function getColumns(numColumns, numOptions, columnOptions) {
|
||||
let columns = [];
|
||||
for (let i = 0; i < numColumns; i++) {
|
||||
@ -72,10 +72,10 @@
|
||||
options: this.getColumnOptions(i, numOptions, columnOptions)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
|
||||
function getColumnOptions(columnIndex, numOptions, columnOptions) {
|
||||
let options = [];
|
||||
for (let i = 0; i < numOptions; i++) {
|
||||
@ -84,7 +84,7 @@
|
||||
value: i
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user