Skip to content

Commit

Permalink
sync upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiedb committed Apr 12, 2024
2 parents 895c07c + be6fab4 commit 3158629
Show file tree
Hide file tree
Showing 35 changed files with 13,522 additions and 142 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StippleUI"
uuid = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
authors = ["Adrian Salceanu <[email protected]>"]
version = "0.22.10"
version = "0.23.1"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -22,10 +22,10 @@ StippleUIDataFramesExt = "DataFrames"
Colors = "0.12"
DataFrames = "1"
Dates = "1.6"
Genie = "5"
Genie = "5.23.8"
OrderedCollections = "1"
PrecompileTools = "1"
Stipple = "0.27.15"
Stipple = "0.28.0"
Tables = "1"
julia = "1.6"

Expand Down
12,217 changes: 12,216 additions & 1 deletion assets/css/quasar.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions demos/anapp/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
12 changes: 12 additions & 0 deletions demos/anapp/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using GenieFramework
@genietools

@app begin
@in say_hi = false
@onchange say_hi println("Hi!")
end

ui() = button("Hi", @click("say_hi = !say_hi"))
@page("/", ui)

up()
3 changes: 3 additions & 0 deletions demos/cards/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
13 changes: 13 additions & 0 deletions demos/cards/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using GenieFramework
@genietools

@app begin

end

ui() = begin
card_1(; show_avatar = false, title = "Welcome to Genie", subtitle = "The best Julia Framework", content = "",
buttons_component = nothing, menu_component = nothing, show_separator = false)
end

@page("/", ui)
4 changes: 4 additions & 0 deletions demos/complex_inputs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
89 changes: 89 additions & 0 deletions demos/complex_inputs/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using GenieFramework
@genietools

@app begin
@in start_date = today()
@out start_date_has_errors = false
@in end_date = today() + Day(7)
@out end_date_has_errors = false
@in start_time = Dates.Time(now())

@onchange start_date begin
if start_date < today()
notify(__model__, "Start date must be today or later", :negative)
start_date_has_errors = true
start_date = today()
return
end
if start_date > end_date
notify(__model__, "Start date must be before end date", :negative)
start_date_has_errors = true
start_date = today()
return
end
if start_date >= today() && start_date <= end_date
if start_date_has_errors
start_date_has_errors = false
return
end

notify(__model__, "Start date saved", :positive)
end
end

@onchange end_date begin
if end_date < today()
notify(__model__, "End date must be today or later", :negative)
end_date_has_errors = true
end_date = today()
return
end
if end_date < start_date
notify(__model__, "End date must be after start date", :negative)
end_date_has_errors = true
end_date = start_date + Day(7)
return
end
if end_date >= today() && end_date >= start_date
if end_date_has_errors
end_date_has_errors = false
return
end

notify(__model__, "End date saved", :positive)
end
end

@onchange start_time begin
notify(__model__, "Start time saved", :positive)
end
end

ui() = begin
row(style="max-width: 400px") do
cell() do; [
row() do
cell() do
heading("Date range picker demo")
end
end
row() do
cell() do
datefield("Start date", :start_date, datepicker_props = Dict(:todaybtn => true, :nounset => true), textfield_props = Dict(:bgcolor => "green-1"))
end
end
row() do
cell() do
datefield("End date", :end_date, datepicker_props = Dict(:nounset => true), icon_props = Dict(:color => "red-10"), textfield_props = Dict(:dense => true, :square => true))
end
end
row() do
cell() do
timefield("Start time", :start_time, timepicker_props = Dict(:nowbtn => true, :nounset => true, :format24h => true, :withseconds => true), textfield_props = Dict(:bgcolor => "blue-1"))
end
end
];end
end
end

@page("/", ui)
3 changes: 0 additions & 3 deletions demos/Project.toml → demos/datatable/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
GenieDevTools = "4e5d9629-6565-4102-a9ff-45c707eb060e"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
Stipple = "4acbeb90-81a0-11ea-1966-bdaff8155998"
StipplePlotly = "ec984513-233d-481d-95b0-a3b58b97af2b"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
20 changes: 20 additions & 0 deletions demos/datatable/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module App

using GenieFramework
using DataFrames
@genietools

@app begin
NO_OF_ROWS = 10_000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))
ROWS_PER_PAGE = 10

@out df = DATA
@out dt = DataTable(DataFrame([]), DataTableOptions(DATA))

@out pagination = DataTablePagination(rows_per_page = ROWS_PER_PAGE, rows_number = NO_OF_ROWS)
@out loading = false
@in filter = ""
end

end
6 changes: 6 additions & 0 deletions demos/tablefilter/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
Stipple = "4acbeb90-81a0-11ea-1966-bdaff8155998"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
42 changes: 42 additions & 0 deletions demos/tablefilter/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module App

using GenieFramework
using DataFrames
@genietools

@app begin
NO_OF_ROWS = 1000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))
ROWS_PER_PAGE = 10

@out df = DATA
@out dt = DataTable(DATA) # DataTable(DataFrame([]), DataTableOptions(DATA))
@out pagination = DataTablePagination(rows_per_page = ROWS_PER_PAGE, rows_number = NO_OF_ROWS)
@out loading = false
# @in filter = ""
@in dfilter = ""

# @onchange isready begin
# dt = DataTable(DATA[1:ROWS_PER_PAGE, :])
# filter = ""
# end

# @event request begin
# loading = true
# state = process_request(DATA, dt, pagination, filter)
# dt = state.datatable
# pagination = state.pagination
# loading = false
# end

# @onchange filter begin
# pagination.page = 1
# state = process_request(DATA, dt, pagination, filter)
# dt = state.datatable
# pagination = state.pagination
# end
end

@page("/", "ui.jl")

end
10 changes: 10 additions & 0 deletions demos/tablefilter/ui.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# table(:dt, paginationsync = :pagination, @on("request", :request), loading = :loading, filter = :filter, title = "Random data")
Stipple.table(:dt, class="table-white-row", pagination=:pagination, dense=true, hide__pagination=false, filter=:dfilter,
template(var"v-slot:top-right"="",
textfield("", hint="Search by any keywords", :dfilter, borderless="", dense="", debounce="300", placeholder="Search", [
template(var"v-slot:append"=true,
icon("search")
)]
)
)
)
6 changes: 6 additions & 0 deletions demos/tables/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
Stipple = "4acbeb90-81a0-11ea-1966-bdaff8155998"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
27 changes: 16 additions & 11 deletions demos/tables/app.jl
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
module App

using GenieFramework
using DataFrames
@genietools


@app begin
NO_OF_ROWS = 10_000
NO_OF_ROWS = 1000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))
ROWS_PER_PAGE = 10

@out data = DataTable(DataFrame([]), DataTableOptions(DATA))
@out df = DATA
@out dt = DataTable(DataFrame([]), DataTableOptions(DATA))
@out pagination = DataTablePagination(rows_per_page = ROWS_PER_PAGE, rows_number = NO_OF_ROWS)
@out loading = false
@in filter = ""

@onchange isready begin
data = DataTable(DATA[1:ROWS_PER_PAGE, :])
dt = DataTable(DATA[1:ROWS_PER_PAGE, :])
filter = ""
end

@event :request begin
@event request begin
loading = true
state = process_request(DATA, data, pagination, filter)
@show state
data = state.datatable
state = process_request(DATA, dt, pagination, filter)
dt = state.datatable
pagination = state.pagination
loading = false
end

@onchange filter begin
loading = true
pagination.page = 1
state = process_request(DATA, data, pagination, filter)
data = state.datatable
state = process_request(DATA, dt, pagination, filter)
dt = state.datatable
pagination = state.pagination
loading = false
end
end

@page("/", "ui.jl")
@page("/", "ui.jl")

end
2 changes: 2 additions & 0 deletions demos/tables/blankapp/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
32 changes: 32 additions & 0 deletions demos/tables/blankapp/app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module App
# set up Genie development environment
using GenieFramework
@genietools

# add your data analysis code
function mean(x)
sum(x) / length(x)
end

# add reactive code to make the UI interactive
@app begin
# reactive variables are tagged with @in and @out
@in N = 0
@out msg = "The average is 0."
# @private defines a non-reactive variable
@private result = 0.0

# watch a variable and execute a block of code when
# its value changes
@onchange N begin
# the values of result and msg in the UI will
# be automatically updated
result = mean(rand(N))
msg = "The average is $result."
end
end

# register a new route and the page that will be
# loaded on access
@page("/", "app.jl.html")
end
6 changes: 6 additions & 0 deletions demos/tables/blankapp/app.jl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h4> Hello Genie! </h4>
<p> Generated {{N}} random numbers. </p>
<p v-text="msg"></p>
<q-slider v-model="N" :label="true"></q-slider>
<p>This is the default view for the application.</p>
<p>You can change this view by editing the file <code>app.jl.html</code>.</p>
2 changes: 1 addition & 1 deletion demos/tables/ui.jl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
table(:data, paginationsync = :pagination, @on("request", :request), loading = :loading, filter = :filter, title = "Random data")
table(:dt, paginationsync = :pagination, @on("request", :request), loading = :loading, filter = :filter, title = "Random data")
7 changes: 7 additions & 0 deletions demos/uploader/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
GenieAutoReload = "c6228e60-a24f-11e9-1776-c313472ebacc"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Stipple = "4acbeb90-81a0-11ea-1966-bdaff8155998"
StippleUI = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
Loading

0 comments on commit 3158629

Please sign in to comment.