@yuneta/gobj-ui 7.26.45 → 7.26.46

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.
@@ -1,4 +1,4 @@
1
- import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
1
+ import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_remove_local_storage_value, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
2
2
  import i18next, { t } from "i18next";
3
3
  import TomSelect from "tom-select";
4
4
  import { createJSONEditor } from "vanilla-jsoneditor";
@@ -134,7 +134,14 @@ function yui_tint(colour) {
134
134
  * that wrapped to it, did nothing and was prevented -- the
135
135
  * keyboard never got into the dialog.
136
136
  *
137
- * Pure module — no gobj / Yuneta dependencies. The optional
137
+ * A trap whose panel left the document without being released
138
+ * (its owner was torn down with it) is dropped, with its
139
+ * listener, the next time the stack is read, and said. Up to
140
+ * gobj-ui 7.26.45 it stayed the top: every window opened later
141
+ * believed itself under an overlay and took no focus, and a
142
+ * live trap under it no longer heard Tab.
143
+ *
144
+ * No gobj dependency: only gobj-js's logger. The optional
138
145
  * second argument lets callers inject a mock document object
139
146
  * for unit tests.
140
147
  *
@@ -143,6 +150,15 @@ function yui_tint(colour) {
143
150
  ***********************************************************************/
144
151
  var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
145
152
  var __trap_stack__ = [];
153
+ function drop_detached_traps() {
154
+ for (let i = __trap_stack__.length - 1; i >= 0; i--) {
155
+ let trap = __trap_stack__[i];
156
+ if (trap.$panel.isConnected !== false) continue;
157
+ __trap_stack__.splice(i, 1);
158
+ trap.detach();
159
+ log_warning("focus trap: its panel left the document without releasing it; dropped (the overlay's owner was torn down with it open)");
160
+ }
161
+ }
146
162
  function is_drawn(el) {
147
163
  if (typeof el.checkVisibility === "function") return el.checkVisibility();
148
164
  if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
@@ -167,6 +183,7 @@ function activate_focus_trap_on($panel, doc) {
167
183
  let released = false;
168
184
  let trap = function(ev) {
169
185
  if (ev.key !== "Tab" && ev.keyCode !== 9) return;
186
+ drop_detached_traps();
170
187
  if (__trap_stack__[__trap_stack__.length - 1] !== trap) return;
171
188
  let nodes = focusables_of($panel);
172
189
  if (nodes.length === 0) return;
@@ -184,6 +201,9 @@ function activate_focus_trap_on($panel, doc) {
184
201
  }
185
202
  };
186
203
  trap.$panel = $panel;
204
+ trap.detach = function() {
205
+ doc.removeEventListener("keydown", trap, true);
206
+ };
187
207
  doc.addEventListener("keydown", trap, true);
188
208
  __trap_stack__.push(trap);
189
209
  let firstFocusable = focusables_of($panel)[0];
@@ -205,6 +225,7 @@ function activate_focus_trap_on($panel, doc) {
205
225
  * where it cannot be seen, and the next Tab would give it back.
206
226
  ***************************************************************/
207
227
  function focus_trap_panel() {
228
+ drop_detached_traps();
208
229
  let top = __trap_stack__[__trap_stack__.length - 1];
209
230
  return top ? top.$panel : null;
210
231
  }
@@ -1411,6 +1432,7 @@ function mt_start$21(gobj) {
1411
1432
  function mt_stop$20(gobj) {
1412
1433
  let priv = gobj.priv;
1413
1434
  if (!priv) return 0;
1435
+ close_overlays(gobj);
1414
1436
  close_toolbar_dropdown(gobj);
1415
1437
  if (priv.hash_handler) {
1416
1438
  window.removeEventListener("hashchange", priv.hash_handler);
@@ -1465,6 +1487,7 @@ function mt_stop$20(gobj) {
1465
1487
  * Framework Method: Destroy
1466
1488
  ***************************************************************/
1467
1489
  function mt_destroy$22(gobj) {
1490
+ close_overlays(gobj);
1468
1491
  close_toolbar_dropdown(gobj);
1469
1492
  let live_idx = __live_shells__.indexOf(gobj);
1470
1493
  if (live_idx >= 0) __live_shells__.splice(live_idx, 1);
@@ -2565,7 +2588,7 @@ function open_toolbar_dropdown(gobj, item, action, $trigger) {
2565
2588
  $panel.__yui_backdrop_handler__ = backdrop;
2566
2589
  $panel.__yui_dismiss_handler__ = dismiss;
2567
2590
  $panel.__yui_trigger__ = $trigger || null;
2568
- push_escape(gobj, "popup", close_fn);
2591
+ push_escape(gobj, "popup", close_fn, close_fn);
2569
2592
  $panel.__yui_focus_release__ = activate_focus_trap_on($panel);
2570
2593
  if ($trigger) $trigger.setAttribute("aria-expanded", "true");
2571
2594
  priv.active_dropdown = $panel;
@@ -2730,8 +2753,12 @@ function take_back_focus(ev) {
2730
2753
  * only and consumes the event; LIFO ordering naturally matches
2731
2754
  * the z-index layering most apps use (drawer at the bottom,
2732
2755
  * modal on top, popup on top of that).
2756
+ *
2757
+ * `teardown` is the overlay's UNCONDITIONAL close, what the shell
2758
+ * runs when it stops with the overlay still up (close_overlays);
2759
+ * `handler` may be a guarded one (a modal's before_close).
2733
2760
  ************************************************************/
2734
- function push_escape(gobj, layer, handler) {
2761
+ function push_escape(gobj, layer, handler, teardown) {
2735
2762
  let priv = gobj.priv;
2736
2763
  if (!priv || !priv.escape_stack) {
2737
2764
  log_warning(`C_YUI_SHELL: push_escape('${layer}') on a shell that is gone: Escape will not close it`);
@@ -2741,9 +2768,34 @@ function push_escape(gobj, layer, handler) {
2741
2768
  priv.escape_stack.push({
2742
2769
  layer,
2743
2770
  handler,
2771
+ teardown: typeof teardown === "function" ? teardown : null,
2744
2772
  seq: priv.escape_seq
2745
2773
  });
2746
2774
  }
2775
+ /************************************************************
2776
+ * Close every overlay still up, the top first, as if each had
2777
+ * been dismissed: a shell that stops -- a logout, a session cut
2778
+ * -- with a drawer, a modal or a question open. Up to gobj-ui
2779
+ * 7.26.45 only the toolbar dropdown was closed: the others kept
2780
+ * their focus trap, and every window opened afterwards believed
2781
+ * itself under an overlay and took no focus; a question never
2782
+ * answered. Run before the views stop, so what an overlay's
2783
+ * on_close calls is still alive. An overlay pushed with no
2784
+ * teardown is left to its owner.
2785
+ ************************************************************/
2786
+ function close_overlays(gobj) {
2787
+ let priv = gobj.priv;
2788
+ if (!priv || !priv.escape_stack) return;
2789
+ let entries = priv.escape_stack.slice().reverse();
2790
+ for (let entry of entries) {
2791
+ if (!entry.teardown) continue;
2792
+ try {
2793
+ entry.teardown();
2794
+ } catch (e) {
2795
+ log_warning(`C_YUI_SHELL: closing the '${entry.layer}' overlay at stop failed: ${e}`);
2796
+ }
2797
+ }
2798
+ }
2747
2799
  function pop_escape(gobj, handler) {
2748
2800
  let priv = gobj.priv;
2749
2801
  if (!priv || !priv.escape_stack) return;
@@ -2953,7 +3005,7 @@ function open_drawer_one(gobj, $c) {
2953
3005
  if ($c.classList.contains("is-active")) return;
2954
3006
  let close_fn = () => close_drawer_one(gobj, $c);
2955
3007
  $c.__yui_close_handler__ = close_fn;
2956
- push_escape(gobj, "overlay", close_fn);
3008
+ push_escape(gobj, "overlay", close_fn, close_fn);
2957
3009
  $c.classList.add("is-active");
2958
3010
  $c.__yui_focus_release__ = activate_focus_trap_on($c.querySelector(".yui-drawer-panel") || $c);
2959
3011
  }
@@ -3655,8 +3707,8 @@ function yui_shell_close_drawer(shell_gobj, menu_id) {
3655
3707
  function yui_shell_toggle_drawer(shell_gobj, menu_id) {
3656
3708
  toggle_drawer(shell_gobj, menu_id);
3657
3709
  }
3658
- function yui_shell_push_escape(shell_gobj, layer, handler) {
3659
- push_escape(shell_gobj, layer, handler);
3710
+ function yui_shell_push_escape(shell_gobj, layer, handler, teardown) {
3711
+ push_escape(shell_gobj, layer, handler, teardown);
3660
3712
  }
3661
3713
  function yui_shell_pop_escape(shell_gobj, handler) {
3662
3714
  pop_escape(shell_gobj, handler);
@@ -4265,7 +4317,7 @@ function yui_shell_show_modal(shell, content, opts) {
4265
4317
  });
4266
4318
  };
4267
4319
  escape_handler = request_close;
4268
- yui_shell_push_escape(shell, "modal", request_close);
4320
+ yui_shell_push_escape(shell, "modal", request_close, do_close);
4269
4321
  overlay = yui_shell_register_overlay(shell, on_back);
4270
4322
  release_focus = activate_focus_trap_on($modal);
4271
4323
  if (opts == null || opts.dismiss_on_background !== false) $modal.querySelector(".modal-background").addEventListener("click", request_close);
@@ -4420,7 +4472,7 @@ function build_dialog(shell, message, buttons, opts) {
4420
4472
  resolve(value);
4421
4473
  };
4422
4474
  close_fn = () => close(dismiss_value);
4423
- yui_shell_push_escape(shell, "modal", close_fn);
4475
+ yui_shell_push_escape(shell, "modal", close_fn, close_fn);
4424
4476
  overlay = yui_shell_register_overlay(shell, close_fn);
4425
4477
  release_focus = activate_focus_trap_on($modal.querySelector(".modal-card"));
4426
4478
  $modal.querySelector(".modal-background").addEventListener("click", () => close(dismiss_value));
@@ -5034,7 +5086,14 @@ function build_ui$18(gobj) {
5034
5086
  let key = `${gobj_name(gobj)}-rect`;
5035
5087
  let stored = kw_get_local_storage_value(key);
5036
5088
  let rect = whole_rect(stored);
5037
- if (!rect && stored != null) log_warning(`${gobj_short_name(gobj)}: the saved position '${key}' is not a rect of four numbers: ignored`);
5089
+ if (!rect && stored != null) {
5090
+ log_warning(`${gobj_short_name(gobj)}: the saved position '${key}' is not a rect of four numbers: ignored`);
5091
+ kw_remove_local_storage_value(key);
5092
+ } else if (rect && (rect.width <= 0 || rect.height <= 0)) {
5093
+ log_warning(`${gobj_short_name(gobj)}: the saved position '${key}' has no size (${rect.width} x ${rect.height}): ignored`);
5094
+ kw_remove_local_storage_value(key);
5095
+ rect = null;
5096
+ }
5038
5097
  if (rect) {
5039
5098
  rect.x = rect.x < 0 ? 0 : rect.x;
5040
5099
  rect.y = rect.y < 0 ? 0 : rect.y;
@@ -9673,6 +9732,117 @@ function datetime_local_to_epoch(value) {
9673
9732
  return Math.floor(date.getTime() / 1e3);
9674
9733
  }
9675
9734
  //#endregion
9735
+ //#region src/form_time_cell_editor.js
9736
+ /****************************************************************************
9737
+ * form_time_cell_editor.js
9738
+ *
9739
+ * The cell editor of a `time` / `now` column in a table of
9740
+ * C_YUI_FORM: a `datetime-local` box, as the form's own time
9741
+ * field, converting with the same helpers (form_time_value.js)
9742
+ * -- an epoch in SECONDS for an integer column, an ISO text
9743
+ * for a string one -- and to the second (`step` 1).
9744
+ *
9745
+ * Up to gobj-ui 7.26.45 the column used Tabulator's `datetime`
9746
+ * editor with a `format`, which needs luxon, and nothing gives
9747
+ * gobj-ui luxon: the editor said "'date' editor 'format' param
9748
+ * is dependant on luxon.js" in the console, opened empty, and
9749
+ * threw when it was committed. Its format ("dd/MM/yyyy hh:mm",
9750
+ * 12-hour) could not have read an epoch either. Luxon is not
9751
+ * taken in for it: one editor is not worth a dependency every
9752
+ * app would have to dedupe, and the conversion it needs is the
9753
+ * one the form already makes.
9754
+ *
9755
+ * It behaves as Tabulator's own: `elementAttributes` are
9756
+ * written on the box (the column's name, see
9757
+ * yui_tabulator_name_editor), a true blur or Enter commits,
9758
+ * Escape cancels, `verticalNavigation: "editor"` keeps the
9759
+ * arrows, and a value that did not change is a cancel.
9760
+ *
9761
+ * Copyright (c) 2026, ArtGins.
9762
+ * All Rights Reserved.
9763
+ ****************************************************************************/
9764
+ /************************************************************
9765
+ * A cell's value -> the text of the box ("" when empty).
9766
+ ************************************************************/
9767
+ function time_to_datetime_local(value, real_type) {
9768
+ if (value === null || value === void 0 || value === "") return "";
9769
+ if (real_type === "string") return date_to_datetime_local(new Date(String(value)));
9770
+ let seconds = Number(value);
9771
+ if (!Number.isFinite(seconds)) return "";
9772
+ return date_to_datetime_local(/* @__PURE__ */ new Date(seconds * 1e3));
9773
+ }
9774
+ /************************************************************
9775
+ * The text of the box -> the cell's value (null when empty).
9776
+ ************************************************************/
9777
+ function datetime_local_to_time(text, real_type) {
9778
+ let epoch = datetime_local_to_epoch(text);
9779
+ if (epoch === null) return null;
9780
+ if (real_type === "string") return (/* @__PURE__ */ new Date(epoch * 1e3)).toISOString();
9781
+ return epoch;
9782
+ }
9783
+ /************************************************************
9784
+ * The editor of a time column whose values are `real_type`
9785
+ * ("integer": epoch seconds; "string": ISO text).
9786
+ ************************************************************/
9787
+ function form_time_cell_editor(real_type) {
9788
+ return function(cell, onRendered, success, cancel, editorParams) {
9789
+ let params = editorParams || {};
9790
+ let vertical = params.verticalNavigation || "editor";
9791
+ let original = cell.getValue();
9792
+ let original_text = time_to_datetime_local(original, real_type);
9793
+ let input = document.createElement("input");
9794
+ input.type = "datetime-local";
9795
+ input.setAttribute("step", "1");
9796
+ input.style.padding = "4px";
9797
+ input.style.width = "100%";
9798
+ input.style.boxSizing = "border-box";
9799
+ let attrs = params.elementAttributes;
9800
+ if (attrs && typeof attrs === "object") for (let key of Object.keys(attrs)) input.setAttribute(key, attrs[key]);
9801
+ input.value = original_text;
9802
+ onRendered(function() {
9803
+ if (cell.getType() === "cell") {
9804
+ input.focus({ preventScroll: true });
9805
+ input.style.height = "100%";
9806
+ }
9807
+ });
9808
+ let commit = function() {
9809
+ if (input.value === original_text) {
9810
+ cancel();
9811
+ return;
9812
+ }
9813
+ let value = datetime_local_to_time(input.value, real_type);
9814
+ if (value === original || value === null && original_text === "") {
9815
+ cancel();
9816
+ return;
9817
+ }
9818
+ success(value);
9819
+ };
9820
+ input.addEventListener("blur", function(e) {
9821
+ if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit();
9822
+ });
9823
+ input.addEventListener("keydown", function(e) {
9824
+ switch (e.key) {
9825
+ case "Enter":
9826
+ commit();
9827
+ break;
9828
+ case "Escape":
9829
+ cancel();
9830
+ break;
9831
+ case "End":
9832
+ case "Home":
9833
+ e.stopPropagation();
9834
+ break;
9835
+ case "ArrowUp":
9836
+ case "ArrowDown": if (vertical === "editor") {
9837
+ e.stopImmediatePropagation();
9838
+ e.stopPropagation();
9839
+ }
9840
+ }
9841
+ });
9842
+ return input;
9843
+ };
9844
+ }
9845
+ //#endregion
9676
9846
  //#region src/form_json_field.js
9677
9847
  /***********************************************************************
9678
9848
  * form_json_field.js
@@ -10098,7 +10268,7 @@ var attrs_table$17 = [
10098
10268
  SDATA(data_type_t.DTP_BOOLEAN, "editable", 0, false, "Default is editable, set false to readonly"),
10099
10269
  SDATA(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"),
10100
10270
  SDATA(data_type_t.DTP_BOOLEAN, "selectable", 0, true, "A click selects a row, when tabulator_settings selects rows (selectableRows)"),
10101
- SDATA(data_type_t.DTP_BOOLEAN, "with_checkbox", 0, false, "Show a first column with checkbox to select rows"),
10271
+ SDATA(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`)"),
10102
10272
  SDATA(data_type_t.DTP_BOOLEAN, "with_rownum", 0, false, "Print first column with row number"),
10103
10273
  SDATA(data_type_t.DTP_BOOLEAN, "with_delete_row_btn", 0, false, "Print last column with delete row button"),
10104
10274
  SDATA(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"),
@@ -10515,10 +10685,28 @@ function destroy_widget(gobj, what, widget) {
10515
10685
  * walks the rows already wiped: a reload, a Clear or a destroy
10516
10686
  * with an editor open in any row but the first threw, and left
10517
10687
  * the table half wiped.
10688
+ *
10689
+ * Tabulator has no public way to ask which cell is edited: this
10690
+ * reads its edit module (`modules.edit`, `currentCell`,
10691
+ * `cancelEdit()`), names pinned against the installed Tabulator
10692
+ * by tabulator_edit_internals.test.js. A Tabulator without them
10693
+ * is said: the guard would do nothing, and the crash come back.
10518
10694
  ************************************************************/
10519
- function close_table_editor(tabulator) {
10695
+ function close_table_editor(gobj, tabulator) {
10520
10696
  let edit = tabulator.modules ? tabulator.modules.edit : null;
10521
- if (edit && edit.currentCell) edit.cancelEdit();
10697
+ if (!edit || !("currentCell" in edit) || typeof edit.cancelEdit !== "function") {
10698
+ 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`);
10699
+ return;
10700
+ }
10701
+ if (edit.currentCell) edit.cancelEdit();
10702
+ }
10703
+ /************************************************************
10704
+ * The element of the table (`.tabulator` kept on it) that holds
10705
+ * $el, the innermost one.
10706
+ ************************************************************/
10707
+ function table_element_of($el) {
10708
+ for (let $n = $el; $n; $n = $n.parentNode) if ($n.tabulator) return $n;
10709
+ return null;
10522
10710
  }
10523
10711
  /************************************************************
10524
10712
  * A table element that is gone: its identity is no table now,
@@ -10541,7 +10729,7 @@ function destroy_row_tables(gobj, $row) {
10541
10729
  $row.yui_nested = null;
10542
10730
  for (let $nested of nested) {
10543
10731
  if ($nested.tabulator) {
10544
- close_table_editor($nested.tabulator);
10732
+ close_table_editor(gobj, $nested.tabulator);
10545
10733
  destroy_rows_tables(gobj, $nested.tabulator);
10546
10734
  destroy_widget(gobj, "nested table", $nested.tabulator);
10547
10735
  $nested.tabulator = null;
@@ -10574,7 +10762,7 @@ function destroy_widgets(gobj, $container) {
10574
10762
  $el.jsoneditor = null;
10575
10763
  }
10576
10764
  if ($el.tabulator) {
10577
- close_table_editor($el.tabulator);
10765
+ close_table_editor(gobj, $el.tabulator);
10578
10766
  destroy_rows_tables(gobj, $el.tabulator);
10579
10767
  destroy_widget(gobj, "table", $el.tabulator);
10580
10768
  $el.tabulator = null;
@@ -11839,13 +12027,25 @@ function create_coordinates(gobj, attrs) {
11839
12027
  * the form's `selectable` -- first. Up to 7.26.44 the form toggled
11840
12028
  * the row again in `rowClick`, which undid every click. The default
11841
12029
  * `"highlight"` is left as it is, hover and all.
12030
+ *
12031
+ * The checkbox column (`with_checkbox`) asks `selectable` too, and is
12032
+ * not drawn when the form is not selectable: Tabulator's row box ticks
12033
+ * before its toggle is refused (a ticked box over a row not selected),
12034
+ * and its header box selects every row asking nothing. Up to 7.26.45
12035
+ * the boxes were drawn and lied; with the default `selectableRows`
12036
+ * they selected whatever `selectable` said.
12037
+ *
12038
+ * A click in a nested table stays there: it bubbled to the row that
12039
+ * holds the table, whose own click listener (SelectRow's) toggled
12040
+ * that row too.
11842
12041
  ******************************************************************/
11843
12042
  function create_tabulator$1(gobj, $extend, name, template, rows) {
11844
12043
  $extend.template = template;
11845
12044
  let tabulator_settings = json_deep_copy(gobj_read_attr(gobj, "tabulator_settings"));
11846
12045
  if (is_array(rows) && rows.length > 0) tabulator_settings.data = json_deep_copy(rows);
12046
+ let with_checkbox = gobj_read_bool_attr(gobj, "with_checkbox");
11847
12047
  let selectable_rows = tabulator_settings.selectableRows;
11848
- if (selectable_rows === true || typeof selectable_rows === "number") tabulator_settings.selectableRowsCheck = function() {
12048
+ if (selectable_rows === true || typeof selectable_rows === "number" || with_checkbox) tabulator_settings.selectableRowsCheck = function() {
11849
12049
  return gobj_read_bool_attr(gobj, "selectable");
11850
12050
  };
11851
12051
  let columns = [];
@@ -11872,6 +12072,12 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
11872
12072
  "name": sub_element.name
11873
12073
  }];
11874
12074
  let $extend = createElement2(extend);
12075
+ $extend.addEventListener("click", function(ev) {
12076
+ ev.stopPropagation();
12077
+ });
12078
+ $extend.addEventListener("mousedown", function(ev) {
12079
+ if (ev.shiftKey) ev.stopPropagation();
12080
+ });
11875
12081
  let rows = data[sub_element.name];
11876
12082
  $extend.tabulator = create_tabulator$1(gobj, $extend, sub_element.name, sub_element.template, rows);
11877
12083
  $row.appendChild($extend);
@@ -11893,7 +12099,7 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
11893
12099
  cell.getRow().delete();
11894
12100
  }
11895
12101
  });
11896
- if (gobj_read_bool_attr(gobj, "with_checkbox")) tabulator_settings.rowHeader = {
12102
+ if (with_checkbox && gobj_read_bool_attr(gobj, "selectable")) tabulator_settings.rowHeader = {
11897
12103
  formatter: "rowSelection",
11898
12104
  titleFormatter: "rowSelection",
11899
12105
  headerSort: false,
@@ -11907,6 +12113,11 @@ function create_tabulator$1(gobj, $extend, name, template, rows) {
11907
12113
  if (gobj.priv.loading_rows > 0) return;
11908
12114
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
11909
12115
  });
12116
+ $extend.addEventListener("input", function(ev) {
12117
+ let $target = ev.target;
12118
+ if (!$target || typeof $target.closest !== "function" || !$target.closest(".tabulator-cell.tabulator-editing") || table_element_of($target) !== $extend) return;
12119
+ gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
12120
+ });
11910
12121
  $extend.yui_pending_rows = null;
11911
12122
  tabulator.on("tableBuilt", function() {
11912
12123
  let rows = $extend.yui_pending_rows;
@@ -12061,13 +12272,8 @@ function template2columns(gobj, columns, template, sub_elements) {
12061
12272
  break;
12062
12273
  case "now":
12063
12274
  case "time":
12064
- column.editor = "datetime";
12065
- column.editorParams = {
12066
- format: "dd/MM/yyyy hh:mm",
12067
- verticalNavigation: "table",
12068
- elementAttributes: { title: t("slide bar to choose option") }
12069
- };
12070
- field_desc.real_type;
12275
+ column.editor = form_time_cell_editor(field_desc.real_type);
12276
+ column.editorParams = { verticalNavigation: "table" };
12071
12277
  break;
12072
12278
  case "color":
12073
12279
  column.editor = "input";
@@ -12358,7 +12564,7 @@ function clear_data(gobj, $form) {
12358
12564
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
12359
12565
  $table.yui_pending_rows = null;
12360
12566
  if ($table.tabulator.initialized) {
12361
- close_table_editor($table.tabulator);
12567
+ close_table_editor(gobj, $table.tabulator);
12362
12568
  destroy_rows_tables(gobj, $table.tabulator);
12363
12569
  $table.tabulator.clearData();
12364
12570
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.26.45",
3
+ "version": "7.26.46",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",