@ganwei-web/gw-base-components-plus 1.0.24 → 1.0.26
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/element-plus-adapter/dist/ElementPlusAdapter.cjs +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.css +24 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.js +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -1
- package/equip-list-vue2/dist/index.es.js +1173 -415
- package/equip-list-vue2/dist/index.umd.js +6 -1
- package/equip-list-vue3/dist/index.es.js +2964 -609
- package/equip-list-vue3/dist/index.umd.js +6 -1
- package/equipProcessing/dist/index.es.js +49 -13
- package/equipProcessing/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,45 +1,668 @@
|
|
|
1
|
-
import { createBlock as
|
|
2
|
-
import I from "vue3-virtual-scroll-list";
|
|
3
|
-
import * as T from "@aspnet/signalr";
|
|
1
|
+
import { computed as lt, createBlock as se, createCommentVNode as M, createElementBlock as T, createElementVNode as A, createTextVNode as we, createVNode as C, defineComponent as qe, mergeProps as dt, normalizeClass as Ae, normalizeStyle as Se, onActivated as ct, onBeforeMount as ut, onMounted as Ve, onUnmounted as Je, onUpdated as ht, openBlock as E, ref as W, resolveComponent as x, toDisplayString as K, toHandlers as pt, watch as ee, withCtx as G, withModifiers as ne } from "vue";
|
|
4
2
|
|
|
5
3
|
import "./style.css";
|
|
6
|
-
|
|
4
|
+
function $e(n, e) {
|
|
5
|
+
let t = Object.keys(n);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
let i = Object.getOwnPropertySymbols(n);
|
|
8
|
+
e && (i = i.filter(function(s) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(n, s).enumerable;
|
|
10
|
+
})), t.push.apply(t, i);
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function te(n) {
|
|
15
|
+
for (let e = 1; e < arguments.length; e++) {
|
|
16
|
+
var t = arguments[e] != null ? arguments[e] : {};
|
|
17
|
+
e % 2 ? $e(Object(t), !0).forEach(function(i) {
|
|
18
|
+
bt(n, i, t[i]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : $e(Object(t)).forEach(function(i) {
|
|
20
|
+
Object.defineProperty(n, i, Object.getOwnPropertyDescriptor(t, i));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
function ft(n, e) {
|
|
26
|
+
if (!(n instanceof e)) { throw new TypeError("Cannot call a class as a function"); }
|
|
27
|
+
}
|
|
28
|
+
function Le(n, e) {
|
|
29
|
+
for (let t = 0; t < e.length; t++) {
|
|
30
|
+
let i = e[t];
|
|
31
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, i.key, i);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function gt(n, e, t) {
|
|
35
|
+
return e && Le(n.prototype, e), t && Le(n, t), n;
|
|
36
|
+
}
|
|
37
|
+
function bt(n, e, t) {
|
|
38
|
+
return e in n ? Object.defineProperty(n, e, {
|
|
39
|
+
value: t,
|
|
40
|
+
enumerable: !0,
|
|
41
|
+
configurable: !0,
|
|
42
|
+
writable: !0
|
|
43
|
+
}) : n[e] = t, n;
|
|
44
|
+
}
|
|
45
|
+
function wt(n) {
|
|
46
|
+
return St(n) || vt(n) || yt(n) || mt();
|
|
47
|
+
}
|
|
48
|
+
function St(n) {
|
|
49
|
+
if (Array.isArray(n)) { return me(n); }
|
|
50
|
+
}
|
|
51
|
+
function vt(n) {
|
|
52
|
+
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) { return Array.from(n); }
|
|
53
|
+
}
|
|
54
|
+
function yt(n, e) {
|
|
55
|
+
if (n) {
|
|
56
|
+
if (typeof n == "string") { return me(n, e); }
|
|
57
|
+
let t = Object.prototype.toString.call(n).slice(8, -1);
|
|
58
|
+
if (t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set") { return Array.from(n); }
|
|
59
|
+
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) { return me(n, e); }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function me(n, e) {
|
|
63
|
+
(e == null || e > n.length) && (e = n.length);
|
|
64
|
+
for (var t = 0, i = new Array(e); t < e; t++) { i[t] = n[t]; }
|
|
65
|
+
return i;
|
|
66
|
+
}
|
|
67
|
+
function mt() {
|
|
68
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
69
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
70
|
+
}
|
|
71
|
+
let P = {
|
|
72
|
+
FRONT: "FRONT",
|
|
73
|
+
// scroll up or left
|
|
74
|
+
BEHIND: "BEHIND"
|
|
75
|
+
// scroll down or right
|
|
76
|
+
}, I = {
|
|
77
|
+
INIT: "INIT",
|
|
78
|
+
FIXED: "FIXED",
|
|
79
|
+
DYNAMIC: "DYNAMIC"
|
|
80
|
+
}, Re = 2, Ct = /* @__PURE__ */ (function() {
|
|
81
|
+
function n(e, t) {
|
|
82
|
+
ft(this, n), this.init(e, t);
|
|
83
|
+
}
|
|
84
|
+
return gt(n, [{
|
|
85
|
+
key: "init",
|
|
86
|
+
value: function(t, i) {
|
|
87
|
+
this.param = t, this.callUpdate = i, this.sizes = /* @__PURE__ */ new Map(), this.firstRangeTotalSize = 0, this.firstRangeAverageSize = 0, this.lastCalcIndex = 0, this.fixedSizeValue = 0, this.calcType = I.INIT, this.offset = 0, this.direction = "", this.range = /* @__PURE__ */ Object.create(null), t && this.checkRange(0, t.keeps - 1);
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "destroy",
|
|
91
|
+
value: function() {
|
|
92
|
+
this.init(null, null);
|
|
93
|
+
}
|
|
94
|
+
// return current render range
|
|
95
|
+
}, {
|
|
96
|
+
key: "getRange",
|
|
97
|
+
value: function() {
|
|
98
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
99
|
+
return t.start = this.range.start, t.end = this.range.end, t.padFront = this.range.padFront, t.padBehind = this.range.padBehind, t;
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "isBehind",
|
|
103
|
+
value: function() {
|
|
104
|
+
return this.direction === P.BEHIND;
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "isFront",
|
|
108
|
+
value: function() {
|
|
109
|
+
return this.direction === P.FRONT;
|
|
110
|
+
}
|
|
111
|
+
// return start index offset
|
|
112
|
+
}, {
|
|
113
|
+
key: "getOffset",
|
|
114
|
+
value: function(t) {
|
|
115
|
+
return (t < 1 ? 0 : this.getIndexOffset(t)) + this.param.slotHeaderSize;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "updateParam",
|
|
119
|
+
value: function(t, i) {
|
|
120
|
+
let s = this;
|
|
121
|
+
this.param && t in this.param && (t === "uniqueIds" && this.sizes.forEach(function(r, a) {
|
|
122
|
+
i.includes(a) || s.sizes.delete(a);
|
|
123
|
+
}), this.param[t] = i);
|
|
124
|
+
}
|
|
125
|
+
// save each size map by id
|
|
126
|
+
}, {
|
|
127
|
+
key: "saveSize",
|
|
128
|
+
value: function(t, i) {
|
|
129
|
+
this.sizes.set(t, i), this.calcType === I.INIT ? (this.fixedSizeValue = i, this.calcType = I.FIXED) : this.calcType === I.FIXED && this.fixedSizeValue !== i && (this.calcType = I.DYNAMIC, delete this.fixedSizeValue), this.calcType !== I.FIXED && typeof this.firstRangeTotalSize < "u" && (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length) ? (this.firstRangeTotalSize = wt(this.sizes.values()).reduce(function(s, r) {
|
|
130
|
+
return s + r;
|
|
131
|
+
}, 0), this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)) : delete this.firstRangeTotalSize);
|
|
132
|
+
}
|
|
133
|
+
// in some special situation (e.g. length change) we need to update in a row
|
|
134
|
+
// try goiong to render next range by a leading buffer according to current direction
|
|
135
|
+
}, {
|
|
136
|
+
key: "handleDataSourcesChange",
|
|
137
|
+
value: function() {
|
|
138
|
+
let t = this.range.start;
|
|
139
|
+
this.isFront() ? t = t - Re : this.isBehind() && (t = t + Re), t = Math.max(t, 0), this.updateRange(this.range.start, this.getEndByStart(t));
|
|
140
|
+
}
|
|
141
|
+
// when slot size change, we also need force update
|
|
142
|
+
}, {
|
|
143
|
+
key: "handleSlotSizeChange",
|
|
144
|
+
value: function() {
|
|
145
|
+
this.handleDataSourcesChange();
|
|
146
|
+
}
|
|
147
|
+
// calculating range on scroll
|
|
148
|
+
}, {
|
|
149
|
+
key: "handleScroll",
|
|
150
|
+
value: function(t) {
|
|
151
|
+
this.direction = t < this.offset ? P.FRONT : P.BEHIND, this.offset = t, this.param && (this.direction === P.FRONT ? this.handleFront() : this.direction === P.BEHIND && this.handleBehind());
|
|
152
|
+
}
|
|
153
|
+
// ----------- public method end -----------
|
|
154
|
+
}, {
|
|
155
|
+
key: "handleFront",
|
|
156
|
+
value: function() {
|
|
157
|
+
let t = this.getScrollOvers();
|
|
158
|
+
if (!(t > this.range.start)) {
|
|
159
|
+
let i = Math.max(t - this.param.buffer, 0);
|
|
160
|
+
this.checkRange(i, this.getEndByStart(i));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "handleBehind",
|
|
165
|
+
value: function() {
|
|
166
|
+
let t = this.getScrollOvers();
|
|
167
|
+
t < this.range.start + this.param.buffer || this.checkRange(t, this.getEndByStart(t));
|
|
168
|
+
}
|
|
169
|
+
// return the pass overs according to current scroll offset
|
|
170
|
+
}, {
|
|
171
|
+
key: "getScrollOvers",
|
|
172
|
+
value: function() {
|
|
173
|
+
let t = this.offset - this.param.slotHeaderSize;
|
|
174
|
+
if (t <= 0) { return 0; }
|
|
175
|
+
if (this.isFixedType()) { return Math.floor(t / this.fixedSizeValue); }
|
|
176
|
+
for (var i = 0, s = 0, r = 0, a = this.param.uniqueIds.length; i <= a;) {
|
|
177
|
+
if (s = i + Math.floor((a - i) / 2), r = this.getIndexOffset(s), r === t) { return s; }
|
|
178
|
+
r < t ? i = s + 1 : r > t && (a = s - 1);
|
|
179
|
+
}
|
|
180
|
+
return i > 0 ? --i : 0;
|
|
181
|
+
}
|
|
182
|
+
// return a scroll offset from given index, can efficiency be improved more here?
|
|
183
|
+
// although the call frequency is very high, its only a superposition of numbers
|
|
184
|
+
}, {
|
|
185
|
+
key: "getIndexOffset",
|
|
186
|
+
value: function(t) {
|
|
187
|
+
if (!t) { return 0; }
|
|
188
|
+
for (var i = 0, s = 0, r = 0; r < t; r++) { s = this.sizes.get(this.param.uniqueIds[r]), i = i + (typeof s == "number" ? s : this.getEstimateSize()); }
|
|
189
|
+
return this.lastCalcIndex = Math.max(this.lastCalcIndex, t - 1), this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex()), i;
|
|
190
|
+
}
|
|
191
|
+
// is fixed size type
|
|
192
|
+
}, {
|
|
193
|
+
key: "isFixedType",
|
|
194
|
+
value: function() {
|
|
195
|
+
return this.calcType === I.FIXED;
|
|
196
|
+
}
|
|
197
|
+
// return the real last index
|
|
198
|
+
}, {
|
|
199
|
+
key: "getLastIndex",
|
|
200
|
+
value: function() {
|
|
201
|
+
return this.param.uniqueIds.length - 1;
|
|
202
|
+
}
|
|
203
|
+
// in some conditions range is broke, we need correct it
|
|
204
|
+
// and then decide whether need update to next range
|
|
205
|
+
}, {
|
|
206
|
+
key: "checkRange",
|
|
207
|
+
value: function(t, i) {
|
|
208
|
+
let s = this.param.keeps, r = this.param.uniqueIds.length;
|
|
209
|
+
r <= s ? (t = 0, i = this.getLastIndex()) : i - t < s - 1 && (t = i - s + 1), this.range.start !== t && this.updateRange(t, i);
|
|
210
|
+
}
|
|
211
|
+
// setting to a new range and rerender
|
|
212
|
+
}, {
|
|
213
|
+
key: "updateRange",
|
|
214
|
+
value: function(t, i) {
|
|
215
|
+
this.range.start = t, this.range.end = i, this.range.padFront = this.getPadFront(), this.range.padBehind = this.getPadBehind(), this.callUpdate(this.getRange());
|
|
216
|
+
}
|
|
217
|
+
// return end base on start
|
|
218
|
+
}, {
|
|
219
|
+
key: "getEndByStart",
|
|
220
|
+
value: function(t) {
|
|
221
|
+
let i = t + this.param.keeps - 1, s = Math.min(i, this.getLastIndex());
|
|
222
|
+
return s;
|
|
223
|
+
}
|
|
224
|
+
// return total front offset
|
|
225
|
+
}, {
|
|
226
|
+
key: "getPadFront",
|
|
227
|
+
value: function() {
|
|
228
|
+
return this.isFixedType() ? this.fixedSizeValue * this.range.start : this.getIndexOffset(this.range.start);
|
|
229
|
+
}
|
|
230
|
+
// return total behind offset
|
|
231
|
+
}, {
|
|
232
|
+
key: "getPadBehind",
|
|
233
|
+
value: function() {
|
|
234
|
+
let t = this.range.end, i = this.getLastIndex();
|
|
235
|
+
return this.isFixedType() ? (i - t) * this.fixedSizeValue : this.lastCalcIndex === i ? this.getIndexOffset(i) - this.getIndexOffset(t) : (i - t) * this.getEstimateSize();
|
|
236
|
+
}
|
|
237
|
+
// get the item estimate size
|
|
238
|
+
}, {
|
|
239
|
+
key: "getEstimateSize",
|
|
240
|
+
value: function() {
|
|
241
|
+
return this.isFixedType() ? this.fixedSizeValue : this.firstRangeAverageSize || this.param.estimateSize;
|
|
242
|
+
}
|
|
243
|
+
}]), n;
|
|
244
|
+
})(), kt = {
|
|
245
|
+
dataKey: {
|
|
246
|
+
type: [String, Function],
|
|
247
|
+
required: !0
|
|
248
|
+
},
|
|
249
|
+
dataSources: {
|
|
250
|
+
type: Array,
|
|
251
|
+
required: !0,
|
|
252
|
+
default: function() {
|
|
253
|
+
return [];
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
dataComponent: {
|
|
257
|
+
type: [Object, Function],
|
|
258
|
+
required: !0
|
|
259
|
+
},
|
|
260
|
+
keeps: {
|
|
261
|
+
type: Number,
|
|
262
|
+
default: 30
|
|
263
|
+
},
|
|
264
|
+
extraProps: {
|
|
265
|
+
type: Object
|
|
266
|
+
},
|
|
267
|
+
estimateSize: {
|
|
268
|
+
type: Number,
|
|
269
|
+
default: 50
|
|
270
|
+
},
|
|
271
|
+
direction: {
|
|
272
|
+
type: String,
|
|
273
|
+
default: "vertical"
|
|
274
|
+
// the other value is horizontal
|
|
275
|
+
},
|
|
276
|
+
start: {
|
|
277
|
+
type: Number,
|
|
278
|
+
default: 0
|
|
279
|
+
},
|
|
280
|
+
offset: {
|
|
281
|
+
type: Number,
|
|
282
|
+
default: 0
|
|
283
|
+
},
|
|
284
|
+
topThreshold: {
|
|
285
|
+
type: Number,
|
|
286
|
+
default: 0
|
|
287
|
+
},
|
|
288
|
+
bottomThreshold: {
|
|
289
|
+
type: Number,
|
|
290
|
+
default: 0
|
|
291
|
+
},
|
|
292
|
+
pageMode: {
|
|
293
|
+
type: Boolean,
|
|
294
|
+
default: !1
|
|
295
|
+
},
|
|
296
|
+
rootTag: {
|
|
297
|
+
type: String,
|
|
298
|
+
default: "div"
|
|
299
|
+
},
|
|
300
|
+
wrapTag: {
|
|
301
|
+
type: String,
|
|
302
|
+
default: "div"
|
|
303
|
+
},
|
|
304
|
+
wrapClass: {
|
|
305
|
+
type: String,
|
|
306
|
+
default: "wrap"
|
|
307
|
+
},
|
|
308
|
+
wrapStyle: {
|
|
309
|
+
type: Object
|
|
310
|
+
},
|
|
311
|
+
itemTag: {
|
|
312
|
+
type: String,
|
|
313
|
+
default: "div"
|
|
314
|
+
},
|
|
315
|
+
itemClass: {
|
|
316
|
+
type: String,
|
|
317
|
+
default: ""
|
|
318
|
+
},
|
|
319
|
+
itemClassAdd: {
|
|
320
|
+
type: Function
|
|
321
|
+
},
|
|
322
|
+
itemStyle: {
|
|
323
|
+
type: Object
|
|
324
|
+
},
|
|
325
|
+
headerTag: {
|
|
326
|
+
type: String,
|
|
327
|
+
default: "div"
|
|
328
|
+
},
|
|
329
|
+
headerClass: {
|
|
330
|
+
type: String,
|
|
331
|
+
default: ""
|
|
332
|
+
},
|
|
333
|
+
headerStyle: {
|
|
334
|
+
type: Object
|
|
335
|
+
},
|
|
336
|
+
footerTag: {
|
|
337
|
+
type: String,
|
|
338
|
+
default: "div"
|
|
339
|
+
},
|
|
340
|
+
footerClass: {
|
|
341
|
+
type: String,
|
|
342
|
+
default: ""
|
|
343
|
+
},
|
|
344
|
+
footerStyle: {
|
|
345
|
+
type: Object
|
|
346
|
+
},
|
|
347
|
+
itemScopedSlots: {
|
|
348
|
+
type: Object
|
|
349
|
+
}
|
|
350
|
+
}, Et = {
|
|
351
|
+
index: {
|
|
352
|
+
type: Number
|
|
353
|
+
},
|
|
354
|
+
event: {
|
|
355
|
+
type: String
|
|
356
|
+
},
|
|
357
|
+
tag: {
|
|
358
|
+
type: String
|
|
359
|
+
},
|
|
360
|
+
horizontal: {
|
|
361
|
+
type: Boolean
|
|
362
|
+
},
|
|
363
|
+
source: {
|
|
364
|
+
type: Object
|
|
365
|
+
},
|
|
366
|
+
component: {
|
|
367
|
+
type: [Object, Function]
|
|
368
|
+
},
|
|
369
|
+
uniqueKey: {
|
|
370
|
+
type: [String, Number]
|
|
371
|
+
},
|
|
372
|
+
extraProps: {
|
|
373
|
+
type: Object
|
|
374
|
+
},
|
|
375
|
+
scopedSlots: {
|
|
376
|
+
type: Object
|
|
377
|
+
}
|
|
378
|
+
}, qt = {
|
|
379
|
+
event: {
|
|
380
|
+
type: String
|
|
381
|
+
},
|
|
382
|
+
uniqueKey: {
|
|
383
|
+
type: String
|
|
384
|
+
},
|
|
385
|
+
tag: {
|
|
386
|
+
type: String
|
|
387
|
+
},
|
|
388
|
+
horizontal: {
|
|
389
|
+
type: Boolean
|
|
390
|
+
}
|
|
391
|
+
}, Xe = function(e, t, i) {
|
|
392
|
+
let s = null, r = lt(function() {
|
|
393
|
+
return e.horizontal ? "offsetWidth" : "offsetHeight";
|
|
394
|
+
}), a = function() {
|
|
395
|
+
return t.value ? t.value[r.value] : 0;
|
|
396
|
+
}, c = function() {
|
|
397
|
+
let o = e.event, l = e.uniqueKey, d = e.hasInitial;
|
|
398
|
+
i(o, l, a(), d);
|
|
399
|
+
};
|
|
400
|
+
Ve(function() {
|
|
401
|
+
typeof ResizeObserver < "u" && (s = new ResizeObserver(function() {
|
|
402
|
+
c();
|
|
403
|
+
}), t.value && s.observe(t.value));
|
|
404
|
+
}), ht(function() {
|
|
405
|
+
c();
|
|
406
|
+
}), Je(function() {
|
|
407
|
+
s && (s.disconnect(), s = null);
|
|
408
|
+
});
|
|
409
|
+
}, Tt = qe({
|
|
410
|
+
name: "VirtualListItem",
|
|
411
|
+
props: Et,
|
|
412
|
+
emits: ["itemResize"],
|
|
413
|
+
setup: function(e, t) {
|
|
414
|
+
let i = t.emit, s = W(null);
|
|
415
|
+
return Xe(e, s, i), function() {
|
|
416
|
+
let r = e.tag, a = e.component, c = e.extraProps, u = c === void 0 ? {} : c, o = e.index, l = e.source, d = e.scopedSlots, f = d === void 0 ? {} : d, z = e.uniqueKey, B = te(te({}, u), {}, {
|
|
417
|
+
source: l,
|
|
418
|
+
index: o
|
|
419
|
+
});
|
|
420
|
+
return C(r, {
|
|
421
|
+
key: z,
|
|
422
|
+
ref: s
|
|
423
|
+
}, {
|
|
424
|
+
default: function() {
|
|
425
|
+
return [C(a, te(te({}, B), {}, {
|
|
426
|
+
scopedSlots: f
|
|
427
|
+
}), null)];
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}), ze = qe({
|
|
433
|
+
name: "VirtualListSlot",
|
|
434
|
+
props: qt,
|
|
435
|
+
emits: ["slotResize"],
|
|
436
|
+
setup: function(e, t) {
|
|
437
|
+
let i = t.slots, s = t.emit, r = W(null);
|
|
438
|
+
return Xe(e, r, s), function() {
|
|
439
|
+
let a, c = e.tag, u = e.uniqueKey;
|
|
440
|
+
return C(c, {
|
|
441
|
+
ref: r,
|
|
442
|
+
key: u
|
|
443
|
+
}, {
|
|
444
|
+
default: function() {
|
|
445
|
+
return [(a = i.default) === null || a === void 0 ? void 0 : a.call(i)];
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
}), V;
|
|
451
|
+
(function(n) {
|
|
452
|
+
n.ITEM = "itemResize", n.SLOT = "slotResize";
|
|
453
|
+
})(V || (V = {}));
|
|
454
|
+
let $;
|
|
455
|
+
(function(n) {
|
|
456
|
+
n.HEADER = "thead", n.FOOTER = "tfoot";
|
|
457
|
+
})($ || ($ = {}));
|
|
458
|
+
let Ot = qe({
|
|
459
|
+
name: "VirtualList",
|
|
460
|
+
props: kt,
|
|
461
|
+
setup: function(e, t) {
|
|
462
|
+
let i = t.emit, s = t.slots, r = t.expose, a = e.direction === "horizontal", c = a ? "scrollLeft" : "scrollTop", u = W(null), o = W(), l = W(null), d;
|
|
463
|
+
ee(function() {
|
|
464
|
+
return e.dataSources.length;
|
|
465
|
+
}, function() {
|
|
466
|
+
d.updateParam("uniqueIds", Me()), d.handleDataSourcesChange();
|
|
467
|
+
}), ee(function() {
|
|
468
|
+
return e.keeps;
|
|
469
|
+
}, function(g) {
|
|
470
|
+
d.updateParam("keeps", g), d.handleSlotSizeChange();
|
|
471
|
+
}), ee(function() {
|
|
472
|
+
return e.start;
|
|
473
|
+
}, function(g) {
|
|
474
|
+
he(g);
|
|
475
|
+
}), ee(function() {
|
|
476
|
+
return e.offset;
|
|
477
|
+
}, function(g) {
|
|
478
|
+
return j(g);
|
|
479
|
+
});
|
|
480
|
+
var f = function(p) {
|
|
481
|
+
return d.sizes.get(p);
|
|
482
|
+
}, z = function() {
|
|
483
|
+
return e.pageMode ? document.documentElement[c] || document.body[c] : o.value ? Math.ceil(o.value[c]) : 0;
|
|
484
|
+
}, B = function() {
|
|
485
|
+
let p = a ? "clientWidth" : "clientHeight";
|
|
486
|
+
return e.pageMode ? document.documentElement[p] || document.body[p] : o.value ? Math.ceil(o.value[p]) : 0;
|
|
487
|
+
}, Y = function() {
|
|
488
|
+
let p = a ? "scrollWidth" : "scrollHeight";
|
|
489
|
+
return e.pageMode ? document.documentElement[p] || document.body[p] : o.value ? Math.ceil(o.value[p]) : 0;
|
|
490
|
+
}, tt = function(p, b, m, k) {
|
|
491
|
+
i("scroll", k, d.getRange()), d.isFront() && e.dataSources.length && p - e.topThreshold <= 0 ? i("totop") : d.isBehind() && p + b + e.bottomThreshold >= m && i("tobottom");
|
|
492
|
+
}, le = function(p) {
|
|
493
|
+
let b = z(), m = B(), k = Y();
|
|
494
|
+
b < 0 || b + m > k + 1 || !k || (d.handleScroll(b), tt(b, m, k, p));
|
|
495
|
+
}, Me = function() {
|
|
496
|
+
let p = e.dataKey, b = e.dataSources, m = b === void 0 ? [] : b;
|
|
497
|
+
return m.map(function(k) {
|
|
498
|
+
return typeof p == "function" ? p(k) : k[p];
|
|
499
|
+
});
|
|
500
|
+
}, it = function(p) {
|
|
501
|
+
u.value = p;
|
|
502
|
+
}, nt = function() {
|
|
503
|
+
d = new Ct({
|
|
504
|
+
slotHeaderSize: 0,
|
|
505
|
+
slotFooterSize: 0,
|
|
506
|
+
keeps: e.keeps,
|
|
507
|
+
estimateSize: e.estimateSize,
|
|
508
|
+
buffer: Math.round(e.keeps / 3),
|
|
509
|
+
// recommend for a third of keeps
|
|
510
|
+
uniqueIds: Me()
|
|
511
|
+
}, it), u.value = d.getRange();
|
|
512
|
+
}, he = function(p) {
|
|
513
|
+
if (p >= e.dataSources.length - 1) { je(); } else {
|
|
514
|
+
let b = d.getOffset(p);
|
|
515
|
+
j(b);
|
|
516
|
+
}
|
|
517
|
+
}, j = function(p) {
|
|
518
|
+
e.pageMode ? (document.body[c] = p, document.documentElement[c] = p) : o.value && (o.value[c] = p);
|
|
519
|
+
}, rt = function() {
|
|
520
|
+
for (var p = [], b = u.value, m = b.start, k = b.end, de = e.dataSources, _ = e.dataKey, pe = e.itemClass, fe = e.itemTag, ge = e.itemStyle, be = e.extraProps, Q = e.dataComponent, Z = e.itemScopedSlots, q = m; q <= k; q++) {
|
|
521
|
+
let N = de[q];
|
|
522
|
+
if (N) {
|
|
523
|
+
let D = typeof _ == "function" ? _(N) : N[_];
|
|
524
|
+
typeof D == "string" || typeof D == "number" ? p.push(C(Tt, {
|
|
525
|
+
index: q,
|
|
526
|
+
tag: fe,
|
|
527
|
+
event: V.ITEM,
|
|
528
|
+
horizontal: a,
|
|
529
|
+
uniqueKey: D,
|
|
530
|
+
source: N,
|
|
531
|
+
extraProps: be,
|
|
532
|
+
component: Q,
|
|
533
|
+
scopedSlots: Z,
|
|
534
|
+
style: ge,
|
|
535
|
+
class: "".concat(pe).concat(e.itemClassAdd ? " " + e.itemClassAdd(q) : ""),
|
|
536
|
+
onItemResize: st
|
|
537
|
+
}, null)) : console.warn("Cannot get the data-key '".concat(_, "' from data-sources."));
|
|
538
|
+
} else { console.warn("Cannot get the index '".concat(q, "' from data-sources.")); }
|
|
539
|
+
}
|
|
540
|
+
return p;
|
|
541
|
+
}, st = function(p, b) {
|
|
542
|
+
d.saveSize(p, b), i("resized", p, b);
|
|
543
|
+
}, xe = function(p, b, m) {
|
|
544
|
+
p === $.HEADER ? d.updateParam("slotHeaderSize", b) : p === $.FOOTER && d.updateParam("slotFooterSize", b), m && d.handleSlotSizeChange();
|
|
545
|
+
}, je = function g() {
|
|
546
|
+
if (l.value) {
|
|
547
|
+
let p = l.value[a ? "offsetLeft" : "offsetTop"];
|
|
548
|
+
j(p), setTimeout(function() {
|
|
549
|
+
z() + B() < Y() && g();
|
|
550
|
+
}, 3);
|
|
551
|
+
}
|
|
552
|
+
}, ot = function() {
|
|
553
|
+
if (o.value) {
|
|
554
|
+
let p = o.value.getBoundingClientRect(), b = o.value.ownerDocument.defaultView, m = a ? p.left + b.pageXOffset : p.top + b.pageYOffset;
|
|
555
|
+
d.updateParam("slotHeaderSize", m);
|
|
556
|
+
}
|
|
557
|
+
}, at = function() {
|
|
558
|
+
return d.sizes.size;
|
|
559
|
+
};
|
|
560
|
+
return ut(function() {
|
|
561
|
+
nt();
|
|
562
|
+
}), ct(function() {
|
|
563
|
+
j(d.offset);
|
|
564
|
+
}), Ve(function() {
|
|
565
|
+
e.start ? he(e.start) : e.offset && j(e.offset), e.pageMode && (ot(), document.addEventListener("scroll", le, {
|
|
566
|
+
passive: !1
|
|
567
|
+
}));
|
|
568
|
+
}), Je(function() {
|
|
569
|
+
d.destroy(), e.pageMode && document.removeEventListener("scroll", le);
|
|
570
|
+
}), r({
|
|
571
|
+
scrollToBottom: je,
|
|
572
|
+
getSizes: at,
|
|
573
|
+
getSize: f,
|
|
574
|
+
getOffset: z,
|
|
575
|
+
getScrollSize: Y,
|
|
576
|
+
getClientSize: B,
|
|
577
|
+
scrollToOffset: j,
|
|
578
|
+
scrollToIndex: he
|
|
579
|
+
}), function() {
|
|
580
|
+
let g = e.pageMode, p = e.rootTag, b = e.wrapTag, m = e.wrapClass, k = e.wrapStyle, de = e.headerTag, _ = e.headerClass, pe = e.headerStyle, fe = e.footerTag, ge = e.footerClass, be = e.footerStyle, Q = u.value, Z = Q.padFront, q = Q.padBehind, N = {
|
|
581
|
+
padding: a ? "0px ".concat(q, "px 0px ").concat(Z, "px") : "".concat(Z, "px 0px ").concat(q, "px")
|
|
582
|
+
}, D = k ? Object.assign({}, k, N) : N, _e = s.header, Ge = s.footer;
|
|
583
|
+
return C(p, {
|
|
584
|
+
ref: o,
|
|
585
|
+
onScroll: !g && le
|
|
586
|
+
}, {
|
|
587
|
+
default: function() {
|
|
588
|
+
return [_e && C(ze, {
|
|
589
|
+
class: _,
|
|
590
|
+
style: pe,
|
|
591
|
+
tag: de,
|
|
592
|
+
event: V.SLOT,
|
|
593
|
+
uniqueKey: $.HEADER,
|
|
594
|
+
onSlotResize: xe
|
|
595
|
+
}, {
|
|
596
|
+
default: function() {
|
|
597
|
+
return [_e()];
|
|
598
|
+
}
|
|
599
|
+
}), C(b, {
|
|
600
|
+
class: m,
|
|
601
|
+
style: D
|
|
602
|
+
}, {
|
|
603
|
+
default: function() {
|
|
604
|
+
return [rt()];
|
|
605
|
+
}
|
|
606
|
+
}), Ge && C(ze, {
|
|
607
|
+
class: ge,
|
|
608
|
+
style: be,
|
|
609
|
+
tag: fe,
|
|
610
|
+
event: V.SLOT,
|
|
611
|
+
uniqueKey: $.FOOTER,
|
|
612
|
+
onSlotResize: xe
|
|
613
|
+
}, {
|
|
614
|
+
default: function() {
|
|
615
|
+
return [Ge()];
|
|
616
|
+
}
|
|
617
|
+
}), C("div", {
|
|
618
|
+
ref: l,
|
|
619
|
+
style: {
|
|
620
|
+
width: a ? "0px" : "100%",
|
|
621
|
+
height: a ? "100%" : "0px"
|
|
622
|
+
}
|
|
623
|
+
}, null)];
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
class Nt {
|
|
7
630
|
// 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
|
|
8
|
-
constructor(
|
|
9
|
-
this.groupNodeObject =
|
|
631
|
+
constructor(e, t, i) {
|
|
632
|
+
this.groupNodeObject = e, this.nodesMap = t, this.controlObject = i;
|
|
10
633
|
}
|
|
11
634
|
// 增加映射
|
|
12
|
-
addNodesMap(
|
|
13
|
-
|
|
14
|
-
this.nodesMap[
|
|
635
|
+
addNodesMap(e) {
|
|
636
|
+
e && e.forEach((t) => {
|
|
637
|
+
this.nodesMap[t.key] = t;
|
|
15
638
|
});
|
|
16
639
|
}
|
|
17
640
|
// 移除映射
|
|
18
|
-
removeNodesMap(
|
|
19
|
-
|
|
20
|
-
delete this.nodesMap[
|
|
641
|
+
removeNodesMap(e) {
|
|
642
|
+
e && e.forEach((t) => {
|
|
643
|
+
delete this.nodesMap[t.key];
|
|
21
644
|
});
|
|
22
645
|
}
|
|
23
646
|
// 回收所有分组节点缓存
|
|
24
|
-
recycleAllNodeCache(
|
|
25
|
-
for (let
|
|
647
|
+
recycleAllNodeCache(e) {
|
|
648
|
+
for (let t in this.groupNodeObject) { this.groupNodeObject[t].expand = !1, this.groupNodeObject[t].count = 0, this.recycleGroupCache(this.groupNodeObject[t].key), e && delete this.groupNodeObject[t]; }
|
|
26
649
|
}
|
|
27
650
|
// 回收分组节点内存
|
|
28
|
-
recycleGroupCache(
|
|
29
|
-
if (this.groupNodeObject[
|
|
30
|
-
this.groupNodeObject[
|
|
31
|
-
for (let
|
|
651
|
+
recycleGroupCache(e) {
|
|
652
|
+
if (this.groupNodeObject[e]) {
|
|
653
|
+
this.groupNodeObject[e].children = [], this.removeNodesMap(this.groupNodeObject[e].equips), this.groupNodeObject[e].equips = [], this.groupNodeObject[e].equips.length = 0, this.groupNodeObject[e].expand = !1;
|
|
654
|
+
for (let t in this.groupNodeObject) { this.groupNodeObject[t].groupId == e && this.recycleGroupCache(this.groupNodeObject[t].key); }
|
|
32
655
|
}
|
|
33
656
|
}
|
|
34
657
|
// 关闭兄弟分组节点及回收内存
|
|
35
|
-
closeBrotherNode(
|
|
36
|
-
if (
|
|
37
|
-
let
|
|
38
|
-
for (let i in this.groupNodeObject) { this.groupNodeObject[i].groupId ==
|
|
658
|
+
closeBrotherNode(e) {
|
|
659
|
+
if (e && this.groupNodeObject[e]) {
|
|
660
|
+
let t = this.groupNodeObject[e].groupId;
|
|
661
|
+
for (let i in this.groupNodeObject) { this.groupNodeObject[i].groupId == t && this.groupNodeObject[i].key != e && this.groupNodeObject[i].expand && (this.groupNodeObject[i].expand = !1, this.recycleGroupCache(this.groupNodeObject[i].key)); }
|
|
39
662
|
}
|
|
40
663
|
}
|
|
41
664
|
}
|
|
42
|
-
class
|
|
665
|
+
class ae {
|
|
43
666
|
constructor() {
|
|
44
667
|
this.window = window;
|
|
45
668
|
try {
|
|
@@ -49,7 +672,7 @@ class m {
|
|
|
49
672
|
}
|
|
50
673
|
}
|
|
51
674
|
}
|
|
52
|
-
const
|
|
675
|
+
const Ye = {
|
|
53
676
|
data() {
|
|
54
677
|
return {
|
|
55
678
|
window: null
|
|
@@ -64,22 +687,22 @@ const x = {
|
|
|
64
687
|
}
|
|
65
688
|
}
|
|
66
689
|
};
|
|
67
|
-
class
|
|
68
|
-
constructor(
|
|
69
|
-
super(), this.equipControllObject = i, this.groupNodeObject =
|
|
690
|
+
class It extends ae {
|
|
691
|
+
constructor(e, t, i, s, r, a) {
|
|
692
|
+
super(), this.equipControllObject = i, this.groupNodeObject = e, this.nodesMap = t, this.controlObject = s, this.equipCheckObject = r, this.isSearchStatus = !1, this.searchStatusGroupObject = {}, this.aliasName = a;
|
|
70
693
|
}
|
|
71
694
|
resetCheckedStatus() {
|
|
72
|
-
Object.values(this.nodesMap).forEach((
|
|
73
|
-
this.setCheckStatus(
|
|
74
|
-
}), Object.keys(this.equipCheckObject).forEach((
|
|
695
|
+
Object.values(this.nodesMap).forEach((e) => {
|
|
696
|
+
this.setCheckStatus(e.key, !1, !1);
|
|
697
|
+
}), Object.keys(this.equipCheckObject).forEach((e) => delete this.equipCheckObject[e]), this.updateGroupCheckStatus();
|
|
75
698
|
}
|
|
76
699
|
|
|
77
700
|
/**
|
|
78
701
|
* 搜索状态下,更新分组选中状态
|
|
79
702
|
* 新方案:直接调用 updateGroupCheckStatus 重新计算
|
|
80
703
|
*/
|
|
81
|
-
reComputedCheckNum(
|
|
82
|
-
this.isSearchStatus =
|
|
704
|
+
reComputedCheckNum(e) {
|
|
705
|
+
this.isSearchStatus = e, this.updateGroupCheckStatus();
|
|
83
706
|
}
|
|
84
707
|
// 根据传过来的设备选中数据、回显选中状态
|
|
85
708
|
/**
|
|
@@ -90,32 +713,32 @@ class A extends m {
|
|
|
90
713
|
* 注意:此方法只负责将选中状态写入 equipCheckObject,不调用 updateGroupCheckStatus。
|
|
91
714
|
* 分组状态的更新由调用方在合适的时机(数据就绪后)统一调用。
|
|
92
715
|
*/
|
|
93
|
-
updateCheckedStatusWithEquips(
|
|
94
|
-
let
|
|
95
|
-
Array.isArray(
|
|
96
|
-
Array.isArray(
|
|
97
|
-
|
|
716
|
+
updateCheckedStatusWithEquips(e) {
|
|
717
|
+
let t = [];
|
|
718
|
+
Array.isArray(e) ? t = e.map((i) => ({ equipNo: i, groupId: null })) : e !== null && typeof e == "object" && Object.keys(e).forEach((i) => {
|
|
719
|
+
Array.isArray(e[i]) && e[i].forEach((s) => {
|
|
720
|
+
t.push({ equipNo: s, groupId: Number(i) });
|
|
98
721
|
});
|
|
99
722
|
});
|
|
100
|
-
for (let i = 0,
|
|
101
|
-
const { equipNo:
|
|
723
|
+
for (let i = 0, s = t.length; i < s; i++) {
|
|
724
|
+
const { equipNo: r, groupId: a } = t[i];
|
|
102
725
|
if (a != null) {
|
|
103
|
-
const
|
|
104
|
-
this.setEquipCheckObject(
|
|
726
|
+
const c = `${a}-${r}`;
|
|
727
|
+
this.setEquipCheckObject(c, !0, !1, a), this.setCheckStatus(c, !0, !1), this.updateExpandControlCheckStatus(a, r);
|
|
105
728
|
} else {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
this.setEquipCheckObject(
|
|
729
|
+
const c = this.window.equipCache && this.window.equipCache[r];
|
|
730
|
+
c && (c.groupIds || (c.groupId ? [c.groupId] : [])).forEach((o) => {
|
|
731
|
+
const l = `${o}-${r}`;
|
|
732
|
+
this.setEquipCheckObject(l, !0, !1, o), this.setCheckStatus(l, !0, !1), this.updateExpandControlCheckStatus(o, r);
|
|
110
733
|
});
|
|
111
734
|
}
|
|
112
735
|
}
|
|
113
736
|
}
|
|
114
737
|
// 更新展开的设备控制项选中状态
|
|
115
|
-
updateExpandControlCheckStatus(
|
|
116
|
-
let i = this.nodesMap[`${
|
|
117
|
-
i && i.settings && i.settings.length && i.settings.forEach((
|
|
118
|
-
this.nodesMap[`${
|
|
738
|
+
updateExpandControlCheckStatus(e, t) {
|
|
739
|
+
let i = this.nodesMap[`${e}-${t}`];
|
|
740
|
+
i && i.settings && i.settings.length && i.settings.forEach((s) => {
|
|
741
|
+
this.nodesMap[`${e}-${t}-${s.setNo}`] && this.setCheckStatus(`${e}-${t}-${s.setNo}`, !0, !1);
|
|
119
742
|
});
|
|
120
743
|
}
|
|
121
744
|
// 根据传过来的设备控制项,回显设备分组选中状态
|
|
@@ -123,18 +746,18 @@ class A extends m {
|
|
|
123
746
|
* 注意:此方法只负责将控制项状态写入 equipControllObject/equipCheckObject,不调用 updateGroupCheckStatus。
|
|
124
747
|
* 分组状态的更新由调用方在合适的时机(数据就绪后)统一调用。
|
|
125
748
|
*/
|
|
126
|
-
updateCheckedStatusWithControls(
|
|
127
|
-
for (let
|
|
128
|
-
let
|
|
129
|
-
if (
|
|
130
|
-
let
|
|
131
|
-
|
|
749
|
+
updateCheckedStatusWithControls(e) {
|
|
750
|
+
for (let t = 0, i = e.length; t < i; t++) {
|
|
751
|
+
let s = e[t], r, a, c;
|
|
752
|
+
if (s !== null && typeof s == "object" && !Array.isArray(s)) { r = s.equipNo, a = s.setNo, c = s.groupId; } else {
|
|
753
|
+
let o = s.split(".");
|
|
754
|
+
r = o[0], a = o[1], c = null;
|
|
132
755
|
}
|
|
133
|
-
this.equipControllObject[
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
this.nodesMap[
|
|
756
|
+
this.equipControllObject[r] || (this.equipControllObject[r] = []), this.equipControllObject[r].push(Number(a));
|
|
757
|
+
const u = this.window.equipCache && this.window.equipCache[r];
|
|
758
|
+
u && (c != null ? [c] : u.groupIds || (u.groupId ? [u.groupId] : [])).forEach((l) => {
|
|
759
|
+
const d = `${l}-${r}`, f = `${l}-${r}-${a}`;
|
|
760
|
+
this.nodesMap[f] && this.setCheckStatus(f, !0, !1), this.nodesMap[d] && this.setCheckStatus(d, !1, !0), this.setEquipCheckObject(d, !1, !0, l);
|
|
138
761
|
});
|
|
139
762
|
}
|
|
140
763
|
}
|
|
@@ -144,40 +767,40 @@ class A extends m {
|
|
|
144
767
|
* 优点:状态判断准确,不会累积误差
|
|
145
768
|
*/
|
|
146
769
|
updateGroupCheckStatus() {
|
|
147
|
-
this.getSortedGroupsByLevel().forEach((
|
|
148
|
-
const i = this.computeGroupStatus(
|
|
149
|
-
this.setCheckStatus(
|
|
770
|
+
this.getSortedGroupsByLevel().forEach((t) => {
|
|
771
|
+
const i = this.computeGroupStatus(t.key);
|
|
772
|
+
this.setCheckStatus(t.key, i.checked, i.indeterminate), t.equipSelectCount = i.selectCount;
|
|
150
773
|
});
|
|
151
774
|
}
|
|
152
775
|
// 按层级排序分组(从深到浅,确保子分组先处理)
|
|
153
776
|
getSortedGroupsByLevel() {
|
|
154
|
-
return Object.values(this.groupNodeObject).sort((
|
|
777
|
+
return Object.values(this.groupNodeObject).sort((e, t) => t.level - e.level);
|
|
155
778
|
}
|
|
156
779
|
// 计算单个分组的选中状态
|
|
157
780
|
/**
|
|
158
781
|
* @returns {Object} { checked, indeterminate, selectCount }
|
|
159
782
|
*/
|
|
160
|
-
computeGroupStatus(
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
163
|
-
const i = this.isSearchStatus ? this.window[`group-${
|
|
164
|
-
let
|
|
165
|
-
i.forEach((
|
|
166
|
-
const
|
|
167
|
-
this.equipCheckObject[
|
|
783
|
+
computeGroupStatus(e) {
|
|
784
|
+
const t = this.groupNodeObject[e];
|
|
785
|
+
if (!t) { return { checked: !1, indeterminate: !1, selectCount: 0 }; }
|
|
786
|
+
const i = this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || [];
|
|
787
|
+
let s = 0;
|
|
788
|
+
i.forEach((d) => {
|
|
789
|
+
const f = `${e}-${d.equipNo}`;
|
|
790
|
+
this.equipCheckObject[f] && this.equipCheckObject[f].checked && s++;
|
|
168
791
|
});
|
|
169
|
-
let
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
792
|
+
let r = 0, a = 0, c = !1, u = !1;
|
|
793
|
+
t.groups && t.groups.length > 0 && t.groups.forEach((d) => {
|
|
794
|
+
const f = this.nodesMap[d.key];
|
|
795
|
+
f && (f.checked ? (r += f.count || 0, c = !0) : f.indeterminate ? (u = !0, c = !0) : u = !0, a += f.count || 0);
|
|
173
796
|
});
|
|
174
|
-
const
|
|
175
|
-
return
|
|
797
|
+
const o = s + r, l = t.count || 0;
|
|
798
|
+
return l === 0 ? { checked: !1, indeterminate: !1, selectCount: 0 } : o === 0 ? c ? { checked: !1, indeterminate: !0, selectCount: o } : { checked: !1, indeterminate: !1, selectCount: 0 } : o === l && !u ? { checked: !0, indeterminate: !1, selectCount: o } : { checked: !1, indeterminate: !0, selectCount: o };
|
|
176
799
|
}
|
|
177
800
|
// 设置设备控制项状态
|
|
178
|
-
setControlStatus(
|
|
179
|
-
|
|
180
|
-
this.nodesMap[`${
|
|
801
|
+
setControlStatus(e, t, i, s) {
|
|
802
|
+
e && e.forEach((r) => {
|
|
803
|
+
this.nodesMap[`${t}-${i}-${r.setNo}`] && this.setCheckStatus(`${t}-${i}-${r.setNo}`, s, !1);
|
|
181
804
|
});
|
|
182
805
|
}
|
|
183
806
|
// 更新设备控制项选中状态
|
|
@@ -185,19 +808,19 @@ class A extends m {
|
|
|
185
808
|
* 改造点:controlObject 键格式统一为 ${groupId}-${equipNo}
|
|
186
809
|
* */
|
|
187
810
|
updateControlCheckStatus() {
|
|
188
|
-
Object.keys(this.controlObject).forEach((
|
|
189
|
-
const [
|
|
190
|
-
let
|
|
191
|
-
if (
|
|
192
|
-
if (
|
|
193
|
-
let
|
|
194
|
-
this.setControlStatus(
|
|
195
|
-
} else if (!
|
|
196
|
-
let
|
|
197
|
-
this.setControlStatus(
|
|
811
|
+
Object.keys(this.controlObject).forEach((e) => {
|
|
812
|
+
const [t, i] = e.split("-");
|
|
813
|
+
let s = this.nodesMap[e];
|
|
814
|
+
if (s) {
|
|
815
|
+
if (s.checked) {
|
|
816
|
+
let r = s.settings;
|
|
817
|
+
this.setControlStatus(r, t, i, !0);
|
|
818
|
+
} else if (!s.checked && !s.indeterminate) {
|
|
819
|
+
let r = s.settings;
|
|
820
|
+
this.setControlStatus(r, t, i, !1);
|
|
198
821
|
} else {
|
|
199
|
-
this.equipControllObject[i] && this.equipControllObject[i].forEach((
|
|
200
|
-
let a = `${
|
|
822
|
+
this.equipControllObject[i] && this.equipControllObject[i].forEach((r) => {
|
|
823
|
+
let a = `${t}-${i}-${r}`;
|
|
201
824
|
this.nodesMap[a] && this.setCheckStatus(a, !0, !1);
|
|
202
825
|
});
|
|
203
826
|
}
|
|
@@ -206,50 +829,50 @@ class A extends m {
|
|
|
206
829
|
}
|
|
207
830
|
// 获取选中的分组
|
|
208
831
|
getGroupChecked() {
|
|
209
|
-
let
|
|
210
|
-
return Object.keys(this.groupNodeObject).forEach((
|
|
211
|
-
this.groupNodeObject[
|
|
212
|
-
}),
|
|
832
|
+
let e = [];
|
|
833
|
+
return Object.keys(this.groupNodeObject).forEach((t) => {
|
|
834
|
+
this.groupNodeObject[t].checked && e.push(t);
|
|
835
|
+
}), e;
|
|
213
836
|
}
|
|
214
837
|
// 获取选中设备
|
|
215
838
|
getEquipSelectd() {
|
|
216
|
-
let
|
|
839
|
+
let e = [], t = /* @__PURE__ */ new Set();
|
|
217
840
|
return Object.keys(this.equipCheckObject).forEach((i) => {
|
|
218
841
|
if (this.equipCheckObject[i].checked) {
|
|
219
842
|
try {
|
|
220
|
-
|
|
221
|
-
} catch (
|
|
222
|
-
console.log(
|
|
843
|
+
t.add(Number(i.split("-")[1]));
|
|
844
|
+
} catch (s) {
|
|
845
|
+
console.log(s);
|
|
223
846
|
}
|
|
224
847
|
}
|
|
225
|
-
}),
|
|
848
|
+
}), e = Array.from(t), e;
|
|
226
849
|
}
|
|
227
850
|
// 获取选中设备(携带分组)
|
|
228
851
|
getEquipGroupSelectd() {
|
|
229
|
-
let
|
|
230
|
-
return
|
|
231
|
-
}
|
|
232
|
-
returnArray(
|
|
233
|
-
const
|
|
234
|
-
return
|
|
235
|
-
const [
|
|
236
|
-
isNaN(a) ||
|
|
237
|
-
}),
|
|
852
|
+
let e = Object.keys(this.equipCheckObject);
|
|
853
|
+
return e.length > 0 && (e = this.returnArray(e)), e;
|
|
854
|
+
}
|
|
855
|
+
returnArray(e) {
|
|
856
|
+
const t = [];
|
|
857
|
+
return e.forEach((i) => {
|
|
858
|
+
const [s, r] = i.split("-"), a = parseInt(r);
|
|
859
|
+
isNaN(a) || t.push(a);
|
|
860
|
+
}), t;
|
|
238
861
|
}
|
|
239
862
|
// 解析设备数组为分组格式
|
|
240
|
-
parseEquipArrayToGroupFormat(
|
|
241
|
-
const
|
|
242
|
-
return
|
|
243
|
-
const [
|
|
244
|
-
isNaN(a) || (
|
|
245
|
-
}),
|
|
863
|
+
parseEquipArrayToGroupFormat(e) {
|
|
864
|
+
const t = {};
|
|
865
|
+
return e.forEach((i) => {
|
|
866
|
+
const [s, r] = i.split("-"), a = parseInt(s);
|
|
867
|
+
isNaN(a) || (t[a] || (t[a] = []), t[a].push(parseInt(r)));
|
|
868
|
+
}), t;
|
|
246
869
|
}
|
|
247
870
|
// 获取选中的设备控制项
|
|
248
871
|
getControlSelected() {
|
|
249
|
-
let
|
|
250
|
-
return Object.keys(this.equipControllObject).forEach((
|
|
251
|
-
|
|
252
|
-
}),
|
|
872
|
+
let e = [];
|
|
873
|
+
return Object.keys(this.equipControllObject).forEach((t) => {
|
|
874
|
+
e.push(...this.equipControllObject[t].map((i) => `${t}.${i}`));
|
|
875
|
+
}), e;
|
|
253
876
|
}
|
|
254
877
|
// 点击选中
|
|
255
878
|
/**
|
|
@@ -257,211 +880,1943 @@ class A extends m {
|
|
|
257
880
|
* 2:如果是设备选择,触发设备选中事件
|
|
258
881
|
* 3:如果是设备控制项选择,触发设备控制项选中事件
|
|
259
882
|
* */
|
|
260
|
-
onChecked(
|
|
261
|
-
this.isSearchStatus =
|
|
883
|
+
onChecked(e, t) {
|
|
884
|
+
this.isSearchStatus = t || !1, e.isGroup && !e.isEquip ? this.selectGroup(e) : e.isEquip ? this.selectEquip(e) : e.isSetting && this.selectControl(e);
|
|
262
885
|
}
|
|
263
886
|
// 从全局映射中,设置节点选中状态
|
|
264
|
-
setCheckStatus(
|
|
265
|
-
this.nodesMap[
|
|
887
|
+
setCheckStatus(e, t, i, s) {
|
|
888
|
+
this.nodesMap[e] && (this.nodesMap[e].checked = t, this.nodesMap[e].isGroup && (this.nodesMap[e].indeterminate = i));
|
|
266
889
|
}
|
|
267
890
|
// 保存全局设备选中状态
|
|
268
|
-
setEquipCheckObject(
|
|
269
|
-
this.equipCheckObject[
|
|
891
|
+
setEquipCheckObject(e, t, i, s) {
|
|
892
|
+
this.equipCheckObject[e] || (this.equipCheckObject[e] = {}), this.equipCheckObject[e].checked = t, this.equipCheckObject[e].indeterminate = i, this.equipCheckObject[e].groupId = s, !t && !i && delete this.equipCheckObject[e];
|
|
270
893
|
}
|
|
271
894
|
// 触发分组选择
|
|
272
|
-
selectGroup(
|
|
273
|
-
this.updateAllEquipStatus(
|
|
895
|
+
selectGroup(e) {
|
|
896
|
+
this.updateAllEquipStatus(e.key, e.checked), this.updateControlCheckStatus(), this.updateGroupCheckStatus();
|
|
274
897
|
}
|
|
275
898
|
// 更新分组下所有设备的选中状态
|
|
276
|
-
updateAllEquipStatus(
|
|
277
|
-
const i = this.groupNodeObject[
|
|
899
|
+
updateAllEquipStatus(e, t) {
|
|
900
|
+
const i = this.groupNodeObject[e];
|
|
278
901
|
if (!i) { return; }
|
|
279
|
-
(this.isSearchStatus ? this.window[`group-${
|
|
280
|
-
const a = `${
|
|
281
|
-
this.setEquipCheckObject(a,
|
|
282
|
-
}), i.groups && i.groups.length > 0 && i.groups.forEach((
|
|
283
|
-
this.updateAllEquipStatus(
|
|
902
|
+
(this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || []).forEach((r) => {
|
|
903
|
+
const a = `${e}-${r.equipNo}`;
|
|
904
|
+
this.setEquipCheckObject(a, t, !1, e), this.nodesMap[a] && this.setCheckStatus(a, t, !1);
|
|
905
|
+
}), i.groups && i.groups.length > 0 && i.groups.forEach((r) => {
|
|
906
|
+
this.updateAllEquipStatus(r.key, t);
|
|
284
907
|
});
|
|
285
908
|
}
|
|
286
909
|
// 触发设备选择
|
|
287
910
|
/**
|
|
288
911
|
* 新方案:简化逻辑,只更新设备状态,分组状态由 updateGroupCheckStatus 统一计算
|
|
289
912
|
*/
|
|
290
|
-
selectEquip(
|
|
291
|
-
const
|
|
292
|
-
this.setEquipCheckObject(
|
|
913
|
+
selectEquip(e) {
|
|
914
|
+
const t = `${e.groupId}-${e.equipNo}`;
|
|
915
|
+
this.setEquipCheckObject(t, e.checked, !1, e.groupId), this.nodesMap[t] && this.setCheckStatus(t, e.checked, !1), this.updateControlCheckStatus(), this.updateGroupCheckStatus();
|
|
293
916
|
}
|
|
294
917
|
// 更新设备控制项存储
|
|
295
|
-
updateEquipControl(
|
|
296
|
-
this.equipControllObject[
|
|
918
|
+
updateEquipControl(e, t, i) {
|
|
919
|
+
this.equipControllObject[e] || (this.equipControllObject[e] = []), i ? this.equipControllObject[e].push(t) : this.equipControllObject[e] = this.equipControllObject[e].filter((s) => s != t);
|
|
297
920
|
}
|
|
298
921
|
// 触发控制项选择
|
|
299
922
|
/**
|
|
300
923
|
* 新方案:简化逻辑,只更新控制项和设备状态,分组状态由 updateGroupCheckStatus 统一计算
|
|
301
924
|
*/
|
|
302
|
-
selectControl(
|
|
303
|
-
const
|
|
304
|
-
if (!
|
|
305
|
-
this.updateEquipControl(
|
|
306
|
-
const
|
|
307
|
-
|
|
925
|
+
selectControl(e) {
|
|
926
|
+
const t = `${e.groupId}-${e.equipNo}`, i = `${e.groupId}-${e.equipNo}-${e.setNo}`, s = this.nodesMap[t];
|
|
927
|
+
if (!s) { return; }
|
|
928
|
+
this.updateEquipControl(e.equipNo, e.setNo, e.checked), this.setCheckStatus(i, e.checked, !1);
|
|
929
|
+
const r = s.settings || [], a = this.equipControllObject[e.equipNo] || [], c = r.length, u = a.length;
|
|
930
|
+
e.checked ? u === c ? (delete this.equipControllObject[e.equipNo], this.setEquipCheckObject(t, !0, !1, e.groupId), this.setCheckStatus(t, !0, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)) : u === 0 ? (this.setEquipCheckObject(t, !1, !1, e.groupId), this.setCheckStatus(t, !1, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)), this.updateGroupCheckStatus();
|
|
308
931
|
}
|
|
309
932
|
}
|
|
310
|
-
class
|
|
933
|
+
class Mt extends ae {
|
|
311
934
|
// 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
|
|
312
|
-
constructor(
|
|
313
|
-
super(), this.aliasName =
|
|
935
|
+
constructor(e, t) {
|
|
936
|
+
super(), this.aliasName = t, this.groupNodeObject = e;
|
|
314
937
|
}
|
|
315
938
|
// 重新计算分组设备数量
|
|
316
|
-
resetGroupNum(
|
|
939
|
+
resetGroupNum(e, t, i) {
|
|
317
940
|
this.clearAllEquipNum();
|
|
318
|
-
for (let
|
|
319
|
-
let
|
|
320
|
-
|
|
321
|
-
let a =
|
|
322
|
-
this.groupNodeObject[
|
|
941
|
+
for (let s in this.groupNodeObject) {
|
|
942
|
+
let r = [];
|
|
943
|
+
e ? r = this.window[`group-${s}-search`] : r = this.window[`group-${s}${this.aliasName}`], t && r && r.length && (r = r.filter((c) => i[c.equipNo] === 2));
|
|
944
|
+
let a = r ? r.length : 0;
|
|
945
|
+
this.groupNodeObject[s].equipCount = a, a && this.setGroupNum(s, a);
|
|
323
946
|
}
|
|
324
947
|
}
|
|
325
948
|
clearAllEquipNum() {
|
|
326
|
-
for (let
|
|
949
|
+
for (let e in this.groupNodeObject) { this.groupNodeObject[e].equipCount = 0, this.groupNodeObject[e].count = 0; }
|
|
327
950
|
}
|
|
328
951
|
// 设置分组设备数量
|
|
329
|
-
setGroupNum(
|
|
330
|
-
this.groupNodeObject[
|
|
952
|
+
setGroupNum(e, t) {
|
|
953
|
+
this.groupNodeObject[e] && (this.groupNodeObject[e].count = Number(this.groupNodeObject[e].count) + Number(t), this.setGroupNum(this.groupNodeObject[e].groupId, t));
|
|
331
954
|
}
|
|
332
955
|
// 获取设备总数
|
|
333
956
|
getAllEquipsNum() {
|
|
334
|
-
let
|
|
335
|
-
for (let
|
|
336
|
-
return
|
|
957
|
+
let e = 0;
|
|
958
|
+
for (let t in this.groupNodeObject) { this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`] && (e = e + this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`].length); }
|
|
959
|
+
return e;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
let Te = globalThis && globalThis.__extends || (function() {
|
|
963
|
+
let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
964
|
+
e.__proto__ = t;
|
|
965
|
+
} || function(e, t) {
|
|
966
|
+
for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]); }
|
|
967
|
+
};
|
|
968
|
+
return function(e, t) {
|
|
969
|
+
n(e, t);
|
|
970
|
+
function i() {
|
|
971
|
+
this.constructor = e;
|
|
972
|
+
}
|
|
973
|
+
e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i());
|
|
974
|
+
};
|
|
975
|
+
})(), J = (
|
|
976
|
+
|
|
977
|
+
/** @class */
|
|
978
|
+
function(n) {
|
|
979
|
+
Te(e, n);
|
|
980
|
+
function e(t, i) {
|
|
981
|
+
let s = this.constructor, r = this, a = s.prototype;
|
|
982
|
+
return r = n.call(this, t) || this, r.statusCode = i, r.__proto__ = a, r;
|
|
983
|
+
}
|
|
984
|
+
return e;
|
|
985
|
+
})(Error)
|
|
986
|
+
, Oe = (
|
|
987
|
+
|
|
988
|
+
/** @class */
|
|
989
|
+
function(n) {
|
|
990
|
+
Te(e, n);
|
|
991
|
+
function e(t) {
|
|
992
|
+
let i = this.constructor;
|
|
993
|
+
t === void 0 && (t = "A timeout occurred.");
|
|
994
|
+
let s = this, r = i.prototype;
|
|
995
|
+
return s = n.call(this, t) || this, s.__proto__ = r, s;
|
|
996
|
+
}
|
|
997
|
+
return e;
|
|
998
|
+
})(Error)
|
|
999
|
+
, oe = (
|
|
1000
|
+
|
|
1001
|
+
/** @class */
|
|
1002
|
+
function(n) {
|
|
1003
|
+
Te(e, n);
|
|
1004
|
+
function e(t) {
|
|
1005
|
+
let i = this.constructor;
|
|
1006
|
+
t === void 0 && (t = "An abort occurred.");
|
|
1007
|
+
let s = this, r = i.prototype;
|
|
1008
|
+
return s = n.call(this, t) || this, s.__proto__ = r, s;
|
|
1009
|
+
}
|
|
1010
|
+
return e;
|
|
1011
|
+
})(Error)
|
|
1012
|
+
, ve = globalThis && globalThis.__assign || Object.assign || function(n) {
|
|
1013
|
+
for (var e, t = 1, i = arguments.length; t < i; t++) {
|
|
1014
|
+
e = arguments[t];
|
|
1015
|
+
for (let s in e) { Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]); }
|
|
1016
|
+
}
|
|
1017
|
+
return n;
|
|
1018
|
+
}, Qe = (
|
|
1019
|
+
|
|
1020
|
+
/** @class */
|
|
1021
|
+
function() {
|
|
1022
|
+
function n(e, t, i) {
|
|
1023
|
+
this.statusCode = e, this.statusText = t, this.content = i;
|
|
1024
|
+
}
|
|
1025
|
+
return n;
|
|
1026
|
+
})()
|
|
1027
|
+
, Ne = (
|
|
1028
|
+
|
|
1029
|
+
/** @class */
|
|
1030
|
+
function() {
|
|
1031
|
+
function n() {
|
|
1032
|
+
}
|
|
1033
|
+
return n.prototype.get = function(e, t) {
|
|
1034
|
+
return this.send(ve({}, t, { method: "GET", url: e }));
|
|
1035
|
+
}, n.prototype.post = function(e, t) {
|
|
1036
|
+
return this.send(ve({}, t, { method: "POST", url: e }));
|
|
1037
|
+
}, n.prototype.delete = function(e, t) {
|
|
1038
|
+
return this.send(ve({}, t, { method: "DELETE", url: e }));
|
|
1039
|
+
}, n.prototype.getCookieString = function(e) {
|
|
1040
|
+
return "";
|
|
1041
|
+
}, n;
|
|
1042
|
+
})()
|
|
1043
|
+
, h;
|
|
1044
|
+
(function(n) {
|
|
1045
|
+
n[n.Trace = 0] = "Trace", n[n.Debug = 1] = "Debug", n[n.Information = 2] = "Information", n[n.Warning = 3] = "Warning", n[n.Error = 4] = "Error", n[n.Critical = 5] = "Critical", n[n.None = 6] = "None";
|
|
1046
|
+
})(h || (h = {}));
|
|
1047
|
+
let Ie = (
|
|
1048
|
+
|
|
1049
|
+
/** @class */
|
|
1050
|
+
function() {
|
|
1051
|
+
function n() {
|
|
1052
|
+
}
|
|
1053
|
+
return n.prototype.log = function(e, t) {
|
|
1054
|
+
}, n.instance = new n(), n;
|
|
1055
|
+
})()
|
|
1056
|
+
, xt = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
1057
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
1058
|
+
function a(o) {
|
|
1059
|
+
try {
|
|
1060
|
+
u(i.next(o));
|
|
1061
|
+
} catch (l) {
|
|
1062
|
+
r(l);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
function c(o) {
|
|
1066
|
+
try {
|
|
1067
|
+
u(i.throw(o));
|
|
1068
|
+
} catch (l) {
|
|
1069
|
+
r(l);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
function u(o) {
|
|
1073
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
1074
|
+
l(o.value);
|
|
1075
|
+
}).then(a, c);
|
|
1076
|
+
}
|
|
1077
|
+
u((i = i.apply(n, e || [])).next());
|
|
1078
|
+
});
|
|
1079
|
+
}, jt = globalThis && globalThis.__generator || function(n, e) {
|
|
1080
|
+
let t = { label: 0, sent: function() {
|
|
1081
|
+
if (r[0] & 1) { throw r[1]; }
|
|
1082
|
+
return r[1];
|
|
1083
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
1084
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
1085
|
+
return this;
|
|
1086
|
+
}), a;
|
|
1087
|
+
function c(o) {
|
|
1088
|
+
return function(l) {
|
|
1089
|
+
return u([o, l]);
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function u(o) {
|
|
1093
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
1094
|
+
for (; t;) {
|
|
1095
|
+
try {
|
|
1096
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
1097
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
1098
|
+
case 0:
|
|
1099
|
+
case 1:
|
|
1100
|
+
r = o;
|
|
1101
|
+
break;
|
|
1102
|
+
case 4:
|
|
1103
|
+
return t.label++, { value: o[1], done: !1 };
|
|
1104
|
+
case 5:
|
|
1105
|
+
t.label++, s = o[1], o = [0];
|
|
1106
|
+
continue;
|
|
1107
|
+
case 7:
|
|
1108
|
+
o = t.ops.pop(), t.trys.pop();
|
|
1109
|
+
continue;
|
|
1110
|
+
default:
|
|
1111
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
1112
|
+
t = 0;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
1116
|
+
t.label = o[1];
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
1120
|
+
t.label = r[1], r = o;
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
if (r && t.label < r[2]) {
|
|
1124
|
+
t.label = r[2], t.ops.push(o);
|
|
1125
|
+
break;
|
|
1126
|
+
}
|
|
1127
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
o = e.call(n, t);
|
|
1131
|
+
} catch (l) {
|
|
1132
|
+
o = [6, l], s = 0;
|
|
1133
|
+
} finally {
|
|
1134
|
+
i = r = 0;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
if (o[0] & 5) { throw o[1]; }
|
|
1138
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
1139
|
+
}
|
|
1140
|
+
}, S = (
|
|
1141
|
+
|
|
1142
|
+
/** @class */
|
|
1143
|
+
function() {
|
|
1144
|
+
function n() {
|
|
1145
|
+
}
|
|
1146
|
+
return n.isRequired = function(e, t) {
|
|
1147
|
+
if (e == null) { throw new Error("The '" + t + "' argument is required."); }
|
|
1148
|
+
}, n.isIn = function(e, t, i) {
|
|
1149
|
+
if (!(e in t)) { throw new Error("Unknown " + i + " value: " + e + "."); }
|
|
1150
|
+
}, n;
|
|
1151
|
+
})()
|
|
1152
|
+
;
|
|
1153
|
+
function X(n, e) {
|
|
1154
|
+
let t = "";
|
|
1155
|
+
return ue(n) ? (t = "Binary data of length " + n.byteLength, e && (t += ". Content: '" + _t(n) + "'")) : typeof n == "string" && (t = "String data of length " + n.length, e && (t += ". Content: '" + n + "'")), t;
|
|
1156
|
+
}
|
|
1157
|
+
function _t(n) {
|
|
1158
|
+
let e = new Uint8Array(n), t = "";
|
|
1159
|
+
return e.forEach(function(i) {
|
|
1160
|
+
let s = i < 16 ? "0" : "";
|
|
1161
|
+
t += "0x" + s + i.toString(16) + " ";
|
|
1162
|
+
}), t.substr(0, t.length - 1);
|
|
1163
|
+
}
|
|
1164
|
+
function ue(n) {
|
|
1165
|
+
return n && typeof ArrayBuffer < "u" && (n instanceof ArrayBuffer || // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
|
|
1166
|
+
n.constructor && n.constructor.name === "ArrayBuffer");
|
|
1167
|
+
}
|
|
1168
|
+
function Ze(n, e, t, i, s, r, a) {
|
|
1169
|
+
return xt(this, void 0, void 0, function() {
|
|
1170
|
+
let c, u, o, l, d;
|
|
1171
|
+
return jt(this, function(f) {
|
|
1172
|
+
switch (f.label) {
|
|
1173
|
+
case 0:
|
|
1174
|
+
return s ? [4, s()] : [3, 2];
|
|
1175
|
+
case 1:
|
|
1176
|
+
o = f.sent(), o && (u = (c = {}, c.Authorization = "Bearer " + o, c)), f.label = 2;
|
|
1177
|
+
case 2:
|
|
1178
|
+
return n.log(h.Trace, "(" + e + " transport) sending data. " + X(r, a) + "."), l = ue(r) ? "arraybuffer" : "text", [4, t.post(i, {
|
|
1179
|
+
content: r,
|
|
1180
|
+
headers: u,
|
|
1181
|
+
responseType: l
|
|
1182
|
+
})];
|
|
1183
|
+
case 3:
|
|
1184
|
+
return d = f.sent(), n.log(h.Trace, "(" + e + " transport) request complete. Response status: " + d.statusCode + "."), [
|
|
1185
|
+
2
|
|
1186
|
+
|
|
1187
|
+
/*return*/
|
|
1188
|
+
];
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
function Gt(n) {
|
|
1194
|
+
return n === void 0 ? new Ce(h.Information) : n === null ? Ie.instance : n.log ? n : new Ce(n);
|
|
1195
|
+
}
|
|
1196
|
+
var Pt = (
|
|
1197
|
+
|
|
1198
|
+
/** @class */
|
|
1199
|
+
function() {
|
|
1200
|
+
function n() {
|
|
1201
|
+
this.observers = [];
|
|
1202
|
+
}
|
|
1203
|
+
return n.prototype.next = function(e) {
|
|
1204
|
+
for (let t = 0, i = this.observers; t < i.length; t++) {
|
|
1205
|
+
let s = i[t];
|
|
1206
|
+
s.next(e);
|
|
1207
|
+
}
|
|
1208
|
+
}, n.prototype.error = function(e) {
|
|
1209
|
+
for (let t = 0, i = this.observers; t < i.length; t++) {
|
|
1210
|
+
let s = i[t];
|
|
1211
|
+
s.error && s.error(e);
|
|
1212
|
+
}
|
|
1213
|
+
}, n.prototype.complete = function() {
|
|
1214
|
+
for (let e = 0, t = this.observers; e < t.length; e++) {
|
|
1215
|
+
let i = t[e];
|
|
1216
|
+
i.complete && i.complete();
|
|
1217
|
+
}
|
|
1218
|
+
}, n.prototype.subscribe = function(e) {
|
|
1219
|
+
return this.observers.push(e), new At(this, e);
|
|
1220
|
+
}, n;
|
|
1221
|
+
})()
|
|
1222
|
+
, At = (
|
|
1223
|
+
|
|
1224
|
+
/** @class */
|
|
1225
|
+
function() {
|
|
1226
|
+
function n(e, t) {
|
|
1227
|
+
this.subject = e, this.observer = t;
|
|
1228
|
+
}
|
|
1229
|
+
return n.prototype.dispose = function() {
|
|
1230
|
+
let e = this.subject.observers.indexOf(this.observer);
|
|
1231
|
+
e > -1 && this.subject.observers.splice(e, 1), this.subject.observers.length === 0 && this.subject.cancelCallback && this.subject.cancelCallback().catch(function(t) {
|
|
1232
|
+
});
|
|
1233
|
+
}, n;
|
|
1234
|
+
})()
|
|
1235
|
+
, Ce = (
|
|
1236
|
+
|
|
1237
|
+
/** @class */
|
|
1238
|
+
function() {
|
|
1239
|
+
function n(e) {
|
|
1240
|
+
this.minimumLogLevel = e;
|
|
1241
|
+
}
|
|
1242
|
+
return n.prototype.log = function(e, t) {
|
|
1243
|
+
if (e >= this.minimumLogLevel) {
|
|
1244
|
+
switch (e) {
|
|
1245
|
+
case h.Critical:
|
|
1246
|
+
case h.Error:
|
|
1247
|
+
console.error("[" + (/* @__PURE__ */ new Date()).toISOString() + "] " + h[e] + ": " + t);
|
|
1248
|
+
break;
|
|
1249
|
+
case h.Warning:
|
|
1250
|
+
console.warn("[" + (/* @__PURE__ */ new Date()).toISOString() + "] " + h[e] + ": " + t);
|
|
1251
|
+
break;
|
|
1252
|
+
case h.Information:
|
|
1253
|
+
console.info("[" + (/* @__PURE__ */ new Date()).toISOString() + "] " + h[e] + ": " + t);
|
|
1254
|
+
break;
|
|
1255
|
+
default:
|
|
1256
|
+
console.log("[" + (/* @__PURE__ */ new Date()).toISOString() + "] " + h[e] + ": " + t);
|
|
1257
|
+
break;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}, n;
|
|
1261
|
+
})()
|
|
1262
|
+
, $t = globalThis && globalThis.__extends || (function() {
|
|
1263
|
+
let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
1264
|
+
e.__proto__ = t;
|
|
1265
|
+
} || function(e, t) {
|
|
1266
|
+
for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]); }
|
|
1267
|
+
};
|
|
1268
|
+
return function(e, t) {
|
|
1269
|
+
n(e, t);
|
|
1270
|
+
function i() {
|
|
1271
|
+
this.constructor = e;
|
|
1272
|
+
}
|
|
1273
|
+
e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i());
|
|
1274
|
+
};
|
|
1275
|
+
})(), Lt = globalThis && globalThis.__assign || Object.assign || function(n) {
|
|
1276
|
+
for (var e, t = 1, i = arguments.length; t < i; t++) {
|
|
1277
|
+
e = arguments[t];
|
|
1278
|
+
for (let s in e) { Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]); }
|
|
1279
|
+
}
|
|
1280
|
+
return n;
|
|
1281
|
+
}, re;
|
|
1282
|
+
if (typeof XMLHttpRequest > "u") {
|
|
1283
|
+
let Rt = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;
|
|
1284
|
+
re = Rt("request");
|
|
1285
|
+
}
|
|
1286
|
+
let zt = (
|
|
1287
|
+
|
|
1288
|
+
/** @class */
|
|
1289
|
+
function(n) {
|
|
1290
|
+
$t(e, n);
|
|
1291
|
+
function e(t) {
|
|
1292
|
+
let i = n.call(this) || this;
|
|
1293
|
+
if (typeof re > "u") { throw new Error("The 'request' module could not be loaded."); }
|
|
1294
|
+
return i.logger = t, i.cookieJar = re.jar(), i.request = re.defaults({ jar: i.cookieJar }), i;
|
|
1295
|
+
}
|
|
1296
|
+
return e.prototype.send = function(t) {
|
|
1297
|
+
let i = this;
|
|
1298
|
+
return new Promise(function(s, r) {
|
|
1299
|
+
let a;
|
|
1300
|
+
ue(t.content) ? a = Buffer.from(t.content) : a = t.content || "";
|
|
1301
|
+
let c = i.request(t.url, {
|
|
1302
|
+
body: a,
|
|
1303
|
+
// If binary is expected 'null' should be used, otherwise for text 'utf8'
|
|
1304
|
+
encoding: t.responseType === "arraybuffer" ? null : "utf8",
|
|
1305
|
+
headers: Lt({
|
|
1306
|
+
// Tell auth middleware to 401 instead of redirecting
|
|
1307
|
+
"X-Requested-With": "XMLHttpRequest"
|
|
1308
|
+
}, t.headers),
|
|
1309
|
+
method: t.method,
|
|
1310
|
+
timeout: t.timeout
|
|
1311
|
+
}, function(u, o, l) {
|
|
1312
|
+
if (t.abortSignal && (t.abortSignal.onabort = null), u) {
|
|
1313
|
+
u.code === "ETIMEDOUT" && (i.logger.log(h.Warning, "Timeout from HTTP request."), r(new Oe())), i.logger.log(h.Warning, "Error from HTTP request. " + u), r(u);
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
o.statusCode >= 200 && o.statusCode < 300 ? s(new Qe(o.statusCode, o.statusMessage || "", l)) : r(new J(o.statusMessage || "", o.statusCode || 0));
|
|
1317
|
+
});
|
|
1318
|
+
t.abortSignal && (t.abortSignal.onabort = function() {
|
|
1319
|
+
c.abort(), r(new oe());
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1322
|
+
}, e.prototype.getCookieString = function(t) {
|
|
1323
|
+
return this.cookieJar.getCookieString(t);
|
|
1324
|
+
}, e;
|
|
1325
|
+
})(Ne)
|
|
1326
|
+
, Bt = globalThis && globalThis.__extends || (function() {
|
|
1327
|
+
let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
1328
|
+
e.__proto__ = t;
|
|
1329
|
+
} || function(e, t) {
|
|
1330
|
+
for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]); }
|
|
1331
|
+
};
|
|
1332
|
+
return function(e, t) {
|
|
1333
|
+
n(e, t);
|
|
1334
|
+
function i() {
|
|
1335
|
+
this.constructor = e;
|
|
1336
|
+
}
|
|
1337
|
+
e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i());
|
|
1338
|
+
};
|
|
1339
|
+
})(), Dt = (
|
|
1340
|
+
|
|
1341
|
+
/** @class */
|
|
1342
|
+
function(n) {
|
|
1343
|
+
Bt(e, n);
|
|
1344
|
+
function e(t) {
|
|
1345
|
+
let i = n.call(this) || this;
|
|
1346
|
+
return i.logger = t, i;
|
|
1347
|
+
}
|
|
1348
|
+
return e.prototype.send = function(t) {
|
|
1349
|
+
let i = this;
|
|
1350
|
+
return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new oe()) : t.method ? t.url ? new Promise(function(s, r) {
|
|
1351
|
+
let a = new XMLHttpRequest();
|
|
1352
|
+
a.open(t.method, t.url, !0), a.withCredentials = !0, a.setRequestHeader("X-Requested-With", "XMLHttpRequest"), a.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
|
|
1353
|
+
let c = t.headers;
|
|
1354
|
+
c && Object.keys(c).forEach(function(u) {
|
|
1355
|
+
a.setRequestHeader(u, c[u]);
|
|
1356
|
+
}), t.responseType && (a.responseType = t.responseType), t.abortSignal && (t.abortSignal.onabort = function() {
|
|
1357
|
+
a.abort(), r(new oe());
|
|
1358
|
+
}), t.timeout && (a.timeout = t.timeout), a.onload = function() {
|
|
1359
|
+
t.abortSignal && (t.abortSignal.onabort = null), a.status >= 200 && a.status < 300 ? s(new Qe(a.status, a.statusText, a.response || a.responseText)) : r(new J(a.statusText, a.status));
|
|
1360
|
+
}, a.onerror = function() {
|
|
1361
|
+
i.logger.log(h.Warning, "Error from HTTP request. " + a.status + ": " + a.statusText + "."), r(new J(a.statusText, a.status));
|
|
1362
|
+
}, a.ontimeout = function() {
|
|
1363
|
+
i.logger.log(h.Warning, "Timeout from HTTP request."), r(new Oe());
|
|
1364
|
+
}, a.send(t.content || "");
|
|
1365
|
+
}) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined."));
|
|
1366
|
+
}, e;
|
|
1367
|
+
})(Ne)
|
|
1368
|
+
, Ft = globalThis && globalThis.__extends || (function() {
|
|
1369
|
+
let n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
1370
|
+
e.__proto__ = t;
|
|
1371
|
+
} || function(e, t) {
|
|
1372
|
+
for (let i in t) { t.hasOwnProperty(i) && (e[i] = t[i]); }
|
|
1373
|
+
};
|
|
1374
|
+
return function(e, t) {
|
|
1375
|
+
n(e, t);
|
|
1376
|
+
function i() {
|
|
1377
|
+
this.constructor = e;
|
|
1378
|
+
}
|
|
1379
|
+
e.prototype = t === null ? Object.create(t) : (i.prototype = t.prototype, new i());
|
|
1380
|
+
};
|
|
1381
|
+
})(), Ht = (
|
|
1382
|
+
|
|
1383
|
+
/** @class */
|
|
1384
|
+
function(n) {
|
|
1385
|
+
Ft(e, n);
|
|
1386
|
+
function e(t) {
|
|
1387
|
+
let i = n.call(this) || this;
|
|
1388
|
+
return typeof XMLHttpRequest < "u" ? i.httpClient = new Dt(t) : i.httpClient = new zt(t), i;
|
|
1389
|
+
}
|
|
1390
|
+
return e.prototype.send = function(t) {
|
|
1391
|
+
return t.abortSignal && t.abortSignal.aborted ? Promise.reject(new oe()) : t.method ? t.url ? this.httpClient.send(t) : Promise.reject(new Error("No url defined.")) : Promise.reject(new Error("No method defined."));
|
|
1392
|
+
}, e.prototype.getCookieString = function(t) {
|
|
1393
|
+
return this.httpClient.getCookieString(t);
|
|
1394
|
+
}, e;
|
|
1395
|
+
})(Ne)
|
|
1396
|
+
, L = (
|
|
1397
|
+
|
|
1398
|
+
/** @class */
|
|
1399
|
+
function() {
|
|
1400
|
+
function n() {
|
|
1401
|
+
}
|
|
1402
|
+
return n.write = function(e) {
|
|
1403
|
+
return "" + e + n.RecordSeparator;
|
|
1404
|
+
}, n.parse = function(e) {
|
|
1405
|
+
if (e[e.length - 1] !== n.RecordSeparator) { throw new Error("Message is incomplete."); }
|
|
1406
|
+
let t = e.split(n.RecordSeparator);
|
|
1407
|
+
return t.pop(), t;
|
|
1408
|
+
}, n.RecordSeparatorCode = 30, n.RecordSeparator = String.fromCharCode(n.RecordSeparatorCode), n;
|
|
1409
|
+
})()
|
|
1410
|
+
, Ut = (
|
|
1411
|
+
|
|
1412
|
+
/** @class */
|
|
1413
|
+
function() {
|
|
1414
|
+
function n() {
|
|
1415
|
+
}
|
|
1416
|
+
return n.prototype.writeHandshakeRequest = function(e) {
|
|
1417
|
+
return L.write(JSON.stringify(e));
|
|
1418
|
+
}, n.prototype.parseHandshakeResponse = function(e) {
|
|
1419
|
+
let t, i, s;
|
|
1420
|
+
if (ue(e) || typeof Buffer < "u" && e instanceof Buffer) {
|
|
1421
|
+
var r = new Uint8Array(e), a = r.indexOf(L.RecordSeparatorCode);
|
|
1422
|
+
if (a === -1) { throw new Error("Message is incomplete."); }
|
|
1423
|
+
var c = a + 1;
|
|
1424
|
+
i = String.fromCharCode.apply(null, r.slice(0, c)), s = r.byteLength > c ? r.slice(c).buffer : null;
|
|
1425
|
+
} else {
|
|
1426
|
+
var u = e, a = u.indexOf(L.RecordSeparator);
|
|
1427
|
+
if (a === -1) { throw new Error("Message is incomplete."); }
|
|
1428
|
+
var c = a + 1;
|
|
1429
|
+
i = u.substring(0, c), s = u.length > c ? u.substring(c) : null;
|
|
1430
|
+
}
|
|
1431
|
+
let o = L.parse(i), l = JSON.parse(o[0]);
|
|
1432
|
+
if (l.type) { throw new Error("Expected a handshake response from the server."); }
|
|
1433
|
+
return t = l, [s, t];
|
|
1434
|
+
}, n;
|
|
1435
|
+
})()
|
|
1436
|
+
, w;
|
|
1437
|
+
(function(n) {
|
|
1438
|
+
n[n.Invocation = 1] = "Invocation", n[n.StreamItem = 2] = "StreamItem", n[n.Completion = 3] = "Completion", n[n.StreamInvocation = 4] = "StreamInvocation", n[n.CancelInvocation = 5] = "CancelInvocation", n[n.Ping = 6] = "Ping", n[n.Close = 7] = "Close";
|
|
1439
|
+
})(w || (w = {}));
|
|
1440
|
+
let Be = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
1441
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
1442
|
+
function a(o) {
|
|
1443
|
+
try {
|
|
1444
|
+
u(i.next(o));
|
|
1445
|
+
} catch (l) {
|
|
1446
|
+
r(l);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function c(o) {
|
|
1450
|
+
try {
|
|
1451
|
+
u(i.throw(o));
|
|
1452
|
+
} catch (l) {
|
|
1453
|
+
r(l);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
function u(o) {
|
|
1457
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
1458
|
+
l(o.value);
|
|
1459
|
+
}).then(a, c);
|
|
1460
|
+
}
|
|
1461
|
+
u((i = i.apply(n, e || [])).next());
|
|
1462
|
+
});
|
|
1463
|
+
}, De = globalThis && globalThis.__generator || function(n, e) {
|
|
1464
|
+
let t = { label: 0, sent: function() {
|
|
1465
|
+
if (r[0] & 1) { throw r[1]; }
|
|
1466
|
+
return r[1];
|
|
1467
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
1468
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
1469
|
+
return this;
|
|
1470
|
+
}), a;
|
|
1471
|
+
function c(o) {
|
|
1472
|
+
return function(l) {
|
|
1473
|
+
return u([o, l]);
|
|
1474
|
+
};
|
|
337
1475
|
}
|
|
1476
|
+
function u(o) {
|
|
1477
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
1478
|
+
for (; t;) {
|
|
1479
|
+
try {
|
|
1480
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
1481
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
1482
|
+
case 0:
|
|
1483
|
+
case 1:
|
|
1484
|
+
r = o;
|
|
1485
|
+
break;
|
|
1486
|
+
case 4:
|
|
1487
|
+
return t.label++, { value: o[1], done: !1 };
|
|
1488
|
+
case 5:
|
|
1489
|
+
t.label++, s = o[1], o = [0];
|
|
1490
|
+
continue;
|
|
1491
|
+
case 7:
|
|
1492
|
+
o = t.ops.pop(), t.trys.pop();
|
|
1493
|
+
continue;
|
|
1494
|
+
default:
|
|
1495
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
1496
|
+
t = 0;
|
|
1497
|
+
continue;
|
|
1498
|
+
}
|
|
1499
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
1500
|
+
t.label = o[1];
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
1504
|
+
t.label = r[1], r = o;
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
if (r && t.label < r[2]) {
|
|
1508
|
+
t.label = r[2], t.ops.push(o);
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
1512
|
+
continue;
|
|
1513
|
+
}
|
|
1514
|
+
o = e.call(n, t);
|
|
1515
|
+
} catch (l) {
|
|
1516
|
+
o = [6, l], s = 0;
|
|
1517
|
+
} finally {
|
|
1518
|
+
i = r = 0;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (o[0] & 5) { throw o[1]; }
|
|
1522
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
1523
|
+
}
|
|
1524
|
+
}, Wt = 30 * 1e3, Kt = 15 * 1e3, R;
|
|
1525
|
+
(function(n) {
|
|
1526
|
+
n[n.Disconnected = 0] = "Disconnected", n[n.Connected = 1] = "Connected";
|
|
1527
|
+
})(R || (R = {}));
|
|
1528
|
+
let Vt = (
|
|
1529
|
+
|
|
1530
|
+
/** @class */
|
|
1531
|
+
function() {
|
|
1532
|
+
function n(e, t, i) {
|
|
1533
|
+
let s = this;
|
|
1534
|
+
S.isRequired(e, "connection"), S.isRequired(t, "logger"), S.isRequired(i, "protocol"), this.serverTimeoutInMilliseconds = Wt, this.keepAliveIntervalInMilliseconds = Kt, this.logger = t, this.protocol = i, this.connection = e, this.handshakeProtocol = new Ut(), this.connection.onreceive = function(r) {
|
|
1535
|
+
return s.processIncomingData(r);
|
|
1536
|
+
}, this.connection.onclose = function(r) {
|
|
1537
|
+
return s.connectionClosed(r);
|
|
1538
|
+
}, this.callbacks = {}, this.methods = {}, this.closedCallbacks = [], this.id = 0, this.receivedHandshakeResponse = !1, this.connectionState = R.Disconnected, this.cachedPingMessage = this.protocol.writeMessage({ type: w.Ping });
|
|
1539
|
+
}
|
|
1540
|
+
return n.create = function(e, t, i) {
|
|
1541
|
+
return new n(e, t, i);
|
|
1542
|
+
}, Object.defineProperty(n.prototype, "state", {
|
|
1543
|
+
|
|
1544
|
+
/** Indicates the state of the {@link HubConnection} to the server. */
|
|
1545
|
+
get: function() {
|
|
1546
|
+
return this.connectionState;
|
|
1547
|
+
},
|
|
1548
|
+
enumerable: !0,
|
|
1549
|
+
configurable: !0
|
|
1550
|
+
}), n.prototype.start = function() {
|
|
1551
|
+
return Be(this, void 0, void 0, function() {
|
|
1552
|
+
let e, t, i = this;
|
|
1553
|
+
return De(this, function(s) {
|
|
1554
|
+
switch (s.label) {
|
|
1555
|
+
case 0:
|
|
1556
|
+
return e = {
|
|
1557
|
+
protocol: this.protocol.name,
|
|
1558
|
+
version: this.protocol.version
|
|
1559
|
+
}, this.logger.log(h.Debug, "Starting HubConnection."), this.receivedHandshakeResponse = !1, t = new Promise(function(r, a) {
|
|
1560
|
+
i.handshakeResolver = r, i.handshakeRejecter = a;
|
|
1561
|
+
}), [4, this.connection.start(this.protocol.transferFormat)];
|
|
1562
|
+
case 1:
|
|
1563
|
+
return s.sent(), this.logger.log(h.Debug, "Sending handshake request."), [4, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(e))];
|
|
1564
|
+
case 2:
|
|
1565
|
+
return s.sent(), this.logger.log(h.Information, "Using HubProtocol '" + this.protocol.name + "'."), this.cleanupTimeout(), this.resetTimeoutPeriod(), this.resetKeepAliveInterval(), [4, t];
|
|
1566
|
+
case 3:
|
|
1567
|
+
return s.sent(), this.connectionState = R.Connected, [
|
|
1568
|
+
2
|
|
1569
|
+
|
|
1570
|
+
/*return*/
|
|
1571
|
+
];
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1574
|
+
});
|
|
1575
|
+
}, n.prototype.stop = function() {
|
|
1576
|
+
return this.logger.log(h.Debug, "Stopping HubConnection."), this.cleanupTimeout(), this.cleanupPingTimer(), this.connection.stop();
|
|
1577
|
+
}, n.prototype.stream = function(e) {
|
|
1578
|
+
for (var t = this, i = [], s = 1; s < arguments.length; s++) { i[s - 1] = arguments[s]; }
|
|
1579
|
+
let r = this.createStreamInvocation(e, i), a, c = new Pt();
|
|
1580
|
+
c.cancelCallback = function() {
|
|
1581
|
+
let o = t.createCancelInvocation(r.invocationId), l = t.protocol.writeMessage(o);
|
|
1582
|
+
return delete t.callbacks[r.invocationId], a.then(function() {
|
|
1583
|
+
return t.sendMessage(l);
|
|
1584
|
+
});
|
|
1585
|
+
}, this.callbacks[r.invocationId] = function(o, l) {
|
|
1586
|
+
if (l) {
|
|
1587
|
+
c.error(l);
|
|
1588
|
+
return;
|
|
1589
|
+
} o && (o.type === w.Completion ? o.error ? c.error(new Error(o.error)) : c.complete() : c.next(o.item));
|
|
1590
|
+
};
|
|
1591
|
+
let u = this.protocol.writeMessage(r);
|
|
1592
|
+
return a = this.sendMessage(u).catch(function(o) {
|
|
1593
|
+
c.error(o), delete t.callbacks[r.invocationId];
|
|
1594
|
+
}), c;
|
|
1595
|
+
}, n.prototype.sendMessage = function(e) {
|
|
1596
|
+
return this.resetKeepAliveInterval(), this.connection.send(e);
|
|
1597
|
+
}, n.prototype.send = function(e) {
|
|
1598
|
+
for (var t = [], i = 1; i < arguments.length; i++) { t[i - 1] = arguments[i]; }
|
|
1599
|
+
let s = this.createInvocation(e, t, !0), r = this.protocol.writeMessage(s);
|
|
1600
|
+
return this.sendMessage(r);
|
|
1601
|
+
}, n.prototype.invoke = function(e) {
|
|
1602
|
+
for (var t = this, i = [], s = 1; s < arguments.length; s++) { i[s - 1] = arguments[s]; }
|
|
1603
|
+
let r = this.createInvocation(e, i, !1), a = new Promise(function(c, u) {
|
|
1604
|
+
t.callbacks[r.invocationId] = function(l, d) {
|
|
1605
|
+
if (d) {
|
|
1606
|
+
u(d);
|
|
1607
|
+
return;
|
|
1608
|
+
} l && (l.type === w.Completion ? l.error ? u(new Error(l.error)) : c(l.result) : u(new Error("Unexpected message type: " + l.type)));
|
|
1609
|
+
};
|
|
1610
|
+
let o = t.protocol.writeMessage(r);
|
|
1611
|
+
t.sendMessage(o).catch(function(l) {
|
|
1612
|
+
u(l), delete t.callbacks[r.invocationId];
|
|
1613
|
+
});
|
|
1614
|
+
});
|
|
1615
|
+
return a;
|
|
1616
|
+
}, n.prototype.on = function(e, t) {
|
|
1617
|
+
!e || !t || (e = e.toLowerCase(), this.methods[e] || (this.methods[e] = []), this.methods[e].indexOf(t) === -1 && this.methods[e].push(t));
|
|
1618
|
+
}, n.prototype.off = function(e, t) {
|
|
1619
|
+
if (e) {
|
|
1620
|
+
e = e.toLowerCase();
|
|
1621
|
+
let i = this.methods[e];
|
|
1622
|
+
if (i) {
|
|
1623
|
+
if (t) {
|
|
1624
|
+
let s = i.indexOf(t);
|
|
1625
|
+
s !== -1 && (i.splice(s, 1), i.length === 0 && delete this.methods[e]);
|
|
1626
|
+
} else { delete this.methods[e]; }
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}, n.prototype.onclose = function(e) {
|
|
1630
|
+
e && this.closedCallbacks.push(e);
|
|
1631
|
+
}, n.prototype.processIncomingData = function(e) {
|
|
1632
|
+
if (this.cleanupTimeout(), this.receivedHandshakeResponse || (e = this.processHandshakeResponse(e), this.receivedHandshakeResponse = !0), e) {
|
|
1633
|
+
for (let t = this.protocol.parseMessages(e, this.logger), i = 0, s = t; i < s.length; i++) {
|
|
1634
|
+
let r = s[i];
|
|
1635
|
+
switch (r.type) {
|
|
1636
|
+
case w.Invocation:
|
|
1637
|
+
this.invokeClientMethod(r);
|
|
1638
|
+
break;
|
|
1639
|
+
case w.StreamItem:
|
|
1640
|
+
case w.Completion:
|
|
1641
|
+
var a = this.callbacks[r.invocationId];
|
|
1642
|
+
a != null && (r.type === w.Completion && delete this.callbacks[r.invocationId], a(r));
|
|
1643
|
+
break;
|
|
1644
|
+
case w.Ping:
|
|
1645
|
+
break;
|
|
1646
|
+
case w.Close:
|
|
1647
|
+
this.logger.log(h.Information, "Close message received from server."), this.connection.stop(r.error ? new Error("Server returned an error on close: " + r.error) : void 0);
|
|
1648
|
+
break;
|
|
1649
|
+
default:
|
|
1650
|
+
this.logger.log(h.Warning, "Invalid message type: " + r.type + ".");
|
|
1651
|
+
break;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
this.resetTimeoutPeriod();
|
|
1656
|
+
}, n.prototype.processHandshakeResponse = function(e) {
|
|
1657
|
+
let t, i, s;
|
|
1658
|
+
try {
|
|
1659
|
+
t = this.handshakeProtocol.parseHandshakeResponse(e), s = t[0], i = t[1];
|
|
1660
|
+
} catch (c) {
|
|
1661
|
+
var r = "Error parsing handshake response: " + c;
|
|
1662
|
+
this.logger.log(h.Error, r);
|
|
1663
|
+
let a = new Error(r);
|
|
1664
|
+
throw this.connection.stop(a), this.handshakeRejecter(a), a;
|
|
1665
|
+
}
|
|
1666
|
+
if (i.error) {
|
|
1667
|
+
var r = "Server returned handshake error: " + i.error;
|
|
1668
|
+
throw this.logger.log(h.Error, r), this.handshakeRejecter(r), this.connection.stop(new Error(r)), new Error(r);
|
|
1669
|
+
} else { this.logger.log(h.Debug, "Server handshake complete."); }
|
|
1670
|
+
return this.handshakeResolver(), s;
|
|
1671
|
+
}, n.prototype.resetKeepAliveInterval = function() {
|
|
1672
|
+
let e = this;
|
|
1673
|
+
this.cleanupPingTimer(), this.pingServerHandle = setTimeout(function() {
|
|
1674
|
+
return Be(e, void 0, void 0, function() {
|
|
1675
|
+
return De(this, function(t) {
|
|
1676
|
+
switch (t.label) {
|
|
1677
|
+
case 0:
|
|
1678
|
+
if (this.connectionState !== R.Connected) { return [3, 4]; }
|
|
1679
|
+
t.label = 1;
|
|
1680
|
+
case 1:
|
|
1681
|
+
return t.trys.push([1, 3, , 4]), [4, this.sendMessage(this.cachedPingMessage)];
|
|
1682
|
+
case 2:
|
|
1683
|
+
return t.sent(), [3, 4];
|
|
1684
|
+
case 3:
|
|
1685
|
+
return t.sent(), this.cleanupPingTimer(), [3, 4];
|
|
1686
|
+
case 4:
|
|
1687
|
+
return [
|
|
1688
|
+
2
|
|
1689
|
+
|
|
1690
|
+
/*return*/
|
|
1691
|
+
];
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
});
|
|
1695
|
+
}, this.keepAliveIntervalInMilliseconds);
|
|
1696
|
+
}, n.prototype.resetTimeoutPeriod = function() {
|
|
1697
|
+
let e = this;
|
|
1698
|
+
(!this.connection.features || !this.connection.features.inherentKeepAlive) && (this.timeoutHandle = setTimeout(function() {
|
|
1699
|
+
return e.serverTimeout();
|
|
1700
|
+
}, this.serverTimeoutInMilliseconds));
|
|
1701
|
+
}, n.prototype.serverTimeout = function() {
|
|
1702
|
+
this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
|
|
1703
|
+
}, n.prototype.invokeClientMethod = function(e) {
|
|
1704
|
+
let t = this, i = this.methods[e.target.toLowerCase()];
|
|
1705
|
+
if (i) {
|
|
1706
|
+
if (i.forEach(function(r) {
|
|
1707
|
+
return r.apply(t, e.arguments);
|
|
1708
|
+
}), e.invocationId) {
|
|
1709
|
+
let s = "Server requested a response, which is not supported in this version of the client.";
|
|
1710
|
+
this.logger.log(h.Error, s), this.connection.stop(new Error(s));
|
|
1711
|
+
}
|
|
1712
|
+
} else { this.logger.log(h.Warning, "No client method with the name '" + e.target + "' found."); }
|
|
1713
|
+
}, n.prototype.connectionClosed = function(e) {
|
|
1714
|
+
let t = this, i = this.callbacks;
|
|
1715
|
+
this.callbacks = {}, this.connectionState = R.Disconnected, this.handshakeRejecter && this.handshakeRejecter(e), Object.keys(i).forEach(function(s) {
|
|
1716
|
+
let r = i[s];
|
|
1717
|
+
r(null, e || new Error("Invocation canceled due to connection being closed."));
|
|
1718
|
+
}), this.cleanupTimeout(), this.cleanupPingTimer(), this.closedCallbacks.forEach(function(s) {
|
|
1719
|
+
return s.apply(t, [e]);
|
|
1720
|
+
});
|
|
1721
|
+
}, n.prototype.cleanupPingTimer = function() {
|
|
1722
|
+
this.pingServerHandle && clearTimeout(this.pingServerHandle);
|
|
1723
|
+
}, n.prototype.cleanupTimeout = function() {
|
|
1724
|
+
this.timeoutHandle && clearTimeout(this.timeoutHandle);
|
|
1725
|
+
}, n.prototype.createInvocation = function(e, t, i) {
|
|
1726
|
+
if (i) {
|
|
1727
|
+
return {
|
|
1728
|
+
arguments: t,
|
|
1729
|
+
target: e,
|
|
1730
|
+
type: w.Invocation
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
let s = this.id;
|
|
1734
|
+
return this.id++, {
|
|
1735
|
+
arguments: t,
|
|
1736
|
+
invocationId: s.toString(),
|
|
1737
|
+
target: e,
|
|
1738
|
+
type: w.Invocation
|
|
1739
|
+
};
|
|
1740
|
+
}, n.prototype.createStreamInvocation = function(e, t) {
|
|
1741
|
+
let i = this.id;
|
|
1742
|
+
return this.id++, {
|
|
1743
|
+
arguments: t,
|
|
1744
|
+
invocationId: i.toString(),
|
|
1745
|
+
target: e,
|
|
1746
|
+
type: w.StreamInvocation
|
|
1747
|
+
};
|
|
1748
|
+
}, n.prototype.createCancelInvocation = function(e) {
|
|
1749
|
+
return {
|
|
1750
|
+
invocationId: e,
|
|
1751
|
+
type: w.CancelInvocation
|
|
1752
|
+
};
|
|
1753
|
+
}, n;
|
|
1754
|
+
})()
|
|
1755
|
+
, v;
|
|
1756
|
+
(function(n) {
|
|
1757
|
+
n[n.None = 0] = "None", n[n.WebSockets = 1] = "WebSockets", n[n.ServerSentEvents = 2] = "ServerSentEvents", n[n.LongPolling = 4] = "LongPolling";
|
|
1758
|
+
})(v || (v = {}));
|
|
1759
|
+
let y;
|
|
1760
|
+
(function(n) {
|
|
1761
|
+
n[n.Text = 1] = "Text", n[n.Binary = 2] = "Binary";
|
|
1762
|
+
})(y || (y = {}));
|
|
1763
|
+
let Jt = (
|
|
1764
|
+
|
|
1765
|
+
/** @class */
|
|
1766
|
+
function() {
|
|
1767
|
+
function n() {
|
|
1768
|
+
this.isAborted = !1, this.onabort = null;
|
|
1769
|
+
}
|
|
1770
|
+
return n.prototype.abort = function() {
|
|
1771
|
+
this.isAborted || (this.isAborted = !0, this.onabort && this.onabort());
|
|
1772
|
+
}, Object.defineProperty(n.prototype, "signal", {
|
|
1773
|
+
get: function() {
|
|
1774
|
+
return this;
|
|
1775
|
+
},
|
|
1776
|
+
enumerable: !0,
|
|
1777
|
+
configurable: !0
|
|
1778
|
+
}), Object.defineProperty(n.prototype, "aborted", {
|
|
1779
|
+
get: function() {
|
|
1780
|
+
return this.isAborted;
|
|
1781
|
+
},
|
|
1782
|
+
enumerable: !0,
|
|
1783
|
+
configurable: !0
|
|
1784
|
+
}), n;
|
|
1785
|
+
})()
|
|
1786
|
+
, F = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
1787
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
1788
|
+
function a(o) {
|
|
1789
|
+
try {
|
|
1790
|
+
u(i.next(o));
|
|
1791
|
+
} catch (l) {
|
|
1792
|
+
r(l);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
function c(o) {
|
|
1796
|
+
try {
|
|
1797
|
+
u(i.throw(o));
|
|
1798
|
+
} catch (l) {
|
|
1799
|
+
r(l);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
function u(o) {
|
|
1803
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
1804
|
+
l(o.value);
|
|
1805
|
+
}).then(a, c);
|
|
1806
|
+
}
|
|
1807
|
+
u((i = i.apply(n, e || [])).next());
|
|
1808
|
+
});
|
|
1809
|
+
}, H = globalThis && globalThis.__generator || function(n, e) {
|
|
1810
|
+
let t = { label: 0, sent: function() {
|
|
1811
|
+
if (r[0] & 1) { throw r[1]; }
|
|
1812
|
+
return r[1];
|
|
1813
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
1814
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
1815
|
+
return this;
|
|
1816
|
+
}), a;
|
|
1817
|
+
function c(o) {
|
|
1818
|
+
return function(l) {
|
|
1819
|
+
return u([o, l]);
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
function u(o) {
|
|
1823
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
1824
|
+
for (; t;) {
|
|
1825
|
+
try {
|
|
1826
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
1827
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
1828
|
+
case 0:
|
|
1829
|
+
case 1:
|
|
1830
|
+
r = o;
|
|
1831
|
+
break;
|
|
1832
|
+
case 4:
|
|
1833
|
+
return t.label++, { value: o[1], done: !1 };
|
|
1834
|
+
case 5:
|
|
1835
|
+
t.label++, s = o[1], o = [0];
|
|
1836
|
+
continue;
|
|
1837
|
+
case 7:
|
|
1838
|
+
o = t.ops.pop(), t.trys.pop();
|
|
1839
|
+
continue;
|
|
1840
|
+
default:
|
|
1841
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
1842
|
+
t = 0;
|
|
1843
|
+
continue;
|
|
1844
|
+
}
|
|
1845
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
1846
|
+
t.label = o[1];
|
|
1847
|
+
break;
|
|
1848
|
+
}
|
|
1849
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
1850
|
+
t.label = r[1], r = o;
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
if (r && t.label < r[2]) {
|
|
1854
|
+
t.label = r[2], t.ops.push(o);
|
|
1855
|
+
break;
|
|
1856
|
+
}
|
|
1857
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
1858
|
+
continue;
|
|
1859
|
+
}
|
|
1860
|
+
o = e.call(n, t);
|
|
1861
|
+
} catch (l) {
|
|
1862
|
+
o = [6, l], s = 0;
|
|
1863
|
+
} finally {
|
|
1864
|
+
i = r = 0;
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
if (o[0] & 5) { throw o[1]; }
|
|
1868
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
1869
|
+
}
|
|
1870
|
+
}, Fe = (
|
|
1871
|
+
|
|
1872
|
+
/** @class */
|
|
1873
|
+
function() {
|
|
1874
|
+
function n(e, t, i, s) {
|
|
1875
|
+
this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.pollAbort = new Jt(), this.logMessageContent = s, this.running = !1, this.onreceive = null, this.onclose = null;
|
|
1876
|
+
}
|
|
1877
|
+
return Object.defineProperty(n.prototype, "pollAborted", {
|
|
1878
|
+
// This is an internal type, not exported from 'index' so this is really just internal.
|
|
1879
|
+
get: function() {
|
|
1880
|
+
return this.pollAbort.aborted;
|
|
1881
|
+
},
|
|
1882
|
+
enumerable: !0,
|
|
1883
|
+
configurable: !0
|
|
1884
|
+
}), n.prototype.connect = function(e, t) {
|
|
1885
|
+
return F(this, void 0, void 0, function() {
|
|
1886
|
+
let i, s, r, a;
|
|
1887
|
+
return H(this, function(c) {
|
|
1888
|
+
switch (c.label) {
|
|
1889
|
+
case 0:
|
|
1890
|
+
if (S.isRequired(e, "url"), S.isRequired(t, "transferFormat"), S.isIn(t, y, "transferFormat"), this.url = e, this.logger.log(h.Trace, "(LongPolling transport) Connecting."), t === y.Binary && typeof XMLHttpRequest < "u" && typeof new XMLHttpRequest().responseType != "string") { throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported."); }
|
|
1891
|
+
return i = {
|
|
1892
|
+
abortSignal: this.pollAbort.signal,
|
|
1893
|
+
headers: {},
|
|
1894
|
+
timeout: 1e5
|
|
1895
|
+
}, t === y.Binary && (i.responseType = "arraybuffer"), [4, this.getAccessToken()];
|
|
1896
|
+
case 1:
|
|
1897
|
+
return s = c.sent(), this.updateHeaderToken(i, s), r = e + "&_=" + Date.now(), this.logger.log(h.Trace, "(LongPolling transport) polling: " + r + "."), [4, this.httpClient.get(r, i)];
|
|
1898
|
+
case 2:
|
|
1899
|
+
return a = c.sent(), a.statusCode !== 200 ? (this.logger.log(h.Error, "(LongPolling transport) Unexpected response code: " + a.statusCode + "."), this.closeError = new J(a.statusText || "", a.statusCode), this.running = !1) : this.running = !0, this.receiving = this.poll(this.url, i), [
|
|
1900
|
+
2
|
|
1901
|
+
|
|
1902
|
+
/*return*/
|
|
1903
|
+
];
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
});
|
|
1907
|
+
}, n.prototype.getAccessToken = function() {
|
|
1908
|
+
return F(this, void 0, void 0, function() {
|
|
1909
|
+
return H(this, function(e) {
|
|
1910
|
+
switch (e.label) {
|
|
1911
|
+
case 0:
|
|
1912
|
+
return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];
|
|
1913
|
+
case 1:
|
|
1914
|
+
return [2, e.sent()];
|
|
1915
|
+
case 2:
|
|
1916
|
+
return [2, null];
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
});
|
|
1920
|
+
}, n.prototype.updateHeaderToken = function(e, t) {
|
|
1921
|
+
if (e.headers || (e.headers = {}), t) {
|
|
1922
|
+
e.headers.Authorization = "Bearer " + t;
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
e.headers.Authorization && delete e.headers.Authorization;
|
|
1926
|
+
}, n.prototype.poll = function(e, t) {
|
|
1927
|
+
return F(this, void 0, void 0, function() {
|
|
1928
|
+
let i, s, r, a;
|
|
1929
|
+
return H(this, function(c) {
|
|
1930
|
+
switch (c.label) {
|
|
1931
|
+
case 0:
|
|
1932
|
+
c.trys.push([0, , 8, 9]), c.label = 1;
|
|
1933
|
+
case 1:
|
|
1934
|
+
return this.running ? [4, this.getAccessToken()] : [3, 7];
|
|
1935
|
+
case 2:
|
|
1936
|
+
i = c.sent(), this.updateHeaderToken(t, i), c.label = 3;
|
|
1937
|
+
case 3:
|
|
1938
|
+
return c.trys.push([3, 5, , 6]), s = e + "&_=" + Date.now(), this.logger.log(h.Trace, "(LongPolling transport) polling: " + s + "."), [4, this.httpClient.get(s, t)];
|
|
1939
|
+
case 4:
|
|
1940
|
+
return r = c.sent(), r.statusCode === 204 ? (this.logger.log(h.Information, "(LongPolling transport) Poll terminated by server."), this.running = !1) : r.statusCode !== 200 ? (this.logger.log(h.Error, "(LongPolling transport) Unexpected response code: " + r.statusCode + "."), this.closeError = new J(r.statusText || "", r.statusCode), this.running = !1) : r.content ? (this.logger.log(h.Trace, "(LongPolling transport) data received. " + X(r.content, this.logMessageContent) + "."), this.onreceive && this.onreceive(r.content)) : this.logger.log(h.Trace, "(LongPolling transport) Poll timed out, reissuing."), [3, 6];
|
|
1941
|
+
case 5:
|
|
1942
|
+
return a = c.sent(), this.running ? a instanceof Oe ? this.logger.log(h.Trace, "(LongPolling transport) Poll timed out, reissuing.") : (this.closeError = a, this.running = !1) : this.logger.log(h.Trace, "(LongPolling transport) Poll errored after shutdown: " + a.message), [3, 6];
|
|
1943
|
+
case 6:
|
|
1944
|
+
return [3, 1];
|
|
1945
|
+
case 7:
|
|
1946
|
+
return [3, 9];
|
|
1947
|
+
case 8:
|
|
1948
|
+
return this.logger.log(h.Trace, "(LongPolling transport) Polling complete."), this.pollAborted || this.raiseOnClose(), [
|
|
1949
|
+
7
|
|
1950
|
+
|
|
1951
|
+
/*endfinally*/
|
|
1952
|
+
];
|
|
1953
|
+
case 9:
|
|
1954
|
+
return [
|
|
1955
|
+
2
|
|
1956
|
+
|
|
1957
|
+
/*return*/
|
|
1958
|
+
];
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
}, n.prototype.send = function(e) {
|
|
1963
|
+
return F(this, void 0, void 0, function() {
|
|
1964
|
+
return H(this, function(t) {
|
|
1965
|
+
return this.running ? [2, Ze(this.logger, "LongPolling", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))];
|
|
1966
|
+
});
|
|
1967
|
+
});
|
|
1968
|
+
}, n.prototype.stop = function() {
|
|
1969
|
+
return F(this, void 0, void 0, function() {
|
|
1970
|
+
let e, t;
|
|
1971
|
+
return H(this, function(i) {
|
|
1972
|
+
switch (i.label) {
|
|
1973
|
+
case 0:
|
|
1974
|
+
this.logger.log(h.Trace, "(LongPolling transport) Stopping polling."), this.running = !1, this.pollAbort.abort(), i.label = 1;
|
|
1975
|
+
case 1:
|
|
1976
|
+
return i.trys.push([1, , 5, 6]), [4, this.receiving];
|
|
1977
|
+
case 2:
|
|
1978
|
+
return i.sent(), this.logger.log(h.Trace, "(LongPolling transport) sending DELETE request to " + this.url + "."), e = {
|
|
1979
|
+
headers: {}
|
|
1980
|
+
}, [4, this.getAccessToken()];
|
|
1981
|
+
case 3:
|
|
1982
|
+
return t = i.sent(), this.updateHeaderToken(e, t), [4, this.httpClient.delete(this.url, e)];
|
|
1983
|
+
case 4:
|
|
1984
|
+
return i.sent(), this.logger.log(h.Trace, "(LongPolling transport) DELETE request sent."), [3, 6];
|
|
1985
|
+
case 5:
|
|
1986
|
+
return this.logger.log(h.Trace, "(LongPolling transport) Stop finished."), this.raiseOnClose(), [
|
|
1987
|
+
7
|
|
1988
|
+
|
|
1989
|
+
/*endfinally*/
|
|
1990
|
+
];
|
|
1991
|
+
case 6:
|
|
1992
|
+
return [
|
|
1993
|
+
2
|
|
1994
|
+
|
|
1995
|
+
/*return*/
|
|
1996
|
+
];
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
});
|
|
2000
|
+
}, n.prototype.raiseOnClose = function() {
|
|
2001
|
+
if (this.onclose) {
|
|
2002
|
+
let e = "(LongPolling transport) Firing onclose event.";
|
|
2003
|
+
this.closeError && (e += " Error: " + this.closeError), this.logger.log(h.Trace, e), this.onclose(this.closeError);
|
|
2004
|
+
}
|
|
2005
|
+
}, n;
|
|
2006
|
+
})()
|
|
2007
|
+
, He = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
2008
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
2009
|
+
function a(o) {
|
|
2010
|
+
try {
|
|
2011
|
+
u(i.next(o));
|
|
2012
|
+
} catch (l) {
|
|
2013
|
+
r(l);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
function c(o) {
|
|
2017
|
+
try {
|
|
2018
|
+
u(i.throw(o));
|
|
2019
|
+
} catch (l) {
|
|
2020
|
+
r(l);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
function u(o) {
|
|
2024
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
2025
|
+
l(o.value);
|
|
2026
|
+
}).then(a, c);
|
|
2027
|
+
}
|
|
2028
|
+
u((i = i.apply(n, e || [])).next());
|
|
2029
|
+
});
|
|
2030
|
+
}, Ue = globalThis && globalThis.__generator || function(n, e) {
|
|
2031
|
+
let t = { label: 0, sent: function() {
|
|
2032
|
+
if (r[0] & 1) { throw r[1]; }
|
|
2033
|
+
return r[1];
|
|
2034
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
2035
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
2036
|
+
return this;
|
|
2037
|
+
}), a;
|
|
2038
|
+
function c(o) {
|
|
2039
|
+
return function(l) {
|
|
2040
|
+
return u([o, l]);
|
|
2041
|
+
};
|
|
2042
|
+
}
|
|
2043
|
+
function u(o) {
|
|
2044
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
2045
|
+
for (; t;) {
|
|
2046
|
+
try {
|
|
2047
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
2048
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
2049
|
+
case 0:
|
|
2050
|
+
case 1:
|
|
2051
|
+
r = o;
|
|
2052
|
+
break;
|
|
2053
|
+
case 4:
|
|
2054
|
+
return t.label++, { value: o[1], done: !1 };
|
|
2055
|
+
case 5:
|
|
2056
|
+
t.label++, s = o[1], o = [0];
|
|
2057
|
+
continue;
|
|
2058
|
+
case 7:
|
|
2059
|
+
o = t.ops.pop(), t.trys.pop();
|
|
2060
|
+
continue;
|
|
2061
|
+
default:
|
|
2062
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
2063
|
+
t = 0;
|
|
2064
|
+
continue;
|
|
2065
|
+
}
|
|
2066
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
2067
|
+
t.label = o[1];
|
|
2068
|
+
break;
|
|
2069
|
+
}
|
|
2070
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
2071
|
+
t.label = r[1], r = o;
|
|
2072
|
+
break;
|
|
2073
|
+
}
|
|
2074
|
+
if (r && t.label < r[2]) {
|
|
2075
|
+
t.label = r[2], t.ops.push(o);
|
|
2076
|
+
break;
|
|
2077
|
+
}
|
|
2078
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
2079
|
+
continue;
|
|
2080
|
+
}
|
|
2081
|
+
o = e.call(n, t);
|
|
2082
|
+
} catch (l) {
|
|
2083
|
+
o = [6, l], s = 0;
|
|
2084
|
+
} finally {
|
|
2085
|
+
i = r = 0;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
if (o[0] & 5) { throw o[1]; }
|
|
2089
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
2090
|
+
}
|
|
2091
|
+
}, Xt = (
|
|
2092
|
+
|
|
2093
|
+
/** @class */
|
|
2094
|
+
function() {
|
|
2095
|
+
function n(e, t, i, s, r) {
|
|
2096
|
+
this.httpClient = e, this.accessTokenFactory = t, this.logger = i, this.logMessageContent = s, this.eventSourceConstructor = r, this.onreceive = null, this.onclose = null;
|
|
2097
|
+
}
|
|
2098
|
+
return n.prototype.connect = function(e, t) {
|
|
2099
|
+
return He(this, void 0, void 0, function() {
|
|
2100
|
+
let i, s = this;
|
|
2101
|
+
return Ue(this, function(r) {
|
|
2102
|
+
switch (r.label) {
|
|
2103
|
+
case 0:
|
|
2104
|
+
return S.isRequired(e, "url"), S.isRequired(t, "transferFormat"), S.isIn(t, y, "transferFormat"), this.logger.log(h.Trace, "(SSE transport) Connecting."), this.url = e, this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];
|
|
2105
|
+
case 1:
|
|
2106
|
+
i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2;
|
|
2107
|
+
case 2:
|
|
2108
|
+
return [2, new Promise(function(a, c) {
|
|
2109
|
+
let u = !1;
|
|
2110
|
+
if (t !== y.Text) {
|
|
2111
|
+
c(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
let o;
|
|
2115
|
+
if (typeof window < "u") { o = new s.eventSourceConstructor(e, { withCredentials: !0 }); } else {
|
|
2116
|
+
let l = s.httpClient.getCookieString(e);
|
|
2117
|
+
o = new s.eventSourceConstructor(e, { withCredentials: !0, headers: { Cookie: l } });
|
|
2118
|
+
}
|
|
2119
|
+
try {
|
|
2120
|
+
o.onmessage = function(d) {
|
|
2121
|
+
if (s.onreceive) {
|
|
2122
|
+
try {
|
|
2123
|
+
s.logger.log(h.Trace, "(SSE transport) data received. " + X(d.data, s.logMessageContent) + "."), s.onreceive(d.data);
|
|
2124
|
+
} catch (f) {
|
|
2125
|
+
s.close(f);
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}, o.onerror = function(d) {
|
|
2130
|
+
let f = new Error(d.data || "Error occurred");
|
|
2131
|
+
u ? s.close(f) : c(f);
|
|
2132
|
+
}, o.onopen = function() {
|
|
2133
|
+
s.logger.log(h.Information, "SSE connected to " + s.url), s.eventSource = o, u = !0, a();
|
|
2134
|
+
};
|
|
2135
|
+
} catch (d) {
|
|
2136
|
+
c(d);
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
})];
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
});
|
|
2143
|
+
}, n.prototype.send = function(e) {
|
|
2144
|
+
return He(this, void 0, void 0, function() {
|
|
2145
|
+
return Ue(this, function(t) {
|
|
2146
|
+
return this.eventSource ? [2, Ze(this.logger, "SSE", this.httpClient, this.url, this.accessTokenFactory, e, this.logMessageContent)] : [2, Promise.reject(new Error("Cannot send until the transport is connected"))];
|
|
2147
|
+
});
|
|
2148
|
+
});
|
|
2149
|
+
}, n.prototype.stop = function() {
|
|
2150
|
+
return this.close(), Promise.resolve();
|
|
2151
|
+
}, n.prototype.close = function(e) {
|
|
2152
|
+
this.eventSource && (this.eventSource.close(), this.eventSource = void 0, this.onclose && this.onclose(e));
|
|
2153
|
+
}, n;
|
|
2154
|
+
})()
|
|
2155
|
+
, Yt = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
2156
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
2157
|
+
function a(o) {
|
|
2158
|
+
try {
|
|
2159
|
+
u(i.next(o));
|
|
2160
|
+
} catch (l) {
|
|
2161
|
+
r(l);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
function c(o) {
|
|
2165
|
+
try {
|
|
2166
|
+
u(i.throw(o));
|
|
2167
|
+
} catch (l) {
|
|
2168
|
+
r(l);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
function u(o) {
|
|
2172
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
2173
|
+
l(o.value);
|
|
2174
|
+
}).then(a, c);
|
|
2175
|
+
}
|
|
2176
|
+
u((i = i.apply(n, e || [])).next());
|
|
2177
|
+
});
|
|
2178
|
+
}, Qt = globalThis && globalThis.__generator || function(n, e) {
|
|
2179
|
+
let t = { label: 0, sent: function() {
|
|
2180
|
+
if (r[0] & 1) { throw r[1]; }
|
|
2181
|
+
return r[1];
|
|
2182
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
2183
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
2184
|
+
return this;
|
|
2185
|
+
}), a;
|
|
2186
|
+
function c(o) {
|
|
2187
|
+
return function(l) {
|
|
2188
|
+
return u([o, l]);
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
function u(o) {
|
|
2192
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
2193
|
+
for (; t;) {
|
|
2194
|
+
try {
|
|
2195
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
2196
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
2197
|
+
case 0:
|
|
2198
|
+
case 1:
|
|
2199
|
+
r = o;
|
|
2200
|
+
break;
|
|
2201
|
+
case 4:
|
|
2202
|
+
return t.label++, { value: o[1], done: !1 };
|
|
2203
|
+
case 5:
|
|
2204
|
+
t.label++, s = o[1], o = [0];
|
|
2205
|
+
continue;
|
|
2206
|
+
case 7:
|
|
2207
|
+
o = t.ops.pop(), t.trys.pop();
|
|
2208
|
+
continue;
|
|
2209
|
+
default:
|
|
2210
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
2211
|
+
t = 0;
|
|
2212
|
+
continue;
|
|
2213
|
+
}
|
|
2214
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
2215
|
+
t.label = o[1];
|
|
2216
|
+
break;
|
|
2217
|
+
}
|
|
2218
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
2219
|
+
t.label = r[1], r = o;
|
|
2220
|
+
break;
|
|
2221
|
+
}
|
|
2222
|
+
if (r && t.label < r[2]) {
|
|
2223
|
+
t.label = r[2], t.ops.push(o);
|
|
2224
|
+
break;
|
|
2225
|
+
}
|
|
2226
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
2227
|
+
continue;
|
|
2228
|
+
}
|
|
2229
|
+
o = e.call(n, t);
|
|
2230
|
+
} catch (l) {
|
|
2231
|
+
o = [6, l], s = 0;
|
|
2232
|
+
} finally {
|
|
2233
|
+
i = r = 0;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
if (o[0] & 5) { throw o[1]; }
|
|
2237
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
2238
|
+
}
|
|
2239
|
+
}, Zt = (
|
|
2240
|
+
|
|
2241
|
+
/** @class */
|
|
2242
|
+
function() {
|
|
2243
|
+
function n(e, t, i, s, r) {
|
|
2244
|
+
this.logger = i, this.accessTokenFactory = t, this.logMessageContent = s, this.webSocketConstructor = r, this.httpClient = e, this.onreceive = null, this.onclose = null;
|
|
2245
|
+
}
|
|
2246
|
+
return n.prototype.connect = function(e, t) {
|
|
2247
|
+
return Yt(this, void 0, void 0, function() {
|
|
2248
|
+
let i, s = this;
|
|
2249
|
+
return Qt(this, function(r) {
|
|
2250
|
+
switch (r.label) {
|
|
2251
|
+
case 0:
|
|
2252
|
+
return S.isRequired(e, "url"), S.isRequired(t, "transferFormat"), S.isIn(t, y, "transferFormat"), this.logger.log(h.Trace, "(WebSockets transport) Connecting."), this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];
|
|
2253
|
+
case 1:
|
|
2254
|
+
i = r.sent(), i && (e += (e.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(i))), r.label = 2;
|
|
2255
|
+
case 2:
|
|
2256
|
+
return [2, new Promise(function(a, c) {
|
|
2257
|
+
e = e.replace(/^http/, "ws");
|
|
2258
|
+
let u, o = s.httpClient.getCookieString(e);
|
|
2259
|
+
typeof window > "u" && o && (u = new s.webSocketConstructor(e, void 0, {
|
|
2260
|
+
headers: {
|
|
2261
|
+
Cookie: "" + o
|
|
2262
|
+
}
|
|
2263
|
+
})), u || (u = new s.webSocketConstructor(e)), t === y.Binary && (u.binaryType = "arraybuffer"), u.onopen = function(l) {
|
|
2264
|
+
s.logger.log(h.Information, "WebSocket connected to " + e + "."), s.webSocket = u, a();
|
|
2265
|
+
}, u.onerror = function(l) {
|
|
2266
|
+
let d = null;
|
|
2267
|
+
typeof ErrorEvent < "u" && l instanceof ErrorEvent && (d = l.error), c(d);
|
|
2268
|
+
}, u.onmessage = function(l) {
|
|
2269
|
+
s.logger.log(h.Trace, "(WebSockets transport) data received. " + X(l.data, s.logMessageContent) + "."), s.onreceive && s.onreceive(l.data);
|
|
2270
|
+
}, u.onclose = function(l) {
|
|
2271
|
+
return s.close(l);
|
|
2272
|
+
};
|
|
2273
|
+
})];
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
});
|
|
2277
|
+
}, n.prototype.send = function(e) {
|
|
2278
|
+
return this.webSocket && this.webSocket.readyState === this.webSocketConstructor.OPEN ? (this.logger.log(h.Trace, "(WebSockets transport) sending data. " + X(e, this.logMessageContent) + "."), this.webSocket.send(e), Promise.resolve()) : Promise.reject("WebSocket is not in the OPEN state");
|
|
2279
|
+
}, n.prototype.stop = function() {
|
|
2280
|
+
return this.webSocket && (this.webSocket.onclose = function() {
|
|
2281
|
+
}, this.webSocket.onmessage = function() {
|
|
2282
|
+
}, this.webSocket.onerror = function() {
|
|
2283
|
+
}, this.webSocket.close(), this.webSocket = void 0, this.close(void 0)), Promise.resolve();
|
|
2284
|
+
}, n.prototype.close = function(e) {
|
|
2285
|
+
this.logger.log(h.Trace, "(WebSockets transport) socket closed."), this.onclose && (e && (e.wasClean === !1 || e.code !== 1e3) ? this.onclose(new Error("WebSocket closed with status code: " + e.code + " (" + e.reason + ").")) : this.onclose());
|
|
2286
|
+
}, n;
|
|
2287
|
+
})()
|
|
2288
|
+
, ie = globalThis && globalThis.__awaiter || function(n, e, t, i) {
|
|
2289
|
+
return new (t || (t = Promise))(function(s, r) {
|
|
2290
|
+
function a(o) {
|
|
2291
|
+
try {
|
|
2292
|
+
u(i.next(o));
|
|
2293
|
+
} catch (l) {
|
|
2294
|
+
r(l);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function c(o) {
|
|
2298
|
+
try {
|
|
2299
|
+
u(i.throw(o));
|
|
2300
|
+
} catch (l) {
|
|
2301
|
+
r(l);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
function u(o) {
|
|
2305
|
+
o.done ? s(o.value) : new t(function(l) {
|
|
2306
|
+
l(o.value);
|
|
2307
|
+
}).then(a, c);
|
|
2308
|
+
}
|
|
2309
|
+
u((i = i.apply(n, e || [])).next());
|
|
2310
|
+
});
|
|
2311
|
+
}, U = globalThis && globalThis.__generator || function(n, e) {
|
|
2312
|
+
let t = { label: 0, sent: function() {
|
|
2313
|
+
if (r[0] & 1) { throw r[1]; }
|
|
2314
|
+
return r[1];
|
|
2315
|
+
}, trys: [], ops: [] }, i, s, r, a;
|
|
2316
|
+
return a = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
2317
|
+
return this;
|
|
2318
|
+
}), a;
|
|
2319
|
+
function c(o) {
|
|
2320
|
+
return function(l) {
|
|
2321
|
+
return u([o, l]);
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
function u(o) {
|
|
2325
|
+
if (i) { throw new TypeError("Generator is already executing."); }
|
|
2326
|
+
for (; t;) {
|
|
2327
|
+
try {
|
|
2328
|
+
if (i = 1, s && (r = o[0] & 2 ? s.return : o[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, o[1])).done) { return r; }
|
|
2329
|
+
switch (s = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
|
|
2330
|
+
case 0:
|
|
2331
|
+
case 1:
|
|
2332
|
+
r = o;
|
|
2333
|
+
break;
|
|
2334
|
+
case 4:
|
|
2335
|
+
return t.label++, { value: o[1], done: !1 };
|
|
2336
|
+
case 5:
|
|
2337
|
+
t.label++, s = o[1], o = [0];
|
|
2338
|
+
continue;
|
|
2339
|
+
case 7:
|
|
2340
|
+
o = t.ops.pop(), t.trys.pop();
|
|
2341
|
+
continue;
|
|
2342
|
+
default:
|
|
2343
|
+
if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
2344
|
+
t = 0;
|
|
2345
|
+
continue;
|
|
2346
|
+
}
|
|
2347
|
+
if (o[0] === 3 && (!r || o[1] > r[0] && o[1] < r[3])) {
|
|
2348
|
+
t.label = o[1];
|
|
2349
|
+
break;
|
|
2350
|
+
}
|
|
2351
|
+
if (o[0] === 6 && t.label < r[1]) {
|
|
2352
|
+
t.label = r[1], r = o;
|
|
2353
|
+
break;
|
|
2354
|
+
}
|
|
2355
|
+
if (r && t.label < r[2]) {
|
|
2356
|
+
t.label = r[2], t.ops.push(o);
|
|
2357
|
+
break;
|
|
2358
|
+
}
|
|
2359
|
+
r[2] && t.ops.pop(), t.trys.pop();
|
|
2360
|
+
continue;
|
|
2361
|
+
}
|
|
2362
|
+
o = e.call(n, t);
|
|
2363
|
+
} catch (l) {
|
|
2364
|
+
o = [6, l], s = 0;
|
|
2365
|
+
} finally {
|
|
2366
|
+
i = r = 0;
|
|
2367
|
+
}
|
|
338
2368
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
2369
|
+
if (o[0] & 5) { throw o[1]; }
|
|
2370
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
2371
|
+
}
|
|
2372
|
+
}, We = 100, ke = null, Ee = null;
|
|
2373
|
+
if (typeof window > "u" && typeof require < "u") {
|
|
2374
|
+
let Ke = typeof __webpack_require__ == "function" ? __non_webpack_require__ : require;
|
|
2375
|
+
ke = Ke("ws"), Ee = Ke("eventsource");
|
|
2376
|
+
}
|
|
2377
|
+
let ei = (
|
|
2378
|
+
|
|
2379
|
+
/** @class */
|
|
2380
|
+
function() {
|
|
2381
|
+
function n(e, t) {
|
|
2382
|
+
t === void 0 && (t = {}), this.features = {}, S.isRequired(e, "url"), this.logger = Gt(t.logger), this.baseUrl = this.resolveUrl(e), t = t || {}, t.logMessageContent = t.logMessageContent || !1;
|
|
2383
|
+
let i = typeof window > "u";
|
|
2384
|
+
!i && typeof WebSocket < "u" && !t.WebSocket ? t.WebSocket = WebSocket : i && !t.WebSocket && ke && (t.WebSocket = ke), !i && typeof EventSource < "u" && !t.EventSource ? t.EventSource = EventSource : i && !t.EventSource && typeof Ee < "u" && (t.EventSource = Ee), this.httpClient = t.httpClient || new Ht(this.logger), this.connectionState = 2, this.options = t, this.onreceive = null, this.onclose = null;
|
|
2385
|
+
}
|
|
2386
|
+
return n.prototype.start = function(e) {
|
|
2387
|
+
return e = e || y.Binary, S.isIn(e, y, "transferFormat"), this.logger.log(h.Debug, "Starting connection with transfer format '" + y[e] + "'."), this.connectionState !== 2 ? Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")) : (this.connectionState = 0, this.startPromise = this.startInternal(e), this.startPromise);
|
|
2388
|
+
}, n.prototype.send = function(e) {
|
|
2389
|
+
if (this.connectionState !== 1) { throw new Error("Cannot send data if the connection is not in the 'Connected' State."); }
|
|
2390
|
+
return this.transport.send(e);
|
|
2391
|
+
}, n.prototype.stop = function(e) {
|
|
2392
|
+
return ie(this, void 0, void 0, function() {
|
|
2393
|
+
return U(this, function(t) {
|
|
2394
|
+
switch (t.label) {
|
|
2395
|
+
case 0:
|
|
2396
|
+
this.connectionState = 2, this.stopError = e, t.label = 1;
|
|
2397
|
+
case 1:
|
|
2398
|
+
return t.trys.push([1, 3, , 4]), [4, this.startPromise];
|
|
2399
|
+
case 2:
|
|
2400
|
+
return t.sent(), [3, 4];
|
|
2401
|
+
case 3:
|
|
2402
|
+
return t.sent(), [3, 4];
|
|
2403
|
+
case 4:
|
|
2404
|
+
return this.transport ? [4, this.transport.stop()] : [3, 6];
|
|
2405
|
+
case 5:
|
|
2406
|
+
t.sent(), this.transport = void 0, t.label = 6;
|
|
2407
|
+
case 6:
|
|
2408
|
+
return [
|
|
2409
|
+
2
|
|
2410
|
+
|
|
2411
|
+
/*return*/
|
|
2412
|
+
];
|
|
2413
|
+
}
|
|
2414
|
+
});
|
|
2415
|
+
});
|
|
2416
|
+
}, n.prototype.startInternal = function(e) {
|
|
2417
|
+
return ie(this, void 0, void 0, function() {
|
|
2418
|
+
let t, i, s, r, a, c, u, o = this;
|
|
2419
|
+
return U(this, function(l) {
|
|
2420
|
+
switch (l.label) {
|
|
2421
|
+
case 0:
|
|
2422
|
+
t = this.baseUrl, this.accessTokenFactory = this.options.accessTokenFactory, l.label = 1;
|
|
2423
|
+
case 1:
|
|
2424
|
+
return l.trys.push([1, 12, , 13]), this.options.skipNegotiation ? this.options.transport !== v.WebSockets ? [3, 3] : (this.transport = this.constructTransport(v.WebSockets), [4, this.transport.connect(t, e)]) : [3, 5];
|
|
2425
|
+
case 2:
|
|
2426
|
+
return l.sent(), [3, 4];
|
|
2427
|
+
case 3:
|
|
2428
|
+
throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");
|
|
2429
|
+
case 4:
|
|
2430
|
+
return [3, 11];
|
|
2431
|
+
case 5:
|
|
2432
|
+
i = null, s = 0, r = function() {
|
|
2433
|
+
let d;
|
|
2434
|
+
return U(this, function(f) {
|
|
2435
|
+
switch (f.label) {
|
|
2436
|
+
case 0:
|
|
2437
|
+
return [4, a.getNegotiationResponse(t)];
|
|
2438
|
+
case 1:
|
|
2439
|
+
if (i = f.sent(), a.connectionState === 2) { return [2, { value: void 0 }]; }
|
|
2440
|
+
if (i.error) { throw Error(i.error); }
|
|
2441
|
+
if (i.ProtocolVersion) { throw Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); }
|
|
2442
|
+
return i.url && (t = i.url), i.accessToken && (d = i.accessToken, a.accessTokenFactory = function() {
|
|
2443
|
+
return d;
|
|
2444
|
+
}), s++, [
|
|
2445
|
+
2
|
|
2446
|
+
|
|
2447
|
+
/*return*/
|
|
2448
|
+
];
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2451
|
+
}, a = this, l.label = 6;
|
|
2452
|
+
case 6:
|
|
2453
|
+
return [5, r()];
|
|
2454
|
+
case 7:
|
|
2455
|
+
if (c = l.sent(), typeof c == "object") { return [2, c.value]; }
|
|
2456
|
+
l.label = 8;
|
|
2457
|
+
case 8:
|
|
2458
|
+
if (i.url && s < We) { return [3, 6]; }
|
|
2459
|
+
l.label = 9;
|
|
2460
|
+
case 9:
|
|
2461
|
+
if (s === We && i.url) { throw Error("Negotiate redirection limit exceeded."); }
|
|
2462
|
+
return [4, this.createTransport(t, this.options.transport, i, e)];
|
|
2463
|
+
case 10:
|
|
2464
|
+
l.sent(), l.label = 11;
|
|
2465
|
+
case 11:
|
|
2466
|
+
return this.transport instanceof Fe && (this.features.inherentKeepAlive = !0), this.transport.onreceive = this.onreceive, this.transport.onclose = function(d) {
|
|
2467
|
+
return o.stopConnection(d);
|
|
2468
|
+
}, this.changeState(
|
|
2469
|
+
0,
|
|
2470
|
+
1
|
|
2471
|
+
|
|
2472
|
+
/* Connected */
|
|
2473
|
+
), [3, 13];
|
|
2474
|
+
case 12:
|
|
2475
|
+
throw u = l.sent(), this.logger.log(h.Error, "Failed to start the connection: " + u), this.connectionState = 2, this.transport = void 0, u;
|
|
2476
|
+
case 13:
|
|
2477
|
+
return [
|
|
2478
|
+
2
|
|
2479
|
+
|
|
2480
|
+
/*return*/
|
|
2481
|
+
];
|
|
2482
|
+
}
|
|
2483
|
+
});
|
|
2484
|
+
});
|
|
2485
|
+
}, n.prototype.getNegotiationResponse = function(e) {
|
|
2486
|
+
return ie(this, void 0, void 0, function() {
|
|
2487
|
+
let t, i, s, r, a, c;
|
|
2488
|
+
return U(this, function(u) {
|
|
2489
|
+
switch (u.label) {
|
|
2490
|
+
case 0:
|
|
2491
|
+
return this.accessTokenFactory ? [4, this.accessTokenFactory()] : [3, 2];
|
|
2492
|
+
case 1:
|
|
2493
|
+
s = u.sent(), s && (i = (t = {}, t.Authorization = "Bearer " + s, t)), u.label = 2;
|
|
2494
|
+
case 2:
|
|
2495
|
+
r = this.resolveNegotiateUrl(e), this.logger.log(h.Debug, "Sending negotiation request: " + r + "."), u.label = 3;
|
|
2496
|
+
case 3:
|
|
2497
|
+
return u.trys.push([3, 5, , 6]), [4, this.httpClient.post(r, {
|
|
2498
|
+
content: "",
|
|
2499
|
+
headers: i
|
|
2500
|
+
})];
|
|
2501
|
+
case 4:
|
|
2502
|
+
if (a = u.sent(), a.statusCode !== 200) { throw Error("Unexpected status code returned from negotiate " + a.statusCode); }
|
|
2503
|
+
return [2, JSON.parse(a.content)];
|
|
2504
|
+
case 5:
|
|
2505
|
+
throw c = u.sent(), this.logger.log(h.Error, "Failed to complete negotiation with the server: " + c), c;
|
|
2506
|
+
case 6:
|
|
2507
|
+
return [
|
|
2508
|
+
2
|
|
2509
|
+
|
|
2510
|
+
/*return*/
|
|
2511
|
+
];
|
|
2512
|
+
}
|
|
2513
|
+
});
|
|
2514
|
+
});
|
|
2515
|
+
}, n.prototype.createConnectUrl = function(e, t) {
|
|
2516
|
+
return t ? e + (e.indexOf("?") === -1 ? "?" : "&") + ("id=" + t) : e;
|
|
2517
|
+
}, n.prototype.createTransport = function(e, t, i, s) {
|
|
2518
|
+
return ie(this, void 0, void 0, function() {
|
|
2519
|
+
let r, a, c, u, o, l, d;
|
|
2520
|
+
return U(this, function(f) {
|
|
2521
|
+
switch (f.label) {
|
|
2522
|
+
case 0:
|
|
2523
|
+
return r = this.createConnectUrl(e, i.connectionId), this.isITransport(t) ? (this.logger.log(h.Debug, "Connection was provided an instance of ITransport, using that directly."), this.transport = t, [4, this.transport.connect(r, s)]) : [3, 2];
|
|
2524
|
+
case 1:
|
|
2525
|
+
return f.sent(), this.changeState(
|
|
2526
|
+
0,
|
|
2527
|
+
1
|
|
2528
|
+
|
|
2529
|
+
/* Connected */
|
|
2530
|
+
), [
|
|
2531
|
+
2
|
|
2532
|
+
|
|
2533
|
+
/*return*/
|
|
2534
|
+
];
|
|
2535
|
+
case 2:
|
|
2536
|
+
a = i.availableTransports || [], c = 0, u = a, f.label = 3;
|
|
2537
|
+
case 3:
|
|
2538
|
+
return c < u.length ? (o = u[c], this.connectionState = 0, l = this.resolveTransport(o, t, s), typeof l != "number" ? [3, 8] : (this.transport = this.constructTransport(l), i.connectionId ? [3, 5] : [4, this.getNegotiationResponse(e)])) : [3, 9];
|
|
2539
|
+
case 4:
|
|
2540
|
+
i = f.sent(), r = this.createConnectUrl(e, i.connectionId), f.label = 5;
|
|
2541
|
+
case 5:
|
|
2542
|
+
return f.trys.push([5, 7, , 8]), [4, this.transport.connect(r, s)];
|
|
2543
|
+
case 6:
|
|
2544
|
+
return f.sent(), this.changeState(
|
|
2545
|
+
0,
|
|
2546
|
+
1
|
|
2547
|
+
|
|
2548
|
+
/* Connected */
|
|
2549
|
+
), [
|
|
2550
|
+
2
|
|
2551
|
+
|
|
2552
|
+
/*return*/
|
|
2553
|
+
];
|
|
2554
|
+
case 7:
|
|
2555
|
+
return d = f.sent(), this.logger.log(h.Error, "Failed to start the transport '" + v[l] + "': " + d), this.connectionState = 2, i.connectionId = void 0, [3, 8];
|
|
2556
|
+
case 8:
|
|
2557
|
+
return c++, [3, 3];
|
|
2558
|
+
case 9:
|
|
2559
|
+
throw new Error("Unable to initialize any of the available transports.");
|
|
2560
|
+
}
|
|
2561
|
+
});
|
|
2562
|
+
});
|
|
2563
|
+
}, n.prototype.constructTransport = function(e) {
|
|
2564
|
+
switch (e) {
|
|
2565
|
+
case v.WebSockets:
|
|
2566
|
+
if (!this.options.WebSocket) { throw new Error("'WebSocket' is not supported in your environment."); }
|
|
2567
|
+
return new Zt(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.WebSocket);
|
|
2568
|
+
case v.ServerSentEvents:
|
|
2569
|
+
if (!this.options.EventSource) { throw new Error("'EventSource' is not supported in your environment."); }
|
|
2570
|
+
return new Xt(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1, this.options.EventSource);
|
|
2571
|
+
case v.LongPolling:
|
|
2572
|
+
return new Fe(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || !1);
|
|
2573
|
+
default:
|
|
2574
|
+
throw new Error("Unknown transport: " + e + ".");
|
|
2575
|
+
}
|
|
2576
|
+
}, n.prototype.resolveTransport = function(e, t, i) {
|
|
2577
|
+
let s = v[e.transport];
|
|
2578
|
+
if (s == null) { this.logger.log(h.Debug, "Skipping transport '" + e.transport + "' because it is not supported by this client."); } else {
|
|
2579
|
+
let r = e.transferFormats.map(function(a) {
|
|
2580
|
+
return y[a];
|
|
2581
|
+
});
|
|
2582
|
+
if (ti(t, s)) {
|
|
2583
|
+
if (r.indexOf(i) >= 0) {
|
|
2584
|
+
if (s === v.WebSockets && !this.options.WebSocket || s === v.ServerSentEvents && !this.options.EventSource) { this.logger.log(h.Debug, "Skipping transport '" + v[s] + "' because it is not supported in your environment.'"); } else { return this.logger.log(h.Debug, "Selecting transport '" + v[s] + "'."), s; }
|
|
2585
|
+
} else { this.logger.log(h.Debug, "Skipping transport '" + v[s] + "' because it does not support the requested transfer format '" + y[i] + "'."); }
|
|
2586
|
+
} else { this.logger.log(h.Debug, "Skipping transport '" + v[s] + "' because it was disabled by the client."); }
|
|
2587
|
+
}
|
|
2588
|
+
return null;
|
|
2589
|
+
}, n.prototype.isITransport = function(e) {
|
|
2590
|
+
return e && typeof e == "object" && "connect" in e;
|
|
2591
|
+
}, n.prototype.changeState = function(e, t) {
|
|
2592
|
+
return this.connectionState === e ? (this.connectionState = t, !0) : !1;
|
|
2593
|
+
}, n.prototype.stopConnection = function(e) {
|
|
2594
|
+
this.transport = void 0, e = this.stopError || e, e ? this.logger.log(h.Error, "Connection disconnected with error '" + e + "'.") : this.logger.log(h.Information, "Connection disconnected."), this.connectionState = 2, this.onclose && this.onclose(e);
|
|
2595
|
+
}, n.prototype.resolveUrl = function(e) {
|
|
2596
|
+
if (e.lastIndexOf("https://", 0) === 0 || e.lastIndexOf("http://", 0) === 0) { return e; }
|
|
2597
|
+
if (typeof window > "u" || !window || !window.document) { throw new Error("Cannot resolve '" + e + "'."); }
|
|
2598
|
+
let t = window.document.createElement("a");
|
|
2599
|
+
return t.href = e, this.logger.log(h.Information, "Normalizing '" + e + "' to '" + t.href + "'."), t.href;
|
|
2600
|
+
}, n.prototype.resolveNegotiateUrl = function(e) {
|
|
2601
|
+
let t = e.indexOf("?"), i = e.substring(0, t === -1 ? e.length : t);
|
|
2602
|
+
return i[i.length - 1] !== "/" && (i += "/"), i += "negotiate", i += t === -1 ? "" : e.substring(t), i;
|
|
2603
|
+
}, n;
|
|
2604
|
+
})()
|
|
2605
|
+
;
|
|
2606
|
+
function ti(n, e) {
|
|
2607
|
+
return !n || (e & n) !== 0;
|
|
2608
|
+
}
|
|
2609
|
+
let ii = "json", ni = (
|
|
2610
|
+
|
|
2611
|
+
/** @class */
|
|
2612
|
+
function() {
|
|
2613
|
+
function n() {
|
|
2614
|
+
this.name = ii, this.version = 1, this.transferFormat = y.Text;
|
|
2615
|
+
}
|
|
2616
|
+
return n.prototype.parseMessages = function(e, t) {
|
|
2617
|
+
if (typeof e != "string") { throw new Error("Invalid input for JSON hub protocol. Expected a string."); }
|
|
2618
|
+
if (!e) { return []; }
|
|
2619
|
+
t === null && (t = Ie.instance);
|
|
2620
|
+
for (var i = L.parse(e), s = [], r = 0, a = i; r < a.length; r++) {
|
|
2621
|
+
let c = a[r], u = JSON.parse(c);
|
|
2622
|
+
if (typeof u.type != "number") { throw new Error("Invalid payload."); }
|
|
2623
|
+
switch (u.type) {
|
|
2624
|
+
case w.Invocation:
|
|
2625
|
+
this.isInvocationMessage(u);
|
|
2626
|
+
break;
|
|
2627
|
+
case w.StreamItem:
|
|
2628
|
+
this.isStreamItemMessage(u);
|
|
2629
|
+
break;
|
|
2630
|
+
case w.Completion:
|
|
2631
|
+
this.isCompletionMessage(u);
|
|
2632
|
+
break;
|
|
2633
|
+
case w.Ping:
|
|
2634
|
+
break;
|
|
2635
|
+
case w.Close:
|
|
2636
|
+
break;
|
|
2637
|
+
default:
|
|
2638
|
+
t.log(h.Information, "Unknown message type '" + u.type + "' ignored.");
|
|
2639
|
+
continue;
|
|
2640
|
+
}
|
|
2641
|
+
s.push(u);
|
|
2642
|
+
}
|
|
2643
|
+
return s;
|
|
2644
|
+
}, n.prototype.writeMessage = function(e) {
|
|
2645
|
+
return L.write(JSON.stringify(e));
|
|
2646
|
+
}, n.prototype.isInvocationMessage = function(e) {
|
|
2647
|
+
this.assertNotEmptyString(e.target, "Invalid payload for Invocation message."), e.invocationId !== void 0 && this.assertNotEmptyString(e.invocationId, "Invalid payload for Invocation message.");
|
|
2648
|
+
}, n.prototype.isStreamItemMessage = function(e) {
|
|
2649
|
+
if (this.assertNotEmptyString(e.invocationId, "Invalid payload for StreamItem message."), e.item === void 0) { throw new Error("Invalid payload for StreamItem message."); }
|
|
2650
|
+
}, n.prototype.isCompletionMessage = function(e) {
|
|
2651
|
+
if (e.result && e.error) { throw new Error("Invalid payload for Completion message."); }
|
|
2652
|
+
!e.result && e.error && this.assertNotEmptyString(e.error, "Invalid payload for Completion message."), this.assertNotEmptyString(e.invocationId, "Invalid payload for Completion message.");
|
|
2653
|
+
}, n.prototype.assertNotEmptyString = function(e, t) {
|
|
2654
|
+
if (typeof e != "string" || e === "") { throw new Error(t); }
|
|
2655
|
+
}, n;
|
|
2656
|
+
})()
|
|
2657
|
+
, ri = (
|
|
2658
|
+
|
|
2659
|
+
/** @class */
|
|
2660
|
+
function() {
|
|
2661
|
+
function n() {
|
|
2662
|
+
}
|
|
2663
|
+
return n.prototype.configureLogging = function(e) {
|
|
2664
|
+
return S.isRequired(e, "logging"), si(e) ? this.logger = e : this.logger = new Ce(e), this;
|
|
2665
|
+
}, n.prototype.withUrl = function(e, t) {
|
|
2666
|
+
return S.isRequired(e, "url"), this.url = e, typeof t == "object" ? this.httpConnectionOptions = t : this.httpConnectionOptions = {
|
|
2667
|
+
transport: t
|
|
2668
|
+
}, this;
|
|
2669
|
+
}, n.prototype.withHubProtocol = function(e) {
|
|
2670
|
+
return S.isRequired(e, "protocol"), this.protocol = e, this;
|
|
2671
|
+
}, n.prototype.build = function() {
|
|
2672
|
+
let e = this.httpConnectionOptions || {};
|
|
2673
|
+
if (e.logger === void 0 && (e.logger = this.logger), !this.url) { throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection."); }
|
|
2674
|
+
let t = new ei(this.url, e);
|
|
2675
|
+
return Vt.create(t, this.logger || Ie.instance, this.protocol || new ni());
|
|
2676
|
+
}, n;
|
|
2677
|
+
})()
|
|
2678
|
+
;
|
|
2679
|
+
function si(n) {
|
|
2680
|
+
return n.log !== void 0;
|
|
2681
|
+
}
|
|
2682
|
+
class et {
|
|
2683
|
+
constructor(e, t, i) {
|
|
2684
|
+
this.url = e, this.connectionId = t, this.equipNo = i, this.signalr = null;
|
|
342
2685
|
}
|
|
343
2686
|
openConnect() {
|
|
344
|
-
return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new
|
|
2687
|
+
return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new ri().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise((e) => {
|
|
345
2688
|
this.signalr.start().then(() => {
|
|
346
|
-
this.connectionId && this.send(),
|
|
347
|
-
}).catch((
|
|
348
|
-
console.log(
|
|
2689
|
+
this.connectionId && this.send(), e(this.signalr);
|
|
2690
|
+
}).catch((t) => {
|
|
2691
|
+
console.log(t);
|
|
349
2692
|
});
|
|
350
2693
|
});
|
|
351
2694
|
}
|
|
352
2695
|
async send() {
|
|
353
2696
|
try {
|
|
354
2697
|
await this.signalr.invoke(this.connectionId, this.equipNo);
|
|
355
|
-
} catch (
|
|
356
|
-
console.log("connectHub 连接失败" +
|
|
2698
|
+
} catch (e) {
|
|
2699
|
+
console.log("connectHub 连接失败" + e);
|
|
357
2700
|
}
|
|
358
2701
|
}
|
|
359
2702
|
}
|
|
360
|
-
class
|
|
361
|
-
constructor(
|
|
362
|
-
super(), this.equipStatusObject =
|
|
2703
|
+
class oi extends ae {
|
|
2704
|
+
constructor(e, t, i, s, r) {
|
|
2705
|
+
super(), this.equipStatusObject = t, this.groupNodeObject = i, this.aleadyUpdateStatus = {}, this.isGetAllEquipStatus = !1, this.nodesMap = e, this.statusChange = s, this.openSignlr(), this.aliasName = r;
|
|
363
2706
|
}
|
|
364
2707
|
openSignlr() {
|
|
365
|
-
this.equipStatusSignlr = new
|
|
2708
|
+
this.equipStatusSignlr = new et("/equipStatusMonitor", "", ""), this.equipStatusSignlr.openConnect().then((e) => {
|
|
366
2709
|
try {
|
|
367
|
-
|
|
368
|
-
} catch (
|
|
369
|
-
console.log(
|
|
2710
|
+
e.invoke("GetAllEquipStatus");
|
|
2711
|
+
} catch (t) {
|
|
2712
|
+
console.log(t);
|
|
370
2713
|
}
|
|
371
|
-
this.subscribeTo(
|
|
2714
|
+
this.subscribeTo(e, "GetAllEquipStatus");
|
|
372
2715
|
try {
|
|
373
|
-
|
|
374
|
-
} catch (
|
|
375
|
-
console.log(
|
|
2716
|
+
e.invoke("GetEquipChangeStatus");
|
|
2717
|
+
} catch (t) {
|
|
2718
|
+
console.log(t);
|
|
376
2719
|
}
|
|
377
|
-
|
|
2720
|
+
e.onclose(() => {
|
|
378
2721
|
this.openSignlr();
|
|
379
|
-
}), this.subscribeTo(
|
|
2722
|
+
}), this.subscribeTo(e, "GetEquipChangeStatus");
|
|
380
2723
|
});
|
|
381
2724
|
}
|
|
382
|
-
subscribeTo(
|
|
383
|
-
|
|
384
|
-
i && i.isSuccess && i.data && (this[
|
|
2725
|
+
subscribeTo(e, t) {
|
|
2726
|
+
e.off(t), e.on(t, (i) => {
|
|
2727
|
+
i && i.isSuccess && i.data && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId }));
|
|
385
2728
|
});
|
|
386
2729
|
}
|
|
387
|
-
GetAllEquipStatus(
|
|
388
|
-
this.isGetAllEquipStatus = !0, this.resetGroupStatus(), Object.keys(
|
|
389
|
-
this.equipStatusObject[
|
|
390
|
-
}), Object.keys(this.groupNodeObject).forEach((
|
|
391
|
-
this.updateByGroup(
|
|
2730
|
+
GetAllEquipStatus(e) {
|
|
2731
|
+
this.isGetAllEquipStatus = !0, this.resetGroupStatus(), Object.keys(e).forEach((t) => {
|
|
2732
|
+
this.equipStatusObject[t] = e[t];
|
|
2733
|
+
}), Object.keys(this.groupNodeObject).forEach((t) => {
|
|
2734
|
+
this.updateByGroup(t);
|
|
392
2735
|
});
|
|
393
2736
|
}
|
|
394
|
-
updateByGroup(
|
|
395
|
-
if (!this.aleadyUpdateStatus[
|
|
396
|
-
let
|
|
397
|
-
|
|
398
|
-
this.
|
|
399
|
-
|
|
2737
|
+
updateByGroup(e) {
|
|
2738
|
+
if (!this.aleadyUpdateStatus[e]) {
|
|
2739
|
+
let t = this.window[`group-${e}${this.aliasName}`] || [];
|
|
2740
|
+
if (t.length) {
|
|
2741
|
+
this.aleadyUpdateStatus[e] = !0;
|
|
2742
|
+
let i = !1, s = !0;
|
|
2743
|
+
t.forEach((r) => {
|
|
2744
|
+
const a = this.equipStatusObject[r.equipNo];
|
|
2745
|
+
a === 1 ? (i = !0, s = !1) : a !== 0 && (s = !1);
|
|
2746
|
+
}), s && this.setOfflineStatus(e), t.forEach((r) => {
|
|
2747
|
+
this.equipStatusObject[r.equipNo] == 2 ? this.setGroupStatus(e, !0, 2) : this.equipStatusObject[r.equipNo] == 6 && this.setGroupStatus(e, !0, 6), this.nodesMap[`${e}-${r.equipNo}`] && (this.nodesMap[`${e}-${r.equipNo}`].status = this.equipStatusObject[r.equipNo]);
|
|
2748
|
+
}), this.nodesMap[e].alarmCounts === 0 && this.nodesMap[e].backUpCounts === 0 && i && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId));
|
|
2749
|
+
}
|
|
400
2750
|
}
|
|
401
2751
|
}
|
|
402
|
-
updateGroupStatus(
|
|
403
|
-
this.isGetAllEquipStatus && this.updateByGroup(
|
|
2752
|
+
updateGroupStatus(e) {
|
|
2753
|
+
this.isGetAllEquipStatus && this.updateByGroup(e);
|
|
404
2754
|
}
|
|
405
|
-
GetEquipChangeStatus(
|
|
406
|
-
this.setStatus(
|
|
2755
|
+
GetEquipChangeStatus(e) {
|
|
2756
|
+
this.setStatus(e);
|
|
407
2757
|
}
|
|
408
2758
|
// 设置分组状态 key:扁平化数据中节点索引;type:类型(增加,减少);status:状态(报警2、双机热备6)
|
|
409
|
-
setGroupStatus(
|
|
410
|
-
|
|
2759
|
+
setGroupStatus(e, t, i) {
|
|
2760
|
+
t ? i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts + 1, this.nodesMap[e].alarmCounts > 0 && (this.nodesMap[e].status = 2)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts + 1, this.nodesMap[e].alarmCounts == 0 && this.nodesMap[e].backUpCounts > 0 && (this.nodesMap[e].status = 6)) : i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].status = 1)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].backUpCounts == 0 ? this.nodesMap[e].status = 1 : this.nodesMap[e].status = 6)), this.nodesMap[e].groupId && this.setGroupStatus(this.nodesMap[e].groupId, t, i);
|
|
2761
|
+
}
|
|
2762
|
+
// 设置分组离线状态并向上冒泡(不覆盖正常、报警、双机热备状态)
|
|
2763
|
+
setOfflineStatus(e) {
|
|
2764
|
+
this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && this.nodesMap[e].status !== 1 && (this.nodesMap[e].status = 0, this.nodesMap[e].groupId && this.setOfflineStatus(this.nodesMap[e].groupId));
|
|
411
2765
|
}
|
|
412
|
-
|
|
413
|
-
|
|
2766
|
+
// 设置分组正常状态并向上冒泡(不覆盖报警和双机热备状态)
|
|
2767
|
+
setNormalStatus(e) {
|
|
2768
|
+
this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId));
|
|
414
2769
|
}
|
|
415
2770
|
// 获取设备所属的所有分组ID
|
|
416
2771
|
// 优先从 groupCache 反查(按分组隔离存储,数据准确),兜底从 equipCache 获取
|
|
417
|
-
getEquipGroupIds(
|
|
418
|
-
const
|
|
2772
|
+
getEquipGroupIds(e) {
|
|
2773
|
+
const t = [];
|
|
419
2774
|
if (this.window.groupCache && Object.keys(this.window.groupCache).forEach((i) => {
|
|
420
|
-
this.window.groupCache[i] && this.window.groupCache[i][
|
|
421
|
-
}),
|
|
422
|
-
const i = this.window.equipCache && this.window.equipCache[
|
|
2775
|
+
this.window.groupCache[i] && this.window.groupCache[i][e] && t.push(Number(i));
|
|
2776
|
+
}), t.length === 0) {
|
|
2777
|
+
const i = this.window.equipCache && this.window.equipCache[e];
|
|
423
2778
|
if (i) {
|
|
424
2779
|
if (i.groupIds && i.groupIds.length > 0) { return i.groupIds; }
|
|
425
|
-
i.groupId &&
|
|
2780
|
+
i.groupId && t.push(i.groupId);
|
|
426
2781
|
}
|
|
427
2782
|
}
|
|
428
|
-
return
|
|
2783
|
+
return t;
|
|
429
2784
|
}
|
|
430
|
-
setStatus(
|
|
431
|
-
let
|
|
432
|
-
const i = this.getEquipGroupIds(
|
|
433
|
-
|
|
434
|
-
switch (
|
|
2785
|
+
setStatus(e) {
|
|
2786
|
+
let t = this.equipStatusObject[e.equipNo];
|
|
2787
|
+
const i = this.getEquipGroupIds(e.equipNo);
|
|
2788
|
+
e.status != 3 && i.length > 0 && (i.forEach((s) => {
|
|
2789
|
+
switch (e.status) {
|
|
435
2790
|
case 0:
|
|
436
|
-
|
|
2791
|
+
t == 6 && this.setGroupStatus(s, !1, 6);
|
|
437
2792
|
break;
|
|
438
2793
|
case 1:
|
|
439
|
-
|
|
2794
|
+
t == 6 ? this.setGroupStatus(s, !1, 6) : t == 2 && this.setGroupStatus(s, !1, 2);
|
|
440
2795
|
break;
|
|
441
2796
|
case 2:
|
|
442
|
-
|
|
2797
|
+
t != 2 && this.setGroupStatus(s, !0, 2), t == 6 && this.setGroupStatus(s, !1, 6);
|
|
443
2798
|
break;
|
|
444
2799
|
case 6:
|
|
445
|
-
|
|
2800
|
+
t == 2 && this.setGroupStatus(s, !1, 2), t != 6 && this.setGroupStatus(s, !0, 6);
|
|
446
2801
|
break;
|
|
447
2802
|
}
|
|
448
|
-
let
|
|
449
|
-
this.nodesMap[
|
|
450
|
-
}), this.equipStatusObject[
|
|
2803
|
+
let r = `${s}-${e.equipNo}`;
|
|
2804
|
+
this.nodesMap[r] && (this.nodesMap[r].status = e.status);
|
|
2805
|
+
}), this.equipStatusObject[e.equipNo] = e.status, this.statusChange(i[0], e.equipNo, e.status));
|
|
451
2806
|
}
|
|
452
2807
|
// 重置分组状态
|
|
453
2808
|
resetGroupStatus() {
|
|
454
|
-
for (let
|
|
2809
|
+
for (let e in this.groupNodeObject) { this.groupNodeObject[e].alarmCounts = 0, this.groupNodeObject[e].backUpCount = 0; }
|
|
455
2810
|
}
|
|
456
2811
|
}
|
|
457
|
-
const
|
|
458
|
-
getSetParm(
|
|
2812
|
+
const ai = {
|
|
2813
|
+
getSetParm(n) {
|
|
459
2814
|
if (window.AxiosBuilder.axios) {
|
|
460
2815
|
return window.AxiosBuilder.axios({
|
|
461
2816
|
method: "post",
|
|
462
2817
|
url: "/IoT/api/v3/EquipList/GetFullSetParmByEquipNo",
|
|
463
|
-
params:
|
|
464
|
-
data:
|
|
2818
|
+
params: n,
|
|
2819
|
+
data: n,
|
|
465
2820
|
headers: {
|
|
466
2821
|
"Content-Type": "application/json;charset=UTF-8",
|
|
467
2822
|
"Accept-Language": window.sessionStorage.languageType || "zh-CN"
|
|
@@ -469,87 +2824,87 @@ const W = {
|
|
|
469
2824
|
});
|
|
470
2825
|
}
|
|
471
2826
|
}
|
|
472
|
-
},
|
|
2827
|
+
}, ui = Object.assign(
|
|
473
2828
|
{},
|
|
474
|
-
|
|
2829
|
+
ai
|
|
475
2830
|
);
|
|
476
|
-
class
|
|
477
|
-
constructor(
|
|
478
|
-
this.nodesMap =
|
|
2831
|
+
class ci {
|
|
2832
|
+
constructor(e, t) {
|
|
2833
|
+
this.nodesMap = e, this.equipControllObject = t;
|
|
479
2834
|
}
|
|
480
2835
|
// 获取设备控制项
|
|
481
|
-
async getSetting(
|
|
482
|
-
let [
|
|
2836
|
+
async getSetting(e, t, i, s) {
|
|
2837
|
+
let [r, a] = String(e).split("-"), c = {
|
|
483
2838
|
equipNo: a
|
|
484
2839
|
};
|
|
485
|
-
await
|
|
486
|
-
if (
|
|
487
|
-
let
|
|
488
|
-
this.nodesMap[
|
|
489
|
-
|
|
490
|
-
}), this.nodesMap[
|
|
2840
|
+
await ui.getSetParm(c).then((u) => {
|
|
2841
|
+
if (u.data.code == 200) {
|
|
2842
|
+
let o = u && u.data && u.data.data && u.data.data.rows || [];
|
|
2843
|
+
this.nodesMap[e].settings || (this.nodesMap[e].settings = []), o && o.length > 0 && this.nodesMap[e] && (o.forEach((l) => {
|
|
2844
|
+
l.title = l.setNm, l.key = `${r}-${a}-${l.setNo}`, l.level = Number(i) + 1, l.checked = s || this.equipControllObject[a] && this.equipControllObject[a].includes(l.setNo), l.isSetting = !0, l.equipNo = a, l.groupId = r, l.setNo = l.setNo, l.equipName = t;
|
|
2845
|
+
}), this.nodesMap[e].settings = [...o]);
|
|
491
2846
|
}
|
|
492
2847
|
});
|
|
493
2848
|
}
|
|
494
2849
|
}
|
|
495
|
-
class
|
|
496
|
-
static formateList(
|
|
2850
|
+
class O {
|
|
2851
|
+
static formateList(e, t) {
|
|
497
2852
|
let i = [];
|
|
498
|
-
for (const
|
|
499
|
-
let
|
|
500
|
-
|
|
501
|
-
...this.formateList(
|
|
502
|
-
]), i.push(
|
|
2853
|
+
for (const s of e) {
|
|
2854
|
+
let r = {};
|
|
2855
|
+
r.count = 0, r.equipSelectCount = 0, r.controlSelectCount = 0, r.equipCount = s.equipCount || 0, r.title = s.name, r.key = s.id, r.isGroup = !0, r.children = [], r.status = 1, r.level = t || 1, r.expand = !t, r.equips = [], r.groupId = s.parentId, r.groups = [], r.alarmCounts = 0, r.backUpCounts = 0, r.indeterminate = !1, r.checked = !1, r.visible = !0, r.nodeEquipSelectCount = 0, r.checkedEquips = [], r.halfCheckedEquips = [], r.selectControlCount = 0, s.children && s.children.length > 0 && (r.groups = [
|
|
2856
|
+
...this.formateList(s.children, t ? t + 1 : 2)
|
|
2857
|
+
]), i.push(r);
|
|
503
2858
|
}
|
|
504
2859
|
return i;
|
|
505
2860
|
}
|
|
506
|
-
static deepClone(
|
|
507
|
-
let
|
|
508
|
-
if (
|
|
509
|
-
for (let
|
|
510
|
-
|
|
2861
|
+
static deepClone(e, t, i, s, r, a) {
|
|
2862
|
+
let c = [];
|
|
2863
|
+
if (e) {
|
|
2864
|
+
for (let u = 0, o = e.length; u < o; u++) {
|
|
2865
|
+
c.push(
|
|
511
2866
|
{
|
|
512
2867
|
isGroup: i,
|
|
513
|
-
key: `${
|
|
514
|
-
status: a[
|
|
515
|
-
title:
|
|
516
|
-
level:
|
|
2868
|
+
key: `${s}-${e[u].id}`,
|
|
2869
|
+
status: a[e[u].id] || 0,
|
|
2870
|
+
title: e[u].title,
|
|
2871
|
+
level: t,
|
|
517
2872
|
expand: !1,
|
|
518
2873
|
isEquip: !0,
|
|
519
2874
|
loading: !1,
|
|
520
|
-
indeterminate:
|
|
521
|
-
checked:
|
|
522
|
-
groupId:
|
|
523
|
-
equipNo:
|
|
2875
|
+
indeterminate: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].indeterminate || !1,
|
|
2876
|
+
checked: r[`${e[u].groupId}-${e[u].equipNo}`] && r[`${e[u].groupId}-${e[u].equipNo}`].checked || !1,
|
|
2877
|
+
groupId: s,
|
|
2878
|
+
equipNo: e[u].id,
|
|
524
2879
|
visible: !0,
|
|
525
2880
|
settings: []
|
|
526
2881
|
}
|
|
527
2882
|
);
|
|
528
2883
|
}
|
|
529
2884
|
}
|
|
530
|
-
return
|
|
2885
|
+
return c;
|
|
531
2886
|
}
|
|
532
|
-
static copyOrigin(
|
|
533
|
-
let
|
|
534
|
-
return
|
|
535
|
-
|
|
536
|
-
}),
|
|
2887
|
+
static copyOrigin(e) {
|
|
2888
|
+
let t = [];
|
|
2889
|
+
return e.forEach((i) => {
|
|
2890
|
+
t.push({ ...i });
|
|
2891
|
+
}), t;
|
|
537
2892
|
}
|
|
538
2893
|
// 获取分组位置
|
|
539
|
-
static getPosition(
|
|
2894
|
+
static getPosition(e, t) {
|
|
540
2895
|
let i = 0;
|
|
541
|
-
for (let
|
|
542
|
-
if (
|
|
543
|
-
i =
|
|
2896
|
+
for (let s = 0, r = t.length; s < r; s++) {
|
|
2897
|
+
if (t[s].key == e) {
|
|
2898
|
+
i = s - 30;
|
|
544
2899
|
break;
|
|
545
2900
|
}
|
|
546
2901
|
}
|
|
547
2902
|
return i;
|
|
548
2903
|
}
|
|
549
2904
|
// 扁平化
|
|
550
|
-
static flattern(
|
|
551
|
-
|
|
552
|
-
i.isGroup && (
|
|
2905
|
+
static flattern(e, t) {
|
|
2906
|
+
e.forEach((i) => {
|
|
2907
|
+
i.isGroup && (t[`${i.key}`] = null, t[`${i.key}`] = i), i.groups && i.groups.length && this.flattern(i.groups, t);
|
|
553
2908
|
});
|
|
554
2909
|
}
|
|
555
2910
|
|
|
@@ -559,10 +2914,10 @@ class f {
|
|
|
559
2914
|
* @return {string}
|
|
560
2915
|
*/
|
|
561
2916
|
static generateUUID() {
|
|
562
|
-
let
|
|
563
|
-
return window.performance && typeof window.performance.now == "function" && (
|
|
564
|
-
let
|
|
565
|
-
return
|
|
2917
|
+
let e = (/* @__PURE__ */ new Date()).getTime();
|
|
2918
|
+
return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
|
|
2919
|
+
let s = (e + Math.random() * 16) % 16 | 0;
|
|
2920
|
+
return e = Math.floor(e / 16), (i === "x" ? s : s & 3 | 8).toString(16);
|
|
566
2921
|
});
|
|
567
2922
|
}
|
|
568
2923
|
|
|
@@ -571,36 +2926,36 @@ class f {
|
|
|
571
2926
|
* @param {list} 可构建树形结构的普通列表
|
|
572
2927
|
* @return {string}
|
|
573
2928
|
*/
|
|
574
|
-
static listToTreeList(
|
|
575
|
-
const
|
|
576
|
-
return
|
|
577
|
-
|
|
578
|
-
}),
|
|
579
|
-
const a =
|
|
580
|
-
a ? (a.children || (a.children = [])).push(
|
|
2929
|
+
static listToTreeList(e) {
|
|
2930
|
+
const t = e, i = [], s = {};
|
|
2931
|
+
return t.forEach((r) => {
|
|
2932
|
+
s[r.id] = r;
|
|
2933
|
+
}), t.forEach((r) => {
|
|
2934
|
+
const a = s[r.parentId];
|
|
2935
|
+
a ? (a.children || (a.children = [])).push(r) : i.push(r);
|
|
581
2936
|
}), i;
|
|
582
2937
|
}
|
|
583
2938
|
}
|
|
584
|
-
class
|
|
2939
|
+
class li extends ae {
|
|
585
2940
|
// 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
|
|
586
|
-
constructor(
|
|
587
|
-
super(), this.showSettings =
|
|
2941
|
+
constructor(e, t, i) {
|
|
2942
|
+
super(), this.showSettings = t, this.groupNodeObject = e, this.aliasName = i;
|
|
588
2943
|
}
|
|
589
2944
|
// 触发搜索
|
|
590
|
-
filterMethod(
|
|
591
|
-
for (let
|
|
2945
|
+
filterMethod(e) {
|
|
2946
|
+
for (let t in this.groupNodeObject) { e && this.updateBySearch(t, e); }
|
|
592
2947
|
}
|
|
593
2948
|
// 搜索状态将搜索的结果存放缓存中
|
|
594
|
-
updateBySearch(
|
|
595
|
-
let i = this.window[`group-${this.groupNodeObject[
|
|
596
|
-
i && (i = i.filter((
|
|
2949
|
+
updateBySearch(e, t) {
|
|
2950
|
+
let i = this.window[`group-${this.groupNodeObject[e].key}${this.aliasName}`];
|
|
2951
|
+
i && (i = i.filter((s) => s.title.includes(t)), this.window[`group-${this.groupNodeObject[e].key}-search`] = O.copyOrigin(i));
|
|
597
2952
|
}
|
|
598
2953
|
}
|
|
599
|
-
const
|
|
600
|
-
const
|
|
601
|
-
for (const [i,
|
|
602
|
-
return
|
|
603
|
-
},
|
|
2954
|
+
const ce = (n, e) => {
|
|
2955
|
+
const t = n.__vccOpts || n;
|
|
2956
|
+
for (const [i, s] of e) { t[i] = s; }
|
|
2957
|
+
return t;
|
|
2958
|
+
}, hi = {
|
|
604
2959
|
props: {
|
|
605
2960
|
source: {
|
|
606
2961
|
type: Object,
|
|
@@ -618,60 +2973,60 @@ const O = (s, t) => {
|
|
|
618
2973
|
}
|
|
619
2974
|
}
|
|
620
2975
|
}
|
|
621
|
-
},
|
|
622
|
-
function
|
|
623
|
-
const a =
|
|
624
|
-
return
|
|
625
|
-
|
|
2976
|
+
}, di = { class: "operates" };
|
|
2977
|
+
function pi(n, e, t, i, s, r) {
|
|
2978
|
+
const a = x("el-button"), c = x("el-button-group"), u = x("el-popover");
|
|
2979
|
+
return E(), T("div", di, [
|
|
2980
|
+
C(u, {
|
|
626
2981
|
placement: "bottom",
|
|
627
2982
|
trigger: "hover"
|
|
628
2983
|
}, {
|
|
629
|
-
reference:
|
|
630
|
-
|
|
2984
|
+
reference: G(() => [
|
|
2985
|
+
A("i", {
|
|
631
2986
|
class: "el-icon-more",
|
|
632
|
-
onClick:
|
|
2987
|
+
onClick: e[3] || (e[3] = ne(() => {
|
|
633
2988
|
}, ["stop"]))
|
|
634
2989
|
})
|
|
635
2990
|
]),
|
|
636
|
-
default:
|
|
637
|
-
|
|
638
|
-
default:
|
|
639
|
-
|
|
2991
|
+
default: G(() => [
|
|
2992
|
+
C(c, { class: "new-button-group setModule" }, {
|
|
2993
|
+
default: G(() => [
|
|
2994
|
+
C(a, {
|
|
640
2995
|
type: "text",
|
|
641
2996
|
size: "small",
|
|
642
2997
|
class: "elBtn",
|
|
643
2998
|
icon: " iconfont icon-tubiao20_bianji",
|
|
644
|
-
onClick:
|
|
2999
|
+
onClick: e[0] || (e[0] = ne((o) => t.groupEditAndNew(!1, t.source), ["stop"]))
|
|
645
3000
|
}, {
|
|
646
|
-
default:
|
|
647
|
-
|
|
3001
|
+
default: G(() => [
|
|
3002
|
+
we(K(n.$t("equipInfo.poverTips.rename")), 1)
|
|
648
3003
|
]),
|
|
649
3004
|
_: 1
|
|
650
3005
|
}),
|
|
651
|
-
|
|
3006
|
+
C(a, {
|
|
652
3007
|
type: "text",
|
|
653
3008
|
size: "small",
|
|
654
3009
|
class: "elBtn",
|
|
655
3010
|
icon: " iconfont icon-gw-icon-tianjia1",
|
|
656
|
-
onClick:
|
|
3011
|
+
onClick: e[1] || (e[1] = (o) => t.groupEditAndNew(!0, t.source))
|
|
657
3012
|
}, {
|
|
658
|
-
default:
|
|
659
|
-
|
|
3013
|
+
default: G(() => [
|
|
3014
|
+
we(K(n.$t("equipInfo.poverTips.newChildGroup")), 1)
|
|
660
3015
|
]),
|
|
661
3016
|
_: 1
|
|
662
3017
|
}),
|
|
663
|
-
|
|
3018
|
+
t.source.level != 1 ? (E(), se(a, {
|
|
664
3019
|
key: 0,
|
|
665
3020
|
type: "danger",
|
|
666
3021
|
size: "small",
|
|
667
|
-
onClick:
|
|
3022
|
+
onClick: e[2] || (e[2] = ne((o) => t.deleteGroup(t.source), ["stop"])),
|
|
668
3023
|
icon: " iconfont icon-tubiao20_shanchu"
|
|
669
3024
|
}, {
|
|
670
|
-
default:
|
|
671
|
-
|
|
3025
|
+
default: G(() => [
|
|
3026
|
+
we(K(n.$t("publics.button.deletes")), 1)
|
|
672
3027
|
]),
|
|
673
3028
|
_: 1
|
|
674
|
-
})) :
|
|
3029
|
+
})) : M("", !0)
|
|
675
3030
|
]),
|
|
676
3031
|
_: 1
|
|
677
3032
|
})
|
|
@@ -680,7 +3035,7 @@ function P(s, t, e, i, o, u) {
|
|
|
680
3035
|
})
|
|
681
3036
|
]);
|
|
682
3037
|
}
|
|
683
|
-
const
|
|
3038
|
+
const fi = /* @__PURE__ */ ce(hi, [["render", pi]]), gi = {
|
|
684
3039
|
name: "ElTreeVirtualNode",
|
|
685
3040
|
componentName: "ElTreeVirtualNode",
|
|
686
3041
|
props: {
|
|
@@ -751,11 +3106,11 @@ const z = /* @__PURE__ */ O(J, [["render", P]]), R = {
|
|
|
751
3106
|
}
|
|
752
3107
|
},
|
|
753
3108
|
components: {
|
|
754
|
-
oparate:
|
|
3109
|
+
oparate: fi
|
|
755
3110
|
},
|
|
756
3111
|
computed: {
|
|
757
3112
|
getColor() {
|
|
758
|
-
return function(
|
|
3113
|
+
return function(n) {
|
|
759
3114
|
this.colorConfig || (this.colorConfig = {
|
|
760
3115
|
noComm: "#a0a0a0",
|
|
761
3116
|
normal: "#63e03f",
|
|
@@ -765,34 +3120,34 @@ const z = /* @__PURE__ */ O(J, [["render", P]]), R = {
|
|
|
765
3120
|
withdraw: "#ffc0cb",
|
|
766
3121
|
BackUp: "#f8901c"
|
|
767
3122
|
});
|
|
768
|
-
let
|
|
769
|
-
switch (
|
|
3123
|
+
let e;
|
|
3124
|
+
switch (n) {
|
|
770
3125
|
case 0:
|
|
771
|
-
|
|
3126
|
+
e = this.colorConfig.noComm;
|
|
772
3127
|
break;
|
|
773
3128
|
case 1:
|
|
774
|
-
|
|
3129
|
+
e = this.colorConfig.normal;
|
|
775
3130
|
break;
|
|
776
3131
|
case 2:
|
|
777
|
-
|
|
3132
|
+
e = this.colorConfig.alarm;
|
|
778
3133
|
break;
|
|
779
3134
|
case 3:
|
|
780
|
-
|
|
3135
|
+
e = this.colorConfig.lsSet;
|
|
781
3136
|
break;
|
|
782
3137
|
case 4:
|
|
783
|
-
|
|
3138
|
+
e = this.colorConfig.initialize;
|
|
784
3139
|
break;
|
|
785
3140
|
case 5:
|
|
786
|
-
|
|
3141
|
+
e = this.colorConfig.withdraw;
|
|
787
3142
|
break;
|
|
788
3143
|
case 6:
|
|
789
|
-
|
|
3144
|
+
e = this.colorConfig.BackUp;
|
|
790
3145
|
break;
|
|
791
3146
|
default:
|
|
792
|
-
|
|
3147
|
+
e = this.colorConfig.noComm;
|
|
793
3148
|
break;
|
|
794
3149
|
}
|
|
795
|
-
return
|
|
3150
|
+
return e;
|
|
796
3151
|
};
|
|
797
3152
|
}
|
|
798
3153
|
},
|
|
@@ -805,89 +3160,89 @@ const z = /* @__PURE__ */ O(J, [["render", P]]), R = {
|
|
|
805
3160
|
clickFunction() {
|
|
806
3161
|
this.source.expand = !this.source.expand, this.nodeClick(this.source, this.index, this.source.level, this.source.checked);
|
|
807
3162
|
},
|
|
808
|
-
checkedChange(
|
|
3163
|
+
checkedChange(n) {
|
|
809
3164
|
this.onChecked(this.source);
|
|
810
3165
|
}
|
|
811
3166
|
}
|
|
812
|
-
},
|
|
3167
|
+
}, bi = { class: "el-tree-node__content" }, wi = { class: "nodeContent" }, Si = {
|
|
813
3168
|
key: 1,
|
|
814
3169
|
class: "circle"
|
|
815
|
-
},
|
|
3170
|
+
}, vi = { class: "label" }, yi = {
|
|
816
3171
|
key: 2,
|
|
817
3172
|
class: "equipNumber"
|
|
818
|
-
},
|
|
3173
|
+
}, mi = {
|
|
819
3174
|
key: 4,
|
|
820
3175
|
class: "el-tree-node__loading-icon el-icon-loading"
|
|
821
3176
|
};
|
|
822
|
-
function
|
|
823
|
-
const a =
|
|
824
|
-
return
|
|
825
|
-
class:
|
|
826
|
-
parent_tag:
|
|
827
|
-
child_tags: !
|
|
828
|
-
selectedColor:
|
|
3177
|
+
function Ci(n, e, t, i, s, r) {
|
|
3178
|
+
const a = x("el-checkbox"), c = x("oparate");
|
|
3179
|
+
return E(), T("div", {
|
|
3180
|
+
class: Ae(["el-tree-node", {
|
|
3181
|
+
parent_tag: t.source.isGroup,
|
|
3182
|
+
child_tags: !t.source.isGroup,
|
|
3183
|
+
selectedColor: t.currentSelect === t.source.key && !t.source.isGroup
|
|
829
3184
|
}]),
|
|
830
|
-
onClick:
|
|
3185
|
+
onClick: e[2] || (e[2] = (...u) => r.clickFunction && r.clickFunction(...u))
|
|
831
3186
|
}, [
|
|
832
|
-
|
|
833
|
-
|
|
3187
|
+
A("div", bi, [
|
|
3188
|
+
A("span", {
|
|
834
3189
|
class: "el-tree__indent",
|
|
835
3190
|
"aria-hidden": "true",
|
|
836
|
-
style:
|
|
3191
|
+
style: Se({ width: (t.source.level - 1) * s.indent + "px" })
|
|
837
3192
|
}, null, 4),
|
|
838
|
-
|
|
3193
|
+
t.source.isGroup ? (E(), T("span", {
|
|
839
3194
|
key: 0,
|
|
840
|
-
class:
|
|
3195
|
+
class: Ae([
|
|
841
3196
|
{
|
|
842
|
-
"is-leaf": !
|
|
843
|
-
expanded:
|
|
3197
|
+
"is-leaf": !t.source.isGroup,
|
|
3198
|
+
expanded: t.source.isGroup && t.source.expand
|
|
844
3199
|
},
|
|
845
3200
|
"el-tree-node__expand-icon",
|
|
846
3201
|
"iconfont icon-fangxiangL"
|
|
847
3202
|
])
|
|
848
|
-
}, null, 2)) :
|
|
849
|
-
|
|
850
|
-
|
|
3203
|
+
}, null, 2)) : M("", !0),
|
|
3204
|
+
A("div", wi, [
|
|
3205
|
+
t.showCheckbox ? (E(), se(a, {
|
|
851
3206
|
key: 0,
|
|
852
|
-
onClick:
|
|
3207
|
+
onClick: e[0] || (e[0] = ne(() => {
|
|
853
3208
|
}, ["stop"])),
|
|
854
|
-
modelValue:
|
|
855
|
-
"onUpdate:modelValue":
|
|
856
|
-
indeterminate:
|
|
857
|
-
onChange:
|
|
858
|
-
}, null, 8, ["modelValue", "indeterminate", "onChange"])) :
|
|
859
|
-
|
|
860
|
-
|
|
3209
|
+
modelValue: t.source.checked,
|
|
3210
|
+
"onUpdate:modelValue": e[1] || (e[1] = (u) => t.source.checked = u),
|
|
3211
|
+
indeterminate: t.source.indeterminate,
|
|
3212
|
+
onChange: r.checkedChange
|
|
3213
|
+
}, null, 8, ["modelValue", "indeterminate", "onChange"])) : M("", !0),
|
|
3214
|
+
t.showStatus ? (E(), T("span", Si, [
|
|
3215
|
+
t.source.status != 6 ? (E(), T("span", {
|
|
861
3216
|
key: 0,
|
|
862
3217
|
class: "yd",
|
|
863
|
-
style:
|
|
864
|
-
}, null, 4)) : (
|
|
3218
|
+
style: Se({ backgroundColor: r.getColor(t.source.status) })
|
|
3219
|
+
}, null, 4)) : (E(), T("i", {
|
|
865
3220
|
key: 1,
|
|
866
|
-
style:
|
|
3221
|
+
style: Se({ color: t.colorConfig.BackUp }),
|
|
867
3222
|
class: "iconfont icon-gw-icon-beiji2"
|
|
868
3223
|
}, null, 4))
|
|
869
|
-
])) :
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
3224
|
+
])) : M("", !0),
|
|
3225
|
+
A("span", vi, K(t.source.title), 1),
|
|
3226
|
+
t.source.isGroup && !t.source.isEquip || t.source.isGroup && !t.source.isEquip ? (E(), T("span", yi, K(t.source.count), 1)) : M("", !0),
|
|
3227
|
+
t.source.isGroup && t.showOperate ? (E(), se(c, {
|
|
873
3228
|
key: 3,
|
|
874
|
-
source:
|
|
875
|
-
groupEditAndNew:
|
|
876
|
-
deleteGroup:
|
|
877
|
-
}, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) :
|
|
878
|
-
|
|
3229
|
+
source: t.source,
|
|
3230
|
+
groupEditAndNew: t.groupEditAndNew,
|
|
3231
|
+
deleteGroup: t.deleteGroup
|
|
3232
|
+
}, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) : M("", !0),
|
|
3233
|
+
t.source.loading ? (E(), T("span", mi)) : M("", !0)
|
|
879
3234
|
])
|
|
880
3235
|
])
|
|
881
3236
|
], 2);
|
|
882
3237
|
}
|
|
883
|
-
const
|
|
3238
|
+
const ki = /* @__PURE__ */ ce(gi, [["render", Ci]]), Ei = {
|
|
884
3239
|
components: {
|
|
885
|
-
VirtualList:
|
|
3240
|
+
VirtualList: Ot
|
|
886
3241
|
},
|
|
887
|
-
mixins: [
|
|
3242
|
+
mixins: [Ye],
|
|
888
3243
|
data() {
|
|
889
3244
|
return {
|
|
890
|
-
itemComponent:
|
|
3245
|
+
itemComponent: ki,
|
|
891
3246
|
//节点组件
|
|
892
3247
|
visibleList: [],
|
|
893
3248
|
//虚拟滚动所需要的列表
|
|
@@ -1010,20 +3365,20 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1010
3365
|
}
|
|
1011
3366
|
},
|
|
1012
3367
|
watch: {
|
|
1013
|
-
data(
|
|
1014
|
-
|
|
3368
|
+
data(n) {
|
|
3369
|
+
n && n.length && (O.flattern(this.data, this.groupNodeObject), this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map((e) => e)), this.init());
|
|
1015
3370
|
},
|
|
1016
|
-
controllList(
|
|
3371
|
+
controllList(n) {
|
|
1017
3372
|
this.updateCheckedStatusWithControls();
|
|
1018
3373
|
},
|
|
1019
|
-
selectEquips(
|
|
3374
|
+
selectEquips(n) {
|
|
1020
3375
|
this.updateCheckedStatusWithEquips(), this.$nextTick(() => {
|
|
1021
3376
|
this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus();
|
|
1022
3377
|
});
|
|
1023
3378
|
},
|
|
1024
|
-
filterEquip(
|
|
3379
|
+
filterEquip(n) {
|
|
1025
3380
|
this.$nextTick(() => {
|
|
1026
|
-
this.visibleList = [], this.$refs.virtualList.scrollToIndex(0), this.updateTreeList(this.data), this.equipNumManage.resetGroupNum(this.isSearchStatus,
|
|
3381
|
+
this.visibleList = [], this.$refs.virtualList.scrollToIndex(0), this.updateTreeList(this.data), this.equipNumManage.resetGroupNum(this.isSearchStatus, n, this.equipStatusObject);
|
|
1027
3382
|
});
|
|
1028
3383
|
}
|
|
1029
3384
|
},
|
|
@@ -1033,27 +3388,27 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1033
3388
|
}
|
|
1034
3389
|
},
|
|
1035
3390
|
created() {
|
|
1036
|
-
this.showCheckbox && (this.checkStatusManage = new
|
|
3391
|
+
this.showCheckbox && (this.checkStatusManage = new It(this.groupNodeObject, this.nodesMap, this.equipControllObject, this.controlObject, this.equipCheckObject, this.aliasName)), this.cacheManage = new Nt(this.groupNodeObject, this.nodesMap, this.controlObject, this.equipCheckObject), this.searchManage = new li(this.groupNodeObject, this.showSettings, this.aliasName), this.equipNumManage = new Mt(this.groupNodeObject, this.aliasName), this.requestManage = new ci(this.nodesMap, this.equipControllObject);
|
|
1037
3392
|
},
|
|
1038
3393
|
mounted() {
|
|
1039
|
-
this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", (
|
|
1040
|
-
|
|
3394
|
+
this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", (n) => {
|
|
3395
|
+
n.data.type && this[n.data.type] && this[n.data.type](n.data.data);
|
|
1041
3396
|
});
|
|
1042
3397
|
},
|
|
1043
3398
|
methods: {
|
|
1044
3399
|
// 初始化
|
|
1045
3400
|
init() {
|
|
1046
3401
|
this.data[0].expand = !0, this.updateTreeList(), setTimeout(() => {
|
|
1047
|
-
Object.values(this.groupNodeObject).forEach((
|
|
1048
|
-
!
|
|
1049
|
-
}), this.showCheckbox && this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new
|
|
3402
|
+
Object.values(this.groupNodeObject).forEach((n, e) => {
|
|
3403
|
+
!n.expand && this.expandGroup.includes(n.key) && (n.expand = !0), this.filterWithAlias(n.key), this.updateGroupEquips(n.key, !0);
|
|
3404
|
+
}), this.showCheckbox && this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new oi(this.nodesMap, this.equipStatusObject, this.groupNodeObject, this.statusChange, this.aliasName));
|
|
1050
3405
|
}, 500);
|
|
1051
3406
|
},
|
|
1052
3407
|
// 根据条件过滤
|
|
1053
|
-
filterWithAlias(
|
|
3408
|
+
filterWithAlias(n) {
|
|
1054
3409
|
if (this.aliasName) {
|
|
1055
|
-
let
|
|
1056
|
-
this.window[`group-${
|
|
3410
|
+
let e = this.window[`group-${n}`] || [];
|
|
3411
|
+
this.window[`group-${n}${this.aliasName}`] = this.filterData(e);
|
|
1057
3412
|
}
|
|
1058
3413
|
},
|
|
1059
3414
|
// 更新当前选中
|
|
@@ -1061,52 +3416,52 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1061
3416
|
this.window.equipCache && this.window.equipCache[this.currentNodeKey] && (this.currentSelect = `${this.window.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`);
|
|
1062
3417
|
},
|
|
1063
3418
|
// 设备状态变化
|
|
1064
|
-
statusChange(
|
|
1065
|
-
this.currentSelect == `${
|
|
3419
|
+
statusChange(n, e, t) {
|
|
3420
|
+
this.currentSelect == `${n}-${e}` && this.$emit("statusChange", e, t);
|
|
1066
3421
|
},
|
|
1067
3422
|
// 更新checkbox选中状态
|
|
1068
3423
|
updateCheckWidthJob() {
|
|
1069
3424
|
this.showCheckbox && (this.checkStatusManage.resetCheckedStatus(), this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus());
|
|
1070
3425
|
},
|
|
1071
3426
|
// 通过外框更新设备
|
|
1072
|
-
updateGroupEquips(
|
|
1073
|
-
if (!this.isSearchStatus && this.groupNodeObject[
|
|
1074
|
-
let
|
|
1075
|
-
this.$emit("getTotal",
|
|
3427
|
+
updateGroupEquips(n, e) {
|
|
3428
|
+
if (!this.isSearchStatus && this.groupNodeObject[n]) {
|
|
3429
|
+
let t = this.equipNumManage.getAllEquipsNum();
|
|
3430
|
+
this.$emit("getTotal", t);
|
|
1076
3431
|
}
|
|
1077
|
-
this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.groupNodeObject[
|
|
3432
|
+
this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.groupNodeObject[n].expand && this.updateList(n, this.groupNodeObject[n].level, null, !1);
|
|
1078
3433
|
},
|
|
1079
3434
|
// 展开的时候从缓存中拿设备数据到equips中并更新视图
|
|
1080
|
-
updateList(
|
|
1081
|
-
if (this.groupNodeObject[
|
|
1082
|
-
let
|
|
1083
|
-
this.isSearchStatus ? (
|
|
3435
|
+
updateList(n) {
|
|
3436
|
+
if (this.groupNodeObject[n]) {
|
|
3437
|
+
let e = [];
|
|
3438
|
+
this.isSearchStatus ? (e = this.window[`group-${n}-search`], this.groupNodeObject[n].equips = [...O.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]) : (e = this.window[`group-${n}${this.aliasName}`], this.groupNodeObject[n].equips = [...O.deepClone(e, Number(this.groupNodeObject[n].level) + 1, this.showSettings, n, this.equipCheckObject, this.equipStatusObject)]), this.cacheManage.addNodesMap(this.groupNodeObject[n].equips), this.cacheManage.closeBrotherNode(n), this.visibleList = [], this.updateTreeList(this.data), this.showCheckbox && this.checkStatusManage && e && e.length && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && this.equipStatusManage && this.equipStatusManage.updateGroupStatus(n), this.updateCurrentSelect();
|
|
1084
3439
|
}
|
|
1085
3440
|
},
|
|
1086
3441
|
// 更新整个树形结构
|
|
1087
|
-
updateTreeList(
|
|
1088
|
-
|
|
1089
|
-
this.filterEquip &&
|
|
3442
|
+
updateTreeList(n) {
|
|
3443
|
+
n && n.length > 0 && n.forEach((e) => {
|
|
3444
|
+
this.filterEquip && e.status === 2 ? this.filterEquipList.includes(e.equipNo) || this.visibleList.push(e) : this.filterEquip || this.visibleList.push(e), e.expand ? e.isEquip ? (e.children || (e.children = []), e.settings && (e.children = [...e.settings || []])) : e.children = [...e.equips || [], ...e.groups || []] : e.children = [], this.updateTreeList(e.children || []);
|
|
1090
3445
|
});
|
|
1091
3446
|
},
|
|
1092
3447
|
// 节点点击事件
|
|
1093
|
-
nodeClick(
|
|
1094
|
-
this.$emit("node-click", { ...
|
|
3448
|
+
nodeClick(n, e, t, i) {
|
|
3449
|
+
this.$emit("node-click", { ...n, key: n.isEquip ? n.equipNo : n.key }), n.isGroup ? n.isEquip ? this.equipClick(n, e, i) : this.groupClick(n, e, i) : this.currentSelect = n.key;
|
|
1095
3450
|
},
|
|
1096
|
-
groupClick(
|
|
1097
|
-
|
|
3451
|
+
groupClick(n, e, t) {
|
|
3452
|
+
n.expand ? this.updateList(n.key, n.level, e, t) : (this.cacheManage.recycleGroupCache(n.key), this.visibleList = [], this.updateTreeList(this.data));
|
|
1098
3453
|
},
|
|
1099
|
-
async equipClick(
|
|
1100
|
-
this.showSettings && (
|
|
3454
|
+
async equipClick(n, e, t) {
|
|
3455
|
+
this.showSettings && (n.expand ? (n.loading = !0, await this.requestManage.getSetting(n.key, n.title, n.level, t), this.controlObject[`${n.groupId}-${n.equipNo}`] = { groupId: n.groupId }, n.loading = !1, this.visibleList.splice(e + 1, 0, ...this.nodesMap[n.key].settings), this.cacheManage.addNodesMap(this.nodesMap[n.key].settings)) : (this.visibleList.splice(e + 1, this.nodesMap[n.key].settings.length), this.cacheManage.removeNodesMap(this.nodesMap[n.key].settings), this.nodesMap[n.key].settings = [], delete this.controlObject[`${n.groupId}-${n.equipNo}`]));
|
|
1101
3456
|
},
|
|
1102
|
-
onChecked(
|
|
1103
|
-
this.checkStatusManage && this.checkStatusManage.onChecked(
|
|
3457
|
+
onChecked(n) {
|
|
3458
|
+
this.checkStatusManage && this.checkStatusManage.onChecked(n, this.isSearchStatus), this.$emit("onCheck");
|
|
1104
3459
|
},
|
|
1105
|
-
groupEditAndNew(
|
|
1106
|
-
this.$emit("groupEditAndNew", { isGroupNew:
|
|
3460
|
+
groupEditAndNew(n, e) {
|
|
3461
|
+
this.$emit("groupEditAndNew", { isGroupNew: n, node: e });
|
|
1107
3462
|
},
|
|
1108
|
-
deleteGroup(
|
|
1109
|
-
this.$emit("deleteGroup",
|
|
3463
|
+
deleteGroup(n) {
|
|
3464
|
+
this.$emit("deleteGroup", n);
|
|
1110
3465
|
},
|
|
1111
3466
|
updateCheckedStatusWithControls() {
|
|
1112
3467
|
this.controllList && this.controllList.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithControls(this.controllList);
|
|
@@ -1147,8 +3502,8 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1147
3502
|
* @return 无
|
|
1148
3503
|
*/
|
|
1149
3504
|
recordExpandGroup() {
|
|
1150
|
-
this.expandGroup = [], Object.values(this.groupNodeObject).forEach((
|
|
1151
|
-
|
|
3505
|
+
this.expandGroup = [], Object.values(this.groupNodeObject).forEach((n) => {
|
|
3506
|
+
n.expand && this.expandGroup.push(n.key);
|
|
1152
3507
|
});
|
|
1153
3508
|
},
|
|
1154
3509
|
|
|
@@ -1170,8 +3525,8 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1170
3525
|
* @param {searchName} 搜索名称
|
|
1171
3526
|
* @return 无返回值
|
|
1172
3527
|
*/
|
|
1173
|
-
filterMethod(
|
|
1174
|
-
this.visibleList = [], this.cacheManage.recycleAllNodeCache(),
|
|
3528
|
+
filterMethod(n) {
|
|
3529
|
+
this.visibleList = [], this.cacheManage.recycleAllNodeCache(), n ? (this.isSearchStatus = !0, this.searchManage.filterMethod(n)) : this.isSearchStatus = !1, this.init(), this.$nextTick(() => {
|
|
1175
3530
|
this.$refs.virtualList.scrollToIndex(0);
|
|
1176
3531
|
}), this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.showCheckbox && (this.checkStatusManage && this.checkStatusManage.reComputedCheckNum(this.isSearchStatus), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus());
|
|
1177
3532
|
},
|
|
@@ -1191,8 +3546,8 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1191
3546
|
* @param {data} {分组Id}
|
|
1192
3547
|
* @return 无返回值
|
|
1193
3548
|
*/
|
|
1194
|
-
GetGroupEquips(
|
|
1195
|
-
|
|
3549
|
+
GetGroupEquips(n) {
|
|
3550
|
+
n.groupId && this.groupNodeObject[n.groupId] && !this.isSearchStatus && (this.updateGroupEquips(n.groupId, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(() => {
|
|
1196
3551
|
this.updateCheckWidthJob();
|
|
1197
3552
|
}, 500));
|
|
1198
3553
|
},
|
|
@@ -1202,11 +3557,11 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1202
3557
|
* @param {data} {groupId,equips}
|
|
1203
3558
|
* @return 无返回值
|
|
1204
3559
|
*/
|
|
1205
|
-
DeleteEquip(
|
|
1206
|
-
const { groupId:
|
|
1207
|
-
|
|
1208
|
-
let
|
|
1209
|
-
|
|
3560
|
+
DeleteEquip(n) {
|
|
3561
|
+
const { groupId: e, equips: t } = n || {};
|
|
3562
|
+
e && this.groupNodeObject[e] && (this.updateGroupEquips(n.groupId), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()), t.length && t.forEach((i) => {
|
|
3563
|
+
let s = this.nodesMap[`${e}-${i.id}`];
|
|
3564
|
+
s && (this.currentSelect.toString().includes(i.id) && this.$emit("currentDelete"), this.showStatus && (s.status == 2 ? this.equipStatusManage.setGroupStatus(e, !1, 2) : s.status == 6 && this.equipStatusManage.setGroupStatus(e, !1, 6)), delete this.nodesMap[`${e}-${i.id}`], delete this.equipCheckObject[i.id]), delete this.equipStatusObject[i.id];
|
|
1210
3565
|
});
|
|
1211
3566
|
},
|
|
1212
3567
|
|
|
@@ -1215,11 +3570,11 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1215
3570
|
* @param {data} {updateGroups} 需要更新的分组列表
|
|
1216
3571
|
* @return 无返回值
|
|
1217
3572
|
*/
|
|
1218
|
-
moveEquips(
|
|
1219
|
-
const { updateGroups:
|
|
1220
|
-
!
|
|
3573
|
+
moveEquips(n) {
|
|
3574
|
+
const { updateGroups: e, buildTree: t } = n || {};
|
|
3575
|
+
!t && e ? e.forEach((i) => {
|
|
1221
3576
|
i && this.groupNodeObject[i] && (this.updateGroupEquips(i), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus());
|
|
1222
|
-
}) :
|
|
3577
|
+
}) : t && this.rebuildTree();
|
|
1223
3578
|
},
|
|
1224
3579
|
|
|
1225
3580
|
/**
|
|
@@ -1227,9 +3582,9 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1227
3582
|
* @param {data} {groupId,parentGroupId}
|
|
1228
3583
|
* @return 无返回值
|
|
1229
3584
|
*/
|
|
1230
|
-
DeleteEquipGroup(
|
|
1231
|
-
|
|
1232
|
-
|
|
3585
|
+
DeleteEquipGroup(n) {
|
|
3586
|
+
n.forEach((e) => {
|
|
3587
|
+
e.groupId && this.nodesMap[e.groupId] && (this.isSearchStatus || this.rebuildTree());
|
|
1233
3588
|
});
|
|
1234
3589
|
},
|
|
1235
3590
|
|
|
@@ -1238,9 +3593,9 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1238
3593
|
* @param {data} {groupId,parentGroupId}
|
|
1239
3594
|
* @return 无返回值
|
|
1240
3595
|
*/
|
|
1241
|
-
AddEquipGroup(
|
|
1242
|
-
const { parentGroupId:
|
|
1243
|
-
|
|
3596
|
+
AddEquipGroup(n) {
|
|
3597
|
+
const { parentGroupId: e, groupId: t } = n || {};
|
|
3598
|
+
t && this.nodesMap[e] && this.treeType && (this.isSearchStatus || this.rebuildTree());
|
|
1244
3599
|
},
|
|
1245
3600
|
|
|
1246
3601
|
/** 编辑分组
|
|
@@ -1248,9 +3603,9 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1248
3603
|
* @param {data} {groupId,parentGroupId}
|
|
1249
3604
|
* @return 无返回值
|
|
1250
3605
|
*/
|
|
1251
|
-
EditEquipGroup(
|
|
1252
|
-
const { groupId:
|
|
1253
|
-
this.nodesMap[
|
|
3606
|
+
EditEquipGroup(n) {
|
|
3607
|
+
const { groupId: e, groupName: t } = n;
|
|
3608
|
+
this.nodesMap[e] && (this.nodesMap[e].title = t);
|
|
1254
3609
|
},
|
|
1255
3610
|
|
|
1256
3611
|
/**
|
|
@@ -1258,8 +3613,8 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1258
3613
|
* @param {data} {分组Id,设备}
|
|
1259
3614
|
* @return 无返回值
|
|
1260
3615
|
*/
|
|
1261
|
-
AddEquip(
|
|
1262
|
-
this.filterEquip && (this.filterEquipList =
|
|
3616
|
+
AddEquip(n) {
|
|
3617
|
+
this.filterEquip && (this.filterEquipList = n == null ? void 0 : n.equips.map((e) => e.id)), this.init();
|
|
1263
3618
|
},
|
|
1264
3619
|
|
|
1265
3620
|
/**
|
|
@@ -1267,9 +3622,9 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1267
3622
|
* @param {data} {分组Id,设备}
|
|
1268
3623
|
* @return 无返回值
|
|
1269
3624
|
*/
|
|
1270
|
-
EditEquip(
|
|
1271
|
-
const { equipNo:
|
|
1272
|
-
this.nodesMap[`${
|
|
3625
|
+
EditEquip(n) {
|
|
3626
|
+
const { equipNo: e, groupId: t, equipName: i } = n || {};
|
|
3627
|
+
this.nodesMap[`${t}-${e}`] && (this.isSearchStatus || (this.nodesMap[`${t}-${e}`].title = i));
|
|
1273
3628
|
},
|
|
1274
3629
|
|
|
1275
3630
|
/**
|
|
@@ -1277,8 +3632,8 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1277
3632
|
* @param {isSearchStatus} {是否查询状态}
|
|
1278
3633
|
* @return 无返回值
|
|
1279
3634
|
*/
|
|
1280
|
-
childrenResetGroupNum(
|
|
1281
|
-
this.equipNumManage.resetGroupNum(
|
|
3635
|
+
childrenResetGroupNum(n) {
|
|
3636
|
+
this.equipNumManage.resetGroupNum(n, this.filterEquip, this.equipStatusObject);
|
|
1282
3637
|
},
|
|
1283
3638
|
|
|
1284
3639
|
/**
|
|
@@ -1286,52 +3641,52 @@ const it = /* @__PURE__ */ O(R, [["render", et]]), st = {
|
|
|
1286
3641
|
* @param {data} {equipNo}
|
|
1287
3642
|
* @return arry[equipNo]
|
|
1288
3643
|
*/
|
|
1289
|
-
getEquipStatus(
|
|
1290
|
-
return this.equipStatusManage.equipStatusObject[
|
|
3644
|
+
getEquipStatus(n) {
|
|
3645
|
+
return this.equipStatusManage.equipStatusObject[n];
|
|
1291
3646
|
}
|
|
1292
3647
|
// 通过外框事件更新树形结构数据--end
|
|
1293
3648
|
}
|
|
1294
|
-
},
|
|
3649
|
+
}, qi = {
|
|
1295
3650
|
class: "gw-tree",
|
|
1296
3651
|
style: { height: "100%" }
|
|
1297
|
-
},
|
|
3652
|
+
}, Ti = {
|
|
1298
3653
|
class: "tree",
|
|
1299
3654
|
style: { height: "100%" }
|
|
1300
3655
|
};
|
|
1301
|
-
function
|
|
1302
|
-
const a =
|
|
1303
|
-
return
|
|
1304
|
-
|
|
1305
|
-
|
|
3656
|
+
function Oi(n, e, t, i, s, r) {
|
|
3657
|
+
const a = x("virtual-list", !0);
|
|
3658
|
+
return E(), T("div", qi, [
|
|
3659
|
+
A("div", Ti, [
|
|
3660
|
+
C(a, {
|
|
1306
3661
|
ref: "virtualList",
|
|
1307
3662
|
class: "virtualList",
|
|
1308
3663
|
"data-key": "key",
|
|
1309
|
-
"data-sources":
|
|
1310
|
-
"data-component":
|
|
3664
|
+
"data-sources": s.visibleList,
|
|
3665
|
+
"data-component": s.itemComponent,
|
|
1311
3666
|
keeps: 40,
|
|
1312
3667
|
"extra-props": {
|
|
1313
|
-
currentSelect:
|
|
1314
|
-
nodeClick:
|
|
1315
|
-
showStatus:
|
|
1316
|
-
filterEquip:
|
|
1317
|
-
showSettings:
|
|
1318
|
-
showCheckbox:
|
|
1319
|
-
onChecked:
|
|
1320
|
-
showOperate:
|
|
1321
|
-
groupEditAndNew:
|
|
1322
|
-
deleteGroup:
|
|
1323
|
-
colorConfig:
|
|
1324
|
-
childrenResetGroupNum:
|
|
1325
|
-
getEquipStatus:
|
|
3668
|
+
currentSelect: s.currentSelect,
|
|
3669
|
+
nodeClick: r.nodeClick,
|
|
3670
|
+
showStatus: t.showStatus,
|
|
3671
|
+
filterEquip: t.filterEquip,
|
|
3672
|
+
showSettings: t.showSettings,
|
|
3673
|
+
showCheckbox: t.showCheckbox,
|
|
3674
|
+
onChecked: r.onChecked,
|
|
3675
|
+
showOperate: t.showOperate,
|
|
3676
|
+
groupEditAndNew: r.groupEditAndNew,
|
|
3677
|
+
deleteGroup: r.deleteGroup,
|
|
3678
|
+
colorConfig: t.colorConfig,
|
|
3679
|
+
childrenResetGroupNum: r.childrenResetGroupNum,
|
|
3680
|
+
getEquipStatus: r.getEquipStatus
|
|
1326
3681
|
}
|
|
1327
3682
|
}, null, 8, ["data-sources", "data-component", "extra-props"])
|
|
1328
3683
|
])
|
|
1329
3684
|
]);
|
|
1330
3685
|
}
|
|
1331
|
-
const
|
|
1332
|
-
class
|
|
3686
|
+
const Ni = /* @__PURE__ */ ce(Ei, [["render", Oi]]);
|
|
3687
|
+
class Ii {
|
|
1333
3688
|
constructor() {
|
|
1334
|
-
this.eGroupNotify = new
|
|
3689
|
+
this.eGroupNotify = new et("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.window = window;
|
|
1335
3690
|
try {
|
|
1336
3691
|
window.top.equipGroup, this.window = window.top;
|
|
1337
3692
|
} catch {
|
|
@@ -1342,181 +3697,181 @@ class ht {
|
|
|
1342
3697
|
this.notify && this.notify.stop();
|
|
1343
3698
|
}
|
|
1344
3699
|
Init() {
|
|
1345
|
-
this.eGroupNotify.openConnect().then((
|
|
1346
|
-
this.notify =
|
|
3700
|
+
this.eGroupNotify.openConnect().then((e) => {
|
|
3701
|
+
this.notify = e;
|
|
1347
3702
|
try {
|
|
1348
|
-
|
|
1349
|
-
} catch (
|
|
1350
|
-
console.log(
|
|
3703
|
+
e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree");
|
|
3704
|
+
} catch (t) {
|
|
3705
|
+
console.log(t);
|
|
1351
3706
|
}
|
|
1352
|
-
this.subscribeTo(
|
|
3707
|
+
this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");
|
|
1353
3708
|
try {
|
|
1354
|
-
|
|
1355
|
-
} catch (
|
|
1356
|
-
console.log(
|
|
3709
|
+
e.invoke("GetGroupEquips");
|
|
3710
|
+
} catch (t) {
|
|
3711
|
+
console.log(t);
|
|
1357
3712
|
}
|
|
1358
|
-
this.subscribeTo(
|
|
3713
|
+
this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose((t) => {
|
|
1359
3714
|
try {
|
|
1360
3715
|
this.Init();
|
|
1361
3716
|
} catch (i) {
|
|
1362
3717
|
console.log(i);
|
|
1363
3718
|
}
|
|
1364
|
-
console.log("重连",
|
|
3719
|
+
console.log("重连", t);
|
|
1365
3720
|
});
|
|
1366
|
-
}).catch((
|
|
1367
|
-
console.error(
|
|
3721
|
+
}).catch((e) => {
|
|
3722
|
+
console.error(e);
|
|
1368
3723
|
});
|
|
1369
3724
|
}
|
|
1370
|
-
subscribeTo(
|
|
1371
|
-
|
|
1372
|
-
i && i.isSuccess && (this[
|
|
3725
|
+
subscribeTo(e, t) {
|
|
3726
|
+
e.off(t), e.on(t, (i) => {
|
|
3727
|
+
i && i.isSuccess && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId }));
|
|
1373
3728
|
});
|
|
1374
3729
|
}
|
|
1375
3730
|
// 获取分组---无权限管理的分组列表--空设备分组不展示
|
|
1376
|
-
GetEquipGroupTree(
|
|
1377
|
-
this.window.groupList || (this.window.groupList =
|
|
3731
|
+
GetEquipGroupTree(e) {
|
|
3732
|
+
this.window.groupList || (this.window.groupList = e, this.notice({ type: "GetEquipGroupTree" }));
|
|
1378
3733
|
}
|
|
1379
3734
|
// 获取全量分组---设备管理使用
|
|
1380
|
-
GetAllEquipGroupTree(
|
|
1381
|
-
this.window.groupList_manageMent || (this.window.groupList_manageMent =
|
|
3735
|
+
GetAllEquipGroupTree(e) {
|
|
3736
|
+
this.window.groupList_manageMent || (this.window.groupList_manageMent = e, this.notice({ type: "GetEquipGroupTreeWidthTreeType" }));
|
|
1382
3737
|
}
|
|
1383
3738
|
// 新增分组
|
|
1384
|
-
AddEquipGroup(
|
|
1385
|
-
const { parentGroupId:
|
|
3739
|
+
AddEquipGroup(e) {
|
|
3740
|
+
const { parentGroupId: t, groupId: i, groupName: s } = e || {};
|
|
1386
3741
|
i && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({
|
|
1387
|
-
parentId:
|
|
3742
|
+
parentId: t,
|
|
1388
3743
|
id: i,
|
|
1389
|
-
name:
|
|
3744
|
+
name: s,
|
|
1390
3745
|
equipCount: 0
|
|
1391
|
-
}), this.notice({ type: "AddEquipGroup", data:
|
|
3746
|
+
}), this.notice({ type: "AddEquipGroup", data: e }));
|
|
1392
3747
|
}
|
|
1393
3748
|
// 编辑分组
|
|
1394
|
-
EditEquipGroup(
|
|
1395
|
-
const { groupId:
|
|
1396
|
-
this.window.groupList && window.groupList.forEach((
|
|
1397
|
-
|
|
1398
|
-
}), this.window.groupList_manageMent && window.groupList_manageMent.forEach((
|
|
1399
|
-
|
|
1400
|
-
}), this.notice({ type: "EditEquipGroup", data:
|
|
1401
|
-
}
|
|
1402
|
-
deleteChildGroup(
|
|
3749
|
+
EditEquipGroup(e) {
|
|
3750
|
+
const { groupId: t, groupName: i } = e;
|
|
3751
|
+
this.window.groupList && window.groupList.forEach((s) => {
|
|
3752
|
+
s.id == t && (s.name = i);
|
|
3753
|
+
}), this.window.groupList_manageMent && window.groupList_manageMent.forEach((s) => {
|
|
3754
|
+
s.id == t && (s.name = i);
|
|
3755
|
+
}), this.notice({ type: "EditEquipGroup", data: e });
|
|
3756
|
+
}
|
|
3757
|
+
deleteChildGroup(e, t) {
|
|
1403
3758
|
let i = [];
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
}), i.forEach((
|
|
1407
|
-
let
|
|
1408
|
-
|
|
3759
|
+
t.forEach((s) => {
|
|
3760
|
+
s.parentId == e && i.push(s.id);
|
|
3761
|
+
}), i.forEach((s) => {
|
|
3762
|
+
let r = t.findIndex((a) => a.id == s);
|
|
3763
|
+
r > -1 && t.splice(r, 1), this.deleteChildGroup(s, t);
|
|
1409
3764
|
});
|
|
1410
3765
|
}
|
|
1411
3766
|
// 删除分组
|
|
1412
|
-
DeleteEquipGroup(
|
|
1413
|
-
|
|
3767
|
+
DeleteEquipGroup(e) {
|
|
3768
|
+
e.forEach((t) => {
|
|
1414
3769
|
if (this.window.groupList) {
|
|
1415
|
-
let i = this.window.groupList.findIndex((
|
|
1416
|
-
i > -1 && this.window.groupList.splice(i, 1), this.deleteChildGroup(
|
|
3770
|
+
let i = this.window.groupList.findIndex((s) => s.id == t.groupId);
|
|
3771
|
+
i > -1 && this.window.groupList.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList);
|
|
1417
3772
|
}
|
|
1418
3773
|
if (this.window.groupList_manageMent) {
|
|
1419
|
-
let i = this.window.groupList_manageMent.findIndex((
|
|
1420
|
-
i > -1 && this.window.groupList_manageMent.splice(i, 1), this.deleteChildGroup(
|
|
3774
|
+
let i = this.window.groupList_manageMent.findIndex((s) => s.id == t.groupId);
|
|
3775
|
+
i > -1 && this.window.groupList_manageMent.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList_manageMent);
|
|
1421
3776
|
}
|
|
1422
|
-
}), this.notice({ type: "DeleteEquipGroup", data:
|
|
3777
|
+
}), this.notice({ type: "DeleteEquipGroup", data: e });
|
|
1423
3778
|
}
|
|
1424
3779
|
// 获取设备
|
|
1425
|
-
GetGroupEquips(
|
|
1426
|
-
const { groupId:
|
|
1427
|
-
this.alreadyUpdate[
|
|
1428
|
-
|
|
1429
|
-
}), this.window[`group-${
|
|
3780
|
+
GetGroupEquips(e) {
|
|
3781
|
+
const { groupId: t, equips: i } = e || {};
|
|
3782
|
+
this.alreadyUpdate[t] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] = {}, t && i && i instanceof Array && (i.forEach((s) => {
|
|
3783
|
+
s.title = s.name, s.groupId = t, s.equipNo = s.id, delete s.name, window.equipCache || (this.window.equipCache = {}), this.window.equipCache[s.id] = s, this.window.groupCache[t][s.id] = s;
|
|
3784
|
+
}), this.window[`group-${t}`] = i, this.notice({ type: "GetGroupEquips", data: { groupId: t } }), this.alreadyUpdate[t] = !0));
|
|
1430
3785
|
}
|
|
1431
3786
|
// 新增设备
|
|
1432
|
-
AddEquip(
|
|
1433
|
-
const { groupId:
|
|
1434
|
-
this.window[`group-${
|
|
1435
|
-
let
|
|
1436
|
-
if (
|
|
1437
|
-
if (i.forEach((
|
|
1438
|
-
this.window[`group-${
|
|
3787
|
+
AddEquip(e) {
|
|
3788
|
+
const { groupId: t, equips: i } = e || {};
|
|
3789
|
+
this.window[`group-${t}`] || (this.window[`group-${t}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] || (this.window.groupCache[t] = {}), this.window.equipCache || (this.window.equipCache = {});
|
|
3790
|
+
let s = this.window[`group-${t}`].length;
|
|
3791
|
+
if (t && i) {
|
|
3792
|
+
if (i.forEach((r, a) => {
|
|
3793
|
+
this.window[`group-${t}`].push(
|
|
1439
3794
|
{
|
|
1440
|
-
equipNo:
|
|
1441
|
-
groupId:
|
|
1442
|
-
id:
|
|
1443
|
-
title:
|
|
3795
|
+
equipNo: r.id,
|
|
3796
|
+
groupId: t,
|
|
3797
|
+
id: r.id,
|
|
3798
|
+
title: r.name
|
|
1444
3799
|
}
|
|
1445
|
-
), this.window.equipCache[
|
|
1446
|
-
}), !this.exist(
|
|
1447
|
-
let
|
|
1448
|
-
this.window.groupList.push(...
|
|
3800
|
+
), this.window.equipCache[r.id] = this.window[`group-${t}`][s + a], this.window.groupCache[t][r.id] = this.window[`group-${t}`][s + a];
|
|
3801
|
+
}), !this.exist(t, this.window.groupList)) {
|
|
3802
|
+
let r = this.findParentList(t, this.window.groupList_manageMent);
|
|
3803
|
+
this.window.groupList.push(...r);
|
|
1449
3804
|
}
|
|
1450
|
-
this.notice({ type: "AddEquip", data:
|
|
3805
|
+
this.notice({ type: "AddEquip", data: e });
|
|
1451
3806
|
}
|
|
1452
3807
|
}
|
|
1453
|
-
moveEquips(
|
|
1454
|
-
let
|
|
1455
|
-
const { sourceGroup:
|
|
1456
|
-
a &&
|
|
1457
|
-
if (
|
|
1458
|
-
if (
|
|
1459
|
-
let
|
|
1460
|
-
|
|
3808
|
+
moveEquips(e) {
|
|
3809
|
+
let t = [], i = !0, s = [];
|
|
3810
|
+
const { sourceGroup: r, targetGroupId: a } = e || {};
|
|
3811
|
+
a && t.push(a), r.forEach((c) => {
|
|
3812
|
+
if (t.push(c.groupId), (!this.window[`group-${a}`] || !this.window[`group-${a}`].length) && (this.window[`group-${a}`] = [], s.push(a)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[a] || (this.window.groupCache[a] = {}), c.equips.forEach((u) => {
|
|
3813
|
+
if (u.title = u.name, u.groupId = a, u.equipNo = u.id, this.window[`group-${c.groupId}`]) {
|
|
3814
|
+
let o = this.window[`group-${c.groupId}`].findIndex((l) => l.id == u.id);
|
|
3815
|
+
o > -1 && this.window[`group-${c.groupId}`].splice(o, 1);
|
|
1461
3816
|
}
|
|
1462
|
-
window.equipCache || (this.window.equipCache = {}), this.window.equipCache[
|
|
1463
|
-
}), !this.window[`group-${
|
|
1464
|
-
let
|
|
1465
|
-
|
|
3817
|
+
window.equipCache || (this.window.equipCache = {}), this.window.equipCache[u.id] = u, this.window.groupCache[a][u.id] = u, this.window[`group-${a}`].push(u);
|
|
3818
|
+
}), !this.window[`group-${c.groupId}`].length) {
|
|
3819
|
+
let u = this.window.groupList.findIndex((o) => o.id == c.groupId);
|
|
3820
|
+
u > -1 && this.window.groupList.splice(u, 1), this.deleteChildGroup(c.groupId, this.window.groupList);
|
|
1466
3821
|
}
|
|
1467
|
-
}),
|
|
1468
|
-
if (!this.exist(
|
|
1469
|
-
let
|
|
1470
|
-
this.window.groupList.push(...
|
|
3822
|
+
}), s.forEach((c) => {
|
|
3823
|
+
if (!this.exist(c, this.window.groupList)) {
|
|
3824
|
+
let u = this.findParentList(c, this.window.groupList_manageMent);
|
|
3825
|
+
this.window.groupList.push(...u);
|
|
1471
3826
|
}
|
|
1472
|
-
}), this.notice({ type: "moveEquips", data: { updateGroups:
|
|
3827
|
+
}), this.notice({ type: "moveEquips", data: { updateGroups: t, buildTree: i } });
|
|
1473
3828
|
}
|
|
1474
|
-
exist(
|
|
1475
|
-
return
|
|
3829
|
+
exist(e, t) {
|
|
3830
|
+
return t ? t.some((i) => i.id == e) : !1;
|
|
1476
3831
|
}
|
|
1477
|
-
findParentList(
|
|
3832
|
+
findParentList(e, t) {
|
|
1478
3833
|
let i = [];
|
|
1479
|
-
if (
|
|
1480
|
-
let
|
|
1481
|
-
|
|
3834
|
+
if (t) {
|
|
3835
|
+
let s = t.findIndex((r) => r.id == e);
|
|
3836
|
+
s > -1 && i.push({ ...t[s] }), t[s].parentId && !this.exist(t[s].parentId, this.window.groupList) && i.push(...this.findParentList(t[s].parentId, this.window.groupList_manageMent));
|
|
1482
3837
|
}
|
|
1483
3838
|
return i;
|
|
1484
3839
|
}
|
|
1485
3840
|
// 删除设备
|
|
1486
|
-
DeleteEquip(
|
|
1487
|
-
const { groupId:
|
|
1488
|
-
if (
|
|
1489
|
-
if (this.window[`group-${
|
|
1490
|
-
for (let
|
|
1491
|
-
let a = this.window[`group-${
|
|
1492
|
-
a > -1 && this.window[`group-${
|
|
3841
|
+
DeleteEquip(e) {
|
|
3842
|
+
const { groupId: t, equips: i } = e || {};
|
|
3843
|
+
if (t && i && i instanceof Array) {
|
|
3844
|
+
if (this.window[`group-${t}`]) {
|
|
3845
|
+
for (let s = 0, r = i.length; s < r; s++) {
|
|
3846
|
+
let a = this.window[`group-${t}`].findIndex((c) => c.id == i[s].id);
|
|
3847
|
+
a > -1 && this.window[`group-${t}`].splice(a, 1), delete this.window.equipCache[i[s].id], delete this.window.groupCache[t][i[s].id];
|
|
1493
3848
|
}
|
|
1494
3849
|
}
|
|
1495
|
-
this.notice({ type: "DeleteEquip", data:
|
|
3850
|
+
this.notice({ type: "DeleteEquip", data: e });
|
|
1496
3851
|
}
|
|
1497
3852
|
}
|
|
1498
3853
|
// 编辑设备
|
|
1499
|
-
EditEquip(
|
|
1500
|
-
const { equipNo:
|
|
1501
|
-
i &&
|
|
3854
|
+
EditEquip(e) {
|
|
3855
|
+
const { equipNo: t, groupId: i, equipName: s } = e || {};
|
|
3856
|
+
i && t && (window[`group-${i}`] && (this.window.equipCache[t] = s), this.notice({ type: "EditEquip", data: e }));
|
|
1502
3857
|
}
|
|
1503
|
-
notice(
|
|
3858
|
+
notice(e) {
|
|
1504
3859
|
if (this.window.hasIframe) {
|
|
1505
|
-
let
|
|
1506
|
-
for (let i of
|
|
1507
|
-
} else { window.postMessage(
|
|
3860
|
+
let t = document.getElementsByTagName("iframe");
|
|
3861
|
+
for (let i of t) { i.contentWindow.postMessage(e); }
|
|
3862
|
+
} else { window.postMessage(e, "*"); }
|
|
1508
3863
|
}
|
|
1509
3864
|
}
|
|
1510
|
-
const
|
|
3865
|
+
const Mi = {
|
|
1511
3866
|
name: "treeV2",
|
|
1512
3867
|
components: {
|
|
1513
|
-
tree:
|
|
3868
|
+
tree: Ni
|
|
1514
3869
|
},
|
|
1515
|
-
mixins: [
|
|
3870
|
+
mixins: [Ye],
|
|
1516
3871
|
data() {
|
|
1517
3872
|
return {
|
|
1518
3873
|
list: [],
|
|
1519
|
-
refId:
|
|
3874
|
+
refId: O.generateUUID(),
|
|
1520
3875
|
treeKey: null,
|
|
1521
3876
|
listKey: null,
|
|
1522
3877
|
hasBuildTree: !1
|
|
@@ -1529,8 +3884,8 @@ const nt = {
|
|
|
1529
3884
|
}
|
|
1530
3885
|
},
|
|
1531
3886
|
mounted() {
|
|
1532
|
-
this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, this.window[this.treeKey] ? this.list =
|
|
1533
|
-
|
|
3887
|
+
this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, this.window[this.treeKey] ? this.list = O.formateList(JSON.parse(JSON.stringify(this.window[this.treeKey]))) : this.window[this.listKey] && this.buildTree(), window.executeQueue || (window.executeQueues = {}), window.executeQueues[this.refId] = this.destroyTree, window.addEventListener("message", (n) => {
|
|
3888
|
+
n && n.data && n.data.type && this[n.data.type] && this[n.data.type]();
|
|
1534
3889
|
});
|
|
1535
3890
|
try {
|
|
1536
3891
|
this.window.hasIframe || this.selfRequest();
|
|
@@ -1540,7 +3895,7 @@ const nt = {
|
|
|
1540
3895
|
},
|
|
1541
3896
|
methods: {
|
|
1542
3897
|
selfRequest() {
|
|
1543
|
-
new
|
|
3898
|
+
new Ii().Init();
|
|
1544
3899
|
},
|
|
1545
3900
|
GetEquipGroupTreeWidthTreeType() {
|
|
1546
3901
|
this.treeType && this.window[this.listKey] && this.buildTree();
|
|
@@ -1550,12 +3905,12 @@ const nt = {
|
|
|
1550
3905
|
},
|
|
1551
3906
|
buildTree() {
|
|
1552
3907
|
if (this.window[this.listKey]) {
|
|
1553
|
-
let
|
|
1554
|
-
this.list =
|
|
3908
|
+
let n = O.listToTreeList(JSON.parse(JSON.stringify(this.window[this.listKey])));
|
|
3909
|
+
this.list = O.formateList(JSON.parse(JSON.stringify(n))), this.window[`equipGroup${this.treeType}`] = n, this.hasBuildTree = !0;
|
|
1555
3910
|
}
|
|
1556
3911
|
},
|
|
1557
|
-
filterMethod(
|
|
1558
|
-
this.$refs[this.refId].filterMethod(
|
|
3912
|
+
filterMethod(n) {
|
|
3913
|
+
this.$refs[this.refId].filterMethod(n);
|
|
1559
3914
|
},
|
|
1560
3915
|
resetCheckedStatus() {
|
|
1561
3916
|
this.$refs[this.refId].resetCheckedStatus();
|
|
@@ -1574,17 +3929,17 @@ const nt = {
|
|
|
1574
3929
|
}
|
|
1575
3930
|
}
|
|
1576
3931
|
};
|
|
1577
|
-
function
|
|
1578
|
-
const a =
|
|
1579
|
-
return
|
|
1580
|
-
ref:
|
|
1581
|
-
data:
|
|
1582
|
-
}, { ...
|
|
3932
|
+
function xi(n, e, t, i, s, r) {
|
|
3933
|
+
const a = x("tree");
|
|
3934
|
+
return E(), se(a, dt({
|
|
3935
|
+
ref: s.refId,
|
|
3936
|
+
data: s.list
|
|
3937
|
+
}, { ...n.$attrs, ...n.$props }, pt(n.$listeners), { buildTree: r.buildTree }), null, 16, ["data", "buildTree"]);
|
|
1583
3938
|
}
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
|
|
3939
|
+
const ye = /* @__PURE__ */ ce(Mi, [["render", xi]]);
|
|
3940
|
+
ye.install = function(n) {
|
|
3941
|
+
n.component(ye.name, ye);
|
|
1587
3942
|
};
|
|
1588
3943
|
export {
|
|
1589
|
-
|
|
3944
|
+
ye as default
|
|
1590
3945
|
};
|