mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
docs(picker): add some basic documentation for picker
This commit is contained in:
@ -31,8 +31,63 @@ export class Picker {
|
|||||||
private durationTimeout: any;
|
private durationTimeout: any;
|
||||||
private mode: string;
|
private mode: string;
|
||||||
|
|
||||||
|
pickerId: number;
|
||||||
|
|
||||||
@Element() private el: HTMLElement;
|
@Element() private el: HTMLElement;
|
||||||
|
|
||||||
|
@State() private showSpinner: boolean = null;
|
||||||
|
@State() private spinner: string;
|
||||||
|
|
||||||
|
@Prop({ connect: 'ion-animation-controller' }) animationCtrl: AnimationController;
|
||||||
|
@Prop({ context: 'config' }) config: Config;
|
||||||
|
@Prop({ context: 'dom' }) dom: DomController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation to use when the picker is presented.
|
||||||
|
*/
|
||||||
|
@Prop() enterAnimation: AnimationBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation to use when the picker is dismissed.
|
||||||
|
*/
|
||||||
|
@Prop() leaveAnimation: AnimationBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of buttons to be displayed at the top of the picker.
|
||||||
|
*/
|
||||||
|
@Prop() buttons: PickerButton[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of columns to be displayed in the picker.
|
||||||
|
*/
|
||||||
|
@Prop() columns: PickerColumn[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional classes to apply for custom CSS. If multiple classes are
|
||||||
|
* provided they should be separated by spaces.
|
||||||
|
*/
|
||||||
|
@Prop() cssClass: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of milliseconds to wait before dismissing the picker.
|
||||||
|
*/
|
||||||
|
@Prop() duration: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, a backdrop will be displayed behind the picker. Defaults to `true`.
|
||||||
|
*/
|
||||||
|
@Prop() showBackdrop = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the picker will be dismissed when the backdrop is clicked. Defaults to `true`.
|
||||||
|
*/
|
||||||
|
@Prop() enableBackdropDismiss = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the picker will animate. Defaults to `true`.
|
||||||
|
*/
|
||||||
|
@Prop() willAnimate = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted after the picker has loaded.
|
* Emitted after the picker has loaded.
|
||||||
*/
|
*/
|
||||||
@ -63,27 +118,9 @@ export class Picker {
|
|||||||
*/
|
*/
|
||||||
@Event() ionPickerDidUnload: EventEmitter<PickerEventDetail>;
|
@Event() ionPickerDidUnload: EventEmitter<PickerEventDetail>;
|
||||||
|
|
||||||
@State() private showSpinner: boolean = null;
|
/**
|
||||||
@State() private spinner: string;
|
* Present the picker overlay after it has been created.
|
||||||
|
*/
|
||||||
@Prop({ connect: 'ion-animation-controller' }) animationCtrl: AnimationController;
|
|
||||||
@Prop({ context: 'config' }) config: Config;
|
|
||||||
@Prop({ context: 'dom' }) dom: DomController;
|
|
||||||
|
|
||||||
@Prop() cssClass: string;
|
|
||||||
@Prop() content: string;
|
|
||||||
@Prop() dismissOnPageChange = false;
|
|
||||||
@Prop() duration: number;
|
|
||||||
@Prop() enterAnimation: AnimationBuilder;
|
|
||||||
@Prop() leaveAnimation: AnimationBuilder;
|
|
||||||
@Prop() pickerId: number;
|
|
||||||
@Prop() showBackdrop = true;
|
|
||||||
@Prop() enableBackdropDismiss = true;
|
|
||||||
@Prop() willAnimate = true;
|
|
||||||
|
|
||||||
@Prop() buttons: PickerButton[] = [];
|
|
||||||
@Prop() columns: PickerColumn[] = [];
|
|
||||||
|
|
||||||
@Method()
|
@Method()
|
||||||
present() {
|
present() {
|
||||||
if (this.animation) {
|
if (this.animation) {
|
||||||
@ -113,6 +150,9 @@ export class Picker {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dismiss the picker overlay after it has been presented.
|
||||||
|
*/
|
||||||
@Method()
|
@Method()
|
||||||
dismiss(data?: any, role?: string) {
|
dismiss(data?: any, role?: string) {
|
||||||
clearTimeout(this.durationTimeout);
|
clearTimeout(this.durationTimeout);
|
||||||
@ -223,17 +263,11 @@ export class Picker {
|
|||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {any} button Picker toolbar button
|
|
||||||
*/
|
|
||||||
@Method()
|
@Method()
|
||||||
addButton(button: any) {
|
addButton(button: any) {
|
||||||
this.buttons.push(button);
|
this.buttons.push(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {PickerColumn} column Picker toolbar button
|
|
||||||
*/
|
|
||||||
@Method()
|
@Method()
|
||||||
addColumn(column: PickerColumn) {
|
addColumn(column: PickerColumn) {
|
||||||
this.columns.push(column);
|
this.columns.push(column);
|
||||||
@ -307,31 +341,13 @@ export class Picker {
|
|||||||
// return column;
|
// return column;
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// RENDER TODO
|
|
||||||
// <ion-backdrop (click)="bdClick()"></ion-backdrop>
|
|
||||||
// <div class="picker-wrapper">
|
|
||||||
// <div class="picker-toolbar">
|
|
||||||
// <div *ngFor="let b of d.buttons" class="picker-toolbar-button" [ngClass]="b.cssRole">
|
|
||||||
// <ion-button (click)="btnClick(b)" [ngClass]="b.cssClass" class="picker-button" clear>
|
|
||||||
// {{b.text}}
|
|
||||||
// </ion-button>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// <div class="picker-columns">
|
|
||||||
// <div class="picker-above-highlight"></div>
|
|
||||||
// <div *ngFor="let c of d.columns" [col]="c" class="picker-col" (ionChange)="_colChange($event)"></div>
|
|
||||||
// <div class="picker-below-highlight"></div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
<ion-backdrop
|
<ion-backdrop
|
||||||
onClick={this.backdropClick.bind(this)}
|
onClick={this.backdropClick.bind(this)}
|
||||||
class={{
|
class={{
|
||||||
'picker-backdrop': true,
|
'picker-backdrop': true,
|
||||||
'hide-backdrop': !this.showBackdrop
|
'hide-backdrop': !this.showBackdrop
|
||||||
}}
|
}}></ion-backdrop>,
|
||||||
/>,
|
|
||||||
<div class='picker-wrapper' role='dialog'>
|
<div class='picker-wrapper' role='dialog'>
|
||||||
<div class='picker-toolbar'>
|
<div class='picker-toolbar'>
|
||||||
{buttons.map(b =>
|
{buttons.map(b =>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# ion-picker
|
# ion-picker
|
||||||
|
|
||||||
|
A Picker is a dialog that displays a row of buttons and columns underneath. It appears on top of the app's content, and at the bottom of the viewport.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Auto Generated Below -->
|
<!-- Auto Generated Below -->
|
||||||
@ -11,61 +13,65 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Array of buttons to be displayed at the top of the picker.
|
||||||
|
|
||||||
|
|
||||||
#### columns
|
#### columns
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Array of columns to be displayed in the picker.
|
||||||
#### content
|
|
||||||
|
|
||||||
string
|
|
||||||
|
|
||||||
|
|
||||||
#### cssClass
|
#### cssClass
|
||||||
|
|
||||||
string
|
string
|
||||||
|
|
||||||
|
Additional classes to apply for custom CSS. If multiple classes are
|
||||||
#### dismissOnPageChange
|
provided they should be separated by spaces.
|
||||||
|
|
||||||
boolean
|
|
||||||
|
|
||||||
|
|
||||||
#### duration
|
#### duration
|
||||||
|
|
||||||
number
|
number
|
||||||
|
|
||||||
|
Number of milliseconds to wait before dismissing the picker.
|
||||||
|
|
||||||
|
|
||||||
#### enableBackdropDismiss
|
#### enableBackdropDismiss
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the picker will be dismissed when the backdrop is clicked. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### enterAnimation
|
#### enterAnimation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Animation to use when the picker is presented.
|
||||||
|
|
||||||
|
|
||||||
#### leaveAnimation
|
#### leaveAnimation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Animation to use when the picker is dismissed.
|
||||||
#### pickerId
|
|
||||||
|
|
||||||
number
|
|
||||||
|
|
||||||
|
|
||||||
#### showBackdrop
|
#### showBackdrop
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, a backdrop will be displayed behind the picker. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### willAnimate
|
#### willAnimate
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the picker will animate. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
## Attributes
|
## Attributes
|
||||||
|
|
||||||
@ -73,61 +79,65 @@ boolean
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Array of buttons to be displayed at the top of the picker.
|
||||||
|
|
||||||
|
|
||||||
#### columns
|
#### columns
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Array of columns to be displayed in the picker.
|
||||||
#### content
|
|
||||||
|
|
||||||
string
|
|
||||||
|
|
||||||
|
|
||||||
#### css-class
|
#### css-class
|
||||||
|
|
||||||
string
|
string
|
||||||
|
|
||||||
|
Additional classes to apply for custom CSS. If multiple classes are
|
||||||
#### dismiss-on-page-change
|
provided they should be separated by spaces.
|
||||||
|
|
||||||
boolean
|
|
||||||
|
|
||||||
|
|
||||||
#### duration
|
#### duration
|
||||||
|
|
||||||
number
|
number
|
||||||
|
|
||||||
|
Number of milliseconds to wait before dismissing the picker.
|
||||||
|
|
||||||
|
|
||||||
#### enable-backdrop-dismiss
|
#### enable-backdrop-dismiss
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the picker will be dismissed when the backdrop is clicked. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### enter-animation
|
#### enter-animation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Animation to use when the picker is presented.
|
||||||
|
|
||||||
|
|
||||||
#### leave-animation
|
#### leave-animation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Animation to use when the picker is dismissed.
|
||||||
#### picker-id
|
|
||||||
|
|
||||||
number
|
|
||||||
|
|
||||||
|
|
||||||
#### show-backdrop
|
#### show-backdrop
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, a backdrop will be displayed behind the picker. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### will-animate
|
#### will-animate
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the picker will animate. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
@ -171,6 +181,8 @@ Emitted before the picker has presented.
|
|||||||
|
|
||||||
#### dismiss()
|
#### dismiss()
|
||||||
|
|
||||||
|
Dismiss the picker overlay after it has been presented.
|
||||||
|
|
||||||
|
|
||||||
#### getColumn()
|
#### getColumn()
|
||||||
|
|
||||||
@ -180,6 +192,8 @@ Emitted before the picker has presented.
|
|||||||
|
|
||||||
#### present()
|
#### present()
|
||||||
|
|
||||||
|
Present the picker overlay after it has been created.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
Reference in New Issue
Block a user