Skip to content

Commit

Permalink
small edit
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Dec 31, 2020
1 parent cf503e9 commit 9f95834
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ export range, RangeData, slider
Genie.Renderer.Html.register_normal_element("q__range", context = @__MODULE__)
Genie.Renderer.Html.register_normal_element("q__slider", context = @__MODULE__)


Base.@kwdef mutable struct RangeData{T}
range::UnitRange{T}
end

function Base.range( range::AbstractRange{T} where T <: Real,
fieldname::Union{Symbol,Nothing},
function Base.range(
range::AbstractRange{T} where T <: Real,
fieldname::Union{Symbol,Nothing} = nothing,
args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)

wrap() do
q__range(args...; attributes(
[Symbol(":min") => first(range), Symbol(":max") => last(range), Symbol(":step") => step(range),
:fieldname => fieldname, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
q__range( args...;
attributes(
[ Symbol(":min") => first(range),
Symbol(":max") => last(range),
Symbol(":step") => step(range),
:fieldname => fieldname, kwargs...
], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down

0 comments on commit 9f95834

Please sign in to comment.