Skip to content

Commit d25234b

Browse files
committed
feat: sync 2.6.1
1 parent 1a58b0b commit d25234b

Some content is hidden

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

99 files changed

+895
-521
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ const App = () => {
101101
### Development
102102

103103
```bash
104-
cd storybook
104+
cd demo
105105
npm i
106-
npm run storybook
106+
npm run dev
107107
```
108108

109109
## Theme

demo/.gitignore

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
110
node_modules
2-
.DS_Store
311
dist
412
dist-ssr
513
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

demo/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="zh">
33
<head>
44
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
66
<title>ChatUI DEMO</title>
77
</head>
88
<body>
99
<div id="root"></div>
1010
<script type="module" src="/src/main.tsx"></script>
11-
<script src="//dev.g.alicdn.com/chatui/icons/2.0.1/index.js" async=""></script>
11+
<script src="//g.alicdn.com/chatui/icons/2.0.2/index.js" async></script>
1212
</body>
1313
</html>

demo/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
"name": "demo",
33
"version": "0.1.0",
44
"scripts": {
5-
"dev": "vite --host",
5+
"dev": "vite",
66
"build": "tsc && vite build",
7-
"serve": "vite preview"
7+
"preview": "vite preview"
88
},
99
"dependencies": {
1010
"react": "^17.0.2",
1111
"react-dom": "^17.0.2",
12-
"react-router-dom": "^6.3.0"
12+
"react-router-dom": "^6.4.1"
1313
},
1414
"devDependencies": {
15-
"@types/react": "^17.0.45",
15+
"@types/react": "^17.0.50",
1616
"@types/react-dom": "^17.0.17",
1717
"@types/react-router-dom": "^5.3.3",
18-
"@vitejs/plugin-react-refresh": "^1.3.6",
19-
"typescript": "^4.7.3",
20-
"vite": "^2.9.12"
18+
"@vitejs/plugin-react": "^2.1.0",
19+
"typescript": "^4.8.4",
20+
"vite": "^3.1.3"
2121
}
2222
}

demo/src/App.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

demo/src/components/LangSwitcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import locales from '../../../src/components/LocaleProvider/locales';
2+
import locales from '../../../src/components/ConfigProvider/locales';
33

44
interface LangSwitcherProps {
55
value: string;

demo/src/demo/Card.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ export default () => (
9090
<CardText>fluid</CardText>
9191
</Card>
9292
</div>
93+
<div className="demo-row">
94+
<Card fluid="order">
95+
<CardText>fluid=order</CardText>
96+
</Card>
97+
</div>
9398
</DemoSection>
9499
<DemoSection title="按钮竖排">
95100
<Card size="xl">

demo/src/demo/Chat.tsx

Lines changed: 89 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import React from 'react';
2-
import { DemoPage, DemoSection } from '../components';
2+
import { useNavigate } from 'react-router-dom';
33
import Chat, {
44
Bubble,
55
MessageProps,
66
useMessages,
77
QuickReplyItemProps,
88
useQuickReplies,
99
Card,
10+
CardMedia,
1011
CardTitle,
1112
CardText,
13+
CardActions,
14+
Button,
1215
List,
1316
ListItem,
1417
Flex,
1518
FlexItem,
1619
ScrollView,
1720
ToolbarItemProps,
21+
RateActions,
1822
} from '../../../src';
1923
import OrderSelector from './OrdderSelector';
2024

@@ -28,10 +32,24 @@ const initialMessages: MessageWithoutId[] = [
2832
{
2933
type: 'text',
3034
content: { text: 'Hi,我是你的专属智能助理小蜜,有问题请随时找我哦~' },
31-
user: { avatar: '//gw.alicdn.com/tfs/TB1DYHLwMHqK1RjSZFEXXcGMXXa-56-62.svg', name: '小小蜜' },
35+
user: {
36+
avatar: '//gw.alicdn.com/imgextra/i3/O1CN015amSBN287NjjndS06_!!6000000007885-2-tps-99-98.png',
37+
name: '小小蜜',
38+
},
3239
createdAt: Date.now(),
3340
hasTime: true,
3441
},
42+
{
43+
type: 'text',
44+
content: { text: '你好~' },
45+
user: {
46+
avatar: '//gw.alicdn.com/tfs/TB1g6n4xQP2gK0jSZPxXXacQpXa-234-216.png',
47+
name: '小淘',
48+
},
49+
createdAt: Date.now(),
50+
hasTime: true,
51+
position: 'right',
52+
},
3553
{
3654
type: 'guess-you',
3755
},
@@ -42,7 +60,7 @@ const initialMessages: MessageWithoutId[] = [
4260
type: 'text',
4361
content: { text: '小蜜我要查看我的物流信息' },
4462
position: 'right',
45-
user: { avatar: '//gw.alicdn.com/tfs/TB1DYHLwMHqK1RjSZFEXXcGMXXa-56-62.svg' },
63+
user: { avatar: '//gw.alicdn.com/tfs/TB1g6n4xQP2gK0jSZPxXXacQpXa-234-216.png' },
4664
},
4765
{
4866
type: 'image',
@@ -56,6 +74,10 @@ const initialMessages: MessageWithoutId[] = [
5674
text: '由于您长时间未说话或退出小蜜(离开页面、锁屏等)已自动结束本次服务',
5775
},
5876
},
77+
{
78+
type: 'image-text-button',
79+
content: {},
80+
},
5981
];
6082

6183
const defaultQuickReplies = [
@@ -105,7 +127,8 @@ const skillList = [
105127
{ title: '修改地址', desc: '修改地址' },
106128
];
107129

108-
const toolbar = [
130+
// eslint-disable-next-line @typescript-eslint/no-redeclare
131+
const toolbar: ToolbarItemProps[] = [
109132
{
110133
type: 'smile',
111134
icon: 'smile',
@@ -129,7 +152,7 @@ const toolbar = [
129152
{
130153
type: 'photo',
131154
title: 'Photo',
132-
img: 'https://gw.alicdn.com/tfs/TB1eDjNj.T1gK0jSZFrXXcNCXXa-80-80.png',
155+
img: '//gw.alicdn.com/tfs/TB1eDjNj.T1gK0jSZFrXXcNCXXa-80-80.png',
133156
},
134157
];
135158

@@ -139,6 +162,8 @@ export default () => {
139162
const { quickReplies, replace } = useQuickReplies(defaultQuickReplies);
140163
const msgRef = React.useRef(null);
141164

165+
const navigate = useNavigate();
166+
142167
window.appendMsg = appendMsg;
143168
window.msgRef = msgRef;
144169

@@ -154,15 +179,15 @@ export default () => {
154179

155180
setTimeout(() => {
156181
setTyping(true);
157-
}, 10);
182+
}, 1000);
158183

159184
// 模拟回复消息
160185
setTimeout(() => {
161186
appendMsg({
162187
type: 'text',
163188
content: { text: '亲,您遇到什么问题啦?请简要描述您的问题~' },
164189
});
165-
}, 1000);
190+
}, 1500);
166191
}
167192
}
168193

@@ -186,6 +211,7 @@ export default () => {
186211
appendMsg({
187212
type: 'order-selector',
188213
content: {},
214+
position: 'pop',
189215
});
190216
}
191217
}
@@ -300,47 +326,67 @@ export default () => {
300326
<img src={content.picUrl} alt="" />
301327
</Bubble>
302328
);
329+
case 'image-text-button':
330+
return (
331+
<Flex>
332+
<Card fluid>
333+
<CardMedia image="//gw.alicdn.com/tfs/TB1Xv5_vlr0gK0jSZFnXXbRRXXa-427-240.png" />
334+
<CardTitle>Card title</CardTitle>
335+
<CardText>
336+
如您希望卖家尽快给您发货,可以进入【我的订单】找到该笔交易,点击【提醒发货】或点击【联系卖家】与卖家进行旺旺沟通尽快发货给您哦,若卖家明确表示无法发货,建议您申请退款重新选购更高品质的商品哦商品。申请退款重新选购更高品质的商品哦商品。
337+
</CardText>
338+
<CardActions>
339+
<Button>次要按钮</Button>
340+
<Button color="primary">主要按钮</Button>
341+
</CardActions>
342+
</Card>
343+
<RateActions onClick={console.log} />
344+
</Flex>
345+
);
303346
default:
304347
return null;
305348
}
306349
}
307350

308351
return (
309-
<DemoPage>
310-
<div style={{ height: 'calc(100vh - 48px)', marginTop: '-12px' }}>
311-
<Chat
312-
onRefresh={handleRefresh}
313-
navbar={{
314-
leftContent: {
315-
icon: 'chevron-left',
316-
title: 'Back',
317-
},
318-
rightContent: [
319-
{
320-
icon: 'apps',
321-
title: 'Applications',
322-
},
323-
{
324-
icon: 'ellipsis-h',
325-
title: 'More',
326-
},
327-
],
328-
title: '智能助理',
329-
}}
330-
rightAction={{ icon: 'compass' }}
331-
toolbar={toolbar}
332-
messagesRef={msgRef}
333-
onToolbarClick={handleToolbarClick}
334-
recorder={{ canRecord: true }}
335-
wideBreakpoint="600px"
336-
messages={messages}
337-
renderMessageContent={renderMessageContent}
338-
quickReplies={quickReplies}
339-
onQuickReplyClick={handleQuickReplyClick}
340-
onSend={handleSend}
341-
onImageSend={() => Promise.resolve()}
342-
/>
343-
</div>
344-
</DemoPage>
352+
<Chat
353+
elderMode
354+
onRefresh={handleRefresh}
355+
navbar={{
356+
leftContent: {
357+
icon: 'chevron-left',
358+
title: 'Back',
359+
onClick() {
360+
navigate('/');
361+
},
362+
},
363+
rightContent: [
364+
{
365+
icon: 'apps',
366+
title: 'Applications',
367+
},
368+
{
369+
icon: 'ellipsis-h',
370+
title: 'More',
371+
},
372+
],
373+
title: '智能助理',
374+
// desc: '客服热线9510211(7:00-次日1:00)',
375+
// logo: 'https://gw.alicdn.com/imgextra/i4/O1CN016i66TT24lRwUecIk5_!!6000000007431-2-tps-164-164.png_80x80.jpg',
376+
// align: 'left',
377+
}}
378+
rightAction={{ icon: 'compass' }}
379+
toolbar={toolbar}
380+
messagesRef={msgRef}
381+
onToolbarClick={handleToolbarClick}
382+
recorder={{ canRecord: true }}
383+
wideBreakpoint="600px"
384+
messages={messages}
385+
renderMessageContent={renderMessageContent}
386+
quickReplies={quickReplies}
387+
onQuickReplyClick={handleQuickReplyClick}
388+
onSend={handleSend}
389+
onImageSend={() => Promise.resolve()}
390+
/>
345391
);
346392
};

0 commit comments

Comments
 (0)