@blocklet/list 0.13.22 → 0.13.24
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 +28 -28
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -208,14 +208,14 @@ function ie({
|
|
|
208
208
|
wrapChildren: u,
|
|
209
209
|
baseSearch: b,
|
|
210
210
|
serverVersion: d,
|
|
211
|
-
storeVersion:
|
|
211
|
+
storeVersion: C,
|
|
212
212
|
fetchCategoryDelay: v,
|
|
213
|
-
showResourcesSwitch:
|
|
213
|
+
showResourcesSwitch: S,
|
|
214
214
|
showCategory: P,
|
|
215
215
|
tagFilters: R
|
|
216
216
|
}) {
|
|
217
217
|
const i = {};
|
|
218
|
-
d && (i["x-blocklet-server-version"] = d),
|
|
218
|
+
d && (i["x-blocklet-server-version"] = d), C && (i["x-blocklet-store-version"] = C);
|
|
219
219
|
const h = Q(() => it.create({
|
|
220
220
|
baseURL: r,
|
|
221
221
|
headers: i
|
|
@@ -295,7 +295,7 @@ function ie({
|
|
|
295
295
|
priceOptions: V,
|
|
296
296
|
storeApi: h,
|
|
297
297
|
baseSearch: b,
|
|
298
|
-
showResourcesSwitch:
|
|
298
|
+
showResourcesSwitch: S,
|
|
299
299
|
showCategory: P,
|
|
300
300
|
tagFilters: R,
|
|
301
301
|
hasNextPage: !I.noMore,
|
|
@@ -395,17 +395,17 @@ se.defaultProps = {
|
|
|
395
395
|
disabled: !1
|
|
396
396
|
};
|
|
397
397
|
function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c, itemRender: x, ...y }) {
|
|
398
|
-
const u = J(null), b = ae(), [d,
|
|
398
|
+
const u = J(null), b = ae(), [d, C] = E(!1), [v, S] = E(n !== null ? n : ""), P = Se(b.breakpoints.down("sm"));
|
|
399
399
|
j(() => {
|
|
400
|
-
|
|
400
|
+
S(n !== null ? n : "");
|
|
401
401
|
}, [n]);
|
|
402
402
|
const R = ne(() => {
|
|
403
|
-
|
|
403
|
+
C(!1);
|
|
404
404
|
}, []), i = ne(() => {
|
|
405
|
-
|
|
405
|
+
C(!0);
|
|
406
406
|
}, []);
|
|
407
407
|
function h(k) {
|
|
408
|
-
|
|
408
|
+
S(k.value), c(k.value), P && R();
|
|
409
409
|
}
|
|
410
410
|
function m(k) {
|
|
411
411
|
return k === v;
|
|
@@ -564,8 +564,8 @@ U.defaultProps = {
|
|
|
564
564
|
value: null
|
|
565
565
|
};
|
|
566
566
|
function pe() {
|
|
567
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N(), [y, u] = E(!1), b = (d,
|
|
568
|
-
d === "category" && n(
|
|
567
|
+
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N(), [y, u] = E(!1), b = (d, C) => {
|
|
568
|
+
d === "category" && n(C), d === "price" && a(C), u(!1);
|
|
569
569
|
};
|
|
570
570
|
return /* @__PURE__ */ f(At, { children: [
|
|
571
571
|
/* @__PURE__ */ t(ht, { variant: "outlined", className: "filter-button", onClick: () => u(!0), children: /* @__PURE__ */ t(dt, { className: "filter-icon", fontSize: "small" }) }),
|
|
@@ -693,8 +693,8 @@ function ue({ blocklets: e, ...n }) {
|
|
|
693
693
|
t: u,
|
|
694
694
|
hasNextPage: b,
|
|
695
695
|
loadMore: d,
|
|
696
|
-
endpoint:
|
|
697
|
-
} = N(), v = !!c || !!y.price, [
|
|
696
|
+
endpoint: C
|
|
697
|
+
} = N(), v = !!c || !!y.price, [S] = gt({
|
|
698
698
|
loading: s.fetchBlockletsLoading || s.loadingMore,
|
|
699
699
|
hasNextPage: b,
|
|
700
700
|
onLoadMore: d
|
|
@@ -703,7 +703,7 @@ function ue({ blocklets: e, ...n }) {
|
|
|
703
703
|
return /* @__PURE__ */ t(
|
|
704
704
|
Te,
|
|
705
705
|
{
|
|
706
|
-
error: new Error(`Failed to fetch blocklets from ${
|
|
706
|
+
error: new Error(`Failed to fetch blocklets from ${C}: ${a.fetchBlockletsError.message}`)
|
|
707
707
|
}
|
|
708
708
|
);
|
|
709
709
|
if (s.fetchBlockletsLoading)
|
|
@@ -760,7 +760,7 @@ function ue({ blocklets: e, ...n }) {
|
|
|
760
760
|
},
|
|
761
761
|
children: [
|
|
762
762
|
e.map((i) => /* @__PURE__ */ t(te, { xs: 4, "data-blocklet-did": i.did, children: r({ blocklet: i, blocklets: e }) }, i.did)),
|
|
763
|
-
b && /* @__PURE__ */ t(te, { xs: 12, ref:
|
|
763
|
+
b && /* @__PURE__ */ t(te, { xs: 12, ref: S, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) }) })
|
|
764
764
|
]
|
|
765
765
|
}
|
|
766
766
|
) });
|
|
@@ -865,27 +865,27 @@ const Ut = T(je)`
|
|
|
865
865
|
cursor: pointer;
|
|
866
866
|
`;
|
|
867
867
|
function he({ onSelect: e, wrapChildren: n }) {
|
|
868
|
-
const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender: x, filters: y, endpoint: u, handleKeyword: b, t: d } = N(),
|
|
868
|
+
const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender: x, filters: y, endpoint: u, handleKeyword: b, t: d } = N(), C = async (i) => {
|
|
869
869
|
const { data: h } = await c.get(_.blockletsPath, { params: i }), m = h.dataList || [];
|
|
870
870
|
return m.length > 0 && m.unshift({ type: "more-result", total: h.total || 0 }), m;
|
|
871
871
|
}, v = (i) => {
|
|
872
872
|
b(i.state.query), i.setIsOpen(!1);
|
|
873
|
-
},
|
|
873
|
+
}, S = () => {
|
|
874
874
|
r.current && setTimeout(() => {
|
|
875
875
|
const i = r.current.querySelector("input.bl-autocomplete-input");
|
|
876
876
|
i && i.focus();
|
|
877
877
|
});
|
|
878
878
|
}, P = (i) => {
|
|
879
|
-
i.setIsOpen(!1),
|
|
879
|
+
i.setIsOpen(!1), S();
|
|
880
880
|
}, R = ({ prevState: i, state: h }) => {
|
|
881
|
-
i.query !== h.query && (h.query || b());
|
|
881
|
+
i.query !== h.query && (h.query || (b(), S()));
|
|
882
882
|
};
|
|
883
883
|
return St(
|
|
884
884
|
"ctrl + k, command + k",
|
|
885
|
-
(i) => (i.stopPropagation(), i.preventDefault(),
|
|
885
|
+
(i) => (i.stopPropagation(), i.preventDefault(), S(), !1),
|
|
886
886
|
{ enableOnTags: ["INPUT"] }
|
|
887
887
|
), j(() => {
|
|
888
|
-
|
|
888
|
+
S();
|
|
889
889
|
}, [u]), j(() => {
|
|
890
890
|
if (!r.current)
|
|
891
891
|
return;
|
|
@@ -937,7 +937,7 @@ function he({ onSelect: e, wrapChildren: n }) {
|
|
|
937
937
|
{
|
|
938
938
|
sourceId: "blocklets",
|
|
939
939
|
getItems() {
|
|
940
|
-
return
|
|
940
|
+
return C($);
|
|
941
941
|
},
|
|
942
942
|
// 选中后填充 搜索框中值
|
|
943
943
|
getItemInputValue({ item: w }) {
|
|
@@ -1022,9 +1022,9 @@ function Kt() {
|
|
|
1022
1022
|
t: u,
|
|
1023
1023
|
getCategoryLocale: b,
|
|
1024
1024
|
priceOptions: d,
|
|
1025
|
-
wrapChildren:
|
|
1025
|
+
wrapChildren: C,
|
|
1026
1026
|
showResourcesSwitch: v,
|
|
1027
|
-
showCategory:
|
|
1027
|
+
showCategory: S,
|
|
1028
1028
|
baseSearch: P,
|
|
1029
1029
|
onFilterChange: R,
|
|
1030
1030
|
tagFilters: i
|
|
@@ -1042,7 +1042,7 @@ function Kt() {
|
|
|
1042
1042
|
});
|
|
1043
1043
|
V ? G(V) : i.length > 0 && G(i[0]);
|
|
1044
1044
|
}), /* @__PURE__ */ f(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
|
|
1045
|
-
|
|
1045
|
+
S ? /* @__PURE__ */ t(ye, { mdDown: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
|
|
1046
1046
|
/* @__PURE__ */ f(Ht, { children: [
|
|
1047
1047
|
/* @__PURE__ */ f(Vt, { children: [
|
|
1048
1048
|
/* @__PURE__ */ f(
|
|
@@ -1063,7 +1063,7 @@ function Kt() {
|
|
|
1063
1063
|
gap: 1
|
|
1064
1064
|
},
|
|
1065
1065
|
children: [
|
|
1066
|
-
|
|
1066
|
+
S ? /* @__PURE__ */ t(ye, { mdUp: !0, children: /* @__PURE__ */ t(pe, {}) }) : null,
|
|
1067
1067
|
/* @__PURE__ */ t(
|
|
1068
1068
|
"form",
|
|
1069
1069
|
{
|
|
@@ -1081,7 +1081,7 @@ function Kt() {
|
|
|
1081
1081
|
onBlur: () => {
|
|
1082
1082
|
I(!1);
|
|
1083
1083
|
},
|
|
1084
|
-
children: P ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: u("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: y, wrapChildren:
|
|
1084
|
+
children: P ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: u("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: y, wrapChildren: C })
|
|
1085
1085
|
}
|
|
1086
1086
|
),
|
|
1087
1087
|
/* @__PURE__ */ f(D, { className: "filter-container", display: "flex", alignItems: "center", children: [
|
|
@@ -1102,7 +1102,7 @@ function Kt() {
|
|
|
1102
1102
|
]
|
|
1103
1103
|
}
|
|
1104
1104
|
),
|
|
1105
|
-
|
|
1105
|
+
S ? /* @__PURE__ */ f(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
|
|
1106
1106
|
/* @__PURE__ */ t(
|
|
1107
1107
|
q,
|
|
1108
1108
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.24",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@algolia/autocomplete-js": "^1.17.0",
|
|
54
54
|
"@algolia/autocomplete-theme-classic": "^1.17.0",
|
|
55
|
-
"@blocklet/util": "0.13.
|
|
55
|
+
"@blocklet/util": "0.13.24",
|
|
56
56
|
"@emotion/react": "^11.10.0",
|
|
57
57
|
"@emotion/styled": "^11.10.0",
|
|
58
58
|
"@mui/icons-material": "^5.16.4",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"prettier": "^3.3.2",
|
|
84
84
|
"vite": "^5.2.12"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "41dfdc8de5994273369d29dadfd53494e4828498"
|
|
87
87
|
}
|