mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Merge remote-tracking branch 'origin/main' into sync-80-main-11-27
This commit is contained in:
@ -45,5 +45,8 @@
|
||||
</p>
|
||||
|
||||
<button id="set-menu-count" (click)="setMenuCount()">Set Menu Count</button>
|
||||
<button id="open-alert" (click)="openAlert()">Open Alert</button>
|
||||
<button id="open-action-sheet" (click)="openActionSheet()">Open Action Sheet</button>
|
||||
<button id="open-loading" (click)="openLoading()">Open Loading Indicator</button>
|
||||
<button id="open-picker" (click)="openPicker()">Open Picker</button>
|
||||
</ion-content>
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
import { Component, NgZone } from '@angular/core';
|
||||
import {
|
||||
Platform, ModalController, AlertController, ActionSheetController,
|
||||
PopoverController, ToastController, PickerController, MenuController,
|
||||
LoadingController, NavController, DomController, Config
|
||||
Platform,
|
||||
ModalController,
|
||||
AlertController,
|
||||
ActionSheetController,
|
||||
PopoverController,
|
||||
ToastController,
|
||||
PickerController,
|
||||
MenuController,
|
||||
LoadingController,
|
||||
NavController,
|
||||
DomController,
|
||||
Config,
|
||||
} from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
@ -10,7 +19,6 @@ import {
|
||||
templateUrl: './providers.component.html',
|
||||
})
|
||||
export class ProvidersComponent {
|
||||
|
||||
isLoaded = false;
|
||||
isReady = false;
|
||||
isResumed = false;
|
||||
@ -25,10 +33,10 @@ export class ProvidersComponent {
|
||||
|
||||
constructor(
|
||||
private actionSheetCtrl: ActionSheetController,
|
||||
alertCtrl: AlertController,
|
||||
loadingCtrl: LoadingController,
|
||||
private alertCtrl: AlertController,
|
||||
private loadingCtrl: LoadingController,
|
||||
private menuCtrl: MenuController,
|
||||
pickerCtrl: PickerController,
|
||||
private pickerCtrl: PickerController,
|
||||
modalCtrl: ModalController,
|
||||
platform: Platform,
|
||||
popoverCtrl: PopoverController,
|
||||
@ -40,11 +48,21 @@ export class ProvidersComponent {
|
||||
) {
|
||||
// test all providers load
|
||||
if (
|
||||
actionSheetCtrl && alertCtrl && loadingCtrl && menuCtrl && pickerCtrl &&
|
||||
modalCtrl && platform && popoverCtrl && toastCtrl && navCtrl && domCtrl && config
|
||||
) {
|
||||
this.isLoaded = true;
|
||||
}
|
||||
actionSheetCtrl &&
|
||||
alertCtrl &&
|
||||
loadingCtrl &&
|
||||
menuCtrl &&
|
||||
pickerCtrl &&
|
||||
modalCtrl &&
|
||||
platform &&
|
||||
popoverCtrl &&
|
||||
toastCtrl &&
|
||||
navCtrl &&
|
||||
domCtrl &&
|
||||
config
|
||||
) {
|
||||
this.isLoaded = true;
|
||||
}
|
||||
|
||||
// test platform ready()
|
||||
platform.ready().then(() => {
|
||||
@ -91,9 +109,46 @@ export class ProvidersComponent {
|
||||
|
||||
async openActionSheet() {
|
||||
const actionSheet = await this.actionSheetCtrl.create({
|
||||
buttons: ['Button']
|
||||
buttons: ['Button'],
|
||||
});
|
||||
|
||||
await actionSheet.present();
|
||||
}
|
||||
|
||||
async openAlert() {
|
||||
const alert = await this.alertCtrl.create({
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
],
|
||||
header: 'Alert!',
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
async openLoading() {
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Loading...',
|
||||
duration: 2000,
|
||||
});
|
||||
|
||||
await loading.present();
|
||||
}
|
||||
|
||||
async openPicker() {
|
||||
const picker = await this.pickerCtrl.create({
|
||||
columns: [],
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await picker.present();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
<div>
|
||||
<button id="open-alert" (click)="openAlert()">Open Alert</button>
|
||||
<button id="open-loading" (click)="openLoading()">Open Loading Indicator</button>
|
||||
<button id="open-modal" (click)="openModal()">Open Modal</button>
|
||||
<button id="open-picker" (click)="openPicker()">Open Picker</button>
|
||||
<button id="open-popover" (click)="openPopover($event)">Open Popover</button>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ModalController, PopoverController } from '@ionic/angular/standalone';
|
||||
import {
|
||||
AlertController,
|
||||
LoadingController,
|
||||
ModalController,
|
||||
PickerController,
|
||||
PopoverController,
|
||||
} from '@ionic/angular/standalone';
|
||||
|
||||
@Component({
|
||||
selector: 'app-overlay-controllers',
|
||||
@ -7,20 +13,63 @@ import { ModalController, PopoverController } from '@ionic/angular/standalone';
|
||||
standalone: true,
|
||||
})
|
||||
export class OverlayControllersComponent {
|
||||
constructor(private modalCtrl: ModalController, private popoverCtrl: PopoverController) {}
|
||||
constructor(
|
||||
private alertCtrl: AlertController,
|
||||
private loadingCtrl: LoadingController,
|
||||
private modalCtrl: ModalController,
|
||||
private pickerCtrl: PickerController,
|
||||
private popoverCtrl: PopoverController
|
||||
) {}
|
||||
|
||||
async openAlert() {
|
||||
const alert = await this.alertCtrl.create({
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
],
|
||||
header: 'Alert!',
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
async openLoading() {
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Loading...',
|
||||
duration: 2000,
|
||||
});
|
||||
|
||||
await loading.present();
|
||||
}
|
||||
|
||||
async openModal() {
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: DialogComponent
|
||||
component: DialogComponent,
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
async openPicker() {
|
||||
const picker = await this.pickerCtrl.create({
|
||||
columns: [],
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await picker.present();
|
||||
}
|
||||
|
||||
async openPopover(ev: MouseEvent) {
|
||||
const popover = await this.popoverCtrl.create({
|
||||
component: DialogComponent,
|
||||
event: ev
|
||||
event: ev,
|
||||
});
|
||||
|
||||
await popover.present();
|
||||
@ -32,5 +81,4 @@ export class OverlayControllersComponent {
|
||||
template: '<div class="ion-padding">Dialog Content</div>',
|
||||
standalone: true,
|
||||
})
|
||||
class DialogComponent {
|
||||
}
|
||||
class DialogComponent {}
|
||||
|
||||
Reference in New Issue
Block a user