bk-magic-vue 2.4.8-beta.8 → 2.4.8

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.
@@ -12206,7 +12206,8 @@
12206
12206
  "disabled-date": _vm.disabledDate,
12207
12207
  "range-state": _vm.rangeState,
12208
12208
  "value": _vm.preSelecting.left ? [_vm.dates[0]] : _vm.dates,
12209
- "focused-date": _vm.focusedDate
12209
+ "focused-date": _vm.focusedDate,
12210
+ "cell-class": _vm.cellClass
12210
12211
  },
12211
12212
  on: {
12212
12213
  "change-range": _vm.handleChangeRange,
@@ -13221,7 +13222,6 @@
13221
13222
  if (this.escClose) {
13222
13223
  addEvent(document, 'keydown', this.escCloseHandler);
13223
13224
  }
13224
- console.error(this);
13225
13225
  },
13226
13226
  beforeDestroy: function beforeDestroy() {
13227
13227
  if (this.escClose) {
@@ -48326,6 +48326,21 @@
48326
48326
 
48327
48327
  setInstaller(__vue_component__$1e);
48328
48328
 
48329
+ var getElementSize = function getElementSize(node) {
48330
+ if (node === undefined) {
48331
+ return {
48332
+ height: 0,
48333
+ width: 0
48334
+ };
48335
+ }
48336
+ var computedStyle = getComputedStyle(node);
48337
+ var width = node.clientWidth - _parseFloat$2(computedStyle.paddingTop) - _parseFloat$2(computedStyle.paddingBottom);
48338
+ var height = node.clientHeight - _parseFloat$2(computedStyle.paddingLeft) - _parseFloat$2(computedStyle.paddingRight);
48339
+ return {
48340
+ height: height,
48341
+ width: width
48342
+ };
48343
+ };
48329
48344
  var script$1e = {
48330
48345
  name: 'bk-swiper',
48331
48346
  props: {
@@ -48364,7 +48379,6 @@
48364
48379
  },
48365
48380
  data: function data() {
48366
48381
  return {
48367
- swiperMainWith: 0,
48368
48382
  currentIndex: 1,
48369
48383
  isStartMove: false,
48370
48384
  isTransition: false,
@@ -48372,7 +48386,9 @@
48372
48386
  mouseDistance: 0,
48373
48387
  loopId: '',
48374
48388
  isClick: false,
48375
- realWidth: 0
48389
+ realWidth: 0,
48390
+ realHeight: 0,
48391
+ resizeObserver: {}
48376
48392
  };
48377
48393
  },
48378
48394
  computed: {
@@ -48384,6 +48400,9 @@
48384
48400
  var last = this.sourceList.slice(-1);
48385
48401
  return [].concat(_toConsumableArray(last), _toConsumableArray(this.sourceList), [first]);
48386
48402
  },
48403
+ swiperMainWith: function swiperMainWith() {
48404
+ return this.realWidth * this.dataList.length;
48405
+ },
48387
48406
  imageTransfer: function imageTransfer() {
48388
48407
  var indexMove = this.realWidth * this.currentIndex;
48389
48408
  var imageMove = indexMove - this.mouseDistance;
@@ -48398,38 +48417,11 @@
48398
48417
  },
48399
48418
  immediate: true
48400
48419
  },
48401
- height: function height(val) {
48402
- var ele = this.$refs.swiper || {
48403
- style: {
48404
- width: 0,
48405
- height: 0
48406
- },
48407
- offsetWidth: 0
48408
- };
48409
- if (+val > 0) ele.style.height = val + 'px';
48410
- },
48411
- width: function width(val) {
48412
- var ele = this.$refs.swiper || {
48413
- style: {
48414
- width: 0,
48415
- height: 0
48416
- },
48417
- offsetWidth: 0
48418
- };
48419
- this.realWidth = +val > 0 ? +val : ele.offsetWidth;
48420
- ele.style.width = this.realWidth + 'px';
48421
- },
48422
- list: function list() {
48423
- var _this = this;
48424
- this.$nextTick(function () {
48425
- _this.calcSize();
48426
- });
48420
+ height: function height() {
48421
+ this.calcSize();
48427
48422
  },
48428
- pics: function pics() {
48429
- var _this2 = this;
48430
- this.$nextTick(function () {
48431
- _this2.calcSize();
48432
- });
48423
+ width: function width() {
48424
+ this.calcSize();
48433
48425
  }
48434
48426
  },
48435
48427
  mounted: function mounted() {
@@ -48440,27 +48432,37 @@
48440
48432
  },
48441
48433
  methods: {
48442
48434
  calcSize: function calcSize() {
48443
- var ele = this.$refs.swiper || {
48444
- style: {
48445
- width: 0,
48446
- height: 0
48447
- },
48448
- offsetWidth: 0
48449
- };
48450
- if (+this.height > 0) ele.style.height = this.height + 'px';
48451
- this.realWidth = +this.width > 0 ? +this.width : ele.offsetWidth;
48452
- ele.style.width = this.realWidth + 'px';
48453
- this.swiperMainWith = this.realWidth * this.dataList.length;
48435
+ var swiperParentSize = getElementSize(this.$refs.swiper && this.$refs.swiper.parentElement);
48436
+ this.realWidth = +this.width > 0 ? this.width : swiperParentSize.width || 600;
48437
+ this.realHeight = +this.height > 0 ? this.height : swiperParentSize.height || 300;
48454
48438
  },
48455
48439
  initStatus: function initStatus() {
48456
48440
  this.calcSize();
48457
48441
  this.startLoop();
48442
+ this.watchParentSizeChange();
48458
48443
  document.addEventListener('visibilitychange', this.visChange);
48459
48444
  },
48460
48445
  destoryStatus: function destoryStatus() {
48461
48446
  this.endLoop();
48447
+ this.endWatchParentSizeChange();
48462
48448
  document.removeEventListener('visibilitychange', this.visChange);
48463
48449
  },
48450
+ watchParentSizeChange: function watchParentSizeChange() {
48451
+ var _this = this;
48452
+ var parentEle = this.$refs.swiper && this.$refs.swiper.parentElement;
48453
+ if (!parentEle || !window.ResizeObserver) {
48454
+ return;
48455
+ }
48456
+ this.resizeObserver = new ResizeObserver(function () {
48457
+ _this.calcSize();
48458
+ });
48459
+ this.resizeObserver.observe(parentEle);
48460
+ },
48461
+ endWatchParentSizeChange: function endWatchParentSizeChange() {
48462
+ if (this.resizeObserver && this.resizeObserver.disconnect) {
48463
+ this.resizeObserver.disconnect();
48464
+ }
48465
+ },
48464
48466
  goToLink: function goToLink(link) {
48465
48467
  if (this.isClick && link) window.open(link, '_blank');
48466
48468
  },
@@ -48519,13 +48521,13 @@
48519
48521
  }
48520
48522
  },
48521
48523
  startLoop: function startLoop() {
48522
- var _this3 = this;
48524
+ var _this2 = this;
48523
48525
  if (!this.isLoop) return;
48524
48526
  this.endLoop();
48525
48527
  this.loopId = window.setTimeout(function () {
48526
- _this3.isTransition = true;
48527
- _this3.changeCurrentIndex(_this3.currentIndex + 1);
48528
- _this3.startLoop();
48528
+ _this2.isTransition = true;
48529
+ _this2.changeCurrentIndex(_this2.currentIndex + 1);
48530
+ _this2.startLoop();
48529
48531
  }, this.loopTime);
48530
48532
  },
48531
48533
  endLoop: function endLoop() {
@@ -48547,8 +48549,11 @@
48547
48549
 
48548
48550
  return _vm.sourceList.length ? _c('section', {
48549
48551
  ref: "swiper",
48550
- staticClass: "bk-swiper-home",
48551
- class: _vm.extCls
48552
+ class: ['bk-swiper-home', _vm.extCls],
48553
+ style: {
48554
+ width: _vm.realWidth + "px",
48555
+ height: _vm.realHeight + "px"
48556
+ }
48552
48557
  }, [_c('hgroup', {
48553
48558
  class: [{
48554
48559
  'bk-transition': _vm.isTransition