@fmdeui/fmui 1.0.22 → 1.0.24

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.
@@ -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);
@@ -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.22 */
1
+ /*! fmdeui-fmui v1.0.24 */
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,52 +1690,51 @@
1690
1690
  return entity;
1691
1691
  }
1692
1692
 
1693
- 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({
1694
- nextRetryDelayInMilliseconds: () => {
1695
- return 5e3;
1696
- }
1697
- }).build();
1698
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1699
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
1700
- connection.start().then(() => {
1701
- });
1702
- connection.onclose(async () => {
1703
- });
1704
- connection.onreconnecting(() => {
1705
- elementPlus.ElNotification({
1706
- title: "\u63D0\u793A",
1707
- message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
1708
- type: "error",
1709
- 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(() => {
1710
1702
  });
1711
- });
1712
- connection.onreconnected(() => {
1713
- elementPlus.ElNotification({
1714
- title: "\u63D0\u793A",
1715
- message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
1716
- type: "success",
1717
- position: "bottom-right"
1703
+ connection.onclose(async () => {
1718
1704
  });
1719
- });
1720
- connection.on("OnlineUserList", () => {
1721
- });
1722
- connection.on("ReceiveMessage", (message) => {
1723
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
1724
- tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
1725
- elementPlus.ElNotification({
1726
- title: `${message.title}`,
1727
- message: tmpMsg,
1728
- type: message.messageType.toString().toLowerCase(),
1729
- position: "top-right",
1730
- dangerouslyUseHTMLString: true,
1731
- 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
+ });
1732
1712
  });
1733
- });
1734
-
1735
- var signalR$1 = /*#__PURE__*/Object.freeze({
1736
- __proto__: null,
1737
- signalR: connection
1738
- });
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 = window.__SIGNALR_INSTANCE__;
1739
1738
 
1740
1739
  const setWatermark = (str) => {
1741
1740
  const id = "1.23452384164.123412416";
@@ -18794,13 +18793,11 @@
18794
18793
  var __defProp = Object.defineProperty;
18795
18794
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18796
18795
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
18797
- let signalR;
18798
18796
  async function loadSignalR() {
18799
- if (!signalR) {
18800
- const module = await Promise.resolve().then(function () { return signalR$1; });
18801
- signalR = module.signalR;
18797
+ while (!window.__SIGNALR_INSTANCE__) {
18798
+ await new Promise((resolve) => setTimeout(resolve, 100));
18802
18799
  }
18803
- return signalR;
18800
+ return window.__SIGNALR_INSTANCE__;
18804
18801
  }
18805
18802
  const { t } = useLocale();
18806
18803
  class IdleTimeoutManager {
@@ -18878,8 +18875,8 @@
18878
18875
  timeOutExec() {
18879
18876
  const appEl = document.getElementById("app");
18880
18877
  appEl == null ? void 0 : appEl.remove();
18881
- loadSignalR().then((signalR2) => {
18882
- signalR2.stop();
18878
+ loadSignalR().then((signalR) => {
18879
+ signalR.stop();
18883
18880
  });
18884
18881
  Local.remove(accessTokenKey);
18885
18882
  Local.remove(refreshAccessTokenKey);
@@ -23155,7 +23152,7 @@
23155
23152
  exports.setJsCdn = setJsCdn;
23156
23153
  exports.setPathPrefix = setPathPrefix;
23157
23154
  exports.setupI18n = setupI18n;
23158
- exports.signalR = connection;
23155
+ exports.signalR = signalR;
23159
23156
  exports.signatureByKSort = signatureByKSort;
23160
23157
  exports.sleep = sleep;
23161
23158
  exports.tansParams = tansParams;