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