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: cd5a112008a22c8c4a2c46f10929571f013deef9df4d4926d3d17a06d47e09f3
4
- data.tar.gz: cab1f062cc0f9f68f3a577e82c7a406895e5b50005af4b671fd0e48f4fbbe81c
3
+ metadata.gz: 1162e3083759cf27249c3868a38a062293ef0d2eb810f05638949dfecb32df98
4
+ data.tar.gz: edf6931a9e8ec09beb70e6b40397cf4cfa1bcb63fdcfb45f0526ccb84a41b652
5
5
  SHA512:
6
- metadata.gz: bb84cb09936b8fd5d1695142591e4502fd76ce307b91b692c10d09d516de165b0277d935097aa9c786c62a9bfc14b3531ab14b74cf9ad8dd35d811d7f1d70f83
7
- data.tar.gz: f4a070003e5b23465001b048265b3abe0d4c5870221bf31e85eb67eeceeb0fc7f4d28d14e89200524010bf17297d11d6c2570075fd16eb636494946f4f0606ff
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.60.0"
4
+ VERSION = "0.61.0"
5
5
  end
@@ -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
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.60.0
4
+ version: 0.61.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider