keystone_ui 0.71.0 → 0.72.0
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/app/components/keystone/ui/data_table_component.html.erb +23 -22
- data/app/components/keystone/ui/data_table_component.rb +22 -5
- data/app/components/keystone/ui/link_list_component.html.erb +9 -7
- data/app/components/keystone/ui/link_list_component.rb +3 -1
- data/app/components/keystone/ui/mobile_header_component.html.erb +13 -11
- data/app/components/keystone/ui/mobile_header_component.rb +1 -0
- data/app/components/keystone/ui/page_header_component.rb +3 -3
- data/app/components/keystone/ui/section_component.html.erb +14 -10
- data/app/components/keystone/ui/section_component.rb +1 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +32 -16
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5c864218e3c08539be733309f9a8a3b04773b9bfa659a0b7d19bc4431346bf8
|
|
4
|
+
data.tar.gz: 2d362eca45eb1624c8ef3a617d0801efea167abfc1887c63885fd2b627cc902d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0371ee2dfec124385cdc27cbf079cc5fa08b52bfe8540291f631397352b176d13e7c536f608e76462cc31519f05f1aace40fbc0ed83a4cfc9464236a20cde607
|
|
7
|
+
data.tar.gz: 153f5013bdd548512cb20da11d95d215edf837dc57341e198fdbd319598ff2aa9a48b0aac4a254f3b4546b63e065a9024d48fdf96aff54eda0fab6625d94f088
|
|
@@ -5,26 +5,28 @@
|
|
|
5
5
|
<% end %>
|
|
6
6
|
<div class="<%= Keystone::Ui::DataTableComponent::WRAPPER_CLASSES %>">
|
|
7
7
|
<table class="<%= table_classes %> divide-y divide-gray-300 dark:divide-white/15">
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
<% if header? %>
|
|
9
|
+
<thead class="<%= head_classes %>">
|
|
10
|
+
<tr>
|
|
11
|
+
<% header_cells.each do |cell| %>
|
|
12
|
+
<th scope="<%= cell[:scope] %>" class="<%= cell[:classes] %>">
|
|
13
|
+
<% if cell[:sort_href] %>
|
|
14
|
+
<a href="<%= cell[:sort_href] %>" class="<%= Keystone::Ui::DataTableComponent::SORT_LINK_CLASSES %>" data-turbo-action="replace">
|
|
15
|
+
<%= cell[:label] %>
|
|
16
|
+
<% if cell[:sort_active] %>
|
|
17
|
+
<span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_ACTIVE %>"><%= (cell[:sort_direction] == :asc ? Keystone::Ui::DataTableComponent::SORT_ASC_ICON : Keystone::Ui::DataTableComponent::SORT_DESC_ICON).html_safe %></span>
|
|
18
|
+
<% else %>
|
|
19
|
+
<span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_INACTIVE %>"><%= Keystone::Ui::DataTableComponent::SORT_NEUTRAL_ICON.html_safe %></span>
|
|
20
|
+
<% end %>
|
|
21
|
+
</a>
|
|
22
|
+
<% else %>
|
|
14
23
|
<%= cell[:label] %>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<% else %>
|
|
22
|
-
<%= cell[:label] %>
|
|
23
|
-
<% end %>
|
|
24
|
-
</th>
|
|
25
|
-
<% end %>
|
|
26
|
-
</tr>
|
|
27
|
-
</thead>
|
|
24
|
+
<% end %>
|
|
25
|
+
</th>
|
|
26
|
+
<% end %>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
<% end %>
|
|
28
30
|
<tbody class="<%= body_classes %>"<% if row_detail? %> data-controller="row-detail" data-action="turbo:before-morph-attribute->row-detail#keep"<% end %>>
|
|
29
31
|
<% if empty? %>
|
|
30
32
|
<% if @empty_message %>
|
|
@@ -63,10 +65,9 @@
|
|
|
63
65
|
<% end %>
|
|
64
66
|
<% if actions? %>
|
|
65
67
|
<td class="<%= actions_cell_classes %>">
|
|
66
|
-
<% row_actions
|
|
67
|
-
<% if row_actions.present? %>
|
|
68
|
+
<% if row_actions[idx].present? %>
|
|
68
69
|
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
69
|
-
<%= row_actions %>
|
|
70
|
+
<%= row_actions[idx] %>
|
|
70
71
|
<% end %>
|
|
71
72
|
<% end %>
|
|
72
73
|
</td>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "active_support/core_ext/object/blank"
|
|
4
|
+
|
|
3
5
|
module Keystone
|
|
4
6
|
module Ui
|
|
5
7
|
class DataTableComponent < ViewComponent::Base
|
|
@@ -32,7 +34,7 @@ module Keystone
|
|
|
32
34
|
|
|
33
35
|
PHONE_LIST_HEAD_CLASSES = "max-sm:hidden"
|
|
34
36
|
PHONE_LIST_BLOCK_CLASSES = "max-sm:block"
|
|
35
|
-
PHONE_LIST_CELL_CLASSES = "max-sm:block max-sm:text-left max-sm:whitespace-normal"
|
|
37
|
+
PHONE_LIST_CELL_CLASSES = "ks-table-phone-list-cell max-sm:block max-sm:text-left max-sm:whitespace-normal"
|
|
36
38
|
CELL_LABEL_CLASSES = "ks-caption block sm:hidden"
|
|
37
39
|
|
|
38
40
|
SORT_LINK_CLASSES = "ks-table-sort-link group inline-flex items-center"
|
|
@@ -44,7 +46,7 @@ module Keystone
|
|
|
44
46
|
SORT_DESC_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .75.75v10.638l3.96-4.158a.75.75 0 1 1 1.08 1.04l-5.25 5.5a.75.75 0 0 1-1.08 0l-5.25-5.5a.75.75 0 0 1 1.08-1.04l3.96 4.158V3.75A.75.75 0 0 1 10 3Z" clip-rule="evenodd" /></svg>'
|
|
45
47
|
SORT_NEUTRAL_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .55.24l3.25 3.5a.75.75 0 1 1-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 0 1-1.1-1.02l3.25-3.5A.75.75 0 0 1 10 3Zm-3.76 9.2a.75.75 0 0 1 1.06.04l2.7 2.908 2.7-2.908a.75.75 0 1 1 1.1 1.02l-3.25 3.5a.75.75 0 0 1-1.1 0l-3.25-3.5a.75.75 0 0 1 .04-1.06Z" clip-rule="evenodd" /></svg>'
|
|
46
48
|
|
|
47
|
-
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)
|
|
49
|
+
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)
|
|
48
50
|
@items = items.to_a
|
|
49
51
|
@current_index = @items.index(current_row) unless current_row.nil?
|
|
50
52
|
@group_by = group_by
|
|
@@ -62,6 +64,7 @@ module Keystone
|
|
|
62
64
|
@actions_block = nil
|
|
63
65
|
@link_blocks = {}
|
|
64
66
|
@phone_list = phone_list
|
|
67
|
+
@header = header
|
|
65
68
|
end
|
|
66
69
|
|
|
67
70
|
def before_render
|
|
@@ -123,8 +126,18 @@ module Keystone
|
|
|
123
126
|
phone_list_classes(HEAD_CLASSES, PHONE_LIST_HEAD_CLASSES)
|
|
124
127
|
end
|
|
125
128
|
|
|
129
|
+
def header?
|
|
130
|
+
@header
|
|
131
|
+
end
|
|
132
|
+
|
|
126
133
|
def actions?
|
|
127
|
-
|
|
134
|
+
row_actions.any?(&:present?)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def row_actions
|
|
138
|
+
return [] unless @actions_block
|
|
139
|
+
|
|
140
|
+
@row_actions ||= @items.map { |item| capture(item, &@actions_block) }
|
|
128
141
|
end
|
|
129
142
|
|
|
130
143
|
def column_picker
|
|
@@ -196,7 +209,7 @@ module Keystone
|
|
|
196
209
|
value: resolve_value(item, column.key),
|
|
197
210
|
classes: wrapped(aligned(tokens.join(" "), column), column)
|
|
198
211
|
}
|
|
199
|
-
cell[:label] = column.header_text if
|
|
212
|
+
cell[:label] = column.header_text if phone_labels?
|
|
200
213
|
|
|
201
214
|
link_block = @link_blocks[column.key]
|
|
202
215
|
cell[:href] = link_block.call(item) if link_block
|
|
@@ -243,7 +256,11 @@ module Keystone
|
|
|
243
256
|
private
|
|
244
257
|
|
|
245
258
|
def summary_label(index, column)
|
|
246
|
-
column.header_text if
|
|
259
|
+
column.header_text if phone_labels? && !index.zero?
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def phone_labels?
|
|
263
|
+
@phone_list && @header
|
|
247
264
|
end
|
|
248
265
|
|
|
249
266
|
def phone_list_classes(classes, phone_list_classes)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<div class="ks-value-list">
|
|
2
2
|
<% rows.each do |row| %>
|
|
3
3
|
<%= link_to row.fetch(:href), class: ROW_CLASSES do %>
|
|
4
|
-
<span class="<%=
|
|
5
|
-
<span class="<%=
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
<span class="<%= STACK_CLASSES %>">
|
|
5
|
+
<span class="<%= TEXT_CLASSES %>">
|
|
6
|
+
<span class="<%= LABEL_CLASSES %>"><%= row.fetch(:label) %></span>
|
|
7
|
+
<% if row[:subtitle] %>
|
|
8
|
+
<span class="<%= SUBTITLE_CLASSES %>"><%= row[:subtitle] %></span>
|
|
9
|
+
<% end %>
|
|
10
|
+
</span>
|
|
11
|
+
<% if row[:badge] %>
|
|
12
|
+
<%= render badge(row) %>
|
|
8
13
|
<% end %>
|
|
9
14
|
</span>
|
|
10
|
-
<% if row[:badge] %>
|
|
11
|
-
<%= render badge(row) %>
|
|
12
|
-
<% end %>
|
|
13
15
|
<% if row[:value] %>
|
|
14
16
|
<span class="<%= VALUE_CLASSES %>"><%= row[:value] %></span>
|
|
15
17
|
<% end %>
|
|
@@ -4,6 +4,8 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class LinkListComponent < ViewComponent::Base
|
|
6
6
|
ROW_CLASSES = "ks-value-list-row items-center no-underline"
|
|
7
|
+
STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
|
|
8
|
+
BADGE_CLASSES = "max-sm:self-start"
|
|
7
9
|
TEXT_CLASSES = "min-w-0 flex-1"
|
|
8
10
|
LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
|
|
9
11
|
SUBTITLE_CLASSES = "ks-value-list-note"
|
|
@@ -16,7 +18,7 @@ module Keystone
|
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def badge(row)
|
|
19
|
-
BadgeComponent.new(**row[:badge])
|
|
21
|
+
BadgeComponent.new(**row[:badge], class: BADGE_CLASSES)
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
<div class="<%=
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<%=
|
|
1
|
+
<div class="<%= ROW_CLASSES %>">
|
|
2
|
+
<div class="<%= WRAPPER_CLASSES %>">
|
|
3
|
+
<% if @back_url %>
|
|
4
|
+
<%= link_to @back_url, class: BACK_LINK_CLASSES, aria: { label: "Back" } do %>
|
|
5
|
+
<%= BACK_ICON.html_safe %>
|
|
6
|
+
<% end %>
|
|
5
7
|
<% end %>
|
|
6
|
-
|
|
8
|
+
</div>
|
|
9
|
+
<span class="<%= TITLE_CLASSES %>">
|
|
10
|
+
<%= @title %>
|
|
11
|
+
<% if @subtitle.present? %>
|
|
12
|
+
<span class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></span>
|
|
13
|
+
<% end %>
|
|
14
|
+
</span>
|
|
7
15
|
</div>
|
|
8
|
-
<span class="<%= TITLE_CLASSES %>">
|
|
9
|
-
<%= @title %>
|
|
10
|
-
<% if @subtitle.present? %>
|
|
11
|
-
<span class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></span>
|
|
12
|
-
<% end %>
|
|
13
|
-
</span>
|
|
@@ -15,6 +15,7 @@ module Keystone
|
|
|
15
15
|
</svg>
|
|
16
16
|
SVG
|
|
17
17
|
|
|
18
|
+
ROW_CLASSES = "ks-page flex items-center ks-grid-gap-sm lg:hidden print:hidden max-lg:in-[.top-nav]:contents"
|
|
18
19
|
WRAPPER_CLASSES = "flex items-center lg:hidden print:hidden"
|
|
19
20
|
BACK_LINK_CLASSES = "ks-mobile-header-back"
|
|
20
21
|
TITLE_CLASSES = "ks-mobile-header-title flex-[1_1_6rem] min-w-0 self-center lg:hidden truncate"
|
|
@@ -9,8 +9,8 @@ module Keystone
|
|
|
9
9
|
ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
|
|
10
10
|
PHONE_TITLE_CLASSES = "ks-page-header-title max-sm:[body:has(.ks-mobile-header-title)_&]:hidden"
|
|
11
11
|
PHONE_WRAPPER_CLASSES = "max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:justify-between"
|
|
12
|
-
PHONE_ACTIONS_CLASSES = "max-sm:
|
|
13
|
-
|
|
12
|
+
PHONE_ACTIONS_CLASSES = "max-sm:flex max-sm:items-center max-sm:basis-full"
|
|
13
|
+
ROW_CLASSES = "sm:flex sm:items-center flex-wrap max-w-full ks-grid-gap-sm"
|
|
14
14
|
TITLE_ROW_CLASSES = "flex flex-wrap items-center ks-grid-gap-sm"
|
|
15
15
|
|
|
16
16
|
attr_reader :title, :action_url, :action_label, :action_method
|
|
@@ -44,7 +44,7 @@ module Keystone
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def actions_classes
|
|
47
|
-
[ ACTIONS_CLASSES, (
|
|
47
|
+
[ ACTIONS_CLASSES, ROW_CLASSES, (PHONE_ACTIONS_CLASSES if phone?) ].compact.join(" ")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def title_classes
|
|
@@ -7,17 +7,21 @@
|
|
|
7
7
|
<p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
|
|
8
8
|
<% end %>
|
|
9
9
|
</div>
|
|
10
|
-
<% if @action %>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
17
|
-
<% @menu.each do |item| %>
|
|
18
|
-
<%= render Keystone::Ui::ActionMenuItemComponent.new(**item) %>
|
|
10
|
+
<% if @action || @menu.any? %>
|
|
11
|
+
<div class="<%= ACTIONS_CLASSES %>">
|
|
12
|
+
<% if @action %>
|
|
13
|
+
<a href="<%= @action[:href] %>" class="<%= action_classes %>">
|
|
14
|
+
<%= @action[:label] %>
|
|
15
|
+
</a>
|
|
19
16
|
<% end %>
|
|
20
|
-
|
|
17
|
+
<% if @menu.any? %>
|
|
18
|
+
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
19
|
+
<% @menu.each do |item| %>
|
|
20
|
+
<%= render Keystone::Ui::ActionMenuItemComponent.new(**item) %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
21
25
|
<% end %>
|
|
22
26
|
</div>
|
|
23
27
|
<% end %>
|
|
@@ -8,6 +8,7 @@ module Keystone
|
|
|
8
8
|
TITLE_CLASSES = "ks-section-title"
|
|
9
9
|
SUBTITLE_CLASSES = "ks-section-subtitle"
|
|
10
10
|
ACTION_CLASSES = "ks-section-action"
|
|
11
|
+
ACTIONS_CLASSES = "flex items-center shrink-0 ks-grid-gap-sm"
|
|
11
12
|
|
|
12
13
|
def initialize(title: nil, subtitle: nil, action: nil, menu: [], spacing: :md, class: nil)
|
|
13
14
|
@title = title
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -187,7 +187,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
187
187
|
actions and menu, and hides its title when the page holds
|
|
188
188
|
`ui_mobile_header`'s title. Its action then shows below `sm:` beside
|
|
189
189
|
`ui_mobile_action`'s plus icon, so ask the developer whether a screen
|
|
190
|
-
with both keeps both.
|
|
190
|
+
with both keeps both. Below `sm:` the actions and menu sit side by side
|
|
191
|
+
on their own full-width row under the title and badges, and from `sm:` up
|
|
192
|
+
they sit side by side on the right, with or without a menu. At every
|
|
193
|
+
width buttons that do not fit wrap onto another line, so the header never
|
|
194
|
+
makes the page wider than the screen.
|
|
191
195
|
- `ui_breadcrumbs(trail:, current: nil)` renders `trail:` as links separated
|
|
192
196
|
by `›`, then `current:` unlinked and marked as the current page, shown
|
|
193
197
|
only from `lg:` up. On a form or detail screen pass `trail:` to the shell
|
|
@@ -200,10 +204,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
200
204
|
4. Lay out the body. Each of these takes a block and they nest.
|
|
201
205
|
|
|
202
206
|
- `ui_section(title: nil, subtitle: nil, action: nil, menu: [], spacing: :md, class: nil)`
|
|
203
|
-
— `action:` is `{ label:, href: }` and renders a
|
|
207
|
+
— `action:` is `{ label:, href: }` and renders a link.
|
|
204
208
|
`menu:` is `[{ label:, href:, method: }, ...]`, each hash taking the
|
|
205
|
-
keywords of `ui_action_menu_item`, and renders an action menu
|
|
206
|
-
|
|
209
|
+
keywords of `ui_action_menu_item`, and renders an action menu. The link
|
|
210
|
+
and the menu sit side by side at the right edge of the header, the link
|
|
211
|
+
first, at every width. `spacing:` is `:sm` `:md` `:lg`. The header, with its
|
|
207
212
|
`action:` and `menu:`, renders only when `title:` is given.
|
|
208
213
|
- `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
|
|
209
214
|
`cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
|
|
@@ -274,14 +279,19 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
274
279
|
over the icon. The bar is hidden from `lg:` up and inside a
|
|
275
280
|
Hotwire Native web view.
|
|
276
281
|
- `ui_mobile_header(title:, back_url:, subtitle: nil)` is hidden from `lg:`
|
|
277
|
-
up and goes in the navbar's `mobile_left` slot
|
|
278
|
-
passed, and `nil` renders the
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
up and goes in the navbar's `mobile_left` slot or directly in the
|
|
283
|
+
layout's `<header>`. `back_url:` must be passed, and `nil` renders the
|
|
284
|
+
title with no back arrow. Outside a top bar it draws the arrow, title and
|
|
285
|
+
subtitle in one row with `ui_page`'s side margin, ending the text in an
|
|
286
|
+
ellipsis when too long. Inside an element with the `top-nav` class, such
|
|
287
|
+
as `ui_navbar`, the arrow and title are laid out by the bar instead: the
|
|
288
|
+
title and subtitle sit between the arrow and the right-side controls,
|
|
289
|
+
start at the left, and end in an ellipsis when too long. In `ui_navbar`,
|
|
290
|
+
controls that leave less than 6rem for the title move to a second row
|
|
291
|
+
under it. In a hand-written top bar, give the bar the `top-nav` class,
|
|
292
|
+
make the header a direct child of the bar's flex row, and add
|
|
293
|
+
`max-lg:has-[.ks-mobile-header-title]:flex-wrap` to the bar if its
|
|
294
|
+
controls can fill its width.
|
|
285
295
|
- `ui_mobile_action` takes no keywords and no block, and goes in the top
|
|
286
296
|
bar's right side, such as the navbar's `mobile_right` slot. It draws a plus
|
|
287
297
|
icon linking to the `action_url:` a screen gives `ui_page_header`, named
|
|
@@ -435,7 +445,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
435
445
|
|
|
436
446
|
8. Build tables.
|
|
437
447
|
|
|
438
|
-
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)`
|
|
448
|
+
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)`
|
|
439
449
|
takes a block yielding the table. `items:` are records or hashes, and a
|
|
440
450
|
cell's value is the column key called on the item, or `item[key]`.
|
|
441
451
|
`group_by:` lists rows under heading rows named by that key's value,
|
|
@@ -452,6 +462,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
452
462
|
From `sm:` up the table is unchanged, and a table without it is unchanged
|
|
453
463
|
at every width. It is chosen table by table, so ask the developer which
|
|
454
464
|
tables show as a list on a phone.
|
|
465
|
+
- `header: false` draws no heading row, for a table of labels and their
|
|
466
|
+
values such as a record's details. With `phone_list: true` it also drops
|
|
467
|
+
the column heading label from every cell, subtotal and total below `sm:`,
|
|
468
|
+
so each row shows only its label and its value.
|
|
455
469
|
- `columns:` takes `{ key: "Label" }` hashes when every column is plain.
|
|
456
470
|
Switch the whole set to `Keystone::Ui::Column` objects once one column
|
|
457
471
|
needs an option.
|
|
@@ -467,9 +481,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
467
481
|
table locks its first column.
|
|
468
482
|
- In the block, `table.link(:column_key) { |item| url }` turns a column's
|
|
469
483
|
cells into links, and `table.actions { |item| ... }` adds a right-aligned
|
|
470
|
-
actions column whose block holds only `ui_action_menu_item` calls.
|
|
471
|
-
|
|
472
|
-
|
|
484
|
+
actions column whose block holds only `ui_action_menu_item` calls. When
|
|
485
|
+
the block renders nothing for every row, the table draws no actions
|
|
486
|
+
column. With no actions column, the last column is right-aligned, so put
|
|
487
|
+
a column of amounts last.
|
|
473
488
|
- `table.row_colour { |item| ... }` tints a whole row. The block returns
|
|
474
489
|
`:danger`, `:warning`, `:success`, `:info` or `nil` for each item. A named
|
|
475
490
|
colour tints every cell of that row in the same colour as the badge of
|
|
@@ -553,6 +568,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
553
568
|
adds a close button.
|
|
554
569
|
- `ui_link_list(rows:)` — each row is `{ label:, href:, subtitle: nil,
|
|
555
570
|
badge: nil, value: nil }`, and `badge:` takes `ui_badge`'s `{ label:, variant: }`.
|
|
571
|
+
A row's badge sits above its label below `sm` and beside it from `sm` up.
|
|
556
572
|
Use it for a list of records that each open their own page, in place of a
|
|
557
573
|
hand-written `<ul>` of links.
|
|
558
574
|
- `ui_empty_state(title:, message: nil, action: nil)` — `action:` is
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.72.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.32.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.32.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|