dtable-statistic 4.0.2-test-2
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/README.md +3 -0
- package/es/api/dtable-db-api.js +43 -0
- package/es/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/color-theme-dialog.css +40 -0
- package/es/assets/css/dashboard.css +562 -0
- package/es/assets/css/dialog.css +415 -0
- package/es/assets/css/mobile-dashboard.module.css +91 -0
- package/es/assets/css/slider.css +77 -0
- package/es/assets/css/statistic-chart.module.css +11 -0
- package/es/assets/css/statistic-custom-title.module.css +3 -0
- package/es/assets/css/statistic-custom.module.css +4 -0
- package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
- package/es/assets/css/statistic-time-picker.module.css +21 -0
- package/es/assets/css/theme.css +61 -0
- package/es/assets/images/icon.png +0 -0
- package/es/calculator/base-calculator.js +111 -0
- package/es/calculator/basic-chart-calculator.js +571 -0
- package/es/calculator/combination-calculator.js +296 -0
- package/es/calculator/compare-bar-calculator.js +291 -0
- package/es/calculator/completeness-calculator.js +307 -0
- package/es/calculator/copy-value.js +47 -0
- package/es/calculator/dashboard-calculator.js +146 -0
- package/es/calculator/heat-map-calculator.js +225 -0
- package/es/calculator/horizontal-bar-calculator.js +100 -0
- package/es/calculator/index.js +88 -0
- package/es/calculator/map-calculator.js +169 -0
- package/es/calculator/mirror-calculator.js +217 -0
- package/es/calculator/number-card-calculator.js +135 -0
- package/es/calculator/pivot-table-calculator.js +810 -0
- package/es/calculator/scatter-calculator.js +150 -0
- package/es/calculator/thread-manager.js +70 -0
- package/es/calculator/trend-calculator.js +204 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
- package/es/calculator/workers/calculator.worker.js +22 -0
- package/es/calculator/workers/card-calculator-worker.js +28 -0
- package/es/calculator/workers/combination-calculator-worker.js +257 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
- package/es/calculator/workers/completeness-calculator-worker.js +153 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
- package/es/calculator/workers/mirror-calculator-worker.js +132 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
- package/es/calculator/workers/scatter-calculator-worker.js +67 -0
- package/es/calculator/workers/trend-calculator-worker.js +93 -0
- package/es/calculator/world-map-calculator.js +193 -0
- package/es/components/common-add-tool.js +19 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
- package/es/components/dialog/color-theme-dialog.js +71 -0
- package/es/components/dialog/enlarged-chart-dialog.js +73 -0
- package/es/components/dialog/new-table-dialog.js +113 -0
- package/es/components/dialog/new-view-dialog.js +87 -0
- package/es/components/dialog/rename-view-dialog.js +87 -0
- package/es/components/dialog/statistic-record-dialog/index.css +114 -0
- package/es/components/dialog/statistic-record-dialog/index.js +174 -0
- package/es/components/dialog/table-select-dialog.js +93 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
- package/es/components/dtable-popover.js +109 -0
- package/es/components/dtable-search-input.js +137 -0
- package/es/components/dtable-select.js +104 -0
- package/es/components/index.js +11 -0
- package/es/components/loading.js +8 -0
- package/es/components/modal-portal.js +36 -0
- package/es/components/popover/color-rules/color-rule.js +179 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
- package/es/components/popover/color-rules/rule-filters/index.css +214 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
- package/es/components/popover/color-rules-popover.js +213 -0
- package/es/components/popover/color-selector-popover.js +85 -0
- package/es/components/seatable-radio/index.css +51 -0
- package/es/components/seatable-radio/index.js +28 -0
- package/es/components/select/index.js +2 -0
- package/es/components/select/option-group.css +104 -0
- package/es/components/select/option-group.js +225 -0
- package/es/components/select/option.js +51 -0
- package/es/components/select/select.css +211 -0
- package/es/components/select/select.js +157 -0
- package/es/components/toast/alert.js +130 -0
- package/es/components/toast/index.js +3 -0
- package/es/components/toast/toast.js +164 -0
- package/es/components/toast/toastManager.js +150 -0
- package/es/components/toast/toaster.js +64 -0
- package/es/constants/color-rules.js +8 -0
- package/es/constants/dtable-select-style.js +61 -0
- package/es/constants/event-types.js +1 -0
- package/es/constants/index.js +501 -0
- package/es/constants/key-codes.js +102 -0
- package/es/constants/zIndexes.js +1 -0
- package/es/custom-g2.js +614 -0
- package/es/dashboard.js +408 -0
- package/es/desktop-dashboard.js +299 -0
- package/es/index.js +33 -0
- package/es/locale/index.js +17 -0
- package/es/locale/lang/de.js +237 -0
- package/es/locale/lang/en.js +237 -0
- package/es/locale/lang/fr.js +237 -0
- package/es/locale/lang/zh_CN.js +237 -0
- package/es/mobile-dashboard.js +103 -0
- package/es/model/collaborators.js +11 -0
- package/es/model/stat-item.js +340 -0
- package/es/model/statistic-dashboard.js +8 -0
- package/es/service/chart-service.js +192 -0
- package/es/service/dashboard-service.js +415 -0
- package/es/stat-editor/chart-name-editor.js +75 -0
- package/es/stat-editor/index.js +74 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
- package/es/stat-list/chart-preview.js +139 -0
- package/es/stat-list/index.js +275 -0
- package/es/stat-view/area-chart.js +521 -0
- package/es/stat-view/bar-chart.js +568 -0
- package/es/stat-view/base-chart.js +44 -0
- package/es/stat-view/basic-number-card.js +255 -0
- package/es/stat-view/combination-chart.js +558 -0
- package/es/stat-view/compare-chart.js +485 -0
- package/es/stat-view/completeness-chart.js +389 -0
- package/es/stat-view/custom-bar.js +433 -0
- package/es/stat-view/dashboard-chart.js +317 -0
- package/es/stat-view/heat-map.js +501 -0
- package/es/stat-view/horizontal-bar-chart.js +569 -0
- package/es/stat-view/index.js +183 -0
- package/es/stat-view/line-chart.js +505 -0
- package/es/stat-view/map.js +428 -0
- package/es/stat-view/mirror.js +285 -0
- package/es/stat-view/pie-chart.js +326 -0
- package/es/stat-view/pivot-table/index.js +206 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
- package/es/stat-view/ring-chart.js +416 -0
- package/es/stat-view/scatter-chart.js +367 -0
- package/es/stat-view/treemap-chart.js +318 -0
- package/es/stat-view/trend-chart.js +299 -0
- package/es/stat-view/world-map.js +443 -0
- package/es/tabs/index.js +252 -0
- package/es/tabs/statistic-tabs.module.css +154 -0
- package/es/tabs/tab.js +167 -0
- package/es/utils/basic-chart-utils.js +24 -0
- package/es/utils/cell-format.js +110 -0
- package/es/utils/cell-value.js +27 -0
- package/es/utils/collaborator.js +31 -0
- package/es/utils/color-utils.js +112 -0
- package/es/utils/column-utils.js +18 -0
- package/es/utils/column.js +13 -0
- package/es/utils/common-utils.js +303 -0
- package/es/utils/date-format.js +65 -0
- package/es/utils/export-table-utils.js +632 -0
- package/es/utils/index.js +26 -0
- package/es/utils/object.js +26 -0
- package/es/utils/row-utils.js +115 -0
- package/es/utils/search.js +67 -0
- package/es/utils/sql-utils.js +293 -0
- package/es/utils/stat-utils.js +353 -0
- package/es/utils/trend-utils.js +136 -0
- package/index.js +1 -0
- package/package.json +188 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import ReactDOM from 'react-dom';
|
|
8
|
+
import GridLayout, { WidthProvider } from 'react-grid-layout';
|
|
9
|
+
import html2canvas from 'html2canvas';
|
|
10
|
+
import intl from 'react-intl-universal';
|
|
11
|
+
import ChartPreview from './chart-preview';
|
|
12
|
+
import { NewTableDialog, toaster } from '../components';
|
|
13
|
+
import EnlargeChartDialog from '../components/dialog/enlarged-chart-dialog';
|
|
14
|
+
import TableSelectDialog from '../components/dialog/table-select-dialog';
|
|
15
|
+
import { exportStatisticToTable, updateStatisticToTable } from '../utils/export-table-utils';
|
|
16
|
+
import { STAT_TYPE } from '../constants';
|
|
17
|
+
var ReactGridLayout = WidthProvider(GridLayout);
|
|
18
|
+
var StatList = /*#__PURE__*/function (_Component) {
|
|
19
|
+
_inherits(StatList, _Component);
|
|
20
|
+
var _super = _createSuper(StatList);
|
|
21
|
+
function StatList(props) {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, StatList);
|
|
24
|
+
_this = _super.call(this, props);
|
|
25
|
+
_this.getStatItemsLayout = function (statItems) {
|
|
26
|
+
return Array.isArray(statItems) ? statItems.map(function (chart) {
|
|
27
|
+
return chart.layout;
|
|
28
|
+
}) : [];
|
|
29
|
+
};
|
|
30
|
+
_this.editStatItem = function (id) {
|
|
31
|
+
_this.props.editStatItem(id);
|
|
32
|
+
};
|
|
33
|
+
_this.onLayoutChange = function (layout) {
|
|
34
|
+
_this.props.modifyDashboardLayout(layout);
|
|
35
|
+
};
|
|
36
|
+
_this.onExportChart = function (statItem) {
|
|
37
|
+
var exportContainerID = 'exported-statistic-chart-container';
|
|
38
|
+
var exportContainer = document.createElement('div');
|
|
39
|
+
exportContainer.setAttribute('id', exportContainerID);
|
|
40
|
+
|
|
41
|
+
// for charts rendered with `<canvas>`
|
|
42
|
+
var id = statItem._id;
|
|
43
|
+
var originalElement = document.querySelector("#stat-item-".concat(id, " .statistic-chart-container > div"));
|
|
44
|
+
if (originalElement) {
|
|
45
|
+
var containerWidth = originalElement.scrollWidth + 15 * 2;
|
|
46
|
+
var containerHeight = originalElement.scrollHeight + 15 * 2;
|
|
47
|
+
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
48
|
+
}
|
|
49
|
+
document.body.appendChild(exportContainer);
|
|
50
|
+
ReactDOM.render(_this.renderView(statItem), exportContainer);
|
|
51
|
+
setTimeout(function () {
|
|
52
|
+
var ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
|
|
53
|
+
if (!ele) return;
|
|
54
|
+
html2canvas(ele, {
|
|
55
|
+
windowWidth: ele.scrollWidth,
|
|
56
|
+
windowHeight: ele.scrollHeight
|
|
57
|
+
}).then(function (canvas) {
|
|
58
|
+
var eleA = document.createElement('a');
|
|
59
|
+
eleA.href = canvas.toDataURL('image/png');
|
|
60
|
+
eleA.download = "".concat(statItem.name || 'image', ".png");
|
|
61
|
+
eleA.click();
|
|
62
|
+
document.body.removeChild(exportContainer);
|
|
63
|
+
});
|
|
64
|
+
}, 1000);
|
|
65
|
+
};
|
|
66
|
+
_this.enlargeChart = function (chartIndex) {
|
|
67
|
+
_this.setState({
|
|
68
|
+
enlargedChartIndex: chartIndex
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
_this.closeEnlargedChart = function (event) {
|
|
72
|
+
if (event) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
}
|
|
76
|
+
_this.setState({
|
|
77
|
+
enlargedChartIndex: -1
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
_this.showNewTableDialog = function (chartIndexExport2Table, statisticalResult) {
|
|
81
|
+
_this.statisticalResult4Export = statisticalResult;
|
|
82
|
+
_this.setState({
|
|
83
|
+
chartIndexExport2Table: chartIndexExport2Table
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
_this.exportChart2Table = function (tableName, chart) {
|
|
87
|
+
if (chart.type !== STAT_TYPE.PIVOT_TABLE) {
|
|
88
|
+
_this.statisticalResult4Export = null;
|
|
89
|
+
toaster.danger(intl.get('Failed_export_statistic_to_Table'));
|
|
90
|
+
_this.closeNewTableDialog();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
_this.closeNewTableDialog();
|
|
94
|
+
if (!_this.statisticalResult4Export) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
var _exportStatisticToTab = exportStatisticToTable({
|
|
98
|
+
statisticalResult: _this.statisticalResult4Export,
|
|
99
|
+
t: intl
|
|
100
|
+
}),
|
|
101
|
+
columns = _exportStatisticToTab.columns,
|
|
102
|
+
rows = _exportStatisticToTab.rows;
|
|
103
|
+
if (window.app && window.app.onExportStatisticToTable) {
|
|
104
|
+
window.app.onExportStatisticToTable({
|
|
105
|
+
tableName: tableName,
|
|
106
|
+
columns: columns,
|
|
107
|
+
rows: rows
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
_this.statisticalResult4Export = null;
|
|
111
|
+
_this.props.onCloseDashboard();
|
|
112
|
+
};
|
|
113
|
+
_this.closeNewTableDialog = function () {
|
|
114
|
+
_this.setState({
|
|
115
|
+
chartIndexExport2Table: -1
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
_this.showSelectTableDialog = function (chartIndexUpdate2Table, statisticalResult) {
|
|
119
|
+
_this.statisticalResult4Update = statisticalResult;
|
|
120
|
+
_this.setState({
|
|
121
|
+
chartIndexUpdate2Table: chartIndexUpdate2Table
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
_this.updateChart2Table = function (selectedTableId, chartUpdate2Table) {
|
|
125
|
+
var getTableById = _this.props.getTableById;
|
|
126
|
+
if (chartUpdate2Table.type !== STAT_TYPE.PIVOT_TABLE) {
|
|
127
|
+
_this.statisticalResult4Update = null;
|
|
128
|
+
toaster.danger(intl.get('Failed_export_statistic_to_Table'));
|
|
129
|
+
_this.closeSelectTableDialog();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var updateTable = getTableById(selectedTableId);
|
|
133
|
+
_this.closeSelectTableDialog();
|
|
134
|
+
if (!_this.statisticalResult4Update || !updateTable) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var _updateStatisticToTab = updateStatisticToTable({
|
|
138
|
+
updateTable: updateTable,
|
|
139
|
+
statisticalResult: _this.statisticalResult4Update,
|
|
140
|
+
t: intl
|
|
141
|
+
}),
|
|
142
|
+
newRows = _updateStatisticToTab.newRows,
|
|
143
|
+
updatedRows = _updateStatisticToTab.updatedRows,
|
|
144
|
+
rowIds = _updateStatisticToTab.rowIds,
|
|
145
|
+
oldRows = _updateStatisticToTab.oldRows;
|
|
146
|
+
if (window.app && window.app.onUpdateStatisticToTable) {
|
|
147
|
+
window.app.onUpdateStatisticToTable({
|
|
148
|
+
tableId: selectedTableId,
|
|
149
|
+
newRows: newRows,
|
|
150
|
+
updatedRows: updatedRows,
|
|
151
|
+
rowIds: rowIds,
|
|
152
|
+
oldRows: oldRows
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
_this.statisticalResult4Update = null;
|
|
156
|
+
_this.closeSelectTableDialog();
|
|
157
|
+
};
|
|
158
|
+
_this.closeSelectTableDialog = function () {
|
|
159
|
+
_this.setState({
|
|
160
|
+
chartIndexUpdate2Table: -1
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
var _statItems = props.statItems;
|
|
164
|
+
_this.state = {
|
|
165
|
+
layout: _this.getStatItemsLayout(_statItems),
|
|
166
|
+
enlargedChartIndex: -1,
|
|
167
|
+
chartIndexExport2Table: -1,
|
|
168
|
+
chartIndexUpdate2Table: -1
|
|
169
|
+
};
|
|
170
|
+
return _this;
|
|
171
|
+
}
|
|
172
|
+
_createClass(StatList, [{
|
|
173
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
174
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
175
|
+
var statItems = nextProps.statItems;
|
|
176
|
+
this.setState({
|
|
177
|
+
layout: this.getStatItemsLayout(statItems)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "render",
|
|
182
|
+
value: function render() {
|
|
183
|
+
var _this2 = this;
|
|
184
|
+
var _this$props = this.props,
|
|
185
|
+
isTableReadOnly = _this$props.isTableReadOnly,
|
|
186
|
+
refresh = _this$props.refresh,
|
|
187
|
+
theme = _this$props.theme,
|
|
188
|
+
colorThemeName = _this$props.colorThemeName,
|
|
189
|
+
statItems = _this$props.statItems,
|
|
190
|
+
chartCalculator = _this$props.chartCalculator,
|
|
191
|
+
eventBus = _this$props.eventBus;
|
|
192
|
+
var _this$state = this.state,
|
|
193
|
+
layout = _this$state.layout,
|
|
194
|
+
enlargedChartIndex = _this$state.enlargedChartIndex,
|
|
195
|
+
chartIndexExport2Table = _this$state.chartIndexExport2Table,
|
|
196
|
+
chartIndexUpdate2Table = _this$state.chartIndexUpdate2Table;
|
|
197
|
+
var enlargedChart = enlargedChartIndex > -1 && statItems[enlargedChartIndex];
|
|
198
|
+
var chartExport2Table = chartIndexExport2Table > -1 && statItems[chartIndexExport2Table];
|
|
199
|
+
var chartUpdate2Table = chartIndexUpdate2Table > -1 && statItems[chartIndexUpdate2Table];
|
|
200
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: "statistic-list"
|
|
202
|
+
}, Array.isArray(statItems) && /*#__PURE__*/React.createElement(ReactGridLayout, {
|
|
203
|
+
className: "statistic-layout layout",
|
|
204
|
+
isDraggable: true,
|
|
205
|
+
rowHeight: 35,
|
|
206
|
+
layout: layout,
|
|
207
|
+
containerPadding: [15, 15],
|
|
208
|
+
margin: [10, 10],
|
|
209
|
+
draggableHandle: '.statistic-chart-preview-header',
|
|
210
|
+
onLayoutChange: this.onLayoutChange,
|
|
211
|
+
cols: 4,
|
|
212
|
+
useCSSTransforms: false
|
|
213
|
+
}, statItems.map(function (statItem, index) {
|
|
214
|
+
var statId = statItem._id;
|
|
215
|
+
if (!statId) return null;
|
|
216
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
217
|
+
id: statId,
|
|
218
|
+
key: statId,
|
|
219
|
+
className: "statistic-chart-preview"
|
|
220
|
+
}, /*#__PURE__*/React.createElement(ChartPreview, {
|
|
221
|
+
isTableReadOnly: isTableReadOnly,
|
|
222
|
+
refresh: refresh,
|
|
223
|
+
theme: theme,
|
|
224
|
+
colorThemeName: colorThemeName,
|
|
225
|
+
statItem: _objectSpread({}, statItem),
|
|
226
|
+
chartCalculator: chartCalculator,
|
|
227
|
+
eventBus: eventBus,
|
|
228
|
+
getTableById: _this2.props.getTableById,
|
|
229
|
+
getTables: _this2.props.getTables,
|
|
230
|
+
copyChart: _this2.props.copyChart,
|
|
231
|
+
deleteChart: _this2.props.deleteChart,
|
|
232
|
+
enlargeChart: function enlargeChart() {
|
|
233
|
+
return _this2.enlargeChart(index);
|
|
234
|
+
},
|
|
235
|
+
showNewTableDialog: function showNewTableDialog(_ref) {
|
|
236
|
+
var statisticalResult = _ref.statisticalResult;
|
|
237
|
+
return _this2.showNewTableDialog(index, statisticalResult);
|
|
238
|
+
},
|
|
239
|
+
showSelectTableDialog: function showSelectTableDialog(_ref2) {
|
|
240
|
+
var statisticalResult = _ref2.statisticalResult;
|
|
241
|
+
return _this2.showSelectTableDialog(index, statisticalResult);
|
|
242
|
+
},
|
|
243
|
+
onToggleEditChart: _this2.props.onToggleEditChart,
|
|
244
|
+
onCloseDashboard: _this2.props.onCloseDashboard,
|
|
245
|
+
toggleStatisticRecordsDialog: _this2.props.toggleStatisticRecordsDialog
|
|
246
|
+
}));
|
|
247
|
+
})), enlargedChart && /*#__PURE__*/React.createElement(EnlargeChartDialog, {
|
|
248
|
+
refresh: refresh,
|
|
249
|
+
colorThemeName: colorThemeName,
|
|
250
|
+
statItem: enlargedChart,
|
|
251
|
+
eventBus: eventBus,
|
|
252
|
+
chartCalculator: chartCalculator,
|
|
253
|
+
getTableById: this.props.getTableById,
|
|
254
|
+
onEnlargeToggle: this.closeEnlargedChart,
|
|
255
|
+
onToggleShowEnlarged: this.closeEnlargedChart,
|
|
256
|
+
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
257
|
+
}), chartExport2Table && /*#__PURE__*/React.createElement(NewTableDialog, {
|
|
258
|
+
tableName: chartExport2Table.name,
|
|
259
|
+
onNewTableConfirm: function onNewTableConfirm(tableName) {
|
|
260
|
+
return _this2.exportChart2Table(tableName, chartExport2Table);
|
|
261
|
+
},
|
|
262
|
+
onNewTableCancel: this.closeNewTableDialog
|
|
263
|
+
}), chartUpdate2Table && /*#__PURE__*/React.createElement(TableSelectDialog, {
|
|
264
|
+
tables: this.props.getTables(),
|
|
265
|
+
title: intl.get('Update_to_a_table'),
|
|
266
|
+
toggle: this.closeSelectTableDialog,
|
|
267
|
+
onSelectTable: function onSelectTable(selectedTableId) {
|
|
268
|
+
return _this2.updateChart2Table(selectedTableId, chartUpdate2Table);
|
|
269
|
+
}
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
}]);
|
|
273
|
+
return StatList;
|
|
274
|
+
}(Component);
|
|
275
|
+
export default StatList;
|