@befly-addon/admin 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Befly - 管理后台功能组件",
5
5
  "type": "module",
6
6
  "private": false,
@@ -19,7 +19,6 @@
19
19
  "tables/",
20
20
  "views/",
21
21
  "utils/",
22
- "types/",
23
22
  "addon.config.json",
24
23
  "README.md",
25
24
  "package.json",
@@ -40,7 +39,7 @@
40
39
  "url": "https://github.com/chenbimo/befly.git",
41
40
  "directory": "packages/addon-admin"
42
41
  },
43
- "gitHead": "62797bf96f317ff0e666db73b4edac4435a6ed35",
42
+ "gitHead": "5cb110dfdbc9dda0f85729ee51173a7122decb50",
44
43
  "dependencies": {
45
44
  "befly": "3.8.12"
46
45
  }
@@ -1,15 +1,22 @@
1
- import type { RouteRecordRaw } from 'vue-router';
2
- import type { LayoutConfig } from '../types/layout';
1
+ /**
2
+ * 布局配置接口
3
+ * @typedef {Object} LayoutConfig
4
+ * @property {string} path - 路径
5
+ * @property {string} layoutName - 布局名称
6
+ * @property {import('vue-router').Component} component - 组件
7
+ * @property {LayoutConfig[]} [children] - 子配置
8
+ * @property {Record<string, any>} [meta] - 元信息
9
+ */
3
10
 
4
11
  /**
5
12
  * 自定义布局处理函数
6
13
  * 根据文件名后缀判断使用哪个布局
7
- * @param routes - 原始路由配置
8
- * @param inheritLayout - 继承的布局名称(来自父级目录)
9
- * @returns 处理后的布局配置(不包含实际的布局组件导入)
14
+ * @param {import('vue-router').RouteRecordRaw[]} routes - 原始路由配置
15
+ * @param {string} inheritLayout - 继承的布局名称(来自父级目录)
16
+ * @returns {LayoutConfig[]} 处理后的布局配置(不包含实际的布局组件导入)
10
17
  */
11
- export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): LayoutConfig[] {
12
- const result: LayoutConfig[] = [];
18
+ export function Layouts(routes, inheritLayout = '') {
19
+ const result = [];
13
20
 
14
21
  for (const route of routes) {
15
22
  const currentPath = route.path || '';
@@ -45,7 +52,7 @@ export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): LayoutCon
45
52
  const layoutName = match ? match[1] : currentLayout || 'default';
46
53
 
47
54
  // 计算清理后的路径
48
- let cleanPath: string;
55
+ let cleanPath;
49
56
  if (lastPart === 'index' || (lastPart.startsWith('index_') && match)) {
50
57
  // index 或 index_数字 → 改为空路径(由父级路径表示)
51
58
  cleanPath = '';
@@ -61,7 +68,7 @@ export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): LayoutCon
61
68
  result.push({
62
69
  path: cleanPath,
63
70
  layoutName: layoutName,
64
- component: route.component!,
71
+ component: route.component,
65
72
  meta: route.meta
66
73
  });
67
74
  }
@@ -11,7 +11,7 @@ export function scanBeflyAddonViews() {
11
11
  // 使用绝对路径:基于项目根目录(process.cwd())
12
12
  const projectRoot = process.cwd();
13
13
  const addonBasePath = join(projectRoot, 'node_modules', '@befly-addon');
14
- const routesFolders: Array<{ src: string; path: string }> = [];
14
+ const routesFolders = [];
15
15
 
16
16
  if (!existsSync(addonBasePath)) {
17
17
  return routesFolders;
@@ -24,7 +24,7 @@
24
24
  </TinyForm>
25
25
  </template>
26
26
 
27
- <script setup lang="ts">
27
+ <script setup>
28
28
  import { $ref, $shallowRef } from 'vue-macros/macros';
29
29
  import { useRouter, useRoute } from 'vue-router';
30
30
  import { Button as TinyButton, Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, Modal } from '@opentiny/vue';
package/types/layout.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { RouteRecordRaw, Component } from 'vue-router';
2
-
3
- /**
4
- * 布局配置接口
5
- */
6
- export interface LayoutConfig {
7
- path: string;
8
- layoutName: string;
9
- component: Component;
10
- children?: LayoutConfig[];
11
- meta?: Record<string, any>;
12
- }