@alicloud/console-components-search 0.2.37-alpha.6 → 0.2.37-alpha.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.
@@ -226,6 +226,7 @@ const Demo1: React.FC<{}> = (props) => {
226
226
  options={options3}
227
227
  prefixSelectMode="cascader"
228
228
  onSearch={(value, dataIndex, extra) => {
229
+ console.log(value, dataIndex, extra);
229
230
  // @ts-ignore
230
231
  setFilters([...filters, extra]);
231
232
  }}
package/dist/index.js CHANGED
@@ -90277,15 +90277,28 @@ var normalizeSelectDataSource = function (title, list) {
90277
90277
  },
90278
90278
  ];
90279
90279
  };
90280
+ var flatOption = function (opts) {
90281
+ if (opts === void 0) { opts = []; }
90282
+ var flattened = [];
90283
+ opts.forEach(function (item) {
90284
+ if (item.children) {
90285
+ flattened.push.apply(flattened, flatOption(item.children));
90286
+ }
90287
+ else {
90288
+ flattened.push(item);
90289
+ }
90290
+ });
90291
+ return flattened;
90292
+ };
90280
90293
  var normalizeSearchOptions = function (dataIndex, value, options) {
90281
- var _a, _b, _c;
90282
- var opt = options === null || options === void 0 ? void 0 : options.find(function (o) { return getDataIndex(o) === dataIndex; });
90294
+ var _a, _b, _c, _d;
90295
+ var opt = (_a = flatOption(options)) === null || _a === void 0 ? void 0 : _a.find(function (o) { return getDataIndex(o) === dataIndex; });
90283
90296
  var valueLabel = value;
90284
90297
  if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'select') {
90285
- valueLabel = (_b = (_a = opt.templateProps) === null || _a === void 0 ? void 0 : _a.dataSource.find(function (d) { return d.value === value; })) === null || _b === void 0 ? void 0 : _b.label;
90298
+ valueLabel = (_c = (_b = opt.templateProps) === null || _b === void 0 ? void 0 : _b.dataSource.find(function (d) { return d.value === value; })) === null || _c === void 0 ? void 0 : _c.label;
90286
90299
  }
90287
90300
  if ((opt === null || opt === void 0 ? void 0 : opt.template) === 'multiple') {
90288
- valueLabel = (_c = opt.templateProps) === null || _c === void 0 ? void 0 : _c.dataSource.filter(function (d) { return value === null || value === void 0 ? void 0 : value.includes(d.value); }).map(function (d) { return d.label; }).join('/');
90301
+ valueLabel = (_d = opt.templateProps) === null || _d === void 0 ? void 0 : _d.dataSource.filter(function (d) { return value === null || value === void 0 ? void 0 : value.includes(d.value); }).map(function (d) { return d.label; }).join('/');
90289
90302
  }
90290
90303
  return {
90291
90304
  label: opt === null || opt === void 0 ? void 0 : opt.label,
@@ -90337,18 +90350,6 @@ var ComplexSearch = function (props) {
90337
90350
  */
90338
90351
  var handlerFilterTypeChange = function (type, resetValue) {
90339
90352
  if (resetValue === void 0) { resetValue = true; }
90340
- var flatOption = function (opts) {
90341
- var flattened = [];
90342
- opts.forEach(function (item) {
90343
- if (item.children) {
90344
- flattened.push.apply(flattened, flatOption(item.children));
90345
- }
90346
- else {
90347
- flattened.push(item);
90348
- }
90349
- });
90350
- return flattened;
90351
- };
90352
90353
  setSelectedFilterType(flatOption(options).find(function (o) { return getDataIndex(o) === type; }));
90353
90354
  resetValue && reset();
90354
90355
  };
@@ -84,8 +84,21 @@ var normalizeSelectDataSource = function normalizeSelectDataSource(title, list)
84
84
  children: _toConsumableArray(list)
85
85
  }];
86
86
  };
87
+ var _flatOption = function flatOption() {
88
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
89
+ var flattened = [];
90
+ opts.forEach(function (item) {
91
+ if (item.children) {
92
+ flattened.push.apply(flattened, _toConsumableArray(_flatOption(item.children)));
93
+ } else {
94
+ flattened.push(item);
95
+ }
96
+ });
97
+ return flattened;
98
+ };
87
99
  var normalizeSearchOptions = function normalizeSearchOptions(dataIndex, value, options) {
88
- var opt = options === null || options === void 0 ? void 0 : options.find(function (o) {
100
+ var _flatOption2;
101
+ var opt = (_flatOption2 = _flatOption(options)) === null || _flatOption2 === void 0 ? void 0 : _flatOption2.find(function (o) {
89
102
  return getDataIndex(o) === dataIndex;
90
103
  });
91
104
  var valueLabel = value;
@@ -184,17 +197,6 @@ var ComplexSearch = function ComplexSearch(props) {
184
197
  */
185
198
  var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
186
199
  var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
187
- var _flatOption = function flatOption(opts) {
188
- var flattened = [];
189
- opts.forEach(function (item) {
190
- if (item.children) {
191
- flattened.push.apply(flattened, _toConsumableArray(_flatOption(item.children)));
192
- } else {
193
- flattened.push(item);
194
- }
195
- });
196
- return flattened;
197
- };
198
200
  setSelectedFilterType(_flatOption(options).find(function (o) {
199
201
  return getDataIndex(o) === type;
200
202
  }));
@@ -93,8 +93,21 @@ var normalizeSelectDataSource = function normalizeSelectDataSource(title, list)
93
93
  children: (0, _toConsumableArray2.default)(list)
94
94
  }];
95
95
  };
96
+ var _flatOption = function flatOption() {
97
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
98
+ var flattened = [];
99
+ opts.forEach(function (item) {
100
+ if (item.children) {
101
+ flattened.push.apply(flattened, (0, _toConsumableArray2.default)(_flatOption(item.children)));
102
+ } else {
103
+ flattened.push(item);
104
+ }
105
+ });
106
+ return flattened;
107
+ };
96
108
  var normalizeSearchOptions = function normalizeSearchOptions(dataIndex, value, options) {
97
- var opt = options === null || options === void 0 ? void 0 : options.find(function (o) {
109
+ var _flatOption2;
110
+ var opt = (_flatOption2 = _flatOption(options)) === null || _flatOption2 === void 0 ? void 0 : _flatOption2.find(function (o) {
98
111
  return getDataIndex(o) === dataIndex;
99
112
  });
100
113
  var valueLabel = value;
@@ -193,17 +206,6 @@ var ComplexSearch = function ComplexSearch(props) {
193
206
  */
194
207
  var handlerFilterTypeChange = function handlerFilterTypeChange(type) {
195
208
  var resetValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
196
- var _flatOption = function flatOption(opts) {
197
- var flattened = [];
198
- opts.forEach(function (item) {
199
- if (item.children) {
200
- flattened.push.apply(flattened, (0, _toConsumableArray2.default)(_flatOption(item.children)));
201
- } else {
202
- flattened.push(item);
203
- }
204
- });
205
- return flattened;
206
- };
207
209
  setSelectedFilterType(_flatOption(options).find(function (o) {
208
210
  return getDataIndex(o) === type;
209
211
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-components-search",
3
- "version": "0.2.37-alpha.6",
3
+ "version": "0.2.37-alpha.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "license": "MIT",