@blocklet/list 0.13.38 → 0.13.40
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 +1040 -898
- package/package.json +10 -4
package/lib/index.es.js
CHANGED
|
@@ -1,38 +1,135 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as
|
|
3
|
-
import { Global as xe, css as
|
|
4
|
-
import
|
|
5
|
-
import { Button as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { styled as D, useTheme as be } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import { Global as xe, css as we } from "@emotion/react";
|
|
4
|
+
import { ErrorFallback as Z } from "@arcblock/ux/lib/ErrorBoundary";
|
|
5
|
+
import { Button as ee, useTheme as Qe, useMediaQuery as N, Drawer as Xe, Box as S, CircularProgress as te, MenuList as Ye, SvgIcon as Je, Popper as Ke, Grow as Ze, Paper as et, ClickAwayListener as tt, MenuItem as rt, Stack as T, FormControlLabel as ke, Checkbox as ve, Typography as I, Link as ot, Grid as pe, OutlinedInput as nt, InputAdornment as me } from "@mui/material";
|
|
6
|
+
import { ErrorBoundary as lt } from "react-error-boundary";
|
|
7
|
+
import at from "@iconify-icons/tabler/compass";
|
|
8
|
+
import { Icon as Ce } from "@iconify/react";
|
|
9
|
+
import Se from "@mui/icons-material/Close";
|
|
10
|
+
import { createContext as Be, useState as q, useMemo as E, useContext as Re, useCallback as K, useEffect as j, forwardRef as it, useRef as U, memo as st, createElement as ct, Fragment as dt } from "react";
|
|
11
|
+
import Pe from "axios";
|
|
12
|
+
import ut from "lodash/orderBy";
|
|
13
|
+
import i from "prop-types";
|
|
14
|
+
import { useInfiniteScroll as pt, useRequest as re, useReactive as mt, useDebounceFn as ht } from "ahooks";
|
|
15
|
+
import ft from "lodash/omitBy";
|
|
16
|
+
import gt from "json-stable-stringify";
|
|
16
17
|
import "lodash/cloneDeep";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
18
|
+
import yt from "color";
|
|
19
|
+
import he from "flat";
|
|
20
|
+
import bt from "@mui/icons-material/KeyboardArrowDown";
|
|
21
|
+
import xt from "lodash/isEmpty";
|
|
22
|
+
import Te from "@mui/material/Box";
|
|
23
|
+
import wt from "@arcblock/ux/lib/Avatar";
|
|
24
|
+
import kt from "@iconify-icons/tabler/cloud-download";
|
|
25
|
+
import vt from "@mui/icons-material/ChevronLeft";
|
|
26
|
+
import Ct from "@mui/icons-material/ChevronRight";
|
|
27
|
+
import St from "react-image-gallery";
|
|
28
|
+
import "react-image-gallery/styles/css/image-gallery.css";
|
|
29
|
+
import Bt from "@arcblock/ux/lib/Empty";
|
|
30
|
+
import Rt from "react-infinite-scroll-hook";
|
|
31
|
+
import Ie from "@mui/material/Typography";
|
|
32
|
+
import Pt from "@mui/icons-material/Menu";
|
|
33
|
+
import { createRoot as Tt } from "react-dom/client";
|
|
34
|
+
import { autocomplete as It } from "@algolia/autocomplete-js";
|
|
35
|
+
import { useHotkeys as Lt } from "react-hotkeys-hook";
|
|
36
|
+
import { joinURL as zt } from "ufo";
|
|
37
|
+
import $t from "@mui/icons-material/Search";
|
|
34
38
|
import "@algolia/autocomplete-theme-classic/dist/theme.css";
|
|
35
|
-
const
|
|
39
|
+
const Le = Be({
|
|
40
|
+
open: !1,
|
|
41
|
+
toggleOpen: (e) => {
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function _t({ children: e }) {
|
|
45
|
+
const [r, o] = q(!1), n = (l) => {
|
|
46
|
+
o(l ?? !l);
|
|
47
|
+
}, a = E(() => ({ open: r, toggleOpen: n }), [r]);
|
|
48
|
+
return /* @__PURE__ */ t(Le.Provider, { value: a, children: e });
|
|
49
|
+
}
|
|
50
|
+
function oe() {
|
|
51
|
+
return Re(Le);
|
|
52
|
+
}
|
|
53
|
+
const P = {
|
|
54
|
+
nameAsc: "title",
|
|
55
|
+
nameDesc: "title",
|
|
56
|
+
popularity: "stats.downloads",
|
|
57
|
+
publishAt: "lastPublishedAt",
|
|
58
|
+
mobilePageSize: 10,
|
|
59
|
+
pageSize: 18,
|
|
60
|
+
currentPage: 1,
|
|
61
|
+
defaultCurrentPage: 1,
|
|
62
|
+
blockletsPath: "/api/v2/blocklets.json",
|
|
63
|
+
categoriesPath: "/api/blocklets/categories",
|
|
64
|
+
explorePath: "/api/blocklets/explore",
|
|
65
|
+
exploreDidsPath: "/api/blocklets/dids",
|
|
66
|
+
cacheSize: 100
|
|
67
|
+
}, At = (e, r, o, n) => pt(
|
|
68
|
+
async (a) => {
|
|
69
|
+
a || (o.currentPage = o.defaultCurrentPage);
|
|
70
|
+
const { currentPage: l, pageSize: c } = o, d = {
|
|
71
|
+
...r,
|
|
72
|
+
category: r.category === "All" ? "" : r.category,
|
|
73
|
+
sortBy: P[r.sortBy],
|
|
74
|
+
page: l,
|
|
75
|
+
pageSize: c
|
|
76
|
+
};
|
|
77
|
+
n(null);
|
|
78
|
+
const { data: s = {} } = await e.get(P.blockletsPath, { params: d });
|
|
79
|
+
return o.currentPage++, { page: l, pageSize: c, list: (s == null ? void 0 : s.dataList) || [], total: (s == null ? void 0 : s.total) || 0 };
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
isNoMore: (a) => a ? a.page * a.pageSize >= a.total : !1,
|
|
83
|
+
reloadDeps: [e, gt(r)],
|
|
84
|
+
onError: n
|
|
85
|
+
}
|
|
86
|
+
), Ft = (e) => re(
|
|
87
|
+
async () => {
|
|
88
|
+
const { data: r } = await e.get(P.categoriesPath);
|
|
89
|
+
return Array.isArray(r) ? r : [];
|
|
90
|
+
},
|
|
91
|
+
{ manual: !0 }
|
|
92
|
+
), ze = {
|
|
93
|
+
filters: i.shape({
|
|
94
|
+
keyword: i.string,
|
|
95
|
+
sortBy: i.string,
|
|
96
|
+
sortDirection: i.string,
|
|
97
|
+
price: i.string,
|
|
98
|
+
category: i.string,
|
|
99
|
+
developer: i.string,
|
|
100
|
+
resourceType: i.string
|
|
101
|
+
}),
|
|
102
|
+
wrapChildren: i.func,
|
|
103
|
+
extraFilter: i.func,
|
|
104
|
+
serverVersion: i.string,
|
|
105
|
+
endpoint: i.string.isRequired,
|
|
106
|
+
blockletRender: i.func.isRequired,
|
|
107
|
+
onFilterChange: i.func,
|
|
108
|
+
onSearchSelect: i.func,
|
|
109
|
+
locale: i.oneOf(["zh", "en"]),
|
|
110
|
+
baseSearch: i.bool,
|
|
111
|
+
// sometimes blocklet list can be rendered only before the category is fetched
|
|
112
|
+
fetchCategoryDelay: i.number,
|
|
113
|
+
showResourcesSwitch: i.bool,
|
|
114
|
+
showCategory: i.bool,
|
|
115
|
+
tagFilters: i.array
|
|
116
|
+
}, $e = {
|
|
117
|
+
locale: "zh",
|
|
118
|
+
filters: {},
|
|
119
|
+
serverVersion: "",
|
|
120
|
+
onFilterChange: () => {
|
|
121
|
+
},
|
|
122
|
+
onSearchSelect: ({ detailUrl: e }) => {
|
|
123
|
+
window.location.href = e;
|
|
124
|
+
},
|
|
125
|
+
wrapChildren: (e) => e,
|
|
126
|
+
extraFilter: (e) => e,
|
|
127
|
+
baseSearch: !1,
|
|
128
|
+
fetchCategoryDelay: 0,
|
|
129
|
+
showResourcesSwitch: !1,
|
|
130
|
+
showCategory: !0,
|
|
131
|
+
tagFilters: []
|
|
132
|
+
}, _e = (e) => [
|
|
36
133
|
{
|
|
37
134
|
name: e("sort.popularity"),
|
|
38
135
|
value: "popularity"
|
|
@@ -40,45 +137,49 @@ const vt = (e) => [
|
|
|
40
137
|
{
|
|
41
138
|
name: e("sort.lastPublished"),
|
|
42
139
|
value: "publishAt"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: e("sort.nameAscend"),
|
|
46
|
-
value: "nameAsc"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: e("sort.nameDescend"),
|
|
50
|
-
value: "nameDesc"
|
|
51
140
|
}
|
|
52
|
-
|
|
141
|
+
// {
|
|
142
|
+
// name: t('sort.rating'),
|
|
143
|
+
// value: 'rating',
|
|
144
|
+
// },
|
|
145
|
+
], Dt = (e) => [
|
|
53
146
|
{ name: e("blocklet.free"), value: "free" },
|
|
54
147
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
55
|
-
],
|
|
148
|
+
], Et = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Mt = (e, r) => (
|
|
56
149
|
// eslint-disable-next-line no-prototype-builtins
|
|
57
|
-
e.replace(/{(\w*)}/g, (
|
|
58
|
-
),
|
|
59
|
-
function
|
|
60
|
-
let
|
|
61
|
-
return function(...
|
|
62
|
-
return
|
|
63
|
-
|
|
150
|
+
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
151
|
+
), Nt = () => window.innerWidth <= 600, Ot = (e) => yt(e).rgb().object();
|
|
152
|
+
function qt(e, r) {
|
|
153
|
+
let o;
|
|
154
|
+
return function(...a) {
|
|
155
|
+
return o && clearTimeout(o), new Promise((l) => {
|
|
156
|
+
o = setTimeout(() => l(e(...a)), r);
|
|
64
157
|
});
|
|
65
158
|
};
|
|
66
159
|
}
|
|
67
|
-
const
|
|
160
|
+
const jt = qt((e) => Promise.resolve(e), 300), Vt = {
|
|
68
161
|
common: {
|
|
69
|
-
|
|
162
|
+
title: "Blocklet Store",
|
|
163
|
+
searchStore: "Search Blocklet",
|
|
70
164
|
showResources: "Show resources",
|
|
71
165
|
price: "Price",
|
|
72
166
|
category: "Category",
|
|
73
167
|
resourceType: "Resource Type",
|
|
74
168
|
clear: "Clear",
|
|
75
169
|
cancel: "Cancel",
|
|
76
|
-
search: "Search"
|
|
170
|
+
search: "Search",
|
|
171
|
+
fetchError: "Failed to fetch data, please try again later"
|
|
172
|
+
},
|
|
173
|
+
explore: {
|
|
174
|
+
title: "Explore",
|
|
175
|
+
trending: "Trending",
|
|
176
|
+
topRated: "Top Rated",
|
|
177
|
+
recentlyUpdated: "Recently Updated",
|
|
178
|
+
viewDetail: "View Details"
|
|
77
179
|
},
|
|
78
180
|
sort: {
|
|
79
181
|
sort: "Sort",
|
|
80
|
-
|
|
81
|
-
nameAscend: "Name Ascending",
|
|
182
|
+
rating: "Rating",
|
|
82
183
|
popularity: "Most Popular",
|
|
83
184
|
lastPublished: "Latest Published"
|
|
84
185
|
},
|
|
@@ -89,8 +190,9 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
89
190
|
},
|
|
90
191
|
blocklet: {
|
|
91
192
|
noResults: "No Blocklets",
|
|
92
|
-
|
|
93
|
-
|
|
193
|
+
free: "Free",
|
|
194
|
+
search: 'Results for "{keyword}"',
|
|
195
|
+
resultCount: "{count} Blocklets",
|
|
94
196
|
emptyTip: "Tips:",
|
|
95
197
|
filterTip: "Appropriately reduce the filter conditions",
|
|
96
198
|
keywordTip: "Try other keywords",
|
|
@@ -103,21 +205,29 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
103
205
|
autocomplete: {
|
|
104
206
|
expandResult: 'View all search results for "{name}"'
|
|
105
207
|
}
|
|
106
|
-
},
|
|
208
|
+
}, Wt = {
|
|
107
209
|
common: {
|
|
108
|
-
|
|
210
|
+
title: "Blocklet 商店",
|
|
211
|
+
searchStore: "搜索 Blocklet",
|
|
109
212
|
showResources: "显示资源型应用",
|
|
110
213
|
price: "价格",
|
|
111
214
|
category: "类别",
|
|
112
215
|
resourceType: "资源类型",
|
|
113
216
|
clear: "清除",
|
|
114
217
|
cancel: "取消",
|
|
115
|
-
search: "搜索"
|
|
218
|
+
search: "搜索",
|
|
219
|
+
fetchError: "获取数据失败, 请稍后再试"
|
|
220
|
+
},
|
|
221
|
+
explore: {
|
|
222
|
+
title: "探索",
|
|
223
|
+
trending: "趋势",
|
|
224
|
+
topRated: "评分最高",
|
|
225
|
+
recentlyUpdated: "最近更新",
|
|
226
|
+
viewDetail: "查看详情"
|
|
116
227
|
},
|
|
117
228
|
sort: {
|
|
118
229
|
sort: "排序",
|
|
119
|
-
|
|
120
|
-
nameAscend: "名称升序",
|
|
230
|
+
rating: "评分",
|
|
121
231
|
popularity: "最热门",
|
|
122
232
|
lastPublished: "最新发布"
|
|
123
233
|
},
|
|
@@ -128,8 +238,9 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
128
238
|
},
|
|
129
239
|
blocklet: {
|
|
130
240
|
noResults: "暂无应用",
|
|
131
|
-
free: "
|
|
132
|
-
|
|
241
|
+
free: "免费",
|
|
242
|
+
search: '搜索 "{keyword}" 的结果',
|
|
243
|
+
resultCount: "{count} 个 Blocklet",
|
|
133
244
|
emptyTip: "建议:",
|
|
134
245
|
filterTip: "适当减少筛选条件",
|
|
135
246
|
keywordTip: "尝试其他关键字",
|
|
@@ -142,322 +253,328 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
142
253
|
autocomplete: {
|
|
143
254
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
144
255
|
}
|
|
145
|
-
},
|
|
146
|
-
en:
|
|
147
|
-
zh:
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
wrapChildren: o.func,
|
|
159
|
-
extraFilter: o.func,
|
|
160
|
-
serverVersion: o.string,
|
|
161
|
-
endpoint: o.string.isRequired,
|
|
162
|
-
blockletRender: o.func.isRequired,
|
|
163
|
-
onFilterChange: o.func,
|
|
164
|
-
onSearchSelect: o.func,
|
|
165
|
-
locale: o.oneOf(["zh", "en"]),
|
|
166
|
-
baseSearch: o.bool,
|
|
167
|
-
// sometimes blocklet list can be rendered only before the category is fetched
|
|
168
|
-
fetchCategoryDelay: o.number,
|
|
169
|
-
showResourcesSwitch: o.bool,
|
|
170
|
-
showCategory: o.bool,
|
|
171
|
-
tagFilters: o.array
|
|
172
|
-
}, $e = {
|
|
173
|
-
locale: "zh",
|
|
174
|
-
filters: {},
|
|
175
|
-
serverVersion: "",
|
|
176
|
-
onFilterChange: () => {
|
|
256
|
+
}, J = {
|
|
257
|
+
en: he(Vt),
|
|
258
|
+
zh: he(Wt)
|
|
259
|
+
}, Ae = (e, r) => {
|
|
260
|
+
const o = {};
|
|
261
|
+
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
262
|
+
}, Ut = (e) => (r, o) => {
|
|
263
|
+
const n = J[e] ? J[e][r] : J.en[r];
|
|
264
|
+
return Mt(n, o) || r;
|
|
265
|
+
}, Fe = {
|
|
266
|
+
errors: {
|
|
267
|
+
fetchBlockletsError: null,
|
|
268
|
+
fetchCategoriesError: null
|
|
177
269
|
},
|
|
178
|
-
|
|
179
|
-
|
|
270
|
+
loadings: {
|
|
271
|
+
fetchBlockletsLoading: !1,
|
|
272
|
+
fetchCategoriesLoading: !1,
|
|
273
|
+
loadingMore: !1
|
|
180
274
|
},
|
|
181
|
-
|
|
182
|
-
|
|
275
|
+
endpoint: "",
|
|
276
|
+
blockletList: [],
|
|
277
|
+
wrapChildren: () => null,
|
|
278
|
+
t: (e) => e,
|
|
279
|
+
storeVersion: "",
|
|
280
|
+
serverVersion: "",
|
|
281
|
+
filters: {},
|
|
282
|
+
selectedCategory: void 0,
|
|
283
|
+
categoryList: [],
|
|
284
|
+
blockletRender: () => null,
|
|
285
|
+
locale: "en",
|
|
286
|
+
categoryOptions: [],
|
|
287
|
+
priceOptions: [],
|
|
288
|
+
storeApi: null,
|
|
183
289
|
baseSearch: !1,
|
|
184
|
-
fetchCategoryDelay: 0,
|
|
185
290
|
showResourcesSwitch: !1,
|
|
186
|
-
showCategory: !
|
|
187
|
-
tagFilters: []
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
|
|
291
|
+
showCategory: !1,
|
|
292
|
+
tagFilters: [],
|
|
293
|
+
hasNextPage: !1,
|
|
294
|
+
onFilterChange: () => {
|
|
295
|
+
},
|
|
296
|
+
handleSort: () => {
|
|
297
|
+
},
|
|
298
|
+
cleanFilter: () => {
|
|
299
|
+
},
|
|
300
|
+
handleKeyword: () => {
|
|
301
|
+
},
|
|
302
|
+
handlePrice: () => {
|
|
303
|
+
},
|
|
304
|
+
handleCategory: () => {
|
|
305
|
+
},
|
|
306
|
+
handleDeveloper: () => {
|
|
307
|
+
},
|
|
308
|
+
handlePage: () => {
|
|
309
|
+
},
|
|
310
|
+
handleSwitchShowResources: () => {
|
|
311
|
+
},
|
|
312
|
+
loadMore: () => {
|
|
313
|
+
},
|
|
314
|
+
getCategoryLocale: () => null,
|
|
315
|
+
developerName: "",
|
|
316
|
+
handleSearchSelect: () => {
|
|
317
|
+
}
|
|
318
|
+
}, De = Be(Fe), { Provider: Ht, Consumer: Hr } = De;
|
|
319
|
+
function ne({
|
|
202
320
|
filters: e,
|
|
203
|
-
children:
|
|
204
|
-
endpoint:
|
|
205
|
-
locale:
|
|
206
|
-
blockletRender:
|
|
207
|
-
onFilterChange:
|
|
208
|
-
onSearchSelect:
|
|
209
|
-
extraFilter:
|
|
210
|
-
wrapChildren:
|
|
211
|
-
baseSearch:
|
|
212
|
-
serverVersion:
|
|
213
|
-
storeVersion:
|
|
214
|
-
fetchCategoryDelay:
|
|
215
|
-
showResourcesSwitch:
|
|
216
|
-
showCategory:
|
|
217
|
-
tagFilters:
|
|
321
|
+
children: r,
|
|
322
|
+
endpoint: o,
|
|
323
|
+
locale: n,
|
|
324
|
+
blockletRender: a,
|
|
325
|
+
onFilterChange: l,
|
|
326
|
+
onSearchSelect: c,
|
|
327
|
+
extraFilter: d,
|
|
328
|
+
wrapChildren: s,
|
|
329
|
+
baseSearch: v,
|
|
330
|
+
serverVersion: f,
|
|
331
|
+
storeVersion: y,
|
|
332
|
+
fetchCategoryDelay: u,
|
|
333
|
+
showResourcesSwitch: w,
|
|
334
|
+
showCategory: k,
|
|
335
|
+
tagFilters: x
|
|
218
336
|
}) {
|
|
219
|
-
const y = {}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}), [z, I] = E(null), v = Xe(
|
|
233
|
-
async (l) => {
|
|
234
|
-
l || (k.currentPage = k.defaultCurrentPage);
|
|
235
|
-
const { currentPage: p, pageSize: P } = k, A = {
|
|
236
|
-
...i,
|
|
237
|
-
sortBy: N[i.sortBy],
|
|
238
|
-
page: p,
|
|
239
|
-
pageSize: P
|
|
240
|
-
};
|
|
241
|
-
I(null);
|
|
242
|
-
const { data: D = {} } = await d.get(N.blockletsPath, {
|
|
243
|
-
params: A
|
|
244
|
-
});
|
|
245
|
-
return k.currentPage++, {
|
|
246
|
-
page: p,
|
|
247
|
-
pageSize: P,
|
|
248
|
-
list: (D == null ? void 0 : D.dataList) || [],
|
|
249
|
-
total: (D == null ? void 0 : D.total) || 0
|
|
250
|
-
};
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
254
|
-
reloadDeps: [r, st(e)],
|
|
255
|
-
onError: (l) => {
|
|
256
|
-
I(l);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
), {
|
|
260
|
-
data: V = [],
|
|
261
|
-
error: ee,
|
|
262
|
-
loading: O,
|
|
263
|
-
run: W
|
|
264
|
-
} = Ye(
|
|
265
|
-
async () => {
|
|
266
|
-
const { data: l } = await d.get(N.categoriesPath);
|
|
267
|
-
return Array.isArray(l) ? l : [];
|
|
268
|
-
},
|
|
269
|
-
{ manual: !0 }
|
|
270
|
-
), F = Q(() => at(V || [], [(p) => p.name], ["asc"]), [V]), G = ne(
|
|
271
|
-
(l, p) => {
|
|
272
|
-
const P = re[a] ? re[a][l] : re.en[l];
|
|
273
|
-
return Rt(P, p);
|
|
274
|
-
},
|
|
275
|
-
[a]
|
|
276
|
-
), K = Q(() => {
|
|
337
|
+
const $ = Ae(f, y), b = E(() => Pe.create({ baseURL: o, headers: $ }), [o]), h = { sortBy: "popularity", sortDirection: "desc", ...e }, C = h.category, _ = mt({
|
|
338
|
+
currentPage: P.currentPage,
|
|
339
|
+
pageSize: Nt() ? P.mobilePageSize : P.pageSize,
|
|
340
|
+
defaultCurrentPage: P.defaultCurrentPage
|
|
341
|
+
}), [A, z] = q(null), L = At(b, h, _, z), {
|
|
342
|
+
data: X = [],
|
|
343
|
+
error: Ve,
|
|
344
|
+
loading: We,
|
|
345
|
+
run: se
|
|
346
|
+
} = Ft(b), Y = E(() => {
|
|
347
|
+
const p = ut(X, [(R) => R.name], ["asc"]), g = p.findIndex((R) => R.name === "All" || R.locales.en === "All");
|
|
348
|
+
return g > -1 ? [{ ...p[g], _id: "All" }, ...p.slice(0, g), ...p.slice(g + 1)] : p;
|
|
349
|
+
}, [X]), ce = E(() => {
|
|
277
350
|
var p;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
errors: { fetchBlockletsError: z, fetchCategoriesError: ee },
|
|
351
|
+
return d(((p = L.data) == null ? void 0 : p.list) || []);
|
|
352
|
+
}, [L.data, d]), de = K(Ut(n), [n]), Ue = E(() => Et(Y, n), [Y, n]), He = Dt(de), Ge = {
|
|
353
|
+
errors: { fetchBlockletsError: A, fetchCategoriesError: Ve },
|
|
282
354
|
loadings: {
|
|
283
|
-
fetchBlockletsLoading:
|
|
284
|
-
fetchCategoriesLoading:
|
|
285
|
-
loadingMore:
|
|
355
|
+
fetchBlockletsLoading: L.loading,
|
|
356
|
+
fetchCategoriesLoading: We,
|
|
357
|
+
loadingMore: L.loadingMore
|
|
358
|
+
},
|
|
359
|
+
endpoint: o,
|
|
360
|
+
blockletList: ce,
|
|
361
|
+
wrapChildren: s,
|
|
362
|
+
t: de,
|
|
363
|
+
storeVersion: y,
|
|
364
|
+
serverVersion: f,
|
|
365
|
+
filters: h,
|
|
366
|
+
selectedCategory: C,
|
|
367
|
+
categoryList: Y,
|
|
368
|
+
blockletRender: a,
|
|
369
|
+
locale: n,
|
|
370
|
+
categoryOptions: Ue,
|
|
371
|
+
priceOptions: He,
|
|
372
|
+
storeApi: b,
|
|
373
|
+
baseSearch: v,
|
|
374
|
+
showResourcesSwitch: w,
|
|
375
|
+
showCategory: k,
|
|
376
|
+
tagFilters: x,
|
|
377
|
+
hasNextPage: !L.noMore,
|
|
378
|
+
onFilterChange: l,
|
|
379
|
+
cleanFilter: (p) => {
|
|
380
|
+
const g = p ? ft(h, (R, M) => p == null ? void 0 : p.includes(M)) : {};
|
|
381
|
+
l(g);
|
|
286
382
|
},
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
t: G,
|
|
291
|
-
serverVersion: u,
|
|
292
|
-
filters: i,
|
|
293
|
-
selectedCategory: b,
|
|
294
|
-
categoryList: F,
|
|
295
|
-
blockletRender: s,
|
|
296
|
-
locale: a,
|
|
297
|
-
categoryOptions: f,
|
|
298
|
-
priceOptions: H,
|
|
299
|
-
storeApi: d,
|
|
300
|
-
baseSearch: x,
|
|
301
|
-
showResourcesSwitch: T,
|
|
302
|
-
showCategory: $,
|
|
303
|
-
tagFilters: C,
|
|
304
|
-
hasNextPage: !v.noMore,
|
|
305
|
-
onFilterChange: c,
|
|
306
|
-
handleSort: (l) => {
|
|
307
|
-
const p = {
|
|
308
|
-
...i,
|
|
309
|
-
sortBy: l,
|
|
310
|
-
sortDirection: l === "nameAsc" ? "asc" : "desc"
|
|
311
|
-
};
|
|
312
|
-
c(p);
|
|
383
|
+
handleSort: (p) => {
|
|
384
|
+
const g = { ...h, sortBy: p, sortDirection: p === "nameAsc" ? "asc" : "desc" };
|
|
385
|
+
l(g);
|
|
313
386
|
},
|
|
314
|
-
handleKeyword: (
|
|
315
|
-
const
|
|
316
|
-
|
|
387
|
+
handleKeyword: (p) => {
|
|
388
|
+
const g = { ...h, category: void 0, keyword: p || void 0 };
|
|
389
|
+
l(g);
|
|
317
390
|
},
|
|
318
|
-
handlePrice: (
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
price: l === i.price ? void 0 : l
|
|
322
|
-
};
|
|
323
|
-
c(p);
|
|
391
|
+
handlePrice: (p) => {
|
|
392
|
+
const g = { ...h, price: p === h.price ? void 0 : p };
|
|
393
|
+
l(g);
|
|
324
394
|
},
|
|
325
|
-
handleCategory: (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const P = { ...i, category: p };
|
|
329
|
-
c(P);
|
|
395
|
+
handleCategory: (p) => {
|
|
396
|
+
const g = p === "all" || p === h.category ? "" : p, R = { ...h, category: g };
|
|
397
|
+
l(R);
|
|
330
398
|
},
|
|
331
|
-
handleDeveloper: (
|
|
332
|
-
const
|
|
333
|
-
|
|
399
|
+
handleDeveloper: (p) => {
|
|
400
|
+
const g = { ...h, owner: p || void 0 };
|
|
401
|
+
l(g);
|
|
334
402
|
},
|
|
335
|
-
handlePage: (
|
|
336
|
-
const
|
|
337
|
-
|
|
403
|
+
handlePage: (p) => {
|
|
404
|
+
const g = { ...h, currentPage: p };
|
|
405
|
+
l(g);
|
|
338
406
|
},
|
|
339
407
|
handleSwitchShowResources: () => {
|
|
340
|
-
const
|
|
341
|
-
|
|
408
|
+
const p = { ...h };
|
|
409
|
+
l(p);
|
|
342
410
|
},
|
|
343
|
-
loadMore:
|
|
344
|
-
getCategoryLocale: (
|
|
345
|
-
if (!
|
|
411
|
+
loadMore: L.loadMore,
|
|
412
|
+
getCategoryLocale: (p) => {
|
|
413
|
+
if (!p)
|
|
346
414
|
return null;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return P && (p = P.locales[a] || P.locales.en), p;
|
|
415
|
+
const g = X.find((R) => R._id === p);
|
|
416
|
+
return g ? g.locales[n] || g.locales.en : null;
|
|
350
417
|
},
|
|
351
418
|
get developerName() {
|
|
352
|
-
var
|
|
353
|
-
return ((
|
|
354
|
-
var
|
|
355
|
-
return ((
|
|
356
|
-
})) == null ? void 0 :
|
|
419
|
+
var g, R;
|
|
420
|
+
return ((R = (g = ce.find((M) => {
|
|
421
|
+
var ue;
|
|
422
|
+
return ((ue = M == null ? void 0 : M.owner) == null ? void 0 : ue.did) === h.owner;
|
|
423
|
+
})) == null ? void 0 : g.owner) == null ? void 0 : R.name) || "";
|
|
357
424
|
},
|
|
358
|
-
handleSearchSelect:
|
|
425
|
+
handleSearchSelect: c
|
|
359
426
|
};
|
|
360
427
|
return j(() => {
|
|
361
|
-
setTimeout(
|
|
362
|
-
|
|
363
|
-
}, B || 0);
|
|
364
|
-
}, [r]), /* @__PURE__ */ t(Nt, { value: M, children: n });
|
|
428
|
+
setTimeout(se, u || 0);
|
|
429
|
+
}, [o, se, u]), /* @__PURE__ */ t(Ht, { value: Ge, children: r });
|
|
365
430
|
}
|
|
366
|
-
|
|
367
|
-
...
|
|
368
|
-
children:
|
|
431
|
+
ne.propTypes = {
|
|
432
|
+
...ze,
|
|
433
|
+
children: i.any.isRequired
|
|
369
434
|
};
|
|
370
|
-
|
|
371
|
-
function
|
|
372
|
-
const e =
|
|
373
|
-
return e ||
|
|
435
|
+
ne.defaultProps = $e;
|
|
436
|
+
function B() {
|
|
437
|
+
const e = Re(De);
|
|
438
|
+
return e || Fe;
|
|
439
|
+
}
|
|
440
|
+
function Ee({
|
|
441
|
+
children: e,
|
|
442
|
+
onClick: r,
|
|
443
|
+
size: o = 32
|
|
444
|
+
}) {
|
|
445
|
+
return /* @__PURE__ */ t(
|
|
446
|
+
ee,
|
|
447
|
+
{
|
|
448
|
+
onClick: r,
|
|
449
|
+
variant: "outlined",
|
|
450
|
+
sx: {
|
|
451
|
+
minWidth: o,
|
|
452
|
+
height: o,
|
|
453
|
+
p: 0,
|
|
454
|
+
borderColor: "divider",
|
|
455
|
+
"&:hover": {
|
|
456
|
+
borderColor: "divider"
|
|
457
|
+
},
|
|
458
|
+
borderRadius: 2,
|
|
459
|
+
color: "text.secondary"
|
|
460
|
+
},
|
|
461
|
+
children: e
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
function V(e, r) {
|
|
466
|
+
return e === void 0 ? r : e;
|
|
374
467
|
}
|
|
375
|
-
|
|
468
|
+
function G({
|
|
469
|
+
xs: e,
|
|
470
|
+
sm: r,
|
|
471
|
+
md: o,
|
|
472
|
+
lg: n,
|
|
473
|
+
xl: a,
|
|
474
|
+
exact: l
|
|
475
|
+
}) {
|
|
476
|
+
const c = Qe(), d = N(c.breakpoints.down("sm")), s = N(c.breakpoints.between("sm", "md")), v = N(c.breakpoints.between("md", "lg")), f = N(c.breakpoints.between("lg", "xl"));
|
|
477
|
+
if (l)
|
|
478
|
+
return d ? e || null : s ? r || null : v ? o || null : f ? n || null : a || null;
|
|
479
|
+
let y = e;
|
|
480
|
+
return d || (y = V(r, y), s) || (y = V(o, y), v) || (y = V(n, y), f) ? y : V(a, y);
|
|
481
|
+
}
|
|
482
|
+
function Gt({ children: e }) {
|
|
483
|
+
const { open: r, toggleOpen: o } = oe();
|
|
484
|
+
return /* @__PURE__ */ t(
|
|
485
|
+
G,
|
|
486
|
+
{
|
|
487
|
+
xs: /* @__PURE__ */ t(Xe, { open: r, onClose: () => o(!1), children: e }),
|
|
488
|
+
md: /* @__PURE__ */ t(S, { children: e })
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
const Qt = D(ee)`
|
|
376
493
|
border-radius: 4px;
|
|
377
|
-
`,
|
|
378
|
-
|
|
494
|
+
`, le = it(({ children: e, rounded: r, loading: o, disabled: n, ...a }, l) => /* @__PURE__ */ t(
|
|
495
|
+
Qt,
|
|
379
496
|
{
|
|
380
|
-
ref:
|
|
497
|
+
ref: l,
|
|
381
498
|
disableElevation: !0,
|
|
382
|
-
disabled:
|
|
383
|
-
...
|
|
384
|
-
startIcon:
|
|
499
|
+
disabled: n || o,
|
|
500
|
+
...a,
|
|
501
|
+
startIcon: o && /* @__PURE__ */ t(te, { size: "1em" }),
|
|
385
502
|
children: e
|
|
386
503
|
}
|
|
387
504
|
));
|
|
388
|
-
|
|
389
|
-
children:
|
|
390
|
-
rounded:
|
|
391
|
-
loading:
|
|
392
|
-
disabled:
|
|
505
|
+
le.propTypes = {
|
|
506
|
+
children: i.any,
|
|
507
|
+
rounded: i.bool,
|
|
508
|
+
loading: i.bool,
|
|
509
|
+
disabled: i.bool
|
|
393
510
|
};
|
|
394
|
-
|
|
511
|
+
le.defaultProps = {
|
|
395
512
|
children: null,
|
|
396
513
|
rounded: !1,
|
|
397
514
|
loading: !1,
|
|
398
515
|
disabled: !1
|
|
399
516
|
};
|
|
400
|
-
function
|
|
401
|
-
const
|
|
517
|
+
function Q({ title: e, value: r, icon: o, prepend: n, options: a, onChange: l, itemRender: c, ...d }) {
|
|
518
|
+
const s = U(null), v = be(), [f, y] = q(!1), [u, w] = q(r !== null ? r : ""), k = N(v.breakpoints.down("sm"));
|
|
402
519
|
j(() => {
|
|
403
|
-
|
|
404
|
-
}, [
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
}, []),
|
|
408
|
-
|
|
520
|
+
w(r !== null ? r : "");
|
|
521
|
+
}, [r]);
|
|
522
|
+
const x = K(() => {
|
|
523
|
+
y(!1);
|
|
524
|
+
}, []), $ = K(() => {
|
|
525
|
+
y(!0);
|
|
409
526
|
}, []);
|
|
410
|
-
function
|
|
411
|
-
|
|
527
|
+
function b(C) {
|
|
528
|
+
w(C.value), l(C.value), k && x();
|
|
412
529
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
530
|
+
function h(C) {
|
|
531
|
+
return C === u;
|
|
415
532
|
}
|
|
416
|
-
return /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
|
|
533
|
+
return /* @__PURE__ */ m(F, { children: [
|
|
534
|
+
/* @__PURE__ */ m(
|
|
535
|
+
Xt,
|
|
419
536
|
{
|
|
420
|
-
ref:
|
|
421
|
-
onClick:
|
|
537
|
+
ref: s,
|
|
538
|
+
onClick: $,
|
|
422
539
|
variant: "outlined",
|
|
423
540
|
size: "small",
|
|
424
|
-
className: ["my-select__selector",
|
|
541
|
+
className: ["my-select__selector", xt(u) ? "" : "my-select__selector--active"].join(" "),
|
|
425
542
|
sx: { minWidth: "auto" },
|
|
426
|
-
...
|
|
543
|
+
...d,
|
|
427
544
|
children: [
|
|
428
|
-
/* @__PURE__ */ t("div", { className: "my-select__icon", children:
|
|
545
|
+
/* @__PURE__ */ t("div", { className: "my-select__icon", children: o }),
|
|
429
546
|
e,
|
|
430
|
-
/* @__PURE__ */ t(
|
|
547
|
+
/* @__PURE__ */ t(Je, { className: "my-select__arrowdown", component: bt, fontSize: "small" })
|
|
431
548
|
]
|
|
432
549
|
}
|
|
433
550
|
),
|
|
434
|
-
/* @__PURE__ */ t(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
551
|
+
/* @__PURE__ */ t(Ke, { open: f, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: C, placement: _ }) => /* @__PURE__ */ t(Ze, { ...C, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(et, { children: /* @__PURE__ */ t(tt, { onClickAway: x, children: /* @__PURE__ */ m(Yt, { autoFocusItem: f, onMouseEnter: $, onMouseLeave: x, children: [
|
|
552
|
+
n,
|
|
553
|
+
a.map((A) => c ? c(A) : /* @__PURE__ */ t(
|
|
554
|
+
rt,
|
|
438
555
|
{
|
|
439
|
-
onClick: () =>
|
|
556
|
+
onClick: () => b(A),
|
|
440
557
|
className: [
|
|
441
558
|
"my-select__option",
|
|
442
|
-
|
|
559
|
+
h(A.value) ? "my-select__option--active" : ""
|
|
443
560
|
].join(" "),
|
|
444
|
-
children:
|
|
561
|
+
children: A.name
|
|
445
562
|
},
|
|
446
|
-
|
|
563
|
+
A.value
|
|
447
564
|
))
|
|
448
565
|
] }) }) }) }) })
|
|
449
566
|
] });
|
|
450
567
|
}
|
|
451
|
-
|
|
452
|
-
options:
|
|
453
|
-
value:
|
|
454
|
-
onChange:
|
|
455
|
-
itemRender:
|
|
456
|
-
title:
|
|
457
|
-
icon:
|
|
458
|
-
prepend:
|
|
568
|
+
Q.propTypes = {
|
|
569
|
+
options: i.array.isRequired,
|
|
570
|
+
value: i.oneOfType([i.string, i.number, i.array]),
|
|
571
|
+
onChange: i.func,
|
|
572
|
+
itemRender: i.func,
|
|
573
|
+
title: i.string.isRequired,
|
|
574
|
+
icon: i.any,
|
|
575
|
+
prepend: i.any
|
|
459
576
|
};
|
|
460
|
-
|
|
577
|
+
Q.defaultProps = {
|
|
461
578
|
value: null,
|
|
462
579
|
icon: null,
|
|
463
580
|
prepend: null,
|
|
@@ -465,11 +582,11 @@ ce.defaultProps = {
|
|
|
465
582
|
onChange: () => {
|
|
466
583
|
}
|
|
467
584
|
};
|
|
468
|
-
const
|
|
585
|
+
const Xt = D(le)`
|
|
469
586
|
border: 1px solid #f0f0f0;
|
|
470
587
|
padding: 6px 8px 6px 12px;
|
|
471
|
-
font-weight: ${(e) => e.theme.typography.
|
|
472
|
-
font-size:
|
|
588
|
+
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
589
|
+
font-size: 14px;
|
|
473
590
|
color: #666;
|
|
474
591
|
line-height: 1;
|
|
475
592
|
text-transform: none;
|
|
@@ -485,7 +602,7 @@ const Mt = R(se)`
|
|
|
485
602
|
}
|
|
486
603
|
.my-select__arrowdown {
|
|
487
604
|
color: #999;
|
|
488
|
-
font-size:
|
|
605
|
+
font-size: 14px;
|
|
489
606
|
margin-left: 6px;
|
|
490
607
|
}
|
|
491
608
|
.my-select__icon {
|
|
@@ -496,14 +613,14 @@ const Mt = R(se)`
|
|
|
496
613
|
margin-right: 3px;
|
|
497
614
|
}
|
|
498
615
|
}
|
|
499
|
-
`,
|
|
616
|
+
`, Yt = D(Ye)`
|
|
500
617
|
.my-select__option__icon {
|
|
501
618
|
color: transparent;
|
|
502
|
-
font-size:
|
|
619
|
+
font-size: 14px;
|
|
503
620
|
margin: 0 3px 0 -5px;
|
|
504
621
|
}
|
|
505
622
|
.my-select__option {
|
|
506
|
-
font-size:
|
|
623
|
+
font-size: 14px;
|
|
507
624
|
color: #999;
|
|
508
625
|
}
|
|
509
626
|
.my-select__option--active {
|
|
@@ -513,268 +630,463 @@ const Mt = R(se)`
|
|
|
513
630
|
}
|
|
514
631
|
}
|
|
515
632
|
`;
|
|
516
|
-
function
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
633
|
+
function Me() {
|
|
634
|
+
var c;
|
|
635
|
+
const { filters: e, handleSort: r, handlePrice: o, t: n } = B(), a = _e(n), l = ((c = a.find((d) => d.value === e.sortBy)) == null ? void 0 : c.name) || n("sort.sort");
|
|
636
|
+
return /* @__PURE__ */ m(
|
|
637
|
+
T,
|
|
638
|
+
{
|
|
639
|
+
direction: { xs: "row", md: "column" },
|
|
640
|
+
alignItems: { xs: "center", md: "flex-start" },
|
|
641
|
+
gap: { xs: 1, md: 2 },
|
|
642
|
+
width: { xs: "100%", md: "auto" },
|
|
643
|
+
justifyContent: "space-between",
|
|
644
|
+
children: [
|
|
645
|
+
/* @__PURE__ */ t(
|
|
646
|
+
ke,
|
|
647
|
+
{
|
|
648
|
+
control: /* @__PURE__ */ t(
|
|
649
|
+
ve,
|
|
650
|
+
{
|
|
651
|
+
checked: e.price === "free",
|
|
652
|
+
size: "small",
|
|
653
|
+
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
654
|
+
onChange: (d) => o(d.target.checked ? "free" : "")
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
label: n("blocklet.free")
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
/* @__PURE__ */ t(
|
|
661
|
+
Q,
|
|
662
|
+
{
|
|
663
|
+
value: e.sortBy,
|
|
664
|
+
options: a,
|
|
665
|
+
title: l,
|
|
666
|
+
onChange: r,
|
|
667
|
+
icon: null,
|
|
668
|
+
prepend: null,
|
|
669
|
+
itemRender: null
|
|
670
|
+
}
|
|
671
|
+
)
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
function Jt() {
|
|
677
|
+
const { selectedCategory: e, handleCategory: r, t: o, categoryOptions: n, filters: a, cleanFilter: l, loadings: c } = B(), { toggleOpen: d } = oe();
|
|
678
|
+
return /* @__PURE__ */ m(Gt, { children: [
|
|
679
|
+
/* @__PURE__ */ t(
|
|
680
|
+
G,
|
|
521
681
|
{
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
682
|
+
xs: /* @__PURE__ */ m(
|
|
683
|
+
T,
|
|
684
|
+
{
|
|
685
|
+
direction: "row",
|
|
686
|
+
justifyContent: "space-between",
|
|
687
|
+
alignItems: "center",
|
|
688
|
+
p: 2,
|
|
689
|
+
mb: 0.5,
|
|
690
|
+
gap: 2,
|
|
691
|
+
borderBottom: 1,
|
|
692
|
+
borderColor: "divider",
|
|
693
|
+
children: [
|
|
694
|
+
/* @__PURE__ */ t(Ee, { onClick: () => d(!1), children: /* @__PURE__ */ t(Se, {}) }),
|
|
695
|
+
/* @__PURE__ */ t(I, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
md: null
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ t(
|
|
703
|
+
T,
|
|
704
|
+
{
|
|
705
|
+
visibility: c.fetchCategoriesLoading ? "hidden" : "visible",
|
|
706
|
+
width: { xs: 268, md: 200 },
|
|
707
|
+
boxSizing: "content-box",
|
|
708
|
+
p: { xs: 2, md: 0 },
|
|
709
|
+
pr: { md: 6 },
|
|
710
|
+
children: a.keyword ? /* @__PURE__ */ t(Me, {}) : /* @__PURE__ */ m(F, { children: [
|
|
711
|
+
/* @__PURE__ */ m(S, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
712
|
+
/* @__PURE__ */ t(Ce, { icon: at }),
|
|
713
|
+
/* @__PURE__ */ t(
|
|
714
|
+
I,
|
|
715
|
+
{
|
|
716
|
+
variant: "body1",
|
|
717
|
+
color: e ? "text.lighter" : "text.primary",
|
|
718
|
+
fontWeight: e ? void 0 : "fontWeightMedium",
|
|
719
|
+
sx: { cursor: "pointer" },
|
|
720
|
+
onClick: () => {
|
|
721
|
+
d(!1), l();
|
|
722
|
+
},
|
|
723
|
+
children: o("explore.title")
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] }),
|
|
727
|
+
!!n.length && /* @__PURE__ */ t(T, { pt: 3, mt: 3, borderTop: 1, borderColor: "divider", gap: 2, children: n.map((s) => /* @__PURE__ */ t(
|
|
728
|
+
I,
|
|
729
|
+
{
|
|
730
|
+
variant: "body1",
|
|
731
|
+
title: s.name,
|
|
732
|
+
sx: { cursor: "pointer" },
|
|
733
|
+
"data-cy": "filter",
|
|
734
|
+
color: e === s.value ? "text.primary" : "text.lighter",
|
|
735
|
+
textTransform: "capitalize",
|
|
736
|
+
onClick: () => {
|
|
737
|
+
e === s.value ? l() : r(s.value), d(!1);
|
|
738
|
+
},
|
|
739
|
+
children: s.name
|
|
740
|
+
},
|
|
741
|
+
s.value
|
|
742
|
+
)) })
|
|
743
|
+
] })
|
|
744
|
+
}
|
|
745
|
+
)
|
|
530
746
|
] });
|
|
531
747
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
text-overflow: ellipsis;
|
|
546
|
-
white-space: nowrap;
|
|
547
|
-
text-transform: capitalize;
|
|
548
|
-
cursor: pointer;
|
|
549
|
-
&:hover {
|
|
550
|
-
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
551
|
-
color: initial;
|
|
552
|
-
font-weight: bold;
|
|
748
|
+
function Ne() {
|
|
749
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = B(), n = Ae(r, o), a = E(() => Pe.create({
|
|
750
|
+
baseURL: e,
|
|
751
|
+
headers: n
|
|
752
|
+
}), [e]);
|
|
753
|
+
return {
|
|
754
|
+
get: async (l) => {
|
|
755
|
+
const { data: c } = await a.get(l);
|
|
756
|
+
return c;
|
|
757
|
+
},
|
|
758
|
+
post: async (l, c) => {
|
|
759
|
+
const { data: d } = await a.post(l, c);
|
|
760
|
+
return d;
|
|
553
761
|
}
|
|
554
|
-
}
|
|
555
|
-
.select {
|
|
556
|
-
color: ${(e) => e.theme.palette.primary.main};
|
|
557
|
-
font-weight: bold;
|
|
558
|
-
}
|
|
559
|
-
`;
|
|
560
|
-
U.propTypes = {
|
|
561
|
-
title: o.string.isRequired,
|
|
562
|
-
options: o.array.isRequired,
|
|
563
|
-
onChange: o.func.isRequired,
|
|
564
|
-
value: o.oneOfType([o.string, o.number])
|
|
565
|
-
};
|
|
566
|
-
U.defaultProps = {
|
|
567
|
-
value: null
|
|
568
|
-
};
|
|
569
|
-
function pe() {
|
|
570
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: w } = L(), [g, m] = E(!1), x = (u, S) => {
|
|
571
|
-
u === "category" && n(S), u === "price" && a(S), m(!1);
|
|
572
762
|
};
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
) })
|
|
598
|
-
] })
|
|
763
|
+
}
|
|
764
|
+
const Oe = st(function(r) {
|
|
765
|
+
return /* @__PURE__ */ t(Te, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(te, {}) });
|
|
766
|
+
});
|
|
767
|
+
function fe({
|
|
768
|
+
icon: e,
|
|
769
|
+
children: r,
|
|
770
|
+
maxWidth: o = 100,
|
|
771
|
+
title: n
|
|
772
|
+
}) {
|
|
773
|
+
return (r === 0 || r) && /* @__PURE__ */ m(T, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
774
|
+
e,
|
|
775
|
+
/* @__PURE__ */ t(
|
|
776
|
+
I,
|
|
777
|
+
{
|
|
778
|
+
flex: 1,
|
|
779
|
+
variant: "body2",
|
|
780
|
+
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
781
|
+
title: n || (typeof r == "string" ? r : void 0),
|
|
782
|
+
children: r
|
|
783
|
+
}
|
|
784
|
+
)
|
|
599
785
|
] });
|
|
600
786
|
}
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
787
|
+
const ge = 292;
|
|
788
|
+
function Kt() {
|
|
789
|
+
var f, y;
|
|
790
|
+
const { t: e } = B(), { post: r } = Ne(), o = ((y = (f = window.blocklet) == null ? void 0 : f.preferences) == null ? void 0 : y.homeBanner) || [], { data: n = [] } = re(async () => {
|
|
791
|
+
const u = await r(P.exploreDidsPath, { didList: o.map((w) => w.did) });
|
|
792
|
+
return Array.isArray(u) ? u : [];
|
|
793
|
+
}), a = {
|
|
794
|
+
position: "absolute",
|
|
795
|
+
top: "50%",
|
|
796
|
+
transform: "translateY(-50%)",
|
|
797
|
+
zIndex: 100,
|
|
798
|
+
cursor: "pointer",
|
|
799
|
+
color: "text.lighter"
|
|
800
|
+
};
|
|
801
|
+
return o.length > 0 ? /* @__PURE__ */ m(F, { children: [
|
|
802
|
+
/* @__PURE__ */ t(I, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
803
|
+
/* @__PURE__ */ t(S, { height: { xs: "auto", md: ge }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
|
|
804
|
+
St,
|
|
805
|
+
{
|
|
806
|
+
showNav: !0,
|
|
807
|
+
autoPlay: !0,
|
|
808
|
+
slideDuration: 1e3,
|
|
809
|
+
slideInterval: 5e3,
|
|
810
|
+
showPlayButton: !1,
|
|
811
|
+
showIndex: !1,
|
|
812
|
+
showBullets: !1,
|
|
813
|
+
showThumbnails: !1,
|
|
814
|
+
showFullscreenButton: !1,
|
|
815
|
+
renderLeftNav: (u) => /* @__PURE__ */ t(S, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(vt, { sx: { ...a, left: 5 } }) }),
|
|
816
|
+
renderRightNav: (u) => /* @__PURE__ */ t(S, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ct, { sx: { ...a, right: 5 } }) }),
|
|
817
|
+
items: o.map((u, w) => ({
|
|
818
|
+
original: u.did,
|
|
819
|
+
renderItem: () => {
|
|
820
|
+
var x;
|
|
821
|
+
const k = n[w] || {};
|
|
822
|
+
return /* @__PURE__ */ m(
|
|
823
|
+
T,
|
|
824
|
+
{
|
|
825
|
+
height: { xs: "auto", md: ge },
|
|
826
|
+
display: "flex",
|
|
827
|
+
direction: { xs: "column", md: "row" },
|
|
828
|
+
justifyContent: "center",
|
|
829
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
830
|
+
p: { xs: 2, md: 5 },
|
|
831
|
+
gap: { xs: 2, md: 5 },
|
|
832
|
+
children: [
|
|
833
|
+
l(u.cover || ((x = k.screenshots) == null ? void 0 : x[0])),
|
|
834
|
+
/* @__PURE__ */ m(T, { flex: 1, height: "100%", gap: 3, children: [
|
|
835
|
+
/* @__PURE__ */ m(S, { flex: 1, children: [
|
|
836
|
+
c(u.name || k.title || u.name),
|
|
837
|
+
d(u.desc || k.description)
|
|
838
|
+
] }),
|
|
839
|
+
k.did && s(k, u.baseNum),
|
|
840
|
+
v(u.link, u.did)
|
|
841
|
+
] })
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
}))
|
|
847
|
+
}
|
|
848
|
+
) })
|
|
849
|
+
] }) : null;
|
|
850
|
+
function l(u) {
|
|
851
|
+
return /* @__PURE__ */ t(S, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", children: /* @__PURE__ */ t("img", { src: u, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) });
|
|
606
852
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
color: ${(e) => e.theme.palette.grey[500]};
|
|
853
|
+
function c(u) {
|
|
854
|
+
return /* @__PURE__ */ t(I, { variant: "h2", width: "100%", children: u });
|
|
610
855
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
856
|
+
function d(u) {
|
|
857
|
+
return /* @__PURE__ */ t(
|
|
858
|
+
I,
|
|
859
|
+
{
|
|
860
|
+
variant: "body2",
|
|
861
|
+
color: "text.secondary",
|
|
862
|
+
textAlign: "left",
|
|
863
|
+
width: "100%",
|
|
864
|
+
pt: 1,
|
|
865
|
+
sx: {
|
|
866
|
+
display: "-webkit-box",
|
|
867
|
+
lineClamp: 3,
|
|
868
|
+
WebkitLineClamp: 3,
|
|
869
|
+
maxHeight: 71,
|
|
870
|
+
textWrap: "wrap",
|
|
871
|
+
overflow: "hidden",
|
|
872
|
+
WebkitBoxOrient: "vertical"
|
|
873
|
+
},
|
|
874
|
+
children: u
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
function s(u, w = 0) {
|
|
879
|
+
const { did: k, owner: x, stats: $ } = u;
|
|
880
|
+
return /* @__PURE__ */ m(S, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
881
|
+
/* @__PURE__ */ t(fe, { icon: /* @__PURE__ */ t(wt, { src: x.avatar, did: k, size: 20, variant: "circle" }), children: x.fullName }),
|
|
882
|
+
/* @__PURE__ */ t(fe, { icon: /* @__PURE__ */ t(Ce, { icon: kt }), title: `${$.downloads + w}`, children: Zt($.downloads + w) })
|
|
883
|
+
] });
|
|
884
|
+
}
|
|
885
|
+
function v(u, w) {
|
|
886
|
+
return /* @__PURE__ */ t(ot, { href: u || `/blocklets/${w}`, align: "left", width: 100, children: /* @__PURE__ */ t(
|
|
887
|
+
ee,
|
|
888
|
+
{
|
|
889
|
+
variant: "outlined",
|
|
890
|
+
size: "small",
|
|
891
|
+
fullWidth: !0,
|
|
892
|
+
sx: {
|
|
893
|
+
bgcolor: "white",
|
|
894
|
+
borderColor: "divider",
|
|
895
|
+
"&:hover": { borderColor: "divider" }
|
|
896
|
+
},
|
|
897
|
+
children: e("explore.viewDetail")
|
|
898
|
+
}
|
|
899
|
+
) });
|
|
621
900
|
}
|
|
622
|
-
`;
|
|
623
|
-
function q({ label: e, icon: n, onDelete: r, ...a }) {
|
|
624
|
-
return e ? /* @__PURE__ */ t(Et, { ...a, children: /* @__PURE__ */ t(Ce, { color: "primary", "data-cy": "filter-tag", icon: n, label: e, onDelete: r }) }) : null;
|
|
625
901
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
icon: null,
|
|
634
|
-
label: null
|
|
635
|
-
};
|
|
636
|
-
function we() {
|
|
637
|
-
const { t: e } = L();
|
|
638
|
-
return /* @__PURE__ */ t(Re, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
902
|
+
const Zt = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`;
|
|
903
|
+
function er({ title: e, blocklets: r }) {
|
|
904
|
+
const { blockletRender: o, serverVersion: n } = B();
|
|
905
|
+
return /* @__PURE__ */ m(S, { mt: 3, children: [
|
|
906
|
+
/* @__PURE__ */ t(I, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
907
|
+
/* @__PURE__ */ t(pe, { container: !0, spacing: 2, children: r.map((a) => /* @__PURE__ */ t(pe, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": a.did, children: /* @__PURE__ */ t(S, { padding: "1px", children: o({ blocklet: a, blocklets: r, serverVersion: n }) }) }, a.did)) })
|
|
908
|
+
] });
|
|
639
909
|
}
|
|
640
|
-
function
|
|
641
|
-
const {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
910
|
+
function tr() {
|
|
911
|
+
const { get: e } = Ne(), { t: r } = B(), {
|
|
912
|
+
data: o = [],
|
|
913
|
+
error: n,
|
|
914
|
+
loading: a
|
|
915
|
+
} = re(async () => {
|
|
916
|
+
const l = await e(P.explorePath);
|
|
917
|
+
return Array.isArray(l) ? l : [];
|
|
918
|
+
});
|
|
919
|
+
return n ? /* @__PURE__ */ t(Z, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : a ? /* @__PURE__ */ t(Oe, { mt: 15 }) : /* @__PURE__ */ m(F, { children: [
|
|
920
|
+
/* @__PURE__ */ t(Kt, {}),
|
|
921
|
+
o.map(
|
|
922
|
+
(l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(er, { title: r(`explore.${l.type}`), blocklets: l.blocklets }, l.type) : null
|
|
923
|
+
)
|
|
647
924
|
] });
|
|
648
925
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
926
|
+
function rr() {
|
|
927
|
+
var d;
|
|
928
|
+
const { filters: e, handleSort: r, handlePrice: o, t: n, getCategoryLocale: a } = B(), l = _e(n), c = ((d = l.find((s) => s.value === e.sortBy)) == null ? void 0 : d.name) || n("sort.sort");
|
|
929
|
+
return /* @__PURE__ */ m(
|
|
930
|
+
T,
|
|
931
|
+
{
|
|
932
|
+
direction: { xs: "column", md: "row" },
|
|
933
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
934
|
+
justifyContent: "space-between",
|
|
935
|
+
spacing: { xs: 1, md: 0 },
|
|
936
|
+
pt: { xs: 2, md: 0 },
|
|
937
|
+
px: 0,
|
|
938
|
+
pb: 3,
|
|
939
|
+
children: [
|
|
940
|
+
/* @__PURE__ */ t(I, { variant: "h2", textTransform: "capitalize", children: a(e.category) }),
|
|
941
|
+
/* @__PURE__ */ m(T, { direction: "row", alignItems: "center", width: { xs: "100%", md: "auto" }, justifyContent: "space-between", children: [
|
|
942
|
+
/* @__PURE__ */ t(
|
|
943
|
+
ke,
|
|
944
|
+
{
|
|
945
|
+
control: /* @__PURE__ */ t(
|
|
946
|
+
ve,
|
|
947
|
+
{
|
|
948
|
+
checked: e.price === "free",
|
|
949
|
+
size: "small",
|
|
950
|
+
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
951
|
+
onChange: (s) => o(s.target.checked ? "free" : "")
|
|
952
|
+
}
|
|
953
|
+
),
|
|
954
|
+
label: n("blocklet.free")
|
|
955
|
+
}
|
|
956
|
+
),
|
|
957
|
+
/* @__PURE__ */ t(
|
|
958
|
+
Q,
|
|
959
|
+
{
|
|
960
|
+
value: e.sortBy,
|
|
961
|
+
options: l,
|
|
962
|
+
title: c,
|
|
963
|
+
onChange: r,
|
|
964
|
+
icon: null,
|
|
965
|
+
prepend: null,
|
|
966
|
+
itemRender: null
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
] })
|
|
970
|
+
]
|
|
971
|
+
}
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
function ye() {
|
|
975
|
+
const { t: e } = B();
|
|
976
|
+
return /* @__PURE__ */ t(Ie, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
977
|
+
}
|
|
978
|
+
function O({ filterTip: e, keywordTip: r }) {
|
|
979
|
+
const { t: o, locale: n } = B(), a = () => n === "zh" ? "、" : " , ";
|
|
980
|
+
return /* @__PURE__ */ m(Te, { className: "tips", children: [
|
|
981
|
+
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
982
|
+
e && /* @__PURE__ */ t("span", { children: o("blocklet.filterTip") }),
|
|
983
|
+
e && r && a(),
|
|
984
|
+
r && /* @__PURE__ */ t("span", { children: o("blocklet.keywordTip") })
|
|
985
|
+
] });
|
|
986
|
+
}
|
|
987
|
+
O.propTypes = {
|
|
988
|
+
filterTip: i.bool,
|
|
989
|
+
keywordTip: i.bool
|
|
652
990
|
};
|
|
653
|
-
|
|
991
|
+
O.defaultProps = {
|
|
654
992
|
filterTip: !1,
|
|
655
993
|
keywordTip: !1
|
|
656
994
|
};
|
|
657
|
-
function
|
|
658
|
-
return /* @__PURE__ */
|
|
995
|
+
function H({ primaryStart: e, primaryEnd: r, filter: o }) {
|
|
996
|
+
return /* @__PURE__ */ m(Ie, { variant: "subtitle2", children: [
|
|
659
997
|
/* @__PURE__ */ t("span", { children: e }),
|
|
660
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ m("span", { className: "primary", children: [
|
|
661
999
|
" ",
|
|
662
|
-
|
|
1000
|
+
o,
|
|
663
1001
|
" "
|
|
664
1002
|
] }),
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
|
|
1003
|
+
/* @__PURE__ */ m("span", { children: [
|
|
1004
|
+
r,
|
|
667
1005
|
" "
|
|
668
1006
|
] })
|
|
669
1007
|
] });
|
|
670
1008
|
}
|
|
671
|
-
|
|
672
|
-
primaryStart:
|
|
673
|
-
primaryEnd:
|
|
674
|
-
filter:
|
|
675
|
-
};
|
|
676
|
-
function qt(e) {
|
|
677
|
-
return e ? e.width > 900 ? 12 : e.width > 600 ? 8 : 4 : 0;
|
|
678
|
-
}
|
|
679
|
-
function ze({ children: e }) {
|
|
680
|
-
const n = J(null), [r, a] = E(null), s = Ze(r);
|
|
681
|
-
return j(() => {
|
|
682
|
-
r || a(n.current);
|
|
683
|
-
}, [r]), e(n, qt(s));
|
|
684
|
-
}
|
|
685
|
-
ze.propTypes = {
|
|
686
|
-
children: o.func.isRequired
|
|
1009
|
+
H.propTypes = {
|
|
1010
|
+
primaryStart: i.string.isRequired,
|
|
1011
|
+
primaryEnd: i.string.isRequired,
|
|
1012
|
+
filter: i.string.isRequired
|
|
687
1013
|
};
|
|
688
|
-
function
|
|
1014
|
+
function qe({ blocklets: e, ...r }) {
|
|
689
1015
|
const {
|
|
690
|
-
blockletRender:
|
|
691
|
-
errors:
|
|
692
|
-
loadings:
|
|
693
|
-
selectedCategory:
|
|
694
|
-
getCategoryLocale:
|
|
695
|
-
filters:
|
|
696
|
-
t:
|
|
697
|
-
serverVersion:
|
|
698
|
-
hasNextPage:
|
|
699
|
-
loadMore:
|
|
700
|
-
endpoint:
|
|
701
|
-
} =
|
|
702
|
-
loading:
|
|
703
|
-
hasNextPage:
|
|
704
|
-
onLoadMore:
|
|
1016
|
+
blockletRender: o,
|
|
1017
|
+
errors: n,
|
|
1018
|
+
loadings: a,
|
|
1019
|
+
selectedCategory: l,
|
|
1020
|
+
getCategoryLocale: c,
|
|
1021
|
+
filters: d,
|
|
1022
|
+
t: s,
|
|
1023
|
+
serverVersion: v,
|
|
1024
|
+
hasNextPage: f,
|
|
1025
|
+
loadMore: y,
|
|
1026
|
+
endpoint: u
|
|
1027
|
+
} = B(), w = !!l || !!d.price, [k] = Rt({
|
|
1028
|
+
loading: a.fetchBlockletsLoading || a.loadingMore,
|
|
1029
|
+
hasNextPage: f,
|
|
1030
|
+
onLoadMore: y
|
|
705
1031
|
});
|
|
706
|
-
if (
|
|
1032
|
+
if (n.fetchBlockletsError)
|
|
707
1033
|
return /* @__PURE__ */ t(
|
|
708
|
-
|
|
1034
|
+
Z,
|
|
709
1035
|
{
|
|
710
|
-
error: new Error(`Failed to fetch blocklets from ${
|
|
1036
|
+
error: new Error(`Failed to fetch blocklets from ${u}: ${n.fetchBlockletsError.message}`)
|
|
711
1037
|
}
|
|
712
1038
|
);
|
|
713
|
-
if (
|
|
714
|
-
return /* @__PURE__ */ t(
|
|
715
|
-
if (
|
|
716
|
-
return /* @__PURE__ */
|
|
1039
|
+
if (a.fetchBlockletsLoading)
|
|
1040
|
+
return /* @__PURE__ */ t(Oe, { mt: 15 });
|
|
1041
|
+
if (d.keyword && w && e.length === 0)
|
|
1042
|
+
return /* @__PURE__ */ m(W, { children: [
|
|
717
1043
|
/* @__PURE__ */ t(
|
|
718
|
-
|
|
1044
|
+
H,
|
|
719
1045
|
{
|
|
720
|
-
primaryStart:
|
|
721
|
-
primaryEnd:
|
|
722
|
-
filter:
|
|
1046
|
+
primaryStart: s("blocklet.noBlockletPart1"),
|
|
1047
|
+
primaryEnd: s("blocklet.noBlockletPart2"),
|
|
1048
|
+
filter: d.keyword
|
|
723
1049
|
}
|
|
724
1050
|
),
|
|
725
|
-
/* @__PURE__ */ t(
|
|
1051
|
+
/* @__PURE__ */ t(O, { keywordTip: !0, filterTip: !0 })
|
|
726
1052
|
] });
|
|
727
|
-
if (
|
|
728
|
-
return /* @__PURE__ */
|
|
1053
|
+
if (d.keyword && e.length === 0)
|
|
1054
|
+
return /* @__PURE__ */ m(W, { children: [
|
|
729
1055
|
/* @__PURE__ */ t(
|
|
730
|
-
|
|
1056
|
+
H,
|
|
731
1057
|
{
|
|
732
|
-
primaryStart:
|
|
733
|
-
primaryEnd:
|
|
734
|
-
filter:
|
|
1058
|
+
primaryStart: s("blocklet.noBlockletPart1"),
|
|
1059
|
+
primaryEnd: s("blocklet.noBlockletPart2"),
|
|
1060
|
+
filter: d.keyword
|
|
735
1061
|
}
|
|
736
1062
|
),
|
|
737
|
-
/* @__PURE__ */ t(
|
|
1063
|
+
/* @__PURE__ */ t(O, { keywordTip: !0 })
|
|
738
1064
|
] });
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
741
|
-
return /* @__PURE__ */
|
|
742
|
-
|
|
743
|
-
|
|
1065
|
+
if (w && e.length === 0) {
|
|
1066
|
+
const x = c(l);
|
|
1067
|
+
return /* @__PURE__ */ m(W, { children: [
|
|
1068
|
+
x ? /* @__PURE__ */ t(
|
|
1069
|
+
H,
|
|
744
1070
|
{
|
|
745
|
-
primaryStart:
|
|
746
|
-
primaryEnd:
|
|
747
|
-
filter:
|
|
1071
|
+
primaryStart: s("blocklet.noCategoryResults1"),
|
|
1072
|
+
primaryEnd: s("blocklet.noCategoryResults2"),
|
|
1073
|
+
filter: x
|
|
748
1074
|
}
|
|
749
|
-
) : /* @__PURE__ */ t(
|
|
750
|
-
/* @__PURE__ */ t(
|
|
1075
|
+
) : /* @__PURE__ */ t(ye, {}),
|
|
1076
|
+
/* @__PURE__ */ t(O, { filterTip: !0 })
|
|
751
1077
|
] });
|
|
752
1078
|
}
|
|
753
|
-
return e.length === 0 ? /* @__PURE__ */ t(
|
|
754
|
-
|
|
755
|
-
{
|
|
756
|
-
|
|
757
|
-
container: !0,
|
|
758
|
-
spacing: 2,
|
|
759
|
-
columns: y,
|
|
760
|
-
disableEqualOverflow: !0,
|
|
761
|
-
ref: C,
|
|
762
|
-
sx: {
|
|
763
|
-
opacity: () => y > 0 ? 1 : 0
|
|
764
|
-
},
|
|
765
|
-
children: [
|
|
766
|
-
e.map((d) => /* @__PURE__ */ t(te, { xs: 6, "data-blocklet-did": d.did, children: r({ blocklet: d, blocklets: e, serverVersion: x }) }, d.did)),
|
|
767
|
-
u && /* @__PURE__ */ t(te, { xs: 12, ref: $, children: /* @__PURE__ */ t(_, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) }) })
|
|
768
|
-
]
|
|
769
|
-
}
|
|
770
|
-
) });
|
|
1079
|
+
return e.length === 0 ? /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(ye, {}) }) : /* @__PURE__ */ m(F, { children: [
|
|
1080
|
+
/* @__PURE__ */ t(S, { display: "grid", gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }, p: "2px", ...r, gap: 2, children: e.map((x) => /* @__PURE__ */ t(S, { "data-blocklet-did": x.did, children: o({ blocklet: x, blocklets: e, serverVersion: v }) }, x.did)) }),
|
|
1081
|
+
f && /* @__PURE__ */ t(S, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: k, children: /* @__PURE__ */ t(te, {}) })
|
|
1082
|
+
] });
|
|
771
1083
|
}
|
|
772
|
-
|
|
773
|
-
blocklets:
|
|
1084
|
+
qe.propTypes = {
|
|
1085
|
+
blocklets: i.array.isRequired
|
|
774
1086
|
};
|
|
775
|
-
|
|
776
|
-
const Y = R(ft)`
|
|
1087
|
+
const W = D(Bt)`
|
|
777
1088
|
text-align: center;
|
|
1089
|
+
margin-top: 100px;
|
|
778
1090
|
.primary {
|
|
779
1091
|
color: ${(e) => e.theme.palette.primary.main};
|
|
780
1092
|
}
|
|
@@ -782,124 +1094,38 @@ const Y = R(ft)`
|
|
|
782
1094
|
margin-top: ${(e) => e.theme.spacing(1)};
|
|
783
1095
|
}
|
|
784
1096
|
`;
|
|
785
|
-
function
|
|
786
|
-
const {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
onChange: n
|
|
796
|
-
}
|
|
797
|
-
) })
|
|
798
|
-
] });
|
|
799
|
-
}
|
|
800
|
-
const jt = R("aside")`
|
|
801
|
-
width: 220px;
|
|
802
|
-
margin-right: ${(e) => e.theme.spacing(2)};
|
|
803
|
-
height: 100%;
|
|
804
|
-
position: sticky;
|
|
805
|
-
top: 0;
|
|
806
|
-
overflow-y: auto;
|
|
807
|
-
z-index: auto;
|
|
808
|
-
`;
|
|
809
|
-
de.propTypes = {};
|
|
810
|
-
de.defaultProps = {};
|
|
811
|
-
function me({ placeholder: e, ...n }) {
|
|
812
|
-
const { filters: r, handleKeyword: a } = L(), [s, c] = E(r.keyword || ""), w = et(a, { wait: 300 }), g = (x) => {
|
|
813
|
-
const { value: u } = x.target;
|
|
814
|
-
c(u), w.run(u);
|
|
815
|
-
}, m = () => {
|
|
816
|
-
c(""), a();
|
|
817
|
-
};
|
|
818
|
-
return j(() => {
|
|
819
|
-
c(r.keyword || "");
|
|
820
|
-
}, [r.keyword]), /* @__PURE__ */ t(
|
|
821
|
-
Ut,
|
|
822
|
-
{
|
|
823
|
-
inputProps: {
|
|
824
|
-
"data-cy": "search-blocklet"
|
|
825
|
-
},
|
|
826
|
-
startAdornment: /* @__PURE__ */ t(ge, { position: "start", children: /* @__PURE__ */ t(Vt, {}) }),
|
|
827
|
-
onChange: g,
|
|
828
|
-
placeholder: e,
|
|
829
|
-
value: s,
|
|
830
|
-
title: e,
|
|
831
|
-
"data-cy": "search",
|
|
832
|
-
endAdornment: s && /* @__PURE__ */ t(ge, { position: "end", children: /* @__PURE__ */ t(Wt, { "data-cy": "search-delete", onClick: m }) }),
|
|
833
|
-
...n
|
|
834
|
-
}
|
|
835
|
-
);
|
|
836
|
-
}
|
|
837
|
-
me.propTypes = {
|
|
838
|
-
placeholder: o.string
|
|
839
|
-
};
|
|
840
|
-
me.defaultProps = {
|
|
841
|
-
placeholder: "Type to search..."
|
|
842
|
-
};
|
|
843
|
-
const Ut = R(je)`
|
|
844
|
-
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
845
|
-
font-size: 14px;
|
|
846
|
-
border-radius: 6px;
|
|
847
|
-
width: 100%;
|
|
848
|
-
.MuiInputBase-input {
|
|
849
|
-
padding: 8px 0 8px 10px;
|
|
850
|
-
}
|
|
851
|
-
.MuiOutlinedInput-notchedOutline {
|
|
852
|
-
border: none;
|
|
853
|
-
}
|
|
854
|
-
.Mui-focused {
|
|
855
|
-
background-color: #f6f6f6;
|
|
856
|
-
.MuiInputBase-input::placeholder {
|
|
857
|
-
color: transparent;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
`, Vt = R(bt)`
|
|
861
|
-
color: ${(e) => e.theme.palette.grey[500]};
|
|
862
|
-
font-size: 28px;
|
|
863
|
-
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
864
|
-
font-size: 24px;
|
|
865
|
-
}
|
|
866
|
-
`, Wt = R(wt)`
|
|
867
|
-
color: ${(e) => e.theme.palette.grey[500]};
|
|
868
|
-
font-size: 16px;
|
|
869
|
-
cursor: pointer;
|
|
870
|
-
`;
|
|
871
|
-
function he({ onSelect: e, wrapChildren: n }) {
|
|
872
|
-
const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender: w, filters: g, endpoint: m, handleKeyword: x, t: u, serverVersion: S } = L(), B = async (d) => {
|
|
873
|
-
const { data: i } = await c.get(N.blockletsPath, { params: d }), b = i.dataList || [];
|
|
874
|
-
return b.length > 0 && b.unshift({ type: "more-result", total: i.total || 0 }), b;
|
|
875
|
-
}, T = (d) => {
|
|
876
|
-
x(d.state.query), d.setIsOpen(!1);
|
|
877
|
-
}, $ = () => {
|
|
878
|
-
r.current && setTimeout(() => {
|
|
879
|
-
const d = r.current.querySelector("input.bl-autocomplete-input");
|
|
880
|
-
d && d.focus();
|
|
1097
|
+
function ae({ onSelect: e, wrapChildren: r }) {
|
|
1098
|
+
const o = U(null), n = U(null), a = U(null), { storeApi: l, blockletRender: c, filters: d, endpoint: s, handleKeyword: v, t: f, serverVersion: y } = B(), u = async (b) => {
|
|
1099
|
+
const { data: h } = await l.get(P.blockletsPath, { params: b }), C = h.dataList || [];
|
|
1100
|
+
return C.length > 0 && C.unshift({ type: "more-result", total: h.total || 0 }), C;
|
|
1101
|
+
}, w = (b) => {
|
|
1102
|
+
v(b.state.query), b.setIsOpen(!1);
|
|
1103
|
+
}, k = () => {
|
|
1104
|
+
o.current && setTimeout(() => {
|
|
1105
|
+
const b = o.current.querySelector("input.bl-autocomplete-input");
|
|
1106
|
+
b && b.focus();
|
|
881
1107
|
});
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
},
|
|
885
|
-
|
|
1108
|
+
}, x = (b) => {
|
|
1109
|
+
b.setIsOpen(!1), k();
|
|
1110
|
+
}, $ = ({ prevState: b, state: h }) => {
|
|
1111
|
+
b.query !== h.query && (h.query || (v(), k()));
|
|
886
1112
|
};
|
|
887
|
-
return
|
|
1113
|
+
return Lt(
|
|
888
1114
|
"ctrl + k, command + k",
|
|
889
|
-
(
|
|
1115
|
+
(b) => (b.stopPropagation(), b.preventDefault(), k(), !1),
|
|
890
1116
|
{ enableOnTags: ["INPUT"] }
|
|
891
1117
|
), j(() => {
|
|
892
|
-
|
|
893
|
-
}, [
|
|
894
|
-
if (!
|
|
1118
|
+
k();
|
|
1119
|
+
}, [s]), j(() => {
|
|
1120
|
+
if (!o.current)
|
|
895
1121
|
return;
|
|
896
|
-
const
|
|
897
|
-
container:
|
|
898
|
-
renderer: { createElement:
|
|
1122
|
+
const b = It({
|
|
1123
|
+
container: o.current,
|
|
1124
|
+
renderer: { createElement: ct, Fragment: dt, render: () => {
|
|
899
1125
|
} },
|
|
900
|
-
render({ children:
|
|
901
|
-
var
|
|
902
|
-
(!
|
|
1126
|
+
render({ children: h }, C) {
|
|
1127
|
+
var _;
|
|
1128
|
+
(!n.current || a.current !== C) && (a.current = C, (_ = n.current) == null || _.unmount(), n.current = Tt(C)), n.current.render(r(h));
|
|
903
1129
|
},
|
|
904
1130
|
autoFocus: !0,
|
|
905
1131
|
openOnFocus: !1,
|
|
@@ -913,54 +1139,53 @@ function he({ onSelect: e, wrapChildren: n }) {
|
|
|
913
1139
|
detachedContainer: "bl-autocomplete-detached-container"
|
|
914
1140
|
},
|
|
915
1141
|
translations: {
|
|
916
|
-
clearButtonTitle:
|
|
917
|
-
detachedCancelButtonText:
|
|
918
|
-
submitButtonTitle:
|
|
919
|
-
detachedSearchButtonTitle:
|
|
1142
|
+
clearButtonTitle: f("common.clear"),
|
|
1143
|
+
detachedCancelButtonText: f("common.cancel"),
|
|
1144
|
+
submitButtonTitle: f("common.search"),
|
|
1145
|
+
detachedSearchButtonTitle: f("common.search")
|
|
920
1146
|
},
|
|
921
|
-
placeholder:
|
|
1147
|
+
placeholder: f("common.searchStore"),
|
|
922
1148
|
initialState: {
|
|
923
|
-
query:
|
|
1149
|
+
query: d.keyword
|
|
924
1150
|
},
|
|
925
|
-
onStateChange(
|
|
926
|
-
|
|
1151
|
+
onStateChange(h) {
|
|
1152
|
+
$(h);
|
|
927
1153
|
},
|
|
928
|
-
onSubmit:
|
|
929
|
-
onReset(
|
|
930
|
-
|
|
1154
|
+
onSubmit: w,
|
|
1155
|
+
onReset(h) {
|
|
1156
|
+
x(h);
|
|
931
1157
|
},
|
|
932
|
-
getSources({ query:
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
sortBy: N[g.sortBy],
|
|
1158
|
+
getSources({ query: h, state: C, ..._ }) {
|
|
1159
|
+
const A = {
|
|
1160
|
+
sortBy: P.nameDesc,
|
|
936
1161
|
page: 1,
|
|
937
1162
|
pageSize: 10,
|
|
938
|
-
keyword:
|
|
1163
|
+
keyword: h
|
|
939
1164
|
};
|
|
940
|
-
return
|
|
1165
|
+
return jt([
|
|
941
1166
|
{
|
|
942
1167
|
sourceId: "blocklets",
|
|
943
1168
|
getItems() {
|
|
944
|
-
return
|
|
1169
|
+
return u(A);
|
|
945
1170
|
},
|
|
946
1171
|
// 选中后填充 搜索框中值
|
|
947
|
-
getItemInputValue({ item:
|
|
948
|
-
return
|
|
1172
|
+
getItemInputValue({ item: z }) {
|
|
1173
|
+
return z.type === "more-result" ? h : z.title;
|
|
949
1174
|
},
|
|
950
1175
|
// 选中或者点击自动完成列表中的 item 时触发
|
|
951
|
-
onSelect({ event:
|
|
952
|
-
return
|
|
953
|
-
blocklet:
|
|
954
|
-
detailUrl:
|
|
955
|
-
storeUrl:
|
|
1176
|
+
onSelect({ event: z, item: L }) {
|
|
1177
|
+
return L.type === "more-result" ? (_.setIsOpen(!1), v(h)) : z.type === "keydown" ? v(L.title) : e({
|
|
1178
|
+
blocklet: L,
|
|
1179
|
+
detailUrl: zt(s, "/blocklets", L.did),
|
|
1180
|
+
storeUrl: s
|
|
956
1181
|
});
|
|
957
1182
|
},
|
|
958
1183
|
templates: {
|
|
959
|
-
item({ item:
|
|
960
|
-
return
|
|
1184
|
+
item({ item: z }) {
|
|
1185
|
+
return z.type === "more-result" ? /* @__PURE__ */ t("div", { children: f("autocomplete.expandResult", { name: h, number: z.total.toLocaleString() }) }) : c({ blocklet: z, autocompleteSetters: _, serverVersion: y });
|
|
961
1186
|
},
|
|
962
1187
|
noResults() {
|
|
963
|
-
return
|
|
1188
|
+
return f("blocklet.noResults");
|
|
964
1189
|
}
|
|
965
1190
|
}
|
|
966
1191
|
}
|
|
@@ -968,257 +1193,174 @@ function he({ onSelect: e, wrapChildren: n }) {
|
|
|
968
1193
|
}
|
|
969
1194
|
});
|
|
970
1195
|
return () => {
|
|
971
|
-
|
|
1196
|
+
b.destroy();
|
|
972
1197
|
};
|
|
973
|
-
}, [
|
|
1198
|
+
}, [d, c]), /* @__PURE__ */ m(F, { children: [
|
|
974
1199
|
/* @__PURE__ */ t(
|
|
975
1200
|
xe,
|
|
976
1201
|
{
|
|
977
|
-
styles:
|
|
1202
|
+
styles: (b) => we`
|
|
978
1203
|
.bl-autocomplete-detached-container {
|
|
979
1204
|
.bl-autocomplete-detached-cancel {
|
|
980
1205
|
white-space: nowrap;
|
|
981
1206
|
}
|
|
982
1207
|
}
|
|
1208
|
+
.bl-autocomplete-panel {
|
|
1209
|
+
@media (min-width: ${b.breakpoints.values.md}px) {
|
|
1210
|
+
min-width: 450px;
|
|
1211
|
+
left: unset !important;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
983
1214
|
`
|
|
984
1215
|
}
|
|
985
1216
|
),
|
|
986
|
-
/* @__PURE__ */ t("div", { className: "bl-search-container", ref:
|
|
1217
|
+
/* @__PURE__ */ t("div", { className: "bl-search-container", ref: o })
|
|
987
1218
|
] });
|
|
988
1219
|
}
|
|
989
|
-
|
|
990
|
-
onSelect:
|
|
991
|
-
wrapChildren:
|
|
1220
|
+
ae.propTypes = {
|
|
1221
|
+
onSelect: i.func.isRequired,
|
|
1222
|
+
wrapChildren: i.func
|
|
992
1223
|
};
|
|
993
|
-
|
|
1224
|
+
ae.defaultProps = {
|
|
994
1225
|
wrapChildren: (e) => e
|
|
995
1226
|
};
|
|
996
|
-
function
|
|
997
|
-
const { filters:
|
|
998
|
-
|
|
1227
|
+
function ie({ placeholder: e, ...r }) {
|
|
1228
|
+
const { filters: o, handleKeyword: n } = B(), [a, l] = q(o.keyword || ""), c = ht(n, { wait: 300 }), d = (v) => {
|
|
1229
|
+
const { value: f } = v.target;
|
|
1230
|
+
l(f), c.run(f);
|
|
1231
|
+
}, s = () => {
|
|
1232
|
+
l(""), n();
|
|
999
1233
|
};
|
|
1000
|
-
return
|
|
1001
|
-
|
|
1234
|
+
return j(() => {
|
|
1235
|
+
l(o.keyword || "");
|
|
1236
|
+
}, [o.keyword]), /* @__PURE__ */ t(
|
|
1237
|
+
or,
|
|
1002
1238
|
{
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1239
|
+
inputProps: {
|
|
1240
|
+
"data-cy": "search-blocklet"
|
|
1241
|
+
},
|
|
1242
|
+
startAdornment: /* @__PURE__ */ t(me, { position: "start", children: /* @__PURE__ */ t(nr, {}) }),
|
|
1243
|
+
onChange: d,
|
|
1244
|
+
placeholder: e,
|
|
1245
|
+
value: a,
|
|
1246
|
+
title: e,
|
|
1247
|
+
"data-cy": "search",
|
|
1248
|
+
endAdornment: a && /* @__PURE__ */ t(me, { position: "end", children: /* @__PURE__ */ t(lr, { "data-cy": "search-delete", onClick: s }) }),
|
|
1249
|
+
...r
|
|
1008
1250
|
}
|
|
1009
1251
|
);
|
|
1010
1252
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1253
|
+
ie.propTypes = {
|
|
1254
|
+
placeholder: i.string
|
|
1013
1255
|
};
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
developerName: a,
|
|
1022
|
-
handleSort: s,
|
|
1023
|
-
handleCategory: c,
|
|
1024
|
-
handlePrice: w,
|
|
1025
|
-
handleSearchSelect: g,
|
|
1026
|
-
t: m,
|
|
1027
|
-
getCategoryLocale: x,
|
|
1028
|
-
priceOptions: u,
|
|
1029
|
-
wrapChildren: S,
|
|
1030
|
-
showResourcesSwitch: B,
|
|
1031
|
-
showCategory: T,
|
|
1032
|
-
baseSearch: $,
|
|
1033
|
-
onFilterChange: C,
|
|
1034
|
-
tagFilters: y
|
|
1035
|
-
} = L(), d = vt(m), i = ((G = d.find((f) => f.value === r.sortBy)) == null ? void 0 : G.name) || m("sort.sort"), b = x(r.category), { resourceType: k } = r || {}, z = (K = u.find((f) => f.value === r.price)) == null ? void 0 : K.name, [I, v] = E(!1), V = ae(), ee = Se(() => V.breakpoints.down("md")), O = Pe({
|
|
1036
|
-
chooseTagId: ""
|
|
1037
|
-
}), W = tt((f) => {
|
|
1038
|
-
O.chooseTagId = f.id, ["category", "resourceType", "resourceDid"].forEach((M) => {
|
|
1039
|
-
typeof f.params[M] > "u" ? delete r[M] : r[M] = f.params[M];
|
|
1040
|
-
}), C(r);
|
|
1041
|
-
}), F = rt(() => y.find((f) => f.id === O.chooseTagId), [O.chooseTagId]);
|
|
1042
|
-
return ot(() => {
|
|
1043
|
-
const f = lt(window.location.search), H = y.find((M) => {
|
|
1044
|
-
const l = M.params;
|
|
1045
|
-
return l ? Object.keys(l).every((p) => f[p] === l[p]) : !1;
|
|
1046
|
-
});
|
|
1047
|
-
H ? W(H) : y.length > 0 && W(y[0]);
|
|
1048
|
-
}), /* @__PURE__ */ h(_, { display: "flex", alignItems: "flex-start", height: "100%", children: [
|
|
1049
|
-
T ? /* @__PURE__ */ t(ye, { mdDown: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
|
|
1050
|
-
/* @__PURE__ */ h(Kt, { children: [
|
|
1051
|
-
/* @__PURE__ */ h(Ht, { children: [
|
|
1052
|
-
/* @__PURE__ */ h(
|
|
1053
|
-
_,
|
|
1054
|
-
{
|
|
1055
|
-
className: "filter-bar",
|
|
1056
|
-
sx: {
|
|
1057
|
-
display: "flex",
|
|
1058
|
-
flexDirection: {
|
|
1059
|
-
lg: "row",
|
|
1060
|
-
md: B ? "column" : "row"
|
|
1061
|
-
},
|
|
1062
|
-
alignItems: {
|
|
1063
|
-
lg: "center",
|
|
1064
|
-
md: B ? "flex-start" : "center",
|
|
1065
|
-
xs: "center"
|
|
1066
|
-
},
|
|
1067
|
-
gap: 1
|
|
1068
|
-
},
|
|
1069
|
-
children: [
|
|
1070
|
-
T ? /* @__PURE__ */ t(ye, { mdUp: !0, children: /* @__PURE__ */ t(pe, {}) }) : null,
|
|
1071
|
-
/* @__PURE__ */ t(
|
|
1072
|
-
"form",
|
|
1073
|
-
{
|
|
1074
|
-
className: "search-form",
|
|
1075
|
-
style: {
|
|
1076
|
-
flex: 1,
|
|
1077
|
-
width: "100%"
|
|
1078
|
-
},
|
|
1079
|
-
onSubmit: (f) => {
|
|
1080
|
-
f.preventDefault(), f.stopPropagation();
|
|
1081
|
-
},
|
|
1082
|
-
onFocus: () => {
|
|
1083
|
-
v(!0);
|
|
1084
|
-
},
|
|
1085
|
-
onBlur: () => {
|
|
1086
|
-
v(!1);
|
|
1087
|
-
},
|
|
1088
|
-
children: $ ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: m("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: g, wrapChildren: S })
|
|
1089
|
-
}
|
|
1090
|
-
),
|
|
1091
|
-
/* @__PURE__ */ h(_, { className: "filter-container", display: "flex", alignItems: "center", children: [
|
|
1092
|
-
!ee && B && /* @__PURE__ */ t(_, { ml: 1, mr: 1, children: /* @__PURE__ */ t(fe, { t: m }) }),
|
|
1093
|
-
/* @__PURE__ */ t(
|
|
1094
|
-
ce,
|
|
1095
|
-
{
|
|
1096
|
-
value: r.sortBy,
|
|
1097
|
-
options: d,
|
|
1098
|
-
title: i,
|
|
1099
|
-
icon: /* @__PURE__ */ t(_e, {}),
|
|
1100
|
-
onChange: (f) => {
|
|
1101
|
-
s(f);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
)
|
|
1105
|
-
] })
|
|
1106
|
-
]
|
|
1107
|
-
}
|
|
1108
|
-
),
|
|
1109
|
-
T ? /* @__PURE__ */ h(_, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
|
|
1110
|
-
/* @__PURE__ */ t(
|
|
1111
|
-
q,
|
|
1112
|
-
{
|
|
1113
|
-
label: a,
|
|
1114
|
-
icon: /* @__PURE__ */ t(Ve, {}),
|
|
1115
|
-
onDelete: () => {
|
|
1116
|
-
e(null);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
),
|
|
1120
|
-
/* @__PURE__ */ t(
|
|
1121
|
-
q,
|
|
1122
|
-
{
|
|
1123
|
-
label: b,
|
|
1124
|
-
onDelete: () => {
|
|
1125
|
-
c(null);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
),
|
|
1129
|
-
/* @__PURE__ */ t(
|
|
1130
|
-
q,
|
|
1131
|
-
{
|
|
1132
|
-
label: z,
|
|
1133
|
-
onDelete: () => {
|
|
1134
|
-
w(null);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
),
|
|
1138
|
-
k && /* @__PURE__ */ t(q, { label: `${m("common.resourceType")}: ${k}` })
|
|
1139
|
-
] }) : null
|
|
1140
|
-
] }),
|
|
1141
|
-
/* @__PURE__ */ t(We, { FallbackComponent: Te, children: /* @__PURE__ */ h(_, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
|
|
1142
|
-
(y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ h(le, { children: [
|
|
1143
|
-
/* @__PURE__ */ t(Ue, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: y.map((f) => /* @__PURE__ */ t(
|
|
1144
|
-
Ce,
|
|
1145
|
-
{
|
|
1146
|
-
label: f.title,
|
|
1147
|
-
size: "small",
|
|
1148
|
-
variant: O.chooseTagId === f.id ? "contained" : "outlined",
|
|
1149
|
-
onClick: () => W(f),
|
|
1150
|
-
color: O.chooseTagId === f.id ? "primary" : "default"
|
|
1151
|
-
},
|
|
1152
|
-
f.id
|
|
1153
|
-
)) }),
|
|
1154
|
-
F ? /* @__PURE__ */ t(_, { mb: 2, children: F.description ? /* @__PURE__ */ t(ve, { variant: "body1", children: F.description }) : null }) : null
|
|
1155
|
-
] }) : null,
|
|
1156
|
-
/* @__PURE__ */ t(ue, { blocklets: n })
|
|
1157
|
-
] }) })
|
|
1158
|
-
] })
|
|
1159
|
-
] });
|
|
1160
|
-
}
|
|
1161
|
-
const Kt = R("main")`
|
|
1162
|
-
display: flex;
|
|
1163
|
-
flex-direction: column;
|
|
1164
|
-
flex: 1;
|
|
1256
|
+
ie.defaultProps = {
|
|
1257
|
+
placeholder: "Type to search..."
|
|
1258
|
+
};
|
|
1259
|
+
const or = D(nt)`
|
|
1260
|
+
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1261
|
+
font-size: 14px;
|
|
1262
|
+
border-radius: 6px;
|
|
1165
1263
|
width: 100%;
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
justify-content: space-between;
|
|
1169
|
-
margin-bottom: ${(e) => e.theme.spacing(2)};
|
|
1170
|
-
}
|
|
1171
|
-
.sort-button {
|
|
1172
|
-
white-space: nowrap;
|
|
1173
|
-
}
|
|
1174
|
-
.bl-search-container {
|
|
1175
|
-
margin-left: 0px;
|
|
1264
|
+
.MuiInputBase-input {
|
|
1265
|
+
padding: 8px 0 8px 10px;
|
|
1176
1266
|
}
|
|
1177
|
-
.
|
|
1178
|
-
|
|
1179
|
-
justify-content: flex-end;
|
|
1267
|
+
.MuiOutlinedInput-notchedOutline {
|
|
1268
|
+
border: none;
|
|
1180
1269
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
.bl-search-container {
|
|
1186
|
-
width: 100%;
|
|
1187
|
-
}
|
|
1188
|
-
.filter-container {
|
|
1189
|
-
margin-left: 0;
|
|
1190
|
-
display: flex;
|
|
1191
|
-
justify-content: flex-start;
|
|
1270
|
+
.Mui-focused {
|
|
1271
|
+
background-color: #f6f6f6;
|
|
1272
|
+
.MuiInputBase-input::placeholder {
|
|
1273
|
+
color: transparent;
|
|
1192
1274
|
}
|
|
1193
1275
|
}
|
|
1276
|
+
`, nr = D($t)`
|
|
1277
|
+
color: ${(e) => e.theme.palette.grey[500]};
|
|
1278
|
+
font-size: 28px;
|
|
1194
1279
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1195
|
-
|
|
1196
|
-
font-size: 12px;
|
|
1197
|
-
}
|
|
1280
|
+
font-size: 24px;
|
|
1198
1281
|
}
|
|
1199
|
-
`,
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
background-color: white;
|
|
1282
|
+
`, lr = D(Se)`
|
|
1283
|
+
color: ${(e) => e.theme.palette.grey[500]};
|
|
1284
|
+
font-size: 16px;
|
|
1285
|
+
cursor: pointer;
|
|
1204
1286
|
`;
|
|
1205
|
-
function
|
|
1206
|
-
const n =
|
|
1207
|
-
|
|
1287
|
+
function ar() {
|
|
1288
|
+
const { filters: e, handleSearchSelect: r, t: o, wrapChildren: n, baseSearch: a } = B(), { toggleOpen: l } = oe(), c = !!e.keyword;
|
|
1289
|
+
return /* @__PURE__ */ m(
|
|
1290
|
+
T,
|
|
1291
|
+
{
|
|
1292
|
+
direction: "row",
|
|
1293
|
+
alignItems: "center",
|
|
1294
|
+
justifyContent: "space-between",
|
|
1295
|
+
pt: { xs: 2, md: 5 },
|
|
1296
|
+
pb: { xs: 2, md: 3 },
|
|
1297
|
+
borderBottom: 1,
|
|
1298
|
+
borderColor: { xs: "transparent", md: "divider" },
|
|
1299
|
+
mb: { xs: 0, md: 3 },
|
|
1300
|
+
children: [
|
|
1301
|
+
/* @__PURE__ */ t(
|
|
1302
|
+
G,
|
|
1303
|
+
{
|
|
1304
|
+
xs: !c && /* @__PURE__ */ t(Ee, { onClick: () => l(!0), children: /* @__PURE__ */ t(Pt, {}) }),
|
|
1305
|
+
md: /* @__PURE__ */ t(I, { variant: "h1", children: o("common.title") })
|
|
1306
|
+
}
|
|
1307
|
+
),
|
|
1308
|
+
/* @__PURE__ */ t(
|
|
1309
|
+
S,
|
|
1310
|
+
{
|
|
1311
|
+
width: { xs: c ? "100%" : 300, md: 300 },
|
|
1312
|
+
className: "filter-bar",
|
|
1313
|
+
sx: {
|
|
1314
|
+
"& .bl-autocomplete-form": { borderRadius: 2 },
|
|
1315
|
+
"& .aa-SubmitButton, & .aa-LoadingIndicator": { width: "auto", pl: 1.5, pr: 1 },
|
|
1316
|
+
"& .aa-SubmitIcon, & .aa-LoadingIcon": { height: 16, width: 16 }
|
|
1317
|
+
},
|
|
1318
|
+
children: a ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder: o("common.searchStore"), sx: { pl: 1.5 } }) : /* @__PURE__ */ t(ae, { onSelect: r, wrapChildren: n })
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
]
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
function ir() {
|
|
1326
|
+
const { blockletList: e, filters: r, t: o } = B(), n = r.category || r.keyword || r.price;
|
|
1327
|
+
return /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ m(lt, { FallbackComponent: Z, children: [
|
|
1328
|
+
/* @__PURE__ */ t(ar, {}),
|
|
1329
|
+
/* @__PURE__ */ m(S, { display: "flex", height: "100%", children: [
|
|
1330
|
+
/* @__PURE__ */ t(Jt, {}),
|
|
1331
|
+
/* @__PURE__ */ t(T, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: n ? /* @__PURE__ */ m(F, { children: [
|
|
1332
|
+
r.keyword ? /* @__PURE__ */ m(F, { children: [
|
|
1333
|
+
/* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(Me, {}), md: null }),
|
|
1334
|
+
a()
|
|
1335
|
+
] }) : /* @__PURE__ */ t(rr, {}),
|
|
1336
|
+
/* @__PURE__ */ t(qe, { blocklets: e, height: "100%" })
|
|
1337
|
+
] }) : /* @__PURE__ */ t(tr, {}) })
|
|
1338
|
+
] })
|
|
1339
|
+
] }) });
|
|
1340
|
+
function a() {
|
|
1341
|
+
return /* @__PURE__ */ m(T, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
|
|
1342
|
+
/* @__PURE__ */ t(I, { variant: "h3", children: o("blocklet.search", { keyword: r.keyword }) }),
|
|
1343
|
+
/* @__PURE__ */ t(I, { variant: "body1", color: "text.lighter", fontSize: 13, children: o("blocklet.resultCount", { count: e.length }) })
|
|
1344
|
+
] });
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function je(e) {
|
|
1348
|
+
const r = be(), o = Ot(r.palette.primary.main), n = {
|
|
1349
|
+
autocomplete: we`
|
|
1208
1350
|
:root {
|
|
1209
|
-
--aa-detached-media-query: (max-width: ${
|
|
1210
|
-
--aa-detached-modal-media-query: (min-width: ${
|
|
1211
|
-
--aa-detached-modal-max-width: ${
|
|
1212
|
-
--aa-selected-color-rgb: ${
|
|
1213
|
-
--aa-primary-color-rgb: ${
|
|
1351
|
+
--aa-detached-media-query: (max-width: ${r.breakpoints.values.md}px) !important;
|
|
1352
|
+
--aa-detached-modal-media-query: (min-width: ${r.breakpoints.values.md}px) !important;
|
|
1353
|
+
--aa-detached-modal-max-width: ${r.breakpoints.values.md}px !important;
|
|
1354
|
+
--aa-selected-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1355
|
+
--aa-primary-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1214
1356
|
--aa-input-background-color-rgb: 250, 250, 250 !important;
|
|
1215
1357
|
}
|
|
1216
1358
|
.bl-autocomplete-panel {
|
|
1217
|
-
z-index: ${
|
|
1359
|
+
z-index: ${r.zIndex.modal};
|
|
1218
1360
|
}
|
|
1219
1361
|
.bl-autocomplete-label {
|
|
1220
1362
|
.aa-SubmitIcon {
|
|
1221
|
-
color: ${
|
|
1363
|
+
color: ${r.palette.grey[500]} !important;
|
|
1222
1364
|
}
|
|
1223
1365
|
}
|
|
1224
1366
|
.bl-autocomplete-form {
|
|
@@ -1234,21 +1376,21 @@ function De(e) {
|
|
|
1234
1376
|
box-shadow: none !important;
|
|
1235
1377
|
}
|
|
1236
1378
|
.aa-SubmitIcon {
|
|
1237
|
-
color: ${
|
|
1379
|
+
color: ${r.palette.grey[500]} !important;
|
|
1238
1380
|
}
|
|
1239
1381
|
}
|
|
1240
1382
|
.aa-Panel .arcblock-blocklet button {
|
|
1241
|
-
border: 1px solid rgba(${
|
|
1383
|
+
border: 1px solid rgba(${o.r}, ${o.g}, ${o.b}, 0.5);
|
|
1242
1384
|
}
|
|
1243
1385
|
`
|
|
1244
1386
|
};
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */ t(xe, { styles:
|
|
1247
|
-
/* @__PURE__ */ t(
|
|
1387
|
+
return /* @__PURE__ */ m(ne, { ...e, children: [
|
|
1388
|
+
/* @__PURE__ */ t(xe, { styles: n.autocomplete }),
|
|
1389
|
+
/* @__PURE__ */ t(ir, {})
|
|
1248
1390
|
] });
|
|
1249
1391
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1392
|
+
je.propTypes = ze;
|
|
1393
|
+
je.defaultProps = $e;
|
|
1252
1394
|
export {
|
|
1253
|
-
|
|
1395
|
+
je as default
|
|
1254
1396
|
};
|