This repository was archived by the owner on Sep 26, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +120
-32
lines changed
svelte-materialify/src/components/Slider Expand file tree Collapse file tree 7 files changed +120
-32
lines changed Original file line number Diff line number Diff line change 32
32
},
33
33
"defaultValue" : " 24px"
34
34
},
35
+ {
36
+ "visibility" : " public" ,
37
+ "description" : null ,
38
+ "keywords" : [],
39
+ "name" : " width" ,
40
+ "kind" : " let" ,
41
+ "static" : false ,
42
+ "readonly" : false ,
43
+ "type" : {
44
+ "kind" : " type" ,
45
+ "text" : " any" ,
46
+ "type" : " any"
47
+ }
48
+ },
49
+ {
50
+ "visibility" : " public" ,
51
+ "description" : null ,
52
+ "keywords" : [],
53
+ "name" : " height" ,
54
+ "kind" : " let" ,
55
+ "static" : false ,
56
+ "readonly" : false ,
57
+ "type" : {
58
+ "kind" : " type" ,
59
+ "text" : " any" ,
60
+ "type" : " any"
61
+ }
62
+ },
63
+ {
64
+ "visibility" : " public" ,
65
+ "description" : null ,
66
+ "keywords" : [],
67
+ "name" : " viewWidth" ,
68
+ "kind" : " let" ,
69
+ "static" : false ,
70
+ "readonly" : false ,
71
+ "type" : {
72
+ "kind" : " type" ,
73
+ "text" : " string" ,
74
+ "type" : " string"
75
+ },
76
+ "defaultValue" : " 24"
77
+ },
78
+ {
79
+ "visibility" : " public" ,
80
+ "description" : null ,
81
+ "keywords" : [],
82
+ "name" : " viewHeight" ,
83
+ "kind" : " let" ,
84
+ "static" : false ,
85
+ "readonly" : false ,
86
+ "type" : {
87
+ "kind" : " type" ,
88
+ "text" : " string" ,
89
+ "type" : " string"
90
+ },
91
+ "defaultValue" : " 24"
92
+ },
35
93
{
36
94
"visibility" : " public" ,
37
95
"description" : null ,
Original file line number Diff line number Diff line change 250
250
"type" : " any"
251
251
}
252
252
},
253
+ {
254
+ "visibility" : " public" ,
255
+ "description" : null ,
256
+ "keywords" : [],
257
+ "name" : " emptyString" ,
258
+ "kind" : " let" ,
259
+ "static" : false ,
260
+ "readonly" : false ,
261
+ "type" : {
262
+ "kind" : " type" ,
263
+ "text" : " string" ,
264
+ "type" : " string"
265
+ },
266
+ "defaultValue" : " "
267
+ },
253
268
{
254
269
"visibility" : " public" ,
255
270
"description" : null ,
270
285
"components" : [],
271
286
"description" : null ,
272
287
"keywords" : [],
273
- "events" : [],
288
+ "events" : [
289
+ {
290
+ "visibility" : " public" ,
291
+ "description" : null ,
292
+ "keywords" : [],
293
+ "name" : " change"
294
+ }
295
+ ],
274
296
"slots" : [
275
297
{
276
298
"name" : " prepend-outer" ,
Original file line number Diff line number Diff line change 55
55
"readonly" : false ,
56
56
"type" : {
57
57
"kind" : " type" ,
58
- "text" : " object " ,
59
- "type" : " object "
58
+ "text" : " boolean " ,
59
+ "type" : " boolean "
60
60
},
61
- "defaultValue" : null
61
+ "defaultValue" : false
62
62
}
63
63
],
64
64
"computed" : [],
65
65
"methods" : [],
66
66
"components" : [],
67
67
"description" : null ,
68
68
"keywords" : [],
69
- "events" : [],
69
+ "events" : [
70
+ {
71
+ "name" : " click" ,
72
+ "parent" : " button" ,
73
+ "modificators" : [],
74
+ "locations" : null ,
75
+ "loc" : null ,
76
+ "visibility" : " public" ,
77
+ "description" : " " ,
78
+ "keywords" : []
79
+ }
80
+ ],
70
81
"slots" : [
71
82
{
72
83
"name" : " default" ,
Original file line number Diff line number Diff line change 27
27
"readonly" : false ,
28
28
"type" : {
29
29
"kind" : " type" ,
30
- "text" : " object " ,
31
- "type" : " object "
30
+ "text" : " string " ,
31
+ "type" : " string "
32
32
},
33
- "defaultValue" : null
33
+ "defaultValue" : " "
34
34
}
35
35
],
36
36
"computed" : [],
Original file line number Diff line number Diff line change 8
8
</script >
9
9
10
10
<Subheader >Default Slider</Subheader >
11
- <Slider {min } {max } bind:value ={slider } hint = " Hint Text " >
12
- <span slot =" append" >
11
+ <Slider {min } {max } bind:value ={slider }>
12
+ <span slot =" append-outer " >
13
13
<TextField bind:value ={slider } />
14
14
</span >
15
15
</Slider >
16
16
17
17
<Subheader >Range</Subheader >
18
18
<Slider {min } {max } bind:value ={range }>
19
- <span slot =" prepend" >
19
+ <span slot =" prepend-outer " >
20
20
<TextField bind:value ={range [0 ]} />
21
21
</span >
22
- <span slot =" append" >
23
- <TextField bind:value ={range [1 ]} />
22
+ <span slot =" append-outer " >
23
+ <TextField class = "ml-3" bind:value ={range [1 ]} />
24
24
</span >
25
25
</Slider >
Original file line number Diff line number Diff line change 1
1
<script >
2
2
import Input from ' ../Input' ;
3
- import { onMount , afterUpdate , createEventDispatcher } from ' svelte' ;
3
+ import { onMount , createEventDispatcher } from ' svelte' ;
4
4
5
5
let sliderElement;
6
6
let slider;
7
- let localValue ;
7
+ let internalValue ;
8
8
const dispatch = createEventDispatcher ();
9
9
10
10
export let min = 0 ;
70
70
slider = sliderElement .noUiSlider ;
71
71
slider .on (' update' , (val , handle ) => {
72
72
value = format (val);
73
- localValue = value;
73
+ internalValue = value;
74
74
dispatch (' update' , { value: val, handle });
75
75
});
76
76
slider .on (' change' , (val , handle ) => {
82
82
};
83
83
});
84
84
85
- $: {
86
- if (slider != null ) {
87
- slider .updateOptions ({
88
- range: { min, max },
89
- orientation: vertical ? ' vertical' : ' horizontal' ,
90
- connect,
91
- margin,
92
- limit,
93
- padding,
94
- });
95
- }
85
+ $: if (slider) {
86
+ if (value !== internalValue) slider .set (value, false );
87
+ slider .updateOptions ({
88
+ start: value,
89
+ range: { min, max },
90
+ orientation: vertical ? ' vertical' : ' horizontal' ,
91
+ connect,
92
+ margin,
93
+ limit,
94
+ padding,
95
+ step,
96
+ }, false );
96
97
}
97
-
98
- afterUpdate (() => {
99
- if (slider && value !== localValue) slider .set (value, false );
100
- });
101
98
</script >
102
99
103
100
<style lang =" scss" src =" ./Slider.scss" global >
You can’t perform that action at this time.
0 commit comments