bk-magic-vue 2.5.3 → 2.5.4-beta.1

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.
@@ -50628,6 +50628,7 @@
50628
50628
  bkOverflowTips: overflowTips,
50629
50629
  bkloading: bkLoading
50630
50630
  },
50631
+ mixins: [locale.mixin],
50631
50632
  props: {
50632
50633
  show: Boolean,
50633
50634
  versionList: {
@@ -50679,6 +50680,14 @@
50679
50680
  versionSubTitleName: {
50680
50681
  type: String,
50681
50682
  default: 'date'
50683
+ },
50684
+ defaultActive: {
50685
+ type: String,
50686
+ default: ''
50687
+ },
50688
+ currentTagText: {
50689
+ type: String,
50690
+ default: ''
50682
50691
  }
50683
50692
  },
50684
50693
  data: function data() {
@@ -50699,6 +50708,14 @@
50699
50708
  };
50700
50709
  },
50701
50710
  computed: {
50711
+ defaultActiveIndex: function defaultActiveIndex() {
50712
+ var _this = this;
50713
+ var activeVersion = this.defaultActive || this.currentVersion;
50714
+ var index = this.versionList.findIndex(function (item) {
50715
+ return item[_this.versionTitleName] === activeVersion;
50716
+ });
50717
+ return index === -1 ? 0 : index;
50718
+ },
50702
50719
  logContent: function logContent() {
50703
50720
  if (this.mdMode) {
50704
50721
  return marked.parse(this.versionDetail);
@@ -50725,7 +50742,7 @@
50725
50742
  },
50726
50743
  methods: {
50727
50744
  handleMouseDown: function handleMouseDown(e) {
50728
- var _this = this;
50745
+ var _this2 = this;
50729
50746
  var target = event.target;
50730
50747
  while (target && target.dataset['tag'] !== 'resizeTarget') {
50731
50748
  target = target.parentNode;
@@ -50738,7 +50755,7 @@
50738
50755
  return false;
50739
50756
  };
50740
50757
  var handleMouseMove = function handleMouseMove(event) {
50741
- _this.left.width = Math.min(Math.max(_this.minLeftWidth, event.clientX - rect.left), _this.maxLeftWidth);
50758
+ _this2.left.width = Math.min(Math.max(_this2.minLeftWidth, event.clientX - rect.left), _this2.maxLeftWidth);
50742
50759
  };
50743
50760
  var handleMouseUp = function handleMouseUp() {
50744
50761
  document.body.style.cursor = '';
@@ -50766,52 +50783,52 @@
50766
50783
  this.$emit('change', v);
50767
50784
  },
50768
50785
  handleOnShowChange: function handleOnShowChange(v) {
50769
- var _this2 = this;
50786
+ var _this3 = this;
50770
50787
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee() {
50771
50788
  return _regeneratorRuntime().wrap(function _callee$(_context) {
50772
50789
  while (1) {
50773
50790
  switch (_context.prev = _context.next) {
50774
50791
  case 0:
50775
- _this2.dialog.show = v;
50792
+ _this3.dialog.show = v;
50776
50793
  if (!v) {
50777
50794
  _context.next = 20;
50778
50795
  break;
50779
50796
  }
50780
- _this2.dialog.width = window.innerWidth >= 1920 ? 1110 : 850;
50781
- _this2.dialog.height = window.innerWidth >= 1920 ? 640 : 520;
50782
- _this2.loading = true;
50783
- _context.t0 = !_this2.versionList.length && typeof _this2.getVersionList === 'function';
50797
+ _this3.dialog.width = window.innerWidth >= 1920 ? 1110 : 850;
50798
+ _this3.dialog.height = window.innerWidth >= 1920 ? 640 : 520;
50799
+ _this3.loading = true;
50800
+ _context.t0 = !_this3.versionList.length && typeof _this3.getVersionList === 'function';
50784
50801
  if (!_context.t0) {
50785
50802
  _context.next = 9;
50786
50803
  break;
50787
50804
  }
50788
50805
  _context.next = 9;
50789
- return _this2.getVersionList();
50806
+ return _this3.getVersionList();
50790
50807
  case 9:
50791
- if (!_this2.versionList.length) {
50808
+ if (!_this3.versionList.length) {
50792
50809
  _context.next = 19;
50793
50810
  break;
50794
50811
  }
50795
50812
  case 10:
50796
- if (!(!_this2.finished && _this2.dialog.height - 40 > _this2.versionList.length * 55)) {
50813
+ if (!(!_this3.finished && _this3.dialog.height - 40 > _this3.versionList.length * 55)) {
50797
50814
  _context.next = 17;
50798
50815
  break;
50799
50816
  }
50800
- _context.t1 = typeof _this2.getVersionList === 'function';
50817
+ _context.t1 = typeof _this3.getVersionList === 'function';
50801
50818
  if (!_context.t1) {
50802
50819
  _context.next = 15;
50803
50820
  break;
50804
50821
  }
50805
50822
  _context.next = 15;
50806
- return _this2.getVersionList();
50823
+ return _this3.getVersionList();
50807
50824
  case 15:
50808
50825
  _context.next = 10;
50809
50826
  break;
50810
50827
  case 17:
50811
50828
  _context.next = 19;
50812
- return _this2.handleItemClick();
50829
+ return _this3.handleItemClick(_this3.defaultActiveIndex);
50813
50830
  case 19:
50814
- _this2.loading = false;
50831
+ _this3.loading = false;
50815
50832
  case 20:
50816
50833
  case "end":
50817
50834
  return _context.stop();
@@ -50821,39 +50838,39 @@
50821
50838
  }))();
50822
50839
  },
50823
50840
  handleLeftScroll: function handleLeftScroll(e) {
50824
- var _this3 = this;
50841
+ var _this4 = this;
50825
50842
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee2() {
50826
50843
  var el, scrollHeight, scrollTop, clientHeight;
50827
50844
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
50828
50845
  while (1) {
50829
50846
  switch (_context2.prev = _context2.next) {
50830
50847
  case 0:
50831
- el = _this3.$refs.leftList;
50848
+ el = _this4.$refs.leftList;
50832
50849
  scrollHeight = el.scrollHeight;
50833
50850
  scrollTop = el.scrollTop;
50834
50851
  clientHeight = el.clientHeight;
50835
- if (!(!_this3.finished && clientHeight + scrollTop >= scrollHeight && !_this3.scroll)) {
50852
+ if (!(!_this4.finished && clientHeight + scrollTop >= scrollHeight && !_this4.scroll)) {
50836
50853
  _context2.next = 16;
50837
50854
  break;
50838
50855
  }
50839
- _this3.left.scroll = true;
50840
- _this3.left.loading = true;
50841
- _context2.t0 = typeof _this3.getVersionList === 'function';
50856
+ _this4.left.scroll = true;
50857
+ _this4.left.loading = true;
50858
+ _context2.t0 = typeof _this4.getVersionList === 'function';
50842
50859
  if (!_context2.t0) {
50843
50860
  _context2.next = 11;
50844
50861
  break;
50845
50862
  }
50846
50863
  _context2.next = 11;
50847
- return _this3.getVersionList().catch(function (_) {
50864
+ return _this4.getVersionList().catch(function (_) {
50848
50865
  return false;
50849
50866
  });
50850
50867
  case 11:
50851
50868
  _context2.next = 13;
50852
- return _this3.$nextTick();
50869
+ return _this4.$nextTick();
50853
50870
  case 13:
50854
50871
  el.scrollTo(0, scrollTop - 100);
50855
- _this3.left.loading = false;
50856
- _this3.left.scroll = false;
50872
+ _this4.left.loading = false;
50873
+ _this4.left.scroll = false;
50857
50874
  case 16:
50858
50875
  case "end":
50859
50876
  return _context2.stop();
@@ -50863,27 +50880,28 @@
50863
50880
  }))();
50864
50881
  },
50865
50882
  handleItemClick: function handleItemClick() {
50866
- var _this4 = this;
50883
+ var _this5 = this;
50867
50884
  var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
50868
50885
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee3() {
50869
50886
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
50870
50887
  while (1) {
50871
50888
  switch (_context3.prev = _context3.next) {
50872
50889
  case 0:
50873
- _this4.active = v;
50874
- _this4.loading = true;
50875
- _context3.t0 = typeof _this4.getVersionDetail === 'function';
50890
+ _this5.active = v;
50891
+ _this5.loading = true;
50892
+ _context3.t0 = typeof _this5.getVersionDetail === 'function';
50876
50893
  if (!_context3.t0) {
50877
50894
  _context3.next = 6;
50878
50895
  break;
50879
50896
  }
50880
50897
  _context3.next = 6;
50881
- return _this4.getVersionDetail(_this4.versionList[v]).catch(function (_) {
50898
+ return _this5.getVersionDetail(_this5.versionList[v]).catch(function (_) {
50882
50899
  return false;
50883
50900
  });
50884
50901
  case 6:
50885
- _this4.loading = false;
50886
- case 7:
50902
+ _this5.loading = false;
50903
+ _this5.$emit('selected', v, _this5.versionList[v]);
50904
+ case 8:
50887
50905
  case "end":
50888
50906
  return _context3.stop();
50889
50907
  }
@@ -50966,7 +50984,7 @@
50966
50984
  staticClass: "item-date"
50967
50985
  }, [_vm._v(_vm._s(item[_vm.versionSubTitleName]))]), item[_vm.versionTitleName] === _vm.currentVersion ? _c('span', {
50968
50986
  staticClass: "item-current"
50969
- }, [_vm._v(" " + _vm._s('当前版本') + " ")]) : _vm._e()];
50987
+ }, [_vm._v(" " + _vm._s(_vm.currentTagText || _vm.t('bk.versionDetail.currentTagText')) + " ")]) : _vm._e()];
50970
50988
  }, {
50971
50989
  "version": {
50972
50990
  item: item,