@yuneta/gobj-ui 7.26.31 → 7.26.32
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.
- package/README.md +237 -72
- package/dist/gobj-ui.cjs.js +22 -16
- package/dist/gobj-ui.es.js +22 -16
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +1755 -328
- package/src/c_g6_nodes_tree.js +6 -4
- package/src/c_yui_form.js +5 -4
- package/src/c_yui_treedb_graph.js +6 -3
- package/src/c_yui_treedb_topics.js +6 -3
- package/src/i18n_key_functions.js +54 -31
- package/src/i18n_key_functions.test.js +461 -49
- package/src/yui_table_select.js +20 -13
package/src/yui_table_select.js
CHANGED
|
@@ -199,8 +199,8 @@ function yui_wire_selection(tabulator, on_change)
|
|
|
199
199
|
***************************************************************/
|
|
200
200
|
function yui_selection_bar(t, opts)
|
|
201
201
|
{
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
const o = opts || {};
|
|
203
|
+
const actions = Array.isArray(o.actions) ? o.actions : [];
|
|
204
204
|
let name = o.name || "TABLE";
|
|
205
205
|
let count = 0;
|
|
206
206
|
|
|
@@ -218,7 +218,6 @@ function yui_selection_bar(t, opts)
|
|
|
218
218
|
click: action.on_click
|
|
219
219
|
}]
|
|
220
220
|
);
|
|
221
|
-
$b._yui_label = action.label || "";
|
|
222
221
|
$buttons.push($b);
|
|
223
222
|
}
|
|
224
223
|
|
|
@@ -254,19 +253,27 @@ function yui_selection_bar(t, opts)
|
|
|
254
253
|
return $b.querySelector("span.icon ~ span");
|
|
255
254
|
}
|
|
256
255
|
|
|
256
|
+
/* A button's label and its name, in the current language */
|
|
257
|
+
function paint_label($b, key)
|
|
258
|
+
{
|
|
259
|
+
let $label = label_of($b);
|
|
260
|
+
if($label && key) {
|
|
261
|
+
$label.textContent = t(key);
|
|
262
|
+
}
|
|
263
|
+
$b.title = key ? t(key) : "";
|
|
264
|
+
$b.setAttribute("aria-label", $b.title);
|
|
265
|
+
}
|
|
266
|
+
|
|
257
267
|
function refresh()
|
|
258
268
|
{
|
|
259
269
|
$count.textContent = t("{{n}} selected", {n: count});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
$b.title = key ? t(key) : "";
|
|
268
|
-
$b.setAttribute("aria-label", $b.title);
|
|
269
|
-
}
|
|
270
|
+
/* An action's label is the HOST's key, read where the host calls
|
|
271
|
+
* yui_selection_bar() (I18N_KEY_FUNCTIONS); the clear button's, a
|
|
272
|
+
* literal read here */
|
|
273
|
+
actions.forEach((action, i) => {
|
|
274
|
+
paint_label($buttons[i], action.label || "");
|
|
275
|
+
});
|
|
276
|
+
paint_label($clear, "clear selection");
|
|
270
277
|
/* Bulma's `is-hidden` carries `!important`: the class is what
|
|
271
278
|
* toggles, an inline display would lose to it. */
|
|
272
279
|
$el.classList.toggle("is-hidden", count <= 0);
|