uni-ui-plus
Version:
🦄基于uni-ui的二次封装的uniapp组件库
431 lines (420 loc) • 12.7 kB
text/typescript
import { ButtonOnGetphonenumberEvent, ButtonOnErrorEvent, ButtonOnOpensettingEvent, ButtonOnLaunchappEvent, ButtonOnChooseavatarEvent, ButtonOnAgreeprivacyauthorizationEvent, ButtonOnAddgroupappEvent, ButtonOnChooseaddressEvent, ButtonOnChooseinvoicetitleEvent, ButtonOnSubscribeEvent, ButtonOnLoginEvent, ScrollViewProps, ScrollViewOnRefresherpulling, ScrollViewOnScrollEvent, ImageMode } from '@uni-helper/uni-app-types';
import * as vue from 'vue';
import { ExtractPropTypes, PropType } from 'vue';
import { ComponentResolver } from '@uni-helper/vite-plugin-uni-components';
declare const buttonProps: {
/**
* @description 打开公众号资料卡时,传递的号码 openType="openPublicProfile"时有效
*/
readonly publicId: StringConstructor;
/**
* @description 客服的抖音号,openType="im"时有效
*/
readonly dataImId: StringConstructor;
/**
* @description IM卡片类型,openType="im"时有效
*/
readonly dataImType: StringConstructor;
/**
* @description 商品的id,仅支持泛知识课程库和生活服务商品库中的商品,openType="im"时有效
*/
readonly dataGoodsId: StringConstructor;
/**
* @description 订单的id,仅支持交易2.0订单, openType="im"时有效
*/
readonly dataOrderId: StringConstructor;
/**
* @description 商品类型,“1”代表生活服务,“2”代表泛知识。openType="im"时有效
*/
readonly dataBizLine: StringConstructor;
};
type ButtonProps = ExtractPropTypes<typeof buttonProps>;
declare const buttonEmits: {
getphonenumber: (evt: ButtonOnGetphonenumberEvent) => boolean;
getuserinfo: (evt: any) => boolean;
error: (evt: ButtonOnErrorEvent) => boolean;
opensetting: (evt: ButtonOnOpensettingEvent) => boolean;
launchapp: (evt: ButtonOnLaunchappEvent) => boolean;
contact: (evt: any) => boolean;
chooseavatar: (evt: ButtonOnChooseavatarEvent) => boolean;
agreeprivacyauthorization: (evt: ButtonOnAgreeprivacyauthorizationEvent) => boolean;
addgroupapp: (evt: ButtonOnAddgroupappEvent) => boolean;
chooseaddress: (evt: ButtonOnChooseaddressEvent) => boolean;
chooseinvoicetitle: (evt: ButtonOnChooseinvoicetitleEvent) => boolean;
subscribe: (evt: ButtonOnSubscribeEvent) => boolean;
login: (evt: ButtonOnLoginEvent) => boolean;
im: (evt: any) => boolean;
};
type ButtonEmits = typeof buttonEmits;
interface ListObj<T> {
loading: boolean;
finished: boolean;
refreshing: boolean;
list: T[];
total?: number;
}
interface SkeletonObj {
num?: number;
rows?: number;
gridCol?: number;
}
declare const listProps: {
/**
* @description 是否需要设置高度为全屏
* @default false
*/
readonly isNeedHFull: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 是否需要显示空状态
* @default true
*/
readonly isNeedEmpty: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 空状态是否需要居中显示
* @default true
*/
readonly isNeedEmptyCenter: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 空状态是否需要底部内边距
* @default true
*/
readonly isNeedEmptyPb: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 空状态的顶部内边距
* @default undefined
*/
readonly emptyTop: {
readonly type: StringConstructor;
readonly default: undefined;
};
/**
* @description 空状态对象
* @default undefined
*/
readonly emptyObj: {
readonly type: PropType<any>;
readonly default: undefined;
};
/**
* @description 列表数据对象,包含加载状态、完成状态、刷新状态、列表数据和总数等信息
* @required
*/
readonly listObj: {
readonly type: PropType<ListObj<any>>;
readonly required: true;
};
/**
* @description 骨架屏配置对象,包含骨架屏数量、行数和网格列数等信息
* @default { num: 1, rows: 3, gridCol: 1 }
*/
readonly skeletonObj: {
readonly type: PropType<SkeletonObj>;
readonly default: () => {
num: number;
rows: number;
gridCol: number;
};
};
/**
* @description 滚动视图的属性配置,排除了 'loading'、'finished' 和 'onLoad' 属性
* @default { scrollY: true, scrollX: false, refresherEnabled: true, refresherThreshold: 100, refresherBackground: "transparent" }
*/
readonly scrollViewProps: {
readonly type: PropType<Partial<Omit<ScrollViewProps, "loading" | "finished" | "onLoad">>>;
readonly default: () => {
scrollY: boolean;
scrollX: boolean;
refresherThreshold: number;
refresherBackground: string;
};
};
/**
* @description 虚拟列表配置对象,包含是否启用虚拟列表、项高度、容器高度、底部 loading 骨架高度等
* @default { enabled: false, itemHeight: 50, containerHeight: undefined, loadingHeight: 100 }
*/
readonly virtualListProps: {
readonly type: PropType<{
enabled?: boolean;
itemHeight?: number;
containerHeight?: number;
loadingHeight?: number;
}>;
readonly default: () => {
enabled: boolean;
itemHeight: number;
containerHeight: undefined;
loadingHeight: number;
};
};
/**
* @description 是否启默认列表模式(只针对非虚拟列表)
* @default false
*/
readonly isListMode: {
readonly type: BooleanConstructor;
readonly default: false;
};
};
type ListProps = ExtractPropTypes<typeof listProps>;
type ListEmits = {
(e: 'update:listObj', data: ListObj<any>): void;
(e: 'onRefresh'): void;
(e: 'onLoad'): void;
(e: 'onPulling', data: ScrollViewOnRefresherpulling): void;
(e: 'onScroll', data: ScrollViewOnScrollEvent): void;
};
declare const skeletonProps: {
/**
* @description 骨架屏类型
*/
readonly type: {
type: PropType<"title" | "avatar">;
default: "title" | "avatar";
};
/**
* @description 是否禁用刷新功能
* @default false
*/
readonly loading: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 是否开启骨架屏
* @default false
*/
readonly animate: {
readonly type: BooleanConstructor;
readonly default: true;
};
/**
* @description 头像形状
* @default "circle"
*/
readonly avatarShape: {
type: PropType<"circle" | "square">;
default: "circle" | "square";
};
/**
* @description 头像大小
* @default 60
*/
readonly avatarSize: {
readonly type: PropType<number | string>;
readonly default: 60;
};
/**
* @description 标题高度
* @default 36
*/
readonly titleHeight: {
readonly type: PropType<number | string>;
readonly default: 36;
};
/**
* @description 标题宽度
* @default "100%"
*/
readonly titleWidth: {
readonly type: PropType<number | string>;
readonly default: "100%";
};
/**
* @description 行数
* @default 3
*/
readonly rows: {
readonly type: NumberConstructor;
readonly default: 3;
};
};
type SkeletonProps = ExtractPropTypes<typeof skeletonProps>;
declare const imageProps: {
readonly mode: {
readonly type: PropType<ImageMode>;
readonly default: "scaleToFill";
};
readonly width: {
readonly type: PropType<number | string>;
};
readonly height: {
readonly type: PropType<number | string>;
};
readonly delay: {
readonly type: NumberConstructor;
readonly default: 0;
};
readonly radius: {
readonly type: PropType<number | string>;
readonly default: 0;
};
readonly minHeight: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
readonly lazyLoad: {
readonly type: BooleanConstructor;
readonly default: true;
};
readonly customStyle: {
readonly type: StringConstructor;
readonly default: "";
};
readonly round: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly enablePreview: {
readonly type: BooleanConstructor;
readonly default: false;
};
readonly customClass: {
readonly type: StringConstructor;
readonly default: "";
};
readonly src: {
readonly type: StringConstructor;
readonly default: "";
};
readonly previewSrc: {
readonly type: StringConstructor;
readonly default: "";
};
readonly placeholderSrc: {
readonly type: StringConstructor;
readonly default: "";
};
readonly filter: {
readonly type: PropType<number | string>;
readonly default: "";
};
};
type ImageProps = ExtractPropTypes<typeof imageProps>;
interface ImageEmits {
(e: 'onRefresh'): any;
}
/**
* prop type helpers
* help us to write less code and reduce bundle size
* copy from https://github.com/youzan/vant/blob/main/packages/vant/src/utils/props.ts
*/
type ClassType = string | object | Array<ClassType>;
declare const emptyProps: {
/**
* @description 图片类型,可选值为 `empty`、`error`、`network`,支持传入图片 `URL`
*/
image: {
type: vue.PropType<(string & {}) | "empty" | "error" | "network">;
default: (string & {}) | "empty" | "error" | "network";
};
/**
* @description 图片大小,单位为 `px`
*/
imageSize: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
/**
* @description 图片下方的描述文字
*/
description: {
type: vue.PropType<string>;
default: string;
};
customClass: {
type: vue.PropType<ClassType>;
default: string;
};
customStyle: {
type: vue.PropType<vue.StyleValue>;
default: string;
};
};
type EmptyProps = ExtractPropTypes<typeof emptyProps>;
interface WaterfallItem {
[key: string]: any;
index?: number;
id?: string | number;
}
interface ColumnHeight {
column: number;
height: number;
}
interface FlowData {
list: WaterfallItem[];
column: number;
columnSpace: number;
[key: string]: any;
}
declare const waterfallProps: {
/**
* @description 瀑布流数据列表
*/
list: {
type: PropType<WaterfallItem[]>;
default: () => never[];
};
/**
* @description 列数
* @default 2
*/
column: {
type: NumberConstructor;
default: number;
};
/**
* @description 列间距(百分比)
* @default 2
*/
columnSpace: {
type: NumberConstructor;
default: number;
};
/**
* @description 图片字段名
* @default 'imgUrl'
*/
imageField: {
type: StringConstructor;
default: string;
};
/**
* @description 获取图片源的方法
* @default undefined
*/
getImageSrc: {
type: PropType<(item: WaterfallItem) => string>;
default: undefined;
};
/**
* @description 是否根据图片信息排序
* @default false
*/
sortByImgInfo: {
type: BooleanConstructor;
default: boolean;
};
};
type WaterfallProps = ExtractPropTypes<typeof waterfallProps>;
interface WaterfallEmits {
(e: 'load-complete'): void;
(e: 'item-click', item: WaterfallItem, index: number): void;
(e: 'image-load', item: WaterfallItem): void;
(e: 'image-error', item: WaterfallItem): void;
}
declare const waterfallEmits: readonly ["load-complete", "item-click", "image-load", "image-error"];
declare function UpResolver(): ComponentResolver;
export { UpResolver, buttonEmits, buttonProps, emptyProps, imageProps, listProps, skeletonProps, waterfallEmits, waterfallProps };
export type { ButtonEmits, ButtonProps, ColumnHeight, EmptyProps, FlowData, ImageEmits, ImageProps, ListEmits, ListProps, SkeletonProps, WaterfallEmits, WaterfallItem, WaterfallProps };