@fmdeui/fmui 1.0.35 → 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.
@@ -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 };
@@ -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;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.35 */
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() {
@@ -22845,6 +22850,14 @@
22845
22850
  const res = await getBackEndControlRoutes();
22846
22851
  if (res == void 0 || res.length <= 0) return Promise.resolve(true);
22847
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
+ }
22848
22861
  dynamicRoutes[0].children = await backEndComponent(res);
22849
22862
  await setAddRoute();
22850
22863
  setFilterMenuAndCacheTagsViewRoutes();
@@ -22874,35 +22887,64 @@
22874
22887
  return resData;
22875
22888
  }
22876
22889
  function backEndComponent(routes) {
22877
- if (!routes) return;
22890
+ if (!routes) return [];
22878
22891
  return routes.map((item) => {
22879
22892
  if (!item.path) item.path = "";
22880
- if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component);
22881
- 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
+ }
22882
22903
  return item;
22883
22904
  });
22884
22905
  }
22885
22906
  function dynamicImport(dynamicViewsModules2, component) {
22886
22907
  const keys = Object.keys(dynamicViewsModules2);
22887
- const matchKeys = keys.filter((key) => {
22908
+ let matchKeys = [];
22909
+ matchKeys = keys.filter((key) => key.includes(component));
22910
+ if (matchKeys.length === 0) {
22888
22911
  const REMOVE_PREFIXES = [
22889
22912
  "../../../../packages/fmasyspage/views",
22890
22913
  "../../../../packages/fmwlpage/views",
22891
22914
  "../../../../packages/fmreliefpage/views",
22892
22915
  "../views",
22893
22916
  "./views",
22917
+ "./layout/routerView",
22918
+ "../layout/routerView",
22894
22919
  ".."
22895
22920
  ].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
22896
- const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
22897
- return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
22898
- });
22921
+ matchKeys = keys.filter((key) => {
22922
+ const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
22923
+ return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
22924
+ });
22925
+ }
22899
22926
  if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
22900
22927
  const matchKey = matchKeys[0];
22901
22928
  return dynamicViewsModules2[matchKey];
22902
22929
  }
22903
22930
  if ((matchKeys == null ? void 0 : matchKeys.length) > 1) {
22904
- 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
+ }
22905
22945
  }
22946
+ console.warn(`No component found for: ${component}`);
22947
+ console.warn("Available modules:", Object.keys(dynamicViewsModules2));
22906
22948
  }
22907
22949
 
22908
22950
  const storesThemeConfig = useThemeConfig(pinia);