dtable-statistic 4.0.2-test-2

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