mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(list): rename methods and update docs
This commit is contained in:
16
core/src/components.d.ts
vendored
16
core/src/components.d.ts
vendored
@@ -2778,11 +2778,17 @@ declare global {
|
||||
declare global {
|
||||
interface HTMLIonListElement extends HTMLStencilElement {
|
||||
/**
|
||||
* Close the sliding items. Items can also be closed from the [Item Sliding](../../item-sliding/ItemSliding).
|
||||
* Close the sliding items. Items can also be closed from the [Item Sliding](../../item-sliding/ItemSliding). Returns a boolean value of whether it closed an item or not.
|
||||
*/
|
||||
'closeSlidingItems': () => boolean;
|
||||
'getOpenedItem': () => ItemSliding;
|
||||
'setOpenedItem': (itemSliding: ItemSliding) => void;
|
||||
/**
|
||||
* Get the [Item Sliding](../../item-sliding/ItemSliding) that is currently opene.
|
||||
*/
|
||||
'getOpenItem': () => ItemSliding;
|
||||
/**
|
||||
* Set an [Item Sliding](../../item-sliding/ItemSliding) as the open item.
|
||||
*/
|
||||
'setOpenItem': (itemSliding: ItemSliding) => void;
|
||||
}
|
||||
var HTMLIonListElement: {
|
||||
prototype: HTMLIonListElement;
|
||||
@@ -2996,7 +3002,7 @@ declare global {
|
||||
declare global {
|
||||
interface HTMLIonMenuButtonElement extends HTMLStencilElement {
|
||||
/**
|
||||
* Automatically hides the content when the corresponding menu is not active
|
||||
* Automatically hides the menu button when the corresponding menu is not active
|
||||
*/
|
||||
'autoHide': boolean;
|
||||
/**
|
||||
@@ -3022,7 +3028,7 @@ declare global {
|
||||
namespace JSXElements {
|
||||
export interface IonMenuButtonAttributes extends HTMLAttributes {
|
||||
/**
|
||||
* Automatically hides the content when the corresponding menu is not active
|
||||
* Automatically hides the menu button when the corresponding menu is not active
|
||||
*/
|
||||
'autoHide'?: boolean;
|
||||
/**
|
||||
|
||||
@@ -130,7 +130,7 @@ export class ItemSliding {
|
||||
}
|
||||
|
||||
private canStart(): boolean {
|
||||
const selected = this.list && this.list.getOpenedItem();
|
||||
const selected = this.list && this.list.getOpenItem();
|
||||
if (selected && selected !== this) {
|
||||
this.closeOpened();
|
||||
return false;
|
||||
@@ -139,7 +139,7 @@ export class ItemSliding {
|
||||
}
|
||||
|
||||
private onDragStart() {
|
||||
this.list && this.list.setOpenedItem(this);
|
||||
this.list && this.list.setOpenItem(this);
|
||||
|
||||
if (this.tmr) {
|
||||
clearTimeout(this.tmr);
|
||||
@@ -243,7 +243,7 @@ export class ItemSliding {
|
||||
this.state = SlidingState.Disabled;
|
||||
this.tmr = null;
|
||||
}, 600);
|
||||
this.list && this.list.setOpenedItem(null);
|
||||
this.list && this.list.setOpenItem(null);
|
||||
style.transform = '';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,26 +14,33 @@ import { ItemSliding } from '../item-sliding/item-sliding';
|
||||
}
|
||||
})
|
||||
export class List {
|
||||
private openedItem: ItemSliding|null;
|
||||
private openItem: ItemSliding | null;
|
||||
|
||||
/**
|
||||
* Get the [Item Sliding](../../item-sliding/ItemSliding) that is currently opene.
|
||||
*/
|
||||
@Method()
|
||||
getOpenedItem() {
|
||||
return this.openedItem;
|
||||
getOpenItem() {
|
||||
return this.openItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an [Item Sliding](../../item-sliding/ItemSliding) as the open item.
|
||||
*/
|
||||
@Method()
|
||||
setOpenedItem(itemSliding: ItemSliding|null) {
|
||||
this.openedItem = itemSliding;
|
||||
setOpenItem(itemSliding: ItemSliding | null) {
|
||||
this.openItem = itemSliding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the sliding items. Items can also be closed from the [Item Sliding](../../item-sliding/ItemSliding).
|
||||
* Returns a boolean value of whether it closed an item or not.
|
||||
*/
|
||||
@Method()
|
||||
closeSlidingItems(): boolean {
|
||||
if (this.openedItem) {
|
||||
this.openedItem.close();
|
||||
this.openedItem = null;
|
||||
if (this.openItem) {
|
||||
this.openItem.close();
|
||||
this.openItem = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# ion-list
|
||||
|
||||
Lists are made up of multiple rows of items which can contain text, buttons, toggles,
|
||||
icons, thumbnails, and much more. Lists generally contain items with similar
|
||||
data content, such as images and text.
|
||||
|
||||
Lists support several interactions including swiping items to reveal options, dragging to
|
||||
reorder items within the list, and deleting items.
|
||||
|
||||
|
||||
<!-- Auto Generated Below -->
|
||||
@@ -10,12 +16,17 @@
|
||||
#### closeSlidingItems()
|
||||
|
||||
Close the sliding items. Items can also be closed from the [Item Sliding](../../item-sliding/ItemSliding).
|
||||
Returns a boolean value of whether it closed an item or not.
|
||||
|
||||
|
||||
#### getOpenedItem()
|
||||
#### getOpenItem()
|
||||
|
||||
Get the [Item Sliding](../../item-sliding/ItemSliding) that is currently opene.
|
||||
|
||||
|
||||
#### setOpenedItem()
|
||||
#### setOpenItem()
|
||||
|
||||
Set an [Item Sliding](../../item-sliding/ItemSliding) as the open item.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user