@yuneta/gobj-ui 7.26.55 → 7.26.57
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 +8 -4
- package/dist/gobj-ui.cjs.js +126 -88
- package/dist/gobj-ui.es.js +87 -49
- package/package.json +4 -4
- package/scripts/validate-locales.mjs +4 -3
- package/src/c_yui_form.js +11 -33
- package/src/c_yui_treedb_topic_with_form.js +9 -2
- package/src/fmt_date_time.test.js +1 -1
- package/src/form_time_field.wiring.test.js +12 -0
- package/src/form_time_value.js +1 -1
- package/src/json_view_helpers.js +1 -1
- package/src/tabulator_edit_internals.test.js +5 -4
- package/src/yui_tabulator_edit.js +77 -14
- package/src/yui_tabulator_edit.test.js +61 -7
- package/src/yui_uplot_time.js +1 -1
package/README.md
CHANGED
|
@@ -4199,10 +4199,14 @@ and reads back the bundle each host serves (`--check` only reads back,
|
|
|
4199
4199
|
`--only <name>` does one app, `--no-wait` skips the registry). The private
|
|
4200
4200
|
consumers are listed in `~/.yuneta/gobj-ui-consumers.json` (see
|
|
4201
4201
|
`scripts/gobj-ui-consumers.example.json`); the demo (`test-app/`) is built in.
|
|
4202
|
-
It is built from the working
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
`
|
|
4202
|
+
It is built from the working trees of this repo and of the sibling `gobj-js`
|
|
4203
|
+
(`test-app/vite.config.js` bundles `../../gobj-js/src`), so it goes out only
|
|
4204
|
+
when each is a clean tree of its own (untracked files count; a copy with no
|
|
4205
|
+
`.git` inside another repo is refused) whose HEAD is the commit `origin/main`
|
|
4206
|
+
holds on the remote; otherwise it is `NOT DEPLOYED`, with the reason, and the
|
|
4207
|
+
round exits 1 (since `7.26.55`, the sibling `gobj-js` since `7.26.57`; up to
|
|
4208
|
+
`7.26.54` any copy of the repo, on any commit, deployed the public demo). The
|
|
4209
|
+
demo's target is named `test-app` (`--only test-app`).
|
|
4206
4210
|
|
|
4207
4211
|
An app whose range cannot be raised safely is refused and left as it was --
|
|
4208
4212
|
every package.json of it, since all are checked before any is written: a
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
10
|
var __exportAll = (all, no_symbols) => {
|
|
11
11
|
let target = {};
|
|
12
12
|
for (var name in all) __defProp(target, name, {
|
|
@@ -9916,7 +9916,7 @@ function is_time_field(field) {
|
|
|
9916
9916
|
/************************************************************
|
|
9917
9917
|
* Format an epoch value as a local wall-clock string, 24
|
|
9918
9918
|
* hours, in the APP's language `locale` (fmt_date_time() of
|
|
9919
|
-
*
|
|
9919
|
+
* yui_date_text.js, as the time cells of the forms and tables;
|
|
9920
9920
|
* up to gobj-ui 7.26.51 it was toLocaleString(): the
|
|
9921
9921
|
* browser's language, and 12 hours in English).
|
|
9922
9922
|
* Accepts seconds or milliseconds; returns null when the
|
|
@@ -10196,7 +10196,7 @@ function epoch_to_time_value(epoch, real_type) {
|
|
|
10196
10196
|
/************************************************************
|
|
10197
10197
|
* The value of a time column as a table cell shows it: the
|
|
10198
10198
|
* local clock, 24 hours, in the APP's language `locale`
|
|
10199
|
-
* (fmt_date_time() of
|
|
10199
|
+
* (fmt_date_time() of yui_date_text.js: es "14 oct 2026, 15:05:09").
|
|
10200
10200
|
* Up to gobj-ui 7.26.51 the form wrote "2026-10-14 15:05:09" and
|
|
10201
10201
|
* the treedb table "14 oct 2026, 03:05:09 p. m.", in the
|
|
10202
10202
|
* browser's language. "" for no time; a value that is not one is
|
|
@@ -10360,22 +10360,55 @@ function form_time_cell_editor(real_type) {
|
|
|
10360
10360
|
* (form_time_cell_editor.js) or Tabulator's own.
|
|
10361
10361
|
*
|
|
10362
10362
|
* `setColumns()` (a language change of
|
|
10363
|
-
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it)
|
|
10364
|
-
* `setMaxHeight
|
|
10365
|
-
*
|
|
10363
|
+
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it), `setHeight`,
|
|
10364
|
+
* `setMaxHeight`, `setMinHeight`, `addColumn`,
|
|
10365
|
+
* `updateColumnDefinition` and `moveColumn` build the cells
|
|
10366
|
+
* again the same way, and Tabulator throws the same.
|
|
10366
10367
|
*
|
|
10367
10368
|
* So the edit is ended BEFORE each of those calls, while its cell
|
|
10368
10369
|
* is alive, and opened again on the new cell of the same row
|
|
10369
|
-
* and column after it
|
|
10370
|
-
*
|
|
10370
|
+
* and column after it (after the promise, for the calls that
|
|
10371
|
+
* answer one). What was typed in the box is lost; the editor
|
|
10372
|
+
* stays open under the reader. A cell the call left out of the
|
|
10373
|
+
* page (a row the virtual DOM no longer renders) is not opened:
|
|
10374
|
+
* the edit stays closed, and the log says so.
|
|
10375
|
+
*
|
|
10376
|
+
* A call that WIPES the rows (setData, replaceData, clearData,
|
|
10377
|
+
* destroy) closes the edit first with
|
|
10378
|
+
* `yui_tabulator_close_editor()`: there is no cell to open it
|
|
10379
|
+
* on again.
|
|
10371
10380
|
*
|
|
10372
10381
|
* Copyright (c) 2026, ArtGins.
|
|
10373
10382
|
* All Rights Reserved.
|
|
10374
10383
|
****************************************************************************/
|
|
10375
10384
|
/************************************************************
|
|
10385
|
+
* Close the cell editor a table has open, dropping what is
|
|
10386
|
+
* typed in it, before its rows are wiped (setData, replaceData,
|
|
10387
|
+
* clearData, destroy). Tabulator 6.6.0 closes it while it wipes
|
|
10388
|
+
* them, and the redraw that follows walks the rows already
|
|
10389
|
+
* wiped: with an editor open in any row but the first it threw
|
|
10390
|
+
* ("reading 'add'"), and left the table half wiped.
|
|
10391
|
+
*
|
|
10392
|
+
* Tabulator has no public way to ask which cell is edited: this
|
|
10393
|
+
* reads its edit module (`modules.edit`, `currentCell`,
|
|
10394
|
+
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
10395
|
+
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
10396
|
+
* is said: the guard would do nothing, and the crash come back.
|
|
10397
|
+
* `who` names the owner in that warning.
|
|
10398
|
+
************************************************************/
|
|
10399
|
+
function yui_tabulator_close_editor(tabulator, who) {
|
|
10400
|
+
let edit = tabulator.modules ? tabulator.modules.edit : null;
|
|
10401
|
+
if (!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
10402
|
+
(0, _yuneta_gobj_js.log_warning)(`${who}: this Tabulator has no modules.edit.currentCell/cancelEdit(): an open cell editor is not closed before its table is wiped`);
|
|
10403
|
+
return;
|
|
10404
|
+
}
|
|
10405
|
+
if (edit.currentCell) edit.cancelEdit();
|
|
10406
|
+
}
|
|
10407
|
+
/************************************************************
|
|
10376
10408
|
* Wrap the calls of `tabulator` that build the cells again --
|
|
10377
|
-
* a forced `redraw`, `setColumns
|
|
10378
|
-
*
|
|
10409
|
+
* a forced `redraw`, `setColumns`, the three height setters
|
|
10410
|
+
* and `addColumn`, `updateColumnDefinition`, `moveColumn` --
|
|
10411
|
+
* so that each ends the open edit first and opens it again
|
|
10379
10412
|
* after.
|
|
10380
10413
|
************************************************************/
|
|
10381
10414
|
function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
@@ -10389,6 +10422,19 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10389
10422
|
tabulator.on("cellEditCancelled", function() {
|
|
10390
10423
|
editing = null;
|
|
10391
10424
|
});
|
|
10425
|
+
function edit_again(row, field, name) {
|
|
10426
|
+
let again = row.getCell(field);
|
|
10427
|
+
if (!again) {
|
|
10428
|
+
(0, _yuneta_gobj_js.log_warning)(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: no column '${field}' after ${name}()`);
|
|
10429
|
+
return;
|
|
10430
|
+
}
|
|
10431
|
+
let $again = again.getElement();
|
|
10432
|
+
if (!$again || !$again.isConnected) {
|
|
10433
|
+
(0, _yuneta_gobj_js.log_warning)(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: its row is not in the page after ${name}()`);
|
|
10434
|
+
return;
|
|
10435
|
+
}
|
|
10436
|
+
again.edit(true);
|
|
10437
|
+
}
|
|
10392
10438
|
function keep_edit_around(name, rebuilds) {
|
|
10393
10439
|
let original = tabulator[name].bind(tabulator);
|
|
10394
10440
|
tabulator[name] = function(...args) {
|
|
@@ -10399,12 +10445,14 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10399
10445
|
let field = cell.getField();
|
|
10400
10446
|
cell.cancelEdit();
|
|
10401
10447
|
let ret = original(...args);
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10448
|
+
if (ret && typeof ret.then === "function") return ret.then((value) => {
|
|
10449
|
+
edit_again(row, field, name);
|
|
10450
|
+
return value;
|
|
10451
|
+
}, (reason) => {
|
|
10452
|
+
edit_again(row, field, name);
|
|
10453
|
+
throw reason;
|
|
10454
|
+
});
|
|
10455
|
+
edit_again(row, field, name);
|
|
10408
10456
|
return ret;
|
|
10409
10457
|
};
|
|
10410
10458
|
}
|
|
@@ -10413,7 +10461,10 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10413
10461
|
"setColumns",
|
|
10414
10462
|
"setHeight",
|
|
10415
10463
|
"setMaxHeight",
|
|
10416
|
-
"setMinHeight"
|
|
10464
|
+
"setMinHeight",
|
|
10465
|
+
"addColumn",
|
|
10466
|
+
"updateColumnDefinition",
|
|
10467
|
+
"moveColumn"
|
|
10417
10468
|
]) keep_edit_around(name, () => true);
|
|
10418
10469
|
}
|
|
10419
10470
|
//#endregion
|
|
@@ -11270,28 +11321,6 @@ function destroy_widget(gobj, what, widget) {
|
|
|
11270
11321
|
}
|
|
11271
11322
|
}
|
|
11272
11323
|
/************************************************************
|
|
11273
|
-
* Close the cell editor a table has open, dropping what is
|
|
11274
|
-
* typed in it, before its rows are wiped. Tabulator 6.6.0
|
|
11275
|
-
* closes it while it wipes them, and the redraw that follows
|
|
11276
|
-
* walks the rows already wiped: a reload, a Clear or a destroy
|
|
11277
|
-
* with an editor open in any row but the first threw, and left
|
|
11278
|
-
* the table half wiped.
|
|
11279
|
-
*
|
|
11280
|
-
* Tabulator has no public way to ask which cell is edited: this
|
|
11281
|
-
* reads its edit module (`modules.edit`, `currentCell`,
|
|
11282
|
-
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
11283
|
-
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
11284
|
-
* is said: the guard would do nothing, and the crash come back.
|
|
11285
|
-
************************************************************/
|
|
11286
|
-
function close_table_editor(gobj, tabulator) {
|
|
11287
|
-
let edit = tabulator.modules ? tabulator.modules.edit : null;
|
|
11288
|
-
if (!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
11289
|
-
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: this Tabulator has no modules.edit.currentCell/cancelEdit(): an open cell editor is not closed before its table is wiped`);
|
|
11290
|
-
return;
|
|
11291
|
-
}
|
|
11292
|
-
if (edit.currentCell) edit.cancelEdit();
|
|
11293
|
-
}
|
|
11294
|
-
/************************************************************
|
|
11295
11324
|
* The element of the table (`.tabulator` kept on it) that holds
|
|
11296
11325
|
* $el, the innermost one.
|
|
11297
11326
|
************************************************************/
|
|
@@ -11320,7 +11349,7 @@ function destroy_row_tables(gobj, $row) {
|
|
|
11320
11349
|
$row.yui_nested = null;
|
|
11321
11350
|
for (let $nested of nested) {
|
|
11322
11351
|
if ($nested.tabulator) {
|
|
11323
|
-
|
|
11352
|
+
yui_tabulator_close_editor($nested.tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
11324
11353
|
destroy_rows_tables(gobj, $nested.tabulator);
|
|
11325
11354
|
destroy_widget(gobj, "nested table", $nested.tabulator);
|
|
11326
11355
|
$nested.tabulator = null;
|
|
@@ -11353,7 +11382,7 @@ function destroy_widgets(gobj, $container) {
|
|
|
11353
11382
|
$el.jsoneditor = null;
|
|
11354
11383
|
}
|
|
11355
11384
|
if ($el.tabulator) {
|
|
11356
|
-
|
|
11385
|
+
yui_tabulator_close_editor($el.tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
11357
11386
|
destroy_rows_tables(gobj, $el.tabulator);
|
|
11358
11387
|
destroy_widget(gobj, "table", $el.tabulator);
|
|
11359
11388
|
$el.tabulator = null;
|
|
@@ -12792,7 +12821,7 @@ function table_column_titles(template) {
|
|
|
12792
12821
|
var TIME_CELL_FORMATTERS = /* @__PURE__ */ new WeakSet();
|
|
12793
12822
|
/******************************************************************
|
|
12794
12823
|
* The formatter of a time cell: the local clock, 24 hours, in the
|
|
12795
|
-
* APP's language (fmt_date_time of
|
|
12824
|
+
* APP's language (fmt_date_time of yui_date_text.js, as the cells of
|
|
12796
12825
|
* C_YUI_TREEDB_TOPIC_WITH_FORM): es "14 oct 2026, 15:05:09".
|
|
12797
12826
|
******************************************************************/
|
|
12798
12827
|
function time_cell_formatter(real_type) {
|
|
@@ -13252,7 +13281,7 @@ function clear_data(gobj, $form) {
|
|
|
13252
13281
|
$form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
|
|
13253
13282
|
$table.yui_pending_rows = null;
|
|
13254
13283
|
if ($table.tabulator.initialized) {
|
|
13255
|
-
|
|
13284
|
+
yui_tabulator_close_editor($table.tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
13256
13285
|
destroy_rows_tables(gobj, $table.tabulator);
|
|
13257
13286
|
$table.tabulator.clearData();
|
|
13258
13287
|
}
|
|
@@ -13336,6 +13365,7 @@ function set_form_values(gobj, template, $form, record) {
|
|
|
13336
13365
|
value: stored,
|
|
13337
13366
|
shown: $input.value
|
|
13338
13367
|
} : null;
|
|
13368
|
+
if ($input.value === "" && stored !== null && stored !== "") (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: '${path}' holds ${JSON.stringify(stored)}, which the time box cannot show: a save writes it as null`);
|
|
13339
13369
|
break;
|
|
13340
13370
|
case "color":
|
|
13341
13371
|
$input.value = convertColor(value);
|
|
@@ -15221,7 +15251,7 @@ function yui_uplot_axes(axes) {
|
|
|
15221
15251
|
* The texts uPlot writes for a moment -- the ticks of a time axis
|
|
15222
15252
|
* and the reading of the legend -- in the APP's language, with a
|
|
15223
15253
|
* clock of 24 hours, as every other time a gobj-ui view shows
|
|
15224
|
-
* (fmt_date_time of
|
|
15254
|
+
* (fmt_date_time of yui_date_text.js).
|
|
15225
15255
|
*
|
|
15226
15256
|
* uPlot writes them from templates of its own, in English and
|
|
15227
15257
|
* 12 hours: "3pm", "3:05pm", "10/14" (month first), "Oct", and
|
|
@@ -15422,9 +15452,9 @@ function mt_destroy$15(gobj) {
|
|
|
15422
15452
|
gobj.priv.theme_observer.disconnect();
|
|
15423
15453
|
gobj.priv.theme_observer = null;
|
|
15424
15454
|
}
|
|
15425
|
-
let uplot
|
|
15426
|
-
if (uplot
|
|
15427
|
-
uplot
|
|
15455
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15456
|
+
if (uplot) {
|
|
15457
|
+
uplot.destroy();
|
|
15428
15458
|
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "uplot", null);
|
|
15429
15459
|
}
|
|
15430
15460
|
destroy_ui$9(gobj);
|
|
@@ -15454,12 +15484,12 @@ function build_ui$14(gobj) {
|
|
|
15454
15484
|
scales: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "scales"),
|
|
15455
15485
|
fmtDate: yui_uplot_fmt_date(() => i18next.default.language)
|
|
15456
15486
|
};
|
|
15457
|
-
let uplot$
|
|
15458
|
-
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "uplot", uplot$
|
|
15487
|
+
let uplot$1 = new uplot.default(uPlot_options, (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "data"), $container);
|
|
15488
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "uplot", uplot$1);
|
|
15459
15489
|
let fixed_height = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "height");
|
|
15460
15490
|
function fit_to_container() {
|
|
15461
15491
|
let w = $container.clientWidth;
|
|
15462
|
-
if (w > 0) uplot$
|
|
15492
|
+
if (w > 0) uplot$1.setSize({
|
|
15463
15493
|
width: w,
|
|
15464
15494
|
height: fixed_height
|
|
15465
15495
|
});
|
|
@@ -15495,19 +15525,19 @@ function destroy_ui$9(gobj) {
|
|
|
15495
15525
|
*
|
|
15496
15526
|
******************************************************/
|
|
15497
15527
|
function ac_load_data$2(gobj, event, kw, src) {
|
|
15498
|
-
let uplot
|
|
15528
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15499
15529
|
if (!kw.length) {
|
|
15500
|
-
uplot
|
|
15530
|
+
uplot.setData([]);
|
|
15501
15531
|
return -1;
|
|
15502
15532
|
}
|
|
15503
15533
|
let tm = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "tm");
|
|
15504
15534
|
let data = [];
|
|
15505
|
-
let max_series = uplot
|
|
15535
|
+
let max_series = uplot.series.length;
|
|
15506
15536
|
for (let idx = 0; idx < max_series; idx++) data[idx] = [];
|
|
15507
15537
|
for (let i = 0; i < kw.length; i++) {
|
|
15508
15538
|
data[0].push(kw[i][tm]);
|
|
15509
|
-
for (let idx = 1; idx < uplot
|
|
15510
|
-
let serie = uplot
|
|
15539
|
+
for (let idx = 1; idx < uplot.series.length; idx++) {
|
|
15540
|
+
let serie = uplot.series[idx];
|
|
15511
15541
|
let value = kw[i][serie.id];
|
|
15512
15542
|
if ((0, _yuneta_gobj_js.is_string)(value)) {
|
|
15513
15543
|
if (value.toLowerCase() === "on") value = 1;
|
|
@@ -15520,20 +15550,20 @@ function ac_load_data$2(gobj, event, kw, src) {
|
|
|
15520
15550
|
data[idx].push(value);
|
|
15521
15551
|
}
|
|
15522
15552
|
}
|
|
15523
|
-
uplot
|
|
15524
|
-
Array.from(uplot
|
|
15553
|
+
uplot.setData(data);
|
|
15554
|
+
Array.from(uplot.root.querySelectorAll(".cursor-pt")).forEach(function(pt, i) {
|
|
15525
15555
|
pt.onclick = function(e) {
|
|
15526
15556
|
let seriesIdx = i + 1;
|
|
15527
|
-
let dataIdx = uplot
|
|
15528
|
-
let xVal = uplot
|
|
15529
|
-
let yVal = uplot
|
|
15530
|
-
let xPos = uplot
|
|
15531
|
-
let yPos = uplot
|
|
15557
|
+
let dataIdx = uplot.cursor.idx;
|
|
15558
|
+
let xVal = uplot.data[0][dataIdx];
|
|
15559
|
+
let yVal = uplot.data[seriesIdx][dataIdx];
|
|
15560
|
+
let xPos = uplot.valToPos(xVal, "x");
|
|
15561
|
+
let yPos = uplot.valToPos(yVal, "y");
|
|
15532
15562
|
let heart = document.createElement("div");
|
|
15533
15563
|
heart.classList.add("heart");
|
|
15534
15564
|
heart.style.left = xPos + "px";
|
|
15535
15565
|
heart.style.top = yPos + "px";
|
|
15536
|
-
uplot
|
|
15566
|
+
uplot.root.querySelector(".over").appendChild(heart);
|
|
15537
15567
|
};
|
|
15538
15568
|
});
|
|
15539
15569
|
return 0;
|
|
@@ -15542,10 +15572,10 @@ function ac_load_data$2(gobj, event, kw, src) {
|
|
|
15542
15572
|
*
|
|
15543
15573
|
******************************************************/
|
|
15544
15574
|
function ac_add_serie(gobj, event, kw, src) {
|
|
15545
|
-
let uplot
|
|
15575
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15546
15576
|
let idx = 0;
|
|
15547
|
-
for (; idx < uplot
|
|
15548
|
-
let serie = uplot
|
|
15577
|
+
for (; idx < uplot.series.length; idx++) {
|
|
15578
|
+
let serie = uplot.series[idx];
|
|
15549
15579
|
if (serie.id && serie.id === kw.id) {
|
|
15550
15580
|
(0, _yuneta_gobj_js.log_error)("Serie '" + kw.id + "' already exists");
|
|
15551
15581
|
return -1;
|
|
@@ -15556,7 +15586,7 @@ function ac_add_serie(gobj, event, kw, src) {
|
|
|
15556
15586
|
let color = colors[Math.max(0, idx - 1) % colors.length];
|
|
15557
15587
|
if (kw.stroke === void 0) kw.stroke = color.stroke;
|
|
15558
15588
|
if (kw.fill === void 0) kw.fill = color.fill;
|
|
15559
|
-
uplot
|
|
15589
|
+
uplot.addSeries(kw);
|
|
15560
15590
|
return 0;
|
|
15561
15591
|
}
|
|
15562
15592
|
/******************************************************
|
|
@@ -15564,10 +15594,10 @@ function ac_add_serie(gobj, event, kw, src) {
|
|
|
15564
15594
|
* one already, the canvas is what has to be painted again.
|
|
15565
15595
|
******************************************************/
|
|
15566
15596
|
function ac_theme$4(gobj, event, kw, src) {
|
|
15567
|
-
let uplot
|
|
15568
|
-
if (!uplot
|
|
15597
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15598
|
+
if (!uplot) return 0;
|
|
15569
15599
|
try {
|
|
15570
|
-
uplot
|
|
15600
|
+
uplot.redraw();
|
|
15571
15601
|
} catch (e) {
|
|
15572
15602
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot redraw the chart: ${e}`);
|
|
15573
15603
|
}
|
|
@@ -15579,11 +15609,11 @@ function ac_theme$4(gobj, event, kw, src) {
|
|
|
15579
15609
|
* so they are written again.
|
|
15580
15610
|
******************************************************/
|
|
15581
15611
|
function ac_language_changed$9(gobj, event, kw, src) {
|
|
15582
|
-
let uplot
|
|
15583
|
-
if (!uplot
|
|
15612
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15613
|
+
if (!uplot) return 0;
|
|
15584
15614
|
try {
|
|
15585
|
-
uplot
|
|
15586
|
-
uplot
|
|
15615
|
+
uplot.redraw(true, true);
|
|
15616
|
+
uplot.setLegend(null, false);
|
|
15587
15617
|
} catch (e) {
|
|
15588
15618
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot redraw the chart: ${e}`);
|
|
15589
15619
|
}
|
|
@@ -15593,14 +15623,14 @@ function ac_language_changed$9(gobj, event, kw, src) {
|
|
|
15593
15623
|
*
|
|
15594
15624
|
******************************************************/
|
|
15595
15625
|
function ac_del_serie(gobj, event, kw, src) {
|
|
15596
|
-
let uplot
|
|
15597
|
-
for (let idx = 1; idx < uplot
|
|
15598
|
-
let serie = uplot
|
|
15626
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15627
|
+
for (let idx = 1; idx < uplot.series.length; idx++) {
|
|
15628
|
+
let serie = uplot.series[idx];
|
|
15599
15629
|
if (serie.id && serie.id === kw.id) {
|
|
15600
|
-
uplot
|
|
15601
|
-
let data = uplot
|
|
15630
|
+
uplot.delSeries(idx);
|
|
15631
|
+
let data = uplot.data.splice(idx, 1);
|
|
15602
15632
|
if (data.length === 1) data = [[]];
|
|
15603
|
-
uplot
|
|
15633
|
+
uplot.setData(data);
|
|
15604
15634
|
return 0;
|
|
15605
15635
|
}
|
|
15606
15636
|
}
|
|
@@ -15610,9 +15640,9 @@ function ac_del_serie(gobj, event, kw, src) {
|
|
|
15610
15640
|
*
|
|
15611
15641
|
******************************************************/
|
|
15612
15642
|
function ac_clear$1(gobj, event, kw, src) {
|
|
15613
|
-
let uplot
|
|
15614
|
-
uplot
|
|
15615
|
-
for (let idx = uplot
|
|
15643
|
+
let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
15644
|
+
uplot.setData([[]]);
|
|
15645
|
+
for (let idx = uplot.series.length - 1; idx > 0; idx--) uplot.delSeries(idx);
|
|
15616
15646
|
return 0;
|
|
15617
15647
|
}
|
|
15618
15648
|
/***************************
|
|
@@ -33225,7 +33255,12 @@ function create_tabulator(gobj) {
|
|
|
33225
33255
|
function table__destroy(gobj) {
|
|
33226
33256
|
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
33227
33257
|
if (tabulator) {
|
|
33228
|
-
tabulator.
|
|
33258
|
+
yui_tabulator_close_editor(tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
33259
|
+
try {
|
|
33260
|
+
tabulator.destroy();
|
|
33261
|
+
} catch (e) {
|
|
33262
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy the table: ${e}`);
|
|
33263
|
+
}
|
|
33229
33264
|
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "tabulator", null);
|
|
33230
33265
|
}
|
|
33231
33266
|
}
|
|
@@ -34562,8 +34597,10 @@ function ac_load_nodes(gobj, event, kw, src) {
|
|
|
34562
34597
|
}
|
|
34563
34598
|
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
34564
34599
|
if (tabulator) {
|
|
34565
|
-
if (tabulator._ready)
|
|
34566
|
-
|
|
34600
|
+
if (tabulator._ready) {
|
|
34601
|
+
yui_tabulator_close_editor(tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
34602
|
+
tabulator.setData(data);
|
|
34603
|
+
} else tabulator._pendingData = data;
|
|
34567
34604
|
}
|
|
34568
34605
|
return 0;
|
|
34569
34606
|
}
|
|
@@ -35350,6 +35387,7 @@ function settle_page(gobj, req_id, value, error) {
|
|
|
35350
35387
|
function ac_repull_page(gobj, event, kw, src) {
|
|
35351
35388
|
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
35352
35389
|
if (!tabulator) return 0;
|
|
35390
|
+
yui_tabulator_close_editor(tabulator, (0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
35353
35391
|
try {
|
|
35354
35392
|
tabulator.replaceData();
|
|
35355
35393
|
} catch (e) {
|
|
@@ -55047,10 +55085,10 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
55047
55085
|
* @author AntVis
|
|
55048
55086
|
* @docs https://g.antv.antgroup.com/
|
|
55049
55087
|
*/
|
|
55050
|
-
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
55088
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
55051
55089
|
(function(global, factory) {
|
|
55052
55090
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.html2canvas = factory());
|
|
55053
|
-
})(
|
|
55091
|
+
})(this$1, (function() {
|
|
55054
55092
|
"use strict";
|
|
55055
55093
|
var extendStatics = function(d, b) {
|
|
55056
55094
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -13,7 +13,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
13
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
14
|
var __getProtoOf = Object.getPrototypeOf;
|
|
15
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
16
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
17
17
|
var __exportAll = (all, no_symbols) => {
|
|
18
18
|
let target = {};
|
|
19
19
|
for (var name in all) __defProp(target, name, {
|
|
@@ -9911,7 +9911,7 @@ function is_time_field(field) {
|
|
|
9911
9911
|
/************************************************************
|
|
9912
9912
|
* Format an epoch value as a local wall-clock string, 24
|
|
9913
9913
|
* hours, in the APP's language `locale` (fmt_date_time() of
|
|
9914
|
-
*
|
|
9914
|
+
* yui_date_text.js, as the time cells of the forms and tables;
|
|
9915
9915
|
* up to gobj-ui 7.26.51 it was toLocaleString(): the
|
|
9916
9916
|
* browser's language, and 12 hours in English).
|
|
9917
9917
|
* Accepts seconds or milliseconds; returns null when the
|
|
@@ -10191,7 +10191,7 @@ function epoch_to_time_value(epoch, real_type) {
|
|
|
10191
10191
|
/************************************************************
|
|
10192
10192
|
* The value of a time column as a table cell shows it: the
|
|
10193
10193
|
* local clock, 24 hours, in the APP's language `locale`
|
|
10194
|
-
* (fmt_date_time() of
|
|
10194
|
+
* (fmt_date_time() of yui_date_text.js: es "14 oct 2026, 15:05:09").
|
|
10195
10195
|
* Up to gobj-ui 7.26.51 the form wrote "2026-10-14 15:05:09" and
|
|
10196
10196
|
* the treedb table "14 oct 2026, 03:05:09 p. m.", in the
|
|
10197
10197
|
* browser's language. "" for no time; a value that is not one is
|
|
@@ -10355,22 +10355,55 @@ function form_time_cell_editor(real_type) {
|
|
|
10355
10355
|
* (form_time_cell_editor.js) or Tabulator's own.
|
|
10356
10356
|
*
|
|
10357
10357
|
* `setColumns()` (a language change of
|
|
10358
|
-
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it)
|
|
10359
|
-
* `setMaxHeight
|
|
10360
|
-
*
|
|
10358
|
+
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it), `setHeight`,
|
|
10359
|
+
* `setMaxHeight`, `setMinHeight`, `addColumn`,
|
|
10360
|
+
* `updateColumnDefinition` and `moveColumn` build the cells
|
|
10361
|
+
* again the same way, and Tabulator throws the same.
|
|
10361
10362
|
*
|
|
10362
10363
|
* So the edit is ended BEFORE each of those calls, while its cell
|
|
10363
10364
|
* is alive, and opened again on the new cell of the same row
|
|
10364
|
-
* and column after it
|
|
10365
|
-
*
|
|
10365
|
+
* and column after it (after the promise, for the calls that
|
|
10366
|
+
* answer one). What was typed in the box is lost; the editor
|
|
10367
|
+
* stays open under the reader. A cell the call left out of the
|
|
10368
|
+
* page (a row the virtual DOM no longer renders) is not opened:
|
|
10369
|
+
* the edit stays closed, and the log says so.
|
|
10370
|
+
*
|
|
10371
|
+
* A call that WIPES the rows (setData, replaceData, clearData,
|
|
10372
|
+
* destroy) closes the edit first with
|
|
10373
|
+
* `yui_tabulator_close_editor()`: there is no cell to open it
|
|
10374
|
+
* on again.
|
|
10366
10375
|
*
|
|
10367
10376
|
* Copyright (c) 2026, ArtGins.
|
|
10368
10377
|
* All Rights Reserved.
|
|
10369
10378
|
****************************************************************************/
|
|
10370
10379
|
/************************************************************
|
|
10380
|
+
* Close the cell editor a table has open, dropping what is
|
|
10381
|
+
* typed in it, before its rows are wiped (setData, replaceData,
|
|
10382
|
+
* clearData, destroy). Tabulator 6.6.0 closes it while it wipes
|
|
10383
|
+
* them, and the redraw that follows walks the rows already
|
|
10384
|
+
* wiped: with an editor open in any row but the first it threw
|
|
10385
|
+
* ("reading 'add'"), and left the table half wiped.
|
|
10386
|
+
*
|
|
10387
|
+
* Tabulator has no public way to ask which cell is edited: this
|
|
10388
|
+
* reads its edit module (`modules.edit`, `currentCell`,
|
|
10389
|
+
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
10390
|
+
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
10391
|
+
* is said: the guard would do nothing, and the crash come back.
|
|
10392
|
+
* `who` names the owner in that warning.
|
|
10393
|
+
************************************************************/
|
|
10394
|
+
function yui_tabulator_close_editor(tabulator, who) {
|
|
10395
|
+
let edit = tabulator.modules ? tabulator.modules.edit : null;
|
|
10396
|
+
if (!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
10397
|
+
log_warning(`${who}: this Tabulator has no modules.edit.currentCell/cancelEdit(): an open cell editor is not closed before its table is wiped`);
|
|
10398
|
+
return;
|
|
10399
|
+
}
|
|
10400
|
+
if (edit.currentCell) edit.cancelEdit();
|
|
10401
|
+
}
|
|
10402
|
+
/************************************************************
|
|
10371
10403
|
* Wrap the calls of `tabulator` that build the cells again --
|
|
10372
|
-
* a forced `redraw`, `setColumns
|
|
10373
|
-
*
|
|
10404
|
+
* a forced `redraw`, `setColumns`, the three height setters
|
|
10405
|
+
* and `addColumn`, `updateColumnDefinition`, `moveColumn` --
|
|
10406
|
+
* so that each ends the open edit first and opens it again
|
|
10374
10407
|
* after.
|
|
10375
10408
|
************************************************************/
|
|
10376
10409
|
function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
@@ -10384,6 +10417,19 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10384
10417
|
tabulator.on("cellEditCancelled", function() {
|
|
10385
10418
|
editing = null;
|
|
10386
10419
|
});
|
|
10420
|
+
function edit_again(row, field, name) {
|
|
10421
|
+
let again = row.getCell(field);
|
|
10422
|
+
if (!again) {
|
|
10423
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: no column '${field}' after ${name}()`);
|
|
10424
|
+
return;
|
|
10425
|
+
}
|
|
10426
|
+
let $again = again.getElement();
|
|
10427
|
+
if (!$again || !$again.isConnected) {
|
|
10428
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: its row is not in the page after ${name}()`);
|
|
10429
|
+
return;
|
|
10430
|
+
}
|
|
10431
|
+
again.edit(true);
|
|
10432
|
+
}
|
|
10387
10433
|
function keep_edit_around(name, rebuilds) {
|
|
10388
10434
|
let original = tabulator[name].bind(tabulator);
|
|
10389
10435
|
tabulator[name] = function(...args) {
|
|
@@ -10394,12 +10440,14 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10394
10440
|
let field = cell.getField();
|
|
10395
10441
|
cell.cancelEdit();
|
|
10396
10442
|
let ret = original(...args);
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10443
|
+
if (ret && typeof ret.then === "function") return ret.then((value) => {
|
|
10444
|
+
edit_again(row, field, name);
|
|
10445
|
+
return value;
|
|
10446
|
+
}, (reason) => {
|
|
10447
|
+
edit_again(row, field, name);
|
|
10448
|
+
throw reason;
|
|
10449
|
+
});
|
|
10450
|
+
edit_again(row, field, name);
|
|
10403
10451
|
return ret;
|
|
10404
10452
|
};
|
|
10405
10453
|
}
|
|
@@ -10408,7 +10456,10 @@ function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
|
10408
10456
|
"setColumns",
|
|
10409
10457
|
"setHeight",
|
|
10410
10458
|
"setMaxHeight",
|
|
10411
|
-
"setMinHeight"
|
|
10459
|
+
"setMinHeight",
|
|
10460
|
+
"addColumn",
|
|
10461
|
+
"updateColumnDefinition",
|
|
10462
|
+
"moveColumn"
|
|
10412
10463
|
]) keep_edit_around(name, () => true);
|
|
10413
10464
|
}
|
|
10414
10465
|
//#endregion
|
|
@@ -11265,28 +11316,6 @@ function destroy_widget(gobj, what, widget) {
|
|
|
11265
11316
|
}
|
|
11266
11317
|
}
|
|
11267
11318
|
/************************************************************
|
|
11268
|
-
* Close the cell editor a table has open, dropping what is
|
|
11269
|
-
* typed in it, before its rows are wiped. Tabulator 6.6.0
|
|
11270
|
-
* closes it while it wipes them, and the redraw that follows
|
|
11271
|
-
* walks the rows already wiped: a reload, a Clear or a destroy
|
|
11272
|
-
* with an editor open in any row but the first threw, and left
|
|
11273
|
-
* the table half wiped.
|
|
11274
|
-
*
|
|
11275
|
-
* Tabulator has no public way to ask which cell is edited: this
|
|
11276
|
-
* reads its edit module (`modules.edit`, `currentCell`,
|
|
11277
|
-
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
11278
|
-
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
11279
|
-
* is said: the guard would do nothing, and the crash come back.
|
|
11280
|
-
************************************************************/
|
|
11281
|
-
function close_table_editor(gobj, tabulator) {
|
|
11282
|
-
let edit = tabulator.modules ? tabulator.modules.edit : null;
|
|
11283
|
-
if (!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
11284
|
-
log_warning(`${gobj_short_name(gobj)}: this Tabulator has no modules.edit.currentCell/cancelEdit(): an open cell editor is not closed before its table is wiped`);
|
|
11285
|
-
return;
|
|
11286
|
-
}
|
|
11287
|
-
if (edit.currentCell) edit.cancelEdit();
|
|
11288
|
-
}
|
|
11289
|
-
/************************************************************
|
|
11290
11319
|
* The element of the table (`.tabulator` kept on it) that holds
|
|
11291
11320
|
* $el, the innermost one.
|
|
11292
11321
|
************************************************************/
|
|
@@ -11315,7 +11344,7 @@ function destroy_row_tables(gobj, $row) {
|
|
|
11315
11344
|
$row.yui_nested = null;
|
|
11316
11345
|
for (let $nested of nested) {
|
|
11317
11346
|
if ($nested.tabulator) {
|
|
11318
|
-
|
|
11347
|
+
yui_tabulator_close_editor($nested.tabulator, gobj_short_name(gobj));
|
|
11319
11348
|
destroy_rows_tables(gobj, $nested.tabulator);
|
|
11320
11349
|
destroy_widget(gobj, "nested table", $nested.tabulator);
|
|
11321
11350
|
$nested.tabulator = null;
|
|
@@ -11348,7 +11377,7 @@ function destroy_widgets(gobj, $container) {
|
|
|
11348
11377
|
$el.jsoneditor = null;
|
|
11349
11378
|
}
|
|
11350
11379
|
if ($el.tabulator) {
|
|
11351
|
-
|
|
11380
|
+
yui_tabulator_close_editor($el.tabulator, gobj_short_name(gobj));
|
|
11352
11381
|
destroy_rows_tables(gobj, $el.tabulator);
|
|
11353
11382
|
destroy_widget(gobj, "table", $el.tabulator);
|
|
11354
11383
|
$el.tabulator = null;
|
|
@@ -12787,7 +12816,7 @@ function table_column_titles(template) {
|
|
|
12787
12816
|
var TIME_CELL_FORMATTERS = /* @__PURE__ */ new WeakSet();
|
|
12788
12817
|
/******************************************************************
|
|
12789
12818
|
* The formatter of a time cell: the local clock, 24 hours, in the
|
|
12790
|
-
* APP's language (fmt_date_time of
|
|
12819
|
+
* APP's language (fmt_date_time of yui_date_text.js, as the cells of
|
|
12791
12820
|
* C_YUI_TREEDB_TOPIC_WITH_FORM): es "14 oct 2026, 15:05:09".
|
|
12792
12821
|
******************************************************************/
|
|
12793
12822
|
function time_cell_formatter(real_type) {
|
|
@@ -13247,7 +13276,7 @@ function clear_data(gobj, $form) {
|
|
|
13247
13276
|
$form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
|
|
13248
13277
|
$table.yui_pending_rows = null;
|
|
13249
13278
|
if ($table.tabulator.initialized) {
|
|
13250
|
-
|
|
13279
|
+
yui_tabulator_close_editor($table.tabulator, gobj_short_name(gobj));
|
|
13251
13280
|
destroy_rows_tables(gobj, $table.tabulator);
|
|
13252
13281
|
$table.tabulator.clearData();
|
|
13253
13282
|
}
|
|
@@ -13331,6 +13360,7 @@ function set_form_values(gobj, template, $form, record) {
|
|
|
13331
13360
|
value: stored,
|
|
13332
13361
|
shown: $input.value
|
|
13333
13362
|
} : null;
|
|
13363
|
+
if ($input.value === "" && stored !== null && stored !== "") log_warning(`${gobj_short_name(gobj)}: '${path}' holds ${JSON.stringify(stored)}, which the time box cannot show: a save writes it as null`);
|
|
13334
13364
|
break;
|
|
13335
13365
|
case "color":
|
|
13336
13366
|
$input.value = convertColor(value);
|
|
@@ -15216,7 +15246,7 @@ function yui_uplot_axes(axes) {
|
|
|
15216
15246
|
* The texts uPlot writes for a moment -- the ticks of a time axis
|
|
15217
15247
|
* and the reading of the legend -- in the APP's language, with a
|
|
15218
15248
|
* clock of 24 hours, as every other time a gobj-ui view shows
|
|
15219
|
-
* (fmt_date_time of
|
|
15249
|
+
* (fmt_date_time of yui_date_text.js).
|
|
15220
15250
|
*
|
|
15221
15251
|
* uPlot writes them from templates of its own, in English and
|
|
15222
15252
|
* 12 hours: "3pm", "3:05pm", "10/14" (month first), "Oct", and
|
|
@@ -33220,7 +33250,12 @@ function create_tabulator(gobj) {
|
|
|
33220
33250
|
function table__destroy(gobj) {
|
|
33221
33251
|
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
33222
33252
|
if (tabulator) {
|
|
33223
|
-
tabulator
|
|
33253
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
33254
|
+
try {
|
|
33255
|
+
tabulator.destroy();
|
|
33256
|
+
} catch (e) {
|
|
33257
|
+
log_warning(`${gobj_short_name(gobj)}: cannot destroy the table: ${e}`);
|
|
33258
|
+
}
|
|
33224
33259
|
gobj_write_attr(gobj, "tabulator", null);
|
|
33225
33260
|
}
|
|
33226
33261
|
}
|
|
@@ -34557,8 +34592,10 @@ function ac_load_nodes(gobj, event, kw, src) {
|
|
|
34557
34592
|
}
|
|
34558
34593
|
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
34559
34594
|
if (tabulator) {
|
|
34560
|
-
if (tabulator._ready)
|
|
34561
|
-
|
|
34595
|
+
if (tabulator._ready) {
|
|
34596
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
34597
|
+
tabulator.setData(data);
|
|
34598
|
+
} else tabulator._pendingData = data;
|
|
34562
34599
|
}
|
|
34563
34600
|
return 0;
|
|
34564
34601
|
}
|
|
@@ -35345,6 +35382,7 @@ function settle_page(gobj, req_id, value, error) {
|
|
|
35345
35382
|
function ac_repull_page(gobj, event, kw, src) {
|
|
35346
35383
|
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
35347
35384
|
if (!tabulator) return 0;
|
|
35385
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
35348
35386
|
try {
|
|
35349
35387
|
tabulator.replaceData();
|
|
35350
35388
|
} catch (e) {
|
|
@@ -55042,10 +55080,10 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
55042
55080
|
* @author AntVis
|
|
55043
55081
|
* @docs https://g.antv.antgroup.com/
|
|
55044
55082
|
*/
|
|
55045
|
-
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
55083
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
55046
55084
|
(function(global, factory) {
|
|
55047
55085
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.html2canvas = factory());
|
|
55048
|
-
})(
|
|
55086
|
+
})(this$1, (function() {
|
|
55049
55087
|
"use strict";
|
|
55050
55088
|
var extendStatics = function(d, b) {
|
|
55051
55089
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"@rollup/plugin-terser": "^1.0.0",
|
|
42
42
|
"@vitest/coverage-v8": "^4.1.10",
|
|
43
43
|
"@yuneta/gobj-js": "^7.26.28",
|
|
44
|
-
"vite": "^8.3.
|
|
44
|
+
"vite": "^8.3.4",
|
|
45
45
|
"vitest": "^4.1.10"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@antv/g6": "^5.1.0",
|
|
49
49
|
"@yuneta/gobj-js": "^7.26.3",
|
|
50
50
|
"bulma": "^1.0.4",
|
|
51
|
-
"i18next": "^26.
|
|
52
|
-
"maplibre-gl": "^6.
|
|
51
|
+
"i18next": "^26.4.5",
|
|
52
|
+
"maplibre-gl": "^6.14.0",
|
|
53
53
|
"tabulator-tables": "^6.5.3",
|
|
54
54
|
"tom-select": "^2.6.2",
|
|
55
55
|
"uplot": "^1.6.32",
|
|
@@ -669,14 +669,15 @@ async function report_locales(request)
|
|
|
669
669
|
const buffer_from = Buffer.from.bind(Buffer);
|
|
670
670
|
const define = Object.defineProperty;
|
|
671
671
|
const has_own = Object.hasOwn;
|
|
672
|
+
const to_string = String;
|
|
672
673
|
const problems = [];
|
|
673
674
|
const add_problem = (text) => {
|
|
674
|
-
define(problems, problems.length, {value:
|
|
675
|
+
define(problems, problems.length, {value: to_string(text), enumerable: true});
|
|
675
676
|
};
|
|
676
677
|
const list_text = (list) => {
|
|
677
678
|
let text = "[";
|
|
678
679
|
for(let i = 0; i < list.length; i++) {
|
|
679
|
-
text += (i? "," : "") + stringify(
|
|
680
|
+
text += (i? "," : "") + stringify(to_string(list[i]));
|
|
680
681
|
}
|
|
681
682
|
return text + "]";
|
|
682
683
|
};
|
|
@@ -712,7 +713,7 @@ async function report_locales(request)
|
|
|
712
713
|
});
|
|
713
714
|
}
|
|
714
715
|
} catch(e) {
|
|
715
|
-
set_locale(code, {error:
|
|
716
|
+
set_locale(code, {error: to_string((e && e.message) || e)});
|
|
716
717
|
}
|
|
717
718
|
}
|
|
718
719
|
set_timeout(() => {
|
package/src/c_yui_form.js
CHANGED
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
time_value_to_text
|
|
101
101
|
} from "./form_time_value.js";
|
|
102
102
|
import {form_time_cell_editor} from "./form_time_cell_editor.js";
|
|
103
|
-
import {yui_tabulator_keep_edit_on_redraw} from "./yui_tabulator_edit.js";
|
|
103
|
+
import {yui_tabulator_keep_edit_on_redraw, yui_tabulator_close_editor} from "./yui_tabulator_edit.js";
|
|
104
104
|
import {safe_locale} from "./yui_date_text.js";
|
|
105
105
|
import {parse_json_field, json_editor_value} from "./form_json_field.js";
|
|
106
106
|
import {
|
|
@@ -652,33 +652,6 @@ function destroy_widget(gobj, what, widget)
|
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
-
/************************************************************
|
|
656
|
-
* Close the cell editor a table has open, dropping what is
|
|
657
|
-
* typed in it, before its rows are wiped. Tabulator 6.6.0
|
|
658
|
-
* closes it while it wipes them, and the redraw that follows
|
|
659
|
-
* walks the rows already wiped: a reload, a Clear or a destroy
|
|
660
|
-
* with an editor open in any row but the first threw, and left
|
|
661
|
-
* the table half wiped.
|
|
662
|
-
*
|
|
663
|
-
* Tabulator has no public way to ask which cell is edited: this
|
|
664
|
-
* reads its edit module (`modules.edit`, `currentCell`,
|
|
665
|
-
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
666
|
-
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
667
|
-
* is said: the guard would do nothing, and the crash come back.
|
|
668
|
-
************************************************************/
|
|
669
|
-
function close_table_editor(gobj, tabulator)
|
|
670
|
-
{
|
|
671
|
-
let edit = tabulator.modules? tabulator.modules.edit : null;
|
|
672
|
-
if(!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
673
|
-
log_warning(`${gobj_short_name(gobj)}: this Tabulator has no modules.edit.currentCell/cancelEdit(): ` +
|
|
674
|
-
`an open cell editor is not closed before its table is wiped`);
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if(edit.currentCell) {
|
|
678
|
-
edit.cancelEdit();
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
655
|
/************************************************************
|
|
683
656
|
* The element of the table (`.tabulator` kept on it) that holds
|
|
684
657
|
* $el, the innermost one.
|
|
@@ -719,7 +692,7 @@ function destroy_row_tables(gobj, $row)
|
|
|
719
692
|
$row.yui_nested = null;
|
|
720
693
|
for(let $nested of nested) {
|
|
721
694
|
if($nested.tabulator) {
|
|
722
|
-
|
|
695
|
+
yui_tabulator_close_editor($nested.tabulator, gobj_short_name(gobj));
|
|
723
696
|
destroy_rows_tables(gobj, $nested.tabulator);
|
|
724
697
|
destroy_widget(gobj, "nested table", $nested.tabulator);
|
|
725
698
|
$nested.tabulator = null;
|
|
@@ -758,7 +731,7 @@ function destroy_widgets(gobj, $container)
|
|
|
758
731
|
$el.jsoneditor = null;
|
|
759
732
|
}
|
|
760
733
|
if($el.tabulator) {
|
|
761
|
-
|
|
734
|
+
yui_tabulator_close_editor($el.tabulator, gobj_short_name(gobj));
|
|
762
735
|
destroy_rows_tables(gobj, $el.tabulator);
|
|
763
736
|
destroy_widget(gobj, "table", $el.tabulator);
|
|
764
737
|
$el.tabulator = null;
|
|
@@ -2532,7 +2505,7 @@ function create_tabulator(gobj, $extend, name, template, rows)
|
|
|
2532
2505
|
});
|
|
2533
2506
|
tabulator.on("cellEditCancelled", function() {
|
|
2534
2507
|
if(gobj_is_destroying(gobj)) {
|
|
2535
|
-
return; // closed by the teardown (
|
|
2508
|
+
return; // closed by the teardown (yui_tabulator_close_editor)
|
|
2536
2509
|
}
|
|
2537
2510
|
gobj_send_event(gobj, "EV_CELL_EDIT_CANCELLED",
|
|
2538
2511
|
{table_id: table_identity(gobj, $extend)}, gobj);
|
|
@@ -2613,7 +2586,7 @@ const TIME_CELL_FORMATTERS = new WeakSet();
|
|
|
2613
2586
|
|
|
2614
2587
|
/******************************************************************
|
|
2615
2588
|
* The formatter of a time cell: the local clock, 24 hours, in the
|
|
2616
|
-
* APP's language (fmt_date_time of
|
|
2589
|
+
* APP's language (fmt_date_time of yui_date_text.js, as the cells of
|
|
2617
2590
|
* C_YUI_TREEDB_TOPIC_WITH_FORM): es "14 oct 2026, 15:05:09".
|
|
2618
2591
|
******************************************************************/
|
|
2619
2592
|
function time_cell_formatter(real_type)
|
|
@@ -3403,7 +3376,7 @@ function clear_data(gobj, $form)
|
|
|
3403
3376
|
$form.querySelectorAll('.yui-tabulator-table').forEach($table => {
|
|
3404
3377
|
$table.yui_pending_rows = null;
|
|
3405
3378
|
if($table.tabulator.initialized) {
|
|
3406
|
-
|
|
3379
|
+
yui_tabulator_close_editor($table.tabulator, gobj_short_name(gobj));
|
|
3407
3380
|
destroy_rows_tables(gobj, $table.tabulator);
|
|
3408
3381
|
$table.tabulator.clearData();
|
|
3409
3382
|
}
|
|
@@ -3531,6 +3504,11 @@ function set_form_values(gobj, template, $form, record)
|
|
|
3531
3504
|
$input.value = date_to_datetime_local(value);
|
|
3532
3505
|
$input.yui_time_kept = ($input.value !== "")?
|
|
3533
3506
|
{value: stored, shown: $input.value} : null;
|
|
3507
|
+
if($input.value === "" && stored !== null && stored !== "") {
|
|
3508
|
+
log_warning(`${gobj_short_name(gobj)}: '${path}' holds ` +
|
|
3509
|
+
`${JSON.stringify(stored)}, which the time box cannot show: ` +
|
|
3510
|
+
`a save writes it as null`);
|
|
3511
|
+
}
|
|
3534
3512
|
break;
|
|
3535
3513
|
case "color":
|
|
3536
3514
|
$input.value = convertColor(value);
|
|
@@ -79,7 +79,7 @@ import {yui_tabulator_lang, yui_tabulator_relocalize,
|
|
|
79
79
|
yui_tabulator_name_filters,
|
|
80
80
|
yui_tabulator_name_row_selects,
|
|
81
81
|
yui_tabulator_name_editor} from "./yui_tabulator_i18n.js";
|
|
82
|
-
import {yui_tabulator_keep_edit_on_redraw} from "./yui_tabulator_edit.js";
|
|
82
|
+
import {yui_tabulator_keep_edit_on_redraw, yui_tabulator_close_editor} from "./yui_tabulator_edit.js";
|
|
83
83
|
|
|
84
84
|
import {
|
|
85
85
|
yui_selection_column,
|
|
@@ -2021,7 +2021,12 @@ function table__destroy(gobj)
|
|
|
2021
2021
|
{
|
|
2022
2022
|
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
2023
2023
|
if(tabulator) {
|
|
2024
|
-
tabulator
|
|
2024
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
2025
|
+
try {
|
|
2026
|
+
tabulator.destroy();
|
|
2027
|
+
} catch(e) {
|
|
2028
|
+
log_warning(`${gobj_short_name(gobj)}: cannot destroy the table: ${e}`);
|
|
2029
|
+
}
|
|
2025
2030
|
gobj_write_attr(gobj, "tabulator", null);
|
|
2026
2031
|
}
|
|
2027
2032
|
}
|
|
@@ -3840,6 +3845,7 @@ function ac_load_nodes(gobj, event, kw, src)
|
|
|
3840
3845
|
* Guard: defer until tableBuilt fires if Tabulator isn't ready yet.
|
|
3841
3846
|
*/
|
|
3842
3847
|
if(tabulator._ready) {
|
|
3848
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
3843
3849
|
tabulator.setData(data);
|
|
3844
3850
|
} else {
|
|
3845
3851
|
tabulator._pendingData = data;
|
|
@@ -4980,6 +4986,7 @@ function ac_repull_page(gobj, event, kw, src)
|
|
|
4980
4986
|
if(!tabulator) {
|
|
4981
4987
|
return 0;
|
|
4982
4988
|
}
|
|
4989
|
+
yui_tabulator_close_editor(tabulator, gobj_short_name(gobj));
|
|
4983
4990
|
try {
|
|
4984
4991
|
tabulator.replaceData();
|
|
4985
4992
|
} catch(e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* fmt_date_time.test.js
|
|
3
3
|
*
|
|
4
|
-
* fmt_date_time() of
|
|
4
|
+
* fmt_date_time() of yui_date_text.js: a moment as a view shows it as
|
|
5
5
|
* text -- day, short month, year, and a clock of 24 hours with its
|
|
6
6
|
* seconds -- in the language it is given (the app's), and the two
|
|
7
7
|
* readers built on it: time_value_to_text() (the time cells of the
|
|
@@ -86,6 +86,11 @@ function errors()
|
|
|
86
86
|
return logged.filter(l => /error/i.test(l.level) || /ERROR/.test(l.msg));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
function warnings()
|
|
90
|
+
{
|
|
91
|
+
return logged.filter(l => /warn/i.test(l.level) || /WARNING/.test(l.msg));
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
function box(form, name)
|
|
90
95
|
{
|
|
91
96
|
const $container = gobj_read_attr(form, "$container");
|
|
@@ -114,6 +119,8 @@ describe("the time field of a form", () => {
|
|
|
114
119
|
expect(saved[0].as_text).toBe(ISO);
|
|
115
120
|
expect(saved[0].no_time).toBe(null);
|
|
116
121
|
expect(errors()).toEqual([]);
|
|
122
|
+
/* A column that holds no time loses nothing: nothing to say. */
|
|
123
|
+
expect(warnings()).toEqual([]);
|
|
117
124
|
});
|
|
118
125
|
|
|
119
126
|
/* The template grammar defaults a spec with no real type to
|
|
@@ -331,6 +338,11 @@ describe("a stored value the box cannot show", () => {
|
|
|
331
338
|
|
|
332
339
|
expect(box(form, "as_epoch").value).toBe("");
|
|
333
340
|
expect(box(form, "as_text").value).toBe("");
|
|
341
|
+
/* ...but the loss is said when it is loaded, not left silent. */
|
|
342
|
+
const said = warnings().map((l) => l.msg);
|
|
343
|
+
expect(said.length).toBe(2);
|
|
344
|
+
expect(said[0]).toMatch(/'as_epoch' holds "rubbish", which the time box cannot show: a save writes it as null/);
|
|
345
|
+
expect(said[1]).toMatch(/'as_text' holds "rubbish"/);
|
|
334
346
|
gobj_send_event(form, "EV_SAVE_RECORD", {}, form);
|
|
335
347
|
expect(saved[0].as_epoch).toBe(null);
|
|
336
348
|
expect(saved[0].as_text).toBe(null);
|
package/src/form_time_value.js
CHANGED
|
@@ -112,7 +112,7 @@ function epoch_to_time_value(epoch, real_type)
|
|
|
112
112
|
/************************************************************
|
|
113
113
|
* The value of a time column as a table cell shows it: the
|
|
114
114
|
* local clock, 24 hours, in the APP's language `locale`
|
|
115
|
-
* (fmt_date_time() of
|
|
115
|
+
* (fmt_date_time() of yui_date_text.js: es "14 oct 2026, 15:05:09").
|
|
116
116
|
* Up to gobj-ui 7.26.51 the form wrote "2026-10-14 15:05:09" and
|
|
117
117
|
* the treedb table "14 oct 2026, 03:05:09 p. m.", in the
|
|
118
118
|
* browser's language. "" for no time; a value that is not one is
|
package/src/json_view_helpers.js
CHANGED
|
@@ -217,7 +217,7 @@ export {TIME_FIELDS};
|
|
|
217
217
|
/************************************************************
|
|
218
218
|
* Format an epoch value as a local wall-clock string, 24
|
|
219
219
|
* hours, in the APP's language `locale` (fmt_date_time() of
|
|
220
|
-
*
|
|
220
|
+
* yui_date_text.js, as the time cells of the forms and tables;
|
|
221
221
|
* up to gobj-ui 7.26.51 it was toLocaleString(): the
|
|
222
222
|
* browser's language, and 12 hours in English).
|
|
223
223
|
* Accepts seconds or milliseconds; returns null when the
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* tabulator_edit_internals.test.js
|
|
3
3
|
*
|
|
4
|
-
* C_YUI_FORM
|
|
5
|
-
*
|
|
4
|
+
* C_YUI_FORM and C_YUI_TREEDB_TOPIC_WITH_FORM close a table's
|
|
5
|
+
* open cell editor before they wipe the rows
|
|
6
|
+
* (yui_tabulator_close_editor): Tabulator 6.6.0 closes it while
|
|
6
7
|
* it wipes them and throws. Tabulator has no public way to ask
|
|
7
|
-
* which cell is being edited, so the
|
|
8
|
+
* which cell is being edited, so the helper reads its edit module:
|
|
8
9
|
* `table.modules.edit`, its `currentCell` and its `cancelEdit()`.
|
|
9
10
|
* This pins those names against the Tabulator INSTALLED: an
|
|
10
11
|
* upgrade that renames them fails here, not in a reader's
|
|
11
|
-
* reload. (The
|
|
12
|
+
* reload. (The helper also says so in the log when they are
|
|
12
13
|
* missing.)
|
|
13
14
|
*
|
|
14
15
|
* Copyright (c) 2026, ArtGins.
|
|
@@ -18,24 +18,62 @@
|
|
|
18
18
|
* (form_time_cell_editor.js) or Tabulator's own.
|
|
19
19
|
*
|
|
20
20
|
* `setColumns()` (a language change of
|
|
21
|
-
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it)
|
|
22
|
-
* `setMaxHeight
|
|
23
|
-
*
|
|
21
|
+
* C_YUI_TREEDB_TOPIC_WITH_FORM runs it), `setHeight`,
|
|
22
|
+
* `setMaxHeight`, `setMinHeight`, `addColumn`,
|
|
23
|
+
* `updateColumnDefinition` and `moveColumn` build the cells
|
|
24
|
+
* again the same way, and Tabulator throws the same.
|
|
24
25
|
*
|
|
25
26
|
* So the edit is ended BEFORE each of those calls, while its cell
|
|
26
27
|
* is alive, and opened again on the new cell of the same row
|
|
27
|
-
* and column after it
|
|
28
|
-
*
|
|
28
|
+
* and column after it (after the promise, for the calls that
|
|
29
|
+
* answer one). What was typed in the box is lost; the editor
|
|
30
|
+
* stays open under the reader. A cell the call left out of the
|
|
31
|
+
* page (a row the virtual DOM no longer renders) is not opened:
|
|
32
|
+
* the edit stays closed, and the log says so.
|
|
33
|
+
*
|
|
34
|
+
* A call that WIPES the rows (setData, replaceData, clearData,
|
|
35
|
+
* destroy) closes the edit first with
|
|
36
|
+
* `yui_tabulator_close_editor()`: there is no cell to open it
|
|
37
|
+
* on again.
|
|
29
38
|
*
|
|
30
39
|
* Copyright (c) 2026, ArtGins.
|
|
31
40
|
* All Rights Reserved.
|
|
32
41
|
****************************************************************************/
|
|
33
42
|
import {log_warning} from "@yuneta/gobj-js";
|
|
34
43
|
|
|
44
|
+
/************************************************************
|
|
45
|
+
* Close the cell editor a table has open, dropping what is
|
|
46
|
+
* typed in it, before its rows are wiped (setData, replaceData,
|
|
47
|
+
* clearData, destroy). Tabulator 6.6.0 closes it while it wipes
|
|
48
|
+
* them, and the redraw that follows walks the rows already
|
|
49
|
+
* wiped: with an editor open in any row but the first it threw
|
|
50
|
+
* ("reading 'add'"), and left the table half wiped.
|
|
51
|
+
*
|
|
52
|
+
* Tabulator has no public way to ask which cell is edited: this
|
|
53
|
+
* reads its edit module (`modules.edit`, `currentCell`,
|
|
54
|
+
* `cancelEdit()`), names pinned against the installed Tabulator
|
|
55
|
+
* by tabulator_edit_internals.test.js. A Tabulator without them
|
|
56
|
+
* is said: the guard would do nothing, and the crash come back.
|
|
57
|
+
* `who` names the owner in that warning.
|
|
58
|
+
************************************************************/
|
|
59
|
+
function yui_tabulator_close_editor(tabulator, who)
|
|
60
|
+
{
|
|
61
|
+
let edit = tabulator.modules? tabulator.modules.edit : null;
|
|
62
|
+
if(!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
|
|
63
|
+
log_warning(`${who}: this Tabulator has no modules.edit.currentCell/cancelEdit(): ` +
|
|
64
|
+
`an open cell editor is not closed before its table is wiped`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if(edit.currentCell) {
|
|
68
|
+
edit.cancelEdit();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
35
72
|
/************************************************************
|
|
36
73
|
* Wrap the calls of `tabulator` that build the cells again --
|
|
37
|
-
* a forced `redraw`, `setColumns
|
|
38
|
-
*
|
|
74
|
+
* a forced `redraw`, `setColumns`, the three height setters
|
|
75
|
+
* and `addColumn`, `updateColumnDefinition`, `moveColumn` --
|
|
76
|
+
* so that each ends the open edit first and opens it again
|
|
39
77
|
* after.
|
|
40
78
|
************************************************************/
|
|
41
79
|
function yui_tabulator_keep_edit_on_redraw(tabulator)
|
|
@@ -51,6 +89,23 @@ function yui_tabulator_keep_edit_on_redraw(tabulator)
|
|
|
51
89
|
editing = null;
|
|
52
90
|
});
|
|
53
91
|
|
|
92
|
+
function edit_again(row, field, name)
|
|
93
|
+
{
|
|
94
|
+
let again = row.getCell(field);
|
|
95
|
+
if(!again) {
|
|
96
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: ` +
|
|
97
|
+
`no column '${field}' after ${name}()`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let $again = again.getElement();
|
|
101
|
+
if(!$again || !$again.isConnected) {
|
|
102
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: the edit of '${field}' stays closed: ` +
|
|
103
|
+
`its row is not in the page after ${name}()`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
again.edit(true);
|
|
107
|
+
}
|
|
108
|
+
|
|
54
109
|
function keep_edit_around(name, rebuilds)
|
|
55
110
|
{
|
|
56
111
|
let original = tabulator[name].bind(tabulator);
|
|
@@ -66,20 +121,28 @@ function yui_tabulator_keep_edit_on_redraw(tabulator)
|
|
|
66
121
|
let field = cell.getField();
|
|
67
122
|
cell.cancelEdit();
|
|
68
123
|
let ret = original(...args);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
124
|
+
if(ret && typeof ret.then === "function") {
|
|
125
|
+
return ret.then(
|
|
126
|
+
(value) => {
|
|
127
|
+
edit_again(row, field, name);
|
|
128
|
+
return value;
|
|
129
|
+
},
|
|
130
|
+
(reason) => {
|
|
131
|
+
edit_again(row, field, name);
|
|
132
|
+
throw reason;
|
|
133
|
+
}
|
|
134
|
+
);
|
|
73
135
|
}
|
|
74
|
-
|
|
136
|
+
edit_again(row, field, name);
|
|
75
137
|
return ret;
|
|
76
138
|
};
|
|
77
139
|
}
|
|
78
140
|
|
|
79
141
|
keep_edit_around("redraw", (args) => !!args[0]);
|
|
80
|
-
for(const name of ["setColumns", "setHeight", "setMaxHeight", "setMinHeight"
|
|
142
|
+
for(const name of ["setColumns", "setHeight", "setMaxHeight", "setMinHeight",
|
|
143
|
+
"addColumn", "updateColumnDefinition", "moveColumn"]) {
|
|
81
144
|
keep_edit_around(name, () => true);
|
|
82
145
|
}
|
|
83
146
|
}
|
|
84
147
|
|
|
85
|
-
export {yui_tabulator_keep_edit_on_redraw};
|
|
148
|
+
export {yui_tabulator_keep_edit_on_redraw, yui_tabulator_close_editor};
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
* yui_tabulator_edit.test.js
|
|
3
3
|
*
|
|
4
4
|
* yui_tabulator_keep_edit_on_redraw(): every Tabulator call that
|
|
5
|
-
* builds the cells again -- a forced redraw, setColumns()
|
|
6
|
-
* three height setters
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* builds the cells again -- a forced redraw, setColumns(), the
|
|
6
|
+
* three height setters, addColumn(), updateColumnDefinition() and
|
|
7
|
+
* moveColumn() -- ends the open edit BEFORE it, while its cell is
|
|
8
|
+
* alive, and opens it again on the new cell after it (after the
|
|
9
|
+
* promise, for a call that answers one), unless that cell is not
|
|
10
|
+
* in the page. Nothing else is touched. The table is a double that records the
|
|
9
11
|
* order of the calls; that the real Tabulator throws without this
|
|
10
12
|
* is proved in a browser by scripts/qa-cell-editor.mjs.
|
|
11
13
|
*
|
|
12
14
|
* Copyright (c) 2026, ArtGins.
|
|
13
15
|
* All Rights Reserved.
|
|
14
16
|
***********************************************************************/
|
|
15
|
-
import {describe, test, expect, beforeEach} from "vitest";
|
|
17
|
+
import {describe, test, expect, beforeEach, vi} from "vitest";
|
|
16
18
|
import {yui_tabulator_keep_edit_on_redraw} from "./yui_tabulator_edit.js";
|
|
17
19
|
|
|
18
20
|
let calls = [];
|
|
21
|
+
let connected = true;
|
|
19
22
|
|
|
20
23
|
function make_cell(row, field, editing)
|
|
21
24
|
{
|
|
@@ -23,7 +26,7 @@ function make_cell(row, field, editing)
|
|
|
23
26
|
field,
|
|
24
27
|
classes: new Set(editing? ["tabulator-editing"] : []),
|
|
25
28
|
getElement() {
|
|
26
|
-
return {classList: {contains: (c) => cell.classes.has(c)}};
|
|
29
|
+
return {classList: {contains: (c) => cell.classes.has(c)}, isConnected: connected};
|
|
27
30
|
},
|
|
28
31
|
getRow() {
|
|
29
32
|
return row;
|
|
@@ -60,18 +63,32 @@ function make_table()
|
|
|
60
63
|
handlers[name](cell);
|
|
61
64
|
},
|
|
62
65
|
};
|
|
63
|
-
for(const name of ["redraw", "setColumns", "setHeight", "setMaxHeight", "setMinHeight"
|
|
66
|
+
for(const name of ["redraw", "setColumns", "setHeight", "setMaxHeight", "setMinHeight",
|
|
67
|
+
"moveColumn"]) {
|
|
64
68
|
table[name] = function(...args) {
|
|
65
69
|
calls.push(`${name}(${args.join(",")})`);
|
|
66
70
|
return `${name} done`;
|
|
67
71
|
};
|
|
68
72
|
}
|
|
73
|
+
for(const name of ["addColumn", "updateColumnDefinition"]) {
|
|
74
|
+
table[name] = function(...args) {
|
|
75
|
+
calls.push(`${name}(${args.join(",")})`);
|
|
76
|
+
return Promise.resolve().then(() => {
|
|
77
|
+
calls.push(`${name} resolved`);
|
|
78
|
+
if(args[0] === "reject") {
|
|
79
|
+
throw new Error("refused");
|
|
80
|
+
}
|
|
81
|
+
return `${name} done`;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
}
|
|
69
85
|
yui_tabulator_keep_edit_on_redraw(table);
|
|
70
86
|
return table;
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
beforeEach(() => {
|
|
74
90
|
calls = [];
|
|
91
|
+
connected = true;
|
|
75
92
|
});
|
|
76
93
|
|
|
77
94
|
describe("an open edit around a call that builds the cells again", () => {
|
|
@@ -81,6 +98,7 @@ describe("an open edit around a call that builds the cells again", () => {
|
|
|
81
98
|
["setHeight", [300]],
|
|
82
99
|
["setMaxHeight", [400]],
|
|
83
100
|
["setMinHeight", [100]],
|
|
101
|
+
["moveColumn", ["a", "b", true]],
|
|
84
102
|
]) {
|
|
85
103
|
test(`${name}: ended before, opened again after, the answer passed on`, () => {
|
|
86
104
|
const table = make_table();
|
|
@@ -130,3 +148,39 @@ describe("what it leaves alone", () => {
|
|
|
130
148
|
expect(calls).toEqual(["cancel gone", "setColumns(other)", "getCell gone"]);
|
|
131
149
|
});
|
|
132
150
|
});
|
|
151
|
+
|
|
152
|
+
describe("a call that answers a promise", () => {
|
|
153
|
+
for(const name of ["addColumn", "updateColumnDefinition"]) {
|
|
154
|
+
test(`${name}: opened again after the promise, its answer passed on`, async () => {
|
|
155
|
+
const table = make_table();
|
|
156
|
+
table.emit("cellEditing", make_cell(table.row, "when", true));
|
|
157
|
+
const ret = table[name]("x");
|
|
158
|
+
expect(calls).toEqual(["cancel when", `${name}(x)`]);
|
|
159
|
+
expect(await ret).toBe(`${name} done`);
|
|
160
|
+
expect(calls).toEqual([
|
|
161
|
+
"cancel when", `${name}(x)`, `${name} resolved`,
|
|
162
|
+
"getCell when", "edit when true",
|
|
163
|
+
]);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
test("a refusal still opens it again, and is passed on", async () => {
|
|
168
|
+
const table = make_table();
|
|
169
|
+
table.emit("cellEditing", make_cell(table.row, "when", true));
|
|
170
|
+
await expect(table.updateColumnDefinition("reject")).rejects.toThrow("refused");
|
|
171
|
+
expect(calls.slice(-2)).toEqual(["getCell when", "edit when true"]);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe("a cell the call left out of the page", () => {
|
|
176
|
+
test("the edit stays closed, and the log says why", () => {
|
|
177
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
178
|
+
const table = make_table();
|
|
179
|
+
table.emit("cellEditing", make_cell(table.row, "when", true));
|
|
180
|
+
connected = false;
|
|
181
|
+
expect(table.setHeight(50)).toBe("setHeight done");
|
|
182
|
+
expect(calls).toEqual(["cancel when", "setHeight(50)", "getCell when"]);
|
|
183
|
+
expect(warn.mock.calls.flat().join(" ")).toMatch(/'when' stays closed: its row is not in the page after setHeight\(\)/);
|
|
184
|
+
warn.mockRestore();
|
|
185
|
+
});
|
|
186
|
+
});
|
package/src/yui_uplot_time.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The texts uPlot writes for a moment -- the ticks of a time axis
|
|
5
5
|
* and the reading of the legend -- in the APP's language, with a
|
|
6
6
|
* clock of 24 hours, as every other time a gobj-ui view shows
|
|
7
|
-
* (fmt_date_time of
|
|
7
|
+
* (fmt_date_time of yui_date_text.js).
|
|
8
8
|
*
|
|
9
9
|
* uPlot writes them from templates of its own, in English and
|
|
10
10
|
* 12 hours: "3pm", "3:05pm", "10/14" (month first), "Oct", and
|