dtable-statistic 4.1.8 → 4.1.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.
|
@@ -34,6 +34,8 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
34
34
|
var id = statItem._id;
|
|
35
35
|
var originalElement = document.querySelector("#stat-item-".concat(id, " .statistic-chart-container > div"));
|
|
36
36
|
if (originalElement) {
|
|
37
|
+
originalElement.style.width = "".concat(window.innerWidth, "px");
|
|
38
|
+
originalElement.style.height = "".concat(window.innerHeight, "px");
|
|
37
39
|
var containerWidth = originalElement.scrollWidth + 15 * 2;
|
|
38
40
|
var containerHeight = originalElement.scrollHeight + 15 * 2;
|
|
39
41
|
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
@@ -52,6 +54,10 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
52
54
|
eleA.download = "".concat(statItem.name || 'image', ".png");
|
|
53
55
|
eleA.click();
|
|
54
56
|
document.body.removeChild(exportContainer);
|
|
57
|
+
if (originalElement) {
|
|
58
|
+
originalElement.style.width = 'unset';
|
|
59
|
+
originalElement.style.height = 'unset';
|
|
60
|
+
}
|
|
55
61
|
});
|
|
56
62
|
}, 1000);
|
|
57
63
|
};
|
package/es/stat-list/index.js
CHANGED
|
@@ -4,9 +4,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
5
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
|
-
import ReactDOM from 'react-dom';
|
|
8
7
|
import GridLayout, { WidthProvider } from 'react-grid-layout';
|
|
9
|
-
import html2canvas from 'html2canvas';
|
|
10
8
|
import intl from 'react-intl-universal';
|
|
11
9
|
import ChartPreview from './chart-preview';
|
|
12
10
|
import { NewTableDialog, toaster } from '../components';
|
|
@@ -39,36 +37,6 @@ var StatList = /*#__PURE__*/function (_Component) {
|
|
|
39
37
|
_this.onLayoutChange = function (layout) {
|
|
40
38
|
_this.props.modifyDashboardLayout(layout);
|
|
41
39
|
};
|
|
42
|
-
_this.onExportChart = function (statItem) {
|
|
43
|
-
var exportContainerID = 'exported-statistic-chart-container';
|
|
44
|
-
var exportContainer = document.createElement('div');
|
|
45
|
-
exportContainer.setAttribute('id', exportContainerID);
|
|
46
|
-
|
|
47
|
-
// for charts rendered with `<canvas>`
|
|
48
|
-
var id = statItem._id;
|
|
49
|
-
var originalElement = document.querySelector("#stat-item-".concat(id, " .statistic-chart-container > div"));
|
|
50
|
-
if (originalElement) {
|
|
51
|
-
var containerWidth = originalElement.scrollWidth + 15 * 2;
|
|
52
|
-
var containerHeight = originalElement.scrollHeight + 15 * 2;
|
|
53
|
-
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
54
|
-
}
|
|
55
|
-
document.body.appendChild(exportContainer);
|
|
56
|
-
ReactDOM.render(_this.renderView(statItem), exportContainer);
|
|
57
|
-
setTimeout(function () {
|
|
58
|
-
var ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
|
|
59
|
-
if (!ele) return;
|
|
60
|
-
html2canvas(ele, {
|
|
61
|
-
windowWidth: ele.scrollWidth,
|
|
62
|
-
windowHeight: ele.scrollHeight
|
|
63
|
-
}).then(function (canvas) {
|
|
64
|
-
var eleA = document.createElement('a');
|
|
65
|
-
eleA.href = canvas.toDataURL('image/png');
|
|
66
|
-
eleA.download = "".concat(statItem.name || 'image', ".png");
|
|
67
|
-
eleA.click();
|
|
68
|
-
document.body.removeChild(exportContainer);
|
|
69
|
-
});
|
|
70
|
-
}, 1000);
|
|
71
|
-
};
|
|
72
40
|
_this.enlargeChart = function (chartIndex) {
|
|
73
41
|
_this.setState({
|
|
74
42
|
enlargedChartIndex: chartIndex
|
|
@@ -299,7 +299,7 @@ var TreemapChart = /*#__PURE__*/function (_BaseChart) {
|
|
|
299
299
|
ref: function ref(_ref3) {
|
|
300
300
|
return _this2.container = _ref3;
|
|
301
301
|
},
|
|
302
|
-
className: "statistic-chart-
|
|
302
|
+
className: "statistic-chart-container ".concat(chartStyles['statistic-treemap-chart-container'])
|
|
303
303
|
}));
|
|
304
304
|
}
|
|
305
305
|
}]);
|
package/es/utils/column-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CellType, isDateColumn, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES
|
|
1
|
+
import { CellType, isDateColumn, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
|
|
2
2
|
import { MIRROR_COLUMN_LIST } from '../constants';
|
|
3
3
|
export function getColorFromSingleSelectColumn(column, target) {
|
|
4
4
|
var columnType = column.type,
|