@datalabz_/dashboard-kit 6.0.12 → 6.0.14

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 +23 -7
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.14",
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 = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(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 = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(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 = 'a5476b3'; // replaced at deploy: sed -i "s/a5476b3/$(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
@@ -1929,7 +1929,9 @@ html[data-dk-setup="true"] .dk-resp-toggle {
1929
1929
  // header's Refresh covers it.
1930
1930
  const cause = failedCall && failedCall.kind === 'transport'
1931
1931
  ? ': Network error after ' + (failedCall.clientMs / 1000).toFixed(2) + 's.'
1932
- : '';
1932
+ : failedCall && failedCall.errorCode === '57014'
1933
+ ? ': Query timed out after ' + (failedCall.clientMs / 1000).toFixed(2) + 's.'
1934
+ : '';
1933
1935
  container.innerHTML =
1934
1936
  '<div class="dk-error"><span>This view couldn\'t load' + cause + '</span>' +
1935
1937
  '<button class="dk-error-report-btn" type="button">Ask AI to fix</button></div>';
@@ -2696,12 +2698,26 @@ html[data-dk-setup="true"] .dk-resp-toggle {
2696
2698
  html += '<td>' + esc(cell ?? '—') + '</td>';
2697
2699
  } else if (cell && cell.agg === 'sum') {
2698
2700
  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
2701
  let out;
2704
- try { out = fmt(sum, {}); } catch { out = '—'; }
2702
+ if (cell.currency !== undefined) {
2703
+ // A money total bound to the rows' currency field: one currency, the sum in it; more than
2704
+ // one (a row without any counts as one more), — rather than a number of mixed money.
2705
+ if (typeof cell.currency !== 'string' || !cell.currency) {
2706
+ throw new Error('renderTable: totalsRow[' + i + '].currency must name the rows\' currency field, such as "currency"');
2707
+ }
2708
+ const seen = {};
2709
+ rows.forEach(function (r) {
2710
+ const c = r[cell.currency];
2711
+ seen[typeof c === 'string' ? c : ''] = true;
2712
+ });
2713
+ const found = Object.keys(seen);
2714
+ out = found.length > 1 ? '—' : formatCurrency(sum, found[0]);
2715
+ } else {
2716
+ const fmt = col.format || function (v) { return v; };
2717
+ // Totals have no single row; pass an empty row so a per-row-currency
2718
+ // formatter degrades gracefully instead of throwing.
2719
+ try { out = fmt(sum, {}); } catch { out = '—'; }
2720
+ }
2705
2721
  html += '<td>' + totalsSlots.html(out, '—') + '</td>';
2706
2722
  } else {
2707
2723
  html += '<td>—</td>';