ztxkui 2.3.9 → 2.4.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.
@@ -348,11 +348,26 @@ function EnhanceSelect(_a) {
348
348
  newData.forEach(function (item) {
349
349
  // 如果源数组中找到了该条数据,那么不添加
350
350
  // 否则添加
351
- if (!resultData.find(function (resultItem) {
351
+ // if (
352
+ // !resultData.find(
353
+ // (resultItem) =>
354
+ // resultItem && item && resultItem[dataKey] === item[dataKey]
355
+ // )
356
+ // ) {
357
+ // resultData.push(item);
358
+ // }
359
+ // 2022-03-01修改此处逻辑,外部参数可能会传递一些不同的逻辑,可能需要禁用此项
360
+ var index = resultData.findIndex(function (resultItem) {
352
361
  return resultItem && item && resultItem[dataKey] === item[dataKey];
353
- })) {
362
+ });
363
+ if (index === -1) {
364
+ // 没有找到直接添加
354
365
  resultData.push(item);
355
366
  }
367
+ else {
368
+ // 找到了,需要替换
369
+ resultData.splice(index, 1, __assign(__assign({}, resultData[index]), item));
370
+ }
356
371
  });
357
372
  }
358
373
  return resultData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "2.3.9",
3
+ "version": "2.4.0",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",