@fmdeui/fmui 1.0.34 → 1.0.36

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 CHANGED
@@ -438,7 +438,7 @@ const watermark = new Watermark({
438
438
 
439
439
  ## 版本信息
440
440
 
441
- 当前版本:`1.0.26`
441
+ 当前版本:`1.0.35`
442
442
 
443
443
  ## 注意事项
444
444
 
package/es/index.mjs CHANGED
@@ -20,7 +20,7 @@ export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './packages/hooks/
20
20
  export { base64ToFile, blobToFile, dataURLtoBlob, fileToBase64, urlToBase64 } from './packages/utils/base64Conver.mjs';
21
21
  export { buildLocaleContext, buildTranslator, translate, useLocale } from './packages/hooks/useLocale.mjs';
22
22
  export { clone, isObjectValueEqual, judgementSameArr, removeDuplicate } from './packages/utils/arrayOperation.mjs';
23
- export { configureRoutes, setPathPrefix, staticRoutes } from './packages/router/route.mjs';
23
+ export { configureRoutes, staticRoutes } from './packages/router/route.mjs';
24
24
  export { destroyIdleTimeout, initIdleTimeout, updateIdleTimeout } from './packages/hooks/idleTimeout.mjs';
25
25
  export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow } from './packages/utils/download.mjs';
26
26
  export { default as en } from './packages/locale/lang/en.mjs';
@@ -35,6 +35,14 @@ async function initBackEndControlRoutes() {
35
35
  const res = await getBackEndControlRoutes();
36
36
  if (res == void 0 || res.length <= 0) return Promise.resolve(true);
37
37
  useRequestOldRoutes().setRequestOldRoutes(res);
38
+ if (dynamicRoutes.length === 0) {
39
+ dynamicRoutes.push({
40
+ path: "/",
41
+ name: "Layout",
42
+ component: () => import('../components/fm-layout/src/index.vue.mjs'),
43
+ children: []
44
+ });
45
+ }
38
46
  dynamicRoutes[0].children = await backEndComponent(res);
39
47
  await setAddRoute();
40
48
  setFilterMenuAndCacheTagsViewRoutes();
@@ -67,35 +75,64 @@ async function setBackEndControlRefreshRoutes() {
67
75
  await getBackEndControlRoutes();
68
76
  }
69
77
  function backEndComponent(routes) {
70
- if (!routes) return;
78
+ if (!routes) return [];
71
79
  return routes.map((item) => {
72
80
  if (!item.path) item.path = "";
73
- if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component);
74
- item.children && backEndComponent(item.children);
81
+ if (item.component && typeof item.component === "string") {
82
+ item.component = dynamicImport(dynamicViewsModules, item.component);
83
+ if (!item.component) {
84
+ item.component = () => import('../components/fm-layout/src/index.vue.mjs');
85
+ console.warn(`Using default component for route: ${item.path}`);
86
+ }
87
+ }
88
+ if (item.children) {
89
+ item.children = backEndComponent(item.children);
90
+ }
75
91
  return item;
76
92
  });
77
93
  }
78
94
  function dynamicImport(dynamicViewsModules2, component) {
79
95
  const keys = Object.keys(dynamicViewsModules2);
80
- const matchKeys = keys.filter((key) => {
96
+ let matchKeys = [];
97
+ matchKeys = keys.filter((key) => key.includes(component));
98
+ if (matchKeys.length === 0) {
81
99
  const REMOVE_PREFIXES = [
82
100
  "../../../../packages/fmasyspage/views",
83
101
  "../../../../packages/fmwlpage/views",
84
102
  "../../../../packages/fmreliefpage/views",
85
103
  "../views",
86
104
  "./views",
105
+ "./layout/routerView",
106
+ "../layout/routerView",
87
107
  ".."
88
108
  ].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
89
- const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
90
- return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
91
- });
109
+ matchKeys = keys.filter((key) => {
110
+ const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
111
+ return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
112
+ });
113
+ }
92
114
  if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
93
115
  const matchKey = matchKeys[0];
94
116
  return dynamicViewsModules2[matchKey];
95
117
  }
96
118
  if ((matchKeys == null ? void 0 : matchKeys.length) > 1) {
97
- return false;
119
+ const exactMatch = matchKeys.find((key) => key.endsWith(`${component}.vue`) || key.endsWith(`${component}.tsx`));
120
+ if (exactMatch) {
121
+ return dynamicViewsModules2[exactMatch];
122
+ }
123
+ return dynamicViewsModules2[matchKeys[0]];
124
+ }
125
+ if (dynamicViewsModules2[component]) {
126
+ return dynamicViewsModules2[component];
127
+ }
128
+ if (component.startsWith("/")) {
129
+ const relativeComponent = component.substring(1);
130
+ if (dynamicViewsModules2[relativeComponent]) {
131
+ return dynamicViewsModules2[relativeComponent];
132
+ }
98
133
  }
134
+ console.warn(`No component found for: ${component}`);
135
+ console.warn("Available modules:", Object.keys(dynamicViewsModules2));
99
136
  }
100
137
 
101
138
  export { backEndComponent, dynamicImport, getBackEndControlRoutes, initBackEndControlRoutes, setAddRoute, setBackEndControlRefreshRoutes, setCacheTagsViewRoutes, setDynamicViewsModules, setFilterMenuAndCacheTagsViewRoutes, setFilterRouteEnd };
@@ -2,7 +2,7 @@ import { storeToRefs } from 'pinia';
2
2
  import { useRoutesList } from '../stores/routesList.mjs';
3
3
  import { useThemeConfig } from '../stores/themeConfig.mjs';
4
4
  import { Session, Local } from '../utils/storage.mjs';
5
- export { configureRoutes, setPathPrefix, staticRoutes } from './route.mjs';
5
+ export { configureRoutes, staticRoutes } from './route.mjs';
6
6
  import { initFrontEndControlRoutes } from './frontEnd.mjs';
7
7
  import { initBackEndControlRoutes } from './backEnd.mjs';
8
8
  export { setDynamicViewsModules } from './backEnd.mjs';
@@ -1,122 +1,6 @@
1
- let pathPrefix = "/@";
2
- function setPathPrefix(prefix) {
3
- pathPrefix = prefix;
4
- }
5
- function getPath(path) {
6
- return `${pathPrefix}${path}`;
7
- }
8
- let dynamicRoutes = [
9
- {
10
- path: "/",
11
- name: "/",
12
- component: () => import(getPath("/layout/index.vue")),
13
- redirect: "/dashboard/home",
14
- meta: {
15
- isKeepAlive: true
16
- },
17
- children: []
18
- },
19
- {
20
- path: "/llm/aiChat",
21
- name: "aiChat",
22
- component: () => import(getPath("/views/aiChat/index.vue")),
23
- meta: {
24
- title: "AI\u5BF9\u8BDD",
25
- isKeepAlive: true
26
- }
27
- },
28
- {
29
- path: "/platform/job/dashboard",
30
- name: "jobDashboard",
31
- component: () => import(getPath("/views/system/job/dashboard.vue")),
32
- meta: {
33
- title: "\u4EFB\u52A1\u770B\u677F",
34
- isLink: window.__env__.VITE_API_URL + "/schedule",
35
- isHide: true,
36
- isKeepAlive: true,
37
- isAffix: false,
38
- isIframe: true,
39
- icon: "ele-Clock"
40
- }
41
- },
42
- {
43
- path: "/develop/database/visual",
44
- name: "databaseVisual",
45
- component: () => import(getPath("/views/system/database/component/visualTable.vue")),
46
- meta: {
47
- title: "\u5E93\u8868\u53EF\u89C6\u5316",
48
- isHide: true,
49
- isKeepAlive: true,
50
- isAffix: false,
51
- // isIframe: true,
52
- icon: "ele-View"
53
- }
54
- },
55
- {
56
- path: "/report/view/:reportConfigId/:tagsViewName?",
57
- name: "sysReportView",
58
- component: () => import(getPath("/views/system/reportConfig/component/reportView.vue")),
59
- meta: {
60
- title: "\u62A5\u8868\u67E5\u770B",
61
- isHide: true,
62
- isKeepAlive: true,
63
- isAffix: false,
64
- isIframe: false,
65
- icon: ""
66
- }
67
- }
68
- ];
69
- let notFoundAndNoPower = [
70
- {
71
- path: "/:path(.*)*",
72
- name: "notFound",
73
- component: () => import(getPath("/views/error/404.vue")),
74
- meta: {
75
- title: "message.staticRoutes.notFound",
76
- isHide: true
77
- }
78
- },
79
- {
80
- path: "/401",
81
- name: "noPower",
82
- component: () => import(getPath("/views/error/401.vue")),
83
- meta: {
84
- title: "message.staticRoutes.noPower",
85
- isHide: true
86
- }
87
- }
88
- ];
89
- let staticRoutes = [
90
- {
91
- path: "/login",
92
- name: "login",
93
- component: () => import(getPath("/views/login/index.vue")),
94
- meta: {
95
- title: "Login",
96
- isPublic: true
97
- }
98
- }
99
- /**
100
- * 提示:写在这里的为全屏界面,不建议写在这里
101
- * 请写在 `dynamicRoutes` 路由数组中
102
- */
103
- // {
104
- // path: '/visualizingDemo1',
105
- // name: 'visualizingDemo1',
106
- // component: () => import('/@/views/visualizing/demo1.vue'),
107
- // meta: {
108
- // title: 'message.router.visualizingLinkDemo1',
109
- // },
110
- // },
111
- // {
112
- // path: '/visualizingDemo2',
113
- // name: 'visualizingDemo2',
114
- // component: () => import('/@/views/visualizing/demo2.vue'),
115
- // meta: {
116
- // title: 'message.router.visualizingLinkDemo2',
117
- // },
118
- // },
119
- ];
1
+ let dynamicRoutes = [];
2
+ let notFoundAndNoPower = [];
3
+ let staticRoutes = [];
120
4
  function configureRoutes(options) {
121
5
  if (options.dynamicRoutes) {
122
6
  if (options.merge) {
@@ -139,9 +23,6 @@ function configureRoutes(options) {
139
23
  notFoundAndNoPower = options.notFoundAndNoPower;
140
24
  }
141
25
  }
142
- if (options.pathPrefix) {
143
- setPathPrefix(options.pathPrefix);
144
- }
145
26
  }
146
27
 
147
- export { configureRoutes, dynamicRoutes, notFoundAndNoPower, setPathPrefix, staticRoutes };
28
+ export { configureRoutes, dynamicRoutes, notFoundAndNoPower, staticRoutes };
@@ -60,4 +60,4 @@ export declare function backEndComponent(routes: any): any;
60
60
  * @param component 当前要处理项 component
61
61
  * @returns 返回处理成函数后的 component
62
62
  */
63
- export declare function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string): false | Function | undefined;
63
+ export declare function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string): Function | undefined;
@@ -1,4 +1,4 @@
1
- import { configureRoutes, setPathPrefix, staticRoutes } from './route';
1
+ import { configureRoutes, staticRoutes } from './route';
2
2
  import { initFrontEndControlRoutes } from './frontEnd';
3
3
  import { initBackEndControlRoutes, setDynamicViewsModules } from './backEnd';
4
4
  import { router } from './createRouter';
@@ -9,4 +9,4 @@ import { Router } from 'vue-router';
9
9
  */
10
10
  export declare function initRouter(): Router;
11
11
  export default router;
12
- export { configureRoutes, staticRoutes, setPathPrefix, setDynamicViewsModules, initBackEndControlRoutes, initFrontEndControlRoutes };
12
+ export { configureRoutes, staticRoutes, setDynamicViewsModules, initBackEndControlRoutes, initFrontEndControlRoutes };
@@ -27,11 +27,6 @@ declare module 'vue-router' {
27
27
  isPublic?: boolean;
28
28
  }
29
29
  }
30
- /**
31
- * 设置路径前缀
32
- * @param prefix 路径前缀
33
- */
34
- export declare function setPathPrefix(prefix: string): void;
35
30
  /**
36
31
  * 定义动态路由
37
32
  * 前端添加路由,请在顶级节点的 `children 数组` 里添加
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.34 */
1
+ /*! fmdeui-fmui v1.0.36 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('exceljs'), require('@element-plus/icons-vue'), require('vue'), require('element-plus'), require('lodash-es'), require('js-cookie'), require('pinia'), require('@vueuse/core'), require('crypto-js'), require('xlsx-js-style'), require('vue-i18n'), require('vue-router'), require('sortablejs'), require('screenfull'), require('push.js'), require('mitt'), require('@microsoft/signalr'), require('nprogress'), require('axios')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'exceljs', '@element-plus/icons-vue', 'vue', 'element-plus', 'lodash-es', 'js-cookie', 'pinia', '@vueuse/core', 'crypto-js', 'xlsx-js-style', 'vue-i18n', 'vue-router', 'sortablejs', 'screenfull', 'push.js', 'mitt', '@microsoft/signalr', 'nprogress', 'axios'], factory) :
@@ -22516,6 +22516,11 @@
22516
22516
  }
22517
22517
  });
22518
22518
 
22519
+ var index$4 = /*#__PURE__*/Object.freeze({
22520
+ __proto__: null,
22521
+ default: _sfc_main$o
22522
+ });
22523
+
22519
22524
  const FLayout = _sfc_main$o;
22520
22525
 
22521
22526
  function commonFunction() {
@@ -22688,125 +22693,9 @@
22688
22693
  };
22689
22694
  }
22690
22695
 
22691
- let pathPrefix = "/@";
22692
- function setPathPrefix(prefix) {
22693
- pathPrefix = prefix;
22694
- }
22695
- function getPath(path) {
22696
- return `${pathPrefix}${path}`;
22697
- }
22698
- let dynamicRoutes = [
22699
- {
22700
- path: "/",
22701
- name: "/",
22702
- component: () => import(getPath("/layout/index.vue")),
22703
- redirect: "/dashboard/home",
22704
- meta: {
22705
- isKeepAlive: true
22706
- },
22707
- children: []
22708
- },
22709
- {
22710
- path: "/llm/aiChat",
22711
- name: "aiChat",
22712
- component: () => import(getPath("/views/aiChat/index.vue")),
22713
- meta: {
22714
- title: "AI\u5BF9\u8BDD",
22715
- isKeepAlive: true
22716
- }
22717
- },
22718
- {
22719
- path: "/platform/job/dashboard",
22720
- name: "jobDashboard",
22721
- component: () => import(getPath("/views/system/job/dashboard.vue")),
22722
- meta: {
22723
- title: "\u4EFB\u52A1\u770B\u677F",
22724
- isLink: window.__env__.VITE_API_URL + "/schedule",
22725
- isHide: true,
22726
- isKeepAlive: true,
22727
- isAffix: false,
22728
- isIframe: true,
22729
- icon: "ele-Clock"
22730
- }
22731
- },
22732
- {
22733
- path: "/develop/database/visual",
22734
- name: "databaseVisual",
22735
- component: () => import(getPath("/views/system/database/component/visualTable.vue")),
22736
- meta: {
22737
- title: "\u5E93\u8868\u53EF\u89C6\u5316",
22738
- isHide: true,
22739
- isKeepAlive: true,
22740
- isAffix: false,
22741
- // isIframe: true,
22742
- icon: "ele-View"
22743
- }
22744
- },
22745
- {
22746
- path: "/report/view/:reportConfigId/:tagsViewName?",
22747
- name: "sysReportView",
22748
- component: () => import(getPath("/views/system/reportConfig/component/reportView.vue")),
22749
- meta: {
22750
- title: "\u62A5\u8868\u67E5\u770B",
22751
- isHide: true,
22752
- isKeepAlive: true,
22753
- isAffix: false,
22754
- isIframe: false,
22755
- icon: ""
22756
- }
22757
- }
22758
- ];
22759
- let notFoundAndNoPower = [
22760
- {
22761
- path: "/:path(.*)*",
22762
- name: "notFound",
22763
- component: () => import(getPath("/views/error/404.vue")),
22764
- meta: {
22765
- title: "message.staticRoutes.notFound",
22766
- isHide: true
22767
- }
22768
- },
22769
- {
22770
- path: "/401",
22771
- name: "noPower",
22772
- component: () => import(getPath("/views/error/401.vue")),
22773
- meta: {
22774
- title: "message.staticRoutes.noPower",
22775
- isHide: true
22776
- }
22777
- }
22778
- ];
22779
- exports.staticRoutes = [
22780
- {
22781
- path: "/login",
22782
- name: "login",
22783
- component: () => import(getPath("/views/login/index.vue")),
22784
- meta: {
22785
- title: "Login",
22786
- isPublic: true
22787
- }
22788
- }
22789
- /**
22790
- * 提示:写在这里的为全屏界面,不建议写在这里
22791
- * 请写在 `dynamicRoutes` 路由数组中
22792
- */
22793
- // {
22794
- // path: '/visualizingDemo1',
22795
- // name: 'visualizingDemo1',
22796
- // component: () => import('/@/views/visualizing/demo1.vue'),
22797
- // meta: {
22798
- // title: 'message.router.visualizingLinkDemo1',
22799
- // },
22800
- // },
22801
- // {
22802
- // path: '/visualizingDemo2',
22803
- // name: 'visualizingDemo2',
22804
- // component: () => import('/@/views/visualizing/demo2.vue'),
22805
- // meta: {
22806
- // title: 'message.router.visualizingLinkDemo2',
22807
- // },
22808
- // },
22809
- ];
22696
+ let dynamicRoutes = [];
22697
+ let notFoundAndNoPower = [];
22698
+ exports.staticRoutes = [];
22810
22699
  function configureRoutes(options) {
22811
22700
  if (options.dynamicRoutes) {
22812
22701
  if (options.merge) {
@@ -22829,9 +22718,6 @@
22829
22718
  notFoundAndNoPower = options.notFoundAndNoPower;
22830
22719
  }
22831
22720
  }
22832
- if (options.pathPrefix) {
22833
- setPathPrefix(options.pathPrefix);
22834
- }
22835
22721
  }
22836
22722
 
22837
22723
  function formatFlatteningRoutes(arr) {
@@ -22964,6 +22850,14 @@
22964
22850
  const res = await getBackEndControlRoutes();
22965
22851
  if (res == void 0 || res.length <= 0) return Promise.resolve(true);
22966
22852
  useRequestOldRoutes().setRequestOldRoutes(res);
22853
+ if (dynamicRoutes.length === 0) {
22854
+ dynamicRoutes.push({
22855
+ path: "/",
22856
+ name: "Layout",
22857
+ component: () => Promise.resolve().then(function () { return index$4; }),
22858
+ children: []
22859
+ });
22860
+ }
22967
22861
  dynamicRoutes[0].children = await backEndComponent(res);
22968
22862
  await setAddRoute();
22969
22863
  setFilterMenuAndCacheTagsViewRoutes();
@@ -22993,35 +22887,64 @@
22993
22887
  return resData;
22994
22888
  }
22995
22889
  function backEndComponent(routes) {
22996
- if (!routes) return;
22890
+ if (!routes) return [];
22997
22891
  return routes.map((item) => {
22998
22892
  if (!item.path) item.path = "";
22999
- if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component);
23000
- item.children && backEndComponent(item.children);
22893
+ if (item.component && typeof item.component === "string") {
22894
+ item.component = dynamicImport(dynamicViewsModules, item.component);
22895
+ if (!item.component) {
22896
+ item.component = () => Promise.resolve().then(function () { return index$4; });
22897
+ console.warn(`Using default component for route: ${item.path}`);
22898
+ }
22899
+ }
22900
+ if (item.children) {
22901
+ item.children = backEndComponent(item.children);
22902
+ }
23001
22903
  return item;
23002
22904
  });
23003
22905
  }
23004
22906
  function dynamicImport(dynamicViewsModules2, component) {
23005
22907
  const keys = Object.keys(dynamicViewsModules2);
23006
- const matchKeys = keys.filter((key) => {
22908
+ let matchKeys = [];
22909
+ matchKeys = keys.filter((key) => key.includes(component));
22910
+ if (matchKeys.length === 0) {
23007
22911
  const REMOVE_PREFIXES = [
23008
22912
  "../../../../packages/fmasyspage/views",
23009
22913
  "../../../../packages/fmwlpage/views",
23010
22914
  "../../../../packages/fmreliefpage/views",
23011
22915
  "../views",
23012
22916
  "./views",
22917
+ "./layout/routerView",
22918
+ "../layout/routerView",
23013
22919
  ".."
23014
22920
  ].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
23015
- const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
23016
- return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
23017
- });
22921
+ matchKeys = keys.filter((key) => {
22922
+ const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
22923
+ return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
22924
+ });
22925
+ }
23018
22926
  if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
23019
22927
  const matchKey = matchKeys[0];
23020
22928
  return dynamicViewsModules2[matchKey];
23021
22929
  }
23022
22930
  if ((matchKeys == null ? void 0 : matchKeys.length) > 1) {
23023
- return false;
22931
+ const exactMatch = matchKeys.find((key) => key.endsWith(`${component}.vue`) || key.endsWith(`${component}.tsx`));
22932
+ if (exactMatch) {
22933
+ return dynamicViewsModules2[exactMatch];
22934
+ }
22935
+ return dynamicViewsModules2[matchKeys[0]];
22936
+ }
22937
+ if (dynamicViewsModules2[component]) {
22938
+ return dynamicViewsModules2[component];
22939
+ }
22940
+ if (component.startsWith("/")) {
22941
+ const relativeComponent = component.substring(1);
22942
+ if (dynamicViewsModules2[relativeComponent]) {
22943
+ return dynamicViewsModules2[relativeComponent];
22944
+ }
23024
22945
  }
22946
+ console.warn(`No component found for: ${component}`);
22947
+ console.warn("Available modules:", Object.keys(dynamicViewsModules2));
23025
22948
  }
23026
22949
 
23027
22950
  const storesThemeConfig = useThemeConfig(pinia);
@@ -29046,7 +28969,6 @@
29046
28969
  exports.setDynamicViewsModules = setDynamicViewsModules;
29047
28970
  exports.setIntroduction = setIntroduction;
29048
28971
  exports.setJsCdn = setJsCdn;
29049
- exports.setPathPrefix = setPathPrefix;
29050
28972
  exports.setupI18n = setupI18n;
29051
28973
  exports.signalR = signalR;
29052
28974
  exports.signatureByKSort = signatureByKSort;