@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.
@@ -10,7 +10,8 @@ const en = {
10
10
  common: {
11
11
  searchStore: 'Search the store',
12
12
  price: 'Price',
13
- category: 'Category'
13
+ category: 'Category',
14
+ resourceType: 'Resource Type'
14
15
  },
15
16
  sort: {
16
17
  sort: 'Sort',
@@ -45,7 +46,8 @@ const zh = {
45
46
  common: {
46
47
  searchStore: '搜索商店内应用',
47
48
  price: '价格',
48
- category: '类别'
49
+ category: '类别',
50
+ resourceType: '资源类型'
49
51
  },
50
52
  sort: {
51
53
  sort: '排序',
package/lib/base.js CHANGED
@@ -42,6 +42,9 @@ function ListBase() {
42
42
  const sortOptions = (0, _utils.getSortOptions)(t);
43
43
  const sortLocale = ((_sortOptions$find = sortOptions.find(f => f.value === filters.sortBy)) === null || _sortOptions$find === void 0 ? void 0 : _sortOptions$find.name) || t('sort.sort');
44
44
  const categoryLocale = getCategoryLocale(filters.category);
45
+ const {
46
+ resourceType
47
+ } = filters || {};
45
48
  const priceLocale = (_priceOptions$find = priceOptions.find(price => price.value === filters.price)) === null || _priceOptions$find === void 0 ? void 0 : _priceOptions$find.name;
46
49
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
47
50
  display: "flex",
@@ -100,6 +103,8 @@ function ListBase() {
100
103
  onDelete: () => {
101
104
  handlePrice(null);
102
105
  }
106
+ }), resourceType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_filter2.CustomChip, {
107
+ label: "".concat(t('common.resourceType'), ": ").concat(resourceType)
103
108
  })]
104
109
  })]
105
110
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
@@ -44,7 +44,7 @@ FilterChip.propTypes = {
44
44
  icon: _propTypes.default.element
45
45
  };
46
46
  FilterChip.defaultProps = {
47
- onDelete: () => {},
47
+ onDelete: null,
48
48
  icon: null,
49
49
  label: null
50
50
  };
@@ -42,7 +42,8 @@ function FilterProvider(_ref) {
42
42
  wrapChildren,
43
43
  baseSearch,
44
44
  serverVersion,
45
- storeVersion
45
+ storeVersion,
46
+ fetchCategoryDelay
46
47
  } = _ref;
47
48
  const requestHeaders = {};
48
49
  if (serverVersion) {
@@ -222,7 +223,10 @@ function FilterProvider(_ref) {
222
223
  handleSearchSelect: onSearchSelect
223
224
  };
224
225
  (0, _react.useEffect)(() => {
225
- fetchCategories();
226
+ // sometimes blocklet list can be rendered only before the category is fetched
227
+ setTimeout(() => {
228
+ fetchCategories();
229
+ }, fetchCategoryDelay || 0);
226
230
  // eslint-disable-next-line react-hooks/exhaustive-deps
227
231
  }, [endpoint]);
228
232
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {