@datalabz_/dashboard-kit 6.0.12 → 6.0.13

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 +20 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalabz_/dashboard-kit",
3
- "version": "6.0.12",
3
+ "version": "6.0.13",
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 = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'df0ab1d'; // replaced at deploy: sed -i "s/df0ab1d/$(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 = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'df0ab1d'; // replaced at deploy: sed -i "s/df0ab1d/$(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 = '79c14b3'; // replaced at deploy: sed -i "s/79c14b3/$(git rev-parse --short HEAD)/g" v6.js
23
+ let _gitVer = 'df0ab1d'; // replaced at deploy: sed -i "s/df0ab1d/$(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
@@ -2696,12 +2696,26 @@ html[data-dk-setup="true"] .dk-resp-toggle {
2696
2696
  html += '<td>' + esc(cell ?? '—') + '</td>';
2697
2697
  } else if (cell && cell.agg === 'sum') {
2698
2698
  const sum = rows.reduce(function (a, r) { return a + (Number(r[cell.key]) || 0); }, 0);
2699
- const fmt = col.format || function (v) { return v; };
2700
- // Totals have no single row; pass an empty row so a per-row-currency
2701
- // formatter degrades gracefully instead of throwing. Don't sum a
2702
- // mixed-currency column (see the all-currencies note in the docs).
2703
2699
  let out;
2704
- try { out = fmt(sum, {}); } catch { out = '—'; }
2700
+ if (cell.currency !== undefined) {
2701
+ // A money total bound to the rows' currency field: one currency, the sum in it; more than
2702
+ // one (a row without any counts as one more), — rather than a number of mixed money.
2703
+ if (typeof cell.currency !== 'string' || !cell.currency) {
2704
+ throw new Error('renderTable: totalsRow[' + i + '].currency must name the rows\' currency field, such as "currency"');
2705
+ }
2706
+ const seen = {};
2707
+ rows.forEach(function (r) {
2708
+ const c = r[cell.currency];
2709
+ seen[typeof c === 'string' ? c : ''] = true;
2710
+ });
2711
+ const found = Object.keys(seen);
2712
+ out = found.length > 1 ? '—' : formatCurrency(sum, found[0]);
2713
+ } else {
2714
+ const fmt = col.format || function (v) { return v; };
2715
+ // Totals have no single row; pass an empty row so a per-row-currency
2716
+ // formatter degrades gracefully instead of throwing.
2717
+ try { out = fmt(sum, {}); } catch { out = '—'; }
2718
+ }
2705
2719
  html += '<td>' + totalsSlots.html(out, '—') + '</td>';
2706
2720
  } else {
2707
2721
  html += '<td>—</td>';