@autobest-ui/components 2.0.5-y.2 → 2.1.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.
@@ -7,7 +7,6 @@ export interface SelectOptionItem {
7
7
  name: NameValue;
8
8
  value: Value;
9
9
  actualName?: NameValue;
10
- disabled?: boolean;
11
10
  unselect?: boolean;
12
11
  className?: string;
13
12
  }
@@ -59,7 +58,7 @@ export interface SelectProps extends Pick<TriggerProps, 'windowResizeHidden' | '
59
58
  */
60
59
  isMinRootWidth?: boolean;
61
60
  /**
62
- * 是否支持过滤功能, 目前的过滤类似carid.com,仅仅支持首字母过滤,滚动到匹配位置,填充匹配到的第一项,触发onChange
61
+ * 是否支持过滤功能, 目前的过滤类似carid.com,仅仅支持首字母过滤,滚动到匹配位置,填充匹配到的第一项,触发onFilterChange
63
62
  */
64
63
  isFilterOption?: boolean;
65
64
  /**
@@ -101,7 +101,7 @@ function (_super) {
101
101
  var code = event.keyCode || event.which;
102
102
 
103
103
  if (code >= 65 && code <= 90 || code >= 48 && code <= 57 || code >= 96 && code <= 105) {
104
- var findItem_1 = _this.findMatchItem(event.key);
104
+ var findItem_1 = _this.findMatchItem(event.key.toLowerCase());
105
105
 
106
106
  if (!findItem_1) {
107
107
  return;
@@ -146,10 +146,12 @@ function (_super) {
146
146
 
147
147
  for (var i = 0; i < list.length; i++) {
148
148
  for (var j = 0; j < list[i].length; j++) {
149
- var item = list[i][j];
149
+ var item = list[i][j]; // 只对string/number类型进行筛选,
150
150
 
151
- if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
152
- return item;
151
+ if (!item.unselect && (typeof item.name === 'string' || typeof item.name === 'number')) {
152
+ if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
153
+ return item;
154
+ }
153
155
  }
154
156
  }
155
157
  }
@@ -174,11 +176,12 @@ function (_super) {
174
176
 
175
177
  if (_this.props.isFilterOption && status) {
176
178
  _this.addKeydownListener();
177
- }
179
+ } // 关闭下拉框,并且已经过滤到数据
180
+
178
181
 
179
182
  var filterItem = _this.state.filterItem;
180
183
 
181
- if (filterItem) {
184
+ if (filterItem && !status) {
182
185
  // 清空filter数据,并触发onChange
183
186
  _this.setState({
184
187
  filterItem: null
@@ -7,7 +7,6 @@ export interface SelectOptionItem {
7
7
  name: NameValue;
8
8
  value: Value;
9
9
  actualName?: NameValue;
10
- disabled?: boolean;
11
10
  unselect?: boolean;
12
11
  className?: string;
13
12
  }
@@ -59,7 +58,7 @@ export interface SelectProps extends Pick<TriggerProps, 'windowResizeHidden' | '
59
58
  */
60
59
  isMinRootWidth?: boolean;
61
60
  /**
62
- * 是否支持过滤功能, 目前的过滤类似carid.com,仅仅支持首字母过滤,滚动到匹配位置,填充匹配到的第一项,触发onChange
61
+ * 是否支持过滤功能, 目前的过滤类似carid.com,仅仅支持首字母过滤,滚动到匹配位置,填充匹配到的第一项,触发onFilterChange
63
62
  */
64
63
  isFilterOption?: boolean;
65
64
  /**
@@ -113,7 +113,7 @@ function (_super) {
113
113
  var code = event.keyCode || event.which;
114
114
 
115
115
  if (code >= 65 && code <= 90 || code >= 48 && code <= 57 || code >= 96 && code <= 105) {
116
- var findItem_1 = _this.findMatchItem(event.key);
116
+ var findItem_1 = _this.findMatchItem(event.key.toLowerCase());
117
117
 
118
118
  if (!findItem_1) {
119
119
  return;
@@ -158,10 +158,12 @@ function (_super) {
158
158
 
159
159
  for (var i = 0; i < list.length; i++) {
160
160
  for (var j = 0; j < list[i].length; j++) {
161
- var item = list[i][j];
161
+ var item = list[i][j]; // 只对string/number类型进行筛选,
162
162
 
163
- if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
164
- return item;
163
+ if (!item.unselect && (typeof item.name === 'string' || typeof item.name === 'number')) {
164
+ if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
165
+ return item;
166
+ }
165
167
  }
166
168
  }
167
169
  }
@@ -186,11 +188,12 @@ function (_super) {
186
188
 
187
189
  if (_this.props.isFilterOption && status) {
188
190
  _this.addKeydownListener();
189
- }
191
+ } // 关闭下拉框,并且已经过滤到数据
192
+
190
193
 
191
194
  var filterItem = _this.state.filterItem;
192
195
 
193
- if (filterItem) {
196
+ if (filterItem && !status) {
194
197
  // 清空filter数据,并触发onChange
195
198
  _this.setState({
196
199
  filterItem: null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobest-ui/components",
3
- "version": "2.0.5-y.2",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "description": "components common ui for React",
6
6
  "main": "lib/index.js",
@@ -46,5 +46,5 @@
46
46
  "react": ">=16.8.6",
47
47
  "react-transition-group": ">=4.2.2"
48
48
  },
49
- "gitHead": "922987f547f608a090e509ccec8cbecc58bb8935"
49
+ "gitHead": "1d4466a308912ee7251003a834d85125654918f9"
50
50
  }