dtable-statistic 4.0.13 → 4.1.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.
- package/es/components/dialog/chart-addition-edit-dialog.js +1 -0
- package/es/components/dialog/statistic-record-dialog/index.js +128 -51
- package/es/constants/event-types.js +4 -1
- package/es/dashboard.js +26 -15
- package/es/desktop-dashboard.js +2 -0
- package/es/model/generic-model.js +2 -2
- package/es/stat-editor/index.js +1 -0
- package/es/stat-list/index.js +6 -1
- package/package.json +2 -2
|
@@ -68,6 +68,7 @@ var ChartAdditionEditDialog = /*#__PURE__*/function (_Component) {
|
|
|
68
68
|
}, intl.get(editMode ? 'Edit_the_chart' : 'Choose_a_chart')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
69
69
|
className: "statistic-modal-body"
|
|
70
70
|
}, editMode ? /*#__PURE__*/React.createElement(StatEditor, {
|
|
71
|
+
dtableChangedTime: this.props.dtableChangedTime,
|
|
71
72
|
colorThemeName: colorThemeName,
|
|
72
73
|
statItem: chart,
|
|
73
74
|
labelColorConfigs: labelColorConfigs,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -10,6 +11,7 @@ import dtableDbAPI from '../../../api/dtable-db-api';
|
|
|
10
11
|
import { DtableSearchInput, Loading } from '../../index';
|
|
11
12
|
import { searchRows } from '../../../utils';
|
|
12
13
|
import { getSqlString } from '../../../utils/sql-utils';
|
|
14
|
+
import { CommonEventTypes } from '../../../constants';
|
|
13
15
|
import './index.css';
|
|
14
16
|
export var UNSHOWN_COLUMN_TYPES = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
|
|
15
17
|
var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
@@ -21,21 +23,21 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
21
23
|
_this = _super.call(this, props);
|
|
22
24
|
_this.init = function () {
|
|
23
25
|
var chartRecordsParams = _this.props.chartRecordsParams;
|
|
26
|
+
if (!chartRecordsParams) return;
|
|
24
27
|
var _ref = chartRecordsParams || {},
|
|
25
28
|
statisticRecord = _ref.statisticRecord,
|
|
26
29
|
chart = _ref.chart,
|
|
27
30
|
isColumn = _ref.isColumn,
|
|
28
31
|
isCurrentView = _ref.isCurrentView,
|
|
29
32
|
isRow = _ref.isRow;
|
|
30
|
-
var records = statisticRecord.rows
|
|
31
|
-
title = statisticRecord.name;
|
|
33
|
+
var records = statisticRecord.rows;
|
|
32
34
|
var getTableById = _this.props.getTableById;
|
|
33
35
|
var table_id = chart.table_id,
|
|
34
36
|
view_id = chart.view_id;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (isArchiveView || !records) {
|
|
37
|
+
_this.table = getTableById(table_id);
|
|
38
|
+
_this.view = Views.getViewById(_this.table.views, view_id);
|
|
39
|
+
_this.isArchiveView = Views.isArchiveView(_this.view);
|
|
40
|
+
if (_this.isArchiveView || !records) {
|
|
39
41
|
var sqlString = getSqlString(chart, statisticRecord, {
|
|
40
42
|
isColumn: isColumn,
|
|
41
43
|
isCurrentView: isCurrentView,
|
|
@@ -44,29 +46,33 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
44
46
|
});
|
|
45
47
|
dtableDbAPI.sqlQuery(sqlString).then(function (res) {
|
|
46
48
|
var rows = res.data.results;
|
|
47
|
-
|
|
48
|
-
_this.setState({
|
|
49
|
-
loading: false,
|
|
50
|
-
title: title,
|
|
51
|
-
rows: rows,
|
|
52
|
-
searchedRows: searchedRows
|
|
53
|
-
});
|
|
49
|
+
_this.processDrilledRows(rows);
|
|
54
50
|
});
|
|
55
51
|
return;
|
|
56
52
|
}
|
|
57
|
-
|
|
53
|
+
_this.processDrilledRows(records);
|
|
54
|
+
};
|
|
55
|
+
_this.processDrilledRows = function (drilledRows) {
|
|
56
|
+
var statisticRecord = _this.props.chartRecordsParams.statisticRecord;
|
|
57
|
+
var name = statisticRecord.name;
|
|
58
|
+
var searchedRowsIds = _this.getSearchedRows(drilledRows);
|
|
59
|
+
var idRowMap = {};
|
|
60
|
+
drilledRows.forEach(function (row) {
|
|
61
|
+
idRowMap[row._id] = row;
|
|
62
|
+
});
|
|
58
63
|
_this.setState({
|
|
59
64
|
loading: false,
|
|
60
|
-
title:
|
|
61
|
-
rows:
|
|
62
|
-
|
|
65
|
+
title: name,
|
|
66
|
+
rows: drilledRows,
|
|
67
|
+
idRowMap: idRowMap,
|
|
68
|
+
searchedRowsIds: searchedRowsIds
|
|
63
69
|
});
|
|
64
70
|
};
|
|
65
71
|
_this.onSearch = function (searchVal) {
|
|
66
72
|
var rows = _this.state.rows;
|
|
67
|
-
var
|
|
73
|
+
var searchedRowsIds = _this.getSearchedRows(rows, searchVal);
|
|
68
74
|
_this.setState({
|
|
69
|
-
|
|
75
|
+
searchedRowsIds: searchedRowsIds,
|
|
70
76
|
searchVal: searchVal
|
|
71
77
|
});
|
|
72
78
|
};
|
|
@@ -76,58 +82,116 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
76
82
|
_this.timer = null;
|
|
77
83
|
}
|
|
78
84
|
};
|
|
79
|
-
_this.getStatisticTable = function () {
|
|
80
|
-
var _this$props = _this.props,
|
|
81
|
-
chartRecordsParams = _this$props.chartRecordsParams,
|
|
82
|
-
getTableById = _this$props.getTableById;
|
|
83
|
-
var table_id = chartRecordsParams.chart.table_id;
|
|
84
|
-
return getTableById(table_id);
|
|
85
|
-
};
|
|
86
|
-
_this.getStatisticView = function (table) {
|
|
87
|
-
var chartRecordsParams = _this.props.chartRecordsParams;
|
|
88
|
-
var view_id = chartRecordsParams.chart.view_id;
|
|
89
|
-
return Views.getViewById(table.views, view_id);
|
|
90
|
-
};
|
|
91
|
-
_this.getStatisticColumns = function () {
|
|
92
|
-
var table = _this.getStatisticTable();
|
|
93
|
-
var view = _this.getStatisticView(table);
|
|
94
|
-
return Views.getColumns(view, table);
|
|
95
|
-
};
|
|
96
85
|
_this.clearSearch = function () {
|
|
97
86
|
var rows = _this.state.rows;
|
|
87
|
+
var searchedRowsIds = _this.getSearchedRows(rows);
|
|
98
88
|
_this.setState({
|
|
99
|
-
|
|
89
|
+
searchedRowsIds: searchedRowsIds,
|
|
100
90
|
searchVal: ''
|
|
101
91
|
});
|
|
102
92
|
};
|
|
103
93
|
_this.getSearchedRows = function (rows, searchVal) {
|
|
94
|
+
if (!Array.isArray(rows) || rows.length === 0) return [];
|
|
104
95
|
if (searchVal) {
|
|
105
|
-
return searchRows(rows, _this.
|
|
96
|
+
return searchRows(rows, Views.getColumns(_this.view, _this.table), searchVal, function (row) {
|
|
106
97
|
return row;
|
|
98
|
+
}).map(function (row) {
|
|
99
|
+
return row._id;
|
|
107
100
|
});
|
|
108
101
|
}
|
|
109
|
-
return rows
|
|
102
|
+
return rows.map(function (row) {
|
|
103
|
+
return row._id;
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
_this.getRowsByIds = function (rowsIds) {
|
|
107
|
+
if (!Array.isArray(rowsIds) || rowsIds.length === 0) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
var idRowMap = _this.state.idRowMap;
|
|
111
|
+
return rowsIds.map(function (rowId) {
|
|
112
|
+
return idRowMap[rowId];
|
|
113
|
+
}).filter(Boolean);
|
|
110
114
|
};
|
|
111
115
|
_this.toggle = function () {
|
|
116
|
+
if (_this.valueChanged) {
|
|
117
|
+
_this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
|
|
118
|
+
}
|
|
112
119
|
_this.props.toggleStatisticRecordsDialog();
|
|
113
120
|
};
|
|
114
|
-
_this.
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
_this.expandRowUpdated = function (_ref2) {
|
|
122
|
+
var table_id = _ref2.table_id,
|
|
123
|
+
updatedRow = _ref2.updatedRow;
|
|
124
|
+
// none-matched
|
|
125
|
+
if (table_id !== _this.table._id) return;
|
|
126
|
+
var _this$state = _this.state,
|
|
127
|
+
rows = _this$state.rows,
|
|
128
|
+
searchedRowsIds = _this$state.searchedRowsIds,
|
|
129
|
+
idRowMap = _this$state.idRowMap,
|
|
130
|
+
searchVal = _this$state.searchVal;
|
|
131
|
+
var updatedSearchedRowsIds = searchedRowsIds;
|
|
132
|
+
var updatedRows = _toConsumableArray(rows);
|
|
133
|
+
var updatedIdRowMap = idRowMap;
|
|
134
|
+
rows.forEach(function (row, index) {
|
|
135
|
+
var rowId = row._id;
|
|
136
|
+
if (rowId === updatedRow._id) {
|
|
137
|
+
updatedRows[index] = updatedRow;
|
|
138
|
+
updatedIdRowMap[rowId] = updatedRow;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (searchedRowsIds.length > 0) {
|
|
142
|
+
var searchedRows = _this.getRowsByIds(searchedRowsIds);
|
|
143
|
+
updatedSearchedRowsIds = _this.getSearchedRows(searchedRows, searchVal);
|
|
118
144
|
}
|
|
145
|
+
_this.valueChanged = true;
|
|
146
|
+
_this.setState({
|
|
147
|
+
rows: updatedRows,
|
|
148
|
+
idRowMap: updatedIdRowMap,
|
|
149
|
+
searchedRowsIds: updatedSearchedRowsIds
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
_this.expandRowDeleted = function (_ref3) {
|
|
153
|
+
var table_id = _ref3.table_id,
|
|
154
|
+
row_id = _ref3.row_id;
|
|
155
|
+
// none-matched
|
|
156
|
+
if (table_id !== _this.table._id) return;
|
|
157
|
+
var _this$state2 = _this.state,
|
|
158
|
+
rows = _this$state2.rows,
|
|
159
|
+
searchedRowsIds = _this$state2.searchedRowsIds,
|
|
160
|
+
idRowMap = _this$state2.idRowMap;
|
|
161
|
+
var updatedSearchedRowsIds = searchedRowsIds;
|
|
162
|
+
var updatedIdRowMap = idRowMap;
|
|
163
|
+
var updatedRows = rows.filter(function (row) {
|
|
164
|
+
return row._id !== row_id;
|
|
165
|
+
});
|
|
166
|
+
delete updatedIdRowMap[row_id];
|
|
167
|
+
if (searchedRowsIds.length > 0) {
|
|
168
|
+
updatedSearchedRowsIds = searchedRowsIds.filter(function (rowId) {
|
|
169
|
+
return rowId !== row_id;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
_this.valueChanged = true;
|
|
173
|
+
_this.setState({
|
|
174
|
+
rows: updatedRows,
|
|
175
|
+
idRowMap: updatedIdRowMap,
|
|
176
|
+
searchedRowsIds: updatedSearchedRowsIds
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
_this.renderRowsCards = function () {
|
|
180
|
+
var searchedRowsIds = _this.state.searchedRowsIds;
|
|
181
|
+
var searchedRows = _this.getRowsByIds(searchedRowsIds);
|
|
182
|
+
if (searchedRows.length === 0) return null;
|
|
119
183
|
var unShowColumnKeyList = ['0000'];
|
|
120
|
-
var
|
|
121
|
-
var renderedColumns =
|
|
184
|
+
var allColumns = _this.table.columns;
|
|
185
|
+
var renderedColumns = allColumns.filter(function (column) {
|
|
122
186
|
return !unShowColumnKeyList.includes(column.key) && !UNSHOWN_COLUMN_TYPES.includes(column.type);
|
|
123
187
|
});
|
|
124
188
|
if (!window.app || !window.app.renderRowsCards) return null;
|
|
125
189
|
return window.app.renderRowsCards({
|
|
126
|
-
table: table,
|
|
190
|
+
table: _this.table,
|
|
127
191
|
renderedColumns: renderedColumns,
|
|
128
192
|
unShowColumnKeyList: unShowColumnKeyList,
|
|
129
193
|
isShowRowCardHeader: true,
|
|
130
|
-
columns:
|
|
194
|
+
columns: allColumns,
|
|
131
195
|
rows: searchedRows,
|
|
132
196
|
rowCardType: 'statistic'
|
|
133
197
|
});
|
|
@@ -136,22 +200,35 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
136
200
|
loading: true,
|
|
137
201
|
title: '',
|
|
138
202
|
rows: [],
|
|
203
|
+
idRowMap: {},
|
|
139
204
|
searchVal: '',
|
|
140
|
-
|
|
205
|
+
searchedRowsIds: []
|
|
141
206
|
};
|
|
207
|
+
_this.table = null;
|
|
208
|
+
_this.view = null;
|
|
209
|
+
_this.isArchiveView = false;
|
|
210
|
+
_this.valueChanged = false;
|
|
142
211
|
return _this;
|
|
143
212
|
}
|
|
144
213
|
_createClass(StatisticRecordDialog, [{
|
|
145
214
|
key: "componentDidMount",
|
|
146
215
|
value: function componentDidMount() {
|
|
216
|
+
this.unsubscribeExpandRowUpdated = this.props.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_UPDATED, this.expandRowUpdated);
|
|
217
|
+
this.unsubscribeExpandRowDeleted = this.props.eventBus.subscribe(CommonEventTypes.EXPAND_ROW_DELETED, this.expandRowDeleted);
|
|
147
218
|
this.init();
|
|
148
219
|
}
|
|
220
|
+
}, {
|
|
221
|
+
key: "componentWillUnmount",
|
|
222
|
+
value: function componentWillUnmount() {
|
|
223
|
+
this.unsubscribeExpandRowUpdated();
|
|
224
|
+
this.unsubscribeExpandRowDeleted();
|
|
225
|
+
}
|
|
149
226
|
}, {
|
|
150
227
|
key: "render",
|
|
151
228
|
value: function render() {
|
|
152
|
-
var _this$
|
|
153
|
-
loading = _this$
|
|
154
|
-
title = _this$
|
|
229
|
+
var _this$state3 = this.state,
|
|
230
|
+
loading = _this$state3.loading,
|
|
231
|
+
title = _this$state3.title;
|
|
155
232
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
156
233
|
isOpen: true,
|
|
157
234
|
autoFocus: false,
|
package/es/dashboard.js
CHANGED
|
@@ -16,7 +16,7 @@ import ThreadManager from './calculator/thread-manager';
|
|
|
16
16
|
import ChartCalculator from './calculator';
|
|
17
17
|
import { isMobile } from './utils';
|
|
18
18
|
import { generatorUniqueId } from './utils/common-utils';
|
|
19
|
-
import { DASHBOARD_ACTION_TYPE, KEY_SELECTED_DASHBOARD, LABEL_COLORS } from './constants';
|
|
19
|
+
import { CommonEventTypes, DASHBOARD_ACTION_TYPE, KEY_SELECTED_DASHBOARD, LABEL_COLORS } from './constants';
|
|
20
20
|
import './locale';
|
|
21
21
|
import './assets/css/dashboard.css';
|
|
22
22
|
import './assets/css/theme.css';
|
|
@@ -46,12 +46,17 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
46
46
|
_this.updatingLocalStatistics = false;
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
_this.onDTableChanged(
|
|
49
|
+
_this.onDTableChanged({
|
|
50
|
+
value: value
|
|
51
|
+
});
|
|
50
52
|
};
|
|
51
53
|
_this.onServerDTableChanged = function (value) {
|
|
52
|
-
_this.onDTableChanged(
|
|
54
|
+
_this.onDTableChanged({
|
|
55
|
+
value: value
|
|
56
|
+
});
|
|
53
57
|
};
|
|
54
|
-
_this.onDTableChanged = function (
|
|
58
|
+
_this.onDTableChanged = function (_ref) {
|
|
59
|
+
var value = _ref.value;
|
|
55
60
|
_this.value = value;
|
|
56
61
|
_this.disabledUpdateLayout = true;
|
|
57
62
|
var _this$initDashboard = _this.initDashboard(),
|
|
@@ -59,7 +64,11 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
59
64
|
selectedDashboardIdx = _this$initDashboard.selectedDashboardIdx;
|
|
60
65
|
_this.setState({
|
|
61
66
|
statistics: statistics,
|
|
62
|
-
selectedDashboardIdx: selectedDashboardIdx
|
|
67
|
+
selectedDashboardIdx: selectedDashboardIdx
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
_this.refreshCharts = function () {
|
|
71
|
+
_this.setState({
|
|
63
72
|
dtableChangedTime: Date.now()
|
|
64
73
|
});
|
|
65
74
|
};
|
|
@@ -141,11 +150,11 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
141
150
|
if (!activeViewId) return selectedTable.views[0];
|
|
142
151
|
return Views.getViewById(selectedTable.views, activeViewId);
|
|
143
152
|
};
|
|
144
|
-
_this.getInitChart = function (
|
|
145
|
-
var chartType =
|
|
146
|
-
dashboard =
|
|
147
|
-
activeTable =
|
|
148
|
-
activeView =
|
|
153
|
+
_this.getInitChart = function (_ref2) {
|
|
154
|
+
var chartType = _ref2.chartType,
|
|
155
|
+
dashboard = _ref2.dashboard,
|
|
156
|
+
activeTable = _ref2.activeTable,
|
|
157
|
+
activeView = _ref2.activeView;
|
|
149
158
|
return _this.chartService.getInitChart({
|
|
150
159
|
type: chartType,
|
|
151
160
|
dashboard: dashboard,
|
|
@@ -153,10 +162,10 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
153
162
|
activeView: activeView
|
|
154
163
|
});
|
|
155
164
|
};
|
|
156
|
-
_this.getConvertedChart = function (
|
|
157
|
-
var originalStatistic =
|
|
158
|
-
targetStatisticType =
|
|
159
|
-
activeTable =
|
|
165
|
+
_this.getConvertedChart = function (_ref3) {
|
|
166
|
+
var originalStatistic = _ref3.originalStatistic,
|
|
167
|
+
targetStatisticType = _ref3.targetStatisticType,
|
|
168
|
+
activeTable = _ref3.activeTable;
|
|
160
169
|
return _this.chartService.getConvertedChart({
|
|
161
170
|
originalStatistic: originalStatistic,
|
|
162
171
|
targetStatisticType: targetStatisticType,
|
|
@@ -225,7 +234,6 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
225
234
|
var nextSelectedDashboardIdx = selectedDashboardIdx;
|
|
226
235
|
if (index === statistics.length - 1) {
|
|
227
236
|
nextSelectedDashboardIdx--;
|
|
228
|
-
_this.clearCalculations();
|
|
229
237
|
}
|
|
230
238
|
var updatedStatistics = _this.dashboardService.update({
|
|
231
239
|
action: DASHBOARD_ACTION_TYPE.DELETE_DASHBOARD,
|
|
@@ -234,6 +242,7 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
234
242
|
}
|
|
235
243
|
});
|
|
236
244
|
_this.setSelectedDashboardIdx(nextSelectedDashboardIdx);
|
|
245
|
+
_this.clearCalculations();
|
|
237
246
|
_this.updateStatistics({
|
|
238
247
|
statistics: updatedStatistics,
|
|
239
248
|
selectedDashboardIdx: nextSelectedDashboardIdx
|
|
@@ -389,12 +398,14 @@ var DashBoard = /*#__PURE__*/function (_Component) {
|
|
|
389
398
|
var eventBus = this.props.eventBus;
|
|
390
399
|
this.unsubscribeLocalDtableChanged = eventBus.subscribe('local-dtable-changed', this.onLocalDTableChanged);
|
|
391
400
|
this.unsubscribeRemoteDtableChange = eventBus.subscribe('remote-dtable-changed', this.onServerDTableChanged);
|
|
401
|
+
this.unsubscribeRefreshCharts = eventBus.subscribe(CommonEventTypes.REFRESH_CHARTS, this.refreshCharts);
|
|
392
402
|
}
|
|
393
403
|
}, {
|
|
394
404
|
key: "componentWillUnmount",
|
|
395
405
|
value: function componentWillUnmount() {
|
|
396
406
|
this.unsubscribeLocalDtableChanged();
|
|
397
407
|
this.unsubscribeRemoteDtableChange();
|
|
408
|
+
this.unsubscribeRefreshCharts();
|
|
398
409
|
this.clearCalculations();
|
|
399
410
|
}
|
|
400
411
|
}, {
|
package/es/desktop-dashboard.js
CHANGED
|
@@ -235,6 +235,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
235
235
|
onCloseDashboard: this.props.onCloseDashboard,
|
|
236
236
|
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
237
237
|
})), this.state.isShowChartAdditionDialog && /*#__PURE__*/React.createElement(ChartAdditionEditDialog, {
|
|
238
|
+
dtableChangedTime: dtableChangedTime,
|
|
238
239
|
colorThemeName: colorThemeName,
|
|
239
240
|
editingChart: editingChart,
|
|
240
241
|
labelColorConfigs: labelColorConfigs,
|
|
@@ -254,6 +255,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
254
255
|
onToggleColorThemeDialog: this.onToggleColorThemeDialog,
|
|
255
256
|
modifyColorTheme: this.props.modifyColorTheme
|
|
256
257
|
}), !!chartRecordsParams && /*#__PURE__*/React.createElement(StatisticRecordDialog, {
|
|
258
|
+
eventBus: this.props.eventBus,
|
|
257
259
|
chartRecordsParams: chartRecordsParams,
|
|
258
260
|
getTableById: getTableById,
|
|
259
261
|
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
@@ -6,7 +6,7 @@ import BaseModel from './base-model';
|
|
|
6
6
|
import { getChartConfigValueFromKey, getChartConfigValueFromKeys } from '../utils/model';
|
|
7
7
|
import { isBoolean } from '../utils/common-utils';
|
|
8
8
|
import { DATE_GRANULARITY, DATE_GRANULARITY_LIST, DEFAULT_LABEL_FONT_SIZE, GEOLOCATION_GRANULARITY, GEOLOCATION_GRANULARITY_LIST } from '../constants';
|
|
9
|
-
import { COLUMN_DATE_GRANULARITY_KEYS, COLUMN_GEO_GRANULARITY_KEYS, COLUMN_GROUPBY_KEYS, LABEL_FRONT_SIZE_KEYS, X_DATE_GRANULARITY_KEYS, X_GEO_GRANULARITY_KEYS, X_GROUPBY_KEYS, X_INCLUDE_EMPTY_KEYS, X_LABEL_POSITION_KEYS, Y_AUTO_RANGE_KEYS, Y_AUTO_RANGE_MAX_KEYS, Y_AUTO_RANGE_MIN_KEYS, Y_LABEL_COLOR_KEYS, Y_LABEL_COLOR_RULES_KEYS, Y_LABEL_POSITION_KEYS, Y_SHOW_AXIS_LABEL_KEYS, Y_SUMMARY_BY_KEYS, Y_SUMMARY_METHOD_KEYS, Y_SUMMARY_TYPE_KEYS } from '../constants/model';
|
|
9
|
+
import { COLUMN_DATE_GRANULARITY_KEYS, COLUMN_GEO_GRANULARITY_KEYS, COLUMN_GROUPBY_KEYS, LABEL_FRONT_SIZE_KEYS, X_DATE_GRANULARITY_KEYS, X_GEO_GRANULARITY_KEYS, X_GROUPBY_KEYS, X_INCLUDE_EMPTY_KEYS, X_LABEL_POSITION_KEYS, X_SHOW_AXIS_LABEL, Y_AUTO_RANGE_KEYS, Y_AUTO_RANGE_MAX_KEYS, Y_AUTO_RANGE_MIN_KEYS, Y_LABEL_COLOR_KEYS, Y_LABEL_COLOR_RULES_KEYS, Y_LABEL_POSITION_KEYS, Y_SHOW_AXIS_LABEL_KEYS, Y_SUMMARY_BY_KEYS, Y_SUMMARY_METHOD_KEYS, Y_SUMMARY_TYPE_KEYS } from '../constants/model';
|
|
10
10
|
var GenericModel = /*#__PURE__*/function (_BaseModel) {
|
|
11
11
|
_inherits(GenericModel, _BaseModel);
|
|
12
12
|
var _super = _createSuper(GenericModel);
|
|
@@ -35,7 +35,7 @@ var GenericModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
35
35
|
_this.x_axis_compared_date_range_end = getChartConfigValueFromKey('x_axis_compared_date_range_end', object);
|
|
36
36
|
|
|
37
37
|
// x style
|
|
38
|
-
_this.show_x_axis_label = getChartConfigValueFromKeys(
|
|
38
|
+
_this.show_x_axis_label = getChartConfigValueFromKeys(X_SHOW_AXIS_LABEL, object);
|
|
39
39
|
if (!isBoolean(_this.show_x_axis_label)) {
|
|
40
40
|
_this.show_x_axis_label = null;
|
|
41
41
|
}
|
package/es/stat-editor/index.js
CHANGED
|
@@ -42,6 +42,7 @@ var StatEditor = /*#__PURE__*/function (_Component) {
|
|
|
42
42
|
isEdit: true,
|
|
43
43
|
isPreview: false,
|
|
44
44
|
isEnlarge: false,
|
|
45
|
+
dtableChangedTime: this.props.dtableChangedTime,
|
|
45
46
|
colorThemeName: colorThemeName,
|
|
46
47
|
statItem: statItem,
|
|
47
48
|
labelColorConfigs: labelColorConfigs,
|
package/es/stat-list/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { NewTableDialog, toaster } from '../components';
|
|
|
13
13
|
import EnlargeChartDialog from '../components/dialog/enlarged-chart-dialog';
|
|
14
14
|
import TableSelectDialog from '../components/dialog/table-select-dialog';
|
|
15
15
|
import { exportStatisticToTable, updateStatisticToTable } from '../utils/export-table-utils';
|
|
16
|
-
import { STAT_TYPE } from '../constants';
|
|
16
|
+
import { CommonEventTypes, STAT_TYPE } from '../constants';
|
|
17
17
|
var ReactGridLayout = WidthProvider(GridLayout);
|
|
18
18
|
var StatList = /*#__PURE__*/function (_Component) {
|
|
19
19
|
_inherits(StatList, _Component);
|
|
@@ -155,6 +155,11 @@ var StatList = /*#__PURE__*/function (_Component) {
|
|
|
155
155
|
rowIds: rowIds,
|
|
156
156
|
oldRows: oldRows
|
|
157
157
|
});
|
|
158
|
+
|
|
159
|
+
// refresh charts if has updates
|
|
160
|
+
if (Array.isArray(rowIds) && rowIds.length > 0 || Array.isArray(newRows) && newRows.length > 0) {
|
|
161
|
+
_this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
164
|
_this.statisticalResult4Update = null;
|
|
160
165
|
_this.closeSelectTableDialog();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.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.0
|
|
15
|
+
"dtable-store": "4.1.0",
|
|
16
16
|
"dtable-web-api": "4.0.5",
|
|
17
17
|
"glamor": "^2.20.40",
|
|
18
18
|
"html2canvas": "^1.4.1",
|