@alicloud/console-components-search 0.2.4 → 0.2.7

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.
@@ -1,13 +1,13 @@
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 11.42s
4
+ ✔ Webpack: Compiled successfully in 12.98s
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:
8
- main.js (2.49 MiB),entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
8
+ main.js (2.51 MiB),entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
9
9
  Entrypoints:
10
- main (2.49 MiB)
10
+ main (2.51 MiB)
11
11
  main.css
12
12
  main.js
13
13
  ,webpack performance recommendations:
@@ -22,6 +22,13 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
22
22
  className: classNames('condition-select'),
23
23
  hasBorder: false,
24
24
  dataSource: dataSource,
25
+ itemRender: function itemRender(_ref) {
26
+ var label = _ref.label,
27
+ value = _ref.value;
28
+ return /*#__PURE__*/React.createElement("span", {
29
+ "data-value": value
30
+ }, label);
31
+ },
25
32
  autoWidth: true
26
33
  }, reset)));
27
34
  };
@@ -306,7 +306,7 @@ var ComplexSearch = function ComplexSearch(props) {
306
306
  }, /*#__PURE__*/React.createElement("span", {
307
307
  className: "".concat(prefix, "input-hint-wrap")
308
308
  }, /*#__PURE__*/React.createElement("i", {
309
- className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "medium ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
309
+ className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
310
310
  role: "button",
311
311
  "aria-label": "\u6E05\u9664",
312
312
  onClick: function onClick() {
package/es/search.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import ComplexSearch from "./modeSingleSingle/index2";
3
2
  import classNames from 'classnames';
4
3
  import styled from "styled-components";
5
4
  import { baseClassName } from './constants';
5
+ import ComplexSearch from "./ComplexSearch/index";
6
6
  import LoggerProvider from './provider/LoggerProvider';
7
7
  var SearchWrap = styled.div.withConfig({
8
8
  componentId: "sc-1szhzw4-0"
@@ -19,7 +19,7 @@ var TagGroup = Tag.Group,
19
19
  */
20
20
 
21
21
  var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
22
- var isTag = !!value.tagKey;
22
+ var isTag = !!(value !== null && value !== void 0 && value.tagKey);
23
23
 
24
24
  if (isArray(value)) {
25
25
  return value[0] && !!value[0].tagKey;
@@ -63,9 +63,14 @@ var SearchTagList = function SearchTagList(props) {
63
63
  return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
64
64
  });
65
65
  var deletedTags = item.value.splice(resFindIndex, 1);
66
- onChange(_objectSpread(_objectSpread({}, item), {}, {
67
- value: deletedTags
68
- }), newDataSource);
66
+
67
+ if (item.value.length === 0) {
68
+ onRemoveFilter(item);
69
+ } else {
70
+ onChange(_objectSpread(_objectSpread({}, item), {}, {
71
+ value: deletedTags
72
+ }), newDataSource);
73
+ }
69
74
  }
70
75
  };
71
76
 
@@ -76,9 +81,9 @@ var SearchTagList = function SearchTagList(props) {
76
81
  return value.map(function (t) {
77
82
  return /*#__PURE__*/React.createElement(PureTag, {
78
83
  showLabel: true,
79
- key: "".concat(t.tagKey, "-").concat(t.tagValue),
80
- tagKey: t.tagKey,
81
- tagValue: t.tagValue,
84
+ key: "".concat(t === null || t === void 0 ? void 0 : t.tagKey, "-").concat(t === null || t === void 0 ? void 0 : t.tagValue),
85
+ tagKey: t === null || t === void 0 ? void 0 : t.tagKey,
86
+ tagValue: t === null || t === void 0 ? void 0 : t.tagValue,
82
87
  closable: true,
83
88
  onClose: function onClose() {
84
89
  onRemoveTag(tagItem, t);
@@ -90,8 +95,8 @@ var SearchTagList = function SearchTagList(props) {
90
95
 
91
96
  return /*#__PURE__*/React.createElement(PureTag, {
92
97
  showLabel: true,
93
- tagKey: value.tagKey,
94
- tagValue: value.tagValue,
98
+ tagKey: value === null || value === void 0 ? void 0 : value.tagKey,
99
+ tagValue: value === null || value === void 0 ? void 0 : value.tagValue,
95
100
  closable: true,
96
101
  onClose: function onClose() {
97
102
  onRemoveFilter(tagItem);
@@ -100,11 +105,16 @@ var SearchTagList = function SearchTagList(props) {
100
105
  });
101
106
  };
102
107
 
108
+ var processDataSource = dataSource && dataSource.filter(function (t) {
109
+ var _t$value;
110
+
111
+ return !isArray(t === null || t === void 0 ? void 0 : t.value) || (t === null || t === void 0 ? void 0 : (_t$value = t.value) === null || _t$value === void 0 ? void 0 : _t$value.length);
112
+ }) || [];
103
113
  return /*#__PURE__*/React.createElement(TagListWrap, {
104
114
  prefix: prefix,
105
115
  className: classNames(baseTagListClassName, className),
106
116
  style: style
107
- }, /*#__PURE__*/React.createElement(TagGroup, null, dataSource && dataSource.length > 0 && dataSource.map(function (tagItem) {
117
+ }, /*#__PURE__*/React.createElement(TagGroup, null, processDataSource.map(function (tagItem) {
108
118
  if (isTagLikeDataStructure(tagItem.value)) {
109
119
  return renderTags(tagItem);
110
120
  }
@@ -121,7 +131,7 @@ var SearchTagList = function SearchTagList(props) {
121
131
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", {
122
132
  className: "console-tags-tag-label"
123
133
  }, tagItem.label), tagItem.valueLabel || tagItem.value));
124
- }), dataSource && dataSource.length > 0 && /*#__PURE__*/React.createElement("a", {
134
+ }), processDataSource.length > 0 && /*#__PURE__*/React.createElement("a", {
125
135
  className: "remove-btn",
126
136
  onClick: onRemoveAllFilter
127
137
  }, "\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;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);
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:var(--corner-1,2px);border-top-left-radius:var(--corner-1,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:var(--corner-1,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);
@@ -35,6 +35,13 @@ var SearchConditionSelectPrefix = function SearchConditionSelectPrefix(props) {
35
35
  className: (0, _classnames.default)('condition-select'),
36
36
  hasBorder: false,
37
37
  dataSource: dataSource,
38
+ itemRender: function itemRender(_ref) {
39
+ var label = _ref.label,
40
+ value = _ref.value;
41
+ return /*#__PURE__*/_react.default.createElement("span", {
42
+ "data-value": value
43
+ }, label);
44
+ },
38
45
  autoWidth: true
39
46
  }, reset)));
40
47
  };
@@ -335,7 +335,7 @@ var ComplexSearch = function ComplexSearch(props) {
335
335
  }, /*#__PURE__*/_react.default.createElement("span", {
336
336
  className: "".concat(prefix, "input-hint-wrap")
337
337
  }, /*#__PURE__*/_react.default.createElement("i", {
338
- className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "medium ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
338
+ className: "".concat(prefix, "icon ").concat(prefix, "icon-delete-filling ").concat(prefix, "input-hint ").concat(prefix, "input-clear-icon"),
339
339
  role: "button",
340
340
  "aria-label": "\u6E05\u9664",
341
341
  onClick: function onClick() {
package/lib/search.js CHANGED
@@ -9,14 +9,14 @@ exports.Search = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _index = _interopRequireDefault(require("./modeSingleSingle/index2"));
13
-
14
12
  var _classnames = _interopRequireDefault(require("classnames"));
15
13
 
16
14
  var _styledComponents = _interopRequireDefault(require("styled-components"));
17
15
 
18
16
  var _constants = require("./constants");
19
17
 
18
+ var _index = _interopRequireDefault(require("./ComplexSearch/index"));
19
+
20
20
  var _LoggerProvider = _interopRequireDefault(require("./provider/LoggerProvider"));
21
21
 
22
22
  var SearchWrap = _styledComponents.default.div.withConfig({
@@ -36,7 +36,7 @@ var TagGroup = _consoleComponents.Tag.Group,
36
36
  */
37
37
 
38
38
  var isTagLikeDataStructure = function isTagLikeDataStructure(value) {
39
- var isTag = !!value.tagKey;
39
+ var isTag = !!(value !== null && value !== void 0 && value.tagKey);
40
40
 
41
41
  if ((0, _isArray.default)(value)) {
42
42
  return value[0] && !!value[0].tagKey;
@@ -80,9 +80,14 @@ var SearchTagList = function SearchTagList(props) {
80
80
  return x.tagKey === tag.tagKey && x.tagValue === tag.tagValue;
81
81
  });
82
82
  var deletedTags = item.value.splice(resFindIndex, 1);
83
- onChange(_objectSpread(_objectSpread({}, item), {}, {
84
- value: deletedTags
85
- }), newDataSource);
83
+
84
+ if (item.value.length === 0) {
85
+ onRemoveFilter(item);
86
+ } else {
87
+ onChange(_objectSpread(_objectSpread({}, item), {}, {
88
+ value: deletedTags
89
+ }), newDataSource);
90
+ }
86
91
  }
87
92
  };
88
93
 
@@ -93,9 +98,9 @@ var SearchTagList = function SearchTagList(props) {
93
98
  return value.map(function (t) {
94
99
  return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
95
100
  showLabel: true,
96
- key: "".concat(t.tagKey, "-").concat(t.tagValue),
97
- tagKey: t.tagKey,
98
- tagValue: t.tagValue,
101
+ key: "".concat(t === null || t === void 0 ? void 0 : t.tagKey, "-").concat(t === null || t === void 0 ? void 0 : t.tagValue),
102
+ tagKey: t === null || t === void 0 ? void 0 : t.tagKey,
103
+ tagValue: t === null || t === void 0 ? void 0 : t.tagValue,
99
104
  closable: true,
100
105
  onClose: function onClose() {
101
106
  onRemoveTag(tagItem, t);
@@ -107,8 +112,8 @@ var SearchTagList = function SearchTagList(props) {
107
112
 
108
113
  return /*#__PURE__*/_react.default.createElement(_PureTag.default, {
109
114
  showLabel: true,
110
- tagKey: value.tagKey,
111
- tagValue: value.tagValue,
115
+ tagKey: value === null || value === void 0 ? void 0 : value.tagKey,
116
+ tagValue: value === null || value === void 0 ? void 0 : value.tagValue,
112
117
  closable: true,
113
118
  onClose: function onClose() {
114
119
  onRemoveFilter(tagItem);
@@ -117,11 +122,16 @@ var SearchTagList = function SearchTagList(props) {
117
122
  });
118
123
  };
119
124
 
125
+ var processDataSource = dataSource && dataSource.filter(function (t) {
126
+ var _t$value;
127
+
128
+ return !(0, _isArray.default)(t === null || t === void 0 ? void 0 : t.value) || (t === null || t === void 0 ? void 0 : (_t$value = t.value) === null || _t$value === void 0 ? void 0 : _t$value.length);
129
+ }) || [];
120
130
  return /*#__PURE__*/_react.default.createElement(_style.TagListWrap, {
121
131
  prefix: prefix,
122
132
  className: (0, _classnames.default)(_constants.baseTagListClassName, className),
123
133
  style: style
124
- }, /*#__PURE__*/_react.default.createElement(TagGroup, null, dataSource && dataSource.length > 0 && dataSource.map(function (tagItem) {
134
+ }, /*#__PURE__*/_react.default.createElement(TagGroup, null, processDataSource.map(function (tagItem) {
125
135
  if (isTagLikeDataStructure(tagItem.value)) {
126
136
  return renderTags(tagItem);
127
137
  }
@@ -138,7 +148,7 @@ var SearchTagList = function SearchTagList(props) {
138
148
  }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("label", {
139
149
  className: "console-tags-tag-label"
140
150
  }, tagItem.label), tagItem.valueLabel || tagItem.value));
141
- }), dataSource && dataSource.length > 0 && /*#__PURE__*/_react.default.createElement("a", {
151
+ }), processDataSource.length > 0 && /*#__PURE__*/_react.default.createElement("a", {
142
152
  className: "remove-btn",
143
153
  onClick: onRemoveAllFilter
144
154
  }, "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6")));
package/lib/style.js CHANGED
@@ -15,7 +15,7 @@ var prefix = function prefix(props) {
15
15
 
16
16
  var SearchWarp = _styledComponents.default.div.withConfig({
17
17
  componentId: "sc-1afc1cn-0"
18
- })(["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);
18
+ })(["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:var(--corner-1,2px);border-top-left-radius:var(--corner-1,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:var(--corner-1,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);
19
19
 
20
20
  exports.SearchWarp = SearchWarp;
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-components-search",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "license": "MIT",