bk-magic-vue 2.4.10-beta.1 → 2.4.10

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.
@@ -15362,9 +15362,23 @@ th.bk-table-column-selection .cell, th.bk-table-column-expand .cell, td.bk-table
15362
15362
  font-size:26px;
15363
15363
  }
15364
15364
  .bk-divider{
15365
- position:relative
15365
+ position:relative
15366
15366
  }
15367
- .bk-divider-info{
15367
+ .bk-divider.bk-divider__vertical{
15368
+ display:inline-block;
15369
+ width:0;
15370
+ height:1em;
15371
+ margin:0 8px;
15372
+ verticalAlign:middle;
15373
+ }
15374
+ .bk-divider.bk-divider__horizontal{
15375
+ display:block;
15376
+ width:100%;
15377
+ height:0;
15378
+ margin:1em 0;
15379
+ verticalAlign:middle;
15380
+ }
15381
+ .bk-divider .bk-divider-info{
15368
15382
  position:absolute;
15369
15383
  padding:0 1.4em;
15370
15384
  color:#313238;
@@ -15372,16 +15386,16 @@ th.bk-table-column-selection .cell, th.bk-table-column-expand .cell, td.bk-table
15372
15386
  -webkit-transform:translateY(-50%);
15373
15387
  transform:translateY(-50%);
15374
15388
  background-color:#fff;
15375
- }
15376
- .bk-divider-info-left{
15389
+ }
15390
+ .bk-divider .bk-divider-info-left{
15377
15391
  left:2em;
15378
15392
  }
15379
- .bk-divider-info-center{
15393
+ .bk-divider .bk-divider-info-center{
15380
15394
  left:50%;
15381
15395
  -webkit-transform:translateX(-50%) translateY(-50%);
15382
15396
  transform:translateX(-50%) translateY(-50%)
15383
15397
  }
15384
- .bk-divider-info-right{
15398
+ .bk-divider .bk-divider-info-right{
15385
15399
  right:2em;
15386
15400
  }
15387
15401
  .bk-compose-form-item{
@@ -25272,7 +25272,7 @@
25272
25272
  timer: 0,
25273
25273
  isShow: false,
25274
25274
  popInstance: null,
25275
- containerHeight: 32
25275
+ holderHeight: variable_1
25276
25276
  };
25277
25277
  },
25278
25278
  computed: {
@@ -25287,7 +25287,6 @@
25287
25287
  }
25288
25288
  },
25289
25289
  mounted: function mounted() {
25290
- this.containerHeight = this.containerHeight + _parseInt$2(variable_1, 10);
25291
25290
  var placement = "bottom".concat(this.getPlacementFix());
25292
25291
  this.popInstance = new Popper(this.$refs.refDropTrigger, this.$refs.refDropContent, {
25293
25292
  placement: placement,
@@ -25383,9 +25382,6 @@
25383
25382
  }],
25384
25383
  staticClass: "bk-dropdown-menu",
25385
25384
  class: [_vm.disabled ? 'disabled' : '', _vm.positionFixed ? '' : 'bk-dropdown-full-width', _vm.fontSizeCls, _vm.extCls],
25386
- style: {
25387
- height: _vm.containerHeight + 'px'
25388
- },
25389
25385
  attrs: {
25390
25386
  "tabindex": "0"
25391
25387
  },
@@ -25414,6 +25410,12 @@
25414
25410
  ref: "refDropTrigger",
25415
25411
  staticClass: "bk-dropdown-trigger"
25416
25412
  }, [_vm._t("dropdown-trigger")], 2), _c('div', {
25413
+ style: {
25414
+ height: _vm.holderHeight,
25415
+ width: '100%',
25416
+ position: 'absolute'
25417
+ }
25418
+ }), _c('div', {
25417
25419
  ref: "refDropContent",
25418
25420
  class: ['bk-dropdown-content', {
25419
25421
  'is-show': _vm.isShow,
@@ -29617,7 +29619,10 @@
29617
29619
  type: String,
29618
29620
  default: 'normal'
29619
29621
  },
29620
- precision: Number,
29622
+ precision: {
29623
+ type: Number,
29624
+ default: 0
29625
+ },
29621
29626
  passwordIcon: {
29622
29627
  type: Array,
29623
29628
  default: function _default() {
@@ -29670,7 +29675,15 @@
29670
29675
  inputSize: this.size,
29671
29676
  inputPasswordIcon: this.passwordIcon,
29672
29677
  inputRightPadding: '10px',
29673
- iconAreaSizeObserver: null
29678
+ iconAreaSizeObserver: null,
29679
+ validKeyCodeList: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
29680
+ 8,
29681
+ 189,
29682
+ 190,
29683
+ 38, 40, 37, 39,
29684
+ 46,
29685
+ 9
29686
+ ]
29674
29687
  };
29675
29688
  },
29676
29689
  computed: {
@@ -29822,6 +29835,7 @@
29822
29835
  max: this.max
29823
29836
  };
29824
29837
  _extends(outputAttr, defaultAttr, numberAttr);
29838
+ outputAttr.type = 'text';
29825
29839
  break;
29826
29840
  case 'textarea':
29827
29841
  var txtAttr = {
@@ -29926,7 +29940,53 @@
29926
29940
  this.$emit('keypress', value, event);
29927
29941
  },
29928
29942
  handlerKeydown: function handlerKeydown(event) {
29929
- var value = event.target.value;
29943
+ var keyCode = event.keyCode;
29944
+ var target = event.currentTarget;
29945
+ var value = target.value;
29946
+ if (this.inputType === 'number') {
29947
+ if (this.validKeyCodeList.indexOf(keyCode) < 0) {
29948
+ event.stopPropagation();
29949
+ event.preventDefault();
29950
+ return false;
29951
+ }
29952
+ if (keyCode === 190) {
29953
+ if (this.precision === 0) {
29954
+ event.stopPropagation();
29955
+ event.preventDefault();
29956
+ return false;
29957
+ }
29958
+ if (String(value).trim()) {
29959
+ if (value.indexOf('.') >= 0) {
29960
+ event.stopPropagation();
29961
+ event.preventDefault();
29962
+ return false;
29963
+ }
29964
+ }
29965
+ }
29966
+ if (event.keyCode === 189) {
29967
+ if (String(value).trim()) {
29968
+ if (value.indexOf('-') >= 0) {
29969
+ event.stopPropagation();
29970
+ event.preventDefault();
29971
+ return false;
29972
+ }
29973
+ if (document.getSelection().type !== 'Range') {
29974
+ if (target.selectionEnd !== 0) {
29975
+ event.stopPropagation();
29976
+ event.preventDefault();
29977
+ return false;
29978
+ }
29979
+ }
29980
+ }
29981
+ }
29982
+ if (keyCode === 38) {
29983
+ event.preventDefault();
29984
+ this.handleNumberAdd(event);
29985
+ } else if (keyCode === 40) {
29986
+ event.preventDefault();
29987
+ this.handleNumberDelete(event);
29988
+ }
29989
+ }
29930
29990
  this.$emit('keydown', value, event);
29931
29991
  },
29932
29992
  handlerFocus: function handlerFocus(event) {
@@ -32759,6 +32819,10 @@
32759
32819
  default: true
32760
32820
  },
32761
32821
  allowCreate: Boolean,
32822
+ allowEnter: {
32823
+ type: Boolean,
32824
+ default: true
32825
+ },
32762
32826
  disabled: Boolean,
32763
32827
  readonly: Boolean,
32764
32828
  loading: Boolean,
@@ -33137,7 +33201,7 @@
33137
33201
  var popover = this.getPopoverInstance();
33138
33202
  popover.set({
33139
33203
  onShown: function onShown() {
33140
- if (_this6.searchable && !_this6.allowCreate) {
33204
+ if (_this6.searchable) {
33141
33205
  _this6.$refs.searchInput.focus();
33142
33206
  }
33143
33207
  }
@@ -33305,6 +33369,58 @@
33305
33369
  this.close();
33306
33370
  this.$refs.bkSelect && this.$refs.bkSelect.focus();
33307
33371
  },
33372
+ ensureSearch: function ensureSearch() {
33373
+ var _this12 = this;
33374
+ if (!this.allowEnter) {
33375
+ return false;
33376
+ }
33377
+ var option = {};
33378
+ this.options.some(function (item) {
33379
+ var searchValue = _this12.searchValue;
33380
+ var data = item;
33381
+ if (item.$options) {
33382
+ data = item.$options.propsData;
33383
+ }
33384
+ var name = data.name;
33385
+ if (typeof name === 'string' && _this12.searchWithPinyin) {
33386
+ var pinyinList = pinyin.parse(name).map(function (v) {
33387
+ if (v.type === 2) {
33388
+ return v.target.toLowerCase();
33389
+ }
33390
+ return v.target;
33391
+ });
33392
+ var pinyinStr = pinyinList.reduce(function (res, cur) {
33393
+ return res + cur[0];
33394
+ }, '');
33395
+ if (pinyinList.join('').indexOf(searchValue) !== -1 || pinyinStr.indexOf(searchValue) !== -1) {
33396
+ option = data;
33397
+ return true;
33398
+ }
33399
+ return pinyinList.join('').indexOf(searchValue) !== -1 || pinyinStr.indexOf(searchValue) !== -1;
33400
+ } else {
33401
+ if ("".concat(name).includes(_this12.searchValue)) {
33402
+ option = data;
33403
+ return true;
33404
+ }
33405
+ }
33406
+ return false;
33407
+ });
33408
+ if (option) {
33409
+ if (this.multiple && this.selected.includes(option.id)) {
33410
+ return false;
33411
+ }
33412
+ this.selectOption(option);
33413
+ } else {
33414
+ if (this.allowCreate) {
33415
+ this.$refs.createInput.value = this.searchValue;
33416
+ this.handleInputChange({
33417
+ target: {
33418
+ value: this.searchValue
33419
+ }
33420
+ });
33421
+ }
33422
+ }
33423
+ },
33308
33424
  handleTabRemove: function handleTabRemove(options) {
33309
33425
  this.$emit('tab-remove', options);
33310
33426
  },
@@ -33429,6 +33545,7 @@
33429
33545
  "create-tag": _vm.handleCreateTag
33430
33546
  }
33431
33547
  }) : [_vm.allowCreate && !_vm.multiple ? _c('input', {
33548
+ ref: "createInput",
33432
33549
  staticClass: "bk-select-name",
33433
33550
  class: _vm.fontSizeCls,
33434
33551
  attrs: {
@@ -33477,6 +33594,12 @@
33477
33594
  },
33478
33595
  on: {
33479
33596
  "keydown": [function ($event) {
33597
+ if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
33598
+ return null;
33599
+ }
33600
+
33601
+ return _vm.ensureSearch($event);
33602
+ }, function ($event) {
33480
33603
  if (!('button' in $event) && _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")) {
33481
33604
  return null;
33482
33605
  }
@@ -35466,9 +35589,7 @@
35466
35589
  name: {
35467
35590
  type: [String, Number],
35468
35591
  default: function _default() {
35469
- var seed = 0;
35470
- var now = now$1();
35471
- return "bk_radio_".concat(now, "_").concat(seed++);
35592
+ return "bk_radio_".concat(uuid());
35472
35593
  }
35473
35594
  }
35474
35595
  },
@@ -56009,20 +56130,10 @@
56009
56130
  style: function style() {
56010
56131
  if (this.direction === 'vertical') {
56011
56132
  return {
56012
- display: 'inline-block',
56013
- width: 0,
56014
- height: '1em',
56015
- margin: '0 8px',
56016
- verticalAlign: 'middle',
56017
56133
  borderRight: "".concat(this.width, "px ").concat(this.type, " ").concat(this.color)
56018
56134
  };
56019
56135
  }
56020
56136
  return {
56021
- display: 'block',
56022
- width: '100%',
56023
- height: 0,
56024
- margin: '1em 0',
56025
- verticalAlign: 'middle',
56026
56137
  borderBottom: "".concat(this.width, "px ").concat(this.type, " ").concat(this.color)
56027
56138
  };
56028
56139
  }
@@ -56042,6 +56153,7 @@
56042
56153
 
56043
56154
  return _c('div', {
56044
56155
  staticClass: "bk-divider",
56156
+ class: _vm.direction === 'horizontal' ? 'bk-divider__horizontal' : 'bk-divider__vertical',
56045
56157
  style: _vm.style
56046
56158
  }, [_vm.direction === 'horizontal' ? _c('div', {
56047
56159
  class: ['bk-divider-info', "bk-divider-info-" + _vm.align]