dtable-statistic 4.0.9 → 4.0.10
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.
|
@@ -306,8 +306,7 @@ function getGroupbyNumericColumnsChartResults(rows, formulaRows, groupbyColumn,
|
|
|
306
306
|
return getGroupChartStatResult(table, value, groupbyColumn, numericSummaryColumnKey, rows, formulaRows, includeEmpty, groupbyDateGranularity, groupbyGeolocationGranularity, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, summaryColumn, summaryType, summaryMethod, columnGroupbyMultipleNumericColumn, yAxisType);
|
|
307
307
|
}
|
|
308
308
|
function calculateGeolocationBasicChart(chart, value, username, userId) {
|
|
309
|
-
var
|
|
310
|
-
table_id = chart.table_id,
|
|
309
|
+
var table_id = chart.table_id,
|
|
311
310
|
view_id = chart.view_id,
|
|
312
311
|
geo_column = chart.geo_column,
|
|
313
312
|
geolocation_granularity = chart.geolocation_granularity,
|
|
@@ -315,9 +314,6 @@ function calculateGeolocationBasicChart(chart, value, username, userId) {
|
|
|
315
314
|
summary_column = chart.summary_column,
|
|
316
315
|
summary_method = chart.summary_method;
|
|
317
316
|
var geolocationGranularity = geolocation_granularity;
|
|
318
|
-
if (type === STAT_TYPE.WORLD_MAP || type === STAT_TYPE.WORLD_MAP_BUBBLE) {
|
|
319
|
-
geolocationGranularity = null;
|
|
320
|
-
}
|
|
321
317
|
var table = TableUtils.getTableById(value.tables, table_id);
|
|
322
318
|
var view = table && Views.getViewById(table.views, view_id);
|
|
323
319
|
if (!view) {
|
|
@@ -24,8 +24,14 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
24
24
|
_createClass(DashBoardService, [{
|
|
25
25
|
key: "initStatistics",
|
|
26
26
|
value: function initStatistics(value, updateStatistics, deletePluginSettings) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var baseStatistics = value && value.statistics || [];
|
|
28
|
+
var advancedStatistics = this.getAdvancedStatistics(value);
|
|
29
|
+
var hasBaseStatistics = baseStatistics.length > 0;
|
|
30
|
+
var hasAdvancedStatistics = advancedStatistics.length > 0;
|
|
31
|
+
this.statistics = baseStatistics;
|
|
32
|
+
|
|
33
|
+
// init default dashboard if neither base-statistics nor advanced-statistics
|
|
34
|
+
if (!hasBaseStatistics && !hasAdvancedStatistics) {
|
|
29
35
|
this.statistics = [new StatisticDashBoard({
|
|
30
36
|
_id: generatorUniqueId([]),
|
|
31
37
|
stat_items: [],
|
|
@@ -36,11 +42,15 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
36
42
|
this.needSave = false;
|
|
37
43
|
|
|
38
44
|
// convert to advance-statistic
|
|
39
|
-
if (!hasOwnProperty(this.statistics[0], 'stat_items')) {
|
|
45
|
+
if (hasBaseStatistics && !hasOwnProperty(this.statistics[0], 'stat_items')) {
|
|
40
46
|
this.needSave = true;
|
|
41
47
|
this.convert2AdvanceStatistic();
|
|
42
48
|
}
|
|
43
|
-
|
|
49
|
+
|
|
50
|
+
// merge advanced statistics
|
|
51
|
+
if (hasAdvancedStatistics) {
|
|
52
|
+
this.mergeAdvancedStatistics(advancedStatistics, deletePluginSettings);
|
|
53
|
+
}
|
|
44
54
|
this.filterInvalidCharts();
|
|
45
55
|
if (this.needSave) {
|
|
46
56
|
this.needSave = false;
|
|
@@ -148,12 +158,16 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
148
158
|
return this.chartService.generatorChart(convertedChart);
|
|
149
159
|
}
|
|
150
160
|
}, {
|
|
151
|
-
key: "
|
|
152
|
-
value: function
|
|
161
|
+
key: "getAdvancedStatistics",
|
|
162
|
+
value: function getAdvancedStatistics(value) {
|
|
153
163
|
if (!value || !hasOwnProperty(value, 'plugin_settings') || !hasOwnProperty(value.plugin_settings, ADVANCED_STATISTICS_NAME)) {
|
|
154
|
-
return;
|
|
164
|
+
return [];
|
|
155
165
|
}
|
|
156
|
-
|
|
166
|
+
return value.plugin_settings[ADVANCED_STATISTICS_NAME] || [];
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "mergeAdvancedStatistics",
|
|
170
|
+
value: function mergeAdvancedStatistics(advancedStatistics, deletePluginSettings) {
|
|
157
171
|
if (!Array.isArray(advancedStatistics) || advancedStatistics.length === 0 || this.statistics.some(function (dashboard) {
|
|
158
172
|
return dashboard.from_advanced;
|
|
159
173
|
}) // already merged from advanced
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
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.0.
|
|
15
|
+
"dtable-store": "4.0.6",
|
|
16
16
|
"dtable-web-api": "4.0.1",
|
|
17
17
|
"glamor": "^2.20.40",
|
|
18
18
|
"html2canvas": "^1.4.1",
|