acdr/acdr-admin/yskj-ui/yskj-ui-mall-uniapp/uni_modules/z-paging/global.d.ts

724 lines
24 KiB
TypeScript
Raw Permalink Normal View History

2024-09-05 14:05:15 +08:00
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 {
/**
* list同时滚动的组件idscroller
*/
id?: string;
/**
* header顶部距离scroller顶部的距离
* - Android暂不支持
*
* @default 0
*/
headerHeight?: number;
}
/**
* z-paging组件实例
*/
interface ZPagingInstance<T = any> {
/**
* pageNo恢复为默认值
*
* @param [animate=false]
*/
reload: (animate?: boolean) => Promise<ZPagingReturnData<T>>;
/**
* pageNo和pageSize不会重置
*
* @since 2.0.4
*/
refresh: () => Promise<ZPagingReturnData<T>>;
/**
*
*
* @since 2.5.9
* @param page
*/
refreshToPage: (page: number) => Promise<ZPagingReturnData<T>>;
/**
*
* - complete传进去的数组长度小于pageSize时
*
* @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;
/**
* pageNo和pageSize
*
* @param data
* @param [scrollToTop=true] true
* @param [animate=true] 使
*/
addDataFromTop: (data: _Arrayable<T>, scrollToTop?: boolean, animate?: boolean) => void;
/**
* pageNo和pageSize
* - 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-paging未确定高度时scroll-view会无限增高z-paging无法得知是否滚动到底部onReachBottom中手动调用此方法触发上拉加载更多
*
* @param [source]
*/
doLoadMore: (source?: "click" | "toBottom") => void;
/**
* 使onPageScroll中调用此方法z-paging当前的pageScrollTop
* - mixins
*
* @param scrollTop page的onPageScroll中获取的scrollTop
*/
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;
/**
* fixed模式下z-paging的布局onShow时候调用iOS+h5+tabbar+fixed+tabbar页面跳转到无tabbar页面后返回
*
* @since 2.6.5
*/
updateFixedLayout: () => void;
/**
* 使item
*
* @since 2.5.9
* @param item
* @param index cell位置2item在原list的index=10
*/
doInsertVirtualListItem: (item: T, index: number) => void;
/**
* 使cell的缓存高度
* - cell高度在初始化之后再次改变时调用
*
* @since 2.4.0
* @param index cell在列表中的位置0
*/
didUpdateVirtualListCell: (index: number) => void;
/**
* 使item
*
* @since 2.4.0
* @param index cell在列表中的位置0
*/
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-mode为true时有效
*
* @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 view的id值"#"
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewById: (id: string, offset?: number, animate?: boolean) => void;
/**
* view
* - vue中有效
*
* @since 1.7.4
* @param top view的top值(uni.createSelectorQuery())
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByNodeTop: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - vue中有效
* - scrollIntoViewByNodeTop的不同之处在于scrollToY传入的是view相对于屏幕的top值scrollIntoViewByNodeTop传入的top值并非是固定的uni.createSelectorQuery()top会因列表滚动而改变
*
* @param top view的top值px
* @param [offset=0] px
* @param [animate=false]
*/
scrollToY: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - nvue或虚拟列表中有效
* - 在nvue中的cell必须设置 :ref="`z-paging-${index}`"
*
* @param index view的index()
* @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 List的specialEffects
*
* @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-model绑定的list中的前pageSize条覆盖缓存list数据更新到预期结果后再调用此方法
*
* @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 {
/**
* query的触发来源0. 1.reload触发 2.refresh触发 3.
*/
type _QueryFrom = 0 | 1 | 2 | 3;
/**
*
*
* @param pageNo
* @param pageSize
* @param from query的触发来源0. 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-refresher为false时无效
*
* @param status 0- 1. 2. 3.(:refresher-complete-delay="200")
*/
interface RefresherStatusChange {
(status: _RefresherStatus): void;
}
/**
*
* - use-custom-refresher为false时无效nvue无效
*
* @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-refresher为false时无效
* - 使wxs的平台上wxs与js通信折损z-paging添加@refresherTouchmove时wxs才会实时将下拉拖动事件传给jsQQ小程序中$listeners无效所以必须设置:watch-refresher-touchmove="true"使
*
* @param info touchmove信息
*/
interface RefresherTouchmove {
(info: _RefresherTouchmoveInfo): void;
}
/**
*
* - use-custom-refresher为false时无效nvue无效
*
* @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;
}
/**
* reload操作reload事件handler(false)
*/
type _EmptyViewReloadHandler = (value: boolean) => void;
/**
*
*
* @since 1.8.0
* @param handler reload操作reload事件handler(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.onKeyboardHeightChange监听z-paging内置的键盘高度改变监听失效ps: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滚动底部时的来源(toBottom滚动到底部click点击了加载更多view)
*/
type _ScrolltolowerFrom = 'toBottom' | 'click';
/**
* scroll-view滚动底部时触发
*
* @param from (toBottom滚动到底部click点击了加载更多view)
*/
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 {};