@blocklet/list 0.16.14 → 0.16.16
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 +45 -46
- package/package.json +5 -4
package/lib/index.es.js
CHANGED
|
@@ -2,40 +2,36 @@ import { jsx as t, jsxs as h, Fragment as M } from "react/jsx-runtime";
|
|
|
2
2
|
import { styled as X, useTheme as ye } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import Je from "@mui/material/styles/createTheme";
|
|
4
4
|
import et from "@mui/material/styles/ThemeProvider";
|
|
5
|
-
import tt from "lodash
|
|
5
|
+
import { omitBy as le, orderBy as tt, isEmpty as rt, merge as ot } from "lodash-es";
|
|
6
6
|
import { ErrorFallback as xe } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
7
|
import x from "@mui/material/Box";
|
|
8
8
|
import F from "@mui/material/Stack";
|
|
9
|
-
import { ErrorBoundary as
|
|
10
|
-
import
|
|
9
|
+
import { ErrorBoundary as nt } from "react-error-boundary";
|
|
10
|
+
import it from "@iconify-icons/tabler/compass";
|
|
11
11
|
import { Icon as K } from "@iconify/react";
|
|
12
12
|
import we from "@mui/icons-material/Close";
|
|
13
13
|
import b from "@mui/material/Typography";
|
|
14
|
-
import { createContext as Le, useState as E, useMemo as j, useContext as Oe, useCallback as me, useEffect as H, forwardRef as
|
|
14
|
+
import { createContext as Le, useState as E, useMemo as j, useContext as Oe, useCallback as me, useEffect as H, forwardRef as lt, useRef as fe, memo as at } from "react";
|
|
15
15
|
import { createAxios as _e } from "@blocklet/js-sdk";
|
|
16
|
-
import
|
|
17
|
-
import { useRequest as re, useDebounceFn as Me, useInfiniteScroll as at, useReactive as st } from "ahooks";
|
|
18
|
-
import le from "lodash/omitBy";
|
|
16
|
+
import { useRequest as re, useDebounceFn as Me, useInfiniteScroll as st, useReactive as ct } from "ahooks";
|
|
19
17
|
import "color";
|
|
20
|
-
import "
|
|
21
|
-
import { parseURL as ct, parseQuery as dt, parseFilename as ut, stringifyParsedURL as ht, withQuery as be, joinURL as Se } from "ufo";
|
|
18
|
+
import { parseURL as dt, parseQuery as ut, parseFilename as ht, stringifyParsedURL as pt, withQuery as be, joinURL as Se } from "ufo";
|
|
22
19
|
import Ie from "flat";
|
|
23
20
|
import oe from "@mui/material/Button";
|
|
24
|
-
import
|
|
21
|
+
import mt from "@mui/material/styles/useTheme";
|
|
25
22
|
import $ from "@mui/material/useMediaQuery";
|
|
26
|
-
import
|
|
23
|
+
import ft from "@mui/material/Drawer";
|
|
27
24
|
import ze from "@mui/material/Checkbox";
|
|
28
25
|
import Ne from "@mui/material/FormControlLabel";
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
26
|
+
import gt from "@mui/icons-material/Check";
|
|
27
|
+
import yt from "@mui/icons-material/KeyboardArrowDown";
|
|
28
|
+
import xt from "@mui/material/ClickAwayListener";
|
|
29
|
+
import wt from "@mui/material/Grow";
|
|
33
30
|
import De from "@mui/material/MenuItem";
|
|
34
31
|
import We from "@mui/material/MenuList";
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import vt from "lodash/isEmpty";
|
|
32
|
+
import bt from "@mui/material/Paper";
|
|
33
|
+
import kt from "@mui/material/Popper";
|
|
34
|
+
import vt from "@mui/material/SvgIcon";
|
|
39
35
|
import ne from "@mui/material/CircularProgress";
|
|
40
36
|
import $e from "@arcblock/ux/lib/Avatar";
|
|
41
37
|
import Ct from "@iconify-icons/tabler/cloud-download";
|
|
@@ -165,9 +161,9 @@ const jt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
165
161
|
// },
|
|
166
162
|
], Ve = (e, r, o) => {
|
|
167
163
|
var d, y;
|
|
168
|
-
const n =
|
|
169
|
-
if ((d =
|
|
170
|
-
return l.imageFilter ?
|
|
164
|
+
const n = dt(e), l = ut(n.search);
|
|
165
|
+
if ((d = ht(e, { strict: !0 })) == null ? void 0 : d.endsWith(".gif"))
|
|
166
|
+
return l.imageFilter ? pt({ ...n, search: "" }) : e;
|
|
171
167
|
if (l.imageFilter)
|
|
172
168
|
return e;
|
|
173
169
|
const a = o || ((y = window.blocklet) == null ? void 0 : y.version), { w: i, h: u } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
@@ -346,7 +342,7 @@ const jt = (e, r, o) => e && r || !o, Ue = (e) => [
|
|
|
346
342
|
handlePage: () => {
|
|
347
343
|
}
|
|
348
344
|
}
|
|
349
|
-
}, Ke = Le(Ge), { Provider: Qt, Consumer:
|
|
345
|
+
}, Ke = Le(Ge), { Provider: Qt, Consumer: To } = Ke;
|
|
350
346
|
function Yt(e) {
|
|
351
347
|
const {
|
|
352
348
|
locale: r = "zh",
|
|
@@ -376,7 +372,7 @@ function Yt(e) {
|
|
|
376
372
|
loading: ie,
|
|
377
373
|
run: V
|
|
378
374
|
} = Wt(T), q = j(() => {
|
|
379
|
-
const I =
|
|
375
|
+
const I = tt(D, [(W) => W.name], ["asc"]), _ = I.findIndex((W) => W.name === "All" || W.locales.en === "All");
|
|
380
376
|
return _ > -1 ? [{ ...I[_], _id: "All" }, ...I.slice(0, _), ...I.slice(_ + 1)] : I;
|
|
381
377
|
}, [D]), G = me(Xt(r), [r]), Y = j(() => Ut(q, r), [q, r]), c = Ht(G), C = {
|
|
382
378
|
search: z,
|
|
@@ -469,7 +465,7 @@ function ve({
|
|
|
469
465
|
xl: l,
|
|
470
466
|
exact: s
|
|
471
467
|
}) {
|
|
472
|
-
const a =
|
|
468
|
+
const a = mt(), i = $(a.breakpoints.down("sm")), u = $(a.breakpoints.between("sm", "md")), d = $(a.breakpoints.between("md", "lg")), y = $(a.breakpoints.between("lg", "xl"));
|
|
473
469
|
if (s)
|
|
474
470
|
return i ? e || null : u ? r || null : d ? o || null : y ? n || null : l || null;
|
|
475
471
|
let m = e;
|
|
@@ -480,12 +476,12 @@ function Zt({ children: e }) {
|
|
|
480
476
|
return /* @__PURE__ */ t(
|
|
481
477
|
ve,
|
|
482
478
|
{
|
|
483
|
-
xs: /* @__PURE__ */ t(
|
|
479
|
+
xs: /* @__PURE__ */ t(ft, { open: r, onClose: () => o(!1), children: e }),
|
|
484
480
|
md: /* @__PURE__ */ t(x, { children: e })
|
|
485
481
|
}
|
|
486
482
|
);
|
|
487
483
|
}
|
|
488
|
-
const Jt =
|
|
484
|
+
const Jt = lt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
489
485
|
oe,
|
|
490
486
|
{
|
|
491
487
|
ref: n,
|
|
@@ -521,23 +517,23 @@ function Qe({ value: e, options: r, onChange: o, placeholder: n, ...l }) {
|
|
|
521
517
|
onClick: k,
|
|
522
518
|
variant: "outlined",
|
|
523
519
|
size: "medium",
|
|
524
|
-
className: ["my-select__selector",
|
|
520
|
+
className: ["my-select__selector", rt(d) ? "" : "my-select__selector--active"].join(" "),
|
|
525
521
|
sx: { minWidth: "auto", color: "text.primary", borderRadius: "8px" },
|
|
526
522
|
...l,
|
|
527
523
|
children: [
|
|
528
524
|
((S = r.find((p) => p.value === d)) == null ? void 0 : S.name) || n,
|
|
529
|
-
/* @__PURE__ */ t(
|
|
525
|
+
/* @__PURE__ */ t(vt, { className: "my-select__arrowdown", component: yt, sx: { width: 18, height: 18 } })
|
|
530
526
|
]
|
|
531
527
|
}
|
|
532
528
|
),
|
|
533
|
-
/* @__PURE__ */ t(
|
|
534
|
-
|
|
529
|
+
/* @__PURE__ */ t(kt, { open: i, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: p, placement: v }) => /* @__PURE__ */ t(
|
|
530
|
+
wt,
|
|
535
531
|
{
|
|
536
532
|
...p,
|
|
537
533
|
style: { transformOrigin: v === "bottom" ? "center top" : "center bottom" },
|
|
538
|
-
children: /* @__PURE__ */ t(
|
|
534
|
+
children: /* @__PURE__ */ t(bt, { children: /* @__PURE__ */ t(xt, { onClickAway: f, children: /* @__PURE__ */ t(tr, { autoFocusItem: i, onMouseEnter: k, onMouseLeave: f, children: r.map((w) => /* @__PURE__ */ h(De, { onClick: () => g(w), sx: { fontSize: 14 }, children: [
|
|
539
535
|
/* @__PURE__ */ t(
|
|
540
|
-
|
|
536
|
+
gt,
|
|
541
537
|
{
|
|
542
538
|
sx: { mr: 1, fontSize: 16, visibility: B(w.value) ? "visible" : "hidden" }
|
|
543
539
|
}
|
|
@@ -673,7 +669,7 @@ function rr({ menus: e }) {
|
|
|
673
669
|
children: k ? /* @__PURE__ */ h(M, { children: [
|
|
674
670
|
a.showExplore && /* @__PURE__ */ h(x, { mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
675
671
|
/* @__PURE__ */ h(x, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
676
|
-
/* @__PURE__ */ t(K, { icon:
|
|
672
|
+
/* @__PURE__ */ t(K, { icon: it, width: 20, height: 20 }),
|
|
677
673
|
/* @__PURE__ */ t(
|
|
678
674
|
b,
|
|
679
675
|
{
|
|
@@ -743,7 +739,7 @@ function Ce() {
|
|
|
743
739
|
}
|
|
744
740
|
};
|
|
745
741
|
}
|
|
746
|
-
const Ze =
|
|
742
|
+
const Ze = at(function(r) {
|
|
747
743
|
return /* @__PURE__ */ t(x, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ne, {}) });
|
|
748
744
|
});
|
|
749
745
|
function Pe({
|
|
@@ -987,7 +983,10 @@ function cr() {
|
|
|
987
983
|
return n ? /* @__PURE__ */ t(xe, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : l ? /* @__PURE__ */ t(Ze, { mt: 15 }) : /* @__PURE__ */ h(M, { children: [
|
|
988
984
|
/* @__PURE__ */ t(nr, {}),
|
|
989
985
|
o.map(
|
|
990
|
-
(s) =>
|
|
986
|
+
(s) => {
|
|
987
|
+
var a;
|
|
988
|
+
return ((a = s.blocklets) == null ? void 0 : a.length) > 0 ? /* @__PURE__ */ t(sr, { title: r(`explore.${s.type}`), blocklets: s.blocklets }, s.type) : null;
|
|
989
|
+
}
|
|
991
990
|
)
|
|
992
991
|
] });
|
|
993
992
|
}
|
|
@@ -1448,7 +1447,7 @@ function gr() {
|
|
|
1448
1447
|
}
|
|
1449
1448
|
return /* @__PURE__ */ t(J, { children: /* @__PURE__ */ t(Fe, {}) });
|
|
1450
1449
|
}
|
|
1451
|
-
const yr = (e, r, o, n) =>
|
|
1450
|
+
const yr = (e, r, o, n) => st(
|
|
1452
1451
|
async (l) => {
|
|
1453
1452
|
l || (o.currentPage = o.defaultCurrentPage);
|
|
1454
1453
|
const { currentPage: s, pageSize: a } = o, i = {
|
|
@@ -1470,7 +1469,7 @@ const yr = (e, r, o, n) => at(
|
|
|
1470
1469
|
);
|
|
1471
1470
|
function xr() {
|
|
1472
1471
|
var m;
|
|
1473
|
-
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: l } = R(), { filters: s } = r, a =
|
|
1472
|
+
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: l } = R(), { filters: s } = r, a = ct({
|
|
1474
1473
|
currentPage: P.currentPage,
|
|
1475
1474
|
pageSize: qt() ? P.mobilePageSize : P.pageSize,
|
|
1476
1475
|
defaultCurrentPage: P.defaultCurrentPage
|
|
@@ -1571,7 +1570,7 @@ function br() {
|
|
|
1571
1570
|
function kr({ menus: e, children: r }) {
|
|
1572
1571
|
var i;
|
|
1573
1572
|
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;
|
|
1574
|
-
return /* @__PURE__ */ t(Dt, { children: /* @__PURE__ */ h(
|
|
1573
|
+
return /* @__PURE__ */ t(Dt, { children: /* @__PURE__ */ h(nt, { FallbackComponent: xe, children: [
|
|
1575
1574
|
/* @__PURE__ */ t(br, {}),
|
|
1576
1575
|
/* @__PURE__ */ h(x, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1577
1576
|
/* @__PURE__ */ t(rr, { menus: e }),
|
|
@@ -1582,7 +1581,7 @@ function kr({ menus: e, children: r }) {
|
|
|
1582
1581
|
] })
|
|
1583
1582
|
] }) });
|
|
1584
1583
|
}
|
|
1585
|
-
function
|
|
1584
|
+
function Po(e) {
|
|
1586
1585
|
return /* @__PURE__ */ h(zt, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
|
|
1587
1586
|
/* @__PURE__ */ h(ae, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
|
|
1588
1587
|
/* @__PURE__ */ h(ae, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
|
|
@@ -1601,12 +1600,12 @@ function Lo(e) {
|
|
|
1601
1600
|
] })
|
|
1602
1601
|
] });
|
|
1603
1602
|
}
|
|
1604
|
-
function
|
|
1603
|
+
function Ao({ showSkeleton: e, ...r }) {
|
|
1605
1604
|
return e ? /* @__PURE__ */ t(O, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(Nt, { ...r });
|
|
1606
1605
|
}
|
|
1607
|
-
function
|
|
1606
|
+
function Eo(e) {
|
|
1608
1607
|
const { menus: r, children: o, ...n } = e, l = ye(), s = Je(
|
|
1609
|
-
|
|
1608
|
+
ot({
|
|
1610
1609
|
...l,
|
|
1611
1610
|
typography: {
|
|
1612
1611
|
h1: {
|
|
@@ -1638,8 +1637,8 @@ function _o(e) {
|
|
|
1638
1637
|
}
|
|
1639
1638
|
export {
|
|
1640
1639
|
dr as Autocomplete,
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1640
|
+
Po as CardSkeleton,
|
|
1641
|
+
Ao as Image,
|
|
1642
|
+
Eo as default,
|
|
1644
1643
|
$t as useSearch
|
|
1645
1644
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.16",
|
|
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.37",
|
|
56
|
-
"@blocklet/util": "0.16.
|
|
56
|
+
"@blocklet/util": "0.16.16",
|
|
57
57
|
"@emotion/react": "^11.10.0",
|
|
58
58
|
"@emotion/styled": "^11.10.0",
|
|
59
59
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"color": "^4.2.3",
|
|
65
65
|
"flat": "^5.0.2",
|
|
66
66
|
"json-stable-stringify": "^1.0.2",
|
|
67
|
-
"lodash": "^4.17.21",
|
|
67
|
+
"lodash-es": "^4.17.21",
|
|
68
68
|
"prop-types": "^15.8.1",
|
|
69
69
|
"react-error-boundary": "^3.1.4",
|
|
70
70
|
"react-hotkeys-hook": "^3.4.7",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@emotion/babel-plugin": "^11.10.0",
|
|
82
82
|
"@storybook/jest": "^0.0.10",
|
|
83
83
|
"@storybook/testing-library": "^0.0.13",
|
|
84
|
+
"@types/lodash-es": "^4.17.12",
|
|
84
85
|
"@types/react-image-gallery": "^1.2.4",
|
|
85
86
|
"@vitejs/plugin-react": "^4.3.3",
|
|
86
87
|
"babel-plugin-inline-react-svg": "^2.0.1",
|
|
@@ -90,5 +91,5 @@
|
|
|
90
91
|
"prettier": "^3.3.2",
|
|
91
92
|
"vite": "^5.4.10"
|
|
92
93
|
},
|
|
93
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "76cd5f65e33072c5156d6bf6e40e198ff60ab5d2"
|
|
94
95
|
}
|