@datalabz_/dashboard-kit 6.0.11 → 6.0.12

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 (4) hide show
  1. package/package.json +1 -1
  2. package/v4.js +1 -1
  3. package/v5.js +1 -1
  4. package/v6.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalabz_/dashboard-kit",
3
- "version": "6.0.11",
3
+ "version": "6.0.12",
4
4
  "description": "DashboardKit runtime + styles, served from jsDelivr",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
package/v4.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '679acd7'; // replaced at deploy: sed -i "s/679acd7/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v5.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '679acd7'; // replaced at deploy: sed -i "s/679acd7/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v6.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '679acd7'; // replaced at deploy: sed -i "s/679acd7/$(git rev-parse --short HEAD)/g" v6.js
23
+ let _gitVer = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v6.js
24
24
  let _calls = []; // System Info call log
25
25
  let _pageErrors = []; // System Info: errors no load() caught (a handler's, a timer's, the page script's)
26
26
  let _sectionErrors = {}; // sectionId → error count
@@ -1090,6 +1090,15 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1090
1090
  return n.toFixed(typeof decimals === 'number' ? decimals : 2) + '%';
1091
1091
  }
1092
1092
 
1093
+ // A ratio shown as a percentage: 0.123 → 12.30%, where formatPercent takes 12.3. Which one a
1094
+ // value is, the call says, and the ×100 is the kit's: in a page, null * 100 is 0, so a ratio
1095
+ // with no base (NULLIF) would show 0.00% instead of —. Same type-check as _fmtDate.
1096
+ function formatRatio(v, decimals) {
1097
+ const n = parseFloat(v);
1098
+ if (isNaN(n)) return '—';
1099
+ return formatPercent(n * 100, decimals);
1100
+ }
1101
+
1093
1102
  function colorClass(v) {
1094
1103
  const n = Number(v);
1095
1104
  return n > 0 ? 'pos' : n < 0 ? 'neg' : '';
@@ -1633,6 +1642,7 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1633
1642
  runQuery: function (s, l, q, a, p) { return runQuery(s, l, q, a, p, running ? gen : null); },
1634
1643
  formatCurrency,
1635
1644
  formatPercent,
1645
+ formatRatio,
1636
1646
  formatInteger: fmtInt,
1637
1647
  formatDate: fmtDate,
1638
1648
  formatDatetime: fmtDatetime,
@@ -3304,6 +3314,7 @@ html[data-dk-setup="true"] .dk-resp-toggle {
3304
3314
  formatCurrency,
3305
3315
  formatInteger: fmtInt,
3306
3316
  formatPercent,
3317
+ formatRatio,
3307
3318
  formatDate: fmtDate,
3308
3319
  formatDatetime: fmtDatetime,
3309
3320
  colorClass,
@@ -3322,8 +3333,8 @@ html[data-dk-setup="true"] .dk-resp-toggle {
3322
3333
  // it, where a declaration here would make that a SyntaxError. A name the window already holds for
3323
3334
  // something else is left as it is.
3324
3335
  ['runQuery', 'renderTable', 'renderKpiCard', 'renderKpiStrip', 'renderInfoGrid', 'renderTotalsStrip',
3325
- 'formatCurrency', 'formatInteger', 'formatPercent', 'formatDate', 'formatDatetime', 'colorClass',
3326
- 'escHtml'].forEach(function (name) {
3336
+ 'formatCurrency', 'formatInteger', 'formatPercent', 'formatRatio', 'formatDate', 'formatDatetime',
3337
+ 'colorClass', 'escHtml'].forEach(function (name) {
3327
3338
  const ours = earlier && global[name] === earlier[name];
3328
3339
  if (Object.prototype.hasOwnProperty.call(global, name) && !ours) {
3329
3340
  console.warn('[DashboardKit] window.' + name + ' is already taken; use DashboardKit.' + name);