kui-vue 3.2.10 → 3.2.11
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/components/_tool/number.js +177 -0
- package/components/_tool/utils.js +9 -3
- package/components/base/input.jsx +82 -54
- package/components/base/pop.jsx +22 -8
- package/components/button/button.jsx +1 -1
- package/components/button/styles/index.less +6 -2
- package/components/checkbox/checkbox.jsx +6 -11
- package/components/checkbox/demo/check-all.md +6 -6
- package/components/checkbox/group.jsx +0 -1
- package/components/checkbox/styles/index.less +17 -11
- package/components/divider/styles/index.less +1 -1
- package/components/dropdown/demo/rightmenu.md +2 -2
- package/components/dropdown/styles/index.less +23 -34
- package/components/form/demo/base.md +7 -1
- package/components/form/demo/valid.md +13 -4
- package/components/form/styles/index.less +1 -5
- package/components/icon/demo/base.md +2 -2
- package/components/icon/demo/search.vue +31 -14
- package/components/icon/icon.jsx +3 -1
- package/components/icon/styles/index.less +1 -1
- package/components/index.js +2 -0
- package/components/input/demo/icon.md +2 -2
- package/components/input/demo/size.md +3 -3
- package/components/input/demo/suffix.md +13 -6
- package/components/input/demo/theme.md +11 -6
- package/components/input/index.md +2 -1
- package/components/input/input.jsx +5 -0
- package/components/input/styles/index.less +52 -63
- package/components/inputNumber/demo/base.md +34 -0
- package/components/inputNumber/demo/ffix.md +27 -0
- package/components/inputNumber/demo/format.md +80 -0
- package/components/inputNumber/demo/index.vue +23 -0
- package/components/inputNumber/demo/info.md +7 -0
- package/components/inputNumber/demo/size.md +18 -0
- package/components/inputNumber/index.js +2 -0
- package/components/inputNumber/index.md +16 -0
- package/components/inputNumber/inputNumber.jsx +169 -0
- package/components/inputNumber/styles/index.less +172 -0
- package/components/menu/demo/collapsed.md +1 -1
- package/components/menu/styles/dropmenu.less +2 -2
- package/components/menu/styles/index.less +31 -14
- package/components/message/demo/icon.md +33 -0
- package/components/message/demo/index.vue +2 -0
- package/components/message/index.md +9 -7
- package/components/message/inner.jsx +5 -3
- package/components/modal/modal.jsx +31 -31
- package/components/notice/demo/icon.md +27 -11
- package/components/notice/demo/index.vue +2 -0
- package/components/notice/demo/types.md +28 -0
- package/components/notice/index.js +3 -0
- package/components/notice/index.md +8 -6
- package/components/popconfirm/styles/index.less +64 -83
- package/components/poptip/demo/base.md +7 -0
- package/components/poptip/demo/placement.md +12 -13
- package/components/poptip/styles/index.less +60 -79
- package/components/progress/demo/circle.md +2 -2
- package/components/radio/button.jsx +4 -2
- package/components/radio/demo/button.md +32 -28
- package/components/radio/group.jsx +4 -2
- package/components/radio/radio.jsx +7 -7
- package/components/radio/styles/index.less +61 -29
- package/components/rate/demo/base.md +7 -1
- package/components/rate/rate.jsx +8 -3
- package/components/rate/star.jsx +4 -3
- package/components/rate/styles/index.less +5 -3
- package/components/select/select.jsx +2 -0
- package/components/skeleton/demo/custom.md +62 -0
- package/components/skeleton/demo/index.vue +2 -0
- package/components/skeleton/demo/items.md +6 -2
- package/components/skeleton/index.md +32 -12
- package/components/skeleton/skeleton.jsx +1 -3
- package/components/skeleton/skeletonAvatar.jsx +33 -7
- package/components/skeleton/skeletonButton.jsx +29 -4
- package/components/skeleton/skeletonImage.jsx +43 -6
- package/components/skeleton/skeletonText.jsx +29 -4
- package/components/slider/demo/base.md +7 -15
- package/components/slider/demo/formatter.md +19 -0
- package/components/slider/demo/index.vue +10 -1
- package/components/slider/demo/marks.md +42 -0
- package/components/slider/demo/reverse.md +26 -0
- package/components/slider/demo/vertical.md +26 -3
- package/components/slider/demo/withNumber.md +43 -0
- package/components/slider/index.md +15 -6
- package/components/slider/slider.jsx +173 -41
- package/components/slider/styles/index.less +109 -44
- package/components/slider/thumb.jsx +165 -0
- package/components/space/demo/align.md +22 -21
- package/components/space/demo/base.md +0 -1
- package/components/space/demo/index.vue +2 -0
- package/components/space/demo/size.md +34 -22
- package/components/space/demo/vertical.md +1 -1
- package/components/space/demo/wrap.md +12 -0
- package/components/space/index.md +6 -5
- package/components/space/space.jsx +40 -35
- package/components/space/styles/index.less +15 -0
- package/components/spin/demo/mode.md +6 -4
- package/components/spin/spin.jsx +1 -1
- package/components/styles/index.less +1 -0
- package/components/switch/demo/loading.md +1 -1
- package/components/switch/demo/text.md +3 -1
- package/components/switch/styles/index.less +31 -20
- package/components/table/styles/index.less +9 -10
- package/components/tooltip/styles/index.less +103 -76
- package/components/tooltip/tooltip.jsx +3 -0
- package/components/upload/styles/index.less +7 -0
- package/components/upload/upload.jsx +22 -12
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +1 -1
|
@@ -3,61 +3,126 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
display: inline-block;
|
|
5
5
|
position: relative;
|
|
6
|
-
height: 12px;
|
|
7
|
-
font-size: 0;
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// height: 12px;
|
|
7
|
+
// font-size: 0;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0 13px;
|
|
10
|
+
user-select: none;
|
|
11
|
+
.k-slider-bar {
|
|
12
|
+
height: 32px;
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
.k-slider-thumb {
|
|
17
|
+
user-select: none;
|
|
18
|
+
box-shadow: 0 4px 6px rgb(0 0 0 / 10%), 0 0 1px rgb(0 0 0 / 30%);
|
|
19
|
+
width: 24px;
|
|
20
|
+
height: 24px;
|
|
21
|
+
margin-top: 3px;
|
|
22
|
+
border: none;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
position: absolute;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
background: #fff;
|
|
27
|
+
border: 1px solid #fff;
|
|
28
|
+
transform: translateX(-50%);
|
|
29
|
+
&:active {
|
|
30
|
+
border: 1px solid var(--kui-color-main);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
.k-slider-track {
|
|
34
|
+
height: 4px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
border-radius: 2px;
|
|
37
|
+
background: var(--kui-color-main);
|
|
10
38
|
position: absolute;
|
|
39
|
+
top: 14px;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
}
|
|
42
|
+
.k-slider-rail {
|
|
43
|
+
cursor: pointer;
|
|
11
44
|
height: 4px;
|
|
12
45
|
border-radius: 2px;
|
|
13
46
|
background: var(--kui-color-border);
|
|
14
|
-
|
|
47
|
+
position: absolute;
|
|
15
48
|
width: 100%;
|
|
16
|
-
|
|
49
|
+
top: 14px;
|
|
17
50
|
}
|
|
18
|
-
.k-slider-
|
|
19
|
-
position:
|
|
20
|
-
z-index: 1;
|
|
21
|
-
margin-top: 4px;
|
|
22
|
-
-webkit-appearance: none;
|
|
23
|
-
// background: linear-gradient(to right, #1CE4FF 41.6777%, rgba(255, 255, 255, 0.3) 0%);
|
|
24
|
-
border-radius: 3px;
|
|
51
|
+
.k-slider-marks {
|
|
52
|
+
position: absolute;
|
|
25
53
|
width: 100%;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
border-
|
|
42
|
-
border: 2px solid var(--kui-color-main);
|
|
43
|
-
background-color: var(--kui-color-back);
|
|
44
|
-
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
}
|
|
47
|
-
&:disabled {
|
|
48
|
-
cursor: not-allowed;
|
|
49
|
-
}
|
|
50
|
-
&:focus {
|
|
51
|
-
&::-webkit-slider-thumb {
|
|
52
|
-
box-shadow: 0 0 0px 5px var(--kui-color-main-60);
|
|
53
|
-
}
|
|
54
|
+
top: 12px;
|
|
55
|
+
left: 0;
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
z-index: 0;
|
|
58
|
+
}
|
|
59
|
+
.k-slider-mark-symbol {
|
|
60
|
+
position: absolute;
|
|
61
|
+
height: 4px;
|
|
62
|
+
width: 4px;
|
|
63
|
+
border: 2px solid var(--kui-color-border);
|
|
64
|
+
background: #fff;
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
transform: translateX(-50%);
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
&-active {
|
|
69
|
+
border-color: var(--kui-color-main);
|
|
54
70
|
}
|
|
55
71
|
}
|
|
72
|
+
.k-slider-mark-text {
|
|
73
|
+
position: absolute;
|
|
74
|
+
transform: translateX(-50%);
|
|
75
|
+
color: var(--kui-color-font);
|
|
76
|
+
z-index: 0;
|
|
77
|
+
line-height: 1;
|
|
78
|
+
margin-top: 18px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.k-slider-vertical {
|
|
83
|
+
padding: 13px 0;
|
|
84
|
+
height: 100%;
|
|
85
|
+
.k-slider-bar {
|
|
86
|
+
width: 32px;
|
|
87
|
+
height: 100%;
|
|
88
|
+
}
|
|
89
|
+
.k-slider-track {
|
|
90
|
+
width: 4px;
|
|
91
|
+
left: 14px;
|
|
92
|
+
top: 0;
|
|
93
|
+
}
|
|
94
|
+
.k-slider-rail {
|
|
95
|
+
height: 100%;
|
|
96
|
+
width: 4px;
|
|
97
|
+
left: 14px;
|
|
98
|
+
top: 0;
|
|
99
|
+
}
|
|
100
|
+
.k-slider-marks {
|
|
101
|
+
left: 12px;
|
|
102
|
+
top: auto;
|
|
103
|
+
height: 100%;
|
|
104
|
+
width: auto;
|
|
105
|
+
}
|
|
106
|
+
.k-slider-thumb {
|
|
107
|
+
transform: translateY(-50%);
|
|
108
|
+
margin: 0 0 0 3px;
|
|
109
|
+
}
|
|
110
|
+
.k-slider-mark-symbol, .k-slider-mark-text {
|
|
111
|
+
transform: translateY(-50%);
|
|
112
|
+
}
|
|
113
|
+
.k-slider-mark-text{
|
|
114
|
+
margin:0 0 0 18px;
|
|
115
|
+
}
|
|
56
116
|
}
|
|
57
117
|
|
|
58
118
|
.k-slider-disabled {
|
|
59
119
|
opacity: .5;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
.k-slider-thumb, .k-slider-thumb:active {
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
border-color: #fff;
|
|
124
|
+
}
|
|
125
|
+
.k-slider-rail {
|
|
126
|
+
cursor: not-allowed;
|
|
127
|
+
}
|
|
63
128
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import Tooltip from "../tooltip"
|
|
2
|
+
import { getMaxDigit, toNumber } from '../_tool/number'
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
vertical: Boolean,
|
|
6
|
+
disabled: Boolean,
|
|
7
|
+
range: Boolean,
|
|
8
|
+
reverse: Boolean,
|
|
9
|
+
max: Number,
|
|
10
|
+
step: Number,
|
|
11
|
+
value: [Number, Array],
|
|
12
|
+
tipFormatter: [Function, Object],
|
|
13
|
+
type: String,
|
|
14
|
+
tooltipVisible: Boolean
|
|
15
|
+
},
|
|
16
|
+
inject: {
|
|
17
|
+
bar: { default: null },
|
|
18
|
+
},
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
index: 1,
|
|
22
|
+
showTip: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
rect() {
|
|
27
|
+
return this.bar.$refs.rail.getBoundingClientRect()
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
mouseMove(e) {
|
|
32
|
+
if (this.isMouseDown) {
|
|
33
|
+
let { clientX, clientY } = e
|
|
34
|
+
let { width, height, left, right, top, bottom } = this.rect
|
|
35
|
+
let { value, range, step, max, vertical, reverse } = this, v = value;
|
|
36
|
+
|
|
37
|
+
let percent = 0;
|
|
38
|
+
if (reverse) {
|
|
39
|
+
percent = vertical ? ((height - (clientY - top)) / height) : ((width - (clientX - left)) / width)
|
|
40
|
+
} else {
|
|
41
|
+
percent = vertical ? ((clientY - top) / height) : ((clientX - left) / width)
|
|
42
|
+
}
|
|
43
|
+
if (percent >= 1) percent = 1
|
|
44
|
+
else if (percent <= 0) percent = 0
|
|
45
|
+
// this.defaultValue = value
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if (this.type == 'right') {
|
|
49
|
+
let x1 = 0;
|
|
50
|
+
if (range) {
|
|
51
|
+
let [x, y] = value
|
|
52
|
+
v = y
|
|
53
|
+
x1 = x
|
|
54
|
+
} else {
|
|
55
|
+
v = value
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let digit = getMaxDigit(step, v)
|
|
59
|
+
v = (((percent * max) / step) * step).toFixed(digit)
|
|
60
|
+
|
|
61
|
+
v = toNumber(v)
|
|
62
|
+
if (range) {
|
|
63
|
+
v = Math.max(v, x1)
|
|
64
|
+
v = [x1, v]
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
let [x, y] = value
|
|
68
|
+
let digit = getMaxDigit(step, x)
|
|
69
|
+
v = ((percent * max / step) * step).toFixed(digit)
|
|
70
|
+
v = toNumber(v)
|
|
71
|
+
|
|
72
|
+
v = Math.min(v, y)
|
|
73
|
+
v = [v, y]
|
|
74
|
+
}
|
|
75
|
+
this.$emit('input', v)
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
mouseUp(e) {
|
|
79
|
+
this.isMouseDown = false
|
|
80
|
+
this.index = 1
|
|
81
|
+
if (this.tooltipVisible === true) {
|
|
82
|
+
this.showTip = true
|
|
83
|
+
} else {
|
|
84
|
+
this.showTip = false
|
|
85
|
+
}
|
|
86
|
+
document.removeEventListener('mousemove', this.mouseMove)
|
|
87
|
+
document.removeEventListener('mouseup', this.mouseUp)
|
|
88
|
+
},
|
|
89
|
+
onMouseDown(e) {
|
|
90
|
+
if (this.disabled) return;
|
|
91
|
+
this.isMouseDown = true
|
|
92
|
+
this.showTip = true
|
|
93
|
+
this.index = 2
|
|
94
|
+
this.mouseMove(e)
|
|
95
|
+
document.addEventListener('mousemove', this.mouseMove)
|
|
96
|
+
document.addEventListener('mouseup', this.mouseUp)
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
render() {
|
|
100
|
+
let { vertical, value, index, disabled, max, tipFormatter, range, type, reverse, tooltipVisible } = this
|
|
101
|
+
const props = {
|
|
102
|
+
class: 'k-slider-thumb',
|
|
103
|
+
style: {
|
|
104
|
+
// left: `${percent}%`,
|
|
105
|
+
zIndex: index
|
|
106
|
+
},
|
|
107
|
+
on: {
|
|
108
|
+
mousedown: this.onMouseDown,
|
|
109
|
+
mouseenter: () => {
|
|
110
|
+
if (!disabled) this.showTip = true
|
|
111
|
+
},
|
|
112
|
+
mouseleave: (e) => {
|
|
113
|
+
if (this.tooltipVisible == true) {
|
|
114
|
+
this.showTip = true
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
if (!this.isMouseDown) {
|
|
118
|
+
this.showTip = false
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
let percent;
|
|
124
|
+
if (type == 'right') {
|
|
125
|
+
percent = ((range ? value[1] : value) / max) * 100
|
|
126
|
+
} else {
|
|
127
|
+
percent = (value[0] / max) * 100
|
|
128
|
+
}
|
|
129
|
+
let sty = {}
|
|
130
|
+
if (vertical) {
|
|
131
|
+
sty = reverse ? { bottom: `${percent}%`, transform: 'translateY(50%)' } :
|
|
132
|
+
{ top: `${percent}%` }
|
|
133
|
+
} else {
|
|
134
|
+
sty = reverse ? { right: `${percent}%`, transform: 'translateX(50%)' } :
|
|
135
|
+
{ left: `${percent}%` }
|
|
136
|
+
}
|
|
137
|
+
props.style = Object.assign(props.style, sty)
|
|
138
|
+
|
|
139
|
+
if (tipFormatter === null || tooltipVisible === null) return <div {...props}></div>
|
|
140
|
+
|
|
141
|
+
let tip = ''
|
|
142
|
+
if (type == 'right') {
|
|
143
|
+
tip = this.range ? value[1] : value
|
|
144
|
+
} else {
|
|
145
|
+
tip = value[0]
|
|
146
|
+
}
|
|
147
|
+
tip = tip.toString()
|
|
148
|
+
|
|
149
|
+
if (tipFormatter !== undefined) {
|
|
150
|
+
tip = tipFormatter(tip)
|
|
151
|
+
}
|
|
152
|
+
const tipProps = {
|
|
153
|
+
props: {
|
|
154
|
+
title: tip,
|
|
155
|
+
value: this.showTip,
|
|
156
|
+
show: tooltipVisible,
|
|
157
|
+
trigger: 'nromal',
|
|
158
|
+
},
|
|
159
|
+
on: {
|
|
160
|
+
input: value => this.showTip = value
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return <Tooltip {...tipProps}><div {...props}></div></Tooltip >
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -6,41 +6,42 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<div class="demo-space">
|
|
9
|
-
Align start
|
|
10
9
|
<Space align="start">
|
|
11
|
-
<
|
|
12
|
-
<Button>
|
|
13
|
-
<
|
|
14
|
-
Start text
|
|
10
|
+
<div class="demo-space-align">Start</div>
|
|
11
|
+
<Button>Start</Button>
|
|
12
|
+
<Tag color="blue">Start</Tag>
|
|
15
13
|
</Space>
|
|
16
14
|
<br/>
|
|
17
15
|
<br/>
|
|
18
|
-
Align end
|
|
19
16
|
<Space align="end">
|
|
20
|
-
<
|
|
21
|
-
<Button>
|
|
22
|
-
<
|
|
23
|
-
End text
|
|
17
|
+
<div class="demo-space-align" >end</div>
|
|
18
|
+
<Button>end</Button>
|
|
19
|
+
<Tag color="blue">end</Tag>
|
|
24
20
|
</Space>
|
|
25
21
|
<br/>
|
|
26
22
|
<br/>
|
|
27
|
-
Align center
|
|
28
23
|
<Space align="center">
|
|
29
|
-
<
|
|
30
|
-
<Button>
|
|
31
|
-
<
|
|
32
|
-
Center text
|
|
24
|
+
<div class="demo-space-align" >center</div>
|
|
25
|
+
<Button>center</Button>
|
|
26
|
+
<Tag color="blue">center</Tag>
|
|
33
27
|
</Space>
|
|
34
28
|
<br/>
|
|
35
29
|
<br/>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<Button>
|
|
39
|
-
<
|
|
30
|
+
<Space align="baseline">
|
|
31
|
+
<div class="demo-space-align">baseline</div>
|
|
32
|
+
<Button>baseline</Button>
|
|
33
|
+
<Tag color="blue">baseline</Tag>
|
|
40
34
|
</Space>
|
|
41
35
|
</div>
|
|
42
36
|
</template>
|
|
43
|
-
<style
|
|
44
|
-
|
|
37
|
+
<style lang=less>
|
|
38
|
+
.demo-space-align{
|
|
39
|
+
border:1px solid var(--kui-color-border);
|
|
40
|
+
height:120px;
|
|
41
|
+
display:flex;
|
|
42
|
+
align-items:center;
|
|
43
|
+
justify-content:center;
|
|
44
|
+
width:100px;
|
|
45
|
+
}
|
|
45
46
|
</style>
|
|
46
47
|
```
|
|
@@ -4,6 +4,7 @@ import Base from "./base";
|
|
|
4
4
|
import Vertical from "./vertical";
|
|
5
5
|
import Align from "./align";
|
|
6
6
|
import Size from "./size";
|
|
7
|
+
import Warp from "./wrap";
|
|
7
8
|
import CustomSize from "./custom-size";
|
|
8
9
|
|
|
9
10
|
import CN from "../index.md";
|
|
@@ -17,6 +18,7 @@ export default {
|
|
|
17
18
|
<Size />
|
|
18
19
|
<Align />
|
|
19
20
|
<CustomSize />
|
|
21
|
+
<Warp />
|
|
20
22
|
<CN class="typo" />
|
|
21
23
|
</div>
|
|
22
24
|
);
|
|
@@ -6,30 +6,42 @@
|
|
|
6
6
|
|
|
7
7
|
```vue
|
|
8
8
|
<template>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
<Tabs v-model="current" @change="change" style="width:350px;">
|
|
10
|
+
<TabPane key="1" title="Small">
|
|
11
|
+
<Space size="small" >
|
|
12
|
+
<Button size="small" v-for="x in 5" :key="x">Small</Button>
|
|
13
|
+
</Space>
|
|
14
|
+
</TabPane>
|
|
15
|
+
<TabPane key="2" title="Middle ">
|
|
16
|
+
<Space size="middle">
|
|
17
|
+
<Button size="small" v-for="x in 5" :key="x">Middle</Button>
|
|
18
|
+
</Space>
|
|
19
|
+
</TabPane>
|
|
20
|
+
<TabPane key="3" title="Large">
|
|
21
|
+
<Space size="large" >
|
|
22
|
+
<Button size="small" v-for="x in 5" :key="x">Large</Button>
|
|
23
|
+
</Space>
|
|
24
|
+
</TabPane>
|
|
25
|
+
<TabPane key="4" title="Array">
|
|
26
|
+
<Space :size="[8,20]" wrap>
|
|
27
|
+
<Button size="small" v-for="x in 10" :key="x">Array</Button>
|
|
28
|
+
</Space>
|
|
29
|
+
</TabPane>
|
|
30
|
+
</Tabs>
|
|
25
31
|
</template>
|
|
26
32
|
<script>
|
|
27
|
-
export default
|
|
28
|
-
data()
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
}
|
|
33
|
+
export default{
|
|
34
|
+
data(){
|
|
35
|
+
return{
|
|
36
|
+
current:'1'
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
|
-
|
|
39
|
+
methods:{
|
|
40
|
+
change(key){
|
|
41
|
+
console.log(key)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
</script>
|
|
46
|
+
|
|
35
47
|
```
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
### Space API
|
|
2
|
-
| 属性
|
|
3
|
-
|
|
|
4
|
-
| align
|
|
5
|
-
|
|
|
6
|
-
| size
|
|
2
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
3
|
+
| -------- | ------------ | ----------------------------- | ------ |
|
|
4
|
+
| align | 对齐方式 | start , end ,center ,baseline | center |
|
|
5
|
+
| vertical | 是否垂直显示 | Boolean | false |
|
|
6
|
+
| size | 间距大小 | small,middle,large,number | small |
|
|
7
|
+
| wrap | 是否换行 | Boolean | false |
|
|
@@ -9,49 +9,54 @@ export default {
|
|
|
9
9
|
return value ? ["start", "end", "center", "baseline"].indexOf(value) >= 0 : true;
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
default: 'horizontal',
|
|
15
|
-
validator(value) {
|
|
16
|
-
return ["vertical", "horizontal"].indexOf(value) >= 0;
|
|
17
|
-
}
|
|
18
|
-
},
|
|
12
|
+
vertical: Boolean,
|
|
13
|
+
wrap: Boolean,
|
|
19
14
|
size: {
|
|
20
|
-
type: [String, Number],
|
|
15
|
+
type: [String, Number, Array],
|
|
21
16
|
default: 'small',
|
|
22
|
-
validator(value) {
|
|
23
|
-
|
|
24
|
-
}
|
|
17
|
+
// validator(value) {
|
|
18
|
+
// return typeof value == 'number' || Array.isArray(value) ? true : ["small", "middle", "large"].indexOf(value) >= 0;
|
|
19
|
+
// }
|
|
25
20
|
}
|
|
26
21
|
},
|
|
27
22
|
render() {
|
|
28
|
-
let { align,
|
|
29
|
-
const
|
|
30
|
-
[
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
let { align, vertical, $slots, size, wrap } = this
|
|
24
|
+
const props = {
|
|
25
|
+
class: ['k-space', {
|
|
26
|
+
[`k-space-vertical`]: vertical,
|
|
27
|
+
[`k-space-lg`]: size == 'large',
|
|
28
|
+
[`k-space-md`]: size == 'middle ',
|
|
29
|
+
[`k-space-wrap`]: wrap,
|
|
30
|
+
[`k-space-align-${align}`]: align,
|
|
31
|
+
}]
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(size)) {
|
|
34
|
+
props.style = { gap: `${size[1]}px ${size[0]}px` }
|
|
35
|
+
} else if (size && !/small|large/.test(size)) {
|
|
36
|
+
props.style = { gap: `${size}px` }
|
|
37
|
+
}
|
|
38
|
+
// let mrs = { small: 8, middle: 16, large: 24 }
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
// let mr = typeof size == 'number' ? size : mrs[size]
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
// const childs = getChild(this.$slots.default)
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
style.marginBottom = `${mr}px`
|
|
43
|
-
} else {
|
|
44
|
-
style.marginRight = `${mr}px`
|
|
45
|
-
}
|
|
44
|
+
// let style = {}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
// if (direction == 'vertical') {
|
|
47
|
+
// style.marginBottom = `${mr}px`
|
|
48
|
+
// } else {
|
|
49
|
+
// style.marginRight = `${mr}px`
|
|
50
|
+
// }
|
|
51
|
+
return <div {...props}>{$slots.default}</div>
|
|
52
|
+
// return (
|
|
53
|
+
// <div class={classes}>
|
|
54
|
+
// {
|
|
55
|
+
// childs.map((child, i) => {
|
|
56
|
+
// return <div class="k-space-item" style={i != childs.length - 1 ? style : null}>{child}</div>
|
|
57
|
+
// })
|
|
58
|
+
// }
|
|
59
|
+
// </div>
|
|
60
|
+
// )
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
.k-space {
|
|
2
2
|
display: inline-flex;
|
|
3
|
+
gap: 8px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.k-space-md {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
gap: 16px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.k-space-wrap {
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.k-space-lg {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
gap: 24px;
|
|
3
18
|
}
|
|
4
19
|
|
|
5
20
|
.k-space-align-start {
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</Spin>
|
|
15
15
|
<br/>
|
|
16
|
+
<br/>
|
|
16
17
|
Loading state:<Switch v-model="spinning" @change="change"/>
|
|
17
18
|
<br/>
|
|
19
|
+
<br/>
|
|
18
20
|
<RadioGroup v-model="mode" @change="changeMode">
|
|
19
|
-
<Radio value="bounce" label="
|
|
20
|
-
<Radio value="flip" label="
|
|
21
|
-
<Radio value="rotate" label="
|
|
22
|
-
<Radio value="zoom" label="
|
|
21
|
+
<Radio value="bounce" label="Bounce"/>
|
|
22
|
+
<Radio value="flip" label="Flip"/>
|
|
23
|
+
<Radio value="rotate" label="Rotate"/>
|
|
24
|
+
<Radio value="zoom" label="Zoom"/>
|
|
23
25
|
</RadioGroup>
|
|
24
26
|
</div>
|
|
25
27
|
</template>
|
package/components/spin/spin.jsx
CHANGED
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
value: { type: Boolean, default: true },
|
|
5
5
|
delay: { type: Number, default: 500 },
|
|
6
6
|
mode: {
|
|
7
|
-
type: String, default: '
|
|
7
|
+
type: String, default: 'rotate', validator(value) {
|
|
8
8
|
return ["bounce", "flip", "rotate", "zoom"].indexOf(value) >= 0;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
@import '../grid/styles/index.less';
|
|
22
22
|
@import '../icon/styles/index.less';
|
|
23
23
|
@import '../input/styles/index.less';
|
|
24
|
+
@import '../inputNumber/styles/index.less';
|
|
24
25
|
@import '../image/styles/index.less';
|
|
25
26
|
@import '../loading/styles/index.less';
|
|
26
27
|
@import '../layout/styles/index.less';
|