@campus-admin/core 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -159
- package/dist/app.d.ts +2 -0
- package/dist/context.d.ts +29 -15
- package/dist/copyright.d.ts +2 -0
- package/dist/i18n.d.ts +352 -0
- package/dist/index.d.ts +23 -32
- package/dist/index.js +2475 -424
- package/dist/layout/CaCopyright.vue.d.ts +3 -0
- package/dist/layout/CaLayout.vue.d.ts +3 -0
- package/dist/layout/HeaderBar.vue.d.ts +3 -0
- package/dist/layout/PageHeader.vue.d.ts +3 -0
- package/dist/layout/PageTitle.vue.d.ts +3 -0
- package/dist/layout/SideMenu.vue.d.ts +3 -0
- package/dist/layout/TabsBar.vue.d.ts +3 -0
- package/dist/layout/breakpoints.d.ts +21 -0
- package/dist/{components/overlay/ca-loading-overlay.vue.d.ts → pages/AuthPreview.vue.d.ts} +2 -6
- package/dist/{components/overlay/ca-toast-list.vue.d.ts → pages/ExceptionPage.vue.d.ts} +2 -5
- package/dist/{components/overlay/ca-overlay-list.vue.d.ts → pages/ForgotPage.vue.d.ts} +2 -5
- package/dist/pages/LoginPage.vue.d.ts +3 -0
- package/dist/pages/LoginSplit.vue.d.ts +6 -0
- package/dist/pages/RegisterPage.vue.d.ts +6 -0
- package/dist/pages/auth/AuthIcon.vue.d.ts +10 -0
- package/dist/pages/auth/AuthShell.vue.d.ts +29 -0
- package/dist/pages/auth/CaptchaField.vue.d.ts +20 -0
- package/dist/pages/auth/ForgotForm.vue.d.ts +6 -0
- package/dist/pages/auth/LoginForm.vue.d.ts +6 -0
- package/dist/pages/auth/RegisterForm.vue.d.ts +6 -0
- package/dist/pages/auth/SmsField.vue.d.ts +14 -0
- package/dist/pages/auth/WechatPane.vue.d.ts +3 -0
- package/dist/pages/auth/options.d.ts +15 -0
- package/dist/router.d.ts +15 -0
- package/dist/security.d.ts +15 -0
- package/dist/services/auth.d.ts +11 -0
- package/dist/services/ca.d.ts +48 -0
- package/dist/services/feedback.d.ts +54 -0
- package/dist/storage.d.ts +12 -0
- package/dist/stores/layout.d.ts +41 -0
- package/dist/stores/session.d.ts +53 -0
- package/dist/stores/tabs.d.ts +49 -0
- package/dist/stores/theme.d.ts +280 -0
- package/dist/style.css +2 -0
- package/dist/tabs-policy.d.ts +4 -0
- package/dist/types.d.ts +224 -0
- package/package.json +23 -61
- package/dist/application.d.ts +0 -51
- package/dist/campus.d.ts +0 -9
- package/dist/components/overlay/index.d.ts +0 -6
- package/dist/components/overlay/style/index.d.ts +0 -10
- package/dist/container.d.ts +0 -21
- package/dist/contracts/config.d.ts +0 -13
- package/dist/contracts/provider.d.ts +0 -24
- package/dist/core.css +0 -2
- package/dist/facade.d.ts +0 -15
- package/dist/index.umd.cjs +0 -1
- package/dist/plugin.d.ts +0 -49
- package/dist/services/index.d.ts +0 -7
- package/dist/services/loading.d.ts +0 -21
- package/dist/services/modal.d.ts +0 -47
- package/dist/services/store.d.ts +0 -20
- package/dist/services/toast.d.ts +0 -19
- package/dist/services/use-store.d.ts +0 -9
- package/dist/vue-application.d.ts +0 -21
- package/dist/vue.d.ts +0 -8
- package/types/ca.d.ts +0 -22
- /package/dist/{components/overlay/ca-overlay-host.vue.d.ts → CampusRoot.vue.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,171 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Campus Admin Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Vue 3 application shell with routing, navigation, theme, localization and UI components.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @campus-admin/core vue @lucide/vue
|
|
5
|
+
```sh
|
|
6
|
+
npm install @campus-admin/core vue
|
|
9
7
|
```
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| 包 | 职责 | 依赖 |
|
|
14
|
-
| --- | --- | --- |
|
|
15
|
-
| `@campus-admin/icon` | 校园语义图标与后端图标名解析 | `@lucide/vue` |
|
|
16
|
-
| `@campus-admin/locale` | 国际化运行时:词条、取词、日期数字格式化 | `vue` |
|
|
17
|
-
| `@campus-admin/ui` | 组件库:27 个组件、设计 Token、主题 | `@campus-admin/locale`、`vue` |
|
|
18
|
-
| `@campus-admin/core` | 框架层 + 装配入口(本包) | 上面三个包 |
|
|
19
|
-
|
|
20
|
-
依赖只能向上,`ui` 不会反向依赖 `core`;这条约束由 `pnpm run check:boundaries` 强制。
|
|
21
|
-
|
|
22
|
-
## 快速开始
|
|
9
|
+
Import the public API from the core package. Styles are loaded with the entry point.
|
|
23
10
|
|
|
24
11
|
```ts
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
12
|
+
import { createCampusApp } from '@campus-admin/core'
|
|
13
|
+
|
|
14
|
+
createCampusApp({
|
|
15
|
+
environment: 'test',
|
|
16
|
+
brand: { name: 'Campus' },
|
|
17
|
+
menus: [{
|
|
18
|
+
key: 'main', title: 'Main', children: [
|
|
19
|
+
{ key: 'home', title: 'Home', path: '/home', component: () => import('./Home.vue') },
|
|
20
|
+
],
|
|
21
|
+
}],
|
|
22
|
+
auth: {
|
|
23
|
+
async login() {
|
|
24
|
+
throw new Error('Connect your authentication service')
|
|
25
|
+
},
|
|
39
26
|
},
|
|
40
|
-
|
|
41
|
-
}))
|
|
42
|
-
|
|
43
|
-
app.mount('#app')
|
|
27
|
+
}).mount('#app')
|
|
44
28
|
```
|
|
45
29
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## 全局命令式 API:ca
|
|
49
|
-
|
|
50
|
-
无需 import,页面里直接使用(需要类型提示时 `import { ca } from '@campus-admin/core'`):
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
const loading = ca.loading('加载中')
|
|
54
|
-
loading.hide()
|
|
55
|
-
|
|
56
|
-
ca.toast('保存成功') // 对勾
|
|
57
|
-
ca.toast('保存失败', false) // 叉号
|
|
58
|
-
|
|
59
|
-
ca.alert('提示')
|
|
60
|
-
ca.alert('标题', '内容', () => { /* 点确定后执行 */ })
|
|
61
|
-
|
|
62
|
-
if (await ca.confirm('删除后不可恢复', '确定删除?')) { /* ... */ }
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
| API | 说明 |
|
|
66
|
-
| --- | --- |
|
|
67
|
-
| `ca.loading(text?)` | 加载动画,返回 `{ hide() }` |
|
|
68
|
-
| `ca.toast(text, success?)` | 轻提示,`success=false` 显示叉号;与组件库的 `toast.success()` 共用同一份队列 |
|
|
69
|
-
| `ca.alert(title, content?, onConfirm?)` | 提示框,单个确定按钮 |
|
|
70
|
-
| `ca.confirm(title, content?)` | 确认框,返回 `Promise<boolean>` |
|
|
71
|
-
| `ca.modal({ title, content, onConfirm })` | 通用弹层 |
|
|
72
|
-
| `ca.hideLoading()` | 兜底关闭加载动画(请求拦截器等场景) |
|
|
73
|
-
|
|
74
|
-
## 在组件里取应用实例
|
|
75
|
-
|
|
76
|
-
```vue
|
|
77
|
-
<script setup lang="ts">
|
|
78
|
-
import { useCampus } from '@campus-admin/core'
|
|
79
|
-
|
|
80
|
-
const campus = useCampus()
|
|
81
|
-
campus.config.get('request.baseURL')
|
|
82
|
-
</script>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## 接入业务能力(Provider)
|
|
86
|
-
|
|
87
|
-
能力以 Provider 形式装配进容器,业务通过 Facade 解析,不直接依赖实现:
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
import { defineProvider } from '@campus-admin/core'
|
|
91
|
-
import type { CampusContext } from '@campus-admin/core'
|
|
92
|
-
|
|
93
|
-
export const requestProvider = defineProvider({
|
|
94
|
-
name: 'app:request',
|
|
95
|
-
register(context: CampusContext) {
|
|
96
|
-
context.bind('request', () => createRequestClient({
|
|
97
|
-
baseURL: context.get<string>('request.baseURL', '/api'),
|
|
98
|
-
}))
|
|
99
|
-
},
|
|
100
|
-
})
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import { campus } from '@campus-admin/core'
|
|
105
|
-
|
|
106
|
-
const request = campus<RequestClient>('request') // 换实现时调用方不用改
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## 从本包能 import 什么
|
|
110
|
-
|
|
111
|
-
- **内核**:`CampusApplication`、`createCampus`、`CampusContainer`、`CampusContext`、`defineProvider`、`definePlugin`、`campus()`、`CampusConfig` 等契约类型
|
|
112
|
-
- **Vue 适配**:`computed` / `ref` / `watch` / `inject` / `provide` 等响应式 API 出口、`useCampus()`、`CAMPUS_KEY`、`createVueApplication()`
|
|
113
|
-
- **命令式 API**:`ca`、`CaOverlayHost`、`showLoading` / `showToast` / `alert` / `confirm`
|
|
114
|
-
- **组件库**:全部 `CaXxx` 组件、`builtInComponents`、`ns` / `cx`、`setTheme` / `setPrimaryColor`
|
|
115
|
-
- **国际化**:`useLocale` / `setLocale` / `createLocale` / `caMessages`、`formatDay` / `formatMonth` / `weekdayLabels` / `formatNumber`
|
|
116
|
-
- **图标**:`Campus*` 语义图标、`resolveIcon()`、`iconRegistry`
|
|
117
|
-
|
|
118
|
-
## 生命周期
|
|
119
|
-
|
|
120
|
-
```text
|
|
121
|
-
created → register(所有 Provider 绑定服务)→ boot(初始化,可依赖其他服务)→ start(触发启动回调)
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
约定:**register 阶段不要调用别的服务**,因为无法保证对方已经注册完成;需要跨服务协作时放到 `boot`。
|
|
125
|
-
|
|
126
|
-
## 内核 API 速查
|
|
127
|
-
|
|
128
|
-
### createCampus(options)
|
|
129
|
-
|
|
130
|
-
| 选项 | 类型 | 说明 |
|
|
131
|
-
| --- | --- | --- |
|
|
132
|
-
| `name` / `version` | `string` | 应用名称与版本 |
|
|
133
|
-
| `config` | `object` | 业务配置,可自由扩展(`request`、`locale` 等) |
|
|
134
|
-
| `providers` | `CampusProvider[]` | 启动时注册的服务提供者 |
|
|
135
|
-
| `plugins` | `CampusPlugin[]` | 启动时装载的插件 |
|
|
136
|
-
|
|
137
|
-
### CampusContainer
|
|
138
|
-
|
|
139
|
-
| 方法 | 说明 |
|
|
140
|
-
| --- | --- |
|
|
141
|
-
| `bind(key, value \| factory)` | 绑定实例或工厂函数,单例语义 |
|
|
142
|
-
| `singleton(key, value)` | 同 `bind`,语义更明确的别名 |
|
|
143
|
-
| `make<T>(key)` | 解析服务,未注册返回 `undefined` |
|
|
144
|
-
| `resolve<T>(key)` | 解析服务,未注册抛错 |
|
|
145
|
-
|
|
146
|
-
## 设计约束(改代码前必读)
|
|
147
|
-
|
|
148
|
-
1. **依赖只能向上**:`icon`、`locale` 是底座,`ui` 只依赖 `locale`,`core` 依赖 `ui` / `locale` / `icon`;
|
|
149
|
-
2. **包源码不得反向依赖 `examples`**;
|
|
150
|
-
3. **源码里不出现构建工具**(Vite 配置只放包根目录);
|
|
151
|
-
4. **契约优先**:业务依赖契约与 Facade,不依赖具体实现,替换实现时不改调用方。
|
|
152
|
-
|
|
153
|
-
以上 1–3 由 `pnpm run check:boundaries` 在门禁里强制。
|
|
154
|
-
|
|
155
|
-
## 相关包
|
|
156
|
-
|
|
157
|
-
- [`@campus-admin/ui`](../ui/README.md):组件库
|
|
158
|
-
- [`@campus-admin/locale`](../locale/README.md):国际化
|
|
159
|
-
- [`@campus-admin/icon`](../icon/README.md):图标
|
|
160
|
-
|
|
161
|
-
## 版权
|
|
162
|
-
|
|
163
|
-
使用本项目时请保留版权信息(MIT 许可要求随副本保留版权声明):
|
|
30
|
+
This is a setup example: create `Home.vue` and provide real menus and authentication. In production, configure `auth.captcha()` and enforce authentication and password validation on the server. The source repository is private.
|
|
164
31
|
|
|
165
|
-
|
|
166
|
-
- 保留页面页脚中的「Powered By 众校通 ®」与联系方式(示例用 `Copyright` 组件统一渲染);
|
|
167
|
-
- 二次分发或修改后的版本,请在显著位置保留同样的版权声明。
|
|
32
|
+
## Upgrading from 1.0
|
|
168
33
|
|
|
169
|
-
|
|
34
|
+
Version 2 is a rewrite and is not API compatible with 1.0. Replace the old `createCampusAdmin` integration with `createCampusApp`, provide menus, brand and authentication using `CampusOptions`, and test your application before upgrading. Version 2 uses the new `@campus-admin/theme` package; the old `@campus-admin/icon` package is not a dependency. Keep a working 1.0 lockfile for rollback.
|
|
170
35
|
|
|
171
|
-
|
|
36
|
+
License: MIT.
|
package/dist/app.d.ts
ADDED
package/dist/context.d.ts
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
import type { CampusContainer } from './container';
|
|
2
|
-
import type { CampusConfig } from './contracts/config';
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* 应用级上下文:保存创建应用时传入的配置,并提供菜单展平工具。
|
|
3
|
+
*
|
|
4
|
+
* 为什么用模块级单例而不是 provide/inject:
|
|
5
|
+
* 路由守卫、Pinia store 都在组件之外运行,拿不到 inject;而一个页面里只会有一个 Campus 应用,
|
|
6
|
+
* 单例足够简单可靠。
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
bind<T>(key: string, value: T | (() => T)): void;
|
|
16
|
-
make<T>(key: string): T | undefined;
|
|
17
|
-
resolve<T>(key: string): T;
|
|
8
|
+
import { type CampusOptions, type MenuApp, type MenuPage } from './types.js';
|
|
9
|
+
export declare function setOptions(options: CampusOptions): void;
|
|
10
|
+
/** 读取配置;未创建应用就调用说明用法有误,直接抛错而不是返回空值 */
|
|
11
|
+
export declare function getOptions(): CampusOptions;
|
|
12
|
+
/** 展平后的页面:带上所属应用与菜单组(二级直接是页面时没有菜单组),路由和标签页都靠它定位 */
|
|
13
|
+
export interface FlatPage extends MenuPage {
|
|
14
|
+
appKey: string;
|
|
15
|
+
groupKey?: string;
|
|
18
16
|
}
|
|
17
|
+
/** 页面在菜单里的位置:一级场景 → (二级菜单组)→ 页面;面包屑据此显示 */
|
|
18
|
+
export declare function findTrail(pageKey: string): {
|
|
19
|
+
titles: string[];
|
|
20
|
+
} | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* 把“应用 → 菜单组 → 页面”(二级也可以直接是页面)展平成页面列表。
|
|
23
|
+
* 同时做配置检查:页面键或路径重复会导致路由、标签页、缓存互相串,所以启动时就报错。
|
|
24
|
+
*/
|
|
25
|
+
export declare function flattenPages(menus: MenuApp[]): FlatPage[];
|
|
26
|
+
/**
|
|
27
|
+
* 检查“账户页路径”:配置了就必须是菜单里某个页面的路径。
|
|
28
|
+
* 不检查的话,写错路径要等用户点了“我的账户”才会落到 404,问题发现得太晚,所以启动时就报错。
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkAccountPath(accountPath: string | undefined, pages: {
|
|
31
|
+
path: string;
|
|
32
|
+
}[]): void;
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 国际化:合并框架词条与平台词条,并保存用户选择的语言。
|
|
3
|
+
*/
|
|
4
|
+
import { type LocaleCode } from '@campus-admin/locale';
|
|
5
|
+
import type { Composer } from 'vue-i18n';
|
|
6
|
+
import type { CampusOptions } from './types.js';
|
|
7
|
+
/** 创建 i18n 实例:用户上次选择 > 平台默认 > 中文 */
|
|
8
|
+
export declare function createCampusI18n(options: CampusOptions): import("vue-i18n").I18n<{
|
|
9
|
+
'zh-CN': {
|
|
10
|
+
campus: {
|
|
11
|
+
notify: {
|
|
12
|
+
success: string;
|
|
13
|
+
info: string;
|
|
14
|
+
warning: string;
|
|
15
|
+
error: string;
|
|
16
|
+
};
|
|
17
|
+
common: {
|
|
18
|
+
ok: string;
|
|
19
|
+
cancel: string;
|
|
20
|
+
confirm: string;
|
|
21
|
+
tip: string;
|
|
22
|
+
loading: string;
|
|
23
|
+
};
|
|
24
|
+
login: {
|
|
25
|
+
title: string;
|
|
26
|
+
username: string;
|
|
27
|
+
password: string;
|
|
28
|
+
submit: string;
|
|
29
|
+
failed: string;
|
|
30
|
+
required: string;
|
|
31
|
+
};
|
|
32
|
+
auth: {
|
|
33
|
+
tabAccount: string;
|
|
34
|
+
tabWechat: string;
|
|
35
|
+
tabRegister: string;
|
|
36
|
+
tabForgot: string;
|
|
37
|
+
backLogin: string;
|
|
38
|
+
accountPlaceholder: string;
|
|
39
|
+
passwordPlaceholder: string;
|
|
40
|
+
captcha: string;
|
|
41
|
+
captchaPlaceholder: string;
|
|
42
|
+
captchaRefresh: string;
|
|
43
|
+
captchaFailed: string;
|
|
44
|
+
captchaRequired: string;
|
|
45
|
+
wechatHint: string;
|
|
46
|
+
wechatNote: string;
|
|
47
|
+
qrcodeAlt: string;
|
|
48
|
+
helpTitle: string;
|
|
49
|
+
help1: string;
|
|
50
|
+
help2: string;
|
|
51
|
+
help3: string;
|
|
52
|
+
help4: string;
|
|
53
|
+
findPassword: string;
|
|
54
|
+
forgotLink: string;
|
|
55
|
+
registerLink: string;
|
|
56
|
+
phone: string;
|
|
57
|
+
phonePlaceholder: string;
|
|
58
|
+
phoneInvalid: string;
|
|
59
|
+
account: string;
|
|
60
|
+
accountRequired: string;
|
|
61
|
+
smsCode: string;
|
|
62
|
+
smsPlaceholder: string;
|
|
63
|
+
getCode: string;
|
|
64
|
+
resend: string;
|
|
65
|
+
smsSent: string;
|
|
66
|
+
smsNeedPhone: string;
|
|
67
|
+
smsNeedAccount: string;
|
|
68
|
+
registerPassword: string;
|
|
69
|
+
registerPasswordPlaceholder: string;
|
|
70
|
+
newPasswordPlaceholder: string;
|
|
71
|
+
confirmPlaceholder: string;
|
|
72
|
+
passwordPolicy: string;
|
|
73
|
+
sessionExpired: string;
|
|
74
|
+
passwordMismatch: string;
|
|
75
|
+
agreePrefix: string;
|
|
76
|
+
agreeRequired: string;
|
|
77
|
+
registerOk: string;
|
|
78
|
+
resetOk: string;
|
|
79
|
+
previewNote: string;
|
|
80
|
+
unavailableTitle: string;
|
|
81
|
+
unavailableDesc: string;
|
|
82
|
+
};
|
|
83
|
+
header: {
|
|
84
|
+
language: string;
|
|
85
|
+
theme: string;
|
|
86
|
+
logout: string;
|
|
87
|
+
myAccount: string;
|
|
88
|
+
search: string;
|
|
89
|
+
shortcuts: string;
|
|
90
|
+
fullscreen: string;
|
|
91
|
+
exitFullscreen: string;
|
|
92
|
+
notifications: string;
|
|
93
|
+
assistant: string;
|
|
94
|
+
appearance: string;
|
|
95
|
+
settings: string;
|
|
96
|
+
account: string;
|
|
97
|
+
};
|
|
98
|
+
settings: {
|
|
99
|
+
title: string;
|
|
100
|
+
themeMode: string;
|
|
101
|
+
themeColor: string;
|
|
102
|
+
themeColorCustom: string;
|
|
103
|
+
themeColorReset: string;
|
|
104
|
+
boxStyle: string;
|
|
105
|
+
boxBorder: string;
|
|
106
|
+
boxShadow: string;
|
|
107
|
+
close: string;
|
|
108
|
+
};
|
|
109
|
+
mode: {
|
|
110
|
+
light: string;
|
|
111
|
+
dark: string;
|
|
112
|
+
auto: string;
|
|
113
|
+
};
|
|
114
|
+
side: {
|
|
115
|
+
home: string;
|
|
116
|
+
collapse: string;
|
|
117
|
+
expand: string;
|
|
118
|
+
hideText: string;
|
|
119
|
+
showText: string;
|
|
120
|
+
openMenu: string;
|
|
121
|
+
closeMenu: string;
|
|
122
|
+
};
|
|
123
|
+
breadcrumb: {
|
|
124
|
+
current: string;
|
|
125
|
+
};
|
|
126
|
+
tabs: {
|
|
127
|
+
refresh: string;
|
|
128
|
+
close: string;
|
|
129
|
+
closeLeft: string;
|
|
130
|
+
closeRight: string;
|
|
131
|
+
closeOthers: string;
|
|
132
|
+
closeAll: string;
|
|
133
|
+
fullscreen: string;
|
|
134
|
+
exitFullscreen: string;
|
|
135
|
+
};
|
|
136
|
+
table: {
|
|
137
|
+
search: string;
|
|
138
|
+
reset: string;
|
|
139
|
+
empty: string;
|
|
140
|
+
loadFailed: string;
|
|
141
|
+
retry: string;
|
|
142
|
+
total: string;
|
|
143
|
+
refresh: string;
|
|
144
|
+
};
|
|
145
|
+
form: {
|
|
146
|
+
required: string;
|
|
147
|
+
submit: string;
|
|
148
|
+
reset: string;
|
|
149
|
+
};
|
|
150
|
+
chart: {
|
|
151
|
+
compact: string;
|
|
152
|
+
empty: string;
|
|
153
|
+
loading: string;
|
|
154
|
+
total: string;
|
|
155
|
+
category: string;
|
|
156
|
+
value: string;
|
|
157
|
+
percent: string;
|
|
158
|
+
summaryLine: string;
|
|
159
|
+
summaryBar: string;
|
|
160
|
+
summarySeries: string;
|
|
161
|
+
summaryPie: string;
|
|
162
|
+
summaryPieItem: string;
|
|
163
|
+
summarySpark: string;
|
|
164
|
+
summaryGauge: string;
|
|
165
|
+
};
|
|
166
|
+
error: {
|
|
167
|
+
forbidden: string;
|
|
168
|
+
notFound: string;
|
|
169
|
+
backHome: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
'en-US': {
|
|
174
|
+
campus: {
|
|
175
|
+
notify: {
|
|
176
|
+
success: string;
|
|
177
|
+
info: string;
|
|
178
|
+
warning: string;
|
|
179
|
+
error: string;
|
|
180
|
+
};
|
|
181
|
+
common: {
|
|
182
|
+
ok: string;
|
|
183
|
+
cancel: string;
|
|
184
|
+
confirm: string;
|
|
185
|
+
tip: string;
|
|
186
|
+
loading: string;
|
|
187
|
+
};
|
|
188
|
+
login: {
|
|
189
|
+
title: string;
|
|
190
|
+
username: string;
|
|
191
|
+
password: string;
|
|
192
|
+
submit: string;
|
|
193
|
+
failed: string;
|
|
194
|
+
required: string;
|
|
195
|
+
};
|
|
196
|
+
auth: {
|
|
197
|
+
tabAccount: string;
|
|
198
|
+
tabWechat: string;
|
|
199
|
+
tabRegister: string;
|
|
200
|
+
tabForgot: string;
|
|
201
|
+
backLogin: string;
|
|
202
|
+
accountPlaceholder: string;
|
|
203
|
+
passwordPlaceholder: string;
|
|
204
|
+
captcha: string;
|
|
205
|
+
captchaPlaceholder: string;
|
|
206
|
+
captchaRefresh: string;
|
|
207
|
+
captchaFailed: string;
|
|
208
|
+
captchaRequired: string;
|
|
209
|
+
wechatHint: string;
|
|
210
|
+
wechatNote: string;
|
|
211
|
+
qrcodeAlt: string;
|
|
212
|
+
helpTitle: string;
|
|
213
|
+
help1: string;
|
|
214
|
+
help2: string;
|
|
215
|
+
help3: string;
|
|
216
|
+
help4: string;
|
|
217
|
+
findPassword: string;
|
|
218
|
+
forgotLink: string;
|
|
219
|
+
registerLink: string;
|
|
220
|
+
phone: string;
|
|
221
|
+
phonePlaceholder: string;
|
|
222
|
+
phoneInvalid: string;
|
|
223
|
+
account: string;
|
|
224
|
+
accountRequired: string;
|
|
225
|
+
smsCode: string;
|
|
226
|
+
smsPlaceholder: string;
|
|
227
|
+
getCode: string;
|
|
228
|
+
resend: string;
|
|
229
|
+
smsSent: string;
|
|
230
|
+
smsNeedPhone: string;
|
|
231
|
+
smsNeedAccount: string;
|
|
232
|
+
registerPassword: string;
|
|
233
|
+
registerPasswordPlaceholder: string;
|
|
234
|
+
newPasswordPlaceholder: string;
|
|
235
|
+
confirmPlaceholder: string;
|
|
236
|
+
passwordPolicy: string;
|
|
237
|
+
sessionExpired: string;
|
|
238
|
+
passwordMismatch: string;
|
|
239
|
+
agreePrefix: string;
|
|
240
|
+
agreeRequired: string;
|
|
241
|
+
registerOk: string;
|
|
242
|
+
resetOk: string;
|
|
243
|
+
previewNote: string;
|
|
244
|
+
unavailableTitle: string;
|
|
245
|
+
unavailableDesc: string;
|
|
246
|
+
};
|
|
247
|
+
header: {
|
|
248
|
+
language: string;
|
|
249
|
+
theme: string;
|
|
250
|
+
logout: string;
|
|
251
|
+
myAccount: string;
|
|
252
|
+
search: string;
|
|
253
|
+
shortcuts: string;
|
|
254
|
+
fullscreen: string;
|
|
255
|
+
exitFullscreen: string;
|
|
256
|
+
notifications: string;
|
|
257
|
+
assistant: string;
|
|
258
|
+
appearance: string;
|
|
259
|
+
settings: string;
|
|
260
|
+
account: string;
|
|
261
|
+
};
|
|
262
|
+
settings: {
|
|
263
|
+
title: string;
|
|
264
|
+
themeMode: string;
|
|
265
|
+
themeColor: string;
|
|
266
|
+
themeColorCustom: string;
|
|
267
|
+
themeColorReset: string;
|
|
268
|
+
boxStyle: string;
|
|
269
|
+
boxBorder: string;
|
|
270
|
+
boxShadow: string;
|
|
271
|
+
close: string;
|
|
272
|
+
};
|
|
273
|
+
mode: {
|
|
274
|
+
light: string;
|
|
275
|
+
dark: string;
|
|
276
|
+
auto: string;
|
|
277
|
+
};
|
|
278
|
+
side: {
|
|
279
|
+
home: string;
|
|
280
|
+
collapse: string;
|
|
281
|
+
expand: string;
|
|
282
|
+
hideText: string;
|
|
283
|
+
showText: string;
|
|
284
|
+
openMenu: string;
|
|
285
|
+
closeMenu: string;
|
|
286
|
+
};
|
|
287
|
+
breadcrumb: {
|
|
288
|
+
current: string;
|
|
289
|
+
};
|
|
290
|
+
tabs: {
|
|
291
|
+
refresh: string;
|
|
292
|
+
close: string;
|
|
293
|
+
closeLeft: string;
|
|
294
|
+
closeRight: string;
|
|
295
|
+
closeOthers: string;
|
|
296
|
+
closeAll: string;
|
|
297
|
+
fullscreen: string;
|
|
298
|
+
exitFullscreen: string;
|
|
299
|
+
};
|
|
300
|
+
table: {
|
|
301
|
+
search: string;
|
|
302
|
+
reset: string;
|
|
303
|
+
empty: string;
|
|
304
|
+
loadFailed: string;
|
|
305
|
+
retry: string;
|
|
306
|
+
total: string;
|
|
307
|
+
refresh: string;
|
|
308
|
+
};
|
|
309
|
+
form: {
|
|
310
|
+
required: string;
|
|
311
|
+
submit: string;
|
|
312
|
+
reset: string;
|
|
313
|
+
};
|
|
314
|
+
chart: {
|
|
315
|
+
compact: string;
|
|
316
|
+
empty: string;
|
|
317
|
+
loading: string;
|
|
318
|
+
total: string;
|
|
319
|
+
category: string;
|
|
320
|
+
value: string;
|
|
321
|
+
percent: string;
|
|
322
|
+
summaryLine: string;
|
|
323
|
+
summaryBar: string;
|
|
324
|
+
summarySeries: string;
|
|
325
|
+
summaryPie: string;
|
|
326
|
+
summaryPieItem: string;
|
|
327
|
+
summarySpark: string;
|
|
328
|
+
summaryGauge: string;
|
|
329
|
+
};
|
|
330
|
+
error: {
|
|
331
|
+
forbidden: string;
|
|
332
|
+
notFound: string;
|
|
333
|
+
backHome: string;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
}, {}, {}, LocaleCode, false>;
|
|
338
|
+
/**
|
|
339
|
+
* 组件之外也能用的翻译函数(工具函数、接口适配、确认框文案等没有 setup 的地方)。
|
|
340
|
+
* 读取当前语言,写在模板或 computed 里会随语言切换自动更新;应用创建前调用只返回键。
|
|
341
|
+
*/
|
|
342
|
+
export declare function t(key: string, params?: Record<string, unknown>): string;
|
|
343
|
+
/** 切换并记住语言 */
|
|
344
|
+
export declare function persistLocale(code: LocaleCode): void;
|
|
345
|
+
/**
|
|
346
|
+
* 平台页面里用的翻译工具。
|
|
347
|
+
* label(text):text 是已登记的词条键就翻译,否则原样返回——
|
|
348
|
+
* 菜单标题等位置既可以写词条键,也可以直接写文本。
|
|
349
|
+
*/
|
|
350
|
+
export declare function useCampusT(): Pick<Composer, 't' | 'te' | 'locale'> & {
|
|
351
|
+
label: (text: string) => string;
|
|
352
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @campus-admin/core
|
|
2
|
+
* @campus-admin/core 对平台的公开出口。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. **Vue 适配**:响应式 API 出口、`useCampus`、弹层宿主与命令式 API(`ca.*`);
|
|
7
|
-
* 3. **装配**:`createCampusAdmin()` 一次装好组件库、语言实例与弹层宿主。
|
|
8
|
-
*
|
|
9
|
-
* 业务只需要安装本包;组件与样式由 `@campus-admin/ui` 提供,国际化由
|
|
10
|
-
* `@campus-admin/locale` 提供,两者都在这里再导出,业务不必分别安装。
|
|
4
|
+
* 平台只需要安装这个包:通用组件、主题类型、反馈服务都从这里转出,
|
|
5
|
+
* 平台代码里不应出现 element-plus 或其他框架内部依赖的直接引用。
|
|
11
6
|
*/
|
|
12
|
-
import '
|
|
13
|
-
import '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export type {
|
|
23
|
-
export {
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export {
|
|
27
|
-
export
|
|
7
|
+
import 'element-plus/es/components/base/style/css';
|
|
8
|
+
import 'element-plus/theme-chalk/dark/css-vars.css';
|
|
9
|
+
import '@campus-admin/theme/nova.css';
|
|
10
|
+
import type { MenuApp } from './types.js';
|
|
11
|
+
export { createCampusApp } from './app.js';
|
|
12
|
+
export { t, useCampusT } from './i18n.js';
|
|
13
|
+
export { ca } from './services/ca.js';
|
|
14
|
+
export { handleUnauthorized } from './services/auth.js';
|
|
15
|
+
export { resolveEnvironment } from './security.js';
|
|
16
|
+
export type { Ca } from './services/ca.js';
|
|
17
|
+
export type { DialogOptions, NotifyOptions } from './services/feedback.js';
|
|
18
|
+
export { useSessionStore } from './stores/session.js';
|
|
19
|
+
export { useLayoutStore } from './stores/layout.js';
|
|
20
|
+
export { useTabsStore } from './stores/tabs.js';
|
|
21
|
+
export { useThemeStore } from './stores/theme.js';
|
|
22
|
+
export type * from './types.js';
|
|
28
23
|
export * from '@campus-admin/ui';
|
|
29
|
-
export
|
|
30
|
-
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare const _default: {
|
|
34
|
-
install(app: Parameters<ReturnType<typeof createCampusAdmin>["install"]>[0]): void;
|
|
35
|
-
};
|
|
36
|
-
export default _default;
|
|
24
|
+
export type { LocaleCode } from '@campus-admin/locale';
|
|
25
|
+
export type { LoginBackground, ThemeField, ThemeInput, ThemeLayer, ThemeLayers, ThemeMode } from '@campus-admin/theme';
|
|
26
|
+
/** 菜单数据的类型辅助:本身不做任何事,只是让平台写菜单时有完整的类型提示 */
|
|
27
|
+
export declare function defineMenus(menus: MenuApp[]): MenuApp[];
|