@blocklet/list 0.13.26 → 0.13.28
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 +298 -294
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as
|
|
1
|
+
import { jsx as t, jsxs as h, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { styled as P, useTheme as ae } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import { Global as xe, css as ke } from "@emotion/react";
|
|
4
4
|
import _e from "@mui/icons-material/Sort";
|
|
5
|
-
import { Button as Ne, CircularProgress as oe, MenuList as Le, useMediaQuery as Se, SvgIcon as Me, Popper as Oe, Grow as Fe, Paper as Ae, ClickAwayListener as Ee, MenuItem as qe, Chip as Ce, Box as
|
|
6
|
-
import
|
|
7
|
-
import { ErrorBoundary as
|
|
5
|
+
import { Button as Ne, CircularProgress as oe, MenuList as Le, useMediaQuery as Se, SvgIcon as Me, Popper as Oe, Grow as Fe, Paper as Ae, ClickAwayListener as Ee, MenuItem as qe, Chip as Ce, Box as _, Unstable_Grid2 as te, OutlinedInput as je, InputAdornment as ge, Typography as ve, Hidden as ye, Stack as Ue } from "@mui/material";
|
|
6
|
+
import Ve from "@mui/icons-material/Face";
|
|
7
|
+
import { ErrorBoundary as We } from "react-error-boundary";
|
|
8
8
|
import { ErrorFallback as Te } from "@arcblock/ux/lib/ErrorBoundary";
|
|
9
|
-
import { createContext as
|
|
9
|
+
import { createContext as Ge, useMemo as Q, useState as E, useCallback as ne, useEffect as j, useContext as Ke, forwardRef as He, useRef as J, createElement as Qe, Fragment as Je } from "react";
|
|
10
10
|
import { useReactive as Pe, useInfiniteScroll as Xe, useRequest as Ye, useSize as Ze, useDebounceFn as et, useMemoizedFn as tt, useCreation as rt, useMount as ot } from "ahooks";
|
|
11
11
|
import { joinURL as nt, parseQuery as lt } from "ufo";
|
|
12
12
|
import o from "prop-types";
|
|
@@ -157,6 +157,7 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
157
157
|
}),
|
|
158
158
|
wrapChildren: o.func,
|
|
159
159
|
extraFilter: o.func,
|
|
160
|
+
serverVersion: o.string,
|
|
160
161
|
endpoint: o.string.isRequired,
|
|
161
162
|
blockletRender: o.func.isRequired,
|
|
162
163
|
onFilterChange: o.func,
|
|
@@ -171,6 +172,7 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
171
172
|
}, $e = {
|
|
172
173
|
locale: "zh",
|
|
173
174
|
filters: {},
|
|
175
|
+
serverVersion: "",
|
|
174
176
|
onFilterChange: () => {
|
|
175
177
|
},
|
|
176
178
|
onSearchSelect: ({ detailUrl: e }) => {
|
|
@@ -183,7 +185,7 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
183
185
|
showResourcesSwitch: !1,
|
|
184
186
|
showCategory: !0,
|
|
185
187
|
tagFilters: []
|
|
186
|
-
},
|
|
188
|
+
}, N = {
|
|
187
189
|
nameAsc: "title",
|
|
188
190
|
nameDesc: "title",
|
|
189
191
|
popularity: "stats.downloads",
|
|
@@ -195,7 +197,7 @@ const zt = It((e) => Promise.resolve(e), 300), Dt = {
|
|
|
195
197
|
blockletsPath: "/api/v2/blocklets.json",
|
|
196
198
|
categoriesPath: "/api/blocklets/categories",
|
|
197
199
|
cacheSize: 100
|
|
198
|
-
}, Ie =
|
|
200
|
+
}, Ie = Ge({}), { Provider: Nt, Consumer: $r } = Ie;
|
|
199
201
|
function ie({
|
|
200
202
|
filters: e,
|
|
201
203
|
children: n,
|
|
@@ -203,161 +205,162 @@ function ie({
|
|
|
203
205
|
locale: a,
|
|
204
206
|
blockletRender: s,
|
|
205
207
|
onFilterChange: c,
|
|
206
|
-
onSearchSelect:
|
|
207
|
-
extraFilter:
|
|
208
|
-
wrapChildren:
|
|
209
|
-
baseSearch:
|
|
210
|
-
serverVersion:
|
|
211
|
-
storeVersion:
|
|
212
|
-
fetchCategoryDelay:
|
|
213
|
-
showResourcesSwitch:
|
|
214
|
-
showCategory:
|
|
215
|
-
tagFilters:
|
|
208
|
+
onSearchSelect: w,
|
|
209
|
+
extraFilter: g,
|
|
210
|
+
wrapChildren: m,
|
|
211
|
+
baseSearch: x,
|
|
212
|
+
serverVersion: u,
|
|
213
|
+
storeVersion: S,
|
|
214
|
+
fetchCategoryDelay: R,
|
|
215
|
+
showResourcesSwitch: T,
|
|
216
|
+
showCategory: B,
|
|
217
|
+
tagFilters: C
|
|
216
218
|
}) {
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
219
|
+
const y = {};
|
|
220
|
+
u && (y["x-blocklet-server-version"] = u), S && (y["x-blocklet-store-version"] = S);
|
|
221
|
+
const d = Q(() => it.create({
|
|
220
222
|
baseURL: r,
|
|
221
|
-
headers:
|
|
222
|
-
}), [r]),
|
|
223
|
+
headers: y
|
|
224
|
+
}), [r]), i = Q(() => ({
|
|
223
225
|
sortBy: "popularity",
|
|
224
226
|
sortDirection: "desc",
|
|
225
227
|
...e
|
|
226
|
-
}), [e]),
|
|
227
|
-
currentPage:
|
|
228
|
-
pageSize: Bt() ?
|
|
229
|
-
defaultCurrentPage:
|
|
230
|
-
}), [
|
|
228
|
+
}), [e]), b = i.category, k = Pe({
|
|
229
|
+
currentPage: N.currentPage,
|
|
230
|
+
pageSize: Bt() ? N.mobilePageSize : N.pageSize,
|
|
231
|
+
defaultCurrentPage: N.defaultCurrentPage
|
|
232
|
+
}), [z, $] = E(null), v = Xe(
|
|
231
233
|
async (l) => {
|
|
232
|
-
l || (
|
|
233
|
-
const { currentPage: p, pageSize:
|
|
234
|
-
...
|
|
235
|
-
sortBy:
|
|
234
|
+
l || (k.currentPage = k.defaultCurrentPage);
|
|
235
|
+
const { currentPage: p, pageSize: I } = k, A = {
|
|
236
|
+
...i,
|
|
237
|
+
sortBy: N[i.sortBy],
|
|
236
238
|
page: p,
|
|
237
|
-
pageSize:
|
|
239
|
+
pageSize: I
|
|
238
240
|
};
|
|
239
|
-
|
|
240
|
-
const { data:
|
|
241
|
+
$(null);
|
|
242
|
+
const { data: D = {} } = await d.get(N.blockletsPath, {
|
|
241
243
|
params: A
|
|
242
244
|
});
|
|
243
|
-
return
|
|
245
|
+
return k.currentPage++, {
|
|
244
246
|
page: p,
|
|
245
|
-
pageSize:
|
|
246
|
-
list: (
|
|
247
|
-
total: (
|
|
247
|
+
pageSize: I,
|
|
248
|
+
list: (D == null ? void 0 : D.dataList) || [],
|
|
249
|
+
total: (D == null ? void 0 : D.total) || 0
|
|
248
250
|
};
|
|
249
251
|
},
|
|
250
252
|
{
|
|
251
253
|
isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
|
|
252
254
|
reloadDeps: [r, st(e)],
|
|
253
255
|
onError: (l) => {
|
|
254
|
-
|
|
256
|
+
$(l);
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
259
|
), {
|
|
258
|
-
data:
|
|
260
|
+
data: V = [],
|
|
259
261
|
error: ee,
|
|
260
262
|
loading: O,
|
|
261
|
-
run:
|
|
263
|
+
run: W
|
|
262
264
|
} = Ye(
|
|
263
265
|
async () => {
|
|
264
|
-
const { data: l } = await
|
|
266
|
+
const { data: l } = await d.get(N.categoriesPath);
|
|
265
267
|
return Array.isArray(l) ? l : [];
|
|
266
268
|
},
|
|
267
269
|
{ manual: !0 }
|
|
268
|
-
), F = Q(() => at(
|
|
270
|
+
), F = Q(() => at(V || [], [(p) => p.name], ["asc"]), [V]), G = ne(
|
|
269
271
|
(l, p) => {
|
|
270
|
-
const
|
|
271
|
-
return Rt(
|
|
272
|
+
const I = re[a] ? re[a][l] : re.en[l];
|
|
273
|
+
return Rt(I, p);
|
|
272
274
|
},
|
|
273
275
|
[a]
|
|
274
|
-
),
|
|
276
|
+
), K = Q(() => {
|
|
275
277
|
var p;
|
|
276
|
-
let l = ((p =
|
|
277
|
-
return l =
|
|
278
|
-
}, [
|
|
279
|
-
errors: { fetchBlockletsError:
|
|
278
|
+
let l = ((p = v.data) == null ? void 0 : p.list) || [];
|
|
279
|
+
return l = g(l), l;
|
|
280
|
+
}, [v.data, g]), f = Q(() => Pt(F, a), [F, a]), H = Tt(G), M = {
|
|
281
|
+
errors: { fetchBlockletsError: z, fetchCategoriesError: ee },
|
|
280
282
|
loadings: {
|
|
281
|
-
fetchBlockletsLoading:
|
|
283
|
+
fetchBlockletsLoading: v.loading,
|
|
282
284
|
fetchCategoriesLoading: O,
|
|
283
|
-
loadingMore:
|
|
285
|
+
loadingMore: v.loadingMore
|
|
284
286
|
},
|
|
285
287
|
endpoint: r,
|
|
286
|
-
blockletList:
|
|
287
|
-
wrapChildren:
|
|
288
|
-
t:
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
blockletList: K,
|
|
289
|
+
wrapChildren: m,
|
|
290
|
+
t: G,
|
|
291
|
+
serverVersion: u,
|
|
292
|
+
filters: i,
|
|
293
|
+
selectedCategory: b,
|
|
291
294
|
categoryList: F,
|
|
292
295
|
blockletRender: s,
|
|
293
296
|
locale: a,
|
|
294
|
-
categoryOptions:
|
|
295
|
-
priceOptions:
|
|
296
|
-
storeApi:
|
|
297
|
-
baseSearch:
|
|
298
|
-
showResourcesSwitch:
|
|
299
|
-
showCategory:
|
|
300
|
-
tagFilters:
|
|
301
|
-
hasNextPage: !
|
|
297
|
+
categoryOptions: f,
|
|
298
|
+
priceOptions: H,
|
|
299
|
+
storeApi: d,
|
|
300
|
+
baseSearch: x,
|
|
301
|
+
showResourcesSwitch: T,
|
|
302
|
+
showCategory: B,
|
|
303
|
+
tagFilters: C,
|
|
304
|
+
hasNextPage: !v.noMore,
|
|
302
305
|
onFilterChange: c,
|
|
303
306
|
handleSort: (l) => {
|
|
304
307
|
const p = {
|
|
305
|
-
...
|
|
308
|
+
...i,
|
|
306
309
|
sortBy: l,
|
|
307
310
|
sortDirection: l === "nameAsc" ? "asc" : "desc"
|
|
308
311
|
};
|
|
309
312
|
c(p);
|
|
310
313
|
},
|
|
311
314
|
handleKeyword: (l) => {
|
|
312
|
-
const p = { ...
|
|
315
|
+
const p = { ...i, keyword: l || void 0 };
|
|
313
316
|
c(p);
|
|
314
317
|
},
|
|
315
318
|
handlePrice: (l) => {
|
|
316
319
|
const p = {
|
|
317
|
-
...
|
|
318
|
-
price: l ===
|
|
320
|
+
...i,
|
|
321
|
+
price: l === i.price ? void 0 : l
|
|
319
322
|
};
|
|
320
323
|
c(p);
|
|
321
324
|
},
|
|
322
325
|
handleCategory: (l) => {
|
|
323
326
|
let p = l;
|
|
324
|
-
(l === "all" || l ===
|
|
325
|
-
const
|
|
326
|
-
c(
|
|
327
|
+
(l === "all" || l === i.category) && (p = void 0);
|
|
328
|
+
const I = { ...i, category: p };
|
|
329
|
+
c(I);
|
|
327
330
|
},
|
|
328
331
|
handleDeveloper: (l) => {
|
|
329
|
-
const p = { ...
|
|
332
|
+
const p = { ...i, owner: l || void 0 };
|
|
330
333
|
c(p);
|
|
331
334
|
},
|
|
332
335
|
handlePage: (l) => {
|
|
333
|
-
const p = { ...
|
|
336
|
+
const p = { ...i, currentPage: l };
|
|
334
337
|
c(p);
|
|
335
338
|
},
|
|
336
339
|
handleSwitchShowResources: () => {
|
|
337
|
-
const l = { ...
|
|
340
|
+
const l = { ...i };
|
|
338
341
|
c(l);
|
|
339
342
|
},
|
|
340
|
-
loadMore:
|
|
343
|
+
loadMore: v.loadMore,
|
|
341
344
|
getCategoryLocale: (l) => {
|
|
342
345
|
if (!l)
|
|
343
346
|
return null;
|
|
344
347
|
let p = null;
|
|
345
|
-
const
|
|
346
|
-
return
|
|
348
|
+
const I = V.find((A) => A._id === l);
|
|
349
|
+
return I && (p = I.locales[a]), p;
|
|
347
350
|
},
|
|
348
351
|
get developerName() {
|
|
349
|
-
var p,
|
|
350
|
-
return ((
|
|
351
|
-
var
|
|
352
|
-
return ((
|
|
353
|
-
})) == null ? void 0 : p.owner) == null ? void 0 :
|
|
352
|
+
var p, I;
|
|
353
|
+
return ((I = (p = K.find((A) => {
|
|
354
|
+
var D;
|
|
355
|
+
return ((D = A == null ? void 0 : A.owner) == null ? void 0 : D.did) === i.owner;
|
|
356
|
+
})) == null ? void 0 : p.owner) == null ? void 0 : I.name) || "";
|
|
354
357
|
},
|
|
355
|
-
handleSearchSelect:
|
|
358
|
+
handleSearchSelect: w
|
|
356
359
|
};
|
|
357
360
|
return j(() => {
|
|
358
361
|
setTimeout(() => {
|
|
359
|
-
|
|
360
|
-
},
|
|
362
|
+
W();
|
|
363
|
+
}, R || 0);
|
|
361
364
|
}, [r]), /* @__PURE__ */ t(Nt, { value: M, children: n });
|
|
362
365
|
}
|
|
363
366
|
ie.propTypes = {
|
|
@@ -365,13 +368,13 @@ ie.propTypes = {
|
|
|
365
368
|
children: o.any.isRequired
|
|
366
369
|
};
|
|
367
370
|
ie.defaultProps = $e;
|
|
368
|
-
function
|
|
369
|
-
const e =
|
|
371
|
+
function L() {
|
|
372
|
+
const e = Ke(Ie);
|
|
370
373
|
return e || {};
|
|
371
374
|
}
|
|
372
|
-
const Lt =
|
|
375
|
+
const Lt = P(Ne)`
|
|
373
376
|
border-radius: 4px;
|
|
374
|
-
`, se =
|
|
377
|
+
`, se = He(({ children: e, rounded: n, loading: r, disabled: a, ...s }, c) => /* @__PURE__ */ t(
|
|
375
378
|
Lt,
|
|
376
379
|
{
|
|
377
380
|
ref: c,
|
|
@@ -394,33 +397,33 @@ se.defaultProps = {
|
|
|
394
397
|
loading: !1,
|
|
395
398
|
disabled: !1
|
|
396
399
|
};
|
|
397
|
-
function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c, itemRender:
|
|
398
|
-
const
|
|
400
|
+
function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c, itemRender: w, ...g }) {
|
|
401
|
+
const m = J(null), x = ae(), [u, S] = E(!1), [R, T] = E(n !== null ? n : ""), B = Se(x.breakpoints.down("sm"));
|
|
399
402
|
j(() => {
|
|
400
|
-
|
|
403
|
+
T(n !== null ? n : "");
|
|
401
404
|
}, [n]);
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
}, []),
|
|
405
|
-
|
|
405
|
+
const C = ne(() => {
|
|
406
|
+
S(!1);
|
|
407
|
+
}, []), y = ne(() => {
|
|
408
|
+
S(!0);
|
|
406
409
|
}, []);
|
|
407
|
-
function
|
|
408
|
-
|
|
410
|
+
function d(b) {
|
|
411
|
+
T(b.value), c(b.value), B && C();
|
|
409
412
|
}
|
|
410
|
-
function
|
|
411
|
-
return
|
|
413
|
+
function i(b) {
|
|
414
|
+
return b === R;
|
|
412
415
|
}
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ h(le, { children: [
|
|
417
|
+
/* @__PURE__ */ h(
|
|
415
418
|
Mt,
|
|
416
419
|
{
|
|
417
|
-
ref:
|
|
418
|
-
onClick:
|
|
420
|
+
ref: m,
|
|
421
|
+
onClick: y,
|
|
419
422
|
variant: "outlined",
|
|
420
423
|
size: "small",
|
|
421
|
-
className: ["my-select__selector", ut(
|
|
424
|
+
className: ["my-select__selector", ut(R) ? "" : "my-select__selector--active"].join(" "),
|
|
422
425
|
sx: { minWidth: "auto" },
|
|
423
|
-
...
|
|
426
|
+
...g,
|
|
424
427
|
children: [
|
|
425
428
|
/* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
|
|
426
429
|
e,
|
|
@@ -428,19 +431,19 @@ function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c,
|
|
|
428
431
|
]
|
|
429
432
|
}
|
|
430
433
|
),
|
|
431
|
-
/* @__PURE__ */ t(Oe, { open:
|
|
434
|
+
/* @__PURE__ */ t(Oe, { open: u, anchorEl: m.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: b, placement: k }) => /* @__PURE__ */ t(Fe, { ...b, sx: { transformOrigin: k === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(Ee, { onClickAway: C, children: /* @__PURE__ */ h(Ot, { autoFocusItem: u, onMouseEnter: y, onMouseLeave: C, children: [
|
|
432
435
|
a,
|
|
433
|
-
s.map((
|
|
436
|
+
s.map((z) => w ? w(z) : /* @__PURE__ */ t(
|
|
434
437
|
qe,
|
|
435
438
|
{
|
|
436
|
-
onClick: () =>
|
|
439
|
+
onClick: () => d(z),
|
|
437
440
|
className: [
|
|
438
441
|
"my-select__option",
|
|
439
|
-
|
|
442
|
+
i(z.value) ? "my-select__option--active" : ""
|
|
440
443
|
].join(" "),
|
|
441
|
-
children:
|
|
444
|
+
children: z.name
|
|
442
445
|
},
|
|
443
|
-
|
|
446
|
+
z.value
|
|
444
447
|
))
|
|
445
448
|
] }) }) }) }) })
|
|
446
449
|
] });
|
|
@@ -462,7 +465,7 @@ ce.defaultProps = {
|
|
|
462
465
|
onChange: () => {
|
|
463
466
|
}
|
|
464
467
|
};
|
|
465
|
-
const Mt =
|
|
468
|
+
const Mt = P(se)`
|
|
466
469
|
border: 1px solid #f0f0f0;
|
|
467
470
|
padding: 6px 8px 6px 12px;
|
|
468
471
|
font-weight: ${(e) => e.theme.typography.fontWeightBold};
|
|
@@ -493,7 +496,7 @@ const Mt = T(se)`
|
|
|
493
496
|
margin-right: 3px;
|
|
494
497
|
}
|
|
495
498
|
}
|
|
496
|
-
`, Ot =
|
|
499
|
+
`, Ot = P(Le)`
|
|
497
500
|
.my-select__option__icon {
|
|
498
501
|
color: transparent;
|
|
499
502
|
font-size: 16px;
|
|
@@ -511,7 +514,7 @@ const Mt = T(se)`
|
|
|
511
514
|
}
|
|
512
515
|
`;
|
|
513
516
|
function U({ options: e, onChange: n, title: r, value: a }) {
|
|
514
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ h(Ft, { children: [
|
|
515
518
|
/* @__PURE__ */ t("div", { className: "title", children: r }),
|
|
516
519
|
/* @__PURE__ */ t("div", { className: "list", children: e.map((s) => /* @__PURE__ */ t(
|
|
517
520
|
"div",
|
|
@@ -526,7 +529,7 @@ function U({ options: e, onChange: n, title: r, value: a }) {
|
|
|
526
529
|
)) })
|
|
527
530
|
] });
|
|
528
531
|
}
|
|
529
|
-
const Ft =
|
|
532
|
+
const Ft = P("div")`
|
|
530
533
|
.title {
|
|
531
534
|
font-size: 18px;
|
|
532
535
|
font-weight: bold;
|
|
@@ -564,20 +567,20 @@ U.defaultProps = {
|
|
|
564
567
|
value: null
|
|
565
568
|
};
|
|
566
569
|
function pe() {
|
|
567
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions:
|
|
568
|
-
|
|
570
|
+
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: w } = L(), [g, m] = E(!1), x = (u, S) => {
|
|
571
|
+
u === "category" && n(S), u === "price" && a(S), m(!1);
|
|
569
572
|
};
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */ t(ht, { variant: "outlined", className: "filter-button", onClick: () =>
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ h(At, { children: [
|
|
574
|
+
/* @__PURE__ */ t(ht, { variant: "outlined", className: "filter-button", onClick: () => m(!0), children: /* @__PURE__ */ t(dt, { className: "filter-icon", fontSize: "small" }) }),
|
|
575
|
+
/* @__PURE__ */ h(mt, { fullWidth: !0, title: "", open: g, onClose: () => m(!1), children: [
|
|
573
576
|
/* @__PURE__ */ t(
|
|
574
577
|
U,
|
|
575
578
|
{
|
|
576
579
|
title: r("common.price"),
|
|
577
|
-
options:
|
|
580
|
+
options: w,
|
|
578
581
|
value: s.price,
|
|
579
|
-
onChange: (
|
|
580
|
-
|
|
582
|
+
onChange: (u) => {
|
|
583
|
+
x("price", u);
|
|
581
584
|
}
|
|
582
585
|
}
|
|
583
586
|
),
|
|
@@ -587,15 +590,15 @@ function pe() {
|
|
|
587
590
|
title: r("common.category"),
|
|
588
591
|
options: c,
|
|
589
592
|
value: e,
|
|
590
|
-
onChange: (
|
|
591
|
-
|
|
593
|
+
onChange: (u) => {
|
|
594
|
+
x("category", u);
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
597
|
) })
|
|
595
598
|
] })
|
|
596
599
|
] });
|
|
597
600
|
}
|
|
598
|
-
const At =
|
|
601
|
+
const At = P("div")`
|
|
599
602
|
.filter-button {
|
|
600
603
|
border-color: rgb(240, 240, 240);
|
|
601
604
|
padding: 5px 8px;
|
|
@@ -608,7 +611,7 @@ const At = T("div")`
|
|
|
608
611
|
`;
|
|
609
612
|
pe.propTypes = {};
|
|
610
613
|
pe.defaultProps = {};
|
|
611
|
-
const Et =
|
|
614
|
+
const Et = P("div")`
|
|
612
615
|
.MuiChip-root {
|
|
613
616
|
border-radius: 4px;
|
|
614
617
|
height: initial;
|
|
@@ -631,12 +634,12 @@ q.defaultProps = {
|
|
|
631
634
|
label: null
|
|
632
635
|
};
|
|
633
636
|
function we() {
|
|
634
|
-
const { t: e } =
|
|
637
|
+
const { t: e } = L();
|
|
635
638
|
return /* @__PURE__ */ t(Re, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
636
639
|
}
|
|
637
640
|
function X({ filterTip: e, keywordTip: n }) {
|
|
638
|
-
const { t: r, locale: a } =
|
|
639
|
-
return /* @__PURE__ */
|
|
641
|
+
const { t: r, locale: a } = L(), s = () => a === "zh" ? "、" : " , ";
|
|
642
|
+
return /* @__PURE__ */ h(yt, { className: "tips", children: [
|
|
640
643
|
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
|
|
641
644
|
e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
|
|
642
645
|
e && n && s(),
|
|
@@ -652,14 +655,14 @@ X.defaultProps = {
|
|
|
652
655
|
keywordTip: !1
|
|
653
656
|
};
|
|
654
657
|
function Z({ primaryStart: e, primaryEnd: n, filter: r }) {
|
|
655
|
-
return /* @__PURE__ */
|
|
658
|
+
return /* @__PURE__ */ h(Re, { variant: "subtitle2", children: [
|
|
656
659
|
/* @__PURE__ */ t("span", { children: e }),
|
|
657
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ h("span", { className: "primary", children: [
|
|
658
661
|
" ",
|
|
659
662
|
r,
|
|
660
663
|
" "
|
|
661
664
|
] }),
|
|
662
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ h("span", { children: [
|
|
663
666
|
n,
|
|
664
667
|
" "
|
|
665
668
|
] })
|
|
@@ -688,79 +691,80 @@ function ue({ blocklets: e, ...n }) {
|
|
|
688
691
|
errors: a,
|
|
689
692
|
loadings: s,
|
|
690
693
|
selectedCategory: c,
|
|
691
|
-
getCategoryLocale:
|
|
692
|
-
filters:
|
|
693
|
-
t:
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
694
|
+
getCategoryLocale: w,
|
|
695
|
+
filters: g,
|
|
696
|
+
t: m,
|
|
697
|
+
serverVersion: x,
|
|
698
|
+
hasNextPage: u,
|
|
699
|
+
loadMore: S,
|
|
700
|
+
endpoint: R
|
|
701
|
+
} = L(), T = !!c || !!g.price, [B] = gt({
|
|
698
702
|
loading: s.fetchBlockletsLoading || s.loadingMore,
|
|
699
|
-
hasNextPage:
|
|
700
|
-
onLoadMore:
|
|
703
|
+
hasNextPage: u,
|
|
704
|
+
onLoadMore: S
|
|
701
705
|
});
|
|
702
706
|
if (a.fetchBlockletsError)
|
|
703
707
|
return /* @__PURE__ */ t(
|
|
704
708
|
Te,
|
|
705
709
|
{
|
|
706
|
-
error: new Error(`Failed to fetch blocklets from ${
|
|
710
|
+
error: new Error(`Failed to fetch blocklets from ${R}: ${a.fetchBlockletsError.message}`)
|
|
707
711
|
}
|
|
708
712
|
);
|
|
709
713
|
if (s.fetchBlockletsLoading)
|
|
710
|
-
return /* @__PURE__ */ t(
|
|
711
|
-
if (
|
|
712
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ t(_, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) });
|
|
715
|
+
if (g.keyword && T && e.length === 0)
|
|
716
|
+
return /* @__PURE__ */ h(Y, { children: [
|
|
713
717
|
/* @__PURE__ */ t(
|
|
714
718
|
Z,
|
|
715
719
|
{
|
|
716
|
-
primaryStart:
|
|
717
|
-
primaryEnd:
|
|
718
|
-
filter:
|
|
720
|
+
primaryStart: m("blocklet.noBlockletPart1"),
|
|
721
|
+
primaryEnd: m("blocklet.noBlockletPart2"),
|
|
722
|
+
filter: g.keyword
|
|
719
723
|
}
|
|
720
724
|
),
|
|
721
725
|
/* @__PURE__ */ t(X, { keywordTip: !0, filterTip: !0 })
|
|
722
726
|
] });
|
|
723
|
-
if (
|
|
724
|
-
return /* @__PURE__ */
|
|
727
|
+
if (g.keyword && e.length === 0)
|
|
728
|
+
return /* @__PURE__ */ h(Y, { children: [
|
|
725
729
|
/* @__PURE__ */ t(
|
|
726
730
|
Z,
|
|
727
731
|
{
|
|
728
|
-
primaryStart:
|
|
729
|
-
primaryEnd:
|
|
730
|
-
filter:
|
|
732
|
+
primaryStart: m("blocklet.noBlockletPart1"),
|
|
733
|
+
primaryEnd: m("blocklet.noBlockletPart2"),
|
|
734
|
+
filter: g.keyword
|
|
731
735
|
}
|
|
732
736
|
),
|
|
733
737
|
/* @__PURE__ */ t(X, { keywordTip: !0 })
|
|
734
738
|
] });
|
|
735
|
-
if (
|
|
736
|
-
const
|
|
737
|
-
return /* @__PURE__ */
|
|
738
|
-
|
|
739
|
+
if (T && e.length === 0) {
|
|
740
|
+
const C = w(c);
|
|
741
|
+
return /* @__PURE__ */ h(Y, { children: [
|
|
742
|
+
C ? /* @__PURE__ */ t(
|
|
739
743
|
Z,
|
|
740
744
|
{
|
|
741
|
-
primaryStart:
|
|
742
|
-
primaryEnd:
|
|
743
|
-
filter:
|
|
745
|
+
primaryStart: m("blocklet.noCategoryResults1"),
|
|
746
|
+
primaryEnd: m("blocklet.noCategoryResults2"),
|
|
747
|
+
filter: C
|
|
744
748
|
}
|
|
745
749
|
) : /* @__PURE__ */ t(we, {}),
|
|
746
750
|
/* @__PURE__ */ t(X, { filterTip: !0 })
|
|
747
751
|
] });
|
|
748
752
|
}
|
|
749
|
-
return e.length === 0 ? /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(we, {}) }) : /* @__PURE__ */ t(ze, { children: (
|
|
753
|
+
return e.length === 0 ? /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(we, {}) }) : /* @__PURE__ */ t(ze, { children: (C, y) => /* @__PURE__ */ h(
|
|
750
754
|
te,
|
|
751
755
|
{
|
|
752
756
|
...n,
|
|
753
757
|
container: !0,
|
|
754
758
|
spacing: 2,
|
|
755
|
-
columns:
|
|
759
|
+
columns: y,
|
|
756
760
|
disableEqualOverflow: !0,
|
|
757
|
-
ref:
|
|
761
|
+
ref: C,
|
|
758
762
|
sx: {
|
|
759
|
-
opacity: () =>
|
|
763
|
+
opacity: () => y > 0 ? 1 : 0
|
|
760
764
|
},
|
|
761
765
|
children: [
|
|
762
|
-
e.map((
|
|
763
|
-
|
|
766
|
+
e.map((d) => /* @__PURE__ */ t(te, { xs: 4, "data-blocklet-did": d.did, children: r({ blocklet: d, blocklets: e, serverVersion: x }) }, d.did)),
|
|
767
|
+
u && /* @__PURE__ */ t(te, { xs: 12, ref: B, children: /* @__PURE__ */ t(_, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) }) })
|
|
764
768
|
]
|
|
765
769
|
}
|
|
766
770
|
) });
|
|
@@ -769,7 +773,7 @@ ue.propTypes = {
|
|
|
769
773
|
blocklets: o.array.isRequired
|
|
770
774
|
};
|
|
771
775
|
ue.defaultProps = {};
|
|
772
|
-
const Y =
|
|
776
|
+
const Y = P(ft)`
|
|
773
777
|
text-align: center;
|
|
774
778
|
.primary {
|
|
775
779
|
color: ${(e) => e.theme.palette.primary.main};
|
|
@@ -779,9 +783,9 @@ const Y = T(ft)`
|
|
|
779
783
|
}
|
|
780
784
|
`;
|
|
781
785
|
function de() {
|
|
782
|
-
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions:
|
|
783
|
-
return /* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(U, { title: r("common.price"), options:
|
|
786
|
+
const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: w } = L();
|
|
787
|
+
return /* @__PURE__ */ h(jt, { children: [
|
|
788
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(U, { title: r("common.price"), options: w, value: s.price, onChange: a }) }),
|
|
785
789
|
c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
|
|
786
790
|
U,
|
|
787
791
|
{
|
|
@@ -793,7 +797,7 @@ function de() {
|
|
|
793
797
|
) })
|
|
794
798
|
] });
|
|
795
799
|
}
|
|
796
|
-
const jt =
|
|
800
|
+
const jt = P("aside")`
|
|
797
801
|
width: 220px;
|
|
798
802
|
margin-right: ${(e) => e.theme.spacing(2)};
|
|
799
803
|
height: 100%;
|
|
@@ -805,10 +809,10 @@ const jt = T("aside")`
|
|
|
805
809
|
de.propTypes = {};
|
|
806
810
|
de.defaultProps = {};
|
|
807
811
|
function me({ placeholder: e, ...n }) {
|
|
808
|
-
const { filters: r, handleKeyword: a } =
|
|
809
|
-
const { value:
|
|
810
|
-
c(
|
|
811
|
-
},
|
|
812
|
+
const { filters: r, handleKeyword: a } = L(), [s, c] = E(r.keyword || ""), w = et(a, { wait: 300 }), g = (x) => {
|
|
813
|
+
const { value: u } = x.target;
|
|
814
|
+
c(u), w.run(u);
|
|
815
|
+
}, m = () => {
|
|
812
816
|
c(""), a();
|
|
813
817
|
};
|
|
814
818
|
return j(() => {
|
|
@@ -819,13 +823,13 @@ function me({ placeholder: e, ...n }) {
|
|
|
819
823
|
inputProps: {
|
|
820
824
|
"data-cy": "search-blocklet"
|
|
821
825
|
},
|
|
822
|
-
startAdornment: /* @__PURE__ */ t(ge, { position: "start", children: /* @__PURE__ */ t(
|
|
823
|
-
onChange:
|
|
826
|
+
startAdornment: /* @__PURE__ */ t(ge, { position: "start", children: /* @__PURE__ */ t(Vt, {}) }),
|
|
827
|
+
onChange: g,
|
|
824
828
|
placeholder: e,
|
|
825
829
|
value: s,
|
|
826
830
|
title: e,
|
|
827
831
|
"data-cy": "search",
|
|
828
|
-
endAdornment: s && /* @__PURE__ */ t(ge, { position: "end", children: /* @__PURE__ */ t(
|
|
832
|
+
endAdornment: s && /* @__PURE__ */ t(ge, { position: "end", children: /* @__PURE__ */ t(Wt, { "data-cy": "search-delete", onClick: m }) }),
|
|
829
833
|
...n
|
|
830
834
|
}
|
|
831
835
|
);
|
|
@@ -836,7 +840,7 @@ me.propTypes = {
|
|
|
836
840
|
me.defaultProps = {
|
|
837
841
|
placeholder: "Type to search..."
|
|
838
842
|
};
|
|
839
|
-
const Ut =
|
|
843
|
+
const Ut = P(je)`
|
|
840
844
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
841
845
|
font-size: 14px;
|
|
842
846
|
border-radius: 6px;
|
|
@@ -853,49 +857,49 @@ const Ut = T(je)`
|
|
|
853
857
|
color: transparent;
|
|
854
858
|
}
|
|
855
859
|
}
|
|
856
|
-
`,
|
|
860
|
+
`, Vt = P(bt)`
|
|
857
861
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
858
862
|
font-size: 28px;
|
|
859
863
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
860
864
|
font-size: 24px;
|
|
861
865
|
}
|
|
862
|
-
`,
|
|
866
|
+
`, Wt = P(wt)`
|
|
863
867
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
864
868
|
font-size: 16px;
|
|
865
869
|
cursor: pointer;
|
|
866
870
|
`;
|
|
867
871
|
function he({ onSelect: e, wrapChildren: n }) {
|
|
868
|
-
const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender:
|
|
869
|
-
const { data:
|
|
870
|
-
return
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
},
|
|
872
|
+
const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender: w, filters: g, endpoint: m, handleKeyword: x, t: u, serverVersion: S } = L(), R = async (d) => {
|
|
873
|
+
const { data: i } = await c.get(N.blockletsPath, { params: d }), b = i.dataList || [];
|
|
874
|
+
return b.length > 0 && b.unshift({ type: "more-result", total: i.total || 0 }), b;
|
|
875
|
+
}, T = (d) => {
|
|
876
|
+
x(d.state.query), d.setIsOpen(!1);
|
|
877
|
+
}, B = () => {
|
|
874
878
|
r.current && setTimeout(() => {
|
|
875
|
-
const
|
|
876
|
-
|
|
879
|
+
const d = r.current.querySelector("input.bl-autocomplete-input");
|
|
880
|
+
d && d.focus();
|
|
877
881
|
});
|
|
878
|
-
},
|
|
879
|
-
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
+
}, C = (d) => {
|
|
883
|
+
d.setIsOpen(!1), B();
|
|
884
|
+
}, y = ({ prevState: d, state: i }) => {
|
|
885
|
+
d.query !== i.query && (i.query || (x(), B()));
|
|
882
886
|
};
|
|
883
887
|
return St(
|
|
884
888
|
"ctrl + k, command + k",
|
|
885
|
-
(
|
|
889
|
+
(d) => (d.stopPropagation(), d.preventDefault(), B(), !1),
|
|
886
890
|
{ enableOnTags: ["INPUT"] }
|
|
887
891
|
), j(() => {
|
|
888
|
-
|
|
889
|
-
}, [
|
|
892
|
+
B();
|
|
893
|
+
}, [m]), j(() => {
|
|
890
894
|
if (!r.current)
|
|
891
895
|
return;
|
|
892
|
-
const
|
|
896
|
+
const d = kt({
|
|
893
897
|
container: r.current,
|
|
894
898
|
renderer: { createElement: Qe, Fragment: Je, render: () => {
|
|
895
899
|
} },
|
|
896
|
-
render({ children:
|
|
900
|
+
render({ children: i }, b) {
|
|
897
901
|
var k;
|
|
898
|
-
(!a.current || s.current !==
|
|
902
|
+
(!a.current || s.current !== b) && (s.current = b, (k = a.current) == null || k.unmount(), a.current = xt(b)), a.current.render(n(i));
|
|
899
903
|
},
|
|
900
904
|
autoFocus: !0,
|
|
901
905
|
openOnFocus: !1,
|
|
@@ -909,54 +913,54 @@ function he({ onSelect: e, wrapChildren: n }) {
|
|
|
909
913
|
detachedContainer: "bl-autocomplete-detached-container"
|
|
910
914
|
},
|
|
911
915
|
translations: {
|
|
912
|
-
clearButtonTitle:
|
|
913
|
-
detachedCancelButtonText:
|
|
914
|
-
submitButtonTitle:
|
|
915
|
-
detachedSearchButtonTitle:
|
|
916
|
+
clearButtonTitle: u("common.clear"),
|
|
917
|
+
detachedCancelButtonText: u("common.cancel"),
|
|
918
|
+
submitButtonTitle: u("common.search"),
|
|
919
|
+
detachedSearchButtonTitle: u("common.search")
|
|
916
920
|
},
|
|
917
|
-
placeholder:
|
|
921
|
+
placeholder: u("common.searchStore"),
|
|
918
922
|
initialState: {
|
|
919
|
-
query:
|
|
923
|
+
query: g.keyword
|
|
920
924
|
},
|
|
921
|
-
onStateChange(
|
|
922
|
-
|
|
925
|
+
onStateChange(i) {
|
|
926
|
+
y(i);
|
|
923
927
|
},
|
|
924
|
-
onSubmit:
|
|
925
|
-
onReset(
|
|
926
|
-
|
|
928
|
+
onSubmit: T,
|
|
929
|
+
onReset(i) {
|
|
930
|
+
C(i);
|
|
927
931
|
},
|
|
928
|
-
getSources({ query:
|
|
929
|
-
const
|
|
930
|
-
...
|
|
931
|
-
sortBy:
|
|
932
|
+
getSources({ query: i, state: b, ...k }) {
|
|
933
|
+
const z = {
|
|
934
|
+
...g,
|
|
935
|
+
sortBy: N[g.sortBy],
|
|
932
936
|
page: 1,
|
|
933
937
|
pageSize: 10,
|
|
934
|
-
keyword:
|
|
938
|
+
keyword: i
|
|
935
939
|
};
|
|
936
940
|
return zt([
|
|
937
941
|
{
|
|
938
942
|
sourceId: "blocklets",
|
|
939
943
|
getItems() {
|
|
940
|
-
return
|
|
944
|
+
return R(z);
|
|
941
945
|
},
|
|
942
946
|
// 选中后填充 搜索框中值
|
|
943
|
-
getItemInputValue({ item:
|
|
944
|
-
return
|
|
947
|
+
getItemInputValue({ item: $ }) {
|
|
948
|
+
return $.type === "more-result" ? i : $.title;
|
|
945
949
|
},
|
|
946
950
|
// 选中或者点击自动完成列表中的 item 时触发
|
|
947
|
-
onSelect({ event:
|
|
948
|
-
return
|
|
949
|
-
blocklet:
|
|
950
|
-
detailUrl: nt(
|
|
951
|
-
storeUrl:
|
|
951
|
+
onSelect({ event: $, item: v }) {
|
|
952
|
+
return v.type === "more-result" ? (k.setIsOpen(!1), x(i)) : $.type === "keydown" ? x(v.title) : e({
|
|
953
|
+
blocklet: v,
|
|
954
|
+
detailUrl: nt(m, "/blocklets", v.did),
|
|
955
|
+
storeUrl: m
|
|
952
956
|
});
|
|
953
957
|
},
|
|
954
958
|
templates: {
|
|
955
|
-
item({ item:
|
|
956
|
-
return
|
|
959
|
+
item({ item: $ }) {
|
|
960
|
+
return $.type === "more-result" ? /* @__PURE__ */ t("div", { children: u("autocomplete.expandResult", { name: i, number: $.total.toLocaleString() }) }) : w({ blocklet: $, autocompleteSetters: k, serverVersion: S });
|
|
957
961
|
},
|
|
958
962
|
noResults() {
|
|
959
|
-
return
|
|
963
|
+
return u("blocklet.noResults");
|
|
960
964
|
}
|
|
961
965
|
}
|
|
962
966
|
}
|
|
@@ -964,9 +968,9 @@ function he({ onSelect: e, wrapChildren: n }) {
|
|
|
964
968
|
}
|
|
965
969
|
});
|
|
966
970
|
return () => {
|
|
967
|
-
|
|
971
|
+
d.destroy();
|
|
968
972
|
};
|
|
969
|
-
}, [
|
|
973
|
+
}, [g, w]), /* @__PURE__ */ h(le, { children: [
|
|
970
974
|
/* @__PURE__ */ t(
|
|
971
975
|
xe,
|
|
972
976
|
{
|
|
@@ -990,7 +994,7 @@ he.defaultProps = {
|
|
|
990
994
|
wrapChildren: (e) => e
|
|
991
995
|
};
|
|
992
996
|
function fe({ t: e }) {
|
|
993
|
-
const { filters: n, handleSwitchShowResources: r } =
|
|
997
|
+
const { filters: n, handleSwitchShowResources: r } = L(), a = () => {
|
|
994
998
|
n.showResources = !n.showResources, r();
|
|
995
999
|
};
|
|
996
1000
|
return /* @__PURE__ */ t(
|
|
@@ -1008,8 +1012,8 @@ fe.propTypes = {
|
|
|
1008
1012
|
t: o.func.isRequired
|
|
1009
1013
|
};
|
|
1010
1014
|
fe.defaultProps = {};
|
|
1011
|
-
function
|
|
1012
|
-
var
|
|
1015
|
+
function Gt() {
|
|
1016
|
+
var G, K;
|
|
1013
1017
|
const {
|
|
1014
1018
|
handleDeveloper: e,
|
|
1015
1019
|
blockletList: n,
|
|
@@ -1017,53 +1021,53 @@ function Kt() {
|
|
|
1017
1021
|
developerName: a,
|
|
1018
1022
|
handleSort: s,
|
|
1019
1023
|
handleCategory: c,
|
|
1020
|
-
handlePrice:
|
|
1021
|
-
handleSearchSelect:
|
|
1022
|
-
t:
|
|
1023
|
-
getCategoryLocale:
|
|
1024
|
-
priceOptions:
|
|
1025
|
-
wrapChildren:
|
|
1026
|
-
showResourcesSwitch:
|
|
1027
|
-
showCategory:
|
|
1028
|
-
baseSearch:
|
|
1029
|
-
onFilterChange:
|
|
1030
|
-
tagFilters:
|
|
1031
|
-
} =
|
|
1024
|
+
handlePrice: w,
|
|
1025
|
+
handleSearchSelect: g,
|
|
1026
|
+
t: m,
|
|
1027
|
+
getCategoryLocale: x,
|
|
1028
|
+
priceOptions: u,
|
|
1029
|
+
wrapChildren: S,
|
|
1030
|
+
showResourcesSwitch: R,
|
|
1031
|
+
showCategory: T,
|
|
1032
|
+
baseSearch: B,
|
|
1033
|
+
onFilterChange: C,
|
|
1034
|
+
tagFilters: y
|
|
1035
|
+
} = L(), d = vt(m), i = ((G = d.find((f) => f.value === r.sortBy)) == null ? void 0 : G.name) || m("sort.sort"), b = x(r.category), { resourceType: k } = r || {}, z = (K = u.find((f) => f.value === r.price)) == null ? void 0 : K.name, [$, v] = E(!1), V = ae(), ee = Se(() => V.breakpoints.down("md")), O = Pe({
|
|
1032
1036
|
chooseTagId: ""
|
|
1033
|
-
}),
|
|
1034
|
-
O.chooseTagId =
|
|
1035
|
-
typeof
|
|
1036
|
-
}),
|
|
1037
|
-
}), F = rt(() =>
|
|
1037
|
+
}), W = tt((f) => {
|
|
1038
|
+
O.chooseTagId = f.id, ["category", "resourceType", "resourceDid"].forEach((M) => {
|
|
1039
|
+
typeof f.params[M] > "u" ? delete r[M] : r[M] = f.params[M];
|
|
1040
|
+
}), C(r);
|
|
1041
|
+
}), F = rt(() => y.find((f) => f.id === O.chooseTagId), [O.chooseTagId]);
|
|
1038
1042
|
return ot(() => {
|
|
1039
|
-
const
|
|
1043
|
+
const f = lt(window.location.search), H = y.find((M) => {
|
|
1040
1044
|
const l = M.params;
|
|
1041
|
-
return l ? Object.keys(l).every((p) =>
|
|
1045
|
+
return l ? Object.keys(l).every((p) => f[p] === l[p]) : !1;
|
|
1042
1046
|
});
|
|
1043
|
-
|
|
1044
|
-
}), /* @__PURE__ */
|
|
1045
|
-
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
|
|
1047
|
+
H ? W(H) : y.length > 0 && W(y[0]);
|
|
1048
|
+
}), /* @__PURE__ */ h(_, { display: "flex", alignItems: "flex-start", height: "100%", children: [
|
|
1049
|
+
T ? /* @__PURE__ */ t(ye, { mdDown: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
|
|
1050
|
+
/* @__PURE__ */ h(Kt, { children: [
|
|
1051
|
+
/* @__PURE__ */ h(Ht, { children: [
|
|
1052
|
+
/* @__PURE__ */ h(
|
|
1053
|
+
_,
|
|
1050
1054
|
{
|
|
1051
1055
|
className: "filter-bar",
|
|
1052
1056
|
sx: {
|
|
1053
1057
|
display: "flex",
|
|
1054
1058
|
flexDirection: {
|
|
1055
1059
|
lg: "row",
|
|
1056
|
-
md:
|
|
1060
|
+
md: R ? "column" : "row"
|
|
1057
1061
|
},
|
|
1058
1062
|
alignItems: {
|
|
1059
1063
|
lg: "center",
|
|
1060
|
-
md:
|
|
1064
|
+
md: R ? "flex-start" : "center",
|
|
1061
1065
|
xs: "center"
|
|
1062
1066
|
},
|
|
1063
1067
|
gap: 1
|
|
1064
1068
|
},
|
|
1065
1069
|
children: [
|
|
1066
|
-
|
|
1070
|
+
T ? /* @__PURE__ */ t(ye, { mdUp: !0, children: /* @__PURE__ */ t(pe, {}) }) : null,
|
|
1067
1071
|
/* @__PURE__ */ t(
|
|
1068
1072
|
"form",
|
|
1069
1073
|
{
|
|
@@ -1072,29 +1076,29 @@ function Kt() {
|
|
|
1072
1076
|
flex: 1,
|
|
1073
1077
|
width: "100%"
|
|
1074
1078
|
},
|
|
1075
|
-
onSubmit: (
|
|
1076
|
-
|
|
1079
|
+
onSubmit: (f) => {
|
|
1080
|
+
f.preventDefault(), f.stopPropagation();
|
|
1077
1081
|
},
|
|
1078
1082
|
onFocus: () => {
|
|
1079
|
-
|
|
1083
|
+
v(!0);
|
|
1080
1084
|
},
|
|
1081
1085
|
onBlur: () => {
|
|
1082
|
-
|
|
1086
|
+
v(!1);
|
|
1083
1087
|
},
|
|
1084
|
-
children:
|
|
1088
|
+
children: B ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: m("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: g, wrapChildren: S })
|
|
1085
1089
|
}
|
|
1086
1090
|
),
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
!ee &&
|
|
1091
|
+
/* @__PURE__ */ h(_, { className: "filter-container", display: "flex", alignItems: "center", children: [
|
|
1092
|
+
!ee && R && /* @__PURE__ */ t(_, { ml: 1, mr: 1, children: /* @__PURE__ */ t(fe, { t: m }) }),
|
|
1089
1093
|
/* @__PURE__ */ t(
|
|
1090
1094
|
ce,
|
|
1091
1095
|
{
|
|
1092
1096
|
value: r.sortBy,
|
|
1093
|
-
options:
|
|
1094
|
-
title:
|
|
1097
|
+
options: d,
|
|
1098
|
+
title: i,
|
|
1095
1099
|
icon: /* @__PURE__ */ t(_e, {}),
|
|
1096
|
-
onChange: (
|
|
1097
|
-
s(
|
|
1100
|
+
onChange: (f) => {
|
|
1101
|
+
s(f);
|
|
1098
1102
|
}
|
|
1099
1103
|
}
|
|
1100
1104
|
)
|
|
@@ -1102,12 +1106,12 @@ function Kt() {
|
|
|
1102
1106
|
]
|
|
1103
1107
|
}
|
|
1104
1108
|
),
|
|
1105
|
-
|
|
1109
|
+
T ? /* @__PURE__ */ h(_, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
|
|
1106
1110
|
/* @__PURE__ */ t(
|
|
1107
1111
|
q,
|
|
1108
1112
|
{
|
|
1109
1113
|
label: a,
|
|
1110
|
-
icon: /* @__PURE__ */ t(
|
|
1114
|
+
icon: /* @__PURE__ */ t(Ve, {}),
|
|
1111
1115
|
onDelete: () => {
|
|
1112
1116
|
e(null);
|
|
1113
1117
|
}
|
|
@@ -1116,7 +1120,7 @@ function Kt() {
|
|
|
1116
1120
|
/* @__PURE__ */ t(
|
|
1117
1121
|
q,
|
|
1118
1122
|
{
|
|
1119
|
-
label:
|
|
1123
|
+
label: b,
|
|
1120
1124
|
onDelete: () => {
|
|
1121
1125
|
c(null);
|
|
1122
1126
|
}
|
|
@@ -1125,36 +1129,36 @@ function Kt() {
|
|
|
1125
1129
|
/* @__PURE__ */ t(
|
|
1126
1130
|
q,
|
|
1127
1131
|
{
|
|
1128
|
-
label:
|
|
1132
|
+
label: z,
|
|
1129
1133
|
onDelete: () => {
|
|
1130
|
-
|
|
1134
|
+
w(null);
|
|
1131
1135
|
}
|
|
1132
1136
|
}
|
|
1133
1137
|
),
|
|
1134
|
-
|
|
1138
|
+
k && /* @__PURE__ */ t(q, { label: `${m("common.resourceType")}: ${k}` })
|
|
1135
1139
|
] }) : null
|
|
1136
1140
|
] }),
|
|
1137
|
-
/* @__PURE__ */ t(
|
|
1138
|
-
(
|
|
1139
|
-
/* @__PURE__ */ t(Ue, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children:
|
|
1141
|
+
/* @__PURE__ */ t(We, { FallbackComponent: Te, children: /* @__PURE__ */ h(_, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
|
|
1142
|
+
(y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ h(le, { children: [
|
|
1143
|
+
/* @__PURE__ */ t(Ue, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: y.map((f) => /* @__PURE__ */ t(
|
|
1140
1144
|
Ce,
|
|
1141
1145
|
{
|
|
1142
|
-
label:
|
|
1146
|
+
label: f.title,
|
|
1143
1147
|
size: "small",
|
|
1144
|
-
variant: O.chooseTagId ===
|
|
1145
|
-
onClick: () =>
|
|
1146
|
-
color: O.chooseTagId ===
|
|
1148
|
+
variant: O.chooseTagId === f.id ? "contained" : "outlined",
|
|
1149
|
+
onClick: () => W(f),
|
|
1150
|
+
color: O.chooseTagId === f.id ? "primary" : "default"
|
|
1147
1151
|
},
|
|
1148
|
-
|
|
1152
|
+
f.id
|
|
1149
1153
|
)) }),
|
|
1150
|
-
F ? /* @__PURE__ */ t(
|
|
1154
|
+
F ? /* @__PURE__ */ t(_, { mb: 2, children: F.description ? /* @__PURE__ */ t(ve, { variant: "body1", children: F.description }) : null }) : null
|
|
1151
1155
|
] }) : null,
|
|
1152
1156
|
/* @__PURE__ */ t(ue, { blocklets: n })
|
|
1153
1157
|
] }) })
|
|
1154
1158
|
] })
|
|
1155
1159
|
] });
|
|
1156
1160
|
}
|
|
1157
|
-
const
|
|
1161
|
+
const Kt = P("main")`
|
|
1158
1162
|
display: flex;
|
|
1159
1163
|
flex-direction: column;
|
|
1160
1164
|
flex: 1;
|
|
@@ -1192,7 +1196,7 @@ const Ht = T("main")`
|
|
|
1192
1196
|
font-size: 12px;
|
|
1193
1197
|
}
|
|
1194
1198
|
}
|
|
1195
|
-
`,
|
|
1199
|
+
`, Ht = P("div")`
|
|
1196
1200
|
position: sticky;
|
|
1197
1201
|
top: 0;
|
|
1198
1202
|
z-index: 9;
|
|
@@ -1238,9 +1242,9 @@ function De(e) {
|
|
|
1238
1242
|
}
|
|
1239
1243
|
`
|
|
1240
1244
|
};
|
|
1241
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ h(ie, { ...e, children: [
|
|
1242
1246
|
/* @__PURE__ */ t(xe, { styles: a.autocomplete }),
|
|
1243
|
-
/* @__PURE__ */ t(
|
|
1247
|
+
/* @__PURE__ */ t(Gt, {})
|
|
1244
1248
|
] });
|
|
1245
1249
|
}
|
|
1246
1250
|
De.propTypes = Be;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.28",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@algolia/autocomplete-js": "^1.17.0",
|
|
54
54
|
"@algolia/autocomplete-theme-classic": "^1.17.0",
|
|
55
|
-
"@blocklet/util": "0.13.
|
|
55
|
+
"@blocklet/util": "0.13.28",
|
|
56
56
|
"@emotion/react": "^11.10.0",
|
|
57
57
|
"@emotion/styled": "^11.10.0",
|
|
58
58
|
"@mui/icons-material": "^5.16.4",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"prettier": "^3.3.2",
|
|
84
84
|
"vite": "^5.2.12"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "ba5b362b8e1a797a79e51f6aed61e8e3bed42dae"
|
|
87
87
|
}
|