@campus-admin/core 2.0.4 → 2.0.6
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 +37 -0
- package/dist/context.d.ts +34 -7
- package/dist/i18n.d.ts +4 -0
- package/dist/index.js +650 -480
- package/dist/router.d.ts +5 -1
- package/dist/stores/layout.d.ts +52 -3
- package/dist/stores/tabs.d.ts +1 -1
- package/dist/stores/theme.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +36 -9
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -29,6 +29,34 @@ createCampusApp({
|
|
|
29
29
|
|
|
30
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.
|
|
31
31
|
|
|
32
|
+
## Collapsing the sidebar per page
|
|
33
|
+
|
|
34
|
+
Since 2.0.5 a menu page can ask the desktop sidebar to collapse while it is open: add `sideCollapse: 'panel'` to hide the second column (page list) or `sideCollapse: 'all'` to hide both columns and keep only the header (a menu button then appears in the header). `'none'` or no value keeps the user's own layout. The setting applies when the page is entered and the user's previous choice comes back on the next page; if the user expands the sidebar on that page, their action wins until they leave. Nothing is written to browser storage, and phone and tablet layouts are unchanged.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
{ key: 'watch', title: 'Watch list', path: '/watch', component: () => import('./Watch.vue'), sideCollapse: 'panel' }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For manual control use `useLayoutStore()`: `applySideCollapse('panel' | 'all' | 'none')`, `toggleSidePanel()` (same as the collapse button), and the read-only state `sidePanelCollapsed` and `sideHiddenActive`. The user's own collapse choice is still stored under the existing `side-collapsed` key.
|
|
41
|
+
|
|
42
|
+
## Page opening mode (2.0.6)
|
|
43
|
+
|
|
44
|
+
Set `MenuPage.openMode` (also forwarded to route meta):
|
|
45
|
+
|
|
46
|
+
| Value | Behavior |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `normal` / omitted | Normal layout (omitted keeps legacy `sideCollapse`) |
|
|
49
|
+
| `collapsePanel` | Collapse the second sidebar on desktop |
|
|
50
|
+
| `collapseAll` | Collapse both sidebars on desktop |
|
|
51
|
+
| `content` | Hide the header and sidebars within the window, on every screen size |
|
|
52
|
+
| `screen` | Browser fullscreen on every screen size; fall back to `content` if denied |
|
|
53
|
+
|
|
54
|
+
An explicit `openMode`, including `normal`, takes precedence over `sideCollapse`. The previous content layout returns on leaving, and only browser fullscreen opened by the framework is exited. Manual buttons and Escape win until the next page; changing query/hash on the same path does not reapply the mode. Adjacent fullscreen pages keep fullscreen active. No opening-mode state is stored in the browser.
|
|
55
|
+
|
|
56
|
+
The router requests fullscreen before lazy-loading the page, within the user activation from menu, tab or search clicks. Browsers may reject fullscreen after a refresh, direct address navigation, restored tab, expired activation, or on unsupported devices. The page then fills the window and shows a dismissible **Click to enter fullscreen** button. Clicking retries the native API; a failed retry keeps the fallback. This requires no platform-specific click handler.
|
|
57
|
+
|
|
58
|
+
The demo's Feature menu includes five pages at `/feature/open-mode/{normal|collapsePanel|collapseAll|content|screen}` for switching between modes.
|
|
59
|
+
|
|
32
60
|
## WeChat scan sign-in
|
|
33
61
|
|
|
34
62
|
Since 2.0.2 the split login page's WeChat tab can show the platform's own QR code: add `wechat: { mount(el) }` to your `AuthProvider`. The framework only provides the container: `mount` is called when the tab is visible and its returned cleanup runs when the tab is hidden or the page is left; a failing `mount` shows a retry prompt. After your own callback gets a token, call `completeLogin({ token, user }, redirect)`. Without `wechat` the tab stays a placeholder, as in 2.0.1. The login page also accepts `login.panel.title`, `login.panel.background`, `login.card` and `login.fields`; see `docs/06-微信扫码登录.md` in the source repository.
|
|
@@ -38,3 +66,12 @@ Since 2.0.2 the split login page's WeChat tab can show the platform's own QR cod
|
|
|
38
66
|
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.
|
|
39
67
|
|
|
40
68
|
License: MIT.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### 2.0.5 menu and layout options
|
|
72
|
+
|
|
73
|
+
All new options retain previous defaults. `MenuPage.pageHeader` overrides `CampusOptions.pageHeader` (default true); false hides title and description while keeping page actions. `homeEntry: false` keeps affix pages in their original groups without changing fixed tabs. `accountInMenu: true` keeps accountPath visible in the sidebar. `accountEntry: { side, header }` independently hides account items with false; `onAccountClick(source)` receives `side` or `header`, takes precedence over accountPath, and keeps account pages in the sidebar. accountPath no longer needs to be a menu path.
|
|
74
|
+
|
|
75
|
+
`paths` overrides home/login/register/forgot/forbidden/notFound defaults (`/`, `/login`, `/register`, `/forgot`, `/403`, `/:pathMatch(.*)*`). No business menus or profile paths are injected. Custom menu icon classes such as `iconfont zxt-setting1` require platform CSS and a loaded font. See [upgrade guide](../../docs/05-升级指南.md) for migration, sidebar size tokens and demo switches.
|
|
76
|
+
|
|
77
|
+
`routeNames` optionally renames login/register/forgot/forbidden/notFound system routes, preserving their previous names by default. Rename conflicting system routes when platform page keys use those names.
|
package/dist/context.d.ts
CHANGED
|
@@ -23,10 +23,37 @@ export declare function findTrail(pageKey: string): {
|
|
|
23
23
|
* 同时做配置检查:页面键或路径重复会导致路由、标签页、缓存互相串,所以启动时就报错。
|
|
24
24
|
*/
|
|
25
25
|
export declare function flattenPages(menus: MenuApp[]): FlatPage[];
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
/** 系统路由默认值不属于业务菜单;平台可逐项替换路径。 */
|
|
27
|
+
export declare function campusPaths(options: Pick<CampusOptions, 'paths'>): {
|
|
28
|
+
home: string;
|
|
29
|
+
login: string;
|
|
30
|
+
register: string;
|
|
31
|
+
forgot: string;
|
|
32
|
+
forbidden: string;
|
|
33
|
+
notFound: string;
|
|
34
|
+
};
|
|
35
|
+
/** 侧栏只筛选可见入口,不改变路由和固定标签的数据。 */
|
|
36
|
+
export declare function sideMenus(options: CampusOptions, can: (permission?: string) => boolean): {
|
|
37
|
+
home: FlatPage | undefined;
|
|
38
|
+
apps: {
|
|
39
|
+
children: (MenuPage | {
|
|
40
|
+
children: MenuPage[];
|
|
41
|
+
key: string;
|
|
42
|
+
title: string;
|
|
43
|
+
icon?: import("@campus-admin/ui").IconValue;
|
|
44
|
+
badge?: number | (() => number);
|
|
45
|
+
})[];
|
|
46
|
+
key: string;
|
|
47
|
+
title: string;
|
|
48
|
+
icon?: import("@campus-admin/ui").IconValue;
|
|
49
|
+
}[];
|
|
50
|
+
accountStandalone: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** 名称与路径分别配置,平台不必避开默认系统名称。 */
|
|
53
|
+
export declare function campusRouteNames(options: Pick<CampusOptions, 'routeNames'>): {
|
|
54
|
+
login: string;
|
|
55
|
+
register: string;
|
|
56
|
+
forgot: string;
|
|
57
|
+
forbidden: string;
|
|
58
|
+
notFound: string;
|
|
59
|
+
};
|
package/dist/i18n.d.ts
CHANGED
|
@@ -126,6 +126,8 @@ export declare function createCampusI18n(options: CampusOptions): import("vue-i1
|
|
|
126
126
|
current: string;
|
|
127
127
|
};
|
|
128
128
|
tabs: {
|
|
129
|
+
enterScreen: string;
|
|
130
|
+
dismissScreen: string;
|
|
129
131
|
refresh: string;
|
|
130
132
|
close: string;
|
|
131
133
|
closeLeft: string;
|
|
@@ -292,6 +294,8 @@ export declare function createCampusI18n(options: CampusOptions): import("vue-i1
|
|
|
292
294
|
current: string;
|
|
293
295
|
};
|
|
294
296
|
tabs: {
|
|
297
|
+
enterScreen: string;
|
|
298
|
+
dismissScreen: string;
|
|
295
299
|
refresh: string;
|
|
296
300
|
close: string;
|
|
297
301
|
closeLeft: string;
|