refactor(project): re-adjust the overall folder
This commit is contained in:
parent
a1a566cb2f
commit
14538f7ed5
|
@ -165,11 +165,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"cssVariables.lookupFiles": [
|
"cssVariables.lookupFiles": [
|
||||||
"packages/@vben-core/shared/design-tokens/src/**/*.css"
|
"packages/@vben-core/shared/design/src/**/*.css"
|
||||||
],
|
],
|
||||||
|
|
||||||
"i18n-ally.localesPaths": [
|
"i18n-ally.localesPaths": [
|
||||||
"packages/@core/locales/src/langs",
|
"packages/locales/src/langs",
|
||||||
"apps/*/src/locales/langs"
|
"apps/*/src/locales/langs"
|
||||||
],
|
],
|
||||||
"i18n-ally.enabledParsers": ["json", "ts", "js", "yaml"],
|
"i18n-ally.enabledParsers": ["json", "ts", "js", "yaml"],
|
||||||
|
|
|
@ -26,11 +26,6 @@
|
||||||
"#/*": "./src/*"
|
"#/*": "./src/*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vben-core/helpers": "workspace:*",
|
|
||||||
"@vben-core/locales": "workspace:*",
|
|
||||||
"@vben-core/preferences": "workspace:*",
|
|
||||||
"@vben-core/request": "workspace:*",
|
|
||||||
"@vben-core/stores": "workspace:*",
|
|
||||||
"@vben/access": "workspace:*",
|
"@vben/access": "workspace:*",
|
||||||
"@vben/chart-ui": "workspace:*",
|
"@vben/chart-ui": "workspace:*",
|
||||||
"@vben/common-ui": "workspace:*",
|
"@vben/common-ui": "workspace:*",
|
||||||
|
@ -38,6 +33,10 @@
|
||||||
"@vben/hooks": "workspace:*",
|
"@vben/hooks": "workspace:*",
|
||||||
"@vben/icons": "workspace:*",
|
"@vben/icons": "workspace:*",
|
||||||
"@vben/layouts": "workspace:*",
|
"@vben/layouts": "workspace:*",
|
||||||
|
"@vben/locales": "workspace:*",
|
||||||
|
"@vben/preferences": "workspace:*",
|
||||||
|
"@vben/request": "workspace:*",
|
||||||
|
"@vben/stores": "workspace:*",
|
||||||
"@vben/styles": "workspace:*",
|
"@vben/styles": "workspace:*",
|
||||||
"@vben/types": "workspace:*",
|
"@vben/types": "workspace:*",
|
||||||
"@vben/utils": "workspace:*",
|
"@vben/utils": "workspace:*",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { UserApi } from '../types';
|
import type { UserApi } from '../types';
|
||||||
|
|
||||||
import { requestClient } from '#/forward';
|
import { requestClient } from '#/apis/request';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { RouteRecordStringComponent } from '@vben/types';
|
import type { RouteRecordStringComponent } from '@vben/types';
|
||||||
|
|
||||||
import { requestClient } from '#/forward';
|
import { requestClient } from '#/apis/request';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户所有菜单
|
* 获取用户所有菜单
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { UserInfo } from '@vben/types';
|
import type { UserInfo } from '@vben/types';
|
||||||
|
|
||||||
import { requestClient } from '#/forward';
|
import { requestClient } from '#/apis/request';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { requestClient } from '#/forward';
|
import { requestClient } from '#/apis/request';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟任意状态码
|
* 模拟任意状态码
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* 该文件可自行根据业务逻辑进行调整
|
* 该文件可自行根据业务逻辑进行调整
|
||||||
*/
|
*/
|
||||||
import type { HttpResponse } from '@vben-core/request';
|
import type { HttpResponse } from '@vben/request';
|
||||||
|
|
||||||
import { preferences } from '@vben-core/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
import { RequestClient } from '@vben-core/request';
|
import { RequestClient } from '@vben/request';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
import { GlobalProvider } from '@vben/common-ui';
|
import { GlobalProvider } from '@vben/common-ui';
|
||||||
import { preferences, usePreferences } from '@vben-core/preferences';
|
import { preferences, usePreferences } from '@vben/preferences';
|
||||||
|
|
||||||
import { App, ConfigProvider, theme } from 'ant-design-vue';
|
import { App, ConfigProvider, theme } from 'ant-design-vue';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
|
||||||
|
import { preferences } from '@vben/preferences';
|
||||||
import '@vben/styles';
|
import '@vben/styles';
|
||||||
import '@vben/styles/antd';
|
import '@vben/styles/antd';
|
||||||
import { preferences } from '@vben-core/preferences';
|
|
||||||
|
|
||||||
import { loadMessages, setupI18n } from '#/locales';
|
import { loadMessages, setupI18n } from '#/locales';
|
||||||
import { setupStore } from '#/store';
|
import { setupStore } from '#/store';
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# forward
|
|
||||||
|
|
||||||
用于扩展、转发大仓的包以及其他功能,方便在app内自定义不同的逻辑
|
|
||||||
|
|
||||||
## request
|
|
||||||
|
|
||||||
用于扩展请求的功能,例如添加header、错误响应等
|
|
||||||
|
|
||||||
## locale
|
|
||||||
|
|
||||||
用于扩展国际化的功能,例如扩展 dayjs、antd组件库的多语言切换
|
|
|
@ -1,2 +0,0 @@
|
||||||
export * from './access';
|
|
||||||
export * from './request';
|
|
|
@ -12,12 +12,12 @@ import {
|
||||||
NotificationItem,
|
NotificationItem,
|
||||||
UserDropdown,
|
UserDropdown,
|
||||||
} from '@vben/layouts';
|
} from '@vben/layouts';
|
||||||
|
import { preferences } from '@vben/preferences';
|
||||||
import { openWindow } from '@vben/utils';
|
import { openWindow } from '@vben/utils';
|
||||||
import { preferences } from '@vben-core/preferences';
|
|
||||||
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { resetRoutes } from '#/router';
|
import { resetRoutes } from '#/router';
|
||||||
import { storeToRefs, useAccessStore, useAppStore } from '#/store';
|
import { resetAllStores, storeToRefs, useAccessStore } from '#/store';
|
||||||
|
|
||||||
const notifications = ref<NotificationItem[]>([
|
const notifications = ref<NotificationItem[]>([
|
||||||
{
|
{
|
||||||
|
@ -84,10 +84,8 @@ const menus = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const appStore = useAppStore();
|
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
|
|
||||||
const { isLockScreen, lockScreenPassword } = storeToRefs(appStore);
|
|
||||||
const {
|
const {
|
||||||
loading: loginLoading,
|
loading: loginLoading,
|
||||||
openLoginExpiredModal,
|
openLoginExpiredModal,
|
||||||
|
@ -101,8 +99,7 @@ const avatar = computed(() => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
async function handleLogout() {
|
async function handleLogout() {
|
||||||
appStore.resetAppState();
|
resetAllStores();
|
||||||
appStore.unlockScreen();
|
|
||||||
resetRoutes();
|
resetRoutes();
|
||||||
await router.replace(LOGIN_PATH);
|
await router.replace(LOGIN_PATH);
|
||||||
}
|
}
|
||||||
|
@ -114,10 +111,6 @@ function handleNoticeClear() {
|
||||||
function handleMakeAll() {
|
function handleMakeAll() {
|
||||||
notifications.value.forEach((item) => (item.isRead = true));
|
notifications.value.forEach((item) => (item.isRead = true));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLockScreen(password: string) {
|
|
||||||
appStore.lockScreen(password);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -129,7 +122,6 @@ function handleLockScreen(password: string) {
|
||||||
:text="userInfo?.realName"
|
:text="userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@lock-screen="handleLockScreen"
|
|
||||||
@logout="handleLogout"
|
@logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -152,13 +144,7 @@ function handleLockScreen(password: string) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #lock-screen>
|
<template #lock-screen>
|
||||||
<LockScreen
|
<LockScreen :avatar @to-login="handleLogout" />
|
||||||
v-if="isLockScreen"
|
|
||||||
:avatar
|
|
||||||
:cached-password="lockScreenPassword"
|
|
||||||
@to-login="handleLogout"
|
|
||||||
@unlock="appStore.unlockScreen"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</BasicLayout>
|
</BasicLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { Locale } from 'ant-design-vue/es/locale';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { $t, loadLocalesMap, setupI18n } from '@vben-core/locales';
|
import { $t, loadLocalesMap, setupI18n } from '@vben/locales';
|
||||||
|
|
||||||
import antdEnLocale from 'ant-design-vue/es/locale/en_US';
|
import antdEnLocale from 'ant-design-vue/es/locale/en_US';
|
||||||
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
|
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { preferencesManager } from '@vben-core/preferences';
|
import { initPreferences } from '@vben/preferences';
|
||||||
|
|
||||||
import { overridesPreferences } from './preferences';
|
import { overridesPreferences } from './preferences';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ async function initApplication() {
|
||||||
const namespace = `${import.meta.env.VITE_APP_NAMESPACE}-${env}`;
|
const namespace = `${import.meta.env.VITE_APP_NAMESPACE}-${env}`;
|
||||||
|
|
||||||
// app偏好设置初始化
|
// app偏好设置初始化
|
||||||
await preferencesManager.initPreferences({
|
await initPreferences({
|
||||||
namespace,
|
namespace,
|
||||||
overrides: overridesPreferences,
|
overrides: overridesPreferences,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { defineOverridesPreferences } from '@vben-core/preferences';
|
import { defineOverridesPreferences } from '@vben/preferences';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 项目配置文件
|
* @description 项目配置文件
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
||||||
} from '@vben/types';
|
} from '@vben/types';
|
||||||
|
|
||||||
import { generateAccessible } from '@vben/access';
|
import { generateAccessible } from '@vben/access';
|
||||||
import { preferences } from '@vben-core/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import type { Router } from 'vue-router';
|
import type { Router } from 'vue-router';
|
||||||
|
|
||||||
import { LOGIN_PATH } from '@vben/constants';
|
import { LOGIN_PATH } from '@vben/constants';
|
||||||
|
import { preferences } from '@vben/preferences';
|
||||||
import { startProgress, stopProgress } from '@vben/utils';
|
import { startProgress, stopProgress } from '@vben/utils';
|
||||||
import { preferences } from '@vben-core/preferences';
|
|
||||||
|
|
||||||
import { useTitle } from '@vueuse/core';
|
import { useTitle } from '@vueuse/core';
|
||||||
|
|
||||||
import { generateAccess } from '#/forward';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { coreRouteNames, dynamicRoutes } from '#/router/routes';
|
import { coreRouteNames, dynamicRoutes } from '#/router/routes';
|
||||||
import { useAccessStore } from '#/store';
|
import { useAccessStore } from '#/store';
|
||||||
|
|
||||||
|
import { generateAccess } from './access';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用守卫配置
|
* 通用守卫配置
|
||||||
* @param router
|
* @param router
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type { RouteRecordRaw } from 'vue-router';
|
import type { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
import { traverseTreeValues } from '@vben/utils';
|
import { mergeRouteModules, traverseTreeValues } from '@vben/utils';
|
||||||
import { mergeRouteModules } from '@vben-core/helpers';
|
|
||||||
|
|
||||||
import { coreRoutes, fallbackNotFoundRoute } from './core';
|
import { coreRoutes, fallbackNotFoundRoute } from './core';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { InitStoreOptions } from '@vben-core/stores';
|
import type { InitStoreOptions } from '@vben/stores';
|
||||||
|
|
||||||
import type { App } from 'vue';
|
import type { App } from 'vue';
|
||||||
|
|
||||||
import { initStore, storeToRefs } from '@vben-core/stores';
|
import { initStore, resetAllStores, storeToRefs } from '@vben/stores';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @zh_CN 初始化pinia
|
* @zh_CN 初始化pinia
|
||||||
|
@ -13,7 +13,6 @@ async function setupStore(app: App, options: InitStoreOptions) {
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { setupStore, storeToRefs };
|
export { resetAllStores, setupStore, storeToRefs };
|
||||||
|
|
||||||
export { useAccessStore } from './modules/access';
|
export { useAccessStore } from './modules/access';
|
||||||
export { useAppStore } from './modules/app';
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { computed, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
||||||
import { useCoreAccessStore } from '@vben-core/stores';
|
import { resetAllStores, useCoreAccessStore } from '@vben/stores';
|
||||||
|
|
||||||
import { notification } from 'ant-design-vue';
|
import { notification } from 'ant-design-vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
@ -50,7 +50,7 @@ export const useAccessStore = defineStore('access', () => {
|
||||||
onSuccess?: () => Promise<void> | void,
|
onSuccess?: () => Promise<void> | void,
|
||||||
) {
|
) {
|
||||||
// 异步处理用户登录操作并获取 accessToken
|
// 异步处理用户登录操作并获取 accessToken
|
||||||
let userInfo: UserInfo | null = null;
|
let userInfo: null | UserInfo = null;
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const { accessToken, refreshToken } = await login(params);
|
const { accessToken, refreshToken } = await login(params);
|
||||||
|
@ -102,7 +102,7 @@ export const useAccessStore = defineStore('access', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
coreStoreAccess.$reset();
|
resetAllStores();
|
||||||
openLoginExpiredModal.value = false;
|
openLoginExpiredModal.value = false;
|
||||||
|
|
||||||
// 回登陆页带上当前路由地址
|
// 回登陆页带上当前路由地址
|
||||||
|
@ -115,17 +115,19 @@ export const useAccessStore = defineStore('access', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchUserInfo() {
|
async function fetchUserInfo() {
|
||||||
let userInfo: UserInfo | null = null;
|
let userInfo: null | UserInfo = null;
|
||||||
userInfo = await getUserInfo();
|
userInfo = await getUserInfo();
|
||||||
coreStoreAccess.setUserInfo(userInfo);
|
coreStoreAccess.setUserInfo(userInfo);
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function $reset() {
|
||||||
coreStoreAccess.$reset();
|
loading.value = false;
|
||||||
|
openLoginExpiredModal.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
$reset,
|
||||||
accessRoutes,
|
accessRoutes,
|
||||||
accessToken,
|
accessToken,
|
||||||
authLogin,
|
authLogin,
|
||||||
|
@ -134,7 +136,6 @@ export const useAccessStore = defineStore('access', () => {
|
||||||
logout,
|
logout,
|
||||||
openLoginExpiredModal,
|
openLoginExpiredModal,
|
||||||
refreshToken,
|
refreshToken,
|
||||||
reset,
|
|
||||||
setAccessMenus,
|
setAccessMenus,
|
||||||
setAccessRoutes,
|
setAccessRoutes,
|
||||||
setAccessToken,
|
setAccessToken,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type { LoginCodeParams } from '@vben/common-ui';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { AuthenticationCodeLogin } from '@vben/common-ui';
|
import { AuthenticationCodeLogin } from '@vben/common-ui';
|
||||||
|
import { LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
defineOptions({ name: 'CodeLogin' });
|
defineOptions({ name: 'CodeLogin' });
|
||||||
|
|
||||||
|
@ -21,5 +22,9 @@ async function handleLogin(values: LoginCodeParams) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AuthenticationCodeLogin :loading="loading" @submit="handleLogin" />
|
<AuthenticationCodeLogin
|
||||||
|
:loading="loading"
|
||||||
|
:login-path="LOGIN_PATH"
|
||||||
|
@submit="handleLogin"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { AuthenticationForgetPassword } from '@vben/common-ui';
|
import { AuthenticationForgetPassword } from '@vben/common-ui';
|
||||||
|
import { LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
defineOptions({ name: 'ForgetPassword' });
|
defineOptions({ name: 'ForgetPassword' });
|
||||||
|
|
||||||
|
@ -14,5 +15,9 @@ function handleSubmit(value: string) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AuthenticationForgetPassword :loading="loading" @submit="handleSubmit" />
|
<AuthenticationForgetPassword
|
||||||
|
:loading="loading"
|
||||||
|
:login-path="LOGIN_PATH"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { AuthenticationQrCodeLogin } from '@vben/common-ui';
|
import { AuthenticationQrCodeLogin } from '@vben/common-ui';
|
||||||
|
import { LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
defineOptions({ name: 'QrCodeLogin' });
|
defineOptions({ name: 'QrCodeLogin' });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AuthenticationQrCodeLogin />
|
<AuthenticationQrCodeLogin :login-path="LOGIN_PATH" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type { LoginAndRegisterParams } from '@vben/common-ui';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { AuthenticationRegister } from '@vben/common-ui';
|
import { AuthenticationRegister } from '@vben/common-ui';
|
||||||
|
import { LOGIN_PATH } from '@vben/constants';
|
||||||
|
|
||||||
defineOptions({ name: 'Register' });
|
defineOptions({ name: 'Register' });
|
||||||
|
|
||||||
|
@ -16,5 +17,9 @@ function handleSubmit(value: LoginAndRegisterParams) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AuthenticationRegister :loading="loading" @submit="handleSubmit" />
|
<AuthenticationRegister
|
||||||
|
:loading="loading"
|
||||||
|
:login-path="LOGIN_PATH"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
WorkbenchTodo,
|
WorkbenchTodo,
|
||||||
WorkbenchTrends,
|
WorkbenchTrends,
|
||||||
} from '@vben/common-ui';
|
} from '@vben/common-ui';
|
||||||
import { preferences } from '@vben-core/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
|
|
||||||
import { useAccessStore } from '#/store';
|
import { useAccessStore } from '#/store';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { AccessControl, useAccess } from '@vben/access';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useAccessStore, useAppStore } from '#/store';
|
import { resetAllStores, useAccessStore } from '#/store';
|
||||||
|
|
||||||
defineOptions({ name: 'AccessButtonControl' });
|
defineOptions({ name: 'AccessButtonControl' });
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ const accounts: Record<string, LoginAndRegisterParams> = {
|
||||||
|
|
||||||
const { accessMode, hasAccessByCodes } = useAccess();
|
const { accessMode, hasAccessByCodes } = useAccess();
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
const appStore = useAppStore();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
function roleButtonType(role: string) {
|
function roleButtonType(role: string) {
|
||||||
|
@ -41,7 +40,7 @@ async function changeAccount(role: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const account = accounts[role];
|
const account = accounts[role];
|
||||||
appStore.resetAppState();
|
resetAllStores();
|
||||||
await accessStore.authLogin(account, async () => {
|
await accessStore.authLogin(account, async () => {
|
||||||
router.go(0);
|
router.go(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { useAccess } from '@vben/access';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useAccessStore, useAppStore } from '#/store';
|
import { resetAllStores, useAccessStore } from '#/store';
|
||||||
|
|
||||||
defineOptions({ name: 'Access' });
|
defineOptions({ name: 'Access' });
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ const accounts: Record<string, LoginAndRegisterParams> = {
|
||||||
|
|
||||||
const { accessMode, toggleAccessMode } = useAccess();
|
const { accessMode, toggleAccessMode } = useAccess();
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
const appStore = useAppStore();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
function roleButtonType(role: string) {
|
function roleButtonType(role: string) {
|
||||||
|
@ -41,7 +40,7 @@ async function changeAccount(role: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const account = accounts[role];
|
const account = accounts[role];
|
||||||
appStore.resetAppState();
|
resetAllStores();
|
||||||
await accessStore.authLogin(account, async () => {
|
await accessStore.authLogin(account, async () => {
|
||||||
router.go(0);
|
router.go(0);
|
||||||
});
|
});
|
||||||
|
@ -49,7 +48,8 @@ async function changeAccount(role: string) {
|
||||||
|
|
||||||
async function handleToggleAccessMode() {
|
async function handleToggleAccessMode() {
|
||||||
await toggleAccessMode();
|
await toggleAccessMode();
|
||||||
appStore.resetAppState();
|
resetAllStores();
|
||||||
|
|
||||||
await accessStore.authLogin(accounts.super, async () => {
|
await accessStore.authLogin(accounts.super, async () => {
|
||||||
router.go(0);
|
router.go(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { LoginExpiredModeType } from '@vben/types';
|
import type { LoginExpiredModeType } from '@vben/types';
|
||||||
|
|
||||||
import { preferences, updatePreferences } from '@vben-core/preferences';
|
import { preferences, updatePreferences } from '@vben/preferences';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
|
|
||||||
|
|
|
@ -32,22 +32,22 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.7.0",
|
"@eslint/js": "^9.7.0",
|
||||||
"@types/eslint": "^8.56.10",
|
"@types/eslint": "^9.6.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
||||||
"@typescript-eslint/parser": "^7.16.1",
|
"@typescript-eslint/parser": "^7.17.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"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.8.1",
|
"eslint-plugin-jsdoc": "^48.8.3",
|
||||||
"eslint-plugin-jsonc": "^2.16.0",
|
"eslint-plugin-jsonc": "^2.16.0",
|
||||||
"eslint-plugin-n": "^17.9.0",
|
"eslint-plugin-n": "^17.9.0",
|
||||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||||
"eslint-plugin-perfectionist": "^2.11.0",
|
"eslint-plugin-perfectionist": "^3.0.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-regexp": "^2.6.0",
|
"eslint-plugin-regexp": "^2.6.0",
|
||||||
"eslint-plugin-unicorn": "^54.0.0",
|
"eslint-plugin-unicorn": "^54.0.0",
|
||||||
"eslint-plugin-unused-imports": "^4.0.0",
|
"eslint-plugin-unused-imports": "^4.0.1",
|
||||||
"eslint-plugin-vitest": "^0.5.4",
|
"eslint-plugin-vitest": "^0.5.4",
|
||||||
"eslint-plugin-vue": "^9.27.0",
|
"eslint-plugin-vue": "^9.27.0",
|
||||||
"globals": "^15.8.0",
|
"globals": "^15.8.0",
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import type { Linter } from 'eslint';
|
import type { Linter } from 'eslint';
|
||||||
|
|
||||||
export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
||||||
const [perfectionistNatural] = await Promise.all([
|
|
||||||
// @ts-expect-error - no types
|
|
||||||
import('eslint-plugin-perfectionist/configs/recommended-natural'),
|
|
||||||
] as const);
|
|
||||||
|
|
||||||
|
export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
||||||
return [
|
return [
|
||||||
perfectionistNatural,
|
perfectionistPlugin.configs['recommended-natural'],
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
'perfectionist/sort-exports': [
|
'perfectionist/sort-exports': [
|
||||||
|
@ -20,7 +17,7 @@ export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
||||||
'perfectionist/sort-imports': [
|
'perfectionist/sort-imports': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
'custom-groups': {
|
customGroups: {
|
||||||
type: {
|
type: {
|
||||||
vben: 'vben',
|
vben: 'vben',
|
||||||
vue: 'vue',
|
vue: 'vue',
|
||||||
|
@ -46,8 +43,8 @@ export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
||||||
'object',
|
'object',
|
||||||
'unknown',
|
'unknown',
|
||||||
],
|
],
|
||||||
'internal-pattern': ['#*', '#*/**'],
|
internalPattern: ['#*', '#*/**'],
|
||||||
'newlines-between': 'always',
|
newlinesBetween: 'always',
|
||||||
order: 'asc',
|
order: 'asc',
|
||||||
type: 'natural',
|
type: 'natural',
|
||||||
},
|
},
|
||||||
|
@ -62,15 +59,15 @@ export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
||||||
'perfectionist/sort-objects': [
|
'perfectionist/sort-objects': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
'custom-groups': {
|
customGroups: {
|
||||||
items: 'items',
|
items: 'items',
|
||||||
list: 'list',
|
list: 'list',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
},
|
},
|
||||||
groups: ['unknown', 'items', 'list', 'children'],
|
groups: ['unknown', 'items', 'list', 'children'],
|
||||||
'ignore-pattern': ['children'],
|
ignorePattern: ['children'],
|
||||||
order: 'asc',
|
order: 'asc',
|
||||||
'partition-by-comment': 'Part:**',
|
partitionByComment: 'Part:**',
|
||||||
type: 'natural',
|
type: 'natural',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -78,7 +75,7 @@ export async function perfectionist(): Promise<Linter.FlatConfig[]> {
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
// Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
|
// Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
|
||||||
'custom-groups': {
|
customGroups: {
|
||||||
/* eslint-disable perfectionist/sort-objects */
|
/* eslint-disable perfectionist/sort-objects */
|
||||||
DEFINITION: '*(is|:is|v-is)',
|
DEFINITION: '*(is|:is|v-is)',
|
||||||
LIST_RENDERING: 'v-for',
|
LIST_RENDERING: 'v-for',
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
|
||||||
"stub": "pnpm unbuild --stub"
|
"stub": "pnpm unbuild --stub"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
"tailwindcss": "^3.4.3"
|
"tailwindcss": "^3.4.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify/json": "^2.2.229",
|
"@iconify/json": "^2.2.230",
|
||||||
"@iconify/tailwind": "^1.1.1",
|
"@iconify/tailwind": "^1.1.1",
|
||||||
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
|
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
|
||||||
"@tailwindcss/typography": "^0.5.13",
|
"@tailwindcss/typography": "^0.5.13",
|
||||||
|
|
|
@ -30,8 +30,8 @@ const shadcnUiColors = {
|
||||||
hover: 'hsl(var(--accent-hover))',
|
hover: 'hsl(var(--accent-hover))',
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
DEFAULT: 'hsl(var(--background))',
|
|
||||||
deep: 'hsl(var(--background-deep))',
|
deep: 'hsl(var(--background-deep))',
|
||||||
|
DEFAULT: 'hsl(var(--background))',
|
||||||
},
|
},
|
||||||
border: {
|
border: {
|
||||||
DEFAULT: 'hsl(var(--border))',
|
DEFAULT: 'hsl(var(--border))',
|
||||||
|
@ -50,8 +50,8 @@ const shadcnUiColors = {
|
||||||
},
|
},
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
DEFAULT: 'hsl(var(--input))',
|
|
||||||
background: 'hsl(var(--input-background))',
|
background: 'hsl(var(--input-background))',
|
||||||
|
DEFAULT: 'hsl(var(--input))',
|
||||||
},
|
},
|
||||||
muted: {
|
muted: {
|
||||||
DEFAULT: 'hsl(var(--muted))',
|
DEFAULT: 'hsl(var(--muted))',
|
||||||
|
@ -95,8 +95,8 @@ const customColors = {
|
||||||
foreground: 'hsl(var(--destructive-foreground))',
|
foreground: 'hsl(var(--destructive-foreground))',
|
||||||
},
|
},
|
||||||
sidebar: {
|
sidebar: {
|
||||||
DEFAULT: 'hsl(var(--sidebar))',
|
|
||||||
deep: 'hsl(var(--sidebar-deep))',
|
deep: 'hsl(var(--sidebar-deep))',
|
||||||
|
DEFAULT: 'hsl(var(--sidebar))',
|
||||||
},
|
},
|
||||||
success: {
|
success: {
|
||||||
...createColorsPalette('success'),
|
...createColorsPalette('success'),
|
||||||
|
|
|
@ -70,7 +70,7 @@ interface CommonPluginOptions {
|
||||||
/** 构建模式 */
|
/** 构建模式 */
|
||||||
mode?: string;
|
mode?: string;
|
||||||
/** 开启依赖分析 */
|
/** 开启依赖分析 */
|
||||||
visualizer?: PluginVisualizerOptions | boolean;
|
visualizer?: boolean | PluginVisualizerOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ApplicationPluginOptions extends CommonPluginOptions {
|
interface ApplicationPluginOptions extends CommonPluginOptions {
|
||||||
|
@ -110,7 +110,7 @@ interface ApplicationPluginOptions extends CommonPluginOptions {
|
||||||
|
|
||||||
interface LibraryPluginOptions extends CommonPluginOptions {
|
interface LibraryPluginOptions extends CommonPluginOptions {
|
||||||
/** 开启 dts 输出 */
|
/** 开启 dts 输出 */
|
||||||
dts?: PluginOptions | boolean;
|
dts?: boolean | PluginOptions;
|
||||||
|
|
||||||
/** 是否注入lib css */
|
/** 是否注入lib css */
|
||||||
injectLibCss?: boolean;
|
injectLibCss?: boolean;
|
||||||
|
|
12
package.json
12
package.json
|
@ -66,23 +66,23 @@
|
||||||
"@vben/vsh": "workspace:*",
|
"@vben/vsh": "workspace:*",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cspell": "^8.11.0",
|
"cspell": "^8.12.1",
|
||||||
"husky": "^9.1.1",
|
"husky": "^9.1.1",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
"jsdom": "^24.1.0",
|
"jsdom": "^24.1.1",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"turbo": "^2.0.9",
|
"turbo": "^2.0.9",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.4",
|
||||||
"unbuild": "^2.0.0",
|
"unbuild": "^2.0.0",
|
||||||
"vite": "^5.3.4",
|
"vite": "^5.3.4",
|
||||||
"vitest": "^2.0.3",
|
"vitest": "^2.0.4",
|
||||||
"vue-tsc": "^2.0.26"
|
"vue-tsc": "^2.0.28"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20",
|
"node": ">=20",
|
||||||
"pnpm": ">=9"
|
"pnpm": ">=9"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.5.0",
|
"packageManager": "pnpm@9.6.0",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@ctrl/tinycolor": "^4.1.0",
|
"@ctrl/tinycolor": "^4.1.0",
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# @vben-core/forward
|
|
||||||
|
|
||||||
该目录内的包,可直接被app所引用,其是项目基础功能的一层抽象。允许轻微的副作用耦合,如`locales`的集成。
|
|
||||||
|
|
||||||
## 注意事项
|
|
||||||
|
|
||||||
- `forward` 内的包不允许相互引用,有相互引用的情况请考虑是否放到`packages/effects`下
|
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@vben-core/helpers",
|
|
||||||
"version": "5.0.0",
|
|
||||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
|
||||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
|
||||||
"directory": "packages/@vben-core/forward/helpers"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "pnpm unbuild",
|
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"sideEffects": false,
|
|
||||||
"main": "./dist/index.mjs",
|
|
||||||
"module": "./dist/index.mjs",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"types": "./src/index.ts",
|
|
||||||
"development": "./src/index.ts",
|
|
||||||
"default": "./dist/index.mjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"default": "./dist/index.mjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@vben-core/toolkit": "workspace:*",
|
|
||||||
"@vben-core/typings": "workspace:*",
|
|
||||||
"vue-router": "^4.4.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
import { createPinia } from 'pinia';
|
|
||||||
|
|
||||||
interface InitStoreOptions {
|
|
||||||
/**
|
|
||||||
* @zh_CN 应用名,由于 @vben-core/stores 是公用的,后续可能有多个app,为了防止多个app缓存冲突,可在这里配置应用名,应用名将被用于持久化的前缀
|
|
||||||
*/
|
|
||||||
namespace: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @zh_CN 初始化pinia
|
|
||||||
*/
|
|
||||||
async function initStore(options: InitStoreOptions) {
|
|
||||||
const { createPersistedState } = await import('pinia-plugin-persistedstate');
|
|
||||||
const pinia = createPinia();
|
|
||||||
const { namespace } = options;
|
|
||||||
pinia.use(
|
|
||||||
createPersistedState({
|
|
||||||
// key $appName-$store.id
|
|
||||||
key: (storeKey) => `${namespace}-${storeKey}`,
|
|
||||||
storage: localStorage,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
return pinia;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { initStore };
|
|
||||||
|
|
||||||
export type { InitStoreOptions };
|
|
|
@ -6,13 +6,12 @@
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||||
"directory": "packages/@vben-core/shared/hooks"
|
"directory": "packages/@core/hooks"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
@ -37,14 +36,11 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vben-core/constants": "workspace:*",
|
"@vben-core/constants": "workspace:*",
|
||||||
"@vben-core/preferences": "workspace:*",
|
|
||||||
"@vben-core/stores": "workspace:*",
|
|
||||||
"@vben-core/toolkit": "workspace:*",
|
"@vben-core/toolkit": "workspace:*",
|
||||||
"@vueuse/core": "^10.11.0",
|
"@vueuse/core": "^10.11.0",
|
||||||
"radix-vue": "^1.9.2",
|
"radix-vue": "^1.9.2",
|
||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.2",
|
||||||
"vue": "^3.4.33",
|
"vue": "^3.4.33"
|
||||||
"vue-router": "^4.4.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/sortablejs": "^1.15.8"
|
"@types/sortablejs": "^1.15.8"
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
export * from './use-content-height';
|
export * from './use-content-height';
|
||||||
export * from './use-content-maximize';
|
|
||||||
export * from './use-namespace';
|
export * from './use-namespace';
|
||||||
export * from './use-refresh';
|
|
||||||
export * from './use-sortable';
|
export * from './use-sortable';
|
||||||
export * from './use-tabs';
|
|
||||||
export {
|
export {
|
||||||
useEmitAsProps,
|
useEmitAsProps,
|
||||||
useForwardExpose,
|
useForwardExpose,
|
||||||
|
|
|
@ -6,13 +6,12 @@
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||||
"directory": "packages/@vben-core/forward/preferences"
|
"directory": "packages/@core/preferences"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
|
@ -1,11 +1,10 @@
|
||||||
import type { DeepPartial } from '@vben-core/typings';
|
|
||||||
|
|
||||||
import type { Preferences } from './types';
|
import type { Preferences } from './types';
|
||||||
|
|
||||||
import { preferencesManager } from './preferences';
|
import { preferencesManager } from './preferences';
|
||||||
|
|
||||||
// 偏好设置(带有层级关系)
|
// 偏好设置(带有层级关系)
|
||||||
const preferences: Preferences = preferencesManager.getPreferences();
|
const preferences: Preferences =
|
||||||
|
preferencesManager.getPreferences.apply(preferencesManager);
|
||||||
|
|
||||||
// 更新偏好设置
|
// 更新偏好设置
|
||||||
const updatePreferences =
|
const updatePreferences =
|
||||||
|
@ -18,13 +17,13 @@ const resetPreferences =
|
||||||
const clearPreferencesCache =
|
const clearPreferencesCache =
|
||||||
preferencesManager.clearCache.bind(preferencesManager);
|
preferencesManager.clearCache.bind(preferencesManager);
|
||||||
|
|
||||||
function defineOverridesPreferences(preferences: DeepPartial<Preferences>) {
|
// 初始化偏好设置
|
||||||
return preferences;
|
const initPreferences =
|
||||||
}
|
preferencesManager.initPreferences.bind(preferencesManager);
|
||||||
|
|
||||||
export {
|
export {
|
||||||
clearPreferencesCache,
|
clearPreferencesCache,
|
||||||
defineOverridesPreferences,
|
initPreferences,
|
||||||
preferences,
|
preferences,
|
||||||
preferencesManager,
|
preferencesManager,
|
||||||
resetPreferences,
|
resetPreferences,
|
|
@ -1,7 +1,7 @@
|
||||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
import { defaultPreferences } from './config';
|
import { defaultPreferences } from './config';
|
||||||
import { PreferenceManager, isDarkTheme } from './preferences';
|
import { isDarkTheme, PreferenceManager } from './preferences';
|
||||||
|
|
||||||
describe('preferences', () => {
|
describe('preferences', () => {
|
||||||
let preferenceManager: PreferenceManager;
|
let preferenceManager: PreferenceManager;
|
|
@ -1,10 +1,10 @@
|
||||||
import type { DeepPartial } from '@vben-core/typings';
|
import type { DeepPartial } from '@vben-core/typings';
|
||||||
|
|
||||||
import type { Preferences } from './types';
|
import type { InitialOptions, Preferences } from './types';
|
||||||
|
|
||||||
import { markRaw, reactive, readonly, watch } from 'vue';
|
import { markRaw, reactive, readonly, watch } from 'vue';
|
||||||
|
|
||||||
import { StorageManager, isMacOs, merge } from '@vben-core/toolkit';
|
import { isMacOs, merge, StorageManager } from '@vben-core/toolkit';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
breakpointsTailwind,
|
breakpointsTailwind,
|
||||||
|
@ -19,11 +19,6 @@ 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`;
|
||||||
|
|
||||||
interface initialOptions {
|
|
||||||
namespace: string;
|
|
||||||
overrides?: DeepPartial<Preferences>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDarkTheme(theme: string) {
|
function isDarkTheme(theme: string) {
|
||||||
let dark = theme === 'dark';
|
let dark = theme === 'dark';
|
||||||
if (theme === 'auto') {
|
if (theme === 'auto') {
|
||||||
|
@ -33,7 +28,7 @@ function isDarkTheme(theme: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreferenceManager {
|
class PreferenceManager {
|
||||||
private cache: StorageManager | null = null;
|
private cache: null | StorageManager = null;
|
||||||
// private flattenedState: Flatten<Preferences>;
|
// private flattenedState: Flatten<Preferences>;
|
||||||
private initialPreferences: Preferences = defaultPreferences;
|
private initialPreferences: Preferences = defaultPreferences;
|
||||||
private isInitialized: boolean = false;
|
private isInitialized: boolean = false;
|
||||||
|
@ -171,7 +166,7 @@ class PreferenceManager {
|
||||||
* overrides 要覆盖的偏好设置
|
* overrides 要覆盖的偏好设置
|
||||||
* namespace 命名空间
|
* namespace 命名空间
|
||||||
*/
|
*/
|
||||||
public async initPreferences({ namespace, overrides }: initialOptions) {
|
public async initPreferences({ namespace, overrides }: InitialOptions) {
|
||||||
// 是否初始化过
|
// 是否初始化过
|
||||||
if (this.isInitialized) {
|
if (this.isInitialized) {
|
||||||
return;
|
return;
|
||||||
|
@ -237,4 +232,4 @@ class PreferenceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
const preferencesManager = new PreferenceManager();
|
const preferencesManager = new PreferenceManager();
|
||||||
export { PreferenceManager, isDarkTheme, preferencesManager };
|
export { isDarkTheme, PreferenceManager, preferencesManager };
|
|
@ -4,6 +4,7 @@ import type {
|
||||||
BreadcrumbStyleType,
|
BreadcrumbStyleType,
|
||||||
BuiltinThemeType,
|
BuiltinThemeType,
|
||||||
ContentCompactType,
|
ContentCompactType,
|
||||||
|
DeepPartial,
|
||||||
LayoutHeaderModeType,
|
LayoutHeaderModeType,
|
||||||
LayoutType,
|
LayoutType,
|
||||||
LoginExpiredModeType,
|
LoginExpiredModeType,
|
||||||
|
@ -232,11 +233,16 @@ interface Preferences {
|
||||||
|
|
||||||
type PreferencesKeys = keyof Preferences;
|
type PreferencesKeys = keyof Preferences;
|
||||||
|
|
||||||
|
interface InitialOptions {
|
||||||
|
namespace: string;
|
||||||
|
overrides?: DeepPartial<Preferences>;
|
||||||
|
}
|
||||||
export type {
|
export type {
|
||||||
AppPreferences,
|
AppPreferences,
|
||||||
BreadcrumbPreferences,
|
BreadcrumbPreferences,
|
||||||
FooterPreferences,
|
FooterPreferences,
|
||||||
HeaderPreferences,
|
HeaderPreferences,
|
||||||
|
InitialOptions,
|
||||||
LogoPreferences,
|
LogoPreferences,
|
||||||
NavigationPreferences,
|
NavigationPreferences,
|
||||||
Preferences,
|
Preferences,
|
|
@ -11,8 +11,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
@ -36,7 +35,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify/vue": "^4.1.2",
|
"@iconify/vue": "^4.1.2",
|
||||||
"lucide-vue-next": "^0.411.0",
|
"lucide-vue-next": "^0.414.0",
|
||||||
"vue": "^3.4.33"
|
"vue": "^3.4.33"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm unbuild --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|
|
@ -67,7 +67,7 @@ class StorageManager {
|
||||||
* @param defaultValue 当项不存在或已过期时返回的默认值
|
* @param defaultValue 当项不存在或已过期时返回的默认值
|
||||||
* @returns 值,如果项已过期或解析错误则返回默认值
|
* @returns 值,如果项已过期或解析错误则返回默认值
|
||||||
*/
|
*/
|
||||||
getItem<T>(key: string, defaultValue: T | null = null): T | null {
|
getItem<T>(key: string, defaultValue: null | T = null): null | T {
|
||||||
const fullKey = this.getFullKey(key);
|
const fullKey = this.getFullKey(key);
|
||||||
const itemStr = this.storage.getItem(fullKey);
|
const itemStr = this.storage.getItem(fullKey);
|
||||||
if (!itemStr) {
|
if (!itemStr) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ interface StorageValue<T> {
|
||||||
|
|
||||||
interface IStorageCache {
|
interface IStorageCache {
|
||||||
clear(): void;
|
clear(): void;
|
||||||
getItem<T>(key: string): T | null;
|
getItem<T>(key: string): null | T;
|
||||||
key(index: number): null | string;
|
key(index: number): null | string;
|
||||||
length(): number;
|
length(): number;
|
||||||
removeItem(key: string): void;
|
removeItem(key: string): void;
|
||||||
|
|
|
@ -41,4 +41,4 @@ function isValidColor(color?: string) {
|
||||||
return new TinyColor(color).isValid;
|
return new TinyColor(color).isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { TinyColor, convertToHsl, convertToHslCssVar, isValidColor };
|
export { convertToHsl, convertToHslCssVar, isValidColor, TinyColor };
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm unbuild",
|
"build": "pnpm unbuild"
|
||||||
"stub": "pnpm build --stub"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|
|
@ -39,7 +39,7 @@ type AnyFunction<T extends any[] = any[], R = void> =
|
||||||
/**
|
/**
|
||||||
* T | null 包装
|
* T | null 包装
|
||||||
*/
|
*/
|
||||||
type Nullable<T> = T | null;
|
type Nullable<T> = null | T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T | Not null 包装
|
* T | Not null 包装
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { RouteRecordRaw, Router } from 'vue-router';
|
import type { Router, RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
import type { Component } from 'vue';
|
import type { Component } from 'vue';
|
||||||
|
|
||||||
|
|
|
@ -103,11 +103,6 @@ interface VbenLayoutProps {
|
||||||
* @default sidebar-nav
|
* @default sidebar-nav
|
||||||
*/
|
*/
|
||||||
layout?: LayoutType;
|
layout?: LayoutType;
|
||||||
/**
|
|
||||||
* 侧边菜单折叠宽度
|
|
||||||
* @default 48
|
|
||||||
*/
|
|
||||||
sideCollapseWidth?: number;
|
|
||||||
/**
|
/**
|
||||||
* 侧边菜单折叠状态
|
* 侧边菜单折叠状态
|
||||||
* @default false
|
* @default false
|
||||||
|
@ -153,6 +148,11 @@ interface VbenLayoutProps {
|
||||||
* @default 210
|
* @default 210
|
||||||
*/
|
*/
|
||||||
sidebarWidth?: number;
|
sidebarWidth?: number;
|
||||||
|
/**
|
||||||
|
* 侧边菜单折叠宽度
|
||||||
|
* @default 48
|
||||||
|
*/
|
||||||
|
sideCollapseWidth?: number;
|
||||||
/**
|
/**
|
||||||
* tab是否可见
|
* tab是否可见
|
||||||
* @default true
|
* @default true
|
||||||
|
|
|
@ -38,7 +38,6 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
headerVisible: true,
|
headerVisible: true,
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
layout: 'sidebar-nav',
|
layout: 'sidebar-nav',
|
||||||
sideCollapseWidth: 60,
|
|
||||||
sidebarCollapseShowTitle: false,
|
sidebarCollapseShowTitle: false,
|
||||||
sidebarExtraCollapsedWidth: 60,
|
sidebarExtraCollapsedWidth: 60,
|
||||||
sidebarHidden: false,
|
sidebarHidden: false,
|
||||||
|
@ -46,6 +45,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
sidebarSemiDark: true,
|
sidebarSemiDark: true,
|
||||||
sidebarTheme: 'dark',
|
sidebarTheme: 'dark',
|
||||||
sidebarWidth: 180,
|
sidebarWidth: 180,
|
||||||
|
sideCollapseWidth: 60,
|
||||||
tabbarEnable: true,
|
tabbarEnable: true,
|
||||||
tabbarHeight: 36,
|
tabbarHeight: 36,
|
||||||
zIndex: 200,
|
zIndex: 200,
|
||||||
|
@ -130,7 +130,7 @@ const headerWrapperHeight = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const getSideCollapseWidth = computed(() => {
|
const getSideCollapseWidth = computed(() => {
|
||||||
const { sideCollapseWidth, sidebarCollapseShowTitle, sidebarMixedWidth } =
|
const { sidebarCollapseShowTitle, sidebarMixedWidth, sideCollapseWidth } =
|
||||||
props;
|
props;
|
||||||
|
|
||||||
return sidebarCollapseShowTitle || isSidebarMixedNav.value
|
return sidebarCollapseShowTitle || isSidebarMixedNav.value
|
||||||
|
|
|
@ -7,13 +7,13 @@ import type {
|
||||||
} from '../interface';
|
} from '../interface';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type VNodeArrayChildren,
|
|
||||||
computed,
|
computed,
|
||||||
nextTick,
|
nextTick,
|
||||||
reactive,
|
reactive,
|
||||||
ref,
|
ref,
|
||||||
toRef,
|
toRef,
|
||||||
useSlots,
|
useSlots,
|
||||||
|
type VNodeArrayChildren,
|
||||||
watch,
|
watch,
|
||||||
watchEffect,
|
watchEffect,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
@ -22,7 +22,7 @@ import { useNamespace } from '@vben-core/hooks';
|
||||||
import { Ellipsis } from '@vben-core/icons';
|
import { Ellipsis } from '@vben-core/icons';
|
||||||
import { isHttpUrl } from '@vben-core/toolkit';
|
import { isHttpUrl } from '@vben-core/toolkit';
|
||||||
|
|
||||||
import { UseResizeObserverReturn, useResizeObserver } from '@vueuse/core';
|
import { useResizeObserver, UseResizeObserverReturn } from '@vueuse/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createMenuContext,
|
createMenuContext,
|
||||||
|
@ -121,8 +121,8 @@ createMenuContext(
|
||||||
handleMenuItemClick,
|
handleMenuItemClick,
|
||||||
handleSubMenuClick,
|
handleSubMenuClick,
|
||||||
isMenuPopup,
|
isMenuPopup,
|
||||||
openMenu,
|
|
||||||
openedMenus,
|
openedMenus,
|
||||||
|
openMenu,
|
||||||
props,
|
props,
|
||||||
removeMenuItem,
|
removeMenuItem,
|
||||||
removeSubMenu,
|
removeSubMenu,
|
||||||
|
@ -176,7 +176,7 @@ function calcSliceIndex() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function debounce(fn: () => void, wait = 33.34) {
|
function debounce(fn: () => void, wait = 33.34) {
|
||||||
let timer: ReturnType<typeof setTimeout> | null;
|
let timer: null | ReturnType<typeof setTimeout>;
|
||||||
return () => {
|
return () => {
|
||||||
timer && clearTimeout(timer);
|
timer && clearTimeout(timer);
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
|
|
|
@ -44,7 +44,7 @@ const mouseInChild = ref(false);
|
||||||
|
|
||||||
const items = ref<MenuProvider['items']>({});
|
const items = ref<MenuProvider['items']>({});
|
||||||
const subMenus = ref<MenuProvider['subMenus']>({});
|
const subMenus = ref<MenuProvider['subMenus']>({});
|
||||||
const timer = ref<ReturnType<typeof setTimeout> | null>(null);
|
const timer = ref<null | ReturnType<typeof setTimeout>>(null);
|
||||||
|
|
||||||
createSubMenuContext({
|
createSubMenuContext({
|
||||||
addSubMenu,
|
addSubMenu,
|
||||||
|
|
|
@ -105,8 +105,8 @@ interface MenuProvider {
|
||||||
isMenuPopup: boolean;
|
isMenuPopup: boolean;
|
||||||
items: Record<string, MenuItemRegistered>;
|
items: Record<string, MenuItemRegistered>;
|
||||||
|
|
||||||
openMenu: (path: string, parentLinks: string[]) => void;
|
|
||||||
openedMenus: string[];
|
openedMenus: string[];
|
||||||
|
openMenu: (path: string, parentLinks: string[]) => void;
|
||||||
props: MenuProps;
|
props: MenuProps;
|
||||||
removeMenuItem: (item: MenuItemRegistered) => void;
|
removeMenuItem: (item: MenuItemRegistered) => void;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
"@vben-core/typings": "workspace:*",
|
"@vben-core/typings": "workspace:*",
|
||||||
"@vueuse/core": "^10.11.0",
|
"@vueuse/core": "^10.11.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"lucide-vue-next": "^0.411.0",
|
"lucide-vue-next": "^0.414.0",
|
||||||
"radix-vue": "^1.9.2",
|
"radix-vue": "^1.9.2",
|
||||||
"vue": "^3.4.33"
|
"vue": "^3.4.33"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed, useSlots } from 'vue';
|
import { computed, type HTMLAttributes, useSlots } from 'vue';
|
||||||
|
|
||||||
import { VbenTooltip } from '@vben-core/shadcn-ui/components/tooltip';
|
import { VbenTooltip } from '@vben-core/shadcn-ui/components/tooltip';
|
||||||
import { ButtonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
import { ButtonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<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 { computed, HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HoverCard,
|
HoverCard,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
||||||
PopoverRootProps,
|
PopoverRootProps,
|
||||||
} from 'radix-vue';
|
} from 'radix-vue';
|
||||||
|
|
||||||
import { HTMLAttributes, computed } from 'vue';
|
import { computed, HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { buttonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
import { buttonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { buttonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
import { buttonVariants } from '@vben-core/shadcn-ui/components/ui/button';
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
import { AvatarRoot } from 'radix-vue';
|
import { AvatarRoot } from 'radix-vue';
|
||||||
|
|
||||||
import { type AvatarVariants, avatarVariant } from './avatar';
|
import { avatarVariant, type AvatarVariants } from './avatar';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type VariantProps, cva } from 'class-variance-authority';
|
import { cva, type VariantProps } from 'class-variance-authority';
|
||||||
|
|
||||||
export const avatarVariant = cva(
|
export const avatarVariant = cva(
|
||||||
'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden',
|
'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
export * from './avatar';
|
||||||
export { default as Avatar } from './Avatar.vue';
|
export { default as Avatar } from './Avatar.vue';
|
||||||
export { default as AvatarFallback } from './AvatarFallback.vue';
|
export { default as AvatarFallback } from './AvatarFallback.vue';
|
||||||
export { default as AvatarImage } from './AvatarImage.vue';
|
export { default as AvatarImage } from './AvatarImage.vue';
|
||||||
export * from './avatar';
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type VariantProps, cva } from 'class-variance-authority';
|
import { cva, type VariantProps } from 'class-variance-authority';
|
||||||
|
|
||||||
export const badgeVariants = cva(
|
export const badgeVariants = cva(
|
||||||
'inline-flex items-center rounded-md border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
'inline-flex items-center rounded-md border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export { default as Badge } from './Badge.vue';
|
|
||||||
|
|
||||||
export * from './badge';
|
export * from './badge';
|
||||||
|
|
||||||
|
export { default as Badge } from './Badge.vue';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type VariantProps, cva } from 'class-variance-authority';
|
import { cva, type VariantProps } from 'class-variance-authority';
|
||||||
|
|
||||||
export const buttonVariants = cva(
|
export const buttonVariants = cva(
|
||||||
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export { default as Button } from './Button.vue';
|
|
||||||
|
|
||||||
export * from './button';
|
export * from './button';
|
||||||
|
|
||||||
|
export { default as Button } from './Button.vue';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
|
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
|
||||||
|
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type HTMLAttributes, computed } from 'vue';
|
import { computed, type HTMLAttributes } from 'vue';
|
||||||
|
|
||||||
import { cn } from '@vben-core/toolkit';
|
import { cn } from '@vben-core/toolkit';
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue