@datarailsshared/dr_renderer 1.2.98 → 1.2.101
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/src/dr_pivottable.js +12 -3
- package/src/novix_renderer.js +1 -1
- package/src/published_items_renderer.js +92 -69
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -646,10 +646,10 @@ let initDRPivotTable = function($, window, document) {
|
|
|
646
646
|
getColorsWithOffsetForTable = function (value) {
|
|
647
647
|
var colors = [];
|
|
648
648
|
|
|
649
|
-
if (opts.paletteOptions.widgetPalette) {
|
|
649
|
+
if (opts.paletteOptions && opts.paletteOptions.widgetPalette) {
|
|
650
650
|
const mc_palette = _.find(_.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
|
|
651
651
|
colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
|
|
652
|
-
} else if (opts.paletteOptions.dashboardPalette && opts.paletteOptions.dashboardPalette.colors) {
|
|
652
|
+
} else if (opts.paletteOptions && opts.paletteOptions.dashboardPalette && opts.paletteOptions.dashboardPalette.colors) {
|
|
653
653
|
colors = opts.paletteOptions.dashboardPalette.colors;
|
|
654
654
|
} else {
|
|
655
655
|
colors = newTableColors;
|
|
@@ -1421,13 +1421,18 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1421
1421
|
"data-rownode": rowHeader.node
|
|
1422
1422
|
}, getTableEventHandlers(val, rowHeader.key, []));
|
|
1423
1423
|
|
|
1424
|
+
if (rowHeader.children.length && rowHeader.clickStatus === 'expanded') {
|
|
1425
|
+
td.style.display = 'none';
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1424
1428
|
tr.appendChild(td)
|
|
1425
1429
|
}
|
|
1426
1430
|
}
|
|
1427
1431
|
|
|
1428
1432
|
buildAdditionalRowValues = function (tr, colHeaderCols, rowKey) {
|
|
1429
1433
|
for (let i = 0; i < colHeaderCols.length; i++) {
|
|
1430
|
-
const
|
|
1434
|
+
const colHeader = colHeaderCols[i];
|
|
1435
|
+
const colKey = colHeader.flatKey;
|
|
1431
1436
|
const totalAggregator = getAdditionalAggregation(rowKey, colKey);
|
|
1432
1437
|
const val = totalAggregator.value();
|
|
1433
1438
|
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
@@ -1439,6 +1444,10 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1439
1444
|
"data-colnode": "" + i
|
|
1440
1445
|
});
|
|
1441
1446
|
|
|
1447
|
+
if (colHeader.children.length && colHeader.clickStatus === 'expanded') {
|
|
1448
|
+
td.style.display = 'none';
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1442
1451
|
tr.appendChild(td);
|
|
1443
1452
|
}
|
|
1444
1453
|
|
package/src/novix_renderer.js
CHANGED
|
@@ -304,7 +304,7 @@ let initNovixRenderer = function($, window, document, Handsontable){
|
|
|
304
304
|
dataSource.fixedColumns = pvtData.rowAttrs.length + (hasColumnAttr ? 1 : 0);
|
|
305
305
|
dataSource.fixedRows = pvtData.colAttrs.length + (hasRowAttr ? 1 : 0);
|
|
306
306
|
|
|
307
|
-
for (i = 0; i < pvtData.rowAttrs.length; i++) {
|
|
307
|
+
for (let i = 0; i < pvtData.rowAttrs.length; i++) {
|
|
308
308
|
rowKeys.sort((a,b) => {
|
|
309
309
|
if (_.isEqual(a.slice(0, i), b.slice(0,i)) && a[i] && a[i] === subtotal) return -1;
|
|
310
310
|
if (_.isEqual(a.slice(0, i), b.slice(0,i)) && b[i] && b[i] === subtotal) return 1;
|
|
@@ -18,74 +18,78 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
publishedItemsRenderer.resizeTable = function (options,
|
|
21
|
+
publishedItemsRenderer.resizeTable = function (options, iframeWindow) {
|
|
22
22
|
options.alreadySetTimeout = null;
|
|
23
|
-
const publish_item_image =
|
|
24
|
-
const table =
|
|
25
|
-
const body =
|
|
26
|
-
let body_zoom = body.style.zoom;
|
|
27
|
-
body_zoom = parseFloat(body_zoom);
|
|
23
|
+
const publish_item_image = iframeWindow.document.getElementById('publish_item_image');
|
|
24
|
+
const table = iframeWindow.document.getElementsByTagName("table")[0];
|
|
25
|
+
const body = iframeWindow.document.getElementsByTagName("body")[0];
|
|
28
26
|
|
|
29
|
-
if (
|
|
30
|
-
|
|
27
|
+
if (table && options.responsive) {
|
|
28
|
+
publishedItemsRenderer.zoomTable(iframeWindow, table, body);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
zoom = parseFloat(zoom);
|
|
31
|
+
publishedItemsRenderer.resizePublishedImage(publish_item_image, iframeWindow, body);
|
|
32
|
+
}
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
publishedItemsRenderer.zoomTable = function(iframeWindow, table, body) {
|
|
35
|
+
let body_zoom = body.style.zoom;
|
|
36
|
+
body_zoom = parseFloat(body_zoom) || 1;
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
publishedItemsRenderer.resizeTable(options, window);
|
|
53
|
-
}, 10);
|
|
54
|
-
}
|
|
55
|
-
} else if (height >= window.innerHeight || width >= window.innerWidth) {
|
|
56
|
-
zoom -= 0.05;
|
|
57
|
-
height = (positionInfo.height + positionInfo.y * 2) * zoom * body_zoom;
|
|
58
|
-
width = (positionInfo.width + positionInfo.x * 2) * zoom * body_zoom;
|
|
38
|
+
let zoom = table.style.zoom;
|
|
39
|
+
zoom = parseFloat(zoom) || 1;
|
|
40
|
+
|
|
41
|
+
const positionInfo = table.getBoundingClientRect();
|
|
42
|
+
let width = Math.ceil((positionInfo.width + iframeWindow.innerWidth - iframeWindow.document.body.offsetWidth) * zoom * body_zoom);
|
|
43
|
+
|
|
44
|
+
if (width < iframeWindow.innerWidth) {
|
|
45
|
+
zoom += 0.05;
|
|
46
|
+
|
|
47
|
+
width = Math.ceil((positionInfo.width + iframeWindow.innerWidth - iframeWindow.document.body.offsetWidth) * zoom * body_zoom);
|
|
48
|
+
if (width < iframeWindow.innerWidth) {
|
|
59
49
|
table.style.zoom = zoom;
|
|
60
|
-
if (height >= window.innerHeight || width >= window.innerWidth) {
|
|
61
|
-
setTimeout(function () {
|
|
62
|
-
publishedItemsRenderer.resizeTable(options, window);
|
|
63
|
-
}, 10);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (publish_item_image) {
|
|
68
|
-
if (publish_item_image.style.height === '100%') {
|
|
69
|
-
publish_item_image.style.height = 'auto';
|
|
70
|
-
publish_item_image.style.width = '100%';
|
|
71
|
-
publish_item_image.style.marginTop = "";
|
|
72
50
|
setTimeout(function () {
|
|
73
|
-
publishedItemsRenderer.
|
|
51
|
+
publishedItemsRenderer.zoomTable(iframeWindow, table, body);
|
|
74
52
|
}, 10);
|
|
75
53
|
}
|
|
54
|
+
} else if (width >= iframeWindow.innerWidth) {
|
|
55
|
+
zoom -= 0.05;
|
|
76
56
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const temp = (window.innerHeight - height) / 2;
|
|
84
|
-
publish_item_image.style.marginTop = (temp / body_zoom + imgPositionInfo.y) + "px";
|
|
57
|
+
width = Math.ceil((positionInfo.width + iframeWindow.innerWidth - iframeWindow.document.body.offsetWidth) * zoom * body_zoom);
|
|
58
|
+
table.style.zoom = zoom;
|
|
59
|
+
if (width >= iframeWindow.innerWidth) {
|
|
60
|
+
setTimeout(function () {
|
|
61
|
+
publishedItemsRenderer.zoomTable(iframeWindow, table, body);
|
|
62
|
+
}, 10);
|
|
85
63
|
}
|
|
86
64
|
}
|
|
87
65
|
}
|
|
88
66
|
|
|
67
|
+
publishedItemsRenderer.resizePublishedImage = function(publish_item_image, iframeWindow, body) {
|
|
68
|
+
if (!publish_item_image) return;
|
|
69
|
+
|
|
70
|
+
let body_zoom = body.style.zoom;
|
|
71
|
+
body_zoom = parseFloat(body_zoom) || 1;
|
|
72
|
+
|
|
73
|
+
if (publish_item_image.style.height === '100%') {
|
|
74
|
+
publish_item_image.style.height = 'auto';
|
|
75
|
+
publish_item_image.style.width = '100%';
|
|
76
|
+
publish_item_image.style.marginTop = "";
|
|
77
|
+
setTimeout(function () {
|
|
78
|
+
publishedItemsRenderer.resizePublishedImage(publish_item_image, iframeWindow, body);
|
|
79
|
+
}, 10);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const imgPositionInfo = publish_item_image.getBoundingClientRect();
|
|
83
|
+
const height = (imgPositionInfo.height + imgPositionInfo.y * 2) * body_zoom;
|
|
84
|
+
if (height > iframeWindow.innerHeight) {
|
|
85
|
+
publish_item_image.style.height = '100%';
|
|
86
|
+
publish_item_image.style.width = 'auto';
|
|
87
|
+
} else if (height < iframeWindow.innerHeight) {
|
|
88
|
+
const temp = (iframeWindow.innerHeight - height) / 2;
|
|
89
|
+
publish_item_image.style.marginTop = (temp / body_zoom + imgPositionInfo.y) + "px";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
89
93
|
publishedItemsRenderer.resetTableZoom = function (document) {
|
|
90
94
|
const table = document.getElementsByTagName("table")[0];
|
|
91
95
|
if (table) {
|
|
@@ -93,16 +97,22 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
publishedItemsRenderer.changedAutoResize = function (options,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
publishedItemsRenderer.changedAutoResize = function (options, iframeWindow, document) {
|
|
101
|
+
Object.assign(iframeWindow.__options__, options);
|
|
102
|
+
const table = document.getElementsByTagName("table")[0];
|
|
103
|
+
if (table) {
|
|
104
|
+
table.style.margin = options.responsive ? '0 auto' : '';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!options.responsive) {
|
|
108
|
+
publishedItemsRenderer.resetTableZoom(document);
|
|
109
|
+
} else {
|
|
110
|
+
if (!options.alreadySetTimeout) {
|
|
111
|
+
options.alreadySetTimeout = setTimeout(function () {
|
|
112
|
+
publishedItemsRenderer.resizeTable(options, iframeWindow);
|
|
113
|
+
}, 100);
|
|
105
114
|
}
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
publishedItemsRenderer.changedInputValue = function (firstTime, scope, options) {
|
|
@@ -312,18 +322,18 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
312
322
|
}
|
|
313
323
|
}
|
|
314
324
|
|
|
315
|
-
publishedItemsRenderer.addEventListeners = function (document,
|
|
325
|
+
publishedItemsRenderer.addEventListeners = function (document, iframeWindow, scope, options) {
|
|
316
326
|
document.addEventListener("DOMContentLoaded", function () {
|
|
317
327
|
if (!options.alreadySetTimeout) {
|
|
318
328
|
options.alreadySetTimeout = setTimeout(function () {
|
|
319
|
-
publishedItemsRenderer.resizeTable(options,
|
|
329
|
+
publishedItemsRenderer.resizeTable(options, iframeWindow);
|
|
320
330
|
}, 50);
|
|
321
331
|
}
|
|
322
332
|
});
|
|
323
|
-
|
|
333
|
+
iframeWindow.addEventListener("resize", function () {
|
|
324
334
|
if (!options.alreadySetTimeout) {
|
|
325
335
|
options.alreadySetTimeout = setTimeout(function () {
|
|
326
|
-
publishedItemsRenderer.resizeTable(
|
|
336
|
+
publishedItemsRenderer.resizeTable(iframeWindow.__options__, iframeWindow);
|
|
327
337
|
}, 100);
|
|
328
338
|
}
|
|
329
339
|
});
|
|
@@ -334,7 +344,7 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
334
344
|
let td_elem = all_a_hrefs[i].closest('td');
|
|
335
345
|
td_elem.classList.add("apply_hover");
|
|
336
346
|
td_elem.addEventListener('click', function (event) {
|
|
337
|
-
publishedItemsRenderer.formulaCellClicked(event, scope, options,
|
|
347
|
+
publishedItemsRenderer.formulaCellClicked(event, scope, options, iframeWindow)
|
|
338
348
|
});
|
|
339
349
|
}
|
|
340
350
|
}
|
|
@@ -348,17 +358,30 @@ let getPublishedItemsRenderer = function (publishedItemsRenderer) {
|
|
|
348
358
|
return this.options.inputValuesData;
|
|
349
359
|
}
|
|
350
360
|
|
|
351
|
-
publishedItemsRenderer.initPublishedItem = function (document,
|
|
361
|
+
publishedItemsRenderer.initPublishedItem = function (document, iframeWindow, scope, options) {
|
|
352
362
|
this.document = document;
|
|
353
363
|
this.scope = scope;
|
|
354
364
|
this.options = options;
|
|
365
|
+
iframeWindow.__options__ = options;
|
|
355
366
|
publishedItemsRenderer.prepareInputCells(document, scope, options, this.isScenarioMode);
|
|
356
|
-
publishedItemsRenderer.
|
|
367
|
+
publishedItemsRenderer.applyInitDocumentStyles(document, iframeWindow);
|
|
368
|
+
publishedItemsRenderer.addEventListeners(document, iframeWindow, scope, options);
|
|
357
369
|
|
|
358
370
|
setTimeout(function () {
|
|
359
371
|
publishedItemsRenderer.changedInputValue(true, scope, options);
|
|
360
372
|
}, 500);
|
|
361
373
|
}
|
|
374
|
+
|
|
375
|
+
publishedItemsRenderer.applyInitDocumentStyles = function(document, iframeWindow) {
|
|
376
|
+
const table = document.getElementsByTagName('table')[0];
|
|
377
|
+
if (table) {
|
|
378
|
+
table.style.overflow = 'hidden';
|
|
379
|
+
table.style.margin = iframeWindow.__options__.responsive ? '0 auto' : '';
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const body = document.body;
|
|
383
|
+
body.style.margin = '0';
|
|
384
|
+
}
|
|
362
385
|
}
|
|
363
386
|
|
|
364
387
|
module.exports = getPublishedItemsRenderer;
|