dtable-statistic 4.0.7 → 4.0.8

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.
Files changed (60) hide show
  1. package/es/calculator/basic-chart-calculator.js +27 -18
  2. package/es/calculator/combination-calculator.js +34 -9
  3. package/es/calculator/compare-bar-calculator.js +37 -30
  4. package/es/calculator/heat-map-calculator.js +25 -14
  5. package/es/calculator/map-calculator.js +25 -14
  6. package/es/calculator/mirror-calculator.js +29 -14
  7. package/es/calculator/pivot-table-calculator.js +78 -51
  8. package/es/calculator/workers/basic-chart-calculator-worker.js +21 -6
  9. package/es/calculator/workers/combination-calculator-worker.js +20 -5
  10. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +12 -6
  11. package/es/calculator/workers/mirror-calculator-worker.js +15 -6
  12. package/es/calculator/workers/pivot-table-calculator-worker.js +87 -41
  13. package/es/calculator/world-map-calculator.js +25 -14
  14. package/es/components/dialog/enlarged-chart-dialog.js +2 -2
  15. package/es/components/dialog/statistic-record-dialog/index.js +71 -41
  16. package/es/constants/index.js +30 -29
  17. package/es/dashboard.js +57 -43
  18. package/es/desktop-dashboard.js +16 -51
  19. package/es/index.js +34 -2
  20. package/es/locale/lang/de.js +2 -0
  21. package/es/locale/lang/en.js +2 -0
  22. package/es/locale/lang/fr.js +2 -0
  23. package/es/locale/lang/zh_CN.js +2 -0
  24. package/es/mobile-dashboard.js +5 -5
  25. package/es/model/horizontal-bar-group.js +2 -0
  26. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +1 -2
  27. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +1 -1
  28. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +20 -3
  29. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +2 -8
  30. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +23 -2
  31. package/es/stat-list/chart-preview.js +3 -4
  32. package/es/stat-list/index.js +10 -4
  33. package/es/stat-view/area-chart.js +177 -162
  34. package/es/stat-view/bar-chart.js +221 -222
  35. package/es/stat-view/base-chart.js +79 -7
  36. package/es/stat-view/basic-number-card.js +11 -19
  37. package/es/stat-view/combination-chart.js +100 -83
  38. package/es/stat-view/compare-chart.js +133 -144
  39. package/es/stat-view/completeness-chart.js +108 -102
  40. package/es/stat-view/custom-bar.js +79 -99
  41. package/es/stat-view/dashboard-chart.js +57 -57
  42. package/es/stat-view/heat-map.js +13 -32
  43. package/es/stat-view/horizontal-bar-chart.js +200 -230
  44. package/es/stat-view/index.js +2 -2
  45. package/es/stat-view/line-chart.js +162 -158
  46. package/es/stat-view/map.js +26 -40
  47. package/es/stat-view/mirror.js +88 -94
  48. package/es/stat-view/pie-chart.js +11 -39
  49. package/es/stat-view/pivot-table/index.js +4 -16
  50. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +22 -15
  51. package/es/stat-view/ring-chart.js +24 -42
  52. package/es/stat-view/scatter-chart.js +4 -21
  53. package/es/stat-view/treemap-chart.js +3 -12
  54. package/es/stat-view/trend-chart.js +6 -17
  55. package/es/stat-view/world-map.js +39 -50
  56. package/es/tabs/tab.js +2 -1
  57. package/es/utils/common-utils.js +24 -6
  58. package/es/utils/sql-utils.js +10 -9
  59. package/es/utils/stat-utils.js +8 -5
  60. 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.onDTableDataChange = function (value) {
43
- _this.clearCalculations();
44
- var _this$initDashboard = _this.initDashboard({
45
- value: value
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
- refresh: true
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 (_ref) {
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(value);
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 (value) {
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 _this$props = _this.props,
131
- value = _this$props.value,
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 (_ref2) {
142
- var chartType = _ref2.chartType,
143
- dashboard = _ref2.dashboard,
144
- activeTable = _ref2.activeTable,
145
- activeView = _ref2.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 (_ref3) {
154
- var originalStatistic = _ref3.originalStatistic,
155
- targetStatisticType = _ref3.targetStatisticType,
156
- activeTable = _ref3.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.isInitDashboard = true;
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.props.value.tables, tableId);
349
+ return TableUtils.getTableById(_this.value.tables, tableId);
339
350
  };
340
351
  _this.getTables = function () {
341
- return _this.props.value.tables;
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
- refresh: false
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.unsubscribeRemoteTableDataChange = eventBus.subscribe('remote-dtable-changed', this.onDTableDataChange);
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.unsubscribeRemoteTableDataChange();
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
- editingChart = _this$state3.editingChart,
394
- refresh = _this$state3.refresh;
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
- refresh: refresh,
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
- refresh: refresh,
429
+ dtableChangedTime: dtableChangedTime,
416
430
  statistics: statistics,
417
431
  editingChart: editingChart,
418
432
  selectedDashboardIdx: selectedDashboardIdx,
@@ -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 { getSqlString } from './utils/sql-utils';
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 === 'dark' ? 'light' : 'dark';
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
- return;
97
- }
98
- var statisticRecords = statisticRecord.rows;
99
- if (!Array.isArray(statisticRecords) || statisticRecords.length === 0) return;
100
- var getTableById = _this.props.getTableById;
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
- getTableById: getTableById
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
- refresh = _this$props3.refresh,
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 === 'dark';
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 === 'dark' ? 'dtable-icon-day-mode' : 'dtable-icon-night-mode'),
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
- refresh: refresh,
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
- }), !!this.state.chartRecordsParams && /*#__PURE__*/React.createElement(StatisticRecordDialog, {
289
- isLoading: chartRecordsParams.isLoading,
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
- if (!window.app) return;
13
- window.app.mountWidget( /*#__PURE__*/React.createElement(DashBoard, props));
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",
@@ -138,6 +138,8 @@ var de = {
138
138
  'Oct': 'Okt',
139
139
  'Nov': 'Nov',
140
140
  'Dec': 'Dez',
141
+ 'Enter_date': 'Enter date',
142
+ 'Please_select': 'Please select',
141
143
  'Total': 'Gesamt',
142
144
  'Amount': 'Menge',
143
145
  'Empty': 'Leer',
@@ -138,6 +138,8 @@ var en = {
138
138
  'Oct': 'Oct',
139
139
  'Nov': 'Nov',
140
140
  'Dec': 'Dec',
141
+ 'Enter_date': 'Enter date',
142
+ 'Please_select': 'Please select',
141
143
  'Total': 'Total',
142
144
  'Amount': 'Amount',
143
145
  'Empty': 'Empty',
@@ -138,6 +138,8 @@ var fr = {
138
138
  'Oct': 'octobre',
139
139
  'Nov': 'novembre',
140
140
  'Dec': 'décembre',
141
+ 'Enter_date': 'Enter date',
142
+ 'Please_select': 'Please select',
141
143
  'Total': 'Total',
142
144
  'Amount': 'Nombre',
143
145
  'Empty': 'Vide',
@@ -138,6 +138,8 @@ var zh_CN = {
138
138
  'Oct': '十月',
139
139
  'Nov': '十一月',
140
140
  'Dec': '十二月',
141
+ 'Enter_date': '输入日期',
142
+ 'Please_select': '请选择',
141
143
  'Total': '总计',
142
144
  'Amount': '数量',
143
145
  'Empty': '空',
@@ -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
- refresh = _this$props.refresh,
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: 'light',
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
- refresh: refresh,
90
- theme: "light",
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;
@@ -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
- var defaultColumn = _this.numericColumns[0];
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, {
@@ -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 _ref5 = statItem || {},
106
- h_axis_auto_range = _ref5.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 _this$props3 = _this.props,
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) {
@@ -6,7 +6,7 @@ import React, { Component } from 'react';
6
6
  import intl from 'react-intl-universal';
7
7
  import Icon from '../../../../components/icon';
8
8
  import StatisticTypesDialog from '../../../../components/dialog/statistic-types-dialog';
9
- import { STATISTIC_TYPE_SHOW } from '../../../../constants';
9
+ import { STATISTIC_TYPE_SHOW, STAT_TYPE } from '../../../../constants';
10
10
  import './index.css';
11
11
  var TypeSettings = /*#__PURE__*/function (_Component) {
12
12
  _inherits(TypeSettings, _Component);
@@ -25,6 +25,27 @@ var TypeSettings = /*#__PURE__*/function (_Component) {
25
25
  isShowDialog: false
26
26
  });
27
27
  };
28
+ _this.getChartTypeName = function () {
29
+ var chartType = _this.props.chart.type;
30
+ switch (chartType) {
31
+ case STAT_TYPE.MAP:
32
+ {
33
+ return '中国地图';
34
+ }
35
+ case STAT_TYPE.MAP_BUBBLE:
36
+ {
37
+ return '中国地图(气泡图)';
38
+ }
39
+ case STAT_TYPE.WORLD_MAP_BUBBLE:
40
+ {
41
+ return "".concat(intl.get(STATISTIC_TYPE_SHOW[STAT_TYPE.WORLD_MAP]), "(").concat(intl.get('Bubble'), ")");
42
+ }
43
+ default:
44
+ {
45
+ return intl.get(STATISTIC_TYPE_SHOW[chartType]);
46
+ }
47
+ }
48
+ };
28
49
  _this.state = {
29
50
  isShowDialog: false
30
51
  };
@@ -40,7 +61,7 @@ var TypeSettings = /*#__PURE__*/function (_Component) {
40
61
  className: "statistic-chart-parameter-item"
41
62
  }, /*#__PURE__*/React.createElement("label", null, intl.get('Chart_type')), /*#__PURE__*/React.createElement("div", {
42
63
  className: "statistic-selected-type-container d-flex align-items-center"
43
- }, /*#__PURE__*/React.createElement("span", null, intl.get(STATISTIC_TYPE_SHOW[chartType]) || STATISTIC_TYPE_SHOW[chartType]), /*#__PURE__*/React.createElement("div", {
64
+ }, /*#__PURE__*/React.createElement("span", null, this.getChartTypeName()), /*#__PURE__*/React.createElement("div", {
44
65
  className: "statistic-switch-type-container",
45
66
  onClick: this.openTypesDialog
46
67
  }, /*#__PURE__*/React.createElement(Icon, {