tsgrid-ui 2.7.1 → 2.9.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/dist/base.d.ts +148 -0
  3. package/dist/base.es6.js +11 -0
  4. package/dist/base.es6.js.map +1 -0
  5. package/dist/chunks/chunk-26XP2XU3.js +1795 -0
  6. package/dist/chunks/chunk-26XP2XU3.js.map +1 -0
  7. package/dist/chunks/chunk-3NYH6545.js +2423 -0
  8. package/dist/chunks/chunk-3NYH6545.js.map +1 -0
  9. package/dist/chunks/chunk-BIB3X2TW.js +1638 -0
  10. package/dist/chunks/chunk-BIB3X2TW.js.map +1 -0
  11. package/dist/chunks/chunk-DXZJHS4M.js +1283 -0
  12. package/dist/chunks/chunk-DXZJHS4M.js.map +1 -0
  13. package/dist/chunks/chunk-EVZMMVXO.js +1212 -0
  14. package/dist/chunks/chunk-EVZMMVXO.js.map +1 -0
  15. package/dist/chunks/chunk-GJD5NFWQ.js +2305 -0
  16. package/dist/chunks/chunk-GJD5NFWQ.js.map +1 -0
  17. package/dist/chunks/chunk-IYF3Q7GX.js +127 -0
  18. package/dist/chunks/chunk-IYF3Q7GX.js.map +1 -0
  19. package/dist/chunks/chunk-OFASTA2A.js +2980 -0
  20. package/dist/chunks/chunk-OFASTA2A.js.map +1 -0
  21. package/dist/chunks/chunk-OMLGN735.js +677 -0
  22. package/dist/chunks/chunk-OMLGN735.js.map +1 -0
  23. package/dist/chunks/chunk-WKSLGUB3.js +1127 -0
  24. package/dist/chunks/chunk-WKSLGUB3.js.map +1 -0
  25. package/dist/chunks/chunk-YBY52G2U.js +849 -0
  26. package/dist/chunks/chunk-YBY52G2U.js.map +1 -0
  27. package/dist/field.d.ts +329 -0
  28. package/dist/field.es6.js +11 -0
  29. package/dist/field.es6.js.map +1 -0
  30. package/dist/form.d.ts +162 -0
  31. package/dist/form.es6.js +14 -0
  32. package/dist/form.es6.js.map +1 -0
  33. package/dist/layout.d.ts +108 -0
  34. package/dist/layout.es6.js +13 -0
  35. package/dist/layout.es6.js.map +1 -0
  36. package/dist/locale.d.ts +30 -0
  37. package/dist/locale.es6.js +7 -0
  38. package/dist/locale.es6.js.map +1 -0
  39. package/dist/metafile-esm.json +1 -0
  40. package/dist/popup.d.ts +92 -0
  41. package/dist/popup.es6.js +18 -0
  42. package/dist/popup.es6.js.map +1 -0
  43. package/dist/query-CKGg5Ugv.d.ts +81 -0
  44. package/dist/sidebar.d.ts +138 -0
  45. package/dist/sidebar.es6.js +11 -0
  46. package/dist/sidebar.es6.js.map +1 -0
  47. package/dist/tabs.d.ts +63 -0
  48. package/dist/tabs.es6.js +11 -0
  49. package/dist/tabs.es6.js.map +1 -0
  50. package/dist/toolbar.d.ts +97 -0
  51. package/dist/toolbar.es6.js +11 -0
  52. package/dist/toolbar.es6.js.map +1 -0
  53. package/dist/tooltip.d.ts +322 -0
  54. package/dist/tooltip.es6.js +18 -0
  55. package/dist/tooltip.es6.js.map +1 -0
  56. package/dist/tsgrid-ui.css +2 -2
  57. package/dist/tsgrid-ui.d.ts +16 -2004
  58. package/dist/tsgrid-ui.es6.js +7750 -23830
  59. package/dist/tsgrid-ui.es6.js.map +1 -1
  60. package/dist/tsgrid-ui.es6.min.js +28 -28
  61. package/dist/tsgrid-ui.js +96 -17
  62. package/dist/tsgrid-ui.min.css +2 -2
  63. package/dist/tsgrid-ui.min.js +24 -24
  64. package/dist/tsutils-message-CogFtVtO.d.ts +82 -0
  65. package/dist/utils.d.ts +418 -0
  66. package/dist/utils.es6.js +14 -0
  67. package/dist/utils.es6.js.map +1 -0
  68. package/package.json +26 -5
package/dist/tsgrid-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- /* tsgrid-ui 1.0.x (nightly) (5/14/2026, 1:17:35 AM) (c) 2014 vitmalina@gmail.com, (c) 2026 DaverSoGT — MIT */
1
+ /* tsgrid-ui 2.9.0 (c) 2014 vitmalina@gmail.com, (c) 2026 DaverSoGT — MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7674,11 +7674,11 @@ var TsToolbar = class extends TsBase {
7674
7674
  pendingRefresh: {}
7675
7675
  // what should be refreshed with a debounce
7676
7676
  };
7677
- this._refresh = ({ effected, resize: resize2, refreshTooltip }) => {
7677
+ this._refresh = ({ effected, resize: resize2, refreshTooltip, hideTooltip }) => {
7678
7678
  const options2 = this.last.pendingRefresh;
7679
7679
  options2.ids ??= [];
7680
7680
  options2.ids.push(...effected);
7681
- Object.assign(options2, { resize: resize2, refreshTooltip });
7681
+ Object.assign(options2, { resize: resize2, refreshTooltip, hideTooltip });
7682
7682
  this._refreshDebounced();
7683
7683
  };
7684
7684
  this._refreshDebounced = TsUtils.debounce(() => {
@@ -7735,10 +7735,6 @@ var TsToolbar = class extends TsBase {
7735
7735
  console.log('ERROR: The parameter "id" is required but not supplied.', item);
7736
7736
  return;
7737
7737
  }
7738
- if (item.type == null) {
7739
- console.log('ERROR: The parameter "type" is required but not supplied.', item);
7740
- return;
7741
- }
7742
7738
  if (!TsUtils.checkUniqueId(item.id, this.items, "toolbar", this.name)) return;
7743
7739
  const newItem = TsUtils.extend({}, this.item_template, item);
7744
7740
  if (newItem.type == "group" && Array.isArray(newItem.items)) {
@@ -7749,14 +7745,21 @@ var TsToolbar = class extends TsBase {
7749
7745
  if (newItem.type == "menu-check") {
7750
7746
  if (!Array.isArray(newItem.selected)) newItem.selected = [];
7751
7747
  if (Array.isArray(newItem.items)) {
7752
- newItem.items.forEach((it) => {
7748
+ newItem.items.forEach((it, idx2, arr2) => {
7753
7749
  if (typeof it === "string") {
7754
- it = arr[idx] = { id: it, text: it };
7750
+ it = arr2[idx2] = { id: it, text: it };
7755
7751
  }
7756
7752
  if (it.checked && !newItem.selected.includes(it.id)) newItem.selected.push(it.id);
7757
7753
  if (!it.checked && newItem.selected.includes(it.id)) it.checked = true;
7758
7754
  if (it.checked == null) it.checked = false;
7759
7755
  });
7756
+ } else if (typeof newItem.items === "function") {
7757
+ const materialized = newItem.items(newItem);
7758
+ if (Array.isArray(materialized)) {
7759
+ materialized.forEach((it) => {
7760
+ if (it && it.checked && !newItem.selected.includes(it.id)) newItem.selected.push(it.id);
7761
+ });
7762
+ }
7760
7763
  }
7761
7764
  } else if (newItem.type == "menu-radio") {
7762
7765
  if (Array.isArray(newItem.items)) {
@@ -7775,7 +7778,12 @@ var TsToolbar = class extends TsBase {
7775
7778
  this.items.push(newItem);
7776
7779
  } else {
7777
7780
  const middle = this.get(id, true);
7778
- this.items = this.items.slice(0, middle).concat([newItem], this.items.slice(middle));
7781
+ if (middle == null) {
7782
+ console.warn(`TsToolbar: insert anchor id "${id}" not found; appending instead.`);
7783
+ this.items.push(newItem);
7784
+ } else {
7785
+ this.items = this.items.slice(0, middle).concat([newItem], this.items.slice(middle));
7786
+ }
7779
7787
  }
7780
7788
  newItem.line = newItem.line ?? 1;
7781
7789
  if (skipRefresh !== true) this.refresh(newItem.id);
@@ -7792,7 +7800,15 @@ var TsToolbar = class extends TsBase {
7792
7800
  effected++;
7793
7801
  query10(this.box).find("#tb_" + this.name + "_item_" + TsUtils.escapeId(it.id)).remove();
7794
7802
  const ind = this.get(it.id, true);
7795
- if (ind != null) this.items.splice(ind, 1);
7803
+ if (ind != null) {
7804
+ const top = this.items[ind];
7805
+ if (top.id === it.id) {
7806
+ this.items.splice(ind, 1);
7807
+ } else if (top.type === "group" && Array.isArray(top.items)) {
7808
+ const subIdx = top.items.findIndex((s) => s && s.id === it.id);
7809
+ if (subIdx !== -1) top.items.splice(subIdx, 1);
7810
+ }
7811
+ }
7796
7812
  });
7797
7813
  this.resize();
7798
7814
  return effected;
@@ -7848,7 +7864,10 @@ var TsToolbar = class extends TsBase {
7848
7864
  else return it;
7849
7865
  } else if (it.type == "group") {
7850
7866
  const sub = this.get(id, returnIndex, it.items);
7851
- if (sub != null) return sub;
7867
+ if (sub != null) {
7868
+ if (returnIndex === true) return i1;
7869
+ return sub;
7870
+ }
7852
7871
  }
7853
7872
  }
7854
7873
  return null;
@@ -7867,6 +7886,8 @@ var TsToolbar = class extends TsBase {
7867
7886
  item.count = count;
7868
7887
  } else {
7869
7888
  this.set(id, { count });
7889
+ const after = query10(this.box).find(`#tb_${this.name}_item_${TsUtils.escapeId(id)} .tsg-tb-count > span`);
7890
+ if (after.length === 0) return;
7870
7891
  this.setCount(id, count, className, style);
7871
7892
  }
7872
7893
  }
@@ -7973,6 +7994,55 @@ var TsToolbar = class extends TsBase {
7973
7994
  this._refresh({ effected });
7974
7995
  return effected;
7975
7996
  }
7997
+ /**
7998
+ * Toggle the `checked` state of one or more items.
7999
+ *
8000
+ * State management only — does NOT fire events (no `onClick`, no `onChange`)
8001
+ * and does NOT open drop / menu / color overlays. For full UI interaction
8002
+ * including opening pickers, call `click(id)` instead.
8003
+ *
8004
+ * Per-item behaviour:
8005
+ * - button / check / html / spacer / break: flips `it.checked`.
8006
+ * - drop / menu / menu-radio / menu-check / color / text-color: if currently
8007
+ * checked, closes the toolbar's `-drop` overlay via `TsTooltip.hide` before
8008
+ * flipping. Same overlay-close path as `uncheck()`. Never opens overlays.
8009
+ * - radio: emits `console.warn` and is skipped (would leave the group with
8010
+ * no checked member). Use `check()` / `uncheck()` for radios.
8011
+ * - group: recurses into `it.items` and toggles each child individually; the
8012
+ * group container itself is never in the effected list.
8013
+ * - sub-id with `:` notation: skipped (same guard as siblings).
8014
+ * - missing id: silently skipped.
8015
+ *
8016
+ * @param args ids of items to toggle. Varargs, independent per id.
8017
+ * @returns array of ids whose checked state actually flipped. Never `undefined`.
8018
+ */
8019
+ // any: array of heterogeneous runtime values; TsToolbar item shape varies by `type` at runtime
8020
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8021
+ toggle(...args) {
8022
+ const effected = [];
8023
+ args.flat().forEach((item) => {
8024
+ const it = this.get(item);
8025
+ if (!it || String(item).indexOf(":") != -1) return;
8026
+ if (it.type == "radio") {
8027
+ console.warn(`TsToolbar.toggle: radio items are not supported, use check()/uncheck() instead. Item: ${item}`);
8028
+ return;
8029
+ }
8030
+ if (it.type == "group") {
8031
+ const childIds = it.items.map((itm) => itm.id);
8032
+ const childEffected = this.toggle(...childIds);
8033
+ effected.push(...childEffected);
8034
+ return;
8035
+ }
8036
+ const newChecked = !it.checked;
8037
+ if (["menu", "menu-radio", "menu-check", "drop", "color", "text-color"].includes(it.type) && it.checked) {
8038
+ TsTooltip.hide(this.name + "-drop");
8039
+ }
8040
+ it.checked = newChecked;
8041
+ effected.push(String(item).split(":")[0]);
8042
+ });
8043
+ this._refresh({ effected });
8044
+ return effected;
8045
+ }
7976
8046
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7977
8047
  click(id, event2) {
7978
8048
  const tmp = String(id).split(":");
@@ -8260,7 +8330,7 @@ var TsToolbar = class extends TsBase {
8260
8330
  const next = parseInt(this.get(id, true)) + 1;
8261
8331
  let $next = query10(this.box).find(`#tb_${this.name}_item_${TsUtils.escapeId(this.items[next] ? this.items[next].id : "--")}`);
8262
8332
  if ($next.length == 0) {
8263
- $next = query10(this.box).find(`.tsg-tb-line:nth-child(${it.line}`).find(".tsg-tb-right").before(html);
8333
+ $next = query10(this.box).find(`.tsg-tb-line:nth-child(${it.line})`).find(".tsg-tb-right").before(html);
8264
8334
  } else {
8265
8335
  $next.after(html);
8266
8336
  }
@@ -8318,6 +8388,8 @@ var TsToolbar = class extends TsBase {
8318
8388
  destroy() {
8319
8389
  const edata = this.trigger("destroy", { target: this.name });
8320
8390
  if (edata.isCancelled === true) return;
8391
+ TsTooltip.hide(this.name + "-tooltip");
8392
+ TsTooltip.hide(this.name + "-drop");
8321
8393
  if (query10(this.box).find(".tsg-scroll-wrapper").length > 0) {
8322
8394
  this.unmount();
8323
8395
  }
@@ -8383,6 +8455,7 @@ var TsToolbar = class extends TsBase {
8383
8455
  }
8384
8456
  text = `<span style="color: ${color}">${item.text ? TsUtils.lang(item.text) : item.backColor ? `<b style="background-color: ${bcolor ?? "transparent"}; padding: 2px 5px; border-radius: 3px;">Ab</b>` : "<b>Ab</b>"}</span>`;
8385
8457
  }
8458
+ // falls through
8386
8459
  case "menu":
8387
8460
  case "menu-check":
8388
8461
  case "menu-radio":
@@ -8467,7 +8540,7 @@ var TsToolbar = class extends TsBase {
8467
8540
  }
8468
8541
  case "group": {
8469
8542
  html = `<div id="tb_${this.name}_item_${item.id}" class="tsg-tb-group"
8470
- style="display: flex; ${item.hidden ? "display: none" : ""}; ${item.style ? item.style : ""}">`;
8543
+ style="display: ${item.hidden ? "none" : "flex"}; ${item.style ? item.style : ""}">`;
8471
8544
  if (Array.isArray(item.items)) {
8472
8545
  item.items.forEach((it) => {
8473
8546
  html += this.getItemHTML(it);
@@ -8532,8 +8605,11 @@ var TsToolbar = class extends TsBase {
8532
8605
  if (it.input?.spinner || it.input?.min != null || it.input?.max != null || it.input?.step != null) {
8533
8606
  value = parseFloat(value);
8534
8607
  }
8535
- if (it.input?.suffix != null && String(value).substr(-it.input.suffix.length) == it.input.suffix) {
8536
- value = String(value).substr(0, value.length - it.input.suffix.length);
8608
+ if (it.input?.suffix != null) {
8609
+ const strValue = String(value);
8610
+ if (strValue.substr(-it.input.suffix.length) == it.input.suffix) {
8611
+ value = strValue.substr(0, strValue.length - it.input.suffix.length);
8612
+ }
8537
8613
  }
8538
8614
  if (it.input?.min != null && it.input.min > value) {
8539
8615
  value = it.input.min;
@@ -8680,7 +8756,10 @@ var TsToolbar = class extends TsBase {
8680
8756
  mouseAction(event2, target, action, id) {
8681
8757
  const btn = this.get(id);
8682
8758
  const edata = this.trigger("mouse" + action, { target: id, item: btn, object: btn, originalEvent: event2 });
8683
- if (edata.isCancelled === true || btn.disabled || btn.hidden) return;
8759
+ if (edata.isCancelled === true || btn.disabled || btn.hidden) {
8760
+ edata.finish();
8761
+ return;
8762
+ }
8684
8763
  switch (action) {
8685
8764
  case "Enter":
8686
8765
  if (!["label", "input"].includes(btn.type)) {