bk-magic-vue 2.5.6-beta.3 → 2.5.6-beta.4

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.
@@ -43719,27 +43719,31 @@
43719
43719
  this.$refs.input.style.width = this.INPUT_MIN_WIDTH + 'px';
43720
43720
  },
43721
43721
  handleInput: function handleInput(event) {
43722
- if (this.maxData === -1 || this.maxData > this.tagList.length) {
43723
- var value = event.target.value;
43724
- var charLen = this.getCharLength(value);
43725
- this.cacheVal = value;
43726
- if (charLen) {
43727
- this.isCanRemoveTag = false;
43728
- this.filterData(value);
43729
- this.$refs.input.style.width = charLen * this.INPUT_MIN_WIDTH + 'px';
43730
- } else {
43731
- this.isCanRemoveTag = true;
43732
- if (this.trigger === 'focus') {
43733
- this.filterData();
43722
+ var _this7 = this;
43723
+ var value = event.target.value;
43724
+ this.$emit('inputchange', value);
43725
+ this.$nextTick(function () {
43726
+ if (_this7.maxData === -1 || _this7.maxData > _this7.tagList.length) {
43727
+ var charLen = _this7.getCharLength(value);
43728
+ _this7.cacheVal = value;
43729
+ if (charLen) {
43730
+ _this7.isCanRemoveTag = false;
43731
+ _this7.filterData(value);
43732
+ _this7.$refs.input.style.width = charLen * _this7.INPUT_MIN_WIDTH + 'px';
43733
+ } else {
43734
+ _this7.isCanRemoveTag = true;
43735
+ if (_this7.trigger === 'focus') {
43736
+ _this7.filterData();
43737
+ }
43734
43738
  }
43739
+ } else {
43740
+ _this7.handleBlur();
43741
+ _this7.curInputValue = '';
43742
+ _this7.showList = false;
43735
43743
  }
43736
- } else {
43737
- this.handleBlur();
43738
- this.curInputValue = '';
43739
- this.showList = false;
43740
- }
43741
- this.isEdit = true;
43742
- this.focusItemIndex = this.allowCreate ? -1 : 0;
43744
+ _this7.isEdit = true;
43745
+ _this7.focusItemIndex = _this7.allowCreate ? -1 : 0;
43746
+ });
43743
43747
  },
43744
43748
  handleFocus: function handleFocus(event) {
43745
43749
  this.isCanRemoveTag = true;
@@ -43748,7 +43752,7 @@
43748
43752
  event.currentTarget.select();
43749
43753
  },
43750
43754
  handlePaste: function handlePaste(event) {
43751
- var _this7 = this;
43755
+ var _this8 = this;
43752
43756
  if (this.isSingleSelect) {
43753
43757
  return false;
43754
43758
  }
@@ -43763,7 +43767,7 @@
43763
43767
  var valArr = this.pasteFn ? this.pasteFn(value) : this.defaultPasteFn(value);
43764
43768
  var tags = [];
43765
43769
  valArr.map(function (val) {
43766
- return tags.push(val[_this7.saveKey]);
43770
+ return tags.push(val[_this8.saveKey]);
43767
43771
  });
43768
43772
  if (tags.length) {
43769
43773
  var nodes = this.$refs.tagList.childNodes;
@@ -43771,10 +43775,10 @@
43771
43775
  var localTags = [];
43772
43776
  var localInitDara = [];
43773
43777
  this.initData.map(function (data) {
43774
- localInitDara.push(data[_this7.saveKey]);
43778
+ localInitDara.push(data[_this8.saveKey]);
43775
43779
  });
43776
43780
  tags = tags.filter(function (tag) {
43777
- return tag && tag.trim() && !_this7.tagList.includes(tag) && localInitDara.includes(tag);
43781
+ return tag && tag.trim() && !_this8.tagList.includes(tag) && localInitDara.includes(tag);
43778
43782
  });
43779
43783
  if (this.maxData !== -1) {
43780
43784
  if (this.tagList.length < this.maxData) {
@@ -43788,8 +43792,8 @@
43788
43792
  }
43789
43793
  tags.map(function (tag) {
43790
43794
  var temp = {};
43791
- temp[_this7.saveKey] = tag;
43792
- temp[_this7.displayKey] = tag;
43795
+ temp[_this8.saveKey] = tag;
43796
+ temp[_this8.displayKey] = tag;
43793
43797
  localTags.push(temp);
43794
43798
  });
43795
43799
  if (tags.length) {
@@ -43801,36 +43805,36 @@
43801
43805
  this.focusInputer();
43802
43806
  this.$refs.input.style.width = this.INPUT_MIN_WIDTH + 'px';
43803
43807
  this.initData = this.initData.filter(function (val) {
43804
- return !tags.includes(val[_this7.saveKey]);
43808
+ return !tags.includes(val[_this8.saveKey]);
43805
43809
  });
43806
43810
  this.handlerChange('select');
43807
43811
  }
43808
43812
  }
43809
43813
  },
43810
43814
  defaultPasteFn: function defaultPasteFn(val) {
43811
- var _this8 = this;
43815
+ var _this9 = this;
43812
43816
  var target = [];
43813
43817
  var textArr = val.split(';');
43814
43818
  textArr.map(function (item) {
43815
43819
  if (item.match(/^[a-zA-Z][a-zA-Z_]+/g)) {
43816
43820
  var finalItem = item.match(/^[a-zA-Z][a-zA-Z_]+/g).join('');
43817
43821
  var temp = {};
43818
- temp[_this8.saveKey] = finalItem;
43819
- temp[_this8.displayKey] = finalItem;
43822
+ temp[_this9.saveKey] = finalItem;
43823
+ temp[_this9.displayKey] = finalItem;
43820
43824
  target.push(temp);
43821
43825
  }
43822
43826
  });
43823
43827
  return target;
43824
43828
  },
43825
43829
  updateScrollTop: function updateScrollTop() {
43826
- var _this9 = this;
43830
+ var _this10 = this;
43827
43831
  var panelObj = this.$refs.selectorList;
43828
43832
  var panelInfo = {
43829
43833
  height: panelObj.clientHeight,
43830
43834
  yAxis: panelObj.getBoundingClientRect().y
43831
43835
  };
43832
43836
  this.$nextTick(function () {
43833
- var activeObj = _this9.$refs.selectorList.querySelector('.bk-selector-actived');
43837
+ var activeObj = _this10.$refs.selectorList.querySelector('.bk-selector-actived');
43834
43838
  if (!activeObj) {
43835
43839
  return;
43836
43840
  }
@@ -43942,7 +43946,7 @@
43942
43946
  this.showList = false;
43943
43947
  },
43944
43948
  backspaceHandler: function backspaceHandler(index, target) {
43945
- var _this10 = this;
43949
+ var _this11 = this;
43946
43950
  if (!this.curInputValue) {
43947
43951
  if (this.isCanRemoveTag) {
43948
43952
  this.tagList.splice(index - 1, 1);
@@ -43955,7 +43959,7 @@
43955
43959
  this.focusInputer();
43956
43960
  var localList = this.useGroup ? this.allList : this.list;
43957
43961
  var isExistInit = localList.some(function (item) {
43958
- return item === target[_this10.saveKey];
43962
+ return item === target[_this11.saveKey];
43959
43963
  });
43960
43964
  if ((this.allowCreate && isExistInit || !this.allowCreate) && !this.isSingleSelect) {
43961
43965
  this.initData.push(target);
@@ -43973,19 +43977,19 @@
43973
43977
  this.handlerChange('remove');
43974
43978
  },
43975
43979
  removeTag: function removeTag(data, index) {
43976
- var _this11 = this;
43980
+ var _this12 = this;
43977
43981
  this.tagList.splice(index, 1);
43978
43982
  this.localTagList.splice(index, 1);
43979
43983
  var localList = this.useGroup ? this.allList : this.list;
43980
43984
  var isExistInit = localList.some(function (item) {
43981
- return item === data[_this11.saveKey];
43985
+ return item === data[_this12.saveKey];
43982
43986
  });
43983
43987
  if ((this.allowCreate && isExistInit || !this.allowCreate) && !this.isSingleSelect) {
43984
43988
  this.initData.push(data);
43985
43989
  }
43986
43990
  },
43987
43991
  addTag: function addTag(item, type) {
43988
- var _this12 = this;
43992
+ var _this13 = this;
43989
43993
  var nodes = this.$refs.tagList.childNodes;
43990
43994
  var result = this.getSiteInfo();
43991
43995
  var isSelected = false;
@@ -43996,13 +44000,13 @@
43996
44000
  var localTags = [];
43997
44001
  tags = item.split(this.separator);
43998
44002
  tags = tags.filter(function (tag) {
43999
- var validate = typeof _this12.createTagValidator === 'function' ? _this12.createTagValidator(tag) : true;
44000
- return tag && tag.trim() && !_this12.tagList.includes(tag) && validate;
44003
+ var validate = typeof _this13.createTagValidator === 'function' ? _this13.createTagValidator(tag) : true;
44004
+ return tag && tag.trim() && !_this13.tagList.includes(tag) && validate;
44001
44005
  });
44002
44006
  tags.forEach(function (tag) {
44003
44007
  var temp = {};
44004
- temp[_this12.saveKey] = tag;
44005
- temp[_this12.displayKey] = tag;
44008
+ temp[_this13.saveKey] = tag;
44009
+ temp[_this13.displayKey] = tag;
44006
44010
  localTags.push(temp);
44007
44011
  });
44008
44012
  if (tags.length) {
@@ -44047,14 +44051,14 @@
44047
44051
  if (isSelected) {
44048
44052
  this.$nextTick(function () {
44049
44053
  var site = nodes[_parseInt$2(result.index, 10) + 1];
44050
- _this12.insertAfter(_this12.$refs.staffInput, site);
44051
- _this12.$refs.input.style.width = _this12.INPUT_MIN_WIDTH + 'px';
44052
- if (!_this12.isSingleSelect && _this12.allowNextFocus) {
44053
- _this12.focusInputer();
44054
- }
44055
- if (!_this12.isSingleSelect) {
44056
- _this12.initData = _this12.initData.filter(function (val) {
44057
- return !_this12.tagList.includes(val[_this12.saveKey]);
44054
+ _this13.insertAfter(_this13.$refs.staffInput, site);
44055
+ _this13.$refs.input.style.width = _this13.INPUT_MIN_WIDTH + 'px';
44056
+ if (!_this13.isSingleSelect && _this13.allowNextFocus) {
44057
+ _this13.focusInputer();
44058
+ }
44059
+ if (!_this13.isSingleSelect) {
44060
+ _this13.initData = _this13.initData.filter(function (val) {
44061
+ return !_this13.tagList.includes(val[_this13.saveKey]);
44058
44062
  });
44059
44063
  }
44060
44064
  });
@@ -44072,35 +44076,35 @@
44072
44076
  this.cacheVal = '';
44073
44077
  },
44074
44078
  handleBlur: function handleBlur(inputValue) {
44075
- var _this13 = this;
44079
+ var _this14 = this;
44076
44080
  this.timer = setTimeout(function () {
44077
- var inputValue = _this13.curInputValue;
44078
- _this13.clearInput();
44079
- _this13.dispatch('bk-form-item', 'form-blur');
44080
- _this13.isEdit = false;
44081
- if (_this13.isSingleSelect) {
44082
- var _this13$tagListCache = _slicedToArray(_this13.tagListCache, 1),
44083
- oldVal = _this13$tagListCache[0];
44084
- if (inputValue && inputValue === oldVal && _this13.localTagListCache.length) {
44085
- _this13.addTag(_this13.localTagListCache[0], 'select');
44081
+ var inputValue = _this14.curInputValue;
44082
+ _this14.clearInput();
44083
+ _this14.dispatch('bk-form-item', 'form-blur');
44084
+ _this14.isEdit = false;
44085
+ if (_this14.isSingleSelect) {
44086
+ var _this14$tagListCache = _slicedToArray(_this14.tagListCache, 1),
44087
+ oldVal = _this14$tagListCache[0];
44088
+ if (inputValue && inputValue === oldVal && _this14.localTagListCache.length) {
44089
+ _this14.addTag(_this14.localTagListCache[0], 'select');
44086
44090
  } else {
44087
- _this13.handlerChange('remove');
44091
+ _this14.handlerChange('remove');
44088
44092
  }
44089
- } else if (_this13.allowAutoMatch && inputValue) {
44090
- var matchItem = _this13.renderList.find(function (item) {
44091
- return item[_this13.searchKey] === inputValue;
44093
+ } else if (_this14.allowAutoMatch && inputValue) {
44094
+ var matchItem = _this14.renderList.find(function (item) {
44095
+ return item[_this14.searchKey] === inputValue;
44092
44096
  });
44093
44097
  if (matchItem) {
44094
- _this13.handlerResultSelect(matchItem, 'select');
44095
- } else if (_this13.allowCreate) {
44096
- _this13.handlerResultSelect(inputValue, 'custom');
44098
+ _this14.handlerResultSelect(matchItem, 'select');
44099
+ } else if (_this14.allowCreate) {
44100
+ _this14.handlerResultSelect(inputValue, 'custom');
44097
44101
  }
44098
44102
  }
44099
- _this13.$emit('blur', inputValue, _this13.tagList);
44103
+ _this14.$emit('blur', inputValue, _this14.tagList);
44100
44104
  }, 200);
44101
44105
  },
44102
44106
  focusInputer: function focusInputer(event) {
44103
- var _this14 = this;
44107
+ var _this15 = this;
44104
44108
  if (this.disabled) {
44105
44109
  return;
44106
44110
  }
@@ -44125,11 +44129,11 @@
44125
44129
  }
44126
44130
  this.isEdit = true;
44127
44131
  this.$nextTick(function () {
44128
- _this14.$refs.input.focus();
44129
- if (_this14.trigger === 'focus') {
44130
- _this14.showList = true;
44131
- _this14.filterData();
44132
- _this14.showPopover();
44132
+ _this15.$refs.input.focus();
44133
+ if (_this15.trigger === 'focus') {
44134
+ _this15.showList = true;
44135
+ _this15.filterData();
44136
+ _this15.showPopover();
44133
44137
  }
44134
44138
  });
44135
44139
  },