dfish-widget 1.0.83 → 1.0.85

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
@@ -7144,6 +7144,19 @@ var script$A = {
7144
7144
  let t = this.x.label || (this.pubParent && this.pubParent.x.label);
7145
7145
  return t ? (t.text || t) : ''
7146
7146
  },
7147
+ onCloseDrop() {
7148
+ this.showDrop = false;
7149
+ },
7150
+ mergeDropProps(dropProps) {
7151
+ if (this.x.dropProps) dropProps = mergeProps(dropProps, this.x.dropProps);
7152
+ dropProps.onClose = () => {
7153
+ this.onCloseDrop();
7154
+ if (this.x.dropProps && this.x.dropProps.onClose) {
7155
+ this.x.dropProps.onClose();
7156
+ }
7157
+ };
7158
+ return dropProps
7159
+ },
7147
7160
  oninput(e) {
7148
7161
  this.val(e.target.value);
7149
7162
  this.baseValid('change');
@@ -11326,7 +11339,8 @@ var script$a = {
11326
11339
  onkeyup() {
11327
11340
  this.showDrop = true;
11328
11341
  },
11329
- onclose() {
11342
+ // implement
11343
+ onCloseDrop() {
11330
11344
  this.showDrop = false;
11331
11345
  this.currentDate = null;
11332
11346
  this.doAutoFix();
@@ -11433,10 +11447,9 @@ var script$a = {
11433
11447
  autoHide: true,
11434
11448
  snap: () => this.snapElem(),
11435
11449
  position: 'v',
11436
- indent: 1,
11437
- onClose: this.onclose
11450
+ indent: 1
11438
11451
  };
11439
- if (this.x.dropProps) dropProps = mergeProps(dropProps, this.x.dropProps);
11452
+ dropProps = this.mergeDropProps(dropProps);
11440
11453
  r.push(h(script$1a, dropProps, {
11441
11454
  default: () => h(script$r, {
11442
11455
  height: '*',
@@ -11534,7 +11547,7 @@ var script$9 = {
11534
11547
  }
11535
11548
  },
11536
11549
  props: ['multiple', 'cancelable', 'clearable', 'dropProps'],
11537
- emits: ['drop', 'clear'],
11550
+ emits: ['clear'],
11538
11551
  data() {
11539
11552
  return {
11540
11553
  hasBorder: true,
@@ -11596,11 +11609,9 @@ var script$9 = {
11596
11609
  position: m ? null : 'v',
11597
11610
  indent: 1,
11598
11611
  scrollY: true,
11599
- scrollView: '.z-on',
11600
- onShow: () => this.$emit('drop'),
11601
- onClose: () => this.showDrop = false
11612
+ scrollView: '.z-on'
11602
11613
  };
11603
- if (this.x.dropProps) dropProps = mergeProps(dropProps, this.x.dropProps);
11614
+ dropProps = this.mergeDropProps(dropProps);
11604
11615
  r.push(h(script$1a, dropProps, this.$slots));
11605
11616
  }
11606
11617
  return r
@@ -11798,27 +11809,30 @@ script$6.__file = "src/widgets/Range.vue";
11798
11809
  var script$5 = {
11799
11810
  name: 'w-combobox',
11800
11811
  mixins: [script$A],
11801
- props: ['multiple', 'dropper', 'picker', 'dropProps', 'br', 'inputValue', 'clearable'],
11802
- emits: ['input', 'click:item', 'blur', 'focus', 'update:inputValue', 'clear', 'drop'],
11812
+ props: ['multiple', 'strict', 'dropper', 'picker', 'dropProps', 'br', 'clearable'],
11813
+ emits: ['input', 'click:item', 'blur', 'focus', 'clear'],
11803
11814
  data() {
11804
11815
  return {
11805
11816
  hasBorder: true,
11806
11817
  text: '',
11807
11818
  showSuggest: false,
11808
11819
  sug_timer: null,
11809
- sensor_text: this.inputValue,
11820
+ sensor_text: this.getInputText(this.modelValue),
11810
11821
  sensor_width: null,
11811
11822
  }
11812
11823
  },
11813
- watch: {
11814
- inputValue(v) {
11815
- this.sensor_text = v;
11816
- }
11817
- },
11818
11824
  methods: {
11825
+ x_default() {
11826
+ return {
11827
+ strict: true
11828
+ }
11829
+ },
11819
11830
  // implement
11820
11831
  watchModelValue(v, ov) {
11821
11832
  this.clear();
11833
+ if (!this.x.strict) {
11834
+ this.sensor_text = this.getInputText(v);
11835
+ }
11822
11836
  const or = ov && ov.map ? ov.map(n => n.value).join(',') : '';
11823
11837
  const r = v && v.map ? v.map(n => n.value).join(',') : '';
11824
11838
  if (or != r) {
@@ -11826,7 +11840,18 @@ var script$5 = {
11826
11840
  }
11827
11841
  },
11828
11842
  getInputValue(mv) {
11829
- return typeof mv === 'string' ? mv : $$1.array(mv).map(v => v.value).join(',')
11843
+ if (typeof mv === 'string') {
11844
+ return mv
11845
+ }
11846
+ let r = $$1.array(mv).filter(v => v.value).map(v => v.value);
11847
+ if (!this.x.strict && this.sensor_text) {
11848
+ r.push(this.sensor_text);
11849
+ }
11850
+ return r.join(',')
11851
+ },
11852
+ getInputText(mv) {
11853
+ const n = $$1.array(mv).find(v => !v.value && v.text);
11854
+ return n ? n.text : ''
11830
11855
  },
11831
11856
  addVal(v) {
11832
11857
  let mv;
@@ -11880,7 +11905,6 @@ var script$5 = {
11880
11905
  oninput(e) {
11881
11906
  let v = e.target.value;
11882
11907
  this.sensor_text = v;
11883
- this.$emit('update:inputValue', v);
11884
11908
  clearTimeout(this.sug_timer);
11885
11909
  if (v === '') {
11886
11910
  this.suggest(false);
@@ -11924,6 +11948,10 @@ var script$5 = {
11924
11948
  e.preventDefault();
11925
11949
  }
11926
11950
  },
11951
+ // implement
11952
+ onCloseDrop() {
11953
+ this.showSuggest = false;
11954
+ },
11927
11955
  clickItem(e, item) {
11928
11956
  e.runType = 'click:item';
11929
11957
  e.value = item;
@@ -11958,7 +11986,7 @@ var script$5 = {
11958
11986
  html_options() {
11959
11987
  let m = this.x.modelValue;
11960
11988
  if (m && typeof m !== 'string') {
11961
- return [].concat(m).map(v => h('div', {
11989
+ return $$1.array(m).filter(v => v.value).map(v => h('div', {
11962
11990
  class: ['w-combobox-option f-flex-center', {
11963
11991
  'z-forbid': v.forbid
11964
11992
  }],
@@ -12016,11 +12044,9 @@ var script$5 = {
12016
12044
  snap:() => this.el('form'),
12017
12045
  position: 'v',
12018
12046
  indent: 1,
12019
- scrollY: true,
12020
- onShow: () => this.$emit('drop'),
12021
- onClose: () => this.showSuggest = false
12047
+ scrollY: true
12022
12048
  };
12023
- if (this.x.dropProps) dropProps = mergeProps(dropProps, this.x.dropProps);
12049
+ dropProps = this.mergeDropProps(dropProps);
12024
12050
  r.push(h(script$1a, dropProps, this.$slots));
12025
12051
  }
12026
12052
  return [
@@ -12061,8 +12087,17 @@ var script$5 = {
12061
12087
  validHooks() {
12062
12088
  return {
12063
12089
  validateDefault: (v) => {
12064
- if (this.$refs.input.value)
12065
- return this.formErr({type: 'invalid_option'})
12090
+ if (this.sensor_text) {
12091
+ if (this.x.strict) {
12092
+ return this.formErr({type: 'invalid_option'})
12093
+ }
12094
+ if (!this.x.multiple) {
12095
+ const n = $$1.array(this.x.modelValue).find(v => v.value);
12096
+ if (n) {
12097
+ return this.formErr({type: 'maxSize'}, 1)
12098
+ }
12099
+ }
12100
+ }
12066
12101
  },
12067
12102
  ...this.pubValidHooks,
12068
12103
  }
@@ -12105,7 +12140,7 @@ var script$4 = {
12105
12140
  name: 'w-linkbox',
12106
12141
  mixins: [script$A],
12107
12142
  props: ['multiple', 'picker', 'dropProps', 'separator', 'strict', 'br', 'clearable'],
12108
- emits: ['input', 'dblclick:item', 'clear', 'drop'],
12143
+ emits: ['input', 'dblclick:item', 'clear'],
12109
12144
  created() {
12110
12145
  this.$watch(() => this.x.modelValue, (v) => {
12111
12146
  if (!this.isFocus) {
@@ -12428,6 +12463,10 @@ var script$4 = {
12428
12463
  }
12429
12464
  }
12430
12465
  },
12466
+ // implement
12467
+ onCloseDrop() {
12468
+ this.showSuggest = false;
12469
+ },
12431
12470
  formText() {
12432
12471
  return this.input_title
12433
12472
  },
@@ -12477,11 +12516,9 @@ var script$4 = {
12477
12516
  snap: () => this.el('form'),
12478
12517
  position: 'v',
12479
12518
  indent: 1,
12480
- scrollY: true,
12481
- onShow: () => this.$emit('drop'),
12482
- onClose: () => this.showSuggest = false
12519
+ scrollY: true
12483
12520
  };
12484
- if (this.x.dropProps) dropProps = mergeProps(dropProps, this.x.dropProps);
12521
+ dropProps = this.mergeDropProps(dropProps);
12485
12522
  r.push(h(script$1a, dropProps, this.$slots));
12486
12523
  }
12487
12524
  return [