@alicloud/console-components-search 0.2.5 → 0.2.8

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 12.59s
4
+ ✔ Webpack: Compiled successfully in 12.89s
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:
@@ -26,9 +26,7 @@ var AutoComplete = Select.AutoComplete;
26
26
  var normalizeOptions = function normalizeOptions(options) {
27
27
  var optionsCopy = cloneDeep(options);
28
28
  optionsCopy.forEach(function (o) {
29
- var _o$groupName;
30
-
31
- return (_o$groupName = o.groupName) !== null && _o$groupName !== void 0 ? _o$groupName : o.groupName = "选择筛选条件";
29
+ return !o.groupName && (o.groupName = "选择筛选条件");
32
30
  });
33
31
  return Object.entries(groupBy(optionsCopy, 'groupName')).map(function (_ref) {
34
32
  var _ref2 = _slicedToArray(_ref, 2),
@@ -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")));
@@ -53,9 +53,7 @@ var AutoComplete = _consoleComponents.Select.AutoComplete;
53
53
  var normalizeOptions = function normalizeOptions(options) {
54
54
  var optionsCopy = (0, _cloneDeep.default)(options);
55
55
  optionsCopy.forEach(function (o) {
56
- var _o$groupName;
57
-
58
- return (_o$groupName = o.groupName) !== null && _o$groupName !== void 0 ? _o$groupName : o.groupName = "选择筛选条件";
56
+ return !o.groupName && (o.groupName = "选择筛选条件");
59
57
  });
60
58
  return Object.entries((0, _groupBy.default)(optionsCopy, 'groupName')).map(function (_ref) {
61
59
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-components-search",
3
- "version": "0.2.5",
3
+ "version": "0.2.8",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "license": "MIT",