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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af9ebb3caf69815bf6272cf2f67028d1f4e7a98b44f5e8fb0c70654a54b84303
|
|
4
|
+
data.tar.gz: a0465bf4038d273df4d29aca184443640f113a73260842c7590e12d040557a18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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]
|
|
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
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -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
|
|
228
|
-
ones passed in `hidden_columns:`, and
|
|
229
|
-
|
|
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
|
|
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.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
|
237
|
-
|
|
238
|
-
table with no `key:`, a supplier returning
|
|
239
|
-
renders with the hidden columns its own call
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|