@v-c/slider 1.0.3 → 1.0.4
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/dist/Handles/Handle.cjs +195 -1
- package/dist/Handles/Handle.d.ts +4 -4
- package/dist/Handles/Handle.js +191 -204
- package/dist/Handles/index.cjs +108 -1
- package/dist/Handles/index.d.ts +1 -1
- package/dist/Handles/index.js +105 -120
- package/dist/Marks/Mark.cjs +51 -1
- package/dist/Marks/Mark.d.ts +2 -2
- package/dist/Marks/Mark.js +48 -39
- package/dist/Marks/index.cjs +39 -1
- package/dist/Marks/index.d.ts +2 -2
- package/dist/Marks/index.js +36 -32
- package/dist/Slider.cjs +569 -1
- package/dist/Slider.d.ts +53 -267
- package/dist/Slider.js +563 -352
- package/dist/Steps/Dot.cjs +52 -1
- package/dist/Steps/Dot.d.ts +2 -2
- package/dist/Steps/Dot.js +49 -38
- package/dist/Steps/index.cjs +64 -1
- package/dist/Steps/index.d.ts +2 -2
- package/dist/Steps/index.js +61 -41
- package/dist/Tracks/Track.cjs +74 -1
- package/dist/Tracks/Track.js +70 -81
- package/dist/Tracks/index.cjs +70 -1
- package/dist/Tracks/index.js +66 -82
- package/dist/_virtual/rolldown_runtime.cjs +21 -0
- package/dist/context.cjs +39 -1
- package/dist/context.d.ts +13 -7
- package/dist/context.js +29 -24
- package/dist/hooks/useDrag.cjs +160 -1
- package/dist/hooks/useDrag.d.ts +2 -2
- package/dist/hooks/useDrag.js +155 -86
- package/dist/hooks/useOffset.cjs +124 -1
- package/dist/hooks/useOffset.d.ts +2 -1
- package/dist/hooks/useOffset.js +122 -110
- package/dist/hooks/useRange.cjs +21 -1
- package/dist/hooks/useRange.js +18 -9
- package/dist/index.cjs +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -4
- package/dist/interface.cjs +0 -1
- package/dist/interface.js +0 -1
- package/dist/util.cjs +32 -1
- package/dist/util.js +27 -26
- package/package.json +18 -10
- package/docs/TooltipSlider.tsx +0 -94
- package/docs/assets/anim.less +0 -63
- package/docs/assets/bootstrap.less +0 -163
- package/docs/assets/index.less +0 -337
- package/docs/debug.vue +0 -59
- package/docs/editable.vue +0 -58
- package/docs/handle.vue +0 -51
- package/docs/marks.vue +0 -104
- package/docs/multiple.vue +0 -50
- package/docs/range.vue +0 -224
- package/docs/slider.stories.vue +0 -45
- package/docs/sliderDemo.vue +0 -283
- package/docs/vertical.vue +0 -135
- package/src/Handles/Handle.tsx +0 -232
- package/src/Handles/index.tsx +0 -132
- package/src/Marks/Mark.tsx +0 -40
- package/src/Marks/index.tsx +0 -40
- package/src/Slider.tsx +0 -602
- package/src/Steps/Dot.tsx +0 -40
- package/src/Steps/index.tsx +0 -54
- package/src/Tracks/Track.tsx +0 -89
- package/src/Tracks/index.tsx +0 -92
- package/src/context.ts +0 -65
- package/src/hooks/useDrag.ts +0 -243
- package/src/hooks/useOffset.ts +0 -272
- package/src/hooks/useRange.ts +0 -24
- package/src/index.ts +0 -8
- package/src/interface.ts +0 -17
- package/src/util.ts +0 -41
- package/vite.config.ts +0 -18
- package/vitest.config.ts +0 -11
package/docs/assets/index.less
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
@prefixClass: vc-slider;
|
|
3
|
-
|
|
4
|
-
@disabledColor: #ccc;
|
|
5
|
-
@border-radius-base: 6px;
|
|
6
|
-
@primary-color: #2db7f5;
|
|
7
|
-
@tooltip-color: #fff;
|
|
8
|
-
@tooltip-bg: tint(#666, 4%);
|
|
9
|
-
@tooltip-arrow-width: 4px;
|
|
10
|
-
@tooltip-distance: @tooltip-arrow-width+4;
|
|
11
|
-
@tooltip-arrow-color: @tooltip-bg;
|
|
12
|
-
@ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
|
|
13
|
-
@ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
|
|
14
|
-
|
|
15
|
-
.borderBox() {
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); // remove tap highlight color for mobile safari
|
|
18
|
-
|
|
19
|
-
* {
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); // remove tap highlight color for mobile safari
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.@{prefixClass} {
|
|
26
|
-
position: relative;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 14px;
|
|
29
|
-
padding: 5px 0;
|
|
30
|
-
border-radius: @border-radius-base;
|
|
31
|
-
touch-action: none;
|
|
32
|
-
.borderBox();
|
|
33
|
-
|
|
34
|
-
&-rail {
|
|
35
|
-
position: absolute;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 4px;
|
|
38
|
-
background-color: #e9e9e9;
|
|
39
|
-
border-radius: @border-radius-base;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&-track,
|
|
43
|
-
&-tracks {
|
|
44
|
-
position: absolute;
|
|
45
|
-
height: 4px;
|
|
46
|
-
background-color: tint(@primary-color, 60%);
|
|
47
|
-
border-radius: @border-radius-base;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&-track-draggable {
|
|
51
|
-
z-index: 1;
|
|
52
|
-
box-sizing: content-box;
|
|
53
|
-
background-clip: content-box;
|
|
54
|
-
border-top: 5px solid rgba(0, 0, 0, 0);
|
|
55
|
-
border-bottom: 5px solid rgba(0, 0, 0, 0);
|
|
56
|
-
transform: translateY(-5px);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&-handle {
|
|
60
|
-
position: absolute;
|
|
61
|
-
z-index: 1;
|
|
62
|
-
width: 14px;
|
|
63
|
-
height: 14px;
|
|
64
|
-
margin-top: -5px;
|
|
65
|
-
background-color: #fff;
|
|
66
|
-
border: solid 2px tint(@primary-color, 50%);
|
|
67
|
-
border-radius: 50%;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
cursor: -webkit-grab;
|
|
70
|
-
cursor: grab;
|
|
71
|
-
opacity: 0.8;
|
|
72
|
-
user-select: none;
|
|
73
|
-
touch-action: pan-x;
|
|
74
|
-
|
|
75
|
-
&-dragging&-dragging&-dragging {
|
|
76
|
-
border-color: tint(@primary-color, 20%);
|
|
77
|
-
box-shadow: 0 0 0 5px tint(@primary-color, 50%);
|
|
78
|
-
|
|
79
|
-
&-delete {
|
|
80
|
-
opacity: 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&:focus {
|
|
85
|
-
outline: none;
|
|
86
|
-
box-shadow: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&:focus-visible {
|
|
90
|
-
border-color: @primary-color;
|
|
91
|
-
box-shadow: 0 0 0 3px tint(@primary-color, 50%);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&-click-focused:focus {
|
|
95
|
-
border-color: tint(@primary-color, 50%);
|
|
96
|
-
box-shadow: unset;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:hover {
|
|
100
|
-
border-color: tint(@primary-color, 20%);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&:active {
|
|
104
|
-
border-color: tint(@primary-color, 20%);
|
|
105
|
-
box-shadow: 0 0 5px tint(@primary-color, 20%);
|
|
106
|
-
cursor: -webkit-grabbing;
|
|
107
|
-
cursor: grabbing;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&-mark {
|
|
112
|
-
position: absolute;
|
|
113
|
-
top: 18px;
|
|
114
|
-
left: 0;
|
|
115
|
-
width: 100%;
|
|
116
|
-
font-size: 12px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&-mark-text {
|
|
120
|
-
position: absolute;
|
|
121
|
-
display: inline-block;
|
|
122
|
-
color: #999;
|
|
123
|
-
text-align: center;
|
|
124
|
-
vertical-align: middle;
|
|
125
|
-
cursor: pointer;
|
|
126
|
-
|
|
127
|
-
&-active {
|
|
128
|
-
color: #666;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&-step {
|
|
133
|
-
position: absolute;
|
|
134
|
-
width: 100%;
|
|
135
|
-
height: 4px;
|
|
136
|
-
background: transparent;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&-dot {
|
|
140
|
-
position: absolute;
|
|
141
|
-
bottom: -2px;
|
|
142
|
-
width: 8px;
|
|
143
|
-
height: 8px;
|
|
144
|
-
vertical-align: middle;
|
|
145
|
-
background-color: #fff;
|
|
146
|
-
border: 2px solid #e9e9e9;
|
|
147
|
-
border-radius: 50%;
|
|
148
|
-
cursor: pointer;
|
|
149
|
-
&-active {
|
|
150
|
-
border-color: tint(@primary-color, 50%);
|
|
151
|
-
}
|
|
152
|
-
&-reverse {
|
|
153
|
-
margin-right: -4px;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&-disabled {
|
|
158
|
-
background-color: #e9e9e9;
|
|
159
|
-
|
|
160
|
-
.@{prefixClass}-track {
|
|
161
|
-
background-color: @disabledColor;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.@{prefixClass}-handle,
|
|
165
|
-
.@{prefixClass}-dot {
|
|
166
|
-
background-color: #fff;
|
|
167
|
-
border-color: @disabledColor;
|
|
168
|
-
box-shadow: none;
|
|
169
|
-
cursor: not-allowed;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.@{prefixClass}-mark-text,
|
|
173
|
-
.@{prefixClass}-dot {
|
|
174
|
-
cursor: not-allowed !important;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.@{prefixClass}-vertical {
|
|
180
|
-
width: 14px;
|
|
181
|
-
height: 100%;
|
|
182
|
-
padding: 0 5px;
|
|
183
|
-
|
|
184
|
-
.@{prefixClass} {
|
|
185
|
-
&-rail {
|
|
186
|
-
width: 4px;
|
|
187
|
-
height: 100%;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
&-track {
|
|
191
|
-
bottom: 0;
|
|
192
|
-
left: 5px;
|
|
193
|
-
width: 4px;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&-track-draggable {
|
|
197
|
-
border-top: 0;
|
|
198
|
-
border-right: 5px solid rgba(0, 0, 0, 0);
|
|
199
|
-
border-bottom: 0;
|
|
200
|
-
border-left: 5px solid rgba(0, 0, 0, 0);
|
|
201
|
-
transform: translateX(-5px);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
&-handle {
|
|
205
|
-
position: absolute;
|
|
206
|
-
z-index: 1;
|
|
207
|
-
margin-top: 0;
|
|
208
|
-
margin-left: -5px;
|
|
209
|
-
touch-action: pan-y;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
&-mark {
|
|
213
|
-
top: 0;
|
|
214
|
-
left: 18px;
|
|
215
|
-
height: 100%;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
&-step {
|
|
219
|
-
width: 4px;
|
|
220
|
-
height: 100%;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
&-dot {
|
|
224
|
-
margin-left: -2px;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.motion-common() {
|
|
230
|
-
display: block !important;
|
|
231
|
-
animation-duration: 0.3s;
|
|
232
|
-
animation-fill-mode: both;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.make-motion(@className, @keyframeName) {
|
|
236
|
-
.@{className}-enter,
|
|
237
|
-
.@{className}-appear {
|
|
238
|
-
.motion-common();
|
|
239
|
-
animation-play-state: paused;
|
|
240
|
-
}
|
|
241
|
-
.@{className}-leave {
|
|
242
|
-
.motion-common();
|
|
243
|
-
animation-play-state: paused;
|
|
244
|
-
}
|
|
245
|
-
.@{className}-enter.@{className}-enter-active,
|
|
246
|
-
.@{className}-appear.@{className}-appear-active {
|
|
247
|
-
animation-name: ~'@{keyframeName}In';
|
|
248
|
-
animation-play-state: running;
|
|
249
|
-
}
|
|
250
|
-
.@{className}-leave.@{className}-leave-active {
|
|
251
|
-
animation-name: ~'@{keyframeName}Out';
|
|
252
|
-
animation-play-state: running;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
.zoom-motion(@className, @keyframeName) {
|
|
256
|
-
.make-motion(@className, @keyframeName);
|
|
257
|
-
.@{className}-enter,
|
|
258
|
-
.@{className}-appear {
|
|
259
|
-
transform: scale(0, 0); // need this by yiminghe
|
|
260
|
-
animation-timing-function: @ease-out-quint;
|
|
261
|
-
}
|
|
262
|
-
.@{className}-leave {
|
|
263
|
-
animation-timing-function: @ease-in-quint;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
.zoom-motion(rc-slider-tooltip-zoom-down, rcSliderTooltipZoomDown);
|
|
267
|
-
|
|
268
|
-
@keyframes rcSliderTooltipZoomDownIn {
|
|
269
|
-
0% {
|
|
270
|
-
transform: scale(0, 0);
|
|
271
|
-
transform-origin: 50% 100%;
|
|
272
|
-
opacity: 0;
|
|
273
|
-
}
|
|
274
|
-
100% {
|
|
275
|
-
transform: scale(1, 1);
|
|
276
|
-
transform-origin: 50% 100%;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
@keyframes rcSliderTooltipZoomDownOut {
|
|
281
|
-
0% {
|
|
282
|
-
transform: scale(1, 1);
|
|
283
|
-
transform-origin: 50% 100%;
|
|
284
|
-
}
|
|
285
|
-
100% {
|
|
286
|
-
transform: scale(0, 0);
|
|
287
|
-
transform-origin: 50% 100%;
|
|
288
|
-
opacity: 0;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.@{prefixClass}-tooltip {
|
|
293
|
-
position: absolute;
|
|
294
|
-
top: -9999px;
|
|
295
|
-
left: -9999px;
|
|
296
|
-
visibility: visible;
|
|
297
|
-
|
|
298
|
-
.borderBox();
|
|
299
|
-
|
|
300
|
-
&-hidden {
|
|
301
|
-
display: none;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
&-placement-top {
|
|
305
|
-
padding: @tooltip-arrow-width 0 @tooltip-distance 0;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
&-inner {
|
|
309
|
-
min-width: 24px;
|
|
310
|
-
height: 24px;
|
|
311
|
-
padding: 6px 2px;
|
|
312
|
-
color: @tooltip-color;
|
|
313
|
-
font-size: 12px;
|
|
314
|
-
line-height: 1;
|
|
315
|
-
text-align: center;
|
|
316
|
-
text-decoration: none;
|
|
317
|
-
background-color: @tooltip-bg;
|
|
318
|
-
border-radius: @border-radius-base;
|
|
319
|
-
box-shadow: 0 0 4px #d9d9d9;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
&-arrow {
|
|
323
|
-
position: absolute;
|
|
324
|
-
width: 0;
|
|
325
|
-
height: 0;
|
|
326
|
-
border-color: transparent;
|
|
327
|
-
border-style: solid;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
&-placement-top &-arrow {
|
|
331
|
-
bottom: @tooltip-distance - @tooltip-arrow-width;
|
|
332
|
-
left: 50%;
|
|
333
|
-
margin-left: -@tooltip-arrow-width;
|
|
334
|
-
border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
|
|
335
|
-
border-top-color: @tooltip-arrow-color;
|
|
336
|
-
}
|
|
337
|
-
}
|
package/docs/debug.vue
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
import Slider from '../src'
|
|
4
|
-
|
|
5
|
-
const disabled = ref(false)
|
|
6
|
-
const range = ref(false)
|
|
7
|
-
const reverse = ref(false)
|
|
8
|
-
const vertical = ref(false)
|
|
9
|
-
const data = ref()
|
|
10
|
-
|
|
11
|
-
function handleSliderChange(nextValues) {
|
|
12
|
-
console.log('Change:', nextValues)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function handleSliderChangeComplete(v) {
|
|
16
|
-
console.log('AfterChange:', v)
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div>
|
|
22
|
-
<div>
|
|
23
|
-
<label>
|
|
24
|
-
<input v-model="disabled" type="checkbox">
|
|
25
|
-
Disabled
|
|
26
|
-
</label>
|
|
27
|
-
<label>
|
|
28
|
-
<input v-model="range" type="checkbox">
|
|
29
|
-
Range
|
|
30
|
-
</label>
|
|
31
|
-
<label>
|
|
32
|
-
<input v-model="reverse" type="checkbox">
|
|
33
|
-
Reverse
|
|
34
|
-
</label>
|
|
35
|
-
<label>
|
|
36
|
-
<input v-model="vertical" type="checkbox">
|
|
37
|
-
Vertical
|
|
38
|
-
</label>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div style="height: 300px; width: 600px;">
|
|
42
|
-
<Slider
|
|
43
|
-
v-model:value="data"
|
|
44
|
-
:disabled="disabled"
|
|
45
|
-
:step="0.01"
|
|
46
|
-
:default-value="0.81"
|
|
47
|
-
:min="0"
|
|
48
|
-
:max="1"
|
|
49
|
-
:vertical="vertical"
|
|
50
|
-
:reverse="reverse"
|
|
51
|
-
@change="handleSliderChange"
|
|
52
|
-
@change-complete="handleSliderChangeComplete"
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<style scoped>
|
|
59
|
-
</style>
|
package/docs/editable.vue
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { UnstableContextProps } from '../src/context'
|
|
3
|
-
import { ref } from 'vue'
|
|
4
|
-
import Slider from '../src'
|
|
5
|
-
|
|
6
|
-
const style = {
|
|
7
|
-
width: '400px',
|
|
8
|
-
margin: '50px',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const value = ref([0, 50, 80])
|
|
12
|
-
|
|
13
|
-
function onDragStart(info: Parameters<UnstableContextProps['onDragStart']>[0]) {
|
|
14
|
-
const { rawValues } = info
|
|
15
|
-
console.log('Start:', rawValues)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function onDragChange(info: Parameters<UnstableContextProps['onDragChange']>[0]) {
|
|
19
|
-
const { rawValues } = info
|
|
20
|
-
console.log('Move:', rawValues)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function handleChange(nextValue: number | number[]) {
|
|
24
|
-
console.error('Change:', nextValue)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function handleChangeComplete(nextValue: number | number[]) {
|
|
28
|
-
console.log('Complete', nextValue)
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<template>
|
|
33
|
-
<div>
|
|
34
|
-
<div :style="style">
|
|
35
|
-
<Slider
|
|
36
|
-
v-model:value="value"
|
|
37
|
-
:range="{
|
|
38
|
-
editable: true,
|
|
39
|
-
minCount: 1,
|
|
40
|
-
maxCount: 4,
|
|
41
|
-
}"
|
|
42
|
-
:min="0"
|
|
43
|
-
:max="100"
|
|
44
|
-
:styles="{
|
|
45
|
-
rail: {
|
|
46
|
-
background: 'linear-gradient(to right, blue, red)',
|
|
47
|
-
},
|
|
48
|
-
track: {
|
|
49
|
-
background: 'orange',
|
|
50
|
-
},
|
|
51
|
-
}"
|
|
52
|
-
@change="handleChange"
|
|
53
|
-
@change-complete="handleChangeComplete"
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
<p>Here is a word that drag should not select it</p>
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
package/docs/handle.vue
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { CSSProperties } from 'vue'
|
|
3
|
-
import Slider from '@v-c/slider'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
|
-
import TooltipSlider, { HandleRender } from './TooltipSlider.tsx'
|
|
6
|
-
|
|
7
|
-
const data1 = ref(3)
|
|
8
|
-
const data2 = ref(3)
|
|
9
|
-
const data3 = ref(20)
|
|
10
|
-
const data4 = ref([3, 10])
|
|
11
|
-
const data5 = ref(3)
|
|
12
|
-
const wrapperStyle: CSSProperties = {
|
|
13
|
-
width: '400px',
|
|
14
|
-
margin: '50px',
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<div>
|
|
20
|
-
<div :style="wrapperStyle">
|
|
21
|
-
<p>Slider with custom handle</p>
|
|
22
|
-
<Slider v-model:value="data1" :min="0" :max="20" :handle-render="HandleRender" />
|
|
23
|
-
</div>
|
|
24
|
-
<div :style="wrapperStyle">
|
|
25
|
-
<p>Reversed Slider with custom handle</p>
|
|
26
|
-
<Slider v-model:value="data2" :min="0" :max="20" reverse :handle-render="HandleRender" />
|
|
27
|
-
</div>
|
|
28
|
-
<div :style="wrapperStyle">
|
|
29
|
-
<p>Slider with fixed values</p>
|
|
30
|
-
<Slider v-model:value="data3" :min="20" :marks="{ 20: 20, 40: 40, 100: 100 }" :step="null" />
|
|
31
|
-
</div>
|
|
32
|
-
<div :style="wrapperStyle">
|
|
33
|
-
<p>Range with custom tooltip</p>
|
|
34
|
-
<TooltipSlider
|
|
35
|
-
v-model:value="data4"
|
|
36
|
-
range
|
|
37
|
-
:min="0"
|
|
38
|
-
:max="20"
|
|
39
|
-
:tip-formatter="(value) => (`${value}!`)"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
<div :style="wrapperStyle">
|
|
43
|
-
<p>Keyboard events disabled</p>
|
|
44
|
-
<Slider v-model:value="data5" :keyboard="false" />
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<style scoped>
|
|
50
|
-
|
|
51
|
-
</style>
|
package/docs/marks.vue
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { CSSProperties } from 'vue'
|
|
3
|
-
import Slider from '@v-c/slider'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
|
-
|
|
6
|
-
const data1 = ref(20)
|
|
7
|
-
const data2 = ref([-10, 0])
|
|
8
|
-
const data3 = ref(20)
|
|
9
|
-
const data4 = ref(20)
|
|
10
|
-
const data5 = ref(20)
|
|
11
|
-
const data6 = ref(20)
|
|
12
|
-
const data7 = ref([20, 25, 35, 40])
|
|
13
|
-
const data8 = ref([20, 40])
|
|
14
|
-
|
|
15
|
-
const style: CSSProperties = {
|
|
16
|
-
width: '400px',
|
|
17
|
-
margin: '50px',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const marks = {
|
|
21
|
-
'-10': '-10°C',
|
|
22
|
-
'0': '0°C',
|
|
23
|
-
'26': '26°C',
|
|
24
|
-
'37': '37°C',
|
|
25
|
-
'50': '50°C',
|
|
26
|
-
'100': {
|
|
27
|
-
style: {
|
|
28
|
-
color: 'red',
|
|
29
|
-
},
|
|
30
|
-
label: '100°C',
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function log(value: unknown) {
|
|
35
|
-
console.log(value)
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<template>
|
|
40
|
-
<div>
|
|
41
|
-
<div :style="style">
|
|
42
|
-
<p>Slider with marks, `step=null`</p>
|
|
43
|
-
<Slider
|
|
44
|
-
v-model:value="data1"
|
|
45
|
-
:min="-10"
|
|
46
|
-
:marks="marks"
|
|
47
|
-
:step="null"
|
|
48
|
-
@change="log"
|
|
49
|
-
@change-complete="(v) => console.log('AfterChange', v)"
|
|
50
|
-
>
|
|
51
|
-
<template #mark="{ point, label }">
|
|
52
|
-
<template v-if="point === 100">
|
|
53
|
-
<strong>{{ label }}</strong>
|
|
54
|
-
</template>
|
|
55
|
-
<template v-else>
|
|
56
|
-
{{ label }}
|
|
57
|
-
</template>
|
|
58
|
-
</template>
|
|
59
|
-
</Slider>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<div :style="style">
|
|
63
|
-
<p>Range Slider with marks, `step=null`, pushable, draggableTrack</p>
|
|
64
|
-
<Slider
|
|
65
|
-
v-model:value="data2"
|
|
66
|
-
range
|
|
67
|
-
:min="-10"
|
|
68
|
-
:marks="marks"
|
|
69
|
-
:step="null"
|
|
70
|
-
:allow-cross="false"
|
|
71
|
-
pushable
|
|
72
|
-
@change="log"
|
|
73
|
-
@change-complete="(v) => console.log('AfterChange', v)"
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<div :style="style">
|
|
78
|
-
<p>Slider with marks and steps</p>
|
|
79
|
-
<Slider v-model:value="data3" dots :min="-10" :marks="marks" :step="10" @change="log" />
|
|
80
|
-
</div>
|
|
81
|
-
<div :style="style">
|
|
82
|
-
<p>Reversed Slider with marks and steps</p>
|
|
83
|
-
<Slider v-model:value="data4" dots reverse :min="-10" :marks="marks" :step="10" @change="log" />
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<div :style="style">
|
|
87
|
-
<p>Slider with marks, `included=false`</p>
|
|
88
|
-
<Slider v-model:value="data5" :min="-10" :marks="marks" :included="false" />
|
|
89
|
-
</div>
|
|
90
|
-
<div :style="style">
|
|
91
|
-
<p>Slider with marks and steps, `included=false`</p>
|
|
92
|
-
<Slider v-model:value="data6" :min="-10" :marks="marks" :step="10" :included="false" />
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div :style="style">
|
|
96
|
-
<p>Range with marks</p>
|
|
97
|
-
<Slider v-model:value="data7" range :min="-10" :marks="marks" @change="log" />
|
|
98
|
-
</div>
|
|
99
|
-
<div :style="style">
|
|
100
|
-
<p>Range with marks and steps</p>
|
|
101
|
-
<Slider v-model:value="data8" range :min="-10" :marks="marks" :step="10" @change="log" />
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</template>
|
package/docs/multiple.vue
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { CSSProperties, VNode } from 'vue'
|
|
3
|
-
import Slider from '@v-c/slider'
|
|
4
|
-
import { h, ref } from 'vue'
|
|
5
|
-
|
|
6
|
-
const style: CSSProperties = {
|
|
7
|
-
width: '400px',
|
|
8
|
-
margin: '50px',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function NodeWrapper(props: any): VNode {
|
|
12
|
-
return h('div', {}, [
|
|
13
|
-
h('slot', {}, { default: () => props.node }),
|
|
14
|
-
h('div', {}, 'TOOLTIP'),
|
|
15
|
-
])
|
|
16
|
-
}
|
|
17
|
-
function activeHandleRender(props: any) {
|
|
18
|
-
return h(NodeWrapper, { ...props })
|
|
19
|
-
}
|
|
20
|
-
const state = ref([0, 50, 80])
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<div>
|
|
25
|
-
<div :style="style">
|
|
26
|
-
<Slider
|
|
27
|
-
v-model:value="state"
|
|
28
|
-
range
|
|
29
|
-
:min="0"
|
|
30
|
-
:max="100"
|
|
31
|
-
:styles="{
|
|
32
|
-
tracks: {
|
|
33
|
-
background: `linear-gradient(to right, blue, red)`,
|
|
34
|
-
},
|
|
35
|
-
track: {
|
|
36
|
-
background: 'transparent',
|
|
37
|
-
},
|
|
38
|
-
}"
|
|
39
|
-
:active-handle-render="activeHandleRender"
|
|
40
|
-
@change="(nextValue) => {
|
|
41
|
-
console.log('>>>', nextValue)
|
|
42
|
-
}"
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<style scoped>
|
|
49
|
-
|
|
50
|
-
</style>
|