mall-uniapp/uni_modules/z-paging/global.d.ts

724 lines
24 KiB
TypeScript
Raw Permalink Normal View History

type _Arrayable<T> = T | T[];
declare global {
/**
* z-paging
*
* @since 2.5.3
*/
interface ZPagingReturnData<T> {
/**
*
*/
totalList: T[];
/**
*
*/
noMore: boolean;
}
/**
* [list](https://uniapp.dcloud.net.cn/component/list.html)
*
* @since 2.0.4
*/
interface ZPagingSetSpecialEffectsArgs {
/**
* listidscroller
*/
id?: string;
/**
* headerscroller
* - Android
*
* @default 0
*/
headerHeight?: number;
}
/**
* z-paging
*/
interface ZPagingInstance<T = any> {
/**
* pageNo
*
* @param [animate=false]
*/
reload: (animate?: boolean) => Promise<ZPagingReturnData<T>>;
/**
* pageNopageSize
*
* @since 2.0.4
*/
refresh: () => Promise<ZPagingReturnData<T>>;
/**
*
*
* @since 2.5.9
* @param page
*/
refreshToPage: (page: number) => Promise<ZPagingReturnData<T>>;
/**
*
* - completepageSize
*
* @param [data]
* @param [success=true]
*/
complete: (data?: T[] | false, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* - total
*
* @since 2.0.6
* @param data
* @param total
* @param [success=true]
*/
completeByTotal: (data: T[], total: number, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* -
*
* @since 1.9.2
* @param data
* @param noMore
* @param [success=true]
*/
completeByNoMore: (data: T[], noMore: boolean, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* - z-paging
*
* @since 2.6.3
* @param cause
*/
completeByError: (cause: string) => Promise<ZPagingReturnData<T>>;
/**
*
* -
*
* @since 1.6.4
* @param data
* @param key dataKey:data-key
* @param [success=true]
*/
completeByKey: (data: T[], key: string, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
* pageNo
*
* @since 2.1.0
*/
clear: () => void;
/**
* pageNopageSize
*
* @param data
* @param [scrollToTop=true] true
* @param [animate=true] 使
*/
addDataFromTop: (data: _Arrayable<T>, scrollToTop?: boolean, animate?: boolean) => void;
/**
* pageNopageSize
* - z-paging
*
* @param data
*/
resetTotalData: (data: T[]) => void;
/**
*
*
* @since 2.1.0
*/
endRefresh: () => void;
/**
* view
* - 使slot="refresher"view
*
* @since 2.6.1
*/
updateCustomRefresherHeight: () => void;
/**
*
*
* @since 2.7.7
*/
closeF2: () => void;
/**
*
* - 使z-pagingscroll-viewz-pagingonReachBottom
*
* @param [source]
*/
doLoadMore: (source?: "click" | "toBottom") => void;
/**
* 使onPageScrollz-pagingpageScrollTop
* - mixins
*
* @param scrollTop pageonPageScrollscrollTop
*/
updatePageScrollTop: (scrollTop: number) => void;
/**
* 使slot="top"使slot="top"view
*/
updatePageScrollTopHeight: () => void;
/**
* 使slot="bottom"使slot="bottom"view
*/
updatePageScrollBottomHeight: () => void;
/**
* slot="left"slot="right"slot="left"slot="right"
*
* @since 2.3.5
*/
updateLeftAndRightWidth: () => void;
/**
* fixedz-pagingonShowiOS+h5+tabbar+fixed+tabbartabbar
*
* @since 2.6.5
*/
updateFixedLayout: () => void;
/**
* 使item
*
* @since 2.5.9
* @param item
* @param index cell2itemlistindex=10
*/
doInsertVirtualListItem: (item: T, index: number) => void;
/**
* 使cell
* - cell
*
* @since 2.4.0
* @param index cell0
*/
didUpdateVirtualListCell: (index: number) => void;
/**
* 使item
*
* @since 2.4.0
* @param index cell0
*/
didDeleteVirtualListCell: (index: number) => void;
/**
*
*
* @since 2.7.10
*/
updateVirtualListRender: () => void;
/**
* ()z-paging
* - @query
*
* @param data
* @param [success=true]
*/
setLocalPaging: (data: T[], success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
*/
doChatRecordLoadMore: () => void;
/**
* use-chat-record-modetrue
*
* @param data
* @param [scrollToBottom=true]
* @param [animate=true] 使
*/
addChatRecordData: (data: _Arrayable<T>, scrollToBottom?: boolean, animate?: boolean) => void;
/**
*
*
* @param [animate=true]
*/
scrollToTop: (animate?: boolean) => void;
/**
*
*
* @param [animate=true]
*/
scrollToBottom: (animate?: boolean) => void;
/**
* view
* - vue使scrollIntoViewByNodeTop
*
* @param id viewid"#"
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewById: (id: string, offset?: number, animate?: boolean) => void;
/**
* view
* - vue
*
* @since 1.7.4
* @param top viewtop(uni.createSelectorQuery())
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByNodeTop: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - vue
* - scrollIntoViewByNodeTopscrollToYviewtopscrollIntoViewByNodeToptopuni.createSelectorQuery()top
*
* @param top viewtoppx
* @param [offset=0] px
* @param [animate=false]
*/
scrollToY: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - nvue
* - nvuecell :ref="`z-paging-${index}`"
*
* @param index viewindex()
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByIndex: (index: number, offset?: number, animate?: boolean) => void;
/**
* view
* - nvue
*
* @param view view(this.$refs.xxx)
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByView: (view: any, offset?: number, animate?: boolean) => void;
/**
* nvue ListspecialEffects
*
* @since 2.0.4
* @param args https://uniapp.dcloud.io/component/list?id=listsetspecialeffects
*/
setSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
/**
* {@link setSpecialEffects}
*
* @since 2.0.4
*/
setListSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
/**
* v-modellistpageSizelist
*
* @since 2.3.9
*/
updateCache: () => void;
/**
*
*/
getVersion: () => string;
}
/**
* z-paging
* - uni.$zp
*
* @since 2.6.5
*/
interface ZPagingGlobal {
/**
*
*/
config: Record<string, any>;
}
/**
*
*
* @since 2.7.7
*/
type ZPagingVirtualItem<T> = T & {
/**
*
*/
zp_index: number;
};
namespace ZPagingEvent {
/**
* query0. 1.reload 2.refresh 3.
*/
type _QueryFrom = 0 | 1 | 2 | 3;
/**
*
*
* @param pageNo
* @param pageSize
* @param from query0. 1.reload 2.refresh 3.
*/
interface Query {
(pageNo: number, pageSize: number, from: _QueryFrom): void;
}
/**
*
*
* @param list
*/
interface ListChange {
(list: []): void;
}
/**
* 0- 1. 2. 3.(:refresher-complete-delay="200")
*/
type _RefresherStatus = 0 | 1 | 2 | 3;
/**
*
* - use-custom-refresherfalse
*
* @param status 0- 1. 2. 3.(:refresher-complete-delay="200")
*/
interface RefresherStatusChange {
(status: _RefresherStatus): void;
}
/**
*
* - use-custom-refresherfalsenvue
*
* @param y y(px)
*/
interface RefresherTouchstart {
(y: number): void;
}
/**
* touchmove
*/
interface _RefresherTouchmoveInfo {
/** 下拉的距离 */
pullingDistance: number;
/** 前后两次回调滑动距离的差值 */
dy: number;
/** refresh组件高度 */
viewHeight: number;
/** pullingDistance/viewHeight的比值 */
rate: number;
}
/**
*
* - use-custom-refresherfalse
* - 使wxswxsjsz-paging@refresherTouchmovewxsjsQQ$listeners:watch-refresher-touchmove="true"使
*
* @param info touchmove
*/
interface RefresherTouchmove {
(info: _RefresherTouchmoveInfo): void;
}
/**
*
* - use-custom-refresherfalsenvue
*
* @param y y(px)
*/
interface RefresherTouchend {
(y: number): void;
}
/**
* go- close-
*/
type _RefresherF2ChangeStatus = 'go' | 'close';
/**
*
*
* @since 2.7.7
* @param status go- close-
*/
interface RefresherF2Change {
(status: _RefresherF2ChangeStatus): void;
}
/**
*
*/
interface OnRefresh {
(): void;
}
/**
*
*/
interface OnRestore {
(): void;
}
/**
* 0- 1. 2. 3.
*/
type _LoadingStatus = 0 | 1 | 2 | 3;
/**
*
*
* @param status 0- 1. 2. 3.
*/
interface LoadingStatusChange {
(status: _LoadingStatus): void;
}
/**
* reloadreloadhandler(false)
*/
type _EmptyViewReloadHandler = (value: boolean) => void;
/**
*
*
* @since 1.8.0
* @param handler reloadreloadhandler(false)
*/
interface EmptyViewReload {
(handler: _EmptyViewReloadHandler): void;
}
/**
* view
*
* @since 2.3.3
*/
interface EmptyViewClick {
(): void;
}
/**
*
*
* @since 2.5.0
* @param isLoadFailed true
*/
interface IsLoadFailedChange {
(isLoadFailed: boolean): void;
}
/**
* handler(false)
*/
type _BackToTopClickHandler = (value: boolean) => void;
/**
*
*
* @since 2.6.1
* @param handler handler(false)
*/
interface BackToTopClick {
(handler: _BackToTopClickHandler): void;
}
/**
* +
* -nvue
*
* @since 2.2.7
* @param list
*/
interface VirtualListChange {
(list: []): void;
}
/**
* 使cell
*/
interface _InnerCellClickInfo<T> {
/** 当前点击的item */
item: T;
/** 当前点击的index */
index: number;
}
/**
* 使cell
* -nvue
*
* @since 2.4.0
* @param info cell
*/
interface InnerCellClick {
(info: _InnerCellClickInfo<any>): void;
}
/**
*
*
* @since 2.3.6
*/
interface HidedKeyboard {
(): void;
}
/**
*
*/
interface _KeyboardHeightInfo {
/** 键盘的高度 */
height: number;
}
/**
*
* -uni.onKeyboardHeightChangez-pagingps:H5
*
* @since 2.7.1
* @param info
*/
interface KeyboardHeightChange {
(info: _KeyboardHeightInfo): void;
}
/**
* (vue)
*/
interface _ScrollInfo {
detail: {
scrollLeft: number;
scrollTop: number;
scrollHeight: number;
scrollWidth: number;
deltaX: number;
deltaY: number;
}
}
/**
* (nvue)
*/
interface _ScrollInfoN {
contentSize: {
width: number;
height: number;
};
contentOffset: {
x: number;
y: number;
};
isDragging: boolean;
}
/**
*
*
* @param event vue使_ScrollInfonvue使_ScrollInfoN
*/
interface Scroll {
(event: _ScrollInfo | _ScrollInfoN): void;
}
/**
* scrollTop使scrollTop使
*
* @param scrollTop
*/
interface ScrollTopChange {
(scrollTop: number): void;
}
/**
* scroll-view(toBottomclickview)
*/
type _ScrolltolowerFrom = 'toBottom' | 'click';
/**
* scroll-view
*
* @param from (toBottomclickview)
*/
interface Scrolltolower {
(from: _ScrolltolowerFrom): void;
}
/**
* scroll-view
*/
interface Scrolltoupper {
(): void;
}
/**
*
*/
interface _ScrollendEvent {
contentSize: {
width: number;
height: number;
};
contentOffset: {
x: number;
y: number;
};
isDragging: boolean;
}
/**
* list
* -nvue
*
* @since 2.7.3
* @param event
*/
interface Scrollend {
(event: _ScrollendEvent): void;
}
/**
* z-paging
*
* @since 2.1.3
* @param height
*/
interface ContentHeightChanged {
(height: number): void;
}
/**
* top(scrollTop)bottom(scrollTop)
*/
type _TouchDirection = 'top' | 'bottom';
/**
*
*
* @since 2.3.0
* @param direction top(scrollTop)bottom(scrollTop)
*/
interface TouchDirectionChange {
(direction: _TouchDirection): void;
}
}
}
export {};