kui-vue 3.2.11-rc1 → 3.2.11-rc2
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/slider/slider.jsx +27 -15
- package/components/slider/thumb.jsx +9 -26
- package/dist/k-ui.css +1 -1
- package/dist/k-ui.js +2 -2
- package/package.json +1 -1
|
@@ -45,13 +45,17 @@ export default {
|
|
|
45
45
|
if (value >= max) v = max
|
|
46
46
|
else if (value <= min) v = min
|
|
47
47
|
} else {
|
|
48
|
-
v = value
|
|
49
48
|
if (!Array.isArray(v)) {
|
|
50
49
|
v = [0, 0]
|
|
51
50
|
}
|
|
52
51
|
let [x, y] = v
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
|
|
53
|
+
if (x >= max) x = max
|
|
54
|
+
else if (x <= min) x = min
|
|
55
|
+
|
|
56
|
+
if (y >= max) y = max
|
|
57
|
+
else if (y <= min) y = min
|
|
58
|
+
|
|
55
59
|
v = [x, y]
|
|
56
60
|
}
|
|
57
61
|
return v
|
|
@@ -71,8 +75,8 @@ export default {
|
|
|
71
75
|
let value = Math.round(percent / step) * step
|
|
72
76
|
if (range) {
|
|
73
77
|
let [x, y] = defaultValue
|
|
74
|
-
let half = (y - x) / 2 + x
|
|
75
|
-
value = value >= half ? [x, value] : [value, y]
|
|
78
|
+
let half = y > x ? (y - x) / 2 + x : (x - y) / 2 + y
|
|
79
|
+
value = value >= half && y > x ? [x, value] : [value, y]
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
this.defaultValue = value
|
|
@@ -83,7 +87,7 @@ export default {
|
|
|
83
87
|
let active;
|
|
84
88
|
if (this.range) {
|
|
85
89
|
let [x, y] = defaultValue
|
|
86
|
-
active = a >= x && a <= y
|
|
90
|
+
active = x < y ? a >= x && a <= y : a <= x && a >= y
|
|
87
91
|
} else {
|
|
88
92
|
active = a <= defaultValue
|
|
89
93
|
}
|
|
@@ -136,23 +140,31 @@ export default {
|
|
|
136
140
|
x1 = x, x2 = y
|
|
137
141
|
}
|
|
138
142
|
let trackSty = {}
|
|
143
|
+
let w, l;
|
|
144
|
+
if (percent2 > percent1) {
|
|
145
|
+
w = percent2 - percent1
|
|
146
|
+
l = percent1
|
|
147
|
+
} else {
|
|
148
|
+
w = percent1 - percent2
|
|
149
|
+
l = percent2
|
|
150
|
+
}
|
|
139
151
|
if (reverse) {
|
|
140
152
|
trackSty = vertical ? {
|
|
141
|
-
height: `${
|
|
153
|
+
height: `${w}%`,
|
|
142
154
|
top: 'auto',
|
|
143
|
-
bottom: `${
|
|
155
|
+
bottom: `${l}%`
|
|
144
156
|
} : {
|
|
145
|
-
width: `${
|
|
157
|
+
width: `${w}%`,
|
|
146
158
|
left: 'auto',
|
|
147
|
-
right: `${
|
|
159
|
+
right: `${l}%`
|
|
148
160
|
}
|
|
149
161
|
} else {
|
|
150
162
|
trackSty = vertical ? {
|
|
151
|
-
height: `${
|
|
152
|
-
top: `${
|
|
163
|
+
height: `${w}%`,
|
|
164
|
+
top: `${l}%`
|
|
153
165
|
} : {
|
|
154
|
-
width: `${
|
|
155
|
-
left: `${
|
|
166
|
+
width: `${w}%`,
|
|
167
|
+
left: `${l}%`
|
|
156
168
|
}
|
|
157
169
|
}
|
|
158
170
|
return (included && marks) || !marks ?
|
|
@@ -160,7 +172,7 @@ export default {
|
|
|
160
172
|
|
|
161
173
|
},
|
|
162
174
|
thumbProps() {
|
|
163
|
-
let { vertical, disabled, range, step, reverse, max, defaultValue, tooltipVisible, tipFormatter } = this
|
|
175
|
+
let { vertical, disabled, range, step, reverse, max, min, defaultValue, tooltipVisible, tipFormatter } = this
|
|
164
176
|
return {
|
|
165
177
|
props: {
|
|
166
178
|
vertical, disabled, range, step, reverse,
|
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
range: Boolean,
|
|
8
8
|
reverse: Boolean,
|
|
9
9
|
max: Number,
|
|
10
|
+
min: Number,
|
|
10
11
|
step: Number,
|
|
11
12
|
value: [Number, Array],
|
|
12
13
|
tipFormatter: [Function, Object],
|
|
@@ -32,7 +33,7 @@ export default {
|
|
|
32
33
|
if (this.isMouseDown) {
|
|
33
34
|
let { clientX, clientY } = e
|
|
34
35
|
let { width, height, left, right, top, bottom } = this.rect
|
|
35
|
-
let { value, range, step, max, vertical, reverse } = this, v = value;
|
|
36
|
+
let { value, range, step, max, min, vertical, reverse, type } = this, v = value;
|
|
36
37
|
|
|
37
38
|
let percent = 0;
|
|
38
39
|
if (reverse) {
|
|
@@ -43,35 +44,17 @@ export default {
|
|
|
43
44
|
if (percent >= 1) percent = 1
|
|
44
45
|
else if (percent <= 0) percent = 0
|
|
45
46
|
// this.defaultValue = value
|
|
47
|
+
let x = range ? (type == 'right' ? v[1] : v[0]) : v
|
|
46
48
|
|
|
49
|
+
let digit = getMaxDigit(step, x)
|
|
50
|
+
x = (((percent * max) / step) * step).toFixed(digit)
|
|
51
|
+
x = toNumber(x)
|
|
47
52
|
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
if (range) {
|
|
51
|
-
let [x, y] = value
|
|
52
|
-
v = y
|
|
53
|
-
x1 = x
|
|
54
|
-
} else {
|
|
55
|
-
v = value
|
|
56
|
-
}
|
|
53
|
+
if (x >= max) x = max
|
|
54
|
+
else if (x <= min) x = min
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
v = (((percent * max) / step) * step).toFixed(digit)
|
|
56
|
+
v = range ? (type == 'right' ? [v[0], x] : [x, v[1]]) : x
|
|
60
57
|
|
|
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
58
|
this.$emit('input', v)
|
|
76
59
|
}
|
|
77
60
|
},
|
package/dist/k-ui.css
CHANGED