@alicloud/console-components-search 0.2.34 → 0.2.35

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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/es/ComplexSearch/InputPrefix.js +6 -9
  3. package/es/ComplexSearch/index.js +46 -84
  4. package/es/constants.js +3 -1
  5. package/es/index.js +4 -4
  6. package/es/message.js +16 -17
  7. package/es/search.js +11 -18
  8. package/es/searchTagList/PureTag.js +10 -15
  9. package/es/searchTagList/index.js +16 -37
  10. package/es/style.js +13 -11
  11. package/es/types/IRcSearchOptions.type.js +1 -0
  12. package/es/types/IRcSearchProps.type.js +1 -0
  13. package/es/types/IRcSearchTagItemProps.type.js +1 -0
  14. package/es/types/IRcSearchTagListProps.type.js +1 -0
  15. package/es/useCssVar.js +6 -11
  16. package/es/utils.js +9 -41
  17. package/lib/ComplexSearch/InputPrefix.d.ts +2 -2
  18. package/lib/ComplexSearch/InputPrefix.js +7 -16
  19. package/lib/ComplexSearch/index.js +50 -107
  20. package/lib/constants.js +7 -9
  21. package/lib/index.d.ts +5 -5
  22. package/lib/index.js +10 -17
  23. package/lib/message.js +17 -22
  24. package/lib/search.d.ts +2 -2
  25. package/lib/search.js +9 -28
  26. package/lib/searchTagList/PureTag.js +11 -23
  27. package/lib/searchTagList/index.d.ts +1 -1
  28. package/lib/searchTagList/index.js +12 -48
  29. package/lib/style.d.ts +1 -1
  30. package/lib/style.js +13 -24
  31. package/lib/types/IRcSearchOptions.type.d.ts +13 -13
  32. package/lib/types/IRcSearchOptions.type.js +5 -1
  33. package/lib/types/IRcSearchProps.type.d.ts +2 -2
  34. package/lib/types/IRcSearchProps.type.js +5 -1
  35. package/lib/types/IRcSearchTagItemProps.type.js +5 -1
  36. package/lib/types/IRcSearchTagListProps.type.js +5 -1
  37. package/lib/useCssVar.js +6 -19
  38. package/lib/utils.d.ts +1 -3
  39. package/lib/utils.js +18 -72
  40. package/package.json +19 -16
  41. package/dist/index.css +0 -73
  42. package/dist/index.js +0 -135349
  43. package/doc-dist/0.js +0 -2094
  44. package/doc-dist/1.js +0 -27
  45. package/doc-dist/10.js +0 -6
  46. package/doc-dist/11.js +0 -6
  47. package/doc-dist/12.js +0 -6
  48. package/doc-dist/13.js +0 -6
  49. package/doc-dist/14.js +0 -6
  50. package/doc-dist/15.js +0 -6
  51. package/doc-dist/16.js +0 -6
  52. package/doc-dist/3.js +0 -89
  53. package/doc-dist/4.js +0 -6
  54. package/doc-dist/5.js +0 -13
  55. package/doc-dist/6.css +0 -1
  56. package/doc-dist/6.js +0 -6
  57. package/doc-dist/6.os.css +0 -1
  58. package/doc-dist/7.js +0 -6
  59. package/doc-dist/8.js +0 -6
  60. package/doc-dist/9.js +0 -6
  61. package/doc-dist/console-fe-test-rc-search-doc.manifest.json +0 -38
  62. package/doc-dist/deps/console-fe-test-rc-search-doc-deps.manifest.json +0 -33
  63. package/doc-dist/deps/index.html +0 -14
  64. package/doc-dist/deps/main.css +0 -1
  65. package/doc-dist/deps/main.js +0 -103
  66. package/doc-dist/deps/main.os.css +0 -1
  67. package/doc-dist/index.css +0 -1
  68. package/doc-dist/index.html +0 -14
  69. package/doc-dist/index.js +0 -19
  70. package/doc-dist/index.os.css +0 -1
  71. package/doc-dist/log-deps-build.log +0 -19
  72. package/es/provider/LoggerProvider.js +0 -37
  73. package/lib/provider/LoggerProvider.d.ts +0 -8
  74. package/lib/provider/LoggerProvider.js +0 -47
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Alibaba Cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,18 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["defaultValue", "dataSource", "label"];
3
4
  import React from 'react';
4
5
  import classNames from 'classnames';
5
6
  import { Icon, Select } from '@alicloud/console-components';
6
-
7
7
  var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
8
8
  var _dataSource$, _dataSource$$children;
9
-
10
9
  var defaultValue = props.defaultValue,
11
- _props$dataSource = props.dataSource,
12
- dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
13
- label = props.label,
14
- reset = _objectWithoutProperties(props, ["defaultValue", "dataSource", "label"]);
15
-
10
+ _props$dataSource = props.dataSource,
11
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
12
+ label = props.label,
13
+ reset = _objectWithoutProperties(props, _excluded);
16
14
  var noSelect = dataSource.length < 2 && ((_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : (_dataSource$$children = _dataSource$.children) === null || _dataSource$$children === void 0 ? void 0 : _dataSource$$children.length) < 2;
17
15
  return /*#__PURE__*/React.createElement("div", {
18
16
  className: classNames('condition-item')
@@ -32,7 +30,7 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
32
30
  dataSource: dataSource,
33
31
  itemRender: function itemRender(_ref) {
34
32
  var label = _ref.label,
35
- value = _ref.value;
33
+ value = _ref.value;
36
34
  return /*#__PURE__*/React.createElement("span", {
37
35
  "data-value": value
38
36
  }, label);
@@ -42,5 +40,4 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
42
40
  popupClassName: "rc-search-prefix"
43
41
  })));
44
42
  };
45
-
46
43
  export default SearchConditionSelectPrefix;
@@ -2,11 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
-
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
7
-
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
-
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
7
  import classNames from 'classnames';
11
8
  import cloneDeep from 'lodash/cloneDeep';
12
9
  import groupBy from 'lodash/groupBy';
@@ -24,17 +21,15 @@ var AutoComplete = Select.AutoComplete;
24
21
  * @param IRcSearchOptionsProps options
25
22
  * @returns
26
23
  */
27
-
28
24
  var normalizeOptions = function normalizeOptions(options) {
29
25
  var optionsCopy = cloneDeep(options);
30
26
  optionsCopy.forEach(function (o) {
31
- return !o.groupName && (o.groupName = message.defaultFilterGroupName);
27
+ !o.groupName && (o.groupName = message.defaultFilterGroupName);
32
28
  });
33
29
  return Object.entries(groupBy(optionsCopy, 'groupName')).map(function (_ref) {
34
30
  var _ref2 = _slicedToArray(_ref, 2),
35
- groupName = _ref2[0],
36
- children = _ref2[1];
37
-
31
+ groupName = _ref2[0],
32
+ children = _ref2[1];
38
33
  return {
39
34
  label: groupName,
40
35
  children: children.map(function (l) {
@@ -46,7 +41,6 @@ var normalizeOptions = function normalizeOptions(options) {
46
41
  };
47
42
  });
48
43
  };
49
-
50
44
  var normalizeSuggestion = function normalizeSuggestion(suggestion) {
51
45
  var suggestionCopy = cloneDeep(suggestion);
52
46
  suggestionCopy.forEach(function (s) {
@@ -60,38 +54,31 @@ var normalizeSuggestion = function normalizeSuggestion(suggestion) {
60
54
  });
61
55
  return suggestionCopy;
62
56
  };
63
-
64
57
  var normalizeSelectDataSource = function normalizeSelectDataSource(title, list) {
65
58
  return [{
66
59
  label: title || '',
67
60
  children: _toConsumableArray(list)
68
61
  }];
69
62
  };
70
-
71
63
  var normalizeSearchOptions = function normalizeSearchOptions(dataIndex, value, options) {
72
64
  var opt = options === null || options === void 0 ? void 0 : options.find(function (o) {
73
65
  return o.dataIndex === dataIndex;
74
66
  });
75
67
  var valueLabel = value;
76
-
77
68
  if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'select') {
78
69
  var _opt$templateProps, _opt$templateProps$da;
79
-
80
70
  valueLabel = (_opt$templateProps = opt.templateProps) === null || _opt$templateProps === void 0 ? void 0 : (_opt$templateProps$da = _opt$templateProps.dataSource.find(function (d) {
81
71
  return d.value === value;
82
72
  })) === null || _opt$templateProps$da === void 0 ? void 0 : _opt$templateProps$da.label;
83
73
  }
84
-
85
74
  if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'multiple') {
86
75
  var _opt$templateProps2;
87
-
88
76
  valueLabel = (_opt$templateProps2 = opt.templateProps) === null || _opt$templateProps2 === void 0 ? void 0 : _opt$templateProps2.dataSource.filter(function (d) {
89
77
  return value === null || value === void 0 ? void 0 : value.includes(d.value);
90
78
  }).map(function (d) {
91
79
  return d.label;
92
80
  }).join('/');
93
81
  }
94
-
95
82
  return {
96
83
  label: opt === null || opt === void 0 ? void 0 : opt.label,
97
84
  valueLabel: valueLabel,
@@ -99,7 +86,6 @@ var normalizeSearchOptions = function normalizeSearchOptions(dataIndex, value, o
99
86
  dataIndex: dataIndex
100
87
  };
101
88
  };
102
-
103
89
  var highlightKeyword = function highlightKeyword(value, keywords) {
104
90
  var idx = value.toLowerCase().indexOf(keywords.toLowerCase());
105
91
  var startValue = value.slice(0, idx);
@@ -111,39 +97,34 @@ var highlightKeyword = function highlightKeyword(value, keywords) {
111
97
  }
112
98
  }, highlightValue), endValue);
113
99
  };
114
-
115
100
  var ComplexSearch = function ComplexSearch(props) {
116
101
  var _props$options = props.options,
117
- options = _props$options === void 0 ? [] : _props$options,
118
- fuzzy = props.fuzzy,
119
- defaultDataIndex = props.defaultDataIndex,
120
- defaultSelectedDataIndex = props.defaultSelectedDataIndex,
121
- placeholder = props.placeholder,
122
- onSearch = props.onSearch,
123
- onSuggest = props.onSuggest,
124
- _props$suggestions = props.suggestions,
125
- suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
126
- _props$prefix = props.prefix,
127
- prefix = _props$prefix === void 0 ? 'next-' : _props$prefix;
128
-
102
+ options = _props$options === void 0 ? [] : _props$options,
103
+ fuzzy = props.fuzzy,
104
+ defaultDataIndex = props.defaultDataIndex,
105
+ defaultSelectedDataIndex = props.defaultSelectedDataIndex,
106
+ placeholder = props.placeholder,
107
+ onSearch = props.onSearch,
108
+ onSuggest = props.onSuggest,
109
+ _props$suggestions = props.suggestions,
110
+ suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
111
+ _props$prefix = props.prefix,
112
+ prefix = _props$prefix === void 0 ? 'next-' : _props$prefix;
129
113
  var _useState = useState(options.find(function (o) {
130
- return o.dataIndex === defaultSelectedDataIndex;
131
- })),
132
- _useState2 = _slicedToArray(_useState, 2),
133
- selectedFilterType = _useState2[0],
134
- setSelectedFilterType = _useState2[1];
135
-
114
+ return o.dataIndex === defaultSelectedDataIndex;
115
+ })),
116
+ _useState2 = _slicedToArray(_useState, 2),
117
+ selectedFilterType = _useState2[0],
118
+ setSelectedFilterType = _useState2[1];
136
119
  var _useState3 = useState(false),
137
- _useState4 = _slicedToArray(_useState3, 2),
138
- focused = _useState4[0],
139
- setFocused = _useState4[1];
140
-
120
+ _useState4 = _slicedToArray(_useState3, 2),
121
+ focused = _useState4[0],
122
+ setFocused = _useState4[1];
141
123
  var autoRef = useRef(null);
142
- var fuzzyAutoRef = useRef(null);
143
124
  var field = Field.useField();
144
125
  var init = field.init,
145
- getValue = field.getValue,
146
- reset = field.reset;
126
+ getValue = field.getValue,
127
+ reset = field.reset;
147
128
  var focusProps = {
148
129
  onFocus: function onFocus() {
149
130
  setFocused(true);
@@ -151,29 +132,26 @@ var ComplexSearch = function ComplexSearch(props) {
151
132
  onBlur: function onBlur() {
152
133
  setFocused(false);
153
134
  }
154
- }; // 计算视图,根据内部状态和输入的 props 决定一些值
135
+ };
155
136
 
137
+ // 计算视图,根据内部状态和输入的 props 决定一些值
156
138
  var isFuzzy = (!!defaultDataIndex || fuzzy) && !!getValue(SEARCH_FILTER_FIELD);
157
139
  var defaultFilter = options.find(function (t) {
158
140
  return t.dataIndex === defaultDataIndex;
159
141
  });
160
-
161
142
  var highlightItem = function highlightItem(item, searchKey) {
162
143
  var label = item.label;
163
-
164
144
  if (searchKey && searchKey.length) {
165
145
  label = highlightKeyword(item.label, searchKey);
166
146
  }
167
-
168
147
  return /*#__PURE__*/React.createElement("span", {
169
148
  "data-value": item === null || item === void 0 ? void 0 : item.value
170
149
  }, label);
171
150
  };
151
+
172
152
  /**
173
153
  * 处理筛选类型选中的情况
174
154
  */
175
-
176
-
177
155
  var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
178
156
  var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
179
157
  setSelectedFilterType(options.find(function (o) {
@@ -181,67 +159,58 @@ var ComplexSearch = function ComplexSearch(props) {
181
159
  }));
182
160
  resetValue && reset();
183
161
  };
162
+
184
163
  /**
185
164
  * 处理当筛选类型没选中,用户输入筛选类型,或者是做默认搜索的情况
186
165
  */
187
-
188
-
189
166
  var handlerFilterTypeInput = function handlerFilterTypeInput(value, actionType, isFuzzy, option) {
190
- var isFuzzySearch = isFuzzy && getValue(SEARCH_FILTER_FIELD); // 如果是模糊搜索,则直接处理
167
+ var isFuzzySearch = isFuzzy && getValue(SEARCH_FILTER_FIELD);
191
168
 
169
+ // 如果是模糊搜索,则直接处理
192
170
  if (isFuzzySearch) {
193
171
  if (actionType !== 'change') {
194
172
  handleSearch(option.dataIndex);
195
173
  } else {
196
174
  onSuggest && onSuggest(value, defaultDataIndex || '');
197
175
  }
198
-
199
176
  return;
200
- } // 否则处理筛选项改变的情况
201
-
177
+ }
202
178
 
179
+ // 否则处理筛选项改变的情况
203
180
  handlerFilterTypeChange(value, false);
204
181
  };
205
-
206
182
  var handlerFilterClear = function handlerFilterClear() {
207
183
  setSelectedFilterType(null);
208
184
  reset();
209
185
  };
210
-
211
186
  var handleSearch = function handleSearch(dataIndex) {
212
187
  if (onSearch) {
213
- var value = getValue(SEARCH_FILTER_VALUE_FIELD); // 如果是没有选择下拉
214
-
188
+ var value = getValue(SEARCH_FILTER_VALUE_FIELD);
189
+ // 如果是没有选择下拉
215
190
  if (defaultDataIndex && !selectedFilterType) {
216
191
  onSearch(getValue(SEARCH_FILTER_FIELD), defaultDataIndex, normalizeSearchOptions(defaultDataIndex, getValue(SEARCH_FILTER_FIELD), options));
217
- } // 如果是用户没有指定 defaultDataIndex 但是设置了 fuzzy
218
-
219
-
192
+ }
193
+ // 如果是用户没有指定 defaultDataIndex 但是设置了 fuzzy
220
194
  if (fuzzy && !selectedFilterType) {
221
195
  onSearch(getValue(SEARCH_FILTER_FIELD), dataIndex || '', normalizeSearchOptions(dataIndex || '', getValue(SEARCH_FILTER_FIELD), options));
222
196
  }
223
-
224
197
  if (selectedFilterType) {
225
198
  onSearch(value, selectedFilterType.dataIndex, normalizeSearchOptions(selectedFilterType.dataIndex, value, options));
226
199
  }
227
200
  }
228
-
229
201
  reset();
230
202
  document.body.click();
231
203
  setFocused(false);
232
204
  };
233
-
234
205
  var handleKeyUp = function handleKeyUp(e) {
235
206
  if (e.keyCode === 13 && e.currentTarget.value) {
236
207
  handleSearch();
237
208
  document.body.click();
238
209
  }
239
-
240
210
  if (e.keyCode === 8 && !e.currentTarget.value) {
241
211
  handlerFilterClear();
242
212
  }
243
213
  };
244
-
245
214
  var renderMultipleSelectorItem = function renderMultipleSelectorItem(item) {
246
215
  var searchValue = getValue(SEARCH_FILTER_VALUE_FIELD);
247
216
  var checked = isArray(searchValue) && searchValue.some(function (v) {
@@ -251,13 +220,10 @@ var ComplexSearch = function ComplexSearch(props) {
251
220
  checked: checked
252
221
  }, item.label);
253
222
  };
254
-
255
223
  var renderSelectedFilter = function renderSelectedFilter() {
256
224
  var _selectedFilterType$t, _selectedFilterType$t2, _selectedFilterType$t3;
257
-
258
225
  var type = selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.template;
259
226
  var searchValue = getValue(SEARCH_FILTER_VALUE_FIELD);
260
-
261
227
  var props = _objectSpread({
262
228
  hasBorder: false,
263
229
  autoFocus: true,
@@ -267,7 +233,6 @@ var ComplexSearch = function ComplexSearch(props) {
267
233
  value: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label
268
234
  })
269
235
  }, focusProps);
270
-
271
236
  var selectProps = {
272
237
  dataSource: normalizeSelectDataSource(selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label, (selectedFilterType === null || selectedFilterType === void 0 ? void 0 : (_selectedFilterType$t2 = selectedFilterType.templateProps) === null || _selectedFilterType$t2 === void 0 ? void 0 : _selectedFilterType$t2.dataSource) || []),
273
238
  defaultVisible: true,
@@ -275,11 +240,11 @@ var ComplexSearch = function ComplexSearch(props) {
275
240
  width: 'auto'
276
241
  }
277
242
  };
278
-
279
243
  switch (type) {
280
244
  case 'input':
281
245
  return /*#__PURE__*/React.createElement(AutoComplete, _extends({}, init(SEARCH_FILTER_VALUE_FIELD, {}), {
282
- className: classNames('main-input', 'multi') // @ts-ignore
246
+ className: classNames('main-input', 'multi')
247
+ // @ts-ignore
283
248
  ,
284
249
  autoHighlightFirstItem: false
285
250
  }, props, {
@@ -287,7 +252,6 @@ var ComplexSearch = function ComplexSearch(props) {
287
252
  onKeyUp: handleKeyUp,
288
253
  dataSource: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : (_selectedFilterType$t3 = selectedFilterType.templateProps) === null || _selectedFilterType$t3 === void 0 ? void 0 : _selectedFilterType$t3.dataSource
289
254
  }));
290
-
291
255
  case 'select':
292
256
  return /*#__PURE__*/React.createElement(Select, _extends({
293
257
  className: classNames('main-input', 'select')
@@ -299,14 +263,14 @@ var ComplexSearch = function ComplexSearch(props) {
299
263
  // @ts-ignore
300
264
  autoHighlightFirstItem: false
301
265
  }, props, selectProps));
302
-
303
266
  case 'multiple':
304
267
  return /*#__PURE__*/React.createElement(Select, _extends({
305
268
  className: classNames('main-input', 'multi')
306
269
  }, init(SEARCH_FILTER_VALUE_FIELD, {}), props, selectProps, {
307
270
  itemRender: renderMultipleSelectorItem,
308
271
  popupClassName: "xconsole-rcsearch-multi-pop",
309
- mode: "multiple" // @ts-ignore
272
+ mode: "multiple"
273
+ // @ts-ignore
310
274
  ,
311
275
  autoHighlightFirstItem: false,
312
276
  maxTagCount: 0,
@@ -332,12 +296,10 @@ var ComplexSearch = function ComplexSearch(props) {
332
296
  }, message.cancel))
333
297
  }
334
298
  }));
335
-
336
299
  default:
337
300
  return null;
338
301
  }
339
302
  };
340
-
341
303
  var renderSelectFilterCloseIcon = function renderSelectFilterCloseIcon() {
342
304
  var hasFilterTypeClearBtn = !!selectedFilterType && !((selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.template) === 'input' && !!getValue(SEARCH_FILTER_VALUE_FIELD));
343
305
  return hasFilterTypeClearBtn && /*#__PURE__*/React.createElement("div", {
@@ -354,7 +316,6 @@ var ComplexSearch = function ComplexSearch(props) {
354
316
  }
355
317
  }))));
356
318
  };
357
-
358
319
  return /*#__PURE__*/React.createElement(SearchWarp, {
359
320
  prefix: prefix
360
321
  }, /*#__PURE__*/React.createElement("div", {
@@ -380,7 +341,8 @@ var ComplexSearch = function ComplexSearch(props) {
380
341
  }
381
342
  }
382
343
  }), {
383
- autoHighlightFirstItem: false // @ts-ignore
344
+ autoHighlightFirstItem: false
345
+ // @ts-ignore
384
346
  ,
385
347
  itemRender: highlightItem,
386
348
  placeholder: placeholder || (defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ? template(message.defaultPlaceHolder)({
@@ -389,7 +351,8 @@ var ComplexSearch = function ComplexSearch(props) {
389
351
  className: classNames('main-input', 'multi'),
390
352
  hasBorder: false,
391
353
  onKeyUp: handleKeyUp,
392
- dataSource: // 如果是指定了默认的筛选类型或者是直接指定模糊搜索模式 ,并且用户在这个输入框里面已经输入了值
354
+ dataSource:
355
+ // 如果是指定了默认的筛选类型或者是直接指定模糊搜索模式 ,并且用户在这个输入框里面已经输入了值
393
356
  // 则表示需要模糊搜索,调用 handleSuggest
394
357
  isFuzzy ? normalizeSuggestion(suggestions) : normalizeOptions(options),
395
358
  popupStyle: {
@@ -410,5 +373,4 @@ var ComplexSearch = function ComplexSearch(props) {
410
373
  type: "search"
411
374
  }))));
412
375
  };
413
-
414
376
  export default ConfigProvider.config(ComplexSearch);
package/es/constants.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export var baseClassName = 'rc-search';
2
- export var baseTagListClassName = "".concat(baseClassName, "-taglist"); // export const titleClassName = `${baseClassName}-title`
2
+ export var baseTagListClassName = "".concat(baseClassName, "-taglist");
3
+
4
+ // export const titleClassName = `${baseClassName}-title`
3
5
  // export const titleContainerClassName = `${titleClassName}-container`
4
6
  // export const titleExtraClassName = `${titleClassName}-extra`
5
7
  // export const titleChildrenClassName = `${titleClassName}-children`
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Search } from "./search";
2
- import SearchTagList from "./searchTagList";
3
- import { IRcSearchProps } from "./types/IRcSearchProps.type";
4
- import { IRcSearchTagListProps } from "./types/IRcSearchTagListProps.type";
1
+ import { Search } from './search';
2
+ import SearchTagList from './searchTagList';
3
+ import { IRcSearchProps } from './types/IRcSearchProps.type';
4
+ import { IRcSearchTagListProps } from './types/IRcSearchTagListProps.type';
5
5
  import { IRcSearchTagItemProps } from './types/IRcSearchTagItemProps.type';
6
6
  import { IRcSearchOptionsProps } from './types/IRcSearchOptions.type';
7
7
  export { Search, SearchTagList as SearchFilter, IRcSearchProps, IRcSearchTagListProps, IRcSearchOptionsProps, IRcSearchTagItemProps };
package/es/message.js CHANGED
@@ -1,52 +1,51 @@
1
1
  import Cookie from 'js-cookie';
2
2
  var isSSR = typeof document === 'undefined';
3
3
  var messages = {
4
- 'zh': {
4
+ zh: {
5
5
  confirm: '确定',
6
6
  cancel: '取消',
7
7
  allValue: '全部值',
8
8
  emptyValue: '空值',
9
- tag: "标签",
10
- defaultFilterGroupName: "选择筛选条件",
9
+ tag: '标签',
10
+ defaultFilterGroupName: '选择筛选条件',
11
11
  defaultPlaceHolder: '默认按${value}搜索',
12
12
  clearFilter: '清除筛选条件'
13
13
  },
14
- 'en': {
14
+ en: {
15
15
  confirm: 'OK',
16
16
  cancel: 'Cancel',
17
17
  allValue: 'All Values',
18
18
  emptyValue: 'Empty',
19
- tag: "Tag",
20
- defaultFilterGroupName: "Select Filter Condition",
19
+ tag: 'Tag',
20
+ defaultFilterGroupName: 'Select Filter Condition',
21
21
  defaultPlaceHolder: 'Search By ${value}',
22
22
  clearFilter: 'Clear Filter Condition'
23
23
  },
24
- "zh-TW": {
24
+ 'zh-TW': {
25
25
  confirm: '確定',
26
26
  cancel: '取消',
27
27
  allValue: '全部值',
28
28
  emptyValue: '空值',
29
- tag: "標籤",
30
- defaultFilterGroupName: "選擇篩選條件",
29
+ tag: '標籤',
30
+ defaultFilterGroupName: '選擇篩選條件',
31
31
  defaultPlaceHolder: '默認按${value}搜索',
32
32
  clearFilter: '清除篩選條件'
33
33
  },
34
- 'ja': {
34
+ ja: {
35
35
  confirm: 'OK',
36
36
  cancel: 'キャンセル',
37
37
  allValue: 'すべての値',
38
38
  emptyValue: '空',
39
- tag: "タグ",
40
- defaultFilterGroupName: "フィルタリング条件の選択",
39
+ tag: 'タグ',
40
+ defaultFilterGroupName: 'フィルタリング条件の選択',
41
41
  defaultPlaceHolder: '${value} で検索',
42
42
  clearFilter: 'フィルタリング条件のクリア'
43
43
  }
44
44
  };
45
- var lang = isSSR ? 'en' : Cookie.get('aliyun_lang') || 'en';
46
-
45
+ var lang = isSSR ? 'zh' : Cookie.get('aliyun_lang') || 'zh';
47
46
  if (!Object.keys(messages).includes(lang)) {
48
- lang = 'en';
49
- } // @ts-ignore
50
-
47
+ lang = 'zh';
48
+ }
51
49
 
50
+ // @ts-ignore
52
51
  export default messages[lang];
package/es/search.js CHANGED
@@ -1,26 +1,19 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
-
3
- var _templateObject;
4
-
5
- import React from "react";
1
+ import React from 'react';
6
2
  import classNames from 'classnames';
7
- import styled from "styled-components";
3
+ import styled from 'styled-components';
8
4
  import { baseClassName } from './constants';
9
- import ComplexSearch from "./ComplexSearch/index";
10
- import LoggerProvider from './provider/LoggerProvider';
11
- import { useWindTheme } from "./useCssVar";
12
- var SearchWrap = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 32px;\n width: 400px;\n display: inline-block;\n vertical-align: top;\n"])));
5
+ import ComplexSearch from './ComplexSearch/index';
6
+ import { useWindTheme } from './useCssVar';
7
+ var SearchWrap = styled.div.withConfig({
8
+ componentId: "sc-1szhzw4-0"
9
+ })(["height:32px;width:400px;display:inline-block;vertical-align:top;"]);
13
10
  export var Search = function Search(props) {
14
11
  var className = props.className,
15
- _props$simple = props.simple,
16
- simple = _props$simple === void 0 ? false : _props$simple,
17
- style = props.style;
12
+ _props$simple = props.simple,
13
+ simple = _props$simple === void 0 ? false : _props$simple,
14
+ style = props.style;
18
15
  var windThemeClass = useWindTheme();
19
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoggerProvider, {
20
- regionId: props.regionId,
21
- resourceType: props.resourceType || '',
22
- componentName: "RcSearch"
23
- }), /*#__PURE__*/React.createElement(SearchWrap, {
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchWrap, {
24
17
  className: classNames(baseClassName, className, windThemeClass),
25
18
  style: style
26
19
  }, /*#__PURE__*/React.createElement(ComplexSearch, props)));
@@ -1,26 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["intl", "tagKey", "disableTruncate", "showDot", "tagValue", "showLabel", "closable"];
3
4
  import React from 'react';
4
5
  import { Tag, Badge } from '@alicloud/console-components';
5
6
  import Truncate from '@alicloud/console-components-truncate';
6
7
  import message from '../message';
7
-
8
8
  var Empty = function Empty(_ref) {
9
9
  var children = _ref.children;
10
10
  return /*#__PURE__*/React.createElement(React.Fragment, null, children);
11
11
  };
12
-
13
12
  var PureTag = function PureTag(props) {
14
13
  var intl = props.intl,
15
- tagKey = props.tagKey,
16
- disableTruncate = props.disableTruncate,
17
- showDot = props.showDot,
18
- tagValue = props.tagValue,
19
- showLabel = props.showLabel,
20
- _props$closable = props.closable,
21
- closable = _props$closable === void 0 ? true : _props$closable,
22
- resetProps = _objectWithoutProperties(props, ["intl", "tagKey", "disableTruncate", "showDot", "tagValue", "showLabel", "closable"]);
23
-
14
+ tagKey = props.tagKey,
15
+ disableTruncate = props.disableTruncate,
16
+ showDot = props.showDot,
17
+ tagValue = props.tagValue,
18
+ showLabel = props.showLabel,
19
+ _props$closable = props.closable,
20
+ closable = _props$closable === void 0 ? true : _props$closable,
21
+ resetProps = _objectWithoutProperties(props, _excluded);
24
22
  var defaultTruncateProps = {
25
23
  threshold: 20,
26
24
  showTooltip: false
@@ -29,16 +27,14 @@ var PureTag = function PureTag(props) {
29
27
  var DotWrapper = showDot ? Badge : Empty;
30
28
  var TagWrapper = closable ? Tag.Closeable : Tag;
31
29
  var transformedTagValue = tagValue;
32
-
33
30
  if (tagValue === '') {
34
31
  transformedTagValue = message.emptyValue;
35
32
  } else if (tagValue === undefined || tagValue === null) {
36
33
  transformedTagValue = message.allValue;
37
34
  }
38
-
39
35
  return (
40
36
  /*#__PURE__*/
41
- //@ts-ignore
37
+ // @ts-ignore
42
38
  React.createElement(DotWrapper, {
43
39
  className: "search-tags-tag-dot",
44
40
  dot: true
@@ -52,5 +48,4 @@ var PureTag = function PureTag(props) {
52
48
  }, transformedTagValue)))
53
49
  );
54
50
  };
55
-
56
51
  export default PureTag;