Skip to content

Commit

Permalink
copilot系列组件 (#1390)
Browse files Browse the repository at this point in the history
* feat: 尝试删除compiled

* feat: 改造compiled

* feat: 修改real_release.yml文件

* fix: eslintignore

* fix: 修改beta版本号

* fix: release时不再需要重复run build

* feat: 将几处demo页面列表及组件列表的配置文件改为动态生成

* fix: rm app.json

* fix: 提示优化

* fix: 更改beta版本号

* feat: Copilot组件框架

* fix: 增加编译流程

* prompts 组件 (#1345)

* Feat/noticebar support multiple line (#1333)

* fix: temp

* feat: noticeBar组件支持多行展示

* fix: del compiled

* fix: del app.json

* fix: rerun cloudflare pages

---------

Co-authored-by: dennis.zpf <[email protected]>

* fix: 闭合 Button 标签 (#1329)

* fix: 闭合 Button 标签

* docs: checkbox Introducing

---------

Co-authored-by: 柏丘 <[email protected]>
Co-authored-by: rayhomie <[email protected]>

* feat: release.yml增加npm run build指令 (#1335)

* fix: temp

* feat: noticeBar组件支持多行展示

* fix: del compiled

* fix: del app.json

* fix: rerun cloudflare pages

* fix: release.yml脚本增加npm run build

---------

Co-authored-by: dennis.zpf <[email protected]>

* chore(release): v3.0.2 (#1336)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* docs: popover theme color (#1338)

* fix: tabs wechat error (#1340)

* chore(release): v3.0.3 (#1342)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: 新增组件prompts框架

* feat: 新增组件prompts

* feat: demo调整

* feat: css 样式变量化 为暗黑模式适配留坑位

* feat: css 样式变量化 为暗黑模式适配留坑位

* feat: demo 完善

* feat: demo 完善

* feat: demo 完善

* feat: demo 完善

* feat: 命名优化

---------

Co-authored-by: Dennis <[email protected]>
Co-authored-by: dennis.zpf <[email protected]>
Co-authored-by: 赵林 <[email protected]>
Co-authored-by: 柏丘 <[email protected]>
Co-authored-by: rayhomie <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: weifang.jiagweifan <[email protected]>

* feat: copilot suggestion dev

* Copilot suggestion dev (#1356)

* feat: copilot suggestion dev

* feat: copilot suggestion dev

* feat: copilot prompts dev

* feat: copilot prompts dev

* feat: merge prompts & suggestion (#1381)

* Feat Conversations (#1388)

* feat: init copilot conversations

* feat: dev copilot conversations

* feat: dev copilot conversations

* feat: dev copilot conversations

* feat: dev copilot conversations

* feat: dev copilot conversations

* feat: dev copilot conversations

* feat: Add copilot components

* feat: add dark mode

* copilot系列-思维链组件 (#1355)

* feat: thought-chain组件开发

* feat: 思考链组件demo及文档完善

* fix: 修改标题

* CascaderPicker引用路径错误修正 (#1343)

* fix: popup title cant display in wechat platform (#1358)

* fix-some-demo-op (#1341)

* fix: 优化选人组件高度

* fix: 优化文案

---------

Co-authored-by: shijia.sj <[email protected]>

* Update the link to the correct migration documentation (#1325)

* Update faq.md

迁移文档的链接指的是本地主机而不是文档域。


The link to the migration document refers to the localhost instead of the documentation domain.

* Include all instance of localhost.

* docs: update doc

* Feat/table ellipse (#1359)

* fix: temp

* fix: 删除无用代码

* feat: table组件支持多行省略配置 & tabs bar增加一个类配置

* fix: 还原文件格式

* fix: 格式优化

* fix: 触发flouer page

---------

Co-authored-by: dennis.zpf <[email protected]>

* chore(release): v3.0.5 (#1362)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Wx problem fix (#1364)

* fix: inline button style fix in wechat platform

* docs: translate doc

* docs: translate doc

* Add wx:key (#1370)

* fix: inline button style fix in wechat platform

* docs: translate doc

* docs: translate doc

* feat: wx:key add

* Feat/table ellipse (#1365)

* fix: temp

* fix: 删除无用代码

* feat: table组件支持多行省略配置 & tabs bar增加一个类配置

* fix: 还原文件格式

* fix: 格式优化

* fix: 触发flouer page

* feat: 表头也支持换行

* fix: 去掉注释

---------

Co-authored-by: dennis.zpf <[email protected]>

* fix: form onValueChange validate time series problem (#1372)

* fix: form onValueChange validate time series problem

* fix: form onValueChange validate time series problem

* chore(release): v3.0.6 (#1376)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: card divider (#1377)

* Fix card divier (#1378)

* fix: card divider

* fix: button add loading

* fix: aide button in wechat platform

* fix: display range problem (#1383)

* chore(release): v3.0.7 (#1384)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* docs: adjust doc

* chore: nav 新增功能动效

* chore: nav 新增功能动效

* fix: 更新chain-thought组件

* fix: 优化事件和文档

* feat: welcome组件

---------

Co-authored-by: dennis.zpf <[email protected]>
Co-authored-by: dahlzb <[email protected]>
Co-authored-by: homi <[email protected]>
Co-authored-by: ShiJia <[email protected]>
Co-authored-by: shijia.sj <[email protected]>
Co-authored-by: Michael Gichia <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* 优化思维链组件 (#1389)

* feat: thought-chain组件开发

* feat: 思考链组件demo及文档完善

* fix: 修改标题

* CascaderPicker引用路径错误修正 (#1343)

* fix: popup title cant display in wechat platform (#1358)

* fix-some-demo-op (#1341)

* fix: 优化选人组件高度

* fix: 优化文案

---------

Co-authored-by: shijia.sj <[email protected]>

* Update the link to the correct migration documentation (#1325)

* Update faq.md

迁移文档的链接指的是本地主机而不是文档域。


The link to the migration document refers to the localhost instead of the documentation domain.

* Include all instance of localhost.

* docs: update doc

* Feat/table ellipse (#1359)

* fix: temp

* fix: 删除无用代码

* feat: table组件支持多行省略配置 & tabs bar增加一个类配置

* fix: 还原文件格式

* fix: 格式优化

* fix: 触发flouer page

---------

Co-authored-by: dennis.zpf <[email protected]>

* chore(release): v3.0.5 (#1362)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Wx problem fix (#1364)

* fix: inline button style fix in wechat platform

* docs: translate doc

* docs: translate doc

* Add wx:key (#1370)

* fix: inline button style fix in wechat platform

* docs: translate doc

* docs: translate doc

* feat: wx:key add

* Feat/table ellipse (#1365)

* fix: temp

* fix: 删除无用代码

* feat: table组件支持多行省略配置 & tabs bar增加一个类配置

* fix: 还原文件格式

* fix: 格式优化

* fix: 触发flouer page

* feat: 表头也支持换行

* fix: 去掉注释

---------

Co-authored-by: dennis.zpf <[email protected]>

* fix: form onValueChange validate time series problem (#1372)

* fix: form onValueChange validate time series problem

* fix: form onValueChange validate time series problem

* chore(release): v3.0.6 (#1376)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: card divider (#1377)

* Fix card divier (#1378)

* fix: card divider

* fix: button add loading

* fix: aide button in wechat platform

* fix: display range problem (#1383)

* chore(release): v3.0.7 (#1384)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* docs: adjust doc

* chore: nav 新增功能动效

* chore: nav 新增功能动效

* fix: 更新chain-thought组件

* fix: 优化事件和文档

* feat: welcome组件

* fix: 修复深色模式问题

---------

Co-authored-by: dennis.zpf <[email protected]>
Co-authored-by: dahlzb <[email protected]>
Co-authored-by: homi <[email protected]>
Co-authored-by: ShiJia <[email protected]>
Co-authored-by: shijia.sj <[email protected]>
Co-authored-by: Michael Gichia <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: adjust wx

* fix: add demos

* style: change text

* fix: 修复微信编译问题

* fix: fix props & doc contents

* fix: 修复微信兼容问题

* fix: 修复demo问题

* fix: 更新文档

* fix: update doc

---------

Co-authored-by: dennis.zpf <[email protected]>
Co-authored-by: Ray0329 <[email protected]>
Co-authored-by: 赵林 <[email protected]>
Co-authored-by: 柏丘 <[email protected]>
Co-authored-by: rayhomie <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: weifang.jiagweifan <[email protected]>
Co-authored-by: anotherso1a <[email protected]>
Co-authored-by: dahlzb <[email protected]>
Co-authored-by: ShiJia <[email protected]>
Co-authored-by: shijia.sj <[email protected]>
Co-authored-by: Michael Gichia <[email protected]>
  • Loading branch information
14 people authored Jan 24, 2025
1 parent 0a973ee commit 6b26d22
Show file tree
Hide file tree
Showing 112 changed files with 4,574 additions and 95 deletions.
7 changes: 5 additions & 2 deletions .dumi/theme/common/Sim/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function buildUrl(
const DefaultPlatform = 'alipay';

function getSupportPlatform(platform: string) {
const supportWechat = true
const supportWechat = true;
if (!supportWechat && platform === 'wechat') {
return {
platform: DefaultPlatform,
Expand Down Expand Up @@ -83,7 +83,10 @@ const Previewer: React.FC<IProps> = () => {
const matchedRoute = useMatchedRoute();

const isShowSim = useMemo(() => {
return matchedRoute?.meta?.frontmatter?.nav?.path === '/components';
return (
matchedRoute?.meta?.frontmatter?.nav?.path === '/components' ||
matchedRoute?.meta?.frontmatter?.nav?.path === '/copilot'
);
}, [matchedRoute]);

const basicUrl =
Expand Down
6 changes: 4 additions & 2 deletions .dumi/theme/slots/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ const useStyle = ({ isOverview, isShowSim }) => {
const Content: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const isOverview =
window.location.pathname === '/components/overview' ||
window.location.pathname === '/components/overview-en';
window.location.pathname === '/components/overview-en' ||
window.location.pathname === '/copilots/copilot-overview' ||
window.location.pathname === '/copilots/copilot-overview-en';

const matchedRoute = useMatchedRoute();

const isShowSim = useMemo(() => {
return matchedRoute?.meta?.frontmatter?.nav?.path === '/components';
return matchedRoute?.meta?.frontmatter?.nav?.path === '/components' || matchedRoute?.meta?.frontmatter?.nav?.path === '/copilot';
}, [matchedRoute]);

const meta = useRouteMeta();
Expand Down
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
6 changes: 4 additions & 2 deletions .dumi/theme/slots/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const useStyle = (isShowPlatfromSwitch) => {
padding: 3px;
.item {
height: 27px;
border-radius:1px;
border-radius: 1px;
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -250,7 +250,9 @@ const Sidebar: FC = () => {
const { pathname } = window.location;
return (
pathname.startsWith('/components/') ||
matchedRoute?.meta?.frontmatter?.nav?.path === '/components'
matchedRoute?.meta?.frontmatter?.nav?.path === '/components' ||
pathname.startsWith('/copilots/') ||
matchedRoute?.meta?.frontmatter?.nav?.path === '/copilot'
);
}, [matchedRoute]);

Expand Down
24 changes: 24 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export default defineConfig({
title: '组件',
link: '/components/overview',
},
{
title: 'Copilot',
link: '/copilots/bubble',
// @ts-ignore
isNew: true,
rightIcon:
'https://mdn.alipayobjects.com/huamei_2jrq4g/afts/img/A*iiKoT73_9ucAAAAAAAAAAAAAetF8AQ/original',
},
{
title: '资源',
link: '/resources',
Expand All @@ -78,6 +86,10 @@ export default defineConfig({
title: 'Components',
link: '/components/overview-en',
},
{
title: 'Copilot',
link: '/copilots/conversations-en',
},
{
title: 'Resources',
link: '/resources-en',
Expand Down Expand Up @@ -563,4 +575,16 @@ export default defineConfig({
{ id: 'zh-CN', name: '中文', suffix: '' },
{ id: 'en', name: 'English', suffix: '-en' },
],
resolve: {
atomDirs: [
{
type: 'component',
dir: 'src',
},
{
type: 'copilot',
dir: 'copilot',
},
],
},
});
20 changes: 20 additions & 0 deletions copilot-demo/pages/Actions/index.axml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<ant-container title="基础用法">
<ant-actions items="{{basicActions}}" onItemTap="handleTapAction" />
</ant-container>

<ant-container title="配合bubble使用">
<ant-switch checked="{{ showBubble }}" onChange="toggleBubble" />
<ant-bubble
a:if="{{ showBubble }}"
content="永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。群贤毕至,少长咸集。此地有崇山峻岭,茂林修竹,又有清流激湍,映带左右,引以为流觞曲水,列坐其次。虽无丝竹管弦之盛,一觞一咏,亦足以畅叙幽情。"
typing="{{ { step: 2, interval: 50 } }}"
onTypingComplete="onTypingComplete"
>
<ant-actions
a:if="{{ loaded }}"
slot="footer"
items="{{bubbleActions}}"
onItemTap="handleBubbleAction"
/>
</ant-bubble>
</ant-container>
16 changes: 16 additions & 0 deletions copilot-demo/pages/Actions/index.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
/// #if WECHAT
"navigationBarTitleText": "Actions",
/// #endif

/// #if ALIPAY
"defaultTitle": "Actions",
/// #endif

"usingComponents": {
"ant-actions": "../../../src/Actions/index",
"ant-bubble": "../../../src/Bubble/index",
"ant-switch": "../../../src/Switch/index",
"ant-container": "../../../src/Container/index"
}
}
Empty file.
94 changes: 94 additions & 0 deletions copilot-demo/pages/Actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Page({
data: {
liked: false,
loaded: false,
showBubble: true,
basicActions: [
{
label: 'copy',
icon: 'TextOutline',
},
{
label: 'like',
icon: 'LikeOutline',
},
{
label: 'collect',
icon: 'StarOutline',
},
{
label: 'edit',
icon: 'EditSOutline',
},
],
bubbleActions: [
{
label: 'copy',
icon: 'TextOutline',
},
{
label: 'collect',
icon: 'StarOutline',
},
],
},

handleTapAction(item) {
/// #if WECHAT
// @ts-ignore
item = item.detail;
/// #endif
const basicActions = [...this.data.basicActions];
if (item.label === 'like') {
this.setData({
liked: !this.data.liked,
});
basicActions.find((action) => action.label === 'like').icon = this.data.liked
? 'https://mdn.alipayobjects.com/huamei_bsws4g/afts/img/JmVoRp-2UwMAAAAAAAAAAAAADoEQAQFr/original'
: 'LikeOutline';
} else {
/// #if ALIPAY
my.showToast({
content: `${item.label} tapped`,
});
/// #endif
/// #if WECHAT
// @ts-ignore
wx.showToast({
title: `${item.label} tapped`,
});
/// #endif
}
this.setData({
basicActions,
});
},
handleBubbleAction(item) {
/// #if WECHAT
// @ts-ignore
item = item.detail;
/// #endif
/// #if ALIPAY
my.showToast({
content: `${item.label} tapped`,
});
/// #endif
/// #if WECHAT
// @ts-ignore
wx.showToast({
title: `${item.label} tapped`,
});
/// #endif
},
onTypingComplete() {
this.setData({
loaded: true,
});
},
toggleBubble() {
this.setData({
showBubble: !this.data.showBubble,
loaded: false,
});
},
});
Loading

0 comments on commit 6b26d22

Please sign in to comment.