dfish-widget 1.0.70 → 1.0.72

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
@@ -2282,22 +2282,21 @@ var script$1l = {
2282
2282
  /*
2283
2283
  @options: {
2284
2284
  mode: {
2285
- 'default': 一个template只有一个实例,且每次都是新实例
2285
+ 'multiple': 默认值,一个template可以多个实例
2286
+ 'single': 一个template只有一个实例,且每次都是新实例
2286
2287
  'component': 一个template只有一个实例
2287
- 'multiple': 一个template可以多个实例
2288
- },
2289
- init(pop): Function, 对话框mounted后执行
2288
+ }
2290
2289
  }
2291
2290
  */
2292
2291
  createPop(commander, template, props, options = {}) {
2293
2292
  return new Promise((resolve, reject) => {
2294
- const mode = options.mode || 'default';
2293
+ const mode = options.mode || 'multiple';
2295
2294
  const pop = this.getPops(template)[0];
2296
2295
  if (pop) {
2297
2296
  if (mode === 'component') {
2298
2297
  Object.assign(pop, {props, options, resolve, reject});
2299
2298
  return
2300
- } else if (mode === 'default') {
2299
+ } else if (mode === 'single') {
2301
2300
  let index = this.pops.indexOf(pop);
2302
2301
  this.pops.splice(index, 1);
2303
2302
  }
@@ -3861,10 +3860,6 @@ const O = {},
3861
3860
  if (this.x.timeout) {
3862
3861
  setTimeout(this.close, this.x.timeout);
3863
3862
  }
3864
- let o = this.getPop();
3865
- if (o && o.options && o.options.init) {
3866
- o.options.init(this);
3867
- }
3868
3863
  });
3869
3864
  },
3870
3865
  unmounted() {
@@ -5699,18 +5694,21 @@ const props = __props;
5699
5694
  const watchCurrent = async (val) => {
5700
5695
  await nextTick();
5701
5696
  current = val;
5702
- if (!val) return
5703
- val = $$1.array(val);
5697
+ val = val && $$1.array(val);
5698
+ if (!val || !val.length) return
5704
5699
  for (let v of val) {
5705
5700
  if (!showList.value.find(n => v == n[propValue])) {
5706
5701
  expandTo(v);
5707
5702
  }
5708
5703
  }
5709
- const item = find(val[0]);
5710
- const i = flatList.value.indexOf(item);
5711
- if (i > -1) {
5712
- await nextTick();
5713
- wrap.value.scrollToY(((i + 1) * itemHeight) - (flow.value.height / 2));
5704
+ const showIndex = showList.value.findIndex(n => val[0] == n[propValue]);
5705
+ if (showIndex === -1 || showIndex === showList.value.length - 1) {
5706
+ const item = find(val[0]);
5707
+ const i = flatList.value.indexOf(item);
5708
+ if (i > -1) {
5709
+ await nextTick();
5710
+ root.value.scrollToY(((i + 1) * itemHeight) - (flow.value.height / 2));
5711
+ }
5714
5712
  }
5715
5713
  };
5716
5714
 
@@ -5724,7 +5722,7 @@ const props = __props;
5724
5722
  watchCurrent(props.current);
5725
5723
  }
5726
5724
  }, {immediate: true});
5727
- watch(() => props.current, watchCurrent);
5725
+ watch(() => props.current, watchCurrent, {deep: true});
5728
5726
  if (!props.children || props.children.length == 0) {
5729
5727
  const src = props.src && props.src();
5730
5728
  if (src) {
@@ -6714,18 +6712,22 @@ const props = __props;
6714
6712
  const watchCurrent = async (val) => {
6715
6713
  await nextTick();
6716
6714
  current = val;
6717
- if (!val) return
6718
- val = $$1.array(val);
6715
+ console.log(val);
6716
+ val = val && $$1.array(val);
6717
+ if (!val || !val.length) return
6719
6718
  for (let v of val) {
6720
6719
  if (!showList.value.find(n => v == n[propValue])) {
6721
6720
  expandTo(v);
6722
6721
  }
6723
6722
  }
6724
- const item = find(val[0]);
6725
- const i = flatList.value.indexOf(item);
6726
- if (i > -1) {
6727
- await nextTick();
6728
- root.value.scrollToY(((i + 1) * itemHeight) - (flow.value.height / 2));
6723
+ const showIndex = showList.value.findIndex(n => val[0] == n[propValue]);
6724
+ if (showIndex === -1 || showIndex === showList.value.length - 1) {
6725
+ const item = find(val[0]);
6726
+ const i = flatList.value.indexOf(item);
6727
+ if (i > -1) {
6728
+ await nextTick();
6729
+ root.value.scrollToY(((i + 1) * itemHeight) - (flow.value.height / 2));
6730
+ }
6729
6731
  }
6730
6732
  };
6731
6733
 
@@ -6739,7 +6741,7 @@ const props = __props;
6739
6741
  watchCurrent(props.current);
6740
6742
  }
6741
6743
  }, {immediate: true});
6742
- watch(() => props.current, watchCurrent);
6744
+ watch(() => props.current, watchCurrent, {deep: true});
6743
6745
  if (!props.children || props.children.length == 0) {
6744
6746
  const src = props.src && props.src();
6745
6747
  if (src) {
@@ -7440,10 +7442,10 @@ const {leafSymbol: leafSymbol$1} = $$1.symbol;
7440
7442
  }, h('i', {
7441
7443
  class: this.input_icon
7442
7444
  })),
7443
- this.x.text ?
7445
+ this.$slots.text || this.x.text ?
7444
7446
  h('span', {
7445
- class: this.$options.name + '-text'
7446
- }, this.x.text) : null
7447
+ class: this.$options.name + '-text',
7448
+ }, this.$slots.text ? this.$slots.text() : this.x.text) : null
7447
7449
  ]
7448
7450
  },
7449
7451
  html_main() {
@@ -11574,8 +11576,9 @@ var script$8 = {
11574
11576
  }
11575
11577
  if (Array.isArray(v)) {
11576
11578
  return v.map(item => item.text).join(', ')
11577
- } else
11578
- return v && String(v.text)
11579
+ } else {
11580
+ return (v && v.text) || ''
11581
+ }
11579
11582
  }
11580
11583
  }
11581
11584
  };