mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
chore: sync
This commit is contained in:
@ -12,6 +12,14 @@ export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
||||
set(val: any) {
|
||||
this.z.runOutsideAngular(() => (this.el[item] = val));
|
||||
},
|
||||
/**
|
||||
* In the event that proxyInputs is called
|
||||
* multiple times re-defining these inputs
|
||||
* will cause an error to be thrown. As a result
|
||||
* we set configurable: true to indicate these
|
||||
* properties can be changed.
|
||||
*/
|
||||
configurable: true,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -19,15 +19,9 @@ export * from './directives/validators';
|
||||
|
||||
// PROVIDERS
|
||||
export {
|
||||
ActionSheetController,
|
||||
AlertController,
|
||||
LoadingController,
|
||||
ModalController,
|
||||
PickerController,
|
||||
PopoverController,
|
||||
ToastController,
|
||||
AnimationController,
|
||||
GestureController,
|
||||
DomController,
|
||||
NavController,
|
||||
Config,
|
||||
@ -40,7 +34,13 @@ export {
|
||||
ViewDidEnter,
|
||||
ViewDidLeave,
|
||||
} from '@ionic/angular/common';
|
||||
export { AnimationController } from './providers/animation-controller';
|
||||
export { ActionSheetController } from './providers/action-sheet-controller';
|
||||
export { GestureController } from './providers/gesture-controller';
|
||||
export { MenuController } from './providers/menu-controller';
|
||||
export { ModalController } from './providers/modal-controller';
|
||||
export { PopoverController } from './providers/popover-controller';
|
||||
export { ToastController } from './providers/toast-controller';
|
||||
|
||||
// PACKAGE MODULE
|
||||
export { IonicModule } from './ionic-module';
|
||||
|
@ -1,12 +1,6 @@
|
||||
import { CommonModule, DOCUMENT } from '@angular/common';
|
||||
import { ModuleWithProviders, APP_INITIALIZER, NgModule, NgZone } from '@angular/core';
|
||||
import {
|
||||
ModalController,
|
||||
PopoverController,
|
||||
ConfigToken,
|
||||
AngularDelegate,
|
||||
provideComponentInputBinding,
|
||||
} from '@ionic/angular/common';
|
||||
import { ConfigToken, AngularDelegate, provideComponentInputBinding } from '@ionic/angular/common';
|
||||
import { IonicConfig } from '@ionic/core';
|
||||
|
||||
import { appInitialize } from './app-initialize';
|
||||
@ -28,6 +22,8 @@ import { IonModal } from './directives/overlays/modal';
|
||||
import { IonPopover } from './directives/overlays/popover';
|
||||
import { DIRECTIVES } from './directives/proxies-list';
|
||||
import { IonMaxValidator, IonMinValidator } from './directives/validators';
|
||||
import { ModalController } from './providers/modal-controller';
|
||||
import { PopoverController } from './providers/popover-controller';
|
||||
|
||||
const DECLARATIONS = [
|
||||
// generated proxies
|
||||
|
13
packages/angular/src/providers/action-sheet-controller.ts
Normal file
13
packages/angular/src/providers/action-sheet-controller.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { OverlayBaseController } from '@ionic/angular/common';
|
||||
import type { ActionSheetOptions } from '@ionic/core';
|
||||
import { actionSheetController } from '@ionic/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ActionSheetController extends OverlayBaseController<ActionSheetOptions, HTMLIonActionSheetElement> {
|
||||
constructor() {
|
||||
super(actionSheetController);
|
||||
}
|
||||
}
|
33
packages/angular/src/providers/animation-controller.ts
Normal file
33
packages/angular/src/providers/animation-controller.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { createAnimation, getTimeGivenProgression } from '@ionic/core';
|
||||
import type { Animation } from '@ionic/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AnimationController {
|
||||
/**
|
||||
* Create a new animation
|
||||
*/
|
||||
create(animationId?: string): Animation {
|
||||
return createAnimation(animationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* EXPERIMENTAL
|
||||
*
|
||||
* Given a progression and a cubic bezier function,
|
||||
* this utility returns the time value(s) at which the
|
||||
* cubic bezier reaches the given time progression.
|
||||
*
|
||||
* If the cubic bezier never reaches the progression
|
||||
* the result will be an empty array.
|
||||
*
|
||||
* This is most useful for switching between easing curves
|
||||
* when doing a gesture animation (i.e. going from linear easing
|
||||
* during a drag, to another easing when `progressEnd` is called)
|
||||
*/
|
||||
easingTime(p0: number[], p1: number[], p2: number[], p3: number[], progression: number): number[] {
|
||||
return getTimeGivenProgression(p0, p1, p2, p3, progression);
|
||||
}
|
||||
}
|
25
packages/angular/src/providers/gesture-controller.ts
Normal file
25
packages/angular/src/providers/gesture-controller.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import type { Gesture, GestureConfig } from '@ionic/core';
|
||||
import { createGesture } from '@ionic/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GestureController {
|
||||
constructor(private zone: NgZone) {}
|
||||
/**
|
||||
* Create a new gesture
|
||||
*/
|
||||
create(opts: GestureConfig, runInsideAngularZone = false): Gesture {
|
||||
if (runInsideAngularZone) {
|
||||
Object.getOwnPropertyNames(opts).forEach((key) => {
|
||||
if (typeof opts[key] === 'function') {
|
||||
const fn = opts[key];
|
||||
opts[key] = (...props: any[]) => this.zone.run(() => fn(...props));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return createGesture(opts);
|
||||
}
|
||||
}
|
22
packages/angular/src/providers/modal-controller.ts
Normal file
22
packages/angular/src/providers/modal-controller.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Injector, Injectable, EnvironmentInjector, inject } from '@angular/core';
|
||||
import { AngularDelegate, OverlayBaseController } from '@ionic/angular/common';
|
||||
import type { ModalOptions } from '@ionic/core';
|
||||
import { modalController } from '@ionic/core';
|
||||
|
||||
@Injectable()
|
||||
export class ModalController extends OverlayBaseController<ModalOptions, HTMLIonModalElement> {
|
||||
private angularDelegate = inject(AngularDelegate);
|
||||
private injector = inject(Injector);
|
||||
private environmentInjector = inject(EnvironmentInjector);
|
||||
|
||||
constructor() {
|
||||
super(modalController);
|
||||
}
|
||||
|
||||
create(opts: ModalOptions): Promise<HTMLIonModalElement> {
|
||||
return super.create({
|
||||
...opts,
|
||||
delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'modal'),
|
||||
});
|
||||
}
|
||||
}
|
21
packages/angular/src/providers/popover-controller.ts
Normal file
21
packages/angular/src/providers/popover-controller.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Injector, inject, EnvironmentInjector } from '@angular/core';
|
||||
import { AngularDelegate, OverlayBaseController } from '@ionic/angular/common';
|
||||
import type { PopoverOptions } from '@ionic/core';
|
||||
import { popoverController } from '@ionic/core';
|
||||
|
||||
export class PopoverController extends OverlayBaseController<PopoverOptions, HTMLIonPopoverElement> {
|
||||
private angularDelegate = inject(AngularDelegate);
|
||||
private injector = inject(Injector);
|
||||
private environmentInjector = inject(EnvironmentInjector);
|
||||
|
||||
constructor() {
|
||||
super(popoverController);
|
||||
}
|
||||
|
||||
create(opts: PopoverOptions): Promise<HTMLIonPopoverElement> {
|
||||
return super.create({
|
||||
...opts,
|
||||
delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'popover'),
|
||||
});
|
||||
}
|
||||
}
|
13
packages/angular/src/providers/toast-controller.ts
Normal file
13
packages/angular/src/providers/toast-controller.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { OverlayBaseController } from '@ionic/angular/common';
|
||||
import type { ToastOptions } from '@ionic/core';
|
||||
import { toastController } from '@ionic/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastController extends OverlayBaseController<ToastOptions, HTMLIonToastElement> {
|
||||
constructor() {
|
||||
super(toastController);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user