@yuneta/gobj-ui 7.26.46 → 7.26.47

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.
@@ -139,12 +139,15 @@ function yui_tint(colour) {
139
139
  * that wrapped to it, did nothing and was prevented -- the
140
140
  * keyboard never got into the dialog.
141
141
  *
142
- * A trap whose panel left the document without being released
143
- * (its owner was torn down with it) is dropped, with its
144
- * listener, the next time the stack is read, and said. Up to
145
- * gobj-ui 7.26.45 it stayed the top: every window opened later
146
- * believed itself under an overlay and took no focus, and a
147
- * live trap under it no longer heard Tab.
142
+ * A trap whose panel is out of the document is not the top:
143
+ * the top is the highest trap whose panel is in it. Up to
144
+ * gobj-ui 7.26.45 a trap left behind by an owner torn down with
145
+ * it stayed the top: every window opened later believed itself
146
+ * under an overlay and took no focus, and a live trap under it
147
+ * no longer heard Tab. 7.26.46 dropped such a trap from the
148
+ * stack, which was for good: a panel that only moved (taken out
149
+ * and put back, its trap never released) lost its trap. It is
150
+ * skipped now, and leaves the stack only by its release().
148
151
  *
149
152
  * No gobj dependency: only gobj-js's logger. The optional
150
153
  * second argument lets callers inject a mock document object
@@ -155,14 +158,12 @@ function yui_tint(colour) {
155
158
  ***********************************************************************/
156
159
  var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
157
160
  var __trap_stack__ = [];
158
- function drop_detached_traps() {
161
+ function top_trap() {
159
162
  for (let i = __trap_stack__.length - 1; i >= 0; i--) {
160
163
  let trap = __trap_stack__[i];
161
- if (trap.$panel.isConnected !== false) continue;
162
- __trap_stack__.splice(i, 1);
163
- trap.detach();
164
- (0, _yuneta_gobj_js.log_warning)("focus trap: its panel left the document without releasing it; dropped (the overlay's owner was torn down with it open)");
164
+ if (trap.$panel.isConnected !== false) return trap;
165
165
  }
166
+ return null;
166
167
  }
167
168
  function is_drawn(el) {
168
169
  if (typeof el.checkVisibility === "function") return el.checkVisibility();
@@ -188,8 +189,7 @@ function activate_focus_trap_on($panel, doc) {
188
189
  let released = false;
189
190
  let trap = function(ev) {
190
191
  if (ev.key !== "Tab" && ev.keyCode !== 9) return;
191
- drop_detached_traps();
192
- if (__trap_stack__[__trap_stack__.length - 1] !== trap) return;
192
+ if (top_trap() !== trap) return;
193
193
  let nodes = focusables_of($panel);
194
194
  if (nodes.length === 0) return;
195
195
  let first = nodes[0];
@@ -206,9 +206,6 @@ function activate_focus_trap_on($panel, doc) {
206
206
  }
207
207
  };
208
208
  trap.$panel = $panel;
209
- trap.detach = function() {
210
- doc.removeEventListener("keydown", trap, true);
211
- };
212
209
  doc.addEventListener("keydown", trap, true);
213
210
  __trap_stack__.push(trap);
214
211
  let firstFocusable = focusables_of($panel)[0];
@@ -230,8 +227,7 @@ function activate_focus_trap_on($panel, doc) {
230
227
  * where it cannot be seen, and the next Tab would give it back.
231
228
  ***************************************************************/
232
229
  function focus_trap_panel() {
233
- drop_detached_traps();
234
- let top = __trap_stack__[__trap_stack__.length - 1];
230
+ let top = top_trap();
235
231
  return top ? top.$panel : null;
236
232
  }
237
233
  //#endregion
@@ -1437,7 +1433,7 @@ function mt_start$21(gobj) {
1437
1433
  function mt_stop$20(gobj) {
1438
1434
  let priv = gobj.priv;
1439
1435
  if (!priv) return 0;
1440
- close_overlays(gobj);
1436
+ retire_overlays(gobj);
1441
1437
  close_toolbar_dropdown(gobj);
1442
1438
  if (priv.hash_handler) {
1443
1439
  window.removeEventListener("hashchange", priv.hash_handler);
@@ -1492,7 +1488,7 @@ function mt_stop$20(gobj) {
1492
1488
  * Framework Method: Destroy
1493
1489
  ***************************************************************/
1494
1490
  function mt_destroy$22(gobj) {
1495
- close_overlays(gobj);
1491
+ retire_overlays(gobj);
1496
1492
  close_toolbar_dropdown(gobj);
1497
1493
  let live_idx = __live_shells__.indexOf(gobj);
1498
1494
  if (live_idx >= 0) __live_shells__.splice(live_idx, 1);
@@ -2801,6 +2797,25 @@ function close_overlays(gobj) {
2801
2797
  }
2802
2798
  }
2803
2799
  }
2800
+ /************************************************************
2801
+ * What a shell that stops does with its overlays: their
2802
+ * history markers are left where they are, and then they are
2803
+ * closed (close_overlays). The overlay stack is emptied FIRST,
2804
+ * so no close -- of an overlay closed here, or of a window
2805
+ * closed later -- retires its marker with a history.back().
2806
+ * Such a back() is asynchronous and a stopped shell no longer
2807
+ * hears where it lands: up to gobj-ui 7.26.46 a logout followed
2808
+ * by a new shell in the same turn had it taken by the new
2809
+ * shell's first window (Chromium stepped back off that window's
2810
+ * marker, Firefox dropped the back()), and the next Back left
2811
+ * the page. A marker left in place is inert, as a drained one
2812
+ * is: a later Back lands on it and is absorbed.
2813
+ ************************************************************/
2814
+ function retire_overlays(gobj) {
2815
+ let priv = gobj.priv;
2816
+ if (priv && priv.overlay_stack) priv.overlay_stack.splice(0);
2817
+ close_overlays(gobj);
2818
+ }
2804
2819
  function pop_escape(gobj, handler) {
2805
2820
  let priv = gobj.priv;
2806
2821
  if (!priv || !priv.escape_stack) return;
@@ -5089,9 +5104,8 @@ function build_ui$18(gobj) {
5089
5104
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
5090
5105
  if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) {
5091
5106
  let key = `${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`;
5092
- let stored = (0, _yuneta_gobj_js.kw_get_local_storage_value)(key);
5093
- let rect = whole_rect(stored);
5094
- if (!rect && stored != null) {
5107
+ let rect = whole_rect((0, _yuneta_gobj_js.kw_get_local_storage_value)(key));
5108
+ if (!rect && local_storage_holds(key)) {
5095
5109
  (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the saved position '${key}' is not a rect of four numbers: ignored`);
5096
5110
  (0, _yuneta_gobj_js.kw_remove_local_storage_value)(key);
5097
5111
  } else if (rect && (rect.width <= 0 || rect.height <= 0)) {
@@ -5538,6 +5552,17 @@ function min$1(gobj) {
5538
5552
  return rect;
5539
5553
  }
5540
5554
  /************************************************************
5555
+ * Whether localStorage holds anything under `key`, readable
5556
+ * or not.
5557
+ ************************************************************/
5558
+ function local_storage_holds(key) {
5559
+ try {
5560
+ return window.localStorage.getItem(key) !== null;
5561
+ } catch (e) {
5562
+ return false;
5563
+ }
5564
+ }
5565
+ /************************************************************
5541
5566
  * The rect of a window in whole pixels: x, y, width and height
5542
5567
  * are DTP_INTEGER, and getBoundingClientRect() answers fractions
5543
5568
  * under a zoom or a device pixel ratio (an integer attr refuses
@@ -7866,8 +7891,14 @@ function yui_tabulator_name_filters(table, t) {
7866
7891
  * from `yui_tabulator_relocalize()` so a language change
7867
7892
  * reaches them.
7868
7893
  *
7869
- * It matches Tabulator's OWN literal and only that, so a box a
7870
- * view named itself is left alone.
7894
+ * It matches Tabulator's OWN literal, and the boxes it named itself
7895
+ * (they carry `data-yui-row-select`), so a box a view named itself is
7896
+ * left alone. Up to 7.26.46 it matched only the literal: a box named
7897
+ * once was never found again, and a language change through
7898
+ * yui_tabulator_relocalize() left it in the old language.
7899
+ *
7900
+ * The box in the HEADER selects every row, and is named so
7901
+ * ("select all rows"); up to 7.26.46 it was "select row" too.
7871
7902
  ***************************************************************/
7872
7903
  var TABULATOR_ROW_SELECT_ARIA = "Select Row";
7873
7904
  function yui_tabulator_name_row_selects(table, t) {
@@ -7878,12 +7909,16 @@ function yui_tabulator_name_row_selects(table, t) {
7878
7909
  (0, _yuneta_gobj_js.log_warning)("yui_tabulator_name_row_selects: table has no element: its row-selection boxes keep Tabulator's English name");
7879
7910
  return;
7880
7911
  }
7881
- let boxes = $el.querySelectorAll(`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"]`);
7912
+ let boxes = $el.querySelectorAll(`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"], input[type=checkbox][data-yui-row-select]`);
7882
7913
  for (let $box of boxes) {
7883
- $box.setAttribute("aria-label", t("select row"));
7884
- $box.setAttribute("data-i18n-aria-label", "select row");
7885
- $box.setAttribute("title", t("select row"));
7886
- $box.setAttribute("data-i18n-title", "select row");
7914
+ let all = typeof $box.closest === "function" && !!$box.closest(".tabulator-header");
7915
+ let name = all ? t("select all rows") : t("select row");
7916
+ let key = all ? "select all rows" : "select row";
7917
+ $box.setAttribute("aria-label", name);
7918
+ $box.setAttribute("data-i18n-aria-label", key);
7919
+ $box.setAttribute("title", name);
7920
+ $box.setAttribute("data-i18n-title", key);
7921
+ $box.setAttribute("data-yui-row-select", "");
7887
7922
  }
7888
7923
  } catch (e) {}
7889
7924
  }
@@ -9736,6 +9771,44 @@ function datetime_local_to_epoch(value) {
9736
9771
  if (isNaN(date.getTime())) return null;
9737
9772
  return Math.floor(date.getTime() / 1e3);
9738
9773
  }
9774
+ /************************************************************
9775
+ * The value of a time column -> a Date, or null when it holds
9776
+ * none. A `string` column holds an ISO text, any other an epoch
9777
+ * in SECONDS. The form's time field and the cell editor of a
9778
+ * table read it here, so the two agree: up to gobj-ui 7.26.46 the
9779
+ * field read every column with parseInt -- an ISO text as the
9780
+ * year 2026 in SECONDS, in January 1970 -- and showed an empty
9781
+ * one as January 1970 too, which a save then wrote back as 0.
9782
+ ************************************************************/
9783
+ function time_value_to_date(value, real_type) {
9784
+ if (value === null || value === void 0 || value === "") return null;
9785
+ let date = real_type === "string" ? new Date(String(value)) : /* @__PURE__ */ new Date(Number(value) * 1e3);
9786
+ return isNaN(date.getTime()) ? null : date;
9787
+ }
9788
+ /************************************************************
9789
+ * An epoch in seconds (null: no time) -> the value of a time
9790
+ * column: an ISO text for a `string` column, the epoch for any
9791
+ * other. Up to gobj-ui 7.26.46 the field wrote the epoch into a
9792
+ * `string` column too.
9793
+ ************************************************************/
9794
+ function epoch_to_time_value(epoch, real_type) {
9795
+ if (epoch === null || epoch === void 0) return null;
9796
+ if (typeof epoch !== "number" || !Number.isFinite(epoch)) return epoch;
9797
+ if (real_type === "string") return (/* @__PURE__ */ new Date(epoch * 1e3)).toISOString();
9798
+ return epoch;
9799
+ }
9800
+ /************************************************************
9801
+ * The value of a time column as a table cell shows it: the
9802
+ * local clock the editor opens on, "YYYY-MM-DD HH:mm:ss", as
9803
+ * fmt_epoch() of yui_time.js writes a timestamp in a table. ""
9804
+ * for no time; a value that is not one is shown as it is, so the
9805
+ * reader sees what the column holds.
9806
+ ************************************************************/
9807
+ function time_value_to_text(value, real_type) {
9808
+ let date = time_value_to_date(value, real_type);
9809
+ if (!date) return value === null || value === void 0 ? "" : String(value);
9810
+ return date_to_datetime_local(date).replace("T", " ");
9811
+ }
9739
9812
  //#endregion
9740
9813
  //#region src/form_time_cell_editor.js
9741
9814
  /****************************************************************************
@@ -9763,6 +9836,17 @@ function datetime_local_to_epoch(value) {
9763
9836
  * Escape cancels, `verticalNavigation: "editor"` keeps the
9764
9837
  * arrows, and a value that did not change is a cancel.
9765
9838
  *
9839
+ * A date with a part cleared is NOT a value: the box answers
9840
+ * `value ""` for it, as for an empty box, and only
9841
+ * `validity.badInput` tells them apart. Enter leaves the
9842
+ * editor open with `aria-invalid` until the date is whole
9843
+ * again (or Escape); a blur cancels, and the cell keeps what
9844
+ * it had. Up to gobj-ui 7.26.46 both committed null: one
9845
+ * Backspace and Enter erased the stored time. To clear a time
9846
+ * on purpose, clear EVERY part of the box: an empty box
9847
+ * commits null. (Inside the box Tab moves between its parts,
9848
+ * as the browser does: it does not leave the cell.)
9849
+ *
9766
9850
  * Copyright (c) 2026, ArtGins.
9767
9851
  * All Rights Reserved.
9768
9852
  ****************************************************************************/
@@ -9770,20 +9854,13 @@ function datetime_local_to_epoch(value) {
9770
9854
  * A cell's value -> the text of the box ("" when empty).
9771
9855
  ************************************************************/
9772
9856
  function time_to_datetime_local(value, real_type) {
9773
- if (value === null || value === void 0 || value === "") return "";
9774
- if (real_type === "string") return date_to_datetime_local(new Date(String(value)));
9775
- let seconds = Number(value);
9776
- if (!Number.isFinite(seconds)) return "";
9777
- return date_to_datetime_local(/* @__PURE__ */ new Date(seconds * 1e3));
9857
+ return date_to_datetime_local(time_value_to_date(value, real_type));
9778
9858
  }
9779
9859
  /************************************************************
9780
9860
  * The text of the box -> the cell's value (null when empty).
9781
9861
  ************************************************************/
9782
9862
  function datetime_local_to_time(text, real_type) {
9783
- let epoch = datetime_local_to_epoch(text);
9784
- if (epoch === null) return null;
9785
- if (real_type === "string") return (/* @__PURE__ */ new Date(epoch * 1e3)).toISOString();
9786
- return epoch;
9863
+ return epoch_to_time_value(datetime_local_to_epoch(text), real_type);
9787
9864
  }
9788
9865
  /************************************************************
9789
9866
  * The editor of a time column whose values are `real_type`
@@ -9810,7 +9887,15 @@ function form_time_cell_editor(real_type) {
9810
9887
  input.style.height = "100%";
9811
9888
  }
9812
9889
  });
9813
- let commit = function() {
9890
+ let incomplete = function() {
9891
+ return !!(input.validity && input.validity.badInput);
9892
+ };
9893
+ let commit = function(from_blur) {
9894
+ if (incomplete()) {
9895
+ if (from_blur) cancel();
9896
+ else input.setAttribute("aria-invalid", "true");
9897
+ return;
9898
+ }
9814
9899
  if (input.value === original_text) {
9815
9900
  cancel();
9816
9901
  return;
@@ -9823,12 +9908,15 @@ function form_time_cell_editor(real_type) {
9823
9908
  success(value);
9824
9909
  };
9825
9910
  input.addEventListener("blur", function(e) {
9826
- if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit();
9911
+ if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit(true);
9912
+ });
9913
+ input.addEventListener("input", function() {
9914
+ if (!incomplete()) input.removeAttribute("aria-invalid");
9827
9915
  });
9828
9916
  input.addEventListener("keydown", function(e) {
9829
9917
  switch (e.key) {
9830
9918
  case "Enter":
9831
- commit();
9919
+ commit(false);
9832
9920
  break;
9833
9921
  case "Escape":
9834
9922
  cancel();
@@ -10273,7 +10361,7 @@ var attrs_table$17 = [
10273
10361
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "editable", 0, false, "Default is editable, set false to readonly"),
10274
10362
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "readonly", 0, false, "Show EVERY field read-only, whatever its schema says: a record being LOOKED at, not edited. Independent of `editable`, which drives the TABLE rendering; this one drives the FORM"),
10275
10363
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "selectable", 0, true, "A click selects a row, when tabulator_settings selects rows (selectableRows)"),
10276
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_checkbox", 0, false, "Show a first column with checkbox to select rows (not drawn when the form is not `selectable`)"),
10364
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_checkbox", 0, false, "Show a first column with checkbox to select rows (hidden while the form is not `selectable`)"),
10277
10365
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_rownum", 0, false, "Print first column with row number"),
10278
10366
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_delete_row_btn", 0, false, "Print last column with delete row button"),
10279
10367
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "toolbar", 0, DEFAULT_TOOLBAR.slice(), "Toolbar buttons to show. The order inside each group is the order given here; which side each group takes is form_toolbar_plan.js. [] hides the toolbar"),
@@ -10295,7 +10383,9 @@ var PRIVATE_DATA$17 = {
10295
10383
  tables: null,
10296
10384
  table_seq: 0,
10297
10385
  json_names_posted: false,
10298
- lang_shell: null
10386
+ lang_shell: null,
10387
+ change_seq: 0,
10388
+ cell_edit: null
10299
10389
  };
10300
10390
  var __gclass__$17 = null;
10301
10391
  /***************************
@@ -10314,6 +10404,16 @@ function mt_create$17(gobj) {
10314
10404
  build_ui$15(gobj);
10315
10405
  }
10316
10406
  /************************************************************
10407
+ * Framework Method writing
10408
+ ************************************************************/
10409
+ function mt_writing$2(gobj, path) {
10410
+ if (path === "selectable") {
10411
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
10412
+ if (!$container) return;
10413
+ for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) if ($table.tabulator) show_row_selection(gobj, $table.tabulator);
10414
+ }
10415
+ }
10416
+ /************************************************************
10317
10417
  * Framework Method destroy
10318
10418
  * In this point, all children
10319
10419
  * and subscriptions are already deleted.
@@ -10351,6 +10451,7 @@ function mt_stop$17(gobj) {
10351
10451
  * not switched here: they always say it (create_tabulator).
10352
10452
  ************************************************************/
10353
10453
  function set_changed_stated(gobj, changed) {
10454
+ gobj.priv.change_seq += 1;
10354
10455
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
10355
10456
  $container.querySelector("form");
10356
10457
  const enable = ($btn, on, color) => {
@@ -10915,6 +11016,9 @@ function build_form(gobj) {
10915
11016
  id: form_id,
10916
11017
  class: "yui-form"
10917
11018
  }]);
11019
+ $form.addEventListener("submit", function(ev) {
11020
+ ev.preventDefault();
11021
+ });
10918
11022
  let template = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "template");
10919
11023
  if (!(0, _yuneta_gobj_js.is_object)(template) && !(0, _yuneta_gobj_js.is_array)(template)) {
10920
11024
  $form.appendChild((0, _yuneta_gobj_js.createOneHtml)(template));
@@ -11426,6 +11530,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
11426
11530
  "button",
11427
11531
  {
11428
11532
  class: "button p-1",
11533
+ type: "button",
11429
11534
  title: (0, i18next.t)("add"),
11430
11535
  "data-i18n-title": "add",
11431
11536
  "aria-label": (0, i18next.t)("add"),
@@ -12005,6 +12110,22 @@ function create_coordinates(gobj, attrs) {
12005
12110
  return $extend;
12006
12111
  }
12007
12112
  /******************************************************************
12113
+ * Show the checkbox column of a table while the form is
12114
+ * `selectable`, hide it while it is not. The column is the table's
12115
+ * row header, the first of its structured columns. A table not
12116
+ * built yet does it when it is (tableBuilt).
12117
+ ******************************************************************/
12118
+ function show_row_selection(gobj, tabulator) {
12119
+ if (!(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_checkbox") || !tabulator.initialized) return;
12120
+ let column = tabulator.getColumns(true).find((c) => c.getDefinition().formatter === "rowSelection");
12121
+ if (!column) {
12122
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the table has no checkbox column to show or hide`);
12123
+ return;
12124
+ }
12125
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable")) column.show();
12126
+ else column.hide();
12127
+ }
12128
+ /******************************************************************
12008
12129
  * Create tabulator
12009
12130
  *
12010
12131
  * A row builds its nested tables the first time it is drawn, each
@@ -12034,11 +12155,13 @@ function create_coordinates(gobj, attrs) {
12034
12155
  * `"highlight"` is left as it is, hover and all.
12035
12156
  *
12036
12157
  * The checkbox column (`with_checkbox`) asks `selectable` too, and is
12037
- * not drawn when the form is not selectable: Tabulator's row box ticks
12038
- * before its toggle is refused (a ticked box over a row not selected),
12039
- * and its header box selects every row asking nothing. Up to 7.26.45
12040
- * the boxes were drawn and lied; with the default `selectableRows`
12041
- * they selected whatever `selectable` said.
12158
+ * not shown while the form is not selectable: Tabulator's row box
12159
+ * ticks before its toggle is refused (a ticked box over a row not
12160
+ * selected), and its header box selects every row asking nothing. Up
12161
+ * to 7.26.45 the boxes were drawn and lied; with the default
12162
+ * `selectableRows` they selected whatever `selectable` said. Up to
12163
+ * 7.26.46 `selectable` was read when the table was built; the column
12164
+ * now follows every write of it (mt_writing, show_row_selection).
12042
12165
  *
12043
12166
  * A click in a nested table stays there: it bubbled to the row that
12044
12167
  * holds the table, whose own click listener (SelectRow's) toggled
@@ -12104,14 +12227,15 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
12104
12227
  cell.getRow().delete();
12105
12228
  }
12106
12229
  });
12107
- if (with_checkbox && (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable")) tabulator_settings.rowHeader = {
12230
+ if (with_checkbox) tabulator_settings.rowHeader = {
12108
12231
  formatter: "rowSelection",
12109
12232
  titleFormatter: "rowSelection",
12110
12233
  headerSort: false,
12111
12234
  resizable: false,
12112
12235
  frozen: true,
12113
12236
  headerHozAlign: "center",
12114
- hozAlign: "center"
12237
+ hozAlign: "center",
12238
+ visible: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable")
12115
12239
  };
12116
12240
  let tabulator = new tabulator_tables.TabulatorFull($extend, tabulator_settings);
12117
12241
  tabulator.on("dataChanged", function() {
@@ -12121,10 +12245,19 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
12121
12245
  $extend.addEventListener("input", function(ev) {
12122
12246
  let $target = ev.target;
12123
12247
  if (!$target || typeof $target.closest !== "function" || !$target.closest(".tabulator-cell.tabulator-editing") || table_element_of($target) !== $extend) return;
12124
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
12248
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", { typed_in: table_identity(gobj, $extend) }, gobj);
12249
+ });
12250
+ tabulator.on("cellEditing", function() {
12251
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
12252
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CELL_EDIT_OPENED", { table_id: table_identity(gobj, $extend) }, gobj);
12253
+ });
12254
+ tabulator.on("cellEditCancelled", function() {
12255
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
12256
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CELL_EDIT_CANCELLED", { table_id: table_identity(gobj, $extend) }, gobj);
12125
12257
  });
12126
12258
  $extend.yui_pending_rows = null;
12127
12259
  tabulator.on("tableBuilt", function() {
12260
+ show_row_selection(gobj, tabulator);
12128
12261
  let rows = $extend.yui_pending_rows;
12129
12262
  $extend.yui_pending_rows = null;
12130
12263
  if (rows && !(0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LOAD_TABLE_ROWS", {
@@ -12279,6 +12412,9 @@ function template2columns(gobj, columns, template, sub_elements) {
12279
12412
  case "time":
12280
12413
  column.editor = form_time_cell_editor(field_desc.real_type);
12281
12414
  column.editorParams = { verticalNavigation: "table" };
12415
+ column.formatter = function(cell) {
12416
+ return text_node(time_value_to_text(cell.getValue(), field_desc.real_type));
12417
+ };
12282
12418
  break;
12283
12419
  case "color":
12284
12420
  column.editor = "input";
@@ -12766,7 +12902,7 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
12766
12902
  case "url": break;
12767
12903
  case "now":
12768
12904
  case "time":
12769
- value = /* @__PURE__ */ new Date((parseInt(value) || 0) * 1e3);
12905
+ value = time_value_to_date(value, field_desc.real_type);
12770
12906
  break;
12771
12907
  case "date":
12772
12908
  case "color":
@@ -12860,10 +12996,9 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
12860
12996
  case "time":
12861
12997
  switch (real_type) {
12862
12998
  case "string":
12863
- if (value && (0, _yuneta_gobj_js.is_date)(value)) value = value.toISOString();
12864
- break;
12865
12999
  case "integer":
12866
- if (value && (0, _yuneta_gobj_js.is_date)(value)) value = value.getTime() / 1e3;
13000
+ if ((0, _yuneta_gobj_js.is_date)(value)) value = Math.floor(value.getTime() / 1e3);
13001
+ value = epoch_to_time_value(value, real_type);
12867
13002
  break;
12868
13003
  default: (0, _yuneta_gobj_js.log_error)("incompatible type for time: " + real_type);
12869
13004
  }
@@ -13111,7 +13246,44 @@ function ac_load_table_rows(gobj, event, kw, src) {
13111
13246
  * Internal event
13112
13247
  ************************************************************/
13113
13248
  function ac_record_changed(gobj, event, kw, src) {
13114
- if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "initialized")) set_edited_by_reader(gobj);
13249
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "initialized")) {
13250
+ let priv = gobj.priv;
13251
+ let open = priv.cell_edit;
13252
+ let own = !!(open && kw && kw.typed_in === open.table_id && open.seq === priv.change_seq);
13253
+ set_edited_by_reader(gobj);
13254
+ if (own) open.seq = priv.change_seq;
13255
+ }
13256
+ return 0;
13257
+ }
13258
+ /************************************************************
13259
+ * A cell editor opened, in the table `table_id`: what the form
13260
+ * says now is what a cancel of it gives back.
13261
+ ************************************************************/
13262
+ function ac_cell_edit_opened(gobj, event, kw, src) {
13263
+ let priv = gobj.priv;
13264
+ priv.cell_edit = {
13265
+ table_id: kw.table_id,
13266
+ edited: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "edited"),
13267
+ changes: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "changes"),
13268
+ seq: priv.change_seq
13269
+ };
13270
+ return 0;
13271
+ }
13272
+ /************************************************************
13273
+ * A cell editor cancelled -- Escape, or a box left as it was:
13274
+ * the value comes back, and so do the `edited` and `changes` the
13275
+ * form had when it opened. Up to gobj-ui 7.26.46 what was typed
13276
+ * in it still counted, and closing asked about a change that was
13277
+ * gone. Nothing is given back when anything but that editor's
13278
+ * own typing changed the form meanwhile: that change is real.
13279
+ ************************************************************/
13280
+ function ac_cell_edit_cancelled(gobj, event, kw, src) {
13281
+ let priv = gobj.priv;
13282
+ let open = priv.cell_edit;
13283
+ priv.cell_edit = null;
13284
+ if (!open || open.table_id !== kw.table_id || open.seq !== priv.change_seq) return 0;
13285
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "changes") !== open.changes) set_changed_stated(gobj, open.changes);
13286
+ (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "edited", open.edited);
13115
13287
  return 0;
13116
13288
  }
13117
13289
  /************************************************************
@@ -13255,6 +13427,7 @@ function cmd_get_picked_files(gobj, cmd, kw, src) {
13255
13427
  }
13256
13428
  var gmt$17 = {
13257
13429
  mt_create: mt_create$17,
13430
+ mt_writing: mt_writing$2,
13258
13431
  mt_start: mt_start$17,
13259
13432
  mt_stop: mt_stop$17,
13260
13433
  mt_destroy: mt_destroy$17,
@@ -13304,6 +13477,16 @@ function create_gclass$17(gclass_name) {
13304
13477
  ac_record_changed,
13305
13478
  null
13306
13479
  ],
13480
+ [
13481
+ "EV_CELL_EDIT_OPENED",
13482
+ ac_cell_edit_opened,
13483
+ null
13484
+ ],
13485
+ [
13486
+ "EV_CELL_EDIT_CANCELLED",
13487
+ ac_cell_edit_cancelled,
13488
+ null
13489
+ ],
13307
13490
  [
13308
13491
  "EV_COPY_RECORD",
13309
13492
  ac_copy_record,
@@ -13373,6 +13556,8 @@ function create_gclass$17(gclass_name) {
13373
13556
  ["EV_ADD_TABLE_ROW", 0],
13374
13557
  ["EV_LOAD_TABLE_ROWS", 0],
13375
13558
  ["EV_RECORD_CHANGED", 0],
13559
+ ["EV_CELL_EDIT_OPENED", 0],
13560
+ ["EV_CELL_EDIT_CANCELLED", 0],
13376
13561
  ["EV_COPY_RECORD", 0],
13377
13562
  ["EV_PASTE_RECORD", 0],
13378
13563
  ["EV_SET_FILE_PREVIEW", 0],
@@ -32482,8 +32667,11 @@ function transform__treedb_value_2_table_value(gobj, col, value, row, field) {
32482
32667
  switch (field_desc.real_type) {
32483
32668
  case "string":
32484
32669
  case "integer":
32485
- value = parseInt(value) || 0;
32486
- value = /* @__PURE__ */ new Date(value * 1e3);
32670
+ value = time_value_to_date(value, field_desc.real_type);
32671
+ if (!value) {
32672
+ value = "";
32673
+ break;
32674
+ }
32487
32675
  const rawLocale = navigator.language;
32488
32676
  const userLocale = typeof rawLocale === "string" && rawLocale && rawLocale !== "undefined" ? rawLocale : void 0;
32489
32677
  const formatter = new Intl.DateTimeFormat(userLocale, {