yxuse 3.0.101 → 3.0.103

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/lib/index.es11.js CHANGED
@@ -3,14 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { a as axios } from "./vendor-axios.es.js";
5
5
  import { ElMessage, ElLoading, ElNotification } from "element-plus";
6
- import "element-plus/es/components/notification/style/index";
7
- import "element-plus/es/components/message/style/index";
8
- import "element-plus/es/components/message/style/css";
9
- import "element-plus/es/components/notification/style/css";
10
- import "element-plus/es/components/message-box/style/index";
11
6
  import "./vendor-dayjs.es.js";
12
- import "element-plus/es/components/loading/style/index";
13
- import "element-plus/es/components/loading/style/css";
14
7
  import "./vendor-mqtt.es.js";
15
8
  const ttc = {
16
9
  LOGIN_URL: `${window.location.origin}/ttc/cloud/#/login`,
@@ -331,9 +324,12 @@ class YxHttp {
331
324
  );
332
325
  this.service.interceptors.response.use(
333
326
  async (response) => {
327
+ var _a;
334
328
  const { config: config2 } = response;
335
329
  let data = response.data;
336
- hideFullScreenLoading();
330
+ if (!((_a = config2 == null ? void 0 : config2.headers) == null ? void 0 : _a.noLoading)) {
331
+ hideFullScreenLoading();
332
+ }
337
333
  if (this.customResponseInterceptors) return this.customResponseInterceptors(response);
338
334
  if (this.customGlobalResHandler) {
339
335
  const isContinue = this.customGlobalResHandler(response);
@@ -351,9 +347,12 @@ class YxHttp {
351
347
  return data;
352
348
  },
353
349
  (error) => {
354
- hideFullScreenLoading();
350
+ var _a;
355
351
  const response = error.response;
356
352
  const { config: config2 } = error;
353
+ if (!((_a = config2 == null ? void 0 : config2.headers) == null ? void 0 : _a.noLoading)) {
354
+ hideFullScreenLoading();
355
+ }
357
356
  if (this.customResponseInterceptors) return this.customResponseInterceptors(response);
358
357
  if (this.customGlobalResHandler) {
359
358
  const isContinue = this.customGlobalResHandler(response);
Binary file
package/lib/index.es12.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import { ElMessage, ElMessageBox } from "element-plus";
2
- import "element-plus/es/components/message/style/index";
3
- import "element-plus/es/components/message-box/style/index";
4
2
  import { d as dayjs } from "./vendor-dayjs.es.js";
5
3
  const notifyMessageToSystems = (message) => {
6
4
  const themeBc = new BroadcastChannel("YXUSE_BC");
package/lib/index.es2.js CHANGED
@@ -4,8 +4,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  import { g as getToken, s as showFullScreenLoading, h as hideFullScreenLoading, c as checkStatus, a as http, y as yxSubscribe } from "./index.es11.js";
5
5
  import { a as areColorsSimilar, c as copyText, d as deepClone, e as enumToArray, g as getCownDownTime, b as getSelectOptions, i as isColorEqual, f as isDarkColor, n as notifyMessageToSystems, r as receiveMessage, u as useConfirm, y as yxMessage } from "./index.es12.js";
6
6
  import "element-plus";
7
- import "element-plus/es/components/message/style/index";
8
- import "element-plus/es/components/message-box/style/index";
9
7
  import "./vendor-dayjs.es.js";
10
8
  import { m as mqtt_minExports } from "./vendor-mqtt.es.js";
11
9
  function buildQuery(params) {
@@ -63,68 +61,228 @@ const yxFecth = {
63
61
  put: (url, data, config) => baseRequest(url, "PUT", data, config),
64
62
  delete: (url, data, config) => baseRequest(url, "DELETE", data, config)
65
63
  };
66
- const clientOptions = {
64
+ const getOrCreateClientId = () => {
65
+ return `mqttjs_${Date.now()}_${Math.random().toString(16).slice(2, 8)}`;
66
+ };
67
+ const defaultClientOptions = {
67
68
  mqttVersion: 5,
68
69
  clean: true,
69
70
  // true: 清除会话, false: 保留会话
70
71
  connectTimeout: 4e3,
71
- // 超时时间
72
- keepAlive: 60,
73
- // 认证信息
74
- clientId: "mqttjs_" + Date.now(),
72
+ // 超时时间(ms)
73
+ keepalive: 30,
74
+ // 心跳时间(s):mqtt.js 会按此间隔自动发送 PINGREQ
75
+ reconnectPeriod: 6e4
75
76
  // username: "xxxx",
76
77
  // password: "xxxx",
77
- qos: 1
78
78
  };
79
- const subscribeMap = /* @__PURE__ */ new Map();
79
+ const defaultSubscribeOptions = { qos: 1 };
80
+ const defaultPublishOptions = { qos: 1 };
80
81
  class MQ {
81
82
  constructor(url, options) {
82
- __publicField(this, "client");
83
- this.client = null;
84
- this.subscribe = this.subscribe;
85
- this.unsubscribe = this.unsubscribe;
86
- this.publish = this.publish;
87
- this.destroyed = this.destroyed;
88
- this.createClient(url, { ...clientOptions, ...options });
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);
89
124
  }
90
125
  createClient(url, options) {
91
126
  this.client = mqtt_minExports.connect(url, options);
92
- this.client.on("connect", this.onConnect);
93
- this.client.on("reconnect", this.onReconnect);
94
- this.client.on("error", this.onError);
95
- 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
+ });
96
146
  }
97
- publish(topic, message) {
98
- this.client.publish(topic, message, { qos: clientOptions.qos }, (e) => {
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) => {
99
151
  });
100
152
  }
101
- subscribe(topic, callback) {
102
- this.client.subscribe(topic, (error) => {
153
+ subscribe(topic, callback, options = defaultSubscribeOptions) {
154
+ if (!this.client) return;
155
+ this.client.subscribe(topic, options, (error) => {
103
156
  if (!error) {
104
- subscribeMap.set(topic, callback);
157
+ this.subscribeMap.set(topic, callback);
105
158
  } else {
106
- throw new Error(error);
159
+ throw error instanceof Error ? error : new Error(String(error));
107
160
  }
108
161
  });
109
162
  }
110
163
  unsubscribe(topic) {
164
+ if (!this.client) return;
111
165
  this.client.unsubscribe(topic, {}, (error) => {
166
+ if (error) ;
167
+ else {
168
+ this.subscribeMap.delete(topic);
169
+ }
112
170
  });
113
171
  }
114
- onConnect(e) {
172
+ resubscribeAll() {
173
+ if (!this.client) return;
174
+ this.subscribeMap.forEach((_callback, topic) => {
175
+ this.client.subscribe(topic, defaultSubscribeOptions, (error) => {
176
+ });
177
+ });
115
178
  }
116
- onReconnect(error) {
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}`;
117
209
  }
118
- onError(error) {
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)`);
119
216
  }
120
- onMessage(topic, message) {
121
- const data = message.toString();
122
- subscribeMap.get(topic)(JSON.parse(data));
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);
123
249
  }
124
- destroyed() {
125
- if (this.client.end) this.client.end();
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);
126
259
  }
127
- }
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
+ };
128
286
  class Ws {
129
287
  constructor(options, protocols) {
130
288
  __publicField(this, "url");
@@ -296,14 +454,22 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
296
454
  areColorsSimilar,
297
455
  copyText,
298
456
  deepClone,
457
+ destroyAllMQSingleton,
458
+ destroyMQSingleton,
299
459
  enumToArray,
300
460
  getCownDownTime,
461
+ getMQSingleton,
462
+ getMQSingletonUrls,
301
463
  getSelectOptions,
302
464
  http,
465
+ initMQSingleton,
303
466
  isColorEqual,
304
467
  isDarkColor,
305
468
  notifyMessageToSystems,
469
+ publishMQ,
306
470
  receiveMessage,
471
+ subscribeMQ,
472
+ unsubscribeMQ,
307
473
  useConfirm,
308
474
  yxFecth,
309
475
  yxMessage,
@@ -312,6 +478,14 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
312
478
  export {
313
479
  MQ as M,
314
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,
315
489
  utils2 as u,
316
490
  yxFecth as y
317
491
  };
Binary file
package/lib/index.es3.js CHANGED
@@ -1,13 +1,8 @@
1
1
  import "./index.es11.js";
2
2
  import "element-plus";
3
- import "element-plus/es/components/message/style/index";
4
- import { g as getGroupListApi, a as getResourceListApi } from "./index.es13.js";
5
- import "element-plus/es/components/message-box/style/index";
6
3
  import "./vendor-dayjs.es.js";
7
- import "element-plus/es/components/loading/style/index";
8
- import "element-plus/es/components/message/style/css";
9
- import "element-plus/es/components/loading/style/css";
10
4
  import "./vendor-mqtt.es.js";
5
+ import { g as getGroupListApi, a as getResourceListApi } from "./index.es13.js";
11
6
  const ICON_GROUP_NAME = "yxIcon";
12
7
  const initYxIcon = () => {
13
8
  getYxIconGroupUuid();
package/lib/index.es5.js CHANGED
@@ -9,37 +9,19 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var _elId;
11
11
  import { g as getCommentUntreatedCount, b as getUserThemeList } from "./index.es4.js";
12
- import { defineComponent, useSlots, useAttrs, ref, onMounted, nextTick, watch, onBeforeMount, createBlock, openBlock, resolveDynamicComponent, createVNode, Fragment, resolveComponent, mergeProps, withDirectives, withModifiers, isVNode, h, createApp, reactive, createElementBlock, createElementVNode, createTextVNode, unref, getCurrentInstance, onUnmounted, createStaticVNode, toDisplayString, vShow, Transition, withCtx, normalizeClass, createCommentVNode, normalizeStyle, renderList, useCssVars, version, onActivated, onDeactivated, renderSlot } from "vue";
12
+ import { defineComponent, useSlots, useAttrs, ref, onMounted, nextTick, watch, onBeforeMount, createBlock, openBlock, resolveDynamicComponent, createVNode, Fragment, resolveComponent, mergeProps, withDirectives, withModifiers, isVNode, h, createApp, reactive, createElementBlock, createElementVNode, createTextVNode, unref, getCurrentInstance, onUnmounted, computed, createStaticVNode, toDisplayString, vShow, Transition, withCtx, normalizeClass, createCommentVNode, normalizeStyle, renderList, useCssVars, version, onActivated, onDeactivated, renderSlot } from "vue";
13
13
  import * as XLSX from "xlsx";
14
14
  import "./vendor-file-saver.es.js";
15
15
  import "xlsx-js-style";
16
16
  import { S as Sortable } from "./vendor-sortablejs.es.js";
17
17
  import ElementPlus, { ElMessageBox, ElDialog, ElButton, ElMessage, ElIcon, ElDropdown, ElDropdownMenu, ElDropdownItem, ElPopover, ElCheckbox, ElScrollbar, ElCheckboxGroup, ElTooltip, ElDivider } from "element-plus";
18
- import "element-plus/es/components/divider/style/index";
19
- import "element-plus/es/components/tooltip/style/index";
20
- import "element-plus/es/components/dropdown/style/index";
21
- import "element-plus/es/components/dropdown-menu/style/index";
22
- import "element-plus/es/components/dropdown-item/style/index";
23
- import "element-plus/es/components/icon/style/index";
24
- import "element-plus/es/components/popover/style/index";
25
- import "element-plus/es/components/scrollbar/style/index";
26
- import "element-plus/es/components/checkbox-group/style/index";
27
- import "element-plus/es/components/checkbox/style/index";
28
- import "element-plus/es/components/button/style/index";
29
18
  import { f as changeSystemConfig, i as getSystemConfig, a as http, B as BC_LANG_NAME, k as BC_THEME_NAME, y as yxSubscribe, l as setSystemConfig, m as getUserSystemConfig } from "./index.es11.js";
30
19
  import { d as deepClone, i as isColorEqual } from "./index.es12.js";
31
- import "element-plus/es/components/message/style/index";
32
- import "element-plus/es/components/loading/style/index";
33
- import "element-plus/es/components/message/style/css";
34
- import "element-plus/es/components/loading/style/css";
35
20
  import "./vendor-mqtt.es.js";
21
+ import { _ } from "./vendor-lodash.es.js";
36
22
  import { l as localforage } from "./vendor-localforage.es.js";
37
- import "element-plus/es/components/message-box/style/index";
38
23
  import { d as dayjs } from "./vendor-dayjs.es.js";
39
- import { _ } from "./vendor-lodash.es.js";
40
24
  import "./index.es7.js";
41
- import "element-plus/es/components/dialog/style/index";
42
- import "element-plus/es/components/drawer/style/index";
43
25
  const YX_TITLE = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}";
44
26
  const YX_SP_TITLE = "@font-face { font-family: 'YX-SP-TITLE'; font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff2');font-style: normal; font-display: swap}";
45
27
  const YX_TEXT = "@font-face {font-family: 'YX-TEXT'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff2'); font-style: normal; font-display: swap;}";
@@ -61,7 +43,8 @@ const defaultConfig = {
61
43
  systemKey: "",
62
44
  isTranslateApi: false,
63
45
  whitelistTranslateApi: [],
64
- autoGetSystemConfig: true
46
+ autoGetSystemConfig: true,
47
+ autoListenMissFileReload: true
65
48
  };
66
49
  const exportToExcel = ({ header, tableData, fileName }) => {
67
50
  const tHeader = header.map((col) => col.label);
@@ -407,7 +390,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
407
390
  "total": pageInfo.total,
408
391
  "onSizeChange": handleSizeChange,
409
392
  "onCurrentChange": handleCurrentChange,
410
- "pager-count": ((_a = pageInfo == null ? void 0 : pageInfo.config) == null ? void 0 : _a["pager-count"]) ?? 6
393
+ "pager-count": ((_a = pageInfo == null ? void 0 : pageInfo.config) == null ? void 0 : _a["pager-count"]) ?? 7
411
394
  }, pageInfo.config), null)]);
412
395
  };
413
396
  if (!columns.value) return;
@@ -1423,7 +1406,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1423
1406
  const initialData = {};
1424
1407
  const fillFormData = (item) => {
1425
1408
  if (item.prop && !(item.prop in initialData)) {
1426
- initialData[item.prop] = void 0;
1409
+ _.set(initialData, item.prop, void 0);
1427
1410
  }
1428
1411
  if (isOptionsComponent(item == null ? void 0 : item.renderType)) {
1429
1412
  loadOptions2(item);
@@ -1440,7 +1423,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1440
1423
  if (!item.prop) continue;
1441
1424
  const isAsyncOption = ((_a = item.config) == null ? void 0 : _a.loadOptions) && typeof item.config.loadOptions === "function";
1442
1425
  if (!(isAsyncOption && formParams[item.prop] !== void 0)) {
1443
- formData.value[item.prop] = formParams[item.prop];
1426
+ _.set(formData.value, item.prop, formParams[item.prop]);
1444
1427
  }
1445
1428
  }
1446
1429
  } else {
@@ -1498,8 +1481,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1498
1481
  const parentValue = parentProp ? formParams == null ? void 0 : formParams[parentProp] : void 0;
1499
1482
  try {
1500
1483
  config2.options = await loadOptions3(parentValue);
1501
- if (prop && (formParams == null ? void 0 : formParams[prop])) {
1502
- formData.value[prop] = formParams[prop];
1484
+ if (prop && _.get(formParams, prop)) {
1485
+ _.set(formData.value, prop, _.get(formParams, prop));
1503
1486
  }
1504
1487
  } catch (err) {
1505
1488
  }
@@ -1591,10 +1574,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1591
1574
  options,
1592
1575
  ...conf
1593
1576
  } = config2 || {};
1577
+ const computedValue = computed({
1578
+ get: () => _.get(formData.value, prop),
1579
+ set: (value) => _.set(formData.value, prop, value)
1580
+ });
1594
1581
  if (renderType === "cascader") return createVNode(resolveComponent("el-cascader"), mergeProps(event, conf, {
1595
1582
  "options": options,
1596
- "modelValue": formData.value[prop],
1597
- "onUpdate:modelValue": ($event) => formData.value[prop] = $event,
1583
+ "modelValue": computedValue.value,
1584
+ "onUpdate:modelValue": ($event) => computedValue.value = $event,
1598
1585
  "placeholder": `请选择${label}`
1599
1586
  }), null);
1600
1587
  const Component = resolveComponent("el-" + renderType);
@@ -1617,8 +1604,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1617
1604
  return createVNode(Component, mergeProps(event, {
1618
1605
  "placeholder": `请${isSelect ? "选择" : "输入"}${label}`
1619
1606
  }, conf, {
1620
- "modelValue": formData.value[prop],
1621
- "onUpdate:modelValue": ($event) => formData.value[prop] = $event
1607
+ "modelValue": computedValue.value,
1608
+ "onUpdate:modelValue": ($event) => computedValue.value = $event
1622
1609
  }), _isSlot$1(_slot = renderChildComponent()) ? _slot : {
1623
1610
  default: () => [_slot]
1624
1611
  });
@@ -1734,7 +1721,7 @@ const _export_sfc = (sfc, props) => {
1734
1721
  }
1735
1722
  return target;
1736
1723
  };
1737
- const YxForm = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4548eea9"]]);
1724
+ const YxForm = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-f836a157"]]);
1738
1725
  function _isSlot(s) {
1739
1726
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1740
1727
  }
@@ -3077,11 +3064,13 @@ const install = async (config2) => {
3077
3064
  config2 = { ...defaultConfig, ...config2 };
3078
3065
  let themeId = getCurTheme();
3079
3066
  try {
3067
+ handleListenMissFile(config2);
3080
3068
  await handleSystemConfig(config2);
3081
3069
  const { data } = await http.get(config2 == null ? void 0 : config2.themeApiUrl, {}, { headers: { noLoading: true } });
3082
3070
  window["YX_THEME_LIST"] = data;
3083
3071
  if (config2.isRenderLang && config2.systemKey) {
3084
3072
  const lang2 = await getLang();
3073
+ changeSystemConfig("lang", lang2);
3085
3074
  await initTranslate({ to: lang2 ? lang2 : config2.lang, systemKey: config2.systemKey });
3086
3075
  }
3087
3076
  if (config2.isRenderToolbar) {
@@ -3121,6 +3110,26 @@ const handleSystemConfig = async (options) => {
3121
3110
  }
3122
3111
  }
3123
3112
  };
3113
+ const handleListenMissFile = (options) => {
3114
+ if (!options.autoListenMissFileReload) return;
3115
+ let originUrl = window.location.href;
3116
+ let hasRefreshed = false;
3117
+ window.addEventListener("unhandledrejection", (event) => {
3118
+ if (event.reason && event.reason.message && event.reason.message.includes("Failed to fetch dynamically imported module")) {
3119
+ if (hasRefreshed) return;
3120
+ hasRefreshed = true;
3121
+ ElMessage.warning("软件已更新,即将刷新页面");
3122
+ setTimeout(() => {
3123
+ if (window.parent !== window) {
3124
+ window.location.href = originUrl;
3125
+ window.location.reload();
3126
+ } else {
3127
+ window.location.reload();
3128
+ }
3129
+ }, 1e3);
3130
+ }
3131
+ });
3132
+ };
3124
3133
  const initTtcFont = () => {
3125
3134
  const style = document.createElement("style");
3126
3135
  style.innerHTML = ttcFontFamily;
Binary file
package/lib/index.es6.js CHANGED
@@ -4,14 +4,10 @@ import "xlsx";
4
4
  import "./vendor-file-saver.es.js";
5
5
  import "xlsx-js-style";
6
6
  import "./vendor-sortablejs.es.js";
7
+ import "./vendor-lodash.es.js";
7
8
  import { genFileId } from "element-plus";
8
9
  import { j as jumpToHome, b as setGlobalSystemConfig, d as getGlobalSystemConfig } from "./index.es11.js";
9
- import "element-plus/es/components/message/style/index";
10
- import "element-plus/es/components/message-box/style/index";
11
10
  import "./vendor-dayjs.es.js";
12
- import "element-plus/es/components/loading/style/index";
13
- import "element-plus/es/components/message/style/css";
14
- import "element-plus/es/components/loading/style/css";
15
11
  import "./vendor-mqtt.es.js";
16
12
  import { u as uploadResourceApi } from "./index.es13.js";
17
13
  const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
Binary file
package/lib/index.es7.js CHANGED
@@ -1,12 +1,7 @@
1
1
  import { createI18n } from "vue-i18n";
2
2
  import { i as getSystemConfig } from "./index.es11.js";
3
3
  import "element-plus";
4
- import "element-plus/es/components/message/style/index";
5
- import "element-plus/es/components/message-box/style/index";
6
4
  import "./vendor-dayjs.es.js";
7
- import "element-plus/es/components/loading/style/index";
8
- import "element-plus/es/components/message/style/css";
9
- import "element-plus/es/components/loading/style/css";
10
5
  import "./vendor-mqtt.es.js";
11
6
  const messages = {};
12
7
  window.lang = getSystemConfig("lang");
package/lib/index.es9.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { b as useConfirm, c as useDialog, d as useMessage, u as useTime } from "./index.es5.js";
2
2
  import ElementPlus, { ElDrawer, ElButton } from "element-plus";
3
3
  import { ref, defineComponent, h, createApp } from "vue";
4
- import "element-plus/es/components/drawer/style/index";
5
- import "element-plus/es/components/button/style/index";
6
4
  const diaConfig = {
7
5
  width: "30%",
8
6
  showFooter: true,
package/lib/theme.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs5.js");require("./index.cjs4.js"),require("vue"),require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style"),require("./vendor-sortablejs.cjs.js"),require("element-plus"),require("./index.cjs11.js"),require("./index.cjs12.js"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js"),require("./index.cjs7.js"),require("element-plus/es/components/message-box/style/index"),require("element-plus/es/components/dialog/style/index"),require("element-plus/es/components/button/style/index"),require("element-plus/es/components/drawer/style/index"),exports.changeTheme=e.changeTheme,exports.findColorByTheme=e.findColorByTheme,exports.getCurTheme=e.getCurTheme,exports.getCurThemeCssVar=e.getCurThemeCssVar,exports.getDefaultThemeUrl=e.getDefaultThemeUrl,exports.getGroupColor=e.getGroupColor,exports.install=e.install,exports.installCssVarInSystemTheme=e.installCssVarInSystemTheme,exports.saveCssVar=e.saveCssVar,exports.setCssVar=e.setCssVar,exports.updateTheme=e.updateTheme;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs5.js");require("./index.cjs4.js"),require("vue"),require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style"),require("./vendor-sortablejs.cjs.js"),require("./vendor-lodash.cjs.js"),require("element-plus"),require("./index.cjs11.js"),require("./index.cjs12.js"),require("./vendor-mqtt.cjs.js"),require("./index.cjs7.js"),exports.changeTheme=e.changeTheme,exports.findColorByTheme=e.findColorByTheme,exports.getCurTheme=e.getCurTheme,exports.getCurThemeCssVar=e.getCurThemeCssVar,exports.getDefaultThemeUrl=e.getDefaultThemeUrl,exports.getGroupColor=e.getGroupColor,exports.install=e.install,exports.installCssVarInSystemTheme=e.installCssVarInSystemTheme,exports.saveCssVar=e.saveCssVar,exports.setCssVar=e.setCssVar,exports.updateTheme=e.updateTheme;
package/lib/theme.es.js CHANGED
@@ -5,19 +5,12 @@ import "xlsx";
5
5
  import "./vendor-file-saver.es.js";
6
6
  import "xlsx-js-style";
7
7
  import "./vendor-sortablejs.es.js";
8
+ import "./vendor-lodash.es.js";
8
9
  import "element-plus";
9
10
  import "./index.es11.js";
10
11
  import "./index.es12.js";
11
- import "element-plus/es/components/message/style/index";
12
- import "element-plus/es/components/loading/style/index";
13
- import "element-plus/es/components/message/style/css";
14
- import "element-plus/es/components/loading/style/css";
15
12
  import "./vendor-mqtt.es.js";
16
13
  import "./index.es7.js";
17
- import "element-plus/es/components/message-box/style/index";
18
- import "element-plus/es/components/dialog/style/index";
19
- import "element-plus/es/components/button/style/index";
20
- import "element-plus/es/components/drawer/style/index";
21
14
  export {
22
15
  v as changeTheme,
23
16
  E as findColorByTheme,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs5.js");require("./vendor-lodash.cjs.js"),require("./index.cjs11.js"),require("element-plus"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/message-box/style/index"),require("./vendor-dayjs.cjs.js"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js"),require("vue"),require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style"),require("./vendor-sortablejs.cjs.js"),require("./index.cjs7.js"),require("element-plus/es/components/dialog/style/index"),require("element-plus/es/components/button/style/index"),require("element-plus/es/components/drawer/style/index"),exports.changeLang=e.changeLang,exports.getLang=e.getLang,exports.getWordByYxI18nThesaurus=e.getWordByYxI18nThesaurus,exports.getZhWordByYxI18nThesaurus=e.getZhWordByYxI18nThesaurus,exports.handleTranslation=e.handleTranslation,exports.initTranslate=e.initTranslate,exports.loadCustomThesaurus=e.loadCustomThesaurus,exports.whitelistApi=e.whitelistApi;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs5.js");require("./vendor-lodash.cjs.js"),require("./index.cjs11.js"),require("element-plus"),require("./vendor-dayjs.cjs.js"),require("./vendor-mqtt.cjs.js"),require("vue"),require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style"),require("./vendor-sortablejs.cjs.js"),require("./index.cjs7.js"),exports.changeLang=e.changeLang,exports.getLang=e.getLang,exports.getWordByYxI18nThesaurus=e.getWordByYxI18nThesaurus,exports.getZhWordByYxI18nThesaurus=e.getZhWordByYxI18nThesaurus,exports.handleTranslation=e.handleTranslation,exports.initTranslate=e.initTranslate,exports.loadCustomThesaurus=e.loadCustomThesaurus,exports.whitelistApi=e.whitelistApi;
@@ -2,12 +2,7 @@ import { k, l, m, n, q, j, o, w } from "./index.es5.js";
2
2
  import "./vendor-lodash.es.js";
3
3
  import "./index.es11.js";
4
4
  import "element-plus";
5
- import "element-plus/es/components/message/style/index";
6
- import "element-plus/es/components/message-box/style/index";
7
5
  import "./vendor-dayjs.es.js";
8
- import "element-plus/es/components/loading/style/index";
9
- import "element-plus/es/components/message/style/css";
10
- import "element-plus/es/components/loading/style/css";
11
6
  import "./vendor-mqtt.es.js";
12
7
  import "vue";
13
8
  import "xlsx";
@@ -15,9 +10,6 @@ import "./vendor-file-saver.es.js";
15
10
  import "xlsx-js-style";
16
11
  import "./vendor-sortablejs.es.js";
17
12
  import "./index.es7.js";
18
- import "element-plus/es/components/dialog/style/index";
19
- import "element-plus/es/components/button/style/index";
20
- import "element-plus/es/components/drawer/style/index";
21
13
  export {
22
14
  k as changeLang,
23
15
  l as getLang,