chore(project): refactor types dir

This commit is contained in:
vben
2024-05-21 22:14:25 +08:00
parent c31d21be50
commit f6087ce4e8
37 changed files with 141 additions and 65 deletions

View File

@@ -0,0 +1,7 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});

92
packages/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,92 @@
import 'vue-router';
declare module 'vue-router' {
interface RouteMeta {
/**
* 是否固定标签页
* @default false
*/
affixTab?: boolean;
/**
* 需要特定的角色标识才可以访问
* @default []
*/
authority?: string[];
/**
* 徽标
*/
badge?: string;
/**
* 徽标类型
*/
badgeType?: 'dot' | 'normal';
/**
* 徽标颜色
*/
badgeVariants?:
| 'default'
| 'destructive'
| 'primary'
| 'success'
| 'warning'
| string;
/**
* 当前路由的子级在菜单中不展现
* @default false
*/
hideChildrenInMenu?: boolean;
/**
* 当前路由在面包屑中不展现
* @default false
*/
hideInBreadcrumb?: boolean;
/**
* 当前路由在菜单中不展现
* @default false
*/
hideInMenu?: boolean;
/**
* 当前路由在标签页不展现
* @default false
*/
hideInTab?: boolean;
/**
* 路由跳转地址
*/
href?: string;
/**
* 图标(菜单/tab
*/
icon?: string;
/**
* iframe 地址
*/
iframeSrc?: string;
/**
* 忽略权限,直接可以访问
* @default false
*/
ignoreAccess?: boolean;
/**
* 开启KeepAlive缓存
*/
keepAlive?: boolean;
/**
* 路由是否已经加载过
*/
loaded?: boolean;
/**
* 用于路由->菜单排序
*/
orderNo?: number;
/**
* 外链-跳转路径
*/
target?: string;
/**
* 标题名称
*/
title: string;
}
}

View File

@@ -0,0 +1,51 @@
{
"name": "@vben/types",
"version": "1.0.0",
"type": "module",
"license": "MIT",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/types"
},
"bugs": {
"url": "https://github.com/vbenjs/vue-vben-admin/issues"
},
"scripts": {
"build": "pnpm unbuild",
"stub": "pnpm build --stub"
},
"files": [
"dist"
],
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"imports": {
"#*": "./src/*"
},
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
},
"./global": {
"types": "./global.d.ts"
}
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
}
},
"dependencies": {
"@vben-core/typings": "workspace:*",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
}
}

View File

@@ -0,0 +1,2 @@
export type * from './ui';
export type * from '@vben-core/typings';

6
packages/types/src/ui.ts Normal file
View File

@@ -0,0 +1,6 @@
interface SelectListItem {
label: string;
value: string;
}
export type { SelectListItem };

View File

@@ -0,0 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/library.json",
"include": ["src"]
}