Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	Project.toml
  • Loading branch information
Adrian Salceanu committed Apr 12, 2024
2 parents 2aaa859 + e88e905 commit 099aa5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ext/StippleDataFramesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ module StippleDataFramesExt

using Stipple

isdefined(Base, :get_extension) ? using DataFrames : using ..DataFrames
isdefined(Base, :get_extension) ? (using DataFrames) : (using ..DataFrames)

# DataFrame(d::Dict) will generate multiple rows if a field contains a Vector
# to prevent this we need to wrap vectors in a Ref()
function dataframe(d::Dict)
DataFrame([p[1] => p[2] isa Vector ? Ref(p[2]) : p[2] for p in d])
end

function Stipple.stipple_parse(::Type{DF} where DF <: DataFrames.AbstractDataFrame, d::Vector)
isempty(d) ? DF() : reduce(vcat, DataFrames.DataFrame.(d))
isempty(d) ? DF() : reduce(vcat, dataframe.(d))
end

function Stipple.render(df::DataFrames.AbstractDataFrame)
Expand Down
2 changes: 1 addition & 1 deletion ext/StippleJSONExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module StippleJSONExt

using Stipple

isdefined(Base, :get_extension) ? using JSON : using ..JSON
isdefined(Base, :get_extension) ? (using JSON) : (using ..JSON)

# garantee interoperability of different JSONTText definitions in Stipple and JSON
# for both JSON3 and JSON
Expand Down
2 changes: 1 addition & 1 deletion ext/StippleOffsetArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module StippleOffsetArraysExt

using Stipple

isdefined(Base, :get_extension) ? using OffsetArrays : using ..OffsetArrays
isdefined(Base, :get_extension) ? (using OffsetArrays) : (using ..OffsetArrays)

function Stipple.convertvalue(targetfield::Union{Ref{T}, Reactive{T}}, value) where T <: OffsetArrays.OffsetArray
a = Stipple.stipple_parse(eltype(targetfield), value)
Expand Down

0 comments on commit 099aa5f

Please sign in to comment.