@@ -79,8 +79,9 @@ function rangeslider(vals::AbstractArray;
79
79
Creates a slider widget which can take on the values in `vals` and accepts several "handles".
80
80
Pass a vector to `value` with two values if you want to select a range.
81
81
"""
82
- function rangeslider (:: WidgetTheme , vals:: AbstractRange{<:Integer} , formatted_vals = format .(vals);
83
- style = Dict (), label = nothing , value = medianelement (vals), orientation = " horizontal" , readout = true )
82
+ function rangeslider (theme:: WidgetTheme , vals:: AbstractRange{<:Integer} , formatted_vals = format .(vals);
83
+ style = Dict (), label = nothing , value = medianelement (vals), orientation = " horizontal" , readout = true ,
84
+ className = " is-primary" )
84
85
85
86
T = Observables. _val (value) isa Vector ? Vector{eltype (vals)} : eltype (vals)
86
87
value isa AbstractObservable || (value = Observable {T} (value))
@@ -89,7 +90,7 @@ function rangeslider(::WidgetTheme, vals::AbstractRange{<:Integer}, formatted_va
89
90
orientation = string (orientation)
90
91
preprocess = T<: Vector ? js " unencoded.map(Math.round)" : js " Math.round(unencoded[0])"
91
92
92
- scp = Scope (imports = [nouislider_min_js, nouislider_min_css])
93
+ scp = Scope (imports = vcat ( [nouislider_min_js, nouislider_min_css], libraries (theme)) )
93
94
setobservable! (scp, " index" , index)
94
95
fromJS = Observable (scp, " fromJS" , false )
95
96
changes = Observable (scp, " changes" , 0 )
@@ -158,12 +159,12 @@ function rangeslider(::WidgetTheme, vals::AbstractRange{<:Integer}, formatted_va
158
159
sld = t. scope
159
160
sld = label != = nothing ? flex_row (label, sld) : sld
160
161
sld = readout ? vbox (vskip (3 em), sld) : sld
161
- sld = div (sld, className = " field rangeslider rangeslider-horizontal interact-widget" )
162
+ sld = div (sld, className = " field rangeslider rangeslider-horizontal interact-widget $className " )
162
163
else
163
164
sld = t. scope
164
165
sld = readout ? hbox (hskip (6 em), sld) : sld
165
166
sld = label != = nothing ? vbox (label, sld) : sld
166
- sld = div (sld, className = " field rangeslider rangeslider-vertical interact-widget" )
167
+ sld = div (sld, className = " field rangeslider rangeslider-vertical interact-widget $className " )
167
168
end
168
169
sld
169
170
end
@@ -180,7 +181,7 @@ function rangepicker(vals::AbstractArray;
180
181
181
182
A multihandle slider with a set of spinboxes, one per handle.
182
183
"""
183
- function rangepicker (:: WidgetTheme , vals:: AbstractRange{S} ; value = [extrema (vals)... ], readout = false ) where {S}
184
+ function rangepicker (:: WidgetTheme , vals:: AbstractRange{S} ; value = [extrema (vals)... ], readout = false , className = " is-primary " ) where {S}
184
185
T = Observables. _val (value) isa Vector ? Vector{eltype (vals)} : eltype (vals)
185
186
value isa AbstractObservable || (value = Observable {T} (value))
186
187
wdg = Widget {:rangepicker} (output = value)
@@ -200,7 +201,7 @@ function rangepicker(::WidgetTheme, vals::AbstractRange{S}; value = [extrema(val
200
201
end
201
202
inputs = t -> (val for (key, val) in components (t) if occursin (r" slider|input" , string (key)))
202
203
wdg. layout = t -> div (inputs (t)... , className = " interact-widget" )
203
- wdg[" slider" ] = rangeslider (vals, value = value, readout = readout)
204
+ wdg[" slider" ] = rangeslider (vals, value = value, readout = readout, className = className )
204
205
wdg[" changes" ] = map (+ , (val[" changes" ] for val in inputs (wdg)). .. )
205
206
return wdg
206
207
end
0 commit comments