vdesign-ui 0.2.9 → 0.2.12
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/README.md +78 -78
- package/dist/components/actionbar/index.js +8 -8
- package/dist/components/actionbar/index.vue +39 -39
- package/dist/components/actionbar/style.less +44 -44
- package/dist/components/actionbar-cell/index.js +7 -7
- package/dist/components/actionbar-cell/index.vue +38 -38
- package/dist/components/actions/index.js +6 -6
- package/dist/components/actions/index.vue +76 -76
- package/dist/components/actions/style.less +109 -109
- package/dist/components/actions-cell/index.js +6 -6
- package/dist/components/actions-cell/index.vue +94 -94
- package/dist/components/actions-cell/style.less +38 -38
- package/dist/components/activityviews/index.js +8 -8
- package/dist/components/activityviews/index.vue +192 -192
- package/dist/components/activityviews/style.less +151 -151
- package/dist/components/badge/index.js +8 -8
- package/dist/components/badge/index.vue +49 -49
- package/dist/components/badge/style.less +54 -54
- package/dist/components/button/index.js +8 -8
- package/dist/components/button/index.vue +93 -93
- package/dist/components/button/style.less +558 -558
- package/dist/components/calendar/index-element.vue +84 -84
- package/dist/components/calendar/index.js +7 -7
- package/dist/components/calendar/index.vue +52 -52
- package/dist/components/calendar/style.less +138 -138
- package/dist/components/checkbox/index.js +8 -8
- package/dist/components/checkbox/index.vue +161 -161
- package/dist/components/checkbox/style.less +288 -288
- package/dist/components/checkbox-group/index.js +7 -7
- package/dist/components/checkbox-group/index.vue +69 -69
- package/dist/components/common/state/index.vue +33 -33
- package/dist/components/common/state/style.less +47 -47
- package/dist/components/data-list/index.js +10 -10
- package/dist/components/data-list/index.vue +19 -19
- package/dist/components/data-list/style.less +623 -623
- package/dist/components/datetime-picker/index.js +7 -7
- package/dist/components/datetime-picker/index.vue +37 -37
- package/dist/components/datetime-picker/style.less +23 -23
- package/dist/components/dialog/index.js +8 -8
- package/dist/components/dialog/index.vue +164 -164
- package/dist/components/dialog/overlay-manager.js +18 -18
- package/dist/components/dialog/style.less +138 -138
- package/dist/components/divider/index.js +8 -8
- package/dist/components/divider/index.vue +54 -54
- package/dist/components/divider/style.less +92 -92
- package/dist/components/dropdown/index.js +8 -8
- package/dist/components/dropdown/index.vue +218 -218
- package/dist/components/dropdown/style.less +432 -432
- package/dist/components/empty/index.js +8 -8
- package/dist/components/empty/index.vue +138 -138
- package/dist/components/empty/style.less +60 -60
- package/dist/components/footer/index.js +6 -6
- package/dist/components/footer/index.vue +33 -33
- package/dist/components/footer/style.less +20 -20
- package/dist/components/footnav/index.js +6 -6
- package/dist/components/footnav/index.vue +93 -93
- package/dist/components/footnav/style.less +22 -22
- package/dist/components/footnav-item/index.js +6 -6
- package/dist/components/footnav-item/index.vue +50 -50
- package/dist/components/footnav-item/style.less +39 -39
- package/dist/components/form/index.js +6 -6
- package/dist/components/form/index.vue +12 -12
- package/dist/components/headnav/index.js +6 -6
- package/dist/components/headnav/index.vue +185 -185
- package/dist/components/headnav/style.less +231 -231
- package/dist/components/icon/font/iconfont.css +163 -163
- package/dist/components/icon/font/iconfont.js +5 -5
- package/dist/components/icon/index.js +9 -9
- package/dist/components/icon/index.vue +96 -96
- package/dist/components/icon/style.less +44 -44
- package/dist/components/input/calcTextareaHeight.js +162 -162
- package/dist/components/input/index.js +8 -8
- package/dist/components/input/index.vue +345 -345
- package/dist/components/input/style.less +470 -470
- package/dist/components/list/index.js +8 -8
- package/dist/components/list/index.vue +152 -152
- package/dist/components/list/style.less +213 -213
- package/dist/components/loading/index.js +6 -6
- package/dist/components/loading/index.vue +68 -68
- package/dist/components/loading/style.less +53 -53
- package/dist/components/mixins/clickoutside.js +81 -81
- package/dist/components/mixins/languageMixin.js +41 -41
- package/dist/components/mixins/outlineConfigPlugin.js +45 -45
- package/dist/components/mixins/themeMixin.js +43 -43
- package/dist/components/noticebar/index.js +8 -8
- package/dist/components/noticebar/index.vue +258 -258
- package/dist/components/noticebar/style.less +328 -328
- package/dist/components/overlay/index.js +8 -8
- package/dist/components/overlay/index.vue +184 -184
- package/dist/components/overlay/style.less +23 -23
- package/dist/components/pagebreak/index.js +6 -6
- package/dist/components/pagebreak/index.vue +67 -67
- package/dist/components/pagebreak/style.less +41 -41
- package/dist/components/password/index.js +8 -8
- package/dist/components/password/index.vue +60 -60
- package/dist/components/popover/index.js +8 -8
- package/dist/components/popover/index.vue +100 -100
- package/dist/components/popover/style.less +346 -346
- package/dist/components/popover/vue-popover.vue +314 -314
- package/dist/components/popup/index.js +7 -7
- package/dist/components/popup/index.vue +243 -243
- package/dist/components/radio/index.js +8 -8
- package/dist/components/radio/index.vue +184 -184
- package/dist/components/radio/style.less +293 -293
- package/dist/components/radio-group/index.js +6 -6
- package/dist/components/radio-group/index.vue +58 -58
- package/dist/components/result/index.js +8 -8
- package/dist/components/result/index.vue +73 -73
- package/dist/components/result/style.less +43 -43
- package/dist/components/search/index.js +8 -8
- package/dist/components/search/index.vue +66 -66
- package/dist/components/selector/index.js +8 -8
- package/dist/components/selector/index.vue +161 -161
- package/dist/components/selector/style.less +484 -484
- package/dist/components/skeleton/index.js +6 -6
- package/dist/components/skeleton/index.vue +207 -206
- package/dist/components/skeleton/style.less +196 -196
- package/dist/components/slider/draggable.js +49 -49
- package/dist/components/slider/index.js +6 -6
- package/dist/components/slider/index.vue +167 -167
- package/dist/components/slider/style.less +99 -99
- package/dist/components/slider/utils.js +59 -59
- package/dist/components/step/index.js +7 -7
- package/dist/components/step/index.vue +48 -48
- package/dist/components/step/style.less +57 -57
- package/dist/components/step-item/index.js +7 -7
- package/dist/components/step-item/index.vue +126 -126
- package/dist/components/step-item/style.less +362 -362
- package/dist/components/stepper/index.js +8 -8
- package/dist/components/stepper/index.vue +146 -146
- package/dist/components/style/index.vue +42 -42
- package/dist/components/switch/index.js +8 -8
- package/dist/components/switch/index.vue +72 -72
- package/dist/components/switch/style.less +56 -56
- package/dist/components/tab/index.js +7 -7
- package/dist/components/tab/index.vue +94 -93
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.vue +281 -271
- package/dist/components/tabs/style.less +408 -409
- package/dist/components/tag/index.js +6 -6
- package/dist/components/tag/index.vue +64 -64
- package/dist/components/tag/style.less +210 -210
- package/dist/components/title/index.js +8 -8
- package/dist/components/title/index.vue +99 -99
- package/dist/components/title/style.less +187 -187
- package/dist/components/toast/index.js +97 -86
- package/dist/components/toast/index.vue +49 -49
- package/dist/components/toast/style.less +57 -57
- package/dist/components/transition/index.js +8 -8
- package/dist/components/transition/index.vue +13 -13
- package/dist/components/transition/style.less +208 -208
- package/dist/components/upload/index.js +6 -6
- package/dist/components/upload/index.vue +106 -106
- package/dist/components/upload/style.less +147 -147
- package/dist/components/utils/assist.js +34 -34
- package/dist/components/utils/env.js +21 -21
- package/dist/locale/ar.js +97 -97
- package/dist/locale/en.js +97 -97
- package/dist/locale/zh.js +97 -97
- package/dist/token.css +2988 -2988
- package/dist/vdesign-ui.common.js +308 -8512
- package/dist/vdesign-ui.css +1 -1
- package/dist/vdesign-ui.umd.js +312 -8516
- package/dist/vdesign-ui.umd.min.js +2 -8
- package/package.json +113 -113
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vd-slider">
|
|
3
|
-
<template v-if="demonstration">
|
|
4
|
-
<div class="vd-slider__marks vd-slider__marks--top">
|
|
5
|
-
<div class="vd-slider__marks--start" :class="{ 'vd-slider__marks--hidden': (showMarks && progress === 0) }">0%
|
|
6
|
-
</div>
|
|
7
|
-
<div class="vd-slider__marks--end" v-if="progressWidth < 100">100%</div>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="vd-slider__wrap vd-slider__wrap--demonstration" ref="content">
|
|
10
|
-
<div class="vd-slider__bar vd-slider__bar--demonstration" :style="{ width: progressWidth + '%' }"></div>
|
|
11
|
-
<div class="vd-slider__button vd-slider__button--demonstration" ref="thumb"
|
|
12
|
-
:class="{ 'vd-slider__button--active': progress }" :style="{left: this.progress + '%'}">
|
|
13
|
-
<!-- 显示逻辑是滑动时候显示 -->
|
|
14
|
-
<span class="vd-slider__tips" v-if="showMarks">{{ value }}%</span>
|
|
15
|
-
</div>
|
|
16
|
-
<template v-for="(item, index) in items">
|
|
17
|
-
<div :key="index" v-if="index > 1 && index !== items.length - 1"
|
|
18
|
-
:class="['vd-slider__dots', { 'vd-slider__dots--active': (index - 1) % 2 !== 0 }]"
|
|
19
|
-
:style="{ left: (index - 1) * 5 + '%' }"></div>
|
|
20
|
-
</template>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
<template v-else>
|
|
24
|
-
<div class="vd-slider__wrap" ref="content">
|
|
25
|
-
<div class="vd-slider__bar" :style="{ width: progressWidth + '%' }"></div>
|
|
26
|
-
<div class="vd-slider__button" :class="{ 'vd-slider__button--active': progress }" ref="thumb"
|
|
27
|
-
:style="{left: this.progress + '%'}">
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="vd-slider__marks">
|
|
31
|
-
<div class="vd-slider__marks--start">0%</div>
|
|
32
|
-
<div class="vd-slider__marks--end">100%</div>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
import languageMixin from '../mixins/languageMixin.js';
|
|
40
|
-
|
|
41
|
-
import draggable from './draggable';
|
|
42
|
-
export default {
|
|
43
|
-
name: 'vd-slider',
|
|
44
|
-
mixins: [languageMixin],
|
|
45
|
-
props: {
|
|
46
|
-
demonstration: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
min: {
|
|
51
|
-
type: Number,
|
|
52
|
-
default: 0
|
|
53
|
-
},
|
|
54
|
-
max: {
|
|
55
|
-
type: Number,
|
|
56
|
-
default: 100
|
|
57
|
-
},
|
|
58
|
-
step: {
|
|
59
|
-
type: Number,
|
|
60
|
-
default: 1
|
|
61
|
-
},
|
|
62
|
-
value: {
|
|
63
|
-
type: Number
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
data() {
|
|
68
|
-
return {
|
|
69
|
-
items: Array(22),
|
|
70
|
-
showMarks: false, // 控制是否显示百分比标记
|
|
71
|
-
hideStartMark: false, // 控制是否隐藏0%标记
|
|
72
|
-
disabled: false
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
computed: {
|
|
76
|
-
progress() {
|
|
77
|
-
const value = this.value;
|
|
78
|
-
if (typeof value === 'undefined' || value === null) return 0;
|
|
79
|
-
const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
|
|
80
|
-
return this.language === 'ar' ? 100 - progressValue : progressValue;
|
|
81
|
-
},
|
|
82
|
-
progressWidth() {
|
|
83
|
-
const value = this.value;
|
|
84
|
-
if (typeof value === 'undefined' || value === null) return 0;
|
|
85
|
-
const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
|
|
86
|
-
return progressValue;
|
|
87
|
-
},
|
|
88
|
-
inputStyle() {
|
|
89
|
-
if (this.language === 'ar') {
|
|
90
|
-
return {
|
|
91
|
-
left: 'auto',
|
|
92
|
-
right: this.progress + '%'
|
|
93
|
-
};
|
|
94
|
-
} else {
|
|
95
|
-
return {
|
|
96
|
-
left: this.progress + '%',
|
|
97
|
-
right: 'auto'
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
watch: {
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
mounted() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const thumb = this.$refs.thumb;
|
|
109
|
-
const content = this.$refs.content;
|
|
110
|
-
const getThumbPosition = () => {
|
|
111
|
-
const contentBox = content.getBoundingClientRect();
|
|
112
|
-
const thumbBox = thumb.getBoundingClientRect();
|
|
113
|
-
return {
|
|
114
|
-
left: thumbBox.left - contentBox.left,
|
|
115
|
-
top: thumbBox.top - contentBox.top,
|
|
116
|
-
thumbBoxLeft: thumbBox.left
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
let dragState = {};
|
|
121
|
-
draggable(thumb, {
|
|
122
|
-
start: (event) => {
|
|
123
|
-
if (this.disabled) return;
|
|
124
|
-
this.showMarks = true;
|
|
125
|
-
const position = getThumbPosition();
|
|
126
|
-
const thumbClickDetalX = event.clientX - position.thumbBoxLeft;
|
|
127
|
-
dragState = {
|
|
128
|
-
thumbStartLeft: position.left,
|
|
129
|
-
thumbStartTop: position.top,
|
|
130
|
-
thumbClickDetalX: thumbClickDetalX
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
drag: (event) => {
|
|
134
|
-
if (this.disabled) return;
|
|
135
|
-
const contentBox = content.getBoundingClientRect();
|
|
136
|
-
const deltaX = this.language === 'ar' ?
|
|
137
|
-
contentBox.right - event.pageX - dragState.thumbStartLeft - dragState.thumbClickDetalX :
|
|
138
|
-
event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
|
|
139
|
-
// const deltaX = event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
|
|
140
|
-
const stepCount = Math.ceil((this.max - this.min) / this.step);
|
|
141
|
-
const newPosition = (dragState.thumbStartLeft + deltaX) - (dragState.thumbStartLeft + deltaX) % (contentBox.width / stepCount);
|
|
142
|
-
|
|
143
|
-
let newProgress = newPosition / contentBox.width;
|
|
144
|
-
|
|
145
|
-
if (newProgress < 0) {
|
|
146
|
-
newProgress = 0;
|
|
147
|
-
} else if (newProgress > 1) {
|
|
148
|
-
newProgress = 1;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
this.$emit('input', Math.round(this.min + newProgress * (this.max - this.min)));
|
|
152
|
-
},
|
|
153
|
-
end: () => {
|
|
154
|
-
if (this.disabled) return;
|
|
155
|
-
this.$emit('change', this.value);
|
|
156
|
-
dragState = {};
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<style lang="less">
|
|
164
|
-
@import './style.less';
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-slider">
|
|
3
|
+
<template v-if="demonstration">
|
|
4
|
+
<div class="vd-slider__marks vd-slider__marks--top">
|
|
5
|
+
<div class="vd-slider__marks--start" :class="{ 'vd-slider__marks--hidden': (showMarks && progress === 0) }">0%
|
|
6
|
+
</div>
|
|
7
|
+
<div class="vd-slider__marks--end" v-if="progressWidth < 100">100%</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="vd-slider__wrap vd-slider__wrap--demonstration" ref="content">
|
|
10
|
+
<div class="vd-slider__bar vd-slider__bar--demonstration" :style="{ width: progressWidth + '%' }"></div>
|
|
11
|
+
<div class="vd-slider__button vd-slider__button--demonstration" ref="thumb"
|
|
12
|
+
:class="{ 'vd-slider__button--active': progress }" :style="{left: this.progress + '%'}">
|
|
13
|
+
<!-- 显示逻辑是滑动时候显示 -->
|
|
14
|
+
<span class="vd-slider__tips" v-if="showMarks">{{ value }}%</span>
|
|
15
|
+
</div>
|
|
16
|
+
<template v-for="(item, index) in items">
|
|
17
|
+
<div :key="index" v-if="index > 1 && index !== items.length - 1"
|
|
18
|
+
:class="['vd-slider__dots', { 'vd-slider__dots--active': (index - 1) % 2 !== 0 }]"
|
|
19
|
+
:style="{ left: (index - 1) * 5 + '%' }"></div>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else>
|
|
24
|
+
<div class="vd-slider__wrap" ref="content">
|
|
25
|
+
<div class="vd-slider__bar" :style="{ width: progressWidth + '%' }"></div>
|
|
26
|
+
<div class="vd-slider__button" :class="{ 'vd-slider__button--active': progress }" ref="thumb"
|
|
27
|
+
:style="{left: this.progress + '%'}">
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="vd-slider__marks">
|
|
31
|
+
<div class="vd-slider__marks--start">0%</div>
|
|
32
|
+
<div class="vd-slider__marks--end">100%</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import languageMixin from '../mixins/languageMixin.js';
|
|
40
|
+
|
|
41
|
+
import draggable from './draggable';
|
|
42
|
+
export default {
|
|
43
|
+
name: 'vd-slider',
|
|
44
|
+
mixins: [languageMixin],
|
|
45
|
+
props: {
|
|
46
|
+
demonstration: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
min: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 0
|
|
53
|
+
},
|
|
54
|
+
max: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 100
|
|
57
|
+
},
|
|
58
|
+
step: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 1
|
|
61
|
+
},
|
|
62
|
+
value: {
|
|
63
|
+
type: Number
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
items: Array(22),
|
|
70
|
+
showMarks: false, // 控制是否显示百分比标记
|
|
71
|
+
hideStartMark: false, // 控制是否隐藏0%标记
|
|
72
|
+
disabled: false
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
progress() {
|
|
77
|
+
const value = this.value;
|
|
78
|
+
if (typeof value === 'undefined' || value === null) return 0;
|
|
79
|
+
const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
|
|
80
|
+
return this.language === 'ar' ? 100 - progressValue : progressValue;
|
|
81
|
+
},
|
|
82
|
+
progressWidth() {
|
|
83
|
+
const value = this.value;
|
|
84
|
+
if (typeof value === 'undefined' || value === null) return 0;
|
|
85
|
+
const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
|
|
86
|
+
return progressValue;
|
|
87
|
+
},
|
|
88
|
+
inputStyle() {
|
|
89
|
+
if (this.language === 'ar') {
|
|
90
|
+
return {
|
|
91
|
+
left: 'auto',
|
|
92
|
+
right: this.progress + '%'
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
return {
|
|
96
|
+
left: this.progress + '%',
|
|
97
|
+
right: 'auto'
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
watch: {
|
|
103
|
+
|
|
104
|
+
},
|
|
105
|
+
mounted() {
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const thumb = this.$refs.thumb;
|
|
109
|
+
const content = this.$refs.content;
|
|
110
|
+
const getThumbPosition = () => {
|
|
111
|
+
const contentBox = content.getBoundingClientRect();
|
|
112
|
+
const thumbBox = thumb.getBoundingClientRect();
|
|
113
|
+
return {
|
|
114
|
+
left: thumbBox.left - contentBox.left,
|
|
115
|
+
top: thumbBox.top - contentBox.top,
|
|
116
|
+
thumbBoxLeft: thumbBox.left
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
let dragState = {};
|
|
121
|
+
draggable(thumb, {
|
|
122
|
+
start: (event) => {
|
|
123
|
+
if (this.disabled) return;
|
|
124
|
+
this.showMarks = true;
|
|
125
|
+
const position = getThumbPosition();
|
|
126
|
+
const thumbClickDetalX = event.clientX - position.thumbBoxLeft;
|
|
127
|
+
dragState = {
|
|
128
|
+
thumbStartLeft: position.left,
|
|
129
|
+
thumbStartTop: position.top,
|
|
130
|
+
thumbClickDetalX: thumbClickDetalX
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
drag: (event) => {
|
|
134
|
+
if (this.disabled) return;
|
|
135
|
+
const contentBox = content.getBoundingClientRect();
|
|
136
|
+
const deltaX = this.language === 'ar' ?
|
|
137
|
+
contentBox.right - event.pageX - dragState.thumbStartLeft - dragState.thumbClickDetalX :
|
|
138
|
+
event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
|
|
139
|
+
// const deltaX = event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
|
|
140
|
+
const stepCount = Math.ceil((this.max - this.min) / this.step);
|
|
141
|
+
const newPosition = (dragState.thumbStartLeft + deltaX) - (dragState.thumbStartLeft + deltaX) % (contentBox.width / stepCount);
|
|
142
|
+
|
|
143
|
+
let newProgress = newPosition / contentBox.width;
|
|
144
|
+
|
|
145
|
+
if (newProgress < 0) {
|
|
146
|
+
newProgress = 0;
|
|
147
|
+
} else if (newProgress > 1) {
|
|
148
|
+
newProgress = 1;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
this.$emit('input', Math.round(this.min + newProgress * (this.max - this.min)));
|
|
152
|
+
},
|
|
153
|
+
end: () => {
|
|
154
|
+
if (this.disabled) return;
|
|
155
|
+
this.$emit('change', this.value);
|
|
156
|
+
dragState = {};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<style lang="less">
|
|
164
|
+
@import './style.less';
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
</style>
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
@silder-prefix-cls: vd-slider;
|
|
2
|
-
|
|
3
|
-
.@{silder-prefix-cls} {
|
|
4
|
-
|
|
5
|
-
&__wrap {
|
|
6
|
-
position: relative;
|
|
7
|
-
margin: 7px 0;
|
|
8
|
-
height: var(--height-slider-track);
|
|
9
|
-
background-color: var(--color-slider-track-default);
|
|
10
|
-
border-radius: var(--radius-slider-track);
|
|
11
|
-
|
|
12
|
-
&--demonstration {
|
|
13
|
-
height: var(--height-slider-mark_track);
|
|
14
|
-
border-radius: var(--radius-slider-mark_track);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&__bar {
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
height: var(--height-slider-track);
|
|
22
|
-
background-color: var(--color-slider-track-focus);
|
|
23
|
-
border-radius: var(--radius-slider-track);
|
|
24
|
-
|
|
25
|
-
&--demonstration {
|
|
26
|
-
height: var(--height-slider-mark_track);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&__button {
|
|
31
|
-
position: absolute;
|
|
32
|
-
left: 0;
|
|
33
|
-
top: 50%;
|
|
34
|
-
transform: translate3d(-50%, -50%, 0);
|
|
35
|
-
cursor: grab;
|
|
36
|
-
border-radius: 50%;
|
|
37
|
-
width: var(--width-slider-handle);
|
|
38
|
-
height: var(--width-slider-handle);
|
|
39
|
-
background-color: var(--color-slider-handle-bg);
|
|
40
|
-
border: var(--width-slider-handle_border) solid var(--color-slider-handle_border-default);
|
|
41
|
-
|
|
42
|
-
&--demonstration {
|
|
43
|
-
width: var(--width-slider-mark_handle);
|
|
44
|
-
height: var(--height-slider-mark_handle);
|
|
45
|
-
border-radius: var(--radius-slider-mark_handle);
|
|
46
|
-
border: var(--width-slider-mark_handle_border) solid var(--color-slider-handle_border-default);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&--active {
|
|
50
|
-
border-color: var(--color-slider-handle_border-focus);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&__marks {
|
|
55
|
-
display: flex;
|
|
56
|
-
justify-content: space-between;
|
|
57
|
-
margin-top: var(--spacing-slider-margin_bottom);
|
|
58
|
-
font-size: var(--en-single-f-a-r-fontSize);
|
|
59
|
-
font-weight: var(--en-single-f-a-r-fontWeight);
|
|
60
|
-
color: var(--color-slider-mark-text);
|
|
61
|
-
|
|
62
|
-
&--top {
|
|
63
|
-
margin-top: 0;
|
|
64
|
-
margin-bottom: var(--spacing-slider-margin_bottom);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&--active {
|
|
68
|
-
font-size: var(--en-single-f-d-s-fontSize);
|
|
69
|
-
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&--hidden {
|
|
73
|
-
opacity: 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&__dots {
|
|
78
|
-
position: absolute;
|
|
79
|
-
width: 1px;
|
|
80
|
-
height: 3px;
|
|
81
|
-
border-radius: 4px;
|
|
82
|
-
background-color: #fff;
|
|
83
|
-
top: 50%;
|
|
84
|
-
transform: translate(-50%, -50%);
|
|
85
|
-
|
|
86
|
-
&--active {
|
|
87
|
-
height: 5px;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
&__tips {
|
|
92
|
-
position: absolute;
|
|
93
|
-
left: 50%;
|
|
94
|
-
top: calc(-1 * var(--height-slider-mark_handle) - 8px);
|
|
95
|
-
transform: translateX(-50%);
|
|
96
|
-
font-size: var(--en-single-f-d-s-fontSize);
|
|
97
|
-
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
98
|
-
color: var(--color-slider-mark-text-focus);
|
|
99
|
-
}
|
|
1
|
+
@silder-prefix-cls: vd-slider;
|
|
2
|
+
|
|
3
|
+
.@{silder-prefix-cls} {
|
|
4
|
+
|
|
5
|
+
&__wrap {
|
|
6
|
+
position: relative;
|
|
7
|
+
margin: 7px 0;
|
|
8
|
+
height: var(--height-slider-track);
|
|
9
|
+
background-color: var(--color-slider-track-default);
|
|
10
|
+
border-radius: var(--radius-slider-track);
|
|
11
|
+
|
|
12
|
+
&--demonstration {
|
|
13
|
+
height: var(--height-slider-mark_track);
|
|
14
|
+
border-radius: var(--radius-slider-mark_track);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__bar {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
height: var(--height-slider-track);
|
|
22
|
+
background-color: var(--color-slider-track-focus);
|
|
23
|
+
border-radius: var(--radius-slider-track);
|
|
24
|
+
|
|
25
|
+
&--demonstration {
|
|
26
|
+
height: var(--height-slider-mark_track);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__button {
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: 0;
|
|
33
|
+
top: 50%;
|
|
34
|
+
transform: translate3d(-50%, -50%, 0);
|
|
35
|
+
cursor: grab;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
width: var(--width-slider-handle);
|
|
38
|
+
height: var(--width-slider-handle);
|
|
39
|
+
background-color: var(--color-slider-handle-bg);
|
|
40
|
+
border: var(--width-slider-handle_border) solid var(--color-slider-handle_border-default);
|
|
41
|
+
|
|
42
|
+
&--demonstration {
|
|
43
|
+
width: var(--width-slider-mark_handle);
|
|
44
|
+
height: var(--height-slider-mark_handle);
|
|
45
|
+
border-radius: var(--radius-slider-mark_handle);
|
|
46
|
+
border: var(--width-slider-mark_handle_border) solid var(--color-slider-handle_border-default);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--active {
|
|
50
|
+
border-color: var(--color-slider-handle_border-focus);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__marks {
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: space-between;
|
|
57
|
+
margin-top: var(--spacing-slider-margin_bottom);
|
|
58
|
+
font-size: var(--en-single-f-a-r-fontSize);
|
|
59
|
+
font-weight: var(--en-single-f-a-r-fontWeight);
|
|
60
|
+
color: var(--color-slider-mark-text);
|
|
61
|
+
|
|
62
|
+
&--top {
|
|
63
|
+
margin-top: 0;
|
|
64
|
+
margin-bottom: var(--spacing-slider-margin_bottom);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--active {
|
|
68
|
+
font-size: var(--en-single-f-d-s-fontSize);
|
|
69
|
+
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--hidden {
|
|
73
|
+
opacity: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__dots {
|
|
78
|
+
position: absolute;
|
|
79
|
+
width: 1px;
|
|
80
|
+
height: 3px;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
background-color: #fff;
|
|
83
|
+
top: 50%;
|
|
84
|
+
transform: translate(-50%, -50%);
|
|
85
|
+
|
|
86
|
+
&--active {
|
|
87
|
+
height: 5px;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&__tips {
|
|
92
|
+
position: absolute;
|
|
93
|
+
left: 50%;
|
|
94
|
+
top: calc(-1 * var(--height-slider-mark_handle) - 8px);
|
|
95
|
+
transform: translateX(-50%);
|
|
96
|
+
font-size: var(--en-single-f-d-s-fontSize);
|
|
97
|
+
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
98
|
+
color: var(--color-slider-mark-text-focus);
|
|
99
|
+
}
|
|
100
100
|
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
const isServer = Vue.prototype.$isServer;
|
|
3
|
-
|
|
4
|
-
/* istanbul ignore next */
|
|
5
|
-
export const on = (function() {
|
|
6
|
-
if (!isServer && document.addEventListener) {
|
|
7
|
-
return function(element, event, handler, useCapture = false) {
|
|
8
|
-
if (element && event && handler) {
|
|
9
|
-
element.addEventListener(event, handler, useCapture);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
} else {
|
|
13
|
-
return function(element, event, handler) {
|
|
14
|
-
if (element && event && handler) {
|
|
15
|
-
element.attachEvent('on' + event, handler);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
|
|
21
|
-
/* istanbul ignore next */
|
|
22
|
-
export const off = (function() {
|
|
23
|
-
if (!isServer && document.removeEventListener) {
|
|
24
|
-
return function(element, event, handler, useCapture = false) {
|
|
25
|
-
if (element && event) {
|
|
26
|
-
element.removeEventListener(event, handler, useCapture);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
} else {
|
|
30
|
-
return function(element, event, handler) {
|
|
31
|
-
if (element && event) {
|
|
32
|
-
element.detachEvent('on' + event, handler);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
})();
|
|
37
|
-
|
|
38
|
-
const SPECIAL_CHARS_REGEXP = /[:-_]+./g;
|
|
39
|
-
const MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
40
|
-
|
|
41
|
-
function camelCase(name) {
|
|
42
|
-
return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
|
|
43
|
-
return offset ? letter.toUpperCase() : letter;
|
|
44
|
-
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// getStyle
|
|
48
|
-
export function getStyle (element, styleName) {
|
|
49
|
-
if (!element || !styleName) return null;
|
|
50
|
-
styleName = camelCase(styleName);
|
|
51
|
-
if (styleName === 'float') {
|
|
52
|
-
styleName = 'cssFloat';
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const computed = document.defaultView.getComputedStyle(element, '');
|
|
56
|
-
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
57
|
-
} catch(e) {
|
|
58
|
-
return element.style[styleName];
|
|
59
|
-
}
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
const isServer = Vue.prototype.$isServer;
|
|
3
|
+
|
|
4
|
+
/* istanbul ignore next */
|
|
5
|
+
export const on = (function() {
|
|
6
|
+
if (!isServer && document.addEventListener) {
|
|
7
|
+
return function(element, event, handler, useCapture = false) {
|
|
8
|
+
if (element && event && handler) {
|
|
9
|
+
element.addEventListener(event, handler, useCapture);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
} else {
|
|
13
|
+
return function(element, event, handler) {
|
|
14
|
+
if (element && event && handler) {
|
|
15
|
+
element.attachEvent('on' + event, handler);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
|
|
21
|
+
/* istanbul ignore next */
|
|
22
|
+
export const off = (function() {
|
|
23
|
+
if (!isServer && document.removeEventListener) {
|
|
24
|
+
return function(element, event, handler, useCapture = false) {
|
|
25
|
+
if (element && event) {
|
|
26
|
+
element.removeEventListener(event, handler, useCapture);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
return function(element, event, handler) {
|
|
31
|
+
if (element && event) {
|
|
32
|
+
element.detachEvent('on' + event, handler);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
|
|
38
|
+
const SPECIAL_CHARS_REGEXP = /[:-_]+./g;
|
|
39
|
+
const MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
40
|
+
|
|
41
|
+
function camelCase(name) {
|
|
42
|
+
return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
|
|
43
|
+
return offset ? letter.toUpperCase() : letter;
|
|
44
|
+
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// getStyle
|
|
48
|
+
export function getStyle (element, styleName) {
|
|
49
|
+
if (!element || !styleName) return null;
|
|
50
|
+
styleName = camelCase(styleName);
|
|
51
|
+
if (styleName === 'float') {
|
|
52
|
+
styleName = 'cssFloat';
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const computed = document.defaultView.getComputedStyle(element, '');
|
|
56
|
+
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
57
|
+
} catch(e) {
|
|
58
|
+
return element.style[styleName];
|
|
59
|
+
}
|
|
60
60
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Step from './index.vue';
|
|
2
|
-
import './style.less';
|
|
3
|
-
Step.install = function (Vue) {
|
|
4
|
-
Vue.component(Step.name, Step)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default Step;
|
|
1
|
+
import Step from './index.vue';
|
|
2
|
+
import './style.less';
|
|
3
|
+
Step.install = function (Vue) {
|
|
4
|
+
Vue.component(Step.name, Step)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default Step;
|