feat(item-sliding): adds disabled prop

fixes #14831
This commit is contained in:
Manu Mtz.-Almeida
2018-08-07 20:38:11 +02:00
parent 2b7007f38e
commit 9773e2a3b3
3 changed files with 39 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { Component, Element, Event, EventEmitter, Method, Prop, QueueApi, State } from '@stencil/core';
import { Component, Element, Event, EventEmitter, Method, Prop, QueueApi, State, Watch } from '@stencil/core';
import { Gesture, GestureDetail } from '../../interface';
@ -47,6 +47,17 @@ export class ItemSliding {
@Prop({ context: 'queue' }) queue!: QueueApi;
/**
* If true, the user cannot interact with the sliding-item. Defaults to `false`.
*/
@Prop() disabled = false;
@Watch('disabled')
disabledChanged() {
if (this.gesture) {
this.gesture.setDisabled(this.disabled);
}
}
/**
* Emitted when the sliding position changes.
*/
@ -69,7 +80,7 @@ export class ItemSliding {
onMove: this.onDragMove.bind(this),
onEnd: this.onDragEnd.bind(this),
});
this.gesture.setDisabled(false);
this.disabledChanged();
}
componentDidUnload() {

View File

@ -29,6 +29,24 @@ Options can be expanded to take up the full width of the item if you swipe past
<!-- Auto Generated Below -->
## Properties
#### disabled
boolean
If true, the user cannot interact with the sliding-item. Defaults to `false`.
## Attributes
#### disabled
boolean
If true, the user cannot interact with the sliding-item. Defaults to `false`.
## Events
#### ionDrag