dtable-statistic 4.0.7 → 4.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/es/calculator/basic-chart-calculator.js +27 -18
- package/es/calculator/combination-calculator.js +34 -9
- package/es/calculator/compare-bar-calculator.js +37 -30
- package/es/calculator/heat-map-calculator.js +25 -14
- package/es/calculator/map-calculator.js +25 -14
- package/es/calculator/mirror-calculator.js +29 -14
- package/es/calculator/pivot-table-calculator.js +78 -51
- package/es/calculator/workers/basic-chart-calculator-worker.js +21 -6
- package/es/calculator/workers/combination-calculator-worker.js +20 -5
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +12 -6
- package/es/calculator/workers/mirror-calculator-worker.js +15 -6
- package/es/calculator/workers/pivot-table-calculator-worker.js +87 -41
- package/es/calculator/world-map-calculator.js +25 -14
- package/es/components/dialog/enlarged-chart-dialog.js +2 -2
- package/es/components/dialog/statistic-record-dialog/index.js +71 -41
- package/es/constants/index.js +30 -29
- package/es/dashboard.js +57 -43
- package/es/desktop-dashboard.js +16 -51
- package/es/index.js +34 -2
- package/es/locale/lang/de.js +2 -0
- package/es/locale/lang/en.js +2 -0
- package/es/locale/lang/fr.js +2 -0
- package/es/locale/lang/zh_CN.js +2 -0
- package/es/mobile-dashboard.js +5 -5
- package/es/model/horizontal-bar-group.js +2 -0
- package/es/model/ring.js +3 -2
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +1 -2
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +1 -1
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +4 -1
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +20 -3
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +2 -8
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +23 -2
- package/es/stat-list/chart-preview.js +3 -4
- package/es/stat-list/index.js +10 -4
- package/es/stat-view/area-chart.js +177 -162
- package/es/stat-view/bar-chart.js +221 -222
- package/es/stat-view/base-chart.js +81 -7
- package/es/stat-view/basic-number-card.js +11 -19
- package/es/stat-view/combination-chart.js +100 -83
- package/es/stat-view/compare-chart.js +133 -144
- package/es/stat-view/completeness-chart.js +108 -102
- package/es/stat-view/custom-bar.js +79 -99
- package/es/stat-view/dashboard-chart.js +57 -57
- package/es/stat-view/heat-map.js +13 -32
- package/es/stat-view/horizontal-bar-chart.js +207 -231
- package/es/stat-view/index.js +2 -2
- package/es/stat-view/line-chart.js +162 -158
- package/es/stat-view/map.js +26 -40
- package/es/stat-view/mirror.js +88 -94
- package/es/stat-view/pie-chart.js +11 -39
- package/es/stat-view/pivot-table/index.js +4 -16
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +22 -15
- package/es/stat-view/pivot-table/two-dimension-table.js +98 -31
- package/es/stat-view/ring-chart.js +24 -42
- package/es/stat-view/scatter-chart.js +4 -21
- package/es/stat-view/treemap-chart.js +3 -12
- package/es/stat-view/trend-chart.js +6 -17
- package/es/stat-view/world-map.js +39 -50
- package/es/tabs/tab.js +2 -1
- package/es/utils/common-utils.js +29 -12
- package/es/utils/sql-utils.js +10 -9
- package/es/utils/stat-utils.js +23 -15
- package/es/utils/trend-utils.js +1 -1
- package/package.json +1 -1
package/es/dashboard.js
CHANGED
|
@@ -39,30 +39,35 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
39
39
|
console.log(error);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
_this.
|
|
43
|
-
_this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
_this.onLocalDTableChanged = function (value) {
|
|
43
|
+
if (_this.updatingLocalStatistics) {
|
|
44
|
+
// it's unnecessary to notify data changed during update statistics
|
|
45
|
+
_this.value = value;
|
|
46
|
+
_this.updatingLocalStatistics = false;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
_this.onDTableChanged(value);
|
|
50
|
+
};
|
|
51
|
+
_this.onServerDTableChanged = function (value) {
|
|
52
|
+
_this.onDTableChanged(value);
|
|
53
|
+
};
|
|
54
|
+
_this.onDTableChanged = function (value) {
|
|
55
|
+
_this.value = value;
|
|
56
|
+
_this.disabledUpdateLayout = true;
|
|
57
|
+
var _this$initDashboard = _this.initDashboard(),
|
|
47
58
|
statistics = _this$initDashboard.statistics,
|
|
48
59
|
selectedDashboardIdx = _this$initDashboard.selectedDashboardIdx;
|
|
49
60
|
_this.setState({
|
|
50
61
|
statistics: statistics,
|
|
51
62
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
52
|
-
|
|
53
|
-
}, function () {
|
|
54
|
-
setTimeout(function () {
|
|
55
|
-
_this.setState({
|
|
56
|
-
refresh: false
|
|
57
|
-
});
|
|
58
|
-
});
|
|
63
|
+
dtableChangedTime: Date.now()
|
|
59
64
|
});
|
|
60
65
|
};
|
|
61
|
-
_this.initDashboard = function (
|
|
62
|
-
var value = _ref.value;
|
|
66
|
+
_this.initDashboard = function () {
|
|
63
67
|
var _window$dtable = window.dtable,
|
|
64
68
|
username = _window$dtable.username,
|
|
65
69
|
userId = _window$dtable.userId;
|
|
70
|
+
var value = _this.value;
|
|
66
71
|
_this.chartCalculator = new ChartCalculator({
|
|
67
72
|
username: username,
|
|
68
73
|
userId: userId,
|
|
@@ -77,7 +82,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
77
82
|
updateStatistics: _this.props.updateStatistics,
|
|
78
83
|
deletePluginSettings: _this.props.deletePluginSettings
|
|
79
84
|
});
|
|
80
|
-
_this.initLabelColorConfigs(
|
|
85
|
+
_this.initLabelColorConfigs();
|
|
81
86
|
var statistics = _this.dashboardService.getStatistics();
|
|
82
87
|
var selectedDashboardIdx = _this.getSelectedDashboardIdxFromLocal(KEY_SELECTED_DASHBOARD) || 0;
|
|
83
88
|
if (!statistics[selectedDashboardIdx]) {
|
|
@@ -88,9 +93,9 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
88
93
|
selectedDashboardIdx: selectedDashboardIdx
|
|
89
94
|
};
|
|
90
95
|
};
|
|
91
|
-
_this.initLabelColorConfigs = function (
|
|
96
|
+
_this.initLabelColorConfigs = function () {
|
|
92
97
|
var systemCustomColors = window.dtable.customColors || [];
|
|
93
|
-
var baseSettings = value && value.settings;
|
|
98
|
+
var baseSettings = _this.value && _this.value.settings;
|
|
94
99
|
var baseCustomColors = baseSettings && baseSettings.custom_colors || [];
|
|
95
100
|
_this.labelColorConfigs = [].concat(_toConsumableArray(LABEL_COLORS.map(function (color) {
|
|
96
101
|
return {
|
|
@@ -127,10 +132,8 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
127
132
|
localStorage.setItem(KEY_SELECTED_DASHBOARD, JSON.stringify(selectedViewIds));
|
|
128
133
|
};
|
|
129
134
|
_this.getActiveTable = function () {
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
activeTableIdx = _this$props.activeTableIdx;
|
|
133
|
-
return TableUtils.getTableByIndex(value.tables, activeTableIdx);
|
|
135
|
+
var activeTableIdx = _this.props.activeTableIdx;
|
|
136
|
+
return TableUtils.getTableByIndex(_this.value.tables, activeTableIdx);
|
|
134
137
|
};
|
|
135
138
|
_this.getActiveView = function () {
|
|
136
139
|
var activeViewId = _this.props.activeViewId;
|
|
@@ -138,11 +141,11 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
138
141
|
if (!activeViewId) return selectedTable.views[0];
|
|
139
142
|
return Views.getViewById(selectedTable.views, activeViewId);
|
|
140
143
|
};
|
|
141
|
-
_this.getInitChart = function (
|
|
142
|
-
var chartType =
|
|
143
|
-
dashboard =
|
|
144
|
-
activeTable =
|
|
145
|
-
activeView =
|
|
144
|
+
_this.getInitChart = function (_ref) {
|
|
145
|
+
var chartType = _ref.chartType,
|
|
146
|
+
dashboard = _ref.dashboard,
|
|
147
|
+
activeTable = _ref.activeTable,
|
|
148
|
+
activeView = _ref.activeView;
|
|
146
149
|
return _this.chartService.getInitChart({
|
|
147
150
|
type: chartType,
|
|
148
151
|
dashboard: dashboard,
|
|
@@ -150,10 +153,10 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
150
153
|
activeView: activeView
|
|
151
154
|
});
|
|
152
155
|
};
|
|
153
|
-
_this.getConvertedChart = function (
|
|
154
|
-
var originalStatistic =
|
|
155
|
-
targetStatisticType =
|
|
156
|
-
activeTable =
|
|
156
|
+
_this.getConvertedChart = function (_ref2) {
|
|
157
|
+
var originalStatistic = _ref2.originalStatistic,
|
|
158
|
+
targetStatisticType = _ref2.targetStatisticType,
|
|
159
|
+
activeTable = _ref2.activeTable;
|
|
157
160
|
return _this.chartService.getConvertedChart({
|
|
158
161
|
originalStatistic: originalStatistic,
|
|
159
162
|
targetStatisticType: targetStatisticType,
|
|
@@ -161,7 +164,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
161
164
|
});
|
|
162
165
|
};
|
|
163
166
|
_this.selectDashboard = function (selectedDashboardIdx) {
|
|
164
|
-
_this.
|
|
167
|
+
_this.disabledUpdateLayout = true;
|
|
165
168
|
_this.setSelectedDashboardIdx(selectedDashboardIdx);
|
|
166
169
|
_this.clearCalculations();
|
|
167
170
|
_this.setState({
|
|
@@ -255,10 +258,15 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
255
258
|
});
|
|
256
259
|
};
|
|
257
260
|
_this.modifyDashboardLayout = function (layout) {
|
|
261
|
+
// prevent unexpected refresh.
|
|
258
262
|
if (_this.isInitDashboard) {
|
|
259
263
|
_this.isInitDashboard = false;
|
|
260
264
|
return;
|
|
261
265
|
}
|
|
266
|
+
if (_this.disabledUpdateLayout) {
|
|
267
|
+
_this.disabledUpdateLayout = false;
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
262
270
|
var updatedStatistics = _this.dashboardService.update({
|
|
263
271
|
action: DASHBOARD_ACTION_TYPE.MODIFY_DASHBOARD_LAYOUT,
|
|
264
272
|
payload: {
|
|
@@ -286,6 +294,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
286
294
|
_this.addChart(newChart);
|
|
287
295
|
};
|
|
288
296
|
_this.deleteChart = function (chartId) {
|
|
297
|
+
_this.disabledUpdateLayout = true;
|
|
289
298
|
var updatedStatistics = _this.dashboardService.update({
|
|
290
299
|
action: DASHBOARD_ACTION_TYPE.DELETE_CHART,
|
|
291
300
|
payload: {
|
|
@@ -301,6 +310,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
301
310
|
if (!_this.chartCalculator.isValidChart(chart)) {
|
|
302
311
|
return;
|
|
303
312
|
}
|
|
313
|
+
_this.disabledUpdateLayout = true;
|
|
304
314
|
var updatedStatistics = _this.dashboardService.update({
|
|
305
315
|
action: DASHBOARD_ACTION_TYPE.ADD_CHART,
|
|
306
316
|
payload: {
|
|
@@ -329,16 +339,17 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
329
339
|
};
|
|
330
340
|
_this.updateStatistics = function (updates, callback) {
|
|
331
341
|
var statistics = updates.statistics;
|
|
342
|
+
_this.updatingLocalStatistics = true;
|
|
332
343
|
_this.setState(updates, function () {
|
|
333
344
|
callback && callback();
|
|
334
345
|
_this.props.updateStatistics(statistics);
|
|
335
346
|
});
|
|
336
347
|
};
|
|
337
348
|
_this.getTableById = function (tableId) {
|
|
338
|
-
return TableUtils.getTableById(_this.
|
|
349
|
+
return TableUtils.getTableById(_this.value.tables, tableId);
|
|
339
350
|
};
|
|
340
351
|
_this.getTables = function () {
|
|
341
|
-
return _this.
|
|
352
|
+
return _this.value.tables;
|
|
342
353
|
};
|
|
343
354
|
_this.getViews = function (table) {
|
|
344
355
|
return table.views;
|
|
@@ -353,21 +364,22 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
353
364
|
var _value = props.value;
|
|
354
365
|
var defaultChartTitle = intl.get('Untitled');
|
|
355
366
|
_this.defaultDashboardName = intl.get('Default_dashboard');
|
|
367
|
+
_this.value = _value;
|
|
356
368
|
_this.chartService = new ChartService({
|
|
357
369
|
defaultChartTitle: defaultChartTitle
|
|
358
370
|
});
|
|
359
371
|
_this.statisticThreadManager = new ThreadManager((navigator.hardwareConcurrency || 4) - 1);
|
|
360
|
-
var _this$initDashboard2 = _this.initDashboard(
|
|
361
|
-
value: _value
|
|
362
|
-
}),
|
|
372
|
+
var _this$initDashboard2 = _this.initDashboard(),
|
|
363
373
|
_statistics = _this$initDashboard2.statistics,
|
|
364
374
|
_selectedDashboardIdx = _this$initDashboard2.selectedDashboardIdx;
|
|
365
375
|
_this.state = {
|
|
366
376
|
statistics: _statistics,
|
|
367
377
|
selectedDashboardIdx: _selectedDashboardIdx,
|
|
368
|
-
|
|
378
|
+
dtableChangedTime: null
|
|
369
379
|
};
|
|
370
380
|
_this.isInitDashboard = true;
|
|
381
|
+
_this.updatingLocalStatistics = false;
|
|
382
|
+
_this.disabledUpdateLayout = false;
|
|
371
383
|
_this.loadSvg();
|
|
372
384
|
return _this;
|
|
373
385
|
}
|
|
@@ -375,12 +387,14 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
375
387
|
key: "componentDidMount",
|
|
376
388
|
value: function componentDidMount() {
|
|
377
389
|
var eventBus = this.props.eventBus;
|
|
378
|
-
this.
|
|
390
|
+
this.unsubscribeLocalDtableChanged = eventBus.subscribe('local-dtable-changed', this.onLocalDTableChanged);
|
|
391
|
+
this.unsubscribeRemoteDtableChange = eventBus.subscribe('remote-dtable-changed', this.onServerDTableChanged);
|
|
379
392
|
}
|
|
380
393
|
}, {
|
|
381
394
|
key: "componentWillUnmount",
|
|
382
395
|
value: function componentWillUnmount() {
|
|
383
|
-
this.
|
|
396
|
+
this.unsubscribeLocalDtableChanged();
|
|
397
|
+
this.unsubscribeRemoteDtableChange();
|
|
384
398
|
this.clearCalculations();
|
|
385
399
|
}
|
|
386
400
|
}, {
|
|
@@ -390,14 +404,14 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
390
404
|
var _this$state3 = this.state,
|
|
391
405
|
statistics = _this$state3.statistics,
|
|
392
406
|
selectedDashboardIdx = _this$state3.selectedDashboardIdx,
|
|
393
|
-
|
|
394
|
-
|
|
407
|
+
dtableChangedTime = _this$state3.dtableChangedTime,
|
|
408
|
+
editingChart = _this$state3.editingChart;
|
|
395
409
|
var isTableReadOnly = this.isTableReadOnly();
|
|
396
410
|
var colorThemeName = this.dashboardService.getColorThemeName();
|
|
397
411
|
return isMobile ? /*#__PURE__*/React.createElement(MobileDashboard, {
|
|
398
412
|
isTableReadOnly: isTableReadOnly,
|
|
399
413
|
colorThemeName: colorThemeName,
|
|
400
|
-
|
|
414
|
+
dtableChangedTime: dtableChangedTime,
|
|
401
415
|
statistics: statistics,
|
|
402
416
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
403
417
|
chartCalculator: this.chartCalculator,
|
|
@@ -412,7 +426,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
412
426
|
}) : /*#__PURE__*/React.createElement(DesktopDashboard, {
|
|
413
427
|
isTableReadOnly: isTableReadOnly,
|
|
414
428
|
colorThemeName: colorThemeName,
|
|
415
|
-
|
|
429
|
+
dtableChangedTime: dtableChangedTime,
|
|
416
430
|
statistics: statistics,
|
|
417
431
|
editingChart: editingChart,
|
|
418
432
|
selectedDashboardIdx: selectedDashboardIdx,
|
package/es/desktop-dashboard.js
CHANGED
|
@@ -6,15 +6,13 @@ import React, { Component } from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { UncontrolledTooltip } from 'reactstrap';
|
|
8
8
|
import intl from 'react-intl-universal';
|
|
9
|
-
import { Views } from 'dtable-store';
|
|
10
|
-
import dtableDbAPI from './api/dtable-db-api';
|
|
11
9
|
import Tabs from './tabs';
|
|
12
10
|
import StatList from './stat-list';
|
|
13
11
|
import ColorThemeDialog from './components/dialog/color-theme-dialog';
|
|
14
12
|
import ChartAdditionEditDialog from './components/dialog/chart-addition-edit-dialog';
|
|
15
13
|
import StatisticRecordDialog from './components/dialog/statistic-record-dialog';
|
|
16
14
|
import ChartService from './service/chart-service';
|
|
17
|
-
import {
|
|
15
|
+
import { THEME_NAME_MAP } from './constants';
|
|
18
16
|
import logo from './assets/images/icon.png';
|
|
19
17
|
var KEY_LOCAL_THEME_MODE = 'statistics-theme-mode';
|
|
20
18
|
var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
@@ -41,7 +39,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
41
39
|
});
|
|
42
40
|
};
|
|
43
41
|
_this.toggleThemeMode = function () {
|
|
44
|
-
var theme = _this.state.theme ===
|
|
42
|
+
var theme = _this.state.theme === THEME_NAME_MAP.DARK ? THEME_NAME_MAP.LIGHT : THEME_NAME_MAP.DARK;
|
|
45
43
|
_this.setState({
|
|
46
44
|
theme: theme
|
|
47
45
|
}, function () {
|
|
@@ -93,47 +91,17 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
93
91
|
_this.setState({
|
|
94
92
|
chartRecordsParams: null
|
|
95
93
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var table_id = chart.table_id,
|
|
102
|
-
view_id = chart.view_id;
|
|
103
|
-
var table = getTableById(table_id);
|
|
104
|
-
var view = Views.getViewById(table.views, view_id);
|
|
105
|
-
var isArchiveView = Views.isArchiveView(view);
|
|
106
|
-
var chartRecordsParams = {
|
|
107
|
-
isLoading: true,
|
|
108
|
-
currentDate: statisticRecord.name,
|
|
109
|
-
chart: chart
|
|
110
|
-
};
|
|
111
|
-
_this.setState({
|
|
112
|
-
chartRecordsParams: chartRecordsParams
|
|
113
|
-
}, function () {
|
|
114
|
-
if (isArchiveView || !statisticRecords) {
|
|
115
|
-
var sqlString = getSqlString(chart, statisticRecord, {
|
|
94
|
+
} else {
|
|
95
|
+
_this.setState({
|
|
96
|
+
chartRecordsParams: {
|
|
97
|
+
statisticRecord: statisticRecord,
|
|
98
|
+
chart: chart,
|
|
116
99
|
isColumn: isColumn,
|
|
117
100
|
isCurrentView: isCurrentView,
|
|
118
|
-
isRow: isRow
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
dtableDbAPI.sqlQuery(sqlString).then(function (res) {
|
|
122
|
-
var rows = res.data.results;
|
|
123
|
-
chartRecordsParams.rows = rows;
|
|
124
|
-
chartRecordsParams.isLoading = false;
|
|
125
|
-
_this.setState({
|
|
126
|
-
chartRecordsParams: chartRecordsParams
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
chartRecordsParams.rows = statisticRecord.rows;
|
|
132
|
-
chartRecordsParams.isLoading = false;
|
|
133
|
-
_this.setState({
|
|
134
|
-
chartRecordsParams: chartRecordsParams
|
|
101
|
+
isRow: isRow
|
|
102
|
+
}
|
|
135
103
|
});
|
|
136
|
-
}
|
|
104
|
+
}
|
|
137
105
|
};
|
|
138
106
|
_this.generateChart = function (chartType) {
|
|
139
107
|
var _this$props2 = _this.props,
|
|
@@ -169,7 +137,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
169
137
|
var _this$props3 = this.props,
|
|
170
138
|
getTableById = _this$props3.getTableById,
|
|
171
139
|
isTableReadOnly = _this$props3.isTableReadOnly,
|
|
172
|
-
|
|
140
|
+
dtableChangedTime = _this$props3.dtableChangedTime,
|
|
173
141
|
colorThemeName = _this$props3.colorThemeName,
|
|
174
142
|
statistics = _this$props3.statistics,
|
|
175
143
|
selectedDashboardIdx = _this$props3.selectedDashboardIdx,
|
|
@@ -181,7 +149,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
181
149
|
isFullScreen = _this$state.isFullScreen,
|
|
182
150
|
editingChart = _this$state.editingChart,
|
|
183
151
|
chartRecordsParams = _this$state.chartRecordsParams;
|
|
184
|
-
var darkMode = theme ===
|
|
152
|
+
var darkMode = theme === THEME_NAME_MAP.DARK;
|
|
185
153
|
var statistic = statistics[selectedDashboardIdx];
|
|
186
154
|
var _ref2 = statistic || {},
|
|
187
155
|
statItems = _ref2.stat_items;
|
|
@@ -237,7 +205,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
237
205
|
className: "op-item op-item-icon-wrapper",
|
|
238
206
|
id: "btn-statistic-theme-setting"
|
|
239
207
|
}, /*#__PURE__*/React.createElement("span", {
|
|
240
|
-
className: "op-item-icon dtable-font ".concat(theme ===
|
|
208
|
+
className: "op-item-icon dtable-font ".concat(theme === THEME_NAME_MAP.DARK ? 'dtable-icon-day-mode' : 'dtable-icon-night-mode'),
|
|
241
209
|
onClick: this.toggleThemeMode
|
|
242
210
|
}), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
|
|
243
211
|
placement: "bottom",
|
|
@@ -252,7 +220,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
252
220
|
className: "statistic-main"
|
|
253
221
|
}, /*#__PURE__*/React.createElement(StatList, {
|
|
254
222
|
isTableReadOnly: isTableReadOnly,
|
|
255
|
-
|
|
223
|
+
dtableChangedTime: dtableChangedTime,
|
|
256
224
|
theme: theme,
|
|
257
225
|
colorThemeName: colorThemeName,
|
|
258
226
|
statItems: statItems,
|
|
@@ -285,11 +253,8 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
285
253
|
colorThemeName: colorThemeName,
|
|
286
254
|
onToggleColorThemeDialog: this.onToggleColorThemeDialog,
|
|
287
255
|
modifyColorTheme: this.props.modifyColorTheme
|
|
288
|
-
}), !!
|
|
289
|
-
|
|
290
|
-
rows: chartRecordsParams.rows,
|
|
291
|
-
statistic: chartRecordsParams.chart,
|
|
292
|
-
currentDate: chartRecordsParams.currentDate,
|
|
256
|
+
}), !!chartRecordsParams && /*#__PURE__*/React.createElement(StatisticRecordDialog, {
|
|
257
|
+
chartRecordsParams: chartRecordsParams,
|
|
293
258
|
getTableById: getTableById,
|
|
294
259
|
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
295
260
|
}));
|
package/es/index.js
CHANGED
|
@@ -7,10 +7,42 @@ var Statistic = /*#__PURE__*/function () {
|
|
|
7
7
|
_classCallCheck(this, Statistic);
|
|
8
8
|
}
|
|
9
9
|
_createClass(Statistic, null, [{
|
|
10
|
+
key: "getInitProps",
|
|
11
|
+
value: function getInitProps() {
|
|
12
|
+
if (!window || !window.app) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
var _window$app = window.app,
|
|
16
|
+
state = _window$app.state,
|
|
17
|
+
dtableStore = _window$app.dtableStore;
|
|
18
|
+
var value = state.value,
|
|
19
|
+
selectedTableIdx = state.selectedTableIdx,
|
|
20
|
+
selectedViewId = state.selectedViewId;
|
|
21
|
+
return {
|
|
22
|
+
value: value,
|
|
23
|
+
eventBus: dtableStore.eventBus,
|
|
24
|
+
activeTableIdx: selectedTableIdx,
|
|
25
|
+
activeViewId: selectedViewId,
|
|
26
|
+
updateStatistics: this.updateStatistics.bind(this, dtableStore),
|
|
27
|
+
deletePluginSettings: this.deletePluginSettings.bind(this, dtableStore)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "updateStatistics",
|
|
32
|
+
value: function updateStatistics(dtableStore, statistics) {
|
|
33
|
+
dtableStore.updateStatisticsList(statistics);
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "deletePluginSettings",
|
|
37
|
+
value: function deletePluginSettings(dtableStore, plugin_name) {
|
|
38
|
+
dtableStore.deletePluginSettings(plugin_name);
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
10
41
|
key: "mount",
|
|
11
42
|
value: function mount(props) {
|
|
12
|
-
|
|
13
|
-
|
|
43
|
+
var customProps = this.getInitProps();
|
|
44
|
+
if (!customProps) return;
|
|
45
|
+
window.app.mountWidget( /*#__PURE__*/React.createElement(DashBoard, Object.assign({}, props, customProps)));
|
|
14
46
|
}
|
|
15
47
|
}, {
|
|
16
48
|
key: "unmount",
|
package/es/locale/lang/de.js
CHANGED
package/es/locale/lang/en.js
CHANGED
package/es/locale/lang/fr.js
CHANGED
package/es/locale/lang/zh_CN.js
CHANGED
package/es/mobile-dashboard.js
CHANGED
|
@@ -6,7 +6,7 @@ import React, { Component } from 'react';
|
|
|
6
6
|
import intl from 'react-intl-universal';
|
|
7
7
|
import Tabs from './tabs';
|
|
8
8
|
import StatView from './stat-view';
|
|
9
|
-
import { STAT_TYPE } from './constants';
|
|
9
|
+
import { STAT_TYPE, THEME_NAME_MAP } from './constants';
|
|
10
10
|
import logo from './assets/images/icon.png';
|
|
11
11
|
import styles from './assets/css/mobile-dashboard.module.css';
|
|
12
12
|
var MobileDashboard = /*#__PURE__*/function (_Component) {
|
|
@@ -31,7 +31,7 @@ var MobileDashboard = /*#__PURE__*/function (_Component) {
|
|
|
31
31
|
value: function render() {
|
|
32
32
|
var _this$props = this.props,
|
|
33
33
|
getTableById = _this$props.getTableById,
|
|
34
|
-
|
|
34
|
+
dtableChangedTime = _this$props.dtableChangedTime,
|
|
35
35
|
colorThemeName = _this$props.colorThemeName,
|
|
36
36
|
statistics = _this$props.statistics,
|
|
37
37
|
selectedDashboardIdx = _this$props.selectedDashboardIdx,
|
|
@@ -54,7 +54,7 @@ var MobileDashboard = /*#__PURE__*/function (_Component) {
|
|
|
54
54
|
}), /*#__PURE__*/React.createElement("span", {
|
|
55
55
|
className: styles['mobile-statistic-name']
|
|
56
56
|
}, intl.get('Statistics'))), /*#__PURE__*/React.createElement(Tabs, {
|
|
57
|
-
theme:
|
|
57
|
+
theme: THEME_NAME_MAP.LIGHT,
|
|
58
58
|
isMobile: true,
|
|
59
59
|
statistics: statistics,
|
|
60
60
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
@@ -86,8 +86,8 @@ var MobileDashboard = /*#__PURE__*/function (_Component) {
|
|
|
86
86
|
}, /*#__PURE__*/React.createElement(StatView, {
|
|
87
87
|
isPreview: true,
|
|
88
88
|
isEnlarge: false,
|
|
89
|
-
|
|
90
|
-
theme:
|
|
89
|
+
dtableChangedTime: dtableChangedTime,
|
|
90
|
+
theme: THEME_NAME_MAP.LIGHT,
|
|
91
91
|
colorThemeName: colorThemeName,
|
|
92
92
|
statItem: statItem,
|
|
93
93
|
chartCalculator: chartCalculator,
|
|
@@ -48,6 +48,8 @@ var HorizontalBarGroup = /*#__PURE__*/function (_BaseModel) {
|
|
|
48
48
|
_this.label_font_size = object.label_font_size;
|
|
49
49
|
_this.color_option = object.color_option;
|
|
50
50
|
_this.sort_type = object.sort_type;
|
|
51
|
+
_this.display_each_block_data = object.display_each_block_data;
|
|
52
|
+
_this.display_data = object.display_data;
|
|
51
53
|
return _this;
|
|
52
54
|
}
|
|
53
55
|
return HorizontalBarGroup;
|
package/es/model/ring.js
CHANGED
|
@@ -25,13 +25,14 @@ var Ring = /*#__PURE__*/function (_BaseModel) {
|
|
|
25
25
|
if (_this.summary_method === SUMMARY_METHOD_MAP.Row_count) {
|
|
26
26
|
_this.summary_method = SUMMARY_METHOD_MAP.Max;
|
|
27
27
|
}
|
|
28
|
-
_this.show_legend = object.show_legend;
|
|
29
|
-
_this.display_label = object.display_label;
|
|
28
|
+
_this.show_legend = isBoolean(object.show_legend) ? object.show_legend : true;
|
|
29
|
+
_this.display_label = isBoolean(object.display_label) ? object.display_label : true;
|
|
30
30
|
_this.show_percent = object.show_percent;
|
|
31
31
|
_this.sort_type = object.sort_type;
|
|
32
32
|
_this.minimum_slice_percent = object.minimum_slice_percent;
|
|
33
33
|
_this.display_annotation = isBoolean(object.display_annotation) ? object.display_annotation : true;
|
|
34
34
|
_this.annotation_font_size = object.annotation_font_size;
|
|
35
|
+
_this.label_font_size = object.label_font_size;
|
|
35
36
|
_this.label_format = object.label_format;
|
|
36
37
|
_this.label_position = object.label_position;
|
|
37
38
|
return _this;
|
|
@@ -240,8 +240,7 @@ var AdvancedChartSettings = /*#__PURE__*/function (_React$Component) {
|
|
|
240
240
|
summary_method = _this$props$statItem.summary_method;
|
|
241
241
|
if (summaryType === summary_type) return;
|
|
242
242
|
if (summaryType === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
|
|
243
|
-
|
|
244
|
-
summary_column = defaultColumn ? defaultColumn.key : null;
|
|
243
|
+
summary_column = null;
|
|
245
244
|
summary_method = SUMMARY_METHOD[0];
|
|
246
245
|
summary_type = SUMMARY_TYPE.ADVANCED;
|
|
247
246
|
} else {
|
|
@@ -138,7 +138,7 @@ var SummarySettings = /*#__PURE__*/function (_Component) {
|
|
|
138
138
|
var summaryColumn = _this.props.summaryColumn;
|
|
139
139
|
var selectedColumnOption = _this.numericColumnsOptions.find(function (o) {
|
|
140
140
|
return o.value.key === summaryColumn;
|
|
141
|
-
});
|
|
141
|
+
}) || null;
|
|
142
142
|
return /*#__PURE__*/React.createElement("div", {
|
|
143
143
|
className: "statistic-chart-parameter-item"
|
|
144
144
|
}, /*#__PURE__*/React.createElement("label", null, intl.get('Numeric_column')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
@@ -324,7 +324,10 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
324
324
|
_this.onChangeMultiSummaryMethod = function (index, option) {
|
|
325
325
|
var _ref9 = _this.props.statItem || {},
|
|
326
326
|
summary_columns_option = _ref9.summary_columns_option;
|
|
327
|
-
summary_columns_option
|
|
327
|
+
summary_columns_option = Array.isArray(summary_columns_option) ? _toConsumableArray(summary_columns_option) : [];
|
|
328
|
+
summary_columns_option[index] = Object.assign({}, summary_columns_option[index], {
|
|
329
|
+
method: option.value
|
|
330
|
+
});
|
|
328
331
|
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
329
332
|
summary_columns_option: summary_columns_option
|
|
330
333
|
}));
|
|
@@ -94,6 +94,15 @@ var HorizontalBarChartStyle = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
};
|
|
95
95
|
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
96
96
|
};
|
|
97
|
+
_this.onToggleDisplayEachBlockData = function () {
|
|
98
|
+
var statItem = _this.props.statItem;
|
|
99
|
+
var _ref5 = statItem || {},
|
|
100
|
+
display_each_block_data = _ref5.display_each_block_data;
|
|
101
|
+
var updated = {
|
|
102
|
+
display_each_block_data: !display_each_block_data
|
|
103
|
+
};
|
|
104
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
105
|
+
};
|
|
97
106
|
_this.onChangeLabelFontSize = function (label_font_size) {
|
|
98
107
|
var statItem = _this.props.statItem;
|
|
99
108
|
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
@@ -102,8 +111,8 @@ var HorizontalBarChartStyle = /*#__PURE__*/function (_Component) {
|
|
|
102
111
|
};
|
|
103
112
|
_this.onToggleHAxisAutoRange = function () {
|
|
104
113
|
var statItem = _this.props.statItem;
|
|
105
|
-
var
|
|
106
|
-
h_axis_auto_range =
|
|
114
|
+
var _ref6 = statItem || {},
|
|
115
|
+
h_axis_auto_range = _ref6.h_axis_auto_range;
|
|
107
116
|
var updated = {
|
|
108
117
|
h_axis_auto_range: h_axis_auto_range == undefined ? false : !h_axis_auto_range
|
|
109
118
|
};
|
|
@@ -235,7 +244,15 @@ var HorizontalBarChartStyle = /*#__PURE__*/function (_Component) {
|
|
|
235
244
|
chart: statItem,
|
|
236
245
|
labelColorConfigs: labelColorConfigs,
|
|
237
246
|
updateChart: this.props.updateStatItem
|
|
238
|
-
}))
|
|
247
|
+
})), chartType === STAT_TYPE.STACKED_HORIZONTAL_BAR && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
className: "statistic-chart-parameter-divider"
|
|
249
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
250
|
+
className: "statistic-chart-parameter-item"
|
|
251
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
252
|
+
isChecked: !!statItem.display_each_block_data,
|
|
253
|
+
label: intl.get('Display_value_of_each_block'),
|
|
254
|
+
handleToggleChange: this.onToggleDisplayEachBlockData
|
|
255
|
+
}))));
|
|
239
256
|
}
|
|
240
257
|
}]);
|
|
241
258
|
return HorizontalBarChartStyle;
|
|
@@ -107,18 +107,12 @@ var SummarySettings = /*#__PURE__*/function (_Component) {
|
|
|
107
107
|
};
|
|
108
108
|
_this.onChangeSummaryType = function (option) {
|
|
109
109
|
var type = option.value;
|
|
110
|
-
var
|
|
111
|
-
summaryType = _this$props3.summaryType,
|
|
112
|
-
numericColumnsOptions = _this$props3.numericColumnsOptions;
|
|
110
|
+
var summaryType = _this.props.summaryType;
|
|
113
111
|
if (type === summaryType) {
|
|
114
112
|
return;
|
|
115
113
|
}
|
|
116
114
|
var summaryColumnKey = null;
|
|
117
|
-
var summaryMethod = null;
|
|
118
|
-
if (type === STATISTICS_COUNT_TYPE.ADVANCED && Array.isArray(numericColumnsOptions) && numericColumnsOptions.length > 0) {
|
|
119
|
-
summaryColumnKey = numericColumnsOptions[0].value.key;
|
|
120
|
-
summaryMethod = SUMMARY_METHOD[0];
|
|
121
|
-
}
|
|
115
|
+
var summaryMethod = type === STATISTICS_COUNT_TYPE.ADVANCED ? SUMMARY_METHOD[0] : null;
|
|
122
116
|
_this.props.onChangeSummaryType(type, summaryColumnKey, summaryMethod);
|
|
123
117
|
};
|
|
124
118
|
_this.onSelectNumericColumn = function (columnOption) {
|