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 3232 },
3333 "defaultValue" : " 24px"
3434 },
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+ },
3593 {
3694 "visibility" : " public" ,
3795 "description" : null ,
Original file line number Diff line number Diff line change 250250 "type" : " any"
251251 }
252252 },
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+ },
253268 {
254269 "visibility" : " public" ,
255270 "description" : null ,
270285 "components" : [],
271286 "description" : null ,
272287 "keywords" : [],
273- "events" : [],
288+ "events" : [
289+ {
290+ "visibility" : " public" ,
291+ "description" : null ,
292+ "keywords" : [],
293+ "name" : " change"
294+ }
295+ ],
274296 "slots" : [
275297 {
276298 "name" : " prepend-outer" ,
Original file line number Diff line number Diff line change 5555 "readonly" : false ,
5656 "type" : {
5757 "kind" : " type" ,
58- "text" : " object " ,
59- "type" : " object "
58+ "text" : " boolean " ,
59+ "type" : " boolean "
6060 },
61- "defaultValue" : null
61+ "defaultValue" : false
6262 }
6363 ],
6464 "computed" : [],
6565 "methods" : [],
6666 "components" : [],
6767 "description" : null ,
6868 "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+ ],
7081 "slots" : [
7182 {
7283 "name" : " default" ,
Original file line number Diff line number Diff line change 2727 "readonly" : false ,
2828 "type" : {
2929 "kind" : " type" ,
30- "text" : " object " ,
31- "type" : " object "
30+ "text" : " string " ,
31+ "type" : " string "
3232 },
33- "defaultValue" : null
33+ "defaultValue" : " "
3434 }
3535 ],
3636 "computed" : [],
Original file line number Diff line number Diff line change 88 </script >
99
1010<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 " >
1313 <TextField bind:value ={slider } />
1414 </span >
1515</Slider >
1616
1717<Subheader >Range</Subheader >
1818<Slider {min } {max } bind:value ={range }>
19- <span slot =" prepend" >
19+ <span slot =" prepend-outer " >
2020 <TextField bind:value ={range [0 ]} />
2121 </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 ]} />
2424 </span >
2525</Slider >
Original file line number Diff line number Diff line change 11<script >
22 import Input from ' ../Input' ;
3- import { onMount , afterUpdate , createEventDispatcher } from ' svelte' ;
3+ import { onMount , createEventDispatcher } from ' svelte' ;
44
55 let sliderElement;
66 let slider;
7- let localValue ;
7+ let internalValue ;
88 const dispatch = createEventDispatcher ();
99
1010 export let min = 0 ;
7070 slider = sliderElement .noUiSlider ;
7171 slider .on (' update' , (val , handle ) => {
7272 value = format (val);
73- localValue = value;
73+ internalValue = value;
7474 dispatch (' update' , { value: val, handle });
7575 });
7676 slider .on (' change' , (val , handle ) => {
8282 };
8383 });
8484
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 );
9697 }
97-
98- afterUpdate (() => {
99- if (slider && value !== localValue) slider .set (value, false );
100- });
10198 </script >
10299
103100<style lang =" scss" src =" ./Slider.scss" global >
You can’t perform that action at this time.
0 commit comments