Skip to content

Commit 6e40d6b

Browse files
committed
Merge branch 'feature/chat' of https://github.com/Tencent/tdesign-miniprogram into feature/chat
2 parents 40de2e2 + 7dec377 commit 6e40d6b

File tree

76 files changed

+838
-921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+838
-921
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
**/*.wxs
22
miniprogram_dist
33
node_modules
4+
5+
# special files
6+
echarts.js

.github/workflows/typos-config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ nd = "nd"
99
loosing = "loosing"
1010

1111
[files]
12-
extend-exclude = ["CHANGELOG*.md", "changelog.json"]
12+
extend-exclude = ["CHANGELOG*.md", "changelog.json", "echarts.js"]

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"build:assets": "cross-env NODE_ENV=production gulp assets:build --gulpfile script/gulpfile.dist.js --cwd ./",
2020
"update:icons": "pnpm -C packages/tdesign-miniprogram/site update:icons",
2121
"update:css": "pnpm -C packages/tdesign-miniprogram/site update:css",
22-
"lintfix": "eslint '{packages/components,packages/tdesign-miniprogram/example}/**/*.{js,ts}' --fix",
23-
"lint": "eslint '{packages/components,packages/tdesign-miniprogram/example}/**/*.{js,ts}'",
24-
"format": "prettier {packages/components,packages/tdesign-miniprogram/example,script}/**/*.{js,ts,wxss,less,wxml,html,json,md,wxs} --write",
22+
"lintfix": "eslint '{packages/components,packages/pro-components,packages/tdesign-miniprogram/example}/**/*.{js,ts}' --fix",
23+
"lint": "eslint '{packages/components,packages/pro-components,packages/tdesign-miniprogram/example}/**/*.{js,ts}'",
24+
"format": "prettier {packages/components,packages/pro-components,packages/tdesign-miniprogram/example,script}/**/*.{js,ts,wxss,less,wxml,html,json,md,wxs} --write",
2525
"site": "pnpm -C packages/tdesign-miniprogram/site site",
2626
"site:dev": "pnpm -C packages/tdesign-miniprogram/site site:dev",
2727
"site:prerender": "pnpm -C packages/tdesign-miniprogram/site site:prerender",
@@ -119,4 +119,4 @@
119119
"eslint --fix"
120120
]
121121
}
122-
}
122+
}

packages/components/form-item/form-item.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { validate, ValidateStatus } from './form-model';
33
import config from '../common/config';
44
import { SuperComponent, wxComponent, RelationsOptions } from '../common/src/index';
55

6-
76
const { prefix } = config;
87
const name = `${prefix}-form-item`;
98

109
@wxComponent()
1110
export default class FormItem extends SuperComponent {
1211
externalClasses = [
13-
1412
`${prefix}-class`,
1513
`${prefix}-class-label`,
1614
`${prefix}-class-controls`,
@@ -21,7 +19,6 @@ export default class FormItem extends SuperComponent {
2119
properties = props as any;
2220

2321
data = {
24-
2522
prefix,
2623
classPrefix: name,
2724
errorList: [],
@@ -36,7 +33,6 @@ export default class FormItem extends SuperComponent {
3633
};
3734

3835
relations: RelationsOptions = {
39-
4036
'../form/form': {
4137
type: 'parent',
4238
linked(target) {
@@ -78,7 +74,6 @@ export default class FormItem extends SuperComponent {
7874
};
7975

8076
lifetimes = {
81-
8277
ready() {
8378
this.initFormItem();
8479
},
@@ -90,7 +85,6 @@ export default class FormItem extends SuperComponent {
9085
};
9186

9287
methods = {
93-
9488
// 处理描述信息链接点击事件
9589
handlePreviewImage(e) {
9690
const { url } = e.currentTarget.dataset;
@@ -272,4 +266,3 @@ export default class FormItem extends SuperComponent {
272266
},
273267
};
274268
}
275-

packages/components/form-item/props.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const props: TdFormItemProps = {
1919
/** 表单项说明内容 */
2020
help: {
2121
type: String,
22-
2322
},
2423
/** 字段标签名称 */
2524
label: {
@@ -52,7 +51,6 @@ const props: TdFormItemProps = {
5251
showErrorMessage: {
5352
type: null,
5453
value: undefined,
55-
5654
},
5755
};
5856

packages/components/form/_example/horizontal/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ Component({
206206
},
207207

208208
onRemove(e) {
209-
const {index} = e.detail;
210-
const {photo} = this.data.formData;
209+
const { index } = e.detail;
210+
const { photo } = this.data.formData;
211211
photo.splice(index, 1);
212212
this.setData({
213213
'formData.photo': photo,

packages/components/form/_example/vertical/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ Component({
202202
},
203203

204204
onRemove(e) {
205-
const {index} = e.detail;
206-
const {photo} = this.data.formData;
205+
const { index } = e.detail;
206+
const { photo } = this.data.formData;
207207
photo.splice(index, 1);
208208
this.setData({
209209
'formData.photo': photo,

packages/components/upload/__test__/__snapshots__/demo.test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ exports[`Upload Upload multiple demo works fine 1`] = `
9797
class="wrapper"
9898
>
9999
<t-upload
100+
disabled="{{true}}"
100101
files="{{
101102
Array [
102103
Object {

packages/pro-components/chat/attachments/attachments.less

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
width: 100%;
2424
height: auto;
2525

26+
// 可滚动内容区域
27+
&__scrollable {
28+
height: 100%;
29+
display: flex;
30+
align-items: center;
31+
justify-content: flex-start;
32+
}
33+
2634
// 滚动容器样式
2735
.scroll-x {
2836
white-space: nowrap;
@@ -46,39 +54,32 @@
4654
}
4755

4856
// 左侧内容区域
49-
&__left-content {
57+
&__left {
5058
flex: 1;
5159
overflow: hidden;
5260
}
5361

5462
// 文件状态样式
55-
&__file-status {
56-
position: absolute;
57-
width: 100%;
58-
height: 100%;
59-
top: 0;
60-
left: 0;
61-
border-radius: @radius-extraLarge;
62-
display: flex;
63-
flex-direction: column;
64-
align-items: center;
65-
justify-content: center;
66-
67-
.icon {
68-
// 图标样式
63+
&__file {
64+
&--pending,
65+
&--fail,
66+
&--error,
67+
&--success {
68+
position: absolute;
69+
width: 100%;
70+
height: 100%;
71+
top: 0;
72+
left: 0;
73+
border-radius: @radius-extraLarge;
74+
display: flex;
75+
flex-direction: column;
76+
align-items: center;
77+
justify-content: center;
6978
}
7079
}
7180

72-
// 可滚动内容区域
73-
&__scrollable-content {
74-
height: 100%;
75-
display: flex;
76-
align-items: center;
77-
justify-content: flex-start;
78-
}
79-
8081
// 文件包装器
81-
&__file-wrap {
82+
&__files {
8283
box-sizing: border-box;
8384
margin-left: @attachments-file-margin;
8485

@@ -96,7 +97,7 @@
9697
background-color: @attachments-background-color;
9798

9899
// 删除按钮样式
99-
.cancel {
100+
.@{attachments}__remove {
100101
color: @text-color-primary;
101102
position: absolute;
102103
right: -4px;
@@ -141,7 +142,7 @@
141142
}
142143
}
143144

144-
.content {
145+
.@{attachments}__content {
145146
flex: 1;
146147
overflow: hidden;
147148
display: flex;
@@ -150,7 +151,7 @@
150151
justify-content: center;
151152
margin-left: @attachments-file-margin;
152153

153-
.title {
154+
.@{attachments}__title {
154155
width: 100%;
155156
color: @attachments-title-color;
156157
font-size: @attachments-title-font-size;
@@ -166,7 +167,7 @@
166167
padding: 0;
167168
}
168169

169-
.desc {
170+
.@{attachments}__desc {
170171
width: 100%;
171172
color: @attachments-desc-color;
172173
font-size: @attachments-desc-font-size;
@@ -180,7 +181,7 @@
180181
}
181182

182183
// 对话中附件样式覆盖
183-
.inChat {
184+
.@{attachments}--chatting {
184185
.@{attachments}__file {
185186
margin-top: 0;
186187
margin-bottom: @attachments-file-margin;
@@ -218,10 +219,10 @@
218219
border-radius: @radius-extraLarge;
219220
}
220221
}
221-
.@{attachments}__file-wrap {
222+
.@{attachments}__files {
222223
margin-left: 0;
223224
}
224-
.@{attachments}__scrollable-content {
225+
.@{attachments}__scrollable {
225226
display: contents;
226227
}
227228
.file.@{attachments}__file {
@@ -232,7 +233,7 @@
232233

233234
// 右侧布局下的附件样式
234235
.@{prefix}-chat__inner.right {
235-
.inChat {
236+
.@{attachments}--chatting {
236237
.file-image.@{attachments}__file {
237238
text-align: right;
238239
}

packages/pro-components/chat/attachments/attachments.wxml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<wxs src="../../../components/common/utils.wxs" module="_" />
33

44
<view
5-
class="{{[''+classPrefix, inChat ? 'inChat' : '', _this.getFileTypeClass(inChat, files)]}}"
5+
class="{{classPrefix}} {{[inChat ? classPrefix + '--chatting' : '', _this.getFileTypeClass(inChat, files)]}}"
66
style="{{_._style([style, customStyle])}}"
77
>
8-
<view class="{{[classPrefix+'__left-content']}}">
9-
<view class="{{[classPrefix+'__scrollable-content','scroll-x']}}">
8+
<view class="{{classPrefix}}__left">
9+
<view class="{{classPrefix}}__scrollable scroll-x">
1010
<block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index">
11-
<view class="{{[classPrefix+'__file-wrap']}}" bindtap="onFileWrapTap" data-index="{{index}}">
11+
<view class="{{classPrefix}}__files" bindtap="onFileWrapTap" data-index="{{index}}">
1212
<block wx:if="{{item.fileType==='image'}}">
13-
<view class="{{['file-image',classPrefix+'__file']}}">
14-
<block wx:if="{{item.status==='pending'||item.status==='fail'||item.status==='error'}}">
15-
<view class="{{[item.status,classPrefix+'__file-status']}}">
16-
<t-loading theme="circular" size="24px" class="wrapper" />
13+
<view class="file-image {{classPrefix}}__file">
14+
<block wx:if="{{item.status==='pending' || item.status==='fail' || item.status==='error'}}">
15+
<view class="{{item.status}} {{classPrefix}}__file--{{item.status}}">
16+
<t-loading theme="circular" size="48rpx" />
1717
</view>
1818
</block>
1919
<block wx:else>
@@ -29,49 +29,51 @@
2929
<t-icon
3030
catchtap="onRemoveTap"
3131
data-index="{{index}}"
32-
class="cancel"
32+
class="{{classPrefix}}__remove"
3333
name="close-circle-filled"
3434
size="16px"
3535
/>
3636
</block>
3737
</view>
3838
</block>
3939
<block wx:else>
40-
<view class="{{['file',classPrefix+'__file']}}">
40+
<view class="file {{classPrefix}}__file">
4141
<view class="image">
4242
<block wx:if="{{item.status==='pending'}}">
43-
<view class="{{['loading',classPrefix+'__file-status']}}">
44-
<t-loading theme="circular" size="24px" class="wrapper" />
43+
<view class="loading {{classPrefix}}__file--pending">
44+
<t-loading theme="circular" size="48rpx" />
4545
</view>
4646
</block>
4747
<block wx:elif="{{item.status==='fail'}}">
48-
<view class="{{['fail',classPrefix+'__file-status']}}">
49-
<t-loading theme="circular" size="24px" class="wrapper" />
48+
<view class="fail {{classPrefix}}__file--fail">
49+
<t-loading theme="circular" size="48rpx" />
5050
</view>
5151
</block>
5252
<block wx:elif="{{item.status==='error'}}">
53-
<view class="{{['error',classPrefix+'__file-status']}}">
54-
<t-loading theme="circular" size="24px" class="wrapper" />
53+
<view class="error {{classPrefix}}__file--error">
54+
<t-loading theme="circular" size="48rpx" />
5555
</view>
5656
</block>
5757
<block wx:else>
58-
<t-icon name="{{item.fileIcon.name}}" color="{{item.fileIcon.color}}" size="24"></t-icon>
58+
<t-icon name="{{item.fileIcon.name}}" color="{{item.fileIcon.color}}" size="48rpx"></t-icon>
5959
</block>
6060
</view>
61-
<view class="content">
62-
<view class="title">{{item.name}}</view>
61+
<view class="{{classPrefix}}__content">
62+
<view class="{{classPrefix}}__title">{{item.name}}</view>
6363
<block>
64-
<view wx:if="{{item.status==='pending'}}" class="desc">上传中...{{item.progress || 0+"%"}}</view>
65-
<view wx:elif="{{item.status==='fail'}}" class="desc">上传失败</view>
66-
<view wx:elif="{{item.status==='error'}}" class="desc">{{item.errorMessage}}</view>
67-
<view wx:else class="desc">{{item.desc}}</view>
64+
<view wx:if="{{item.status==='pending'}}" class="{{classPrefix}}__desc"
65+
>上传中...{{item.progress || 0+"%"}}</view
66+
>
67+
<view wx:elif="{{item.status==='fail'}}" class="{{classPrefix}}__desc">上传失败</view>
68+
<view wx:elif="{{item.status==='error'}}" class="{{classPrefix}}__desc">{{item.errorMessage}}</view>
69+
<view wx:else class="{{classPrefix}}__desc">{{item.desc}}</view>
6870
</block>
6971
</view>
7072
<block wx:if="{{removable}}">
7173
<t-icon
7274
catchtap="onRemoveTap"
7375
data-index="{{index}}"
74-
class="cancel"
76+
class="{{classPrefix}}__remove"
7577
name="close-circle-filled"
7678
size="16px"
7779
/>

0 commit comments

Comments
 (0)