keystone_ui 0.102.0 → 0.103.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 +1 -1
- data/app/components/keystone/ui/data_table_component.rb +19 -7
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +4 -2
- data/the_local/agents/keystone_ui-info.md +3 -0
- 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: 6f3c5cfaa2455159d01c665ea49bf74c7a306560666d079e84b03b60c467283b
|
|
4
|
+
data.tar.gz: 3bd502112a0900908c23fd8405ee269ea9a8feec3d9aae04fd088ab1b2624254
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c58aaf7c6818cbe4039798c65684af15609d2eb787edfce9c73784cff371452025237cd5e92e9576db8827520054b0d98947d184b9d8e7813654bef8ef6b2509
|
|
7
|
+
data.tar.gz: 02244b12053757519c9ce3de3e0f1dbd24543878442f4751e31b48628991f46017b7843708624b629acdb562ab77b872a2daf0b515e8020de5644ddf473d9811
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<% if empty? %>
|
|
32
32
|
<% if @empty_message %>
|
|
33
33
|
<tr>
|
|
34
|
-
<td class="<%=
|
|
34
|
+
<td class="<%= empty_cell_classes %>" colspan="<%= column_count %>">
|
|
35
35
|
<%= @empty_message %>
|
|
36
36
|
</td>
|
|
37
37
|
</tr>
|
|
@@ -23,6 +23,7 @@ module Keystone
|
|
|
23
23
|
HEADER_CLASSES_MIDDLE = "ks-table-header ks-table-header-middle text-left text-sm"
|
|
24
24
|
HEADER_CLASSES_LAST = "ks-table-header ks-table-header-last text-right text-sm"
|
|
25
25
|
HEADING_CAPS_CLASSES = "ks-label-caps"
|
|
26
|
+
COMPACT_CLASSES = "ks-table-compact"
|
|
26
27
|
|
|
27
28
|
ROW_CLASSES_FIRST = "ks-table-cell-first text-sm whitespace-nowrap"
|
|
28
29
|
ROW_CLASSES_MIDDLE = "ks-table-cell-middle text-sm whitespace-nowrap"
|
|
@@ -47,7 +48,7 @@ module Keystone
|
|
|
47
48
|
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>'
|
|
48
49
|
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>'
|
|
49
50
|
|
|
50
|
-
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, heading_caps: false)
|
|
51
|
+
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, heading_caps: false, density: nil)
|
|
51
52
|
@items = items.to_a
|
|
52
53
|
@current_index = @items.index(current_row) unless current_row.nil?
|
|
53
54
|
@group_by = group_by
|
|
@@ -67,6 +68,7 @@ module Keystone
|
|
|
67
68
|
@phone_list = phone_list
|
|
68
69
|
@header = header
|
|
69
70
|
@heading_caps = heading_caps
|
|
71
|
+
@density = density
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def before_render
|
|
@@ -120,8 +122,12 @@ module Keystone
|
|
|
120
122
|
PHONE_LIST_BLOCK_CLASSES if @phone_list
|
|
121
123
|
end
|
|
122
124
|
|
|
125
|
+
def empty_cell_classes
|
|
126
|
+
densified(EMPTY_CELL_CLASSES)
|
|
127
|
+
end
|
|
128
|
+
|
|
123
129
|
def actions_cell_classes
|
|
124
|
-
phone_list_classes(ROW_CLASSES_LAST, PHONE_LIST_BLOCK_CLASSES)
|
|
130
|
+
densified(phone_list_classes(ROW_CLASSES_LAST, PHONE_LIST_BLOCK_CLASSES))
|
|
125
131
|
end
|
|
126
132
|
|
|
127
133
|
def head_classes
|
|
@@ -164,7 +170,7 @@ module Keystone
|
|
|
164
170
|
|
|
165
171
|
cell = {
|
|
166
172
|
label: column.header_text,
|
|
167
|
-
classes: heading_classes(aligned(tokens.join(" "), column)),
|
|
173
|
+
classes: densified(heading_classes(aligned(tokens.join(" "), column))),
|
|
168
174
|
scope: "col"
|
|
169
175
|
}
|
|
170
176
|
|
|
@@ -191,7 +197,7 @@ module Keystone
|
|
|
191
197
|
if actions?
|
|
192
198
|
cells << {
|
|
193
199
|
label: "Actions",
|
|
194
|
-
classes: heading_classes(HEADER_CLASSES_LAST),
|
|
200
|
+
classes: densified(heading_classes(HEADER_CLASSES_LAST)),
|
|
195
201
|
scope: "col"
|
|
196
202
|
}
|
|
197
203
|
end
|
|
@@ -209,7 +215,7 @@ module Keystone
|
|
|
209
215
|
|
|
210
216
|
cell = {
|
|
211
217
|
value: resolve_value(item, column.key),
|
|
212
|
-
classes: wrapped(aligned(tokens.join(" "), column), column)
|
|
218
|
+
classes: densified(wrapped(aligned(tokens.join(" "), column), column))
|
|
213
219
|
}
|
|
214
220
|
cell[:label] = column.header_text if phone_labels?
|
|
215
221
|
|
|
@@ -244,14 +250,14 @@ module Keystone
|
|
|
244
250
|
return [] unless @total
|
|
245
251
|
|
|
246
252
|
@columns.map.with_index do |column, index|
|
|
247
|
-
{ value: @total[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
253
|
+
{ value: @total[column.key.to_s], classes: densified(phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES)), label: summary_label(index, column) }
|
|
248
254
|
end
|
|
249
255
|
end
|
|
250
256
|
|
|
251
257
|
def group_cells(name)
|
|
252
258
|
subtotals = @group_totals.fetch(name.to_s, {}).to_h.transform_keys(&:to_s)
|
|
253
259
|
@columns.map.with_index do |column, index|
|
|
254
|
-
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
260
|
+
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: densified(phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES)), label: summary_label(index, column) }
|
|
255
261
|
end
|
|
256
262
|
end
|
|
257
263
|
|
|
@@ -297,6 +303,12 @@ module Keystone
|
|
|
297
303
|
[ *classes.split.grep_v("text-sm"), HEADING_CAPS_CLASSES ].join(" ")
|
|
298
304
|
end
|
|
299
305
|
|
|
306
|
+
def densified(classes)
|
|
307
|
+
return classes unless @density == :compact
|
|
308
|
+
|
|
309
|
+
[ *classes.split.map { |token| token == "text-sm" ? "text-xs" : token }, COMPACT_CLASSES ].join(" ")
|
|
310
|
+
end
|
|
311
|
+
|
|
300
312
|
def aligned(classes, column)
|
|
301
313
|
return classes unless column.align
|
|
302
314
|
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -588,9 +588,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
588
588
|
|
|
589
589
|
8. Build tables.
|
|
590
590
|
|
|
591
|
-
- `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, heading_caps: false)`
|
|
591
|
+
- `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, heading_caps: false, density: nil)`
|
|
592
592
|
takes a block yielding the table. `heading_caps: true` draws the column
|
|
593
|
-
headings in small capitals. `
|
|
593
|
+
headings in small capitals. `density: :compact` draws every heading and
|
|
594
|
+
cell in extra small text with smaller padding, for a wide table in a
|
|
595
|
+
narrow panel, and works with `heading_caps: true`. `items:` are records or hashes, and a
|
|
594
596
|
cell's value is the column key called on the item, or `item[key]`.
|
|
595
597
|
`group_by:` lists rows under heading rows named by that key's value,
|
|
596
598
|
`group_totals:` (`{ "Group name" => { column_key => value } }`) puts
|
|
@@ -216,6 +216,9 @@ One decision: is keystone_ui set up in the app?
|
|
|
216
216
|
drawn in small capitals, and a value list's values, a timeline's step names
|
|
217
217
|
and durations and a summary chip's value in a fixed-width font. Each is an
|
|
218
218
|
option on its component, off by default.
|
|
219
|
+
- **Compact data tables.** A data table can be drawn compact, with extra
|
|
220
|
+
small text and smaller padding in every heading and cell, so a wide table
|
|
221
|
+
fits a narrow panel with every value on one line.
|
|
219
222
|
- **Summary chips.** A row of summary chips shows a few labelled values, each
|
|
220
223
|
in a tone's colour on a tinted background, three across on a phone.
|
|
221
224
|
- **Unequal grid columns.** A grid goes up to the `xl:` breakpoint, and a
|
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.103.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.45.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.45.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|