dfish-widget 1.0.73 → 1.0.75

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
@@ -3894,12 +3894,12 @@ const {icon} = __props;
3894
3894
  error: '.f-i .f-i-alert-error'
3895
3895
  };
3896
3896
 
3897
- const save = () => {
3898
- emit('save');
3897
+ const save = (e) => {
3898
+ emit('save', e);
3899
3899
  };
3900
3900
 
3901
- const close = () => {
3902
- emit('close');
3901
+ const close = (e) => {
3902
+ emit('close', e);
3903
3903
  };
3904
3904
 
3905
3905
  const typeIcon = computed(() => {
@@ -4019,13 +4019,25 @@ var script$18 = {
4019
4019
  title: $$1.loc.opertip
4020
4020
  }
4021
4021
  },
4022
- onSave() {
4023
- this.x.yes && this.x.yes();
4024
- this.resolve();
4022
+ async onSave(e) {
4023
+ let r;
4024
+ if (this.x.yes) {
4025
+ try {
4026
+ r = await this.x.yes(e);
4027
+ } catch(e) {
4028
+ console.error(e);
4029
+ }
4030
+ }
4031
+ this.resolve(r);
4025
4032
  this.close();
4026
4033
  },
4027
- onClose() {
4028
- this.onSave();
4034
+ async onClose(e) {
4035
+ let r;
4036
+ if (this.x.no) {
4037
+ r = await this.x.no(e);
4038
+ }
4039
+ this.resolve(r);
4040
+ this.close();
4029
4041
  },
4030
4042
  html_slots_default() {
4031
4043
  return h(
@@ -4070,12 +4082,12 @@ const {icon} = __props;
4070
4082
  error: '.f-i .f-i-alert-error'
4071
4083
  };
4072
4084
 
4073
- const save = () => {
4074
- emit('save');
4085
+ const save = (e) => {
4086
+ emit('save', e);
4075
4087
  };
4076
4088
 
4077
- const close = () => {
4078
- emit('close');
4089
+ const close = (e) => {
4090
+ emit('close', e);
4079
4091
  };
4080
4092
 
4081
4093
  const typeIcon = computed(() => {
@@ -4202,13 +4214,24 @@ var script$16 = {
4202
4214
  title: $$1.loc.opertip
4203
4215
  }
4204
4216
  },
4205
- onSave() {
4206
- this.x.yes && this.x.yes();
4207
- this.resolve();
4217
+ async onSave(e) {
4218
+ let r;
4219
+ if (this.x.yes) {
4220
+ try {
4221
+ r = await this.x.yes(e);
4222
+ } catch(e) {
4223
+ console.error(e);
4224
+ }
4225
+ }
4226
+ this.resolve(r);
4208
4227
  this.close();
4209
4228
  },
4210
- onClose() {
4211
- this.x.no && this.x.no();
4229
+ async onClose(e) {
4230
+ let r;
4231
+ if (this.x.no) {
4232
+ r = await this.x.no(e);
4233
+ }
4234
+ this.resolve(r);
4212
4235
  this.close();
4213
4236
  },
4214
4237
  html_slots_default() {
@@ -5659,18 +5682,25 @@ const props = __props;
5659
5682
  return item
5660
5683
  };
5661
5684
 
5662
- const merge = (newList, oldList) => {
5663
- if (!Array.isArray(newList)) return
5664
- const item = newList.find(n => n[propChildren] && n[propChildren].length);
5665
- if (item) {
5666
- if (!oldList) oldList = props.children;
5667
- const old = oldList.find(n => n[propValue] == item[propValue]);
5668
- if (old) {
5669
- if (old[propChildren] && old[propChildren].length) {
5670
- merge(item[propChildren], old[propChildren]);
5671
- } else {
5672
- old[propChildren] = item[propChildren];
5673
- toFlat(old[propChildren], old);
5685
+ const merge = (newList) => {
5686
+ if (!Array.isArray(newList)) return []
5687
+ const oldList = JSON.parse(JSON.stringify(props.children));
5688
+ mergeChildren(newList, oldList);
5689
+ props.children.length = 0;
5690
+ props.children.push.apply(props.children, newList);
5691
+ flatList.value = toFlat(newList);
5692
+ };
5693
+
5694
+ const mergeChildren = (newList, oldList) => {
5695
+ for (let n of newList) {
5696
+ let o = oldList.find(v => v[propValue] === n[propValue]);
5697
+ if (o) {
5698
+ if (o[propChildren]) {
5699
+ if (n[propChildren]) mergeChildren(n[propChildren], o[propChildren]);
5700
+ else n[propChildren] = o[propChildren];
5701
+ }
5702
+ if (o.expanded != null) {
5703
+ n.expanded = o.expanded;
5674
5704
  }
5675
5705
  }
5676
5706
  }
@@ -6677,18 +6707,25 @@ const props = __props;
6677
6707
  return item
6678
6708
  };
6679
6709
 
6680
- const merge = (newList, oldList) => {
6681
- if (!Array.isArray(newList)) return
6682
- const item = newList.find(n => n[propChildren] && n[propChildren].length);
6683
- if (item) {
6684
- if (!oldList) oldList = props.children;
6685
- const old = oldList.find(n => n[propValue] == item[propValue]);
6686
- if (old) {
6687
- if (old[propChildren] && old[propChildren].length) {
6688
- merge(item[propChildren], old[propChildren]);
6689
- } else {
6690
- old[propChildren] = item[propChildren];
6691
- toFlat(old[propChildren], old);
6710
+ const merge = (newList) => {
6711
+ if (!Array.isArray(newList)) return []
6712
+ const oldList = JSON.parse(JSON.stringify(props.children));
6713
+ mergeChildren(newList, oldList);
6714
+ props.children.length = 0;
6715
+ props.children.push.apply(props.children, newList);
6716
+ flatList.value = toFlat(newList);
6717
+ };
6718
+
6719
+ const mergeChildren = (newList, oldList) => {
6720
+ for (let n of newList) {
6721
+ let o = oldList.find(v => v[propValue] === n[propValue]);
6722
+ if (o) {
6723
+ if (o[propChildren]) {
6724
+ if (n[propChildren]) mergeChildren(n[propChildren], o[propChildren]);
6725
+ else n[propChildren] = o[propChildren];
6726
+ }
6727
+ if (o.expanded != null) {
6728
+ n.expanded = o.expanded;
6692
6729
  }
6693
6730
  }
6694
6731
  }