@arcblock/ux 3.4.3 → 3.4.5
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/Util/index.d.ts +1 -0
- package/lib/Util/index.js +161 -159
- package/lib/package.json.js +1 -1
- package/package.json +7 -7
- package/src/Util/index.ts +10 -0
package/lib/Util/index.d.ts
CHANGED
|
@@ -123,3 +123,4 @@ export declare const compareVersions: (version1: string, version2: string) => bo
|
|
|
123
123
|
*/
|
|
124
124
|
export declare const isSupportFollow: () => boolean;
|
|
125
125
|
export declare const formatAxiosError: (err: AxiosError) => string;
|
|
126
|
+
export declare const mergeIgnoreEmpty: (...objects: Array<Record<string, any>>) => any;
|
package/lib/Util/index.js
CHANGED
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
import { lazy as
|
|
1
|
+
import { lazy as V } from "react";
|
|
2
2
|
import l from "lodash/padStart";
|
|
3
3
|
import { colors as w, getDIDMotifInfo as j } from "@arcblock/did-motif";
|
|
4
|
-
import { mergeAllThemeOptions as
|
|
4
|
+
import { mergeAllThemeOptions as qe } from "@blocklet/theme";
|
|
5
5
|
import I from "lodash/isNil";
|
|
6
6
|
import E from "lodash/omitBy";
|
|
7
|
-
import v from "
|
|
7
|
+
import v from "lodash/mergeWith";
|
|
8
|
+
import O from "p-retry";
|
|
8
9
|
import m from "js-cookie";
|
|
9
|
-
import
|
|
10
|
+
import U from "color-convert";
|
|
10
11
|
import a from "dayjs";
|
|
11
12
|
import "dayjs/locale/zh-cn";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import A from "dayjs/plugin/utc";
|
|
14
|
+
import F from "dayjs/plugin/timezone";
|
|
15
|
+
import R from "dayjs/plugin/relativeTime";
|
|
16
|
+
import W from "dayjs/plugin/updateLocale";
|
|
16
17
|
import P from "dayjs/plugin/localizedFormat";
|
|
17
|
-
import
|
|
18
|
-
import { DID_PREFIX as
|
|
18
|
+
import L from "semver";
|
|
19
|
+
import { DID_PREFIX as C, BLOCKLET_SERVICE_PATH_PREFIX as M } from "./constant.js";
|
|
19
20
|
import b from "../package.json.js";
|
|
20
|
-
import { getFederatedEnabled as
|
|
21
|
+
import { getFederatedEnabled as _ } from "./federated.js";
|
|
21
22
|
let u = null;
|
|
22
|
-
const
|
|
23
|
-
function
|
|
23
|
+
const N = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, z = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), B = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
|
|
24
|
+
function X(e) {
|
|
24
25
|
if (!e)
|
|
25
26
|
return !1;
|
|
26
27
|
const t = e.split(".");
|
|
27
28
|
if (t.length < 2) return !1;
|
|
28
|
-
const
|
|
29
|
-
return
|
|
29
|
+
const r = t[t.length - 2], o = t[t.length - 1];
|
|
30
|
+
return z.has(r) && B.has(o);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function be() {
|
|
32
33
|
const { host: e } = window.location;
|
|
33
|
-
if (!e ||
|
|
34
|
+
if (!e || N.test(e))
|
|
34
35
|
return "";
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
36
|
+
const r = e.split(":")[0].split(".");
|
|
37
|
+
if (r.length === 1)
|
|
37
38
|
return "";
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
return `.${
|
|
39
|
+
if (r.length > 2) {
|
|
40
|
+
const o = r.slice(-2).join(".");
|
|
41
|
+
if (X(o))
|
|
42
|
+
return `.${r.slice(-3).join(".")}`;
|
|
42
43
|
}
|
|
43
|
-
return `.${
|
|
44
|
+
return `.${r.slice(-2).join(".")}`;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
return e.replace(/^\?/, "").split("&").map((t) => t.split("=")).filter(([t]) => !!t).reduce((t,
|
|
47
|
-
const
|
|
48
|
-
return t[
|
|
46
|
+
function Se(e) {
|
|
47
|
+
return e.replace(/^\?/, "").split("&").map((t) => t.split("=")).filter(([t]) => !!t).reduce((t, r) => {
|
|
48
|
+
const o = r[0], i = decodeURIComponent(r[1]) || !0;
|
|
49
|
+
return t[o] = i, t;
|
|
49
50
|
}, {});
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function De(e = {}) {
|
|
52
53
|
return new URLSearchParams(e).toString();
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function $e(e = 1) {
|
|
55
56
|
let t = e;
|
|
56
57
|
typeof t == "number" && (t = { expireInDays: t }), t.path === void 0 && (t.path = "/"), t.expireInDays || (t.expireInDays = 1);
|
|
57
|
-
const
|
|
58
|
+
const r = {
|
|
58
59
|
expires: t.expireInDays,
|
|
59
60
|
path: t.path,
|
|
60
61
|
domain: t.domain || "",
|
|
@@ -62,49 +63,49 @@ function Se(e = 1) {
|
|
|
62
63
|
// 允许自定义设置为 false,默认是 true
|
|
63
64
|
secure: t.secure !== !1
|
|
64
65
|
};
|
|
65
|
-
return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete
|
|
66
|
+
return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete r.domain, r;
|
|
66
67
|
}
|
|
67
|
-
const
|
|
68
|
-
function
|
|
69
|
-
const
|
|
68
|
+
const ke = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, xe = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
|
|
69
|
+
function Te(e, t, r = []) {
|
|
70
|
+
const o = Object.assign({}, e), i = t.defaultProps || {};
|
|
70
71
|
return Object.keys(i).forEach((n) => {
|
|
71
|
-
typeof
|
|
72
|
-
}), Array.isArray(
|
|
73
|
-
if (typeof
|
|
72
|
+
typeof o[n] == "string" && o[n].indexOf("::prop::") === 0 && (o[n] = i[n]);
|
|
73
|
+
}), Array.isArray(r) && r.forEach((n) => {
|
|
74
|
+
if (typeof o[n] == "string")
|
|
74
75
|
try {
|
|
75
|
-
|
|
76
|
+
o[n] = JSON.parse(o[n]);
|
|
76
77
|
} catch {
|
|
77
78
|
}
|
|
78
|
-
}), Object.keys(
|
|
79
|
-
typeof
|
|
80
|
-
}),
|
|
79
|
+
}), Object.keys(o).forEach((n) => {
|
|
80
|
+
typeof o[n] == "string" && o[n].indexOf("::prop::") === 0 && (o[n] = "");
|
|
81
|
+
}), o;
|
|
81
82
|
}
|
|
82
83
|
function Ve(e = 2017) {
|
|
83
84
|
const t = (/* @__PURE__ */ new Date()).getFullYear();
|
|
84
85
|
return `${t}` == `${e}` ? `© ArcBlock ${t}` : `© ArcBlock ${e} - ${t}`;
|
|
85
86
|
}
|
|
86
|
-
const
|
|
87
|
+
const je = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", Ee = (e) => {
|
|
87
88
|
let t = 0;
|
|
88
|
-
for (let
|
|
89
|
-
t = e.charCodeAt(
|
|
90
|
-
let
|
|
91
|
-
for (let
|
|
92
|
-
const i = t >>
|
|
93
|
-
|
|
89
|
+
for (let o = 0; o < e.length; o++)
|
|
90
|
+
t = e.charCodeAt(o) + ((t << 5) - t);
|
|
91
|
+
let r = "#";
|
|
92
|
+
for (let o = 0; o < 3; o++) {
|
|
93
|
+
const i = t >> o * 8 & 255;
|
|
94
|
+
r += `00${i.toString(16)}`.substr(-2);
|
|
94
95
|
}
|
|
95
|
-
return
|
|
96
|
-
},
|
|
97
|
-
const t = Math.round(e / 1e3),
|
|
98
|
-
return `${l(
|
|
96
|
+
return r;
|
|
97
|
+
}, ve = (e) => {
|
|
98
|
+
const t = Math.round(e / 1e3), r = Math.floor(t / 3600), o = Math.floor((t - r * 3600) / 60), i = t % 60;
|
|
99
|
+
return `${l(r, 2, "0")}:${l(o, 2, "0")}:${l(i, 2, "0")}`;
|
|
99
100
|
};
|
|
100
|
-
function
|
|
101
|
+
function J(e) {
|
|
101
102
|
u = e;
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function Oe() {
|
|
104
105
|
return u;
|
|
105
106
|
}
|
|
106
|
-
const S = (e) => (t, { locale:
|
|
107
|
-
if (u === null && (a.extend(P), a.extend(
|
|
107
|
+
const S = (e) => (t, { locale: r, tz: o, isUtc: i } = {}) => {
|
|
108
|
+
if (u === null && (a.extend(P), a.extend(A), a.extend(F), a.extend(W), a.extend(R), a.updateLocale("zh-cn", {
|
|
108
109
|
// copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
|
|
109
110
|
relativeTime: {
|
|
110
111
|
future: "%s后",
|
|
@@ -121,41 +122,41 @@ const S = (e) => (t, { locale: o, tz: r, isUtc: i } = {}) => {
|
|
|
121
122
|
y: "1 年",
|
|
122
123
|
yy: "%d 年"
|
|
123
124
|
}
|
|
124
|
-
}),
|
|
125
|
+
}), J(a)), I(t) || t === "")
|
|
125
126
|
return "-";
|
|
126
127
|
let n = u(t);
|
|
127
|
-
return
|
|
128
|
+
return o && (n = n.tz(o)), i && (n = n.utc()), typeof r < "u" && (n = n.locale(r)), n.format(e);
|
|
128
129
|
};
|
|
129
|
-
function
|
|
130
|
-
return S("ll")(e, { locale: t, tz:
|
|
130
|
+
function Ue(e, { locale: t = "en", tz: r } = {}) {
|
|
131
|
+
return S("ll")(e, { locale: t, tz: r });
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function Ae(e, {
|
|
133
134
|
locale: t = "en",
|
|
134
|
-
tz:
|
|
135
|
-
isUtc:
|
|
135
|
+
tz: r,
|
|
136
|
+
isUtc: o = !1,
|
|
136
137
|
format: i = "lll"
|
|
137
138
|
} = {}) {
|
|
138
|
-
return S(i)(e, { locale: t, tz:
|
|
139
|
+
return S(i)(e, { locale: t, tz: r, isUtc: o });
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function K() {
|
|
141
142
|
const e = window?.ABT_DEV || window.ABT;
|
|
142
143
|
return e && typeof e.open == "function" ? e : null;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function Fe({
|
|
145
146
|
webWalletUrl: e,
|
|
146
147
|
action: t = "login",
|
|
147
|
-
locale:
|
|
148
|
-
url:
|
|
148
|
+
locale: r = "en",
|
|
149
|
+
url: o,
|
|
149
150
|
windowFeatures: i,
|
|
150
151
|
appInfo: n,
|
|
151
152
|
memberAppInfo: f
|
|
152
153
|
}) {
|
|
153
|
-
const h =
|
|
154
|
+
const h = K();
|
|
154
155
|
if (h)
|
|
155
156
|
return h.open({
|
|
156
157
|
action: t,
|
|
157
|
-
locale:
|
|
158
|
-
url: encodeURIComponent(
|
|
158
|
+
locale: r,
|
|
159
|
+
url: encodeURIComponent(o),
|
|
159
160
|
appInfo: {
|
|
160
161
|
...n
|
|
161
162
|
},
|
|
@@ -173,41 +174,41 @@ function Ue({
|
|
|
173
174
|
// iphone 8plus size
|
|
174
175
|
width: 414,
|
|
175
176
|
height: 736
|
|
176
|
-
}, $ = `${e}?action=${t}&locale=${
|
|
177
|
+
}, $ = `${e}?action=${t}&locale=${r}&url=${encodeURIComponent(o)}`, c = Object.assign({}, D, i), k = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
|
|
177
178
|
if (!("left" in c)) {
|
|
178
|
-
const s = k(window.top || window),
|
|
179
|
-
c.left = s +
|
|
179
|
+
const s = k(window.top || window), T = window.screenLeft || window.screenX;
|
|
180
|
+
c.left = s + T - c.width;
|
|
180
181
|
}
|
|
181
182
|
if (!("top" in c)) {
|
|
182
183
|
const s = window.screenTop || window.screenY;
|
|
183
184
|
c.top = s;
|
|
184
185
|
}
|
|
185
|
-
const
|
|
186
|
-
return window.open($, "targetWindow",
|
|
186
|
+
const x = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
|
|
187
|
+
return window.open($, "targetWindow", x), { type: "web" };
|
|
187
188
|
}
|
|
188
|
-
const
|
|
189
|
-
const t = e.replace(
|
|
189
|
+
const Re = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", Q = (e) => {
|
|
190
|
+
const t = e.replace(C, "");
|
|
190
191
|
return !!/^(0x)?[0-9a-f]{40}$/i.test(t);
|
|
191
|
-
},
|
|
192
|
+
}, Y = (e, t) => {
|
|
192
193
|
if (!t)
|
|
193
194
|
return e;
|
|
194
195
|
try {
|
|
195
|
-
const
|
|
196
|
-
return Object.keys(t).forEach((
|
|
197
|
-
|
|
198
|
-
}),
|
|
196
|
+
const r = new URL(e, window.location.origin);
|
|
197
|
+
return Object.keys(t).forEach((o) => {
|
|
198
|
+
r.searchParams.set(o, String(t[o]));
|
|
199
|
+
}), r.origin === window.location.origin ? r.pathname + r.search : r.href;
|
|
199
200
|
} catch {
|
|
200
201
|
return e;
|
|
201
202
|
}
|
|
202
|
-
},
|
|
203
|
+
}, We = (e, t = 48) => e && (e.indexOf(M) >= 0 ? Y(e, {
|
|
203
204
|
imageFilter: "resize",
|
|
204
205
|
w: t,
|
|
205
206
|
h: t
|
|
206
|
-
}) : e),
|
|
207
|
+
}) : e), Pe = (e = 0) => new Promise((t) => {
|
|
207
208
|
setTimeout(() => {
|
|
208
209
|
t();
|
|
209
210
|
}, e);
|
|
210
|
-
}),
|
|
211
|
+
}), Le = (e) => /^https?:\/\//.test(e), p = "vid", g = "__visitor_id", q = () => m.get(p) || localStorage.getItem(g), y = (e) => {
|
|
211
212
|
e === null ? m.remove(p, {
|
|
212
213
|
sameSite: "None",
|
|
213
214
|
secure: !0
|
|
@@ -216,10 +217,10 @@ const Ae = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", K = (e) =
|
|
|
216
217
|
secure: !0,
|
|
217
218
|
expires: 365
|
|
218
219
|
});
|
|
219
|
-
},
|
|
220
|
+
}, Ce = () => {
|
|
220
221
|
let e = localStorage.getItem(g);
|
|
221
|
-
if (e && (localStorage.removeItem(g), y(e)), !
|
|
222
|
-
if (!
|
|
222
|
+
if (e && (localStorage.removeItem(g), y(e)), !q()) {
|
|
223
|
+
if (!_())
|
|
223
224
|
try {
|
|
224
225
|
if (window.crypto && typeof window.crypto.randomUUID == "function")
|
|
225
226
|
e = window.crypto.randomUUID();
|
|
@@ -228,15 +229,15 @@ const Ae = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", K = (e) =
|
|
|
228
229
|
if (window.crypto && typeof window.crypto.getRandomValues == "function")
|
|
229
230
|
window.crypto.getRandomValues(t);
|
|
230
231
|
else
|
|
231
|
-
for (let
|
|
232
|
-
t[
|
|
233
|
-
const
|
|
232
|
+
for (let o = 0; o < 16; o++)
|
|
233
|
+
t[o] = Math.floor(Math.random() * 256);
|
|
234
|
+
const r = Array.from(t).map((o) => o.toString(16).padStart(2, "0"));
|
|
234
235
|
e = [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
r.slice(0, 4).join(""),
|
|
237
|
+
r.slice(4, 6).join(""),
|
|
238
|
+
r.slice(6, 8).join(""),
|
|
239
|
+
r.slice(8, 10).join(""),
|
|
240
|
+
r.slice(10, 16).join("")
|
|
240
241
|
].join("-");
|
|
241
242
|
}
|
|
242
243
|
} catch {
|
|
@@ -244,11 +245,11 @@ const Ae = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", K = (e) =
|
|
|
244
245
|
}
|
|
245
246
|
e && y(e);
|
|
246
247
|
}
|
|
247
|
-
},
|
|
248
|
-
if (
|
|
248
|
+
}, Me = (e) => {
|
|
249
|
+
if (Q(e)) {
|
|
249
250
|
const t = Uint8Array.from(
|
|
250
|
-
e.slice(2).match(/.{1,2}/g).map((
|
|
251
|
-
).slice(0, 8).reduce((
|
|
251
|
+
e.slice(2).match(/.{1,2}/g).map((r) => parseInt(r, 16))
|
|
252
|
+
).slice(0, 8).reduce((r, o) => r + o, 0) % w.length;
|
|
252
253
|
return w[t];
|
|
253
254
|
}
|
|
254
255
|
try {
|
|
@@ -256,14 +257,14 @@ const Ae = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", K = (e) =
|
|
|
256
257
|
} catch {
|
|
257
258
|
return null;
|
|
258
259
|
}
|
|
259
|
-
},
|
|
260
|
-
const { fallbackLocale:
|
|
260
|
+
}, _e = (e, t, r = {}) => {
|
|
261
|
+
const { fallbackLocale: o = "en", defaultValue: i = "unknown" } = r;
|
|
261
262
|
if (typeof e == "string")
|
|
262
263
|
return e;
|
|
263
264
|
let n;
|
|
264
|
-
return t && (n = e[t]), (!n || typeof n != "string") && (n = e[
|
|
265
|
-
},
|
|
266
|
-
() =>
|
|
265
|
+
return t && (n = e[t]), (!n || typeof n != "string") && (n = e[o]), (!n || typeof n != "string") && (n = i), n;
|
|
266
|
+
}, Ne = (e) => V(
|
|
267
|
+
() => O(
|
|
267
268
|
async () => {
|
|
268
269
|
try {
|
|
269
270
|
return await e();
|
|
@@ -274,76 +275,77 @@ const Ae = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", K = (e) =
|
|
|
274
275
|
// 只需要重试两次,加上原本的一次,总共三次
|
|
275
276
|
{ retries: 2 }
|
|
276
277
|
)
|
|
277
|
-
),
|
|
278
|
-
function
|
|
279
|
-
const [
|
|
280
|
-
return `rgba(${
|
|
278
|
+
), ze = (e) => E(e, I);
|
|
279
|
+
function Be(e, t = 1) {
|
|
280
|
+
const [r, o, i] = U.hex.rgb(e);
|
|
281
|
+
return `rgba(${r}, ${o}, ${i}, ${t})`;
|
|
281
282
|
}
|
|
282
|
-
const
|
|
283
|
-
const
|
|
283
|
+
const G = () => window.blocklet?.serverVersion || window.env?.serverVersion || "", H = () => b.version, Z = () => (b.dependencies?.["@blocklet/js-sdk"]).replace(/^[\^~>=<]+/, ""), d = (e, t) => {
|
|
284
|
+
const r = (n) => {
|
|
284
285
|
const f = n.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
|
285
286
|
return f ? f[1] : n;
|
|
286
287
|
};
|
|
287
288
|
if (!e || !t)
|
|
288
289
|
return !1;
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
290
|
+
const o = r(e), i = r(t);
|
|
291
|
+
if (o === i && e !== t)
|
|
291
292
|
return !1;
|
|
292
293
|
try {
|
|
293
|
-
return
|
|
294
|
+
return L.gte(o, i);
|
|
294
295
|
} catch {
|
|
295
296
|
return !1;
|
|
296
297
|
}
|
|
297
|
-
},
|
|
298
|
+
}, Xe = () => {
|
|
298
299
|
if (process.env.NODE_ENV === "development")
|
|
299
300
|
return !0;
|
|
300
|
-
const e =
|
|
301
|
-
if (!e || !t || !
|
|
301
|
+
const e = G(), t = H(), r = Z();
|
|
302
|
+
if (!e || !t || !r)
|
|
302
303
|
return !1;
|
|
303
|
-
const
|
|
304
|
-
return
|
|
305
|
-
},
|
|
304
|
+
const o = d(t, "3.1.29"), i = d(e, "1.16.49-beta-20250822-070545-6d3344cc"), n = d(r, "1.16.49-beta-20250822-070545-6d3344cc");
|
|
305
|
+
return o && i && n;
|
|
306
|
+
}, Je = (e) => {
|
|
306
307
|
const { response: t } = e;
|
|
307
308
|
return t ? `Request failed: ${t.status} ${t.statusText}: ${JSON.stringify(t.data)}` : e.message || "Unknown error occurred";
|
|
308
|
-
};
|
|
309
|
+
}, Ke = (...e) => v({}, ...e, (t, r) => r === "" || r === null || r === void 0 ? t : r);
|
|
309
310
|
export {
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
Y as appendParams,
|
|
312
|
+
ze as cleanedObj,
|
|
312
313
|
d as compareVersions,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
314
|
+
qe as deepmergeAll,
|
|
315
|
+
K as detectWalletExtension,
|
|
316
|
+
Ce as ensureVisitorId,
|
|
317
|
+
Je as formatAxiosError,
|
|
318
|
+
Ue as formatToDate,
|
|
319
|
+
Ae as formatToDatetime,
|
|
320
|
+
ve as formatUptime,
|
|
321
|
+
xe as getBackground,
|
|
322
|
+
ke as getColor,
|
|
323
|
+
$e as getCookieOptions,
|
|
323
324
|
Ve as getCopyright,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
325
|
+
Me as getDIDColor,
|
|
326
|
+
Oe as getDateTool,
|
|
327
|
+
Re as getFontSize,
|
|
328
|
+
Z as getJsSdkVersion,
|
|
329
|
+
G as getServerVersion,
|
|
330
|
+
je as getTimezone,
|
|
331
|
+
_e as getTranslation,
|
|
332
|
+
We as getUserAvatar,
|
|
333
|
+
H as getUxPackageVersion,
|
|
334
|
+
q as getVisitorId,
|
|
335
|
+
Be as hexToRgba,
|
|
336
|
+
Q as isEthereumDid,
|
|
337
|
+
Xe as isSupportFollow,
|
|
338
|
+
X as isTwoSegmentTLD,
|
|
339
|
+
Le as isUrl,
|
|
340
|
+
Ne as lazyRetry,
|
|
341
|
+
Ke as mergeIgnoreEmpty,
|
|
342
|
+
Te as mergeProps,
|
|
343
|
+
Fe as openWebWallet,
|
|
344
|
+
Se as parseQuery,
|
|
345
|
+
be as resolveRootDomain,
|
|
346
|
+
J as setDateTool,
|
|
345
347
|
y as setVisitorId,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
Pe as sleep,
|
|
349
|
+
Ee as str2color,
|
|
350
|
+
De as stringifyQuery
|
|
349
351
|
};
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
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": "a944f14b25e2fd8cd0e7e32b3c3ce276961e6b64",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@arcblock/bridge": "3.4.
|
|
73
|
+
"@arcblock/bridge": "3.4.5",
|
|
74
74
|
"@arcblock/did": "^1.28.2",
|
|
75
75
|
"@arcblock/did-motif": "^1.1.14",
|
|
76
|
-
"@arcblock/icons": "3.4.
|
|
77
|
-
"@arcblock/nft-display": "3.4.
|
|
78
|
-
"@arcblock/react-hooks": "3.4.
|
|
76
|
+
"@arcblock/icons": "3.4.5",
|
|
77
|
+
"@arcblock/nft-display": "3.4.5",
|
|
78
|
+
"@arcblock/react-hooks": "3.4.5",
|
|
79
79
|
"@blocklet/js-sdk": "^1.17.7",
|
|
80
|
-
"@blocklet/theme": "3.4.
|
|
80
|
+
"@blocklet/theme": "3.4.5",
|
|
81
81
|
"@fontsource/roboto": "~5.1.1",
|
|
82
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
|
83
83
|
"@iconify-icons/logos": "^1.2.36",
|
package/src/Util/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { getDIDMotifInfo, colors } from '@arcblock/did-motif';
|
|
|
5
5
|
import { mergeAllThemeOptions } from '@blocklet/theme';
|
|
6
6
|
import isNil from 'lodash/isNil';
|
|
7
7
|
import omitBy from 'lodash/omitBy';
|
|
8
|
+
import mergeWith from 'lodash/mergeWith';
|
|
8
9
|
import pRetry from 'p-retry';
|
|
9
10
|
import Cookies from 'js-cookie';
|
|
10
11
|
import colorConvert from 'color-convert';
|
|
@@ -748,3 +749,12 @@ export const formatAxiosError = (err: AxiosError) => {
|
|
|
748
749
|
|
|
749
750
|
return err.message || 'Unknown error occurred';
|
|
750
751
|
};
|
|
752
|
+
|
|
753
|
+
export const mergeIgnoreEmpty = (...objects: Array<Record<string, any>>) => {
|
|
754
|
+
return mergeWith({}, ...objects, (objValue: any, srcValue: any) => {
|
|
755
|
+
if (srcValue === '' || srcValue === null || srcValue === undefined) {
|
|
756
|
+
return objValue; // 保留前面的值
|
|
757
|
+
}
|
|
758
|
+
return srcValue; // 使用后面的值
|
|
759
|
+
});
|
|
760
|
+
};
|