tsgrid-ui 2.6.0 → 2.7.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/dist/tsgrid-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- /* tsgrid-ui 1.0.x (nightly) (5/13/2026, 10:54:35 PM) (c) 2014 vitmalina@gmail.com, (c) 2026 DaverSoGT — MIT */
1
+ /* tsgrid-ui 1.0.x (nightly) (5/14/2026, 12:10:16 AM) (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;
@@ -3042,6 +3042,59 @@ function _date(dateStr, settings, deps) {
3042
3042
  return '<span title="' + dd1 + " " + time2 + '">' + dsp + "</span>";
3043
3043
  }
3044
3044
 
3045
+ // src/tsutils-locale.ts
3046
+ async function _locale(locale, keepPhrases, noMerge, settings, deps) {
3047
+ if (Array.isArray(locale)) {
3048
+ let mergedSettings = deps.extend({}, settings, { phrases: {} });
3049
+ const localeArr = locale;
3050
+ const proms = [];
3051
+ const files = {};
3052
+ localeArr.forEach((file, ind) => {
3053
+ if (file.length === 5) {
3054
+ file = "locale/" + file.toLowerCase() + ".json";
3055
+ localeArr[ind] = file;
3056
+ }
3057
+ proms.push(_locale(file, true, false, mergedSettings, deps));
3058
+ });
3059
+ const res = await Promise.allSettled(proms);
3060
+ res.forEach((r) => {
3061
+ if (r.status === "fulfilled" && r.value.kind === "load") {
3062
+ files[r.value.file] = r.value.data;
3063
+ }
3064
+ });
3065
+ localeArr.forEach((file) => {
3066
+ mergedSettings = deps.extend({}, mergedSettings, files[file] ?? {});
3067
+ });
3068
+ return { kind: "void", settings: mergedSettings };
3069
+ }
3070
+ if (!locale) locale = "en-us";
3071
+ if (typeof locale === "object") {
3072
+ const mergedSettings = deps.extend({}, settings, TsLocale, locale);
3073
+ return { kind: "merge", settings: mergedSettings };
3074
+ }
3075
+ let localeStr = locale;
3076
+ if (localeStr.length === 5) {
3077
+ localeStr = "locale/" + localeStr.toLowerCase() + ".json";
3078
+ }
3079
+ try {
3080
+ const res = await deps.fetch(localeStr, { method: "GET" });
3081
+ const data = await res.json();
3082
+ if (noMerge !== true) {
3083
+ if (keepPhrases) {
3084
+ const newSettings = deps.extend({}, settings, data);
3085
+ return { kind: "load", file: localeStr, data, settings: newSettings };
3086
+ } else {
3087
+ const newSettings = deps.extend({}, settings, TsLocale, { phrases: {} }, data);
3088
+ return { kind: "load", file: localeStr, data, settings: newSettings };
3089
+ }
3090
+ }
3091
+ return { kind: "load", file: localeStr, data };
3092
+ } catch (err) {
3093
+ console.log("ERROR: Cannot load locale " + localeStr);
3094
+ throw err;
3095
+ }
3096
+ }
3097
+
3045
3098
  // src/tsutils.ts
3046
3099
  var query7 = query;
3047
3100
  var Utils = class {
@@ -3525,52 +3578,13 @@ var Utils = class {
3525
3578
  return this.execTemplate(translation, params);
3526
3579
  }
3527
3580
  locale(locale, keepPhrases, noMerge) {
3528
- return new Promise((resolve, reject) => {
3529
- if (Array.isArray(locale)) {
3530
- this.settings.phrases = {};
3531
- const proms = [];
3532
- const files = {};
3533
- const localeArr = locale;
3534
- localeArr.forEach((file, ind) => {
3535
- if (file.length === 5) {
3536
- file = "locale/" + file.toLowerCase() + ".json";
3537
- localeArr[ind] = file;
3538
- }
3539
- proms.push(this.locale(file, true, false));
3540
- });
3541
- Promise.allSettled(proms).then((res) => {
3542
- res.forEach((r) => {
3543
- if (r.value) files[r.value.file] = r.value.data;
3544
- });
3545
- localeArr.forEach((file) => {
3546
- this.settings = this.extend({}, this.settings, files[file]);
3547
- });
3548
- resolve();
3549
- });
3550
- return;
3551
- }
3552
- if (!locale) locale = "en-us";
3553
- if (typeof locale === "object") {
3554
- this.settings = this.extend({}, this.settings, TsLocale, locale);
3555
- return;
3556
- }
3557
- let localeStr = locale;
3558
- if (localeStr.length === 5) {
3559
- localeStr = "locale/" + localeStr.toLowerCase() + ".json";
3560
- }
3561
- fetch(localeStr, { method: "GET" }).then((res) => res.json()).then((data) => {
3562
- if (noMerge !== true) {
3563
- if (keepPhrases) {
3564
- this.settings = this.extend({}, this.settings, data);
3565
- } else {
3566
- this.settings = this.extend({}, this.settings, TsLocale, { phrases: {} }, data);
3567
- }
3568
- }
3569
- resolve({ file: localeStr, data });
3570
- }).catch((err) => {
3571
- console.log("ERROR: Cannot load locale " + localeStr);
3572
- reject(err);
3573
- });
3581
+ const deps = {
3582
+ extend: this.extend.bind(this),
3583
+ fetch: globalThis.fetch.bind(globalThis)
3584
+ };
3585
+ return _locale(locale, keepPhrases, noMerge, this.settings, deps).then((result) => {
3586
+ if (result.settings) this.settings = result.settings;
3587
+ return result.kind === "load" ? { file: result.file, data: result.data } : void 0;
3574
3588
  });
3575
3589
  }
3576
3590
  scrollBarSize() {