mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
feat(all): add CustomEvents types to components that emit events (#23956)
resolves #22925 BREAKING CHANGE: The `RadioChangeEventDetail` interface has been removed in favor of `RadioGroupChangeEventDetail`.
This commit is contained in:
@ -10,3 +10,12 @@ export interface ScrollDetail extends GestureDetail, ScrollBaseDetail {
|
||||
}
|
||||
|
||||
export type ScrollCallback = (detail?: ScrollDetail) => boolean | void;
|
||||
|
||||
export interface ScrollBaseCustomEvent extends CustomEvent {
|
||||
detail: ScrollBaseDetail;
|
||||
target: HTMLIonContentElement;
|
||||
}
|
||||
|
||||
export interface ScrollCustomEvent extends ScrollBaseCustomEvent {
|
||||
detail: ScrollDetail;
|
||||
}
|
||||
|
@ -11,6 +11,46 @@ Content, along with many other Ionic components, can be customized to modify its
|
||||
|
||||
In order to place elements outside of the scrollable area, `slot="fixed"` can be added to the element. This will absolutely position the element placing it in the top left. In order to place the element in a different position, style it using [top, right, bottom, and left](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
|
||||
|
||||
## Interfaces
|
||||
|
||||
### ScrollBaseDetail
|
||||
|
||||
```typescript
|
||||
interface ScrollBaseDetail {
|
||||
isScrolling: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
### ScrollDetail
|
||||
|
||||
```typescript
|
||||
interface ScrollDetail extends GestureDetail, ScrollBaseDetail {
|
||||
scrollTop: number;
|
||||
scrollLeft: number;
|
||||
}
|
||||
```
|
||||
|
||||
### ScrollBaseCustomEvent
|
||||
|
||||
While not required, this interface can be used in place of the `CustomEvent` interface for stronger typing on the `ionScrollStart` and `ionScrollEnd` events.
|
||||
|
||||
```typescript
|
||||
interface ScrollBaseCustomEvent extends CustomEvent {
|
||||
detail: ScrollBaseDetail;
|
||||
target: HTMLIonContentElement;
|
||||
}
|
||||
```
|
||||
|
||||
### ScrollCustomEvent
|
||||
|
||||
While not required, this interface can be used in place of the `CustomEvent` interface for stronger typing on the `ionScroll` event.
|
||||
|
||||
```typescript
|
||||
interface ScrollCustomEvent extends ScrollBaseCustomEvent {
|
||||
detail: ScrollDetail;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
<!-- Auto Generated Below -->
|
||||
|
||||
|
Reference in New Issue
Block a user