rc-lib-ui 1.3.7 → 1.3.8
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/dist/control-cards.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{index-DjJlkTF6.js → index-DWH7tN5F.js} +2 -2
- package/dist/socket.js +88 -89
- package/package.json +2 -2
package/dist/control-cards.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Box as M, styled as P, Card as xn, Typography as j, Button as yn, Linea
|
|
|
8
8
|
import Ve from "classnames";
|
|
9
9
|
import { createPortal as Un } from "react-dom";
|
|
10
10
|
import { Save as Yn, Close as ge, Delete as Gn, InfoOutlined as Kn, VerifiedUser as Zn, CheckCircle as bn, TaskAlt as Qn } from "@mui/icons-material";
|
|
11
|
-
import { C as Jn } from "./index-
|
|
11
|
+
import { C as Jn } from "./index-DWH7tN5F.js";
|
|
12
12
|
import './control-cards.css';const En = $n(void 0), et = () => {
|
|
13
13
|
const e = hn(En);
|
|
14
14
|
if (!e)
|
package/dist/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as v, useRef as A, useEffect as l, useCallback as r } from "react";
|
|
2
|
-
import { T as p } from "./index-
|
|
2
|
+
import { T as p } from "./index-DWH7tN5F.js";
|
|
3
3
|
import { s as h } from "./index-B7GqTJat.js";
|
|
4
4
|
const b = ({ defaultIsActive: s = !0, timer: c = 5e3, onDeActive: n }) => {
|
|
5
5
|
const [t, u] = v({
|
|
@@ -2231,7 +2231,7 @@ c(x, "events", (t, e, r, n = "") => new Promise((o, s) => {
|
|
|
2231
2231
|
return !1;
|
|
2232
2232
|
}
|
|
2233
2233
|
return !0;
|
|
2234
|
-
}), c(x, "filterItems", (t, e) => t.filter((
|
|
2234
|
+
}), c(x, "filterItems", (t, e, r) => t.filter((n) => n[(r == null ? void 0 : r.filteKey) || "name"].toLowerCase().includes(e.toLowerCase()))), c(x, "sortByOnline", (t) => {
|
|
2235
2235
|
const e = [], r = [];
|
|
2236
2236
|
for (let s = 0; t.length > s; s++) {
|
|
2237
2237
|
const i = t[s];
|
|
@@ -2565,7 +2565,7 @@ class NetworkStatusTracker {
|
|
|
2565
2565
|
isNetwork: e,
|
|
2566
2566
|
typeNetwork: this.getTypeNetwork(e)
|
|
2567
2567
|
};
|
|
2568
|
-
|
|
2568
|
+
typeof r == "function" && this.networkInfo.typeNetwork !== n.typeNetwork && r(n), this.networkInfo = n;
|
|
2569
2569
|
}
|
|
2570
2570
|
getControllersEvents() {
|
|
2571
2571
|
return this.controllersEvents;
|
package/dist/socket.js
CHANGED
|
@@ -7,7 +7,7 @@ import { c as U } from "./react-CLnE01WS.js";
|
|
|
7
7
|
import { styled as M, Collapse as G } from "@mui/material";
|
|
8
8
|
import L from "classnames";
|
|
9
9
|
import { u as W } from "./browser-DJTk47DY.js";
|
|
10
|
-
import { N as $ } from "./index-
|
|
10
|
+
import { N as $ } from "./index-DWH7tN5F.js";
|
|
11
11
|
const T = {
|
|
12
12
|
statusConnect: "disconnect",
|
|
13
13
|
isOfflineSocket: !1,
|
|
@@ -35,7 +35,7 @@ const T = {
|
|
|
35
35
|
getIsOfflineSocket: (o) => o.isOfflineSocket,
|
|
36
36
|
getInfoNoConnectServer: (o) => o.infoNoConnectServer,
|
|
37
37
|
getIsDisableConnectSocket: (o) => o.isDisableConnectSocket
|
|
38
|
-
},
|
|
38
|
+
}, b = (o) => m(o), Q = M("span")({
|
|
39
39
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
40
40
|
color: "#fff",
|
|
41
41
|
display: "flex",
|
|
@@ -76,7 +76,7 @@ const T = {
|
|
|
76
76
|
height: "100%"
|
|
77
77
|
}
|
|
78
78
|
})), j = ({ text: o = "Происходит подключение к серверу", className: e, ...t }) => {
|
|
79
|
-
const n =
|
|
79
|
+
const n = b(R.getStatusConnectSocket), i = b(R.getStatusIsReConnectSocket);
|
|
80
80
|
return /* @__PURE__ */ D(
|
|
81
81
|
Z,
|
|
82
82
|
{
|
|
@@ -100,26 +100,26 @@ class ee {
|
|
|
100
100
|
}, i = (u) => {
|
|
101
101
|
t != null && t.controlAction && (t == null || t.controlAction(u));
|
|
102
102
|
};
|
|
103
|
-
let
|
|
103
|
+
let a = !0, l, c, f;
|
|
104
104
|
const S = (u = !0) => {
|
|
105
105
|
const h = "Ручное завершение startActionEvery";
|
|
106
|
-
|
|
106
|
+
a = !1, clearInterval(l), n(null), u ? c && c({ status: u, msg: h + ": (true)" }) : f && f({ status: u, msg: h + ": (false)" });
|
|
107
107
|
};
|
|
108
108
|
return {
|
|
109
109
|
promise: new Promise((u, h) => {
|
|
110
|
-
|
|
110
|
+
c = u, f = h;
|
|
111
111
|
let y = 0, d = 0;
|
|
112
112
|
l = setInterval(
|
|
113
113
|
() => {
|
|
114
114
|
if (y += t.interval, d += 1, t != null && t.cutoffTime && y > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < d) {
|
|
115
|
-
|
|
115
|
+
a = !1, clearInterval(l), n(null), h({ status: !1, msg: Error("Время загрузки истекло") });
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
e() && (
|
|
118
|
+
e() && (a = !1, clearInterval(l), n(null), u({ status: !0, msg: "cb вернул true" }));
|
|
119
119
|
},
|
|
120
120
|
t.interval < 200 ? 200 : t.interval
|
|
121
121
|
), n(l), i({
|
|
122
|
-
getIsActiveEvent: () =>
|
|
122
|
+
getIsActiveEvent: () => a,
|
|
123
123
|
stop: S
|
|
124
124
|
});
|
|
125
125
|
}),
|
|
@@ -131,24 +131,24 @@ class ee {
|
|
|
131
131
|
e().then(() => {
|
|
132
132
|
i === 1 && (i = 0);
|
|
133
133
|
});
|
|
134
|
-
let
|
|
135
|
-
i === 1 && t(), clearInterval(
|
|
134
|
+
let a = setInterval(() => {
|
|
135
|
+
i === 1 && t(), clearInterval(a);
|
|
136
136
|
}, n * 1e3);
|
|
137
137
|
});
|
|
138
|
-
r(this, "oneOfPromise", (e, t, { second: n }) => new Promise((i,
|
|
139
|
-
let l = 1,
|
|
138
|
+
r(this, "oneOfPromise", (e, t, { second: n }) => new Promise((i, a) => {
|
|
139
|
+
let l = 1, c = { status: !1, msg: "" };
|
|
140
140
|
e().then((S) => {
|
|
141
141
|
l === 1 && (l = 0, i(S));
|
|
142
142
|
}).catch((S) => {
|
|
143
|
-
l === 1 && (l = 0,
|
|
143
|
+
l === 1 && (l = 0, c.msg = S, a(S));
|
|
144
144
|
});
|
|
145
145
|
let f = setInterval(() => {
|
|
146
146
|
if (l === 1) {
|
|
147
147
|
if (l = 0, typeof t == "function") {
|
|
148
|
-
|
|
148
|
+
a({ status: !1, msg: "", ...t(c) });
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
a({ status: !1, msg: "oneOfPromise reject" });
|
|
152
152
|
}
|
|
153
153
|
clearInterval(f);
|
|
154
154
|
}, n * 1e3);
|
|
@@ -207,9 +207,9 @@ class te {
|
|
|
207
207
|
["message", this.msgHandler],
|
|
208
208
|
["error", this.errHandler]
|
|
209
209
|
];
|
|
210
|
-
for (let
|
|
211
|
-
const [l,
|
|
212
|
-
e === "add" ? (n = this.state.ws) == null || n.addEventListener(l,
|
|
210
|
+
for (let a = 0; a < t.length; a++) {
|
|
211
|
+
const [l, c] = t[a];
|
|
212
|
+
e === "add" ? (n = this.state.ws) == null || n.addEventListener(l, c) : (i = this.state.ws) == null || i.removeEventListener(l, c);
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
r(this, "openHandler", () => {
|
|
@@ -223,8 +223,8 @@ class te {
|
|
|
223
223
|
try {
|
|
224
224
|
const { action: n } = t, i = this.findDataRequestByAction(n);
|
|
225
225
|
if (i) {
|
|
226
|
-
const { cb:
|
|
227
|
-
this.events.publish("msg", { ...t, request: { ...f, ...
|
|
226
|
+
const { cb: a, ...l } = i, { payload: c, ...f } = l;
|
|
227
|
+
this.events.publish("msg", { ...t, request: { ...f, ...c } });
|
|
228
228
|
} else
|
|
229
229
|
this.events.publish("msg", t);
|
|
230
230
|
n && this.filterSaveItemsByResponse(t);
|
|
@@ -261,7 +261,7 @@ class te {
|
|
|
261
261
|
const e = this.initOptions;
|
|
262
262
|
return e || this.errorInitSocket(), e;
|
|
263
263
|
});
|
|
264
|
-
r(this, "findDataRequestByAction", (e) => this.getItemsRequestSaveByAction(e).sort((i,
|
|
264
|
+
r(this, "findDataRequestByAction", (e) => this.getItemsRequestSaveByAction(e).sort((i, a) => a.requestTime - i.requestTime)[0]);
|
|
265
265
|
}
|
|
266
266
|
resetState() {
|
|
267
267
|
this.state = this.copyState(this.stateDefault);
|
|
@@ -275,8 +275,8 @@ class te {
|
|
|
275
275
|
filterSaveItemsByResponse(e) {
|
|
276
276
|
const t = this.getRequestSave(), n = [];
|
|
277
277
|
for (let i = 0; i < t.length; i++) {
|
|
278
|
-
const
|
|
279
|
-
|
|
278
|
+
const a = t[i];
|
|
279
|
+
a.payload.action !== e.action ? n.push(a) : a.cb && a.cb(e);
|
|
280
280
|
}
|
|
281
281
|
this.state.arrSaveReq = n;
|
|
282
282
|
}
|
|
@@ -335,16 +335,16 @@ const s = class s {
|
|
|
335
335
|
s.state.isDisconnect || (s.setState({ isDisconnect: !0 }), console.log("DISCONNECT WS"), s.wsApi.disconnect(), s.resetState(), s.events.resetSubscribers(), (e = this.networkTicker) == null || e.destroy());
|
|
336
336
|
}
|
|
337
337
|
static send(e, t) {
|
|
338
|
-
const { action: n, ...i } = e,
|
|
338
|
+
const { action: n, ...i } = e, a = i != null && i.request_id ? i.request_id : W(), l = Date.now();
|
|
339
339
|
s.wsApi.setRequestSave({
|
|
340
340
|
requestAction: n,
|
|
341
|
-
request_id:
|
|
341
|
+
request_id: a,
|
|
342
342
|
requestTime: l,
|
|
343
343
|
payload: { action: n, ...i },
|
|
344
344
|
cb: t
|
|
345
345
|
});
|
|
346
|
-
const
|
|
347
|
-
if (!
|
|
346
|
+
const c = s.wsApi.getSocket();
|
|
347
|
+
if (!c || c.readyState !== 1) {
|
|
348
348
|
console.log("Нет подключения к сокету. Запрос сохранён в setRequestSave");
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
@@ -355,16 +355,16 @@ const s = class s {
|
|
|
355
355
|
}
|
|
356
356
|
static async request(e, t = {}) {
|
|
357
357
|
return new Promise((n, i) => {
|
|
358
|
-
var d,
|
|
358
|
+
var d, g;
|
|
359
359
|
if ((d = t == null ? void 0 : t.signal) != null && d.aborted) {
|
|
360
360
|
i(new DOMException("Aborted", "AbortError"));
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
const
|
|
363
|
+
const a = e.action, l = e.request_id ? e.request_id : W(), c = Date.now();
|
|
364
364
|
s.wsApi.setRequestSave({
|
|
365
|
-
requestAction:
|
|
365
|
+
requestAction: a,
|
|
366
366
|
request_id: l,
|
|
367
|
-
requestTime:
|
|
367
|
+
requestTime: c,
|
|
368
368
|
payload: e,
|
|
369
369
|
cb: void 0
|
|
370
370
|
});
|
|
@@ -372,23 +372,23 @@ const s = class s {
|
|
|
372
372
|
t != null && t.timeout && (f = setTimeout(() => {
|
|
373
373
|
h(), i(new Error("Request timeout"));
|
|
374
374
|
}, t.timeout));
|
|
375
|
-
const S = (
|
|
376
|
-
h(), i(
|
|
377
|
-
}, C = (
|
|
375
|
+
const S = (v) => {
|
|
376
|
+
h(), i(v);
|
|
377
|
+
}, C = (v) => {
|
|
378
378
|
var N;
|
|
379
|
-
const I = this.wsApi.findDataRequestByAction(
|
|
380
|
-
!I || ((N =
|
|
379
|
+
const I = this.wsApi.findDataRequestByAction(a);
|
|
380
|
+
!I || ((N = v == null ? void 0 : v.request) == null ? void 0 : N.requestAction) !== I.requestAction || (h(), n({ ...v }));
|
|
381
381
|
}, u = () => {
|
|
382
382
|
h(), i(new DOMException("Aborted", "AbortError"));
|
|
383
383
|
}, h = () => {
|
|
384
|
-
var
|
|
385
|
-
s.off("msg", C), s.off("error", S), f && clearTimeout(f), (
|
|
384
|
+
var v;
|
|
385
|
+
s.off("msg", C), s.off("error", S), f && clearTimeout(f), (v = t == null ? void 0 : t.signal) == null || v.removeEventListener("abort", u);
|
|
386
386
|
};
|
|
387
|
-
s.on("msg", C), s.on("error", S), (
|
|
387
|
+
s.on("msg", C), s.on("error", S), (g = t == null ? void 0 : t.signal) == null || g.addEventListener("abort", u);
|
|
388
388
|
const y = s.wsApi.getSocket();
|
|
389
389
|
if (!y || y.readyState !== 1) {
|
|
390
|
-
const
|
|
391
|
-
console.error(
|
|
390
|
+
const v = "Нет подключения к сокету";
|
|
391
|
+
console.error(v), h(), i(new Error(v));
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
394
|
s.wsApi.send(e);
|
|
@@ -421,8 +421,8 @@ r(s, "state", {
|
|
|
421
421
|
s.state.isActiveReConnect && s.stopReConnect(!1);
|
|
422
422
|
}), r(s, "splitOptions", (e) => Object.entries(e).reduce(
|
|
423
423
|
(t, [n, i]) => {
|
|
424
|
-
const
|
|
425
|
-
return n in
|
|
424
|
+
const a = s.wsApi.getOptions();
|
|
425
|
+
return n in a ? { ...t, WsOptions: { ...t.WsOptions, [n]: i } } : { ...t, SocketApiOptions: { ...t.SocketApiOptions, [n]: i } };
|
|
426
426
|
},
|
|
427
427
|
{ WsOptions: {}, SocketApiOptions: {} }
|
|
428
428
|
)), /*---------------------------------------------------------------------------------------------------------------------------*/
|
|
@@ -438,8 +438,7 @@ r(s, "setNetworkStatus", (e) => {
|
|
|
438
438
|
}), r(s, "init", (e) => {
|
|
439
439
|
const { WsOptions: t, SocketApiOptions: n } = s.splitOptions(e);
|
|
440
440
|
s.networkTicker = new $(n.listUrlsCheckConnectNetwork ?? []), s.networkTicker.startEvents((i) => {
|
|
441
|
-
|
|
442
|
-
i.typeNetwork == c.infoNetwork.typeNetwork && i.isNetwork == c.infoNetwork.isNetwork || (s.setNetworkStatus(i), s.setState({ infoNetwork: i }));
|
|
441
|
+
s.getState(), s.setNetworkStatus(i), s.setState({ infoNetwork: i });
|
|
443
442
|
}), s.setOptions(n), s.wsApi.init(t), s.wsApi.events.subscribe("status", (i) => {
|
|
444
443
|
s.setState({ isOfflineSocket: i !== "ready" });
|
|
445
444
|
});
|
|
@@ -459,7 +458,7 @@ r(s, "socketReConnect", () => {
|
|
|
459
458
|
watchIdInterval: (l) => {
|
|
460
459
|
s.saveID.idReConnect = l;
|
|
461
460
|
},
|
|
462
|
-
controlAction: ({ stop: l, getIsActiveEvent:
|
|
461
|
+
controlAction: ({ stop: l, getIsActiveEvent: c }) => {
|
|
463
462
|
s.stopReConnect = l;
|
|
464
463
|
}
|
|
465
464
|
}
|
|
@@ -474,21 +473,21 @@ r(s, "socketReConnect", () => {
|
|
|
474
473
|
});
|
|
475
474
|
}
|
|
476
475
|
});
|
|
477
|
-
let
|
|
476
|
+
let p = s;
|
|
478
477
|
const se = (o, e = {}) => {
|
|
479
|
-
const t = o.action, { skip: n = !1, timeout: i = 5e3 } = e, [
|
|
478
|
+
const t = o.action, { skip: n = !1, timeout: i = 5e3 } = e, [a, l] = B({
|
|
480
479
|
data: null,
|
|
481
480
|
error: "",
|
|
482
481
|
isLoading: !1,
|
|
483
482
|
isError: !1,
|
|
484
483
|
isSuccess: !1
|
|
485
|
-
}),
|
|
484
|
+
}), c = b(R.getStatusReady), f = b(R.getStatusConnectSocket), S = x(null), C = x(e);
|
|
486
485
|
C.current = e;
|
|
487
486
|
const u = A(async () => {
|
|
488
|
-
var
|
|
487
|
+
var g, v, I, N;
|
|
489
488
|
if (n) return;
|
|
490
|
-
l((
|
|
491
|
-
...
|
|
489
|
+
l((w) => ({
|
|
490
|
+
...w,
|
|
492
491
|
isLoading: !0,
|
|
493
492
|
isError: !1,
|
|
494
493
|
isSuccess: !1,
|
|
@@ -497,17 +496,17 @@ const se = (o, e = {}) => {
|
|
|
497
496
|
})), S.current = new AbortController();
|
|
498
497
|
const d = S.current.signal;
|
|
499
498
|
try {
|
|
500
|
-
const
|
|
499
|
+
const w = await p.request(o, { timeout: i, signal: d });
|
|
501
500
|
if (d.aborted) return;
|
|
502
501
|
l((q) => ({
|
|
503
502
|
...q,
|
|
504
|
-
data:
|
|
503
|
+
data: w,
|
|
505
504
|
isSuccess: !0,
|
|
506
505
|
isLoading: !1
|
|
507
|
-
})), (
|
|
508
|
-
} catch (
|
|
506
|
+
})), (v = (g = C.current).onSuccess) == null || v.call(g, w);
|
|
507
|
+
} catch (w) {
|
|
509
508
|
if (d.aborted) return;
|
|
510
|
-
const q =
|
|
509
|
+
const q = w instanceof Error ? w.message : String(w);
|
|
511
510
|
l((J) => ({
|
|
512
511
|
...J,
|
|
513
512
|
error: q,
|
|
@@ -516,59 +515,59 @@ const se = (o, e = {}) => {
|
|
|
516
515
|
})), (N = (I = C.current).onError) == null || N.call(I, q);
|
|
517
516
|
}
|
|
518
517
|
}, [n, t, o, i]);
|
|
519
|
-
O(() => (!n &&
|
|
518
|
+
O(() => (!n && c && u(), () => {
|
|
520
519
|
var d;
|
|
521
520
|
(d = S.current) == null || d.abort();
|
|
522
|
-
}), [u, n,
|
|
523
|
-
!
|
|
521
|
+
}), [u, n, c]), O(() => {
|
|
522
|
+
!c && f === "pending" && l((d) => ({
|
|
524
523
|
...d,
|
|
525
524
|
isError: !1,
|
|
526
525
|
isSuccess: !1,
|
|
527
526
|
error: "Потеряно соединение с сервером"
|
|
528
527
|
}));
|
|
529
|
-
}, [
|
|
528
|
+
}, [c, f]);
|
|
530
529
|
const h = A(() => {
|
|
531
530
|
var d;
|
|
532
531
|
return (d = S.current) == null || d.abort(), u();
|
|
533
532
|
}, [u]), y = A(() => {
|
|
534
533
|
var d;
|
|
535
|
-
(d = S.current) == null || d.abort(), l((
|
|
534
|
+
(d = S.current) == null || d.abort(), l((g) => ({ ...g, isLoading: !1 }));
|
|
536
535
|
}, []);
|
|
537
536
|
return {
|
|
538
|
-
...
|
|
537
|
+
...a,
|
|
539
538
|
refetch: h,
|
|
540
539
|
abort: y
|
|
541
540
|
};
|
|
542
541
|
}, Re = (o, e) => se(o, e), ne = (o) => {
|
|
543
|
-
const { isModal: e } =
|
|
542
|
+
const { isModal: e } = b(R.getInfoNoConnectServer), t = b(R.getStatusIsReConnectSocket), n = b(R.getIsDisableConnectSocket), i = b(R.getStatusConnectSocket), [a, l] = B({
|
|
544
543
|
isNetwork: !1,
|
|
545
544
|
typeNetwork: ""
|
|
546
545
|
});
|
|
547
|
-
return O(() => (
|
|
548
|
-
console.log("network: ",
|
|
549
|
-
}),
|
|
546
|
+
return O(() => (p.on("network", (c) => {
|
|
547
|
+
console.log("network: ", c), l((f) => ({ ...f, isNetwork: c.isNetwork, typeNetwork: c.typeNetwork }));
|
|
548
|
+
}), p.init(o.init), typeof o.onMount == "function" && o.onMount(), p.on("status", (c) => {
|
|
550
549
|
const f = m.getState(), { isReadySocket: S, infoNoConnectServer: { isModal: C }, isOfflineSocket: u } = f;
|
|
551
|
-
|
|
552
|
-
}),
|
|
553
|
-
console.log("error: ",
|
|
554
|
-
}),
|
|
555
|
-
console.log('on"reConnect" (status): ',
|
|
550
|
+
c !== "ready" && S && k.setStatusReady({ isReadySocket: !1 }), !S && c === "ready" && (k.setStatusReady({ isReadySocket: !0 }), C && u && (console.log("Вырубаем модалку т.к. сокет законектился после окончания timeOffReConnect"), k.setInfoNoConnectServer({ isModal: !1 }), k.setIsOfflineSocket({ isOfflineSocket: !1 }))), k.setStatusConnectSocket({ statusConnect: c });
|
|
551
|
+
}), p.on("error", (c) => {
|
|
552
|
+
console.log("error: ", c);
|
|
553
|
+
}), p.on("reConnect", (c) => {
|
|
554
|
+
console.log('on"reConnect" (status): ', c);
|
|
556
555
|
const f = m.getState(), { isReConnectSocket: S, infoNoConnectServer: { isModal: C } } = f;
|
|
557
|
-
S !==
|
|
558
|
-
}),
|
|
559
|
-
if (console.log("timeOffReConnect: ",
|
|
556
|
+
S !== c && k.setStatusIsReConnectSocket({ isReConnectSocket: c }), C && c && k.setInfoNoConnectServer({ isModal: !1 });
|
|
557
|
+
}), p.on("timeOffReConnect", (c) => {
|
|
558
|
+
if (console.log("timeOffReConnect: ", c), k.setIsOfflineSocket({ isOfflineSocket: !c.status }), !c.status) {
|
|
560
559
|
const f = m.getState(), { infoNoConnectServer: { isModal: S, isSelectOffline: C } } = f;
|
|
561
560
|
let u = !1;
|
|
562
561
|
!S && !C && (u = !0), u && k.setInfoNoConnectServer({ isModal: u });
|
|
563
562
|
}
|
|
564
|
-
}),
|
|
565
|
-
typeof o.onUnmount == "function" && o.onUnmount(), console.dir("disconnect"),
|
|
563
|
+
}), p.connect(), () => {
|
|
564
|
+
typeof o.onUnmount == "function" && o.onUnmount(), console.dir("disconnect"), p.disconnect();
|
|
566
565
|
}), []), O(() => {
|
|
567
|
-
|
|
568
|
-
}, [n, e, t, i,
|
|
569
|
-
t && (!
|
|
570
|
-
}, [t,
|
|
571
|
-
n && (console.log("isDisableConnectSocket: ", n), k.setIsOfflineSocket({ isOfflineSocket: !0 }),
|
|
566
|
+
a.isNetwork && !n && !e && !t && ["close"].includes(i) && a.typeNetwork !== "none" && (console.log("Запущен socketReConnect"), p.socketReConnect());
|
|
567
|
+
}, [n, e, t, i, a.typeNetwork, a.isNetwork]), O(() => {
|
|
568
|
+
t && (!a.isNetwork || i === "ready") && (console.log("Запущен stopReConnect"), p.stopReConnect());
|
|
569
|
+
}, [t, a.isNetwork, i]), O(() => {
|
|
570
|
+
n && (console.log("isDisableConnectSocket: ", n), k.setIsOfflineSocket({ isOfflineSocket: !0 }), p.close());
|
|
572
571
|
}, [n]), null;
|
|
573
572
|
}, oe = E.memo(ne), ie = M(P, {
|
|
574
573
|
shouldForwardProp: (o) => ![""].includes(o)
|
|
@@ -581,14 +580,14 @@ const se = (o, e = {}) => {
|
|
|
581
580
|
padding: "1px 10px"
|
|
582
581
|
}
|
|
583
582
|
})), re = ({ children: o, className: e, isNetwork: t, ...n }) => {
|
|
584
|
-
const i =
|
|
583
|
+
const i = b(R.getIsOfflineSocket), a = b(R.getIsDisableConnectSocket), l = i || !t, c = "Оффлайн";
|
|
585
584
|
return /* @__PURE__ */ D(
|
|
586
585
|
ie,
|
|
587
586
|
{
|
|
588
587
|
in: l,
|
|
589
588
|
className: L("socket-offline", e),
|
|
590
589
|
...n,
|
|
591
|
-
children: typeof o == "function" ? o({ isDisableConnectSocket:
|
|
590
|
+
children: typeof o == "function" ? o({ isDisableConnectSocket: a }) : a ? `Режим ${c}` : c
|
|
592
591
|
}
|
|
593
592
|
);
|
|
594
593
|
}, ce = E.memo(re), ae = ({ children: o }) => {
|
|
@@ -601,7 +600,7 @@ const se = (o, e = {}) => {
|
|
|
601
600
|
k.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), k.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
|
|
602
601
|
}, []);
|
|
603
602
|
return o({ offlineActive: e });
|
|
604
|
-
}, Se = E.memo(ue),
|
|
603
|
+
}, Se = E.memo(ue), be = {
|
|
605
604
|
ConnectDetection: _,
|
|
606
605
|
OfflineDetection: ce,
|
|
607
606
|
Buttons: {
|
|
@@ -611,12 +610,12 @@ const se = (o, e = {}) => {
|
|
|
611
610
|
Initialization: oe
|
|
612
611
|
};
|
|
613
612
|
export {
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
be as Socket,
|
|
614
|
+
p as SocketApi,
|
|
616
615
|
Re as createRequestSocketApi,
|
|
617
616
|
k as socketActions,
|
|
618
617
|
R as socketSelectors,
|
|
619
618
|
m as socketStore,
|
|
620
619
|
se as useRequestSocketApi,
|
|
621
|
-
|
|
620
|
+
b as useSocketSelector
|
|
622
621
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rc-lib-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.8",
|
|
5
5
|
"author": "SinGlEBW",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build:dev": "node buildEditVersion.js"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"dev-classes": "^1.5.
|
|
62
|
+
"dev-classes": "^1.5.7",
|
|
63
63
|
"notistack": "^3.0.2",
|
|
64
64
|
"react-transition-group": "^4.4.5",
|
|
65
65
|
"uuid4": "^2.0.3",
|