@fmdeui/fmui 1.0.20 → 1.0.22
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/es/index.mjs +1 -1
- package/es/packages/router/backEnd.mjs +9 -1
- package/es/packages/router/index.mjs +1 -1
- package/es/packages/utils/request.mjs +39 -1
- package/es/router/index.d.ts +2 -2
- package/index.js +52 -6
- package/index.min.js +4 -4
- package/index.min.mjs +4 -4
- package/index.mjs +49 -3
- package/{es/make-installer.css → lib/index.css} +2 -2
- package/lib/index.js +4 -0
- package/lib/packages/router/backEnd.js +9 -1
- package/lib/packages/router/index.js +4 -0
- package/lib/packages/utils/request.js +38 -0
- package/lib/router/index.d.ts +2 -2
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/package.json +1 -1
- /package/{lib → es}/defaults.css +0 -0
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 } from './packages/router/route.mjs';
|
|
23
|
+
export { configureRoutes, setPathPrefix, 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';
|
|
@@ -78,7 +78,15 @@ function backEndComponent(routes) {
|
|
|
78
78
|
function dynamicImport(dynamicViewsModules2, component) {
|
|
79
79
|
const keys = Object.keys(dynamicViewsModules2);
|
|
80
80
|
const matchKeys = keys.filter((key) => {
|
|
81
|
-
const
|
|
81
|
+
const REMOVE_PREFIXES = [
|
|
82
|
+
"../../../../packages/fmasyspage/views",
|
|
83
|
+
"../../../../packages/fmwlpage/views",
|
|
84
|
+
"../../../../packages/fmreliefpage/views",
|
|
85
|
+
"../views",
|
|
86
|
+
"./views",
|
|
87
|
+
".."
|
|
88
|
+
].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
|
|
89
|
+
const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
|
|
82
90
|
return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
|
|
83
91
|
});
|
|
84
92
|
if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
|
|
@@ -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 } from './route.mjs';
|
|
5
|
+
export { configureRoutes, setPathPrefix, 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,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { ElMessage } from 'element-plus';
|
|
2
|
+
import { ElLoading, ElMessage } from 'element-plus';
|
|
3
3
|
import { Local, Session } from './storage.mjs';
|
|
4
4
|
|
|
5
5
|
const abortControllerMap = /* @__PURE__ */ new Map();
|
|
@@ -31,9 +31,35 @@ const clearTokens = () => {
|
|
|
31
31
|
Session.clear();
|
|
32
32
|
};
|
|
33
33
|
const axiosInstance = axios;
|
|
34
|
+
let loadingCount = 0;
|
|
35
|
+
let loadingInstance = null;
|
|
36
|
+
function startLoading() {
|
|
37
|
+
if (loadingCount === 0) {
|
|
38
|
+
loadingInstance = ElLoading.service({
|
|
39
|
+
lock: true,
|
|
40
|
+
text: "\u52A0\u8F7D\u4E2D...",
|
|
41
|
+
background: "rgba(0, 0, 0, 0.7)"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
loadingCount++;
|
|
45
|
+
}
|
|
46
|
+
function endLoading() {
|
|
47
|
+
if (loadingCount <= 0) return;
|
|
48
|
+
loadingCount--;
|
|
49
|
+
if (loadingCount === 0 && loadingInstance) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
loadingInstance == null ? void 0 : loadingInstance.close();
|
|
52
|
+
loadingInstance = null;
|
|
53
|
+
}, 200);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
34
56
|
service.interceptors.request.use(
|
|
35
57
|
(config) => {
|
|
36
58
|
var _a;
|
|
59
|
+
const customConfig = config;
|
|
60
|
+
if (customConfig.loading) {
|
|
61
|
+
startLoading();
|
|
62
|
+
}
|
|
37
63
|
const controller = new AbortController();
|
|
38
64
|
config.signal = controller.signal;
|
|
39
65
|
const url = config.url || "";
|
|
@@ -59,11 +85,19 @@ service.interceptors.request.use(
|
|
|
59
85
|
return config;
|
|
60
86
|
},
|
|
61
87
|
(error) => {
|
|
88
|
+
const customConfig = error.config;
|
|
89
|
+
if ((customConfig == null ? void 0 : customConfig.loading) === true) {
|
|
90
|
+
endLoading();
|
|
91
|
+
}
|
|
62
92
|
return Promise.reject(error);
|
|
63
93
|
}
|
|
64
94
|
);
|
|
65
95
|
service.interceptors.response.use(
|
|
66
96
|
(res) => {
|
|
97
|
+
const customConfig = res.config;
|
|
98
|
+
if (customConfig.loading === true) {
|
|
99
|
+
endLoading();
|
|
100
|
+
}
|
|
67
101
|
const url = res.config.url || "";
|
|
68
102
|
abortControllerMap.delete(url);
|
|
69
103
|
var status = res.status;
|
|
@@ -97,6 +131,10 @@ service.interceptors.response.use(
|
|
|
97
131
|
return res;
|
|
98
132
|
},
|
|
99
133
|
(error) => {
|
|
134
|
+
const customConfig = error.config;
|
|
135
|
+
if (customConfig.loading === true) {
|
|
136
|
+
endLoading();
|
|
137
|
+
}
|
|
100
138
|
if (error.response) {
|
|
101
139
|
if (error.response.status === 401) {
|
|
102
140
|
clearAccessTokens();
|
package/es/router/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configureRoutes, setPathPrefix } from './route';
|
|
1
|
+
import { configureRoutes, setPathPrefix, 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, setPathPrefix, setDynamicViewsModules, initBackEndControlRoutes, initFrontEndControlRoutes };
|
|
12
|
+
export { configureRoutes, staticRoutes, setPathPrefix, setDynamicViewsModules, initBackEndControlRoutes, initFrontEndControlRoutes };
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! fmdeui-fmui v1.0.
|
|
1
|
+
/*! fmdeui-fmui v1.0.22 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('axios'), require('js-cookie'), require('@microsoft/signalr'), require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('vue-i18n'), require('exceljs'), require('lodash-es'), require('@vueuse/core'), require('mitt'), require('vue-router'), require('nprogress')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'axios', 'js-cookie', '@microsoft/signalr', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', 'lodash-es', '@vueuse/core', 'mitt', 'vue-router', 'nprogress'], factory) :
|
|
@@ -1263,9 +1263,35 @@
|
|
|
1263
1263
|
Session.clear();
|
|
1264
1264
|
};
|
|
1265
1265
|
const axiosInstance = axios;
|
|
1266
|
+
let loadingCount = 0;
|
|
1267
|
+
let loadingInstance = null;
|
|
1268
|
+
function startLoading() {
|
|
1269
|
+
if (loadingCount === 0) {
|
|
1270
|
+
loadingInstance = elementPlus.ElLoading.service({
|
|
1271
|
+
lock: true,
|
|
1272
|
+
text: "\u52A0\u8F7D\u4E2D...",
|
|
1273
|
+
background: "rgba(0, 0, 0, 0.7)"
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
loadingCount++;
|
|
1277
|
+
}
|
|
1278
|
+
function endLoading() {
|
|
1279
|
+
if (loadingCount <= 0) return;
|
|
1280
|
+
loadingCount--;
|
|
1281
|
+
if (loadingCount === 0 && loadingInstance) {
|
|
1282
|
+
setTimeout(() => {
|
|
1283
|
+
loadingInstance == null ? void 0 : loadingInstance.close();
|
|
1284
|
+
loadingInstance = null;
|
|
1285
|
+
}, 200);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1266
1288
|
service.interceptors.request.use(
|
|
1267
1289
|
(config) => {
|
|
1268
1290
|
var _a;
|
|
1291
|
+
const customConfig = config;
|
|
1292
|
+
if (customConfig.loading) {
|
|
1293
|
+
startLoading();
|
|
1294
|
+
}
|
|
1269
1295
|
const controller = new AbortController();
|
|
1270
1296
|
config.signal = controller.signal;
|
|
1271
1297
|
const url = config.url || "";
|
|
@@ -1291,11 +1317,19 @@
|
|
|
1291
1317
|
return config;
|
|
1292
1318
|
},
|
|
1293
1319
|
(error) => {
|
|
1320
|
+
const customConfig = error.config;
|
|
1321
|
+
if ((customConfig == null ? void 0 : customConfig.loading) === true) {
|
|
1322
|
+
endLoading();
|
|
1323
|
+
}
|
|
1294
1324
|
return Promise.reject(error);
|
|
1295
1325
|
}
|
|
1296
1326
|
);
|
|
1297
1327
|
service.interceptors.response.use(
|
|
1298
1328
|
(res) => {
|
|
1329
|
+
const customConfig = res.config;
|
|
1330
|
+
if (customConfig.loading === true) {
|
|
1331
|
+
endLoading();
|
|
1332
|
+
}
|
|
1299
1333
|
const url = res.config.url || "";
|
|
1300
1334
|
abortControllerMap.delete(url);
|
|
1301
1335
|
var status = res.status;
|
|
@@ -1329,6 +1363,10 @@
|
|
|
1329
1363
|
return res;
|
|
1330
1364
|
},
|
|
1331
1365
|
(error) => {
|
|
1366
|
+
const customConfig = error.config;
|
|
1367
|
+
if (customConfig.loading === true) {
|
|
1368
|
+
endLoading();
|
|
1369
|
+
}
|
|
1332
1370
|
if (error.response) {
|
|
1333
1371
|
if (error.response.status === 401) {
|
|
1334
1372
|
clearAccessTokens();
|
|
@@ -22596,7 +22634,7 @@
|
|
|
22596
22634
|
}
|
|
22597
22635
|
}
|
|
22598
22636
|
];
|
|
22599
|
-
|
|
22637
|
+
exports.staticRoutes = [
|
|
22600
22638
|
{
|
|
22601
22639
|
path: "/login",
|
|
22602
22640
|
name: "login",
|
|
@@ -22637,9 +22675,9 @@
|
|
|
22637
22675
|
}
|
|
22638
22676
|
if (options.staticRoutes) {
|
|
22639
22677
|
if (options.merge) {
|
|
22640
|
-
staticRoutes = [...staticRoutes, ...options.staticRoutes];
|
|
22678
|
+
exports.staticRoutes = [...exports.staticRoutes, ...options.staticRoutes];
|
|
22641
22679
|
} else {
|
|
22642
|
-
staticRoutes = options.staticRoutes;
|
|
22680
|
+
exports.staticRoutes = options.staticRoutes;
|
|
22643
22681
|
}
|
|
22644
22682
|
}
|
|
22645
22683
|
if (options.notFoundAndNoPower) {
|
|
@@ -22695,7 +22733,7 @@
|
|
|
22695
22733
|
* 2、backEnd.ts(后端控制路由)、frontEnd.ts(前端控制路由) 中也需要加 notFoundAndNoPower 404、401 界面。
|
|
22696
22734
|
* 防止 404、401 不在 layout 布局中,不设置的话,404、401 界面将全屏显示
|
|
22697
22735
|
*/
|
|
22698
|
-
routes: [...notFoundAndNoPower, ...staticRoutes]
|
|
22736
|
+
routes: [...notFoundAndNoPower, ...exports.staticRoutes]
|
|
22699
22737
|
});
|
|
22700
22738
|
|
|
22701
22739
|
async function initFrontEndControlRoutes() {
|
|
@@ -22824,7 +22862,15 @@
|
|
|
22824
22862
|
function dynamicImport(dynamicViewsModules2, component) {
|
|
22825
22863
|
const keys = Object.keys(dynamicViewsModules2);
|
|
22826
22864
|
const matchKeys = keys.filter((key) => {
|
|
22827
|
-
const
|
|
22865
|
+
const REMOVE_PREFIXES = [
|
|
22866
|
+
"../../../../packages/fmasyspage/views",
|
|
22867
|
+
"../../../../packages/fmwlpage/views",
|
|
22868
|
+
"../../../../packages/fmreliefpage/views",
|
|
22869
|
+
"../views",
|
|
22870
|
+
"./views",
|
|
22871
|
+
".."
|
|
22872
|
+
].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
|
|
22873
|
+
const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
|
|
22828
22874
|
return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
|
|
22829
22875
|
});
|
|
22830
22876
|
if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
|