@blocklet/list 0.12.49 → 0.12.50

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 CHANGED
@@ -1,38 +1,38 @@
1
- import { jsx as t, jsxs as f, Fragment as Ce } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as h, Fragment as Pe } from "react/jsx-runtime";
2
2
  import { useTheme as pe } from "@mui/material/styles";
3
- import { css as Pe, Global as Te } from "@emotion/react";
3
+ import { css as Te, Global as Be } from "@emotion/react";
4
4
  import { styled as C } from "@arcblock/ux/lib/Theme";
5
- import Be from "@mui/icons-material/Sort";
6
- import { Button as $e, CircularProgress as W, MenuList as Re, useMediaQuery as ze, SvgIcon as Ie, Popper as _e, Grow as De, Paper as Ne, ClickAwayListener as Ae, MenuItem as Le, Chip as Me, Grid as ue, Box as D, OutlinedInput as Oe, InputAdornment as le, Hidden as ae } from "@mui/material";
7
- import Fe from "@mui/icons-material/Face";
8
- import { ErrorBoundary as Ee } from "react-error-boundary";
5
+ import $e from "@mui/icons-material/Sort";
6
+ import { Button as Re, CircularProgress as W, MenuList as ze, useMediaQuery as Ie, SvgIcon as _e, Popper as De, Grow as Ne, Paper as Ae, ClickAwayListener as Le, MenuItem as Me, Chip as Oe, Grid as ue, Box as D, OutlinedInput as Fe, InputAdornment as le, Hidden as ae } from "@mui/material";
7
+ import Ee from "@mui/icons-material/Face";
8
+ import { ErrorBoundary as qe } from "react-error-boundary";
9
9
  import { ErrorFallback as de } from "@arcblock/ux/lib/ErrorBoundary";
10
- import { createContext as qe, useMemo as L, useState as F, useCallback as H, useEffect as E, useContext as je, forwardRef as Ge, useRef as M, memo as Ue, createElement as Ke, Fragment as We } from "react";
11
- import n from "prop-types";
12
- import { useReactive as He, useInfiniteScroll as Ve, useRequest as Qe, useSize as Je, useCreation as Xe, useDebounceFn as Ye } from "ahooks";
13
- import Ze from "lodash/orderBy";
14
- import et from "axios";
15
- import tt from "json-stable-stringify";
10
+ import { createContext as je, useMemo as L, useState as F, useCallback as H, useEffect as E, useContext as Ge, forwardRef as Ue, useRef as M, memo as Ke, createElement as We, Fragment as He } from "react";
11
+ import o from "prop-types";
12
+ import { useReactive as Ve, useInfiniteScroll as Qe, useRequest as Je, useSize as Xe, useCreation as Ye, useDebounceFn as Ze } from "ahooks";
13
+ import et from "lodash/orderBy";
14
+ import tt from "axios";
15
+ import rt from "json-stable-stringify";
16
16
  import "lodash/cloneDeep";
17
- import rt from "color";
17
+ import ot from "color";
18
18
  import ie from "flat";
19
- import ot from "@mui/icons-material/KeyboardArrowDown";
20
- import nt from "lodash/isEmpty";
21
- import lt from "@mui/icons-material/FilterAltOutlined";
22
- import at from "@arcblock/ux/lib/Dialog";
23
- import it from "@mui/material/Button";
24
- import st from "@arcblock/ux/lib/Empty";
25
- import ct from "react-infinite-scroll-hook";
26
- import pt from "@mui/material/Box";
19
+ import nt from "@mui/icons-material/KeyboardArrowDown";
20
+ import lt from "lodash/isEmpty";
21
+ import at from "@mui/icons-material/FilterAltOutlined";
22
+ import it from "@arcblock/ux/lib/Dialog";
23
+ import st from "@mui/material/Button";
24
+ import ct from "@arcblock/ux/lib/Empty";
25
+ import pt from "react-infinite-scroll-hook";
26
+ import ut from "@mui/material/Box";
27
27
  import me from "@mui/material/Typography";
28
- import ut from "@mui/icons-material/Search";
29
- import dt from "@mui/icons-material/Close";
30
- import { createRoot as mt } from "react-dom/client";
31
- import { autocomplete as ft } from "@algolia/autocomplete-js";
32
- import { useHotkeys as ht } from "react-hotkeys-hook";
33
- import gt from "url-join";
28
+ import dt from "@mui/icons-material/Search";
29
+ import mt from "@mui/icons-material/Close";
30
+ import { createRoot as ft } from "react-dom/client";
31
+ import { autocomplete as ht } from "@algolia/autocomplete-js";
32
+ import { useHotkeys as gt } from "react-hotkeys-hook";
33
+ import yt from "url-join";
34
34
  import "@algolia/autocomplete-theme-classic/dist/theme.css";
35
- const yt = (e) => [
35
+ const bt = (e) => [
36
36
  {
37
37
  name: e("sort.popularity"),
38
38
  value: "popularity"
@@ -49,25 +49,25 @@ const yt = (e) => [
49
49
  name: e("sort.nameDescend"),
50
50
  value: "nameDesc"
51
51
  }
52
- ], bt = (e) => [
52
+ ], xt = (e) => [
53
53
  { name: e("blocklet.free"), value: "free" },
54
54
  { name: e("blocklet.payment"), value: "payment" }
55
- ], xt = (e = [], o = "en") => e.map((r) => ({ name: r.locales[o] || `Category.${o}`, value: r._id })), kt = (e, o) => (
55
+ ], kt = (e = [], n = "en") => e.map((r) => ({ name: r.locales[n] || `Category.${n}`, value: r._id })), wt = (e, n) => (
56
56
  // eslint-disable-next-line no-prototype-builtins
57
- e.replace(/{(\w*)}/g, (r, l) => o.hasOwnProperty(l) ? o[l] : "")
58
- ), wt = () => window.innerWidth <= 600, vt = (e, o) => {
59
- const r = (e + o) / o;
57
+ e.replace(/{(\w*)}/g, (r, l) => n.hasOwnProperty(l) ? n[l] : "")
58
+ ), vt = () => window.innerWidth <= 600, St = (e, n) => {
59
+ const r = (e + n) / n;
60
60
  return r > 1 ? r.toFixed() : 1;
61
- }, St = (e) => rt(e).rgb().object();
62
- function Ct(e, o) {
61
+ }, Ct = (e) => ot(e).rgb().object();
62
+ function Pt(e, n) {
63
63
  let r;
64
64
  return function(...i) {
65
- return r && clearTimeout(r), new Promise((s) => {
66
- r = setTimeout(() => s(e(...i)), o);
65
+ return r && clearTimeout(r), new Promise((c) => {
66
+ r = setTimeout(() => c(e(...i)), n);
67
67
  });
68
68
  };
69
69
  }
70
- const Pt = Ct((e) => Promise.resolve(e), 300), Tt = {
70
+ const Tt = Pt((e) => Promise.resolve(e), 300), Bt = {
71
71
  common: {
72
72
  searchStore: "Search the store",
73
73
  price: "Price",
@@ -102,7 +102,7 @@ const Pt = Ct((e) => Promise.resolve(e), 300), Tt = {
102
102
  autocomplete: {
103
103
  expandResult: 'Show {number} search results for "{name}" '
104
104
  }
105
- }, Bt = {
105
+ }, $t = {
106
106
  common: {
107
107
  searchStore: "搜索商店内应用",
108
108
  price: "价格",
@@ -138,26 +138,28 @@ const Pt = Ct((e) => Promise.resolve(e), 300), Tt = {
138
138
  expandResult: "显示 {number} 条 “{name}” 的搜索结果 "
139
139
  }
140
140
  }, K = {
141
- en: ie(Tt),
142
- zh: ie(Bt)
141
+ en: ie(Bt),
142
+ zh: ie($t)
143
143
  }, fe = {
144
- filters: n.shape({
145
- keyword: n.string,
146
- sortBy: n.string,
147
- sortDirection: n.string,
148
- price: n.string,
149
- category: n.string,
150
- developer: n.string,
151
- resourceType: n.string
144
+ filters: o.shape({
145
+ keyword: o.string,
146
+ sortBy: o.string,
147
+ sortDirection: o.string,
148
+ price: o.string,
149
+ category: o.string,
150
+ developer: o.string,
151
+ resourceType: o.string
152
152
  }),
153
- wrapChildren: n.func,
154
- extraFilter: n.func,
155
- endpoint: n.string.isRequired,
156
- blockletRender: n.func.isRequired,
157
- onFilterChange: n.func,
158
- onSearchSelect: n.func,
159
- locale: n.oneOf(["zh", "en"]),
160
- baseSearch: n.bool
153
+ wrapChildren: o.func,
154
+ extraFilter: o.func,
155
+ endpoint: o.string.isRequired,
156
+ blockletRender: o.func.isRequired,
157
+ onFilterChange: o.func,
158
+ onSearchSelect: o.func,
159
+ locale: o.oneOf(["zh", "en"]),
160
+ baseSearch: o.bool,
161
+ // sometimes blocklet list can be rendered only before the category is fetched
162
+ fetchCategoryDelay: o.number
161
163
  }, he = {
162
164
  locale: "zh",
163
165
  filters: {},
@@ -168,7 +170,8 @@ const Pt = Ct((e) => Promise.resolve(e), 300), Tt = {
168
170
  },
169
171
  wrapChildren: (e) => e,
170
172
  extraFilter: (e) => e,
171
- baseSearch: !1
173
+ baseSearch: !1,
174
+ fetchCategoryDelay: 0
172
175
  }, R = {
173
176
  nameAsc: "title",
174
177
  nameDesc: "title",
@@ -180,165 +183,168 @@ const Pt = Ct((e) => Promise.resolve(e), 300), Tt = {
180
183
  blockletsPath: "/api/v2/blocklets.json",
181
184
  categoriesPath: "/api/blocklets/categories",
182
185
  cacheSize: 100
183
- }, ge = qe({}), { Provider: $t, Consumer: Sr } = ge;
186
+ }, ge = je({}), { Provider: Rt, Consumer: Cr } = ge;
184
187
  function V({
185
188
  filters: e,
186
- children: o,
189
+ children: n,
187
190
  endpoint: r,
188
191
  locale: l,
189
192
  blockletRender: i,
190
- onFilterChange: s,
193
+ onFilterChange: c,
191
194
  onSearchSelect: k,
192
- extraFilter: h,
193
- wrapChildren: u,
194
- baseSearch: b,
195
- serverVersion: m,
196
- storeVersion: P
195
+ extraFilter: g,
196
+ wrapChildren: p,
197
+ baseSearch: y,
198
+ serverVersion: f,
199
+ storeVersion: P,
200
+ fetchCategoryDelay: B
197
201
  }) {
198
- const T = {};
199
- m && (T["x-blocklet-server-version"] = m), P && (T["x-blocklet-store-version"] = P);
200
- const x = L(() => et.create({
202
+ const b = {};
203
+ f && (b["x-blocklet-server-version"] = f), P && (b["x-blocklet-store-version"] = P);
204
+ const $ = L(() => tt.create({
201
205
  baseURL: r,
202
- headers: T
203
- }), [r]), g = L(() => ({ sortBy: "popularity", sortDirection: "desc", ...e }), [e]), B = g.category, p = He({
206
+ headers: b
207
+ }), [r]), d = L(() => ({ sortBy: "popularity", sortDirection: "desc", ...e }), [e]), u = d.category, s = Ve({
204
208
  currentPage: R.currentPage,
205
- pageSize: wt() ? R.mobilePageSize : R.pageSize,
209
+ pageSize: vt() ? R.mobilePageSize : R.pageSize,
206
210
  defaultCurrentPage: R.defaultCurrentPage
207
- }), [c, w] = F(null), {
208
- data: y = { list: [], total: 0 },
209
- loading: $,
210
- loadMore: v,
211
- loadingMore: _
212
- } = Ve(
211
+ }), [S, x] = F(null), {
212
+ data: T = { list: [], total: 0 },
213
+ loading: w,
214
+ loadMore: _,
215
+ loadingMore: be
216
+ } = Qe(
213
217
  async (a) => {
214
218
  var z;
215
- const d = {
216
- ...g,
217
- sortBy: R[g.sortBy],
218
- page: vt(((z = a == null ? void 0 : a.list) == null ? void 0 : z.length) || 0, p.pageSize),
219
- pageSize: p.pageSize
219
+ const m = {
220
+ ...d,
221
+ sortBy: R[d.sortBy],
222
+ page: St(((z = a == null ? void 0 : a.list) == null ? void 0 : z.length) || 0, s.pageSize),
223
+ pageSize: s.pageSize
220
224
  };
221
- w(null);
222
- const { data: S = {} } = await x.get(R.blockletsPath, {
223
- params: d
225
+ x(null);
226
+ const { data: v = {} } = await $.get(R.blockletsPath, {
227
+ params: m
224
228
  });
225
- return { list: (S == null ? void 0 : S.dataList) || [], total: (S == null ? void 0 : S.total) || 0 };
229
+ return { list: (v == null ? void 0 : v.dataList) || [], total: (v == null ? void 0 : v.total) || 0 };
226
230
  },
227
231
  {
228
232
  isNoMore: (a) => a ? a.list.length >= a.total : !1,
229
- reloadDeps: [r, tt(e)],
233
+ reloadDeps: [r, rt(e)],
230
234
  onError: (a) => {
231
- w(a);
235
+ x(a);
232
236
  }
233
237
  }
234
238
  ), {
235
239
  data: G = [],
236
- error: be,
237
- loading: xe,
238
- run: ke
239
- } = Qe(
240
+ error: xe,
241
+ loading: ke,
242
+ run: we
243
+ } = Je(
240
244
  async () => {
241
- const { data: a } = await x.get(R.categoriesPath);
245
+ const { data: a } = await $.get(R.categoriesPath);
242
246
  return Array.isArray(a) ? a : [];
243
247
  },
244
248
  { manual: !0 }
245
- ), U = L(() => Ze(G || [], [(d) => d.name], ["asc"]), [G]), re = H(
246
- (a, d) => {
247
- const S = K[l] ? K[l][a] : K.en[a];
248
- return kt(S, d);
249
+ ), U = L(() => et(G || [], [(m) => m.name], ["asc"]), [G]), re = H(
250
+ (a, m) => {
251
+ const v = K[l] ? K[l][a] : K.en[a];
252
+ return wt(v, m);
249
253
  },
250
254
  [l]
251
255
  ), oe = L(() => {
252
- let a = y.list || [];
253
- return a = h(a), a;
254
- }, [y, h]), we = L(() => xt(U, l), [U, l]), ve = bt(re), Se = {
255
- errors: { fetchBlockletsError: c, fetchCategoriesError: be },
256
- loadings: { fetchBlockletsLoading: $, fetchCategoriesLoading: xe, loadingMore: _ },
256
+ let a = T.list || [];
257
+ return a = g(a), a;
258
+ }, [T, g]), ve = L(() => kt(U, l), [U, l]), Se = xt(re), Ce = {
259
+ errors: { fetchBlockletsError: S, fetchCategoriesError: xe },
260
+ loadings: { fetchBlockletsLoading: w, fetchCategoriesLoading: ke, loadingMore: be },
257
261
  endpoint: r,
258
262
  blockletList: oe,
259
- wrapChildren: u,
263
+ wrapChildren: p,
260
264
  t: re,
261
- filters: g,
262
- selectedCategory: B,
265
+ filters: d,
266
+ selectedCategory: u,
263
267
  categoryList: U,
264
268
  blockletRender: i,
265
269
  locale: l,
266
- categoryOptions: we,
267
- priceOptions: ve,
268
- storeApi: x,
269
- baseSearch: b,
270
- hasNextPage: y.list.length < y.total,
270
+ categoryOptions: ve,
271
+ priceOptions: Se,
272
+ storeApi: $,
273
+ baseSearch: y,
274
+ hasNextPage: T.list.length < T.total,
271
275
  handleSort: (a) => {
272
- const d = {
273
- ...g,
276
+ const m = {
277
+ ...d,
274
278
  sortBy: a,
275
279
  sortDirection: a === "nameAsc" ? "asc" : "desc"
276
280
  };
277
- s(d);
281
+ c(m);
278
282
  },
279
283
  handleKeyword: (a) => {
280
- const d = { ...g, keyword: a || void 0 };
281
- s(d);
284
+ const m = { ...d, keyword: a || void 0 };
285
+ c(m);
282
286
  },
283
287
  handlePrice: (a) => {
284
- const d = {
285
- ...g,
286
- price: a === g.price ? void 0 : a
288
+ const m = {
289
+ ...d,
290
+ price: a === d.price ? void 0 : a
287
291
  };
288
- s(d);
292
+ c(m);
289
293
  },
290
294
  handleCategory: (a) => {
291
- let d = a;
292
- (a === "all" || a === g.category) && (d = void 0);
293
- const S = { ...g, category: d };
294
- s(S);
295
+ let m = a;
296
+ (a === "all" || a === d.category) && (m = void 0);
297
+ const v = { ...d, category: m };
298
+ c(v);
295
299
  },
296
300
  handleDeveloper: (a) => {
297
- const d = { ...g, owner: a || void 0 };
298
- s(d);
301
+ const m = { ...d, owner: a || void 0 };
302
+ c(m);
299
303
  },
300
304
  handlePage: (a) => {
301
- const d = { ...g, currentPage: a };
302
- s(d);
305
+ const m = { ...d, currentPage: a };
306
+ c(m);
303
307
  },
304
308
  loadMore: () => {
305
- v();
309
+ _();
306
310
  },
307
311
  getCategoryLocale: (a) => {
308
312
  if (!a)
309
313
  return null;
310
- let d = null;
311
- const S = G.find((z) => z._id === a);
312
- return S && (d = S.locales[l]), d;
314
+ let m = null;
315
+ const v = G.find((z) => z._id === a);
316
+ return v && (m = v.locales[l]), m;
313
317
  },
314
318
  get developerName() {
315
- var d, S;
316
- return ((S = (d = oe.find((z) => {
319
+ var m, v;
320
+ return ((v = (m = oe.find((z) => {
317
321
  var ne;
318
- return ((ne = z == null ? void 0 : z.owner) == null ? void 0 : ne.did) === g.owner;
319
- })) == null ? void 0 : d.owner) == null ? void 0 : S.name) || "";
322
+ return ((ne = z == null ? void 0 : z.owner) == null ? void 0 : ne.did) === d.owner;
323
+ })) == null ? void 0 : m.owner) == null ? void 0 : v.name) || "";
320
324
  },
321
325
  handleSearchSelect: k
322
326
  };
323
327
  return E(() => {
324
- ke();
325
- }, [r]), /* @__PURE__ */ t($t, { value: Se, children: o });
328
+ setTimeout(() => {
329
+ we();
330
+ }, B || 0);
331
+ }, [r]), /* @__PURE__ */ t(Rt, { value: Ce, children: n });
326
332
  }
327
333
  V.propTypes = {
328
334
  ...fe,
329
- children: n.any.isRequired
335
+ children: o.any.isRequired
330
336
  };
331
337
  V.defaultProps = he;
332
338
  function I() {
333
- const e = je(ge);
339
+ const e = Ge(ge);
334
340
  return e || {};
335
341
  }
336
- const Rt = C($e)`
342
+ const zt = C(Re)`
337
343
  border-radius: 4px;
338
- `, Q = Ge(({ children: e, rounded: o, loading: r, disabled: l, ...i }, s) => /* @__PURE__ */ t(
339
- Rt,
344
+ `, Q = Ue(({ children: e, rounded: n, loading: r, disabled: l, ...i }, c) => /* @__PURE__ */ t(
345
+ zt,
340
346
  {
341
- ref: s,
347
+ ref: c,
342
348
  disableElevation: !0,
343
349
  disabled: l || r,
344
350
  ...i,
@@ -347,10 +353,10 @@ const Rt = C($e)`
347
353
  }
348
354
  ));
349
355
  Q.propTypes = {
350
- children: n.any,
351
- rounded: n.bool,
352
- loading: n.bool,
353
- disabled: n.bool
356
+ children: o.any,
357
+ rounded: o.bool,
358
+ loading: o.bool,
359
+ disabled: o.bool
354
360
  };
355
361
  Q.defaultProps = {
356
362
  children: null,
@@ -358,57 +364,57 @@ Q.defaultProps = {
358
364
  loading: !1,
359
365
  disabled: !1
360
366
  };
361
- function J({ title: e, value: o, icon: r, prepend: l, options: i, onChange: s, itemRender: k, ...h }) {
362
- const u = M(null), b = pe(), [m, P] = F(!1), [T, x] = F(o !== null ? o : ""), g = ze(b.breakpoints.down("sm"));
367
+ function J({ title: e, value: n, icon: r, prepend: l, options: i, onChange: c, itemRender: k, ...g }) {
368
+ const p = M(null), y = pe(), [f, P] = F(!1), [B, b] = F(n !== null ? n : ""), $ = Ie(y.breakpoints.down("sm"));
363
369
  E(() => {
364
- x(o !== null ? o : "");
365
- }, [o]);
366
- const B = H(() => {
370
+ b(n !== null ? n : "");
371
+ }, [n]);
372
+ const d = H(() => {
367
373
  P(!1);
368
- }, []), p = H(() => {
374
+ }, []), u = H(() => {
369
375
  P(!0);
370
376
  }, []);
371
- function c(y) {
372
- x(y.value), s(y.value), g && B();
377
+ function s(x) {
378
+ b(x.value), c(x.value), $ && d();
373
379
  }
374
- function w(y) {
375
- return y === T;
380
+ function S(x) {
381
+ return x === B;
376
382
  }
377
- return /* @__PURE__ */ f(Ce, { children: [
378
- /* @__PURE__ */ f(
379
- zt,
383
+ return /* @__PURE__ */ h(Pe, { children: [
384
+ /* @__PURE__ */ h(
385
+ It,
380
386
  {
381
- ref: u,
382
- onClick: p,
387
+ ref: p,
388
+ onClick: u,
383
389
  variant: "outlined",
384
390
  size: "small",
385
- className: ["my-select__selector", nt(T) ? "" : "my-select__selector--active"].join(" "),
386
- ...h,
391
+ className: ["my-select__selector", lt(B) ? "" : "my-select__selector--active"].join(" "),
392
+ ...g,
387
393
  children: [
388
394
  /* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
389
395
  e,
390
- /* @__PURE__ */ t(Ie, { className: "my-select__arrowdown", component: ot, fontSize: "small" })
396
+ /* @__PURE__ */ t(_e, { className: "my-select__arrowdown", component: nt, fontSize: "small" })
391
397
  ]
392
398
  }
393
399
  ),
394
- /* @__PURE__ */ t(_e, { open: m, anchorEl: u.current, transition: !0, style: { zIndex: "9999" }, children: ({ TransitionProps: y, placement: $ }) => /* @__PURE__ */ t(
395
- De,
400
+ /* @__PURE__ */ t(De, { open: f, anchorEl: p.current, transition: !0, style: { zIndex: "9999" }, children: ({ TransitionProps: x, placement: T }) => /* @__PURE__ */ t(
401
+ Ne,
396
402
  {
397
- ...y,
398
- style: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" },
399
- children: /* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ t(Ae, { onClickAway: B, children: /* @__PURE__ */ f(It, { autoFocusItem: m, onMouseEnter: p, onMouseLeave: B, children: [
403
+ ...x,
404
+ style: { transformOrigin: T === "bottom" ? "center top" : "center bottom" },
405
+ children: /* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(Le, { onClickAway: d, children: /* @__PURE__ */ h(_t, { autoFocusItem: f, onMouseEnter: u, onMouseLeave: d, children: [
400
406
  l,
401
- i.map((v) => k ? k(v) : /* @__PURE__ */ t(
402
- Le,
407
+ i.map((w) => k ? k(w) : /* @__PURE__ */ t(
408
+ Me,
403
409
  {
404
- onClick: () => c(v),
410
+ onClick: () => s(w),
405
411
  className: [
406
412
  "my-select__option",
407
- w(v.value) ? "my-select__option--active" : ""
413
+ S(w.value) ? "my-select__option--active" : ""
408
414
  ].join(" "),
409
- children: v.name
415
+ children: w.name
410
416
  },
411
- v.value
417
+ w.value
412
418
  ))
413
419
  ] }) }) })
414
420
  }
@@ -416,13 +422,13 @@ function J({ title: e, value: o, icon: r, prepend: l, options: i, onChange: s, i
416
422
  ] });
417
423
  }
418
424
  J.propTypes = {
419
- options: n.array.isRequired,
420
- value: n.oneOfType([n.string, n.number, n.array]),
421
- onChange: n.func,
422
- itemRender: n.func,
423
- title: n.string.isRequired,
424
- icon: n.any,
425
- prepend: n.any
425
+ options: o.array.isRequired,
426
+ value: o.oneOfType([o.string, o.number, o.array]),
427
+ onChange: o.func,
428
+ itemRender: o.func,
429
+ title: o.string.isRequired,
430
+ icon: o.any,
431
+ prepend: o.any
426
432
  };
427
433
  J.defaultProps = {
428
434
  value: null,
@@ -432,7 +438,7 @@ J.defaultProps = {
432
438
  onChange: () => {
433
439
  }
434
440
  };
435
- const zt = C(Q)`
441
+ const It = C(Q)`
436
442
  border: 1px solid #f0f0f0;
437
443
  padding: 6px 8px 6px 12px;
438
444
  font-weight: ${(e) => e.theme.typography.fontWeightBold};
@@ -464,7 +470,7 @@ const zt = C(Q)`
464
470
  margin-right: 3px;
465
471
  }
466
472
  }
467
- `, It = C(Re)`
473
+ `, _t = C(ze)`
468
474
  .my-select__option__icon {
469
475
  color: transparent;
470
476
  font-size: 16px;
@@ -481,8 +487,8 @@ const zt = C(Q)`
481
487
  }
482
488
  }
483
489
  `;
484
- function A({ options: e, onChange: o, title: r, value: l }) {
485
- return /* @__PURE__ */ f(_t, { children: [
490
+ function A({ options: e, onChange: n, title: r, value: l }) {
491
+ return /* @__PURE__ */ h(Dt, { children: [
486
492
  /* @__PURE__ */ t("div", { className: "title", children: r }),
487
493
  /* @__PURE__ */ t("div", { className: "list", children: e.map((i) => /* @__PURE__ */ t(
488
494
  "div",
@@ -490,14 +496,14 @@ function A({ options: e, onChange: o, title: r, value: l }) {
490
496
  title: i.name,
491
497
  "data-cy": "filter",
492
498
  className: l === i.value ? "select item" : "item",
493
- onClick: () => o(i.value),
499
+ onClick: () => n(i.value),
494
500
  children: i.name
495
501
  },
496
502
  i.value
497
503
  )) })
498
504
  ] });
499
505
  }
500
- const _t = C("div")`
506
+ const Dt = C("div")`
501
507
  .title {
502
508
  font-size: 18px;
503
509
  font-weight: bold;
@@ -526,47 +532,47 @@ const _t = C("div")`
526
532
  }
527
533
  `;
528
534
  A.propTypes = {
529
- title: n.string.isRequired,
530
- options: n.array.isRequired,
531
- onChange: n.func.isRequired,
532
- value: n.oneOfType([n.string, n.number])
535
+ title: o.string.isRequired,
536
+ options: o.array.isRequired,
537
+ onChange: o.func.isRequired,
538
+ value: o.oneOfType([o.string, o.number])
533
539
  };
534
540
  A.defaultProps = {
535
541
  value: null
536
542
  };
537
543
  function X() {
538
- const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: i, categoryOptions: s, priceOptions: k } = I(), [h, u] = F(!1), b = (m, P) => {
539
- m === "category" && o(P), m === "price" && l(P), u(!1);
544
+ const { selectedCategory: e, handleCategory: n, t: r, handlePrice: l, filters: i, categoryOptions: c, priceOptions: k } = I(), [g, p] = F(!1), y = (f, P) => {
545
+ f === "category" && n(P), f === "price" && l(P), p(!1);
540
546
  };
541
- return /* @__PURE__ */ f(Dt, { children: [
542
- /* @__PURE__ */ t(it, { variant: "outlined", className: "filter-button", onClick: () => u(!0), children: /* @__PURE__ */ t(lt, { className: "filter-icon", fontSize: "small" }) }),
543
- /* @__PURE__ */ f(at, { fullWidth: !0, title: "", open: h, onClose: () => u(!1), children: [
547
+ return /* @__PURE__ */ h(Nt, { children: [
548
+ /* @__PURE__ */ t(st, { variant: "outlined", className: "filter-button", onClick: () => p(!0), children: /* @__PURE__ */ t(at, { className: "filter-icon", fontSize: "small" }) }),
549
+ /* @__PURE__ */ h(it, { fullWidth: !0, title: "", open: g, onClose: () => p(!1), children: [
544
550
  /* @__PURE__ */ t(
545
551
  A,
546
552
  {
547
553
  title: r("common.price"),
548
554
  options: k,
549
555
  value: i.price,
550
- onChange: (m) => {
551
- b("price", m);
556
+ onChange: (f) => {
557
+ y("price", f);
552
558
  }
553
559
  }
554
560
  ),
555
- s.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
561
+ c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
556
562
  A,
557
563
  {
558
564
  title: r("common.category"),
559
- options: s,
565
+ options: c,
560
566
  value: e,
561
- onChange: (m) => {
562
- b("category", m);
567
+ onChange: (f) => {
568
+ y("category", f);
563
569
  }
564
570
  }
565
571
  ) })
566
572
  ] })
567
573
  ] });
568
574
  }
569
- const Dt = C("div")`
575
+ const Nt = C("div")`
570
576
  .filter-button {
571
577
  margin-right: 16px;
572
578
  border-color: rgb(240, 240, 240);
@@ -580,7 +586,7 @@ const Dt = C("div")`
580
586
  `;
581
587
  X.propTypes = {};
582
588
  X.defaultProps = {};
583
- const Nt = C("div")`
589
+ const At = C("div")`
584
590
  .MuiChip-root {
585
591
  border-radius: 4px;
586
592
  height: initial;
@@ -589,13 +595,13 @@ const Nt = C("div")`
589
595
  padding: 4px 0;
590
596
  }
591
597
  `;
592
- function N({ label: e, icon: o, onDelete: r, ...l }) {
593
- return e ? /* @__PURE__ */ t(Nt, { ...l, children: /* @__PURE__ */ t(Me, { color: "primary", "data-cy": "filter-tag", icon: o, label: e, onDelete: r }) }) : null;
598
+ function N({ label: e, icon: n, onDelete: r, ...l }) {
599
+ return e ? /* @__PURE__ */ t(At, { ...l, children: /* @__PURE__ */ t(Oe, { color: "primary", "data-cy": "filter-tag", icon: n, label: e, onDelete: r }) }) : null;
594
600
  }
595
601
  N.propTypes = {
596
- label: n.string,
597
- onDelete: n.func,
598
- icon: n.element
602
+ label: o.string,
603
+ onDelete: o.func,
604
+ icon: o.element
599
605
  };
600
606
  N.defaultProps = {
601
607
  onDelete: null,
@@ -606,58 +612,58 @@ function se() {
606
612
  const { t: e } = I();
607
613
  return /* @__PURE__ */ t(me, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
608
614
  }
609
- function O({ filterTip: e, keywordTip: o }) {
615
+ function O({ filterTip: e, keywordTip: n }) {
610
616
  const { t: r, locale: l } = I(), i = () => l === "zh" ? "、" : " , ";
611
- return /* @__PURE__ */ f(pt, { className: "tips", children: [
617
+ return /* @__PURE__ */ h(ut, { className: "tips", children: [
612
618
  /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
613
619
  e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
614
- e && o && i(),
615
- o && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
620
+ e && n && i(),
621
+ n && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
616
622
  ] });
617
623
  }
618
624
  O.propTypes = {
619
- filterTip: n.bool,
620
- keywordTip: n.bool
625
+ filterTip: o.bool,
626
+ keywordTip: o.bool
621
627
  };
622
628
  O.defaultProps = {
623
629
  filterTip: !1,
624
630
  keywordTip: !1
625
631
  };
626
- function j({ primaryStart: e, primaryEnd: o, filter: r }) {
627
- return /* @__PURE__ */ f(me, { variant: "subtitle2", children: [
632
+ function j({ primaryStart: e, primaryEnd: n, filter: r }) {
633
+ return /* @__PURE__ */ h(me, { variant: "subtitle2", children: [
628
634
  /* @__PURE__ */ t("span", { children: e }),
629
- /* @__PURE__ */ f("span", { className: "primary", children: [
635
+ /* @__PURE__ */ h("span", { className: "primary", children: [
630
636
  " ",
631
637
  r,
632
638
  " "
633
639
  ] }),
634
- /* @__PURE__ */ f("span", { children: [
635
- o,
640
+ /* @__PURE__ */ h("span", { children: [
641
+ n,
636
642
  " "
637
643
  ] })
638
644
  ] });
639
645
  }
640
646
  j.propTypes = {
641
- primaryStart: n.string.isRequired,
642
- primaryEnd: n.string.isRequired,
643
- filter: n.string.isRequired
647
+ primaryStart: o.string.isRequired,
648
+ primaryEnd: o.string.isRequired,
649
+ filter: o.string.isRequired
644
650
  };
645
- function Y({ blocklets: e, ...o }) {
651
+ function Y({ blocklets: e, ...n }) {
646
652
  const {
647
653
  blockletRender: r,
648
654
  errors: l,
649
655
  loadings: i,
650
- selectedCategory: s,
656
+ selectedCategory: c,
651
657
  getCategoryLocale: k,
652
- filters: h,
653
- t: u,
654
- hasNextPage: b,
655
- loadMore: m,
658
+ filters: g,
659
+ t: p,
660
+ hasNextPage: y,
661
+ loadMore: f,
656
662
  endpoint: P
657
- } = I(), T = M(null), x = Je(T.current), g = Xe(() => x ? x.width > 900 ? 12 : x.width > 600 ? 8 : 4 : 0, [x]), B = !!s || !!h.price, [p] = ct({
663
+ } = I(), B = M(null), b = Xe(B.current), $ = Ye(() => b ? b.width > 900 ? 12 : b.width > 600 ? 8 : 4 : 0, [b]), d = !!c || !!g.price, [u] = pt({
658
664
  loading: i.fetchBlockletsLoading || i.loadingMore,
659
- hasNextPage: b,
660
- onLoadMore: m
665
+ hasNextPage: y,
666
+ onLoadMore: f
661
667
  });
662
668
  if (l.fetchBlockletsError)
663
669
  return /* @__PURE__ */ t(
@@ -668,60 +674,60 @@ function Y({ blocklets: e, ...o }) {
668
674
  );
669
675
  if (i.fetchBlockletsLoading)
670
676
  return /* @__PURE__ */ t(D, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(W, {}) });
671
- if (h.keyword && B && e.length === 0)
672
- return /* @__PURE__ */ f(q, { children: [
677
+ if (g.keyword && d && e.length === 0)
678
+ return /* @__PURE__ */ h(q, { children: [
673
679
  /* @__PURE__ */ t(
674
680
  j,
675
681
  {
676
- primaryStart: u("blocklet.noBlockletPart1"),
677
- primaryEnd: u("blocklet.noBlockletPart2"),
678
- filter: h.keyword
682
+ primaryStart: p("blocklet.noBlockletPart1"),
683
+ primaryEnd: p("blocklet.noBlockletPart2"),
684
+ filter: g.keyword
679
685
  }
680
686
  ),
681
687
  /* @__PURE__ */ t(O, { keywordTip: !0, filterTip: !0 })
682
688
  ] });
683
- if (h.keyword && e.length === 0)
684
- return /* @__PURE__ */ f(q, { children: [
689
+ if (g.keyword && e.length === 0)
690
+ return /* @__PURE__ */ h(q, { children: [
685
691
  /* @__PURE__ */ t(
686
692
  j,
687
693
  {
688
- primaryStart: u("blocklet.noBlockletPart1"),
689
- primaryEnd: u("blocklet.noBlockletPart2"),
690
- filter: h.keyword
694
+ primaryStart: p("blocklet.noBlockletPart1"),
695
+ primaryEnd: p("blocklet.noBlockletPart2"),
696
+ filter: g.keyword
691
697
  }
692
698
  ),
693
699
  /* @__PURE__ */ t(O, { keywordTip: !0 })
694
700
  ] });
695
- if (B && e.length === 0) {
696
- const c = k(s);
697
- return /* @__PURE__ */ f(q, { children: [
698
- c ? /* @__PURE__ */ t(
701
+ if (d && e.length === 0) {
702
+ const s = k(c);
703
+ return /* @__PURE__ */ h(q, { children: [
704
+ s ? /* @__PURE__ */ t(
699
705
  j,
700
706
  {
701
- primaryStart: u("blocklet.noCategoryResults1"),
702
- primaryEnd: u("blocklet.noCategoryResults2"),
703
- filter: c
707
+ primaryStart: p("blocklet.noCategoryResults1"),
708
+ primaryEnd: p("blocklet.noCategoryResults2"),
709
+ filter: s
704
710
  }
705
711
  ) : /* @__PURE__ */ t(se, {}),
706
712
  /* @__PURE__ */ t(O, { filterTip: !0 })
707
713
  ] });
708
714
  }
709
- return e.length === 0 ? /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(se, {}) }) : /* @__PURE__ */ f(At, { container: !0, ...o, columns: g, ref: T, children: [
710
- e.map((c) => /* @__PURE__ */ t(ce, { item: !0, xs: 4, "data-blocklet-did": c.did, children: r({ blocklet: c, blocklets: e }) }, c.did)),
711
- b && /* @__PURE__ */ t(ce, { item: !0, xs: 12, ref: p, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(W, {}) }) })
715
+ return e.length === 0 ? /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(se, {}) }) : /* @__PURE__ */ h(Lt, { container: !0, ...n, columns: $, ref: B, children: [
716
+ e.map((s) => /* @__PURE__ */ t(ce, { item: !0, xs: 4, "data-blocklet-did": s.did, children: r({ blocklet: s, blocklets: e }) }, s.did)),
717
+ y && /* @__PURE__ */ t(ce, { item: !0, xs: 12, ref: u, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(W, {}) }) })
712
718
  ] });
713
719
  }
714
720
  Y.propTypes = {
715
- blocklets: n.array.isRequired
721
+ blocklets: o.array.isRequired
716
722
  };
717
723
  Y.defaultProps = {};
718
- const At = C(ue)`
724
+ const Lt = C(ue)`
719
725
  opacity: ${(e) => e.columns > 0 ? 1 : 0};
720
726
  &.MuiGrid-root {
721
727
  width: 100%;
722
728
  margin: 0 -16px;
723
729
  }
724
- `, ce = Ue(C(ue)`
730
+ `, ce = Ke(C(ue)`
725
731
  @media (max-width: ${(e) => e.theme.breakpoints.values.sm}px) {
726
732
  &.MuiGrid-item {
727
733
  padding-bottom: 0px;
@@ -732,7 +738,7 @@ const At = C(ue)`
732
738
  margin-bottom: ${(e) => e.theme.spacing(2)};
733
739
  }
734
740
  }
735
- `), q = C(st)`
741
+ `), q = C(ct)`
736
742
  text-align: center;
737
743
  .primary {
738
744
  color: ${(e) => e.theme.palette.primary.main};
@@ -742,21 +748,21 @@ const At = C(ue)`
742
748
  }
743
749
  `;
744
750
  function Z() {
745
- const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: i, categoryOptions: s, priceOptions: k } = I();
746
- return /* @__PURE__ */ f(Lt, { children: [
751
+ const { selectedCategory: e, handleCategory: n, t: r, handlePrice: l, filters: i, categoryOptions: c, priceOptions: k } = I();
752
+ return /* @__PURE__ */ h(Mt, { children: [
747
753
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(A, { title: r("common.price"), options: k, value: i.price, onChange: l }) }),
748
- s.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
754
+ c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
749
755
  A,
750
756
  {
751
757
  title: r("common.category"),
752
- options: s,
758
+ options: c,
753
759
  value: e,
754
- onChange: o
760
+ onChange: n
755
761
  }
756
762
  ) })
757
763
  ] });
758
764
  }
759
- const Lt = C("aside")`
765
+ const Mt = C("aside")`
760
766
  width: 220px;
761
767
  margin-right: ${(e) => e.theme.spacing(2)};
762
768
  height: 100%;
@@ -767,39 +773,39 @@ const Lt = C("aside")`
767
773
  `;
768
774
  Z.propTypes = {};
769
775
  Z.defaultProps = {};
770
- function ee({ placeholder: e, ...o }) {
771
- const { filters: r, handleKeyword: l } = I(), [i, s] = F(r.keyword || ""), k = Ye(l, { wait: 300 }), h = (b) => {
772
- const { value: m } = b.target;
773
- s(m), k.run(m);
774
- }, u = () => {
775
- s(""), l();
776
+ function ee({ placeholder: e, ...n }) {
777
+ const { filters: r, handleKeyword: l } = I(), [i, c] = F(r.keyword || ""), k = Ze(l, { wait: 300 }), g = (y) => {
778
+ const { value: f } = y.target;
779
+ c(f), k.run(f);
780
+ }, p = () => {
781
+ c(""), l();
776
782
  };
777
783
  return E(() => {
778
- s(r.keyword || "");
784
+ c(r.keyword || "");
779
785
  }, [r.keyword]), /* @__PURE__ */ t(
780
- Mt,
786
+ Ot,
781
787
  {
782
788
  inputProps: {
783
789
  "data-cy": "search-blocklet"
784
790
  },
785
- startAdornment: /* @__PURE__ */ t(le, { position: "start", children: /* @__PURE__ */ t(Ot, {}) }),
786
- onChange: h,
791
+ startAdornment: /* @__PURE__ */ t(le, { position: "start", children: /* @__PURE__ */ t(Ft, {}) }),
792
+ onChange: g,
787
793
  placeholder: e,
788
794
  value: i,
789
795
  title: e,
790
796
  "data-cy": "search",
791
- endAdornment: i && /* @__PURE__ */ t(le, { position: "end", children: /* @__PURE__ */ t(Ft, { "data-cy": "search-delete", onClick: u }) }),
792
- ...o
797
+ endAdornment: i && /* @__PURE__ */ t(le, { position: "end", children: /* @__PURE__ */ t(Et, { "data-cy": "search-delete", onClick: p }) }),
798
+ ...n
793
799
  }
794
800
  );
795
801
  }
796
802
  ee.propTypes = {
797
- placeholder: n.string
803
+ placeholder: o.string
798
804
  };
799
805
  ee.defaultProps = {
800
806
  placeholder: "Type to search..."
801
807
  };
802
- const Mt = C(Oe)`
808
+ const Ot = C(Fe)`
803
809
  background-color: ${(e) => e.theme.palette.grey[50]};
804
810
  font-size: 14px;
805
811
  border-radius: 6px;
@@ -815,49 +821,49 @@ const Mt = C(Oe)`
815
821
  color: transparent;
816
822
  }
817
823
  }
818
- `, Ot = C(ut)`
824
+ `, Ft = C(dt)`
819
825
  color: ${(e) => e.theme.palette.grey[500]};
820
826
  font-size: 28px;
821
827
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
822
828
  font-size: 24px;
823
829
  }
824
- `, Ft = C(dt)`
830
+ `, Et = C(mt)`
825
831
  color: ${(e) => e.theme.palette.grey[500]};
826
832
  font-size: 16px;
827
833
  cursor: pointer;
828
834
  `;
829
- function te({ onSelect: e, wrapChildren: o }) {
830
- const r = M(null), l = M(null), i = M(null), { storeApi: s, blockletRender: k, filters: h, endpoint: u, handleKeyword: b, t: m } = I(), P = async (p) => {
831
- const { data: c } = await s.get(R.blockletsPath, { params: p }), w = c.dataList || [];
832
- return w.length > 0 && w.unshift({ type: "more-result", total: c.total || 0 }), w;
833
- }, T = (p) => {
834
- b(p.state.query), p.setIsOpen(!1);
835
- }, x = () => {
835
+ function te({ onSelect: e, wrapChildren: n }) {
836
+ const r = M(null), l = M(null), i = M(null), { storeApi: c, blockletRender: k, filters: g, endpoint: p, handleKeyword: y, t: f } = I(), P = async (u) => {
837
+ const { data: s } = await c.get(R.blockletsPath, { params: u }), S = s.dataList || [];
838
+ return S.length > 0 && S.unshift({ type: "more-result", total: s.total || 0 }), S;
839
+ }, B = (u) => {
840
+ y(u.state.query), u.setIsOpen(!1);
841
+ }, b = () => {
836
842
  r.current && setTimeout(() => {
837
- const p = r.current.querySelector("input.bl-autocomplete-input");
838
- p && p.focus();
843
+ const u = r.current.querySelector("input.bl-autocomplete-input");
844
+ u && u.focus();
839
845
  });
840
- }, g = (p) => {
841
- p.setIsOpen(!1), x();
842
- }, B = ({ prevState: p, state: c }) => {
843
- p.query !== c.query && (c.query || b());
846
+ }, $ = (u) => {
847
+ u.setIsOpen(!1), b();
848
+ }, d = ({ prevState: u, state: s }) => {
849
+ u.query !== s.query && (s.query || y());
844
850
  };
845
- return ht(
851
+ return gt(
846
852
  "ctrl + k, command + k",
847
- (p) => (p.stopPropagation(), p.preventDefault(), x(), !1),
853
+ (u) => (u.stopPropagation(), u.preventDefault(), b(), !1),
848
854
  { enableOnTags: ["INPUT"] }
849
855
  ), E(() => {
850
- x();
851
- }, [u]), E(() => {
856
+ b();
857
+ }, [p]), E(() => {
852
858
  if (!r.current)
853
859
  return;
854
- const p = ft({
860
+ const u = ht({
855
861
  container: r.current,
856
- renderer: { createElement: Ke, Fragment: We, render: () => {
862
+ renderer: { createElement: We, Fragment: He, render: () => {
857
863
  } },
858
- render({ children: c }, w) {
859
- var y;
860
- (!l.current || i.current !== w) && (i.current = w, (y = l.current) == null || y.unmount(), l.current = mt(w)), l.current.render(o(c));
864
+ render({ children: s }, S) {
865
+ var x;
866
+ (!l.current || i.current !== S) && (i.current = S, (x = l.current) == null || x.unmount(), l.current = ft(S)), l.current.render(n(s));
861
867
  },
862
868
  autoFocus: !0,
863
869
  openOnFocus: !1,
@@ -868,49 +874,49 @@ function te({ onSelect: e, wrapChildren: o }) {
868
874
  input: "bl-autocomplete-input",
869
875
  clearButton: "bl-autocomplete-clear"
870
876
  },
871
- placeholder: m("common.searchStore"),
877
+ placeholder: f("common.searchStore"),
872
878
  initialState: {
873
- query: h.keyword
879
+ query: g.keyword
874
880
  },
875
- onStateChange(c) {
876
- B(c);
881
+ onStateChange(s) {
882
+ d(s);
877
883
  },
878
- onSubmit: T,
879
- onReset(c) {
880
- g(c);
884
+ onSubmit: B,
885
+ onReset(s) {
886
+ $(s);
881
887
  },
882
- getSources({ query: c, state: w, ...y }) {
883
- const $ = {
884
- ...h,
885
- sortBy: R[h.sortBy],
888
+ getSources({ query: s, state: S, ...x }) {
889
+ const T = {
890
+ ...g,
891
+ sortBy: R[g.sortBy],
886
892
  page: 1,
887
893
  pageSize: 10,
888
- keyword: c
894
+ keyword: s
889
895
  };
890
- return Pt([
896
+ return Tt([
891
897
  {
892
898
  sourceId: "blocklets",
893
899
  getItems() {
894
- return P($);
900
+ return P(T);
895
901
  },
896
902
  // 选中后填充 搜索框中值
897
- getItemInputValue({ item: v }) {
898
- return v.type === "more-result" ? c : v.title;
903
+ getItemInputValue({ item: w }) {
904
+ return w.type === "more-result" ? s : w.title;
899
905
  },
900
906
  // 选中或者点击自动完成列表中的 item 时触发
901
- onSelect({ event: v, item: _ }) {
902
- return _.type === "more-result" ? (y.setIsOpen(!1), b(c)) : v.type === "keydown" ? b(_.title) : e({
907
+ onSelect({ event: w, item: _ }) {
908
+ return _.type === "more-result" ? (x.setIsOpen(!1), y(s)) : w.type === "keydown" ? y(_.title) : e({
903
909
  blocklet: _,
904
- detailUrl: gt(u, `/blocklets/${_.did}`),
905
- storeUrl: u
910
+ detailUrl: yt(p, `/blocklets/${_.did}`),
911
+ storeUrl: p
906
912
  });
907
913
  },
908
914
  templates: {
909
- item({ item: v }) {
910
- return v.type === "more-result" ? /* @__PURE__ */ t("div", { children: m("autocomplete.expandResult", { name: c, number: v.total.toLocaleString() }) }) : k({ blocklet: v, autocompleteSetters: y });
915
+ item({ item: w }) {
916
+ return w.type === "more-result" ? /* @__PURE__ */ t("div", { children: f("autocomplete.expandResult", { name: s, number: w.total.toLocaleString() }) }) : k({ blocklet: w, autocompleteSetters: x });
911
917
  },
912
918
  noResults() {
913
- return m("blocklet.noResults");
919
+ return f("blocklet.noResults");
914
920
  }
915
921
  }
916
922
  }
@@ -918,62 +924,62 @@ function te({ onSelect: e, wrapChildren: o }) {
918
924
  }
919
925
  });
920
926
  return () => {
921
- p.destroy();
927
+ u.destroy();
922
928
  };
923
- }, [h, k]), /* @__PURE__ */ t("div", { className: "bl-search-container", ref: r });
929
+ }, [g, k]), /* @__PURE__ */ t("div", { className: "bl-search-container", ref: r });
924
930
  }
925
931
  te.propTypes = {
926
- onSelect: n.func.isRequired,
927
- wrapChildren: n.func
932
+ onSelect: o.func.isRequired,
933
+ wrapChildren: o.func
928
934
  };
929
935
  te.defaultProps = {
930
936
  wrapChildren: (e) => e
931
937
  };
932
- function Et() {
933
- var w, y;
938
+ function qt() {
939
+ var S, x;
934
940
  const {
935
941
  handleDeveloper: e,
936
- blockletList: o,
942
+ blockletList: n,
937
943
  filters: r,
938
944
  developerName: l,
939
945
  handleSort: i,
940
- handleCategory: s,
946
+ handleCategory: c,
941
947
  handlePrice: k,
942
- handleSearchSelect: h,
943
- t: u,
944
- getCategoryLocale: b,
945
- priceOptions: m,
948
+ handleSearchSelect: g,
949
+ t: p,
950
+ getCategoryLocale: y,
951
+ priceOptions: f,
946
952
  wrapChildren: P,
947
- baseSearch: T
948
- } = I(), x = yt(u), g = ((w = x.find(($) => $.value === r.sortBy)) == null ? void 0 : w.name) || u("sort.sort"), B = b(r.category), { resourceType: p } = r || {}, c = (y = m.find(($) => $.value === r.price)) == null ? void 0 : y.name;
949
- return /* @__PURE__ */ f(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
953
+ baseSearch: B
954
+ } = I(), b = bt(p), $ = ((S = b.find((T) => T.value === r.sortBy)) == null ? void 0 : S.name) || p("sort.sort"), d = y(r.category), { resourceType: u } = r || {}, s = (x = f.find((T) => T.value === r.price)) == null ? void 0 : x.name;
955
+ return /* @__PURE__ */ h(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
950
956
  /* @__PURE__ */ t(ae, { mdDown: !0, children: /* @__PURE__ */ t(Z, {}) }),
951
- /* @__PURE__ */ f(qt, { children: [
952
- /* @__PURE__ */ f(jt, { children: [
953
- /* @__PURE__ */ f(D, { className: "filter-bar", display: "flex", alignItems: "center", children: [
954
- T ? /* @__PURE__ */ t(ee, { className: "bl-search-container", placeholder: u("common.searchStore") }) : /* @__PURE__ */ t(te, { onSelect: h, wrapChildren: P }),
955
- /* @__PURE__ */ f(D, { mt: 0, ml: "16px", className: "filter-container", children: [
957
+ /* @__PURE__ */ h(jt, { children: [
958
+ /* @__PURE__ */ h(Gt, { children: [
959
+ /* @__PURE__ */ h(D, { className: "filter-bar", display: "flex", alignItems: "center", children: [
960
+ B ? /* @__PURE__ */ t(ee, { className: "bl-search-container", placeholder: p("common.searchStore") }) : /* @__PURE__ */ t(te, { onSelect: g, wrapChildren: P }),
961
+ /* @__PURE__ */ h(D, { mt: 0, ml: "16px", className: "filter-container", children: [
956
962
  /* @__PURE__ */ t(ae, { mdUp: !0, children: /* @__PURE__ */ t(X, {}) }),
957
963
  /* @__PURE__ */ t(
958
964
  J,
959
965
  {
960
966
  value: r.sortBy,
961
- options: x,
962
- title: g,
963
- icon: /* @__PURE__ */ t(Be, {}),
964
- onChange: ($) => {
965
- i($);
967
+ options: b,
968
+ title: $,
969
+ icon: /* @__PURE__ */ t($e, {}),
970
+ onChange: (T) => {
971
+ i(T);
966
972
  }
967
973
  }
968
974
  )
969
975
  ] })
970
976
  ] }),
971
- /* @__PURE__ */ f(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
977
+ /* @__PURE__ */ h(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
972
978
  /* @__PURE__ */ t(
973
979
  N,
974
980
  {
975
981
  label: l,
976
- icon: /* @__PURE__ */ t(Fe, {}),
982
+ icon: /* @__PURE__ */ t(Ee, {}),
977
983
  onDelete: () => {
978
984
  e(null);
979
985
  }
@@ -982,29 +988,29 @@ function Et() {
982
988
  /* @__PURE__ */ t(
983
989
  N,
984
990
  {
985
- label: B,
991
+ label: d,
986
992
  onDelete: () => {
987
- s(null);
993
+ c(null);
988
994
  }
989
995
  }
990
996
  ),
991
997
  /* @__PURE__ */ t(
992
998
  N,
993
999
  {
994
- label: c,
1000
+ label: s,
995
1001
  onDelete: () => {
996
1002
  k(null);
997
1003
  }
998
1004
  }
999
1005
  ),
1000
- p && /* @__PURE__ */ t(N, { label: `${u("common.resourceType")}: ${p}` })
1006
+ u && /* @__PURE__ */ t(N, { label: `${p("common.resourceType")}: ${u}` })
1001
1007
  ] })
1002
1008
  ] }),
1003
- /* @__PURE__ */ t(Ee, { FallbackComponent: de, children: /* @__PURE__ */ t("div", { style: { position: "relative", flex: 1, overflow: "auto" }, children: /* @__PURE__ */ t(Y, { blocklets: o }) }) })
1009
+ /* @__PURE__ */ t(qe, { FallbackComponent: de, children: /* @__PURE__ */ t("div", { style: { position: "relative", flex: 1, overflow: "auto" }, children: /* @__PURE__ */ t(Y, { blocklets: n }) }) })
1004
1010
  ] })
1005
1011
  ] });
1006
1012
  }
1007
- const qt = C("main")`
1013
+ const jt = C("main")`
1008
1014
  display: flex;
1009
1015
  flex-direction: column;
1010
1016
  flex: 1;
@@ -1048,29 +1054,29 @@ const qt = C("main")`
1048
1054
  font-size: 12px;
1049
1055
  }
1050
1056
  }
1051
- `, jt = C("div")`
1057
+ `, Gt = C("div")`
1052
1058
  position: sticky;
1053
1059
  top: 0;
1054
1060
  z-index: 9;
1055
1061
  background-color: white;
1056
1062
  `;
1057
1063
  function ye(e) {
1058
- const o = pe(), r = St(o.palette.primary.main), l = {
1059
- autocomplete: Pe`
1064
+ const n = pe(), r = Ct(n.palette.primary.main), l = {
1065
+ autocomplete: Te`
1060
1066
  :root {
1061
- --aa-detached-media-query: (max-width: ${o.breakpoints.values.md}px) !important;
1062
- --aa-detached-modal-media-query: (min-width: ${o.breakpoints.values.md}px) !important;
1063
- --aa-detached-modal-max-width: ${o.breakpoints.values.md}px !important;
1067
+ --aa-detached-media-query: (max-width: ${n.breakpoints.values.md}px) !important;
1068
+ --aa-detached-modal-media-query: (min-width: ${n.breakpoints.values.md}px) !important;
1069
+ --aa-detached-modal-max-width: ${n.breakpoints.values.md}px !important;
1064
1070
  --aa-selected-color-rgb: ${r.r}, ${r.g}, ${r.b} !important;
1065
1071
  --aa-primary-color-rgb: ${r.r}, ${r.g}, ${r.b} !important;
1066
1072
  --aa-input-background-color-rgb: 250, 250, 250 !important;
1067
1073
  }
1068
1074
  .bl-autocomplete-panel {
1069
- z-index: ${o.zIndex.modal};
1075
+ z-index: ${n.zIndex.modal};
1070
1076
  }
1071
1077
  .bl-autocomplete-label {
1072
1078
  .aa-SubmitIcon {
1073
- color: ${o.palette.grey[500]} !important;
1079
+ color: ${n.palette.grey[500]} !important;
1074
1080
  }
1075
1081
  }
1076
1082
  .bl-autocomplete-form {
@@ -1086,7 +1092,7 @@ function ye(e) {
1086
1092
  box-shadow: none !important;
1087
1093
  }
1088
1094
  .aa-SubmitIcon {
1089
- color: ${o.palette.grey[500]} !important;
1095
+ color: ${n.palette.grey[500]} !important;
1090
1096
  }
1091
1097
  }
1092
1098
  .aa-Panel .arcblock-blocklet button {
@@ -1094,9 +1100,9 @@ function ye(e) {
1094
1100
  }
1095
1101
  `
1096
1102
  };
1097
- return /* @__PURE__ */ f(V, { ...e, children: [
1098
- /* @__PURE__ */ t(Te, { styles: l.autocomplete }),
1099
- /* @__PURE__ */ t(Et, {})
1103
+ return /* @__PURE__ */ h(V, { ...e, children: [
1104
+ /* @__PURE__ */ t(Be, { styles: l.autocomplete }),
1105
+ /* @__PURE__ */ t(qt, {})
1100
1106
  ] });
1101
1107
  }
1102
1108
  ye.propTypes = fe;