dtable-statistic 4.0.9 → 4.0.11
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/workers/basic-chart-calculator-worker.js +1 -5
- package/es/components/dialog/new-table-dialog.js +1 -1
- package/es/locale/lang/de.js +5 -3
- package/es/locale/lang/en.js +2 -0
- package/es/locale/lang/fr.js +5 -3
- package/es/locale/lang/zh_CN.js +3 -1
- package/es/service/dashboard-service.js +22 -8
- package/es/stat-list/index.js +2 -4
- package/es/utils/export-table-utils.js +17 -16
- package/package.json +3 -3
|
@@ -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) {
|
|
@@ -86,7 +86,7 @@ var NewTableDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
86
86
|
autoFocus: false
|
|
87
87
|
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
88
88
|
toggle: this.toggle
|
|
89
|
-
}, intl.get('
|
|
89
|
+
}, intl.get('New_table')), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, {
|
|
90
90
|
for: "tableName"
|
|
91
91
|
}, intl.get('Name')), /*#__PURE__*/React.createElement(Input, {
|
|
92
92
|
id: "tableName",
|
package/es/locale/lang/de.js
CHANGED
|
@@ -138,8 +138,8 @@ var de = {
|
|
|
138
138
|
'Oct': 'Okt',
|
|
139
139
|
'Nov': 'Nov',
|
|
140
140
|
'Dec': 'Dez',
|
|
141
|
-
'Enter_date': '
|
|
142
|
-
'Please_select': '
|
|
141
|
+
'Enter_date': 'Datum eingeben',
|
|
142
|
+
'Please_select': 'Bitte auswählen',
|
|
143
143
|
'Total': 'Gesamt',
|
|
144
144
|
'Amount': 'Menge',
|
|
145
145
|
'Empty': 'Leer',
|
|
@@ -237,7 +237,9 @@ var de = {
|
|
|
237
237
|
'Add_new_stack': 'Neuen Stapel hinzufügen',
|
|
238
238
|
'Chart_type': 'Diagrammtyp',
|
|
239
239
|
'Edit_type': 'Typ ändern',
|
|
240
|
-
'
|
|
240
|
+
'New_table': 'New table',
|
|
241
|
+
'Select_table': 'Tabelle auswählen',
|
|
242
|
+
'Update_to_a_table': 'Aktualisierung in eine Tabelle',
|
|
241
243
|
'Export_to_a_new_table': 'In neue Tabelle exportieren'
|
|
242
244
|
};
|
|
243
245
|
export default de;
|
package/es/locale/lang/en.js
CHANGED
|
@@ -237,6 +237,8 @@ var en = {
|
|
|
237
237
|
'Add_new_stack': 'Add new stack',
|
|
238
238
|
'Chart_type': 'Chart type',
|
|
239
239
|
'Edit_type': 'Edit type',
|
|
240
|
+
'New_table': 'New table',
|
|
241
|
+
'Select_table': 'Select table',
|
|
240
242
|
'Update_to_a_table': 'Update to a table',
|
|
241
243
|
'Export_to_a_new_table': 'Export to a new table'
|
|
242
244
|
};
|
package/es/locale/lang/fr.js
CHANGED
|
@@ -138,8 +138,8 @@ var fr = {
|
|
|
138
138
|
'Oct': 'octobre',
|
|
139
139
|
'Nov': 'novembre',
|
|
140
140
|
'Dec': 'décembre',
|
|
141
|
-
'Enter_date': '
|
|
142
|
-
'Please_select': '
|
|
141
|
+
'Enter_date': 'Entrer une date',
|
|
142
|
+
'Please_select': 'Veuillez sélectionner',
|
|
143
143
|
'Total': 'Total',
|
|
144
144
|
'Amount': 'Nombre',
|
|
145
145
|
'Empty': 'Vide',
|
|
@@ -237,7 +237,9 @@ var fr = {
|
|
|
237
237
|
'Add_new_stack': 'Ajouter une nouvelle pile',
|
|
238
238
|
'Chart_type': 'Type de diagramme',
|
|
239
239
|
'Edit_type': 'Modifier le type',
|
|
240
|
-
'
|
|
240
|
+
'New_table': 'New table',
|
|
241
|
+
'Select_table': 'Sélectionner un tableau',
|
|
242
|
+
'Update_to_a_table': 'Mettre à jour vers un tableau',
|
|
241
243
|
'Export_to_a_new_table': 'Exporter dans un nouveau tableau'
|
|
242
244
|
};
|
|
243
245
|
export default fr;
|
package/es/locale/lang/zh_CN.js
CHANGED
|
@@ -50,7 +50,7 @@ var zh_CN = {
|
|
|
50
50
|
'Style_settings': '样式设置',
|
|
51
51
|
'Untitled': '未命名',
|
|
52
52
|
'Settings': '设置',
|
|
53
|
-
'Table': '
|
|
53
|
+
'Table': '子表',
|
|
54
54
|
'Views': '视图',
|
|
55
55
|
'Display_title': '显示标题',
|
|
56
56
|
'X-axis': 'X 轴',
|
|
@@ -237,6 +237,8 @@ var zh_CN = {
|
|
|
237
237
|
'Add_new_stack': '添加新的堆叠',
|
|
238
238
|
'Chart_type': '图表类型',
|
|
239
239
|
'Edit_type': '编辑类型',
|
|
240
|
+
'New_table': '新建表',
|
|
241
|
+
'Select_table': '选择子表',
|
|
240
242
|
'Update_to_a_table': '更新到子表',
|
|
241
243
|
'Export_to_a_new_table': '导出到新的子表'
|
|
242
244
|
};
|
|
@@ -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/es/stat-list/index.js
CHANGED
|
@@ -101,8 +101,7 @@ var StatList = /*#__PURE__*/function (_Component) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
var _exportStatisticToTab = exportStatisticToTable({
|
|
104
|
-
statisticalResult: _this.statisticalResult4Export
|
|
105
|
-
t: intl
|
|
104
|
+
statisticalResult: _this.statisticalResult4Export
|
|
106
105
|
}),
|
|
107
106
|
columns = _exportStatisticToTab.columns,
|
|
108
107
|
rows = _exportStatisticToTab.rows;
|
|
@@ -142,8 +141,7 @@ var StatList = /*#__PURE__*/function (_Component) {
|
|
|
142
141
|
}
|
|
143
142
|
var _updateStatisticToTab = updateStatisticToTable({
|
|
144
143
|
updateTable: updateTable,
|
|
145
|
-
statisticalResult: _this.statisticalResult4Update
|
|
146
|
-
t: intl
|
|
144
|
+
statisticalResult: _this.statisticalResult4Update
|
|
147
145
|
}),
|
|
148
146
|
newRows = _updateStatisticToTab.newRows,
|
|
149
147
|
updatedRows = _updateStatisticToTab.updatedRows,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
3
4
|
import { getOption, getCollaborator, getNumberDisplayString, isNumber, CellType, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES, isDateColumn, TableUtils } from 'dtable-store';
|
|
4
5
|
import { isCellValueChanged } from './cell-value';
|
|
5
6
|
import { getSelectColumnOptions, getDateColumnFormat } from './column';
|
|
@@ -111,13 +112,13 @@ var getUpdatedOneDimensionStatisticTableResultToTable = function getUpdatedOneDi
|
|
|
111
112
|
|
|
112
113
|
// one dimension table no summary columns
|
|
113
114
|
if (pivot_columns.length < 2) {
|
|
114
|
-
columnMap['total'] = TableUtils.getTableColumnByName(updateTable,
|
|
115
|
+
columnMap['total'] = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
|
|
115
116
|
|
|
116
117
|
// updated rows
|
|
117
118
|
pivot_rows.forEach(function (item) {
|
|
118
119
|
var name = item.name,
|
|
119
120
|
total = item.total;
|
|
120
|
-
var groupName = name === null ?
|
|
121
|
+
var groupName = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
121
122
|
var row = tableRows.find(function (row) {
|
|
122
123
|
return row[nameColumn.key] === groupName;
|
|
123
124
|
});
|
|
@@ -171,7 +172,7 @@ var getUpdatedOneDimensionStatisticTableResultToTable = function getUpdatedOneDi
|
|
|
171
172
|
pivot_rows.forEach(function (item) {
|
|
172
173
|
var name = item.name,
|
|
173
174
|
total = item.total;
|
|
174
|
-
var groupName = name === null ?
|
|
175
|
+
var groupName = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
175
176
|
var row = tableRows.find(function (row) {
|
|
176
177
|
return row[nameColumnKey] === name;
|
|
177
178
|
});
|
|
@@ -234,10 +235,10 @@ var getUpdatedTwoDimensionStatisticTableResultToTable = function getUpdatedTwoDi
|
|
|
234
235
|
// updated columns
|
|
235
236
|
Array.isArray(pivot_columns) && pivot_columns.forEach(function (item) {
|
|
236
237
|
var key = item.key;
|
|
237
|
-
var columnName = key === null ?
|
|
238
|
+
var columnName = key === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(key, columnGroupbyColumn);
|
|
238
239
|
columnMap[columnName] = TableUtils.getTableColumnByName(updateTable, columnName);
|
|
239
240
|
});
|
|
240
|
-
columnMap['total'] = TableUtils.getTableColumnByName(updateTable,
|
|
241
|
+
columnMap['total'] = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
|
|
241
242
|
|
|
242
243
|
// updated rows
|
|
243
244
|
var _loop = function _loop(i) {
|
|
@@ -245,7 +246,7 @@ var getUpdatedTwoDimensionStatisticTableResultToTable = function getUpdatedTwoDi
|
|
|
245
246
|
var name = pivotRow.name,
|
|
246
247
|
cells = pivotRow.cells,
|
|
247
248
|
total = pivotRow.total;
|
|
248
|
-
name = name === null ?
|
|
249
|
+
name = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
249
250
|
var nameColumnKey = nameColumn.key;
|
|
250
251
|
var row = tableRows.find(function (row) {
|
|
251
252
|
return row[nameColumnKey] === name;
|
|
@@ -261,7 +262,7 @@ var getUpdatedTwoDimensionStatisticTableResultToTable = function getUpdatedTwoDi
|
|
|
261
262
|
oldRow = row[totalColumn.key];
|
|
262
263
|
}
|
|
263
264
|
Object.keys(cells).forEach(function (key) {
|
|
264
|
-
var columnName = key === null ?
|
|
265
|
+
var columnName = key === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(key, columnGroupbyColumn);
|
|
265
266
|
var column = columnMap[columnName];
|
|
266
267
|
var validCellValue = getValidValueForColumn(column, cells[key].total);
|
|
267
268
|
if (column && isCellValueChanged(row[column.key], validCellValue, column.type)) {
|
|
@@ -283,7 +284,7 @@ var getUpdatedTwoDimensionStatisticTableResultToTable = function getUpdatedTwoDi
|
|
|
283
284
|
newRow[totalColumn.key] = getValidValueForColumn(totalColumn, name);
|
|
284
285
|
}
|
|
285
286
|
Object.keys(cells).forEach(function (key) {
|
|
286
|
-
var columnName = key === null ?
|
|
287
|
+
var columnName = key === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(key, columnGroupbyColumn);
|
|
287
288
|
var column = columnMap[columnName];
|
|
288
289
|
if (column) {
|
|
289
290
|
newRow[column.key] = getValidValueForColumn(column, cells[key].total);
|
|
@@ -407,7 +408,7 @@ export var getOneDimensionStatisticTableResultToTable = function getOneDimension
|
|
|
407
408
|
// total column
|
|
408
409
|
var totalColumn = {
|
|
409
410
|
type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
|
|
410
|
-
name:
|
|
411
|
+
name: intl.get('Total'),
|
|
411
412
|
data: columnData
|
|
412
413
|
};
|
|
413
414
|
columns.push(totalColumn);
|
|
@@ -417,12 +418,12 @@ export var getOneDimensionStatisticTableResultToTable = function getOneDimension
|
|
|
417
418
|
var _newRow2;
|
|
418
419
|
var name = item.name,
|
|
419
420
|
total = item.total;
|
|
420
|
-
var groupName = name === null ?
|
|
421
|
+
var groupName = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
421
422
|
var cellValue = total.total;
|
|
422
423
|
if (_isDateSummaryColumn && cellValue) {
|
|
423
424
|
cellValue = isIncludeHour ? dayjs(cellValue).format('YYYY-MM-DD HH:mm') : dayjs(cellValue).format('YYYY-MM-DD');
|
|
424
425
|
}
|
|
425
|
-
var newRow = (_newRow2 = {}, _defineProperty(_newRow2, groupbyColumn.name, groupName), _defineProperty(_newRow2,
|
|
426
|
+
var newRow = (_newRow2 = {}, _defineProperty(_newRow2, groupbyColumn.name, groupName), _defineProperty(_newRow2, intl.get('Total'), cellValue), _newRow2);
|
|
426
427
|
rows.push(newRow);
|
|
427
428
|
});
|
|
428
429
|
return {
|
|
@@ -482,7 +483,7 @@ export var getOneDimensionStatisticTableResultToTable = function getOneDimension
|
|
|
482
483
|
pivot_rows.forEach(function (item) {
|
|
483
484
|
var name = item.name,
|
|
484
485
|
total = item.total;
|
|
485
|
-
var groupName = name === null ?
|
|
486
|
+
var groupName = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
486
487
|
var newRow = _defineProperty({}, groupbyColumn.name, groupName);
|
|
487
488
|
Array.isArray(pivot_columns) && pivot_columns.forEach(function (item) {
|
|
488
489
|
var key = item.key;
|
|
@@ -561,7 +562,7 @@ export var getTwoDimensionStatisticTableResultToTable = function getTwoDimension
|
|
|
561
562
|
}
|
|
562
563
|
Array.isArray(pivot_columns) && pivot_columns.forEach(function (item) {
|
|
563
564
|
var key = item.key;
|
|
564
|
-
var columnName = key === null ?
|
|
565
|
+
var columnName = key === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(key, columnGroupbyColumn);
|
|
565
566
|
var newColumn = {
|
|
566
567
|
type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
|
|
567
568
|
name: columnName,
|
|
@@ -574,7 +575,7 @@ export var getTwoDimensionStatisticTableResultToTable = function getTwoDimension
|
|
|
574
575
|
// total column
|
|
575
576
|
var totalColumn = {
|
|
576
577
|
type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
|
|
577
|
-
name:
|
|
578
|
+
name: intl.get('Total'),
|
|
578
579
|
data: columnData
|
|
579
580
|
};
|
|
580
581
|
columns.push(totalColumn);
|
|
@@ -585,13 +586,13 @@ export var getTwoDimensionStatisticTableResultToTable = function getTwoDimension
|
|
|
585
586
|
var name = item.name,
|
|
586
587
|
cells = item.cells,
|
|
587
588
|
total = item.total;
|
|
588
|
-
name = name === null ?
|
|
589
|
+
name = name === null ? intl.get(EMPTY_NAME) : getTableValueDisplayName(name, groupbyColumn);
|
|
589
590
|
var newRow = _defineProperty({}, groupbyColumn.name, name);
|
|
590
591
|
var cellValue = total;
|
|
591
592
|
if (_isDateSummaryColumn && cellValue) {
|
|
592
593
|
cellValue = dayjs(cellValue).format(dateFormat);
|
|
593
594
|
}
|
|
594
|
-
newRow[
|
|
595
|
+
newRow[intl.get('Total')] = cellValue;
|
|
595
596
|
Object.keys(cells).forEach(function (key) {
|
|
596
597
|
var cellValue = cells[key].total;
|
|
597
598
|
if (_isDateSummaryColumn) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.11",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -12,8 +12,8 @@
|
|
|
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.
|
|
16
|
-
"dtable-web-api": "4.0.
|
|
15
|
+
"dtable-store": "4.0.6",
|
|
16
|
+
"dtable-web-api": "4.0.4",
|
|
17
17
|
"glamor": "^2.20.40",
|
|
18
18
|
"html2canvas": "^1.4.1",
|
|
19
19
|
"rc-slider": "^9.7.4",
|