dfish-widget 1.0.52 → 1.0.53

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.
package/lib/index.esm.js CHANGED
@@ -6243,6 +6243,23 @@ const props = __props;
6243
6243
  return item
6244
6244
  };
6245
6245
 
6246
+ const merge = (newList, oldList) => {
6247
+ if (!Array.isArray(newList)) return
6248
+ const item = newList.find(n => n[propChildren] && n[propChildren].length);
6249
+ if (item) {
6250
+ if (!oldList) oldList = props.children;
6251
+ const old = oldList.find(n => n[propValue] == item[propValue]);
6252
+ if (old) {
6253
+ if (old[propChildren] && old[propChildren].length) {
6254
+ merge(item[propChildren], old[propChildren]);
6255
+ } else {
6256
+ old[propChildren] = item[propChildren];
6257
+ toFlat(old[propChildren], old);
6258
+ }
6259
+ }
6260
+ }
6261
+ };
6262
+
6246
6263
  // 界面可见的数据
6247
6264
  const showList = computed(() => {
6248
6265
  const topCount = Math.floor(scrollTop.value / itemHeight);
@@ -6290,7 +6307,7 @@ const props = __props;
6290
6307
  }
6291
6308
  });
6292
6309
 
6293
- expose({toggle, expandTo, find});
6310
+ expose({toggle, expandTo, find, merge});
6294
6311
 
6295
6312
 
6296
6313
  return (_ctx, _cache) => {