dtable-statistic 4.2.2 → 4.3.1

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 (219) hide show
  1. package/es/api/dtable-db-api.js +31 -37
  2. package/es/calculator/base-calculator.js +49 -99
  3. package/es/calculator/basic-chart-calculator.js +335 -559
  4. package/es/calculator/combination-calculator.js +231 -299
  5. package/es/calculator/compare-bar-calculator.js +184 -281
  6. package/es/calculator/completeness-calculator.js +203 -288
  7. package/es/calculator/copy-value.js +18 -18
  8. package/es/calculator/dashboard-calculator.js +68 -137
  9. package/es/calculator/heat-map-calculator.js +139 -220
  10. package/es/calculator/horizontal-bar-calculator.js +64 -93
  11. package/es/calculator/index.js +53 -69
  12. package/es/calculator/map-calculator.js +98 -174
  13. package/es/calculator/mirror-calculator.js +137 -216
  14. package/es/calculator/number-card-calculator.js +58 -126
  15. package/es/calculator/pivot-table-calculator.js +750 -792
  16. package/es/calculator/scatter-calculator.js +72 -140
  17. package/es/calculator/thread-manager.js +48 -67
  18. package/es/calculator/trend-calculator.js +107 -191
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
  20. package/es/calculator/workers/calculator.worker.js +22 -6
  21. package/es/calculator/workers/card-calculator-worker.js +16 -14
  22. package/es/calculator/workers/combination-calculator-worker.js +128 -135
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
  24. package/es/calculator/workers/completeness-calculator-worker.js +56 -49
  25. package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
  26. package/es/calculator/workers/mirror-calculator-worker.js +52 -52
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
  28. package/es/calculator/workers/scatter-calculator-worker.js +34 -32
  29. package/es/calculator/workers/trend-calculator-worker.js +33 -29
  30. package/es/calculator/world-map-calculator.js +120 -197
  31. package/es/components/common-add-tool.js +7 -5
  32. package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
  34. package/es/components/dialog/color-theme-dialog.js +34 -47
  35. package/es/components/dialog/delete-confirmation-dialog.js +7 -5
  36. package/es/components/dialog/enlarged-chart-dialog.js +68 -81
  37. package/es/components/dialog/new-table-dialog.js +62 -80
  38. package/es/components/dialog/new-view-dialog.js +50 -62
  39. package/es/components/dialog/rename-view-dialog.js +49 -58
  40. package/es/components/dialog/statistic-record-dialog/index.js +233 -231
  41. package/es/components/dialog/statistic-types-dialog/index.js +40 -49
  42. package/es/components/dialog/table-select-dialog.js +61 -70
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
  44. package/es/components/dtable-popover.js +62 -81
  45. package/es/components/dtable-search-input.js +89 -99
  46. package/es/components/dtable-select.js +55 -74
  47. package/es/components/icon.js +5 -3
  48. package/es/components/loading.js +1 -1
  49. package/es/components/modal-portal.js +15 -32
  50. package/es/components/popover/color-rules/color-rule.js +137 -141
  51. package/es/components/popover/color-rules/index.js +58 -66
  52. package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
  53. package/es/components/popover/color-rules/rule-filters/index.js +50 -58
  54. package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
  55. package/es/components/popover/color-rules-popover.js +117 -121
  56. package/es/components/popover/color-selector-popover.js +60 -70
  57. package/es/components/seatable-radio/index.js +2 -2
  58. package/es/components/select/option-group.js +139 -157
  59. package/es/components/select/option.js +26 -40
  60. package/es/components/select/select.js +97 -112
  61. package/es/components/toast/alert.js +65 -80
  62. package/es/components/toast/index.js +1 -1
  63. package/es/components/toast/toast.js +76 -103
  64. package/es/components/toast/toastManager.js +57 -93
  65. package/es/components/toast/toaster.js +58 -56
  66. package/es/constants/color-rules.js +8 -5
  67. package/es/constants/dtable-select-style.js +44 -48
  68. package/es/constants/event-types.js +4 -4
  69. package/es/constants/index.js +328 -242
  70. package/es/constants/map.js +2 -2
  71. package/es/constants/model.js +20 -20
  72. package/es/constants/regions.js +1 -1
  73. package/es/constants/zIndexes.js +1 -1
  74. package/es/custom-g2.js +11 -11
  75. package/es/dashboard.js +343 -333
  76. package/es/desktop-dashboard.js +217 -224
  77. package/es/index.js +45 -58
  78. package/es/locale/index.js +3 -3
  79. package/es/locale/lang/de.js +1 -1
  80. package/es/locale/lang/en.js +7 -7
  81. package/es/locale/lang/fr.js +1 -1
  82. package/es/locale/lang/zh_CN.js +1 -1
  83. package/es/mobile-dashboard.js +76 -89
  84. package/es/model/bar-group.js +34 -44
  85. package/es/model/bar.js +26 -36
  86. package/es/model/base-model.js +11 -12
  87. package/es/model/basic-number-card.js +10 -20
  88. package/es/model/collaborators.js +10 -11
  89. package/es/model/combination.js +32 -42
  90. package/es/model/compare-bar.js +30 -40
  91. package/es/model/completeness-group.js +19 -29
  92. package/es/model/completeness.js +14 -24
  93. package/es/model/custom-bar.js +14 -24
  94. package/es/model/dashboard.js +9 -19
  95. package/es/model/generic-model.js +187 -197
  96. package/es/model/heat-map.js +16 -26
  97. package/es/model/horizontal-bar-group.js +32 -42
  98. package/es/model/horizontal-bar.js +26 -36
  99. package/es/model/index.js +31 -3
  100. package/es/model/map.js +20 -30
  101. package/es/model/mirror.js +15 -25
  102. package/es/model/pie.js +21 -31
  103. package/es/model/ring.js +23 -33
  104. package/es/model/scatter.js +11 -21
  105. package/es/model/statistic-dashboard.js +7 -8
  106. package/es/model/table.js +19 -29
  107. package/es/model/trend.js +15 -25
  108. package/es/model/world-map.js +17 -27
  109. package/es/service/chart-service.js +69 -65
  110. package/es/service/dashboard-service.js +421 -419
  111. package/es/service/map-json.js +112 -132
  112. package/es/stat-editor/chart-name-editor.js +44 -58
  113. package/es/stat-editor/index.js +59 -70
  114. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
  115. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
  116. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
  117. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
  118. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
  119. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
  120. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
  121. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
  122. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
  123. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
  124. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
  125. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
  126. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
  127. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
  128. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
  129. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
  130. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
  131. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
  132. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
  133. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
  134. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
  135. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
  136. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
  137. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
  138. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
  139. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
  140. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
  141. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
  143. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
  144. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
  148. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
  149. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
  150. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
  151. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
  152. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
  153. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
  154. package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
  155. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
  156. package/es/stat-editor/stat-settings/map/map-level.js +31 -43
  157. package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
  158. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
  159. package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
  160. package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
  161. package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
  162. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
  163. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
  164. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
  165. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
  166. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
  167. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
  168. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
  169. package/es/stat-list/chart-preview.js +85 -98
  170. package/es/stat-list/index.js +170 -178
  171. package/es/stat-view/area-chart.js +282 -274
  172. package/es/stat-view/bar-chart.js +300 -292
  173. package/es/stat-view/base-chart.js +58 -52
  174. package/es/stat-view/basic-number-card.js +115 -168
  175. package/es/stat-view/combination-chart.js +298 -334
  176. package/es/stat-view/compare-chart.js +256 -254
  177. package/es/stat-view/completeness-chart.js +194 -206
  178. package/es/stat-view/custom-bar.js +221 -223
  179. package/es/stat-view/dashboard-chart.js +122 -180
  180. package/es/stat-view/heat-map.js +268 -294
  181. package/es/stat-view/horizontal-bar-chart.js +291 -281
  182. package/es/stat-view/index.js +136 -152
  183. package/es/stat-view/line-chart.js +267 -265
  184. package/es/stat-view/map.js +246 -246
  185. package/es/stat-view/mirror.js +141 -152
  186. package/es/stat-view/pie-chart.js +143 -156
  187. package/es/stat-view/pivot-table/index.js +113 -118
  188. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
  189. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
  190. package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
  191. package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
  192. package/es/stat-view/ring-chart.js +189 -200
  193. package/es/stat-view/scatter-chart.js +162 -213
  194. package/es/stat-view/treemap-chart.js +136 -200
  195. package/es/stat-view/trend-chart.js +137 -183
  196. package/es/stat-view/world-map.js +233 -243
  197. package/es/tabs/index.js +164 -169
  198. package/es/tabs/tab.js +101 -116
  199. package/es/utils/basic-chart-utils.js +7 -9
  200. package/es/utils/cell-format.js +48 -51
  201. package/es/utils/cell-value.js +1 -1
  202. package/es/utils/collaborator.js +15 -14
  203. package/es/utils/color-utils.js +48 -37
  204. package/es/utils/column-utils.js +47 -33
  205. package/es/utils/column.js +1 -1
  206. package/es/utils/common-utils.js +111 -117
  207. package/es/utils/date-format.js +17 -17
  208. package/es/utils/export-table-utils.js +507 -396
  209. package/es/utils/index.js +6 -6
  210. package/es/utils/map.js +30 -34
  211. package/es/utils/model.js +3 -5
  212. package/es/utils/object.js +4 -4
  213. package/es/utils/pivot-table.js +20 -20
  214. package/es/utils/row-utils.js +41 -33
  215. package/es/utils/search.js +18 -20
  216. package/es/utils/sql-utils.js +132 -98
  217. package/es/utils/stat-utils.js +303 -320
  218. package/es/utils/trend-utils.js +57 -67
  219. package/package.json +2 -2
@@ -1,8 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
1
  import React, { Component, Fragment } from 'react';
7
2
  import classnames from 'classnames';
8
3
  import intl from 'react-intl-universal';
@@ -19,32 +14,31 @@ import CompletenessSetting from './completeness-chart-settings';
19
14
  import PivotTableSettings from './pivot-table-settings';
20
15
  import CustomBarSettings from './custom-bar-settings';
21
16
  import { BASIC_CHART_COLUMN_LIST, DATE_GRANULARITY, GEOLOCATION_GRANULARITY, STATISTICS_COUNT_SHOW, STAT_TYPE, TIME_COLUMN_LIST } from '../../../constants';
22
- var DATE_GRANULARITY_LIST = [DATE_GRANULARITY.DAY, DATE_GRANULARITY.WEEK, DATE_GRANULARITY.MONTH, DATE_GRANULARITY.QUARTER, DATE_GRANULARITY.YEAR];
23
- var GEOLOCATION_GRANULARITY_LIST = [GEOLOCATION_GRANULARITY.PROVINCE, GEOLOCATION_GRANULARITY.CITY, GEOLOCATION_GRANULARITY.DISTRICT];
24
- var BasicChartSettings = /*#__PURE__*/function (_Component) {
25
- _inherits(BasicChartSettings, _Component);
26
- var _super = _createSuper(BasicChartSettings);
27
- function BasicChartSettings(props) {
28
- var _this;
29
- _classCallCheck(this, BasicChartSettings);
30
- _this = _super.call(this, props);
31
- _this.setData = function (selectedTable) {
32
- _this.availableColumns = _this.getAvailableColumns(selectedTable.columns);
33
- _this.columnsOptions = _this.getColumnsOptions(_this.availableColumns);
34
- _this.generalColumnsOptions = _this.getGeneralColumnsOptions(_this.columnsOptions);
35
- _this.columnGroupbyColumnsOptions = _this.getColumnGroupbyColumnsOptions(_this.columnsOptions);
36
- var numericColumns = _this.getNumericColumns(_this.availableColumns);
37
- _this.numericColumnsOptions = _this.getColumnsOptions(numericColumns);
38
- _this.pivotTableSummaryColumnOptions = _this.getPivotTableSummaryColumnOptions(_this.availableColumns);
17
+ const DATE_GRANULARITY_LIST = [DATE_GRANULARITY.DAY, DATE_GRANULARITY.WEEK, DATE_GRANULARITY.MONTH, DATE_GRANULARITY.QUARTER, DATE_GRANULARITY.YEAR];
18
+ const GEOLOCATION_GRANULARITY_LIST = [GEOLOCATION_GRANULARITY.PROVINCE, GEOLOCATION_GRANULARITY.CITY, GEOLOCATION_GRANULARITY.DISTRICT];
19
+ class BasicChartSettings extends Component {
20
+ constructor(props) {
21
+ super(props);
22
+ this.setData = selectedTable => {
23
+ this.availableColumns = this.getAvailableColumns(selectedTable.columns);
24
+ this.columnsOptions = this.getColumnsOptions(this.availableColumns);
25
+ this.generalColumnsOptions = this.getGeneralColumnsOptions(this.columnsOptions);
26
+ this.columnGroupbyColumnsOptions = this.getColumnGroupbyColumnsOptions(this.columnsOptions);
27
+ const numericColumns = this.getNumericColumns(this.availableColumns);
28
+ this.numericColumnsOptions = this.getColumnsOptions(numericColumns);
29
+ this.pivotTableSummaryColumnOptions = this.getPivotTableSummaryColumnOptions(this.availableColumns);
39
30
  };
40
- _this.renderIncludeEmpty = function () {
41
- var statItem = _this.props.statItem;
42
- var _ref = statItem || {},
43
- type = _ref.type,
44
- groupby_include_empty_cells = _ref.groupby_include_empty_cells,
45
- x_axis_include_empty = _ref.x_axis_include_empty,
46
- vertical_axis_include_empty = _ref.vertical_axis_include_empty;
47
- var includeEmptyCells;
31
+ this.renderIncludeEmpty = () => {
32
+ const {
33
+ statItem
34
+ } = this.props;
35
+ const {
36
+ type,
37
+ groupby_include_empty_cells,
38
+ x_axis_include_empty,
39
+ vertical_axis_include_empty
40
+ } = statItem || {};
41
+ let includeEmptyCells;
48
42
  if (type === STAT_TYPE.PIE || type === STAT_TYPE.RING || type === STAT_TYPE.TREEMAP || type === STAT_TYPE.PIVOT_TABLE) {
49
43
  includeEmptyCells = groupby_include_empty_cells;
50
44
  } else if (type === STAT_TYPE.HORIZONTAL_BAR || type === STAT_TYPE.HORIZONTAL_GROUP_BAR || type === STAT_TYPE.STACKED_HORIZONTAL_BAR) {
@@ -56,31 +50,29 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
56
50
  className: "mt-1"
57
51
  }, /*#__PURE__*/React.createElement(ToggleSetting, {
58
52
  isChecked: includeEmptyCells || false,
59
- handleToggleChange: _this.onToggleIncludeEmpty,
53
+ handleToggleChange: this.onToggleIncludeEmpty,
60
54
  label: intl.get('Including_empty_cell')
61
55
  }));
62
56
  };
63
- _this.getAvailableColumns = function (columns) {
57
+ this.getAvailableColumns = columns => {
64
58
  if (!columns || !Array.isArray(columns)) return [];
65
- return columns.filter(function (column) {
66
- return BASIC_CHART_COLUMN_LIST.includes(column.type);
67
- });
59
+ return columns.filter(column => BASIC_CHART_COLUMN_LIST.includes(column.type));
68
60
  };
69
- _this.getPivotTableSummaryColumnOptions = function (columns) {
70
- var summaryColumns = columns.filter(function (column) {
61
+ this.getPivotTableSummaryColumnOptions = columns => {
62
+ const summaryColumns = columns.filter(column => {
71
63
  return column && (isNumericColumn(column) || TIME_COLUMN_LIST.includes(column.type));
72
64
  });
73
- return _this.getColumnsOptions(summaryColumns);
65
+ return this.getColumnsOptions(summaryColumns);
74
66
  };
75
- _this.getColumnsOptions = function (columns) {
67
+ this.getColumnsOptions = columns => {
76
68
  if (!Array.isArray(columns)) return [];
77
- return columns.map(function (column) {
78
- var option = COLUMN_OPTIONS.find(function (o) {
79
- return o.type === column.type;
80
- }) || {};
81
- var name = column.name,
82
- key = column.key,
83
- type = column.type;
69
+ return columns.map(column => {
70
+ let option = COLUMN_OPTIONS.find(o => o.type === column.type) || {};
71
+ const {
72
+ name,
73
+ key,
74
+ type
75
+ } = column;
84
76
  return {
85
77
  label: /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
86
78
  className: "header-icon"
@@ -90,16 +82,18 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
90
82
  className: "select-option-name"
91
83
  }, name)),
92
84
  value: {
93
- name: name,
94
- key: key,
95
- type: type
85
+ name,
86
+ key,
87
+ type
96
88
  }
97
89
  };
98
90
  });
99
91
  };
100
- _this.getGeneralColumnsOptions = function (columnsOptions) {
101
- var statItem = _this.props.statItem;
102
- var list = _toConsumableArray(columnsOptions);
92
+ this.getGeneralColumnsOptions = columnsOptions => {
93
+ const {
94
+ statItem
95
+ } = this.props;
96
+ const list = [...columnsOptions];
103
97
  if (statItem.type === STAT_TYPE.PIVOT_TABLE) {
104
98
  list.unshift({
105
99
  label: /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
@@ -117,29 +111,23 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
117
111
  }
118
112
  return list;
119
113
  };
120
- _this.getColumnGroupbyColumnsOptions = function (columnsOptions) {
121
- var statItem = _this.props.statItem || {};
122
- var availableOptions = columnsOptions.filter(function (o) {
123
- return o.value.key !== statItem.x_axis_column_key;
124
- });
114
+ this.getColumnGroupbyColumnsOptions = columnsOptions => {
115
+ let statItem = this.props.statItem || {};
116
+ let availableOptions = columnsOptions.filter(o => o.value.key !== statItem.x_axis_column_key);
125
117
  return availableOptions;
126
118
  };
127
- _this.getNumericColumns = function (columns) {
119
+ this.getNumericColumns = columns => {
128
120
  if (!columns) return [];
129
- return columns.filter(function (column) {
130
- return column && isNumericColumn(column);
131
- });
121
+ return columns.filter(column => column && isNumericColumn(column));
132
122
  };
133
- _this.getSelectedColumnOption = function (key, columnsOptions) {
123
+ this.getSelectedColumnOption = (key, columnsOptions) => {
134
124
  if (!key || !Array.isArray(columnsOptions) || columnsOptions.length === 0) {
135
125
  return null;
136
126
  }
137
- return columnsOptions.find(function (o) {
138
- return o.value.key === key;
139
- }) || columnsOptions[0];
127
+ return columnsOptions.find(o => o.value.key === key) || columnsOptions[0];
140
128
  };
141
- _this.getGranularityOptions = function (options) {
142
- return options.map(function (g) {
129
+ this.getGranularityOptions = options => {
130
+ return options.map(g => {
143
131
  return {
144
132
  value: g,
145
133
  label: /*#__PURE__*/React.createElement("span", {
@@ -148,18 +136,20 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
148
136
  };
149
137
  });
150
138
  };
151
- _this.getSettingsByType = function () {
152
- var _this$props = _this.props,
153
- statItem = _this$props.statItem,
154
- labelColorConfigs = _this$props.labelColorConfigs,
155
- eventBus = _this$props.eventBus,
156
- getTableById = _this$props.getTableById,
157
- getTables = _this$props.getTables,
158
- getViews = _this$props.getViews;
159
- var _this$state = _this.state,
160
- selectedTable = _this$state.selectedTable,
161
- settingType = _this$state.settingType;
162
- var type = statItem.type;
139
+ this.getSettingsByType = () => {
140
+ const {
141
+ statItem,
142
+ labelColorConfigs,
143
+ eventBus,
144
+ getTableById,
145
+ getTables,
146
+ getViews
147
+ } = this.props;
148
+ const {
149
+ selectedTable,
150
+ settingType
151
+ } = this.state;
152
+ const type = statItem.type;
163
153
  switch (statItem.type) {
164
154
  case STAT_TYPE.BAR:
165
155
  case STAT_TYPE.LINE:
@@ -174,15 +164,15 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
174
164
  getViews: getViews,
175
165
  getTableById: getTableById,
176
166
  selectedTable: selectedTable,
177
- generalColumnsOptions: _this.generalColumnsOptions,
178
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
179
- numericColumnsOptions: _this.numericColumnsOptions,
180
- dateGranularityOptions: _this.dateGranularityOptions,
181
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
182
- getSelectedColumnOption: _this.getSelectedColumnOption,
183
- getConvertedChart: _this.props.getConvertedChart,
184
- updateStatItem: _this.props.updateStatItem,
185
- renderIncludeEmpty: _this.renderIncludeEmpty
167
+ generalColumnsOptions: this.generalColumnsOptions,
168
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
169
+ numericColumnsOptions: this.numericColumnsOptions,
170
+ dateGranularityOptions: this.dateGranularityOptions,
171
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
172
+ getSelectedColumnOption: this.getSelectedColumnOption,
173
+ getConvertedChart: this.props.getConvertedChart,
174
+ updateStatItem: this.props.updateStatItem,
175
+ renderIncludeEmpty: this.renderIncludeEmpty
186
176
  });
187
177
  }
188
178
  case STAT_TYPE.COMPARE_BAR:
@@ -196,12 +186,12 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
196
186
  getViews: getViews,
197
187
  getTableById: getTableById,
198
188
  selectedTable: selectedTable,
199
- generalColumnsOptions: _this.generalColumnsOptions,
200
- numericColumnsOptions: _this.numericColumnsOptions,
201
- dateGranularityOptions: _this.dateGranularityOptions,
202
- getSelectedColumnOption: _this.getSelectedColumnOption,
203
- getConvertedChart: _this.props.getConvertedChart,
204
- updateStatItem: _this.props.updateStatItem
189
+ generalColumnsOptions: this.generalColumnsOptions,
190
+ numericColumnsOptions: this.numericColumnsOptions,
191
+ dateGranularityOptions: this.dateGranularityOptions,
192
+ getSelectedColumnOption: this.getSelectedColumnOption,
193
+ getConvertedChart: this.props.getConvertedChart,
194
+ updateStatItem: this.props.updateStatItem
205
195
  });
206
196
  }
207
197
  case STAT_TYPE.BAR_GROUP:
@@ -219,15 +209,15 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
219
209
  getViews: getViews,
220
210
  getTableById: getTableById,
221
211
  selectedTable: selectedTable,
222
- generalColumnsOptions: _this.generalColumnsOptions,
223
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
224
- numericColumnsOptions: _this.numericColumnsOptions,
225
- dateGranularityOptions: _this.dateGranularityOptions,
226
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
227
- getSelectedColumnOption: _this.getSelectedColumnOption,
228
- getConvertedChart: _this.props.getConvertedChart,
229
- updateStatItem: _this.props.updateStatItem,
230
- renderIncludeEmpty: _this.renderIncludeEmpty
212
+ generalColumnsOptions: this.generalColumnsOptions,
213
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
214
+ numericColumnsOptions: this.numericColumnsOptions,
215
+ dateGranularityOptions: this.dateGranularityOptions,
216
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
217
+ getSelectedColumnOption: this.getSelectedColumnOption,
218
+ getConvertedChart: this.props.getConvertedChart,
219
+ updateStatItem: this.props.updateStatItem,
220
+ renderIncludeEmpty: this.renderIncludeEmpty
231
221
  });
232
222
  }
233
223
  case STAT_TYPE.CUSTOM_BAR:
@@ -242,14 +232,14 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
242
232
  getViews: getViews,
243
233
  getTableById: getTableById,
244
234
  selectedTable: selectedTable,
245
- generalColumnsOptions: _this.generalColumnsOptions,
246
- numericColumnsOptions: _this.numericColumnsOptions,
247
- dateGranularityOptions: _this.dateGranularityOptions,
248
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
249
- getSelectedColumnOption: _this.getSelectedColumnOption,
250
- getConvertedChart: _this.props.getConvertedChart,
251
- updateStatItem: _this.props.updateStatItem,
252
- renderIncludeEmpty: _this.renderIncludeEmpty
235
+ generalColumnsOptions: this.generalColumnsOptions,
236
+ numericColumnsOptions: this.numericColumnsOptions,
237
+ dateGranularityOptions: this.dateGranularityOptions,
238
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
239
+ getSelectedColumnOption: this.getSelectedColumnOption,
240
+ getConvertedChart: this.props.getConvertedChart,
241
+ updateStatItem: this.props.updateStatItem,
242
+ renderIncludeEmpty: this.renderIncludeEmpty
253
243
  });
254
244
  }
255
245
  case STAT_TYPE.PIE:
@@ -265,14 +255,14 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
265
255
  getViews: getViews,
266
256
  getTableById: getTableById,
267
257
  selectedTable: selectedTable,
268
- getConvertedChart: _this.props.getConvertedChart,
269
- columnsOptions: _this.generalColumnsOptions,
270
- numericColumnsOptions: _this.numericColumnsOptions,
271
- dateGranularityOptions: _this.dateGranularityOptions,
272
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
273
- getSelectedColumnOption: _this.getSelectedColumnOption,
274
- updateStatisticsSettings: _this.props.updateStatItem,
275
- renderIncludeEmpty: _this.renderIncludeEmpty
258
+ getConvertedChart: this.props.getConvertedChart,
259
+ columnsOptions: this.generalColumnsOptions,
260
+ numericColumnsOptions: this.numericColumnsOptions,
261
+ dateGranularityOptions: this.dateGranularityOptions,
262
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
263
+ getSelectedColumnOption: this.getSelectedColumnOption,
264
+ updateStatisticsSettings: this.props.updateStatItem,
265
+ renderIncludeEmpty: this.renderIncludeEmpty
276
266
  });
277
267
  }
278
268
  case STAT_TYPE.SCATTER:
@@ -285,12 +275,12 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
285
275
  getTables: getTables,
286
276
  getViews: getViews,
287
277
  getTableById: getTableById,
288
- getConvertedChart: _this.props.getConvertedChart,
289
- numericColumnsOptions: _this.numericColumnsOptions,
290
- generalColumnsOptions: _this.generalColumnsOptions,
291
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
292
- getSelectedColumnOption: _this.getSelectedColumnOption,
293
- updateStatItem: _this.props.updateStatItem
278
+ getConvertedChart: this.props.getConvertedChart,
279
+ numericColumnsOptions: this.numericColumnsOptions,
280
+ generalColumnsOptions: this.generalColumnsOptions,
281
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
282
+ getSelectedColumnOption: this.getSelectedColumnOption,
283
+ updateStatItem: this.props.updateStatItem
294
284
  });
295
285
  }
296
286
  case STAT_TYPE.HORIZONTAL_BAR:
@@ -304,15 +294,15 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
304
294
  getViews: getViews,
305
295
  getTableById: getTableById,
306
296
  selectedTable: selectedTable,
307
- getConvertedChart: _this.props.getConvertedChart,
308
- generalColumnsOptions: _this.generalColumnsOptions,
309
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
310
- numericColumnsOptions: _this.numericColumnsOptions,
311
- dateGranularityOptions: _this.dateGranularityOptions,
312
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
313
- getSelectedColumnOption: _this.getSelectedColumnOption,
314
- updateStatItem: _this.props.updateStatItem,
315
- renderIncludeEmpty: _this.renderIncludeEmpty
297
+ getConvertedChart: this.props.getConvertedChart,
298
+ generalColumnsOptions: this.generalColumnsOptions,
299
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
300
+ numericColumnsOptions: this.numericColumnsOptions,
301
+ dateGranularityOptions: this.dateGranularityOptions,
302
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
303
+ getSelectedColumnOption: this.getSelectedColumnOption,
304
+ updateStatItem: this.props.updateStatItem,
305
+ renderIncludeEmpty: this.renderIncludeEmpty
316
306
  });
317
307
  }
318
308
  case STAT_TYPE.HORIZONTAL_GROUP_BAR:
@@ -327,15 +317,15 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
327
317
  getViews: getViews,
328
318
  getTableById: getTableById,
329
319
  selectedTable: selectedTable,
330
- generalColumnsOptions: _this.generalColumnsOptions,
331
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
332
- numericColumnsOptions: _this.numericColumnsOptions,
333
- dateGranularityOptions: _this.dateGranularityOptions,
334
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
335
- getSelectedColumnOption: _this.getSelectedColumnOption,
336
- updateStatItem: _this.props.updateStatItem,
337
- getConvertedChart: _this.props.getConvertedChart,
338
- renderIncludeEmpty: _this.renderIncludeEmpty
320
+ generalColumnsOptions: this.generalColumnsOptions,
321
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
322
+ numericColumnsOptions: this.numericColumnsOptions,
323
+ dateGranularityOptions: this.dateGranularityOptions,
324
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
325
+ getSelectedColumnOption: this.getSelectedColumnOption,
326
+ updateStatItem: this.props.updateStatItem,
327
+ getConvertedChart: this.props.getConvertedChart,
328
+ renderIncludeEmpty: this.renderIncludeEmpty
339
329
  });
340
330
  }
341
331
  case STAT_TYPE.COMPLETENESS_CHART:
@@ -349,15 +339,15 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
349
339
  getTables: getTables,
350
340
  getViews: getViews,
351
341
  getTableById: getTableById,
352
- getConvertedChart: _this.props.getConvertedChart,
342
+ getConvertedChart: this.props.getConvertedChart,
353
343
  selectedTable: selectedTable,
354
- generalColumnsOptions: _this.generalColumnsOptions,
355
- numericColumnsOptions: _this.numericColumnsOptions,
356
- updateStatItem: _this.props.updateStatItem,
357
- getSelectedColumnOption: _this.getSelectedColumnOption,
358
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
359
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
360
- dateGranularityOptions: _this.dateGranularityOptions
344
+ generalColumnsOptions: this.generalColumnsOptions,
345
+ numericColumnsOptions: this.numericColumnsOptions,
346
+ updateStatItem: this.props.updateStatItem,
347
+ getSelectedColumnOption: this.getSelectedColumnOption,
348
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
349
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
350
+ dateGranularityOptions: this.dateGranularityOptions
361
351
  });
362
352
  }
363
353
  case STAT_TYPE.PIVOT_TABLE:
@@ -370,16 +360,16 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
370
360
  getTables: getTables,
371
361
  getViews: getViews,
372
362
  getTableById: getTableById,
373
- getConvertedChart: _this.props.getConvertedChart,
363
+ getConvertedChart: this.props.getConvertedChart,
374
364
  selectedTable: selectedTable,
375
- generalColumnsOptions: _this.generalColumnsOptions,
376
- pivotTableSummaryColumnOptions: _this.pivotTableSummaryColumnOptions,
377
- updateStatItem: _this.props.updateStatItem,
378
- getSelectedColumnOption: _this.getSelectedColumnOption,
379
- columnGroupbyColumnsOptions: _this.columnGroupbyColumnsOptions,
380
- geolocationGranularityOptions: _this.geolocationGranularityOptions,
381
- dateGranularityOptions: _this.dateGranularityOptions,
382
- renderIncludeEmpty: _this.renderIncludeEmpty
365
+ generalColumnsOptions: this.generalColumnsOptions,
366
+ pivotTableSummaryColumnOptions: this.pivotTableSummaryColumnOptions,
367
+ updateStatItem: this.props.updateStatItem,
368
+ getSelectedColumnOption: this.getSelectedColumnOption,
369
+ columnGroupbyColumnsOptions: this.columnGroupbyColumnsOptions,
370
+ geolocationGranularityOptions: this.geolocationGranularityOptions,
371
+ dateGranularityOptions: this.dateGranularityOptions,
372
+ renderIncludeEmpty: this.renderIncludeEmpty
383
373
  });
384
374
  }
385
375
  default:
@@ -388,14 +378,17 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
388
378
  }
389
379
  }
390
380
  };
391
- _this.onToggleIncludeEmpty = function () {
392
- var statItem = _this.props.statItem;
393
- var _ref2 = statItem || {},
394
- type = _ref2.type,
395
- groupby_include_empty_cells = _ref2.groupby_include_empty_cells,
396
- x_axis_include_empty = _ref2.x_axis_include_empty,
397
- vertical_axis_include_empty = _ref2.vertical_axis_include_empty;
398
- var updated;
381
+ this.onToggleIncludeEmpty = () => {
382
+ let {
383
+ statItem
384
+ } = this.props;
385
+ let {
386
+ type,
387
+ groupby_include_empty_cells,
388
+ x_axis_include_empty,
389
+ vertical_axis_include_empty
390
+ } = statItem || {};
391
+ let updated;
399
392
  if (type === STAT_TYPE.PIE || type === STAT_TYPE.RING || type === STAT_TYPE.TREEMAP || type === STAT_TYPE.PIVOT_TABLE) {
400
393
  updated = {
401
394
  groupby_include_empty_cells: !groupby_include_empty_cells
@@ -409,68 +402,64 @@ var BasicChartSettings = /*#__PURE__*/function (_Component) {
409
402
  x_axis_include_empty: !x_axis_include_empty
410
403
  };
411
404
  }
412
- _this.props.updateStatItem(Object.assign({}, statItem, updated));
405
+ this.props.updateStatItem(Object.assign({}, statItem, updated));
413
406
  };
414
- _this.selectEditType = function (type) {
415
- _this.setState({
407
+ this.selectEditType = type => {
408
+ this.setState({
416
409
  settingType: type
417
410
  });
418
411
  };
419
- var _getTableById = props.getTableById,
420
- _statItem = props.statItem;
421
- var _selectedTable = _getTableById(_statItem.table_id);
422
- _this.state = {
412
+ const {
413
+ getTableById: _getTableById,
414
+ statItem: _statItem
415
+ } = props;
416
+ let _selectedTable = _getTableById(_statItem.table_id);
417
+ this.state = {
423
418
  selectedTable: _selectedTable,
424
419
  settingType: 'data'
425
420
  };
426
- _this.setData(_selectedTable);
427
- _this.dateGranularityOptions = _this.getGranularityOptions(DATE_GRANULARITY_LIST);
428
- _this.geolocationGranularityOptions = _this.getGranularityOptions(GEOLOCATION_GRANULARITY_LIST);
429
- return _this;
421
+ this.setData(_selectedTable);
422
+ this.dateGranularityOptions = this.getGranularityOptions(DATE_GRANULARITY_LIST);
423
+ this.geolocationGranularityOptions = this.getGranularityOptions(GEOLOCATION_GRANULARITY_LIST);
430
424
  }
431
- _createClass(BasicChartSettings, [{
432
- key: "UNSAFE_componentWillReceiveProps",
433
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
434
- var getTableById = this.props.getTableById;
435
- if (nextProps.statItem.table_id !== this.props.statItem.table_id) {
436
- var statItem = nextProps.statItem;
437
- var selectedTable = getTableById(statItem.table_id);
438
- this.setState({
439
- selectedTable: selectedTable
440
- });
441
- this.setData(selectedTable);
442
- }
443
- }
444
- }, {
445
- key: "render",
446
- value: function render() {
447
- var _this2 = this;
448
- var settingType = this.state.settingType;
449
- return /*#__PURE__*/React.createElement("div", {
450
- className: "statistic-chart-settings"
451
- }, /*#__PURE__*/React.createElement("div", {
452
- className: "statistic-chart-settings-type"
453
- }, /*#__PURE__*/React.createElement("div", {
454
- onClick: function onClick() {
455
- return _this2.selectEditType('data');
456
- },
457
- className: classnames('statistic-type-item', {
458
- 'selected-statistic-type-item': settingType === 'data'
459
- })
460
- }, intl.get('Data_settings')), /*#__PURE__*/React.createElement("div", {
461
- onClick: function onClick() {
462
- return _this2.selectEditType('style');
463
- },
464
- className: classnames('statistic-type-item', {
465
- 'selected-statistic-type-item': settingType === 'style'
466
- })
467
- }, intl.get('Style_settings'))), /*#__PURE__*/React.createElement("div", {
468
- className: "statistic-chart-settings-container"
469
- }, /*#__PURE__*/React.createElement("div", {
470
- className: "statistic-chart-settings-parameter-list pt-4"
471
- }, this.getSettingsByType())));
425
+ UNSAFE_componentWillReceiveProps(nextProps) {
426
+ const {
427
+ getTableById
428
+ } = this.props;
429
+ if (nextProps.statItem.table_id !== this.props.statItem.table_id) {
430
+ const {
431
+ statItem
432
+ } = nextProps;
433
+ const selectedTable = getTableById(statItem.table_id);
434
+ this.setState({
435
+ selectedTable
436
+ });
437
+ this.setData(selectedTable);
472
438
  }
473
- }]);
474
- return BasicChartSettings;
475
- }(Component);
439
+ }
440
+ render() {
441
+ const {
442
+ settingType
443
+ } = this.state;
444
+ return /*#__PURE__*/React.createElement("div", {
445
+ className: "statistic-chart-settings"
446
+ }, /*#__PURE__*/React.createElement("div", {
447
+ className: "statistic-chart-settings-type"
448
+ }, /*#__PURE__*/React.createElement("div", {
449
+ onClick: () => this.selectEditType('data'),
450
+ className: classnames('statistic-type-item', {
451
+ 'selected-statistic-type-item': settingType === 'data'
452
+ })
453
+ }, intl.get('Data_settings')), /*#__PURE__*/React.createElement("div", {
454
+ onClick: () => this.selectEditType('style'),
455
+ className: classnames('statistic-type-item', {
456
+ 'selected-statistic-type-item': settingType === 'style'
457
+ })
458
+ }, intl.get('Style_settings'))), /*#__PURE__*/React.createElement("div", {
459
+ className: "statistic-chart-settings-container"
460
+ }, /*#__PURE__*/React.createElement("div", {
461
+ className: "statistic-chart-settings-parameter-list pt-4"
462
+ }, this.getSettingsByType())));
463
+ }
464
+ }
476
465
  export default BasicChartSettings;