@scvzerng/element-ui-ag-grid-vue2 0.0.30 → 0.0.31

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.
@@ -29221,16 +29221,22 @@ class Wy {
29221
29221
  this.rows.push(...t);
29222
29222
  }
29223
29223
  /**
29224
- * 插入数据
29225
- * @param rows
29226
- * @param index
29224
+ * 插入数据, 默认按 id 去重
29225
+ *
29226
+ * 同 id 已在表格里: 删旧 + 插新到 index (换位置)
29227
+ * 新 rows 内部同 id 重复: 后覆盖前 (保留最后一个位置)
29228
+ * 不在表格: 直接插入
29227
29229
  */
29228
29230
  insertRows(t, o = 0) {
29229
29231
  if (!this.rows) {
29230
29232
  this.setRows(t);
29231
29233
  return;
29232
29234
  }
29233
- this.rows.splice(o, 0, ...t);
29235
+ const i = /* @__PURE__ */ new Map();
29236
+ for (const n of t)
29237
+ i.set(n.getId(), n);
29238
+ const s = new Set(i.keys());
29239
+ this.rows = this.rows.filter((n) => !s.has(n.getId())), this.rows.splice(o, 0, ...i.values());
29234
29240
  }
29235
29241
  /**
29236
29242
  * 删除数据