mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
fix(refresher): mode property can be used in typescript (#28717)
Issue number: resolves #28716
---------
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->
<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
All components that have per-mode stylesheets can have their mode
adjusted by setting `mode` on the component. We use the `setMode`
function to determine which mode to use on the component:
516b84475e/core/src/global/ionic-global.ts (L75)
While this works on refresher, it is missing the `virtualProp` jsdoc
comment which causes it to not have the appropriate type information. As
a result, when developers try to use a JS binding for `mode`, they will
get compilation errors.
## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
- Adds virtualProp for mode to refresher
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->
## Other information
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
I am considering this a bug fix instead of a feature. In non-TypeScript
environments you can set `mode` on `ion-refresher` and it does change
the mode. What's missing here is the type information associated with
it.
Dev build: `7.6.2-dev.11702914017.1ae72da5`
This commit is contained in:
@ -1087,6 +1087,7 @@ ion-range,part,tick-active
|
|||||||
ion-refresher,none
|
ion-refresher,none
|
||||||
ion-refresher,prop,closeDuration,string,'280ms',false,false
|
ion-refresher,prop,closeDuration,string,'280ms',false,false
|
||||||
ion-refresher,prop,disabled,boolean,false,false,false
|
ion-refresher,prop,disabled,boolean,false,false,false
|
||||||
|
ion-refresher,prop,mode,"ios" | "md",undefined,false,false
|
||||||
ion-refresher,prop,pullFactor,number,1,false,false
|
ion-refresher,prop,pullFactor,number,1,false,false
|
||||||
ion-refresher,prop,pullMax,number,this.pullMin + 60,false,false
|
ion-refresher,prop,pullMax,number,this.pullMin + 60,false,false
|
||||||
ion-refresher,prop,pullMin,number,60,false,false
|
ion-refresher,prop,pullMin,number,60,false,false
|
||||||
|
8
core/src/components.d.ts
vendored
8
core/src/components.d.ts
vendored
@ -2377,6 +2377,10 @@ export namespace Components {
|
|||||||
* A number representing how far down the user has pulled. The number `0` represents the user hasn't pulled down at all. The number `1`, and anything greater than `1`, represents that the user has pulled far enough down that when they let go then the refresh will happen. If they let go and the number is less than `1`, then the refresh will not happen, and the content will return to it's original position.
|
* A number representing how far down the user has pulled. The number `0` represents the user hasn't pulled down at all. The number `1`, and anything greater than `1`, represents that the user has pulled far enough down that when they let go then the refresh will happen. If they let go and the number is less than `1`, then the refresh will not happen, and the content will return to it's original position.
|
||||||
*/
|
*/
|
||||||
"getProgress": () => Promise<number>;
|
"getProgress": () => Promise<number>;
|
||||||
|
/**
|
||||||
|
* The mode determines which platform styles to use.
|
||||||
|
*/
|
||||||
|
"mode"?: "ios" | "md";
|
||||||
/**
|
/**
|
||||||
* How much to multiply the pull speed by. To slow the pull animation down, pass a number less than `1`. To speed up the pull, pass a number greater than `1`. The default value is `1` which is equal to the speed of the cursor. If a negative value is passed in, the factor will be `1` instead. For example: If the value passed is `1.2` and the content is dragged by `10` pixels, instead of `10` pixels the content will be pulled by `12` pixels (an increase of 20 percent). If the value passed is `0.8`, the dragged amount will be `8` pixels, less than the amount the cursor has moved. Does not apply when the refresher content uses a spinner, enabling the native refresher.
|
* How much to multiply the pull speed by. To slow the pull animation down, pass a number less than `1`. To speed up the pull, pass a number greater than `1`. The default value is `1` which is equal to the speed of the cursor. If a negative value is passed in, the factor will be `1` instead. For example: If the value passed is `1.2` and the content is dragged by `10` pixels, instead of `10` pixels the content will be pulled by `12` pixels (an increase of 20 percent). If the value passed is `0.8`, the dragged amount will be `8` pixels, less than the amount the cursor has moved. Does not apply when the refresher content uses a spinner, enabling the native refresher.
|
||||||
*/
|
*/
|
||||||
@ -7089,6 +7093,10 @@ declare namespace LocalJSX {
|
|||||||
* If `true`, the refresher will be hidden.
|
* If `true`, the refresher will be hidden.
|
||||||
*/
|
*/
|
||||||
"disabled"?: boolean;
|
"disabled"?: boolean;
|
||||||
|
/**
|
||||||
|
* The mode determines which platform styles to use.
|
||||||
|
*/
|
||||||
|
"mode"?: "ios" | "md";
|
||||||
/**
|
/**
|
||||||
* Emitted while the user is pulling down the content and exposing the refresher.
|
* Emitted while the user is pulling down the content and exposing the refresher.
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,9 @@ import {
|
|||||||
translateElement,
|
translateElement,
|
||||||
} from './refresher.utils';
|
} from './refresher.utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-refresher',
|
tag: 'ion-refresher',
|
||||||
styleUrls: {
|
styleUrls: {
|
||||||
|
@ -1626,7 +1626,7 @@ mouse drag, touch gesture, or keyboard interaction.
|
|||||||
|
|
||||||
|
|
||||||
@ProxyCmp({
|
@ProxyCmp({
|
||||||
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
||||||
methods: ['complete', 'cancel', 'getProgress']
|
methods: ['complete', 'cancel', 'getProgress']
|
||||||
})
|
})
|
||||||
@Component({
|
@Component({
|
||||||
@ -1634,7 +1634,7 @@ mouse drag, touch gesture, or keyboard interaction.
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
template: '<ng-content></ng-content>',
|
template: '<ng-content></ng-content>',
|
||||||
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
||||||
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
||||||
})
|
})
|
||||||
export class IonRefresher {
|
export class IonRefresher {
|
||||||
protected el: HTMLElement;
|
protected el: HTMLElement;
|
||||||
|
@ -1496,7 +1496,7 @@ export declare interface IonProgressBar extends Components.IonProgressBar {}
|
|||||||
|
|
||||||
@ProxyCmp({
|
@ProxyCmp({
|
||||||
defineCustomElementFn: defineIonRefresher,
|
defineCustomElementFn: defineIonRefresher,
|
||||||
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
||||||
methods: ['complete', 'cancel', 'getProgress']
|
methods: ['complete', 'cancel', 'getProgress']
|
||||||
})
|
})
|
||||||
@Component({
|
@Component({
|
||||||
@ -1504,7 +1504,7 @@ export declare interface IonProgressBar extends Components.IonProgressBar {}
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
template: '<ng-content></ng-content>',
|
template: '<ng-content></ng-content>',
|
||||||
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
||||||
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
|
||||||
standalone: true
|
standalone: true
|
||||||
})
|
})
|
||||||
export class IonRefresher {
|
export class IonRefresher {
|
||||||
|
Reference in New Issue
Block a user