Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copilot系列-思维链组件 #1355

Merged
merged 30 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
42b7721
feat: thought-chain组件开发
Jan 2, 2025
1ff4918
feat: 思考链组件demo及文档完善
Jan 3, 2025
596b8b1
fix: 合并x-components组件
Jan 3, 2025
64a10d8
fix: 修改标题
Jan 3, 2025
c22927b
CascaderPicker引用路径错误修正 (#1343)
dahlzb Jan 7, 2025
337ad4e
fix: popup title cant display in wechat platform (#1358)
rayhomie Jan 7, 2025
e9a2bf4
fix-some-demo-op (#1341)
ajiaberry Jan 7, 2025
c7d2c63
Update the link to the correct migration documentation (#1325)
michaelgichia Jan 7, 2025
6832e64
docs: update doc
rayhomie Jan 7, 2025
937852c
Feat/table ellipse (#1359)
coderrorer Jan 7, 2025
f43ca40
chore(release): v3.0.5 (#1362)
github-actions[bot] Jan 7, 2025
d27f512
Wx problem fix (#1364)
rayhomie Jan 7, 2025
01249e7
Add wx:key (#1370)
rayhomie Jan 8, 2025
ab39e7b
Feat/table ellipse (#1365)
coderrorer Jan 8, 2025
3a7f981
fix: form onValueChange validate time series problem (#1372)
rayhomie Jan 9, 2025
2cc06ea
chore(release): v3.0.6 (#1376)
github-actions[bot] Jan 9, 2025
18b6eb6
fix: card divider (#1377)
rayhomie Jan 10, 2025
1bd7fb9
Fix card divier (#1378)
rayhomie Jan 10, 2025
4e7a329
fix: display range problem (#1383)
rayhomie Jan 16, 2025
cf6c7bf
chore(release): v3.0.7 (#1384)
github-actions[bot] Jan 16, 2025
15b3c0e
feat: 合并master
Jan 20, 2025
4549e1e
Merge branch 'feat/x-components' into feat/copilot-thought-chain
rayhomie Jan 23, 2025
01264e9
docs: adjust doc
rayhomie Jan 23, 2025
5ed99a1
chore: nav 新增功能动效
rayhomie Jan 23, 2025
ff07c9d
chore: nav 新增功能动效
rayhomie Jan 23, 2025
87f6050
fix: 更新chain-thought组件
Jan 23, 2025
fdde783
feat: 优化thought-chain组件
Jan 23, 2025
3fe9bfc
fix: 优化事件和文档
Jan 24, 2025
59c6191
feat: welcome组件
Jan 24, 2025
65f2b85
fix: 文档翻译
Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 93 additions & 9 deletions .dumi/theme/slots/Header/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MenuFoldOutlined } from '@ant-design/icons';
import { css } from '@emotion/react';
import { Player } from '@galacean/effects';
import type { MenuProps } from 'antd';
import { Menu } from 'antd';
import {
Expand All @@ -11,7 +12,8 @@ import {
useSiteData,
} from 'dumi';
import { INavItem } from 'dumi/dist/client/theme-api/types';
import { useCallback, useContext } from 'react';
import { motion } from 'framer-motion';
import { useCallback, useContext, useEffect, useRef } from 'react';
import useAdditionalThemeConfig from '../../hooks/useAdditionalThemeConfig';
import useLocaleValue from '../../hooks/useLocaleValue';
import useSiteToken from '../../hooks/useSiteToken';
Expand Down Expand Up @@ -79,6 +81,27 @@ const useStyle = () => {
text-align: center;
}
`,
navItem: css`
position: relative;
display: flex;
align-items: center;
justify-content: center;
`,
newPlayer: css`
width: 100px;
height: 100px;
position: absolute;
top: 12px;
left: 50%;
transform: translateX(-50%);
z-index: 9;
pointer-events: none;
`,
rightIcon: css`
margin-left: 8px;
width: 16px;
height: 16px;
`,
popoverMenuNav: css`
${antCls}-menu-item,
${antCls}-menu-submenu {
Expand Down Expand Up @@ -112,23 +135,84 @@ export default function Navigation({ isMobile, responsive }: NavigationProps) {
const locale = useLocale();
const moreLinks = useLocaleValue('moreLinks');
const activeMenuItem = pathname.split('/').slice(0, 2).join('/');
const playerDom = useRef<HTMLDivElement>(null);
const timers = useRef<NodeJS.Timeout[]>([]);

useEffect(() => {
if (!playerDom.current) return;

const player = new Player({
container: playerDom.current,
});

const timer1 = setTimeout(() => {
player.loadScene(
'https://mdn.alipayobjects.com/mars/afts/file/A*wKDRRKoA9fcAAAAAAAAAAAAADlB4AQ'
);
player.play();
const timer2 = setTimeout(() => {
player.loadScene(
'https://mdn.alipayobjects.com/mars/afts/file/A*wKDRRKoA9fcAAAAAAAAAAAAADlB4AQ'
);
player.play();
timers.current.push(timer2);
}, 10000);
}, 3000);
timers.current.push(timer1);
return () => {
timers.current.forEach((t) => {
clearTimeout(t);
});
timers.current = [];
};
}, []);

const createMenuItems = (navs: INavItem[]) => {
const style = useStyle();
return navs.map((navItem: INavItem) => {
const linkKeyValue = (navItem.link ?? '')
.split('/')
.slice(0, 2)
.join('/');
return {
// eslint-disable-next-line no-nested-ternary
label: navItem.children ? (
navItem.title
) : isExternalLinks(navItem.link) ? (
<a href={`${navItem.link}${search}`} target="_blank" rel="noreferrer">
{navItem.title}
</a>
) : (
<Link to={`${navItem.link}${search}`}>{navItem.title}</Link>
label: (
<div css={style.navItem}>
{navItem.children ? (
navItem.title
) : isExternalLinks(navItem.link) ? (
<a
href={`${navItem.link}${search}`}
target="_blank"
rel="noreferrer"
>
{navItem.title}
</a>
) : (
<Link to={`${navItem.link}${search}`}>{navItem.title}</Link>
)}
{navItem.isNew ? (
<div ref={playerDom} css={style.newPlayer}></div>
) : null}
{navItem.rightIcon && (
<motion.div
style={{ display: 'inline-block' }}
animate={{
rotate: [-5, 5, -5, 5, 0], // 轻微旋转
x: [-2, 2, -2, 2, 0], // 轻微水平移动
y: [-1, 1, -1, 1, 0], // 轻微垂直移动
transition: {
duration: 1.0, // 增加持续时间,使晃动更加平滑
repeat: Infinity, // 无限循环
ease: 'easeInOut', // 使用平滑的缓动函数
repeatDelay: 3,
},
}}
>
<img css={style.rightIcon} src={navItem.rightIcon} alt="" />
</motion.div>
)}
</div>
),
key: isExternalLinks(navItem.link) ? navItem.link : linkKeyValue,
children: navItem.children ? createMenuItems(navItem.children) : null,
Expand Down
12 changes: 8 additions & 4 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export default defineConfig({
link: '/components/overview',
},
{
title: 'Copilot系列组件',
link: '/copilots/copilot-overview',
title: 'Copilot',
link: '/copilots/conversations',
// @ts-ignore
isNew: true,
rightIcon:
'https://mdn.alipayobjects.com/huamei_2jrq4g/afts/img/A*iiKoT73_9ucAAAAAAAAAAAAAetF8AQ/original',
},
{
title: '资源',
Expand All @@ -83,8 +87,8 @@ export default defineConfig({
link: '/components/overview-en',
},
{
title: 'Copilot Components',
link: '/copilots/copilot-overview-en',
title: 'Copilot',
link: '/copilots/conversations-en',
},
{
title: 'Resources',
Expand Down
59 changes: 58 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [3.0.7](https://github.com/ant-design/ant-design-mini/compare/3.0.6...3.0.7)

- fix: display range problem [`#1383`](https://github.com/ant-design/ant-design-mini/pull/1383)
- Fix card divier [`#1378`](https://github.com/ant-design/ant-design-mini/pull/1378)
- fix: card divider [`#1377`](https://github.com/ant-design/ant-design-mini/pull/1377)

#### [3.0.6](https://github.com/ant-design/ant-design-mini/compare/3.0.6-beta.1...3.0.6)

> 9 January 2025

- fix: form onValueChange validate time series problem [`#1372`](https://github.com/ant-design/ant-design-mini/pull/1372)
- Feat/table ellipse [`#1365`](https://github.com/ant-design/ant-design-mini/pull/1365)
- Add wx:key [`#1370`](https://github.com/ant-design/ant-design-mini/pull/1370)
- Wx problem fix [`#1364`](https://github.com/ant-design/ant-design-mini/pull/1364)

#### [3.0.6-beta.1](https://github.com/ant-design/ant-design-mini/compare/3.0.5...3.0.6-beta.1)

> 8 January 2025

- feat: 表头也支持换行 [`8372463`](https://github.com/ant-design/ant-design-mini/commit/8372463e104f4b05b557ccfb5b4550a35a837ee6)
- fix: 去掉注释 [`ec936a0`](https://github.com/ant-design/ant-design-mini/commit/ec936a03d87dcc978490a5d078679c385f8ec75e)
- fix: merge master [`5edad2b`](https://github.com/ant-design/ant-design-mini/commit/5edad2bf8cbe585199b545ba577d7499f4f4e4d1)

#### [3.0.5](https://github.com/ant-design/ant-design-mini/compare/3.0.4...3.0.5)

> 7 January 2025

- Feat/table ellipse [`#1359`](https://github.com/ant-design/ant-design-mini/pull/1359)
- Update the link to the correct migration documentation [`#1325`](https://github.com/ant-design/ant-design-mini/pull/1325)
- fix-some-demo-op [`#1341`](https://github.com/ant-design/ant-design-mini/pull/1341)
- fix: popup title cant display in wechat platform [`#1358`](https://github.com/ant-design/ant-design-mini/pull/1358)
- CascaderPicker引用路径错误修正 [`#1343`](https://github.com/ant-design/ant-design-mini/pull/1343)
- Optimize docs [`#1354`](https://github.com/ant-design/ant-design-mini/pull/1354)
- docs: update doc [`6832e64`](https://github.com/ant-design/ant-design-mini/commit/6832e64d97eff3d6bf951033e48ff2c18fe19bd7)

#### [3.0.4](https://github.com/ant-design/ant-design-mini/compare/3.0.3...3.0.4)

> 30 December 2024
Expand Down Expand Up @@ -628,14 +663,36 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- feat: 增加函数式组件的说明 [`#828`](https://github.com/ant-design/ant-design-mini/pull/828)
- fix: 修改 demo 的 appid [`#830`](https://github.com/ant-design/ant-design-mini/pull/830)

### [2.11.0](https://github.com/ant-design/ant-design-mini/compare/1.10.8...2.11.0)
### [2.11.0](https://github.com/ant-design/ant-design-mini/compare/1.10.9...2.11.0)

> 12 September 2023

- feat: 升级到 2.0 [`#826`](https://github.com/ant-design/ant-design-mini/pull/826)
- fix: should not use element selector [`#808`](https://github.com/ant-design/ant-design-mini/pull/808)
- feat: 使用 vm 进行测试 [`#817`](https://github.com/ant-design/ant-design-mini/pull/817)

#### [1.10.9](https://github.com/ant-design/ant-design-mini/compare/1.10.9-alpha.2...1.10.9)

> 9 January 2025

- chore: update version [`f7ceaa5`](https://github.com/ant-design/ant-design-mini/commit/f7ceaa51f428162444609463323e9775c3c64a27)

#### [1.10.9-alpha.2](https://github.com/ant-design/ant-design-mini/compare/1.10.9-alpha.1...1.10.9-alpha.2)

> 8 January 2025

- fix: form onValueChange validate time series problem [`0d8ea96`](https://github.com/ant-design/ant-design-mini/commit/0d8ea966341de9e9707ecf8b168483b31019ca2f)
- fix: picker view render [`be21b03`](https://github.com/ant-design/ant-design-mini/commit/be21b036622f05b747fe1c7dcac88fa2a5fe7f06)
- chore: update version [`4bd2c5a`](https://github.com/ant-design/ant-design-mini/commit/4bd2c5a4e6b1d0d4a26714ef49d6055c199cf8b2)

#### [1.10.9-alpha.1](https://github.com/ant-design/ant-design-mini/compare/1.10.8...1.10.9-alpha.1)

> 8 January 2025

- fix: form onValueChange validate time series problem [`d33653b`](https://github.com/ant-design/ant-design-mini/commit/d33653bdebf6b5da6e21da2713b117c3fdffc8dc)
- fix: form onValueChange validate time series problem [`eb5faed`](https://github.com/ant-design/ant-design-mini/commit/eb5faedd487c605679bd5591b5f477f32b0a7364)
- fix: form onValueChange validate time series problem [`8613b1e`](https://github.com/ant-design/ant-design-mini/commit/8613b1ee116ec23f4ce3bd919dc10f10cd0f23b0)

#### [1.10.8](https://github.com/ant-design/ant-design-mini/compare/1.10.7...1.10.8)

> 30 December 2024
Expand Down
4 changes: 0 additions & 4 deletions copilot-demo/pages/Copilotbutton/index.axml

This file was deleted.

16 changes: 0 additions & 16 deletions copilot-demo/pages/Copilotbutton/index.json5

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions copilot-demo/pages/Copilotbutton/index.ts

This file was deleted.

36 changes: 36 additions & 0 deletions copilot-demo/pages/ThoughtChain/index.axml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<view class="navigation-bar" />

<ant-container title="基础用法">
<thought-chain items="{{basicList}}" onContentItemTap="onContentItemTap" collapsible="{{true}}">
</thought-chain>
</ant-container>
<ant-container title="自定义内容">
<thought-chain items="{{basicList}}" onContentItemTap="onContentItemTap" collapsible="{{false}}">
<view slot="content" slot-scope="module" style="color: red">
{{module.content}}
</view>
</thought-chain>
</ant-container>
<ant-container title="二级节点">
<thought-chain items="{{customList}}" onContentItemTap="onContentItemTap" collapsible="{{true}}">
<view slot="content" slot-scope="module">
<view a:if="{{typeof(module.content) === 'object'}}" class="secondLevel">
<thought-chain
className="second-thoughtchain"
items="{{module.content}}"
collapsible="{{false}}"
>
<view slot="content" slot-scope="secondModule" a:if="{{typeof(secondModule.content) === 'object'}}">
<view class="second-thoughtchain-content" a:for="{{secondModule.content}}">
{{item}}
</view>
</view>
<view a:else class="second-thoughtchain-content">
{{secondModule.content}}
</view>
</thought-chain>
</view>
<view a:else>{{module.content}}</view>
</view>
</thought-chain>
</ant-container>
15 changes: 15 additions & 0 deletions copilot-demo/pages/ThoughtChain/index.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
/// #if WECHAT
"navigationBarTitleText": "ThoughtChain 组件",
/// #endif

/// #if ALIPAY
"defaultTitle": "ThoughtChain 组件",
/// #endif

"usingComponents": {
"ant-container": "../../../src/Container/index",
"thought-chain": "../../../src/ThoughtChain/index"
},
"transparentTitle": "always"
}
18 changes: 18 additions & 0 deletions copilot-demo/pages/ThoughtChain/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
page {
// background: #f5f5f5;
padding: 12rpx;
.secondLevel {
padding: 24rpx;
background-color: #f5f5f5;
border-radius: 24rpx;
margin-left: -58rpx;
}
.second-thoughtchain {
.ant-copilot-thoughtchain-node-title {
color: #000;
}
.second-thoughtchain-content {
color: #999;
}
}
}
Loading
Loading