bk-magic-vue 2.4.6 → 2.4.7

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/lib/button.js CHANGED
@@ -5,105 +5,80 @@
5
5
  }(this, function (exports) { 'use strict';
6
6
 
7
7
  var script = {
8
- name: 'bk-button',
8
+ name: 'bk-spin',
9
9
  props: {
10
10
  theme: {
11
11
  type: String,
12
- default: 'default',
12
+ default: 'primary',
13
13
  validator: function validator(value) {
14
- if (['default', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
14
+ if (!['primary', 'warning', 'success', 'danger', 'info'].includes(value)) {
15
15
  console.error("theme property is not valid: '".concat(value, "'"));
16
16
  return false;
17
17
  }
18
18
  return true;
19
19
  }
20
20
  },
21
- hoverTheme: {
22
- type: String,
23
- default: '',
24
- validator: function validator(value) {
25
- if (['', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
26
- console.error("hoverTheme property is not valid: '".concat(value, "'"));
27
- return false;
28
- }
29
- return true;
30
- }
31
- },
32
21
  size: {
33
22
  type: String,
34
- default: 'normal',
23
+ default: 'small',
35
24
  validator: function validator(value) {
36
- if (['small', 'normal', 'large'].indexOf(value) < 0) {
25
+ if (!['large', 'normal', 'small', 'mini'].includes(value)) {
37
26
  console.error("size property is not valid: '".concat(value, "'"));
38
27
  return false;
39
28
  }
40
29
  return true;
41
30
  }
42
31
  },
43
- title: {
32
+ icon: {
44
33
  type: String,
45
34
  default: ''
46
35
  },
47
- icon: String,
48
- iconRight: String,
49
- disabled: Boolean,
50
- loading: Boolean,
51
- outline: Boolean,
52
- text: Boolean,
53
- nativeType: {
54
- type: String,
55
- default: 'button'
56
- },
57
36
  extCls: {
58
37
  type: String,
59
38
  default: ''
39
+ },
40
+ placement: {
41
+ type: String,
42
+ default: 'bottom',
43
+ validator: function validator(value) {
44
+ if (!['bottom', 'right'].includes(value)) {
45
+ console.error("placement property is not valid: '".concat(value, "'"));
46
+ return false;
47
+ }
48
+ return true;
49
+ }
50
+ },
51
+ spinning: {
52
+ type: Boolean,
53
+ default: true
60
54
  }
61
55
  },
62
56
  data: function data() {
63
- return {
64
- showSlot: true
65
- };
57
+ return {};
66
58
  },
67
59
  computed: {
68
- iconType: function iconType() {
69
- var icon = this.icon || '';
70
- if (icon) {
71
- if (icon.indexOf('icon') === 0) {
72
- icon = icon.replace(/^(icon-)/, '');
73
- }
74
- }
75
- return icon;
60
+ dotClass: function dotClass() {
61
+ var dotClass = ["bk-spin-rotation", "bk-spin-rotation-".concat(this.size), "bk-spin-rotation-".concat(this.theme)];
62
+ !this.spinning && dotClass.push("bk-spin-rotation-".concat(this.theme, "-wait"));
63
+ this.placement === 'right' && dotClass.push("bk-spin-rotation-flex");
64
+ this.placement === 'bottom' && dotClass.push("bk-spin-rotation-margin");
65
+ return dotClass;
76
66
  },
77
- iconRightType: function iconRightType() {
78
- var iconRight = this.iconRight || '';
79
- if (iconRight) {
80
- if (iconRight.indexOf('icon') === 0) {
81
- iconRight = iconRight.replace(/^(icon-)/, '');
82
- }
83
- }
84
- return iconRight;
67
+ slotTypeClass: function slotTypeClass() {
68
+ var slotType = ["rotate"];
69
+ this.$slots.default && this.placement === 'right' && slotType.push("slots-".concat(this.placement, "-rotate"));
70
+ return slotType;
85
71
  },
86
- themeType: function themeType() {
87
- if (this.text) {
88
- if (this.theme === 'default') {
89
- return 'primary';
90
- }
91
- }
92
- return this.theme;
72
+ iconClass: function iconClass() {
73
+ var iconClass = ["bk-spin-icon", "bk-spin-icon-".concat(this.size), "bk-spin-icon-".concat(this.theme)];
74
+ !this.spinning && iconClass.push("bk-spin-icon-wait");
75
+ this.placement === 'right' && iconClass.push("bk-display-flex");
76
+ return iconClass;
93
77
  },
94
- buttonCls: function buttonCls() {
95
- return ["bk-".concat(this.themeType), "bk-button-".concat(this.size), this.hoverTheme ? "bk-button-hover bk-".concat(this.hoverTheme) : this.text ? 'bk-button-text' : 'bk-button', this.disabled ? 'is-disabled' : '', this.loading ? 'is-loading' : '', this.outline ? 'is-outline' : '', !this.showSlot ? 'no-slot' : ''];
96
- }
97
- },
98
- mounted: function mounted() {
99
- this.showSlot = this.$slots.default !== undefined;
100
- },
101
- methods: {
102
- handleClick: function handleClick(e) {
103
- if (!this.disabled && !this.loading) {
104
- this.$emit('click', e);
105
- this.$el.blur();
106
- }
78
+ slotClass: function slotClass() {
79
+ var slotClass = ["bk-spin-title", "bk-spin-title-".concat(this.placement)];
80
+ this.placement === 'right' && slotClass.push("bk-spin-title-".concat(this.size), "bk-display-flex");
81
+ return slotClass;
107
82
  }
108
83
  }
109
84
  };
@@ -178,39 +153,49 @@
178
153
 
179
154
  var _c = _vm._self._c || _h;
180
155
 
181
- return _c('button', _vm._b({
182
- class: [_vm.buttonCls, _vm.extCls],
156
+ return _c('transition', {
183
157
  attrs: {
184
- "title": _vm.title,
185
- "disabled": _vm.disabled,
186
- "type": _vm.nativeType
187
- },
188
- on: {
189
- "click": _vm.handleClick
158
+ "name": "fade"
190
159
  }
191
- }, 'button', _vm.$attrs, false), [_vm.loading ? _c('div', {
192
- staticClass: "bk-button-loading"
193
160
  }, [_c('div', {
194
- staticClass: "bounce1"
161
+ class: ['bk-spin', _vm.extCls]
162
+ }, [_c('div', {
163
+ style: {
164
+ display: _vm.placement === 'right' ? 'flex' : ''
165
+ }
166
+ }, [!_vm.icon ? _c('div', {
167
+ class: [_vm.dotClass]
168
+ }, [_c('div', {
169
+ staticClass: "rotate1",
170
+ class: _vm.slotTypeClass
195
171
  }), _c('div', {
196
- staticClass: "bounce2"
172
+ staticClass: "rotate2",
173
+ class: _vm.slotTypeClass
197
174
  }), _c('div', {
198
- staticClass: "bounce3"
175
+ staticClass: "rotate3",
176
+ class: _vm.slotTypeClass
199
177
  }), _c('div', {
200
- staticClass: "bounce4"
201
- })]) : _vm._e(), _c('div', {
202
- class: _vm.loading ? 'bk-loading-wrapper' : ''
203
- }, [_vm.iconType ? _c('i', {
204
- staticClass: "bk-icon left-icon",
205
- class: ['icon-' + _vm.iconType, _vm.iconType === 'loading' ? 'bk-button-icon-loading' : '']
206
- }, [_vm.iconType === 'loading' ? [_c('span', {
207
- staticClass: "loading"
208
- })] : _vm._e()], 2) : _vm._e(), _c('span', [_vm._t("default")], 2), _vm.iconRightType ? _c('i', {
209
- staticClass: "bk-icon right-icon",
210
- class: ['icon-' + _vm.iconRightType, _vm.iconRightType === 'loading' ? 'bk-button-icon-loading' : '']
211
- }, [_vm.iconRightType === 'loading' ? [_c('span', {
212
- staticClass: "loading"
213
- })] : _vm._e()], 2) : _vm._e()])]);
178
+ staticClass: "rotate4",
179
+ class: _vm.slotTypeClass
180
+ }), _c('div', {
181
+ staticClass: "rotate5",
182
+ class: _vm.slotTypeClass
183
+ }), _c('div', {
184
+ staticClass: "rotate6",
185
+ class: _vm.slotTypeClass
186
+ }), _c('div', {
187
+ staticClass: "rotate7",
188
+ class: _vm.slotTypeClass
189
+ }), _c('div', {
190
+ staticClass: "rotate8",
191
+ class: _vm.slotTypeClass
192
+ })]) : _vm._e(), _vm.icon ? _c('div', {
193
+ class: [_vm.iconClass]
194
+ }, [_c('i', {
195
+ class: ['bk-icon', 'icon-' + _vm.icon]
196
+ })]) : _vm._e(), _vm.$slots.default ? _c('div', {
197
+ class: [_vm.slotClass]
198
+ }, [_vm._t("default")], 2) : _vm._e()])])]);
214
199
  };
215
200
 
216
201
  var __vue_staticRenderFns__ = [];
@@ -544,7 +529,191 @@
544
529
 
545
530
  setInstaller(__vue_component__);
546
531
 
547
- exports.default = __vue_component__;
532
+ var script$1 = {
533
+ name: 'bk-button',
534
+ components: {
535
+ BkSpin: __vue_component__
536
+ },
537
+ props: {
538
+ theme: {
539
+ type: String,
540
+ default: 'default',
541
+ validator: function validator(value) {
542
+ if (['default', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
543
+ console.error("theme property is not valid: '".concat(value, "'"));
544
+ return false;
545
+ }
546
+ return true;
547
+ }
548
+ },
549
+ hoverTheme: {
550
+ type: String,
551
+ default: '',
552
+ validator: function validator(value) {
553
+ if (['', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
554
+ console.error("hoverTheme property is not valid: '".concat(value, "'"));
555
+ return false;
556
+ }
557
+ return true;
558
+ }
559
+ },
560
+ size: {
561
+ type: String,
562
+ default: 'normal',
563
+ validator: function validator(value) {
564
+ if (['small', 'normal', 'large'].indexOf(value) < 0) {
565
+ console.error("size property is not valid: '".concat(value, "'"));
566
+ return false;
567
+ }
568
+ return true;
569
+ }
570
+ },
571
+ title: {
572
+ type: String,
573
+ default: ''
574
+ },
575
+ icon: String,
576
+ iconRight: String,
577
+ disabled: Boolean,
578
+ loading: Boolean,
579
+ outline: Boolean,
580
+ text: Boolean,
581
+ nativeType: {
582
+ type: String,
583
+ default: 'button'
584
+ },
585
+ extCls: {
586
+ type: String,
587
+ default: ''
588
+ }
589
+ },
590
+ data: function data() {
591
+ return {
592
+ showSlot: true
593
+ };
594
+ },
595
+ computed: {
596
+ iconType: function iconType() {
597
+ var icon = this.icon || '';
598
+ if (icon) {
599
+ if (icon.indexOf('icon') === 0) {
600
+ icon = icon.replace(/^(icon-)/, '');
601
+ }
602
+ }
603
+ return icon;
604
+ },
605
+ iconRightType: function iconRightType() {
606
+ var iconRight = this.iconRight || '';
607
+ if (iconRight) {
608
+ if (iconRight.indexOf('icon') === 0) {
609
+ iconRight = iconRight.replace(/^(icon-)/, '');
610
+ }
611
+ }
612
+ return iconRight;
613
+ },
614
+ themeType: function themeType() {
615
+ if (this.text) {
616
+ if (this.theme === 'default') {
617
+ return 'primary';
618
+ }
619
+ }
620
+ return this.theme;
621
+ },
622
+ buttonCls: function buttonCls() {
623
+ return ["bk-".concat(this.themeType), "bk-button-".concat(this.size), this.hoverTheme ? "bk-button-hover bk-".concat(this.hoverTheme) : this.text ? 'bk-button-text' : 'bk-button', this.disabled ? 'is-disabled' : '', this.loading ? 'is-loading' : '', this.outline ? 'is-outline' : '', !this.showSlot ? 'no-slot' : ''];
624
+ }
625
+ },
626
+ mounted: function mounted() {
627
+ this.showSlot = this.$slots.default !== undefined;
628
+ },
629
+ methods: {
630
+ handleClick: function handleClick(e) {
631
+ if (!this.disabled && !this.loading) {
632
+ this.$emit('click', e);
633
+ this.$el.blur();
634
+ }
635
+ }
636
+ }
637
+ };
638
+
639
+ /* script */
640
+ var __vue_script__$1 = script$1;
641
+ /* template */
642
+
643
+ var __vue_render__$1 = function __vue_render__() {
644
+ var _vm = this;
645
+
646
+ var _h = _vm.$createElement;
647
+
648
+ var _c = _vm._self._c || _h;
649
+
650
+ return _c('button', _vm._b({
651
+ class: [_vm.buttonCls, _vm.extCls],
652
+ attrs: {
653
+ "title": _vm.title,
654
+ "disabled": _vm.disabled,
655
+ "type": _vm.nativeType
656
+ },
657
+ on: {
658
+ "click": _vm.handleClick
659
+ }
660
+ }, 'button', _vm.$attrs, false), [_vm.loading ? _c('div', {
661
+ staticClass: "bk-button-loading"
662
+ }, [!_vm.text ? [_c('div', {
663
+ staticClass: "bounce bounce1"
664
+ }), _c('div', {
665
+ staticClass: "bounce bounce2"
666
+ }), _c('div', {
667
+ staticClass: "bounce bounce3"
668
+ }), _c('div', {
669
+ staticClass: "bounce bounce4"
670
+ })] : [_c('bk-spin', {
671
+ attrs: {
672
+ "size": "mini",
673
+ "theme": _vm.theme
674
+ }
675
+ })]], 2) : _vm._e(), _c('div', {
676
+ class: _vm.loading ? 'bk-loading-wrapper' : ''
677
+ }, [_vm.iconType ? _c('i', {
678
+ staticClass: "bk-icon left-icon",
679
+ class: ['icon-' + _vm.iconType, _vm.iconType === 'loading' ? 'bk-button-icon-loading' : '']
680
+ }, [_vm.iconType === 'loading' ? [_c('span', {
681
+ staticClass: "loading"
682
+ })] : _vm._e()], 2) : _vm._e(), _c('span', [_vm._t("default")], 2), _vm.iconRightType ? _c('i', {
683
+ staticClass: "bk-icon right-icon",
684
+ class: ['icon-' + _vm.iconRightType, _vm.iconRightType === 'loading' ? 'bk-button-icon-loading' : '']
685
+ }, [_vm.iconRightType === 'loading' ? [_c('span', {
686
+ staticClass: "loading"
687
+ })] : _vm._e()], 2) : _vm._e()])]);
688
+ };
689
+
690
+ var __vue_staticRenderFns__$1 = [];
691
+ /* style */
692
+
693
+ var __vue_inject_styles__$1 = undefined;
694
+ /* scoped */
695
+
696
+ var __vue_scope_id__$1 = undefined;
697
+ /* module identifier */
698
+
699
+ var __vue_module_identifier__$1 = undefined;
700
+ /* functional template */
701
+
702
+ var __vue_is_functional_template__$1 = false;
703
+ /* style inject */
704
+
705
+ /* style inject SSR */
706
+
707
+ /* style inject shadow dom */
708
+
709
+ var __vue_component__$1 = /*#__PURE__*/normalizeComponent_1({
710
+ render: __vue_render__$1,
711
+ staticRenderFns: __vue_staticRenderFns__$1
712
+ }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
713
+
714
+ setInstaller(__vue_component__$1);
715
+
716
+ exports.default = __vue_component__$1;
548
717
 
549
718
  Object.defineProperty(exports, '__esModule', { value: true });
550
719