@fmdeui/fmui 1.0.24 → 1.0.25

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 CHANGED
@@ -34,9 +34,9 @@ export { initBackEndControlRoutes, setDynamicViewsModules } from './packages/rou
34
34
  export { initFrontEndControlRoutes } from './packages/router/frontEnd.mjs';
35
35
  export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './packages/utils/toolsValidate.mjs';
36
36
  export { loadSysInfo, updateFavicon } from './packages/hooks/sysInfo.mjs';
37
+ export { restartSignalR, signalR } from './packages/utils/signalR.mjs';
37
38
  export { router } from './packages/router/createRouter.mjs';
38
39
  export { saulVModel } from './packages/utils/saulVModel.mjs';
39
- export { signalR } from './packages/utils/signalR.mjs';
40
40
  export { signatureByKSort } from './packages/utils/data-signature.mjs';
41
41
  export { useApi, useBaseApi } from './packages/api/base/index.mjs';
42
42
  export { useChangeColor } from './packages/utils/theme.mjs';
@@ -18,4 +18,4 @@ export { saulVModel } from './saulVModel.mjs';
18
18
  export { Local, Session } from './storage.mjs';
19
19
  export { useChangeColor } from './theme.mjs';
20
20
  export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './toolsValidate.mjs';
21
- export { signalR } from './signalR.mjs';
21
+ export { restartSignalR, signalR } from './signalR.mjs';
@@ -2,8 +2,13 @@ import * as SignalR from '@microsoft/signalr';
2
2
  import { ElNotification } from 'element-plus';
3
3
  import { getToken } from './request.mjs';
4
4
 
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({
5
+ const initSignalR = () => {
6
+ const token = getToken();
7
+ if (!token) return null;
8
+ const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${token}`, {
9
+ transport: SignalR.HttpTransportType.WebSockets,
10
+ skipNegotiation: true
11
+ }).withAutomaticReconnect({
7
12
  nextRetryDelayInMilliseconds: () => {
8
13
  return 5e3;
9
14
  }
@@ -11,6 +16,8 @@ if (!window.__SIGNALR_INSTANCE__) {
11
16
  connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
12
17
  connection.serverTimeoutInMilliseconds = 30 * 1e3;
13
18
  connection.start().then(() => {
19
+ }).catch((err) => {
20
+ console.error("SignalR \u8FDE\u63A5\u5931\u8D25:", err);
14
21
  });
15
22
  connection.onclose(async () => {
16
23
  });
@@ -44,8 +51,27 @@ if (!window.__SIGNALR_INSTANCE__) {
44
51
  duration: 5e3
45
52
  });
46
53
  });
47
- window.__SIGNALR_INSTANCE__ = connection;
54
+ return connection;
55
+ };
56
+ if (!window.__SIGNALR_INSTANCE__) {
57
+ const instance = initSignalR();
58
+ if (instance) {
59
+ window.__SIGNALR_INSTANCE__ = instance;
60
+ }
48
61
  }
49
- const signalR = window.__SIGNALR_INSTANCE__;
62
+ const signalR = window.__SIGNALR_INSTANCE__ || initSignalR();
63
+ const restartSignalR = () => {
64
+ if (window.__SIGNALR_INSTANCE__) {
65
+ window.__SIGNALR_INSTANCE__.stop().then(() => {
66
+ const instance = initSignalR();
67
+ if (instance)
68
+ window.__SIGNALR_INSTANCE__ = instance;
69
+ });
70
+ } else {
71
+ const instance = initSignalR();
72
+ if (instance)
73
+ window.__SIGNALR_INSTANCE__ = instance;
74
+ }
75
+ };
50
76
 
51
- export { signalR };
77
+ export { restartSignalR, signalR };
@@ -1,5 +1,7 @@
1
1
  import * as SignalR from '@microsoft/signalr';
2
- export declare const signalR: SignalR.HubConnection;
2
+ declare const signalR: SignalR.HubConnection;
3
+ declare const restartSignalR: () => void;
4
+ export { signalR, restartSignalR };
3
5
  declare global {
4
6
  interface Window {
5
7
  __SIGNALR_INSTANCE__: SignalR.HubConnection;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.24 */
1
+ /*! fmdeui-fmui v1.0.25 */
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) :
@@ -1690,8 +1690,13 @@
1690
1690
  return entity;
1691
1691
  }
1692
1692
 
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({
1693
+ const initSignalR = () => {
1694
+ const token = getToken();
1695
+ if (!token) return null;
1696
+ const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${token}`, {
1697
+ transport: SignalR__namespace.HttpTransportType.WebSockets,
1698
+ skipNegotiation: true
1699
+ }).withAutomaticReconnect({
1695
1700
  nextRetryDelayInMilliseconds: () => {
1696
1701
  return 5e3;
1697
1702
  }
@@ -1699,6 +1704,8 @@
1699
1704
  connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1700
1705
  connection.serverTimeoutInMilliseconds = 30 * 1e3;
1701
1706
  connection.start().then(() => {
1707
+ }).catch((err) => {
1708
+ console.error("SignalR \u8FDE\u63A5\u5931\u8D25:", err);
1702
1709
  });
1703
1710
  connection.onclose(async () => {
1704
1711
  });
@@ -1732,9 +1739,28 @@
1732
1739
  duration: 5e3
1733
1740
  });
1734
1741
  });
1735
- window.__SIGNALR_INSTANCE__ = connection;
1742
+ return connection;
1743
+ };
1744
+ if (!window.__SIGNALR_INSTANCE__) {
1745
+ const instance = initSignalR();
1746
+ if (instance) {
1747
+ window.__SIGNALR_INSTANCE__ = instance;
1748
+ }
1736
1749
  }
1737
- const signalR = window.__SIGNALR_INSTANCE__;
1750
+ const signalR = window.__SIGNALR_INSTANCE__ || initSignalR();
1751
+ const restartSignalR = () => {
1752
+ if (window.__SIGNALR_INSTANCE__) {
1753
+ window.__SIGNALR_INSTANCE__.stop().then(() => {
1754
+ const instance = initSignalR();
1755
+ if (instance)
1756
+ window.__SIGNALR_INSTANCE__ = instance;
1757
+ });
1758
+ } else {
1759
+ const instance = initSignalR();
1760
+ if (instance)
1761
+ window.__SIGNALR_INSTANCE__ = instance;
1762
+ }
1763
+ };
1738
1764
 
1739
1765
  const setWatermark = (str) => {
1740
1766
  const id = "1.23452384164.123412416";
@@ -23142,6 +23168,7 @@
23142
23168
  exports.refreshAccessTokenKey = refreshAccessTokenKey;
23143
23169
  exports.removeDuplicate = removeDuplicate;
23144
23170
  exports.request2 = request2;
23171
+ exports.restartSignalR = restartSignalR;
23145
23172
  exports.roles = roles;
23146
23173
  exports.router = router;
23147
23174
  exports.saulVModel = saulVModel;