From f1e0278bd8669ca0936ca48a4be1efb56f35ba30 Mon Sep 17 00:00:00 2001 From: invalid w Date: Fri, 9 Aug 2024 10:57:46 +0800 Subject: [PATCH] chore: define examples router & add ellipsis comp (#4019) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: define components router * chore: 组件路由放置到演示路由下 * Revert "chore: 组件路由放置到演示路由下" This reverts commit 3c24632ad51f031cf95aafa49183d7c5538098bb. * chore: typo * chore: 增加密码强度组件 * chore: 国际化密码强度的菜单 * chore(@vben/web-antd): 迁移文本省略组件 * chore: typo * chore: 组件命名方式遵从packages * chore: Optimize the onExpand function * chore: update css * chore(@vben/web-antd): optimize the getPosition function * chore: add ellipsis-text in comm-ui * chore: 文本省略组件迁移至common-ui * feat(@vben/common-ui): Tooltip的tip支持style传参 * chore: 优化组件渲染 * chore: 使用css module解决样式冲突 * chore: update props * chore: 优化css * chore: rm unuse attr --------- Co-authored-by: Li Kui <90845831+likui628@users.noreply.github.com> --- apps/web-antd/src/locales/langs/en-US.json | 10 +- apps/web-antd/src/locales/langs/zh-CN.json | 6 + .../src/router/routes/modules/examples.ts | 30 ++++ .../src/views/examples/ellipsis/data.ts | 2 + .../src/views/examples/ellipsis/index.vue | 42 +++++ .../src/components/tooltip/tooltip.vue | 2 + .../src/ellipsis-text/ellipsis-text.vue | 144 ++++++++++++++++++ .../common-ui/src/ellipsis-text/index.ts | 1 + packages/effects/common-ui/src/index.ts | 1 + 9 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 apps/web-antd/src/router/routes/modules/examples.ts create mode 100644 apps/web-antd/src/views/examples/ellipsis/data.ts create mode 100644 apps/web-antd/src/views/examples/ellipsis/index.vue create mode 100644 packages/effects/common-ui/src/ellipsis-text/ellipsis-text.vue create mode 100644 packages/effects/common-ui/src/ellipsis-text/index.ts diff --git a/apps/web-antd/src/locales/langs/en-US.json b/apps/web-antd/src/locales/langs/en-US.json index 6b1d636e..13179fd2 100644 --- a/apps/web-antd/src/locales/langs/en-US.json +++ b/apps/web-antd/src/locales/langs/en-US.json @@ -37,7 +37,9 @@ "title": "Active Menu Icon", "children": "Children Active Icon" }, - "fallback": { "title": "Fallback Page" }, + "fallback": { + "title": "Fallback Page" + }, "features": { "title": "Features", "hideChildrenInMenu": "Hide Menu Children", @@ -54,6 +56,12 @@ "level": "Level Mode", "levelDetail": "Level Mode Detail" } + }, + "examples": { + "title": "Examples", + "ellipsis": { + "title": "EllipsisText" + } } } } diff --git a/apps/web-antd/src/locales/langs/zh-CN.json b/apps/web-antd/src/locales/langs/zh-CN.json index 0ce11b74..86fbcabc 100644 --- a/apps/web-antd/src/locales/langs/zh-CN.json +++ b/apps/web-antd/src/locales/langs/zh-CN.json @@ -56,6 +56,12 @@ "levelDetail": "层级模式详情", "lateralDetail": "平级模式详情" } + }, + "examples": { + "title": "示例", + "ellipsis": { + "title": "文本省略" + } } } } diff --git a/apps/web-antd/src/router/routes/modules/examples.ts b/apps/web-antd/src/router/routes/modules/examples.ts new file mode 100644 index 00000000..bd1ec467 --- /dev/null +++ b/apps/web-antd/src/router/routes/modules/examples.ts @@ -0,0 +1,30 @@ +import type { RouteRecordRaw } from 'vue-router'; + +import { BasicLayout } from '#/layouts'; +import { $t } from '#/locales'; + +const routes: RouteRecordRaw[] = [ + { + component: BasicLayout, + meta: { + icon: 'ion:layers-outline', + keepAlive: true, + order: 1000, + title: $t('page.examples.title'), + }, + name: 'Examples', + path: '/examples', + children: [ + { + name: 'EllipsisDemo', + path: '/examples/ellipsis', + component: () => import('#/views/examples/ellipsis/index.vue'), + meta: { + title: $t('page.examples.ellipsis.title'), + }, + }, + ], + }, +]; + +export default routes; diff --git a/apps/web-antd/src/views/examples/ellipsis/data.ts b/apps/web-antd/src/views/examples/ellipsis/data.ts new file mode 100644 index 00000000..796d95a7 --- /dev/null +++ b/apps/web-antd/src/views/examples/ellipsis/data.ts @@ -0,0 +1,2 @@ +export const longText: string = + 'Vben Admin 是一个基于 Vue3.0、Vite、 TypeScript 的后台解决方案,目标是为开发中大型项目提供开箱即用的解决方案。包括二次封装组件、utils、hooks、动态菜单、权限校验、多主题配置、按钮级别权限控制等功能。项目会使用前端较新的技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台产品原型。也可以作为一个示例,用于学习 vue3、vite、ts 等主流技术。该项目会持续跟进最新技术,并将其应用在项目中。Vben Admin 是一个基于 Vue3.0、Vite、 TypeScript 的后台解决方案,目标是为开发中大型项目提供开箱即用的解决方案。包括二次封装组件、utils、hooks、动态菜单、权限校验、多主题配置、按钮级别权限控制等功能。项目会使用前端较新的技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台产品原型。也可以作为一个示例,用于学习 vue3、vite、ts 等主流技术。该项目会持续跟进最新技术,并将其应用在项目中。Vben Admin 是一个基于 Vue3.0、Vite、 TypeScript 的后台解决方案,目标是为开发中大型项目提供开箱即用的解决方案。包括二次封装组件、utils、hooks、动态菜单、权限校验、多主题配置、按钮级别权限控制等功能。项目会使用前端较新的技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台产品原型。也可以作为一个示例,用于学习 vue3、vite、ts 等主流技术。该项目会持续跟进最新技术,并将其应用在项目中。Vben Admin 是一个基于 Vue3.0、Vite、 TypeScript 的后台解决方案,目标是为开发中大型项目提供开箱即用的解决方案。包括二次封装组件、utils、hooks、动态菜单、权限校验、多主题配置、按钮级别权限控制等功能。项目会使用前端较新的技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台产品原型。也可以作为一个示例,用于学习 vue3、vite、ts 等主流技术。该项目会持续跟进最新技术,并将其应用在项目中。'; diff --git a/apps/web-antd/src/views/examples/ellipsis/index.vue b/apps/web-antd/src/views/examples/ellipsis/index.vue new file mode 100644 index 00000000..6c501bad --- /dev/null +++ b/apps/web-antd/src/views/examples/ellipsis/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/tooltip/tooltip.vue b/packages/@core/ui-kit/shadcn-ui/src/components/tooltip/tooltip.vue index d042267f..f96984d9 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/tooltip/tooltip.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/tooltip/tooltip.vue @@ -12,6 +12,7 @@ import { interface Props { contentClass?: HTMLAttributes['class']; + contentStyle?: HTMLAttributes['style']; delayDuration?: number; side: TooltipContentProps['side']; } @@ -31,6 +32,7 @@ withDefaults(defineProps(), { diff --git a/packages/effects/common-ui/src/ellipsis-text/ellipsis-text.vue b/packages/effects/common-ui/src/ellipsis-text/ellipsis-text.vue new file mode 100644 index 00000000..3e10cb6c --- /dev/null +++ b/packages/effects/common-ui/src/ellipsis-text/ellipsis-text.vue @@ -0,0 +1,144 @@ + + + + diff --git a/packages/effects/common-ui/src/ellipsis-text/index.ts b/packages/effects/common-ui/src/ellipsis-text/index.ts new file mode 100644 index 00000000..67a236c9 --- /dev/null +++ b/packages/effects/common-ui/src/ellipsis-text/index.ts @@ -0,0 +1 @@ +export { default as EllipsisText } from './ellipsis-text.vue'; diff --git a/packages/effects/common-ui/src/index.ts b/packages/effects/common-ui/src/index.ts index 753baaa6..8da49eaf 100644 --- a/packages/effects/common-ui/src/index.ts +++ b/packages/effects/common-ui/src/index.ts @@ -1,5 +1,6 @@ export * from './about'; export * from './authentication'; export * from './dashboard'; +export * from './ellipsis-text'; export * from './fallback'; export { useToast } from '@vben-core/shadcn-ui';