yxuse 3.0.102 → 3.0.104
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/README.md +89 -89
- package/lib/index.cjs11.js +1 -1
- package/lib/index.cjs2.js +1 -1
- package/lib/index.cjs5.js +1 -1
- package/lib/index.cjs5.js.gz +0 -0
- package/lib/index.cjs6.js +1 -1
- package/lib/index.es11.js +8 -2
- package/lib/index.es11.js.gz +0 -0
- package/lib/index.es2.js +209 -33
- package/lib/index.es2.js.gz +0 -0
- package/lib/index.es5.js +79 -8
- package/lib/index.es5.js.gz +0 -0
- package/lib/index.es6.js +3 -3
- package/lib/index.es6.js.gz +0 -0
- package/lib/utils.cjs.js +1 -1
- package/lib/utils.es.js +9 -1
- package/lib/vendor-axios.cjs.js.gz +0 -0
- package/lib/vendor-axios.es.js.gz +0 -0
- package/lib/vendor-dayjs.es.js.gz +0 -0
- package/lib/vendor-localforage.cjs.js.gz +0 -0
- package/lib/vendor-localforage.es.js.gz +0 -0
- package/lib/vendor-lodash.cjs.js.gz +0 -0
- package/lib/vendor-lodash.es.js.gz +0 -0
- package/lib/vendor-mqtt.cjs.js.gz +0 -0
- package/lib/vendor-mqtt.es.js.gz +0 -0
- package/lib/vendor-sortablejs.cjs.js.gz +0 -0
- package/lib/vendor-sortablejs.es.js.gz +0 -0
- package/lib/version.json +12 -12
- package/lib/yxuse.css +1 -1
- package/lib/yxuse.css.gz +0 -0
- package/package.json +178 -178
- package/types/api/modules/auth/index.d.ts +13 -13
- package/types/components/Common/DynamicComponent/index.vue.d.ts +21 -21
- package/types/components/CommonPage/index.d.ts +3 -3
- package/types/components/CommonPage/page.d.ts +64 -64
- package/types/components/CommonPage/pagination.d.ts +9 -9
- package/types/components/CommonPage/props.d.ts +36 -36
- package/types/components/CommonPage/search.d.ts +4 -4
- package/types/components/CommonPage/table.d.ts +3 -3
- package/types/components/CommonPage/type.d.ts +1 -1
- package/types/components/SearchForm/index.d.ts +3 -3
- package/types/components/SearchForm/index.vue.d.ts +2 -2
- package/types/components/YxForm/form.type.d.ts +183 -183
- package/types/components/YxForm/form.vaildator.d.ts +57 -57
- package/types/components/YxForm/form.vue.d.ts +66 -66
- package/types/components/YxFormV2/index.d.ts +3 -3
- package/types/components/YxFormV2/index.vue.d.ts +46 -46
- package/types/components/YxFormV2/type.d.ts +54 -54
- package/types/components/YxFrom/form.type.d.ts +179 -179
- package/types/components/YxFrom/form.vaildator.d.ts +57 -57
- package/types/components/YxFrom/form.vue.d.ts +66 -66
- package/types/components/YxFrom/index.d.ts +3 -3
- package/types/components/YxIcon/index.vue.d.ts +22 -22
- package/types/components/YxSearchForm/index.d.ts +3 -3
- package/types/components/YxSearchForm/index.vue.d.ts +36 -36
- package/types/components/YxSearchForm/type.d.ts +52 -52
- package/types/components/YxTable3/index.d.ts +1 -1
- package/types/components/YxTable3/src/index.d.ts +31 -31
- package/types/icons/index.d.ts +1 -1
- package/types/icons/src/index.d.ts +4 -4
- package/types/theme/checkVersion.d.ts +1 -0
- package/types/theme/config.d.ts +1 -0
- package/types/theme/type.d.ts +2 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/mqtt/index.d.ts +24 -12
- package/types/utils/mqtt/interface.d.ts +6 -2
- package/types/utils/mqtt/singleton.d.ts +50 -0
package/lib/index.es2.js
CHANGED
|
@@ -61,68 +61,228 @@ const yxFecth = {
|
|
|
61
61
|
put: (url, data, config) => baseRequest(url, "PUT", data, config),
|
|
62
62
|
delete: (url, data, config) => baseRequest(url, "DELETE", data, config)
|
|
63
63
|
};
|
|
64
|
-
const
|
|
64
|
+
const getOrCreateClientId = () => {
|
|
65
|
+
return `mqttjs_${Date.now()}_${Math.random().toString(16).slice(2, 8)}`;
|
|
66
|
+
};
|
|
67
|
+
const defaultClientOptions = {
|
|
65
68
|
mqttVersion: 5,
|
|
66
69
|
clean: true,
|
|
67
70
|
// true: 清除会话, false: 保留会话
|
|
68
71
|
connectTimeout: 4e3,
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
|
|
72
|
+
// 超时时间(ms)
|
|
73
|
+
keepalive: 30,
|
|
74
|
+
// 心跳时间(s):mqtt.js 会按此间隔自动发送 PINGREQ
|
|
75
|
+
reconnectPeriod: 6e4
|
|
73
76
|
// username: "xxxx",
|
|
74
77
|
// password: "xxxx",
|
|
75
|
-
qos: 1
|
|
76
78
|
};
|
|
77
|
-
const
|
|
79
|
+
const defaultSubscribeOptions = { qos: 1 };
|
|
80
|
+
const defaultPublishOptions = { qos: 1 };
|
|
78
81
|
class MQ {
|
|
79
82
|
constructor(url, options) {
|
|
80
|
-
__publicField(this, "client");
|
|
81
|
-
this
|
|
82
|
-
this
|
|
83
|
-
this
|
|
84
|
-
this
|
|
85
|
-
this
|
|
86
|
-
this
|
|
83
|
+
__publicField(this, "client", null);
|
|
84
|
+
__publicField(this, "subscribeMap", /* @__PURE__ */ new Map());
|
|
85
|
+
__publicField(this, "onConnect");
|
|
86
|
+
__publicField(this, "onReconnect");
|
|
87
|
+
__publicField(this, "onError");
|
|
88
|
+
__publicField(this, "onMessage");
|
|
89
|
+
__publicField(this, "destroyed");
|
|
90
|
+
/**标记是否为手动关闭连接 */
|
|
91
|
+
__publicField(this, "isManualClose", false);
|
|
92
|
+
this.onConnect = (e) => {
|
|
93
|
+
this.resubscribeAll();
|
|
94
|
+
};
|
|
95
|
+
this.onReconnect = (error) => {
|
|
96
|
+
};
|
|
97
|
+
this.onError = (error) => {
|
|
98
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
99
|
+
this.analyzeDisconnectReason(err);
|
|
100
|
+
};
|
|
101
|
+
this.onMessage = (topic, message) => {
|
|
102
|
+
var _a;
|
|
103
|
+
const callback = this.subscribeMap.get(topic);
|
|
104
|
+
if (!callback) return;
|
|
105
|
+
let payload = message;
|
|
106
|
+
try {
|
|
107
|
+
const text = (_a = message == null ? void 0 : message.toString) == null ? void 0 : _a.call(message);
|
|
108
|
+
if (text != null) payload = JSON.parse(text);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
}
|
|
111
|
+
callback(payload, topic);
|
|
112
|
+
};
|
|
113
|
+
this.destroyed = () => {
|
|
114
|
+
var _a;
|
|
115
|
+
this.isManualClose = true;
|
|
116
|
+
(_a = this.client) == null ? void 0 : _a.end(true);
|
|
117
|
+
};
|
|
118
|
+
this.subscribe = this.subscribe.bind(this);
|
|
119
|
+
this.unsubscribe = this.unsubscribe.bind(this);
|
|
120
|
+
this.publish = this.publish.bind(this);
|
|
121
|
+
const merged = { ...defaultClientOptions, ...options };
|
|
122
|
+
merged.clientId || (merged.clientId = getOrCreateClientId());
|
|
123
|
+
this.createClient(url, merged);
|
|
87
124
|
}
|
|
88
125
|
createClient(url, options) {
|
|
89
126
|
this.client = mqtt_minExports.connect(url, options);
|
|
90
|
-
this.client.on("connect", this.onConnect);
|
|
91
|
-
this.client.on("reconnect", this.onReconnect);
|
|
92
|
-
this.client.on("error", this.onError);
|
|
93
|
-
this.client.on("message", this.onMessage);
|
|
127
|
+
this.client.on("connect", (e) => this.onConnect(e));
|
|
128
|
+
this.client.on("reconnect", (error) => this.onReconnect(error));
|
|
129
|
+
this.client.on("error", (error) => this.onError(error));
|
|
130
|
+
this.client.on("message", (topic, message) => this.onMessage(topic, message));
|
|
131
|
+
this.client.on("offline", () => {
|
|
132
|
+
(/* @__PURE__ */ new Date()).toISOString();
|
|
133
|
+
});
|
|
134
|
+
this.client.on("close", (hadError, error) => {
|
|
135
|
+
(/* @__PURE__ */ new Date()).toISOString();
|
|
136
|
+
if (this.isManualClose) {
|
|
137
|
+
this.isManualClose = false;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (error) {
|
|
141
|
+
this.analyzeDisconnectReason(error);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
this.client.on("online", () => {
|
|
145
|
+
});
|
|
94
146
|
}
|
|
95
|
-
publish(topic, message) {
|
|
96
|
-
this.client
|
|
147
|
+
publish(topic, message, options = defaultPublishOptions) {
|
|
148
|
+
if (!this.client) return;
|
|
149
|
+
const payload = typeof message === "string" ? message : JSON.stringify(message);
|
|
150
|
+
this.client.publish(topic, payload, options, (e) => {
|
|
97
151
|
});
|
|
98
152
|
}
|
|
99
|
-
subscribe(topic, callback) {
|
|
100
|
-
this.client
|
|
153
|
+
subscribe(topic, callback, options = defaultSubscribeOptions) {
|
|
154
|
+
if (!this.client) return;
|
|
155
|
+
this.client.subscribe(topic, options, (error) => {
|
|
101
156
|
if (!error) {
|
|
102
|
-
subscribeMap.set(topic, callback);
|
|
157
|
+
this.subscribeMap.set(topic, callback);
|
|
103
158
|
} else {
|
|
104
|
-
throw new Error(error);
|
|
159
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
105
160
|
}
|
|
106
161
|
});
|
|
107
162
|
}
|
|
108
163
|
unsubscribe(topic) {
|
|
164
|
+
if (!this.client) return;
|
|
109
165
|
this.client.unsubscribe(topic, {}, (error) => {
|
|
166
|
+
if (error) ;
|
|
167
|
+
else {
|
|
168
|
+
this.subscribeMap.delete(topic);
|
|
169
|
+
}
|
|
110
170
|
});
|
|
111
171
|
}
|
|
112
|
-
|
|
172
|
+
resubscribeAll() {
|
|
173
|
+
if (!this.client) return;
|
|
174
|
+
this.subscribeMap.forEach((_callback, topic) => {
|
|
175
|
+
this.client.subscribe(topic, defaultSubscribeOptions, (error) => {
|
|
176
|
+
});
|
|
177
|
+
});
|
|
113
178
|
}
|
|
114
|
-
|
|
179
|
+
/**
|
|
180
|
+
* @description 分析断开原因
|
|
181
|
+
* @param error 错误对象
|
|
182
|
+
* @returns 断开原因描述
|
|
183
|
+
*/
|
|
184
|
+
analyzeDisconnectReason(error) {
|
|
185
|
+
var _a, _b, _c;
|
|
186
|
+
const errorCode = error.code || error.message;
|
|
187
|
+
if (errorCode === "ECONNREFUSED") {
|
|
188
|
+
return "服务器拒绝连接(服务器可能关闭或不可用)";
|
|
189
|
+
}
|
|
190
|
+
if (errorCode === "ETIMEDOUT") {
|
|
191
|
+
return "连接超时(网络延迟或服务器无响应)";
|
|
192
|
+
}
|
|
193
|
+
if (errorCode === "ENETUNREACH") {
|
|
194
|
+
return "网络不可达(网络中断)";
|
|
195
|
+
}
|
|
196
|
+
if (errorCode === "ECONNRESET") {
|
|
197
|
+
return "连接被重置(服务器主动断开连接)";
|
|
198
|
+
}
|
|
199
|
+
if (errorCode === "EPIPE" || errorCode === "ECONNABORTED") {
|
|
200
|
+
return "连接异常终止(网络中断或服务器关闭)";
|
|
201
|
+
}
|
|
202
|
+
if (((_a = error.message) == null ? void 0 : _a.includes("Not authorized")) || ((_b = error.message) == null ? void 0 : _b.includes("unauthorized"))) {
|
|
203
|
+
return "服务器主动断开 - 认证失败";
|
|
204
|
+
}
|
|
205
|
+
if ((_c = error.message) == null ? void 0 : _c.includes("Connection refused")) {
|
|
206
|
+
return "服务器主动断开 - 连接被拒绝";
|
|
207
|
+
}
|
|
208
|
+
return `其他错误: ${errorCode || error.message}`;
|
|
115
209
|
}
|
|
116
|
-
|
|
210
|
+
}
|
|
211
|
+
const pool = /* @__PURE__ */ new Map();
|
|
212
|
+
const assertConnection = (url) => {
|
|
213
|
+
const conn = pool.get(url);
|
|
214
|
+
if (!conn) {
|
|
215
|
+
throw new Error(`[mqtt] MQ(${url}) 未初始化,请先调用 initMQSingleton(url, options)`);
|
|
117
216
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
217
|
+
return conn;
|
|
218
|
+
};
|
|
219
|
+
const getMQSingletonUrls = () => Array.from(pool.keys());
|
|
220
|
+
const initMQSingleton = (url, options, config = {}) => {
|
|
221
|
+
const existed = pool.get(url);
|
|
222
|
+
if (existed && !config.force) return existed.mq;
|
|
223
|
+
if (existed && config.force) destroyMQSingleton(url);
|
|
224
|
+
const mq = new MQ(url, options);
|
|
225
|
+
pool.set(url, {
|
|
226
|
+
url,
|
|
227
|
+
mq,
|
|
228
|
+
topicHandlers: /* @__PURE__ */ new Map(),
|
|
229
|
+
topicDispatcher: /* @__PURE__ */ new Map()
|
|
230
|
+
});
|
|
231
|
+
return mq;
|
|
232
|
+
};
|
|
233
|
+
const getMQSingleton = (url) => {
|
|
234
|
+
var _a;
|
|
235
|
+
return ((_a = pool.get(url)) == null ? void 0 : _a.mq) ?? null;
|
|
236
|
+
};
|
|
237
|
+
const publishMQ = (url, topic, message, options) => {
|
|
238
|
+
const { mq } = assertConnection(url);
|
|
239
|
+
mq.publish(topic, message, options);
|
|
240
|
+
};
|
|
241
|
+
const subscribeMQ = (url, topic, handler, options) => {
|
|
242
|
+
const conn = assertConnection(url);
|
|
243
|
+
const { mq, topicHandlers, topicDispatcher } = conn;
|
|
244
|
+
let set = topicHandlers.get(topic);
|
|
245
|
+
const isFirst = !set;
|
|
246
|
+
if (!set) {
|
|
247
|
+
set = /* @__PURE__ */ new Set();
|
|
248
|
+
topicHandlers.set(topic, set);
|
|
121
249
|
}
|
|
122
|
-
|
|
123
|
-
|
|
250
|
+
set.add(handler);
|
|
251
|
+
if (isFirst) {
|
|
252
|
+
const dispatcher = (payload, t) => {
|
|
253
|
+
const handlers = topicHandlers.get(t);
|
|
254
|
+
if (!handlers || handlers.size === 0) return;
|
|
255
|
+
handlers.forEach((fn) => fn(payload, t));
|
|
256
|
+
};
|
|
257
|
+
topicDispatcher.set(topic, dispatcher);
|
|
258
|
+
mq.subscribe(topic, dispatcher, options);
|
|
124
259
|
}
|
|
125
|
-
|
|
260
|
+
return () => unsubscribeMQ(url, topic, handler);
|
|
261
|
+
};
|
|
262
|
+
const unsubscribeMQ = (url, topic, handler) => {
|
|
263
|
+
const conn = pool.get(url);
|
|
264
|
+
if (!conn) return;
|
|
265
|
+
const { mq, topicHandlers, topicDispatcher } = conn;
|
|
266
|
+
const set = topicHandlers.get(topic);
|
|
267
|
+
if (!set) return;
|
|
268
|
+
if (handler) set.delete(handler);
|
|
269
|
+
else set.clear();
|
|
270
|
+
if (set.size > 0) return;
|
|
271
|
+
topicHandlers.delete(topic);
|
|
272
|
+
topicDispatcher.delete(topic);
|
|
273
|
+
mq.unsubscribe(topic);
|
|
274
|
+
};
|
|
275
|
+
const destroyMQSingleton = (url) => {
|
|
276
|
+
const conn = pool.get(url);
|
|
277
|
+
if (!conn) return;
|
|
278
|
+
conn.mq.destroyed();
|
|
279
|
+
conn.topicHandlers.clear();
|
|
280
|
+
conn.topicDispatcher.clear();
|
|
281
|
+
pool.delete(url);
|
|
282
|
+
};
|
|
283
|
+
const destroyAllMQSingleton = () => {
|
|
284
|
+
Array.from(pool.keys()).forEach((url) => destroyMQSingleton(url));
|
|
285
|
+
};
|
|
126
286
|
class Ws {
|
|
127
287
|
constructor(options, protocols) {
|
|
128
288
|
__publicField(this, "url");
|
|
@@ -294,14 +454,22 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
294
454
|
areColorsSimilar,
|
|
295
455
|
copyText,
|
|
296
456
|
deepClone,
|
|
457
|
+
destroyAllMQSingleton,
|
|
458
|
+
destroyMQSingleton,
|
|
297
459
|
enumToArray,
|
|
298
460
|
getCownDownTime,
|
|
461
|
+
getMQSingleton,
|
|
462
|
+
getMQSingletonUrls,
|
|
299
463
|
getSelectOptions,
|
|
300
464
|
http,
|
|
465
|
+
initMQSingleton,
|
|
301
466
|
isColorEqual,
|
|
302
467
|
isDarkColor,
|
|
303
468
|
notifyMessageToSystems,
|
|
469
|
+
publishMQ,
|
|
304
470
|
receiveMessage,
|
|
471
|
+
subscribeMQ,
|
|
472
|
+
unsubscribeMQ,
|
|
305
473
|
useConfirm,
|
|
306
474
|
yxFecth,
|
|
307
475
|
yxMessage,
|
|
@@ -310,6 +478,14 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
310
478
|
export {
|
|
311
479
|
MQ as M,
|
|
312
480
|
Ws as W,
|
|
481
|
+
getMQSingleton as a,
|
|
482
|
+
unsubscribeMQ as b,
|
|
483
|
+
destroyAllMQSingleton as c,
|
|
484
|
+
destroyMQSingleton as d,
|
|
485
|
+
getMQSingletonUrls as g,
|
|
486
|
+
initMQSingleton as i,
|
|
487
|
+
publishMQ as p,
|
|
488
|
+
subscribeMQ as s,
|
|
313
489
|
utils2 as u,
|
|
314
490
|
yxFecth as y
|
|
315
491
|
};
|
|
Binary file
|
package/lib/index.es5.js
CHANGED
|
@@ -43,7 +43,8 @@ const defaultConfig = {
|
|
|
43
43
|
systemKey: "",
|
|
44
44
|
isTranslateApi: false,
|
|
45
45
|
whitelistTranslateApi: [],
|
|
46
|
-
autoGetSystemConfig: true
|
|
46
|
+
autoGetSystemConfig: true,
|
|
47
|
+
autoListenMissFileReload: true
|
|
47
48
|
};
|
|
48
49
|
const exportToExcel = ({ header, tableData, fileName }) => {
|
|
49
50
|
const tHeader = header.map((col) => col.label);
|
|
@@ -1720,7 +1721,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
1720
1721
|
}
|
|
1721
1722
|
return target;
|
|
1722
1723
|
};
|
|
1723
|
-
const YxForm = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
1724
|
+
const YxForm = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8c52a48d"]]);
|
|
1724
1725
|
function _isSlot(s) {
|
|
1725
1726
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
1726
1727
|
}
|
|
@@ -2579,7 +2580,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2579
2580
|
[vShow, $props.value > 0]
|
|
2580
2581
|
]);
|
|
2581
2582
|
}
|
|
2582
|
-
const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-
|
|
2583
|
+
const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-181eafdb"]]);
|
|
2583
2584
|
const _sfc_main$1 = {
|
|
2584
2585
|
components: { theme, issue, Badge, lang },
|
|
2585
2586
|
props: {
|
|
@@ -2705,7 +2706,7 @@ const _hoisted_3 = { class: "tool-icon relative flex justify-center items-center
|
|
|
2705
2706
|
const _hoisted_4 = {
|
|
2706
2707
|
class: "yx-icon",
|
|
2707
2708
|
style: { "color": "var(--color-main-100)" },
|
|
2708
|
-
color: "var(--color-main-100) \n ",
|
|
2709
|
+
color: "var(--color-main-100) \r\n ",
|
|
2709
2710
|
size: "24"
|
|
2710
2711
|
};
|
|
2711
2712
|
const _hoisted_5 = { class: "mt-10 text-center" };
|
|
@@ -2808,7 +2809,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2808
2809
|
_: 1
|
|
2809
2810
|
});
|
|
2810
2811
|
}
|
|
2811
|
-
const ToolbarContainer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
2812
|
+
const ToolbarContainer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-96edce95"]]);
|
|
2812
2813
|
const _hoisted_1$1 = {
|
|
2813
2814
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2814
2815
|
width: "50",
|
|
@@ -2919,8 +2920,8 @@ const __default__ = {
|
|
|
2919
2920
|
};
|
|
2920
2921
|
const __injectCSSVars__ = () => {
|
|
2921
2922
|
useCssVars((_ctx) => ({
|
|
2922
|
-
"
|
|
2923
|
-
"
|
|
2923
|
+
"e957f242": _ctx.panelWidthPX,
|
|
2924
|
+
"05985204": _ctx.panelHeightPX
|
|
2924
2925
|
}));
|
|
2925
2926
|
};
|
|
2926
2927
|
const __setup__ = __default__.setup;
|
|
@@ -2963,7 +2964,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2963
2964
|
}, null, 8, ["badgeValue", "showTool"])
|
|
2964
2965
|
]);
|
|
2965
2966
|
}
|
|
2966
|
-
const ToolbarApp = /* @__PURE__ */ _export_sfc(__default__, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
2967
|
+
const ToolbarApp = /* @__PURE__ */ _export_sfc(__default__, [["render", _sfc_render], ["__scopeId", "data-v-6db83be1"]]);
|
|
2967
2968
|
const _Toolbar = class _Toolbar {
|
|
2968
2969
|
constructor(config2) {
|
|
2969
2970
|
/** 工具挂载domId */
|
|
@@ -3058,16 +3059,82 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3058
3059
|
};
|
|
3059
3060
|
}
|
|
3060
3061
|
});
|
|
3062
|
+
const isFileMissingError = (error) => {
|
|
3063
|
+
if (!error) return false;
|
|
3064
|
+
const errorMessage = error.message || error.toString() || "";
|
|
3065
|
+
const errorType = error.type || "";
|
|
3066
|
+
if (errorMessage.includes("Failed to fetch dynamically imported module")) return true;
|
|
3067
|
+
if (errorMessage.includes("Loading chunk") && errorMessage.includes("failed")) return true;
|
|
3068
|
+
if (errorMessage.includes("ChunkLoadError")) return true;
|
|
3069
|
+
if (errorMessage.includes("Failed to load resource") || errorMessage.includes("404")) return true;
|
|
3070
|
+
if (errorMessage.includes("NetworkError") && (errorMessage.includes(".js") || errorMessage.includes(".css"))) return true;
|
|
3071
|
+
if (errorType === "error" && error.target && (error.target.tagName === "SCRIPT" || error.target.tagName === "LINK")) return true;
|
|
3072
|
+
return false;
|
|
3073
|
+
};
|
|
3074
|
+
const refreshPage = (originUrl2) => {
|
|
3075
|
+
if (window.parent !== window) {
|
|
3076
|
+
window.location.href = originUrl2;
|
|
3077
|
+
window.location.reload();
|
|
3078
|
+
} else {
|
|
3079
|
+
window.location.reload();
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
const showRefreshDialog = (originUrl2) => {
|
|
3083
|
+
return ElMessageBox.confirm("软件已更新,是否立即刷新页面?", "提示", {
|
|
3084
|
+
showCancelButton: false,
|
|
3085
|
+
showClose: false,
|
|
3086
|
+
closeOnClickModal: false,
|
|
3087
|
+
closeOnPressEscape: false,
|
|
3088
|
+
type: "warning"
|
|
3089
|
+
}).then(() => {
|
|
3090
|
+
refreshPage(originUrl2);
|
|
3091
|
+
}).catch(() => {
|
|
3092
|
+
});
|
|
3093
|
+
};
|
|
3094
|
+
let originUrl = window.location.href;
|
|
3095
|
+
let hasRefreshed = false;
|
|
3096
|
+
let refreshTimer = null;
|
|
3097
|
+
const handleRefresh = () => {
|
|
3098
|
+
if (hasRefreshed) return;
|
|
3099
|
+
hasRefreshed = true;
|
|
3100
|
+
if (refreshTimer) {
|
|
3101
|
+
clearTimeout(refreshTimer);
|
|
3102
|
+
}
|
|
3103
|
+
refreshTimer = setTimeout(() => {
|
|
3104
|
+
showRefreshDialog(originUrl);
|
|
3105
|
+
}, 100);
|
|
3106
|
+
};
|
|
3107
|
+
const checkVersion = () => {
|
|
3108
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
3109
|
+
if (isFileMissingError(event.reason)) {
|
|
3110
|
+
handleRefresh();
|
|
3111
|
+
}
|
|
3112
|
+
});
|
|
3113
|
+
window.addEventListener("error", (event) => {
|
|
3114
|
+
if (event.target && event.target.tagName) {
|
|
3115
|
+
const target = event.target;
|
|
3116
|
+
if ((target.tagName === "SCRIPT" || target.tagName === "LINK") && isFileMissingError(event)) {
|
|
3117
|
+
handleRefresh();
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
if (event.message && isFileMissingError({ message: event.message })) {
|
|
3122
|
+
handleRefresh();
|
|
3123
|
+
}
|
|
3124
|
+
}, true);
|
|
3125
|
+
};
|
|
3061
3126
|
const install = async (config2) => {
|
|
3062
3127
|
var _a;
|
|
3063
3128
|
config2 = { ...defaultConfig, ...config2 };
|
|
3064
3129
|
let themeId = getCurTheme();
|
|
3065
3130
|
try {
|
|
3131
|
+
handleListenMissFile(config2);
|
|
3066
3132
|
await handleSystemConfig(config2);
|
|
3067
3133
|
const { data } = await http.get(config2 == null ? void 0 : config2.themeApiUrl, {}, { headers: { noLoading: true } });
|
|
3068
3134
|
window["YX_THEME_LIST"] = data;
|
|
3069
3135
|
if (config2.isRenderLang && config2.systemKey) {
|
|
3070
3136
|
const lang2 = await getLang();
|
|
3137
|
+
changeSystemConfig("lang", lang2);
|
|
3071
3138
|
await initTranslate({ to: lang2 ? lang2 : config2.lang, systemKey: config2.systemKey });
|
|
3072
3139
|
}
|
|
3073
3140
|
if (config2.isRenderToolbar) {
|
|
@@ -3107,6 +3174,10 @@ const handleSystemConfig = async (options) => {
|
|
|
3107
3174
|
}
|
|
3108
3175
|
}
|
|
3109
3176
|
};
|
|
3177
|
+
const handleListenMissFile = (options) => {
|
|
3178
|
+
if (!options.autoListenMissFileReload) return;
|
|
3179
|
+
checkVersion();
|
|
3180
|
+
};
|
|
3110
3181
|
const initTtcFont = () => {
|
|
3111
3182
|
const style = document.createElement("style");
|
|
3112
3183
|
style.innerHTML = ttcFontFamily;
|
package/lib/index.es5.js.gz
CHANGED
|
Binary file
|
package/lib/index.es6.js
CHANGED
|
@@ -269,7 +269,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
|
-
const Update = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
272
|
+
const Update = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-668773ee"]]);
|
|
273
273
|
const _sfc_main$2 = {
|
|
274
274
|
props: {
|
|
275
275
|
color: {
|
|
@@ -290,7 +290,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
290
290
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
291
291
|
], 4);
|
|
292
292
|
}
|
|
293
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
293
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-4f75e32e"]]);
|
|
294
294
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
295
295
|
__name: "index",
|
|
296
296
|
props: {
|
|
@@ -451,7 +451,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
451
451
|
}, toDisplayString((_d = $data.customConfig) == null ? void 0 : _d.title), 5)) : createCommentVNode("", true)
|
|
452
452
|
], 2);
|
|
453
453
|
}
|
|
454
|
-
const LogoTitle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
454
|
+
const LogoTitle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-25281149"]]);
|
|
455
455
|
class LogoTitleRender {
|
|
456
456
|
constructor(props, domId = "system-logo-title") {
|
|
457
457
|
this.render(props, domId);
|
package/lib/index.es6.js.gz
CHANGED
|
Binary file
|
package/lib/utils.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs11.js"),s=require("./index.cjs12.js"),o=require("./index.cjs2.js");exports.http=e.http,exports.yxSubscribe=e.yxSubscribe,exports.areColorsSimilar=s.areColorsSimilar,exports.copyText=s.copyText,exports.deepClone=s.deepClone,exports.enumToArray=s.enumToArray,exports.getCownDownTime=s.getCownDownTime,exports.getSelectOptions=s.getSelectOptions,exports.isColorEqual=s.isColorEqual,exports.isDarkColor=s.isDarkColor,exports.notifyMessageToSystems=s.notifyMessageToSystems,exports.receiveMessage=s.receiveMessage,exports.useConfirm=s.useConfirm,exports.yxMessage=s.yxMessage,exports.MQ=o.MQ,exports.WS=o.Ws,exports.yxFecth=o.yxFecth;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs11.js"),s=require("./index.cjs12.js"),o=require("./index.cjs2.js");exports.http=e.http,exports.yxSubscribe=e.yxSubscribe,exports.areColorsSimilar=s.areColorsSimilar,exports.copyText=s.copyText,exports.deepClone=s.deepClone,exports.enumToArray=s.enumToArray,exports.getCownDownTime=s.getCownDownTime,exports.getSelectOptions=s.getSelectOptions,exports.isColorEqual=s.isColorEqual,exports.isDarkColor=s.isDarkColor,exports.notifyMessageToSystems=s.notifyMessageToSystems,exports.receiveMessage=s.receiveMessage,exports.useConfirm=s.useConfirm,exports.yxMessage=s.yxMessage,exports.MQ=o.MQ,exports.WS=o.Ws,exports.destroyAllMQSingleton=o.destroyAllMQSingleton,exports.destroyMQSingleton=o.destroyMQSingleton,exports.getMQSingleton=o.getMQSingleton,exports.getMQSingletonUrls=o.getMQSingletonUrls,exports.initMQSingleton=o.initMQSingleton,exports.publishMQ=o.publishMQ,exports.subscribeMQ=o.subscribeMQ,exports.unsubscribeMQ=o.unsubscribeMQ,exports.yxFecth=o.yxFecth;
|
package/lib/utils.es.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { a, y } from "./index.es11.js";
|
|
2
2
|
import { a as a2, c, d, e, g, b, i, f, n, r, u, y as y2 } from "./index.es12.js";
|
|
3
|
-
import { M, W, y as y3 } from "./index.es2.js";
|
|
3
|
+
import { M, W, c as c2, d as d2, a as a3, g as g2, i as i2, p, s, b as b2, y as y3 } from "./index.es2.js";
|
|
4
4
|
export {
|
|
5
5
|
M as MQ,
|
|
6
6
|
W as WS,
|
|
7
7
|
a2 as areColorsSimilar,
|
|
8
8
|
c as copyText,
|
|
9
9
|
d as deepClone,
|
|
10
|
+
c2 as destroyAllMQSingleton,
|
|
11
|
+
d2 as destroyMQSingleton,
|
|
10
12
|
e as enumToArray,
|
|
11
13
|
g as getCownDownTime,
|
|
14
|
+
a3 as getMQSingleton,
|
|
15
|
+
g2 as getMQSingletonUrls,
|
|
12
16
|
b as getSelectOptions,
|
|
13
17
|
a as http,
|
|
18
|
+
i2 as initMQSingleton,
|
|
14
19
|
i as isColorEqual,
|
|
15
20
|
f as isDarkColor,
|
|
16
21
|
n as notifyMessageToSystems,
|
|
22
|
+
p as publishMQ,
|
|
17
23
|
r as receiveMessage,
|
|
24
|
+
s as subscribeMQ,
|
|
25
|
+
b2 as unsubscribeMQ,
|
|
18
26
|
u as useConfirm,
|
|
19
27
|
y3 as yxFecth,
|
|
20
28
|
y2 as yxMessage,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/vendor-mqtt.es.js.gz
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/version.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.0.4",
|
|
3
|
-
"isNotice": true,
|
|
4
|
-
"message": {
|
|
5
|
-
"title": "🚀🚀🚀系统更新通知🚀🚀🚀",
|
|
6
|
-
"description": "我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动",
|
|
7
|
-
"content": {
|
|
8
|
-
"1": "修复了部分bug",
|
|
9
|
-
"2": "新增了xxx功能"
|
|
10
|
-
},
|
|
11
|
-
"time": "2023年12月7日"
|
|
12
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.4",
|
|
3
|
+
"isNotice": true,
|
|
4
|
+
"message": {
|
|
5
|
+
"title": "🚀🚀🚀系统更新通知🚀🚀🚀",
|
|
6
|
+
"description": "我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动我们做了如下改动",
|
|
7
|
+
"content": {
|
|
8
|
+
"1": "修复了部分bug",
|
|
9
|
+
"2": "新增了xxx功能"
|
|
10
|
+
},
|
|
11
|
+
"time": "2023年12月7日"
|
|
12
|
+
}
|
|
13
13
|
}
|