dfish-widget 1.0.84 → 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
@@ -11809,27 +11809,30 @@ script$6.__file = "src/widgets/Range.vue";
11809
11809
  var script$5 = {
11810
11810
  name: 'w-combobox',
11811
11811
  mixins: [script$A],
11812
- props: ['multiple', 'dropper', 'picker', 'dropProps', 'br', 'inputValue', 'clearable'],
11813
- emits: ['input', 'click:item', 'blur', 'focus', 'update:inputValue', 'clear'],
11812
+ props: ['multiple', 'strict', 'dropper', 'picker', 'dropProps', 'br', 'clearable'],
11813
+ emits: ['input', 'click:item', 'blur', 'focus', 'clear'],
11814
11814
  data() {
11815
11815
  return {
11816
11816
  hasBorder: true,
11817
11817
  text: '',
11818
11818
  showSuggest: false,
11819
11819
  sug_timer: null,
11820
- sensor_text: this.inputValue,
11820
+ sensor_text: this.getInputText(this.modelValue),
11821
11821
  sensor_width: null,
11822
11822
  }
11823
11823
  },
11824
- watch: {
11825
- inputValue(v) {
11826
- this.sensor_text = v;
11827
- }
11828
- },
11829
11824
  methods: {
11825
+ x_default() {
11826
+ return {
11827
+ strict: true
11828
+ }
11829
+ },
11830
11830
  // implement
11831
11831
  watchModelValue(v, ov) {
11832
11832
  this.clear();
11833
+ if (!this.x.strict) {
11834
+ this.sensor_text = this.getInputText(v);
11835
+ }
11833
11836
  const or = ov && ov.map ? ov.map(n => n.value).join(',') : '';
11834
11837
  const r = v && v.map ? v.map(n => n.value).join(',') : '';
11835
11838
  if (or != r) {
@@ -11837,7 +11840,18 @@ var script$5 = {
11837
11840
  }
11838
11841
  },
11839
11842
  getInputValue(mv) {
11840
- 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 : ''
11841
11855
  },
11842
11856
  addVal(v) {
11843
11857
  let mv;
@@ -11891,7 +11905,6 @@ var script$5 = {
11891
11905
  oninput(e) {
11892
11906
  let v = e.target.value;
11893
11907
  this.sensor_text = v;
11894
- this.$emit('update:inputValue', v);
11895
11908
  clearTimeout(this.sug_timer);
11896
11909
  if (v === '') {
11897
11910
  this.suggest(false);
@@ -11973,7 +11986,7 @@ var script$5 = {
11973
11986
  html_options() {
11974
11987
  let m = this.x.modelValue;
11975
11988
  if (m && typeof m !== 'string') {
11976
- return [].concat(m).map(v => h('div', {
11989
+ return $$1.array(m).filter(v => v.value).map(v => h('div', {
11977
11990
  class: ['w-combobox-option f-flex-center', {
11978
11991
  'z-forbid': v.forbid
11979
11992
  }],
@@ -12074,8 +12087,17 @@ var script$5 = {
12074
12087
  validHooks() {
12075
12088
  return {
12076
12089
  validateDefault: (v) => {
12077
- if (this.$refs.input.value)
12078
- 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
+ }
12079
12101
  },
12080
12102
  ...this.pubValidHooks,
12081
12103
  }