@yuneta/gobj-ui 7.26.43 → 7.26.45

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 CHANGED
@@ -164,6 +164,12 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
164
164
  > window the app opens on its own (the Developer window restored at start up
165
165
  > from the last session) leaves the focus in the page, or a keyboard reader's
166
166
  > first Tab lands in a window they did not open; a modal one takes it always.
167
+ > Nor does a window opened under an overlay that holds the focus -- a modal
168
+ > window, a dialog, the drawer, a toolbar menu, all drawn above every window
169
+ > that is not modal (7.26.45): it took the focus where it could not be seen,
170
+ > and the next Tab gave it back to the overlay. It opens under it, and is there
171
+ > when the overlay goes. A window placed by its host INSIDE that overlay
172
+ > (`$parent` in a modal's body) takes it as before.
167
173
  > When it goes, the focus goes back where it was -- if it was in the window;
168
174
  > - **Escape closes it** (`keyboard`, `true` by default) when the focus is in
169
175
  > it, the way its ✕ does: `EV_CLOSE_WINDOW`, so `EV_WINDOW_TO_CLOSE` still
@@ -172,8 +178,11 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
172
178
  > editor's search box), an input method composing, an inline editor that
173
179
  > closed with the key (Tabulator cancels a cell edit by removing the box --
174
180
  > the window then takes the focus back), a `textarea` or a
175
- > `contenteditable` (what is being written is not lost to one key). Turn it
176
- > off with `keyboard: false`; the key then goes on to the shell;
181
+ > `contenteditable` (what is being written is not lost to one key). Nor
182
+ > while an overlay of the shell opened AFTER the window is up (a toolbar
183
+ > menu, 7.26.45): the key goes on to the shell, which closes that overlay
184
+ > first (`yui_shell_escape_order()`). Turn it off with `keyboard: false`;
185
+ > the key then goes on to the shell;
177
186
  > - a **`modal`** one blocks the rest of the app: it hangs over a backdrop in
178
187
  > the shell's dialog layer (`yui_shell_modal_layer()`; above the drawer, the
179
188
  > dock and every other window, below the toasts, and a question it asks opens
@@ -195,7 +204,9 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
195
204
  > **The shell's Escape follows the same rule (7.26.43).** It closed the
196
205
  > overlay on top of its chain for any Escape: one typed in a table cell being
197
206
  > edited inside a dialog cancelled the edit and closed the dialog with it. The
198
- > rule is one function, `escape_is_taken()` (`src/escape_taken.js`).
207
+ > rule is one function, `escape_is_taken()` (`src/escape_taken.js`). An
208
+ > Escape that closed a cell editor took the focus with it, to `<body>`: the
209
+ > dialog on top takes it back (7.26.45), as a window does.
199
210
  >
200
211
  > **The focus trap counts only what is drawn (7.26.43).** The adaptive dialog's
201
212
  > back arrow is the first control of every dialog and is `display:none` on a
@@ -3685,6 +3696,28 @@ its API. So the form applies `disabled` to those three, and the record is still
3685
3696
  read from a disabled control — it is collected by reading each marked control,
3686
3697
  never by submitting the form.
3687
3698
 
3699
+ ### `C_YUI_FORM` — which rows a click selects
3700
+
3701
+ A form's tables select no rows unless the host asks Tabulator for it in
3702
+ `tabulator_settings` (`selectableRows`: `true`, or how many). The form's
3703
+ `selectable` (`true` by default) then says whether a click selects: it is
3704
+ Tabulator's `selectableRowsCheck`, asked when a row is drawn and at each click,
3705
+ so it governs the row's own click, which toggles the row (a row drawn while it
3706
+ was `false` stays unselectable until it is drawn again). With the defaults
3707
+ nothing is selected.
3708
+
3709
+ ```js
3710
+ gobj_create("form", "C_YUI_FORM", {
3711
+ template: template,
3712
+ tabulator_settings: {selectableRows: 1}, // a click picks one row
3713
+ selectable: true, // false: a click selects nothing
3714
+ }, parent);
3715
+ ```
3716
+
3717
+ Up to 7.26.44 the form toggled the row again in its `rowClick`, on top of
3718
+ Tabulator's own toggle: with `selectableRows: true` a click selected nothing,
3719
+ and with `selectable: false` it selected the row (7.26.45).
3720
+
3688
3721
  ### Selecting rows in any table — `yui_table_select.js`
3689
3722
 
3690
3723
  Deleting twenty rows one confirmation at a time is not a workflow. Any view
@@ -3968,7 +4001,14 @@ range raised by hand), and leaves it when it did (the round run twice, a
3968
4001
  package.json two apps share): the package.json's git history says which, and
3969
4002
  one whose history cannot be read is refused (since `7.26.43`; up to `7.26.42`
3970
4003
  a refused app kept the files raised before the refusal, `--no-wait` could
3971
- lower a range, and "already" deployed a new bundle under the old number).
4004
+ lower a range, and "already" deployed a new bundle under the old number). The
4005
+ commit that brought the range is the newest one whose parent has ANOTHER
4006
+ range, and a shallow clone is refused, since it may not hold that parent; its
4007
+ log line says `range already ^x.y.z, version raised` (since `7.26.45`; up to
4008
+ `7.26.44` a commit that only reformatted the line was taken for the one, so a
4009
+ round run again raised the version twice, a shallow clone whose HEAD raised
4010
+ the range by hand was taken for "born with the range" and deployed under the
4011
+ old number, and the line said `range raised`).
3972
4012
 
3973
4013
  ### Colour: a brand token as INK takes `-on-scheme`, as a FILL it does not
3974
4014
 
@@ -4329,7 +4369,10 @@ call of t()?" (since `7.26.32`; up to `7.26.31` it was a call NAMED `t` or
4329
4369
  `.bind()` (`i18next.t.bind(i18next)`), a destructuring (since `7.26.35`:
4330
4370
  `const {t: tt} = i18next`, a parameter `{t: tt}`), a re-export of a module the
4331
4371
  reader reads --, called as `t(k)`, `t?.(k)`, `t.call(x, k)` or
4332
- `t.apply(x, [k])`. An ARRAY given to it is i18next's list of fallback keys, and
4372
+ `t.apply(x, [k])`, and `.call`, `.apply` and `.bind` written as computed
4373
+ members too (`t["call"](x, k)`, `t["bind"](null, k)`, since `7.26.45`; up to
4374
+ `7.26.44` those forms were not read, and a key handed that way went unasked).
4375
+ An ARRAY given to it is i18next's list of fallback keys, and
4333
4376
  each one is a key: `t([specific, "generic"])` asks for "generic". A `.bind()`
4334
4377
  that binds a KEY makes a translator whose calls hand i18next its options or its
4335
4378
  default value: `const tk = t.bind(null, "save"); tk({count: 2})` (since
@@ -4535,7 +4578,12 @@ One that may give neither (`{id: "x", name: row.name}`, a parameter) reaches
4535
4578
  it. The test of the table proves every `fallbacks` against the code: each
4536
4579
  hand-off of the position is the right side of a `||` whose left reads the
4537
4580
  positions named (or a key position of a key function whose `fallbacks` say as
4538
- much). Up to `7.26.42` the id of a card was a key in every case. What is
4581
+ much). And the other way round (since `7.26.45`): a position the code reads
4582
+ first at EVERY hand-off is named, or the validator asks for the fallback where
4583
+ the function never reads it -- the toolbar brand's id reaches a key only
4584
+ behind its `aria_label` and its `name` (in `handle_toolbar_action()`), and up
4585
+ to `7.26.44` its entry named the `aria_label` alone. Up to `7.26.42` the id of
4586
+ a card was a key in every case. What is
4539
4587
  given at those positions is read like any other key (literals, consts,
4540
4588
  branches): in the app's own code, on a call that reaches that function of
4541
4589
  gobj-ui (an app function of the same name is not mistaken for it), and in
@@ -4546,7 +4594,8 @@ member): an import under any name, a re-export from a file of the app
4546
4594
  (`export {yui_shell_show_info as say} from "@yuneta/gobj-ui/src/shell_modals.js"`),
4547
4595
  a const alias (`const show = yui_shell_show_info`), a map in a const
4548
4596
  (`const API = {info: yui_shell_show_info}; API.info(...)`, imported too),
4549
- `.call(x, ...)` and `.apply(x, [...])`; and a `.bind()` of it is read as the
4597
+ `.call(x, ...)` and `.apply(x, [...])` (also as computed members,
4598
+ `f["call"](x, ...)`, since `7.26.45`); and a `.bind()` of it is read as the
4550
4599
  call it prepares, at the positions it binds (since `7.26.43`):
4551
4600
  `yui_shell_show_info.bind(null, shell, "k")` asks for "k", and a parameter
4552
4601
  bound there fails the rule per call as it does when it is handed directly. Up
@@ -5084,15 +5133,33 @@ reading the page in another language:
5084
5133
  translator handed as a callback to one of the methods above over an array
5085
5134
  the reader cannot follow, or to `.then()` / `.catch()`, unmarked;
5086
5135
  - a value the reader GIVES UP on, with the file and the line (since
5087
- `7.26.43`): a chain of consts, aliases or calls more than 24 steps deep, a
5088
- const that leads back to itself, an expression that can take more than
5089
- 10000 values. A key behind it would go unasked. Up to `7.26.42` the reader
5090
- stopped there in silence -- a chain of 24 aliases of a const, or of 12
5091
- consts that branch, asked for nothing at its far end, and the build passed
5092
- -- and a chain of consts that doubles at every link (`const O1 = c()? O0 :
5093
- {...O0, ...O0}`) grew three times at every link until it died with a
5094
- `RangeError` that named no file. A const is now read once, wherever it is
5095
- read, and a spread of the same object or array twice gives its values once.
5136
+ `7.26.43`): a value read through more than 24 steps, a const that leads
5137
+ back to itself, an expression that can take more than 10000 values. A key
5138
+ behind it would go unasked. A STEP is each const, alias, call, property,
5139
+ element, and branch of `?:` / `||` / `??` the read goes through, so twelve
5140
+ consts that each branch (`const K1 = c()? K0 : "k1"`) are already 24; the
5141
+ real apps read nothing deeper than 10. Up to `7.26.42` the reader stopped
5142
+ there in silence -- a chain of 24 aliases of a const, or of 12 consts that
5143
+ branch, asked for nothing at its far end, and the build passed -- and a
5144
+ chain of consts that doubles at every link (`const O1 = c()? O0 : {...O0,
5145
+ ...O0}`) grew three times at every link until it died with a `RangeError`
5146
+ that named no file. A const is read once, wherever it is read, and a spread
5147
+ of the same object or array twice gives its values once.
5148
+
5149
+ Since `7.26.45` the line said is the one of the READ, with the place the
5150
+ count went past 24 (`src/main.js:30: the reader gave up on \`J16\` (past
5151
+ \`K10\`, src/main.js:12), ...`), and the verdict does not depend on the
5152
+ order of the code: a const, a property, an element and the returns of a
5153
+ function are read once and keep the steps they took, so a later read of them
5154
+ counts those steps too. Up to `7.26.44` a const kept what its FIRST read had
5155
+ reached -- with `J0 = K10` and `J16` 28 consts away from the key, `t(J16);
5156
+ t(K10)` failed and `t(K10); t(J16)` passed --, a call started the count
5157
+ again (thirty nested calls were read through), and the line said was the
5158
+ deepest link's. A chain of aliases of a FUNCTION, or of a published list
5159
+ written into, is followed to its end, and only one that can end in a
5160
+ translator, a key function (a function of gobj-ui) or a published list is a
5161
+ give-up: up to `7.26.44` thirty aliases of any function (`const f1 = f0;
5162
+ ... f30(1)`) failed the build with no i18n involved.
5096
5163
 
5097
5164
  Up to `7.26.27` the locale cases were "skipped" with an OK: one language less
5098
5165
  validated, and nobody told. A file of the locales directory with a locale's
@@ -188,6 +188,7 @@ function activate_focus_trap_on($panel, doc) {
188
188
  ev.preventDefault();
189
189
  }
190
190
  };
191
+ trap.$panel = $panel;
191
192
  doc.addEventListener("keydown", trap, true);
192
193
  __trap_stack__.push(trap);
193
194
  let firstFocusable = focusables_of($panel)[0];
@@ -201,6 +202,17 @@ function activate_focus_trap_on($panel, doc) {
201
202
  if (saved && typeof saved.focus === "function" && (!doc.body || !doc.body.contains || doc.body.contains(saved))) saved.focus();
202
203
  };
203
204
  }
205
+ /***************************************************************
206
+ * The panel of the trap that holds the focus now (the top of the
207
+ * stack), or null when none is up. What holds one -- a modal, a
208
+ * dialog, a drawer, a menu -- is drawn above every window that is
209
+ * not modal: such a window that took the focus would take it
210
+ * where it cannot be seen, and the next Tab would give it back.
211
+ ***************************************************************/
212
+ function focus_trap_panel() {
213
+ let top = __trap_stack__[__trap_stack__.length - 1];
214
+ return top ? top.$panel : null;
215
+ }
204
216
  //#endregion
205
217
  //#region src/shell_show_on.js
206
218
  /***********************************************************************
@@ -1238,6 +1250,7 @@ var PRIVATE_DATA$22 = {
1238
1250
  hash_handler: null,
1239
1251
  keydown_handler: null,
1240
1252
  escape_stack: [],
1253
+ escape_seq: 0,
1241
1254
  overlay_stack: [],
1242
1255
  expected_pops: 0,
1243
1256
  expected_pop_hash: "",
@@ -1379,7 +1392,10 @@ function mt_start$21(gobj) {
1379
1392
  priv.keydown_handler = (ev) => {
1380
1393
  if (ev.key !== "Escape" && ev.keyCode !== 27) return;
1381
1394
  if (priv.escape_stack.length === 0) return;
1382
- if (escape_is_taken(ev)) return;
1395
+ if (escape_is_taken(ev)) {
1396
+ take_back_focus(ev);
1397
+ return;
1398
+ }
1383
1399
  let top = priv.escape_stack[priv.escape_stack.length - 1];
1384
1400
  ev.preventDefault();
1385
1401
  ev.stopPropagation();
@@ -2699,6 +2715,21 @@ function drawers(gobj, menu_id) {
2699
2715
  return out;
2700
2716
  }
2701
2717
  /************************************************************
2718
+ * An Escape that closed an inline editor (a table cell) took the
2719
+ * focus with it, to <body>: the overlay that holds the focus (the
2720
+ * top trap: a dialog, a drawer) takes it back, as a window does --
2721
+ * a reader was left on the page, outside the dialog it was in.
2722
+ ************************************************************/
2723
+ function take_back_focus(ev) {
2724
+ if (!ev.target || ev.target.isConnected !== false) return;
2725
+ let active = document.activeElement;
2726
+ if (active && active !== document.body) return;
2727
+ let $panel = focus_trap_panel();
2728
+ if (!$panel || $panel.isConnected === false) return;
2729
+ if (!$panel.hasAttribute("tabindex")) $panel.setAttribute("tabindex", "-1");
2730
+ $panel.focus();
2731
+ }
2732
+ /************************************************************
2702
2733
  * Escape priority chain helpers — push/pop a {layer, handler}
2703
2734
  * record on `priv.escape_stack`. Escape calls the top entry
2704
2735
  * only and consumes the event; LIFO ordering naturally matches
@@ -2711,9 +2742,11 @@ function push_escape(gobj, layer, handler) {
2711
2742
  (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: push_escape('${layer}') on a shell that is gone: Escape will not close it`);
2712
2743
  return;
2713
2744
  }
2745
+ priv.escape_seq += 1;
2714
2746
  priv.escape_stack.push({
2715
2747
  layer,
2716
- handler
2748
+ handler,
2749
+ seq: priv.escape_seq
2717
2750
  });
2718
2751
  }
2719
2752
  function pop_escape(gobj, handler) {
@@ -3633,6 +3666,11 @@ function yui_shell_push_escape(shell_gobj, layer, handler) {
3633
3666
  function yui_shell_pop_escape(shell_gobj, handler) {
3634
3667
  pop_escape(shell_gobj, handler);
3635
3668
  }
3669
+ function yui_shell_escape_order(shell_gobj) {
3670
+ let priv = shell_gobj && shell_gobj.priv;
3671
+ if (!priv || !priv.escape_stack || priv.escape_stack.length === 0) return 0;
3672
+ return priv.escape_stack[priv.escape_stack.length - 1].seq;
3673
+ }
3636
3674
  function yui_shell_register_overlay(shell_gobj, close_fn, opts) {
3637
3675
  return push_overlay_history(shell_gobj, close_fn, opts);
3638
3676
  }
@@ -4586,7 +4624,8 @@ var PRIVATE_DATA$21 = {
4586
4624
  back_shell: null,
4587
4625
  opener: null,
4588
4626
  $lock: null,
4589
- release_focus: null
4627
+ release_focus: null,
4628
+ escape_order: 0
4590
4629
  };
4591
4630
  var __gclass__$21 = null;
4592
4631
  /******************************
@@ -4651,6 +4690,12 @@ function mt_create$21(gobj) {
4651
4690
  * the first Tab of a keyboard reader landed in a window they had
4652
4691
  * not opened. A modal window takes it all the same: nothing else
4653
4692
  * can be used while it is up.
4693
+ *
4694
+ * Nor does one opened under an overlay that holds the focus (a
4695
+ * modal window, a dialog, a drawer, a menu: all are drawn above
4696
+ * the window layer). Up to gobj-ui 7.26.44 it took the focus where
4697
+ * it could not be seen, and the next Tab gave it back to the
4698
+ * overlay; it opens under it now, and is there when it goes.
4654
4699
  ***************************************************************/
4655
4700
  function mt_start$20(gobj) {
4656
4701
  let priv = gobj.priv;
@@ -4661,9 +4706,12 @@ function mt_start$20(gobj) {
4661
4706
  }
4662
4707
  let active = document.activeElement;
4663
4708
  if (active && active !== document.body && !$container.contains(active)) priv.opener = active;
4709
+ priv.escape_order = yui_shell_escape_order(yui_shell_of(gobj));
4664
4710
  let modal = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal");
4711
+ let $trap = focus_trap_panel();
4712
+ let under_an_overlay = !!$trap && !$trap.contains($container);
4665
4713
  if (modal && !priv.release_focus) priv.release_focus = activate_focus_trap_on($container);
4666
- if (modal || opened_by_the_reader()) focus_target(gobj, $container).focus();
4714
+ if (modal || opened_by_the_reader() && !under_an_overlay) focus_target(gobj, $container).focus();
4667
4715
  }
4668
4716
  /***************************************************************
4669
4717
  * Framework Method: Destroy
@@ -4917,8 +4965,9 @@ function window_root(gobj) {
4917
4965
  /************************************************************
4918
4966
  * An Escape typed in the window. The callback only decides
4919
4967
  * whether the key is the window's -- not when `keyboard` is
4920
- * off, nor one that what it was typed in took -- and sends
4921
- * the event: the close is the ✕'s, in the action.
4968
+ * off, nor one that what it was typed in took, nor while an
4969
+ * overlay of the shell opened after the window is up -- and
4970
+ * sends the event: the close is the ✕'s, in the action.
4922
4971
  ************************************************************/
4923
4972
  function on_escape_key(gobj, evt) {
4924
4973
  if (evt.key !== "Escape" && evt.keyCode !== 27) return;
@@ -4929,6 +4978,7 @@ function on_escape_key(gobj, evt) {
4929
4978
  if (evt.target && evt.target.isConnected === false && $container && (!active || active === document.body)) $container.focus();
4930
4979
  return;
4931
4980
  }
4981
+ if (yui_shell_escape_order(yui_shell_of(gobj)) > gobj.priv.escape_order) return;
4932
4982
  evt.preventDefault();
4933
4983
  evt.stopPropagation();
4934
4984
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", { key: "Escape" }, gobj);
@@ -4986,7 +5036,10 @@ function build_ui$18(gobj) {
4986
5036
  if ((0, _yuneta_gobj_js.is_gobj)(footer)) footer = (0, _yuneta_gobj_js.gobj_read_attr)(footer, "$container");
4987
5037
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
4988
5038
  if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) {
4989
- let rect = whole_rect((0, _yuneta_gobj_js.kw_get_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`));
5039
+ let key = `${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`;
5040
+ let stored = (0, _yuneta_gobj_js.kw_get_local_storage_value)(key);
5041
+ let rect = whole_rect(stored);
5042
+ if (!rect && stored != null) (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`);
4990
5043
  if (rect) {
4991
5044
  rect.x = rect.x < 0 ? 0 : rect.x;
4992
5045
  rect.y = rect.y < 0 ? 0 : rect.y;
@@ -5688,6 +5741,7 @@ function ac_shell_changed$1(gobj, event, kw, src) {
5688
5741
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", null);
5689
5742
  priv.back_shell = null;
5690
5743
  }
5744
+ priv.escape_order = going ? 0 : yui_shell_escape_order(src);
5691
5745
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
5692
5746
  if (!$container) {
5693
5747
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_SHELL_CHANGED without a container`);
@@ -10048,7 +10102,7 @@ var attrs_table$17 = [
10048
10102
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "topic_name", 0, "", "Treedb topic name: labels use the i18n cascade '<topic>.<col>' -> '<col>' -> header (like table headers)"),
10049
10103
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "editable", 0, false, "Default is editable, set false to readonly"),
10050
10104
  (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"),
10051
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "selectable", 0, true, "Rows selectable with 'click' (BAD with editable=true)"),
10105
+ (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)"),
10052
10106
  (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"),
10053
10107
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_rownum", 0, false, "Print first column with row number"),
10054
10108
  (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"),
@@ -10460,6 +10514,18 @@ function destroy_widget(gobj, what, widget) {
10460
10514
  }
10461
10515
  }
10462
10516
  /************************************************************
10517
+ * Close the cell editor a table has open, dropping what is
10518
+ * typed in it, before its rows are wiped. Tabulator 6.6.0
10519
+ * closes it while it wipes them, and the redraw that follows
10520
+ * walks the rows already wiped: a reload, a Clear or a destroy
10521
+ * with an editor open in any row but the first threw, and left
10522
+ * the table half wiped.
10523
+ ************************************************************/
10524
+ function close_table_editor(tabulator) {
10525
+ let edit = tabulator.modules ? tabulator.modules.edit : null;
10526
+ if (edit && edit.currentCell) edit.cancelEdit();
10527
+ }
10528
+ /************************************************************
10463
10529
  * A table element that is gone: its identity is no table now,
10464
10530
  * and what was waiting to be loaded in it never will be.
10465
10531
  ************************************************************/
@@ -10480,6 +10546,7 @@ function destroy_row_tables(gobj, $row) {
10480
10546
  $row.yui_nested = null;
10481
10547
  for (let $nested of nested) {
10482
10548
  if ($nested.tabulator) {
10549
+ close_table_editor($nested.tabulator);
10483
10550
  destroy_rows_tables(gobj, $nested.tabulator);
10484
10551
  destroy_widget(gobj, "nested table", $nested.tabulator);
10485
10552
  $nested.tabulator = null;
@@ -10512,6 +10579,7 @@ function destroy_widgets(gobj, $container) {
10512
10579
  $el.jsoneditor = null;
10513
10580
  }
10514
10581
  if ($el.tabulator) {
10582
+ close_table_editor($el.tabulator);
10515
10583
  destroy_rows_tables(gobj, $el.tabulator);
10516
10584
  destroy_widget(gobj, "table", $el.tabulator);
10517
10585
  $el.tabulator = null;
@@ -11752,7 +11820,8 @@ function create_coordinates(gobj, attrs) {
11752
11820
  * Create tabulator
11753
11821
  *
11754
11822
  * A row builds its nested tables the first time it is drawn, each
11755
- * loaded from the row's own data, and keeps them on its element
11823
+ * BUILT with the rows of the row's own data (`rows`, a copy: the
11824
+ * table keeps what it is given), and keeps them on its element
11756
11825
  * (`yui_nested`) until the row goes (destroy_row_tables). A row
11757
11826
  * drawn AGAIN -- a forced redraw, a column rebuilt -- has its
11758
11827
  * children taken off by Tabulator before its formatter runs: they
@@ -11763,14 +11832,27 @@ function create_coordinates(gobj, attrs) {
11763
11832
  * `tableBuilt`, ONE per table (`yui_pending_rows`): a later load
11764
11833
  * replaces it, a clear drops it. Each load used to hang a listener
11765
11834
  * of its own, so two loads before the build drew the rows twice.
11835
+ *
11836
+ * A nested table is not loaded after it is built, as the form's
11837
+ * own tables are (EV_LOAD_TABLE_ROWS): each such load laid it out
11838
+ * twice and redrew it once more, and with a nested table per row
11839
+ * that was most of the time of a load.
11840
+ *
11841
+ * A table selects rows only when a host sets `selectableRows` (true
11842
+ * or a number) in `tabulator_settings`. Tabulator's SelectRow then
11843
+ * toggles a row on its own click, asking `selectableRowsCheck` --
11844
+ * the form's `selectable` -- first. Up to 7.26.44 the form toggled
11845
+ * the row again in `rowClick`, which undid every click. The default
11846
+ * `"highlight"` is left as it is, hover and all.
11766
11847
  ******************************************************************/
11767
- function create_tabulator$1(gobj, $extend, name, template) {
11768
- function get_selectable_state(row) {
11769
- return (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "selectable");
11770
- }
11848
+ function create_tabulator$1(gobj, $extend, name, template, rows) {
11771
11849
  $extend.template = template;
11772
11850
  let tabulator_settings = (0, _yuneta_gobj_js.json_deep_copy)((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator_settings"));
11773
- Object.assign(tabulator_settings, {});
11851
+ if ((0, _yuneta_gobj_js.is_array)(rows) && rows.length > 0) tabulator_settings.data = (0, _yuneta_gobj_js.json_deep_copy)(rows);
11852
+ let selectable_rows = tabulator_settings.selectableRows;
11853
+ if (selectable_rows === true || typeof selectable_rows === "number") tabulator_settings.selectableRowsCheck = function() {
11854
+ return (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable");
11855
+ };
11774
11856
  let columns = [];
11775
11857
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_rownum")) columns.push({
11776
11858
  formatter: "rownum",
@@ -11795,11 +11877,10 @@ function create_tabulator$1(gobj, $extend, name, template) {
11795
11877
  "name": sub_element.name
11796
11878
  }];
11797
11879
  let $extend = (0, _yuneta_gobj_js.createElement2)(extend);
11798
- $extend.tabulator = create_tabulator$1(gobj, $extend, sub_element.name, sub_element.template);
11880
+ let rows = data[sub_element.name];
11881
+ $extend.tabulator = create_tabulator$1(gobj, $extend, sub_element.name, sub_element.template, rows);
11799
11882
  $row.appendChild($extend);
11800
11883
  $row.yui_nested.push($extend);
11801
- let rows = data[sub_element.name];
11802
- load_tabulator_data(gobj, $extend, (0, _yuneta_gobj_js.is_array)(rows) ? rows : []);
11803
11884
  }
11804
11885
  };
11805
11886
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_delete_row_btn")) columns.push({
@@ -11851,11 +11932,9 @@ function create_tabulator$1(gobj, $extend, name, template) {
11851
11932
  });
11852
11933
  tabulator.on("rowClick", function(e, row) {
11853
11934
  e.preventDefault();
11854
- if (get_selectable_state(row)) row.toggleSelect();
11855
11935
  });
11856
11936
  tabulator.on("cellClick", function(e, cell) {
11857
11937
  e.preventDefault();
11858
- cell.getRow();
11859
11938
  });
11860
11939
  return tabulator;
11861
11940
  }
@@ -12284,6 +12363,7 @@ function clear_data(gobj, $form) {
12284
12363
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
12285
12364
  $table.yui_pending_rows = null;
12286
12365
  if ($table.tabulator.initialized) {
12366
+ close_table_editor($table.tabulator);
12287
12367
  destroy_rows_tables(gobj, $table.tabulator);
12288
12368
  $table.tabulator.clearData();
12289
12369
  }
@@ -78970,6 +79050,8 @@ function render_diagram(gobj) {
78970
79050
  * its own node click, which it publishes from inside G6's dispatch
78971
79051
  * of that click: stopped there, the gobj went from under its own
78972
79052
  * publication and the G6 graph from under its own event.
79053
+ * It is not heard from the moment it leaves: what it published in
79054
+ * that turn reached the editor as the current drawing's.
78973
79055
  ***************************************************************/
78974
79056
  function destroy_diagram(gobj) {
78975
79057
  let priv = gobj.priv;
@@ -78978,6 +79060,7 @@ function destroy_diagram(gobj) {
78978
79060
  priv.diagram_gobj = null;
78979
79061
  let $d = (0, _yuneta_gobj_js.gobj_read_attr)(diagram, "$container");
78980
79062
  if ($d && $d.parentNode) $d.parentNode.removeChild($d);
79063
+ (0, _yuneta_gobj_js.gobj_unsubscribe_event)(diagram, null, {}, gobj);
78981
79064
  priv.retired_diagrams.push(diagram);
78982
79065
  if (priv.retired_diagrams.length === 1) (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_DESTROY_DIAGRAMS", {}, gobj);
78983
79066
  }
@@ -85480,6 +85563,7 @@ exports.yui_shell_confirm_danger = yui_shell_confirm_danger;
85480
85563
  exports.yui_shell_confirm_ok = yui_shell_confirm_ok;
85481
85564
  exports.yui_shell_confirm_yesno = yui_shell_confirm_yesno;
85482
85565
  exports.yui_shell_confirm_yesnocancel = yui_shell_confirm_yesnocancel;
85566
+ exports.yui_shell_escape_order = yui_shell_escape_order;
85483
85567
  exports.yui_shell_navigate = yui_shell_navigate;
85484
85568
  exports.yui_shell_open_drawer = yui_shell_open_drawer;
85485
85569
  exports.yui_shell_overlay_dismissed = yui_shell_overlay_dismissed;