@fmdeui/fmui 1.0.23 → 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';
@@ -7,13 +7,11 @@ import { useLocale } from './useLocale.mjs';
7
7
  var __defProp = Object.defineProperty;
8
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
9
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
- let signalR;
11
10
  async function loadSignalR() {
12
- if (!signalR) {
13
- const module = await import('../utils/signalR.mjs');
14
- signalR = module.signalR;
11
+ while (!window.__SIGNALR_INSTANCE__) {
12
+ await new Promise((resolve) => setTimeout(resolve, 100));
15
13
  }
16
- return signalR;
14
+ return window.__SIGNALR_INSTANCE__;
17
15
  }
18
16
  const { t } = useLocale();
19
17
  class IdleTimeoutManager {
@@ -91,8 +89,8 @@ class IdleTimeoutManager {
91
89
  timeOutExec() {
92
90
  const appEl = document.getElementById("app");
93
91
  appEl == null ? void 0 : appEl.remove();
94
- loadSignalR().then((signalR2) => {
95
- signalR2.stop();
92
+ loadSignalR().then((signalR) => {
93
+ signalR.stop();
96
94
  });
97
95
  Local.remove(accessTokenKey);
98
96
  Local.remove(refreshAccessTokenKey);
@@ -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.23 */
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,14 +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$1 = window.__SIGNALR_INSTANCE__;
1738
-
1739
- var signalR$2 = /*#__PURE__*/Object.freeze({
1740
- __proto__: null,
1741
- signalR: signalR$1
1742
- });
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
+ };
1743
1764
 
1744
1765
  const setWatermark = (str) => {
1745
1766
  const id = "1.23452384164.123412416";
@@ -18798,13 +18819,11 @@
18798
18819
  var __defProp = Object.defineProperty;
18799
18820
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18800
18821
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
18801
- let signalR;
18802
18822
  async function loadSignalR() {
18803
- if (!signalR) {
18804
- const module = await Promise.resolve().then(function () { return signalR$2; });
18805
- signalR = module.signalR;
18823
+ while (!window.__SIGNALR_INSTANCE__) {
18824
+ await new Promise((resolve) => setTimeout(resolve, 100));
18806
18825
  }
18807
- return signalR;
18826
+ return window.__SIGNALR_INSTANCE__;
18808
18827
  }
18809
18828
  const { t } = useLocale();
18810
18829
  class IdleTimeoutManager {
@@ -18882,8 +18901,8 @@
18882
18901
  timeOutExec() {
18883
18902
  const appEl = document.getElementById("app");
18884
18903
  appEl == null ? void 0 : appEl.remove();
18885
- loadSignalR().then((signalR2) => {
18886
- signalR2.stop();
18904
+ loadSignalR().then((signalR) => {
18905
+ signalR.stop();
18887
18906
  });
18888
18907
  Local.remove(accessTokenKey);
18889
18908
  Local.remove(refreshAccessTokenKey);
@@ -23149,6 +23168,7 @@
23149
23168
  exports.refreshAccessTokenKey = refreshAccessTokenKey;
23150
23169
  exports.removeDuplicate = removeDuplicate;
23151
23170
  exports.request2 = request2;
23171
+ exports.restartSignalR = restartSignalR;
23152
23172
  exports.roles = roles;
23153
23173
  exports.router = router;
23154
23174
  exports.saulVModel = saulVModel;
@@ -23159,7 +23179,7 @@
23159
23179
  exports.setJsCdn = setJsCdn;
23160
23180
  exports.setPathPrefix = setPathPrefix;
23161
23181
  exports.setupI18n = setupI18n;
23162
- exports.signalR = signalR$1;
23182
+ exports.signalR = signalR;
23163
23183
  exports.signatureByKSort = signatureByKSort;
23164
23184
  exports.sleep = sleep;
23165
23185
  exports.tansParams = tansParams;