@yuneta/gobj-ui 7.26.53 → 7.26.54
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 +63 -0
- package/dist/gobj-ui.es.js +63 -0
- package/package.json +2 -1
- package/src/c_yui_form.js +2 -0
- package/src/c_yui_treedb_topic_with_form.js +2 -0
- package/src/yui_tabulator_edit.js +69 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -10322,6 +10322,67 @@ function form_time_cell_editor(real_type) {
|
|
|
10322
10322
|
};
|
|
10323
10323
|
}
|
|
10324
10324
|
//#endregion
|
|
10325
|
+
//#region src/yui_tabulator_edit.js
|
|
10326
|
+
/****************************************************************************
|
|
10327
|
+
* yui_tabulator_edit.js
|
|
10328
|
+
*
|
|
10329
|
+
* An open cell editor survives a FORCED redraw of its table.
|
|
10330
|
+
*
|
|
10331
|
+
* `table.redraw(true)` builds every row's cells again, the one
|
|
10332
|
+
* being edited too, and leaves Tabulator's edit pointing at the
|
|
10333
|
+
* cell it threw away (it ends the edit before a data refresh,
|
|
10334
|
+
* not before a redraw). Tabulator issues one itself, from
|
|
10335
|
+
* ResizeTable's IntersectionObserver, the first time a table
|
|
10336
|
+
* built out of sight comes into view -- and a click on a cell
|
|
10337
|
+
* of a table below the fold scrolls it in AND opens the editor
|
|
10338
|
+
* in the same turn. Chromium blurs the box it takes out, the
|
|
10339
|
+
* editor's blur ends the edit on the dead cell, and Tabulator
|
|
10340
|
+
* throws in Validate.editorClear ("reading 'remove'"); Firefox
|
|
10341
|
+
* does not blur, and throws at the next edit. Any editor, ours
|
|
10342
|
+
* (form_time_cell_editor.js) or Tabulator's own.
|
|
10343
|
+
*
|
|
10344
|
+
* So the edit is ended BEFORE the forced redraw, while its cell
|
|
10345
|
+
* is alive, and opened again on the new cell of the same row
|
|
10346
|
+
* and column after it. What was typed in the box is lost; the
|
|
10347
|
+
* editor stays open under the reader.
|
|
10348
|
+
*
|
|
10349
|
+
* Copyright (c) 2026, ArtGins.
|
|
10350
|
+
* All Rights Reserved.
|
|
10351
|
+
****************************************************************************/
|
|
10352
|
+
/************************************************************
|
|
10353
|
+
* Wrap `tabulator.redraw` so that a forced redraw ends the
|
|
10354
|
+
* open edit first and opens it again after.
|
|
10355
|
+
************************************************************/
|
|
10356
|
+
function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
10357
|
+
let editing = null;
|
|
10358
|
+
tabulator.on("cellEditing", function(cell) {
|
|
10359
|
+
editing = cell;
|
|
10360
|
+
});
|
|
10361
|
+
tabulator.on("cellEdited", function() {
|
|
10362
|
+
editing = null;
|
|
10363
|
+
});
|
|
10364
|
+
tabulator.on("cellEditCancelled", function() {
|
|
10365
|
+
editing = null;
|
|
10366
|
+
});
|
|
10367
|
+
let redraw = tabulator.redraw.bind(tabulator);
|
|
10368
|
+
tabulator.redraw = function(force) {
|
|
10369
|
+
let cell = editing;
|
|
10370
|
+
let $cell = cell ? cell.getElement() : null;
|
|
10371
|
+
if (!force || !$cell || !$cell.classList.contains("tabulator-editing")) return redraw(force);
|
|
10372
|
+
let row = cell.getRow();
|
|
10373
|
+
let field = cell.getField();
|
|
10374
|
+
cell.cancelEdit();
|
|
10375
|
+
let ret = redraw(force);
|
|
10376
|
+
let again = row.getCell(field);
|
|
10377
|
+
if (!again) {
|
|
10378
|
+
(0, _yuneta_gobj_js.log_warning)(`yui_tabulator_keep_edit_on_redraw: no cell '${field}' after the redraw`);
|
|
10379
|
+
return ret;
|
|
10380
|
+
}
|
|
10381
|
+
again.edit(true);
|
|
10382
|
+
return ret;
|
|
10383
|
+
};
|
|
10384
|
+
}
|
|
10385
|
+
//#endregion
|
|
10325
10386
|
//#region src/form_json_field.js
|
|
10326
10387
|
/***********************************************************************
|
|
10327
10388
|
* form_json_field.js
|
|
@@ -12631,6 +12692,7 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
|
|
|
12631
12692
|
visible: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable")
|
|
12632
12693
|
};
|
|
12633
12694
|
let tabulator = new tabulator_tables.TabulatorFull($extend, tabulator_settings);
|
|
12695
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
12634
12696
|
tabulator.on("dataChanged", function() {
|
|
12635
12697
|
if (gobj.priv.loading_rows > 0) return;
|
|
12636
12698
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
|
|
@@ -33023,6 +33085,7 @@ function create_tabulator(gobj) {
|
|
|
33023
33085
|
return;
|
|
33024
33086
|
}
|
|
33025
33087
|
let tabulator = new tabulator_tables.TabulatorFull($table_el, Object.assign({}, tabulator_settings, yui_tabulator_lang(i18next.t), { placeholder: (0, i18next.t)("no data available", { defaultValue: "No data available" }) }));
|
|
33088
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
33026
33089
|
if (with_checkbox) $table_el.classList.add("yui-no-row-hover");
|
|
33027
33090
|
function update_rowcount(explicit_count) {
|
|
33028
33091
|
let $rc = tabulator.element && tabulator.element.querySelector(".yui-tabulator-rowcount");
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -10317,6 +10317,67 @@ function form_time_cell_editor(real_type) {
|
|
|
10317
10317
|
};
|
|
10318
10318
|
}
|
|
10319
10319
|
//#endregion
|
|
10320
|
+
//#region src/yui_tabulator_edit.js
|
|
10321
|
+
/****************************************************************************
|
|
10322
|
+
* yui_tabulator_edit.js
|
|
10323
|
+
*
|
|
10324
|
+
* An open cell editor survives a FORCED redraw of its table.
|
|
10325
|
+
*
|
|
10326
|
+
* `table.redraw(true)` builds every row's cells again, the one
|
|
10327
|
+
* being edited too, and leaves Tabulator's edit pointing at the
|
|
10328
|
+
* cell it threw away (it ends the edit before a data refresh,
|
|
10329
|
+
* not before a redraw). Tabulator issues one itself, from
|
|
10330
|
+
* ResizeTable's IntersectionObserver, the first time a table
|
|
10331
|
+
* built out of sight comes into view -- and a click on a cell
|
|
10332
|
+
* of a table below the fold scrolls it in AND opens the editor
|
|
10333
|
+
* in the same turn. Chromium blurs the box it takes out, the
|
|
10334
|
+
* editor's blur ends the edit on the dead cell, and Tabulator
|
|
10335
|
+
* throws in Validate.editorClear ("reading 'remove'"); Firefox
|
|
10336
|
+
* does not blur, and throws at the next edit. Any editor, ours
|
|
10337
|
+
* (form_time_cell_editor.js) or Tabulator's own.
|
|
10338
|
+
*
|
|
10339
|
+
* So the edit is ended BEFORE the forced redraw, while its cell
|
|
10340
|
+
* is alive, and opened again on the new cell of the same row
|
|
10341
|
+
* and column after it. What was typed in the box is lost; the
|
|
10342
|
+
* editor stays open under the reader.
|
|
10343
|
+
*
|
|
10344
|
+
* Copyright (c) 2026, ArtGins.
|
|
10345
|
+
* All Rights Reserved.
|
|
10346
|
+
****************************************************************************/
|
|
10347
|
+
/************************************************************
|
|
10348
|
+
* Wrap `tabulator.redraw` so that a forced redraw ends the
|
|
10349
|
+
* open edit first and opens it again after.
|
|
10350
|
+
************************************************************/
|
|
10351
|
+
function yui_tabulator_keep_edit_on_redraw(tabulator) {
|
|
10352
|
+
let editing = null;
|
|
10353
|
+
tabulator.on("cellEditing", function(cell) {
|
|
10354
|
+
editing = cell;
|
|
10355
|
+
});
|
|
10356
|
+
tabulator.on("cellEdited", function() {
|
|
10357
|
+
editing = null;
|
|
10358
|
+
});
|
|
10359
|
+
tabulator.on("cellEditCancelled", function() {
|
|
10360
|
+
editing = null;
|
|
10361
|
+
});
|
|
10362
|
+
let redraw = tabulator.redraw.bind(tabulator);
|
|
10363
|
+
tabulator.redraw = function(force) {
|
|
10364
|
+
let cell = editing;
|
|
10365
|
+
let $cell = cell ? cell.getElement() : null;
|
|
10366
|
+
if (!force || !$cell || !$cell.classList.contains("tabulator-editing")) return redraw(force);
|
|
10367
|
+
let row = cell.getRow();
|
|
10368
|
+
let field = cell.getField();
|
|
10369
|
+
cell.cancelEdit();
|
|
10370
|
+
let ret = redraw(force);
|
|
10371
|
+
let again = row.getCell(field);
|
|
10372
|
+
if (!again) {
|
|
10373
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: no cell '${field}' after the redraw`);
|
|
10374
|
+
return ret;
|
|
10375
|
+
}
|
|
10376
|
+
again.edit(true);
|
|
10377
|
+
return ret;
|
|
10378
|
+
};
|
|
10379
|
+
}
|
|
10380
|
+
//#endregion
|
|
10320
10381
|
//#region src/form_json_field.js
|
|
10321
10382
|
/***********************************************************************
|
|
10322
10383
|
* form_json_field.js
|
|
@@ -12626,6 +12687,7 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
|
|
|
12626
12687
|
visible: gobj_read_bool_attr(gobj, "selectable")
|
|
12627
12688
|
};
|
|
12628
12689
|
let tabulator = new TabulatorFull($extend, tabulator_settings);
|
|
12690
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
12629
12691
|
tabulator.on("dataChanged", function() {
|
|
12630
12692
|
if (gobj.priv.loading_rows > 0) return;
|
|
12631
12693
|
gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
|
|
@@ -33018,6 +33080,7 @@ function create_tabulator(gobj) {
|
|
|
33018
33080
|
return;
|
|
33019
33081
|
}
|
|
33020
33082
|
let tabulator = new TabulatorFull($table_el, Object.assign({}, tabulator_settings, yui_tabulator_lang(t), { placeholder: t("no data available", { defaultValue: "No data available" }) }));
|
|
33083
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
33021
33084
|
if (with_checkbox) $table_el.classList.add("yui-no-row-hover");
|
|
33022
33085
|
function update_rowcount(explicit_count) {
|
|
33023
33086
|
let $rc = tabulator.element && tabulator.element.querySelector(".yui-tabulator-rowcount");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"prebuild": "npm run check-markup",
|
|
31
31
|
"pretest": "npm run check-markup",
|
|
32
32
|
"qa-history": "node scripts/qa-history.mjs",
|
|
33
|
+
"qa-cell-editor": "node scripts/qa-cell-editor.mjs",
|
|
33
34
|
"deploy-round": "node scripts/deploy-round.mjs",
|
|
34
35
|
"prepublishOnly": "npm run build"
|
|
35
36
|
},
|
package/src/c_yui_form.js
CHANGED
|
@@ -100,6 +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
104
|
import {safe_locale} from "./yui_date_text.js";
|
|
104
105
|
import {parse_json_field, json_editor_value} from "./form_json_field.js";
|
|
105
106
|
import {
|
|
@@ -2485,6 +2486,7 @@ function create_tabulator(gobj, $extend, name, template, rows)
|
|
|
2485
2486
|
$extend,
|
|
2486
2487
|
tabulator_settings
|
|
2487
2488
|
);
|
|
2489
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
2488
2490
|
/* What the READER does to a table -- edits a cell, adds or deletes a
|
|
2489
2491
|
* row -- reaches the form only through `dataChanged`. Wired here, on
|
|
2490
2492
|
* every table, nested ones included (a row's formatter builds them
|
|
@@ -79,6 +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
83
|
|
|
83
84
|
import {
|
|
84
85
|
yui_selection_column,
|
|
@@ -1782,6 +1783,7 @@ function create_tabulator(gobj)
|
|
|
1782
1783
|
* what it said before for an app that does not define the key). */
|
|
1783
1784
|
placeholder: t("no data available", {defaultValue: "No data available"})
|
|
1784
1785
|
}));
|
|
1786
|
+
yui_tabulator_keep_edit_on_redraw(tabulator);
|
|
1785
1787
|
|
|
1786
1788
|
/* "highlight" still paints the whole-row hover wash (and a pointer
|
|
1787
1789
|
* cursor), which reads as a selection. This table selects only via the
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/****************************************************************************
|
|
2
|
+
* yui_tabulator_edit.js
|
|
3
|
+
*
|
|
4
|
+
* An open cell editor survives a FORCED redraw of its table.
|
|
5
|
+
*
|
|
6
|
+
* `table.redraw(true)` builds every row's cells again, the one
|
|
7
|
+
* being edited too, and leaves Tabulator's edit pointing at the
|
|
8
|
+
* cell it threw away (it ends the edit before a data refresh,
|
|
9
|
+
* not before a redraw). Tabulator issues one itself, from
|
|
10
|
+
* ResizeTable's IntersectionObserver, the first time a table
|
|
11
|
+
* built out of sight comes into view -- and a click on a cell
|
|
12
|
+
* of a table below the fold scrolls it in AND opens the editor
|
|
13
|
+
* in the same turn. Chromium blurs the box it takes out, the
|
|
14
|
+
* editor's blur ends the edit on the dead cell, and Tabulator
|
|
15
|
+
* throws in Validate.editorClear ("reading 'remove'"); Firefox
|
|
16
|
+
* does not blur, and throws at the next edit. Any editor, ours
|
|
17
|
+
* (form_time_cell_editor.js) or Tabulator's own.
|
|
18
|
+
*
|
|
19
|
+
* So the edit is ended BEFORE the forced redraw, while its cell
|
|
20
|
+
* is alive, and opened again on the new cell of the same row
|
|
21
|
+
* and column after it. What was typed in the box is lost; the
|
|
22
|
+
* editor stays open under the reader.
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) 2026, ArtGins.
|
|
25
|
+
* All Rights Reserved.
|
|
26
|
+
****************************************************************************/
|
|
27
|
+
import {log_warning} from "@yuneta/gobj-js";
|
|
28
|
+
|
|
29
|
+
/************************************************************
|
|
30
|
+
* Wrap `tabulator.redraw` so that a forced redraw ends the
|
|
31
|
+
* open edit first and opens it again after.
|
|
32
|
+
************************************************************/
|
|
33
|
+
function yui_tabulator_keep_edit_on_redraw(tabulator)
|
|
34
|
+
{
|
|
35
|
+
let editing = null;
|
|
36
|
+
tabulator.on("cellEditing", function(cell) {
|
|
37
|
+
editing = cell;
|
|
38
|
+
});
|
|
39
|
+
tabulator.on("cellEdited", function() {
|
|
40
|
+
editing = null;
|
|
41
|
+
});
|
|
42
|
+
tabulator.on("cellEditCancelled", function() {
|
|
43
|
+
editing = null;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
let redraw = tabulator.redraw.bind(tabulator);
|
|
47
|
+
tabulator.redraw = function(force) {
|
|
48
|
+
let cell = editing;
|
|
49
|
+
/* A success() with the value unchanged fires no cellEdited:
|
|
50
|
+
* the cell's class says whether it is still being edited. */
|
|
51
|
+
let $cell = cell? cell.getElement() : null;
|
|
52
|
+
if(!force || !$cell || !$cell.classList.contains("tabulator-editing")) {
|
|
53
|
+
return redraw(force);
|
|
54
|
+
}
|
|
55
|
+
let row = cell.getRow();
|
|
56
|
+
let field = cell.getField();
|
|
57
|
+
cell.cancelEdit();
|
|
58
|
+
let ret = redraw(force);
|
|
59
|
+
let again = row.getCell(field);
|
|
60
|
+
if(!again) {
|
|
61
|
+
log_warning(`yui_tabulator_keep_edit_on_redraw: no cell '${field}' after the redraw`);
|
|
62
|
+
return ret;
|
|
63
|
+
}
|
|
64
|
+
again.edit(true);
|
|
65
|
+
return ret;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {yui_tabulator_keep_edit_on_redraw};
|