@alicloud/console-components-search 0.1.1 → 0.2.0

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 (64) hide show
  1. package/README.md +104 -138
  2. package/demos/demo1.demo.tsx +91 -94
  3. package/doc-dist/0.js +1917 -16
  4. package/doc-dist/1.js +16 -1917
  5. package/doc-dist/10.js +1 -1
  6. package/doc-dist/11.js +1 -1
  7. package/doc-dist/12.js +1 -1
  8. package/doc-dist/13.js +1 -1
  9. package/doc-dist/14.js +1 -1
  10. package/doc-dist/15.js +1 -1
  11. package/doc-dist/3.js +5 -5
  12. package/doc-dist/4.js +1 -1
  13. package/doc-dist/5.js +2 -2
  14. package/doc-dist/6.js +1 -1
  15. package/doc-dist/7.js +1 -1
  16. package/doc-dist/8.js +1 -1
  17. package/doc-dist/9.js +1 -1
  18. package/doc-dist/deps/main.css +1 -1
  19. package/doc-dist/deps/main.js +8 -8
  20. package/doc-dist/deps/main.os.css +1 -1
  21. package/doc-dist/index.js +3 -3
  22. package/doc-dist/log-deps-build.log +1 -1
  23. package/es/index.js +1 -1
  24. package/es/modeSingleSingle/InputPrefix.js +29 -0
  25. package/es/modeSingleSingle/index2.js +342 -0
  26. package/es/search.js +2 -3
  27. package/es/searchTagList/index.js +5 -10
  28. package/es/style.js +1 -1
  29. package/es/useCssVar.js +38 -0
  30. package/lib/index.d.ts +1 -1
  31. package/lib/index.js +1 -1
  32. package/lib/modeSingleSingle/InputPrefix.d.ts +2 -0
  33. package/lib/modeSingleSingle/InputPrefix.js +43 -0
  34. package/lib/modeSingleSingle/index2.d.ts +4 -0
  35. package/lib/modeSingleSingle/index2.js +372 -0
  36. package/lib/search.js +2 -4
  37. package/lib/searchTagList/index.d.ts +3 -1
  38. package/lib/searchTagList/index.js +5 -11
  39. package/lib/style.js +1 -1
  40. package/lib/types/IRcSearchOptions.type.d.ts +3 -2
  41. package/lib/types/IRcSearchProps.type.d.ts +24 -34
  42. package/lib/types/IRcSearchTagItemProps.type.d.ts +1 -1
  43. package/lib/types/IRcSearchTagListProps.type.d.ts +3 -3
  44. package/lib/useCssVar.d.ts +1 -0
  45. package/lib/useCssVar.js +52 -0
  46. package/package.json +3 -2
  47. package/demos/demo2.demo.tsx +0 -83
  48. package/demos/demo3.demo.tsx +0 -87
  49. package/demos/demo4.demo.tsx +0 -142
  50. package/dist/index.css +0 -1
  51. package/dist/index.js +0 -60
  52. package/doc-dist/16.js +0 -6
  53. package/doc-dist/17.js +0 -6
  54. package/doc-dist/18.js +0 -6
  55. package/doc-dist/19.js +0 -6
  56. package/doc-dist/20.js +0 -6
  57. package/docs/markdown-render.doc.md +0 -21
  58. package/docs/test.doc.md +0 -8
  59. package/es/modeSingleMulti/index.js +0 -825
  60. package/es/modeSingleSingle/index.js +0 -217
  61. package/lib/modeSingleMulti/index.d.ts +0 -2
  62. package/lib/modeSingleMulti/index.js +0 -850
  63. package/lib/modeSingleSingle/index.d.ts +0 -2
  64. package/lib/modeSingleSingle/index.js +0 -242
@@ -1,7 +1,7 @@
1
1
  开始构建微应用external依赖...
2
2
  BreezrPluginStyledComponentsIsolation The plugin will trying to use the package's name as isolation id of styled-components. This behavior usually occurred on dev mode. And if you were received this warning on publish mode then you should to set `options.styledComponentStyleSheetId` implicitly.
3
3
  ℹ Compiling Webpack
4
- ✔ Webpack: Compiled successfully in 10.35s
4
+ ✔ Webpack: Compiled successfully in 13.15s
5
5
  WARN asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
6
6
  This can impact web performance.
7
7
  Assets:
package/es/index.js CHANGED
@@ -4,4 +4,4 @@ import { IRcSearchProps } from "./types/IRcSearchProps.type";
4
4
  import { IRcSearchTagListProps } from "./types/IRcSearchTagListProps.type";
5
5
  import { IRcSearchTagItemProps } from './types/IRcSearchTagItemProps.type';
6
6
  import { IRcSearchOptionsProps } from './types/IRcSearchOptions.type';
7
- export { Search, SearchTagList, IRcSearchProps, IRcSearchTagListProps, IRcSearchOptionsProps, IRcSearchTagItemProps };
7
+ export { Search, SearchTagList as SearchFilter, IRcSearchProps, IRcSearchTagListProps, IRcSearchOptionsProps, IRcSearchTagItemProps };
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["dataSource", "label"];
4
+ import React from 'react';
5
+ import classNames from 'classnames';
6
+ import { Icon, Select } from '@alicloud/console-components';
7
+
8
+ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
9
+ var _props$dataSource = props.dataSource,
10
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
11
+ label = props.label,
12
+ reset = _objectWithoutProperties(props, _excluded);
13
+
14
+ return /*#__PURE__*/React.createElement("div", {
15
+ className: classNames('condition-item')
16
+ }, /*#__PURE__*/React.createElement("span", {
17
+ className: classNames('condition-item-txt')
18
+ }, label), /*#__PURE__*/React.createElement(Icon, {
19
+ type: "caret-down",
20
+ size: "xxs"
21
+ }), /*#__PURE__*/React.createElement(Select, _extends({
22
+ className: classNames('condition-select'),
23
+ hasBorder: false,
24
+ dataSource: dataSource,
25
+ autoWidth: true
26
+ }, reset)));
27
+ };
28
+
29
+ export default SearchConditionSelectPrefix;
@@ -0,0 +1,342 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
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); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
+
10
+ import classNames from 'classnames';
11
+ import cloneDeep from 'lodash/cloneDeep';
12
+ import groupBy from 'lodash/groupBy';
13
+ import isArray from 'lodash/isArray';
14
+ import React, { useState, useRef } from "react";
15
+ import { Button, Icon, Select, ConfigProvider, Field, Checkbox } from '@alicloud/console-components';
16
+ import { SearchWarp, MultiBtnWarp } from "../style";
17
+ import SearchConditionSelectPrefix from "./InputPrefix";
18
+ var AutoComplete = Select.AutoComplete;
19
+ /**
20
+ *
21
+ * @param IRcSearchOptionsProps options
22
+ * @returns
23
+ */
24
+
25
+ var normalizeOptions = function normalizeOptions(options) {
26
+ var optionsCopy = cloneDeep(options);
27
+ optionsCopy.forEach(function (o) {
28
+ var _o$groupName;
29
+
30
+ return (_o$groupName = o.groupName) !== null && _o$groupName !== void 0 ? _o$groupName : o.groupName = "选择筛选条件";
31
+ });
32
+ return Object.entries(groupBy(optionsCopy, 'groupName')).map(function (_ref) {
33
+ var _ref2 = _slicedToArray(_ref, 2),
34
+ groupName = _ref2[0],
35
+ children = _ref2[1];
36
+
37
+ return {
38
+ label: groupName,
39
+ children: children.map(function (l) {
40
+ return {
41
+ label: l.label,
42
+ value: l.dataIndex
43
+ };
44
+ })
45
+ };
46
+ });
47
+ };
48
+
49
+ var normalizeSelectDataSource = function normalizeSelectDataSource(title, list) {
50
+ return [{
51
+ label: title || '',
52
+ children: _toConsumableArray(list)
53
+ }];
54
+ };
55
+
56
+ var normalizeSearchOptions = function normalizeSearchOptions(dataIndex, value, options) {
57
+ var opt = options.find(function (o) {
58
+ return o.dataIndex === dataIndex;
59
+ });
60
+ var valueLabel = value;
61
+
62
+ if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'select') {
63
+ var _opt$templateProps;
64
+
65
+ valueLabel = (_opt$templateProps = opt.templateProps) === null || _opt$templateProps === void 0 ? void 0 : _opt$templateProps.dataSource.find(function (d) {
66
+ return d.value === value;
67
+ }).label;
68
+ }
69
+
70
+ if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'multiple') {
71
+ var _opt$templateProps2, _opt$templateProps3;
72
+
73
+ console.log((_opt$templateProps2 = opt.templateProps) === null || _opt$templateProps2 === void 0 ? void 0 : _opt$templateProps2.dataSource.filter(function (d) {
74
+ return value.indexOf(d.value) !== -1;
75
+ }));
76
+ valueLabel = (_opt$templateProps3 = opt.templateProps) === null || _opt$templateProps3 === void 0 ? void 0 : _opt$templateProps3.dataSource.filter(function (d) {
77
+ return value.indexOf(d.value) !== -1;
78
+ }).map(function (d) {
79
+ return d.label;
80
+ }).join('/');
81
+ }
82
+
83
+ return {
84
+ label: opt === null || opt === void 0 ? void 0 : opt.label,
85
+ valueLabel: valueLabel
86
+ };
87
+ };
88
+
89
+ var ComplexSearch = function ComplexSearch(props) {
90
+ var options = props.options,
91
+ fuzzy = props.fuzzy,
92
+ defaultDataIndex = props.defaultDataIndex,
93
+ placeholder = props.placeholder,
94
+ onSearch = props.onSearch,
95
+ onSuggest = props.onSuggest,
96
+ _props$suggestions = props.suggestions,
97
+ suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
98
+ _props$prefix = props.prefix,
99
+ prefix = _props$prefix === void 0 ? 'next-' : _props$prefix;
100
+
101
+ var _useState = useState(null),
102
+ _useState2 = _slicedToArray(_useState, 2),
103
+ selectedFilterType = _useState2[0],
104
+ setSelectedFilterType = _useState2[1];
105
+
106
+ var _useState3 = useState(false),
107
+ _useState4 = _slicedToArray(_useState3, 2),
108
+ focused = _useState4[0],
109
+ setFocused = _useState4[1];
110
+
111
+ var autoRef = useRef(null);
112
+ var field = Field.useField();
113
+ var init = field.init,
114
+ getValue = field.getValue,
115
+ reset = field.reset,
116
+ getError = field.getError;
117
+ var focusProps = {
118
+ onFocus: function onFocus() {
119
+ setFocused(true);
120
+ },
121
+ onBlur: function onBlur() {
122
+ setFocused(false);
123
+ }
124
+ }; //计算视图,根据内部状态和输入的 props 决定一些值
125
+
126
+ var isFuzzy = (!!defaultDataIndex || fuzzy) && !!getValue('filterInputValue');
127
+ var defaultFilter = options.find(function (t) {
128
+ return t.dataIndex === defaultDataIndex;
129
+ });
130
+ /**
131
+ * 处理筛选类型选中的情况
132
+ */
133
+
134
+ var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
135
+ var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
136
+ setSelectedFilterType(options.find(function (o) {
137
+ return o.dataIndex === type;
138
+ }));
139
+ resetValue && reset();
140
+ };
141
+ /**
142
+ * 处理当筛选类型没选中,用户输入筛选类型,或者是做默认搜索的情况
143
+ */
144
+
145
+
146
+ var handlerFilterTypeInput = function handlerFilterTypeInput(value, actionType, isFuzzy) {
147
+ var isFuzzySearch = isFuzzy && getValue('filterInputValue'); // 如果是模糊搜索,则直接处理
148
+
149
+ if (isFuzzySearch) {
150
+ if (actionType !== 'change') {
151
+ handleSearch();
152
+ } else {
153
+ onSuggest && onSuggest(value, defaultDataIndex || '');
154
+ }
155
+
156
+ return;
157
+ } // 否则处理筛选项改变的情况
158
+
159
+
160
+ handlerFilterTypeChange(value, false);
161
+ };
162
+
163
+ var handlerFilterClear = function handlerFilterClear() {
164
+ setSelectedFilterType(null);
165
+ reset();
166
+ };
167
+
168
+ var handleSearch = function handleSearch() {
169
+ if (onSearch) {
170
+ var value = getValue('searchValue');
171
+
172
+ if (defaultDataIndex && !selectedFilterType) {
173
+ onSearch(getValue('filterInputValue'), defaultDataIndex, normalizeSearchOptions(defaultDataIndex, getValue('filterInputValue'), options));
174
+ }
175
+
176
+ if (selectedFilterType) {
177
+ onSearch(value, selectedFilterType.dataIndex, normalizeSearchOptions(selectedFilterType.dataIndex, value, options));
178
+ }
179
+ }
180
+
181
+ reset();
182
+ setFocused(false);
183
+ };
184
+
185
+ var handleKeyUp = function handleKeyUp(e) {
186
+ if (e.keyCode === 13 && e.currentTarget.value) {
187
+ handleSearch();
188
+ document.body.click();
189
+ }
190
+ };
191
+
192
+ var renderMultipleSelectorItem = function renderMultipleSelectorItem(item) {
193
+ var searchValue = getValue('searchValue');
194
+ var checked = isArray(searchValue) && searchValue.some(function (v) {
195
+ return v === item.value;
196
+ });
197
+ return /*#__PURE__*/React.createElement(Checkbox, {
198
+ checked: checked
199
+ }, item.label);
200
+ };
201
+
202
+ var renderSelectedFilter = function renderSelectedFilter() {
203
+ var _selectedFilterType$t, _selectedFilterType$t2;
204
+
205
+ var type = selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.template;
206
+ var searchValue = getValue('searchValue');
207
+
208
+ var props = _objectSpread({
209
+ hasBorder: false,
210
+ autoFocus: true,
211
+ hasClear: true,
212
+ key: type,
213
+ placeholder: (selectedFilterType === null || selectedFilterType === void 0 ? void 0 : (_selectedFilterType$t = selectedFilterType.templateProps) === null || _selectedFilterType$t === void 0 ? void 0 : _selectedFilterType$t.placeholder) || "\u9ED8\u8BA4\u6309".concat(selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label, "\u641C\u7D22")
214
+ }, focusProps);
215
+
216
+ var selectProps = {
217
+ 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) || []),
218
+ defaultVisible: true,
219
+ popupStyle: {
220
+ width: 'auto'
221
+ }
222
+ };
223
+
224
+ switch (type) {
225
+ case 'input':
226
+ return /*#__PURE__*/React.createElement(AutoComplete, _extends({}, init('searchValue', {}), {
227
+ className: classNames('main-input', 'multi')
228
+ }, props, {
229
+ onKeyUp: handleKeyUp
230
+ }));
231
+
232
+ case 'select':
233
+ return /*#__PURE__*/React.createElement(Select, _extends({
234
+ className: classNames('main-input', 'select')
235
+ }, init('searchValue', {
236
+ props: {
237
+ onChange: handleSearch
238
+ }
239
+ }), props, selectProps));
240
+
241
+ case 'multiple':
242
+ return /*#__PURE__*/React.createElement(Select, _extends({
243
+ className: classNames('main-input', 'multi')
244
+ }, init('searchValue', {}), props, selectProps, {
245
+ itemRender: renderMultipleSelectorItem,
246
+ popupClassName: "xconsole-rcsearch-multi-pop",
247
+ mode: "multiple",
248
+ maxTagCount: 0,
249
+ menuProps: {
250
+ footer: /*#__PURE__*/React.createElement(MultiBtnWarp, {
251
+ prefix: prefix
252
+ }, /*#__PURE__*/React.createElement(Button, {
253
+ size: "small",
254
+ className: classNames("pri-btn"),
255
+ type: "primary",
256
+ disabled: !(searchValue !== null && searchValue !== void 0 && searchValue.length),
257
+ onClick: function onClick() {
258
+ handleSearch();
259
+ }
260
+ }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement(Button, {
261
+ size: "small",
262
+ className: classNames("cancel-btn"),
263
+ type: "normal",
264
+ onClick: function onClick() {
265
+ reset();
266
+ }
267
+ }, "\u53D6\u6D88"))
268
+ }
269
+ }));
270
+
271
+ default:
272
+ return null;
273
+ }
274
+ };
275
+
276
+ var renderSelectFilterCloseIcon = function renderSelectFilterCloseIcon() {
277
+ var hasFilterTypeClearBtn = !!selectedFilterType && !((selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.template) === 'input' && !!getValue('searchValue'));
278
+ return hasFilterTypeClearBtn && /*#__PURE__*/React.createElement("div", {
279
+ className: "clear-level1"
280
+ }, /*#__PURE__*/React.createElement("span", {
281
+ className: "".concat(prefix, "input-control")
282
+ }, /*#__PURE__*/React.createElement("span", {
283
+ className: "".concat(prefix, "input-hint-wrap")
284
+ }, /*#__PURE__*/React.createElement("i", {
285
+ className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "medium ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
286
+ role: "button",
287
+ "aria-label": "\u6E05\u9664",
288
+ onClick: function onClick() {
289
+ handlerFilterClear();
290
+ }
291
+ }))));
292
+ };
293
+
294
+ return /*#__PURE__*/React.createElement(SearchWarp, {
295
+ prefix: prefix
296
+ }, /*#__PURE__*/React.createElement("div", {
297
+ className: classNames('left-wrap', "".concat(prefix, "input"), {
298
+ 'focus': focused
299
+ })
300
+ }, /*#__PURE__*/React.createElement("div", {
301
+ className: classNames('condition')
302
+ }, selectedFilterType ? /*#__PURE__*/React.createElement(SearchConditionSelectPrefix, {
303
+ dataSource: normalizeOptions(options),
304
+ label: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.label,
305
+ defaultValue: selectedFilterType === null || selectedFilterType === void 0 ? void 0 : selectedFilterType.dataIndex,
306
+ onChange: function onChange(value) {
307
+ handlerFilterTypeChange(value);
308
+ }
309
+ }) : null), /*#__PURE__*/React.createElement("div", {
310
+ className: classNames('forms')
311
+ }, !selectedFilterType ? /*#__PURE__*/React.createElement(AutoComplete, _extends({}, init('filterInputValue', {
312
+ props: {
313
+ // @ts-ignore
314
+ onChange: function onChange(value, actionType) {
315
+ handlerFilterTypeInput(value, actionType, isFuzzy);
316
+ }
317
+ }
318
+ }), {
319
+ ref: autoRef,
320
+ placeholder: placeholder ? placeholder : defaultFilter !== null && defaultFilter !== void 0 && defaultFilter.label ? "\u9ED8\u8BA4\u6309".concat(defaultFilter === null || defaultFilter === void 0 ? void 0 : defaultFilter.label, "\u641C\u7D22") : '请搜索',
321
+ className: classNames('main-input', 'multi'),
322
+ hasBorder: false,
323
+ onKeyUp: handleKeyUp,
324
+ dataSource: // 如果是指定了默认的筛选类型或者是直接指定模糊搜索模式 ,并且用户在这个输入框里面已经输入了值
325
+ // 则表示需要模糊搜索,调用 handleSuggest
326
+ isFuzzy ? suggestions : normalizeOptions(options),
327
+ popupStyle: {
328
+ width: 'auto'
329
+ }
330
+ }, focusProps)) : null, renderSelectedFilter(), renderSelectFilterCloseIcon())), /*#__PURE__*/React.createElement("div", {
331
+ className: classNames('right-wrap')
332
+ }, /*#__PURE__*/React.createElement(Button, {
333
+ className: classNames('search-btn', {
334
+ 'focus': focused
335
+ }),
336
+ onClick: handleSearch
337
+ }, /*#__PURE__*/React.createElement(Icon, {
338
+ type: "search"
339
+ }))));
340
+ };
341
+
342
+ export default ConfigProvider.config(ComplexSearch);
package/es/search.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import ModeSingleSingle from "./modeSingleSingle";
3
- import ModeSingleMulti from "./modeSingleMulti";
2
+ import ComplexSearch from "./modeSingleSingle/index2";
4
3
  import classNames from 'classnames';
5
4
  import styled from "styled-components";
6
5
  import { baseClassName } from './constants';
@@ -20,5 +19,5 @@ export var Search = function Search(props) {
20
19
  }), /*#__PURE__*/React.createElement(SearchWrap, {
21
20
  className: classNames(baseClassName, className),
22
21
  style: style
23
- }, simple ? /*#__PURE__*/React.createElement(ModeSingleSingle, props) : /*#__PURE__*/React.createElement(ModeSingleMulti, props)));
22
+ }, /*#__PURE__*/React.createElement(ComplexSearch, props)));
24
23
  };
@@ -2,14 +2,13 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import React from "react";
3
3
  import classNames from 'classnames';
4
4
  import { ConfigProvider, Tag } from '@alicloud/console-components';
5
- import LoggerProvider from '../provider/LoggerProvider';
6
5
  import { TagListWrap } from '../style';
7
6
  import { baseTagListClassName } from '../constants';
8
7
  var TagGroup = Tag.Group,
9
8
  ClosableTag = Tag.Closeable;
10
9
 
11
10
  var SearchTagList = function SearchTagList(props) {
12
- var tagList = props.tagList,
11
+ var dataSource = props.dataSource,
13
12
  className = props.className,
14
13
  style = props.style,
15
14
  onChange = props.onChange,
@@ -17,7 +16,7 @@ var SearchTagList = function SearchTagList(props) {
17
16
  prefix = _props$prefix === void 0 ? "next-" : _props$prefix;
18
17
 
19
18
  function onRemoveTag(item) {
20
- var newTagList = _toConsumableArray(tagList);
19
+ var newTagList = _toConsumableArray(dataSource);
21
20
 
22
21
  if (onChange) {
23
22
  var resFindIndex = newTagList.findIndex(function (x) {
@@ -38,11 +37,7 @@ var SearchTagList = function SearchTagList(props) {
38
37
  prefix: prefix,
39
38
  className: classNames(baseTagListClassName, className),
40
39
  style: style
41
- }, /*#__PURE__*/React.createElement(LoggerProvider, {
42
- regionId: props.regionId,
43
- resourceType: props.resourceType || '',
44
- componentName: "RcSearch"
45
- }), /*#__PURE__*/React.createElement(TagGroup, null, tagList && tagList.length > 0 && tagList.map(function (tagItem) {
40
+ }, /*#__PURE__*/React.createElement(TagGroup, null, dataSource && dataSource.length > 0 && dataSource.map(function (tagItem) {
46
41
  return /*#__PURE__*/React.createElement(ClosableTag, {
47
42
  key: tagItem.dataIndex + tagItem.value,
48
43
  type: "normal",
@@ -51,8 +46,8 @@ var SearchTagList = function SearchTagList(props) {
51
46
  onRemoveTag(tagItem);
52
47
  return true;
53
48
  }
54
- }, tagItem.label, ":", tagItem.valueShow);
55
- }), tagList && tagList.length > 0 && /*#__PURE__*/React.createElement("a", {
49
+ }, tagItem.label, ":", tagItem.valueLabel);
50
+ }), dataSource && dataSource.length > 0 && /*#__PURE__*/React.createElement("a", {
56
51
  className: "remove-btn",
57
52
  onClick: onRemoveAllTag
58
53
  }, "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6")));
package/es/style.js CHANGED
@@ -6,7 +6,7 @@ var prefix = function prefix(props) {
6
6
 
7
7
  var SearchWarp = styled.div.withConfig({
8
8
  componentId: "sc-1afc1cn-0"
9
- })(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "-input{height:auto;box-shadow:none;}}", "-input", "-medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
9
+ })(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
10
10
  var MenuContentWrap = styled.ul.withConfig({
11
11
  componentId: "sc-1afc1cn-1"
12
12
  })(["", "tag-small", "tag-closable > ", "tag-close-btn{margin-left:8px;padding-right:4px;padding-top:1px;}", "tag-small", "tag-closable > ", "tag-body{max-width:calc(100% - 8px - 8px - var(--tag-size-m-padding-lr,8px));}", "tag-small", "tag-closable > ", "tag-close-btn ", "icon:before,", "tag-small", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{font-size:13px;}&& [class*='-icon-close']:hover::before{color:#181818;}&& [class*='-icon-close']::before{color:#808080;content:var(--icon-content-delete-filling);}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
@@ -0,0 +1,38 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useLayoutEffect, useState } from 'react';
3
+ import { ConfigProvider } from '@alicloud/console-components';
4
+ var nextId = 0;
5
+ export function useCssVar(cssVarName) {
6
+ var _useState = useState(''),
7
+ _useState2 = _slicedToArray(_useState, 2),
8
+ v = _useState2[0],
9
+ setV = _useState2[1];
10
+
11
+ var refElement = ConfigProvider.useRefElement();
12
+ useLayoutEffect(function () {
13
+ var _window$__recheck_css;
14
+
15
+ check(); // @ts-ignore
16
+
17
+ var checkArr = window['__recheck_css_var'] = (_window$__recheck_css = window['__recheck_css_var']) !== null && _window$__recheck_css !== void 0 ? _window$__recheck_css : [];
18
+
19
+ while (checkArr[nextId]) {
20
+ // 如果一个页面下有份此组件库(即有多个nextId指针),需要避免冲突
21
+ nextId++;
22
+ }
23
+
24
+ var id = nextId++;
25
+ checkArr[id] = check;
26
+ return function () {
27
+ delete checkArr[id];
28
+ };
29
+
30
+ function check() {
31
+ var _window$getComputedSt, _window$getComputedSt2, _window;
32
+
33
+ var val = (_window$getComputedSt = (_window$getComputedSt2 = (_window = window).getComputedStyle) === null || _window$getComputedSt2 === void 0 ? void 0 : _window$getComputedSt2.call(_window, refElement).getPropertyValue(cssVarName)) !== null && _window$getComputedSt !== void 0 ? _window$getComputedSt : '';
34
+ setV(val);
35
+ }
36
+ }, [refElement, cssVarName]);
37
+ return v;
38
+ }
package/lib/index.d.ts CHANGED
@@ -4,4 +4,4 @@ import { IRcSearchProps } from "./types/IRcSearchProps.type";
4
4
  import { IRcSearchTagListProps } from "./types/IRcSearchTagListProps.type";
5
5
  import { IRcSearchTagItemProps } from './types/IRcSearchTagItemProps.type';
6
6
  import { IRcSearchOptionsProps } from './types/IRcSearchOptions.type';
7
- export { Search, SearchTagList, IRcSearchProps, IRcSearchTagListProps, IRcSearchOptionsProps, IRcSearchTagItemProps };
7
+ export { Search, SearchTagList as SearchFilter, IRcSearchProps, IRcSearchTagListProps, IRcSearchOptionsProps, IRcSearchTagItemProps };
package/lib/index.js CHANGED
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "Search", {
35
35
  return _search.Search;
36
36
  }
37
37
  });
38
- Object.defineProperty(exports, "SearchTagList", {
38
+ Object.defineProperty(exports, "SearchFilter", {
39
39
  enumerable: true,
40
40
  get: function get() {
41
41
  return _searchTagList.default;
@@ -0,0 +1,2 @@
1
+ declare const SearchConditionSelectPrefix: (props: any) => JSX.Element;
2
+ export default SearchConditionSelectPrefix;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+
18
+ var _consoleComponents = require("@alicloud/console-components");
19
+
20
+ var _excluded = ["dataSource", "label"];
21
+
22
+ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
23
+ var _props$dataSource = props.dataSource,
24
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
25
+ label = props.label,
26
+ reset = (0, _objectWithoutProperties2.default)(props, _excluded);
27
+ return /*#__PURE__*/_react.default.createElement("div", {
28
+ className: (0, _classnames.default)('condition-item')
29
+ }, /*#__PURE__*/_react.default.createElement("span", {
30
+ className: (0, _classnames.default)('condition-item-txt')
31
+ }, label), /*#__PURE__*/_react.default.createElement(_consoleComponents.Icon, {
32
+ type: "caret-down",
33
+ size: "xxs"
34
+ }), /*#__PURE__*/_react.default.createElement(_consoleComponents.Select, (0, _extends2.default)({
35
+ className: (0, _classnames.default)('condition-select'),
36
+ hasBorder: false,
37
+ dataSource: dataSource,
38
+ autoWidth: true
39
+ }, reset)));
40
+ };
41
+
42
+ var _default = SearchConditionSelectPrefix;
43
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { IRcSearchProps } from "../types/IRcSearchProps.type";
3
+ declare const _default: React.FC<IRcSearchProps>;
4
+ export default _default;