lesli_view 0.1.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lesli_view/charts/bar.rb +41 -0
- data/lib/lesli_view/charts/general.html.erb +97 -0
- data/lib/lesli_view/charts/general.rb +71 -0
- data/lib/lesli_view/charts/line.rb +41 -0
- data/lib/lesli_view/{element → components}/header.html.erb +10 -2
- data/lib/lesli_view/{element → components}/header.rb +4 -3
- data/lib/lesli_view/components/header.scss +69 -0
- data/lib/lesli_view/components/panel.html.erb +37 -0
- data/lib/lesli_view/{element/form.rb → components/panel.rb} +8 -12
- data/lib/lesli_view/components/panel.scss +37 -0
- data/lib/lesli_view/components/tabs.html.erb +35 -0
- data/lib/lesli_view/components/tabs.rb +58 -0
- data/lib/lesli_view/components/tabs_spec.rb +0 -0
- data/lib/lesli_view/components/timeline.html.erb +23 -0
- data/lib/lesli_view/components/timeline.rb +45 -0
- data/lib/lesli_view/components/timeline.scss +218 -0
- data/lib/lesli_view/{element → components}/toolbar.rb +1 -1
- data/lib/lesli_view/components/toolbar.scss +54 -0
- data/lib/lesli_view/elements/avatar.html.erb +7 -0
- data/lib/lesli_view/elements/avatar.rb +76 -0
- data/lib/lesli_view/elements/avatar.scss +50 -0
- data/lib/lesli_view/elements/button.html.erb +24 -0
- data/lib/lesli_view/{element → elements}/button.rb +26 -5
- data/lib/lesli_view/elements/empty.html.erb +8 -0
- data/lib/lesli_view/elements/empty.rb +40 -0
- data/lib/lesli_view/elements/table.html.erb +48 -0
- data/lib/lesli_view/{element → elements}/table.rb +29 -21
- data/lib/lesli_view/elements/table.scss +153 -0
- data/lib/lesli_view/forms/builder.rb +47 -0
- data/lib/lesli_view/forms/builder_horizontal.rb +25 -0
- data/lib/lesli_view/forms/fields.rb +144 -0
- data/lib/lesli_view/forms/fieldset.rb +15 -0
- data/lib/lesli_view/forms/form.scss +87 -0
- data/lib/lesli_view/forms/inputs.rb +46 -0
- data/lib/lesli_view/layout/container.html.erb +5 -3
- data/lib/lesli_view/version.rb +2 -1
- data/lib/lesli_view.rb +27 -5
- data/readme.md +29 -32
- metadata +39 -17
- data/lib/lesli_view/element/button.html.erb +0 -12
- data/lib/lesli_view/element/form.html.erb +0 -10
- data/lib/lesli_view/element/table.full.rb +0 -43
- data/lib/lesli_view/element/table.html.erb +0 -39
- data/lib/lesli_view/element/table.html.full.erb +0 -101
- data/lib/lesli_view/lesli_view.scss +0 -3
- /data/lib/lesli_view/{element → components}/toolbar.html.erb +0 -0
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lesli_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Lesli Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: view_component
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description:
|
27
|
+
description: Web Elements & Components for The Lesli Framework.
|
28
28
|
email:
|
29
29
|
- hello@lesli.tech
|
30
30
|
executables: []
|
@@ -33,22 +33,44 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- Rakefile
|
35
35
|
- lib/lesli_view.rb
|
36
|
-
- lib/lesli_view/
|
37
|
-
- lib/lesli_view/
|
38
|
-
- lib/lesli_view/
|
39
|
-
- lib/lesli_view/
|
40
|
-
- lib/lesli_view/
|
41
|
-
- lib/lesli_view/
|
42
|
-
- lib/lesli_view/
|
43
|
-
- lib/lesli_view/
|
44
|
-
- lib/lesli_view/
|
45
|
-
- lib/lesli_view/
|
46
|
-
- lib/lesli_view/
|
47
|
-
- lib/lesli_view/
|
36
|
+
- lib/lesli_view/charts/bar.rb
|
37
|
+
- lib/lesli_view/charts/general.html.erb
|
38
|
+
- lib/lesli_view/charts/general.rb
|
39
|
+
- lib/lesli_view/charts/line.rb
|
40
|
+
- lib/lesli_view/components/header.html.erb
|
41
|
+
- lib/lesli_view/components/header.rb
|
42
|
+
- lib/lesli_view/components/header.scss
|
43
|
+
- lib/lesli_view/components/panel.html.erb
|
44
|
+
- lib/lesli_view/components/panel.rb
|
45
|
+
- lib/lesli_view/components/panel.scss
|
46
|
+
- lib/lesli_view/components/tabs.html.erb
|
47
|
+
- lib/lesli_view/components/tabs.rb
|
48
|
+
- lib/lesli_view/components/tabs_spec.rb
|
49
|
+
- lib/lesli_view/components/timeline.html.erb
|
50
|
+
- lib/lesli_view/components/timeline.rb
|
51
|
+
- lib/lesli_view/components/timeline.scss
|
52
|
+
- lib/lesli_view/components/toolbar.html.erb
|
53
|
+
- lib/lesli_view/components/toolbar.rb
|
54
|
+
- lib/lesli_view/components/toolbar.scss
|
55
|
+
- lib/lesli_view/elements/avatar.html.erb
|
56
|
+
- lib/lesli_view/elements/avatar.rb
|
57
|
+
- lib/lesli_view/elements/avatar.scss
|
58
|
+
- lib/lesli_view/elements/button.html.erb
|
59
|
+
- lib/lesli_view/elements/button.rb
|
60
|
+
- lib/lesli_view/elements/empty.html.erb
|
61
|
+
- lib/lesli_view/elements/empty.rb
|
62
|
+
- lib/lesli_view/elements/table.html.erb
|
63
|
+
- lib/lesli_view/elements/table.rb
|
64
|
+
- lib/lesli_view/elements/table.scss
|
48
65
|
- lib/lesli_view/engine.rb
|
66
|
+
- lib/lesli_view/forms/builder.rb
|
67
|
+
- lib/lesli_view/forms/builder_horizontal.rb
|
68
|
+
- lib/lesli_view/forms/fields.rb
|
69
|
+
- lib/lesli_view/forms/fieldset.rb
|
70
|
+
- lib/lesli_view/forms/form.scss
|
71
|
+
- lib/lesli_view/forms/inputs.rb
|
49
72
|
- lib/lesli_view/layout/container.html.erb
|
50
73
|
- lib/lesli_view/layout/container.rb
|
51
|
-
- lib/lesli_view/lesli_view.scss
|
52
74
|
- lib/lesli_view/version.rb
|
53
75
|
- license
|
54
76
|
- readme.md
|
@@ -77,5 +99,5 @@ requirements: []
|
|
77
99
|
rubygems_version: 3.4.19
|
78
100
|
signing_key:
|
79
101
|
specification_version: 4
|
80
|
-
summary:
|
102
|
+
summary: Web Elements & Components for The Lesli Framework.
|
81
103
|
test_files: []
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<button class="<%= button_classes %>" data-action="click->button#click">
|
2
|
-
<% if icon %>
|
3
|
-
<span class="icon <%= 'is-small' if small %>">
|
4
|
-
<span class="material-icons"><%= icon %></span>
|
5
|
-
</span>
|
6
|
-
<% end %>
|
7
|
-
<% unless icon_only?(content.present?) %>
|
8
|
-
<span>
|
9
|
-
<%= content %>
|
10
|
-
</span>
|
11
|
-
<% end %>
|
12
|
-
</button>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module LesliView
|
2
|
-
module Element
|
3
|
-
class Table < ViewComponent::Base
|
4
|
-
attr_reader :id, :class_name, :pagination, :loading, :headless, :columns, :records, :link
|
5
|
-
|
6
|
-
def initialize(id: nil, class_name: "is-striped", pagination: nil, loading: false, headless: false, columns:, records:, link: nil)
|
7
|
-
@id = id
|
8
|
-
@class_name = class_name
|
9
|
-
@pagination = pagination
|
10
|
-
@loading = loading
|
11
|
-
@headless = headless
|
12
|
-
@columns = columns
|
13
|
-
@records = records
|
14
|
-
@link = link
|
15
|
-
end
|
16
|
-
|
17
|
-
def table_header_class(column)
|
18
|
-
column[:field] == "id" || column[:align] == "center" ? "has-text-centered" : ""
|
19
|
-
end
|
20
|
-
|
21
|
-
def table_body_class(column)
|
22
|
-
column[:field] == "id" || column[:align] == "center" ? "has-text-centered" : ""
|
23
|
-
end
|
24
|
-
|
25
|
-
def current_sort_dir(column)
|
26
|
-
@current_sort_dir ||= {}
|
27
|
-
@current_sort_dir[column[:field]] || "asc"
|
28
|
-
end
|
29
|
-
|
30
|
-
def toggle_sort_dir(column)
|
31
|
-
current_sort_dir(column) == "asc" ? "desc" : "asc"
|
32
|
-
end
|
33
|
-
|
34
|
-
def render_head_slot(column)
|
35
|
-
content_for?(:"head_#{column[:field]}") ? content_for(:"head_#{column[:field]}") : column[:label]
|
36
|
-
end
|
37
|
-
|
38
|
-
def detail_active?(record)
|
39
|
-
record[:detail_active]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<div class="lesli-table-container">
|
2
|
-
<table id="<%= id %>" class="table is-fullwidth lesli-table mb-5 <%= class_name %>">
|
3
|
-
<% unless headless %>
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<% columns.each do |column| %>
|
7
|
-
<th
|
8
|
-
width="<%= column[:width] %>"
|
9
|
-
class="<%= table_header_class(column) %>"
|
10
|
-
data-action="click->table#sort"
|
11
|
-
data-field="<%= column[:field] %>">
|
12
|
-
<% if column[:sort] %>
|
13
|
-
<span class="icon-text">
|
14
|
-
<span><%= render_head_slot(column) %></span>
|
15
|
-
<span class="icon">
|
16
|
-
<span class="material-icons"><%= column[:field] == @current_sort ? (current_sort_dir(column) == "asc" ? "arrow_upward" : "arrow_downward") : "sort" %></span>
|
17
|
-
</span>
|
18
|
-
</span>
|
19
|
-
<% else %>
|
20
|
-
<%= render_head_slot(column) %>
|
21
|
-
<% end %>
|
22
|
-
</th>
|
23
|
-
<% end %>
|
24
|
-
</tr>
|
25
|
-
</thead>
|
26
|
-
<% end %>
|
27
|
-
<tbody>
|
28
|
-
<% records.each_with_index do |record, i| %>
|
29
|
-
<tr>
|
30
|
-
<% columns.each do |column| %>
|
31
|
-
<td class="<%= table_body_class(column) %>" data-action="click->table#selectRow" data-id="<%= record[:id] %>">
|
32
|
-
<%= record[column[:field]] %>
|
33
|
-
</td>
|
34
|
-
<% end %>
|
35
|
-
</tr>
|
36
|
-
<% end %>
|
37
|
-
</tbody>
|
38
|
-
</table>
|
39
|
-
</div>
|
@@ -1,101 +0,0 @@
|
|
1
|
-
<div class="lesli-table-container">
|
2
|
-
<table id="<%= id %>" class="table is-fullwidth lesli-table mb-5 <%= class_name %>">
|
3
|
-
<% unless headless %>
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<% if content_for?(:detail) %>
|
7
|
-
<th></th>
|
8
|
-
<% end %>
|
9
|
-
<% columns.each do |column| %>
|
10
|
-
<th
|
11
|
-
width="<%= column[:width] %>"
|
12
|
-
class="<%= table_header_class(column) %>"
|
13
|
-
data-action="click->table#sort"
|
14
|
-
data-field="<%= column[:field] %>">
|
15
|
-
<% if column[:sort] %>
|
16
|
-
<span class="icon-text">
|
17
|
-
<span><%= render_head_slot(column) %></span>
|
18
|
-
<span class="icon">
|
19
|
-
<span class="material-icons"><%= column[:field] == @current_sort ? (current_sort_dir(column) == "asc" ? "arrow_upward" : "arrow_downward") : "sort" %></span>
|
20
|
-
</span>
|
21
|
-
</span>
|
22
|
-
<% else %>
|
23
|
-
<%= render_head_slot(column) %>
|
24
|
-
<% end %>
|
25
|
-
</th>
|
26
|
-
<% end %>
|
27
|
-
<% if content_for?(:options) %>
|
28
|
-
<th></th>
|
29
|
-
<% end %>
|
30
|
-
<% if content_for?(:buttons) %>
|
31
|
-
<th></th>
|
32
|
-
<% end %>
|
33
|
-
</tr>
|
34
|
-
</thead>
|
35
|
-
<% end %>
|
36
|
-
<tbody>
|
37
|
-
<% records.each_with_index do |record, i| %>
|
38
|
-
<tr>
|
39
|
-
<% if content_for?(:detail) %>
|
40
|
-
<td class="detail-row px-2 has-text-centered">
|
41
|
-
<button class="button is-white px-2" data-action="click->table#toggleDetails" data-index="<%= i %>">
|
42
|
-
<span class="material-icons"><%= detail_active?(record) ? "expand_more" : "chevron_right" %></span>
|
43
|
-
</button>
|
44
|
-
</td>
|
45
|
-
<% end %>
|
46
|
-
<% columns.each do |column| %>
|
47
|
-
<td class="<%= table_body_class(column) %>" data-action="click->table#selectRow" data-id="<%= record[:id] %>">
|
48
|
-
<% if link && !content_for?(:"#{column[:field]}") %>
|
49
|
-
<%= link_to record[column[:field]], link.call(record), class: "link" %>
|
50
|
-
<% else %>
|
51
|
-
<%= render_slot(column[:field], column: column, record: record, value: record[column[:field]]) do %>
|
52
|
-
<%= record[column[:field]] %>
|
53
|
-
<% end %>
|
54
|
-
<% end %>
|
55
|
-
</td>
|
56
|
-
<% end %>
|
57
|
-
<% if content_for?(:options) %>
|
58
|
-
<td class="options p-0">
|
59
|
-
<div class="dropdown is-right is-hoverable">
|
60
|
-
<div class="dropdown-trigger">
|
61
|
-
<button class="button has-text-info">
|
62
|
-
<span class="icon">
|
63
|
-
<span class="material-icons">more_vert</span>
|
64
|
-
</span>
|
65
|
-
</button>
|
66
|
-
</div>
|
67
|
-
<div class="dropdown-menu" role="menu">
|
68
|
-
<div class="dropdown-content">
|
69
|
-
<%= render_slot(:options, record: record, value: record[:id]) %>
|
70
|
-
</div>
|
71
|
-
</div>
|
72
|
-
</div>
|
73
|
-
</td>
|
74
|
-
<% end %>
|
75
|
-
<% if content_for?(:buttons) %>
|
76
|
-
<td class="p-0">
|
77
|
-
<%= render_slot(:buttons, record: record, value: record[:id]) %>
|
78
|
-
</td>
|
79
|
-
<% end %>
|
80
|
-
</tr>
|
81
|
-
<% if detail_active?(record) && content_for?(:detail) %>
|
82
|
-
<tr>
|
83
|
-
<td colspan="<%= columns.size + (content_for?(:detail) ? 1 : 0) %>">
|
84
|
-
<%= render_slot(:detail, record: record) %>
|
85
|
-
</td>
|
86
|
-
</tr>
|
87
|
-
<% end %>
|
88
|
-
<% end %>
|
89
|
-
</tbody>
|
90
|
-
</table>
|
91
|
-
<%#
|
92
|
-
< % if loading % >
|
93
|
-
<lesli-loading></lesli-loading>
|
94
|
-
< % elsif records.empty? % >
|
95
|
-
<lesli-empty></lesli-empty>
|
96
|
-
< % end % >
|
97
|
-
< % if pagination % >
|
98
|
-
<lesli-pagination :pagination="< %= pagination % >" data-action="paginate->table#paginate"></lesli-pagination>
|
99
|
-
< % end % >
|
100
|
-
%>
|
101
|
-
</div>
|
File without changes
|