dtable-statistic 4.1.8 → 4.2.0
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.
|
@@ -429,6 +429,16 @@
|
|
|
429
429
|
display: flex;
|
|
430
430
|
overflow: auto;
|
|
431
431
|
height: 100%;
|
|
432
|
+
width: 100%;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
#exported-chart-container .statistic-chart-container.map {
|
|
436
|
+
padding: 20px;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
#exported-chart-container .statistic-chart-container > div {
|
|
440
|
+
height: 100%;
|
|
441
|
+
width: 100%;
|
|
432
442
|
}
|
|
433
443
|
|
|
434
444
|
/* specific color */
|
package/es/service/map-json.js
CHANGED
|
@@ -29,17 +29,12 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
29
29
|
var exportContainerID = 'exported-chart-container';
|
|
30
30
|
var exportContainer = document.createElement('div');
|
|
31
31
|
exportContainer.setAttribute('id', exportContainerID);
|
|
32
|
-
|
|
33
|
-
// for charts rendered with `<canvas>`
|
|
34
|
-
var id = statItem._id;
|
|
35
|
-
var originalElement = document.querySelector("#stat-item-".concat(id, " .statistic-chart-container > div"));
|
|
36
|
-
if (originalElement) {
|
|
37
|
-
var containerWidth = originalElement.scrollWidth + 15 * 2;
|
|
38
|
-
var containerHeight = originalElement.scrollHeight + 15 * 2;
|
|
39
|
-
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
40
|
-
}
|
|
32
|
+
exportContainer.setAttribute('style', "width: ".concat(window.innerWidth, "px; height: ").concat(window.innerHeight, "px;"));
|
|
41
33
|
document.body.appendChild(exportContainer);
|
|
42
|
-
ReactDOM.render(_this.renderChart(statItem
|
|
34
|
+
ReactDOM.render(_this.renderChart(statItem, {
|
|
35
|
+
isPreview: false,
|
|
36
|
+
isEnlarge: true
|
|
37
|
+
}), exportContainer);
|
|
43
38
|
setTimeout(function () {
|
|
44
39
|
var ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
|
|
45
40
|
if (!ele) return;
|
|
@@ -67,7 +62,11 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
67
62
|
statisticalResult: statisticalResult
|
|
68
63
|
});
|
|
69
64
|
};
|
|
70
|
-
_this.renderChart = function (statItem) {
|
|
65
|
+
_this.renderChart = function (statItem, _ref) {
|
|
66
|
+
var _ref$isPreview = _ref.isPreview,
|
|
67
|
+
isPreview = _ref$isPreview === void 0 ? true : _ref$isPreview,
|
|
68
|
+
_ref$isEnlarge = _ref.isEnlarge,
|
|
69
|
+
isEnlarge = _ref$isEnlarge === void 0 ? false : _ref$isEnlarge;
|
|
71
70
|
var _this$props = _this.props,
|
|
72
71
|
dtableChangedTime = _this$props.dtableChangedTime,
|
|
73
72
|
chartCalculator = _this$props.chartCalculator,
|
|
@@ -75,12 +74,12 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
75
74
|
colorThemeName = _this$props.colorThemeName,
|
|
76
75
|
eventBus = _this$props.eventBus;
|
|
77
76
|
return /*#__PURE__*/React.createElement(StatView, {
|
|
78
|
-
ref: function ref(
|
|
79
|
-
return _this.chartView =
|
|
77
|
+
ref: function ref(_ref2) {
|
|
78
|
+
return _this.chartView = _ref2;
|
|
80
79
|
},
|
|
81
|
-
isPreview:
|
|
80
|
+
isPreview: isPreview,
|
|
81
|
+
isEnlarge: isEnlarge,
|
|
82
82
|
dtableChangedTime: dtableChangedTime,
|
|
83
|
-
isEnlarge: false,
|
|
84
83
|
theme: theme,
|
|
85
84
|
colorThemeName: colorThemeName,
|
|
86
85
|
statItem: statItem,
|
|
@@ -135,7 +134,10 @@ var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
|
135
134
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
136
135
|
id: "stat-item-".concat(statItem._id),
|
|
137
136
|
className: "statistic-chart-preview-container"
|
|
138
|
-
}, this.renderChart(statItem
|
|
137
|
+
}, this.renderChart(statItem, {
|
|
138
|
+
isPreview: true,
|
|
139
|
+
isEnlarge: false
|
|
140
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
139
141
|
className: "statistic-chart-preview-container-resize"
|
|
140
142
|
}));
|
|
141
143
|
}
|
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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@seafile/seafile-calendar": "0.0.24",
|
|
13
13
|
"comlink": "^4.3.1",
|
|
14
14
|
"dayjs": "1.10.7",
|
|
15
|
-
"dtable-store": "4.
|
|
15
|
+
"dtable-store": "4.2.3",
|
|
16
16
|
"dtable-web-api": "4.0.11",
|
|
17
17
|
"glamor": "^2.20.40",
|
|
18
18
|
"html2canvas": "^1.4.1",
|