@skyfox2000/microbase 1.0.4 → 1.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/lib/index.d.ts CHANGED
@@ -109,7 +109,7 @@ export declare enum AppSource {
109
109
  /**
110
110
  * 深度合并QOD参数
111
111
  */
112
- export declare const combineParams: (...args: ReqParams[]) => ReqParams;
112
+ export declare const combineParams: (...args: (ReqParams | undefined)[]) => ReqParams;
113
113
 
114
114
  /**
115
115
  * 启动配置信息
@@ -379,14 +379,6 @@ export declare type RouteRecord = RouteRecordRaw & {
379
379
  children?: RouteRecord[];
380
380
  };
381
381
 
382
- /**
383
- * 表格行操作区位置
384
- */
385
- export declare enum RowOperate {
386
- LEFT = 1,
387
- RIGHT = 2,
388
- }
389
-
390
382
  /**
391
383
  * 前端个性化配置
392
384
  */
@@ -400,9 +392,15 @@ export declare interface SettingInfo {
400
392
  */
401
393
  menuCollapse: boolean;
402
394
  /**
403
- * 表格行操作区位置
395
+ * 表格头配置
404
396
  */
405
- rowOperate: RowOperate;
397
+ tableColumns: {
398
+ /**
399
+ * PageUrl
400
+ * Columns
401
+ */
402
+ [key: string]: Record<string, any>[]
403
+ };
406
404
  /**
407
405
  * 使用语言
408
406
  */
@@ -439,8 +437,19 @@ export declare interface UserInfo {
439
437
  readonly TenantId: string | null;
440
438
  /**
441
439
  * 用户级别
440
+ * - Super 超级管理员
441
+ * - Admin 系统管理员
442
+ * - User 用户
442
443
  */
443
444
  readonly UserLevel: string;
445
+ /**
446
+ * 角色列表
447
+ */
448
+ readonly Roles?: string[]
449
+ /**
450
+ * 权限列表
451
+ */
452
+ readonly Permissions?: string[];
444
453
  }
445
454
 
446
455
  export { }
@@ -1,26 +1,26 @@
1
1
  import { deepClone as u } from "@skyfox2000/fapi";
2
2
  import { ref as o, markRaw as p, h as a } from "vue";
3
3
  import { createRouter as m, createWebHashHistory as d } from "vue-router";
4
- var v = /* @__PURE__ */ ((e) => (e.Market = "Market", e.Manual = "Manual", e))(v || {}), y = /* @__PURE__ */ ((e) => (e.App = "App", e.MenuApp = "MenuApp", e.Link = "Link", e.Iframe = "Iframe", e))(y || {}), A = /* @__PURE__ */ ((e) => (e[e.LEFT = 1] = "LEFT", e[e.RIGHT = 2] = "RIGHT", e))(A || {});
5
- const r = (e, t) => {
6
- if (!(!t || !e))
7
- for (const n in t)
8
- n in e && typeof e[n] == "object" && typeof t[n] == "object" && !Array.isArray(t[n]) ? r(e[n], t[n]) : e[n] = u(t[n]);
9
- }, E = (...e) => {
10
- const t = {};
11
- for (const n of e)
12
- n != null && n.Option && !t.Option && (t.Option = {}), r(t.Option, n == null ? void 0 : n.Option);
13
- for (const n of e)
14
- n != null && n.Query && !t.Query && (t.Query = {}), r(t.Query, n == null ? void 0 : n.Query);
15
- for (const n of e)
16
- t.Data = n != null && n.Data ? u(n.Data) : {};
17
- return t;
18
- }, L = () => !!window.__MICRO_APP_ENVIRONMENT__, O = () => !!window.__MICRO_APP_BASE_APPLICATION__, i = o(), M = o(), _ = o(), k = () => {
4
+ var v = /* @__PURE__ */ ((e) => (e.Market = "Market", e.Manual = "Manual", e))(v || {}), y = /* @__PURE__ */ ((e) => (e.App = "App", e.MenuApp = "MenuApp", e.Link = "Link", e.Iframe = "Iframe", e))(y || {});
5
+ const r = (e, n) => {
6
+ if (!(!n || !e))
7
+ for (const t in n)
8
+ t in e && typeof e[t] == "object" && typeof n[t] == "object" && !Array.isArray(n[t]) ? r(e[t], n[t]) : e[t] = u(n[t]);
9
+ }, P = (...e) => {
10
+ const n = {};
11
+ for (const t of e)
12
+ t != null && t.Option && !n.Option && (n.Option = {}), r(n.Option, t == null ? void 0 : t.Option);
13
+ for (const t of e)
14
+ t != null && t.Query && !n.Query && (n.Query = {}), r(n.Query, t == null ? void 0 : t.Query);
15
+ for (const t of e)
16
+ n.Data = t != null && t.Data ? u(t.Data) : {};
17
+ return n;
18
+ }, I = () => !!window.__MICRO_APP_ENVIRONMENT__, k = () => !!window.__MICRO_APP_BASE_APPLICATION__, i = o(), A = o(), M = o(), R = () => {
19
19
  const e = window.microApp.getData(
20
20
  !0
21
21
  );
22
- i.value = e.MainApis, M.value = e.MainEvents, _.value = e.pageUrl;
23
- }, h = [
22
+ i.value = e.MainApis, A.value = e.MainEvents, M.value = e.pageUrl;
23
+ }, w = [
24
24
  {
25
25
  path: "/:page(.*)",
26
26
  name: "默认页面",
@@ -28,20 +28,20 @@ const r = (e, t) => {
28
28
  }
29
29
  ], l = m({
30
30
  history: d(void 0),
31
- routes: h
31
+ routes: w
32
32
  });
33
33
  l.afterEach((e) => {
34
34
  if (i.value) {
35
- const { mainAppPush: t } = i.value;
36
- t && t(e.hash);
35
+ const { mainAppPush: n } = i.value;
36
+ n && n(e.hash);
37
37
  }
38
38
  });
39
- const T = o({}), c = o(""), f = o({}), s = o(null), w = async (e) => {
39
+ const C = o({}), c = o(""), f = o({}), s = o(null), _ = async (e) => {
40
40
  c.value = e, e.startsWith("/") && (e = e.substring(1));
41
- const t = f.value[`./views/${e}.vue`];
42
- if (t) {
43
- const n = await t();
44
- s.value = p(n.default), l.replace("/" + e);
41
+ const n = f.value[`./views/${e}.vue`];
42
+ if (n) {
43
+ const t = await n();
44
+ s.value = p(t.default), l.replace("/" + e);
45
45
  } else
46
46
  console.error("加载微模块" + e + "失败"), s.value = a(
47
47
  "div",
@@ -58,28 +58,27 @@ const T = o({}), c = o(""), f = o({}), s = o(null), w = async (e) => {
58
58
  },
59
59
  [a("div", "404 NOT FOUND")]
60
60
  );
61
- }, C = (e) => {
62
- f.value = e, window.microApp && window.microApp.addDataListener(async (t) => {
63
- if (t.pageUrl === c.value) return;
64
- let n = t.pageUrl;
65
- w(n);
61
+ }, E = (e) => {
62
+ f.value = e, window.microApp && window.microApp.addDataListener(async (n) => {
63
+ if (n.pageUrl === c.value) return;
64
+ let t = n.pageUrl;
65
+ _(t);
66
66
  }, !0);
67
67
  };
68
68
  export {
69
69
  y as AppAction,
70
70
  v as AppSource,
71
71
  l as LoaderRouter,
72
- A as RowOperate,
73
- E as combineParams,
74
- k as initMainAppData,
75
- C as initModuleLoader,
76
- O as isBaseMicroApp,
77
- L as isMicroApp,
78
- w as loadModule,
72
+ P as combineParams,
73
+ R as initMainAppData,
74
+ E as initModuleLoader,
75
+ k as isBaseMicroApp,
76
+ I as isMicroApp,
77
+ _ as loadModule,
79
78
  i as mainAppApis,
80
- M as mainAppEvents,
81
- _ as mainPageUrl,
82
- T as moduleAttrs,
79
+ A as mainAppEvents,
80
+ M as mainPageUrl,
81
+ C as moduleAttrs,
83
82
  s as moduleCom,
84
83
  f as moduleRecords,
85
84
  c as moduleUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyfox2000/microbase",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "微前端通用功能与数据类型定义",
5
5
  "type": "module",
6
6
  "keywords": [],
package/src/index.ts CHANGED
@@ -1,14 +1,71 @@
1
- export * from "@/stores/appInfo.d";
2
- export * from "@/stores/hostInfo.d";
3
- export * from "@/stores/settingInfo.d";
4
- export * from "@/stores/userInfo.d";
1
+ import { AppSource, AppAction } from "@/stores/appInfo.d";
2
+ import type { AppInfo } from "@/stores/appInfo.d";
3
+ import type { HostInfo } from "@/stores/hostInfo.d";
4
+ import type { SettingInfo } from "@/stores/settingInfo.d";
5
+ import type { LoginInfo, UserInfo } from "@/stores/userInfo.d";
5
6
 
7
+ import { combineParams } from "@/utils/data";
6
8
 
7
- export * from "@/utils/data";
8
- export * from "@/utils/micro-app";
9
+ import {
10
+ isMicroApp,
11
+ isBaseMicroApp,
12
+ mainAppApis,
13
+ mainAppEvents,
14
+ mainPageUrl,
15
+ initMainAppData
16
+ } from "@/utils/micro-app";
17
+ import type {
18
+ MainAppData,
19
+ MainOpenApis,
20
+ MainOpenEvents
21
+ } from "@/utils/micro-app";
9
22
 
10
- export * from "@/router/loader-router";
23
+ import type {
24
+ MenuLink,
25
+ RouteMeta,
26
+ RouteRecord
27
+ } from "@/router/loader-router";
11
28
  import LoaderRouter from "@/router/loader-router";
29
+
30
+ import {
31
+ moduleAttrs,
32
+ moduleUrl,
33
+ moduleRecords,
34
+ moduleCom,
35
+ loadModule,
36
+ initModuleLoader
37
+ } from "@/components/loader/index";
38
+
39
+ export { AppSource, AppAction };
40
+ export type { AppInfo };
41
+ export type { HostInfo };
42
+ export type { SettingInfo };
43
+ export type { LoginInfo, UserInfo };
44
+
45
+ export { combineParams };
46
+
47
+ export {
48
+ isMicroApp,
49
+ isBaseMicroApp,
50
+ mainAppApis,
51
+ mainAppEvents,
52
+ mainPageUrl,
53
+ initMainAppData
54
+ };
55
+ export type {
56
+ MainAppData,
57
+ MainOpenApis,
58
+ MainOpenEvents
59
+ };
60
+
61
+ export type { MenuLink, RouteMeta, RouteRecord };
12
62
  export { LoaderRouter };
13
63
 
14
- export * from "@/components/loader/index";
64
+ export {
65
+ moduleAttrs,
66
+ moduleUrl,
67
+ moduleRecords,
68
+ moduleCom,
69
+ loadModule,
70
+ initModuleLoader
71
+ };
@@ -1,10 +1,3 @@
1
- /**
2
- * 表格行操作区位置
3
- */
4
- export enum RowOperate {
5
- LEFT = 1,
6
- RIGHT = 2,
7
- }
8
1
  /**
9
2
  * 前端个性化配置
10
3
  */
@@ -18,9 +11,15 @@ export interface SettingInfo {
18
11
  */
19
12
  menuCollapse: boolean;
20
13
  /**
21
- * 表格行操作区位置
14
+ * 表格头配置
22
15
  */
23
- rowOperate: RowOperate;
16
+ tableColumns: {
17
+ /**
18
+ * PageUrl
19
+ * Columns
20
+ */
21
+ [key: string]: Record<string, any>[]
22
+ };
24
23
  /**
25
24
  * 使用语言
26
25
  */
@@ -20,8 +20,19 @@ export interface UserInfo {
20
20
  readonly TenantId: string | null;
21
21
  /**
22
22
  * 用户级别
23
+ * - Super 超级管理员
24
+ * - Admin 系统管理员
25
+ * - User 用户
23
26
  */
24
27
  readonly UserLevel: string;
28
+ /**
29
+ * 角色列表
30
+ */
31
+ readonly Roles?: string[]
32
+ /**
33
+ * 权限列表
34
+ */
35
+ readonly Permissions?: string[];
25
36
  }
26
37
 
27
38
  /**
package/src/utils/data.ts CHANGED
@@ -26,7 +26,7 @@ const mergeDeep = (
26
26
  /**
27
27
  * 深度合并QOD参数
28
28
  */
29
- export const combineParams = (...args: ReqParams[]): ReqParams => {
29
+ export const combineParams = (...args: (ReqParams | undefined)[]): ReqParams => {
30
30
  const mergedParams: ReqParams = {};
31
31
 
32
32
  // 合并选项对象