@blocklet/list 0.10.20 → 0.10.22

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.
@@ -39,7 +39,7 @@ const en = {
39
39
  noCategoryResults2: '" Blocklets'
40
40
  },
41
41
  autocomplete: {
42
- expandResult: 'Show all search results for "{name}" '
42
+ expandResult: 'Show {number} search results for "{name}" '
43
43
  }
44
44
  };
45
45
  const zh = {
@@ -74,7 +74,7 @@ const zh = {
74
74
  noCategoryResults2: '" 类别的 Blocklets'
75
75
  },
76
76
  autocomplete: {
77
- expandResult: '显示所有 “{name}” 的搜索结果 '
77
+ expandResult: '显示 {number} 条 “{name}” 的搜索结果 '
78
78
  }
79
79
  };
80
80
  var _default = {
@@ -58,11 +58,12 @@ function Autocomplete(_ref) {
58
58
  } = await storeApi.get(_constant.default.blockletsPath, {
59
59
  params
60
60
  });
61
- const blocklets = data.dataList || []; // 头部插入的一条 item 用于展示 `点击展开更多结果`,如果没有blocklet 返回,不展示
61
+ const blocklets = data.dataList || []; // 头部插入的一条 item 用于展示 `点击展开 xx条 结果`,如果没有blocklet 返回,不展示
62
62
 
63
63
  if (blocklets.length > 0) {
64
64
  blocklets.unshift({
65
- type: 'more-result'
65
+ type: 'more-result',
66
+ total: data.total || 0
66
67
  });
67
68
  }
68
69
 
@@ -142,7 +143,7 @@ function Autocomplete(_ref) {
142
143
  panelRootRef.current.render(children);
143
144
  },
144
145
 
145
- autoFocus: true,
146
+ autoFocus: false,
146
147
  classNames: {
147
148
  panel: 'bl-autocomplete-panel',
148
149
  label: 'bl-autocomplete-label',
@@ -173,7 +174,7 @@ function Autocomplete(_ref) {
173
174
  const params = _objectSpread(_objectSpread({}, filters), {}, {
174
175
  sortBy: _constant.default[filters.sortBy],
175
176
  page: 1,
176
- pageSize: 5,
177
+ pageSize: 10,
177
178
  keyword: query
178
179
  });
179
180
 
@@ -204,7 +205,7 @@ function Autocomplete(_ref) {
204
205
  } = _ref6;
205
206
 
206
207
  if (item.type === 'more-result') {
207
- return null;
208
+ return handleKeyword(query);
208
209
  }
209
210
 
210
211
  return onSelect({
@@ -224,7 +225,8 @@ function Autocomplete(_ref) {
224
225
  if (item.type === 'more-result') {
225
226
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
226
227
  children: t('autocomplete.expandResult', {
227
- name: query
228
+ name: query,
229
+ number: item.total.toLocaleString()
228
230
  })
229
231
  });
230
232
  }
@@ -35,7 +35,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
35
35
 
36
36
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
37
37
 
38
- const Div = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.arcblock-blocklet {\n padding: ", " ", " 0\n ", ";\n }\n .arcblock-blocklet__content {\n cursor: pointer;\n display: flex;\n }\n .arcblock-blocklet__cover {\n width: 64px;\n height: 64px;\n margin-right: ", ";\n overflow: hidden;\n border-radius: 12px;\n transform: translateZ(0);\n }\n\n .arcblock-blocklet__info {\n flex: 1;\n overflow: hidden;\n border-bottom: 1px solid ", ";\n padding-bottom: ", ";\n }\n .arcblock-blocklet__text {\n height: 57px;\n overflow: hidden;\n }\n /* \u8BBE\u7F6E\u591A\u884C\u6587\u672C\u6EA2\u51FA\u663E\u793A\u7701\u7565\u53F7 \u517C\u5BB9fireFox\u3001safari */\n .arcblock-blocklet__title {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .arcblock-blocklet__describe {\n margin-top: ", ";\n color: ", ";\n font-size: 14px;\n font-weight: 500;\n line-height: 17px;\n max-height: 34px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n word-break: break-word;\n }\n .ms-highlight {\n background-color: yellow;\n }\n"])), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.palette.divider, props => props.theme.spacing(2), props => props.theme.spacing(0.5), props => props.theme.palette.grey[600]);
38
+ const Div = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.arcblock-blocklet {\n padding: ", " ", " 0\n ", ";\n }\n .arcblock-blocklet__content {\n cursor: pointer;\n display: flex;\n }\n .arcblock-blocklet__cover {\n width: 64px;\n height: 64px;\n margin-right: ", ";\n overflow: hidden;\n border-radius: 12px;\n transform: translateZ(0);\n }\n\n .arcblock-blocklet__info {\n flex: 1;\n overflow: hidden;\n border-bottom: 1px solid ", ";\n padding-bottom: ", ";\n }\n .arcblock-blocklet__text {\n height: 57px;\n overflow: hidden;\n }\n /* \u8BBE\u7F6E\u591A\u884C\u6587\u672C\u6EA2\u51FA\u663E\u793A\u7701\u7565\u53F7 \u517C\u5BB9fireFox\u3001safari */\n .arcblock-blocklet__title {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .arcblock-blocklet__describe {\n margin-top: ", ";\n color: ", ";\n font-size: 14px;\n font-weight: 500;\n line-height: 17px;\n max-height: 34px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n word-break: break-word;\n }\n .ms-highlight {\n color: ", ";\n }\n"])), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.spacing(2), props => props.theme.palette.divider, props => props.theme.spacing(2), props => props.theme.spacing(0.5), props => props.theme.palette.grey[600], props => props.theme.palette.primary.main);
39
39
 
40
40
  function Blocklet(_ref) {
41
41
  let {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/list",
3
- "version": "0.10.20",
3
+ "version": "0.10.22",
4
4
  "description": "Common ux components of blocklet",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@algolia/autocomplete-js": "^1.7.1",
44
44
  "@algolia/autocomplete-theme-classic": "^1.7.1",
45
- "@arcblock/ux": "^2.4.40",
45
+ "@arcblock/ux": "^2.4.47",
46
46
  "@emotion/react": "^11.10.0",
47
47
  "@emotion/styled": "^11.10.0",
48
48
  "@mui/icons-material": "^5.8.4",
@@ -71,5 +71,5 @@
71
71
  "eslint": "^8.22.0",
72
72
  "prettier": "^2.7.1"
73
73
  },
74
- "gitHead": "325fb367d112f88af0d4c78b9e26e089f9d363f1"
74
+ "gitHead": "0976ae6e519b415f56cad1b6a1070e9c85d69f35"
75
75
  }
@@ -32,7 +32,7 @@ const en = {
32
32
  noCategoryResults2: '" Blocklets',
33
33
  },
34
34
  autocomplete: {
35
- expandResult: 'Show all search results for "{name}" ',
35
+ expandResult: 'Show {number} search results for "{name}" ',
36
36
  },
37
37
  };
38
38
 
@@ -68,7 +68,7 @@ const zh = {
68
68
  noCategoryResults2: '" 类别的 Blocklets',
69
69
  },
70
70
  autocomplete: {
71
- expandResult: '显示所有 “{name}” 的搜索结果 ',
71
+ expandResult: '显示 {number} 条 “{name}” 的搜索结果 ',
72
72
  },
73
73
  };
74
74
 
@@ -23,9 +23,9 @@ export default function Autocomplete({ onSelect }) {
23
23
  async (params) => {
24
24
  const { data } = await storeApi.get(constant.blockletsPath, { params });
25
25
  const blocklets = data.dataList || [];
26
- // 头部插入的一条 item 用于展示 `点击展开更多结果`,如果没有blocklet 返回,不展示
26
+ // 头部插入的一条 item 用于展示 `点击展开 xx条 结果`,如果没有blocklet 返回,不展示
27
27
  if (blocklets.length > 0) {
28
- blocklets.unshift({ type: 'more-result' });
28
+ blocklets.unshift({ type: 'more-result', total: data.total || 0 });
29
29
  }
30
30
  return blocklets;
31
31
  },
@@ -101,7 +101,7 @@ export default function Autocomplete({ onSelect }) {
101
101
 
102
102
  panelRootRef.current.render(children);
103
103
  },
104
- autoFocus: true,
104
+ autoFocus: false,
105
105
  classNames: {
106
106
  panel: 'bl-autocomplete-panel',
107
107
  label: 'bl-autocomplete-label',
@@ -125,7 +125,7 @@ export default function Autocomplete({ onSelect }) {
125
125
  ...filters,
126
126
  sortBy: constant[filters.sortBy],
127
127
  page: 1,
128
- pageSize: 5,
128
+ pageSize: 10,
129
129
  keyword: query,
130
130
  };
131
131
  return debounced([
@@ -144,7 +144,7 @@ export default function Autocomplete({ onSelect }) {
144
144
  // 选中或者点击自动完成列表中的 item 时触发
145
145
  onSelect({ item }) {
146
146
  if (item.type === 'more-result') {
147
- return null;
147
+ return handleKeyword(query);
148
148
  }
149
149
  return onSelect({
150
150
  blocklet: item,
@@ -156,7 +156,9 @@ export default function Autocomplete({ onSelect }) {
156
156
  item({ item }) {
157
157
  const logoUrl = item.logo ? joinUrl(endpoint, 'assets', item.did, item.logo) : null;
158
158
  if (item.type === 'more-result') {
159
- return <div>{t('autocomplete.expandResult', { name: query })}</div>;
159
+ return (
160
+ <div>{t('autocomplete.expandResult', { name: query, number: item.total.toLocaleString() })}</div>
161
+ );
160
162
  }
161
163
  return (
162
164
  <MuiThemeProvider theme={muiTheme}>
@@ -56,7 +56,7 @@ const Div = styled('div')`
56
56
  word-break: break-word;
57
57
  }
58
58
  .ms-highlight {
59
- background-color: yellow;
59
+ color: ${(props) => props.theme.palette.primary.main};
60
60
  }
61
61
  `;
62
62