@fmdevui/fm-dev 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.
Files changed (49) hide show
  1. package/es/core/index.d.ts +1 -0
  2. package/es/core/types/emitt/index.d.ts +6 -0
  3. package/es/index.d.ts +1 -0
  4. package/es/index.mjs +2 -0
  5. package/es/packages/core/index.mjs +1 -0
  6. package/es/packages/core/layout/component/aside.vue2.mjs +7 -5
  7. package/es/packages/core/layout/main/defaults.vue2.mjs +6 -9
  8. package/es/packages/core/layout/navBars/topBar/onlineuser.vue.mjs +1 -1
  9. package/es/packages/core/layout/navBars/topBar/onlineuser.vue2.mjs +6 -12
  10. package/es/packages/core/layout/navBars/topBar/sendMessage.vue2.mjs +5 -10
  11. package/es/packages/core/layout/navBars/topBar/user.vue2.mjs +1 -2
  12. package/es/packages/core/layout/navMenu/vertical.vue2.mjs +1 -1
  13. package/es/packages/core/utils/comm/sysInfo.mjs +2 -2
  14. package/{lib/sysInfo.css → es/version.css} +4 -3
  15. package/index.css +98 -0
  16. package/index.js +14668 -109
  17. package/index.min.css +9 -0
  18. package/index.min.js +72 -26
  19. package/index.min.mjs +72 -26
  20. package/index.mjs +14662 -109
  21. package/lib/core/index.d.ts +1 -0
  22. package/lib/core/types/emitt/index.d.ts +6 -0
  23. package/lib/index.d.ts +1 -0
  24. package/lib/index.js +8 -0
  25. package/{es → lib}/make-installer.css +4 -4
  26. package/lib/packages/core/index.js +5 -0
  27. package/lib/packages/core/layout/component/aside.vue2.js +6 -4
  28. package/lib/packages/core/layout/main/defaults.vue2.js +5 -8
  29. package/lib/packages/core/layout/navBars/topBar/onlineuser.vue.js +1 -1
  30. package/lib/packages/core/layout/navBars/topBar/onlineuser.vue2.js +8 -14
  31. package/lib/packages/core/layout/navBars/topBar/sendMessage.vue2.js +4 -9
  32. package/lib/packages/core/layout/navBars/topBar/user.vue2.js +1 -2
  33. package/lib/packages/core/layout/navMenu/vertical.vue2.js +1 -1
  34. package/lib/packages/core/utils/comm/sysInfo.js +2 -2
  35. package/package.json +1 -1
  36. package/es/core/ui/components/editor/index.vue.d.ts +0 -52
  37. package/es/core/utils/comm/idleTimeout.d.ts +0 -45
  38. package/es/core/utils/comm/signalR.d.ts +0 -3
  39. package/es/packages/core/utils/comm/idleTimeout.mjs +0 -124
  40. package/es/packages/core/utils/comm/signalR.mjs +0 -45
  41. package/es/sysInfo.d.ts +0 -2
  42. package/es/sysInfo.mjs +0 -53
  43. package/lib/core/ui/components/editor/index.vue.d.ts +0 -52
  44. package/lib/core/utils/comm/idleTimeout.d.ts +0 -45
  45. package/lib/core/utils/comm/signalR.d.ts +0 -3
  46. package/lib/packages/core/utils/comm/idleTimeout.js +0 -128
  47. package/lib/packages/core/utils/comm/signalR.js +0 -66
  48. package/lib/sysInfo.d.ts +0 -2
  49. package/lib/sysInfo.js +0 -56
@@ -1,45 +0,0 @@
1
- import * as SignalR from '@microsoft/signalr';
2
- import { ElNotification } from 'element-plus';
3
- import '../../api/index.mjs';
4
- import { getToken } from '../../api/utils/request.mjs';
5
-
6
- const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Information).withUrl(`${window.__env__.VITE_API_URL}/fmauth/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 * 60 * 1e3;
13
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
14
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
15
- connection.start().then(() => {
16
- });
17
- connection.onclose(async () => {
18
- });
19
- connection.onreconnecting(() => {
20
- ElNotification({
21
- title: "\u63D0\u793A",
22
- message: "\u670D\u52A1\u5668\u5DF2\u65AD\u7EBF...",
23
- type: "error",
24
- position: "bottom-right"
25
- });
26
- });
27
- connection.onreconnected(() => {
28
- });
29
- connection.on("OnlineUserList", () => {
30
- });
31
- connection.on("ReceiveMessage", (message) => {
32
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
33
- tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u4EBA\u5458\uFF1A${message.sendUserName}<p>`;
34
- tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u65F6\u95F4\uFF1A${message.sendTime}<p>`;
35
- ElNotification({
36
- title: `\u6D88\u606F\u3010${message.title}\u3011`,
37
- message: tmpMsg,
38
- type: "info",
39
- position: "top-right",
40
- dangerouslyUseHTMLString: true,
41
- duration: 0
42
- });
43
- });
44
-
45
- export { connection as signalR };
package/es/sysInfo.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function loadSysInfo(tenantid: number): Promise<void>;
2
- export declare const updateFavicon: (url: string) => void;
package/es/sysInfo.mjs DELETED
@@ -1,53 +0,0 @@
1
- import './packages/core/index.mjs';
2
- import { storeToRefs } from 'pinia';
3
- import { updateIdleTimeout } from './packages/core/utils/comm/idleTimeout.mjs';
4
- import { useThemeConfig } from './packages/core/stores/themeConfig.mjs';
5
- import { feature, useSysApi } from './packages/core/api/sys/index.mjs';
6
- import { Local } from './packages/core/utils/storage/index.mjs';
7
- import { PUB } from './packages/core/utils/const/index.mjs';
8
-
9
- async function loadSysInfo(tenantid) {
10
- const storesThemeConfig = useThemeConfig();
11
- const { themeConfig } = storeToRefs(storesThemeConfig);
12
- const [err, res] = await feature(useSysApi().getSysInfo(Number(tenantid)));
13
- if (err) {
14
- themeConfig.value.logoUrl = "logo.png";
15
- Local.remove(PUB.themeConfig);
16
- Local.set(PUB.themeConfig, storesThemeConfig.themeConfig);
17
- return;
18
- } else {
19
- if (res.data.type != "success" || res.data.result == null) return;
20
- const data = res.data.result;
21
- themeConfig.value.logoUrl = data.logo;
22
- themeConfig.value.globalTitle = data.title;
23
- themeConfig.value.globalViceTitle = data.viceTitle;
24
- themeConfig.value.globalViceTitleMsg = data.viceDesc;
25
- themeConfig.value.icp = data.icp;
26
- themeConfig.value.icpUrl = data.icpUrl;
27
- themeConfig.value.isWatermark = data.watermark != null;
28
- themeConfig.value.watermarkText = data.watermark;
29
- themeConfig.value.copyright = data.copyright;
30
- themeConfig.value.version = data.version;
31
- themeConfig.value.primary = data.themeColor;
32
- themeConfig.value.layout = data.layout;
33
- themeConfig.value.animation = data.animation;
34
- themeConfig.value.secondVer = data.secondVer;
35
- themeConfig.value.captcha = data.captcha;
36
- themeConfig.value.forceChangePassword = data.forceChangePassword;
37
- themeConfig.value.passwordExpirationTime = data.passwordExpirationTime;
38
- themeConfig.value.i18NSwitch = data.i18NSwitch;
39
- themeConfig.value.idleTimeout = data.idleTimeout;
40
- themeConfig.value.onlineNotice = data.onlineNotice;
41
- window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
42
- updateFavicon(data.logo);
43
- updateIdleTimeout(themeConfig.value.idleTimeout ?? 0);
44
- Local.remove(PUB.themeConfig);
45
- Local.set(PUB.themeConfig, storesThemeConfig.themeConfig);
46
- }
47
- }
48
- const updateFavicon = (url) => {
49
- const favicon = document.getElementById("favicon");
50
- favicon.href = url ? url : "data:;base64,=";
51
- };
52
-
53
- export { loadSysInfo, updateFavicon };
@@ -1,52 +0,0 @@
1
- import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
- declare const _default: DefineComponent<ExtractPropTypes<{
3
- disable: {
4
- type: BooleanConstructor;
5
- default: () => boolean;
6
- };
7
- placeholder: {
8
- type: StringConstructor;
9
- default: () => string;
10
- };
11
- mode: {
12
- type: StringConstructor;
13
- default: () => string;
14
- };
15
- height: {
16
- type: StringConstructor;
17
- default: () => string;
18
- };
19
- getHtml: StringConstructor;
20
- getText: StringConstructor;
21
- }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
22
- "update:getHtml": (...args: any[]) => void;
23
- "update:getText": (...args: any[]) => void;
24
- }, string, PublicProps, Readonly< ExtractPropTypes<{
25
- disable: {
26
- type: BooleanConstructor;
27
- default: () => boolean;
28
- };
29
- placeholder: {
30
- type: StringConstructor;
31
- default: () => string;
32
- };
33
- mode: {
34
- type: StringConstructor;
35
- default: () => string;
36
- };
37
- height: {
38
- type: StringConstructor;
39
- default: () => string;
40
- };
41
- getHtml: StringConstructor;
42
- getText: StringConstructor;
43
- }>> & Readonly<{
44
- "onUpdate:getHtml"?: ((...args: any[]) => any) | undefined;
45
- "onUpdate:getText"?: ((...args: any[]) => any) | undefined;
46
- }>, {
47
- placeholder: string;
48
- mode: string;
49
- height: string;
50
- disable: boolean;
51
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
52
- export default _default;
@@ -1,45 +0,0 @@
1
- type IdleTimeoutConfig = {
2
- /** 空闲超时时间(秒),默认30分钟 */
3
- timeout?: number;
4
- /** 用于设置最后活动时间的监听事件列表 */
5
- events?: string[];
6
- /** 登出回调函数,在超时发生时执行 */
7
- onTimeout?: () => void;
8
- /** 监听事件防抖间隔(毫秒),默认 200,设为0表示不启用防抖 */
9
- debounceInterval?: number;
10
- };
11
- declare class IdleTimeoutManager {
12
- private timerId;
13
- private readonly config;
14
- private readonly debouncedReset;
15
- /** 检查闲置超时时间间隔 */
16
- private readonly checkTimeoutInterval;
17
- constructor(config?: IdleTimeoutConfig);
18
- private init;
19
- private handleVisibilityChange;
20
- /** 设置最后活动时间 */
21
- setLastActivityTime(): void;
22
- /**
23
- * 更新空闲超时时间
24
- * @param timeout - 新的超时时间(毫秒)
25
- */
26
- updateIdleTimeout(timeout: number): void;
27
- /** 检查是否超时 */
28
- checkTimeout(): void;
29
- /** 销毁实例 */
30
- destroy(): void;
31
- /** 超时时执行 */
32
- private timeOutExec;
33
- }
34
- /** 初始化函数(在应用启动时调用) */
35
- export declare function initIdleTimeout(config?: IdleTimeoutConfig): IdleTimeoutManager;
36
- /** 销毁函数(在需要时调用) */
37
- export declare function destroyIdleTimeout(): void;
38
- /** 更新空闲超时时间(毫秒) */
39
- export declare function updateIdleTimeout(timeout: number): void;
40
- declare global {
41
- interface Window {
42
- __IDLE_TIMEOUT__?: IdleTimeoutManager;
43
- }
44
- }
45
- export {};
@@ -1,3 +0,0 @@
1
- import * as SignalR from '@microsoft/signalr';
2
- declare const connection: SignalR.HubConnection;
3
- export { connection as signalR };
@@ -1,128 +0,0 @@
1
- 'use strict';
2
-
3
- var lodashEs = require('lodash-es');
4
- var index = require('../storage/index.js');
5
- var elementPlus = require('element-plus');
6
- var index$1 = require('../const/index.js');
7
- var vueI18n = require('vue-i18n');
8
-
9
- let signalR;
10
- async function loadSignalR() {
11
- if (!signalR) {
12
- const module = await Promise.resolve().then(function () { return require('./signalR.js'); });
13
- signalR = module.signalR;
14
- }
15
- return signalR;
16
- }
17
- class IdleTimeoutManager {
18
- timerId = null;
19
- config;
20
- debouncedReset;
21
- /** 检查闲置超时时间间隔 */
22
- checkTimeoutInterval = 2 * 1e3;
23
- constructor(config = {}) {
24
- this.config = {
25
- timeout: 30 * 60,
26
- events: ["mousewheel", "keydown", "click"],
27
- onTimeout: this.timeOutExec.bind(this),
28
- debounceInterval: 200,
29
- ...config
30
- };
31
- this.debouncedReset = this.config.debounceInterval > 0 ? lodashEs.debounce(this.setLastActivityTime.bind(this), this.config.debounceInterval) : this.setLastActivityTime.bind(this);
32
- this.init();
33
- }
34
- init() {
35
- this.config.events.forEach((event) => {
36
- window.addEventListener(event, this.debouncedReset);
37
- });
38
- document.addEventListener("visibilitychange", this.handleVisibilityChange);
39
- this.setLastActivityTime();
40
- this.updateIdleTimeout(this.config.timeout);
41
- }
42
- handleVisibilityChange = () => {
43
- if (document.visibilityState === "visible") {
44
- this.setLastActivityTime();
45
- }
46
- };
47
- /** 设置最后活动时间 */
48
- setLastActivityTime() {
49
- index.Local.set("lastActivityTime", (/* @__PURE__ */ new Date()).getTime());
50
- }
51
- /**
52
- * 更新空闲超时时间
53
- * @param timeout - 新的超时时间(毫秒)
54
- */
55
- updateIdleTimeout(timeout) {
56
- this.config.timeout = timeout;
57
- if (this.config.timeout > 0 && this.timerId == null) {
58
- this.timerId = window.setInterval(this.checkTimeout.bind(this), this.checkTimeoutInterval);
59
- } else if (this.config.timeout == 0 && this.timerId != null) {
60
- window.clearInterval(this.timerId);
61
- this.timerId = null;
62
- }
63
- }
64
- /** 检查是否超时 */
65
- checkTimeout() {
66
- const currentTime = (/* @__PURE__ */ new Date()).getTime();
67
- const lastActivityTime = Number(index.Local.get("lastActivityTime"));
68
- if (lastActivityTime == 0) return;
69
- const accessToken = index.Local.get(index$1.PUB.accessTokenKey);
70
- if (!accessToken || accessToken == "invalid_token") return;
71
- const timeout = this.config.timeout * 1e3;
72
- if (currentTime - lastActivityTime > timeout) {
73
- this.destroy();
74
- this.config.onTimeout();
75
- }
76
- }
77
- /** 销毁实例 */
78
- destroy() {
79
- this.config.events.forEach((event) => {
80
- window.removeEventListener(event, this.debouncedReset);
81
- });
82
- document.removeEventListener("visibilitychange", this.handleVisibilityChange);
83
- if (this.timerId !== null) {
84
- window.clearInterval(this.timerId);
85
- this.timerId = null;
86
- }
87
- }
88
- /** 超时时执行 */
89
- timeOutExec() {
90
- const appEl = document.getElementById("app");
91
- appEl?.remove();
92
- loadSignalR().then((signalR2) => {
93
- signalR2.stop();
94
- });
95
- index.Local.remove(index$1.PUB.accessTokenKey);
96
- index.Local.remove(index$1.PUB.refreshAccessTokenKey);
97
- index.Session.clear();
98
- const { t } = vueI18n.useI18n();
99
- elementPlus.ElMessageBox.alert(t("message.list.idleTimeoutMessage"), t("message.list.sysMessage"), {
100
- type: "warning",
101
- draggable: true,
102
- callback: () => {
103
- window.location.reload();
104
- }
105
- });
106
- }
107
- }
108
- function initIdleTimeout(config) {
109
- if (!window.__IDLE_TIMEOUT__) {
110
- window.__IDLE_TIMEOUT__ = new IdleTimeoutManager(config);
111
- }
112
- return window.__IDLE_TIMEOUT__;
113
- }
114
- function destroyIdleTimeout() {
115
- if (window.__IDLE_TIMEOUT__) {
116
- window.__IDLE_TIMEOUT__.destroy();
117
- window.__IDLE_TIMEOUT__ = void 0;
118
- }
119
- }
120
- function updateIdleTimeout(timeout) {
121
- if (window.__IDLE_TIMEOUT__) {
122
- window.__IDLE_TIMEOUT__.updateIdleTimeout(timeout);
123
- }
124
- }
125
-
126
- exports.destroyIdleTimeout = destroyIdleTimeout;
127
- exports.initIdleTimeout = initIdleTimeout;
128
- exports.updateIdleTimeout = updateIdleTimeout;
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- var SignalR = require('@microsoft/signalr');
4
- var elementPlus = require('element-plus');
5
- require('../../api/index.js');
6
- var request = require('../../api/utils/request.js');
7
-
8
- function _interopNamespaceDefault(e) {
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var SignalR__namespace = /*#__PURE__*/_interopNamespaceDefault(SignalR);
26
-
27
- const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Information).withUrl(`${window.__env__.VITE_API_URL}/fmauth/hubs/onlineUser?token=${request.getToken()}`, { transport: SignalR__namespace.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
28
- nextRetryDelayInMilliseconds: () => {
29
- return 5e3;
30
- }
31
- }).build();
32
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
33
- connection.serverTimeoutInMilliseconds = 30 * 60 * 1e3;
34
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
35
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
36
- connection.start().then(() => {
37
- });
38
- connection.onclose(async () => {
39
- });
40
- connection.onreconnecting(() => {
41
- elementPlus.ElNotification({
42
- title: "\u63D0\u793A",
43
- message: "\u670D\u52A1\u5668\u5DF2\u65AD\u7EBF...",
44
- type: "error",
45
- position: "bottom-right"
46
- });
47
- });
48
- connection.onreconnected(() => {
49
- });
50
- connection.on("OnlineUserList", () => {
51
- });
52
- connection.on("ReceiveMessage", (message) => {
53
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
54
- tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u4EBA\u5458\uFF1A${message.sendUserName}<p>`;
55
- tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u65F6\u95F4\uFF1A${message.sendTime}<p>`;
56
- elementPlus.ElNotification({
57
- title: `\u6D88\u606F\u3010${message.title}\u3011`,
58
- message: tmpMsg,
59
- type: "info",
60
- position: "top-right",
61
- dangerouslyUseHTMLString: true,
62
- duration: 0
63
- });
64
- });
65
-
66
- exports.signalR = connection;
package/lib/sysInfo.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function loadSysInfo(tenantid: number): Promise<void>;
2
- export declare const updateFavicon: (url: string) => void;
package/lib/sysInfo.js DELETED
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- require('./packages/core/index.js');
4
- var pinia = require('pinia');
5
- var idleTimeout = require('./packages/core/utils/comm/idleTimeout.js');
6
- var themeConfig = require('./packages/core/stores/themeConfig.js');
7
- var index = require('./packages/core/api/sys/index.js');
8
- var index$1 = require('./packages/core/utils/storage/index.js');
9
- var index$2 = require('./packages/core/utils/const/index.js');
10
-
11
- async function loadSysInfo(tenantid) {
12
- const storesThemeConfig = themeConfig.useThemeConfig();
13
- const { themeConfig: themeConfig$1 } = pinia.storeToRefs(storesThemeConfig);
14
- const [err, res] = await index.feature(index.useSysApi().getSysInfo(Number(tenantid)));
15
- if (err) {
16
- themeConfig$1.value.logoUrl = "logo.png";
17
- index$1.Local.remove(index$2.PUB.themeConfig);
18
- index$1.Local.set(index$2.PUB.themeConfig, storesThemeConfig.themeConfig);
19
- return;
20
- } else {
21
- if (res.data.type != "success" || res.data.result == null) return;
22
- const data = res.data.result;
23
- themeConfig$1.value.logoUrl = data.logo;
24
- themeConfig$1.value.globalTitle = data.title;
25
- themeConfig$1.value.globalViceTitle = data.viceTitle;
26
- themeConfig$1.value.globalViceTitleMsg = data.viceDesc;
27
- themeConfig$1.value.icp = data.icp;
28
- themeConfig$1.value.icpUrl = data.icpUrl;
29
- themeConfig$1.value.isWatermark = data.watermark != null;
30
- themeConfig$1.value.watermarkText = data.watermark;
31
- themeConfig$1.value.copyright = data.copyright;
32
- themeConfig$1.value.version = data.version;
33
- themeConfig$1.value.primary = data.themeColor;
34
- themeConfig$1.value.layout = data.layout;
35
- themeConfig$1.value.animation = data.animation;
36
- themeConfig$1.value.secondVer = data.secondVer;
37
- themeConfig$1.value.captcha = data.captcha;
38
- themeConfig$1.value.forceChangePassword = data.forceChangePassword;
39
- themeConfig$1.value.passwordExpirationTime = data.passwordExpirationTime;
40
- themeConfig$1.value.i18NSwitch = data.i18NSwitch;
41
- themeConfig$1.value.idleTimeout = data.idleTimeout;
42
- themeConfig$1.value.onlineNotice = data.onlineNotice;
43
- window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
44
- updateFavicon(data.logo);
45
- idleTimeout.updateIdleTimeout(themeConfig$1.value.idleTimeout ?? 0);
46
- index$1.Local.remove(index$2.PUB.themeConfig);
47
- index$1.Local.set(index$2.PUB.themeConfig, storesThemeConfig.themeConfig);
48
- }
49
- }
50
- const updateFavicon = (url) => {
51
- const favicon = document.getElementById("favicon");
52
- favicon.href = url ? url : "data:;base64,=";
53
- };
54
-
55
- exports.loadSysInfo = loadSysInfo;
56
- exports.updateFavicon = updateFavicon;