@arcblock/ux 3.1.44 → 3.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Dialog/dialog.d.ts +0 -27
- package/lib/Img/index.d.ts +0 -6
- package/lib/UserCard/Content/minimal.js +1 -1
- package/lib/Util/constant.d.ts +9 -1
- package/lib/Util/index.js +65 -56
- package/lib/package.json.js +1 -1
- package/package.json +10 -10
- package/src/UserCard/Content/minimal.tsx +1 -1
- package/src/Util/index.ts +11 -3
package/lib/Dialog/dialog.d.ts
CHANGED
@@ -6,58 +6,34 @@ export type PaperStyle = import('@mui/material').PaperProps & {
|
|
6
6
|
minHeight?: number | string;
|
7
7
|
};
|
8
8
|
export type UxDialogProps = {
|
9
|
-
/**
|
10
|
-
* - The content of the dialog.
|
11
|
-
*/
|
12
9
|
/**
|
13
10
|
* - The content of the dialog.
|
14
11
|
*/
|
15
12
|
children: React.ReactNode;
|
16
|
-
/**
|
17
|
-
* - The title of the dialog.
|
18
|
-
*/
|
19
13
|
/**
|
20
14
|
* - The title of the dialog.
|
21
15
|
*/
|
22
16
|
title?: React.ReactNode;
|
23
|
-
/**
|
24
|
-
* - Content to be displayed before the dialog title.
|
25
|
-
*/
|
26
17
|
/**
|
27
18
|
* - Content to be displayed before the dialog title.
|
28
19
|
*/
|
29
20
|
prepend?: React.ReactNode;
|
30
|
-
/**
|
31
|
-
* - Content to be displayed in the top toolbar of the dialog.
|
32
|
-
*/
|
33
21
|
/**
|
34
22
|
* - Content to be displayed in the top toolbar of the dialog.
|
35
23
|
*/
|
36
24
|
toolbar?: React.ReactNode;
|
37
|
-
/**
|
38
|
-
* - Content to be displayed in the bottom actions toolbar of the dialog.
|
39
|
-
*/
|
40
25
|
/**
|
41
26
|
* - Content to be displayed in the bottom actions toolbar of the dialog.
|
42
27
|
*/
|
43
28
|
actions?: React.ReactNode;
|
44
|
-
/**
|
45
|
-
* - Whether or not to show the close button.
|
46
|
-
*/
|
47
29
|
/**
|
48
30
|
* - Whether or not to show the close button.
|
49
31
|
*/
|
50
32
|
showCloseButton?: boolean | undefined;
|
51
|
-
/**
|
52
|
-
* - The position of the actions toolbar.
|
53
|
-
*/
|
54
33
|
/**
|
55
34
|
* - The position of the actions toolbar.
|
56
35
|
*/
|
57
36
|
actionsPosition?: "left" | "right" | "center" | undefined;
|
58
|
-
/**
|
59
|
-
* - Props to be passed down to the dialog paper.
|
60
|
-
*/
|
61
37
|
/**
|
62
38
|
* - Props to be passed down to the dialog paper.
|
63
39
|
*/
|
@@ -65,9 +41,6 @@ export type UxDialogProps = {
|
|
65
41
|
slotProps?: {
|
66
42
|
content: object;
|
67
43
|
} | undefined;
|
68
|
-
/**
|
69
|
-
* - Callback function fired when the dialog is closed.
|
70
|
-
*/
|
71
44
|
/**
|
72
45
|
* - Callback function fired when the dialog is closed.
|
73
46
|
*/
|
package/lib/Img/index.d.ts
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
import { default as PropTypes } from 'prop-types';
|
2
2
|
export default Img;
|
3
3
|
export type ImgExProps = {
|
4
|
-
/**
|
5
|
-
* - required
|
6
|
-
*/
|
7
4
|
/**
|
8
5
|
* - required
|
9
6
|
*/
|
@@ -19,9 +16,6 @@ export type ImgExProps = {
|
|
19
16
|
lazy?: boolean | undefined;
|
20
17
|
placeholder?: string | undefined;
|
21
18
|
fallback?: string | undefined;
|
22
|
-
/**
|
23
|
-
* - 是否使用代理 fallback, 用于解决 CSP 的问题
|
24
|
-
*/
|
25
19
|
/**
|
26
20
|
* - 是否使用代理 fallback, 用于解决 CSP 的问题
|
27
21
|
*/
|
@@ -87,7 +87,7 @@ function A({ ...s }) {
|
|
87
87
|
) : null
|
88
88
|
] })
|
89
89
|
] }),
|
90
|
-
i &&
|
90
|
+
i && !l && o.showSocialActions ? /* @__PURE__ */ t(C, { sx: { width: "100%" } }) : null,
|
91
91
|
l ? null : /* @__PURE__ */ t(
|
92
92
|
j,
|
93
93
|
{
|
package/lib/Util/constant.d.ts
CHANGED
@@ -26,7 +26,15 @@ export declare const LOGIN_PROVIDER: {
|
|
26
26
|
TWITTER: string;
|
27
27
|
};
|
28
28
|
export declare const LOGIN_PROVIDER_NAME: {
|
29
|
-
[
|
29
|
+
[LOGIN_PROVIDER.EMAIL]: string;
|
30
|
+
[LOGIN_PROVIDER.AUTH0]: string;
|
31
|
+
[LOGIN_PROVIDER.APPLE]: string;
|
32
|
+
[LOGIN_PROVIDER.GITHUB]: string;
|
33
|
+
[LOGIN_PROVIDER.GOOGLE]: string;
|
34
|
+
[LOGIN_PROVIDER.WALLET]: string;
|
35
|
+
[LOGIN_PROVIDER.NFT]: string;
|
36
|
+
[LOGIN_PROVIDER.PASSKEY]: string;
|
37
|
+
[LOGIN_PROVIDER.TWITTER]: string;
|
30
38
|
};
|
31
39
|
export declare const OAUTH_PROVIDER: {
|
32
40
|
email: string;
|
package/lib/Util/index.js
CHANGED
@@ -25,8 +25,8 @@ function B(e) {
|
|
25
25
|
return !1;
|
26
26
|
const t = e.split(".");
|
27
27
|
if (t.length < 2) return !1;
|
28
|
-
const o = t[t.length - 2],
|
29
|
-
return z.has(o) && N.has(
|
28
|
+
const o = t[t.length - 2], r = t[t.length - 1];
|
29
|
+
return z.has(o) && N.has(r);
|
30
30
|
}
|
31
31
|
function ye() {
|
32
32
|
const { host: e } = window.location;
|
@@ -36,16 +36,16 @@ function ye() {
|
|
36
36
|
if (o.length === 1)
|
37
37
|
return "";
|
38
38
|
if (o.length > 2) {
|
39
|
-
const
|
40
|
-
if (B(
|
39
|
+
const r = o.slice(-2).join(".");
|
40
|
+
if (B(r))
|
41
41
|
return `.${o.slice(-3).join(".")}`;
|
42
42
|
}
|
43
43
|
return `.${o.slice(-2).join(".")}`;
|
44
44
|
}
|
45
45
|
function Ie(e) {
|
46
46
|
return e.replace(/^\?/, "").split("&").map((t) => t.split("=")).filter(([t]) => !!t).reduce((t, o) => {
|
47
|
-
const
|
48
|
-
return t[
|
47
|
+
const r = o[0], i = decodeURIComponent(o[1]) || !0;
|
48
|
+
return t[r] = i, t;
|
49
49
|
}, {});
|
50
50
|
}
|
51
51
|
function be(e = {}) {
|
@@ -64,20 +64,20 @@ function De(e = 1) {
|
|
64
64
|
};
|
65
65
|
return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete o.domain, o;
|
66
66
|
}
|
67
|
-
const Se = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary,
|
68
|
-
function
|
69
|
-
const
|
70
|
-
return Object.keys(i).forEach((
|
71
|
-
typeof n
|
72
|
-
}), Array.isArray(o) && o.forEach((
|
73
|
-
if (typeof n
|
67
|
+
const Se = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, Ve = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
|
68
|
+
function ke(e, t, o = []) {
|
69
|
+
const r = Object.assign({}, e), i = t.defaultProps || {};
|
70
|
+
return Object.keys(i).forEach((n) => {
|
71
|
+
typeof r[n] == "string" && r[n].indexOf("::prop::") === 0 && (r[n] = i[n]);
|
72
|
+
}), Array.isArray(o) && o.forEach((n) => {
|
73
|
+
if (typeof r[n] == "string")
|
74
74
|
try {
|
75
|
-
n
|
75
|
+
r[n] = JSON.parse(r[n]);
|
76
76
|
} catch {
|
77
77
|
}
|
78
|
-
}), Object.keys(
|
79
|
-
typeof n
|
80
|
-
}),
|
78
|
+
}), Object.keys(r).forEach((n) => {
|
79
|
+
typeof r[n] == "string" && r[n].indexOf("::prop::") === 0 && (r[n] = "");
|
80
|
+
}), r;
|
81
81
|
}
|
82
82
|
function $e(e = 2017) {
|
83
83
|
const t = (/* @__PURE__ */ new Date()).getFullYear();
|
@@ -85,17 +85,17 @@ function $e(e = 2017) {
|
|
85
85
|
}
|
86
86
|
const Te = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", je = (e) => {
|
87
87
|
let t = 0;
|
88
|
-
for (let
|
89
|
-
t = e.charCodeAt(
|
88
|
+
for (let r = 0; r < e.length; r++)
|
89
|
+
t = e.charCodeAt(r) + ((t << 5) - t);
|
90
90
|
let o = "#";
|
91
|
-
for (let
|
92
|
-
const i = t >>
|
91
|
+
for (let r = 0; r < 3; r++) {
|
92
|
+
const i = t >> r * 8 & 255;
|
93
93
|
o += `00${i.toString(16)}`.substr(-2);
|
94
94
|
}
|
95
95
|
return o;
|
96
96
|
}, xe = (e) => {
|
97
|
-
const t = Math.round(e / 1e3), o = Math.floor(t / 3600),
|
98
|
-
return `${l(o, 2, "0")}:${l(
|
97
|
+
const t = Math.round(e / 1e3), o = Math.floor(t / 3600), r = Math.floor((t - o * 3600) / 60), i = t % 60;
|
98
|
+
return `${l(o, 2, "0")}:${l(r, 2, "0")}:${l(i, 2, "0")}`;
|
99
99
|
};
|
100
100
|
function X(e) {
|
101
101
|
u = e;
|
@@ -103,7 +103,7 @@ function X(e) {
|
|
103
103
|
function Ee() {
|
104
104
|
return u;
|
105
105
|
}
|
106
|
-
const D = (e) => (t, { locale: o, tz:
|
106
|
+
const D = (e) => (t, { locale: o, tz: r, isUtc: i } = {}) => {
|
107
107
|
if (u === null && (a.extend(R), a.extend(U), a.extend(F), a.extend(P), a.extend(A), a.updateLocale("zh-cn", {
|
108
108
|
// copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
|
109
109
|
relativeTime: {
|
@@ -123,8 +123,8 @@ const D = (e) => (t, { locale: o, tz: n, isUtc: i } = {}) => {
|
|
123
123
|
}
|
124
124
|
}), X(a)), I(t) || t === "")
|
125
125
|
return "-";
|
126
|
-
let
|
127
|
-
return
|
126
|
+
let n = u(t);
|
127
|
+
return r && (n = n.tz(r)), i && (n = n.utc()), typeof o < "u" && (n = n.locale(o)), n.format(e);
|
128
128
|
};
|
129
129
|
function ve(e, { locale: t = "en", tz: o } = {}) {
|
130
130
|
return D("ll")(e, { locale: t, tz: o });
|
@@ -132,10 +132,10 @@ function ve(e, { locale: t = "en", tz: o } = {}) {
|
|
132
132
|
function Oe(e, {
|
133
133
|
locale: t = "en",
|
134
134
|
tz: o,
|
135
|
-
isUtc:
|
135
|
+
isUtc: r = !1,
|
136
136
|
format: i = "lll"
|
137
137
|
} = {}) {
|
138
|
-
return D(i)(e, { locale: t, tz: o, isUtc:
|
138
|
+
return D(i)(e, { locale: t, tz: o, isUtc: r });
|
139
139
|
}
|
140
140
|
function K() {
|
141
141
|
const e = window?.ABT_DEV || window.ABT;
|
@@ -145,9 +145,9 @@ function Ue({
|
|
145
145
|
webWalletUrl: e,
|
146
146
|
action: t = "login",
|
147
147
|
locale: o = "en",
|
148
|
-
url:
|
148
|
+
url: r,
|
149
149
|
windowFeatures: i,
|
150
|
-
appInfo:
|
150
|
+
appInfo: n,
|
151
151
|
memberAppInfo: f
|
152
152
|
}) {
|
153
153
|
const h = K();
|
@@ -155,9 +155,9 @@ function Ue({
|
|
155
155
|
return h.open({
|
156
156
|
action: t,
|
157
157
|
locale: o,
|
158
|
-
url: encodeURIComponent(
|
158
|
+
url: encodeURIComponent(r),
|
159
159
|
appInfo: {
|
160
|
-
...
|
160
|
+
...n
|
161
161
|
},
|
162
162
|
memberAppInfo: {
|
163
163
|
...f
|
@@ -173,9 +173,9 @@ function Ue({
|
|
173
173
|
// iphone 8plus size
|
174
174
|
width: 414,
|
175
175
|
height: 736
|
176
|
-
},
|
176
|
+
}, V = `${e}?action=${t}&locale=${o}&url=${encodeURIComponent(r)}`, c = Object.assign({}, S, i), k = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
|
177
177
|
if (!("left" in c)) {
|
178
|
-
const s =
|
178
|
+
const s = k(window.top || window), T = window.screenLeft || window.screenX;
|
179
179
|
c.left = s + T - c.width;
|
180
180
|
}
|
181
181
|
if (!("top" in c)) {
|
@@ -183,7 +183,7 @@ function Ue({
|
|
183
183
|
c.top = s;
|
184
184
|
}
|
185
185
|
const $ = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
|
186
|
-
return window.open(
|
186
|
+
return window.open(V, "targetWindow", $), { type: "web" };
|
187
187
|
}
|
188
188
|
const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) => {
|
189
189
|
const t = e.replace(L, "");
|
@@ -193,8 +193,8 @@ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
|
|
193
193
|
return e;
|
194
194
|
try {
|
195
195
|
const o = new URL(e, window.location.origin);
|
196
|
-
return Object.keys(t).forEach((
|
197
|
-
o.searchParams.set(
|
196
|
+
return Object.keys(t).forEach((r) => {
|
197
|
+
o.searchParams.set(r, String(t[r]));
|
198
198
|
}), o.origin === window.location.origin ? o.pathname + o.search : o.href;
|
199
199
|
} catch {
|
200
200
|
return e;
|
@@ -228,9 +228,9 @@ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
|
|
228
228
|
if (window.crypto && typeof window.crypto.getRandomValues == "function")
|
229
229
|
window.crypto.getRandomValues(t);
|
230
230
|
else
|
231
|
-
for (let
|
232
|
-
t[
|
233
|
-
const o = Array.from(t).map((
|
231
|
+
for (let r = 0; r < 16; r++)
|
232
|
+
t[r] = Math.floor(Math.random() * 256);
|
233
|
+
const o = Array.from(t).map((r) => r.toString(16).padStart(2, "0"));
|
234
234
|
e = [
|
235
235
|
o.slice(0, 4).join(""),
|
236
236
|
o.slice(4, 6).join(""),
|
@@ -248,7 +248,7 @@ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
|
|
248
248
|
if (J(e)) {
|
249
249
|
const t = Uint8Array.from(
|
250
250
|
e.slice(2).match(/.{1,2}/g).map((o) => parseInt(o, 16))
|
251
|
-
).slice(0, 8).reduce((o,
|
251
|
+
).slice(0, 8).reduce((o, r) => o + r, 0) % w.length;
|
252
252
|
return w[t];
|
253
253
|
}
|
254
254
|
try {
|
@@ -257,11 +257,11 @@ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
|
|
257
257
|
return null;
|
258
258
|
}
|
259
259
|
}, Ce = (e, t, o = {}) => {
|
260
|
-
const { fallbackLocale:
|
260
|
+
const { fallbackLocale: r = "en", defaultValue: i = "unknown" } = o;
|
261
261
|
if (typeof e == "string")
|
262
262
|
return e;
|
263
|
-
let
|
264
|
-
return t && (
|
263
|
+
let n;
|
264
|
+
return t && (n = e[t]), (!n || typeof n != "string") && (n = e[r]), (!n || typeof n != "string") && (n = i), n;
|
265
265
|
}, Me = (e) => j(
|
266
266
|
() => v(
|
267
267
|
async () => {
|
@@ -276,23 +276,32 @@ const Fe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) =
|
|
276
276
|
)
|
277
277
|
), _e = (e) => E(e, I);
|
278
278
|
function ze(e, t = 1) {
|
279
|
-
const [o,
|
280
|
-
return `rgba(${o}, ${
|
279
|
+
const [o, r, i] = O.hex.rgb(e);
|
280
|
+
return `rgba(${o}, ${r}, ${i}, ${t})`;
|
281
281
|
}
|
282
|
-
const G = () => window.blocklet?.serverVersion || "", H = () => b.version, Z = () => (b.dependencies?.["@blocklet/js-sdk"]).replace(/^[\^~>=<]+/, ""), d = (e, t) => {
|
283
|
-
const o = (
|
284
|
-
const f =
|
285
|
-
return f ? f[1] :
|
286
|
-
}
|
287
|
-
|
282
|
+
const G = () => window.blocklet?.serverVersion || window.env?.serverVersion || "", H = () => b.version, Z = () => (b.dependencies?.["@blocklet/js-sdk"]).replace(/^[\^~>=<]+/, ""), d = (e, t) => {
|
283
|
+
const o = (n) => {
|
284
|
+
const f = n.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
285
|
+
return f ? f[1] : n;
|
286
|
+
};
|
287
|
+
if (!e || !t)
|
288
|
+
return !1;
|
289
|
+
const r = o(e), i = o(t);
|
290
|
+
if (r === i && e !== t)
|
291
|
+
return !1;
|
292
|
+
try {
|
293
|
+
return W.gte(r, i);
|
294
|
+
} catch {
|
295
|
+
return !1;
|
296
|
+
}
|
288
297
|
}, Ne = () => {
|
289
298
|
if (process.env.NODE_ENV === "development")
|
290
299
|
return !0;
|
291
300
|
const e = G(), t = H(), o = Z();
|
292
301
|
if (!e || !t || !o)
|
293
302
|
return !1;
|
294
|
-
const
|
295
|
-
return
|
303
|
+
const r = d(t, "3.1.29"), i = d(e, "1.16.49-beta-20250822-070545-6d3344cc"), n = d(o, "1.16.49-beta-20250822-070545-6d3344cc");
|
304
|
+
return r && i && n;
|
296
305
|
};
|
297
306
|
export {
|
298
307
|
Q as appendParams,
|
@@ -304,7 +313,7 @@ export {
|
|
304
313
|
ve as formatToDate,
|
305
314
|
Oe as formatToDatetime,
|
306
315
|
xe as formatUptime,
|
307
|
-
|
316
|
+
Ve as getBackground,
|
308
317
|
Se as getColor,
|
309
318
|
De as getCookieOptions,
|
310
319
|
$e as getCopyright,
|
@@ -324,7 +333,7 @@ export {
|
|
324
333
|
B as isTwoSegmentTLD,
|
325
334
|
Re as isUrl,
|
326
335
|
Me as lazyRetry,
|
327
|
-
|
336
|
+
ke as mergeProps,
|
328
337
|
Ue as openWebWallet,
|
329
338
|
Ie as parseQuery,
|
330
339
|
ye as resolveRootDomain,
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.46",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -68,16 +68,16 @@
|
|
68
68
|
"react": "^19.0.0",
|
69
69
|
"react-router-dom": "^6.22.3"
|
70
70
|
},
|
71
|
-
"gitHead": "
|
71
|
+
"gitHead": "2ced986bdd3c032e7b804790d3b9eced2eda7802",
|
72
72
|
"dependencies": {
|
73
|
-
"@arcblock/bridge": "3.1.
|
74
|
-
"@arcblock/did": "^1.
|
73
|
+
"@arcblock/bridge": "3.1.46",
|
74
|
+
"@arcblock/did": "^1.25.6",
|
75
75
|
"@arcblock/did-motif": "^1.1.14",
|
76
|
-
"@arcblock/icons": "3.1.
|
77
|
-
"@arcblock/nft-display": "3.1.
|
78
|
-
"@arcblock/react-hooks": "3.1.
|
79
|
-
"@blocklet/js-sdk": "
|
80
|
-
"@blocklet/theme": "3.1.
|
76
|
+
"@arcblock/icons": "3.1.46",
|
77
|
+
"@arcblock/nft-display": "3.1.46",
|
78
|
+
"@arcblock/react-hooks": "3.1.46",
|
79
|
+
"@blocklet/js-sdk": "1.16.52-beta-20251005-235515-42ad5caf",
|
80
|
+
"@blocklet/theme": "3.1.46",
|
81
81
|
"@fontsource/roboto": "~5.1.1",
|
82
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
83
83
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -85,7 +85,7 @@
|
|
85
85
|
"@iconify-icons/mdi": "^1.2.48",
|
86
86
|
"@iconify-icons/tabler": "^1.2.95",
|
87
87
|
"@iconify/react": "^5.2.1",
|
88
|
-
"@ocap/mcrypto": "^1.
|
88
|
+
"@ocap/mcrypto": "^1.25.6",
|
89
89
|
"@solana/qr-code-styling": "^1.6.0",
|
90
90
|
"@types/dompurify": "^3.2.0",
|
91
91
|
"@types/mui-datatables": "^4.3.12",
|
@@ -93,7 +93,7 @@ function MinimalContent({ ...props }: MinimalContentProps) {
|
|
93
93
|
) : null}
|
94
94
|
</Box>
|
95
95
|
</Box>
|
96
|
-
{isSmallScreen &&
|
96
|
+
{isSmallScreen && !renderTopRightContent && rest.showSocialActions ? <Divider sx={{ width: '100%' }} /> : null}
|
97
97
|
{!renderTopRightContent ? (
|
98
98
|
<SocialActions
|
99
99
|
onFollowClick={rest.onFollowClick}
|
package/src/Util/index.ts
CHANGED
@@ -663,7 +663,7 @@ export function hexToRgba(hex: string, alpha = 1) {
|
|
663
663
|
|
664
664
|
// 获取 server 的版本号
|
665
665
|
export const getServerVersion = () => {
|
666
|
-
return window.blocklet?.serverVersion || '';
|
666
|
+
return window.blocklet?.serverVersion || window.env?.serverVersion || '';
|
667
667
|
};
|
668
668
|
|
669
669
|
// 获取 UX 包版本号
|
@@ -692,6 +692,10 @@ export const compareVersions = (version1: string, version2: string): boolean =>
|
|
692
692
|
const match = version.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
693
693
|
return match ? match[1] : version;
|
694
694
|
};
|
695
|
+
// 如果版本号为空,返回 false
|
696
|
+
if (!version1 || !version2) {
|
697
|
+
return false;
|
698
|
+
}
|
695
699
|
|
696
700
|
const dateVersion1 = getDateVersion(version1);
|
697
701
|
const dateVersion2 = getDateVersion(version2);
|
@@ -701,8 +705,12 @@ export const compareVersions = (version1: string, version2: string): boolean =>
|
|
701
705
|
return false;
|
702
706
|
}
|
703
707
|
|
704
|
-
|
705
|
-
|
708
|
+
try {
|
709
|
+
// 其他情况正常比较
|
710
|
+
return semver.gte(dateVersion1, dateVersion2);
|
711
|
+
} catch {
|
712
|
+
return false;
|
713
|
+
}
|
706
714
|
};
|
707
715
|
|
708
716
|
/**
|