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