keystone_ui 0.60.0 → 0.61.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1162e3083759cf27249c3868a38a062293ef0d2eb810f05638949dfecb32df98
|
|
4
|
+
data.tar.gz: edf6931a9e8ec09beb70e6b40397cf4cfa1bcb63fdcfb45f0526ccb84a41b652
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0bc9dbdbf3b83401432103e6781c30dc8736957f139ace11f2475d71a5a4ee9d69f307b91c93a5494c5853c01877fb7ea6ca7576dea00a468fb7265981cac0db
|
|
7
|
+
data.tar.gz: '083b71c45bad44f4af0b3a581d7f7c2e73ae39eb63036590dd0bb9f97e8904f6d57cb08f72a1254ef935f386c097c461386e8e7cc47e27694dd0a6eae69c361a'
|
|
@@ -5,9 +5,10 @@ module Keystone
|
|
|
5
5
|
class Column
|
|
6
6
|
attr_reader :key, :header_text, :align
|
|
7
7
|
|
|
8
|
-
def initialize(key, header_text, mobile_hidden: false, sortable: false, hideable: false, locked: false, align: nil)
|
|
8
|
+
def initialize(key, header_text, mobile_hidden: false, sortable: false, hideable: false, locked: false, align: nil, wrap: false)
|
|
9
9
|
@key = key
|
|
10
10
|
@align = align
|
|
11
|
+
@wrap = wrap
|
|
11
12
|
@header_text = header_text
|
|
12
13
|
@mobile_hidden = mobile_hidden
|
|
13
14
|
@sortable = sortable
|
|
@@ -19,6 +20,7 @@ module Keystone
|
|
|
19
20
|
def sortable? = @sortable
|
|
20
21
|
def hideable? = @hideable && !@locked
|
|
21
22
|
def locked? = @locked
|
|
23
|
+
def wrap? = @wrap
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -133,7 +133,7 @@ module Keystone
|
|
|
133
133
|
|
|
134
134
|
cell = {
|
|
135
135
|
value: resolve_value(item, column.key),
|
|
136
|
-
classes: aligned(tokens.join(" "), column)
|
|
136
|
+
classes: wrapped(aligned(tokens.join(" "), column), column)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
link_block = @link_blocks[column.key]
|
|
@@ -208,6 +208,12 @@ module Keystone
|
|
|
208
208
|
[ *classes.split.grep_v(/\Atext-(left|right)\z/), ALIGN_CLASSES.fetch(column.align) ].join(" ")
|
|
209
209
|
end
|
|
210
210
|
|
|
211
|
+
def wrapped(classes, column)
|
|
212
|
+
return classes unless column.wrap?
|
|
213
|
+
|
|
214
|
+
classes.sub("whitespace-nowrap", "whitespace-normal")
|
|
215
|
+
end
|
|
216
|
+
|
|
211
217
|
def resolve_value(item, key)
|
|
212
218
|
if item.respond_to?(key)
|
|
213
219
|
item.public_send(key)
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -429,9 +429,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
429
429
|
- `columns:` takes `{ key: "Label" }` hashes when every column is plain.
|
|
430
430
|
Switch the whole set to `Keystone::Ui::Column` objects once one column
|
|
431
431
|
needs an option.
|
|
432
|
-
- `Keystone::Ui::Column.new(key, header_text, mobile_hidden: false, sortable: false, hideable: false, locked: false, align: nil)`
|
|
432
|
+
- `Keystone::Ui::Column.new(key, header_text, mobile_hidden: false, sortable: false, hideable: false, locked: false, align: nil, wrap: false)`
|
|
433
433
|
— `mobile_hidden:` hides the column below `sm:`, `sortable:` gives it a
|
|
434
434
|
sort header, and `hideable:` lets it be hidden and moved.
|
|
435
|
+
`wrap: true` lets long text in the column's cells wrap onto more lines
|
|
436
|
+
inside the cell instead of widening the table, every other cell keeps its
|
|
437
|
+
text on one line, and headings are unchanged.
|
|
435
438
|
`locked: true` on the first column keeps it in view while the rest scrolls
|
|
436
439
|
sideways, a locked column that is not first renders as an ordinary one,
|
|
437
440
|
and a locked column is never hideable. Ask the developer whether a wide
|