bk-magic-vue 2.5.3-beta.13 → 2.5.3-beta.14

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.
@@ -8689,6 +8689,9 @@
8689
8689
  original: 'original size',
8690
8690
  prev: 'prev',
8691
8691
  next: 'next'
8692
+ },
8693
+ versionDetail: {
8694
+ currentTagText: 'Current'
8692
8695
  }
8693
8696
  }
8694
8697
  };
@@ -8843,6 +8846,9 @@
8843
8846
  rotateRight: '向右旋转',
8844
8847
  fullScreen: '适应屏幕',
8845
8848
  original: '快速回到 1:1'
8849
+ },
8850
+ versionDetail: {
8851
+ currentTagText: '当前版本'
8846
8852
  }
8847
8853
  }
8848
8854
  };
@@ -48430,6 +48436,7 @@
48430
48436
  bkOverflowTips: overflowTips,
48431
48437
  bkloading: bkLoading
48432
48438
  },
48439
+ mixins: [locale.mixin],
48433
48440
  props: {
48434
48441
  show: Boolean,
48435
48442
  versionList: {
@@ -48477,6 +48484,14 @@
48477
48484
  versionSubTitleName: {
48478
48485
  type: String,
48479
48486
  default: 'date'
48487
+ },
48488
+ defaultActive: {
48489
+ type: String,
48490
+ default: ''
48491
+ },
48492
+ currentTagText: {
48493
+ type: String,
48494
+ default: ''
48480
48495
  }
48481
48496
  },
48482
48497
  data: function data() {
@@ -48496,6 +48511,16 @@
48496
48511
  unWatchShow: null
48497
48512
  };
48498
48513
  },
48514
+ computed: {
48515
+ defaultActiveIndex: function defaultActiveIndex() {
48516
+ var _this = this;
48517
+ var activeVersion = this.defaultActive || this.currentVersion;
48518
+ var index = this.versionList.findIndex(function (item) {
48519
+ return item[_this.versionTitleName] === activeVersion;
48520
+ });
48521
+ return index === -1 ? 0 : index;
48522
+ }
48523
+ },
48499
48524
  mounted: function mounted() {
48500
48525
  this.dialog.show = this.show;
48501
48526
  this.$refs.leftList.addEventListener('scroll', this.handleLeftScroll, {
@@ -48515,7 +48540,7 @@
48515
48540
  },
48516
48541
  methods: {
48517
48542
  handleMouseDown: function handleMouseDown(e) {
48518
- var _this = this;
48543
+ var _this2 = this;
48519
48544
  var target = event.target;
48520
48545
  while (target && target.dataset['tag'] !== 'resizeTarget') {
48521
48546
  target = target.parentNode;
@@ -48528,7 +48553,7 @@
48528
48553
  return false;
48529
48554
  };
48530
48555
  var handleMouseMove = function handleMouseMove(event) {
48531
- _this.left.width = Math.min(Math.max(_this.minLeftWidth, event.clientX - rect.left), _this.maxLeftWidth);
48556
+ _this2.left.width = Math.min(Math.max(_this2.minLeftWidth, event.clientX - rect.left), _this2.maxLeftWidth);
48532
48557
  };
48533
48558
  var handleMouseUp = function handleMouseUp() {
48534
48559
  document.body.style.cursor = '';
@@ -48556,52 +48581,52 @@
48556
48581
  this.$emit('change', v);
48557
48582
  },
48558
48583
  handleOnShowChange: function handleOnShowChange(v) {
48559
- var _this2 = this;
48584
+ var _this3 = this;
48560
48585
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee() {
48561
48586
  return _regeneratorRuntime().wrap(function _callee$(_context) {
48562
48587
  while (1) {
48563
48588
  switch (_context.prev = _context.next) {
48564
48589
  case 0:
48565
- _this2.dialog.show = v;
48590
+ _this3.dialog.show = v;
48566
48591
  if (!v) {
48567
48592
  _context.next = 20;
48568
48593
  break;
48569
48594
  }
48570
- _this2.dialog.width = window.innerWidth >= 1920 ? 1110 : 850;
48571
- _this2.dialog.height = window.innerWidth >= 1920 ? 640 : 520;
48572
- _this2.loading = true;
48573
- _context.t0 = !_this2.versionList.length && typeof _this2.getVersionList === 'function';
48595
+ _this3.dialog.width = window.innerWidth >= 1920 ? 1110 : 850;
48596
+ _this3.dialog.height = window.innerWidth >= 1920 ? 640 : 520;
48597
+ _this3.loading = true;
48598
+ _context.t0 = !_this3.versionList.length && typeof _this3.getVersionList === 'function';
48574
48599
  if (!_context.t0) {
48575
48600
  _context.next = 9;
48576
48601
  break;
48577
48602
  }
48578
48603
  _context.next = 9;
48579
- return _this2.getVersionList();
48604
+ return _this3.getVersionList();
48580
48605
  case 9:
48581
- if (!_this2.versionList.length) {
48606
+ if (!_this3.versionList.length) {
48582
48607
  _context.next = 19;
48583
48608
  break;
48584
48609
  }
48585
48610
  case 10:
48586
- if (!(!_this2.finished && _this2.dialog.height - 40 > _this2.versionList.length * 55)) {
48611
+ if (!(!_this3.finished && _this3.dialog.height - 40 > _this3.versionList.length * 55)) {
48587
48612
  _context.next = 17;
48588
48613
  break;
48589
48614
  }
48590
- _context.t1 = typeof _this2.getVersionList === 'function';
48615
+ _context.t1 = typeof _this3.getVersionList === 'function';
48591
48616
  if (!_context.t1) {
48592
48617
  _context.next = 15;
48593
48618
  break;
48594
48619
  }
48595
48620
  _context.next = 15;
48596
- return _this2.getVersionList();
48621
+ return _this3.getVersionList();
48597
48622
  case 15:
48598
48623
  _context.next = 10;
48599
48624
  break;
48600
48625
  case 17:
48601
48626
  _context.next = 19;
48602
- return _this2.handleItemClick();
48627
+ return _this3.handleItemClick(_this3.defaultActiveIndex);
48603
48628
  case 19:
48604
- _this2.loading = false;
48629
+ _this3.loading = false;
48605
48630
  case 20:
48606
48631
  case "end":
48607
48632
  return _context.stop();
@@ -48611,39 +48636,39 @@
48611
48636
  }))();
48612
48637
  },
48613
48638
  handleLeftScroll: function handleLeftScroll(e) {
48614
- var _this3 = this;
48639
+ var _this4 = this;
48615
48640
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee2() {
48616
48641
  var el, scrollHeight, scrollTop, clientHeight;
48617
48642
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
48618
48643
  while (1) {
48619
48644
  switch (_context2.prev = _context2.next) {
48620
48645
  case 0:
48621
- el = _this3.$refs.leftList;
48646
+ el = _this4.$refs.leftList;
48622
48647
  scrollHeight = el.scrollHeight;
48623
48648
  scrollTop = el.scrollTop;
48624
48649
  clientHeight = el.clientHeight;
48625
- if (!(!_this3.finished && clientHeight + scrollTop >= scrollHeight && !_this3.scroll)) {
48650
+ if (!(!_this4.finished && clientHeight + scrollTop >= scrollHeight && !_this4.scroll)) {
48626
48651
  _context2.next = 16;
48627
48652
  break;
48628
48653
  }
48629
- _this3.left.scroll = true;
48630
- _this3.left.loading = true;
48631
- _context2.t0 = typeof _this3.getVersionList === 'function';
48654
+ _this4.left.scroll = true;
48655
+ _this4.left.loading = true;
48656
+ _context2.t0 = typeof _this4.getVersionList === 'function';
48632
48657
  if (!_context2.t0) {
48633
48658
  _context2.next = 11;
48634
48659
  break;
48635
48660
  }
48636
48661
  _context2.next = 11;
48637
- return _this3.getVersionList().catch(function (_) {
48662
+ return _this4.getVersionList().catch(function (_) {
48638
48663
  return false;
48639
48664
  });
48640
48665
  case 11:
48641
48666
  _context2.next = 13;
48642
- return _this3.$nextTick();
48667
+ return _this4.$nextTick();
48643
48668
  case 13:
48644
48669
  el.scrollTo(0, scrollTop - 100);
48645
- _this3.left.loading = false;
48646
- _this3.left.scroll = false;
48670
+ _this4.left.loading = false;
48671
+ _this4.left.scroll = false;
48647
48672
  case 16:
48648
48673
  case "end":
48649
48674
  return _context2.stop();
@@ -48653,27 +48678,28 @@
48653
48678
  }))();
48654
48679
  },
48655
48680
  handleItemClick: function handleItemClick() {
48656
- var _this4 = this;
48681
+ var _this5 = this;
48657
48682
  var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
48658
48683
  return _asyncToGenerator( _regeneratorRuntime().mark(function _callee3() {
48659
48684
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
48660
48685
  while (1) {
48661
48686
  switch (_context3.prev = _context3.next) {
48662
48687
  case 0:
48663
- _this4.active = v;
48664
- _this4.loading = true;
48665
- _context3.t0 = typeof _this4.getVersionDetail === 'function';
48688
+ _this5.active = v;
48689
+ _this5.loading = true;
48690
+ _context3.t0 = typeof _this5.getVersionDetail === 'function';
48666
48691
  if (!_context3.t0) {
48667
48692
  _context3.next = 6;
48668
48693
  break;
48669
48694
  }
48670
48695
  _context3.next = 6;
48671
- return _this4.getVersionDetail(_this4.versionList[v]).catch(function (_) {
48696
+ return _this5.getVersionDetail(_this5.versionList[v]).catch(function (_) {
48672
48697
  return false;
48673
48698
  });
48674
48699
  case 6:
48675
- _this4.loading = false;
48676
- case 7:
48700
+ _this5.loading = false;
48701
+ _this5.$emit('selected', v, _this5.versionList[v]);
48702
+ case 8:
48677
48703
  case "end":
48678
48704
  return _context3.stop();
48679
48705
  }
@@ -48756,7 +48782,7 @@
48756
48782
  staticClass: "item-date"
48757
48783
  }, [_vm._v(_vm._s(item[_vm.versionSubTitleName]))]), item[_vm.versionTitleName] === _vm.currentVersion ? _c('span', {
48758
48784
  staticClass: "item-current"
48759
- }, [_vm._v(" " + _vm._s('当前版本') + " ")]) : _vm._e()];
48785
+ }, [_vm._v(" " + _vm._s(_vm.currentTagText || _vm.t('bk.versionDetail.currentTagText')) + " ")]) : _vm._e()];
48760
48786
  }, {
48761
48787
  "version": {
48762
48788
  item: item,