chore: format code

pull/48/MERGE
vben 2024-06-08 19:49:06 +08:00
parent d584d4cf4e
commit 7bcd7746ca
187 changed files with 775 additions and 587 deletions

View File

@ -1,6 +1,7 @@
import type { UserApiType } from '@/apis/types';
import type { UserInfo } from '@vben/types'; import type { UserInfo } from '@vben/types';
import type { UserApiType } from '@/apis/types';
import { request } from '@/forward'; import { request } from '@/forward';
/** /**

View File

@ -1,13 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import 'dayjs/locale/zh-cn'; import { computed } from 'vue';
import { preferences, usePreferences } from '@vben-core/preferences';
import { GlobalProvider } from '@vben/common-ui'; import { GlobalProvider } from '@vben/common-ui';
import { preferences, usePreferences } from '@vben-core/preferences';
import { ConfigProvider, theme } from 'ant-design-vue'; import { ConfigProvider, theme } from 'ant-design-vue';
import zhCN from 'ant-design-vue/es/locale/zh_CN'; import zhCN from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { computed } from 'vue';
import 'dayjs/locale/zh-cn';
defineOptions({ name: 'App' }); defineOptions({ name: 'App' });

View File

@ -1,10 +1,10 @@
import '@vben/styles'; import { createApp } from 'vue';
import { setupI18n } from '@vben/locales';
import '@vben/styles';
import { preferences } from '@vben-core/preferences'; import { preferences } from '@vben-core/preferences';
import { setupStore } from '@/store'; import { setupStore } from '@/store';
import { setupI18n } from '@vben/locales';
import { createApp } from 'vue';
import App from './app.vue'; import App from './app.vue';
import { router } from './router'; import { router } from './router';

View File

@ -1,16 +1,16 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { NotificationItem } from '@vben/common-ui'; import type { NotificationItem } from '@vben/common-ui';
import { preferences } from '@vben-core/preferences'; import { computed, ref } from 'vue';
import { useAccessStore } from '@vben-core/stores'; import { useRouter } from 'vue-router';
import { Notification, UserDropdown } from '@vben/common-ui'; import { Notification, UserDropdown } from '@vben/common-ui';
import { IcRoundCreditScore, MdiDriveDocument, MdiGithub } from '@vben/icons'; import { IcRoundCreditScore, MdiDriveDocument, MdiGithub } from '@vben/icons';
import { BasicLayout } from '@vben/layouts'; import { BasicLayout } from '@vben/layouts';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { openWindow } from '@vben/utils'; import { openWindow } from '@vben/utils';
import { computed, ref } from 'vue'; import { preferences } from '@vben-core/preferences';
import { useRouter } from 'vue-router'; import { useAccessStore } from '@vben-core/stores';
// https://avatar.vercel.sh/vercel.svg?text=Vaa // https://avatar.vercel.sh/vercel.svg?text=Vaa
// https://avatar.vercel.sh/1 // https://avatar.vercel.sh/1

View File

@ -1,11 +1,12 @@
import { generatorMenus, generatorRoutes } from '@vben-core/helpers';
import { preferences } from '@vben-core/preferences';
import { useAccessStore } from '@vben-core/stores';
import type { RouteLocationNormalized, Router } from 'vue-router'; import type { RouteLocationNormalized, Router } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants'; import { LOGIN_PATH } from '@vben/constants';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { startProgress, stopProgress } from '@vben/utils'; import { startProgress, stopProgress } from '@vben/utils';
import { generatorMenus, generatorRoutes } from '@vben-core/helpers';
import { preferences } from '@vben-core/preferences';
import { useAccessStore } from '@vben-core/stores';
import { useTitle } from '@vueuse/core'; import { useTitle } from '@vueuse/core';
import { dynamicRoutes } from '@/router/routes'; import { dynamicRoutes } from '@/router/routes';
@ -81,15 +82,16 @@ function setupAccessGuard(router: Router) {
// 生成路由表 // 生成路由表
// 当前登录用户拥有的角色标识列表 // 当前登录用户拥有的角色标识列表
const userRoles = accessStore.getUserRoles; const userRoles = accessStore.getUserRoles;
const routes = await generatorRoutes(dynamicRoutes, userRoles); const accessibleRoutes = await generatorRoutes(dynamicRoutes, userRoles);
// 动态添加到router实例内 // 动态添加到router实例内
routes.forEach((route) => router.addRoute(route)); accessibleRoutes.forEach((route) => router.addRoute(route));
const menus = await generatorMenus(routes, router); // 生成菜单
const menus = await generatorMenus(accessibleRoutes, router);
// 保存菜单信息和路由信息 // 保存菜单信息和路由信息
accessStore.setAccessMenus(menus); accessStore.setAccessMenus(menus);
accessStore.setAccessRoutes(routes); accessStore.setAccessRoutes(accessibleRoutes);
const redirectPath = (from.query.redirect ?? to.path) as string; const redirectPath = (from.query.redirect ?? to.path) as string;
return { return {

View File

@ -1,8 +1,9 @@
import type { RouteRecordName, RouteRecordRaw } from 'vue-router'; import type { RouteRecordName, RouteRecordRaw } from 'vue-router';
import { traverseTreeValues } from '@vben/utils';
import { createRouter, createWebHashHistory } from 'vue-router'; import { createRouter, createWebHashHistory } from 'vue-router';
import { traverseTreeValues } from '@vben/utils';
import { createRouterGuard } from './guard'; import { createRouterGuard } from './guard';
import { routes } from './routes'; import { routes } from './routes';

View File

@ -1,13 +1,13 @@
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import { AuthPageLayoutType } from '@/layouts';
import { Fallback } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { AuthPageLayoutType } from '@/layouts';
import Login from '@/views/_essential/authentication/login.vue'; import Login from '@/views/_essential/authentication/login.vue';
/** 基本路由,这些路由是必须存在的 */ /** 基本路由,这些路由是必须存在的 */
const essentialRoutes: RouteRecordRaw[] = [ const essentialsRoutes: RouteRecordRaw[] = [
{ {
component: AuthPageLayoutType, component: AuthPageLayoutType,
meta: { meta: {
@ -69,7 +69,7 @@ const essentialRoutes: RouteRecordRaw[] = [
}, },
// 错误页 // 错误页
{ {
component: Fallback, component: () => import('@/views/_essential/fallback/not-found.vue'),
meta: { meta: {
hideInBreadcrumb: true, hideInBreadcrumb: true,
hideInMenu: true, hideInMenu: true,
@ -82,4 +82,4 @@ const essentialRoutes: RouteRecordRaw[] = [
}, },
]; ];
export { essentialRoutes }; export { essentialsRoutes };

View File

@ -1,8 +1,9 @@
import { preferences } from '@vben-core/preferences';
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout, IFrameView } from '@/layouts';
import { VBEN_GITHUB_URL } from '@vben/constants'; import { VBEN_GITHUB_URL } from '@vben/constants';
import { preferences } from '@vben-core/preferences';
import { BasicLayout, IFrameView } from '@/layouts';
import { $t } from '@vben/locales/helper'; import { $t } from '@vben/locales/helper';
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [

View File

@ -1,7 +1,8 @@
import { mergeRouteModules } from '@vben-core/helpers';
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import { essentialRoutes } from './_essential'; import { mergeRouteModules } from '@vben-core/helpers';
import { essentialsRoutes } from './_essentials';
const dynamicRouteFiles = import.meta.glob('./dynamic/**/*.ts', { const dynamicRouteFiles = import.meta.glob('./dynamic/**/*.ts', {
eager: true, eager: true,
@ -23,6 +24,6 @@ const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles); const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
/** 路由列表,由基本路由+静态路由组成 */ /** 路由列表,由基本路由+静态路由组成 */
const routes: RouteRecordRaw[] = [...essentialRoutes, ...staticRoutes]; const routes: RouteRecordRaw[] = [...essentialsRoutes, ...staticRoutes];
export { dynamicRoutes, externalRoutes, routes }; export { dynamicRoutes, externalRoutes, routes };

View File

@ -1,9 +1,9 @@
import type { InitStoreOptions } from '@vben-core/stores'; import type { InitStoreOptions } from '@vben-core/stores';
import { initStore } from '@vben-core/stores';
import type { App } from 'vue'; import type { App } from 'vue';
import { initStore } from '@vben-core/stores';
/** /**
* @zh_CN pinia * @zh_CN pinia
* @param app vue app * @param app vue app

View File

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginCodeParams } from '@vben/common-ui'; import type { LoginCodeParams } from '@vben/common-ui';
import { AuthenticationCodeLogin } from '@vben/common-ui';
import { ref } from 'vue'; import { ref } from 'vue';
import { AuthenticationCodeLogin } from '@vben/common-ui';
defineOptions({ name: 'CodeLogin' }); defineOptions({ name: 'CodeLogin' });
const loading = ref(false); const loading = ref(false);

View File

@ -1,7 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { AuthenticationForgetPassword } from '@vben/common-ui';
import { ref } from 'vue'; import { ref } from 'vue';
import { AuthenticationForgetPassword } from '@vben/common-ui';
defineOptions({ name: 'ForgetPassword' }); defineOptions({ name: 'ForgetPassword' });
const loading = ref(false); const loading = ref(false);

View File

@ -1,15 +1,16 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { LoginAndRegisterParams } from '@vben/common-ui';
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { AuthenticationLogin } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { useRequest } from '@vben-core/request'; import { useRequest } from '@vben-core/request';
import { useAccessStore } from '@vben-core/stores'; import { useAccessStore } from '@vben-core/stores';
import { getUserInfo, userLogin } from '@/apis'; import { getUserInfo, userLogin } from '@/apis';
import { AuthenticationLogin } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { notification } from 'ant-design-vue'; import { notification } from 'ant-design-vue';
import { computed } from 'vue';
import { useRouter } from 'vue-router';
defineOptions({ name: 'Login' }); defineOptions({ name: 'Login' });

View File

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { LoginAndRegisterParams } from '@vben/common-ui';
import { AuthenticationRegister } from '@vben/common-ui';
import { ref } from 'vue'; import { ref } from 'vue';
import { AuthenticationRegister } from '@vben/common-ui';
defineOptions({ name: 'Register' }); defineOptions({ name: 'Register' });
const loading = ref(false); const loading = ref(false);

View File

@ -0,0 +1,7 @@
<script lang="ts" setup>
import { Fallback } from '@vben/common-ui';
</script>
<template>
<Fallback />
</template>

View File

@ -41,9 +41,9 @@
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-i": "^2.29.1", "eslint-plugin-i": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.7", "eslint-plugin-jsdoc": "^48.2.8",
"eslint-plugin-jsonc": "^2.16.0", "eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^17.7.0", "eslint-plugin-n": "^17.8.0",
"eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-perfectionist": "^2.10.0", "eslint-plugin-perfectionist": "^2.10.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",

View File

@ -22,31 +22,38 @@ export async function perfectionist(): Promise<Linter.FlatConfig[]> {
{ {
'custom-groups': { 'custom-groups': {
type: { type: {
vben: 'vue', vben: 'vben',
vue: ['vue', 'vue-*', '@vue*'], vue: 'vue',
}, },
value: { value: {
vben: 'vben', vben: ['@vben*', '@vben/*', '@vben-core/*'],
vue: ['@vben-*', '@vben-core/*'], vue: ['vue', 'vue-*', '@vue*'],
}, },
}, },
groups: [ groups: [
'side-effect', ['external-type', 'builtin-type', 'type'],
'type', ['parent-type', 'sibling-type', 'index-type'],
'vue', ['internal-type'],
'builtin', 'builtin',
'vue',
'vben', 'vben',
'external', 'external',
'internal-type',
'internal', 'internal',
['parent', 'sibling', 'index'], ['parent', 'sibling', 'index'],
'side-effect',
'side-effect-style',
'style', 'style',
'object', 'object',
'unknown', 'unknown',
'type',
['parent-type', 'sibling-type', 'index-type'],
], ],
'internal-pattern': ['@/layouts/**', '@/router/**', '@/views/**'], 'internal-pattern': [
'@/layouts/**',
'@/apis/**',
'@/forward/**',
'@/router/**',
'@/views/**',
'#/**',
],
'newlines-between': 'always', 'newlines-between': 'always',
order: 'asc', order: 'asc',
type: 'natural', type: 'natural',

View File

@ -54,12 +54,12 @@
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e", "@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
"@tailwindcss/typography": "^0.5.13", "@tailwindcss/typography": "^0.5.13",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"cssnano": "^7.0.1", "cssnano": "^7.0.2",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"postcss-antd-fixes": "^0.2.0", "postcss-antd-fixes": "^0.2.0",
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"postcss-preset-env": "^9.5.14", "postcss-preset-env": "^9.5.14",
"tailwindcss": "^3.4.3", "tailwindcss": "^3.4.4",
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },
"devDependencies": { "devDependencies": {

View File

@ -2,10 +2,11 @@ import type { Config } from 'tailwindcss';
import path from 'node:path'; import path from 'node:path';
import { fs, getPackagesSync } from '@vben/node-utils';
import { addDynamicIconSelectors } from '@iconify/tailwind'; import { addDynamicIconSelectors } from '@iconify/tailwind';
import formsPlugin from '@tailwindcss/forms'; import formsPlugin from '@tailwindcss/forms';
import typographyPlugin from '@tailwindcss/typography'; import typographyPlugin from '@tailwindcss/typography';
import { fs, getPackagesSync } from '@vben/node-utils';
import animate from 'tailwindcss-animate'; import animate from 'tailwindcss-animate';
import { enterAnimationPlugin } from './plugins/entry'; import { enterAnimationPlugin } from './plugins/entry';

View File

@ -1,5 +1,7 @@
import type { UserConfig } from 'vite'; import type { UserConfig } from 'vite';
import type { DefineApplicationOptions } from '../typing';
import { resolve } from 'node:path'; import { resolve } from 'node:path';
import { defineConfig, loadEnv, mergeConfig } from 'vite'; import { defineConfig, loadEnv, mergeConfig } from 'vite';
@ -7,8 +9,6 @@ import { defineConfig, loadEnv, mergeConfig } from 'vite';
import { getApplicationConditionPlugins } from '../plugins'; import { getApplicationConditionPlugins } from '../plugins';
import { getCommonConfig } from './common'; import { getCommonConfig } from './common';
import type { DefineApplicationOptions } from '../typing';
function defineApplicationConfig(options: DefineApplicationOptions = {}) { function defineApplicationConfig(options: DefineApplicationOptions = {}) {
return defineConfig(async ({ command, mode }) => { return defineConfig(async ({ command, mode }) => {
const { application = {}, vite = {} } = options; const { application = {}, vite = {} } = options;

View File

@ -1,11 +1,11 @@
import type { DefineConfig } from '../typing';
import { existsSync } from 'node:fs'; import { existsSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { defineApplicationConfig } from './application'; import { defineApplicationConfig } from './application';
import { defineLibraryConfig } from './library'; import { defineLibraryConfig } from './library';
import type { DefineConfig } from '../typing';
export * from './application'; export * from './application';
export * from './library'; export * from './library';

View File

@ -1,13 +1,14 @@
import type { UserConfig } from 'vite'; import type { UserConfig } from 'vite';
import type { DefineLibraryOptions } from '../typing';
import { readPackageJSON } from '@vben/node-utils'; import { readPackageJSON } from '@vben/node-utils';
import { defineConfig, mergeConfig } from 'vite'; import { defineConfig, mergeConfig } from 'vite';
import { getLibraryConditionPlugins } from '../plugins'; import { getLibraryConditionPlugins } from '../plugins';
import { getCommonConfig } from './common'; import { getCommonConfig } from './common';
import type { DefineLibraryOptions } from '../typing';
function defineLibraryConfig(options: DefineLibraryOptions = {}) { function defineLibraryConfig(options: DefineLibraryOptions = {}) {
return defineConfig(async ({ command, mode }) => { return defineConfig(async ({ command, mode }) => {
const root = process.cwd(); const root = process.cwd();

View File

@ -3,6 +3,7 @@ import {
generatorContentHash, generatorContentHash,
readPackageJSON, readPackageJSON,
} from '@vben/node-utils'; } from '@vben/node-utils';
import { type PluginOption } from 'vite'; import { type PluginOption } from 'vite';
import { getEnvConfig } from '../utils/env'; import { getEnvConfig } from '../utils/env';

View File

@ -1,9 +1,17 @@
import type { PluginOption } from 'vite'; import type { PluginOption } from 'vite';
import type {
ApplicationPluginOptions,
CommonPluginOptions,
ConditionPlugin,
LibraryPluginOptions,
} from '../typing';
import { join } from 'node:path'; import { join } from 'node:path';
import viteVueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import { getPackage } from '@vben/node-utils'; import { getPackage } from '@vben/node-utils';
import viteVueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import viteVue from '@vitejs/plugin-vue'; import viteVue from '@vitejs/plugin-vue';
import viteVueJsx from '@vitejs/plugin-vue-jsx'; import viteVueJsx from '@vitejs/plugin-vue-jsx';
import { visualizer as viteVisualizerPlugin } from 'rollup-plugin-visualizer'; import { visualizer as viteVisualizerPlugin } from 'rollup-plugin-visualizer';
@ -19,13 +27,6 @@ import { viteExtraAppConfigPlugin } from './extra-app-config';
import { viteImportMapPlugin } from './importmap'; import { viteImportMapPlugin } from './importmap';
import { viteInjectAppLoadingPlugin } from './inject-app-loading'; import { viteInjectAppLoadingPlugin } from './inject-app-loading';
import type {
ApplicationPluginOptions,
CommonPluginOptions,
ConditionPlugin,
LibraryPluginOptions,
} from '../typing';
/** /**
* vite * vite
* @param conditionPlugins * @param conditionPlugins

View File

@ -2,6 +2,7 @@ import { join } from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { fs } from '@vben/node-utils'; import { fs } from '@vben/node-utils';
import { type PluginOption } from 'vite'; import { type PluginOption } from 'vite';
/** /**

View File

@ -29,7 +29,7 @@
.loading.hidden { .loading.hidden {
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
transition: all 1s ease-out; transition: all 0.6s ease-out;
} }
.loading .dots { .loading .dots {

View File

@ -23,7 +23,7 @@
.loading.hidden { .loading.hidden {
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
transition: all 1s ease-out; transition: all 0.6s ease-out;
} }
.dark .loading { .dark .loading {

View File

@ -1,6 +1,7 @@
import { join } from 'node:path'; import { join } from 'node:path';
import { fs } from '@vben/node-utils'; import { fs } from '@vben/node-utils';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
/** /**

View File

@ -48,7 +48,7 @@
"@changesets/cli": "^2.27.5", "@changesets/cli": "^2.27.5",
"@ls-lint/ls-lint": "^2.2.3", "@ls-lint/ls-lint": "^2.2.3",
"@types/jsdom": "^21.1.7", "@types/jsdom": "^21.1.7",
"@types/node": "^20.14.1", "@types/node": "^20.14.2",
"@vben/commitlint-config": "workspace:*", "@vben/commitlint-config": "workspace:*",
"@vben/eslint-config": "workspace:*", "@vben/eslint-config": "workspace:*",
"@vben/lint-staged-config": "workspace:*", "@vben/lint-staged-config": "workspace:*",
@ -76,7 +76,7 @@
"node": ">=18.7.0", "node": ">=18.7.0",
"pnpm": ">=8.5.0" "pnpm": ">=8.5.0"
}, },
"packageManager": "pnpm@9.1.4", "packageManager": "pnpm@9.2.0",
"pnpm": { "pnpm": {
"overrides": { "overrides": {
"@ctrl/tinycolor": "4.1.0", "@ctrl/tinycolor": "4.1.0",

View File

@ -1,7 +1,7 @@
import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben-core/typings'; import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben-core/typings';
import type { RouteRecordRaw, Router } from 'vue-router';
import { mapTree } from '@vben-core/toolkit'; import { mapTree } from '@vben-core/toolkit';
import type { RouteRecordRaw, Router } from 'vue-router';
/** /**
* routes * routes

View File

@ -1,16 +1,30 @@
import { filterTree } from '@vben-core/toolkit';
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import { filterTree, mapTree } from '@vben-core/toolkit';
/** /**
* *
*/ */
async function generatorRoutes( async function generatorRoutes(
routes: RouteRecordRaw[], routes: RouteRecordRaw[],
roles: string[], roles: string[],
forbiddenPage?: RouteRecordRaw['component'],
): Promise<RouteRecordRaw[]> { ): Promise<RouteRecordRaw[]> {
// 根据角色标识过滤路由表,判断当前用户是否拥有指定权限 // 根据角色标识过滤路由表,判断当前用户是否拥有指定权限
return filterTree(routes, (route) => { const finalRoutes = filterTree(routes, (route) => {
return hasVisible(route) && hasAuthority(route, roles); return hasVisible(route) && hasAuthority(route, roles);
}); });
if (!forbiddenPage) {
return finalRoutes;
}
// 如果有禁止访问的页面将禁止访问的页面替换为403页面
return mapTree(finalRoutes, (route) => {
if (menuHasVisibleWithForbidden(route)) {
route.component = forbiddenPage;
}
return route;
});
} }
/** /**
@ -24,9 +38,10 @@ function hasAuthority(route: RouteRecordRaw, access: string[]) {
if (!authority) { if (!authority) {
return true; return true;
} }
return access.some((value) => { return (
return authority.includes(value); access.some((value) => authority.includes(value)) ||
}); menuHasVisibleWithForbidden(route)
);
} }
/** /**
@ -37,4 +52,12 @@ function hasVisible(route?: RouteRecordRaw) {
return !route?.meta?.hideInMenu; return !route?.meta?.hideInMenu;
} }
/**
* 访403
* @param route
*/
function menuHasVisibleWithForbidden(route: RouteRecordRaw) {
return !!route.meta?.menuVisibleWithForbidden;
}
export { generatorRoutes, hasAuthority, hasVisible }; export { generatorRoutes, hasAuthority, hasVisible };

View File

@ -1,11 +1,11 @@
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import type { RouteModuleType } from './merge-route-modules';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { mergeRouteModules } from './merge-route-modules'; import { mergeRouteModules } from './merge-route-modules';
import type { RouteModuleType } from './merge-route-modules';
describe('mergeRouteModules', () => { describe('mergeRouteModules', () => {
it('should merge route modules correctly', () => { it('should merge route modules correctly', () => {
const routeModules: Record<string, RouteModuleType> = { const routeModules: Record<string, RouteModuleType> = {

View File

@ -1,9 +1,9 @@
import type { Flatten } from '@vben-core/typings'; import type { Flatten } from '@vben-core/typings';
import { preferencesManager } from './preferences';
import type { Preferences } from './types'; import type { Preferences } from './types';
import { preferencesManager } from './preferences';
// 偏好设置(带有层级关系) // 偏好设置(带有层级关系)
const preferences: Preferences = preferencesManager.getPreferences(); const preferences: Preferences = preferencesManager.getPreferences();

View File

@ -4,6 +4,10 @@ import type {
FlattenObjectKeys, FlattenObjectKeys,
} from '@vben-core/typings'; } from '@vben-core/typings';
import type { Preferences } from './types';
import { markRaw, reactive, watch } from 'vue';
import { StorageManager } from '@vben-core/cache'; import { StorageManager } from '@vben-core/cache';
import { flattenObject, nestedObject } from '@vben-core/helpers'; import { flattenObject, nestedObject } from '@vben-core/helpers';
import { convertToHslCssVar, merge } from '@vben-core/toolkit'; import { convertToHslCssVar, merge } from '@vben-core/toolkit';
@ -14,12 +18,9 @@ import {
useCssVar, useCssVar,
useDebounceFn, useDebounceFn,
} from '@vueuse/core'; } from '@vueuse/core';
import { markRaw, reactive, watch } from 'vue';
import { defaultPreferences } from './config'; import { defaultPreferences } from './config';
import type { Preferences } from './types';
const STORAGE_KEY = 'preferences'; const STORAGE_KEY = 'preferences';
const STORAGE_KEY_LOCALE = `${STORAGE_KEY}-locale`; const STORAGE_KEY_LOCALE = `${STORAGE_KEY}-locale`;
const STORAGE_KEY_THEME = `${STORAGE_KEY}-theme`; const STORAGE_KEY_THEME = `${STORAGE_KEY}-theme`;

View File

@ -1,7 +1,7 @@
import { diff } from '@vben-core/toolkit';
import { computed } from 'vue'; import { computed } from 'vue';
import { diff } from '@vben-core/toolkit';
import { isDarkTheme, preferencesManager } from './preferences'; import { isDarkTheme, preferencesManager } from './preferences';
function usePreferences() { function usePreferences() {

View File

@ -6,6 +6,8 @@ import type {
InternalAxiosRequestConfig, InternalAxiosRequestConfig,
} from 'axios'; } from 'axios';
import type { MakeAuthorizationFn, RequestClientOptions } from './types';
import { merge } from '@vben-core/toolkit'; import { merge } from '@vben-core/toolkit';
import axios from 'axios'; import axios from 'axios';
@ -15,8 +17,6 @@ import { FileDownloader } from './modules/downloader';
import { InterceptorManager } from './modules/interceptor'; import { InterceptorManager } from './modules/interceptor';
import { FileUploader } from './modules/uploader'; import { FileUploader } from './modules/uploader';
import type { MakeAuthorizationFn, RequestClientOptions } from './types';
class RequestClient { class RequestClient {
private instance: AxiosInstance; private instance: AxiosInstance;
private makeAuthorization: MakeAuthorizationFn | undefined; private makeAuthorization: MakeAuthorizationFn | undefined;

View File

@ -1,5 +1,4 @@
import type { MenuRecordRaw } from '@vben-core/typings'; import type { MenuRecordRaw } from '@vben-core/typings';
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import { acceptHMRUpdate, defineStore } from 'pinia'; import { acceptHMRUpdate, defineStore } from 'pinia';

View File

@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router';
import { createPinia, setActivePinia } from 'pinia'; import { createPinia, setActivePinia } from 'pinia';
import { beforeEach, describe, expect, it, vi } from 'vitest'; import { beforeEach, describe, expect, it, vi } from 'vitest';
import { createRouter, createWebHistory } from 'vue-router';
import { useTabsStore } from './tabs'; import { useTabsStore } from './tabs';

View File

@ -1,10 +1,12 @@
import { startProgress, stopProgress } from '@vben-core/toolkit';
import { TabItem } from '@vben-core/typings';
import type { RouteRecordNormalized, Router } from 'vue-router'; import type { RouteRecordNormalized, Router } from 'vue-router';
import { acceptHMRUpdate, defineStore } from 'pinia';
import { toRaw } from 'vue'; import { toRaw } from 'vue';
import { startProgress, stopProgress } from '@vben-core/toolkit';
import { TabItem } from '@vben-core/typings';
import { acceptHMRUpdate, defineStore } from 'pinia';
/** /**
* @zh_CN , * @zh_CN ,
* @param route * @param route

View File

@ -1,6 +1,7 @@
import { Icon } from '@iconify/vue';
import { defineComponent, h } from 'vue'; import { defineComponent, h } from 'vue';
import { Icon } from '@iconify/vue';
function createIcon(name: string) { function createIcon(name: string) {
return defineComponent({ return defineComponent({
setup(props, { attrs }) { setup(props, { attrs }) {

View File

@ -72,6 +72,10 @@ interface RouteMeta {
* *
*/ */
loaded?: boolean; loaded?: boolean;
/**
* 访403
*/
menuVisibleWithForbidden?: boolean;
/** /**
* -> * ->
*/ */
@ -80,6 +84,7 @@ interface RouteMeta {
* - * -
*/ */
target?: string; target?: string;
/** /**
* *
*/ */

View File

@ -1,7 +1,7 @@
import 'vue-router';
import type { RouteMeta as IRouteMeta } from '@vben-core/typings'; import type { RouteMeta as IRouteMeta } from '@vben-core/typings';
import 'vue-router';
declare module 'vue-router' { declare module 'vue-router' {
interface RouteMeta extends IRouteMeta {} interface RouteMeta extends IRouteMeta {}
} }

View File

@ -2,7 +2,6 @@
import type { ContentCompactType } from '@vben-core/typings'; import type { ContentCompactType } from '@vben-core/typings';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
interface Props { interface Props {

View File

@ -1,10 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { useNamespace } from '@vben-core/toolkit';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
import { useNamespace } from '@vben-core/toolkit';
interface Props { interface Props {
/** /**
* 背景颜色 * 背景颜色

View File

@ -1,11 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed, useSlots } from 'vue';
import { IcRoundMenu } from '@vben-core/iconify'; import { IcRoundMenu } from '@vben-core/iconify';
import { VbenIconButton } from '@vben-core/shadcn-ui'; import { VbenIconButton } from '@vben-core/shadcn-ui';
import type { CSSProperties } from 'vue';
import { computed, useSlots } from 'vue';
interface Props { interface Props {
/** /**
* 背景颜色 * 背景颜色

View File

@ -1,12 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ScrollArea } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
// import { onClickOutside } from '@vueuse/core'; // import { onClickOutside } from '@vueuse/core';
import { computed, ref, shallowRef, useSlots, watchEffect } from 'vue'; import { computed, ref, shallowRef, useSlots, watchEffect } from 'vue';
import { ScrollArea } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit';
import { SideCollapseButton, SidePinButton } from './widgets'; import { SideCollapseButton, SidePinButton } from './widgets';
interface Props { interface Props {

View File

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
interface Props { interface Props {

View File

@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed, ref, watch } from 'vue';
import { useMouse, useScroll, useThrottleFn } from '@vueuse/core'; import { useMouse, useScroll, useThrottleFn } from '@vueuse/core';
import { computed, ref, watch } from 'vue';
import { import {
LayoutContent, LayoutContent,

View File

@ -1,12 +1,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { VbenIcon, VbenMenuBadge, VbenTooltip } from '@vben-core/shadcn-ui'; import type { MenuItemProps, MenuItemRegistered } from '../interface';
import { useNamespace } from '@vben-core/toolkit';
import { computed, onBeforeUnmount, onMounted, reactive, useSlots } from 'vue'; import { computed, onBeforeUnmount, onMounted, reactive, useSlots } from 'vue';
import { useMenu, useMenuContext, useSubMenuContext } from '../hooks'; import { VbenIcon, VbenMenuBadge, VbenTooltip } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit';
import type { MenuItemProps, MenuItemRegistered } from '../interface'; import { useMenu, useMenuContext, useSubMenuContext } from '../hooks';
interface Props extends MenuItemProps {} interface Props extends MenuItemProps {}

View File

@ -1,8 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { IcRoundMoreHoriz } from '@vben-core/iconify'; import type {
import { isHttpUrl, useNamespace } from '@vben-core/toolkit'; MenuItemClicked,
MenuItemRegistered,
MenuProps,
MenuProvider,
} from '../interface';
import { UseResizeObserverReturn, useResizeObserver } from '@vueuse/core';
import { import {
type VNodeArrayChildren, type VNodeArrayChildren,
computed, computed,
@ -15,6 +18,11 @@ import {
watchEffect, watchEffect,
} from 'vue'; } from 'vue';
import { IcRoundMoreHoriz } from '@vben-core/iconify';
import { isHttpUrl, useNamespace } from '@vben-core/toolkit';
import { UseResizeObserverReturn, useResizeObserver } from '@vueuse/core';
import { import {
createMenuContext, createMenuContext,
createSubMenuContext, createSubMenuContext,
@ -23,13 +31,6 @@ import {
import { flattedChildren } from '../utils'; import { flattedChildren } from '../utils';
import SubMenu from './sub-menu.vue'; import SubMenu from './sub-menu.vue';
import type {
MenuItemClicked,
MenuItemRegistered,
MenuProps,
MenuProvider,
} from '../interface';
interface Props extends MenuProps {} interface Props extends MenuProps {}
defineOptions({ name: 'Menu' }); defineOptions({ name: 'Menu' });

View File

@ -1,11 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { MenuRecordRaw } from '@vben-core/typings'; import type { MenuRecordRaw } from '@vben-core/typings';
import type { NormalMenuProps } from './normal-menu';
import { VbenIcon } from '@vben-core/shadcn-ui'; import { VbenIcon } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit'; import { useNamespace } from '@vben-core/toolkit';
import type { NormalMenuProps } from './normal-menu';
interface Props extends NormalMenuProps {} interface Props extends NormalMenuProps {}
defineOptions({ defineOptions({

View File

@ -1,4 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { MenuItemProps } from '../interface';
import { computed } from 'vue';
import { import {
IcRoundChevronRight, IcRoundChevronRight,
IcRoundKeyboardArrowDown, IcRoundKeyboardArrowDown,
@ -6,12 +10,8 @@ import {
import { VbenIcon } from '@vben-core/shadcn-ui'; import { VbenIcon } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit'; import { useNamespace } from '@vben-core/toolkit';
import { computed } from 'vue';
import { useMenuContext } from '../hooks'; import { useMenuContext } from '../hooks';
import type { MenuItemProps } from '../interface';
interface Props extends MenuItemProps { interface Props extends MenuItemProps {
isMenuMore: boolean; isMenuMore: boolean;
isTopLevelMenuSubmenu: boolean; isTopLevelMenuSubmenu: boolean;

View File

@ -1,11 +1,17 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { HoverCardContentProps } from '@vben-core/shadcn-ui'; import type { HoverCardContentProps } from '@vben-core/shadcn-ui';
import { VbenHoverCard } from '@vben-core/shadcn-ui'; import type {
import { useNamespace } from '@vben-core/toolkit'; MenuItemRegistered,
MenuProvider,
SubMenuProps,
} from '../interface';
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'; import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
import { VbenHoverCard } from '@vben-core/shadcn-ui';
import { useNamespace } from '@vben-core/toolkit';
import { import {
createSubMenuContext, createSubMenuContext,
useMenu, useMenu,
@ -16,12 +22,6 @@ import {
import CollapseTransition from './collapse-transition.vue'; import CollapseTransition from './collapse-transition.vue';
import SubMenuContent from './sub-menu-content.vue'; import SubMenuContent from './sub-menu-content.vue';
import type {
MenuItemRegistered,
MenuProvider,
SubMenuProps,
} from '../interface';
interface Props extends SubMenuProps { interface Props extends SubMenuProps {
isSubMenuMore?: boolean; isSubMenuMore?: boolean;
} }

View File

@ -1,9 +1,9 @@
import type { MenuProvider, SubMenuProvider } from '../interface';
import { getCurrentInstance, inject, provide } from 'vue'; import { getCurrentInstance, inject, provide } from 'vue';
import { findComponentUpward } from '../utils'; import { findComponentUpward } from '../utils';
import type { MenuProvider, SubMenuProvider } from '../interface';
const menuContextKey = Symbol('menuContext'); const menuContextKey = Symbol('menuContext');
/** /**

View File

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { MenuRecordRaw } from '@vben-core/typings'; import type { MenuRecordRaw } from '@vben-core/typings';
import { VbenMenuBadge } from '@vben-core/shadcn-ui';
import { computed } from 'vue'; import { computed } from 'vue';
import { VbenMenuBadge } from '@vben-core/shadcn-ui';
import { MenuItem, SubMenu as SubMenuComp } from './components'; import { MenuItem, SubMenu as SubMenuComp } from './components';
// eslint-disable-next-line import/no-self-import // eslint-disable-next-line import/no-self-import
import SubMenu from './sub-menu.vue'; import SubMenu from './sub-menu.vue';

View File

@ -4,7 +4,6 @@ import type {
VNodeChild, VNodeChild,
VNodeNormalizedChildren, VNodeNormalizedChildren,
} from 'vue'; } from 'vue';
import { isVNode } from 'vue'; import { isVNode } from 'vue';
type VNodeChildAtom = Exclude<VNodeChild, Array<any>>; type VNodeChildAtom = Exclude<VNodeChild, Array<any>>;

View File

@ -6,9 +6,9 @@ import type {
} from 'radix-vue'; } from 'radix-vue';
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { computed } from 'vue';
import { Avatar, AvatarFallback, AvatarImage } from '#/components/ui/avatar'; import { Avatar, AvatarFallback, AvatarImage } from '#/components/ui/avatar';
import { computed } from 'vue';
interface Props extends AvatarRootProps, AvatarFallbackProps, AvatarImageProps { interface Props extends AvatarRootProps, AvatarFallbackProps, AvatarImageProps {
alt?: string; alt?: string;

View File

@ -1,13 +1,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { IcRoundArrowUpward } from '@vben-core/iconify'; import type { BacktopProps } from './backtop';
import { computed } from 'vue'; import { computed } from 'vue';
import { IcRoundArrowUpward } from '@vben-core/iconify';
import { VbenButton } from '../button'; import { VbenButton } from '../button';
import { useBackTop } from './use-backtop'; import { useBackTop } from './use-backtop';
import type { BacktopProps } from './backtop';
interface Props extends BacktopProps {} interface Props extends BacktopProps {}
defineOptions({ name: 'BackTop' }); defineOptions({ name: 'BackTop' });

View File

@ -1,7 +1,8 @@
import { useEventListener, useThrottleFn } from '@vueuse/core'; import type { BacktopProps } from './backtop';
import { onMounted, ref, shallowRef } from 'vue'; import { onMounted, ref, shallowRef } from 'vue';
import type { BacktopProps } from './backtop'; import { useEventListener, useThrottleFn } from '@vueuse/core';
export const useBackTop = (props: BacktopProps) => { export const useBackTop = (props: BacktopProps) => {
const el = shallowRef<HTMLElement>(); const el = shallowRef<HTMLElement>();

View File

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { VbenIcon } from '../icon';
import type { IBreadcrumb } from './interface'; import type { IBreadcrumb } from './interface';
import { VbenIcon } from '../icon';
interface Props { interface Props {
breadcrumbs: IBreadcrumb[]; breadcrumbs: IBreadcrumb[];
showIcon?: boolean; showIcon?: boolean;

View File

@ -1,4 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { IBreadcrumb } from './interface';
import { IcRoundKeyboardArrowDown } from '@vben-core/iconify'; import { IcRoundKeyboardArrowDown } from '@vben-core/iconify';
import { import {
@ -18,8 +20,6 @@ import {
import { VbenIcon } from '../'; import { VbenIcon } from '../';
import type { IBreadcrumb } from './interface';
interface Props { interface Props {
breadcrumbs: IBreadcrumb[]; breadcrumbs: IBreadcrumb[];
showIcon?: boolean; showIcon?: boolean;

View File

@ -1,12 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue';
import { computed } from 'vue';
import { MdiLoading } from '@vben-core/iconify'; import { MdiLoading } from '@vben-core/iconify';
import type { HTMLAttributes } from 'vue'; import { Primitive, type PrimitiveProps } from 'radix-vue';
import { type ButtonVariants, buttonVariants } from '#/components/ui/button'; import { type ButtonVariants, buttonVariants } from '#/components/ui/button';
import { cn } from '#/lib/utils'; import { cn } from '#/lib/utils';
import { Primitive, type PrimitiveProps } from 'radix-vue';
import { computed } from 'vue';
interface Props extends PrimitiveProps { interface Props extends PrimitiveProps {
class?: HTMLAttributes['class']; class?: HTMLAttributes['class'];

View File

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { type HTMLAttributes, computed, useSlots } from 'vue';
import { type PrimitiveProps } from 'radix-vue';
import { VbenTooltip } from '#/components/tooltip'; import { VbenTooltip } from '#/components/tooltip';
import { ButtonVariants } from '#/components/ui/button'; import { ButtonVariants } from '#/components/ui/button';
import { cn } from '#/lib/utils'; import { cn } from '#/lib/utils';
import { type PrimitiveProps } from 'radix-vue';
import { type HTMLAttributes, computed, useSlots } from 'vue';
import VbenButton from './button.vue'; import VbenButton from './button.vue';

View File

@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue'; import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
import { Checkbox } from '#/components/ui/checkbox';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';
import { Checkbox } from '#/components/ui/checkbox';
const props = defineProps< const props = defineProps<
{ {
name: string; name: string;

View File

@ -5,7 +5,12 @@ import type {
ContextMenuRootProps, ContextMenuRootProps,
} from 'radix-vue'; } from 'radix-vue';
import type { IContextMenuItem } from './interface';
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue';
import { import {
ContextMenu, ContextMenu,
@ -15,10 +20,6 @@ import {
ContextMenuShortcut, ContextMenuShortcut,
ContextMenuTrigger, ContextMenuTrigger,
} from '#/components/ui/context-menu'; } from '#/components/ui/context-menu';
import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import type { IContextMenuItem } from './interface';
const props = defineProps< const props = defineProps<
{ {

View File

@ -1,4 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type {
DropdownMenuProps,
VbenDropdownMenuItem as IDropdownMenuItem,
} from './interface';
import { import {
DropdownMenu, DropdownMenu,
DropdownMenuContent, DropdownMenuContent,
@ -8,11 +13,6 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from '#/components/ui/dropdown-menu'; } from '#/components/ui/dropdown-menu';
import type {
DropdownMenuProps,
VbenDropdownMenuItem as IDropdownMenuItem,
} from './interface';
interface Props extends DropdownMenuProps {} interface Props extends DropdownMenuProps {}
defineOptions({ name: 'DropdownMenu' }); defineOptions({ name: 'DropdownMenu' });

View File

@ -1,4 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DropdownMenuProps } from './interface';
import { import {
DropdownMenu, DropdownMenu,
DropdownMenuContent, DropdownMenuContent,
@ -7,8 +9,6 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from '#/components/ui/dropdown-menu'; } from '#/components/ui/dropdown-menu';
import type { DropdownMenuProps } from './interface';
interface Props extends DropdownMenuProps {} interface Props extends DropdownMenuProps {}
defineOptions({ name: 'DropdownRadioMenu' }); defineOptions({ name: 'DropdownRadioMenu' });

View File

@ -1,13 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HoverCardRootEmits, HoverCardRootProps } from 'radix-vue'; import type { HoverCardRootEmits, HoverCardRootProps } from 'radix-vue';
import { HTMLAttributes, computed } from 'vue';
import { HoverCardContentProps, useForwardPropsEmits } from 'radix-vue';
import { import {
HoverCard, HoverCard,
HoverCardContent, HoverCardContent,
HoverCardTrigger, HoverCardTrigger,
} from '#/components/ui/hover-card'; } from '#/components/ui/hover-card';
import { HoverCardContentProps, useForwardPropsEmits } from 'radix-vue';
import { HTMLAttributes, computed } from 'vue';
const props = defineProps< const props = defineProps<
{ {

View File

@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { type Component, computed } from 'vue';
import { Icon, IconDefault } from '@vben-core/iconify'; import { Icon, IconDefault } from '@vben-core/iconify';
import { isHttpUrl, isObject, isString } from '@vben-core/toolkit'; import { isHttpUrl, isObject, isString } from '@vben-core/toolkit';
import { type Component, computed } from 'vue';
const props = defineProps<{ const props = defineProps<{
// //
fallback?: boolean; fallback?: boolean;

View File

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, useSlots } from 'vue';
import { import {
IcOutlineVisibility, IcOutlineVisibility,
IcOutlineVisibilityOff, IcOutlineVisibilityOff,
} from '@vben-core/iconify'; } from '@vben-core/iconify';
import { type InputProps, VbenInput } from '#/components/input/index';
import { useForwardProps } from 'radix-vue'; import { useForwardProps } from 'radix-vue';
import { ref, useSlots } from 'vue';
import { type InputProps, VbenInput } from '#/components/input/index';
import PasswordStrength from './password-strength.vue'; import PasswordStrength from './password-strength.vue';

View File

@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue';
import type { InputProps } from './interface'; import type { InputProps } from './interface';
import { computed } from 'vue';
defineOptions({ defineOptions({
inheritAttrs: false, inheritAttrs: false,
}); });

View File

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { MenuRecordBadgeRaw } from '@vben-core/typings'; import type { MenuRecordBadgeRaw } from '@vben-core/typings';
import { isValidColor } from '@vben-core/toolkit';
import { computed } from 'vue'; import { computed } from 'vue';
import { isValidColor } from '@vben-core/toolkit';
import BadgeDot from './menu-badge-dot.vue'; import BadgeDot from './menu-badge-dot.vue';
interface Props extends MenuRecordBadgeRaw { interface Props extends MenuRecordBadgeRaw {

View File

@ -1,13 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PinInputProps } from './interface';
import { computed, ref, watch } from 'vue';
import { VbenButton } from '#/components/button'; import { VbenButton } from '#/components/button';
import { import {
PinInput, PinInput,
PinInputGroup, PinInputGroup,
PinInputInput, PinInputInput,
} from '#/components/ui/pin-input'; } from '#/components/ui/pin-input';
import { computed, ref, watch } from 'vue';
import type { PinInputProps } from './interface';
defineOptions({ defineOptions({
inheritAttrs: false, inheritAttrs: false,

View File

@ -5,13 +5,15 @@ import type {
PopoverRootProps, PopoverRootProps,
} from 'radix-vue'; } from 'radix-vue';
import { HTMLAttributes, computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue';
import { import {
PopoverContent, PopoverContent,
Popover as PopoverRoot, Popover as PopoverRoot,
PopoverTrigger, PopoverTrigger,
} from '#/components/ui/popover'; } from '#/components/ui/popover';
import { useForwardPropsEmits } from 'radix-vue';
import { HTMLAttributes, computed } from 'vue';
const props = withDefaults( const props = withDefaults(
defineProps< defineProps<

View File

@ -1,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { Tabs, TabsContent, TabsList } from '#/components/ui/tabs'; import type { SegmentedItem } from './interface';
import { TabsTrigger } from 'radix-vue';
import { computed } from 'vue'; import { computed } from 'vue';
import TabsIndicator from './tabs-indicator.vue'; import { TabsTrigger } from 'radix-vue';
import type { SegmentedItem } from './interface'; import { Tabs, TabsContent, TabsList } from '#/components/ui/tabs';
import TabsIndicator from './tabs-indicator.vue';
interface Props { interface Props {
defaultValue?: string; defaultValue?: string;

View File

@ -1,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
TabsIndicator, TabsIndicator,
type TabsIndicatorProps, type TabsIndicatorProps,
useForwardProps, useForwardProps,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & TabsIndicatorProps { class?: HTMLAttributes['class'] } & TabsIndicatorProps

View File

@ -1,4 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, useSlots } from 'vue';
import { Cross2Icon } from '@radix-icons/vue';
import { VbenButton, VbenIconButton } from '#/components/button'; import { VbenButton, VbenIconButton } from '#/components/button';
import { ScrollArea } from '#/components/ui/scroll-area'; import { ScrollArea } from '#/components/ui/scroll-area';
import { import {
@ -11,8 +15,6 @@ import {
SheetTitle, SheetTitle,
SheetTrigger, SheetTrigger,
} from '#/components/ui/sheet'; } from '#/components/ui/sheet';
import { Cross2Icon } from '@radix-icons/vue';
import { computed, useSlots } from 'vue';
interface Props { interface Props {
cancelText?: string; cancelText?: string;

View File

@ -1,11 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { TooltipContentProps } from 'radix-vue';
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
TooltipProvider, TooltipProvider,
TooltipTrigger, TooltipTrigger,
} from '#/components/ui/tooltip'; } from '#/components/ui/tooltip';
import { TooltipContentProps } from 'radix-vue';
interface Props { interface Props {
delayDuration?: number; delayDuration?: number;

View File

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue';
import { AlertDialogAction, type AlertDialogActionProps } from 'radix-vue';
import { buttonVariants } from '#/components/ui/button'; import { buttonVariants } from '#/components/ui/button';
import { cn } from '#/lib/utils'; import { cn } from '#/lib/utils';
import { AlertDialogAction, type AlertDialogActionProps } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & AlertDialogActionProps { class?: HTMLAttributes['class'] } & AlertDialogActionProps

View File

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue';
import { AlertDialogCancel, type AlertDialogCancelProps } from 'radix-vue';
import { buttonVariants } from '#/components/ui/button'; import { buttonVariants } from '#/components/ui/button';
import { cn } from '#/lib/utils'; import { cn } from '#/lib/utils';
import { AlertDialogCancel, type AlertDialogCancelProps } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & AlertDialogCancelProps { class?: HTMLAttributes['class'] } & AlertDialogCancelProps

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
AlertDialogContent, AlertDialogContent,
type AlertDialogContentEmits, type AlertDialogContentEmits,
@ -8,7 +9,8 @@ import {
AlertDialogPortal, AlertDialogPortal,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & AlertDialogContentProps { class?: HTMLAttributes['class'] } & AlertDialogContentProps

View File

@ -1,10 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
AlertDialogDescription, AlertDialogDescription,
type AlertDialogDescriptionProps, type AlertDialogDescriptionProps,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & AlertDialogDescriptionProps { class?: HTMLAttributes['class'] } & AlertDialogDescriptionProps

View File

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils';
import { AlertDialogTitle, type AlertDialogTitleProps } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue'; import { type HTMLAttributes, computed } from 'vue';
import { AlertDialogTitle, type AlertDialogTitleProps } from 'radix-vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & AlertDialogTitleProps { class?: HTMLAttributes['class'] } & AlertDialogTitleProps
>(); >();

View File

@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { cn } from '#/lib/utils';
import { AvatarRoot } from 'radix-vue'; import { AvatarRoot } from 'radix-vue';
import { cn } from '#/lib/utils';
import { type AvatarVariants, avatarVariant } from './avatar'; import { type AvatarVariants, avatarVariant } from './avatar';
const props = withDefaults( const props = withDefaults(

View File

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { cn } from '#/lib/utils';
import { DotsHorizontalIcon } from '@radix-icons/vue'; import { DotsHorizontalIcon } from '@radix-icons/vue';
import { cn } from '#/lib/utils';
const props = defineProps<{ const props = defineProps<{
class?: HTMLAttributes['class']; class?: HTMLAttributes['class'];
}>(); }>();

View File

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { cn } from '#/lib/utils';
import { Primitive, type PrimitiveProps } from 'radix-vue'; import { Primitive, type PrimitiveProps } from 'radix-vue';
import { cn } from '#/lib/utils';
const props = withDefaults( const props = withDefaults(
defineProps<{ class?: HTMLAttributes['class'] } & PrimitiveProps>(), defineProps<{ class?: HTMLAttributes['class'] } & PrimitiveProps>(),
{ {

View File

@ -1,9 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { cn } from '#/lib/utils';
import { ChevronRightIcon } from '@radix-icons/vue'; import { ChevronRightIcon } from '@radix-icons/vue';
import { cn } from '#/lib/utils';
const props = defineProps<{ const props = defineProps<{
class?: HTMLAttributes['class']; class?: HTMLAttributes['class'];
}>(); }>();

View File

@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes } from 'vue';
import { cn } from '#/lib/utils';
import { Primitive, type PrimitiveProps } from 'radix-vue'; import { Primitive, type PrimitiveProps } from 'radix-vue';
import { cn } from '#/lib/utils';
import { type ButtonVariants, buttonVariants } from './button'; import { type ButtonVariants, buttonVariants } from './button';
interface Props extends PrimitiveProps { interface Props extends PrimitiveProps {

View File

@ -1,14 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue'; import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { CheckIcon } from '@radix-icons/vue'; import { CheckIcon } from '@radix-icons/vue';
import { import {
CheckboxIndicator, CheckboxIndicator,
CheckboxRoot, CheckboxRoot,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & CheckboxRootProps { class?: HTMLAttributes['class'] } & CheckboxRootProps

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { CheckIcon } from '@radix-icons/vue'; import { CheckIcon } from '@radix-icons/vue';
import { import {
ContextMenuCheckboxItem, ContextMenuCheckboxItem,
@ -8,7 +9,8 @@ import {
ContextMenuItemIndicator, ContextMenuItemIndicator,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & ContextMenuCheckboxItemProps { class?: HTMLAttributes['class'] } & ContextMenuCheckboxItemProps

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
ContextMenuContent, ContextMenuContent,
type ContextMenuContentEmits, type ContextMenuContentEmits,
@ -7,7 +8,8 @@ import {
ContextMenuPortal, ContextMenuPortal,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & ContextMenuContentProps { class?: HTMLAttributes['class'] } & ContextMenuContentProps

View File

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
ContextMenuItem, ContextMenuItem,
type ContextMenuItemEmits, type ContextMenuItemEmits,
type ContextMenuItemProps, type ContextMenuItemProps,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class']; inset?: boolean } & ContextMenuItemProps { class?: HTMLAttributes['class']; inset?: boolean } & ContextMenuItemProps

View File

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils';
import { ContextMenuLabel, type ContextMenuLabelProps } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue'; import { type HTMLAttributes, computed } from 'vue';
import { ContextMenuLabel, type ContextMenuLabelProps } from 'radix-vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class']; inset?: boolean } & ContextMenuLabelProps { class?: HTMLAttributes['class']; inset?: boolean } & ContextMenuLabelProps
>(); >();

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { DotFilledIcon } from '@radix-icons/vue'; import { DotFilledIcon } from '@radix-icons/vue';
import { import {
ContextMenuItemIndicator, ContextMenuItemIndicator,
@ -8,7 +9,8 @@ import {
type ContextMenuRadioItemProps, type ContextMenuRadioItemProps,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & ContextMenuRadioItemProps { class?: HTMLAttributes['class'] } & ContextMenuRadioItemProps

View File

@ -1,10 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
ContextMenuSeparator, ContextMenuSeparator,
type ContextMenuSeparatorProps, type ContextMenuSeparatorProps,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & ContextMenuSeparatorProps { class?: HTMLAttributes['class'] } & ContextMenuSeparatorProps

View File

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { import {
ContextMenuSubContent, ContextMenuSubContent,
type DropdownMenuSubContentEmits, type DropdownMenuSubContentEmits,
type DropdownMenuSubContentProps, type DropdownMenuSubContentProps,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & DropdownMenuSubContentProps { class?: HTMLAttributes['class'] } & DropdownMenuSubContentProps

View File

@ -1,12 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { ChevronRightIcon } from '@radix-icons/vue'; import { ChevronRightIcon } from '@radix-icons/vue';
import { import {
ContextMenuSubTrigger, ContextMenuSubTrigger,
type ContextMenuSubTriggerProps, type ContextMenuSubTriggerProps,
useForwardProps, useForwardProps,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ {

View File

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '#/lib/utils'; import { type HTMLAttributes, computed } from 'vue';
import { Cross2Icon } from '@radix-icons/vue'; import { Cross2Icon } from '@radix-icons/vue';
import { import {
DialogClose, DialogClose,
@ -10,7 +11,8 @@ import {
DialogPortal, DialogPortal,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { type HTMLAttributes, computed } from 'vue';
import { cn } from '#/lib/utils';
const props = defineProps< const props = defineProps<
{ class?: HTMLAttributes['class'] } & DialogContentProps { class?: HTMLAttributes['class'] } & DialogContentProps

Some files were not shown because too many files have changed in this diff Show More