@blocklet/list 0.12.110 → 0.12.112
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 +388 -388
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as T, useTheme as
|
|
3
|
-
import { Global as
|
|
4
|
-
import
|
|
5
|
-
import { Button as
|
|
6
|
-
import
|
|
7
|
-
import { ErrorBoundary as
|
|
8
|
-
import { ErrorFallback as
|
|
9
|
-
import { createContext as
|
|
10
|
-
import { useReactive as
|
|
11
|
-
import { joinURL as
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { styled as T, useTheme as ae } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import { Global as xe, css as ke } from "@emotion/react";
|
|
4
|
+
import _e from "@mui/icons-material/Sort";
|
|
5
|
+
import { Button as Ne, CircularProgress as oe, MenuList as Le, useMediaQuery as Se, SvgIcon as Me, Popper as Oe, Grow as Fe, Paper as Ae, ClickAwayListener as Ee, MenuItem as qe, Chip as Ce, Box as D, Unstable_Grid2 as te, OutlinedInput as je, InputAdornment as ge, Typography as ve, Hidden as ye, Stack as Ue } from "@mui/material";
|
|
6
|
+
import We from "@mui/icons-material/Face";
|
|
7
|
+
import { ErrorBoundary as Ge } from "react-error-boundary";
|
|
8
|
+
import { ErrorFallback as Te } from "@arcblock/ux/lib/ErrorBoundary";
|
|
9
|
+
import { createContext as Ke, useMemo as V, useState as E, useCallback as ne, useEffect as j, useContext as He, forwardRef as Qe, useRef as J, createElement as Ve, Fragment as Je } from "react";
|
|
10
|
+
import { useReactive as Pe, useInfiniteScroll as Xe, useRequest as Ye, useSize as Ze, useDebounceFn as et, useMemoizedFn as tt, useCreation as rt, useMount as ot } from "ahooks";
|
|
11
|
+
import { joinURL as nt, parseQuery as lt } from "ufo";
|
|
12
12
|
import o from "prop-types";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import at from "lodash/orderBy";
|
|
14
|
+
import it from "axios";
|
|
15
|
+
import st from "json-stable-stringify";
|
|
16
16
|
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 { createRoot as
|
|
31
|
-
import { autocomplete as
|
|
32
|
-
import { useHotkeys as
|
|
33
|
-
import
|
|
17
|
+
import ct from "color";
|
|
18
|
+
import be from "flat";
|
|
19
|
+
import ut from "@mui/icons-material/KeyboardArrowDown";
|
|
20
|
+
import pt from "lodash/isEmpty";
|
|
21
|
+
import dt from "@mui/icons-material/FilterAltOutlined";
|
|
22
|
+
import mt from "@arcblock/ux/lib/Dialog";
|
|
23
|
+
import ht from "@mui/material/Button";
|
|
24
|
+
import ft from "@arcblock/ux/lib/Empty";
|
|
25
|
+
import gt from "react-infinite-scroll-hook";
|
|
26
|
+
import yt from "@mui/material/Box";
|
|
27
|
+
import Re from "@mui/material/Typography";
|
|
28
|
+
import bt from "@mui/icons-material/Search";
|
|
29
|
+
import wt from "@mui/icons-material/Close";
|
|
30
|
+
import { createRoot as xt } from "react-dom/client";
|
|
31
|
+
import { autocomplete as kt } from "@algolia/autocomplete-js";
|
|
32
|
+
import { useHotkeys as St } from "react-hotkeys-hook";
|
|
33
|
+
import Ct from "@arcblock/ux/lib/Switch";
|
|
34
34
|
import "@algolia/autocomplete-theme-classic/dist/theme.css";
|
|
35
|
-
const
|
|
35
|
+
const vt = (e) => [
|
|
36
36
|
{
|
|
37
37
|
name: e("sort.popularity"),
|
|
38
38
|
value: "popularity"
|
|
@@ -49,14 +49,14 @@ const Rt = (e) => [
|
|
|
49
49
|
name: e("sort.nameDescend"),
|
|
50
50
|
value: "nameDesc"
|
|
51
51
|
}
|
|
52
|
-
],
|
|
52
|
+
], Tt = (e) => [
|
|
53
53
|
{ name: e("blocklet.free"), value: "free" },
|
|
54
54
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
55
|
-
],
|
|
55
|
+
], Pt = (e = [], n = "en") => e.map((r) => ({ name: r.locales[n] || `Category.${n}`, value: r._id })), Rt = (e, n) => (
|
|
56
56
|
// eslint-disable-next-line no-prototype-builtins
|
|
57
|
-
e.replace(/{(\w*)}/g, (r,
|
|
58
|
-
),
|
|
59
|
-
function
|
|
57
|
+
e.replace(/{(\w*)}/g, (r, a) => n.hasOwnProperty(a) ? n[a] : "")
|
|
58
|
+
), Bt = () => window.innerWidth <= 600, $t = (e) => ct(e).rgb().object();
|
|
59
|
+
function It(e, n) {
|
|
60
60
|
let r;
|
|
61
61
|
return function(...s) {
|
|
62
62
|
return r && clearTimeout(r), new Promise((c) => {
|
|
@@ -64,7 +64,7 @@ function _t(e, n) {
|
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
68
68
|
common: {
|
|
69
69
|
searchStore: "Search the store",
|
|
70
70
|
showResources: "Show resources",
|
|
@@ -103,7 +103,7 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
|
|
|
103
103
|
autocomplete: {
|
|
104
104
|
expandResult: 'Show {number} search results for "{name}" '
|
|
105
105
|
}
|
|
106
|
-
},
|
|
106
|
+
}, _t = {
|
|
107
107
|
common: {
|
|
108
108
|
searchStore: "搜索商店内应用",
|
|
109
109
|
showResources: "显示资源型应用",
|
|
@@ -142,10 +142,10 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
|
|
|
142
142
|
autocomplete: {
|
|
143
143
|
expandResult: "显示 {number} 条 “{name}” 的搜索结果 "
|
|
144
144
|
}
|
|
145
|
-
},
|
|
146
|
-
en:
|
|
147
|
-
zh:
|
|
148
|
-
},
|
|
145
|
+
}, re = {
|
|
146
|
+
en: be(Dt),
|
|
147
|
+
zh: be(_t)
|
|
148
|
+
}, Be = {
|
|
149
149
|
filters: o.shape({
|
|
150
150
|
keyword: o.string,
|
|
151
151
|
sortBy: o.string,
|
|
@@ -168,7 +168,7 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
|
|
|
168
168
|
showResourcesSwitch: o.bool,
|
|
169
169
|
showCategory: o.bool,
|
|
170
170
|
tagFilters: o.array
|
|
171
|
-
},
|
|
171
|
+
}, $e = {
|
|
172
172
|
locale: "zh",
|
|
173
173
|
filters: {},
|
|
174
174
|
onFilterChange: () => {
|
|
@@ -195,248 +195,248 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
|
|
|
195
195
|
blockletsPath: "/api/v2/blocklets.json",
|
|
196
196
|
categoriesPath: "/api/blocklets/categories",
|
|
197
197
|
cacheSize: 100
|
|
198
|
-
},
|
|
199
|
-
function
|
|
198
|
+
}, Ie = Ke({}), { Provider: Nt, Consumer: $r } = Ie;
|
|
199
|
+
function ie({
|
|
200
200
|
filters: e,
|
|
201
201
|
children: n,
|
|
202
202
|
endpoint: r,
|
|
203
|
-
locale:
|
|
203
|
+
locale: a,
|
|
204
204
|
blockletRender: s,
|
|
205
205
|
onFilterChange: c,
|
|
206
206
|
onSearchSelect: x,
|
|
207
207
|
extraFilter: y,
|
|
208
|
-
wrapChildren:
|
|
208
|
+
wrapChildren: p,
|
|
209
209
|
baseSearch: b,
|
|
210
|
-
serverVersion:
|
|
210
|
+
serverVersion: d,
|
|
211
211
|
storeVersion: S,
|
|
212
212
|
fetchCategoryDelay: v,
|
|
213
213
|
showResourcesSwitch: C,
|
|
214
|
-
showCategory:
|
|
215
|
-
tagFilters:
|
|
214
|
+
showCategory: P,
|
|
215
|
+
tagFilters: R
|
|
216
216
|
}) {
|
|
217
217
|
const i = {};
|
|
218
|
-
|
|
219
|
-
const h =
|
|
218
|
+
d && (i["x-blocklet-server-version"] = d), S && (i["x-blocklet-store-version"] = S);
|
|
219
|
+
const h = V(() => it.create({
|
|
220
220
|
baseURL: r,
|
|
221
221
|
headers: i
|
|
222
|
-
}), [r]),
|
|
222
|
+
}), [r]), m = V(() => ({
|
|
223
223
|
sortBy: "popularity",
|
|
224
224
|
sortDirection: "desc",
|
|
225
225
|
...e
|
|
226
|
-
}), [e]), k =
|
|
226
|
+
}), [e]), k = m.category, $ = Pe({
|
|
227
227
|
currentPage: _.currentPage,
|
|
228
|
-
pageSize:
|
|
228
|
+
pageSize: Bt() ? _.mobilePageSize : _.pageSize,
|
|
229
229
|
defaultCurrentPage: _.defaultCurrentPage
|
|
230
|
-
}), [w, L] =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const { currentPage: f, pageSize: $ } = P, A = {
|
|
239
|
-
...d,
|
|
240
|
-
sortBy: _[d.sortBy],
|
|
241
|
-
page: f,
|
|
242
|
-
pageSize: $
|
|
230
|
+
}), [w, L] = E(null), I = Xe(
|
|
231
|
+
async (l) => {
|
|
232
|
+
l || ($.currentPage = $.defaultCurrentPage);
|
|
233
|
+
const { currentPage: u, pageSize: B } = $, A = {
|
|
234
|
+
...m,
|
|
235
|
+
sortBy: _[m.sortBy],
|
|
236
|
+
page: u,
|
|
237
|
+
pageSize: B
|
|
243
238
|
};
|
|
244
239
|
L(null);
|
|
245
240
|
const { data: z = {} } = await h.get(_.blockletsPath, {
|
|
246
241
|
params: A
|
|
247
242
|
});
|
|
248
|
-
return
|
|
249
|
-
page:
|
|
250
|
-
pageSize:
|
|
243
|
+
return $.currentPage++, {
|
|
244
|
+
page: u,
|
|
245
|
+
pageSize: B,
|
|
251
246
|
list: (z == null ? void 0 : z.dataList) || [],
|
|
252
247
|
total: (z == null ? void 0 : z.total) || 0
|
|
253
248
|
};
|
|
254
249
|
},
|
|
255
250
|
{
|
|
256
|
-
isNoMore: (
|
|
257
|
-
reloadDeps: [r,
|
|
258
|
-
onError: (
|
|
259
|
-
L(
|
|
251
|
+
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
252
|
+
reloadDeps: [r, st(e)],
|
|
253
|
+
onError: (l) => {
|
|
254
|
+
L(l);
|
|
260
255
|
}
|
|
261
256
|
}
|
|
262
257
|
), {
|
|
263
|
-
data:
|
|
264
|
-
error:
|
|
265
|
-
loading:
|
|
266
|
-
run:
|
|
267
|
-
} =
|
|
258
|
+
data: W = [],
|
|
259
|
+
error: ee,
|
|
260
|
+
loading: O,
|
|
261
|
+
run: G
|
|
262
|
+
} = Ye(
|
|
268
263
|
async () => {
|
|
269
|
-
const { data:
|
|
270
|
-
return Array.isArray(
|
|
264
|
+
const { data: l } = await h.get(_.categoriesPath);
|
|
265
|
+
return Array.isArray(l) ? l : [];
|
|
271
266
|
},
|
|
272
267
|
{ manual: !0 }
|
|
273
|
-
),
|
|
274
|
-
(
|
|
275
|
-
const
|
|
276
|
-
return
|
|
268
|
+
), F = V(() => at(W || [], [(u) => u.name], ["asc"]), [W]), K = ne(
|
|
269
|
+
(l, u) => {
|
|
270
|
+
const B = re[a] ? re[a][l] : re.en[l];
|
|
271
|
+
return Rt(B, u);
|
|
272
|
+
},
|
|
273
|
+
[a]
|
|
274
|
+
), H = V(() => {
|
|
275
|
+
var u;
|
|
276
|
+
let l = ((u = I.data) == null ? void 0 : u.list) || [];
|
|
277
|
+
return l = y(l), l;
|
|
278
|
+
}, [I.data, y]), g = V(() => Pt(F, a), [F, a]), Q = Tt(K), M = {
|
|
279
|
+
errors: { fetchBlockletsError: w, fetchCategoriesError: ee },
|
|
280
|
+
loadings: {
|
|
281
|
+
fetchBlockletsLoading: I.loading,
|
|
282
|
+
fetchCategoriesLoading: O,
|
|
283
|
+
loadingMore: I.loadingMore
|
|
277
284
|
},
|
|
278
|
-
[l]
|
|
279
|
-
), I = H(() => {
|
|
280
|
-
let a = E.list || [];
|
|
281
|
-
return a = y(a), a;
|
|
282
|
-
}, [E, y]), K = H(() => $t(m, l), [m, l]), Y = Bt(q), Le = {
|
|
283
|
-
errors: { fetchBlockletsError: w, fetchCategoriesError: G },
|
|
284
|
-
loadings: { fetchBlockletsLoading: te, fetchCategoriesLoading: J, loadingMore: O },
|
|
285
285
|
endpoint: r,
|
|
286
|
-
blockletList:
|
|
287
|
-
wrapChildren:
|
|
288
|
-
t:
|
|
289
|
-
filters:
|
|
286
|
+
blockletList: H,
|
|
287
|
+
wrapChildren: p,
|
|
288
|
+
t: K,
|
|
289
|
+
filters: m,
|
|
290
290
|
selectedCategory: k,
|
|
291
|
-
categoryList:
|
|
291
|
+
categoryList: F,
|
|
292
292
|
blockletRender: s,
|
|
293
|
-
locale:
|
|
294
|
-
categoryOptions:
|
|
295
|
-
priceOptions:
|
|
293
|
+
locale: a,
|
|
294
|
+
categoryOptions: g,
|
|
295
|
+
priceOptions: Q,
|
|
296
296
|
storeApi: h,
|
|
297
297
|
baseSearch: b,
|
|
298
298
|
showResourcesSwitch: C,
|
|
299
|
-
showCategory:
|
|
300
|
-
tagFilters:
|
|
301
|
-
hasNextPage:
|
|
299
|
+
showCategory: P,
|
|
300
|
+
tagFilters: R,
|
|
301
|
+
hasNextPage: !I.noMore,
|
|
302
302
|
onFilterChange: c,
|
|
303
|
-
handleSort: (
|
|
304
|
-
const
|
|
305
|
-
...
|
|
306
|
-
sortBy:
|
|
307
|
-
sortDirection:
|
|
303
|
+
handleSort: (l) => {
|
|
304
|
+
const u = {
|
|
305
|
+
...m,
|
|
306
|
+
sortBy: l,
|
|
307
|
+
sortDirection: l === "nameAsc" ? "asc" : "desc"
|
|
308
308
|
};
|
|
309
|
-
c(
|
|
309
|
+
c(u);
|
|
310
310
|
},
|
|
311
|
-
handleKeyword: (
|
|
312
|
-
const
|
|
313
|
-
c(
|
|
311
|
+
handleKeyword: (l) => {
|
|
312
|
+
const u = { ...m, keyword: l || void 0 };
|
|
313
|
+
c(u);
|
|
314
314
|
},
|
|
315
|
-
handlePrice: (
|
|
316
|
-
const
|
|
317
|
-
...
|
|
318
|
-
price:
|
|
315
|
+
handlePrice: (l) => {
|
|
316
|
+
const u = {
|
|
317
|
+
...m,
|
|
318
|
+
price: l === m.price ? void 0 : l
|
|
319
319
|
};
|
|
320
|
-
c(
|
|
320
|
+
c(u);
|
|
321
321
|
},
|
|
322
|
-
handleCategory: (
|
|
323
|
-
let
|
|
324
|
-
(
|
|
325
|
-
const
|
|
326
|
-
c(
|
|
322
|
+
handleCategory: (l) => {
|
|
323
|
+
let u = l;
|
|
324
|
+
(l === "all" || l === m.category) && (u = void 0);
|
|
325
|
+
const B = { ...m, category: u };
|
|
326
|
+
c(B);
|
|
327
327
|
},
|
|
328
|
-
handleDeveloper: (
|
|
329
|
-
const
|
|
330
|
-
c(
|
|
328
|
+
handleDeveloper: (l) => {
|
|
329
|
+
const u = { ...m, owner: l || void 0 };
|
|
330
|
+
c(u);
|
|
331
331
|
},
|
|
332
|
-
handlePage: (
|
|
333
|
-
const
|
|
334
|
-
c(
|
|
332
|
+
handlePage: (l) => {
|
|
333
|
+
const u = { ...m, currentPage: l };
|
|
334
|
+
c(u);
|
|
335
335
|
},
|
|
336
336
|
handleSwitchShowResources: () => {
|
|
337
|
-
const
|
|
338
|
-
c(
|
|
337
|
+
const l = { ...m };
|
|
338
|
+
c(l);
|
|
339
339
|
},
|
|
340
|
-
loadMore:
|
|
341
|
-
getCategoryLocale: (
|
|
342
|
-
if (!
|
|
340
|
+
loadMore: I.loadMore,
|
|
341
|
+
getCategoryLocale: (l) => {
|
|
342
|
+
if (!l)
|
|
343
343
|
return null;
|
|
344
|
-
let
|
|
345
|
-
const
|
|
346
|
-
return
|
|
344
|
+
let u = null;
|
|
345
|
+
const B = W.find((A) => A._id === l);
|
|
346
|
+
return B && (u = B.locales[a]), u;
|
|
347
347
|
},
|
|
348
348
|
get developerName() {
|
|
349
|
-
var
|
|
350
|
-
return ((
|
|
349
|
+
var u, B;
|
|
350
|
+
return ((B = (u = H.find((A) => {
|
|
351
351
|
var z;
|
|
352
|
-
return ((z = A == null ? void 0 : A.owner) == null ? void 0 : z.did) ===
|
|
353
|
-
})) == null ? void 0 :
|
|
352
|
+
return ((z = A == null ? void 0 : A.owner) == null ? void 0 : z.did) === m.owner;
|
|
353
|
+
})) == null ? void 0 : u.owner) == null ? void 0 : B.name) || "";
|
|
354
354
|
},
|
|
355
355
|
handleSearchSelect: x
|
|
356
356
|
};
|
|
357
|
-
return
|
|
357
|
+
return j(() => {
|
|
358
358
|
setTimeout(() => {
|
|
359
|
-
|
|
359
|
+
G();
|
|
360
360
|
}, v || 0);
|
|
361
|
-
}, [r]), /* @__PURE__ */ t(
|
|
361
|
+
}, [r]), /* @__PURE__ */ t(Nt, { value: M, children: n });
|
|
362
362
|
}
|
|
363
|
-
|
|
364
|
-
...
|
|
363
|
+
ie.propTypes = {
|
|
364
|
+
...Be,
|
|
365
365
|
children: o.any.isRequired
|
|
366
366
|
};
|
|
367
|
-
|
|
367
|
+
ie.defaultProps = $e;
|
|
368
368
|
function N() {
|
|
369
|
-
const e =
|
|
369
|
+
const e = He(Ie);
|
|
370
370
|
return e || {};
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
const Lt = T(Ne)`
|
|
373
373
|
border-radius: 4px;
|
|
374
|
-
`,
|
|
375
|
-
|
|
374
|
+
`, se = Qe(({ children: e, rounded: n, loading: r, disabled: a, ...s }, c) => /* @__PURE__ */ t(
|
|
375
|
+
Lt,
|
|
376
376
|
{
|
|
377
377
|
ref: c,
|
|
378
378
|
disableElevation: !0,
|
|
379
|
-
disabled:
|
|
379
|
+
disabled: a || r,
|
|
380
380
|
...s,
|
|
381
|
-
startIcon: r && /* @__PURE__ */ t(
|
|
381
|
+
startIcon: r && /* @__PURE__ */ t(oe, { size: "1em" }),
|
|
382
382
|
children: e
|
|
383
383
|
}
|
|
384
384
|
));
|
|
385
|
-
|
|
385
|
+
se.propTypes = {
|
|
386
386
|
children: o.any,
|
|
387
387
|
rounded: o.bool,
|
|
388
388
|
loading: o.bool,
|
|
389
389
|
disabled: o.bool
|
|
390
390
|
};
|
|
391
|
-
|
|
391
|
+
se.defaultProps = {
|
|
392
392
|
children: null,
|
|
393
393
|
rounded: !1,
|
|
394
394
|
loading: !1,
|
|
395
395
|
disabled: !1
|
|
396
396
|
};
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
|
|
397
|
+
function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c, itemRender: x, ...y }) {
|
|
398
|
+
const p = J(null), b = ae(), [d, S] = E(!1), [v, C] = E(n !== null ? n : ""), P = Se(b.breakpoints.down("sm"));
|
|
399
|
+
j(() => {
|
|
400
400
|
C(n !== null ? n : "");
|
|
401
401
|
}, [n]);
|
|
402
|
-
const
|
|
402
|
+
const R = ne(() => {
|
|
403
403
|
S(!1);
|
|
404
|
-
}, []), i =
|
|
404
|
+
}, []), i = ne(() => {
|
|
405
405
|
S(!0);
|
|
406
406
|
}, []);
|
|
407
407
|
function h(k) {
|
|
408
|
-
C(k.value), c(k.value),
|
|
408
|
+
C(k.value), c(k.value), P && R();
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function m(k) {
|
|
411
411
|
return k === v;
|
|
412
412
|
}
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */ f(le, { children: [
|
|
414
|
+
/* @__PURE__ */ f(
|
|
415
415
|
Mt,
|
|
416
416
|
{
|
|
417
|
-
ref:
|
|
417
|
+
ref: p,
|
|
418
418
|
onClick: i,
|
|
419
419
|
variant: "outlined",
|
|
420
420
|
size: "small",
|
|
421
|
-
className: ["my-select__selector",
|
|
421
|
+
className: ["my-select__selector", pt(v) ? "" : "my-select__selector--active"].join(" "),
|
|
422
422
|
sx: { minWidth: "auto" },
|
|
423
423
|
...y,
|
|
424
424
|
children: [
|
|
425
425
|
/* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
|
|
426
426
|
e,
|
|
427
|
-
/* @__PURE__ */ t(Me, { className: "my-select__arrowdown", component:
|
|
427
|
+
/* @__PURE__ */ t(Me, { className: "my-select__arrowdown", component: ut, fontSize: "small" })
|
|
428
428
|
]
|
|
429
429
|
}
|
|
430
430
|
),
|
|
431
|
-
/* @__PURE__ */ t(
|
|
432
|
-
|
|
431
|
+
/* @__PURE__ */ t(Oe, { open: d, anchorEl: p.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: k, placement: $ }) => /* @__PURE__ */ t(Fe, { ...k, sx: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(Ee, { onClickAway: R, children: /* @__PURE__ */ f(Ot, { autoFocusItem: d, onMouseEnter: i, onMouseLeave: R, children: [
|
|
432
|
+
a,
|
|
433
433
|
s.map((w) => x ? x(w) : /* @__PURE__ */ t(
|
|
434
|
-
|
|
434
|
+
qe,
|
|
435
435
|
{
|
|
436
436
|
onClick: () => h(w),
|
|
437
437
|
className: [
|
|
438
438
|
"my-select__option",
|
|
439
|
-
|
|
439
|
+
m(w.value) ? "my-select__option--active" : ""
|
|
440
440
|
].join(" "),
|
|
441
441
|
children: w.name
|
|
442
442
|
},
|
|
@@ -445,7 +445,7 @@ function pe({ title: e, value: n, icon: r, prepend: l, options: s, onChange: c,
|
|
|
445
445
|
] }) }) }) }) })
|
|
446
446
|
] });
|
|
447
447
|
}
|
|
448
|
-
|
|
448
|
+
ce.propTypes = {
|
|
449
449
|
options: o.array.isRequired,
|
|
450
450
|
value: o.oneOfType([o.string, o.number, o.array]),
|
|
451
451
|
onChange: o.func,
|
|
@@ -454,7 +454,7 @@ pe.propTypes = {
|
|
|
454
454
|
icon: o.any,
|
|
455
455
|
prepend: o.any
|
|
456
456
|
};
|
|
457
|
-
|
|
457
|
+
ce.defaultProps = {
|
|
458
458
|
value: null,
|
|
459
459
|
icon: null,
|
|
460
460
|
prepend: null,
|
|
@@ -462,7 +462,7 @@ pe.defaultProps = {
|
|
|
462
462
|
onChange: () => {
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
|
-
const Mt = T(
|
|
465
|
+
const Mt = T(se)`
|
|
466
466
|
border: 1px solid #f0f0f0;
|
|
467
467
|
padding: 6px 8px 6px 12px;
|
|
468
468
|
font-weight: ${(e) => e.theme.typography.fontWeightBold};
|
|
@@ -493,7 +493,7 @@ const Mt = T(ue)`
|
|
|
493
493
|
margin-right: 3px;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
`,
|
|
496
|
+
`, Ot = T(Le)`
|
|
497
497
|
.my-select__option__icon {
|
|
498
498
|
color: transparent;
|
|
499
499
|
font-size: 16px;
|
|
@@ -510,15 +510,15 @@ const Mt = T(ue)`
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
`;
|
|
513
|
-
function
|
|
514
|
-
return /* @__PURE__ */
|
|
513
|
+
function U({ options: e, onChange: n, title: r, value: a }) {
|
|
514
|
+
return /* @__PURE__ */ f(Ft, { children: [
|
|
515
515
|
/* @__PURE__ */ t("div", { className: "title", children: r }),
|
|
516
516
|
/* @__PURE__ */ t("div", { className: "list", children: e.map((s) => /* @__PURE__ */ t(
|
|
517
517
|
"div",
|
|
518
518
|
{
|
|
519
519
|
title: s.name,
|
|
520
520
|
"data-cy": "filter",
|
|
521
|
-
className:
|
|
521
|
+
className: a === s.value ? "select item" : "item",
|
|
522
522
|
onClick: () => n(s.value),
|
|
523
523
|
children: s.name
|
|
524
524
|
},
|
|
@@ -526,7 +526,7 @@ function W({ options: e, onChange: n, title: r, value: l }) {
|
|
|
526
526
|
)) })
|
|
527
527
|
] });
|
|
528
528
|
}
|
|
529
|
-
const
|
|
529
|
+
const Ft = T("div")`
|
|
530
530
|
.title {
|
|
531
531
|
font-size: 18px;
|
|
532
532
|
font-weight: bold;
|
|
@@ -554,48 +554,48 @@ const qt = T("div")`
|
|
|
554
554
|
font-weight: bold;
|
|
555
555
|
}
|
|
556
556
|
`;
|
|
557
|
-
|
|
557
|
+
U.propTypes = {
|
|
558
558
|
title: o.string.isRequired,
|
|
559
559
|
options: o.array.isRequired,
|
|
560
560
|
onChange: o.func.isRequired,
|
|
561
561
|
value: o.oneOfType([o.string, o.number])
|
|
562
562
|
};
|
|
563
|
-
|
|
563
|
+
U.defaultProps = {
|
|
564
564
|
value: null
|
|
565
565
|
};
|
|
566
|
-
function
|
|
567
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice:
|
|
568
|
-
|
|
566
|
+
function ue() {
|
|
567
|
+
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N(), [y, p] = E(!1), b = (d, S) => {
|
|
568
|
+
d === "category" && n(S), d === "price" && a(S), p(!1);
|
|
569
569
|
};
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */ t(
|
|
572
|
-
/* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ f(At, { children: [
|
|
571
|
+
/* @__PURE__ */ t(ht, { variant: "outlined", className: "filter-button", onClick: () => p(!0), children: /* @__PURE__ */ t(dt, { className: "filter-icon", fontSize: "small" }) }),
|
|
572
|
+
/* @__PURE__ */ f(mt, { fullWidth: !0, title: "", open: y, onClose: () => p(!1), children: [
|
|
573
573
|
/* @__PURE__ */ t(
|
|
574
|
-
|
|
574
|
+
U,
|
|
575
575
|
{
|
|
576
576
|
title: r("common.price"),
|
|
577
577
|
options: x,
|
|
578
578
|
value: s.price,
|
|
579
|
-
onChange: (
|
|
580
|
-
b("price",
|
|
579
|
+
onChange: (d) => {
|
|
580
|
+
b("price", d);
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
),
|
|
584
584
|
c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
|
|
585
|
-
|
|
585
|
+
U,
|
|
586
586
|
{
|
|
587
587
|
title: r("common.category"),
|
|
588
588
|
options: c,
|
|
589
589
|
value: e,
|
|
590
|
-
onChange: (
|
|
591
|
-
b("category",
|
|
590
|
+
onChange: (d) => {
|
|
591
|
+
b("category", d);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
) })
|
|
595
595
|
] })
|
|
596
596
|
] });
|
|
597
597
|
}
|
|
598
|
-
const
|
|
598
|
+
const At = T("div")`
|
|
599
599
|
.filter-button {
|
|
600
600
|
border-color: rgb(240, 240, 240);
|
|
601
601
|
padding: 5px 8px;
|
|
@@ -606,9 +606,9 @@ const jt = T("div")`
|
|
|
606
606
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
607
607
|
}
|
|
608
608
|
`;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
const
|
|
609
|
+
ue.propTypes = {};
|
|
610
|
+
ue.defaultProps = {};
|
|
611
|
+
const Et = T("div")`
|
|
612
612
|
.MuiChip-root {
|
|
613
613
|
border-radius: 4px;
|
|
614
614
|
height: initial;
|
|
@@ -617,159 +617,159 @@ const Ut = T("div")`
|
|
|
617
617
|
padding: 4px 0;
|
|
618
618
|
}
|
|
619
619
|
`;
|
|
620
|
-
function
|
|
621
|
-
return e ? /* @__PURE__ */ t(
|
|
620
|
+
function q({ label: e, icon: n, onDelete: r, ...a }) {
|
|
621
|
+
return e ? /* @__PURE__ */ t(Et, { ...a, children: /* @__PURE__ */ t(Ce, { color: "primary", "data-cy": "filter-tag", icon: n, label: e, onDelete: r }) }) : null;
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
q.propTypes = {
|
|
624
624
|
label: o.string,
|
|
625
625
|
onDelete: o.func,
|
|
626
626
|
icon: o.element
|
|
627
627
|
};
|
|
628
|
-
|
|
628
|
+
q.defaultProps = {
|
|
629
629
|
onDelete: null,
|
|
630
630
|
icon: null,
|
|
631
631
|
label: null
|
|
632
632
|
};
|
|
633
|
-
function
|
|
633
|
+
function we() {
|
|
634
634
|
const { t: e } = N();
|
|
635
|
-
return /* @__PURE__ */ t(
|
|
635
|
+
return /* @__PURE__ */ t(Re, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
const { t: r, locale:
|
|
639
|
-
return /* @__PURE__ */
|
|
637
|
+
function X({ filterTip: e, keywordTip: n }) {
|
|
638
|
+
const { t: r, locale: a } = N(), s = () => a === "zh" ? "、" : " , ";
|
|
639
|
+
return /* @__PURE__ */ f(yt, { className: "tips", children: [
|
|
640
640
|
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
|
|
641
641
|
e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
|
|
642
642
|
e && n && s(),
|
|
643
643
|
n && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
|
|
644
644
|
] });
|
|
645
645
|
}
|
|
646
|
-
|
|
646
|
+
X.propTypes = {
|
|
647
647
|
filterTip: o.bool,
|
|
648
648
|
keywordTip: o.bool
|
|
649
649
|
};
|
|
650
|
-
|
|
650
|
+
X.defaultProps = {
|
|
651
651
|
filterTip: !1,
|
|
652
652
|
keywordTip: !1
|
|
653
653
|
};
|
|
654
|
-
function
|
|
655
|
-
return /* @__PURE__ */
|
|
654
|
+
function Z({ primaryStart: e, primaryEnd: n, filter: r }) {
|
|
655
|
+
return /* @__PURE__ */ f(Re, { variant: "subtitle2", children: [
|
|
656
656
|
/* @__PURE__ */ t("span", { children: e }),
|
|
657
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ f("span", { className: "primary", children: [
|
|
658
658
|
" ",
|
|
659
659
|
r,
|
|
660
660
|
" "
|
|
661
661
|
] }),
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ f("span", { children: [
|
|
663
663
|
n,
|
|
664
664
|
" "
|
|
665
665
|
] })
|
|
666
666
|
] });
|
|
667
667
|
}
|
|
668
|
-
|
|
668
|
+
Z.propTypes = {
|
|
669
669
|
primaryStart: o.string.isRequired,
|
|
670
670
|
primaryEnd: o.string.isRequired,
|
|
671
671
|
filter: o.string.isRequired
|
|
672
672
|
};
|
|
673
|
-
function
|
|
673
|
+
function qt(e) {
|
|
674
674
|
return e ? e.width > 900 ? 12 : e.width > 600 ? 8 : 4 : 0;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
const n =
|
|
678
|
-
return
|
|
679
|
-
r ||
|
|
680
|
-
}, [r]), e(n,
|
|
676
|
+
function ze({ children: e }) {
|
|
677
|
+
const n = J(null), [r, a] = E(null), s = Ze(r);
|
|
678
|
+
return j(() => {
|
|
679
|
+
r || a(n.current);
|
|
680
|
+
}, [r]), e(n, qt(s));
|
|
681
681
|
}
|
|
682
|
-
|
|
682
|
+
ze.propTypes = {
|
|
683
683
|
children: o.func.isRequired
|
|
684
684
|
};
|
|
685
|
-
function
|
|
685
|
+
function pe({ blocklets: e, ...n }) {
|
|
686
686
|
const {
|
|
687
687
|
blockletRender: r,
|
|
688
|
-
errors:
|
|
688
|
+
errors: a,
|
|
689
689
|
loadings: s,
|
|
690
690
|
selectedCategory: c,
|
|
691
691
|
getCategoryLocale: x,
|
|
692
692
|
filters: y,
|
|
693
|
-
t:
|
|
693
|
+
t: p,
|
|
694
694
|
hasNextPage: b,
|
|
695
|
-
loadMore:
|
|
695
|
+
loadMore: d,
|
|
696
696
|
endpoint: S
|
|
697
|
-
} = N(), v = !!c || !!y.price, [C] =
|
|
697
|
+
} = N(), v = !!c || !!y.price, [C] = gt({
|
|
698
698
|
loading: s.fetchBlockletsLoading || s.loadingMore,
|
|
699
699
|
hasNextPage: b,
|
|
700
|
-
onLoadMore:
|
|
700
|
+
onLoadMore: d
|
|
701
701
|
});
|
|
702
|
-
if (
|
|
702
|
+
if (a.fetchBlockletsError)
|
|
703
703
|
return /* @__PURE__ */ t(
|
|
704
|
-
|
|
704
|
+
Te,
|
|
705
705
|
{
|
|
706
|
-
error: new Error(`Failed to fetch blocklets from ${S}: ${
|
|
706
|
+
error: new Error(`Failed to fetch blocklets from ${S}: ${a.fetchBlockletsError.message}`)
|
|
707
707
|
}
|
|
708
708
|
);
|
|
709
709
|
if (s.fetchBlockletsLoading)
|
|
710
|
-
return /* @__PURE__ */ t(D, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(
|
|
710
|
+
return /* @__PURE__ */ t(D, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) });
|
|
711
711
|
if (y.keyword && v && e.length === 0)
|
|
712
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ f(Y, { children: [
|
|
713
713
|
/* @__PURE__ */ t(
|
|
714
|
-
|
|
714
|
+
Z,
|
|
715
715
|
{
|
|
716
|
-
primaryStart:
|
|
717
|
-
primaryEnd:
|
|
716
|
+
primaryStart: p("blocklet.noBlockletPart1"),
|
|
717
|
+
primaryEnd: p("blocklet.noBlockletPart2"),
|
|
718
718
|
filter: y.keyword
|
|
719
719
|
}
|
|
720
720
|
),
|
|
721
|
-
/* @__PURE__ */ t(
|
|
721
|
+
/* @__PURE__ */ t(X, { keywordTip: !0, filterTip: !0 })
|
|
722
722
|
] });
|
|
723
723
|
if (y.keyword && e.length === 0)
|
|
724
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ f(Y, { children: [
|
|
725
725
|
/* @__PURE__ */ t(
|
|
726
|
-
|
|
726
|
+
Z,
|
|
727
727
|
{
|
|
728
|
-
primaryStart:
|
|
729
|
-
primaryEnd:
|
|
728
|
+
primaryStart: p("blocklet.noBlockletPart1"),
|
|
729
|
+
primaryEnd: p("blocklet.noBlockletPart2"),
|
|
730
730
|
filter: y.keyword
|
|
731
731
|
}
|
|
732
732
|
),
|
|
733
|
-
/* @__PURE__ */ t(
|
|
733
|
+
/* @__PURE__ */ t(X, { keywordTip: !0 })
|
|
734
734
|
] });
|
|
735
735
|
if (v && e.length === 0) {
|
|
736
|
-
const
|
|
737
|
-
return /* @__PURE__ */
|
|
738
|
-
|
|
739
|
-
|
|
736
|
+
const P = x(c);
|
|
737
|
+
return /* @__PURE__ */ f(Y, { children: [
|
|
738
|
+
P ? /* @__PURE__ */ t(
|
|
739
|
+
Z,
|
|
740
740
|
{
|
|
741
|
-
primaryStart:
|
|
742
|
-
primaryEnd:
|
|
743
|
-
filter:
|
|
741
|
+
primaryStart: p("blocklet.noCategoryResults1"),
|
|
742
|
+
primaryEnd: p("blocklet.noCategoryResults2"),
|
|
743
|
+
filter: P
|
|
744
744
|
}
|
|
745
|
-
) : /* @__PURE__ */ t(
|
|
746
|
-
/* @__PURE__ */ t(
|
|
745
|
+
) : /* @__PURE__ */ t(we, {}),
|
|
746
|
+
/* @__PURE__ */ t(X, { filterTip: !0 })
|
|
747
747
|
] });
|
|
748
748
|
}
|
|
749
|
-
return e.length === 0 ? /* @__PURE__ */ t(
|
|
750
|
-
|
|
749
|
+
return e.length === 0 ? /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(we, {}) }) : /* @__PURE__ */ t(ze, { children: (P, R) => /* @__PURE__ */ f(
|
|
750
|
+
te,
|
|
751
751
|
{
|
|
752
752
|
...n,
|
|
753
753
|
container: !0,
|
|
754
754
|
spacing: 2,
|
|
755
|
-
columns:
|
|
755
|
+
columns: R,
|
|
756
756
|
disableEqualOverflow: !0,
|
|
757
|
-
ref:
|
|
757
|
+
ref: P,
|
|
758
758
|
sx: {
|
|
759
|
-
opacity: () =>
|
|
759
|
+
opacity: () => R > 0 ? 1 : 0
|
|
760
760
|
},
|
|
761
761
|
children: [
|
|
762
|
-
e.map((i) => /* @__PURE__ */ t(
|
|
763
|
-
b && /* @__PURE__ */ t(
|
|
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: C, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) }) })
|
|
764
764
|
]
|
|
765
765
|
}
|
|
766
766
|
) });
|
|
767
767
|
}
|
|
768
|
-
|
|
768
|
+
pe.propTypes = {
|
|
769
769
|
blocklets: o.array.isRequired
|
|
770
770
|
};
|
|
771
|
-
|
|
772
|
-
const
|
|
771
|
+
pe.defaultProps = {};
|
|
772
|
+
const Y = T(ft)`
|
|
773
773
|
text-align: center;
|
|
774
774
|
.primary {
|
|
775
775
|
color: ${(e) => e.theme.palette.primary.main};
|
|
@@ -778,12 +778,12 @@ const Z = T(bt)`
|
|
|
778
778
|
margin-top: ${(e) => e.theme.spacing(1)};
|
|
779
779
|
}
|
|
780
780
|
`;
|
|
781
|
-
function
|
|
782
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice:
|
|
783
|
-
return /* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
781
|
+
function de() {
|
|
782
|
+
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N();
|
|
783
|
+
return /* @__PURE__ */ f(jt, { children: [
|
|
784
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(U, { title: r("common.price"), options: x, value: s.price, onChange: a }) }),
|
|
785
785
|
c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
|
|
786
|
-
|
|
786
|
+
U,
|
|
787
787
|
{
|
|
788
788
|
title: r("common.category"),
|
|
789
789
|
options: c,
|
|
@@ -793,7 +793,7 @@ function he() {
|
|
|
793
793
|
) })
|
|
794
794
|
] });
|
|
795
795
|
}
|
|
796
|
-
const
|
|
796
|
+
const jt = T("aside")`
|
|
797
797
|
width: 220px;
|
|
798
798
|
margin-right: ${(e) => e.theme.spacing(2)};
|
|
799
799
|
height: 100%;
|
|
@@ -802,41 +802,41 @@ const Gt = T("aside")`
|
|
|
802
802
|
overflow-y: auto;
|
|
803
803
|
z-index: auto;
|
|
804
804
|
`;
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
function
|
|
808
|
-
const { filters: r, handleKeyword:
|
|
809
|
-
const { value:
|
|
810
|
-
c(
|
|
811
|
-
},
|
|
812
|
-
c(""),
|
|
805
|
+
de.propTypes = {};
|
|
806
|
+
de.defaultProps = {};
|
|
807
|
+
function me({ placeholder: e, ...n }) {
|
|
808
|
+
const { filters: r, handleKeyword: a } = N(), [s, c] = E(r.keyword || ""), x = et(a, { wait: 300 }), y = (b) => {
|
|
809
|
+
const { value: d } = b.target;
|
|
810
|
+
c(d), x.run(d);
|
|
811
|
+
}, p = () => {
|
|
812
|
+
c(""), a();
|
|
813
813
|
};
|
|
814
|
-
return
|
|
814
|
+
return j(() => {
|
|
815
815
|
c(r.keyword || "");
|
|
816
816
|
}, [r.keyword]), /* @__PURE__ */ t(
|
|
817
|
-
|
|
817
|
+
Ut,
|
|
818
818
|
{
|
|
819
819
|
inputProps: {
|
|
820
820
|
"data-cy": "search-blocklet"
|
|
821
821
|
},
|
|
822
|
-
startAdornment: /* @__PURE__ */ t(
|
|
822
|
+
startAdornment: /* @__PURE__ */ t(ge, { position: "start", children: /* @__PURE__ */ t(Wt, {}) }),
|
|
823
823
|
onChange: y,
|
|
824
824
|
placeholder: e,
|
|
825
825
|
value: s,
|
|
826
826
|
title: e,
|
|
827
827
|
"data-cy": "search",
|
|
828
|
-
endAdornment: s && /* @__PURE__ */ t(
|
|
828
|
+
endAdornment: s && /* @__PURE__ */ t(ge, { position: "end", children: /* @__PURE__ */ t(Gt, { "data-cy": "search-delete", onClick: p }) }),
|
|
829
829
|
...n
|
|
830
830
|
}
|
|
831
831
|
);
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
me.propTypes = {
|
|
834
834
|
placeholder: o.string
|
|
835
835
|
};
|
|
836
|
-
|
|
836
|
+
me.defaultProps = {
|
|
837
837
|
placeholder: "Type to search..."
|
|
838
838
|
};
|
|
839
|
-
const
|
|
839
|
+
const Ut = T(je)`
|
|
840
840
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
841
841
|
font-size: 14px;
|
|
842
842
|
border-radius: 6px;
|
|
@@ -853,21 +853,21 @@ const Kt = T(Ge)`
|
|
|
853
853
|
color: transparent;
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
-
`,
|
|
856
|
+
`, Wt = T(bt)`
|
|
857
857
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
858
858
|
font-size: 28px;
|
|
859
859
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
860
860
|
font-size: 24px;
|
|
861
861
|
}
|
|
862
|
-
`,
|
|
862
|
+
`, Gt = T(wt)`
|
|
863
863
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
864
864
|
font-size: 16px;
|
|
865
865
|
cursor: pointer;
|
|
866
866
|
`;
|
|
867
|
-
function
|
|
868
|
-
const r =
|
|
869
|
-
const { data: h } = await c.get(_.blockletsPath, { params: i }),
|
|
870
|
-
return
|
|
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: p, handleKeyword: b, t: d } = N(), S = async (i) => {
|
|
869
|
+
const { data: h } = await c.get(_.blockletsPath, { params: i }), m = h.dataList || [];
|
|
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
|
}, C = () => {
|
|
@@ -875,27 +875,27 @@ function ge({ onSelect: e, wrapChildren: n }) {
|
|
|
875
875
|
const i = r.current.querySelector("input.bl-autocomplete-input");
|
|
876
876
|
i && i.focus();
|
|
877
877
|
});
|
|
878
|
-
},
|
|
878
|
+
}, P = (i) => {
|
|
879
879
|
i.setIsOpen(!1), C();
|
|
880
|
-
},
|
|
880
|
+
}, R = ({ prevState: i, state: h }) => {
|
|
881
881
|
i.query !== h.query && (h.query || b());
|
|
882
882
|
};
|
|
883
|
-
return
|
|
883
|
+
return St(
|
|
884
884
|
"ctrl + k, command + k",
|
|
885
885
|
(i) => (i.stopPropagation(), i.preventDefault(), C(), !1),
|
|
886
886
|
{ enableOnTags: ["INPUT"] }
|
|
887
|
-
),
|
|
887
|
+
), j(() => {
|
|
888
888
|
C();
|
|
889
|
-
}, [
|
|
889
|
+
}, [p]), j(() => {
|
|
890
890
|
if (!r.current)
|
|
891
891
|
return;
|
|
892
|
-
const i =
|
|
892
|
+
const i = kt({
|
|
893
893
|
container: r.current,
|
|
894
|
-
renderer: { createElement:
|
|
894
|
+
renderer: { createElement: Ve, Fragment: Je, render: () => {
|
|
895
895
|
} },
|
|
896
|
-
render({ children: h },
|
|
896
|
+
render({ children: h }, m) {
|
|
897
897
|
var k;
|
|
898
|
-
(!
|
|
898
|
+
(!a.current || s.current !== m) && (s.current = m, (k = a.current) == null || k.unmount(), a.current = xt(m)), a.current.render(n(h));
|
|
899
899
|
},
|
|
900
900
|
autoFocus: !0,
|
|
901
901
|
openOnFocus: !1,
|
|
@@ -909,35 +909,35 @@ function ge({ onSelect: e, wrapChildren: n }) {
|
|
|
909
909
|
detachedContainer: "bl-autocomplete-detached-container"
|
|
910
910
|
},
|
|
911
911
|
translations: {
|
|
912
|
-
clearButtonTitle:
|
|
913
|
-
detachedCancelButtonText:
|
|
914
|
-
submitButtonTitle:
|
|
915
|
-
detachedSearchButtonTitle:
|
|
912
|
+
clearButtonTitle: d("common.clear"),
|
|
913
|
+
detachedCancelButtonText: d("common.cancel"),
|
|
914
|
+
submitButtonTitle: d("common.search"),
|
|
915
|
+
detachedSearchButtonTitle: d("common.search")
|
|
916
916
|
},
|
|
917
|
-
placeholder:
|
|
917
|
+
placeholder: d("common.searchStore"),
|
|
918
918
|
initialState: {
|
|
919
919
|
query: y.keyword
|
|
920
920
|
},
|
|
921
921
|
onStateChange(h) {
|
|
922
|
-
|
|
922
|
+
R(h);
|
|
923
923
|
},
|
|
924
924
|
onSubmit: v,
|
|
925
925
|
onReset(h) {
|
|
926
|
-
|
|
926
|
+
P(h);
|
|
927
927
|
},
|
|
928
|
-
getSources({ query: h, state:
|
|
929
|
-
const
|
|
928
|
+
getSources({ query: h, state: m, ...k }) {
|
|
929
|
+
const $ = {
|
|
930
930
|
...y,
|
|
931
931
|
sortBy: _[y.sortBy],
|
|
932
932
|
page: 1,
|
|
933
933
|
pageSize: 10,
|
|
934
934
|
keyword: h
|
|
935
935
|
};
|
|
936
|
-
return
|
|
936
|
+
return zt([
|
|
937
937
|
{
|
|
938
938
|
sourceId: "blocklets",
|
|
939
939
|
getItems() {
|
|
940
|
-
return S(
|
|
940
|
+
return S($);
|
|
941
941
|
},
|
|
942
942
|
// 选中后填充 搜索框中值
|
|
943
943
|
getItemInputValue({ item: w }) {
|
|
@@ -947,16 +947,16 @@ function ge({ onSelect: e, wrapChildren: n }) {
|
|
|
947
947
|
onSelect({ event: w, item: L }) {
|
|
948
948
|
return L.type === "more-result" ? (k.setIsOpen(!1), b(h)) : w.type === "keydown" ? b(L.title) : e({
|
|
949
949
|
blocklet: L,
|
|
950
|
-
detailUrl:
|
|
951
|
-
storeUrl:
|
|
950
|
+
detailUrl: nt(p, `/blocklets/${L.did}`),
|
|
951
|
+
storeUrl: p
|
|
952
952
|
});
|
|
953
953
|
},
|
|
954
954
|
templates: {
|
|
955
955
|
item({ item: w }) {
|
|
956
|
-
return w.type === "more-result" ? /* @__PURE__ */ t("div", { children:
|
|
956
|
+
return w.type === "more-result" ? /* @__PURE__ */ t("div", { children: d("autocomplete.expandResult", { name: h, number: w.total.toLocaleString() }) }) : x({ blocklet: w, autocompleteSetters: k });
|
|
957
957
|
},
|
|
958
958
|
noResults() {
|
|
959
|
-
return
|
|
959
|
+
return d("blocklet.noResults");
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
}
|
|
@@ -966,11 +966,11 @@ function ge({ onSelect: e, wrapChildren: n }) {
|
|
|
966
966
|
return () => {
|
|
967
967
|
i.destroy();
|
|
968
968
|
};
|
|
969
|
-
}, [y, x]), /* @__PURE__ */
|
|
969
|
+
}, [y, x]), /* @__PURE__ */ f(le, { children: [
|
|
970
970
|
/* @__PURE__ */ t(
|
|
971
|
-
|
|
971
|
+
xe,
|
|
972
972
|
{
|
|
973
|
-
styles:
|
|
973
|
+
styles: ke`
|
|
974
974
|
.bl-autocomplete-detached-container {
|
|
975
975
|
.bl-autocomplete-detached-cancel {
|
|
976
976
|
white-space: nowrap;
|
|
@@ -982,70 +982,70 @@ function ge({ onSelect: e, wrapChildren: n }) {
|
|
|
982
982
|
/* @__PURE__ */ t("div", { className: "bl-search-container", ref: r })
|
|
983
983
|
] });
|
|
984
984
|
}
|
|
985
|
-
|
|
985
|
+
he.propTypes = {
|
|
986
986
|
onSelect: o.func.isRequired,
|
|
987
987
|
wrapChildren: o.func
|
|
988
988
|
};
|
|
989
|
-
|
|
989
|
+
he.defaultProps = {
|
|
990
990
|
wrapChildren: (e) => e
|
|
991
991
|
};
|
|
992
|
-
function
|
|
993
|
-
const { filters: n, handleSwitchShowResources: r } = N(),
|
|
992
|
+
function fe({ t: e }) {
|
|
993
|
+
const { filters: n, handleSwitchShowResources: r } = N(), a = () => {
|
|
994
994
|
n.showResources = !n.showResources, r();
|
|
995
995
|
};
|
|
996
996
|
return /* @__PURE__ */ t(
|
|
997
|
-
|
|
997
|
+
Ct,
|
|
998
998
|
{
|
|
999
999
|
checked: n.showResources,
|
|
1000
|
-
onChange:
|
|
1000
|
+
onChange: a,
|
|
1001
1001
|
labelProps: {
|
|
1002
|
-
label: /* @__PURE__ */ t(
|
|
1002
|
+
label: /* @__PURE__ */ t(ve, { marginLeft: "8px", fontSize: "small", children: /* @__PURE__ */ t("span", { children: e("common.showResources") }) })
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
1005
|
);
|
|
1006
1006
|
}
|
|
1007
|
-
|
|
1007
|
+
fe.propTypes = {
|
|
1008
1008
|
t: o.func.isRequired
|
|
1009
1009
|
};
|
|
1010
|
-
|
|
1011
|
-
function
|
|
1012
|
-
var
|
|
1010
|
+
fe.defaultProps = {};
|
|
1011
|
+
function Kt() {
|
|
1012
|
+
var K, H;
|
|
1013
1013
|
const {
|
|
1014
1014
|
handleDeveloper: e,
|
|
1015
1015
|
blockletList: n,
|
|
1016
1016
|
filters: r,
|
|
1017
|
-
developerName:
|
|
1017
|
+
developerName: a,
|
|
1018
1018
|
handleSort: s,
|
|
1019
1019
|
handleCategory: c,
|
|
1020
1020
|
handlePrice: x,
|
|
1021
1021
|
handleSearchSelect: y,
|
|
1022
|
-
t:
|
|
1022
|
+
t: p,
|
|
1023
1023
|
getCategoryLocale: b,
|
|
1024
|
-
priceOptions:
|
|
1024
|
+
priceOptions: d,
|
|
1025
1025
|
wrapChildren: S,
|
|
1026
1026
|
showResourcesSwitch: v,
|
|
1027
1027
|
showCategory: C,
|
|
1028
|
-
baseSearch:
|
|
1029
|
-
onFilterChange:
|
|
1028
|
+
baseSearch: P,
|
|
1029
|
+
onFilterChange: R,
|
|
1030
1030
|
tagFilters: i
|
|
1031
|
-
} = N(), h =
|
|
1031
|
+
} = N(), h = vt(p), m = ((K = h.find((g) => g.value === r.sortBy)) == null ? void 0 : K.name) || p("sort.sort"), k = b(r.category), { resourceType: $ } = r || {}, w = (H = d.find((g) => g.value === r.price)) == null ? void 0 : H.name, [L, I] = E(!1), W = ae(), ee = Se(() => W.breakpoints.down("md")), O = Pe({
|
|
1032
1032
|
chooseTagId: ""
|
|
1033
|
-
}),
|
|
1034
|
-
O.chooseTagId =
|
|
1035
|
-
typeof
|
|
1036
|
-
}),
|
|
1037
|
-
}),
|
|
1038
|
-
return
|
|
1039
|
-
const
|
|
1040
|
-
const
|
|
1041
|
-
return
|
|
1033
|
+
}), G = tt((g) => {
|
|
1034
|
+
O.chooseTagId = g.id, ["category", "resourceType", "resourceDid"].forEach((M) => {
|
|
1035
|
+
typeof g.params[M] > "u" ? delete r[M] : r[M] = g.params[M];
|
|
1036
|
+
}), R(r);
|
|
1037
|
+
}), F = rt(() => i.find((g) => g.id === O.chooseTagId), [O.chooseTagId]);
|
|
1038
|
+
return ot(() => {
|
|
1039
|
+
const g = lt(window.location.search), Q = i.find((M) => {
|
|
1040
|
+
const l = M.params;
|
|
1041
|
+
return l ? Object.keys(l).every((u) => g[u] === l[u]) : !1;
|
|
1042
1042
|
});
|
|
1043
|
-
|
|
1044
|
-
}), /* @__PURE__ */
|
|
1045
|
-
C ? /* @__PURE__ */ t(
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1043
|
+
Q ? G(Q) : i.length > 0 && G(i[0]);
|
|
1044
|
+
}), /* @__PURE__ */ f(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
|
|
1045
|
+
C ? /* @__PURE__ */ t(ye, { mdDown: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
|
|
1046
|
+
/* @__PURE__ */ f(Ht, { children: [
|
|
1047
|
+
/* @__PURE__ */ f(Qt, { children: [
|
|
1048
|
+
/* @__PURE__ */ f(
|
|
1049
1049
|
D,
|
|
1050
1050
|
{
|
|
1051
1051
|
className: "filter-bar",
|
|
@@ -1062,7 +1062,7 @@ function Vt() {
|
|
|
1062
1062
|
gap: 1
|
|
1063
1063
|
},
|
|
1064
1064
|
children: [
|
|
1065
|
-
C ? /* @__PURE__ */ t(
|
|
1065
|
+
C ? /* @__PURE__ */ t(ye, { mdUp: !0, children: /* @__PURE__ */ t(ue, {}) }) : null,
|
|
1066
1066
|
/* @__PURE__ */ t(
|
|
1067
1067
|
"form",
|
|
1068
1068
|
{
|
|
@@ -1071,29 +1071,29 @@ function Vt() {
|
|
|
1071
1071
|
flex: 1,
|
|
1072
1072
|
width: "100%"
|
|
1073
1073
|
},
|
|
1074
|
-
onSubmit: (
|
|
1075
|
-
|
|
1074
|
+
onSubmit: (g) => {
|
|
1075
|
+
g.preventDefault(), g.stopPropagation();
|
|
1076
1076
|
},
|
|
1077
1077
|
onFocus: () => {
|
|
1078
|
-
|
|
1078
|
+
I(!0);
|
|
1079
1079
|
},
|
|
1080
1080
|
onBlur: () => {
|
|
1081
|
-
|
|
1081
|
+
I(!1);
|
|
1082
1082
|
},
|
|
1083
|
-
children:
|
|
1083
|
+
children: P ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: p("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: y, wrapChildren: S })
|
|
1084
1084
|
}
|
|
1085
1085
|
),
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
!
|
|
1086
|
+
/* @__PURE__ */ f(D, { className: "filter-container", display: "flex", alignItems: "center", children: [
|
|
1087
|
+
!ee && v && /* @__PURE__ */ t(D, { ml: 1, mr: 1, children: /* @__PURE__ */ t(fe, { t: p }) }),
|
|
1088
1088
|
/* @__PURE__ */ t(
|
|
1089
|
-
|
|
1089
|
+
ce,
|
|
1090
1090
|
{
|
|
1091
1091
|
value: r.sortBy,
|
|
1092
1092
|
options: h,
|
|
1093
|
-
title:
|
|
1094
|
-
icon: /* @__PURE__ */ t(
|
|
1095
|
-
onChange: (
|
|
1096
|
-
s(
|
|
1093
|
+
title: m,
|
|
1094
|
+
icon: /* @__PURE__ */ t(_e, {}),
|
|
1095
|
+
onChange: (g) => {
|
|
1096
|
+
s(g);
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
)
|
|
@@ -1101,19 +1101,19 @@ function Vt() {
|
|
|
1101
1101
|
]
|
|
1102
1102
|
}
|
|
1103
1103
|
),
|
|
1104
|
-
C ? /* @__PURE__ */
|
|
1104
|
+
C ? /* @__PURE__ */ f(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
|
|
1105
1105
|
/* @__PURE__ */ t(
|
|
1106
|
-
|
|
1106
|
+
q,
|
|
1107
1107
|
{
|
|
1108
|
-
label:
|
|
1109
|
-
icon: /* @__PURE__ */ t(
|
|
1108
|
+
label: a,
|
|
1109
|
+
icon: /* @__PURE__ */ t(We, {}),
|
|
1110
1110
|
onDelete: () => {
|
|
1111
1111
|
e(null);
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
),
|
|
1115
1115
|
/* @__PURE__ */ t(
|
|
1116
|
-
|
|
1116
|
+
q,
|
|
1117
1117
|
{
|
|
1118
1118
|
label: k,
|
|
1119
1119
|
onDelete: () => {
|
|
@@ -1122,7 +1122,7 @@ function Vt() {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
),
|
|
1124
1124
|
/* @__PURE__ */ t(
|
|
1125
|
-
|
|
1125
|
+
q,
|
|
1126
1126
|
{
|
|
1127
1127
|
label: w,
|
|
1128
1128
|
onDelete: () => {
|
|
@@ -1130,30 +1130,30 @@ function Vt() {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
),
|
|
1133
|
-
|
|
1133
|
+
$ && /* @__PURE__ */ t(q, { label: `${p("common.resourceType")}: ${$}` })
|
|
1134
1134
|
] }) : null
|
|
1135
1135
|
] }),
|
|
1136
|
-
/* @__PURE__ */ t(
|
|
1137
|
-
(i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */ t(
|
|
1139
|
-
|
|
1136
|
+
/* @__PURE__ */ t(Ge, { FallbackComponent: Te, children: /* @__PURE__ */ f(D, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
|
|
1137
|
+
(i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */ f(le, { children: [
|
|
1138
|
+
/* @__PURE__ */ t(Ue, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: i.map((g) => /* @__PURE__ */ t(
|
|
1139
|
+
Ce,
|
|
1140
1140
|
{
|
|
1141
|
-
label:
|
|
1141
|
+
label: g.title,
|
|
1142
1142
|
size: "small",
|
|
1143
|
-
variant: O.chooseTagId ===
|
|
1144
|
-
onClick: () =>
|
|
1145
|
-
color: O.chooseTagId ===
|
|
1143
|
+
variant: O.chooseTagId === g.id ? "contained" : "outlined",
|
|
1144
|
+
onClick: () => G(g),
|
|
1145
|
+
color: O.chooseTagId === g.id ? "primary" : "default"
|
|
1146
1146
|
},
|
|
1147
|
-
|
|
1147
|
+
g.id
|
|
1148
1148
|
)) }),
|
|
1149
|
-
|
|
1149
|
+
F ? /* @__PURE__ */ t(D, { mb: 2, children: F.description ? /* @__PURE__ */ t(ve, { variant: "body1", children: F.description }) : null }) : null
|
|
1150
1150
|
] }) : null,
|
|
1151
|
-
/* @__PURE__ */ t(
|
|
1151
|
+
/* @__PURE__ */ t(pe, { blocklets: n })
|
|
1152
1152
|
] }) })
|
|
1153
1153
|
] })
|
|
1154
1154
|
] });
|
|
1155
1155
|
}
|
|
1156
|
-
const
|
|
1156
|
+
const Ht = T("main")`
|
|
1157
1157
|
display: flex;
|
|
1158
1158
|
flex-direction: column;
|
|
1159
1159
|
flex: 1;
|
|
@@ -1191,15 +1191,15 @@ const Jt = T("main")`
|
|
|
1191
1191
|
font-size: 12px;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
`,
|
|
1194
|
+
`, Qt = T("div")`
|
|
1195
1195
|
position: sticky;
|
|
1196
1196
|
top: 0;
|
|
1197
1197
|
z-index: 9;
|
|
1198
1198
|
background-color: white;
|
|
1199
1199
|
`;
|
|
1200
|
-
function
|
|
1201
|
-
const n =
|
|
1202
|
-
autocomplete:
|
|
1200
|
+
function De(e) {
|
|
1201
|
+
const n = ae(), r = $t(n.palette.primary.main), a = {
|
|
1202
|
+
autocomplete: ke`
|
|
1203
1203
|
:root {
|
|
1204
1204
|
--aa-detached-media-query: (max-width: ${n.breakpoints.values.md}px) !important;
|
|
1205
1205
|
--aa-detached-modal-media-query: (min-width: ${n.breakpoints.values.md}px) !important;
|
|
@@ -1237,13 +1237,13 @@ function Ne(e) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
`
|
|
1239
1239
|
};
|
|
1240
|
-
return /* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */ t(
|
|
1242
|
-
/* @__PURE__ */ t(
|
|
1240
|
+
return /* @__PURE__ */ f(ie, { ...e, children: [
|
|
1241
|
+
/* @__PURE__ */ t(xe, { styles: a.autocomplete }),
|
|
1242
|
+
/* @__PURE__ */ t(Kt, {})
|
|
1243
1243
|
] });
|
|
1244
1244
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1245
|
+
De.propTypes = Be;
|
|
1246
|
+
De.defaultProps = $e;
|
|
1247
1247
|
export {
|
|
1248
|
-
|
|
1248
|
+
De as default
|
|
1249
1249
|
};
|