@blocklet/list 0.16.25 → 0.16.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/lib/index.es.js +88 -73
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as t, jsxs as h, Fragment as M } from "react/jsx-runtime";
|
|
2
|
-
import { styled as X, useTheme as
|
|
2
|
+
import { styled as X, useTheme as xe } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import Je from "@mui/material/styles/createTheme";
|
|
4
4
|
import et from "@mui/material/styles/ThemeProvider";
|
|
5
5
|
import { pick as tt, omitBy as le, orderBy as rt, isEmpty as ot, merge as nt } from "lodash-es";
|
|
6
|
-
import { ErrorFallback as
|
|
7
|
-
import
|
|
6
|
+
import { ErrorFallback as ye } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
|
+
import y from "@mui/material/Box";
|
|
8
8
|
import F from "@mui/material/Stack";
|
|
9
9
|
import { ErrorBoundary as it } from "react-error-boundary";
|
|
10
10
|
import lt from "@iconify-icons/tabler/compass";
|
|
@@ -23,8 +23,8 @@ import $ from "@mui/material/useMediaQuery";
|
|
|
23
23
|
import gt from "@mui/material/Drawer";
|
|
24
24
|
import ze from "@mui/material/Checkbox";
|
|
25
25
|
import De from "@mui/material/FormControlLabel";
|
|
26
|
-
import
|
|
27
|
-
import
|
|
26
|
+
import xt from "@mui/icons-material/Check";
|
|
27
|
+
import yt from "@mui/icons-material/KeyboardArrowDown";
|
|
28
28
|
import wt from "@mui/material/ClickAwayListener";
|
|
29
29
|
import bt from "@mui/material/Grow";
|
|
30
30
|
import Ne from "@mui/material/MenuItem";
|
|
@@ -119,7 +119,7 @@ function jt(e, r) {
|
|
|
119
119
|
return {
|
|
120
120
|
filters: e,
|
|
121
121
|
cleanFilter: (i) => {
|
|
122
|
-
const u = i ? le(o, (d,
|
|
122
|
+
const u = i ? le(o, (d, x) => i.includes(x)) : {};
|
|
123
123
|
n(le(u, (d) => d === "" || d === void 0));
|
|
124
124
|
},
|
|
125
125
|
handleActiveMenu: (i) => {
|
|
@@ -165,13 +165,13 @@ const Ht = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
165
165
|
// value: 'rating',
|
|
166
166
|
// },
|
|
167
167
|
], Ve = (e, r, o) => {
|
|
168
|
-
var d,
|
|
168
|
+
var d, x;
|
|
169
169
|
const n = ut(e), l = ht(n.search);
|
|
170
170
|
if ((d = pt(e, { strict: !0 })) == null ? void 0 : d.endsWith(".gif"))
|
|
171
171
|
return l.imageFilter ? mt({ ...n, search: "" }) : e;
|
|
172
172
|
if (l.imageFilter)
|
|
173
173
|
return e;
|
|
174
|
-
const a = o || ((
|
|
174
|
+
const a = o || ((x = window.blocklet) == null ? void 0 : x.version), { w: i, h: u } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
175
175
|
return be(e, {
|
|
176
176
|
...i || u ? { imageFilter: "resize", w: i, h: u } : {},
|
|
177
177
|
v: a
|
|
@@ -360,7 +360,7 @@ function Zt(e) {
|
|
|
360
360
|
layout: i = {},
|
|
361
361
|
wrapChildren: u = (I) => I,
|
|
362
362
|
extraFilter: d = (I) => I,
|
|
363
|
-
baseSearch:
|
|
363
|
+
baseSearch: x = !1,
|
|
364
364
|
fetchCategoryDelay: m = 0,
|
|
365
365
|
showResourcesSwitch: f = !1,
|
|
366
366
|
showCategory: k = !0,
|
|
@@ -406,7 +406,7 @@ function Zt(e) {
|
|
|
406
406
|
categoryOptions: Y,
|
|
407
407
|
priceOptions: c,
|
|
408
408
|
storeApi: T,
|
|
409
|
-
baseSearch:
|
|
409
|
+
baseSearch: x,
|
|
410
410
|
showResourcesSwitch: f,
|
|
411
411
|
showCategory: k,
|
|
412
412
|
tagFilters: g,
|
|
@@ -470,11 +470,11 @@ function ve({
|
|
|
470
470
|
xl: l,
|
|
471
471
|
exact: s
|
|
472
472
|
}) {
|
|
473
|
-
const a = ft(), i = $(a.breakpoints.down("sm")), u = $(a.breakpoints.between("sm", "md")), d = $(a.breakpoints.between("md", "lg")),
|
|
473
|
+
const a = ft(), i = $(a.breakpoints.down("sm")), u = $(a.breakpoints.between("sm", "md")), d = $(a.breakpoints.between("md", "lg")), x = $(a.breakpoints.between("lg", "xl"));
|
|
474
474
|
if (s)
|
|
475
|
-
return i ? e || null : u ? r || null : d ? o || null :
|
|
475
|
+
return i ? e || null : u ? r || null : d ? o || null : x ? n || null : l || null;
|
|
476
476
|
let m = e;
|
|
477
|
-
return i || (m = Z(r, m), u) || (m = Z(o, m), d) || (m = Z(n, m),
|
|
477
|
+
return i || (m = Z(r, m), u) || (m = Z(o, m), d) || (m = Z(n, m), x) ? m : Z(l, m);
|
|
478
478
|
}
|
|
479
479
|
function Jt({ children: e }) {
|
|
480
480
|
const { open: r, toggleOpen: o } = ke();
|
|
@@ -482,7 +482,7 @@ function Jt({ children: e }) {
|
|
|
482
482
|
ve,
|
|
483
483
|
{
|
|
484
484
|
xs: /* @__PURE__ */ t(gt, { open: r, onClose: () => o(!1), children: e }),
|
|
485
|
-
md: /* @__PURE__ */ t(
|
|
485
|
+
md: /* @__PURE__ */ t(y, { children: e })
|
|
486
486
|
}
|
|
487
487
|
);
|
|
488
488
|
}
|
|
@@ -499,9 +499,9 @@ const er = at(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
|
499
499
|
));
|
|
500
500
|
function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
501
501
|
var S;
|
|
502
|
-
const s = fe(null), a =
|
|
502
|
+
const s = fe(null), a = xe(), [i, u] = E(!1), [d, x] = E(e !== null ? e : ""), m = $(a.breakpoints.down("sm"));
|
|
503
503
|
H(() => {
|
|
504
|
-
|
|
504
|
+
x(e !== null ? e : "");
|
|
505
505
|
}, [e]);
|
|
506
506
|
const f = me(() => {
|
|
507
507
|
u(!1);
|
|
@@ -509,7 +509,7 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
509
509
|
u(!0);
|
|
510
510
|
}, []);
|
|
511
511
|
function g(p) {
|
|
512
|
-
|
|
512
|
+
x(p.value), o(p.value), m && f();
|
|
513
513
|
}
|
|
514
514
|
function B(p) {
|
|
515
515
|
return p === d;
|
|
@@ -527,7 +527,7 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
527
527
|
...l,
|
|
528
528
|
children: [
|
|
529
529
|
((S = r.find((p) => p.value === d)) == null ? void 0 : S.name) || n,
|
|
530
|
-
/* @__PURE__ */ t(Ct, { className: "my-select__arrowdown", component:
|
|
530
|
+
/* @__PURE__ */ t(Ct, { className: "my-select__arrowdown", component: yt, sx: { width: 18, height: 18 } })
|
|
531
531
|
]
|
|
532
532
|
}
|
|
533
533
|
),
|
|
@@ -538,7 +538,7 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
538
538
|
style: { transformOrigin: v === "bottom" ? "center top" : "center bottom" },
|
|
539
539
|
children: /* @__PURE__ */ t(kt, { children: /* @__PURE__ */ t(wt, { onClickAway: f, children: /* @__PURE__ */ t(rr, { autoFocusItem: i, onMouseEnter: k, onMouseLeave: f, children: r.map((w) => /* @__PURE__ */ h(Ne, { onClick: () => g(w), sx: { fontSize: 14 }, children: [
|
|
540
540
|
/* @__PURE__ */ t(
|
|
541
|
-
|
|
541
|
+
xt,
|
|
542
542
|
{
|
|
543
543
|
sx: { mr: 1, fontSize: 16, visibility: B(w.value) ? "visible" : "hidden" }
|
|
544
544
|
}
|
|
@@ -634,7 +634,7 @@ function Ye() {
|
|
|
634
634
|
);
|
|
635
635
|
}
|
|
636
636
|
function or({ menus: e }) {
|
|
637
|
-
const { selectedCategory: r, search: o, t: n, categoryOptions: l, loadings: s, layout: a, baseSearch: i } = R(), { filters: u, handleActiveMenu: d, handleCategory:
|
|
637
|
+
const { selectedCategory: r, search: o, t: n, categoryOptions: l, loadings: s, layout: a, baseSearch: i } = R(), { filters: u, handleActiveMenu: d, handleCategory: x, cleanFilter: m } = o, { toggleOpen: f } = ke();
|
|
638
638
|
H(() => {
|
|
639
639
|
f(!1);
|
|
640
640
|
}, [Object.values(u).join("")]);
|
|
@@ -672,8 +672,8 @@ function or({ menus: e }) {
|
|
|
672
672
|
p: { xs: 2, md: 0 },
|
|
673
673
|
pr: { md: 6 },
|
|
674
674
|
children: k ? /* @__PURE__ */ h(M, { children: [
|
|
675
|
-
a.showExplore && /* @__PURE__ */ h(
|
|
676
|
-
/* @__PURE__ */ h(
|
|
675
|
+
a.showExplore && /* @__PURE__ */ h(y, { mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
676
|
+
/* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
677
677
|
/* @__PURE__ */ t(K, { icon: lt, width: 20, height: 20 }),
|
|
678
678
|
/* @__PURE__ */ t(
|
|
679
679
|
b,
|
|
@@ -689,7 +689,7 @@ function or({ menus: e }) {
|
|
|
689
689
|
}
|
|
690
690
|
)
|
|
691
691
|
] }),
|
|
692
|
-
e == null ? void 0 : e.map((g) => /* @__PURE__ */ h(
|
|
692
|
+
e == null ? void 0 : e.map((g) => /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", mt: 2, gap: 1, children: [
|
|
693
693
|
typeof g.icon == "string" ? /* @__PURE__ */ t(K, { icon: g.icon, width: 20, height: 20 }) : g.icon,
|
|
694
694
|
/* @__PURE__ */ t(
|
|
695
695
|
b,
|
|
@@ -717,7 +717,7 @@ function or({ menus: e }) {
|
|
|
717
717
|
color: r === g.value ? "text.primary" : "text.lighter",
|
|
718
718
|
textTransform: "capitalize",
|
|
719
719
|
onClick: () => {
|
|
720
|
-
r === g.value ? m() :
|
|
720
|
+
r === g.value ? m() : x(g.value), f(!1);
|
|
721
721
|
},
|
|
722
722
|
children: g.name
|
|
723
723
|
},
|
|
@@ -745,7 +745,7 @@ function Ce() {
|
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
747
|
const Ze = st(function(r) {
|
|
748
|
-
return /* @__PURE__ */ t(
|
|
748
|
+
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ne, {}) });
|
|
749
749
|
});
|
|
750
750
|
function Pe({
|
|
751
751
|
icon: e,
|
|
@@ -770,7 +770,7 @@ function Pe({
|
|
|
770
770
|
const nr = 16 / 9, ce = 292, ge = 189, te = 336;
|
|
771
771
|
function ir() {
|
|
772
772
|
var B, S;
|
|
773
|
-
const { t: e, search: r } = R(), { get: o } = Ce(), n =
|
|
773
|
+
const { t: e, search: r } = R(), { get: o } = Ce(), n = xe(), l = $(n.breakpoints.down("md")), s = ((S = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : S.homeBanner) || [], {
|
|
774
774
|
data: a = [],
|
|
775
775
|
error: i,
|
|
776
776
|
loading: u
|
|
@@ -792,7 +792,7 @@ function ir() {
|
|
|
792
792
|
return !i && s.length > 0 ? /* @__PURE__ */ h(M, { children: [
|
|
793
793
|
/* @__PURE__ */ t(b, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
794
794
|
/* @__PURE__ */ t(
|
|
795
|
-
|
|
795
|
+
y,
|
|
796
796
|
{
|
|
797
797
|
height: { xs: "auto", md: ce },
|
|
798
798
|
minHeight: ce,
|
|
@@ -801,13 +801,13 @@ function ir() {
|
|
|
801
801
|
borderColor: "divider",
|
|
802
802
|
borderRadius: 3,
|
|
803
803
|
overflow: "hidden",
|
|
804
|
-
children: u ? /* @__PURE__ */ h(
|
|
804
|
+
children: u ? /* @__PURE__ */ h(y, { p: 5, display: { md: "flex" }, gap: 5, alignItems: "center", justifyContent: "center", children: [
|
|
805
805
|
/* @__PURE__ */ t(O, { variant: "rounded", height: ge, width: te }),
|
|
806
|
-
/* @__PURE__ */ h(
|
|
806
|
+
/* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
|
|
807
807
|
/* @__PURE__ */ t(O, { variant: "text", height: 50, width: 100 }),
|
|
808
808
|
/* @__PURE__ */ t(O, { variant: "text", height: 40, width: "100%" }),
|
|
809
809
|
/* @__PURE__ */ t(O, { variant: "text", height: 40, width: 300 }),
|
|
810
|
-
/* @__PURE__ */ h(
|
|
810
|
+
/* @__PURE__ */ h(y, { display: "flex", gap: 1, my: 2, children: [
|
|
811
811
|
/* @__PURE__ */ t(O, { variant: "circular", height: 20, width: 20 }),
|
|
812
812
|
/* @__PURE__ */ t(O, { variant: "text", height: 20, width: 50 })
|
|
813
813
|
] }),
|
|
@@ -825,8 +825,8 @@ function ir() {
|
|
|
825
825
|
showBullets: !1,
|
|
826
826
|
showThumbnails: !1,
|
|
827
827
|
showFullscreenButton: !1,
|
|
828
|
-
renderLeftNav: (p) => /* @__PURE__ */ t(
|
|
829
|
-
renderRightNav: (p) => /* @__PURE__ */ t(
|
|
828
|
+
renderLeftNav: (p) => /* @__PURE__ */ t(y, { onClick: p, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(It, { sx: { ...d, left: 5 } }) }),
|
|
829
|
+
renderRightNav: (p) => /* @__PURE__ */ t(y, { onClick: p, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Bt, { sx: { ...d, right: 5 } }) }),
|
|
830
830
|
items: s.map((p, v) => ({
|
|
831
831
|
original: p.did,
|
|
832
832
|
renderItem: () => {
|
|
@@ -860,9 +860,9 @@ function ir() {
|
|
|
860
860
|
onClick: () => r.handleSearchSelect(w),
|
|
861
861
|
gap: { xs: 2, md: 5 },
|
|
862
862
|
children: [
|
|
863
|
-
|
|
863
|
+
x(T),
|
|
864
864
|
/* @__PURE__ */ h(F, { flex: 1, height: "100%", gap: 3, children: [
|
|
865
|
-
/* @__PURE__ */ h(
|
|
865
|
+
/* @__PURE__ */ h(y, { flex: 1, children: [
|
|
866
866
|
m(p.name || w.title || p.name),
|
|
867
867
|
f(p.desc || w.description)
|
|
868
868
|
] }),
|
|
@@ -879,8 +879,8 @@ function ir() {
|
|
|
879
879
|
}
|
|
880
880
|
)
|
|
881
881
|
] }) : null;
|
|
882
|
-
function
|
|
883
|
-
return /* @__PURE__ */ t(
|
|
882
|
+
function x(p) {
|
|
883
|
+
return /* @__PURE__ */ t(y, { borderRadius: 2, overflow: "hidden", position: "relative", width: { xs: "100%", md: te }, children: /* @__PURE__ */ t(sr, { url: p }) });
|
|
884
884
|
}
|
|
885
885
|
function m(p) {
|
|
886
886
|
return /* @__PURE__ */ t(b, { variant: "h2", width: "100%", children: p });
|
|
@@ -911,7 +911,7 @@ function ir() {
|
|
|
911
911
|
}
|
|
912
912
|
function k(p, v = 0) {
|
|
913
913
|
const { did: w, owner: A, stats: T } = p;
|
|
914
|
-
return /* @__PURE__ */ h(
|
|
914
|
+
return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
915
915
|
/* @__PURE__ */ t(Pe, { icon: /* @__PURE__ */ t($e, { src: A.avatar, did: w, size: 20, variant: "circle" }), children: A.fullName }),
|
|
916
916
|
/* @__PURE__ */ t(Pe, { icon: /* @__PURE__ */ t(K, { icon: St }), title: `${T.downloads + v}`, children: lr(T.downloads + v) })
|
|
917
917
|
] });
|
|
@@ -951,7 +951,7 @@ function sr({ url: e }) {
|
|
|
951
951
|
}
|
|
952
952
|
),
|
|
953
953
|
/* @__PURE__ */ t(
|
|
954
|
-
|
|
954
|
+
y,
|
|
955
955
|
{
|
|
956
956
|
display: r ? "none" : "block",
|
|
957
957
|
component: "img",
|
|
@@ -971,9 +971,9 @@ function sr({ url: e }) {
|
|
|
971
971
|
}
|
|
972
972
|
function cr({ title: e, blocklets: r }) {
|
|
973
973
|
const { blockletRender: o, serverVersion: n } = R();
|
|
974
|
-
return /* @__PURE__ */ h(
|
|
974
|
+
return /* @__PURE__ */ h(y, { mt: 3, children: [
|
|
975
975
|
/* @__PURE__ */ t(b, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
976
|
-
/* @__PURE__ */ t(Be, { container: !0, spacing: 2, children: r.map((l) => /* @__PURE__ */ t(Be, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": l.did, children: /* @__PURE__ */ t(
|
|
976
|
+
/* @__PURE__ */ t(Be, { container: !0, spacing: 2, boxSizing: "border-box", maxWidth: "calc(100vw - 16px)", children: r.map((l) => /* @__PURE__ */ t(Be, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": l.did, children: /* @__PURE__ */ t(y, { padding: "1px", children: o({ blocklet: l, blocklets: r, serverVersion: n }) }) }, l.did)) })
|
|
977
977
|
] });
|
|
978
978
|
}
|
|
979
979
|
function dr() {
|
|
@@ -985,7 +985,7 @@ function dr() {
|
|
|
985
985
|
const s = await e(P.explorePath);
|
|
986
986
|
return Array.isArray(s) ? s : [];
|
|
987
987
|
});
|
|
988
|
-
return n ? /* @__PURE__ */ t(
|
|
988
|
+
return n ? /* @__PURE__ */ t(ye, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : l ? /* @__PURE__ */ t(Ze, { mt: 15 }) : /* @__PURE__ */ h(M, { children: [
|
|
989
989
|
/* @__PURE__ */ t(ir, {}),
|
|
990
990
|
o.map(
|
|
991
991
|
(s) => {
|
|
@@ -1005,7 +1005,7 @@ function ur({
|
|
|
1005
1005
|
handleSearchSelect: s,
|
|
1006
1006
|
...a
|
|
1007
1007
|
}) {
|
|
1008
|
-
const i = fe(null), u = fe(!1), [d,
|
|
1008
|
+
const i = fe(null), u = fe(!1), [d, x] = E(!1), [m, f] = E(""), [k, g] = E(!1), B = Ce(), [S, p] = E(!1), v = (a == null ? void 0 : a.placeholder) || r("common.searchStore"), w = async (c) => {
|
|
1009
1009
|
p(!0);
|
|
1010
1010
|
const C = await B.get(Se(e, be(P.blockletsPath, c)));
|
|
1011
1011
|
return p(!1), C.dataList || [];
|
|
@@ -1035,7 +1035,7 @@ function ur({
|
|
|
1035
1035
|
let D = [];
|
|
1036
1036
|
return m && (S ? D = [U] : A != null && A.length ? D = [U, ...A] : D = [{ name: Ae, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ h(M, { children: [
|
|
1037
1037
|
/* @__PURE__ */ h(Ft, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
1038
|
-
/* @__PURE__ */ h(
|
|
1038
|
+
/* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
1039
1039
|
/* @__PURE__ */ t(
|
|
1040
1040
|
je,
|
|
1041
1041
|
{
|
|
@@ -1089,9 +1089,9 @@ function ur({
|
|
|
1089
1089
|
ref: i,
|
|
1090
1090
|
open: !!m && d,
|
|
1091
1091
|
size: "small",
|
|
1092
|
-
onOpen: () =>
|
|
1092
|
+
onOpen: () => x(!0),
|
|
1093
1093
|
onClose: (c, C) => {
|
|
1094
|
-
|
|
1094
|
+
x(!1), C === "selectOption" && !u.current && l(m);
|
|
1095
1095
|
},
|
|
1096
1096
|
onKeyDown: (c) => {
|
|
1097
1097
|
c.key === "Enter" && !m && Q();
|
|
@@ -1184,7 +1184,7 @@ function ur({
|
|
|
1184
1184
|
function q(c) {
|
|
1185
1185
|
if ([de, Ae].includes(c.name))
|
|
1186
1186
|
return /* @__PURE__ */ t(
|
|
1187
|
-
|
|
1187
|
+
y,
|
|
1188
1188
|
{
|
|
1189
1189
|
width: ue,
|
|
1190
1190
|
p: "6px",
|
|
@@ -1201,15 +1201,15 @@ function ur({
|
|
|
1201
1201
|
return c.logo && (C = Se(e, "assets", c.did, Ve(c.logo, ue, c.version))), /* @__PURE__ */ t($e, { src: C, size: ue, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1202
1202
|
}
|
|
1203
1203
|
function G(c = !0) {
|
|
1204
|
-
return /* @__PURE__ */ t(
|
|
1204
|
+
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: c && m && S ? /* @__PURE__ */ t(ne, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(ee, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
1205
1205
|
}
|
|
1206
1206
|
function Y() {
|
|
1207
|
-
return m ? /* @__PURE__ */ t(
|
|
1207
|
+
return m ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(we, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => Q() }) }) : null;
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
function hr({ placeholder: e = "Type to search...", ...r }) {
|
|
1211
|
-
const { search: o } = R(), { filters: n, handleKeyword: l } = o, [s, a] = E(n.keyword || ""), i = Me(l, { wait: 300 }), u = (
|
|
1212
|
-
const { value: m } =
|
|
1211
|
+
const { search: o } = R(), { filters: n, handleKeyword: l } = o, [s, a] = E(n.keyword || ""), i = Me(l, { wait: 300 }), u = (x) => {
|
|
1212
|
+
const { value: m } = x.target;
|
|
1213
1213
|
a(m), i.run(m);
|
|
1214
1214
|
}, d = () => {
|
|
1215
1215
|
a(""), l("");
|
|
@@ -1262,7 +1262,7 @@ const pr = X(je)`
|
|
|
1262
1262
|
cursor: pointer;
|
|
1263
1263
|
`;
|
|
1264
1264
|
function gr() {
|
|
1265
|
-
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: l, developerName: s, showResourcesSwitch: a, layout: i, baseSearch: u } = R(), { filters: d, handleSort:
|
|
1265
|
+
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: l, developerName: s, showResourcesSwitch: a, layout: i, baseSearch: u } = R(), { filters: d, handleSort: x, handlePrice: m, handleDeveloper: f, handleSwitchShowResources: k, cleanFilter: g } = e, B = Ue(r);
|
|
1266
1266
|
return /* @__PURE__ */ h(
|
|
1267
1267
|
F,
|
|
1268
1268
|
{
|
|
@@ -1287,7 +1287,7 @@ function gr() {
|
|
|
1287
1287
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1288
1288
|
gap: 2,
|
|
1289
1289
|
children: [
|
|
1290
|
-
i.showSearch ? /* @__PURE__ */ t(
|
|
1290
|
+
i.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: u ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ t(
|
|
1291
1291
|
ur,
|
|
1292
1292
|
{
|
|
1293
1293
|
locale: n,
|
|
@@ -1342,7 +1342,7 @@ function gr() {
|
|
|
1342
1342
|
value: d.sortBy || B[0].value,
|
|
1343
1343
|
options: B,
|
|
1344
1344
|
placeholder: r("sort.sort"),
|
|
1345
|
-
onChange: (S) =>
|
|
1345
|
+
onChange: (S) => x(S)
|
|
1346
1346
|
}
|
|
1347
1347
|
)
|
|
1348
1348
|
]
|
|
@@ -1378,7 +1378,7 @@ function Ee({
|
|
|
1378
1378
|
);
|
|
1379
1379
|
}
|
|
1380
1380
|
function J({ children: e }) {
|
|
1381
|
-
return /* @__PURE__ */ h(
|
|
1381
|
+
return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1382
1382
|
/* @__PURE__ */ t(_t, {}),
|
|
1383
1383
|
e
|
|
1384
1384
|
] });
|
|
@@ -1389,7 +1389,7 @@ function Fe() {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
function he({ filterTip: e, keywordTip: r }) {
|
|
1391
1391
|
const { t: o, locale: n } = R(), l = () => n === "zh" ? "、" : " , ";
|
|
1392
|
-
return /* @__PURE__ */ h(
|
|
1392
|
+
return /* @__PURE__ */ h(y, { mt: 1, display: "flex", children: [
|
|
1393
1393
|
/* @__PURE__ */ t(b, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1394
1394
|
e && /* @__PURE__ */ t(b, { children: o("blocklet.filterTip") }),
|
|
1395
1395
|
e && r && l(),
|
|
@@ -1410,7 +1410,7 @@ function pe({
|
|
|
1410
1410
|
] })
|
|
1411
1411
|
] });
|
|
1412
1412
|
}
|
|
1413
|
-
function
|
|
1413
|
+
function xr() {
|
|
1414
1414
|
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = R(), { filters: l } = r, s = !!n || !!l.price;
|
|
1415
1415
|
if (l.keyword && s)
|
|
1416
1416
|
return /* @__PURE__ */ h(J, { children: [
|
|
@@ -1452,7 +1452,7 @@ function yr() {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
return /* @__PURE__ */ t(J, { children: /* @__PURE__ */ t(Fe, {}) });
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const yr = (e, r, o, n) => ct(
|
|
1456
1456
|
async (l) => {
|
|
1457
1457
|
l || (o.currentPage = o.defaultCurrentPage);
|
|
1458
1458
|
const { currentPage: s, pageSize: a } = o, i = {
|
|
@@ -1478,7 +1478,7 @@ function wr() {
|
|
|
1478
1478
|
currentPage: P.currentPage,
|
|
1479
1479
|
pageSize: Gt() ? P.mobilePageSize : P.pageSize,
|
|
1480
1480
|
defaultCurrentPage: P.defaultCurrentPage
|
|
1481
|
-
}), [i, u] = E(null), d =
|
|
1481
|
+
}), [i, u] = E(null), d = yr(e, s, a, u), x = j(
|
|
1482
1482
|
() => {
|
|
1483
1483
|
var f, k;
|
|
1484
1484
|
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
@@ -1486,10 +1486,10 @@ function wr() {
|
|
|
1486
1486
|
[d.data, o]
|
|
1487
1487
|
);
|
|
1488
1488
|
return H(() => {
|
|
1489
|
-
const f =
|
|
1489
|
+
const f = x.find((k) => k.owner.did === s.owner);
|
|
1490
1490
|
l((f == null ? void 0 : f.owner.fullName) || (f == null ? void 0 : f.author.name) || "");
|
|
1491
|
-
}, [s.owner,
|
|
1492
|
-
blocklets:
|
|
1491
|
+
}, [s.owner, x, l]), {
|
|
1492
|
+
blocklets: x,
|
|
1493
1493
|
fetchBlockletsError: i,
|
|
1494
1494
|
loadMore: d.loadMore,
|
|
1495
1495
|
hasNextPage: !d.noMore,
|
|
@@ -1505,14 +1505,14 @@ function wr() {
|
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
1507
|
function br() {
|
|
1508
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: l, minItemWidth: s, layout: a, baseSearch: i } = R(), { filters: u } = r, { blocklets: d, errors:
|
|
1508
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: l, minItemWidth: s, layout: a, baseSearch: i } = R(), { filters: u } = r, { blocklets: d, errors: x, loadMore: m, loadings: f, hasNextPage: k, total: g } = wr(), [B] = Tt({
|
|
1509
1509
|
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1510
1510
|
hasNextPage: k,
|
|
1511
1511
|
onLoadMore: m
|
|
1512
1512
|
});
|
|
1513
|
-
if (
|
|
1514
|
-
const w = new Error(`Failed to fetch blocklets from ${o}: ${
|
|
1515
|
-
return /* @__PURE__ */ t(
|
|
1513
|
+
if (x.fetchBlockletsError) {
|
|
1514
|
+
const w = new Error(`Failed to fetch blocklets from ${o}: ${x.fetchBlockletsError.message}`);
|
|
1515
|
+
return /* @__PURE__ */ t(ye, { error: w });
|
|
1516
1516
|
}
|
|
1517
1517
|
const S = i && a.showSearch || !u.keyword;
|
|
1518
1518
|
return /* @__PURE__ */ h(M, { children: [
|
|
@@ -1521,20 +1521,35 @@ function br() {
|
|
|
1521
1521
|
v()
|
|
1522
1522
|
] }),
|
|
1523
1523
|
p(),
|
|
1524
|
-
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(
|
|
1524
|
+
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(ne, {}) })
|
|
1525
1525
|
] });
|
|
1526
1526
|
function p() {
|
|
1527
1527
|
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(Ze, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
|
|
1528
|
-
|
|
1528
|
+
y,
|
|
1529
1529
|
{
|
|
1530
1530
|
className: "blocklet-list",
|
|
1531
1531
|
display: "grid",
|
|
1532
|
-
gridTemplateColumns:
|
|
1532
|
+
gridTemplateColumns: {
|
|
1533
|
+
xs: "1fr",
|
|
1534
|
+
sm: `repeat(auto-fill, minmax(${s}px, 1fr))`
|
|
1535
|
+
},
|
|
1533
1536
|
p: "2px",
|
|
1534
1537
|
gap: 2,
|
|
1535
|
-
children: d.map((w) => /* @__PURE__ */ t(
|
|
1538
|
+
children: d.map((w) => /* @__PURE__ */ t(
|
|
1539
|
+
y,
|
|
1540
|
+
{
|
|
1541
|
+
"data-blocklet-did": w.did,
|
|
1542
|
+
minWidth: {
|
|
1543
|
+
xs: "100%",
|
|
1544
|
+
sm: s
|
|
1545
|
+
},
|
|
1546
|
+
maxWidth: "calc(100vw - 32px)",
|
|
1547
|
+
children: n({ blocklet: w, blocklets: d, serverVersion: l })
|
|
1548
|
+
},
|
|
1549
|
+
w.did
|
|
1550
|
+
))
|
|
1536
1551
|
}
|
|
1537
|
-
) : /* @__PURE__ */ t(
|
|
1552
|
+
) : /* @__PURE__ */ t(xr, {});
|
|
1538
1553
|
}
|
|
1539
1554
|
function v() {
|
|
1540
1555
|
return /* @__PURE__ */ h(
|
|
@@ -1575,9 +1590,9 @@ function kr() {
|
|
|
1575
1590
|
function vr({ menus: e, children: r }) {
|
|
1576
1591
|
var i;
|
|
1577
1592
|
const { search: o, layout: n } = R(), { filters: l } = o, s = l.category || l.keyword || l.price, a = (i = e == null ? void 0 : e.find((u) => u.key === l.menu)) == null ? void 0 : i.key;
|
|
1578
|
-
return /* @__PURE__ */ t(Wt, { children: /* @__PURE__ */ h(it, { FallbackComponent:
|
|
1593
|
+
return /* @__PURE__ */ t(Wt, { children: /* @__PURE__ */ h(it, { FallbackComponent: ye, children: [
|
|
1579
1594
|
/* @__PURE__ */ t(kr, {}),
|
|
1580
|
-
/* @__PURE__ */ h(
|
|
1595
|
+
/* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1581
1596
|
/* @__PURE__ */ t(or, { menus: e }),
|
|
1582
1597
|
/* @__PURE__ */ h(F, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: [
|
|
1583
1598
|
a && (r == null ? void 0 : r(a)),
|
|
@@ -1609,7 +1624,7 @@ function Eo({ showSkeleton: e, ...r }) {
|
|
|
1609
1624
|
return e ? /* @__PURE__ */ t(O, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(Nt, { ...r });
|
|
1610
1625
|
}
|
|
1611
1626
|
function Fo(e) {
|
|
1612
|
-
const { menus: r, children: o, ...n } = e, l =
|
|
1627
|
+
const { menus: r, children: o, ...n } = e, l = xe(), s = Je(
|
|
1613
1628
|
nt({
|
|
1614
1629
|
...l,
|
|
1615
1630
|
typography: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.26",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@blocklet/js-sdk": "^1.16.38",
|
|
56
|
-
"@blocklet/util": "0.16.
|
|
56
|
+
"@blocklet/util": "0.16.26",
|
|
57
57
|
"@emotion/react": "^11.10.0",
|
|
58
58
|
"@emotion/styled": "^11.10.0",
|
|
59
59
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"prettier": "^3.3.2",
|
|
92
92
|
"vite": "^5.4.10"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "d17ff7d087a654fd67470568dd7fa9f121c8f0cf"
|
|
95
95
|
}
|