@yuneta/gobj-ui 7.23.122 → 7.23.124
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/dist/gobj-ui.cjs.js +160 -123
- package/dist/gobj-ui.es.js +160 -123
- package/package.json +1 -1
- package/src/c_yui_form.js +9 -0
- package/src/c_yui_treedb_topic_with_form.js +9 -1
- package/src/yui_tabulator_i18n.js +49 -2
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -5892,6 +5892,160 @@ function register_c_yui_wizard() {
|
|
|
5892
5892
|
return create_gclass$17(GCLASS_NAME$17);
|
|
5893
5893
|
}
|
|
5894
5894
|
//#endregion
|
|
5895
|
+
//#region src/yui_tabulator_i18n.js
|
|
5896
|
+
/***********************************************************************
|
|
5897
|
+
* yui_tabulator_i18n.js
|
|
5898
|
+
*
|
|
5899
|
+
* The strings TABULATOR renders on its own — the paginator ("Page
|
|
5900
|
+
* Size", "First", "Prev", "Next", "Last"), the placeholder ("No Data
|
|
5901
|
+
* Available"), the loading/error notices — through the app's i18n.
|
|
5902
|
+
*
|
|
5903
|
+
* They are not built by any gclass, so nothing here or in an app ever
|
|
5904
|
+
* passed them through t(): a table sat in English inside an otherwise
|
|
5905
|
+
* Spanish view, and a language switch did not touch it.
|
|
5906
|
+
*
|
|
5907
|
+
* Two calls:
|
|
5908
|
+
*
|
|
5909
|
+
* new Tabulator($el, {..., ...yui_tabulator_lang(t)});
|
|
5910
|
+
* yui_tabulator_relocalize(table, t); // on a language change
|
|
5911
|
+
*
|
|
5912
|
+
* Every key carries an English `defaultValue`, so an app that does not
|
|
5913
|
+
* define it renders exactly what Tabulator rendered before — the
|
|
5914
|
+
* keys are an OPPORTUNITY to translate, never a requirement.
|
|
5915
|
+
*
|
|
5916
|
+
* Copyright (c) 2026, ArtGins.
|
|
5917
|
+
* All Rights Reserved.
|
|
5918
|
+
***********************************************************************/
|
|
5919
|
+
var __lang_seq__ = 0;
|
|
5920
|
+
function next_lang_name() {
|
|
5921
|
+
return `yui-${++__lang_seq__}`;
|
|
5922
|
+
}
|
|
5923
|
+
/***************************************************************
|
|
5924
|
+
* Tabulator's own strings, in the CURRENT language.
|
|
5925
|
+
*
|
|
5926
|
+
* ONE lang dict (not one per locale): the app owns the locales and hands us
|
|
5927
|
+
* only its live `t`, so a language change rebuilds the dict and re-applies
|
|
5928
|
+
* it under a fresh name (yui_tabulator_relocalize).
|
|
5929
|
+
***************************************************************/
|
|
5930
|
+
function yui_tabulator_lang(t) {
|
|
5931
|
+
let name = next_lang_name();
|
|
5932
|
+
let langs = {};
|
|
5933
|
+
langs[name] = tabulator_strings(t);
|
|
5934
|
+
return {
|
|
5935
|
+
locale: name,
|
|
5936
|
+
langs
|
|
5937
|
+
};
|
|
5938
|
+
}
|
|
5939
|
+
function tabulator_strings(t) {
|
|
5940
|
+
let tr = (key, def) => t(key, { defaultValue: def });
|
|
5941
|
+
return {
|
|
5942
|
+
data: {
|
|
5943
|
+
loading: tr("loading", "Loading"),
|
|
5944
|
+
error: tr("error", "Error")
|
|
5945
|
+
},
|
|
5946
|
+
pagination: {
|
|
5947
|
+
page_size: tr("page size", "Page Size"),
|
|
5948
|
+
page_title: tr("show page", "Show Page"),
|
|
5949
|
+
first: tr("first", "First"),
|
|
5950
|
+
first_title: tr("first page", "First Page"),
|
|
5951
|
+
last: tr("last", "Last"),
|
|
5952
|
+
last_title: tr("last page", "Last Page"),
|
|
5953
|
+
prev: tr("prev", "Prev"),
|
|
5954
|
+
prev_title: tr("prev page", "Prev Page"),
|
|
5955
|
+
next: tr("next", "Next"),
|
|
5956
|
+
next_title: tr("next page", "Next Page"),
|
|
5957
|
+
all: tr("all", "All")
|
|
5958
|
+
},
|
|
5959
|
+
headerFilters: { default: tr("filter column", "filter column...") }
|
|
5960
|
+
};
|
|
5961
|
+
}
|
|
5962
|
+
/***************************************************************
|
|
5963
|
+
* Put an EXISTING table in the current language: rebuild the strings and
|
|
5964
|
+
* re-apply the locale, which is what makes Tabulator re-render the parts
|
|
5965
|
+
* it owns (the paginator above all — it is drawn once, at build).
|
|
5966
|
+
*
|
|
5967
|
+
* Silent no-op on a table that is gone: a language switch races nothing,
|
|
5968
|
+
* but a view torn down mid-switch must not log a failure it cannot act on.
|
|
5969
|
+
***************************************************************/
|
|
5970
|
+
/***************************************************************
|
|
5971
|
+
* Name the HEADER FILTER inputs.
|
|
5972
|
+
*
|
|
5973
|
+
* Tabulator draws one text box per filterable column and gives
|
|
5974
|
+
* it nothing: no label, no `aria-label`, no placeholder. On
|
|
5975
|
+
* screen its position says what it filters -- it sits under the
|
|
5976
|
+
* column's title -- and to anything that is not an eye it is a
|
|
5977
|
+
* row of anonymous text boxes.
|
|
5978
|
+
*
|
|
5979
|
+
* The name is composed from the column's own title, so it needs
|
|
5980
|
+
* ONE consumer key with an interpolation (`filter by column` ->
|
|
5981
|
+
* "Filtrar por {{column}}") instead of one per column, and it
|
|
5982
|
+
* follows a language change because this runs from
|
|
5983
|
+
* `yui_tabulator_relocalize()` as well as at build.
|
|
5984
|
+
***************************************************************/
|
|
5985
|
+
function yui_tabulator_name_filters(table, t) {
|
|
5986
|
+
if (!table || typeof table.getColumns !== "function") return;
|
|
5987
|
+
try {
|
|
5988
|
+
for (let col of table.getColumns()) {
|
|
5989
|
+
let $el = typeof col.getElement === "function" ? col.getElement() : null;
|
|
5990
|
+
if (!$el) continue;
|
|
5991
|
+
let $input = $el.querySelector(".tabulator-header-filter input, .tabulator-header-filter select");
|
|
5992
|
+
if (!$input) continue;
|
|
5993
|
+
let title = typeof col.getDefinition === "function" ? String(col.getDefinition().title || "") : "";
|
|
5994
|
+
let $title = $el.querySelector(".tabulator-col-title");
|
|
5995
|
+
if (!title && $title) title = $title.textContent.trim();
|
|
5996
|
+
if (!title) continue;
|
|
5997
|
+
$input.setAttribute("aria-label", t("filter by column", { column: title }));
|
|
5998
|
+
}
|
|
5999
|
+
} catch (e) {}
|
|
6000
|
+
}
|
|
6001
|
+
/***************************************************************
|
|
6002
|
+
* Name the ROW-SELECTION checkboxes.
|
|
6003
|
+
*
|
|
6004
|
+
* Tabulator's `rowSelection` formatter hard-codes
|
|
6005
|
+
* `aria-label="Select Row"` on the box it draws -- no locale
|
|
6006
|
+
* key, no option, nothing to configure -- so a table in any
|
|
6007
|
+
* other language announces every row in English. Same shape as
|
|
6008
|
+
* the header filters above: rename after the render, and again
|
|
6009
|
+
* from `yui_tabulator_relocalize()` so a language change
|
|
6010
|
+
* reaches them.
|
|
6011
|
+
*
|
|
6012
|
+
* It matches Tabulator's OWN literal and only that, so a box a
|
|
6013
|
+
* view named itself is left alone.
|
|
6014
|
+
***************************************************************/
|
|
6015
|
+
var TABULATOR_ROW_SELECT_ARIA = "Select Row";
|
|
6016
|
+
function yui_tabulator_name_row_selects(table, t) {
|
|
6017
|
+
if (!table) return;
|
|
6018
|
+
try {
|
|
6019
|
+
let $el = table.element || (typeof table.getElement === "function" ? table.getElement() : null);
|
|
6020
|
+
if (!$el) {
|
|
6021
|
+
(0, _yuneta_gobj_js.log_warning)("yui_tabulator_name_row_selects: table has no element: its row-selection boxes keep Tabulator's English name");
|
|
6022
|
+
return;
|
|
6023
|
+
}
|
|
6024
|
+
let boxes = $el.querySelectorAll(`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"]`);
|
|
6025
|
+
for (let $box of boxes) {
|
|
6026
|
+
$box.setAttribute("aria-label", t("select row"));
|
|
6027
|
+
$box.setAttribute("data-i18n-aria-label", "select row");
|
|
6028
|
+
}
|
|
6029
|
+
} catch (e) {}
|
|
6030
|
+
}
|
|
6031
|
+
function yui_tabulator_relocalize(table, t) {
|
|
6032
|
+
if (!table) return;
|
|
6033
|
+
yui_tabulator_name_filters(table, t);
|
|
6034
|
+
yui_tabulator_name_row_selects(table, t);
|
|
6035
|
+
try {
|
|
6036
|
+
let name = next_lang_name();
|
|
6037
|
+
let strings = tabulator_strings(t);
|
|
6038
|
+
table.options.langs = table.options.langs || {};
|
|
6039
|
+
table.options.langs[name] = strings;
|
|
6040
|
+
let localize = table.modules && table.modules.localize;
|
|
6041
|
+
if (localize && typeof localize.installLang === "function") localize.installLang(name, strings);
|
|
6042
|
+
else (0, _yuneta_gobj_js.log_warning)("yui_tabulator_relocalize: no localize module: Tabulator's own chrome stays in the old language");
|
|
6043
|
+
table.setLocale(name);
|
|
6044
|
+
} catch (e) {
|
|
6045
|
+
(0, _yuneta_gobj_js.log_warning)(`yui_tabulator_relocalize: table gone: ${e}`);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
//#endregion
|
|
5895
6049
|
//#region src/yui_file_field.js
|
|
5896
6050
|
/***********************************************************************
|
|
5897
6051
|
* yui_file_field.js
|
|
@@ -8286,6 +8440,9 @@ function create_tabulator$1(gobj, $extend, name, template) {
|
|
|
8286
8440
|
hozAlign: "center"
|
|
8287
8441
|
};
|
|
8288
8442
|
let tabulator = new tabulator_tables.TabulatorFull($extend, tabulator_settings);
|
|
8443
|
+
tabulator.on("renderComplete", function() {
|
|
8444
|
+
yui_tabulator_name_row_selects(tabulator, i18next.t);
|
|
8445
|
+
});
|
|
8289
8446
|
tabulator.on("rowClick", function(e, row) {
|
|
8290
8447
|
e.preventDefault();
|
|
8291
8448
|
if (get_selectable_state(row)) row.toggleSelect();
|
|
@@ -23323,129 +23480,6 @@ function register_c_yui_treedb_topics() {
|
|
|
23323
23480
|
return create_gclass$6(GCLASS_NAME$6);
|
|
23324
23481
|
}
|
|
23325
23482
|
//#endregion
|
|
23326
|
-
//#region src/yui_tabulator_i18n.js
|
|
23327
|
-
/***********************************************************************
|
|
23328
|
-
* yui_tabulator_i18n.js
|
|
23329
|
-
*
|
|
23330
|
-
* The strings TABULATOR renders on its own — the paginator ("Page
|
|
23331
|
-
* Size", "First", "Prev", "Next", "Last"), the placeholder ("No Data
|
|
23332
|
-
* Available"), the loading/error notices — through the app's i18n.
|
|
23333
|
-
*
|
|
23334
|
-
* They are not built by any gclass, so nothing here or in an app ever
|
|
23335
|
-
* passed them through t(): a table sat in English inside an otherwise
|
|
23336
|
-
* Spanish view, and a language switch did not touch it.
|
|
23337
|
-
*
|
|
23338
|
-
* Two calls:
|
|
23339
|
-
*
|
|
23340
|
-
* new Tabulator($el, {..., ...yui_tabulator_lang(t)});
|
|
23341
|
-
* yui_tabulator_relocalize(table, t); // on a language change
|
|
23342
|
-
*
|
|
23343
|
-
* Every key carries an English `defaultValue`, so an app that does not
|
|
23344
|
-
* define it renders exactly what Tabulator rendered before — the
|
|
23345
|
-
* keys are an OPPORTUNITY to translate, never a requirement.
|
|
23346
|
-
*
|
|
23347
|
-
* Copyright (c) 2026, ArtGins.
|
|
23348
|
-
* All Rights Reserved.
|
|
23349
|
-
***********************************************************************/
|
|
23350
|
-
var __lang_seq__ = 0;
|
|
23351
|
-
function next_lang_name() {
|
|
23352
|
-
return `yui-${++__lang_seq__}`;
|
|
23353
|
-
}
|
|
23354
|
-
/***************************************************************
|
|
23355
|
-
* Tabulator's own strings, in the CURRENT language.
|
|
23356
|
-
*
|
|
23357
|
-
* ONE lang dict (not one per locale): the app owns the locales and hands us
|
|
23358
|
-
* only its live `t`, so a language change rebuilds the dict and re-applies
|
|
23359
|
-
* it under a fresh name (yui_tabulator_relocalize).
|
|
23360
|
-
***************************************************************/
|
|
23361
|
-
function yui_tabulator_lang(t) {
|
|
23362
|
-
let name = next_lang_name();
|
|
23363
|
-
let langs = {};
|
|
23364
|
-
langs[name] = tabulator_strings(t);
|
|
23365
|
-
return {
|
|
23366
|
-
locale: name,
|
|
23367
|
-
langs
|
|
23368
|
-
};
|
|
23369
|
-
}
|
|
23370
|
-
function tabulator_strings(t) {
|
|
23371
|
-
let tr = (key, def) => t(key, { defaultValue: def });
|
|
23372
|
-
return {
|
|
23373
|
-
data: {
|
|
23374
|
-
loading: tr("loading", "Loading"),
|
|
23375
|
-
error: tr("error", "Error")
|
|
23376
|
-
},
|
|
23377
|
-
pagination: {
|
|
23378
|
-
page_size: tr("page size", "Page Size"),
|
|
23379
|
-
page_title: tr("show page", "Show Page"),
|
|
23380
|
-
first: tr("first", "First"),
|
|
23381
|
-
first_title: tr("first page", "First Page"),
|
|
23382
|
-
last: tr("last", "Last"),
|
|
23383
|
-
last_title: tr("last page", "Last Page"),
|
|
23384
|
-
prev: tr("prev", "Prev"),
|
|
23385
|
-
prev_title: tr("prev page", "Prev Page"),
|
|
23386
|
-
next: tr("next", "Next"),
|
|
23387
|
-
next_title: tr("next page", "Next Page"),
|
|
23388
|
-
all: tr("all", "All")
|
|
23389
|
-
},
|
|
23390
|
-
headerFilters: { default: tr("filter column", "filter column...") }
|
|
23391
|
-
};
|
|
23392
|
-
}
|
|
23393
|
-
/***************************************************************
|
|
23394
|
-
* Put an EXISTING table in the current language: rebuild the strings and
|
|
23395
|
-
* re-apply the locale, which is what makes Tabulator re-render the parts
|
|
23396
|
-
* it owns (the paginator above all — it is drawn once, at build).
|
|
23397
|
-
*
|
|
23398
|
-
* Silent no-op on a table that is gone: a language switch races nothing,
|
|
23399
|
-
* but a view torn down mid-switch must not log a failure it cannot act on.
|
|
23400
|
-
***************************************************************/
|
|
23401
|
-
/***************************************************************
|
|
23402
|
-
* Name the HEADER FILTER inputs.
|
|
23403
|
-
*
|
|
23404
|
-
* Tabulator draws one text box per filterable column and gives
|
|
23405
|
-
* it nothing: no label, no `aria-label`, no placeholder. On
|
|
23406
|
-
* screen its position says what it filters -- it sits under the
|
|
23407
|
-
* column's title -- and to anything that is not an eye it is a
|
|
23408
|
-
* row of anonymous text boxes.
|
|
23409
|
-
*
|
|
23410
|
-
* The name is composed from the column's own title, so it needs
|
|
23411
|
-
* ONE consumer key with an interpolation (`filter by column` ->
|
|
23412
|
-
* "Filtrar por {{column}}") instead of one per column, and it
|
|
23413
|
-
* follows a language change because this runs from
|
|
23414
|
-
* `yui_tabulator_relocalize()` as well as at build.
|
|
23415
|
-
***************************************************************/
|
|
23416
|
-
function yui_tabulator_name_filters(table, t) {
|
|
23417
|
-
if (!table || typeof table.getColumns !== "function") return;
|
|
23418
|
-
try {
|
|
23419
|
-
for (let col of table.getColumns()) {
|
|
23420
|
-
let $el = typeof col.getElement === "function" ? col.getElement() : null;
|
|
23421
|
-
if (!$el) continue;
|
|
23422
|
-
let $input = $el.querySelector(".tabulator-header-filter input, .tabulator-header-filter select");
|
|
23423
|
-
if (!$input) continue;
|
|
23424
|
-
let title = typeof col.getDefinition === "function" ? String(col.getDefinition().title || "") : "";
|
|
23425
|
-
let $title = $el.querySelector(".tabulator-col-title");
|
|
23426
|
-
if (!title && $title) title = $title.textContent.trim();
|
|
23427
|
-
if (!title) continue;
|
|
23428
|
-
$input.setAttribute("aria-label", t("filter by column", { column: title }));
|
|
23429
|
-
}
|
|
23430
|
-
} catch (e) {}
|
|
23431
|
-
}
|
|
23432
|
-
function yui_tabulator_relocalize(table, t) {
|
|
23433
|
-
if (!table) return;
|
|
23434
|
-
yui_tabulator_name_filters(table, t);
|
|
23435
|
-
try {
|
|
23436
|
-
let name = next_lang_name();
|
|
23437
|
-
let strings = tabulator_strings(t);
|
|
23438
|
-
table.options.langs = table.options.langs || {};
|
|
23439
|
-
table.options.langs[name] = strings;
|
|
23440
|
-
let localize = table.modules && table.modules.localize;
|
|
23441
|
-
if (localize && typeof localize.installLang === "function") localize.installLang(name, strings);
|
|
23442
|
-
else (0, _yuneta_gobj_js.log_warning)("yui_tabulator_relocalize: no localize module: Tabulator's own chrome stays in the old language");
|
|
23443
|
-
table.setLocale(name);
|
|
23444
|
-
} catch (e) {
|
|
23445
|
-
(0, _yuneta_gobj_js.log_warning)(`yui_tabulator_relocalize: table gone: ${e}`);
|
|
23446
|
-
}
|
|
23447
|
-
}
|
|
23448
|
-
//#endregion
|
|
23449
23483
|
//#region src/yui_table_select.js
|
|
23450
23484
|
/***********************************************************************
|
|
23451
23485
|
* yui_table_select.js
|
|
@@ -25192,6 +25226,9 @@ function create_tabulator(gobj) {
|
|
|
25192
25226
|
delete tabulator._pendingData;
|
|
25193
25227
|
}
|
|
25194
25228
|
});
|
|
25229
|
+
tabulator.on("renderComplete", function() {
|
|
25230
|
+
yui_tabulator_name_row_selects(tabulator, i18next.t);
|
|
25231
|
+
});
|
|
25195
25232
|
tabulator.on("dataProcessed", update_rowcount);
|
|
25196
25233
|
tabulator.on("dataChanged", update_rowcount);
|
|
25197
25234
|
tabulator.on("pageSizeChanged", function(size) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -5887,6 +5887,160 @@ function register_c_yui_wizard() {
|
|
|
5887
5887
|
return create_gclass$17(GCLASS_NAME$17);
|
|
5888
5888
|
}
|
|
5889
5889
|
//#endregion
|
|
5890
|
+
//#region src/yui_tabulator_i18n.js
|
|
5891
|
+
/***********************************************************************
|
|
5892
|
+
* yui_tabulator_i18n.js
|
|
5893
|
+
*
|
|
5894
|
+
* The strings TABULATOR renders on its own — the paginator ("Page
|
|
5895
|
+
* Size", "First", "Prev", "Next", "Last"), the placeholder ("No Data
|
|
5896
|
+
* Available"), the loading/error notices — through the app's i18n.
|
|
5897
|
+
*
|
|
5898
|
+
* They are not built by any gclass, so nothing here or in an app ever
|
|
5899
|
+
* passed them through t(): a table sat in English inside an otherwise
|
|
5900
|
+
* Spanish view, and a language switch did not touch it.
|
|
5901
|
+
*
|
|
5902
|
+
* Two calls:
|
|
5903
|
+
*
|
|
5904
|
+
* new Tabulator($el, {..., ...yui_tabulator_lang(t)});
|
|
5905
|
+
* yui_tabulator_relocalize(table, t); // on a language change
|
|
5906
|
+
*
|
|
5907
|
+
* Every key carries an English `defaultValue`, so an app that does not
|
|
5908
|
+
* define it renders exactly what Tabulator rendered before — the
|
|
5909
|
+
* keys are an OPPORTUNITY to translate, never a requirement.
|
|
5910
|
+
*
|
|
5911
|
+
* Copyright (c) 2026, ArtGins.
|
|
5912
|
+
* All Rights Reserved.
|
|
5913
|
+
***********************************************************************/
|
|
5914
|
+
var __lang_seq__ = 0;
|
|
5915
|
+
function next_lang_name() {
|
|
5916
|
+
return `yui-${++__lang_seq__}`;
|
|
5917
|
+
}
|
|
5918
|
+
/***************************************************************
|
|
5919
|
+
* Tabulator's own strings, in the CURRENT language.
|
|
5920
|
+
*
|
|
5921
|
+
* ONE lang dict (not one per locale): the app owns the locales and hands us
|
|
5922
|
+
* only its live `t`, so a language change rebuilds the dict and re-applies
|
|
5923
|
+
* it under a fresh name (yui_tabulator_relocalize).
|
|
5924
|
+
***************************************************************/
|
|
5925
|
+
function yui_tabulator_lang(t) {
|
|
5926
|
+
let name = next_lang_name();
|
|
5927
|
+
let langs = {};
|
|
5928
|
+
langs[name] = tabulator_strings(t);
|
|
5929
|
+
return {
|
|
5930
|
+
locale: name,
|
|
5931
|
+
langs
|
|
5932
|
+
};
|
|
5933
|
+
}
|
|
5934
|
+
function tabulator_strings(t) {
|
|
5935
|
+
let tr = (key, def) => t(key, { defaultValue: def });
|
|
5936
|
+
return {
|
|
5937
|
+
data: {
|
|
5938
|
+
loading: tr("loading", "Loading"),
|
|
5939
|
+
error: tr("error", "Error")
|
|
5940
|
+
},
|
|
5941
|
+
pagination: {
|
|
5942
|
+
page_size: tr("page size", "Page Size"),
|
|
5943
|
+
page_title: tr("show page", "Show Page"),
|
|
5944
|
+
first: tr("first", "First"),
|
|
5945
|
+
first_title: tr("first page", "First Page"),
|
|
5946
|
+
last: tr("last", "Last"),
|
|
5947
|
+
last_title: tr("last page", "Last Page"),
|
|
5948
|
+
prev: tr("prev", "Prev"),
|
|
5949
|
+
prev_title: tr("prev page", "Prev Page"),
|
|
5950
|
+
next: tr("next", "Next"),
|
|
5951
|
+
next_title: tr("next page", "Next Page"),
|
|
5952
|
+
all: tr("all", "All")
|
|
5953
|
+
},
|
|
5954
|
+
headerFilters: { default: tr("filter column", "filter column...") }
|
|
5955
|
+
};
|
|
5956
|
+
}
|
|
5957
|
+
/***************************************************************
|
|
5958
|
+
* Put an EXISTING table in the current language: rebuild the strings and
|
|
5959
|
+
* re-apply the locale, which is what makes Tabulator re-render the parts
|
|
5960
|
+
* it owns (the paginator above all — it is drawn once, at build).
|
|
5961
|
+
*
|
|
5962
|
+
* Silent no-op on a table that is gone: a language switch races nothing,
|
|
5963
|
+
* but a view torn down mid-switch must not log a failure it cannot act on.
|
|
5964
|
+
***************************************************************/
|
|
5965
|
+
/***************************************************************
|
|
5966
|
+
* Name the HEADER FILTER inputs.
|
|
5967
|
+
*
|
|
5968
|
+
* Tabulator draws one text box per filterable column and gives
|
|
5969
|
+
* it nothing: no label, no `aria-label`, no placeholder. On
|
|
5970
|
+
* screen its position says what it filters -- it sits under the
|
|
5971
|
+
* column's title -- and to anything that is not an eye it is a
|
|
5972
|
+
* row of anonymous text boxes.
|
|
5973
|
+
*
|
|
5974
|
+
* The name is composed from the column's own title, so it needs
|
|
5975
|
+
* ONE consumer key with an interpolation (`filter by column` ->
|
|
5976
|
+
* "Filtrar por {{column}}") instead of one per column, and it
|
|
5977
|
+
* follows a language change because this runs from
|
|
5978
|
+
* `yui_tabulator_relocalize()` as well as at build.
|
|
5979
|
+
***************************************************************/
|
|
5980
|
+
function yui_tabulator_name_filters(table, t) {
|
|
5981
|
+
if (!table || typeof table.getColumns !== "function") return;
|
|
5982
|
+
try {
|
|
5983
|
+
for (let col of table.getColumns()) {
|
|
5984
|
+
let $el = typeof col.getElement === "function" ? col.getElement() : null;
|
|
5985
|
+
if (!$el) continue;
|
|
5986
|
+
let $input = $el.querySelector(".tabulator-header-filter input, .tabulator-header-filter select");
|
|
5987
|
+
if (!$input) continue;
|
|
5988
|
+
let title = typeof col.getDefinition === "function" ? String(col.getDefinition().title || "") : "";
|
|
5989
|
+
let $title = $el.querySelector(".tabulator-col-title");
|
|
5990
|
+
if (!title && $title) title = $title.textContent.trim();
|
|
5991
|
+
if (!title) continue;
|
|
5992
|
+
$input.setAttribute("aria-label", t("filter by column", { column: title }));
|
|
5993
|
+
}
|
|
5994
|
+
} catch (e) {}
|
|
5995
|
+
}
|
|
5996
|
+
/***************************************************************
|
|
5997
|
+
* Name the ROW-SELECTION checkboxes.
|
|
5998
|
+
*
|
|
5999
|
+
* Tabulator's `rowSelection` formatter hard-codes
|
|
6000
|
+
* `aria-label="Select Row"` on the box it draws -- no locale
|
|
6001
|
+
* key, no option, nothing to configure -- so a table in any
|
|
6002
|
+
* other language announces every row in English. Same shape as
|
|
6003
|
+
* the header filters above: rename after the render, and again
|
|
6004
|
+
* from `yui_tabulator_relocalize()` so a language change
|
|
6005
|
+
* reaches them.
|
|
6006
|
+
*
|
|
6007
|
+
* It matches Tabulator's OWN literal and only that, so a box a
|
|
6008
|
+
* view named itself is left alone.
|
|
6009
|
+
***************************************************************/
|
|
6010
|
+
var TABULATOR_ROW_SELECT_ARIA = "Select Row";
|
|
6011
|
+
function yui_tabulator_name_row_selects(table, t) {
|
|
6012
|
+
if (!table) return;
|
|
6013
|
+
try {
|
|
6014
|
+
let $el = table.element || (typeof table.getElement === "function" ? table.getElement() : null);
|
|
6015
|
+
if (!$el) {
|
|
6016
|
+
log_warning("yui_tabulator_name_row_selects: table has no element: its row-selection boxes keep Tabulator's English name");
|
|
6017
|
+
return;
|
|
6018
|
+
}
|
|
6019
|
+
let boxes = $el.querySelectorAll(`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"]`);
|
|
6020
|
+
for (let $box of boxes) {
|
|
6021
|
+
$box.setAttribute("aria-label", t("select row"));
|
|
6022
|
+
$box.setAttribute("data-i18n-aria-label", "select row");
|
|
6023
|
+
}
|
|
6024
|
+
} catch (e) {}
|
|
6025
|
+
}
|
|
6026
|
+
function yui_tabulator_relocalize(table, t) {
|
|
6027
|
+
if (!table) return;
|
|
6028
|
+
yui_tabulator_name_filters(table, t);
|
|
6029
|
+
yui_tabulator_name_row_selects(table, t);
|
|
6030
|
+
try {
|
|
6031
|
+
let name = next_lang_name();
|
|
6032
|
+
let strings = tabulator_strings(t);
|
|
6033
|
+
table.options.langs = table.options.langs || {};
|
|
6034
|
+
table.options.langs[name] = strings;
|
|
6035
|
+
let localize = table.modules && table.modules.localize;
|
|
6036
|
+
if (localize && typeof localize.installLang === "function") localize.installLang(name, strings);
|
|
6037
|
+
else log_warning("yui_tabulator_relocalize: no localize module: Tabulator's own chrome stays in the old language");
|
|
6038
|
+
table.setLocale(name);
|
|
6039
|
+
} catch (e) {
|
|
6040
|
+
log_warning(`yui_tabulator_relocalize: table gone: ${e}`);
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
//#endregion
|
|
5890
6044
|
//#region src/yui_file_field.js
|
|
5891
6045
|
/***********************************************************************
|
|
5892
6046
|
* yui_file_field.js
|
|
@@ -8281,6 +8435,9 @@ function create_tabulator$1(gobj, $extend, name, template) {
|
|
|
8281
8435
|
hozAlign: "center"
|
|
8282
8436
|
};
|
|
8283
8437
|
let tabulator = new TabulatorFull($extend, tabulator_settings);
|
|
8438
|
+
tabulator.on("renderComplete", function() {
|
|
8439
|
+
yui_tabulator_name_row_selects(tabulator, t);
|
|
8440
|
+
});
|
|
8284
8441
|
tabulator.on("rowClick", function(e, row) {
|
|
8285
8442
|
e.preventDefault();
|
|
8286
8443
|
if (get_selectable_state(row)) row.toggleSelect();
|
|
@@ -23318,129 +23475,6 @@ function register_c_yui_treedb_topics() {
|
|
|
23318
23475
|
return create_gclass$6(GCLASS_NAME$6);
|
|
23319
23476
|
}
|
|
23320
23477
|
//#endregion
|
|
23321
|
-
//#region src/yui_tabulator_i18n.js
|
|
23322
|
-
/***********************************************************************
|
|
23323
|
-
* yui_tabulator_i18n.js
|
|
23324
|
-
*
|
|
23325
|
-
* The strings TABULATOR renders on its own — the paginator ("Page
|
|
23326
|
-
* Size", "First", "Prev", "Next", "Last"), the placeholder ("No Data
|
|
23327
|
-
* Available"), the loading/error notices — through the app's i18n.
|
|
23328
|
-
*
|
|
23329
|
-
* They are not built by any gclass, so nothing here or in an app ever
|
|
23330
|
-
* passed them through t(): a table sat in English inside an otherwise
|
|
23331
|
-
* Spanish view, and a language switch did not touch it.
|
|
23332
|
-
*
|
|
23333
|
-
* Two calls:
|
|
23334
|
-
*
|
|
23335
|
-
* new Tabulator($el, {..., ...yui_tabulator_lang(t)});
|
|
23336
|
-
* yui_tabulator_relocalize(table, t); // on a language change
|
|
23337
|
-
*
|
|
23338
|
-
* Every key carries an English `defaultValue`, so an app that does not
|
|
23339
|
-
* define it renders exactly what Tabulator rendered before — the
|
|
23340
|
-
* keys are an OPPORTUNITY to translate, never a requirement.
|
|
23341
|
-
*
|
|
23342
|
-
* Copyright (c) 2026, ArtGins.
|
|
23343
|
-
* All Rights Reserved.
|
|
23344
|
-
***********************************************************************/
|
|
23345
|
-
var __lang_seq__ = 0;
|
|
23346
|
-
function next_lang_name() {
|
|
23347
|
-
return `yui-${++__lang_seq__}`;
|
|
23348
|
-
}
|
|
23349
|
-
/***************************************************************
|
|
23350
|
-
* Tabulator's own strings, in the CURRENT language.
|
|
23351
|
-
*
|
|
23352
|
-
* ONE lang dict (not one per locale): the app owns the locales and hands us
|
|
23353
|
-
* only its live `t`, so a language change rebuilds the dict and re-applies
|
|
23354
|
-
* it under a fresh name (yui_tabulator_relocalize).
|
|
23355
|
-
***************************************************************/
|
|
23356
|
-
function yui_tabulator_lang(t) {
|
|
23357
|
-
let name = next_lang_name();
|
|
23358
|
-
let langs = {};
|
|
23359
|
-
langs[name] = tabulator_strings(t);
|
|
23360
|
-
return {
|
|
23361
|
-
locale: name,
|
|
23362
|
-
langs
|
|
23363
|
-
};
|
|
23364
|
-
}
|
|
23365
|
-
function tabulator_strings(t) {
|
|
23366
|
-
let tr = (key, def) => t(key, { defaultValue: def });
|
|
23367
|
-
return {
|
|
23368
|
-
data: {
|
|
23369
|
-
loading: tr("loading", "Loading"),
|
|
23370
|
-
error: tr("error", "Error")
|
|
23371
|
-
},
|
|
23372
|
-
pagination: {
|
|
23373
|
-
page_size: tr("page size", "Page Size"),
|
|
23374
|
-
page_title: tr("show page", "Show Page"),
|
|
23375
|
-
first: tr("first", "First"),
|
|
23376
|
-
first_title: tr("first page", "First Page"),
|
|
23377
|
-
last: tr("last", "Last"),
|
|
23378
|
-
last_title: tr("last page", "Last Page"),
|
|
23379
|
-
prev: tr("prev", "Prev"),
|
|
23380
|
-
prev_title: tr("prev page", "Prev Page"),
|
|
23381
|
-
next: tr("next", "Next"),
|
|
23382
|
-
next_title: tr("next page", "Next Page"),
|
|
23383
|
-
all: tr("all", "All")
|
|
23384
|
-
},
|
|
23385
|
-
headerFilters: { default: tr("filter column", "filter column...") }
|
|
23386
|
-
};
|
|
23387
|
-
}
|
|
23388
|
-
/***************************************************************
|
|
23389
|
-
* Put an EXISTING table in the current language: rebuild the strings and
|
|
23390
|
-
* re-apply the locale, which is what makes Tabulator re-render the parts
|
|
23391
|
-
* it owns (the paginator above all — it is drawn once, at build).
|
|
23392
|
-
*
|
|
23393
|
-
* Silent no-op on a table that is gone: a language switch races nothing,
|
|
23394
|
-
* but a view torn down mid-switch must not log a failure it cannot act on.
|
|
23395
|
-
***************************************************************/
|
|
23396
|
-
/***************************************************************
|
|
23397
|
-
* Name the HEADER FILTER inputs.
|
|
23398
|
-
*
|
|
23399
|
-
* Tabulator draws one text box per filterable column and gives
|
|
23400
|
-
* it nothing: no label, no `aria-label`, no placeholder. On
|
|
23401
|
-
* screen its position says what it filters -- it sits under the
|
|
23402
|
-
* column's title -- and to anything that is not an eye it is a
|
|
23403
|
-
* row of anonymous text boxes.
|
|
23404
|
-
*
|
|
23405
|
-
* The name is composed from the column's own title, so it needs
|
|
23406
|
-
* ONE consumer key with an interpolation (`filter by column` ->
|
|
23407
|
-
* "Filtrar por {{column}}") instead of one per column, and it
|
|
23408
|
-
* follows a language change because this runs from
|
|
23409
|
-
* `yui_tabulator_relocalize()` as well as at build.
|
|
23410
|
-
***************************************************************/
|
|
23411
|
-
function yui_tabulator_name_filters(table, t) {
|
|
23412
|
-
if (!table || typeof table.getColumns !== "function") return;
|
|
23413
|
-
try {
|
|
23414
|
-
for (let col of table.getColumns()) {
|
|
23415
|
-
let $el = typeof col.getElement === "function" ? col.getElement() : null;
|
|
23416
|
-
if (!$el) continue;
|
|
23417
|
-
let $input = $el.querySelector(".tabulator-header-filter input, .tabulator-header-filter select");
|
|
23418
|
-
if (!$input) continue;
|
|
23419
|
-
let title = typeof col.getDefinition === "function" ? String(col.getDefinition().title || "") : "";
|
|
23420
|
-
let $title = $el.querySelector(".tabulator-col-title");
|
|
23421
|
-
if (!title && $title) title = $title.textContent.trim();
|
|
23422
|
-
if (!title) continue;
|
|
23423
|
-
$input.setAttribute("aria-label", t("filter by column", { column: title }));
|
|
23424
|
-
}
|
|
23425
|
-
} catch (e) {}
|
|
23426
|
-
}
|
|
23427
|
-
function yui_tabulator_relocalize(table, t) {
|
|
23428
|
-
if (!table) return;
|
|
23429
|
-
yui_tabulator_name_filters(table, t);
|
|
23430
|
-
try {
|
|
23431
|
-
let name = next_lang_name();
|
|
23432
|
-
let strings = tabulator_strings(t);
|
|
23433
|
-
table.options.langs = table.options.langs || {};
|
|
23434
|
-
table.options.langs[name] = strings;
|
|
23435
|
-
let localize = table.modules && table.modules.localize;
|
|
23436
|
-
if (localize && typeof localize.installLang === "function") localize.installLang(name, strings);
|
|
23437
|
-
else log_warning("yui_tabulator_relocalize: no localize module: Tabulator's own chrome stays in the old language");
|
|
23438
|
-
table.setLocale(name);
|
|
23439
|
-
} catch (e) {
|
|
23440
|
-
log_warning(`yui_tabulator_relocalize: table gone: ${e}`);
|
|
23441
|
-
}
|
|
23442
|
-
}
|
|
23443
|
-
//#endregion
|
|
23444
23478
|
//#region src/yui_table_select.js
|
|
23445
23479
|
/***********************************************************************
|
|
23446
23480
|
* yui_table_select.js
|
|
@@ -25187,6 +25221,9 @@ function create_tabulator(gobj) {
|
|
|
25187
25221
|
delete tabulator._pendingData;
|
|
25188
25222
|
}
|
|
25189
25223
|
});
|
|
25224
|
+
tabulator.on("renderComplete", function() {
|
|
25225
|
+
yui_tabulator_name_row_selects(tabulator, t);
|
|
25226
|
+
});
|
|
25190
25227
|
tabulator.on("dataProcessed", update_rowcount);
|
|
25191
25228
|
tabulator.on("dataChanged", update_rowcount);
|
|
25192
25229
|
tabulator.on("pageSizeChanged", function(size) {
|
package/package.json
CHANGED
package/src/c_yui_form.js
CHANGED
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
} from "@yuneta/gobj-js";
|
|
51
51
|
|
|
52
52
|
import {t} from "i18next";
|
|
53
|
+
|
|
54
|
+
import {yui_tabulator_name_row_selects} from "./yui_tabulator_i18n.js";
|
|
53
55
|
import "tom-select/dist/css/tom-select.css"; // Import Tom-Select CSS
|
|
54
56
|
import TomSelect from "tom-select"; // Import Tom-Select JS
|
|
55
57
|
|
|
@@ -1833,6 +1835,13 @@ function create_tabulator(gobj, $extend, name, template)
|
|
|
1833
1835
|
$extend,
|
|
1834
1836
|
tabulator_settings
|
|
1835
1837
|
);
|
|
1838
|
+
/* Tabulator hard-codes `aria-label="Select Row"` on the box its
|
|
1839
|
+
* rowSelection formatter draws, and it draws a fresh one on EVERY
|
|
1840
|
+
* render -- so this hangs off `renderComplete`, not `tableBuilt`:
|
|
1841
|
+
* a name put on once is gone with the next sort or page. */
|
|
1842
|
+
tabulator.on("renderComplete", function() {
|
|
1843
|
+
yui_tabulator_name_row_selects(tabulator, t);
|
|
1844
|
+
});
|
|
1836
1845
|
tabulator.on("rowClick", function(e, row) {
|
|
1837
1846
|
//e - the click event object
|
|
1838
1847
|
//row - row component
|
|
@@ -76,7 +76,8 @@ import {register_c_yui_json} from "./c_yui_json.js";
|
|
|
76
76
|
import {attach_clear} from "./yui_inputs.js";
|
|
77
77
|
|
|
78
78
|
import {yui_tabulator_lang, yui_tabulator_relocalize,
|
|
79
|
-
yui_tabulator_name_filters
|
|
79
|
+
yui_tabulator_name_filters,
|
|
80
|
+
yui_tabulator_name_row_selects} from "./yui_tabulator_i18n.js";
|
|
80
81
|
|
|
81
82
|
import {
|
|
82
83
|
yui_selection_column,
|
|
@@ -1674,6 +1675,13 @@ function create_tabulator(gobj)
|
|
|
1674
1675
|
* rows, because filtering fires its own event and neither of the other
|
|
1675
1676
|
* two. Nobody had noticed while the only filter was the global search
|
|
1676
1677
|
* box; a filter per column made it a claim you read on every keystroke. */
|
|
1678
|
+
/* Tabulator hard-codes `aria-label="Select Row"` on the box its
|
|
1679
|
+
* rowSelection formatter draws, and it draws a fresh one on EVERY
|
|
1680
|
+
* render -- so this hangs off `renderComplete`, not `tableBuilt`:
|
|
1681
|
+
* a name put on once is gone with the next sort or page. */
|
|
1682
|
+
tabulator.on("renderComplete", function() {
|
|
1683
|
+
yui_tabulator_name_row_selects(tabulator, t);
|
|
1684
|
+
});
|
|
1677
1685
|
tabulator.on("dataProcessed", update_rowcount);
|
|
1678
1686
|
tabulator.on("dataChanged", update_rowcount);
|
|
1679
1687
|
/* The reader changed the page size. The widget has already done the
|
|
@@ -142,14 +142,60 @@ function yui_tabulator_name_filters(table, t)
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/***************************************************************
|
|
146
|
+
* Name the ROW-SELECTION checkboxes.
|
|
147
|
+
*
|
|
148
|
+
* Tabulator's `rowSelection` formatter hard-codes
|
|
149
|
+
* `aria-label="Select Row"` on the box it draws -- no locale
|
|
150
|
+
* key, no option, nothing to configure -- so a table in any
|
|
151
|
+
* other language announces every row in English. Same shape as
|
|
152
|
+
* the header filters above: rename after the render, and again
|
|
153
|
+
* from `yui_tabulator_relocalize()` so a language change
|
|
154
|
+
* reaches them.
|
|
155
|
+
*
|
|
156
|
+
* It matches Tabulator's OWN literal and only that, so a box a
|
|
157
|
+
* view named itself is left alone.
|
|
158
|
+
***************************************************************/
|
|
159
|
+
const TABULATOR_ROW_SELECT_ARIA = "Select Row";
|
|
160
|
+
|
|
161
|
+
function yui_tabulator_name_row_selects(table, t)
|
|
162
|
+
{
|
|
163
|
+
if(!table) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
/* A Tabulator INSTANCE carries its node as `.element`; only its
|
|
168
|
+
* Column/Row components have `getElement()`. Testing for the
|
|
169
|
+
* method and returning silently made this a no-op on every real
|
|
170
|
+
* table -- and a no-op is what a dump of the deployed page
|
|
171
|
+
* showed, with the boxes still saying "Select Row". */
|
|
172
|
+
let $el = table.element
|
|
173
|
+
|| (typeof table.getElement === "function" ? table.getElement() : null);
|
|
174
|
+
if(!$el) {
|
|
175
|
+
log_warning("yui_tabulator_name_row_selects: table has no element: "
|
|
176
|
+
+ "its row-selection boxes keep Tabulator's English name");
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
let boxes = $el.querySelectorAll(
|
|
180
|
+
`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"]`);
|
|
181
|
+
for(let $box of boxes) {
|
|
182
|
+
$box.setAttribute("aria-label", t("select row"));
|
|
183
|
+
$box.setAttribute("data-i18n-aria-label", "select row");
|
|
184
|
+
}
|
|
185
|
+
} catch(e) {
|
|
186
|
+
/* a table between renders has no boxes to name */
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
145
190
|
function yui_tabulator_relocalize(table, t)
|
|
146
191
|
{
|
|
147
192
|
if(!table) {
|
|
148
193
|
return;
|
|
149
194
|
}
|
|
150
|
-
/*
|
|
151
|
-
* again in the new language. */
|
|
195
|
+
/* Neither the header filters nor the row-selection boxes have a
|
|
196
|
+
* name of their own; give them one again in the new language. */
|
|
152
197
|
yui_tabulator_name_filters(table, t);
|
|
198
|
+
yui_tabulator_name_row_selects(table, t);
|
|
153
199
|
try {
|
|
154
200
|
let name = next_lang_name();
|
|
155
201
|
let strings = tabulator_strings(t);
|
|
@@ -182,4 +228,5 @@ export {
|
|
|
182
228
|
yui_tabulator_lang,
|
|
183
229
|
yui_tabulator_relocalize,
|
|
184
230
|
yui_tabulator_name_filters,
|
|
231
|
+
yui_tabulator_name_row_selects,
|
|
185
232
|
};
|