This commit is contained in:
dap 2024-08-30 10:15:41 +08:00
commit b336d3612f
73 changed files with 329 additions and 155 deletions

View File

@ -1,7 +1,4 @@
export default {
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
'prettier --cache --write--parser json',
],
'*.{js,jsx,ts,tsx}': [
'prettier --cache --ignore-unknown --write',
'eslint --cache --fix',
@ -16,5 +13,8 @@ export default {
'eslint --cache --fix',
'stylelint --fix --allow-empty-input',
],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
'prettier --cache --write--parser json',
],
'package.json': ['prettier --cache --write'],
};

View File

@ -12,6 +12,9 @@ VITE_ROUTER_HISTORY=history
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=true
# 后台请求路径 具体在vite.config.mts配置代理
VITE_GLOB_API_URL=/prod-api
@ -26,3 +29,4 @@ VITE_GLOB_APP_CLIENT_ID=6afcaa29272b14c1c87264950c726ef4
# 开启WEBSOCKET
VITE_GLOB_WEBSOCKET_ENABLE=false

View File

@ -1,6 +1,6 @@
{
"name": "@vben/web-antd",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -14,3 +14,6 @@ VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=true

View File

@ -1,6 +1,6 @@
{
"name": "@vben/web-ele",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -14,3 +14,6 @@ VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=true

View File

@ -1,6 +1,6 @@
{
"name": "@vben/web-naive",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -3,6 +3,8 @@ import type { HeadConfig } from 'vitepress';
import { resolve } from 'node:path';
import { viteArchiverPlugin } from '@vben/vite-config';
import {
GitChangelog,
GitChangelogMarkdownSection,
@ -76,6 +78,7 @@ export const shared = defineConfig({
repoURL: () => 'https://github.com/vbenjs/vue-vben-admin',
}),
GitChangelogMarkdownSection(),
viteArchiverPlugin({ outputDir: '.vitepress' }),
],
server: {
fs: {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/docs",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"scripts": {
"build": "vitepress build",
@ -11,15 +11,13 @@
"@vben-core/shadcn-ui": "workspace:*",
"@vben/common-ui": "workspace:*",
"@vben/styles": "workspace:*",
"@vueuse/core": "^11.0.3",
"lucide-vue-next": "^0.436.0",
"markdown-it": "^14.1.0",
"medium-zoom": "^1.1.0",
"radix-vue": "^1.9.5"
},
"devDependencies": {
"@nolebase/vitepress-plugin-git-changelog": "^2.4.0",
"@types/markdown-it": "^14.1.2",
"@vben/vite-config": "workspace:*",
"@vite-pwa/vitepress": "^0.5.0",
"vitepress": "^1.3.4",
"vue": "^3.4.38"

View File

@ -59,7 +59,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
所有属性都可以传入 `useVbenDrawer` 的第一个参数中。
| 属性名 | 描述 | 类型 | 默认值 |
| ------------------ | ------------------- | --------------- | ------- |
| --- | --- | --- | --- |
| title | 标题 | `string\|slot` | - |
| titleTooltip | 标题提示信息 | `string\|slot` | - |
| description | 描述信息 | `string\|slot` | - |
@ -72,8 +72,12 @@ const [Drawer, drawerApi] = useVbenDrawer({
| confirmLoading | 确认按钮loading状态 | `boolean` | `false` |
| closeOnClickModal | 点击遮罩关闭弹窗 | `boolean` | `true` |
| closeOnPressEscape | esc 关闭弹窗 | `boolean` | `true` |
| confirmText | 确认按钮文本 | `boolean\|slot` | `确认` |
| cancelText | 取消按钮文本 | `boolean\|slot` | `取消` |
| confirmText | 确认按钮文本 | `string\|slot` | `确认` |
| cancelText | 取消按钮文本 | `string\|slot` | `取消` |
| class | modal的class宽度通过这个配置 | `string` | - |
| contentClass | modal内容区域的class | `string` | - |
| footerClass | modal底部区域的class | `string` | - |
| headerClass | modal顶部区域的class | `string` | - |
### Event

View File

@ -65,7 +65,7 @@ const [Modal, modalApi] = useVbenModal({
所有属性都可以传入 `useVbenModal` 的第一个参数中。
| 属性名 | 描述 | 类型 | 默认值 |
| ------------------ | ------------------- | --------------- | ------- |
| --- | --- | --- | --- |
| title | 标题 | `string\|slot` | - |
| titleTooltip | 标题提示信息 | `string\|slot` | - |
| description | 描述信息 | `string\|slot` | - |
@ -82,8 +82,12 @@ const [Modal, modalApi] = useVbenModal({
| confirmLoading | 确认按钮loading状态 | `boolean` | `false` |
| closeOnClickModal | 点击遮罩关闭弹窗 | `boolean` | `true` |
| closeOnPressEscape | esc 关闭弹窗 | `boolean` | `true` |
| confirmText | 确认按钮文本 | `boolean\|slot` | `确认` |
| cancelText | 取消按钮文本 | `boolean\|slot` | `取消` |
| confirmText | 确认按钮文本 | `string\|slot` | `确认` |
| cancelText | 取消按钮文本 | `string\|slot` | `取消` |
| class | modal的class宽度通过这个配置 | `string` | - |
| contentClass | modal内容区域的class | `string` | - |
| footerClass | modal底部区域的class | `string` | - |
| headerClass | modal顶部区域的class | `string` | - |
### Event

View File

@ -55,6 +55,9 @@ VITE_DEVTOOLS=true
# Whether to inject global loading
VITE_INJECT_APP_LOADING=true
# Whether to generate after packaging dist.zip
VITE_ARCHIVER=true
```
:::

View File

@ -53,7 +53,7 @@ You can check the list below to understand all the available variables.
/* Theme Colors */
--primary: 211 91% 39%;
--primary: 231 98% 65%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */
@ -351,7 +351,7 @@ type BuiltinThemeType =
/* Theme Colors */
--primary: 211 91% 39%;
--primary: 231 98% 65%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */

View File

@ -55,6 +55,7 @@ VITE_DEVTOOLS=true
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
```
```bash [.env.production]
@ -75,6 +76,10 @@ VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=true
```
:::

View File

@ -53,7 +53,7 @@ css 变量内的颜色,必须使用 `hsl` 格式,如 `0 0% 100%`,不需要
/* 主题颜色 */
--primary: 211 91% 39%;
--primary: 231 98% 65%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */
@ -351,7 +351,7 @@ type BuiltinThemeType =
/* 主题颜色 */
--primary: 211 91% 39%;
--primary: 231 98% 65%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */

View File

@ -1,6 +1,6 @@
{
"name": "@vben/commitlint-config",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -68,7 +68,7 @@ export async function perfectionist(): Promise<Linter.Config[]> {
ignorePattern: ['children'],
order: 'asc',
partitionByComment: 'Part:**',
type: 'alphabetical',
type: 'natural',
},
],
'perfectionist/sort-vue-attributes': [

View File

@ -1,6 +1,6 @@
{
"name": "@vben/stylelint-config",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{
"name": "@vben/node-utils",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{
"name": "@vben/tailwind-config",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -190,8 +190,8 @@ export default {
},
float: {
'0%': { transform: 'translateY(0)' },
'100%': { transform: 'translateY(0)' },
'50%': { transform: 'translateY(-20px)' },
'100%': { transform: 'translateY(0)' },
},
},
zIndex: {
@ -228,11 +228,11 @@ function createColorsPalette(name: string) {
// • backgroundDarkest (#172554): 适用于最深的背景,可能用于非常深色的区域或极端对比色。
return {
50: `hsl(var(--${name}-50))`,
100: `hsl(var(--${name}-100))`,
200: `hsl(var(--${name}-200))`,
300: `hsl(var(--${name}-300))`,
400: `hsl(var(--${name}-400))`,
50: `hsl(var(--${name}-50))`,
500: `hsl(var(--${name}-500))`,
600: `hsl(var(--${name}-600))`,
700: `hsl(var(--${name}-700))`,

View File

@ -1,6 +1,6 @@
{
"name": "@vben/tsconfig",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{
"name": "@vben/vite-config",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@ -29,6 +29,7 @@
"dependencies": {
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@jspm/generator": "^2.1.3",
"archiver": "^7.0.1",
"cheerio": "1.0.0",
"get-port": "^7.1.0",
"html-minifier-terser": "^7.2.0",
@ -39,6 +40,7 @@
"vite-plugin-vue-devtools": "^7.3.9"
},
"devDependencies": {
"@types/archiver": "^6.0.2",
"@types/html-minifier-terser": "^7.0.2",
"@vben/node-utils": "workspace:*",
"@vitejs/plugin-vue": "^5.1.2",

View File

@ -24,6 +24,8 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
const env = loadEnv(mode, root);
const plugins = await loadApplicationPlugins({
archiver: true,
archiverPluginOptions: {},
compress: false,
compressTypes: ['brotli', 'gzip'],
devtools: true,

View File

@ -0,0 +1,67 @@
import type { PluginOption } from 'vite';
import type { ArchiverPluginOptions } from '../typing';
import fs from 'node:fs';
import { join } from 'node:path';
import archiver from 'archiver';
export const viteArchiverPlugin = (
options: ArchiverPluginOptions = {},
): PluginOption => {
return {
apply: 'build',
closeBundle: {
handler() {
const { name = 'dist', outputDir = '.' } = options;
setTimeout(async () => {
const folderToZip = 'dist';
const zipOutputPath = join(process.cwd(), outputDir, `${name}.zip`);
try {
await zipFolder(folderToZip, zipOutputPath);
console.log(`Folder has been zipped to: ${zipOutputPath}`);
} catch (error) {
console.error('Error zipping folder:', error);
}
}, 0);
},
order: 'post',
},
enforce: 'post',
name: 'vite:archiver',
};
};
async function zipFolder(
folderPath: string,
outputPath: string,
): Promise<void> {
return new Promise((resolve, reject) => {
const output = fs.createWriteStream(outputPath);
const archive = archiver('zip', {
zlib: { level: 9 }, // 设置压缩级别为 9 以实现最高压缩率
});
output.on('close', () => {
console.log(
`ZIP file created: ${outputPath} (${archive.pointer()} total bytes)`,
);
resolve();
});
archive.on('error', (err) => {
reject(err);
});
archive.pipe(output);
// 使用 directory 方法以流的方式压缩文件夹,减少内存消耗
archive.directory(folderPath, false);
// 流式处理完成
archive.finalize();
});
}

View File

@ -18,6 +18,7 @@ import { libInjectCss as viteLibInjectCss } from 'vite-plugin-lib-inject-css';
import { VitePWA } from 'vite-plugin-pwa';
import viteVueDevTools from 'vite-plugin-vue-devtools';
import { viteArchiverPlugin } from './archiver';
import { viteExtraAppConfigPlugin } from './extra-app-config';
import { viteImportMapPlugin } from './importmap';
import { viteInjectAppLoadingPlugin } from './inject-app-loading';
@ -92,6 +93,8 @@ async function loadApplicationPlugins(
const env = options.env;
const {
archiver,
archiverPluginOptions,
compress,
compressTypes,
extraAppConfig,
@ -138,6 +141,7 @@ async function loadApplicationPlugins(
return [await viteNitroMockPlugin(nitroMockOptions)];
},
},
{
condition: injectAppLoading,
plugins: async () => [await viteInjectAppLoadingPlugin(!!isBuild, env)],
@ -184,7 +188,6 @@ async function loadApplicationPlugins(
condition: !!html,
plugins: () => [viteHtmlPlugin({ minify: true })],
},
{
condition: isBuild && importmap,
plugins: () => {
@ -197,6 +200,12 @@ async function loadApplicationPlugins(
await viteExtraAppConfigPlugin({ isBuild: true, root: process.cwd() }),
],
},
{
condition: archiver,
plugins: async () => {
return [await viteArchiverPlugin(archiverPluginOptions)];
},
},
]);
}
@ -226,6 +235,7 @@ async function loadLibraryPlugins(
export {
loadApplicationPlugins,
loadLibraryPlugins,
viteArchiverPlugin,
viteCompressPlugin,
viteDtsPlugin,
viteHtmlPlugin,

View File

@ -33,6 +33,19 @@ interface NitroMockPluginOptions {
verbose?: boolean;
}
interface ArchiverPluginOptions {
/**
*
* @default dist
*/
name?: string;
/**
*
* @default .
*/
outputDir?: string;
}
/**
* importmap
*/
@ -74,6 +87,10 @@ interface CommonPluginOptions {
}
interface ApplicationPluginOptions extends CommonPluginOptions {
/** 开启后会在打包dist同级生成dist.zip */
archiver?: boolean;
/** 压缩归档插件配置 */
archiverPluginOptions?: ArchiverPluginOptions;
/** 开启 gzip|brotli 压缩 */
compress?: boolean;
/** 压缩类型 */
@ -134,6 +151,7 @@ type DefineConfig = DefineApplicationOptions | DefineLibraryOptions;
export type {
ApplicationPluginOptions,
ArchiverPluginOptions,
CommonPluginOptions,
ConditionPlugin,
DefineApplicationOptions,

View File

@ -74,6 +74,7 @@ async function loadAndConvertEnv(
const {
VITE_APP_TITLE,
VITE_ARCHIVER,
VITE_BASE,
VITE_COMPRESS,
VITE_DEVTOOLS,
@ -90,6 +91,7 @@ async function loadAndConvertEnv(
return {
appTitle: getString(VITE_APP_TITLE, 'Vben Admin'),
archiver: getBoolean(VITE_ARCHIVER),
base: getString(VITE_BASE, '/'),
compress: compressTypes.length > 0,
compressTypes,

View File

@ -1,6 +1,6 @@
{
"name": "vben-admin-pro",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"keywords": [
"monorepo",

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/design",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -28,7 +28,7 @@
/* 主题颜色 */
--primary: 211 91% 39%;
--primary: 231 98% 65%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/icons",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/shared",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/typings",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/composables",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -2,6 +2,7 @@ export * from './use-content-style';
export * from './use-is-mobile';
export * from './use-namespace';
export * from './use-priority-value';
export * from './use-simple-locale';
export * from './use-sortable';
export {
useEmitAsProps,

View File

@ -0,0 +1,3 @@
# Simple i18n
Simple i18 implementation

View File

@ -0,0 +1,25 @@
import { computed, ref } from 'vue';
import { createSharedComposable } from '@vueuse/core';
import { getMessages, type Locale } from './messages';
export const useSimpleLocale = createSharedComposable(() => {
const currentLocale = ref<Locale>('zh-CN');
const setSimpleLocale = (locale: Locale) => {
currentLocale.value = locale;
};
const $t = computed(() => {
const localeMessages = getMessages(currentLocale.value);
return (key: string) => {
return localeMessages[key] || key;
};
});
return {
$t,
currentLocale,
setSimpleLocale,
};
});

View File

@ -0,0 +1,14 @@
export type Locale = 'en-US' | 'zh-CN';
export const messages: Record<Locale, Record<string, string>> = {
'en-US': {
cancel: 'Cancel',
confirm: 'Confirm',
},
'zh-CN': {
cancel: '取消',
confirm: '确认',
},
};
export const getMessages = (locale: Locale) => messages[locale];

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/preferences",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -43,6 +43,13 @@ function usePreferences() {
isMobile.value ? 'sidebar-nav' : appPreferences.value.layout,
);
/**
* @zh_CN
*/
const isShowHeaderNav = computed(() => {
return preferences.header.enable;
});
/**
* @zh_CN contenttab区域
*/
@ -180,7 +187,11 @@ function usePreferences() {
}
// 如果是全屏模式或者没有固定在顶部,
const fixed = contentIsMaximize || isFullContent.value || isMobile.value;
const fixed =
contentIsMaximize ||
isFullContent.value ||
isMobile.value ||
!isShowHeaderNav.value;
return {
fixed,

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/layout-ui",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/menu-ui",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -44,8 +44,8 @@ describe('drawerApi', () => {
it('should initialize with default state', () => {
expect(drawerState.isOpen).toBe(false);
expect(drawerState.cancelText).toBe('取消');
expect(drawerState.confirmText).toBe('确定');
expect(drawerState.cancelText).toBe(undefined);
expect(drawerState.confirmText).toBe(undefined);
});
it('should open the drawer', () => {

View File

@ -28,12 +28,10 @@ export class DrawerApi {
} = options;
const defaultState: DrawerState = {
cancelText: '取消',
closable: true,
closeOnClickModal: true,
closeOnPressEscape: true,
confirmLoading: false,
confirmText: '确定',
footer: true,
isOpen: false,
loading: false,

View File

@ -3,7 +3,11 @@ import type { DrawerProps, ExtendedDrawerApi } from './drawer';
import { ref, watch } from 'vue';
import { useIsMobile, usePriorityValue } from '@vben-core/composables';
import {
useIsMobile,
usePriorityValue,
useSimpleLocale,
} from '@vben-core/composables';
import { Info, X } from '@vben-core/icons';
import {
Sheet,
@ -34,7 +38,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const wrapperRef = ref<HTMLElement>();
const { $t } = useSimpleLocale();
const { isMobile } = useIsMobile();
const state = props.drawerApi?.useStore?.();
@ -165,7 +169,7 @@ function pointerDownOutside(e: Event) {
<slot name="footer">
<VbenButton variant="ghost" @click="() => drawerApi?.onCancel()">
<slot name="cancelText">
{{ cancelText }}
{{ cancelText || $t('cancel') }}
</slot>
</VbenButton>
<VbenButton
@ -173,7 +177,7 @@ function pointerDownOutside(e: Event) {
@click="() => drawerApi?.onConfirm()"
>
<slot name="confirmText">
{{ confirmText }}
{{ confirmText || $t('confirm') }}
</slot>
</VbenButton>
</slot>

View File

@ -44,8 +44,8 @@ describe('modalApi', () => {
it('should initialize with default state', () => {
expect(modalState.isOpen).toBe(false);
expect(modalState.cancelText).toBe('取消');
expect(modalState.confirmText).toBe('确定');
expect(modalState.cancelText).toBe(undefined);
expect(modalState.confirmText).toBe(undefined);
});
it('should open the modal', () => {

View File

@ -28,12 +28,10 @@ export class ModalApi {
} = options;
const defaultState: ModalState = {
cancelText: '取消',
centered: false,
closeOnClickModal: true,
closeOnPressEscape: true,
confirmLoading: false,
confirmText: '确定',
draggable: false,
footer: true,
fullscreen: false,

View File

@ -3,7 +3,11 @@ import type { ExtendedModalApi, ModalProps } from './modal';
import { computed, nextTick, ref, watch } from 'vue';
import { useIsMobile, usePriorityValue } from '@vben-core/composables';
import {
useIsMobile,
usePriorityValue,
useSimpleLocale,
} from '@vben-core/composables';
import { Expand, Info, Shrink } from '@vben-core/icons';
import {
Dialog,
@ -44,6 +48,7 @@ const dialogRef = ref();
const headerRef = ref();
const footerRef = ref();
const { $t } = useSimpleLocale();
const { isMobile } = useIsMobile();
const state = props.modalApi?.useStore?.();
@ -235,7 +240,7 @@ function pointerDownOutside(e: Event) {
<slot name="footer">
<VbenButton variant="ghost" @click="() => modalApi?.onCancel()">
<slot name="cancelText">
{{ cancelText }}
{{ cancelText || $t('cancel') }}
</slot>
</VbenButton>
<VbenButton
@ -243,7 +248,7 @@ function pointerDownOutside(e: Event) {
@click="() => modalApi?.onConfirm()"
>
<slot name="confirmText">
{{ confirmText }}
{{ confirmText || $t('confirm') }}
</slot>
</VbenButton>
</slot>

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/shadcn-ui",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -53,10 +53,7 @@ withDefaults(defineProps<Props>(), {
:width="logoSize"
class="relative rounded-none bg-transparent"
/>
<span
v-if="!collapsed"
class="text-primary dark:text-foreground truncate text-nowrap"
>
<span v-if="!collapsed" class="text-foreground truncate text-nowrap">
{{ text }}
</span>
</a>

View File

@ -1,6 +1,6 @@
{
"name": "@vben-core/tabs-ui",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/constants",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/access",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/common-ui",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/hooks",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/layouts",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/plugins",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/request",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/icons",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/locales",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
@ -21,6 +21,7 @@
},
"dependencies": {
"@intlify/core-base": "^9.14.0",
"@vben-core/composables": "workspace:*",
"vue": "^3.4.38",
"vue-i18n": "^9.14.0"
}

View File

@ -10,6 +10,8 @@ import type {
import { type App, unref } from 'vue';
import { createI18n } from 'vue-i18n';
import { useSimpleLocale } from '@vben-core/composables';
const i18n = createI18n({
globalInjection: true,
legacy: false,
@ -19,6 +21,8 @@ const i18n = createI18n({
const modules = import.meta.glob('./langs/*.json');
const { setSimpleLocale } = useSimpleLocale();
const localesMap = loadLocalesMap(modules);
let loadMessages: LoadMessageFn;
@ -75,6 +79,7 @@ async function loadLocaleMessages(lang: SupportedLanguagesType) {
if (unref(i18n.global.locale) === lang) {
return setI18nLanguage(lang);
}
setSimpleLocale(lang);
const message = await localesMap[lang]?.();

View File

@ -1,6 +1,6 @@
{
"name": "@vben/preferences",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/stores",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/styles",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/types",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -1,6 +1,6 @@
{
"name": "@vben/utils",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -14,3 +14,6 @@ VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip
VITE_ARCHIVER=true

View File

@ -1,6 +1,6 @@
{
"name": "@vben/playground",
"version": "5.1.2",
"version": "5.2.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@ -359,15 +359,9 @@ importers:
'@vben/styles':
specifier: workspace:*
version: link:../packages/styles
'@vueuse/core':
specifier: ^11.0.3
version: 11.0.3(vue@3.4.38(typescript@5.5.4))
lucide-vue-next:
specifier: ^0.436.0
version: 0.436.0(vue@3.4.38(typescript@5.5.4))
markdown-it:
specifier: ^14.1.0
version: 14.1.0
medium-zoom:
specifier: ^1.1.0
version: 1.1.0
@ -378,9 +372,9 @@ importers:
'@nolebase/vitepress-plugin-git-changelog':
specifier: ^2.4.0
version: 2.4.0(@algolia/client-search@4.24.0)(@types/node@22.5.1)(async-validator@4.2.5)(axios@1.7.5)(nprogress@0.2.0)(postcss@8.4.41)(qrcode@1.5.4)(sass@1.77.8)(search-insights@2.16.3)(sortablejs@1.15.2)(terser@5.31.6)(typescript@5.5.4)
'@types/markdown-it':
specifier: ^14.1.2
version: 14.1.2
'@vben/vite-config':
specifier: workspace:*
version: link:../internal/vite-config
'@vite-pwa/vitepress':
specifier: ^0.5.0
version: 0.5.0(vite-plugin-pwa@0.20.1(vite@5.4.2(@types/node@22.5.1)(less@4.2.0)(sass@1.77.8)(terser@5.31.6))(workbox-build@7.1.1)(workbox-window@7.1.0))
@ -649,6 +643,9 @@ importers:
'@jspm/generator':
specifier: ^2.1.3
version: 2.1.3
archiver:
specifier: ^7.0.1
version: 7.0.1
cheerio:
specifier: 1.0.0
version: 1.0.0
@ -674,6 +671,9 @@ importers:
specifier: ^7.3.9
version: 7.3.9(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(less@4.2.0)(sass@1.77.8)(terser@5.31.6))(vue@3.4.38(typescript@5.5.4))
devDependencies:
'@types/archiver':
specifier: ^6.0.2
version: 6.0.2
'@types/html-minifier-terser':
specifier: ^7.0.2
version: 7.0.2
@ -1112,6 +1112,9 @@ importers:
'@intlify/core-base':
specifier: ^9.14.0
version: 9.14.0
'@vben-core/composables':
specifier: workspace:*
version: link:../@core/composables
vue:
specifier: 3.4.38
version: 3.4.38(typescript@5.5.4)
@ -4043,6 +4046,9 @@ packages:
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
engines: {node: '>=10.13.0'}
'@types/archiver@6.0.2':
resolution: {integrity: sha512-KmROQqbQzKGuaAbmK+ZcytkJ51+YqDa7NmbXjmtC5YBLSyQYo21YaUnQ3HbaPFKL1ooo6RQ6OPYPIDyxfpDDXw==}
'@types/argparse@1.0.38':
resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
@ -4149,6 +4155,9 @@ packages:
'@types/qrcode@1.5.5':
resolution: {integrity: sha512-CdfBi/e3Qk+3Z/fXYShipBT13OJ2fDO2Q2w5CIP5anLTLIndQG9z6P1cnm+8zCWSpm5dnxMFd/uREtb0EXuQzg==}
'@types/readdir-glob@1.1.5':
resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==}
'@types/resolve@1.20.2':
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
@ -7012,9 +7021,6 @@ packages:
lines-and-columns@1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
linkify-it@5.0.0:
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
lint-staged@15.2.9:
resolution: {integrity: sha512-BZAt8Lk3sEnxw7tfxM7jeZlPRuT4M68O0/CwZhhaw6eeWu0Lz5eERE3m386InivXB64fp/mDID452h48tvKlRQ==}
engines: {node: '>=18.12.0'}
@ -7194,10 +7200,6 @@ packages:
mark.js@8.11.1:
resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==}
markdown-it@14.1.0:
resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
hasBin: true
mathml-tag-names@2.1.3:
resolution: {integrity: sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==}
@ -7207,9 +7209,6 @@ packages:
mdn-data@2.0.30:
resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
mdurl@2.0.0:
resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
medium-zoom@1.1.0:
resolution: {integrity: sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==}
@ -8372,10 +8371,6 @@ packages:
engines: {node: '>=16'}
hasBin: true
punycode.js@2.3.1:
resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
engines: {node: '>=6'}
punycode@2.3.1:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@ -9385,9 +9380,6 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
uc.micro@2.1.0:
resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
ufo@1.5.4:
resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==}
@ -13038,6 +13030,10 @@ snapshots:
'@trysound/sax@0.2.0': {}
'@types/archiver@6.0.2':
dependencies:
'@types/readdir-glob': 1.1.5
'@types/argparse@1.0.38': {}
'@types/bintrees@1.0.6': {}
@ -13156,6 +13152,10 @@ snapshots:
dependencies:
'@types/node': 22.5.1
'@types/readdir-glob@1.1.5':
dependencies:
'@types/node': 22.5.1
'@types/resolve@1.20.2': {}
'@types/semver@7.5.8': {}
@ -16499,10 +16499,6 @@ snapshots:
lines-and-columns@1.2.4: {}
linkify-it@5.0.0:
dependencies:
uc.micro: 2.1.0
lint-staged@15.2.9:
dependencies:
chalk: 5.3.0
@ -16719,23 +16715,12 @@ snapshots:
mark.js@8.11.1: {}
markdown-it@14.1.0:
dependencies:
argparse: 2.0.1
entities: 4.5.0
linkify-it: 5.0.0
mdurl: 2.0.0
punycode.js: 2.3.1
uc.micro: 2.1.0
mathml-tag-names@2.1.3: {}
mdn-data@2.0.28: {}
mdn-data@2.0.30: {}
mdurl@2.0.0: {}
medium-zoom@1.1.0: {}
memoize-one@6.0.0: {}
@ -17909,8 +17894,6 @@ snapshots:
picocolors: 1.0.1
sade: 1.8.1
punycode.js@2.3.1: {}
punycode@2.3.1: {}
pupa@3.1.0:
@ -19040,8 +19023,6 @@ snapshots:
typescript@5.5.4: {}
uc.micro@2.1.0: {}
ufo@1.5.4: {}
unbox-primitive@1.0.2:

View File

@ -1,6 +1,6 @@
{
"name": "@vben/turbo-run",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"license": "MIT",
"type": "module",

View File

@ -1,6 +1,6 @@
{
"name": "@vben/vsh",
"version": "5.1.2",
"version": "5.2.0",
"private": true,
"license": "MIT",
"type": "module",

View File

@ -16,7 +16,7 @@
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
"outputs": ["dist/**", "dist.zip"]
},
"preview": {
"dependsOn": ["^build"],