tsgrid-ui 2.7.1 → 2.10.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.
- package/CHANGELOG.md +217 -0
- package/dist/base.d.ts +148 -0
- package/dist/base.es6.js +11 -0
- package/dist/base.es6.js.map +1 -0
- package/dist/chunks/chunk-3NYH6545.js +2423 -0
- package/dist/chunks/chunk-3NYH6545.js.map +1 -0
- package/dist/chunks/chunk-6MOFFUV2.js +2305 -0
- package/dist/chunks/chunk-6MOFFUV2.js.map +1 -0
- package/dist/chunks/chunk-6UCGFWIQ.js +865 -0
- package/dist/chunks/chunk-6UCGFWIQ.js.map +1 -0
- package/dist/chunks/chunk-DXZJHS4M.js +1283 -0
- package/dist/chunks/chunk-DXZJHS4M.js.map +1 -0
- package/dist/chunks/chunk-DZSFZLV6.js +1638 -0
- package/dist/chunks/chunk-DZSFZLV6.js.map +1 -0
- package/dist/chunks/chunk-EQK6JAHT.js +33 -0
- package/dist/chunks/chunk-EQK6JAHT.js.map +1 -0
- package/dist/chunks/chunk-FAIRNXQR.js +3020 -0
- package/dist/chunks/chunk-FAIRNXQR.js.map +1 -0
- package/dist/chunks/chunk-GZFWK4LZ.js +677 -0
- package/dist/chunks/chunk-GZFWK4LZ.js.map +1 -0
- package/dist/chunks/chunk-IYF3Q7GX.js +127 -0
- package/dist/chunks/chunk-IYF3Q7GX.js.map +1 -0
- package/dist/chunks/chunk-KLJ35UAH.js +1795 -0
- package/dist/chunks/chunk-KLJ35UAH.js.map +1 -0
- package/dist/chunks/chunk-LUSNRF73.js +1212 -0
- package/dist/chunks/chunk-LUSNRF73.js.map +1 -0
- package/dist/chunks/chunk-N3GASHTI.js +1127 -0
- package/dist/chunks/chunk-N3GASHTI.js.map +1 -0
- package/dist/field.d.ts +329 -0
- package/dist/field.es6.js +12 -0
- package/dist/field.es6.js.map +1 -0
- package/dist/form.d.ts +162 -0
- package/dist/form.es6.js +15 -0
- package/dist/form.es6.js.map +1 -0
- package/dist/layout.d.ts +108 -0
- package/dist/layout.es6.js +14 -0
- package/dist/layout.es6.js.map +1 -0
- package/dist/locale.d.ts +30 -0
- package/dist/locale.es6.js +7 -0
- package/dist/locale.es6.js.map +1 -0
- package/dist/popup.d.ts +97 -0
- package/dist/popup.es6.js +21 -0
- package/dist/popup.es6.js.map +1 -0
- package/dist/query-CKGg5Ugv.d.ts +81 -0
- package/dist/sidebar.d.ts +138 -0
- package/dist/sidebar.es6.js +12 -0
- package/dist/sidebar.es6.js.map +1 -0
- package/dist/tabs.d.ts +63 -0
- package/dist/tabs.es6.js +12 -0
- package/dist/tabs.es6.js.map +1 -0
- package/dist/toolbar.d.ts +97 -0
- package/dist/toolbar.es6.js +12 -0
- package/dist/toolbar.es6.js.map +1 -0
- package/dist/tooltip.d.ts +330 -0
- package/dist/tooltip.es6.js +21 -0
- package/dist/tooltip.es6.js.map +1 -0
- package/dist/tsgrid-ui.css +2 -2
- package/dist/tsgrid-ui.d.ts +16 -2004
- package/dist/tsgrid-ui.es6.js +7751 -23830
- package/dist/tsgrid-ui.es6.js.map +1 -1
- package/dist/tsgrid-ui.es6.min.js +37 -37
- package/dist/tsgrid-ui.js +150 -22
- package/dist/tsgrid-ui.min.css +2 -2
- package/dist/tsgrid-ui.min.js +39 -39
- package/dist/tsutils-message-CogFtVtO.d.ts +82 -0
- package/dist/utils.d.ts +418 -0
- package/dist/utils.es6.js +14 -0
- package/dist/utils.es6.js.map +1 -0
- package/package.json +25 -5
package/dist/tsgrid-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tsgrid-ui
|
|
1
|
+
/* tsgrid-ui 2.10.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;
|
|
@@ -3797,6 +3797,35 @@ var Utils = class {
|
|
|
3797
3797
|
};
|
|
3798
3798
|
var TsUtils = new Utils();
|
|
3799
3799
|
|
|
3800
|
+
// src/lazy-singleton.ts
|
|
3801
|
+
function lazySingleton(factory, protoRef) {
|
|
3802
|
+
let _impl = null;
|
|
3803
|
+
const materialize = () => _impl ??= factory();
|
|
3804
|
+
return new Proxy({}, {
|
|
3805
|
+
get(_t, prop, receiver) {
|
|
3806
|
+
return Reflect.get(materialize(), prop, receiver);
|
|
3807
|
+
},
|
|
3808
|
+
set(_t, prop, value, _receiver) {
|
|
3809
|
+
return Reflect.set(materialize(), prop, value, materialize());
|
|
3810
|
+
},
|
|
3811
|
+
has(_t, prop) {
|
|
3812
|
+
return Reflect.has(materialize(), prop);
|
|
3813
|
+
},
|
|
3814
|
+
ownKeys() {
|
|
3815
|
+
return Reflect.ownKeys(materialize());
|
|
3816
|
+
},
|
|
3817
|
+
getOwnPropertyDescriptor(_t, prop) {
|
|
3818
|
+
return Reflect.getOwnPropertyDescriptor(materialize(), prop);
|
|
3819
|
+
},
|
|
3820
|
+
defineProperty(_t, prop, desc) {
|
|
3821
|
+
return Reflect.defineProperty(materialize(), prop, desc);
|
|
3822
|
+
},
|
|
3823
|
+
getPrototypeOf() {
|
|
3824
|
+
return protoRef.prototype;
|
|
3825
|
+
}
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3800
3829
|
// src/tspopup.ts
|
|
3801
3830
|
var query8 = query;
|
|
3802
3831
|
var TsDialog = class extends TsBase {
|
|
@@ -4628,7 +4657,11 @@ function TsPrompt(label, title, callBack) {
|
|
|
4628
4657
|
});
|
|
4629
4658
|
return prom;
|
|
4630
4659
|
}
|
|
4631
|
-
var
|
|
4660
|
+
var _TsDialogCtorCount = 0;
|
|
4661
|
+
var TsPopup = lazySingleton(() => {
|
|
4662
|
+
_TsDialogCtorCount++;
|
|
4663
|
+
return new TsDialog();
|
|
4664
|
+
}, TsDialog);
|
|
4632
4665
|
|
|
4633
4666
|
// src/tstooltip.ts
|
|
4634
4667
|
var query9 = query;
|
|
@@ -7589,10 +7622,26 @@ var DateTooltip = class extends Tooltip {
|
|
|
7589
7622
|
return ret;
|
|
7590
7623
|
}
|
|
7591
7624
|
};
|
|
7592
|
-
var
|
|
7593
|
-
var
|
|
7594
|
-
var
|
|
7595
|
-
var
|
|
7625
|
+
var _tooltipCtorCount = 0;
|
|
7626
|
+
var _menuCtorCount = 0;
|
|
7627
|
+
var _colorCtorCount = 0;
|
|
7628
|
+
var _dateCtorCount = 0;
|
|
7629
|
+
var TsTooltip = lazySingleton(() => {
|
|
7630
|
+
_tooltipCtorCount++;
|
|
7631
|
+
return new Tooltip();
|
|
7632
|
+
}, Tooltip);
|
|
7633
|
+
var TsMenu = lazySingleton(() => {
|
|
7634
|
+
_menuCtorCount++;
|
|
7635
|
+
return new MenuTooltip();
|
|
7636
|
+
}, MenuTooltip);
|
|
7637
|
+
var TsColor = lazySingleton(() => {
|
|
7638
|
+
_colorCtorCount++;
|
|
7639
|
+
return new ColorTooltip();
|
|
7640
|
+
}, ColorTooltip);
|
|
7641
|
+
var TsDate = lazySingleton(() => {
|
|
7642
|
+
_dateCtorCount++;
|
|
7643
|
+
return new DateTooltip();
|
|
7644
|
+
}, DateTooltip);
|
|
7596
7645
|
|
|
7597
7646
|
// src/tstoolbar.ts
|
|
7598
7647
|
var query10 = query;
|
|
@@ -7674,11 +7723,11 @@ var TsToolbar = class extends TsBase {
|
|
|
7674
7723
|
pendingRefresh: {}
|
|
7675
7724
|
// what should be refreshed with a debounce
|
|
7676
7725
|
};
|
|
7677
|
-
this._refresh = ({ effected, resize: resize2, refreshTooltip }) => {
|
|
7726
|
+
this._refresh = ({ effected, resize: resize2, refreshTooltip, hideTooltip }) => {
|
|
7678
7727
|
const options2 = this.last.pendingRefresh;
|
|
7679
7728
|
options2.ids ??= [];
|
|
7680
7729
|
options2.ids.push(...effected);
|
|
7681
|
-
Object.assign(options2, { resize: resize2, refreshTooltip });
|
|
7730
|
+
Object.assign(options2, { resize: resize2, refreshTooltip, hideTooltip });
|
|
7682
7731
|
this._refreshDebounced();
|
|
7683
7732
|
};
|
|
7684
7733
|
this._refreshDebounced = TsUtils.debounce(() => {
|
|
@@ -7735,10 +7784,6 @@ var TsToolbar = class extends TsBase {
|
|
|
7735
7784
|
console.log('ERROR: The parameter "id" is required but not supplied.', item);
|
|
7736
7785
|
return;
|
|
7737
7786
|
}
|
|
7738
|
-
if (item.type == null) {
|
|
7739
|
-
console.log('ERROR: The parameter "type" is required but not supplied.', item);
|
|
7740
|
-
return;
|
|
7741
|
-
}
|
|
7742
7787
|
if (!TsUtils.checkUniqueId(item.id, this.items, "toolbar", this.name)) return;
|
|
7743
7788
|
const newItem = TsUtils.extend({}, this.item_template, item);
|
|
7744
7789
|
if (newItem.type == "group" && Array.isArray(newItem.items)) {
|
|
@@ -7749,14 +7794,21 @@ var TsToolbar = class extends TsBase {
|
|
|
7749
7794
|
if (newItem.type == "menu-check") {
|
|
7750
7795
|
if (!Array.isArray(newItem.selected)) newItem.selected = [];
|
|
7751
7796
|
if (Array.isArray(newItem.items)) {
|
|
7752
|
-
newItem.items.forEach((it) => {
|
|
7797
|
+
newItem.items.forEach((it, idx2, arr2) => {
|
|
7753
7798
|
if (typeof it === "string") {
|
|
7754
|
-
it =
|
|
7799
|
+
it = arr2[idx2] = { id: it, text: it };
|
|
7755
7800
|
}
|
|
7756
7801
|
if (it.checked && !newItem.selected.includes(it.id)) newItem.selected.push(it.id);
|
|
7757
7802
|
if (!it.checked && newItem.selected.includes(it.id)) it.checked = true;
|
|
7758
7803
|
if (it.checked == null) it.checked = false;
|
|
7759
7804
|
});
|
|
7805
|
+
} else if (typeof newItem.items === "function") {
|
|
7806
|
+
const materialized = newItem.items(newItem);
|
|
7807
|
+
if (Array.isArray(materialized)) {
|
|
7808
|
+
materialized.forEach((it) => {
|
|
7809
|
+
if (it && it.checked && !newItem.selected.includes(it.id)) newItem.selected.push(it.id);
|
|
7810
|
+
});
|
|
7811
|
+
}
|
|
7760
7812
|
}
|
|
7761
7813
|
} else if (newItem.type == "menu-radio") {
|
|
7762
7814
|
if (Array.isArray(newItem.items)) {
|
|
@@ -7775,7 +7827,12 @@ var TsToolbar = class extends TsBase {
|
|
|
7775
7827
|
this.items.push(newItem);
|
|
7776
7828
|
} else {
|
|
7777
7829
|
const middle = this.get(id, true);
|
|
7778
|
-
|
|
7830
|
+
if (middle == null) {
|
|
7831
|
+
console.warn(`TsToolbar: insert anchor id "${id}" not found; appending instead.`);
|
|
7832
|
+
this.items.push(newItem);
|
|
7833
|
+
} else {
|
|
7834
|
+
this.items = this.items.slice(0, middle).concat([newItem], this.items.slice(middle));
|
|
7835
|
+
}
|
|
7779
7836
|
}
|
|
7780
7837
|
newItem.line = newItem.line ?? 1;
|
|
7781
7838
|
if (skipRefresh !== true) this.refresh(newItem.id);
|
|
@@ -7792,7 +7849,15 @@ var TsToolbar = class extends TsBase {
|
|
|
7792
7849
|
effected++;
|
|
7793
7850
|
query10(this.box).find("#tb_" + this.name + "_item_" + TsUtils.escapeId(it.id)).remove();
|
|
7794
7851
|
const ind = this.get(it.id, true);
|
|
7795
|
-
if (ind != null)
|
|
7852
|
+
if (ind != null) {
|
|
7853
|
+
const top = this.items[ind];
|
|
7854
|
+
if (top.id === it.id) {
|
|
7855
|
+
this.items.splice(ind, 1);
|
|
7856
|
+
} else if (top.type === "group" && Array.isArray(top.items)) {
|
|
7857
|
+
const subIdx = top.items.findIndex((s) => s && s.id === it.id);
|
|
7858
|
+
if (subIdx !== -1) top.items.splice(subIdx, 1);
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7796
7861
|
});
|
|
7797
7862
|
this.resize();
|
|
7798
7863
|
return effected;
|
|
@@ -7848,7 +7913,10 @@ var TsToolbar = class extends TsBase {
|
|
|
7848
7913
|
else return it;
|
|
7849
7914
|
} else if (it.type == "group") {
|
|
7850
7915
|
const sub = this.get(id, returnIndex, it.items);
|
|
7851
|
-
if (sub != null)
|
|
7916
|
+
if (sub != null) {
|
|
7917
|
+
if (returnIndex === true) return i1;
|
|
7918
|
+
return sub;
|
|
7919
|
+
}
|
|
7852
7920
|
}
|
|
7853
7921
|
}
|
|
7854
7922
|
return null;
|
|
@@ -7867,6 +7935,8 @@ var TsToolbar = class extends TsBase {
|
|
|
7867
7935
|
item.count = count;
|
|
7868
7936
|
} else {
|
|
7869
7937
|
this.set(id, { count });
|
|
7938
|
+
const after = query10(this.box).find(`#tb_${this.name}_item_${TsUtils.escapeId(id)} .tsg-tb-count > span`);
|
|
7939
|
+
if (after.length === 0) return;
|
|
7870
7940
|
this.setCount(id, count, className, style);
|
|
7871
7941
|
}
|
|
7872
7942
|
}
|
|
@@ -7973,6 +8043,55 @@ var TsToolbar = class extends TsBase {
|
|
|
7973
8043
|
this._refresh({ effected });
|
|
7974
8044
|
return effected;
|
|
7975
8045
|
}
|
|
8046
|
+
/**
|
|
8047
|
+
* Toggle the `checked` state of one or more items.
|
|
8048
|
+
*
|
|
8049
|
+
* State management only — does NOT fire events (no `onClick`, no `onChange`)
|
|
8050
|
+
* and does NOT open drop / menu / color overlays. For full UI interaction
|
|
8051
|
+
* including opening pickers, call `click(id)` instead.
|
|
8052
|
+
*
|
|
8053
|
+
* Per-item behaviour:
|
|
8054
|
+
* - button / check / html / spacer / break: flips `it.checked`.
|
|
8055
|
+
* - drop / menu / menu-radio / menu-check / color / text-color: if currently
|
|
8056
|
+
* checked, closes the toolbar's `-drop` overlay via `TsTooltip.hide` before
|
|
8057
|
+
* flipping. Same overlay-close path as `uncheck()`. Never opens overlays.
|
|
8058
|
+
* - radio: emits `console.warn` and is skipped (would leave the group with
|
|
8059
|
+
* no checked member). Use `check()` / `uncheck()` for radios.
|
|
8060
|
+
* - group: recurses into `it.items` and toggles each child individually; the
|
|
8061
|
+
* group container itself is never in the effected list.
|
|
8062
|
+
* - sub-id with `:` notation: skipped (same guard as siblings).
|
|
8063
|
+
* - missing id: silently skipped.
|
|
8064
|
+
*
|
|
8065
|
+
* @param args ids of items to toggle. Varargs, independent per id.
|
|
8066
|
+
* @returns array of ids whose checked state actually flipped. Never `undefined`.
|
|
8067
|
+
*/
|
|
8068
|
+
// any: array of heterogeneous runtime values; TsToolbar item shape varies by `type` at runtime
|
|
8069
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8070
|
+
toggle(...args) {
|
|
8071
|
+
const effected = [];
|
|
8072
|
+
args.flat().forEach((item) => {
|
|
8073
|
+
const it = this.get(item);
|
|
8074
|
+
if (!it || String(item).indexOf(":") != -1) return;
|
|
8075
|
+
if (it.type == "radio") {
|
|
8076
|
+
console.warn(`TsToolbar.toggle: radio items are not supported, use check()/uncheck() instead. Item: ${item}`);
|
|
8077
|
+
return;
|
|
8078
|
+
}
|
|
8079
|
+
if (it.type == "group") {
|
|
8080
|
+
const childIds = it.items.map((itm) => itm.id);
|
|
8081
|
+
const childEffected = this.toggle(...childIds);
|
|
8082
|
+
effected.push(...childEffected);
|
|
8083
|
+
return;
|
|
8084
|
+
}
|
|
8085
|
+
const newChecked = !it.checked;
|
|
8086
|
+
if (["menu", "menu-radio", "menu-check", "drop", "color", "text-color"].includes(it.type) && it.checked) {
|
|
8087
|
+
TsTooltip.hide(this.name + "-drop");
|
|
8088
|
+
}
|
|
8089
|
+
it.checked = newChecked;
|
|
8090
|
+
effected.push(String(item).split(":")[0]);
|
|
8091
|
+
});
|
|
8092
|
+
this._refresh({ effected });
|
|
8093
|
+
return effected;
|
|
8094
|
+
}
|
|
7976
8095
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7977
8096
|
click(id, event2) {
|
|
7978
8097
|
const tmp = String(id).split(":");
|
|
@@ -8260,7 +8379,7 @@ var TsToolbar = class extends TsBase {
|
|
|
8260
8379
|
const next = parseInt(this.get(id, true)) + 1;
|
|
8261
8380
|
let $next = query10(this.box).find(`#tb_${this.name}_item_${TsUtils.escapeId(this.items[next] ? this.items[next].id : "--")}`);
|
|
8262
8381
|
if ($next.length == 0) {
|
|
8263
|
-
$next = query10(this.box).find(`.tsg-tb-line:nth-child(${it.line}`).find(".tsg-tb-right").before(html);
|
|
8382
|
+
$next = query10(this.box).find(`.tsg-tb-line:nth-child(${it.line})`).find(".tsg-tb-right").before(html);
|
|
8264
8383
|
} else {
|
|
8265
8384
|
$next.after(html);
|
|
8266
8385
|
}
|
|
@@ -8318,6 +8437,8 @@ var TsToolbar = class extends TsBase {
|
|
|
8318
8437
|
destroy() {
|
|
8319
8438
|
const edata = this.trigger("destroy", { target: this.name });
|
|
8320
8439
|
if (edata.isCancelled === true) return;
|
|
8440
|
+
TsTooltip.hide(this.name + "-tooltip");
|
|
8441
|
+
TsTooltip.hide(this.name + "-drop");
|
|
8321
8442
|
if (query10(this.box).find(".tsg-scroll-wrapper").length > 0) {
|
|
8322
8443
|
this.unmount();
|
|
8323
8444
|
}
|
|
@@ -8383,6 +8504,7 @@ var TsToolbar = class extends TsBase {
|
|
|
8383
8504
|
}
|
|
8384
8505
|
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
8506
|
}
|
|
8507
|
+
// falls through
|
|
8386
8508
|
case "menu":
|
|
8387
8509
|
case "menu-check":
|
|
8388
8510
|
case "menu-radio":
|
|
@@ -8467,7 +8589,7 @@ var TsToolbar = class extends TsBase {
|
|
|
8467
8589
|
}
|
|
8468
8590
|
case "group": {
|
|
8469
8591
|
html = `<div id="tb_${this.name}_item_${item.id}" class="tsg-tb-group"
|
|
8470
|
-
style="display:
|
|
8592
|
+
style="display: ${item.hidden ? "none" : "flex"}; ${item.style ? item.style : ""}">`;
|
|
8471
8593
|
if (Array.isArray(item.items)) {
|
|
8472
8594
|
item.items.forEach((it) => {
|
|
8473
8595
|
html += this.getItemHTML(it);
|
|
@@ -8532,8 +8654,11 @@ var TsToolbar = class extends TsBase {
|
|
|
8532
8654
|
if (it.input?.spinner || it.input?.min != null || it.input?.max != null || it.input?.step != null) {
|
|
8533
8655
|
value = parseFloat(value);
|
|
8534
8656
|
}
|
|
8535
|
-
if (it.input?.suffix != null
|
|
8536
|
-
|
|
8657
|
+
if (it.input?.suffix != null) {
|
|
8658
|
+
const strValue = String(value);
|
|
8659
|
+
if (strValue.substr(-it.input.suffix.length) == it.input.suffix) {
|
|
8660
|
+
value = strValue.substr(0, strValue.length - it.input.suffix.length);
|
|
8661
|
+
}
|
|
8537
8662
|
}
|
|
8538
8663
|
if (it.input?.min != null && it.input.min > value) {
|
|
8539
8664
|
value = it.input.min;
|
|
@@ -8680,7 +8805,10 @@ var TsToolbar = class extends TsBase {
|
|
|
8680
8805
|
mouseAction(event2, target, action, id) {
|
|
8681
8806
|
const btn = this.get(id);
|
|
8682
8807
|
const edata = this.trigger("mouse" + action, { target: id, item: btn, object: btn, originalEvent: event2 });
|
|
8683
|
-
if (edata.isCancelled === true || btn.disabled || btn.hidden)
|
|
8808
|
+
if (edata.isCancelled === true || btn.disabled || btn.hidden) {
|
|
8809
|
+
edata.finish();
|
|
8810
|
+
return;
|
|
8811
|
+
}
|
|
8684
8812
|
switch (action) {
|
|
8685
8813
|
case "Enter":
|
|
8686
8814
|
if (!["label", "input"].includes(btn.type)) {
|