tsgrid-ui 2.6.0 → 2.7.1

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, 1:17:35 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,58 @@ 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.map(
3050
+ (f) => f.length === 5 ? "locale/" + f.toLowerCase() + ".json" : f
3051
+ );
3052
+ const proms = [];
3053
+ const files = {};
3054
+ localeArr.forEach((file) => {
3055
+ proms.push(_locale(file, true, false, mergedSettings, deps));
3056
+ });
3057
+ const res = await Promise.allSettled(proms);
3058
+ res.forEach((r) => {
3059
+ if (r.status === "fulfilled" && r.value.kind === "load") {
3060
+ files[r.value.file] = r.value.data;
3061
+ }
3062
+ });
3063
+ localeArr.forEach((file) => {
3064
+ mergedSettings = deps.extend({}, mergedSettings, files[file] ?? {});
3065
+ });
3066
+ return { kind: "void", settings: mergedSettings };
3067
+ }
3068
+ if (!locale) locale = "en-us";
3069
+ if (typeof locale === "object") {
3070
+ const mergedSettings = deps.extend({}, settings, TsLocale, locale);
3071
+ return { kind: "merge", settings: mergedSettings };
3072
+ }
3073
+ let localeStr = locale;
3074
+ if (localeStr.length === 5) {
3075
+ localeStr = "locale/" + localeStr.toLowerCase() + ".json";
3076
+ }
3077
+ try {
3078
+ const res = await deps.fetch(localeStr, { method: "GET" });
3079
+ const data = await res.json();
3080
+ if (noMerge !== true) {
3081
+ if (keepPhrases) {
3082
+ const newSettings = deps.extend({}, settings, data);
3083
+ return { kind: "load", file: localeStr, data, settings: newSettings };
3084
+ } else {
3085
+ const phrasesCleared = { ...settings, phrases: {} };
3086
+ const newSettings = deps.extend({}, phrasesCleared, TsLocale, data);
3087
+ return { kind: "load", file: localeStr, data, settings: newSettings };
3088
+ }
3089
+ }
3090
+ return { kind: "load", file: localeStr, data };
3091
+ } catch (err) {
3092
+ console.log("ERROR: Cannot load locale " + localeStr);
3093
+ throw err;
3094
+ }
3095
+ }
3096
+
3045
3097
  // src/tsutils.ts
3046
3098
  var query7 = query;
3047
3099
  var Utils = class {
@@ -3525,52 +3577,13 @@ var Utils = class {
3525
3577
  return this.execTemplate(translation, params);
3526
3578
  }
3527
3579
  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
- });
3580
+ const deps = {
3581
+ extend: this.extend.bind(this),
3582
+ fetch: globalThis.fetch.bind(globalThis)
3583
+ };
3584
+ return _locale(locale, keepPhrases, noMerge, this.settings, deps).then((result) => {
3585
+ if (result.settings) this.settings = result.settings;
3586
+ return result.kind === "load" ? { file: result.file, data: result.data } : void 0;
3574
3587
  });
3575
3588
  }
3576
3589
  scrollBarSize() {