tsgrid-ui 2.7.0 → 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 +229 -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 -23831
  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 +103 -25
  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, 12:10:16 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;
@@ -3045,15 +3045,13 @@ function _date(dateStr, settings, deps) {
3045
3045
  // src/tsutils-locale.ts
3046
3046
  async function _locale(locale, keepPhrases, noMerge, settings, deps) {
3047
3047
  if (Array.isArray(locale)) {
3048
- let mergedSettings = deps.extend({}, settings, { phrases: {} });
3049
- const localeArr = locale;
3048
+ let mergedSettings = deps.extend({}, { ...settings, phrases: {} });
3049
+ const localeArr = locale.map(
3050
+ (f) => f.length === 5 ? "locale/" + f.toLowerCase() + ".json" : f
3051
+ );
3050
3052
  const proms = [];
3051
3053
  const files = {};
3052
- localeArr.forEach((file, ind) => {
3053
- if (file.length === 5) {
3054
- file = "locale/" + file.toLowerCase() + ".json";
3055
- localeArr[ind] = file;
3056
- }
3054
+ localeArr.forEach((file) => {
3057
3055
  proms.push(_locale(file, true, false, mergedSettings, deps));
3058
3056
  });
3059
3057
  const res = await Promise.allSettled(proms);
@@ -3084,7 +3082,8 @@ async function _locale(locale, keepPhrases, noMerge, settings, deps) {
3084
3082
  const newSettings = deps.extend({}, settings, data);
3085
3083
  return { kind: "load", file: localeStr, data, settings: newSettings };
3086
3084
  } else {
3087
- const newSettings = deps.extend({}, settings, TsLocale, { phrases: {} }, data);
3085
+ const phrasesCleared = { ...settings, phrases: {} };
3086
+ const newSettings = deps.extend({}, phrasesCleared, TsLocale, data);
3088
3087
  return { kind: "load", file: localeStr, data, settings: newSettings };
3089
3088
  }
3090
3089
  }
@@ -7675,11 +7674,11 @@ var TsToolbar = class extends TsBase {
7675
7674
  pendingRefresh: {}
7676
7675
  // what should be refreshed with a debounce
7677
7676
  };
7678
- this._refresh = ({ effected, resize: resize2, refreshTooltip }) => {
7677
+ this._refresh = ({ effected, resize: resize2, refreshTooltip, hideTooltip }) => {
7679
7678
  const options2 = this.last.pendingRefresh;
7680
7679
  options2.ids ??= [];
7681
7680
  options2.ids.push(...effected);
7682
- Object.assign(options2, { resize: resize2, refreshTooltip });
7681
+ Object.assign(options2, { resize: resize2, refreshTooltip, hideTooltip });
7683
7682
  this._refreshDebounced();
7684
7683
  };
7685
7684
  this._refreshDebounced = TsUtils.debounce(() => {
@@ -7736,10 +7735,6 @@ var TsToolbar = class extends TsBase {
7736
7735
  console.log('ERROR: The parameter "id" is required but not supplied.', item);
7737
7736
  return;
7738
7737
  }
7739
- if (item.type == null) {
7740
- console.log('ERROR: The parameter "type" is required but not supplied.', item);
7741
- return;
7742
- }
7743
7738
  if (!TsUtils.checkUniqueId(item.id, this.items, "toolbar", this.name)) return;
7744
7739
  const newItem = TsUtils.extend({}, this.item_template, item);
7745
7740
  if (newItem.type == "group" && Array.isArray(newItem.items)) {
@@ -7750,14 +7745,21 @@ var TsToolbar = class extends TsBase {
7750
7745
  if (newItem.type == "menu-check") {
7751
7746
  if (!Array.isArray(newItem.selected)) newItem.selected = [];
7752
7747
  if (Array.isArray(newItem.items)) {
7753
- newItem.items.forEach((it) => {
7748
+ newItem.items.forEach((it, idx2, arr2) => {
7754
7749
  if (typeof it === "string") {
7755
- it = arr[idx] = { id: it, text: it };
7750
+ it = arr2[idx2] = { id: it, text: it };
7756
7751
  }
7757
7752
  if (it.checked && !newItem.selected.includes(it.id)) newItem.selected.push(it.id);
7758
7753
  if (!it.checked && newItem.selected.includes(it.id)) it.checked = true;
7759
7754
  if (it.checked == null) it.checked = false;
7760
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
+ }
7761
7763
  }
7762
7764
  } else if (newItem.type == "menu-radio") {
7763
7765
  if (Array.isArray(newItem.items)) {
@@ -7776,7 +7778,12 @@ var TsToolbar = class extends TsBase {
7776
7778
  this.items.push(newItem);
7777
7779
  } else {
7778
7780
  const middle = this.get(id, true);
7779
- 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
+ }
7780
7787
  }
7781
7788
  newItem.line = newItem.line ?? 1;
7782
7789
  if (skipRefresh !== true) this.refresh(newItem.id);
@@ -7793,7 +7800,15 @@ var TsToolbar = class extends TsBase {
7793
7800
  effected++;
7794
7801
  query10(this.box).find("#tb_" + this.name + "_item_" + TsUtils.escapeId(it.id)).remove();
7795
7802
  const ind = this.get(it.id, true);
7796
- 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
+ }
7797
7812
  });
7798
7813
  this.resize();
7799
7814
  return effected;
@@ -7849,7 +7864,10 @@ var TsToolbar = class extends TsBase {
7849
7864
  else return it;
7850
7865
  } else if (it.type == "group") {
7851
7866
  const sub = this.get(id, returnIndex, it.items);
7852
- if (sub != null) return sub;
7867
+ if (sub != null) {
7868
+ if (returnIndex === true) return i1;
7869
+ return sub;
7870
+ }
7853
7871
  }
7854
7872
  }
7855
7873
  return null;
@@ -7868,6 +7886,8 @@ var TsToolbar = class extends TsBase {
7868
7886
  item.count = count;
7869
7887
  } else {
7870
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;
7871
7891
  this.setCount(id, count, className, style);
7872
7892
  }
7873
7893
  }
@@ -7974,6 +7994,55 @@ var TsToolbar = class extends TsBase {
7974
7994
  this._refresh({ effected });
7975
7995
  return effected;
7976
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
+ }
7977
8046
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7978
8047
  click(id, event2) {
7979
8048
  const tmp = String(id).split(":");
@@ -8261,7 +8330,7 @@ var TsToolbar = class extends TsBase {
8261
8330
  const next = parseInt(this.get(id, true)) + 1;
8262
8331
  let $next = query10(this.box).find(`#tb_${this.name}_item_${TsUtils.escapeId(this.items[next] ? this.items[next].id : "--")}`);
8263
8332
  if ($next.length == 0) {
8264
- $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);
8265
8334
  } else {
8266
8335
  $next.after(html);
8267
8336
  }
@@ -8319,6 +8388,8 @@ var TsToolbar = class extends TsBase {
8319
8388
  destroy() {
8320
8389
  const edata = this.trigger("destroy", { target: this.name });
8321
8390
  if (edata.isCancelled === true) return;
8391
+ TsTooltip.hide(this.name + "-tooltip");
8392
+ TsTooltip.hide(this.name + "-drop");
8322
8393
  if (query10(this.box).find(".tsg-scroll-wrapper").length > 0) {
8323
8394
  this.unmount();
8324
8395
  }
@@ -8384,6 +8455,7 @@ var TsToolbar = class extends TsBase {
8384
8455
  }
8385
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>`;
8386
8457
  }
8458
+ // falls through
8387
8459
  case "menu":
8388
8460
  case "menu-check":
8389
8461
  case "menu-radio":
@@ -8468,7 +8540,7 @@ var TsToolbar = class extends TsBase {
8468
8540
  }
8469
8541
  case "group": {
8470
8542
  html = `<div id="tb_${this.name}_item_${item.id}" class="tsg-tb-group"
8471
- style="display: flex; ${item.hidden ? "display: none" : ""}; ${item.style ? item.style : ""}">`;
8543
+ style="display: ${item.hidden ? "none" : "flex"}; ${item.style ? item.style : ""}">`;
8472
8544
  if (Array.isArray(item.items)) {
8473
8545
  item.items.forEach((it) => {
8474
8546
  html += this.getItemHTML(it);
@@ -8533,8 +8605,11 @@ var TsToolbar = class extends TsBase {
8533
8605
  if (it.input?.spinner || it.input?.min != null || it.input?.max != null || it.input?.step != null) {
8534
8606
  value = parseFloat(value);
8535
8607
  }
8536
- if (it.input?.suffix != null && String(value).substr(-it.input.suffix.length) == it.input.suffix) {
8537
- 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
+ }
8538
8613
  }
8539
8614
  if (it.input?.min != null && it.input.min > value) {
8540
8615
  value = it.input.min;
@@ -8681,7 +8756,10 @@ var TsToolbar = class extends TsBase {
8681
8756
  mouseAction(event2, target, action, id) {
8682
8757
  const btn = this.get(id);
8683
8758
  const edata = this.trigger("mouse" + action, { target: id, item: btn, object: btn, originalEvent: event2 });
8684
- if (edata.isCancelled === true || btn.disabled || btn.hidden) return;
8759
+ if (edata.isCancelled === true || btn.disabled || btn.hidden) {
8760
+ edata.finish();
8761
+ return;
8762
+ }
8685
8763
  switch (action) {
8686
8764
  case "Enter":
8687
8765
  if (!["label", "input"].includes(btn.type)) {