bk-magic-vue 2.5.10-beta.3 → 2.5.10-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.
- package/dist/bk-magic-vue.js +117 -21
- package/dist/bk-magic-vue.min.css +1 -1
- package/dist/bk-magic-vue.min.css.gz +0 -0
- package/dist/bk-magic-vue.min.css.map +1 -1
- package/dist/bk-magic-vue.min.js +1 -1
- package/dist/bk-magic-vue.min.js.gz +0 -0
- package/dist/bk-magic-vue.min.js.map +1 -1
- package/lib/option.js +10 -2
- package/lib/pagination.js +117 -21
- package/lib/select.js +117 -21
- package/lib/table.js +117 -21
- package/lib/ui/bk-magic-vue.min.css +1 -1
- package/lib/ui/bk-magic-vue.min.css.gz +0 -0
- package/lib/ui/bk-magic-vue.min.css.map +1 -1
- package/lib/ui/button.min.css +1 -1
- package/lib/ui/button.min.css.map +1 -1
- package/lib/ui/cascade.min.css +1 -1
- package/lib/ui/cascade.min.css.map +1 -1
- package/lib/ui/common.min.css +1 -1
- package/lib/ui/common.min.css.map +1 -1
- package/lib/ui/diff.min.css +1 -1
- package/lib/ui/diff.min.css.map +1 -1
- package/lib/ui/form.min.css +1 -1
- package/lib/ui/form.min.css.map +1 -1
- package/lib/ui/message.min.css +1 -1
- package/lib/ui/message.min.css.map +1 -1
- package/lib/ui/pagination.min.css +1 -1
- package/lib/ui/pagination.min.css.map +1 -1
- package/lib/ui/process.min.css +1 -1
- package/lib/ui/process.min.css.map +1 -1
- package/lib/ui/reset.min.css +1 -1
- package/lib/ui/reset.min.css.map +1 -1
- package/lib/ui/select.min.css +1 -1
- package/lib/ui/select.min.css.map +1 -1
- package/lib/ui/steps.min.css +1 -1
- package/lib/ui/steps.min.css.map +1 -1
- package/lib/ui/swiper.min.css +1 -1
- package/lib/ui/swiper.min.css.map +1 -1
- package/lib/ui/switcher.min.css +1 -1
- package/lib/ui/switcher.min.css.map +1 -1
- package/lib/ui/tab.min.css +1 -1
- package/lib/ui/tab.min.css.map +1 -1
- package/lib/ui/table.min.css +1 -1
- package/lib/ui/table.min.css.map +1 -1
- package/lib/ui/tag-input.min.css +1 -1
- package/lib/ui/tag-input.min.css.map +1 -1
- package/lib/ui/tag.min.css +1 -1
- package/lib/ui/tag.min.css.map +1 -1
- package/lib/ui/time-picker.min.css +1 -1
- package/lib/ui/time-picker.min.css.map +1 -1
- package/lib/ui/tree.min.css +1 -1
- package/lib/ui/tree.min.css.map +1 -1
- package/lib/ui/upload.min.css +1 -1
- package/lib/ui/upload.min.css.map +1 -1
- package/package.json +1 -1
package/dist/bk-magic-vue.js
CHANGED
|
@@ -32339,6 +32339,12 @@
|
|
|
32339
32339
|
if (!select.multiple) {
|
|
32340
32340
|
select.close();
|
|
32341
32341
|
}
|
|
32342
|
+
},
|
|
32343
|
+
handleMouseEnter: function handleMouseEnter() {
|
|
32344
|
+
this.select.activeOptionID = this.id;
|
|
32345
|
+
},
|
|
32346
|
+
handleMouseLeave: function handleMouseLeave() {
|
|
32347
|
+
this.select.activeOptionID = '';
|
|
32342
32348
|
}
|
|
32343
32349
|
}
|
|
32344
32350
|
};
|
|
@@ -32362,10 +32368,12 @@
|
|
|
32362
32368
|
class: {
|
|
32363
32369
|
'is-selected': _vm.isSelected,
|
|
32364
32370
|
'is-disabled': _vm.disabled,
|
|
32365
|
-
'is-highlight': _vm.isHighlight
|
|
32371
|
+
'is-highlight': _vm.isHighlight || _vm.select.activeOptionID === _vm.id
|
|
32366
32372
|
},
|
|
32367
32373
|
on: {
|
|
32368
|
-
"click": _vm.handleOptionClick
|
|
32374
|
+
"click": _vm.handleOptionClick,
|
|
32375
|
+
"mouseenter": _vm.handleMouseEnter,
|
|
32376
|
+
"mouseleave": _vm.handleMouseLeave
|
|
32369
32377
|
}
|
|
32370
32378
|
}, [_c('div', {
|
|
32371
32379
|
staticClass: "bk-option-content"
|
|
@@ -34208,7 +34216,9 @@
|
|
|
34208
34216
|
renderPopoverOptions: {},
|
|
34209
34217
|
popoverDistance: 10 + _parseInt$2(variable_1),
|
|
34210
34218
|
optionList: null,
|
|
34211
|
-
allowCreateData: []
|
|
34219
|
+
allowCreateData: [],
|
|
34220
|
+
activeOptionID: undefined,
|
|
34221
|
+
hasInitKeyDownEvent: false
|
|
34212
34222
|
};
|
|
34213
34223
|
},
|
|
34214
34224
|
computed: {
|
|
@@ -34330,6 +34340,7 @@
|
|
|
34330
34340
|
} else {
|
|
34331
34341
|
_this2.search();
|
|
34332
34342
|
}
|
|
34343
|
+
_this2.initActiveOptionID();
|
|
34333
34344
|
}, 100);
|
|
34334
34345
|
},
|
|
34335
34346
|
selected: function selected(value, oldValue) {
|
|
@@ -34477,11 +34488,22 @@
|
|
|
34477
34488
|
});
|
|
34478
34489
|
},
|
|
34479
34490
|
handleDropdownShow: function handleDropdownShow() {
|
|
34491
|
+
var _this7 = this;
|
|
34492
|
+
if (!this.hasInitKeyDownEvent) {
|
|
34493
|
+
document.addEventListener('keydown', this.handleDocumentKeydown);
|
|
34494
|
+
setTimeout(function () {
|
|
34495
|
+
_this7.initActiveOptionID();
|
|
34496
|
+
_this7.scrollActiveOptionIntoView();
|
|
34497
|
+
}, 50);
|
|
34498
|
+
this.hasInitKeyDownEvent = true;
|
|
34499
|
+
}
|
|
34480
34500
|
this.defaultWidth = this.$el.offsetWidth;
|
|
34481
34501
|
if (this.autoHeight) this.focus = true;
|
|
34482
34502
|
},
|
|
34483
34503
|
handleDropdownHide: function handleDropdownHide() {
|
|
34504
|
+
document.removeEventListener('keydown', this.handleDocumentKeydown);
|
|
34484
34505
|
this.focus = false;
|
|
34506
|
+
this.hasInitKeyDownEvent = false;
|
|
34485
34507
|
},
|
|
34486
34508
|
handleInputChange: function handleInputChange(e) {
|
|
34487
34509
|
var value = e.target.value;
|
|
@@ -34501,7 +34523,7 @@
|
|
|
34501
34523
|
}
|
|
34502
34524
|
},
|
|
34503
34525
|
selectOption: function selectOption(option) {
|
|
34504
|
-
var
|
|
34526
|
+
var _this8 = this;
|
|
34505
34527
|
if (this.multiple) {
|
|
34506
34528
|
if (!this.shouldUpdate) {
|
|
34507
34529
|
this.selectedOptions.push(option);
|
|
@@ -34515,12 +34537,12 @@
|
|
|
34515
34537
|
this.close();
|
|
34516
34538
|
}
|
|
34517
34539
|
this.$nextTick(function () {
|
|
34518
|
-
|
|
34540
|
+
_this8.$emit('selected', _this8.selected, _this8.selectedOptions);
|
|
34519
34541
|
});
|
|
34520
34542
|
this.focusTagInput();
|
|
34521
34543
|
},
|
|
34522
34544
|
unselectOption: function unselectOption(option) {
|
|
34523
|
-
var
|
|
34545
|
+
var _this9 = this;
|
|
34524
34546
|
if (this.multiple) {
|
|
34525
34547
|
if (!this.shouldUpdate) {
|
|
34526
34548
|
this.selectedOptions = this.selectedOptions.filter(function (selectedOption) {
|
|
@@ -34535,16 +34557,16 @@
|
|
|
34535
34557
|
this.reset();
|
|
34536
34558
|
}
|
|
34537
34559
|
this.$nextTick(function () {
|
|
34538
|
-
|
|
34560
|
+
_this9.$emit('selected', _this9.selected, _this9.selectedOptions);
|
|
34539
34561
|
});
|
|
34540
34562
|
},
|
|
34541
34563
|
reset: function reset() {
|
|
34542
|
-
var
|
|
34564
|
+
var _this10 = this;
|
|
34543
34565
|
this.selectedOptions = this.multiple ? [] : null;
|
|
34544
34566
|
var prevSelected = this.multiple ? _toConsumableArray(this.selected) : this.selected;
|
|
34545
34567
|
this.selected = this.multiple ? [] : '';
|
|
34546
34568
|
this.$nextTick(function () {
|
|
34547
|
-
|
|
34569
|
+
_this10.$emit('clear', prevSelected);
|
|
34548
34570
|
});
|
|
34549
34571
|
},
|
|
34550
34572
|
selectAll: function selectAll() {
|
|
@@ -34555,7 +34577,7 @@
|
|
|
34555
34577
|
});
|
|
34556
34578
|
},
|
|
34557
34579
|
search: function search() {
|
|
34558
|
-
var
|
|
34580
|
+
var _this11 = this;
|
|
34559
34581
|
this.searchLoading = true;
|
|
34560
34582
|
var searchValue = String(this.searchValue).trim();
|
|
34561
34583
|
if (searchValue) {
|
|
@@ -34563,13 +34585,13 @@
|
|
|
34563
34585
|
searchValue = searchValue.toLowerCase();
|
|
34564
34586
|
}
|
|
34565
34587
|
this.options.forEach(function (option) {
|
|
34566
|
-
if (
|
|
34588
|
+
if (_this11.searchIgnoreCase) {
|
|
34567
34589
|
option.unmatched = option.lowerName.indexOf(searchValue) < 0;
|
|
34568
34590
|
} else {
|
|
34569
34591
|
option.unmatched = option.name.indexOf(searchValue) < 0;
|
|
34570
34592
|
}
|
|
34571
|
-
if (option.unmatched &&
|
|
34572
|
-
var pinyinList = pinyin.parse(
|
|
34593
|
+
if (option.unmatched && _this11.searchWithPinyin) {
|
|
34594
|
+
var pinyinList = pinyin.parse(_this11.searchIgnoreCase ? option.lowerName : option.name).map(function (v) {
|
|
34573
34595
|
if (v.type === 2) {
|
|
34574
34596
|
return v.target.toLowerCase();
|
|
34575
34597
|
}
|
|
@@ -34590,16 +34612,16 @@
|
|
|
34590
34612
|
this.searchLoading = false;
|
|
34591
34613
|
},
|
|
34592
34614
|
remoteSearch: function remoteSearch() {
|
|
34593
|
-
var
|
|
34615
|
+
var _this12 = this;
|
|
34594
34616
|
return _asyncToGenerator( _regeneratorRuntime().mark(function _callee() {
|
|
34595
34617
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34596
34618
|
while (1) {
|
|
34597
34619
|
switch (_context.prev = _context.next) {
|
|
34598
34620
|
case 0:
|
|
34599
34621
|
_context.prev = 0;
|
|
34600
|
-
|
|
34622
|
+
_this12.searchLoading = true;
|
|
34601
34623
|
_context.next = 4;
|
|
34602
|
-
return
|
|
34624
|
+
return _this12.remoteMethod(_this12.searchValue);
|
|
34603
34625
|
case 4:
|
|
34604
34626
|
_context.next = 9;
|
|
34605
34627
|
break;
|
|
@@ -34609,7 +34631,7 @@
|
|
|
34609
34631
|
console.error(_context.t0);
|
|
34610
34632
|
case 9:
|
|
34611
34633
|
_context.prev = 9;
|
|
34612
|
-
|
|
34634
|
+
_this12.searchLoading = false;
|
|
34613
34635
|
return _context.finish(9);
|
|
34614
34636
|
case 12:
|
|
34615
34637
|
case "end":
|
|
@@ -34639,19 +34661,19 @@
|
|
|
34639
34661
|
this.$refs.bkSelect && this.$refs.bkSelect.focus();
|
|
34640
34662
|
},
|
|
34641
34663
|
ensureSearch: function ensureSearch() {
|
|
34642
|
-
var
|
|
34664
|
+
var _this13 = this;
|
|
34643
34665
|
if (!this.allowEnter) {
|
|
34644
34666
|
return false;
|
|
34645
34667
|
}
|
|
34646
34668
|
var option = {};
|
|
34647
34669
|
this.options.some(function (item) {
|
|
34648
|
-
var searchValue =
|
|
34670
|
+
var searchValue = _this13.searchValue;
|
|
34649
34671
|
var data = item;
|
|
34650
34672
|
if (item.$options) {
|
|
34651
34673
|
data = item.$options.propsData;
|
|
34652
34674
|
}
|
|
34653
34675
|
var name = data.name;
|
|
34654
|
-
if (typeof name === 'string' &&
|
|
34676
|
+
if (typeof name === 'string' && _this13.searchWithPinyin) {
|
|
34655
34677
|
var pinyinList = pinyin.parse(name).map(function (v) {
|
|
34656
34678
|
if (v.type === 2) {
|
|
34657
34679
|
return v.target.toLowerCase();
|
|
@@ -34667,7 +34689,7 @@
|
|
|
34667
34689
|
}
|
|
34668
34690
|
return pinyinList.join('').indexOf(searchValue) !== -1 || pinyinStr.indexOf(searchValue) !== -1;
|
|
34669
34691
|
} else {
|
|
34670
|
-
if ("".concat(name).includes(
|
|
34692
|
+
if ("".concat(name).includes(_this13.searchValue)) {
|
|
34671
34693
|
option = data;
|
|
34672
34694
|
return true;
|
|
34673
34695
|
}
|
|
@@ -34715,6 +34737,80 @@
|
|
|
34715
34737
|
},
|
|
34716
34738
|
focusTagInput: function focusTagInput() {
|
|
34717
34739
|
this.$refs.bkSelectTag && this.$refs.bkSelectTag.focusInput();
|
|
34740
|
+
},
|
|
34741
|
+
isInViewPort: function isInViewPort(el, client) {
|
|
34742
|
+
if (!el || !client) return true;
|
|
34743
|
+
var _el$getBoundingClient = el.getBoundingClientRect(),
|
|
34744
|
+
elTop = _el$getBoundingClient.top,
|
|
34745
|
+
elBottom = _el$getBoundingClient.bottom;
|
|
34746
|
+
var _client$getBoundingCl = client.getBoundingClientRect(),
|
|
34747
|
+
clientTop = _client$getBoundingCl.top,
|
|
34748
|
+
clientBottom = _client$getBoundingCl.bottom;
|
|
34749
|
+
return elTop >= clientTop && elBottom <= clientBottom;
|
|
34750
|
+
},
|
|
34751
|
+
scrollActiveOptionIntoView: function scrollActiveOptionIntoView() {
|
|
34752
|
+
var optionsDom = this.$refs.optionList.querySelectorAll('.is-selected');
|
|
34753
|
+
if (!optionsDom) return;
|
|
34754
|
+
optionsDom[0].scrollIntoView({
|
|
34755
|
+
block: 'nearest'
|
|
34756
|
+
});
|
|
34757
|
+
},
|
|
34758
|
+
initActiveOptionID: function initActiveOptionID() {
|
|
34759
|
+
var firstSelectedID = isArray$1(this.selected) ? this.selected[0] : this.selected;
|
|
34760
|
+
var option = this.optionsMap[firstSelectedID];
|
|
34761
|
+
if (option && !option.disabled) {
|
|
34762
|
+
this.activeOptionID = firstSelectedID;
|
|
34763
|
+
} else {
|
|
34764
|
+
var _option = this.options.find(function (option) {
|
|
34765
|
+
return !option.disabled;
|
|
34766
|
+
}) || {};
|
|
34767
|
+
this.activeOptionID = _option.id || '';
|
|
34768
|
+
}
|
|
34769
|
+
},
|
|
34770
|
+
handleDocumentKeydown: function handleDocumentKeydown(e) {
|
|
34771
|
+
var _this14 = this;
|
|
34772
|
+
if (this.disabled || !this.options.length) return;
|
|
34773
|
+
var availableOptions = this.options.filter(function (option) {
|
|
34774
|
+
return !option.disabled;
|
|
34775
|
+
});
|
|
34776
|
+
var index = availableOptions.findIndex(function (option) {
|
|
34777
|
+
return option.id === _this14.activeOptionID;
|
|
34778
|
+
});
|
|
34779
|
+
switch (e.code) {
|
|
34780
|
+
case 'ArrowUp':
|
|
34781
|
+
case 'ArrowDown':
|
|
34782
|
+
{
|
|
34783
|
+
e.preventDefault();
|
|
34784
|
+
e.stopPropagation();
|
|
34785
|
+
this.$refs.searchInput && this.$refs.searchInput.blur();
|
|
34786
|
+
var activeIndex = 0;
|
|
34787
|
+
if (e.code === 'ArrowDown') {
|
|
34788
|
+
activeIndex = index >= availableOptions.length - 1 ? 0 : index + 1;
|
|
34789
|
+
} else {
|
|
34790
|
+
activeIndex = index === 0 ? availableOptions.length - 1 : index - 1;
|
|
34791
|
+
}
|
|
34792
|
+
if (availableOptions[activeIndex] && availableOptions[activeIndex].$el && !this.isInViewPort(availableOptions[activeIndex].$el, this.$refs.optionList)) {
|
|
34793
|
+
availableOptions[activeIndex].$el.scrollIntoView({
|
|
34794
|
+
block: 'nearest'
|
|
34795
|
+
});
|
|
34796
|
+
}
|
|
34797
|
+
this.activeOptionID = availableOptions[activeIndex].id;
|
|
34798
|
+
break;
|
|
34799
|
+
}
|
|
34800
|
+
case 'NumpadEnter':
|
|
34801
|
+
case 'Enter':
|
|
34802
|
+
{
|
|
34803
|
+
var value = e.target.value;
|
|
34804
|
+
if (this.allowCreate && value || e.target === this.$refs.searchInput) return;
|
|
34805
|
+
var option = this.optionsMap[this.activeOptionID];
|
|
34806
|
+
if (option.isSelected) {
|
|
34807
|
+
this.unselectOption(option);
|
|
34808
|
+
} else {
|
|
34809
|
+
this.selectOption(option);
|
|
34810
|
+
}
|
|
34811
|
+
break;
|
|
34812
|
+
}
|
|
34813
|
+
}
|
|
34718
34814
|
}
|
|
34719
34815
|
}
|
|
34720
34816
|
};
|