@jnrs/vue-core 1.1.1 → 1.1.3

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.
@@ -1,35 +1,4 @@
1
1
  import { RouteMeta } from 'vue-router';
2
- /**
3
- * 用户信息
4
- */
5
- export interface User {
6
- id: number;
7
- name: string;
8
- account?: string;
9
- role?: number;
10
- jobTitle?: number;
11
- workNo?: string;
12
- workgroup?: null | string;
13
- avatarFileName?: string;
14
- loginDateTime?: string;
15
- [key: string]: unknown;
16
- }
17
- /**
18
- * 字典
19
- */
20
- export interface DictItem {
21
- label: string;
22
- value: string | number;
23
- displayColor?: string;
24
- sequence?: number;
25
- [key: string]: unknown;
26
- }
27
- /**
28
- * 字典键值对
29
- */
30
- export interface Dict {
31
- [key: string]: DictItem[];
32
- }
33
2
  /**
34
3
  * 定义菜单项接口
35
4
  */
@@ -37,7 +6,6 @@ export interface MenuItem {
37
6
  meta: RouteMeta;
38
7
  path: string;
39
8
  name?: string;
40
- todoCount?: number;
41
9
  component?: string;
42
10
  redirect?: string;
43
11
  children?: MenuItem[];
@@ -1,105 +1,10 @@
1
- import { createWebHistory as l, createRouter as p } from "vue-router";
2
- import { useRoute as w, useRouter as b } from "vue-router";
3
- const d = {
4
- history: l(),
5
- routes: []
6
- };
7
- let n, s, i, m;
8
- const R = ({
9
- options: o,
10
- fileModules: t,
11
- layoutName: e,
12
- globalComponent: a,
13
- handleBeforeEach: r
14
- }) => (s = t, e && (i = e), a && (m = a), n = p({ ...d, ...o }), n.beforeEach(
15
- async (c, u) => r?.(c, u)
16
- ), n), O = async (o, t = "push") => {
17
- try {
18
- return await n[t](o);
19
- } catch (e) {
20
- console.warn(`router.${t} 失败`, {
21
- code: "ROUTER_NOT_MATCH",
22
- message: "未匹配到有效路由",
23
- error: o || e,
24
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
25
- }), n[t]({ name: "404" });
26
- }
27
- }, h = (o) => s[`/src/views${o}.vue`], f = async (o, t) => {
28
- for (const e of o) {
29
- if (e.meta.fullPathTitle = t ? t.meta.fullPathTitle + "," + e.meta.title : e.meta.title, !e.component) {
30
- e.children && e.children.length > 0 && f(e.children, e);
31
- continue;
32
- }
33
- const a = e.component.replace(/[^a-zA-Z0-9/._-]/g, "");
34
- if (!a.startsWith("/") || a.includes("..")) {
35
- console.warn("[Router] 组件加载失败", {
36
- code: "INVALID_COMPONENT_PATH",
37
- message: "组件路径拼写不符合规则,应以 '/' 开头且不能包含 '..',请检查 component 字段是否配置正确",
38
- menu: {
39
- path: e.path,
40
- name: e.name,
41
- component: e.component
42
- },
43
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
44
- });
45
- continue;
46
- }
47
- const r = h(a);
48
- if (!r) {
49
- console.warn("[Router] 组件加载失败", {
50
- code: "COMPONENT_NOT_FOUND",
51
- message: "组件加载器无效,请检查 component 字段是否配置正确",
52
- menu: {
53
- path: e.path,
54
- name: e.name,
55
- component: e.component
56
- },
57
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
58
- });
59
- continue;
60
- }
61
- let c = {
62
- name: e.name,
63
- path: e.path,
64
- meta: e.meta,
65
- redirect: e.redirect,
66
- component: () => r()
67
- };
68
- e.meta?.global ? (m !== void 0 && (c = {
69
- name: "_globalComponent_" + e.name,
70
- path: e.path,
71
- meta: e.meta,
72
- redirect: e.redirect,
73
- component: () => m,
74
- children: [
75
- {
76
- path: "",
77
- name: e.name,
78
- meta: e.meta,
79
- component: () => r()
80
- }
81
- ]
82
- }), n.addRoute(c)) : n.addRoute(i, c);
83
- }
84
- }, _ = () => {
85
- const o = [];
86
- for (const t of n.getRoutes())
87
- o.push({
88
- name: t.name,
89
- path: t.path,
90
- meta: t.meta
91
- });
92
- return o;
93
- };
94
- console.log(
95
- "%c✨ 欢迎使用 @jnrs/vue-core/router",
96
- 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
97
- );
1
+ import { useRoute as o, useRouter as a } from "vue-router";
2
+ import { a as u, b as s, g as R, h as n } from "../index-DEkMXVh9.js";
98
3
  export {
99
- f as asyncGenerateRoute,
100
- R as createVueRouter,
101
- _ as getRoutes,
102
- O as handleRouter,
103
- w as useRoute,
104
- b as useRouter
4
+ u as asyncGenerateRoute,
5
+ s as createVueRouter,
6
+ R as getRoutes,
7
+ n as handleRouter,
8
+ o as useRoute,
9
+ a as useRouter
105
10
  };
@@ -7,6 +7,7 @@ declare module 'vue-router' {
7
7
  noAuth?: boolean;
8
8
  global?: boolean;
9
9
  fullPathTitle?: string;
10
+ todoCount?: number;
10
11
  }
11
12
  }
12
13
  export interface RouteModule {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jnrs/vue-core",
3
- "version": "1.1.1",
4
- "description": "巨能前端工程化开发,Vue 专用核心功能包",
3
+ "version": "1.1.3",
4
+ "description": "巨能前端工程化开发,Vue 专用核心功能包。",
5
5
  "keywords": [
6
6
  "jnrs",
7
7
  "vue-core"
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "type": "module",
19
19
  "types": "dist/index.d.ts",
20
+ "sideEffects": true,
20
21
  "files": [
21
22
  "dist",
22
23
  "README.md",
@@ -34,21 +35,28 @@
34
35
  "./pinia": {
35
36
  "import": "./dist/piniaStore/index.js",
36
37
  "types": "./dist/piniaStore/index.d.ts"
38
+ },
39
+ "./components": {
40
+ "import": "./dist/components/index.js",
41
+ "types": "./dist/components/index.d.ts"
37
42
  }
38
43
  },
39
44
  "peerDependencies": {
45
+ "@vueuse/core": "^14.1.0",
46
+ "element-plus": "^2.11.9",
40
47
  "pinia": "^3.0.3",
41
48
  "pinia-plugin-persistedstate": "^4.7.1",
42
49
  "vue": "^3.5.22",
43
50
  "vue-router": "^4.5.1",
44
- "@jnrs/shared": "1.1.1",
45
- "@jnrs/core": "1.1.1"
51
+ "@jnrs/core": "1.1.3",
52
+ "@jnrs/shared": "1.1.3"
46
53
  },
47
54
  "devDependencies": {
48
55
  "@vitejs/plugin-vue": "^6.0.1",
49
56
  "rimraf": "^6.0.1",
50
57
  "typescript": "^5.9.3",
51
58
  "vite": "^7.1.7",
59
+ "vite-plugin-css-injected-by-js": "^3.5.2",
52
60
  "vite-plugin-dts": "^4.5.4",
53
61
  "vue-tsc": "^3.1.0"
54
62
  },