升级package, 以及更新声明文件
This commit is contained in:
53
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/chat-list.d.ts
vendored
Normal file
53
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/chat-list.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import { SuperComponent, ComponentsOptionsType } from '../../../components/common/src/index';
|
||||
export default class Chat extends SuperComponent {
|
||||
options: ComponentsOptionsType;
|
||||
properties: {
|
||||
virtualList: {
|
||||
type: BooleanConstructor;
|
||||
value: boolean;
|
||||
};
|
||||
fragmentLen: {
|
||||
type: NumberConstructor;
|
||||
value: number;
|
||||
};
|
||||
animation?: {
|
||||
type: StringConstructor;
|
||||
value?: "skeleton" | "moving" | "gradient" | "dot";
|
||||
};
|
||||
data?: {
|
||||
type: ArrayConstructor;
|
||||
value?: import("./type").TdChatItemMeta[];
|
||||
};
|
||||
layout?: {
|
||||
type: StringConstructor;
|
||||
value?: "both" | "single";
|
||||
};
|
||||
reverse?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
};
|
||||
data: {
|
||||
classPrefix: string;
|
||||
scrollViewTop: number;
|
||||
classes: any[];
|
||||
listClasses: any[];
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
};
|
||||
observers: {
|
||||
data(): void;
|
||||
};
|
||||
methods: {
|
||||
setScrollTop(scrollTop?: number): void;
|
||||
scrollToBottom(): void;
|
||||
onScroll(e: any): void;
|
||||
handlerScrollToUpper(): void;
|
||||
handlerScrollToLower(): void;
|
||||
resetFragments(): void;
|
||||
addFragment(count?: number): void;
|
||||
};
|
||||
lifetimes: {
|
||||
created(): void;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-chat-list`;let Chat=class extends SuperComponent{constructor(){super(...arguments),this.options={multipleSlots:!0},this.properties=Object.assign(Object.assign({},props),{virtualList:{type:Boolean,value:!1},fragmentLen:{type:Number,value:8}}),this.data={classPrefix:name,scrollViewTop:0,classes:[],listClasses:[],startIndex:0,endIndex:0},this.observers={data(){const t=this.properties.data.length;this.properties.virtualList&&this.oldDataLen!==t&&(this.oldDataLen=t,this.resetFragments())}},this.methods={setScrollTop(t=0){t===this.data.scrollViewTop&&(t-=1),this.setData({scrollViewTop:t})},scrollToBottom(){this.setScrollTop()},onScroll(t){this.triggerEvent("scroll",t)},handlerScrollToUpper(){!this.properties.reverse&&this.properties.virtualList&&this.addFragment()},handlerScrollToLower(){this.properties.reverse&&this.properties.virtualList&&this.addFragment()},resetFragments(){const t=this.properties.data.length;if(t){const{fragmentLen:e}=this.properties;this.properties.reverse?this.setData({startIndex:0,endIndex:Math.min(t-1,e-1)}):this.setData({startIndex:Math.max(t-e,0),endIndex:Math.max(t-1,0)})}},addFragment(t=4){const e=this.properties.data.length;e&&(this.properties.reverse?this.setData({endIndex:Math.min(e-1,this.data.endIndex+t)}):this.setData({startIndex:Math.max(this.data.startIndex-t,0)}))}},this.lifetimes={created(){this.data.setScrollTop=this.setScrollTop.bind(this),this.data.scrollToBottom=this.scrollToBottom.bind(this)}}}};Chat=__decorate([wxComponent()],Chat);export default Chat;
|
||||
@@ -0,0 +1 @@
|
||||
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"chat-message":"../chat-message/chat-message"}}
|
||||
@@ -0,0 +1 @@
|
||||
<wxs src="../common/utils.wxs" module="_"/><view class="class {{classPrefix}} {{[classes]}}" style="{{_._style([style, customStyle])}}"><scroll-view class="{{_.cls(classPrefix + '__content', [['reverse' , reverse]])}}" scroll-y="{{true}}" enable-flex="{{true}}" enhanced="{{true}}" scroll-with-animation="{{true}}" scroll-top="{{scrollViewTop}}" data-ref="chatListRef" bindscroll="onScroll" bindscrolltoupper="handlerScrollToUpper" bindscrolltolower="handlerScrollToLower"><block wx:if="{{reverse}}"><view class="placeholder"></view></block><block wx:if="{{data.length > 0}}"><block wx:for="{{data}}" wx:for-index="index" wx:for-item="item" wx:key="index"><chat-message wx:if="{{virtualList ? index >= startIndex && index <= endIndex : true}}" avatar="{{item.avatar || ''}}" name="{{item.name || ''}}" datetime="{{item.datetime || ''}}" content="{{item.content}}" role="{{item.role}}" placement="{{ layout === 'both' ? (item.role === 'user' ? 'right' : 'left') : 'left' }}" animation="{{animation}}" status="{{item.status || ''}}"/></block></block><slot wx:else/></scroll-view><view class="{{classPrefix}}__footer"><slot name="footer"/></view></view>
|
||||
@@ -0,0 +1,5 @@
|
||||
@import '../common/style/index.wxss';.t-chat-list{display:flex;flex-direction:column;height:100%;width:100%;color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));}
|
||||
.t-chat-list__content{flex:1;overflow-y:auto;overflow-x:hidden;width:100%;}
|
||||
.t-chat-list__content--reverse{display:flex;flex-direction:column;transform:scaleY(-1);}
|
||||
.t-chat-list__content--reverse::-webkit-scrollbar{transform:scaleY(-1);}
|
||||
.t-chat-list__content .placeholder{flex-grow:1;flex-shrink:1;}
|
||||
3
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/props.d.ts
vendored
Normal file
3
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdChatListProps } from './type';
|
||||
declare const props: TdChatListProps;
|
||||
export default props;
|
||||
@@ -0,0 +1 @@
|
||||
const props={animation:{type:String,value:"skeleton"},data:{type:Array},layout:{type:String,value:"both"},reverse:{type:Boolean,value:!0}};export default props;
|
||||
26
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/type.d.ts
vendored
Normal file
26
miniprogram/miniprogram_npm/tdesign-miniprogram/chat-list/type.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface TdChatListProps {
|
||||
animation?: {
|
||||
type: StringConstructor;
|
||||
value?: 'skeleton' | 'moving' | 'gradient' | 'dot';
|
||||
};
|
||||
data?: {
|
||||
type: ArrayConstructor;
|
||||
value?: Array<TdChatItemMeta>;
|
||||
};
|
||||
layout?: {
|
||||
type: StringConstructor;
|
||||
value?: 'both' | 'single';
|
||||
};
|
||||
reverse?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
}
|
||||
export interface TdChatItemMeta {
|
||||
avatar?: string;
|
||||
name?: string;
|
||||
role?: string;
|
||||
datetime?: string;
|
||||
content?: string;
|
||||
status?: string;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export{};
|
||||
Reference in New Issue
Block a user