keystone_ui 0.33.0 → 0.33.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 599c6b4269b4ca049a5aefe106cb71dc6205554c49fb6e72824f25cc3b6f2597
4
- data.tar.gz: 390d82ea8082927248351ba74796fde3a05afe4994b151c79169e0cb190ecacd
3
+ metadata.gz: af9ebb3caf69815bf6272cf2f67028d1f4e7a98b44f5e8fb0c70654a54b84303
4
+ data.tar.gz: a0465bf4038d273df4d29aca184443640f113a73260842c7590e12d040557a18
5
5
  SHA512:
6
- metadata.gz: 2b44fd40afcc3d275dab96ab0401f2748a5555d5e38eb319af16d998454e30f094d9e799603658b0597b7a0e8688a9a8d864aa2e170c3b750d5351a37db123d5
7
- data.tar.gz: 65064fb15715bcebbe95efadb89b2a395d06889b6d4962467faeac520df18f88083acd7f5d23ffe8c6057f9434916906861a4c3f02515ae4306cf545bf9eba23
6
+ metadata.gz: 986eb9e5c25dfafa87579cec226b9a7ec3511478a0a402158e2a5279f290311e3e6d513a2f082f331d01e5f2d0fd73463f7bf108a401276530963a2cecbec977
7
+ data.tar.gz: 1a0c99faa3fd4c3c03863adf0a467cd53de595367af6cf015c6ffe6afab5e2b31b7713110341b26aad4dd11b6ecd626146020a9aef9549b7c6e600886e383cfa
@@ -146,7 +146,7 @@ module Keystone
146
146
  saved = KeystoneUi.configuration.supplied_preference(helpers, @key)
147
147
  return unless saved
148
148
 
149
- @hidden_columns = saved[:value]["hidden_columns"]
149
+ @hidden_columns = saved[:value].to_h.fetch("hidden_columns", @hidden_columns)
150
150
  @columns = visible_columns(@hidden_columns)
151
151
  @save_url = saved[:save_url]
152
152
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.33.0"
4
+ VERSION = "0.33.1"
5
5
  end
@@ -224,12 +224,15 @@ outer element. See Conventions before using it.
224
224
  server-side and only affects columns declared `hideable: true`. `key:` (a
225
225
  symbol or string) names the table so it looks up a saved layout through the
226
226
  app's preference supplier. When the supplier returns a saved value for the
227
- key, the hideable columns listed under its `"hidden_columns"` replace the
228
- ones passed in `hidden_columns:`, and when it also returns a save address the
229
- table renders a "Columns" menu above itself that saves to it. When the
227
+ key that lists `"hidden_columns"`, the hideable columns in that list replace
228
+ the ones passed in `hidden_columns:`, and a saved empty list shows every
229
+ column. When the saved value is `nil` or lists no `"hidden_columns"`, the
230
+ table keeps the columns `hidden_columns:` hides. Whenever the supplier
231
+ returns a save address, the table renders a "Columns" menu above itself that
232
+ saves to it, including for a person with nothing saved yet. When the
230
233
  supplier returns nothing, when no supplier is set, or when no `key:` is
231
- passed, the table renders from `hidden_columns:` with no Columns menu, so
232
- `hidden_columns:` is the table's default layout.
234
+ passed, the table renders from `hidden_columns:` with no Columns menu. In
235
+ every case `hidden_columns:` is the table's default layout.
233
236
  - `Keystone::Ui::Column.new(key, header_text, mobile_hidden: false, sortable: false, hideable: false)`
234
237
  — a column with per-column options, for when a `{ key: "Label" }` hash is not
235
238
  enough. `mobile_hidden:` hides the column below `sm:`; `sortable:` opts it into
@@ -127,11 +127,13 @@ holds the catalog.
127
127
  - **Saved table layouts.** A data table can be given a key naming it. A table
128
128
  with a key asks the app, or another gem such as keystone_ui-preferences, for
129
129
  the layout saved under that key for the request. A saved layout lists the
130
- columns to hide, and only columns marked hideable can be hidden. When a
131
- layout is saved, it replaces the columns the table hides by default. When
132
- nothing is saved, the table hides the columns its own call names, so those
133
- are its default layout. When the supplier also gives an address to save to,
134
- a "Columns" menu appears above the table and saves the user's choice there.
130
+ columns to hide, and only columns marked hideable can be hidden. The columns
131
+ the table's own call hides are its default layout. A saved layout that lists
132
+ columns to hide replaces that default, and a saved empty list shows every
133
+ column. When nothing is saved, or the saved layout lists no columns to hide,
134
+ the table keeps its default. When the supplier gives an address to save to,
135
+ a "Columns" menu appears above the table and saves the user's choice there,
136
+ even before anything has been saved.
135
137
  A table with no key, or an app with no supplier, renders from its own call
136
138
  alone. Setting up the supplier belongs to the install local.
137
139
  - **Suggestions.** A form field can carry a list of suggested values. The
@@ -233,15 +233,23 @@ built on ViewComponent; hook it in before building any screen with those helpers
233
233
  where their Back link should come from before enabling the supplier or
234
234
  leaving it out.
235
235
  - `preference_supplier` — a callable that receives the view and a data
236
- table's key and returns `{ value:, save_url: }`, or `nil` when nothing is
237
- saved for that key. It is asked only for tables rendered with a `key:`. A
238
- table with no `key:`, a supplier returning `nil`, or no supplier at all
239
- renders with the hidden columns its own call passes.
240
- - `value` must hold the hidden column names under the string key
241
- `"hidden_columns"`, such as `{ "hidden_columns" => ["sku"] }`. A symbol key
242
- is not read, and the table then hides no columns. Only columns marked
243
- hideable are hidden.
244
- - When `save_url` is present, the table shows a Columns menu above itself.
236
+ table's key and returns `{ value:, save_url: }`, or `nil` when the person
237
+ can neither see nor save a layout for that key. It is asked only for
238
+ tables rendered with a `key:`. A table with no `key:`, a supplier returning
239
+ `nil`, or no supplier at all renders with the hidden columns its own call
240
+ passes and shows no Columns menu.
241
+ - `value` holds the hidden column names under the string key
242
+ `"hidden_columns"`, such as `{ "hidden_columns" => ["sku"] }`. That list
243
+ replaces the hidden columns the table's own call passes, and an empty list
244
+ shows every column. Only columns marked hideable are hidden.
245
+ - When `value` is `nil`, or has no `"hidden_columns"` string key, the table
246
+ keeps the hidden columns its own call passes. A symbol key is not read, so
247
+ `{ hidden_columns: [...] }` also keeps them.
248
+ - When nothing is saved yet for a person who may save a layout, return
249
+ `{ value: nil, save_url: }`. The table then shows its own default layout
250
+ with the Columns menu, so the person can save a first layout.
251
+ - When `save_url` is present, the table shows a Columns menu above itself,
252
+ with the currently hidden columns unchecked.
245
253
  Toggling a column sends a `PATCH` to `save_url` with the JSON body
246
254
  `{"hidden_columns": [...]}` and the page's CSRF token, then reloads the
247
255
  page. The host must have a route and action at that address that store the
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.33.0
4
+ version: 0.33.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider