@fmdeui/fmui 1.0.21 → 1.0.23

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.
@@ -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 k = key.replace(/..\/views|../, "");
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) {
@@ -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();
@@ -2,46 +2,50 @@ import * as SignalR from '@microsoft/signalr';
2
2
  import { ElNotification } from 'element-plus';
3
3
  import { getToken } from './request.mjs';
4
4
 
5
- const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
6
- nextRetryDelayInMilliseconds: () => {
7
- return 5e3;
8
- }
9
- }).build();
10
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
11
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
12
- connection.start().then(() => {
13
- });
14
- connection.onclose(async () => {
15
- });
16
- connection.onreconnecting(() => {
17
- ElNotification({
18
- title: "\u63D0\u793A",
19
- message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
20
- type: "error",
21
- position: "bottom-right"
5
+ if (!window.__SIGNALR_INSTANCE__) {
6
+ const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
7
+ nextRetryDelayInMilliseconds: () => {
8
+ return 5e3;
9
+ }
10
+ }).build();
11
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
12
+ connection.serverTimeoutInMilliseconds = 30 * 1e3;
13
+ connection.start().then(() => {
22
14
  });
23
- });
24
- connection.onreconnected(() => {
25
- ElNotification({
26
- title: "\u63D0\u793A",
27
- message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
28
- type: "success",
29
- position: "bottom-right"
15
+ connection.onclose(async () => {
30
16
  });
31
- });
32
- connection.on("OnlineUserList", () => {
33
- });
34
- connection.on("ReceiveMessage", (message) => {
35
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
36
- tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
37
- ElNotification({
38
- title: `${message.title}`,
39
- message: tmpMsg,
40
- type: message.messageType.toString().toLowerCase(),
41
- position: "top-right",
42
- dangerouslyUseHTMLString: true,
43
- duration: 5e3
17
+ connection.onreconnecting(() => {
18
+ ElNotification({
19
+ title: "\u63D0\u793A",
20
+ message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
21
+ type: "error",
22
+ position: "bottom-right"
23
+ });
44
24
  });
45
- });
25
+ connection.onreconnected(() => {
26
+ ElNotification({
27
+ title: "\u63D0\u793A",
28
+ message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
29
+ type: "success",
30
+ position: "bottom-right"
31
+ });
32
+ });
33
+ connection.on("OnlineUserList", () => {
34
+ });
35
+ connection.on("ReceiveMessage", (message) => {
36
+ var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
37
+ tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
38
+ ElNotification({
39
+ title: `${message.title}`,
40
+ message: tmpMsg,
41
+ type: message.messageType.toString().toLowerCase(),
42
+ position: "top-right",
43
+ dangerouslyUseHTMLString: true,
44
+ duration: 5e3
45
+ });
46
+ });
47
+ window.__SIGNALR_INSTANCE__ = connection;
48
+ }
49
+ const signalR = window.__SIGNALR_INSTANCE__;
46
50
 
47
- export { connection as signalR };
51
+ export { signalR };
@@ -1,3 +1,7 @@
1
1
  import * as SignalR from '@microsoft/signalr';
2
- declare const connection: SignalR.HubConnection;
3
- export { connection as signalR };
2
+ export declare const signalR: SignalR.HubConnection;
3
+ declare global {
4
+ interface Window {
5
+ __SIGNALR_INSTANCE__: SignalR.HubConnection;
6
+ }
7
+ }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.21 */
1
+ /*! fmdeui-fmui v1.0.23 */
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();
@@ -1652,51 +1690,55 @@
1652
1690
  return entity;
1653
1691
  }
1654
1692
 
1655
- const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR__namespace.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
1656
- nextRetryDelayInMilliseconds: () => {
1657
- return 5e3;
1658
- }
1659
- }).build();
1660
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1661
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
1662
- connection.start().then(() => {
1663
- });
1664
- connection.onclose(async () => {
1665
- });
1666
- connection.onreconnecting(() => {
1667
- elementPlus.ElNotification({
1668
- title: "\u63D0\u793A",
1669
- message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
1670
- type: "error",
1671
- position: "bottom-right"
1693
+ if (!window.__SIGNALR_INSTANCE__) {
1694
+ const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR__namespace.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
1695
+ nextRetryDelayInMilliseconds: () => {
1696
+ return 5e3;
1697
+ }
1698
+ }).build();
1699
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1700
+ connection.serverTimeoutInMilliseconds = 30 * 1e3;
1701
+ connection.start().then(() => {
1672
1702
  });
1673
- });
1674
- connection.onreconnected(() => {
1675
- elementPlus.ElNotification({
1676
- title: "\u63D0\u793A",
1677
- message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
1678
- type: "success",
1679
- position: "bottom-right"
1703
+ connection.onclose(async () => {
1680
1704
  });
1681
- });
1682
- connection.on("OnlineUserList", () => {
1683
- });
1684
- connection.on("ReceiveMessage", (message) => {
1685
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
1686
- tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
1687
- elementPlus.ElNotification({
1688
- title: `${message.title}`,
1689
- message: tmpMsg,
1690
- type: message.messageType.toString().toLowerCase(),
1691
- position: "top-right",
1692
- dangerouslyUseHTMLString: true,
1693
- duration: 5e3
1705
+ connection.onreconnecting(() => {
1706
+ elementPlus.ElNotification({
1707
+ title: "\u63D0\u793A",
1708
+ message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
1709
+ type: "error",
1710
+ position: "bottom-right"
1711
+ });
1694
1712
  });
1695
- });
1713
+ connection.onreconnected(() => {
1714
+ elementPlus.ElNotification({
1715
+ title: "\u63D0\u793A",
1716
+ message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
1717
+ type: "success",
1718
+ position: "bottom-right"
1719
+ });
1720
+ });
1721
+ connection.on("OnlineUserList", () => {
1722
+ });
1723
+ connection.on("ReceiveMessage", (message) => {
1724
+ var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
1725
+ tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
1726
+ elementPlus.ElNotification({
1727
+ title: `${message.title}`,
1728
+ message: tmpMsg,
1729
+ type: message.messageType.toString().toLowerCase(),
1730
+ position: "top-right",
1731
+ dangerouslyUseHTMLString: true,
1732
+ duration: 5e3
1733
+ });
1734
+ });
1735
+ window.__SIGNALR_INSTANCE__ = connection;
1736
+ }
1737
+ const signalR$1 = window.__SIGNALR_INSTANCE__;
1696
1738
 
1697
- var signalR$1 = /*#__PURE__*/Object.freeze({
1739
+ var signalR$2 = /*#__PURE__*/Object.freeze({
1698
1740
  __proto__: null,
1699
- signalR: connection
1741
+ signalR: signalR$1
1700
1742
  });
1701
1743
 
1702
1744
  const setWatermark = (str) => {
@@ -18759,7 +18801,7 @@
18759
18801
  let signalR;
18760
18802
  async function loadSignalR() {
18761
18803
  if (!signalR) {
18762
- const module = await Promise.resolve().then(function () { return signalR$1; });
18804
+ const module = await Promise.resolve().then(function () { return signalR$2; });
18763
18805
  signalR = module.signalR;
18764
18806
  }
18765
18807
  return signalR;
@@ -22824,7 +22866,15 @@
22824
22866
  function dynamicImport(dynamicViewsModules2, component) {
22825
22867
  const keys = Object.keys(dynamicViewsModules2);
22826
22868
  const matchKeys = keys.filter((key) => {
22827
- const k = key.replace(/..\/views|../, "");
22869
+ const REMOVE_PREFIXES = [
22870
+ "../../../../packages/fmasyspage/views",
22871
+ "../../../../packages/fmwlpage/views",
22872
+ "../../../../packages/fmreliefpage/views",
22873
+ "../views",
22874
+ "./views",
22875
+ ".."
22876
+ ].map((p) => p.replace(/\./g, "\\.").replace(/\//g, "\\/")).join("|");
22877
+ const k = key.replace(new RegExp(`^(${REMOVE_PREFIXES})/?`), "/");
22828
22878
  return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
22829
22879
  });
22830
22880
  if ((matchKeys == null ? void 0 : matchKeys.length) === 1) {
@@ -23109,7 +23159,7 @@
23109
23159
  exports.setJsCdn = setJsCdn;
23110
23160
  exports.setPathPrefix = setPathPrefix;
23111
23161
  exports.setupI18n = setupI18n;
23112
- exports.signalR = connection;
23162
+ exports.signalR = signalR$1;
23113
23163
  exports.signatureByKSort = signatureByKSort;
23114
23164
  exports.sleep = sleep;
23115
23165
  exports.tansParams = tansParams;