@datalabz_/dashboard-kit 6.0.8 → 6.0.9
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/package.json +1 -1
- package/v4.js +1 -1
- package/v5.js +1 -1
- package/v6.js +35 -2
package/package.json
CHANGED
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 = '
|
|
23
|
+
let _gitVer = 'b94b380'; // replaced at deploy: sed -i "s/b94b380/$(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 = '
|
|
23
|
+
let _gitVer = 'b94b380'; // replaced at deploy: sed -i "s/b94b380/$(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 = '
|
|
23
|
+
let _gitVer = 'b94b380'; // replaced at deploy: sed -i "s/b94b380/$(git rev-parse --short HEAD)/g" v6.js
|
|
24
24
|
let _calls = []; // System Info call log
|
|
25
25
|
let _sectionErrors = {}; // sectionId → error count
|
|
26
26
|
let _generation = 0;
|
|
@@ -1605,6 +1605,8 @@ html[data-dk-setup="true"] .dk-resp-toggle {
|
|
|
1605
1605
|
// What a click point drawn by this load reports: this section, and the header filters and the
|
|
1606
1606
|
// context as the load started, not edits made since.
|
|
1607
1607
|
const ctx = { id: sec.id, localFilters: _headerSnapshot(), context: _contextSnapshot() };
|
|
1608
|
+
// Kept on the section for a render call that arrives without it (_ctxOf).
|
|
1609
|
+
sec.ctx = ctx;
|
|
1608
1610
|
try {
|
|
1609
1611
|
await sec.load({
|
|
1610
1612
|
runQuery,
|
|
@@ -1945,6 +1947,15 @@ html[data-dk-setup="true"] .dk-resp-toggle {
|
|
|
1945
1947
|
}
|
|
1946
1948
|
}
|
|
1947
1949
|
|
|
1950
|
+
// A render call by its global name, or as DashboardKit.<render>, carries no ctx. Its section is
|
|
1951
|
+
// then the panel the container sits in, with the context that section's latest load started with.
|
|
1952
|
+
// A container outside every panel has none, and its points read the filters as they are now.
|
|
1953
|
+
function _ctxOf(container) {
|
|
1954
|
+
const panel = container.closest ? container.closest('.dk-panel') : null;
|
|
1955
|
+
const sec = panel && _sections.find(function (s) { return 'dk-panel-' + s.id === panel.id; });
|
|
1956
|
+
return sec ? sec.ctx : undefined;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1948
1959
|
function _forgetPoints(container) {
|
|
1949
1960
|
if (container.id) delete _pointsByContainer[container.id];
|
|
1950
1961
|
_schedulePoints();
|
|
@@ -2001,6 +2012,7 @@ html[data-dk-setup="true"] .dk-resp-toggle {
|
|
|
2001
2012
|
|
|
2002
2013
|
function _registerPointsUnsafe(container, selector, ctx, spec) {
|
|
2003
2014
|
if (!container.id) return;
|
|
2015
|
+
ctx = ctx || _ctxOf(container);
|
|
2004
2016
|
const count = {};
|
|
2005
2017
|
spec.names.forEach(function (n) { count[n] = (count[n] || 0) + 1; });
|
|
2006
2018
|
const localFilters = ctx ? ctx.localFilters : _headerSnapshot();
|
|
@@ -3203,7 +3215,8 @@ html[data-dk-setup="true"] .dk-resp-toggle {
|
|
|
3203
3215
|
};
|
|
3204
3216
|
},
|
|
3205
3217
|
// Helpers are also passed into each load() function — that is the canonical
|
|
3206
|
-
// way to use them. They are mirrored here so DashboardKit.<helper>(…) works too
|
|
3218
|
+
// way to use them. They are mirrored here so DashboardKit.<helper>(…) works too,
|
|
3219
|
+
// and set as global names below.
|
|
3207
3220
|
runQuery,
|
|
3208
3221
|
setSectionState,
|
|
3209
3222
|
renderTable,
|
|
@@ -3220,6 +3233,26 @@ html[data-dk-setup="true"] .dk-resp-toggle {
|
|
|
3220
3233
|
escHtml: esc,
|
|
3221
3234
|
};
|
|
3222
3235
|
|
|
3236
|
+
// Set when the page loads the kit twice: the global names then still hold the first copy's helpers.
|
|
3237
|
+
const earlier = global.DashboardKit;
|
|
3223
3238
|
global.DashboardKit = DashboardKit;
|
|
3224
3239
|
|
|
3240
|
+
// The helpers as global names too, so a call outside the load() that lists it — a helper the
|
|
3241
|
+
// load() left out of its list, or one called from a function at the top of the script — finds it
|
|
3242
|
+
// instead of throwing a ReferenceError that shows only once its tab is opened. A load() argument
|
|
3243
|
+
// of the same name still wins inside that load(). Assigned, never declared: an assigned property
|
|
3244
|
+
// is configurable, so a page's own `function escHtml` or `const formatDate` still declares over
|
|
3245
|
+
// it, where a declaration here would make that a SyntaxError. A name the window already holds for
|
|
3246
|
+
// something else is left as it is.
|
|
3247
|
+
['runQuery', 'renderTable', 'renderKpiCard', 'renderKpiStrip', 'renderInfoGrid', 'renderTotalsStrip',
|
|
3248
|
+
'formatCurrency', 'formatInteger', 'formatPercent', 'formatDate', 'formatDatetime', 'colorClass',
|
|
3249
|
+
'escHtml'].forEach(function (name) {
|
|
3250
|
+
const ours = earlier && global[name] === earlier[name];
|
|
3251
|
+
if (Object.prototype.hasOwnProperty.call(global, name) && !ours) {
|
|
3252
|
+
console.warn('[DashboardKit] window.' + name + ' is already taken; use DashboardKit.' + name);
|
|
3253
|
+
} else {
|
|
3254
|
+
global[name] = DashboardKit[name];
|
|
3255
|
+
}
|
|
3256
|
+
});
|
|
3257
|
+
|
|
3225
3258
|
}(window));
|