@blocklet/ui-react 3.1.27 → 3.1.30
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/Footer/links.js +26 -33
- package/lib/UserCenter/components/fallback.d.ts +2 -1
- package/lib/UserCenter/components/fallback.js +17 -16
- package/lib/UserCenter/components/user-center.js +187 -173
- package/lib/UserCenter/components/user-info/social-actions/chat.js +12 -11
- package/lib/UserCenter/components/user-info/user-basic-info.d.ts +2 -1
- package/lib/UserCenter/components/user-info/user-basic-info.js +45 -44
- package/lib/blocklets.js +56 -54
- package/lib/common/notification-addon.js +8 -8
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +36 -43
- package/package.json +9 -10
- package/src/Footer/links.jsx +10 -7
- package/src/UserCenter/components/fallback.tsx +6 -0
- package/src/UserCenter/components/user-center.tsx +16 -6
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +2 -1
- package/src/UserCenter/components/user-info/user-basic-info.tsx +3 -1
- package/src/blocklets.js +5 -1
- package/src/common/notification-addon.jsx +1 -1
- package/src/utils.js +5 -26
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsxs as c, jsx as r, Fragment as
|
|
2
|
-
import { Box as l, Typography as S, Divider as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useMemoizedFn as
|
|
6
|
-
import { translate as
|
|
7
|
-
import { useLocaleContext as
|
|
8
|
-
import
|
|
1
|
+
import { jsxs as c, jsx as r, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { Box as l, Typography as S, Divider as N, IconButton as T, Collapse as F } from "@mui/material";
|
|
3
|
+
import K from "@arcblock/ux/lib/Avatar";
|
|
4
|
+
import W from "@arcblock/ux/lib/DID";
|
|
5
|
+
import { useMemoizedFn as O } from "ahooks";
|
|
6
|
+
import { translate as Q } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
8
|
+
import Y from "lodash/noop";
|
|
9
9
|
import { useState as U, useEffect as y } from "react";
|
|
10
10
|
import C from "@arcblock/ux/lib/Toast";
|
|
11
|
-
import { parseURL as
|
|
12
|
-
import { KeyboardArrowUp as
|
|
13
|
-
import { translations as
|
|
11
|
+
import { parseURL as $, joinURL as q } from "ufo";
|
|
12
|
+
import { KeyboardArrowUp as G, KeyboardArrowDown as H } from "@mui/icons-material";
|
|
13
|
+
import { translations as J } from "../../libs/locales.js";
|
|
14
14
|
import { formatAxiosError as z } from "../../libs/utils.js";
|
|
15
|
-
import { currentTimezone as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
15
|
+
import { currentTimezone as X, getStatusDuration as Z, isValidUrl as _ } from "./utils.js";
|
|
16
|
+
import P from "./switch-role.js";
|
|
17
|
+
import M from "./metadata.js";
|
|
18
|
+
import tt from "./user-status.js";
|
|
19
|
+
import rt from "./user-info.js";
|
|
20
20
|
import { client as j } from "../../../libs/client.js";
|
|
21
|
-
import
|
|
22
|
-
function
|
|
21
|
+
import ot from "./social-actions/index.js";
|
|
22
|
+
function zt({
|
|
23
23
|
user: t,
|
|
24
24
|
isMyself: e = !0,
|
|
25
25
|
showFullDid: f = !0,
|
|
@@ -28,19 +28,20 @@ function Ct({
|
|
|
28
28
|
isMobile: a = !1,
|
|
29
29
|
onlyProfile: s = !1,
|
|
30
30
|
refreshProfile: u,
|
|
31
|
+
isShowSocialActions: A = !1,
|
|
31
32
|
...m
|
|
32
33
|
}) {
|
|
33
|
-
const { locale: x } =
|
|
34
|
+
const { locale: x } = V(), [h, g] = U(void 0), w = O((n, o = {}) => Q(J, n, x, "en", o)), [d, v] = U(!a || s);
|
|
34
35
|
y(() => {
|
|
35
36
|
g(t?.metadata?.status);
|
|
36
37
|
}, [t]), y(() => {
|
|
37
38
|
v(!a || s);
|
|
38
39
|
}, [a, s]);
|
|
39
|
-
const
|
|
40
|
+
const b = async (n) => {
|
|
40
41
|
if (e)
|
|
41
42
|
try {
|
|
42
43
|
if (n) {
|
|
43
|
-
const o =
|
|
44
|
+
const o = Z(n);
|
|
44
45
|
n.dateRange = o.length > 0 ? o : h?.dateRange ?? [];
|
|
45
46
|
}
|
|
46
47
|
g(n), await j.user.saveProfile({
|
|
@@ -53,25 +54,25 @@ function Ct({
|
|
|
53
54
|
} catch (o) {
|
|
54
55
|
console.error(o), C.error(z(o));
|
|
55
56
|
}
|
|
56
|
-
},
|
|
57
|
+
}, D = () => {
|
|
57
58
|
v(!d);
|
|
58
59
|
};
|
|
59
60
|
if (!t)
|
|
60
61
|
return null;
|
|
61
|
-
const
|
|
62
|
+
const L = async (n) => {
|
|
62
63
|
if (!e)
|
|
63
64
|
return;
|
|
64
|
-
const { metadata: o, address:
|
|
65
|
+
const { metadata: o, address: k } = n;
|
|
65
66
|
try {
|
|
66
67
|
const p = o?.links?.map((i) => {
|
|
67
|
-
if (!i.url || !
|
|
68
|
+
if (!i.url || !_(i.url)) return null;
|
|
68
69
|
try {
|
|
69
|
-
return
|
|
70
|
+
return $(i.url).protocol || (i.url = q("https://", i.url)), i;
|
|
70
71
|
} catch {
|
|
71
72
|
return console.error("Invalid URL:", i.url), null;
|
|
72
73
|
}
|
|
73
74
|
}).filter((i) => !!i) || [];
|
|
74
|
-
o.links = p, await j.user.saveProfile({ metadata: o, address:
|
|
75
|
+
o.links = p, await j.user.saveProfile({ metadata: o, address: k }), u();
|
|
75
76
|
} catch (p) {
|
|
76
77
|
console.error(p), C.error(z(p));
|
|
77
78
|
}
|
|
@@ -107,7 +108,7 @@ function Ct({
|
|
|
107
108
|
},
|
|
108
109
|
children: [
|
|
109
110
|
/* @__PURE__ */ r(
|
|
110
|
-
|
|
111
|
+
K,
|
|
111
112
|
{
|
|
112
113
|
src: t?.avatar,
|
|
113
114
|
did: t?.did,
|
|
@@ -138,18 +139,18 @@ function Ct({
|
|
|
138
139
|
}
|
|
139
140
|
} : {}
|
|
140
141
|
},
|
|
141
|
-
onClick: e ? R :
|
|
142
|
+
onClick: e ? R : Y
|
|
142
143
|
}
|
|
143
144
|
),
|
|
144
145
|
/* @__PURE__ */ r(
|
|
145
|
-
|
|
146
|
+
tt,
|
|
146
147
|
{
|
|
147
148
|
isMobile: a,
|
|
148
149
|
size: m.size || (a ? 64 : 100),
|
|
149
150
|
isMyself: e,
|
|
150
|
-
timezone: t?.metadata?.timezone ||
|
|
151
|
+
timezone: t?.metadata?.timezone || X,
|
|
151
152
|
status: h,
|
|
152
|
-
onChange:
|
|
153
|
+
onChange: b
|
|
153
154
|
}
|
|
154
155
|
)
|
|
155
156
|
]
|
|
@@ -189,21 +190,21 @@ function Ct({
|
|
|
189
190
|
children: t?.fullName
|
|
190
191
|
}
|
|
191
192
|
),
|
|
192
|
-
e ? /* @__PURE__ */ r(
|
|
193
|
+
e ? /* @__PURE__ */ r(P, { user: t, switchPassport: I }) : null
|
|
193
194
|
]
|
|
194
195
|
}
|
|
195
196
|
),
|
|
196
|
-
/* @__PURE__ */ r(
|
|
197
|
+
/* @__PURE__ */ r(W, { did: t.did, showQrcode: !0, copyable: !0, compact: !f, responsive: !f, locale: x })
|
|
197
198
|
]
|
|
198
199
|
}
|
|
199
200
|
)
|
|
200
201
|
]
|
|
201
202
|
}
|
|
202
203
|
),
|
|
203
|
-
e
|
|
204
|
-
/* @__PURE__ */ r(
|
|
205
|
-
e ? /* @__PURE__ */ c(
|
|
206
|
-
/* @__PURE__ */ r(
|
|
204
|
+
!e && A ? /* @__PURE__ */ r(l, { sx: { mt: 2 }, children: /* @__PURE__ */ r(ot, { user: t }) }) : null,
|
|
205
|
+
/* @__PURE__ */ r(M, { isMobile: a, isMyself: e, user: t, onSave: L }),
|
|
206
|
+
e ? /* @__PURE__ */ c(B, { children: [
|
|
207
|
+
/* @__PURE__ */ r(N, { sx: { my: a ? 1 : 3 } }),
|
|
207
208
|
a && !s ? /* @__PURE__ */ r(
|
|
208
209
|
l,
|
|
209
210
|
{
|
|
@@ -213,10 +214,10 @@ function Ct({
|
|
|
213
214
|
mb: 0
|
|
214
215
|
},
|
|
215
216
|
children: /* @__PURE__ */ r(
|
|
216
|
-
|
|
217
|
+
T,
|
|
217
218
|
{
|
|
218
219
|
size: "small",
|
|
219
|
-
onClick:
|
|
220
|
+
onClick: D,
|
|
220
221
|
sx: {
|
|
221
222
|
backgroundColor: "grey.50",
|
|
222
223
|
"&:hover": {
|
|
@@ -224,12 +225,12 @@ function Ct({
|
|
|
224
225
|
opacity: 0.8
|
|
225
226
|
}
|
|
226
227
|
},
|
|
227
|
-
children: d ? /* @__PURE__ */ r(
|
|
228
|
+
children: d ? /* @__PURE__ */ r(G, {}) : /* @__PURE__ */ r(H, {})
|
|
228
229
|
}
|
|
229
230
|
)
|
|
230
231
|
}
|
|
231
232
|
) : null,
|
|
232
|
-
/* @__PURE__ */ c(
|
|
233
|
+
/* @__PURE__ */ c(F, { in: d, timeout: "auto", children: [
|
|
233
234
|
/* @__PURE__ */ r(
|
|
234
235
|
S,
|
|
235
236
|
{
|
|
@@ -242,7 +243,7 @@ function Ct({
|
|
|
242
243
|
children: w("profile.justForYou")
|
|
243
244
|
}
|
|
244
245
|
),
|
|
245
|
-
/* @__PURE__ */ r(
|
|
246
|
+
/* @__PURE__ */ r(rt, { user: t, isMySelf: e })
|
|
246
247
|
] })
|
|
247
248
|
] }) : null
|
|
248
249
|
]
|
|
@@ -250,5 +251,5 @@ function Ct({
|
|
|
250
251
|
);
|
|
251
252
|
}
|
|
252
253
|
export {
|
|
253
|
-
|
|
254
|
+
zt as default
|
|
254
255
|
};
|
package/lib/blocklets.js
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { mapRecursive as s, filterRecursive as a, isUrl as f } from "./utils.js";
|
|
2
|
-
const
|
|
3
|
-
const r = { ...
|
|
4
|
-
return typeof
|
|
5
|
-
header:
|
|
6
|
-
footer:
|
|
7
|
-
default:
|
|
1
|
+
import { mapRecursive as s, filterRecursive as a, isUrl as f, isMailProtocol as i } from "./utils.js";
|
|
2
|
+
const p = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", c = (e) => {
|
|
3
|
+
const r = { ...e }, t = e?.background;
|
|
4
|
+
return typeof t == "string" ? r.background = { header: t, footer: t, default: t } : t && typeof t == "object" && (r.background = {
|
|
5
|
+
header: t.header || t.default,
|
|
6
|
+
footer: t.footer || t.default,
|
|
7
|
+
default: t.default
|
|
8
8
|
}), r;
|
|
9
|
-
},
|
|
10
|
-
if (typeof
|
|
11
|
-
if (f(
|
|
12
|
-
const
|
|
13
|
-
return
|
|
9
|
+
}, u = (e, r = "en") => {
|
|
10
|
+
if (typeof e == "string") {
|
|
11
|
+
if (f(e)) {
|
|
12
|
+
const o = new URL(e);
|
|
13
|
+
return o.searchParams.set("locale", r), o.href;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (i(e))
|
|
16
|
+
return e;
|
|
17
|
+
const t = new URL(e, window.location.origin);
|
|
18
|
+
return t.searchParams.set("locale", r), t.pathname + t.search;
|
|
17
19
|
}
|
|
18
|
-
return typeof
|
|
19
|
-
},
|
|
20
|
-
if (!
|
|
21
|
-
return
|
|
22
|
-
const
|
|
20
|
+
return typeof e == "object" ? e[r] || e?.en || e?.zh : e;
|
|
21
|
+
}, b = (e, r = "en") => {
|
|
22
|
+
if (!e?.length)
|
|
23
|
+
return e;
|
|
24
|
+
const t = (o, n) => o && typeof o == "object" ? o[n] || o?.en || o?.zh : o;
|
|
23
25
|
return s(
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
...
|
|
27
|
-
title:
|
|
28
|
-
description:
|
|
26
|
+
e,
|
|
27
|
+
(o) => ({
|
|
28
|
+
...o,
|
|
29
|
+
title: t(o.title, r),
|
|
30
|
+
description: t(o.description, r),
|
|
29
31
|
// 仅对叶结点进行处理
|
|
30
|
-
link:
|
|
31
|
-
_rawLink:
|
|
32
|
+
link: o.items?.length ? o.link : u(o.link, r),
|
|
33
|
+
_rawLink: o.link
|
|
32
34
|
}),
|
|
33
35
|
"items"
|
|
34
36
|
);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
+
}, l = (e) => s(
|
|
38
|
+
e,
|
|
37
39
|
(r) => r.role ? {
|
|
38
40
|
...r,
|
|
39
41
|
role: Array.isArray(r.role) ? r.role : [r.role]
|
|
40
42
|
} : r,
|
|
41
43
|
"items"
|
|
42
|
-
),
|
|
43
|
-
if (!
|
|
44
|
+
), d = (e) => {
|
|
45
|
+
if (!e?.length)
|
|
44
46
|
return null;
|
|
45
|
-
const r =
|
|
47
|
+
const r = l(e), t = {
|
|
46
48
|
header: [],
|
|
47
49
|
footer: [],
|
|
48
50
|
// 对应 footer social media
|
|
@@ -55,32 +57,32 @@ const g = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", i =
|
|
|
55
57
|
sessionManager: [],
|
|
56
58
|
userCenter: []
|
|
57
59
|
};
|
|
58
|
-
return r.forEach((
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}) : typeof
|
|
62
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
if (!
|
|
60
|
+
return r.forEach((o) => {
|
|
61
|
+
o.section ? Array.isArray(o.section) ? o.section.forEach((n) => {
|
|
62
|
+
t[n]?.push(o);
|
|
63
|
+
}) : typeof o.section == "string" && t[o.section]?.push(o) : t.header.push(o);
|
|
64
|
+
}), t;
|
|
65
|
+
}, y = (e) => {
|
|
66
|
+
if (!e)
|
|
65
67
|
return null;
|
|
66
|
-
const r = { ...
|
|
67
|
-
return r.theme =
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
(
|
|
71
|
-
const n = !
|
|
72
|
-
return
|
|
68
|
+
const r = { ...e };
|
|
69
|
+
return r.theme = c(r.theme), r.navigation = d(h(r.navigation)), r;
|
|
70
|
+
}, h = (e = []) => a(e, (r, t) => !!r.link || t.filteredChildren?.length, "items"), w = (e, r) => a(
|
|
71
|
+
e,
|
|
72
|
+
(t, o) => {
|
|
73
|
+
const n = !t.role || r && (t.role.includes(r) || t.role.includes("guest"));
|
|
74
|
+
return o.isLeaf ? n : n && o.filteredChildren?.length;
|
|
73
75
|
},
|
|
74
76
|
"items"
|
|
75
77
|
);
|
|
76
78
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
w as filterNavByRole,
|
|
80
|
+
h as filterValidNavItems,
|
|
81
|
+
y as formatBlockletInfo,
|
|
82
|
+
l as formatNavigation,
|
|
83
|
+
c as formatTheme,
|
|
84
|
+
u as getLink,
|
|
85
|
+
b as getLocalizedNavigation,
|
|
86
|
+
d as parseNavigation,
|
|
87
|
+
p as publicPath
|
|
86
88
|
};
|
|
@@ -7,17 +7,17 @@ import S from "@arcblock/icons/lib/Notification";
|
|
|
7
7
|
import { useCreation as s } from "ahooks";
|
|
8
8
|
import { WELLKNOWN_SERVICE_PATH_PREFIX as V, EVENTS as y } from "@abtnode/constant";
|
|
9
9
|
import x from "@arcblock/react-hooks/lib/useBrowser";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import F from "
|
|
13
|
-
import
|
|
14
|
-
const b =
|
|
10
|
+
import { compareVersions as U } from "@arcblock/ux/lib/Util";
|
|
11
|
+
import { joinURL as j, withQuery as I } from "ufo";
|
|
12
|
+
import { useListenWsClient as F } from "./ws.js";
|
|
13
|
+
import H from "../Notifications/Snackbar.js";
|
|
14
|
+
const b = j(V, "user", "notifications"), K = (r) => I(b, {
|
|
15
15
|
id: r.id,
|
|
16
16
|
severity: r.severity || "all",
|
|
17
17
|
componentDid: r.source === "system" ? "system" : r.componentDid || "all"
|
|
18
18
|
});
|
|
19
19
|
function P({ session: r = {} }) {
|
|
20
|
-
const { unReadCount: c, user: w, setUnReadCount: n } = r, e = s(() => w?.did, [w]), { enqueueSnackbar: E } = D(), l = x(), k = _(() => l.arcSphere || l.wallet, [l]), N = s(() => window.blocklet?.serverVersion, []), t =
|
|
20
|
+
const { unReadCount: c, user: w, setUnReadCount: n } = r, e = s(() => w?.did, [w]), { enqueueSnackbar: E } = D(), l = x(), k = _(() => l.arcSphere || l.wallet, [l]), N = s(() => window.blocklet?.serverVersion, []), t = F("user"), d = s(
|
|
21
21
|
() => `${window.blocklet.did}/${e}/${y.NOTIFICATION_BLOCKLET_CREATE}`,
|
|
22
22
|
[e]
|
|
23
23
|
), u = s(
|
|
@@ -28,14 +28,14 @@ function P({ session: r = {} }) {
|
|
|
28
28
|
const { receivers: f } = o ?? {}, { receiver: p } = f[0] ?? {};
|
|
29
29
|
if (p === e) {
|
|
30
30
|
n((v) => v + 1);
|
|
31
|
-
const C =
|
|
31
|
+
const C = U(N, "1.16.42-beta-20250407");
|
|
32
32
|
if (!k && o.source === "component" && C) {
|
|
33
33
|
const v = K(o), { severity: T, description: L } = o || {}, A = ["error", "warning"].includes(T) || o.sticky;
|
|
34
34
|
E(L, {
|
|
35
35
|
variant: T,
|
|
36
36
|
autoHideDuration: A ? null : 5e3,
|
|
37
37
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
38
|
-
content: (R) => /* @__PURE__ */ i(
|
|
38
|
+
content: (R) => /* @__PURE__ */ i(H, { viewAllUrl: v, keyId: R, notification: o })
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export function flatRecursive(array: any, childrenKey?: string): any[];
|
|
|
3
3
|
export function countRecursive(array: any, childrenKey?: string): number;
|
|
4
4
|
export function filterRecursive(array: any, predicate: any, childrenKey?: string): any;
|
|
5
5
|
export function isUrl(str: any): boolean;
|
|
6
|
+
export function isMailProtocol(str: any): boolean;
|
|
6
7
|
export function isIconifyString(str: any): boolean;
|
|
7
8
|
export function matchPath(path: any): any;
|
|
8
9
|
export function matchPaths(paths?: any[]): number;
|
|
9
10
|
export function splitNavColumns(items: any, options?: {}): never[][];
|
|
10
|
-
export function compareVersions(version1: any, version2: any): any;
|
package/lib/utils.js
CHANGED
|
@@ -1,61 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
const d = (n, r, e = "children") => n.map((t) => Array.isArray(t[e]) ? r({
|
|
1
|
+
const p = (n, r, e = "children") => n.map((t) => Array.isArray(t[e]) ? r({
|
|
3
2
|
...t,
|
|
4
|
-
[e]:
|
|
5
|
-
}) : r(t)),
|
|
3
|
+
[e]: p(t[e], r, e)
|
|
4
|
+
}) : r(t)), v = (n, r = "children") => {
|
|
6
5
|
const e = [];
|
|
7
|
-
return
|
|
8
|
-
},
|
|
6
|
+
return p(n, (t) => e.push(t), r), e;
|
|
7
|
+
}, A = (n, r = "children") => {
|
|
9
8
|
let e = 0;
|
|
10
|
-
return
|
|
11
|
-
},
|
|
9
|
+
return p(n, () => e++, r), e;
|
|
10
|
+
}, H = (n, r, e = "children") => n.map((t) => ({ ...t })).filter((t) => {
|
|
12
11
|
const s = t[e];
|
|
13
12
|
if (Array.isArray(s)) {
|
|
14
|
-
const
|
|
15
|
-
t[e] =
|
|
13
|
+
const a = H(s, r, e);
|
|
14
|
+
t[e] = a?.length ? a : void 0;
|
|
16
15
|
}
|
|
17
|
-
const
|
|
18
|
-
return r(t,
|
|
19
|
-
}),
|
|
16
|
+
const l = { filteredChildren: t[e], isLeaf: !s?.length };
|
|
17
|
+
return r(t, l);
|
|
18
|
+
}), C = (n) => /^https?:\/\//.test(n), P = (n) => /^mailto:/i.test(n.trim()), S = (n) => /^[\w-]+:[\w-]+$/.test(n), R = (n) => {
|
|
20
19
|
if (!n || !n?.startsWith("/"))
|
|
21
20
|
return !1;
|
|
22
21
|
const r = (s) => s.endsWith("/") ? s : `${s}/`, e = r(window.location.pathname), t = r(new URL(n, window.location.origin).pathname);
|
|
23
22
|
return e.startsWith(t);
|
|
24
|
-
},
|
|
25
|
-
const r = n.map((t, s) => ({ path: t, index: s })).filter((t) =>
|
|
23
|
+
}, x = (n = []) => {
|
|
24
|
+
const r = n.map((t, s) => ({ path: t, index: s })).filter((t) => R(t.path));
|
|
26
25
|
return r?.length ? r.slice(1).reduce((t, s) => t.path.length >= s.path.length ? t : s, r[0]).index : -1;
|
|
27
|
-
},
|
|
28
|
-
const { columns: e = 1, breakInside: t = !1, groupHeight: s = 48, itemHeight:
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
return n.forEach((
|
|
32
|
-
const g = s + (
|
|
33
|
-
t && f(s) && (
|
|
34
|
-
...
|
|
26
|
+
}, W = (n, r = {}) => {
|
|
27
|
+
const { columns: e = 1, breakInside: t = !1, groupHeight: s = 48, itemHeight: l = 24, childrenKey: a = "items" } = r, m = n.reduce((c, g) => c + s + (g[a]?.length || 0) * l, 0), h = Math.ceil(m / e), u = [[]];
|
|
28
|
+
let o = 0, i = 0;
|
|
29
|
+
const d = h * 0.2, f = (c) => i > h - d && o < e - 1 && i + c > h + d;
|
|
30
|
+
return n.forEach((c) => {
|
|
31
|
+
const g = s + (c[a]?.length || 0) * l;
|
|
32
|
+
t && f(s) && (o++, i = 0, u[o] = []), !t && i > 0 && f(g) && (o++, i = 0, u[o] = []), u[o].push({
|
|
33
|
+
...c,
|
|
35
34
|
group: !0
|
|
36
|
-
}),
|
|
37
|
-
t && f(
|
|
35
|
+
}), i += s, c[a] && c[a].forEach((w) => {
|
|
36
|
+
t && f(l) && (o++, i = 0, u[o] = []), u[o].push({
|
|
38
37
|
...w,
|
|
39
38
|
group: !1
|
|
40
|
-
}),
|
|
39
|
+
}), i += l;
|
|
41
40
|
});
|
|
42
|
-
}),
|
|
43
|
-
}, v = (n, r) => {
|
|
44
|
-
const e = (c) => {
|
|
45
|
-
const o = c.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
|
46
|
-
return o ? o[1] : c;
|
|
47
|
-
}, t = e(n), s = e(r);
|
|
48
|
-
return t === s && n !== r ? !1 : H.gte(t, s);
|
|
41
|
+
}), u;
|
|
49
42
|
};
|
|
50
43
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
P as
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
A as countRecursive,
|
|
45
|
+
H as filterRecursive,
|
|
46
|
+
v as flatRecursive,
|
|
47
|
+
S as isIconifyString,
|
|
48
|
+
P as isMailProtocol,
|
|
49
|
+
C as isUrl,
|
|
50
|
+
p as mapRecursive,
|
|
51
|
+
R as matchPath,
|
|
52
|
+
x as matchPaths,
|
|
53
|
+
W as splitNavColumns
|
|
61
54
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.30",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/constant": "^1.16.
|
|
37
|
-
"@abtnode/util": "^1.16.
|
|
38
|
-
"@arcblock/bridge": "3.1.
|
|
39
|
-
"@arcblock/icons": "3.1.
|
|
40
|
-
"@arcblock/react-hooks": "3.1.
|
|
36
|
+
"@abtnode/constant": "^1.16.49-beta-20250823-082650-626c1473",
|
|
37
|
+
"@abtnode/util": "^1.16.49-beta-20250823-082650-626c1473",
|
|
38
|
+
"@arcblock/bridge": "3.1.30",
|
|
39
|
+
"@arcblock/icons": "3.1.30",
|
|
40
|
+
"@arcblock/react-hooks": "3.1.30",
|
|
41
41
|
"@arcblock/ws": "^1.21.3",
|
|
42
|
-
"@blocklet/constant": "^1.16.
|
|
42
|
+
"@blocklet/constant": "^1.16.49-beta-20250823-082650-626c1473",
|
|
43
43
|
"@blocklet/did-space-react": "^1.1.16",
|
|
44
44
|
"@iconify-icons/logos": "^1.2.36",
|
|
45
45
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"react-error-boundary": "^3.1.4",
|
|
64
64
|
"react-helmet": "^6.1.0",
|
|
65
65
|
"react-placeholder": "^4.1.0",
|
|
66
|
-
"semver": "^7.7.2",
|
|
67
66
|
"type-fest": "^4.41.0",
|
|
68
67
|
"ua-parser-js": "^1.0.40",
|
|
69
68
|
"ufo": "^1.6.1",
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
"access": "public"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
|
-
"@arcblock/did-connect-react": "3.1.
|
|
86
|
+
"@arcblock/did-connect-react": "3.1.30",
|
|
88
87
|
"@types/dompurify": "^3.2.0",
|
|
89
88
|
"@types/ua-parser-js": "^0.7.39",
|
|
90
89
|
"@types/validator": "^13.15.2",
|
|
@@ -92,5 +91,5 @@
|
|
|
92
91
|
"jest": "^29.7.0",
|
|
93
92
|
"unbuild": "^2.0.0"
|
|
94
93
|
},
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "a51fede74e5eca679ff40a8c62d96bae09210f04"
|
|
96
95
|
}
|
package/src/Footer/links.jsx
CHANGED
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';
|
|
10
10
|
import Icon from '../Icon';
|
|
11
11
|
import useMobile from '../hooks/use-mobile';
|
|
12
|
-
import { splitNavColumns } from '../utils';
|
|
12
|
+
import { splitNavColumns, isMailProtocol } from '../utils';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* footer 中的 links (支持分组, 最多支持 2 级)
|
|
@@ -28,14 +28,17 @@ export default function Links({ links = [], flowLayout = false, columns, ...rest
|
|
|
28
28
|
result = render({ label, link, props });
|
|
29
29
|
} else if (link && isString(link)) {
|
|
30
30
|
const isExternal = link.startsWith('http') || link.startsWith('//');
|
|
31
|
+
const isMail = isMailProtocol(link);
|
|
32
|
+
|
|
33
|
+
const otherProps = isMail
|
|
34
|
+
? {}
|
|
35
|
+
: {
|
|
36
|
+
target: isExternal ? '_blank' : '_self',
|
|
37
|
+
rel: isExternal ? 'noreferrer noopener' : undefined,
|
|
38
|
+
};
|
|
31
39
|
|
|
32
40
|
result = (
|
|
33
|
-
<a
|
|
34
|
-
href={link}
|
|
35
|
-
aria-label={`Footer link for ${label}`}
|
|
36
|
-
target={isExternal ? '_blank' : '_self'}
|
|
37
|
-
rel={isExternal ? 'noreferrer noopener' : undefined}
|
|
38
|
-
{...props}>
|
|
41
|
+
<a href={link} aria-label={`Footer link for ${label}`} {...otherProps} {...props}>
|
|
39
42
|
{label}
|
|
40
43
|
</a>
|
|
41
44
|
);
|
|
@@ -15,10 +15,12 @@ import { useUserFollowersContext } from '../../contexts/user-followers';
|
|
|
15
15
|
function Fallback({
|
|
16
16
|
currentActiveTab,
|
|
17
17
|
isMyself,
|
|
18
|
+
isSupportFollow = false,
|
|
18
19
|
children,
|
|
19
20
|
}: {
|
|
20
21
|
currentActiveTab: UserCenterTab;
|
|
21
22
|
isMyself: boolean;
|
|
23
|
+
isSupportFollow?: boolean;
|
|
22
24
|
children: React.ReactNode;
|
|
23
25
|
}) {
|
|
24
26
|
const { locale } = useLocaleContext();
|
|
@@ -34,6 +36,10 @@ function Fallback({
|
|
|
34
36
|
|
|
35
37
|
const { protected: protection } = currentActiveTab;
|
|
36
38
|
|
|
39
|
+
// 如果还没有支持 follow 关系,但是已经设置了仅粉丝可见,则直接显示内容
|
|
40
|
+
if (!isSupportFollow && protection === 'follower-only') {
|
|
41
|
+
return children;
|
|
42
|
+
}
|
|
37
43
|
// 私密内容(仅自己可见)
|
|
38
44
|
if (protection === true || protection === 'private') {
|
|
39
45
|
return <Empty>{t('underProtected')}</Empty>;
|